@betrue/openclaw-claude-code-plugin 1.0.0 → 1.0.2

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 ADDED
@@ -0,0 +1,99 @@
1
+ var Hf=Object.create;var Zi=Object.defineProperty;var Gf=Object.getOwnPropertyDescriptor;var Yf=Object.getOwnPropertyNames;var Jf=Object.getPrototypeOf,Qf=Object.prototype.hasOwnProperty;var Wi=(e,t)=>{for(var r in t)Zi(e,r,{get:t[r],enumerable:!0})},Oa=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Yf(t))!Qf.call(e,i)&&i!==r&&Zi(e,i,{get:()=>t[i],enumerable:!(n=Gf(t,i))||n.enumerable});return e};var Ca=(e,t,r)=>(r=e!=null?Hf(Jf(e)):{},Oa(t||!e||!e.__esModule?Zi(r,"default",{value:e,enumerable:!0}):r,e)),Xf=e=>Oa(Zi({},"__esModule",{value:!0}),e);var sk={};Wi(sk,{register:()=>ik});module.exports=Xf(sk);var yt={};Wi(yt,{HasPropertyKey:()=>Bi,IsArray:()=>Xe,IsAsyncIterator:()=>Gs,IsBigInt:()=>oi,IsBoolean:()=>br,IsDate:()=>Gr,IsFunction:()=>Ys,IsIterator:()=>Js,IsNull:()=>Qs,IsNumber:()=>At,IsObject:()=>Oe,IsRegExp:()=>ai,IsString:()=>Ne,IsSymbol:()=>Xs,IsUint8Array:()=>wr,IsUndefined:()=>et});function Bi(e,t){return t in e}function Gs(e){return Oe(e)&&!Xe(e)&&!wr(e)&&Symbol.asyncIterator in e}function Xe(e){return Array.isArray(e)}function oi(e){return typeof e=="bigint"}function br(e){return typeof e=="boolean"}function Gr(e){return e instanceof globalThis.Date}function Ys(e){return typeof e=="function"}function Js(e){return Oe(e)&&!Xe(e)&&!wr(e)&&Symbol.iterator in e}function Qs(e){return e===null}function At(e){return typeof e=="number"}function Oe(e){return typeof e=="object"&&e!==null}function ai(e){return e instanceof globalThis.RegExp}function Ne(e){return typeof e=="string"}function Xs(e){return typeof e=="symbol"}function wr(e){return e instanceof globalThis.Uint8Array}function et(e){return e===void 0}function ep(e){return e.map(t=>Hi(t))}function tp(e){return new Date(e.getTime())}function rp(e){return new Uint8Array(e)}function np(e){return new RegExp(e.source,e.flags)}function ip(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=Hi(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=Hi(e[r]);return t}function Hi(e){return Xe(e)?ep(e):Gr(e)?tp(e):wr(e)?rp(e):ai(e)?np(e):Oe(e)?ip(e):e}function Ue(e){return Hi(e)}function mn(e,t){return t===void 0?Ue(e):Ue({...t,...e})}function Ea(e){return e!==null&&typeof e=="object"}function Ra(e){return globalThis.Array.isArray(e)&&!globalThis.ArrayBuffer.isView(e)}function Na(e){return e===void 0}function ja(e){return typeof e=="number"}var Gi;(function(e){e.InstanceMode="default",e.ExactOptionalPropertyTypes=!1,e.AllowArrayObject=!1,e.AllowNaN=!1,e.AllowNullVoid=!1;function t(o,a){return e.ExactOptionalPropertyTypes?a in o:o[a]!==void 0}e.IsExactOptionalProperty=t;function r(o){let a=Ea(o);return e.AllowArrayObject?a:a&&!Ra(o)}e.IsObjectLike=r;function n(o){return r(o)&&!(o instanceof Date)&&!(o instanceof Uint8Array)}e.IsRecordLike=n;function i(o){return e.AllowNaN?ja(o):Number.isFinite(o)}e.IsNumberLike=i;function s(o){let a=Na(o);return e.AllowNullVoid?a||o===null:a}e.IsVoidLike=s})(Gi||(Gi={}));function sp(e){return globalThis.Object.freeze(e).map(t=>ui(t))}function op(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=ui(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=ui(e[r]);return globalThis.Object.freeze(t)}function ui(e){return Xe(e)?sp(e):Gr(e)?e:wr(e)?e:ai(e)?e:Oe(e)?op(e):e}function N(e,t){let r=t!==void 0?{...t,...e}:e;switch(Gi.InstanceMode){case"freeze":return ui(r);case"clone":return Ue(r);default:return r}}var ct=class extends Error{constructor(t){super(t)}};var nt=Symbol.for("TypeBox.Transform"),Xt=Symbol.for("TypeBox.Readonly"),mt=Symbol.for("TypeBox.Optional"),Vt=Symbol.for("TypeBox.Hint"),V=Symbol.for("TypeBox.Kind");function hn(e){return Oe(e)&&e[Xt]==="Readonly"}function Pt(e){return Oe(e)&&e[mt]==="Optional"}function eo(e){return ve(e,"Any")}function to(e){return ve(e,"Argument")}function er(e){return ve(e,"Array")}function Yr(e){return ve(e,"AsyncIterator")}function Jr(e){return ve(e,"BigInt")}function Ir(e){return ve(e,"Boolean")}function tr(e){return ve(e,"Computed")}function rr(e){return ve(e,"Constructor")}function ap(e){return ve(e,"Date")}function nr(e){return ve(e,"Function")}function ir(e){return ve(e,"Integer")}function We(e){return ve(e,"Intersect")}function Qr(e){return ve(e,"Iterator")}function ve(e,t){return Oe(e)&&V in e&&e[V]===t}function Yi(e){return br(e)||At(e)||Ne(e)}function Mt(e){return ve(e,"Literal")}function Ft(e){return ve(e,"MappedKey")}function De(e){return ve(e,"MappedResult")}function Nr(e){return ve(e,"Never")}function up(e){return ve(e,"Not")}function li(e){return ve(e,"Null")}function sr(e){return ve(e,"Number")}function tt(e){return ve(e,"Object")}function Xr(e){return ve(e,"Promise")}function en(e){return ve(e,"Record")}function Qe(e){return ve(e,"Ref")}function ro(e){return ve(e,"RegExp")}function $r(e){return ve(e,"String")}function di(e){return ve(e,"Symbol")}function zt(e){return ve(e,"TemplateLiteral")}function lp(e){return ve(e,"This")}function jr(e){return Oe(e)&&nt in e}function Ut(e){return ve(e,"Tuple")}function ci(e){return ve(e,"Undefined")}function be(e){return ve(e,"Union")}function dp(e){return ve(e,"Uint8Array")}function cp(e){return ve(e,"Unknown")}function fp(e){return ve(e,"Unsafe")}function pp(e){return ve(e,"Void")}function mp(e){return Oe(e)&&V in e&&Ne(e[V])}function Dt(e){return eo(e)||to(e)||er(e)||Ir(e)||Jr(e)||Yr(e)||tr(e)||rr(e)||ap(e)||nr(e)||ir(e)||We(e)||Qr(e)||Mt(e)||Ft(e)||De(e)||Nr(e)||up(e)||li(e)||sr(e)||tt(e)||Xr(e)||en(e)||Qe(e)||ro(e)||$r(e)||di(e)||zt(e)||lp(e)||Ut(e)||ci(e)||be(e)||dp(e)||cp(e)||fp(e)||pp(e)||mp(e)}var S={};Wi(S,{IsAny:()=>za,IsArgument:()=>Ua,IsArray:()=>Da,IsAsyncIterator:()=>qa,IsBigInt:()=>La,IsBoolean:()=>Ka,IsComputed:()=>Va,IsConstructor:()=>Za,IsDate:()=>Wa,IsFunction:()=>Ba,IsImport:()=>bp,IsInteger:()=>Ha,IsIntersect:()=>Ga,IsIterator:()=>Ya,IsKind:()=>Iu,IsKindOf:()=>ge,IsLiteral:()=>pi,IsLiteralBoolean:()=>wp,IsLiteralNumber:()=>Qa,IsLiteralString:()=>Ja,IsLiteralValue:()=>Xa,IsMappedKey:()=>eu,IsMappedResult:()=>tu,IsNever:()=>ru,IsNot:()=>nu,IsNull:()=>iu,IsNumber:()=>su,IsObject:()=>ou,IsOptional:()=>_p,IsPromise:()=>au,IsProperties:()=>Ji,IsReadonly:()=>vp,IsRecord:()=>uu,IsRecursive:()=>Ip,IsRef:()=>lu,IsRegExp:()=>du,IsSchema:()=>ft,IsString:()=>cu,IsSymbol:()=>fu,IsTemplateLiteral:()=>pu,IsThis:()=>mu,IsTransform:()=>hu,IsTuple:()=>gu,IsUint8Array:()=>vu,IsUndefined:()=>yu,IsUnion:()=>oo,IsUnionLiteral:()=>$p,IsUnknown:()=>_u,IsUnsafe:()=>bu,IsVoid:()=>wu,TypeGuardUnknownTypeError:()=>no});var no=class extends ct{},hp=["Argument","Any","Array","AsyncIterator","BigInt","Boolean","Computed","Constructor","Date","Enum","Function","Integer","Intersect","Iterator","Literal","MappedKey","MappedResult","Not","Null","Number","Object","Promise","Record","Ref","RegExp","String","Symbol","TemplateLiteral","This","Tuple","Undefined","Union","Uint8Array","Unknown","Void"];function Aa(e){try{return new RegExp(e),!0}catch{return!1}}function io(e){if(!Ne(e))return!1;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r>=7&&r<=13||r===27||r===127)return!1}return!0}function Ma(e){return so(e)||ft(e)}function fi(e){return et(e)||oi(e)}function je(e){return et(e)||At(e)}function so(e){return et(e)||br(e)}function Ce(e){return et(e)||Ne(e)}function gp(e){return et(e)||Ne(e)&&io(e)&&Aa(e)}function yp(e){return et(e)||Ne(e)&&io(e)}function Fa(e){return et(e)||ft(e)}function vp(e){return Oe(e)&&e[Xt]==="Readonly"}function _p(e){return Oe(e)&&e[mt]==="Optional"}function za(e){return ge(e,"Any")&&Ce(e.$id)}function Ua(e){return ge(e,"Argument")&&At(e.index)}function Da(e){return ge(e,"Array")&&e.type==="array"&&Ce(e.$id)&&ft(e.items)&&je(e.minItems)&&je(e.maxItems)&&so(e.uniqueItems)&&Fa(e.contains)&&je(e.minContains)&&je(e.maxContains)}function qa(e){return ge(e,"AsyncIterator")&&e.type==="AsyncIterator"&&Ce(e.$id)&&ft(e.items)}function La(e){return ge(e,"BigInt")&&e.type==="bigint"&&Ce(e.$id)&&fi(e.exclusiveMaximum)&&fi(e.exclusiveMinimum)&&fi(e.maximum)&&fi(e.minimum)&&fi(e.multipleOf)}function Ka(e){return ge(e,"Boolean")&&e.type==="boolean"&&Ce(e.$id)}function Va(e){return ge(e,"Computed")&&Ne(e.target)&&Xe(e.parameters)&&e.parameters.every(t=>ft(t))}function Za(e){return ge(e,"Constructor")&&e.type==="Constructor"&&Ce(e.$id)&&Xe(e.parameters)&&e.parameters.every(t=>ft(t))&&ft(e.returns)}function Wa(e){return ge(e,"Date")&&e.type==="Date"&&Ce(e.$id)&&je(e.exclusiveMaximumTimestamp)&&je(e.exclusiveMinimumTimestamp)&&je(e.maximumTimestamp)&&je(e.minimumTimestamp)&&je(e.multipleOfTimestamp)}function Ba(e){return ge(e,"Function")&&e.type==="Function"&&Ce(e.$id)&&Xe(e.parameters)&&e.parameters.every(t=>ft(t))&&ft(e.returns)}function bp(e){return ge(e,"Import")&&Bi(e,"$defs")&&Oe(e.$defs)&&Ji(e.$defs)&&Bi(e,"$ref")&&Ne(e.$ref)&&e.$ref in e.$defs}function Ha(e){return ge(e,"Integer")&&e.type==="integer"&&Ce(e.$id)&&je(e.exclusiveMaximum)&&je(e.exclusiveMinimum)&&je(e.maximum)&&je(e.minimum)&&je(e.multipleOf)}function Ji(e){return Oe(e)&&Object.entries(e).every(([t,r])=>io(t)&&ft(r))}function Ga(e){return ge(e,"Intersect")&&!(Ne(e.type)&&e.type!=="object")&&Xe(e.allOf)&&e.allOf.every(t=>ft(t)&&!hu(t))&&Ce(e.type)&&(so(e.unevaluatedProperties)||Fa(e.unevaluatedProperties))&&Ce(e.$id)}function Ya(e){return ge(e,"Iterator")&&e.type==="Iterator"&&Ce(e.$id)&&ft(e.items)}function ge(e,t){return Oe(e)&&V in e&&e[V]===t}function Ja(e){return pi(e)&&Ne(e.const)}function Qa(e){return pi(e)&&At(e.const)}function wp(e){return pi(e)&&br(e.const)}function pi(e){return ge(e,"Literal")&&Ce(e.$id)&&Xa(e.const)}function Xa(e){return br(e)||At(e)||Ne(e)}function eu(e){return ge(e,"MappedKey")&&Xe(e.keys)&&e.keys.every(t=>At(t)||Ne(t))}function tu(e){return ge(e,"MappedResult")&&Ji(e.properties)}function ru(e){return ge(e,"Never")&&Oe(e.not)&&Object.getOwnPropertyNames(e.not).length===0}function nu(e){return ge(e,"Not")&&ft(e.not)}function iu(e){return ge(e,"Null")&&e.type==="null"&&Ce(e.$id)}function su(e){return ge(e,"Number")&&e.type==="number"&&Ce(e.$id)&&je(e.exclusiveMaximum)&&je(e.exclusiveMinimum)&&je(e.maximum)&&je(e.minimum)&&je(e.multipleOf)}function ou(e){return ge(e,"Object")&&e.type==="object"&&Ce(e.$id)&&Ji(e.properties)&&Ma(e.additionalProperties)&&je(e.minProperties)&&je(e.maxProperties)}function au(e){return ge(e,"Promise")&&e.type==="Promise"&&Ce(e.$id)&&ft(e.item)}function uu(e){return ge(e,"Record")&&e.type==="object"&&Ce(e.$id)&&Ma(e.additionalProperties)&&Oe(e.patternProperties)&&(t=>{let r=Object.getOwnPropertyNames(t.patternProperties);return r.length===1&&Aa(r[0])&&Oe(t.patternProperties)&&ft(t.patternProperties[r[0]])})(e)}function Ip(e){return Oe(e)&&Vt in e&&e[Vt]==="Recursive"}function lu(e){return ge(e,"Ref")&&Ce(e.$id)&&Ne(e.$ref)}function du(e){return ge(e,"RegExp")&&Ce(e.$id)&&Ne(e.source)&&Ne(e.flags)&&je(e.maxLength)&&je(e.minLength)}function cu(e){return ge(e,"String")&&e.type==="string"&&Ce(e.$id)&&je(e.minLength)&&je(e.maxLength)&&gp(e.pattern)&&yp(e.format)}function fu(e){return ge(e,"Symbol")&&e.type==="symbol"&&Ce(e.$id)}function pu(e){return ge(e,"TemplateLiteral")&&e.type==="string"&&Ne(e.pattern)&&e.pattern[0]==="^"&&e.pattern[e.pattern.length-1]==="$"}function mu(e){return ge(e,"This")&&Ce(e.$id)&&Ne(e.$ref)}function hu(e){return Oe(e)&&nt in e}function gu(e){return ge(e,"Tuple")&&e.type==="array"&&Ce(e.$id)&&At(e.minItems)&&At(e.maxItems)&&e.minItems===e.maxItems&&(et(e.items)&&et(e.additionalItems)&&e.minItems===0||Xe(e.items)&&e.items.every(t=>ft(t)))}function yu(e){return ge(e,"Undefined")&&e.type==="undefined"&&Ce(e.$id)}function $p(e){return oo(e)&&e.anyOf.every(t=>Ja(t)||Qa(t))}function oo(e){return ge(e,"Union")&&Ce(e.$id)&&Oe(e)&&Xe(e.anyOf)&&e.anyOf.every(t=>ft(t))}function vu(e){return ge(e,"Uint8Array")&&e.type==="Uint8Array"&&Ce(e.$id)&&je(e.minByteLength)&&je(e.maxByteLength)}function _u(e){return ge(e,"Unknown")&&Ce(e.$id)}function bu(e){return ge(e,"Unsafe")}function wu(e){return ge(e,"Void")&&e.type==="void"&&Ce(e.$id)}function Iu(e){return Oe(e)&&V in e&&Ne(e[V])&&!hp.includes(e[V])}function ft(e){return Oe(e)&&(za(e)||Ua(e)||Da(e)||Ka(e)||La(e)||qa(e)||Va(e)||Za(e)||Wa(e)||Ba(e)||Ha(e)||Ga(e)||Ya(e)||pi(e)||eu(e)||tu(e)||ru(e)||nu(e)||iu(e)||su(e)||ou(e)||au(e)||uu(e)||lu(e)||du(e)||cu(e)||fu(e)||pu(e)||mu(e)||gu(e)||yu(e)||oo(e)||vu(e)||_u(e)||bu(e)||wu(e)||Iu(e))}var ao="(true|false)",mi="(0|[1-9][0-9]*)",uo="(.*)",xp="(?!.*)",xk=`^${ao}$`,Ar=`^${mi}$`,Mr=`^${uo}$`,$u=`^${xp}$`;function xu(e,t){return e.includes(t)}function Su(e){return[...new Set(e)]}function Sp(e,t){return e.filter(r=>t.includes(r))}function kp(e,t){return e.reduce((r,n)=>Sp(r,n),t)}function ku(e){return e.length===1?e[0]:e.length>1?kp(e.slice(1),e[0]):[]}function Tu(e){let t=[];for(let r of e)t.push(...r);return t}function Fr(e){return N({[V]:"Any"},e)}function gn(e,t){return N({[V]:"Array",type:"array",items:e},t)}function Pu(e){return N({[V]:"Argument",index:e})}function yn(e,t){return N({[V]:"AsyncIterator",type:"AsyncIterator",items:e},t)}function Ae(e,t,r){return N({[V]:"Computed",target:e,parameters:t},r)}function Tp(e,t){let{[t]:r,...n}=e;return n}function Be(e,t){return t.reduce((r,n)=>Tp(r,n),e)}function we(e){return N({[V]:"Never",not:{}},e)}function Ie(e){return N({[V]:"MappedResult",properties:e})}function vn(e,t,r){return N({[V]:"Constructor",type:"Constructor",parameters:e,returns:t},r)}function pr(e,t,r){return N({[V]:"Function",type:"Function",parameters:e,returns:t},r)}function hi(e,t){return N({[V]:"Union",anyOf:e},t)}function Pp(e){return e.some(t=>Pt(t))}function Ou(e){return e.map(t=>Pt(t)?Op(t):t)}function Op(e){return Be(e,[mt])}function Cp(e,t){return Pp(e)?vt(hi(Ou(e),t)):hi(Ou(e),t)}function mr(e,t){return e.length===1?N(e[0],t):e.length===0?we(t):Cp(e,t)}function Pe(e,t){return e.length===0?we(t):e.length===1?N(e[0],t):hi(e,t)}var Qi=class extends ct{};function Ep(e){return e.replace(/\\\$/g,"$").replace(/\\\*/g,"*").replace(/\\\^/g,"^").replace(/\\\|/g,"|").replace(/\\\(/g,"(").replace(/\\\)/g,")")}function lo(e,t,r){return e[t]===r&&e.charCodeAt(t-1)!==92}function Sr(e,t){return lo(e,t,"(")}function gi(e,t){return lo(e,t,")")}function Cu(e,t){return lo(e,t,"|")}function Rp(e){if(!(Sr(e,0)&&gi(e,e.length-1)))return!1;let t=0;for(let r=0;r<e.length;r++)if(Sr(e,r)&&(t+=1),gi(e,r)&&(t-=1),t===0&&r!==e.length-1)return!1;return!0}function Np(e){return e.slice(1,e.length-1)}function jp(e){let t=0;for(let r=0;r<e.length;r++)if(Sr(e,r)&&(t+=1),gi(e,r)&&(t-=1),Cu(e,r)&&t===0)return!0;return!1}function Ap(e){for(let t=0;t<e.length;t++)if(Sr(e,t))return!0;return!1}function Mp(e){let[t,r]=[0,0],n=[];for(let s=0;s<e.length;s++)if(Sr(e,s)&&(t+=1),gi(e,s)&&(t-=1),Cu(e,s)&&t===0){let o=e.slice(r,s);o.length>0&&n.push(_n(o)),r=s+1}let i=e.slice(r);return i.length>0&&n.push(_n(i)),n.length===0?{type:"const",const:""}:n.length===1?n[0]:{type:"or",expr:n}}function Fp(e){function t(i,s){if(!Sr(i,s))throw new Qi("TemplateLiteralParser: Index must point to open parens");let o=0;for(let a=s;a<i.length;a++)if(Sr(i,a)&&(o+=1),gi(i,a)&&(o-=1),o===0)return[s,a];throw new Qi("TemplateLiteralParser: Unclosed group parens in expression")}function r(i,s){for(let o=s;o<i.length;o++)if(Sr(i,o))return[s,o];return[s,i.length]}let n=[];for(let i=0;i<e.length;i++)if(Sr(e,i)){let[s,o]=t(e,i),a=e.slice(s,o+1);n.push(_n(a)),i=o}else{let[s,o]=r(e,i),a=e.slice(s,o);a.length>0&&n.push(_n(a)),i=o-1}return n.length===0?{type:"const",const:""}:n.length===1?n[0]:{type:"and",expr:n}}function _n(e){return Rp(e)?_n(Np(e)):jp(e)?Mp(e):Ap(e)?Fp(e):{type:"const",const:Ep(e)}}function bn(e){return _n(e.slice(1,e.length-1))}var co=class extends ct{};function zp(e){return e.type==="or"&&e.expr.length===2&&e.expr[0].type==="const"&&e.expr[0].const==="0"&&e.expr[1].type==="const"&&e.expr[1].const==="[1-9][0-9]*"}function Up(e){return e.type==="or"&&e.expr.length===2&&e.expr[0].type==="const"&&e.expr[0].const==="true"&&e.expr[1].type==="const"&&e.expr[1].const==="false"}function Dp(e){return e.type==="const"&&e.const===".*"}function tn(e){return zp(e)||Dp(e)?!1:Up(e)?!0:e.type==="and"?e.expr.every(t=>tn(t)):e.type==="or"?e.expr.every(t=>tn(t)):e.type==="const"?!0:(()=>{throw new co("Unknown expression type")})()}function Eu(e){let t=bn(e.pattern);return tn(t)}var fo=class extends ct{};function*Ru(e){if(e.length===1)return yield*e[0];for(let t of e[0])for(let r of Ru(e.slice(1)))yield`${t}${r}`}function*qp(e){return yield*Ru(e.expr.map(t=>[...yi(t)]))}function*Lp(e){for(let t of e.expr)yield*yi(t)}function*Kp(e){return yield e.const}function*yi(e){return e.type==="and"?yield*qp(e):e.type==="or"?yield*Lp(e):e.type==="const"?yield*Kp(e):(()=>{throw new fo("Unknown expression")})()}function Xi(e){let t=bn(e.pattern);return tn(t)?[...yi(t)]:[]}function ke(e,t){return N({[V]:"Literal",const:e,type:typeof e},t)}function es(e){return N({[V]:"Boolean",type:"boolean"},e)}function wn(e){return N({[V]:"BigInt",type:"bigint"},e)}function Zt(e){return N({[V]:"Number",type:"number"},e)}function or(e){return N({[V]:"String",type:"string"},e)}function*Vp(e){let t=e.trim().replace(/"|'/g,"");return t==="boolean"?yield es():t==="number"?yield Zt():t==="bigint"?yield wn():t==="string"?yield or():yield(()=>{let r=t.split("|").map(n=>ke(n.trim()));return r.length===0?we():r.length===1?r[0]:mr(r)})()}function*Zp(e){if(e[1]!=="{"){let t=ke("$"),r=po(e.slice(1));return yield*[t,...r]}for(let t=2;t<e.length;t++)if(e[t]==="}"){let r=Vp(e.slice(2,t)),n=po(e.slice(t+1));return yield*[...r,...n]}yield ke(e)}function*po(e){for(let t=0;t<e.length;t++)if(e[t]==="$"){let r=ke(e.slice(0,t)),n=Zp(e.slice(t));return yield*[r,...n]}yield ke(e)}function Nu(e){return[...po(e)]}var mo=class extends ct{};function Wp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ju(e,t){return zt(e)?e.pattern.slice(1,e.pattern.length-1):be(e)?`(${e.anyOf.map(r=>ju(r,t)).join("|")})`:sr(e)?`${t}${mi}`:ir(e)?`${t}${mi}`:Jr(e)?`${t}${mi}`:$r(e)?`${t}${uo}`:Mt(e)?`${t}${Wp(e.const.toString())}`:Ir(e)?`${t}${ao}`:(()=>{throw new mo(`Unexpected Kind '${e[V]}'`)})()}function ho(e){return`^${e.map(t=>ju(t,"")).join("")}$`}function rn(e){let r=Xi(e).map(n=>ke(n));return mr(r)}function ts(e,t){let r=Ne(e)?ho(Nu(e)):ho(e);return N({[V]:"TemplateLiteral",type:"string",pattern:r},t)}function Bp(e){return Xi(e).map(r=>r.toString())}function Hp(e){let t=[];for(let r of e)t.push(...Ot(r));return t}function Gp(e){return[e.toString()]}function Ot(e){return[...new Set(zt(e)?Bp(e):be(e)?Hp(e.anyOf):Mt(e)?Gp(e.const):sr(e)?["[number]"]:ir(e)?["[number]"]:[])]}function Yp(e,t,r){let n={};for(let i of Object.getOwnPropertyNames(t))n[i]=zr(e,Ot(t[i]),r);return n}function Jp(e,t,r){return Yp(e,t.properties,r)}function Au(e,t,r){let n=Jp(e,t,r);return Ie(n)}function Fu(e,t){return e.map(r=>zu(r,t))}function Qp(e){return e.filter(t=>!Nr(t))}function Xp(e,t){return rs(Qp(Fu(e,t)))}function em(e){return e.some(t=>Nr(t))?[]:e}function tm(e,t){return mr(em(Fu(e,t)))}function rm(e,t){return t in e?e[t]:t==="[number]"?mr(e):we()}function nm(e,t){return t==="[number]"?e:we()}function im(e,t){return t in e?e[t]:we()}function zu(e,t){return We(e)?Xp(e.allOf,t):be(e)?tm(e.anyOf,t):Ut(e)?rm(e.items??[],t):er(e)?nm(e.items,t):tt(e)?im(e.properties,t):we()}function go(e,t){return t.map(r=>zu(e,r))}function Mu(e,t){return mr(go(e,t))}function zr(e,t,r){if(Qe(e)||Qe(t)){let n="Index types using Ref parameters require both Type and Key to be of TSchema";if(!Dt(e)||!Dt(t))throw new ct(n);return Ae("Index",[e,t])}return De(t)?Au(e,t,r):Ft(t)?Uu(e,t,r):N(Dt(t)?Mu(e,Ot(t)):Mu(e,t),r)}function sm(e,t,r){return{[t]:zr(e,[t],Ue(r))}}function om(e,t,r){return t.reduce((n,i)=>({...n,...sm(e,i,r)}),{})}function am(e,t,r){return om(e,t.keys,r)}function Uu(e,t,r){let n=am(e,t,r);return Ie(n)}function In(e,t){return N({[V]:"Iterator",type:"Iterator",items:e},t)}function um(e){return globalThis.Object.keys(e).filter(t=>!Pt(e[t]))}function lm(e,t){let r=um(e),n=r.length>0?{[V]:"Object",type:"object",required:r,properties:e}:{[V]:"Object",type:"object",properties:e};return N(n,t)}var Ee=lm;function ns(e,t){return N({[V]:"Promise",type:"Promise",item:e},t)}function dm(e){return N(Be(e,[Xt]))}function cm(e){return N({...e,[Xt]:"Readonly"})}function fm(e,t){return t===!1?dm(e):cm(e)}function Ct(e,t){let r=t??!0;return De(e)?Du(e,r):fm(e,r)}function pm(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Ct(e[n],t);return r}function mm(e,t){return pm(e.properties,t)}function Du(e,t){let r=mm(e,t);return Ie(r)}function Wt(e,t){return N(e.length>0?{[V]:"Tuple",type:"array",items:e,additionalItems:!1,minItems:e.length,maxItems:e.length}:{[V]:"Tuple",type:"array",minItems:e.length,maxItems:e.length},t)}function qu(e,t){return e in t?Bt(e,t[e]):Ie(t)}function hm(e){return{[e]:ke(e)}}function gm(e){let t={};for(let r of e)t[r]=ke(r);return t}function ym(e,t){return xu(t,e)?hm(e):gm(t)}function vm(e,t){let r=ym(e,t);return qu(e,r)}function vi(e,t){return t.map(r=>Bt(e,r))}function _m(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(t))r[n]=Bt(e,t[n]);return r}function Bt(e,t){let r={...t};return Pt(t)?vt(Bt(e,Be(t,[mt]))):hn(t)?Ct(Bt(e,Be(t,[Xt]))):De(t)?qu(e,t.properties):Ft(t)?vm(e,t.keys):rr(t)?vn(vi(e,t.parameters),Bt(e,t.returns),r):nr(t)?pr(vi(e,t.parameters),Bt(e,t.returns),r):Yr(t)?yn(Bt(e,t.items),r):Qr(t)?In(Bt(e,t.items),r):We(t)?_t(vi(e,t.allOf),r):be(t)?Pe(vi(e,t.anyOf),r):Ut(t)?Wt(vi(e,t.items??[]),r):tt(t)?Ee(_m(e,t.properties),r):er(t)?gn(Bt(e,t.items),r):Xr(t)?ns(Bt(e,t.item),r):t}function bm(e,t){let r={};for(let n of e)r[n]=Bt(n,t);return r}function Lu(e,t,r){let n=Dt(e)?Ot(e):e,i=t({[V]:"MappedKey",keys:n}),s=bm(n,i);return Ee(s,r)}function wm(e){return N(Be(e,[mt]))}function Im(e){return N({...e,[mt]:"Optional"})}function $m(e,t){return t===!1?wm(e):Im(e)}function vt(e,t){let r=t??!0;return De(e)?Ku(e,r):$m(e,r)}function xm(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=vt(e[n],t);return r}function Sm(e,t){return xm(e.properties,t)}function Ku(e,t){let r=Sm(e,t);return Ie(r)}function _i(e,t={}){let r=e.every(i=>tt(i)),n=Dt(t.unevaluatedProperties)?{unevaluatedProperties:t.unevaluatedProperties}:{};return N(t.unevaluatedProperties===!1||Dt(t.unevaluatedProperties)||r?{...n,[V]:"Intersect",type:"object",allOf:e}:{...n,[V]:"Intersect",allOf:e},t)}function km(e){return e.every(t=>Pt(t))}function Tm(e){return Be(e,[mt])}function Vu(e){return e.map(t=>Pt(t)?Tm(t):t)}function Pm(e,t){return km(e)?vt(_i(Vu(e),t)):_i(Vu(e),t)}function rs(e,t={}){if(e.length===1)return N(e[0],t);if(e.length===0)return we(t);if(e.some(r=>jr(r)))throw new Error("Cannot intersect transform types");return Pm(e,t)}function _t(e,t){if(e.length===1)return N(e[0],t);if(e.length===0)return we(t);if(e.some(r=>jr(r)))throw new Error("Cannot intersect transform types");return _i(e,t)}function hr(...e){let[t,r]=typeof e[0]=="string"?[e[0],e[1]]:[e[0].$id,e[1]];if(typeof t!="string")throw new ct("Ref: $ref must be a string");return N({[V]:"Ref",$ref:t},r)}function Om(e,t){return Ae("Awaited",[Ae(e,t)])}function Cm(e){return Ae("Awaited",[hr(e)])}function Em(e){return _t(Zu(e))}function Rm(e){return Pe(Zu(e))}function Nm(e){return $n(e)}function Zu(e){return e.map(t=>$n(t))}function $n(e,t){return N(tr(e)?Om(e.target,e.parameters):We(e)?Em(e.allOf):be(e)?Rm(e.anyOf):Xr(e)?Nm(e.item):Qe(e)?Cm(e.$ref):e,t)}function Wu(e){let t=[];for(let r of e)t.push(bi(r));return t}function jm(e){let t=Wu(e);return Tu(t)}function Am(e){let t=Wu(e);return ku(t)}function Mm(e){return e.map((t,r)=>r.toString())}function Fm(e){return["[number]"]}function zm(e){return globalThis.Object.getOwnPropertyNames(e)}function Um(e){return Dm?globalThis.Object.getOwnPropertyNames(e).map(r=>r[0]==="^"&&r[r.length-1]==="$"?r.slice(1,r.length-1):r):[]}function bi(e){return We(e)?jm(e.allOf):be(e)?Am(e.anyOf):Ut(e)?Mm(e.items??[]):er(e)?Fm(e.items):tt(e)?zm(e.properties):en(e)?Um(e.patternProperties):[]}var Dm=!1;function qm(e,t){return Ae("KeyOf",[Ae(e,t)])}function Lm(e){return Ae("KeyOf",[hr(e)])}function Km(e,t){let r=bi(e),n=Vm(r),i=mr(n);return N(i,t)}function Vm(e){return e.map(t=>t==="[number]"?Zt():ke(t))}function xn(e,t){return tr(e)?qm(e.target,e.parameters):Qe(e)?Lm(e.$ref):De(e)?Bu(e,t):Km(e,t)}function Zm(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=xn(e[n],Ue(t));return r}function Wm(e,t){return Zm(e.properties,t)}function Bu(e,t){let r=Wm(e,t);return Ie(r)}function Bm(e){let t=[];for(let r of e)t.push(...bi(r));return Su(t)}function Hm(e){return e.filter(t=>!Nr(t))}function Gm(e,t){let r=[];for(let n of e)r.push(...go(n,[t]));return Hm(r)}function Ym(e,t){let r={};for(let n of t)r[n]=rs(Gm(e,n));return r}function Hu(e,t){let r=Bm(e),n=Ym(e,r);return Ee(n,t)}function is(e){return N({[V]:"Date",type:"Date"},e)}function ss(e){return N({[V]:"Null",type:"null"},e)}function os(e){return N({[V]:"Symbol",type:"symbol"},e)}function as(e){return N({[V]:"Undefined",type:"undefined"},e)}function us(e){return N({[V]:"Uint8Array",type:"Uint8Array"},e)}function Ur(e){return N({[V]:"Unknown"},e)}function Jm(e){return e.map(t=>yo(t,!1))}function Qm(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=Ct(yo(e[r],!1));return t}function ls(e,t){return t===!0?e:Ct(e)}function yo(e,t){return Gs(e)?ls(Fr(),t):Js(e)?ls(Fr(),t):Xe(e)?Ct(Wt(Jm(e))):wr(e)?us():Gr(e)?is():Oe(e)?ls(Ee(Qm(e)),t):Ys(e)?ls(pr([],Ur()),t):et(e)?as():Qs(e)?ss():Xs(e)?os():oi(e)?wn():At(e)?ke(e):br(e)?ke(e):Ne(e)?ke(e):Ee({})}function Gu(e,t){return N(yo(e,!0),t)}function Yu(e,t){return rr(e)?Wt(e.parameters,t):we(t)}function Ju(e,t){if(et(e))throw new Error("Enum undefined or empty");let r=globalThis.Object.getOwnPropertyNames(e).filter(s=>isNaN(s)).map(s=>e[s]),i=[...new Set(r)].map(s=>ke(s));return Pe(i,{...t,[Vt]:"Enum"})}var _o=class extends ct{},j;(function(e){e[e.Union=0]="Union",e[e.True=1]="True",e[e.False=2]="False"})(j||(j={}));function Ht(e){return e===j.False?e:j.True}function Sn(e){throw new _o(e)}function it(e){return S.IsNever(e)||S.IsIntersect(e)||S.IsUnion(e)||S.IsUnknown(e)||S.IsAny(e)}function st(e,t){return S.IsNever(t)?il(e,t):S.IsIntersect(t)?ds(e,t):S.IsUnion(t)?$o(e,t):S.IsUnknown(t)?ul(e,t):S.IsAny(t)?Io(e,t):Sn("StructuralRight")}function Io(e,t){return j.True}function Xm(e,t){return S.IsIntersect(t)?ds(e,t):S.IsUnion(t)&&t.anyOf.some(r=>S.IsAny(r)||S.IsUnknown(r))?j.True:S.IsUnion(t)?j.Union:S.IsUnknown(t)||S.IsAny(t)?j.True:j.Union}function eh(e,t){return S.IsUnknown(e)?j.False:S.IsAny(e)?j.Union:S.IsNever(e)?j.True:j.False}function th(e,t){return S.IsObject(t)&&cs(t)?j.True:it(t)?st(e,t):S.IsArray(t)?Ht(Re(e.items,t.items)):j.False}function rh(e,t){return it(t)?st(e,t):S.IsAsyncIterator(t)?Ht(Re(e.items,t.items)):j.False}function nh(e,t){return it(t)?st(e,t):S.IsObject(t)?bt(e,t):S.IsRecord(t)?Gt(e,t):S.IsBigInt(t)?j.True:j.False}function rl(e,t){return S.IsLiteralBoolean(e)||S.IsBoolean(e)?j.True:j.False}function ih(e,t){return it(t)?st(e,t):S.IsObject(t)?bt(e,t):S.IsRecord(t)?Gt(e,t):S.IsBoolean(t)?j.True:j.False}function sh(e,t){return it(t)?st(e,t):S.IsObject(t)?bt(e,t):S.IsConstructor(t)?e.parameters.length>t.parameters.length?j.False:e.parameters.every((r,n)=>Ht(Re(t.parameters[n],r))===j.True)?Ht(Re(e.returns,t.returns)):j.False:j.False}function oh(e,t){return it(t)?st(e,t):S.IsObject(t)?bt(e,t):S.IsRecord(t)?Gt(e,t):S.IsDate(t)?j.True:j.False}function ah(e,t){return it(t)?st(e,t):S.IsObject(t)?bt(e,t):S.IsFunction(t)?e.parameters.length>t.parameters.length?j.False:e.parameters.every((r,n)=>Ht(Re(t.parameters[n],r))===j.True)?Ht(Re(e.returns,t.returns)):j.False:j.False}function nl(e,t){return S.IsLiteral(e)&&yt.IsNumber(e.const)||S.IsNumber(e)||S.IsInteger(e)?j.True:j.False}function uh(e,t){return S.IsInteger(t)||S.IsNumber(t)?j.True:it(t)?st(e,t):S.IsObject(t)?bt(e,t):S.IsRecord(t)?Gt(e,t):j.False}function ds(e,t){return t.allOf.every(r=>Re(e,r)===j.True)?j.True:j.False}function lh(e,t){return e.allOf.some(r=>Re(r,t)===j.True)?j.True:j.False}function dh(e,t){return it(t)?st(e,t):S.IsIterator(t)?Ht(Re(e.items,t.items)):j.False}function ch(e,t){return S.IsLiteral(t)&&t.const===e.const?j.True:it(t)?st(e,t):S.IsObject(t)?bt(e,t):S.IsRecord(t)?Gt(e,t):S.IsString(t)?al(e,t):S.IsNumber(t)?sl(e,t):S.IsInteger(t)?nl(e,t):S.IsBoolean(t)?rl(e,t):j.False}function il(e,t){return j.False}function fh(e,t){return j.True}function Qu(e){let[t,r]=[e,0];for(;S.IsNot(t);)t=t.not,r+=1;return r%2===0?t:Ur()}function ph(e,t){return S.IsNot(e)?Re(Qu(e),t):S.IsNot(t)?Re(e,Qu(t)):Sn("Invalid fallthrough for Not")}function mh(e,t){return it(t)?st(e,t):S.IsObject(t)?bt(e,t):S.IsRecord(t)?Gt(e,t):S.IsNull(t)?j.True:j.False}function sl(e,t){return S.IsLiteralNumber(e)||S.IsNumber(e)||S.IsInteger(e)?j.True:j.False}function hh(e,t){return it(t)?st(e,t):S.IsObject(t)?bt(e,t):S.IsRecord(t)?Gt(e,t):S.IsInteger(t)||S.IsNumber(t)?j.True:j.False}function Et(e,t){return Object.getOwnPropertyNames(e.properties).length===t}function Xu(e){return cs(e)}function el(e){return Et(e,0)||Et(e,1)&&"description"in e.properties&&S.IsUnion(e.properties.description)&&e.properties.description.anyOf.length===2&&(S.IsString(e.properties.description.anyOf[0])&&S.IsUndefined(e.properties.description.anyOf[1])||S.IsString(e.properties.description.anyOf[1])&&S.IsUndefined(e.properties.description.anyOf[0]))}function vo(e){return Et(e,0)}function tl(e){return Et(e,0)}function gh(e){return Et(e,0)}function yh(e){return Et(e,0)}function vh(e){return cs(e)}function _h(e){let t=Zt();return Et(e,0)||Et(e,1)&&"length"in e.properties&&Ht(Re(e.properties.length,t))===j.True}function bh(e){return Et(e,0)}function cs(e){let t=Zt();return Et(e,0)||Et(e,1)&&"length"in e.properties&&Ht(Re(e.properties.length,t))===j.True}function wh(e){let t=pr([Fr()],Fr());return Et(e,0)||Et(e,1)&&"then"in e.properties&&Ht(Re(e.properties.then,t))===j.True}function ol(e,t){return Re(e,t)===j.False||S.IsOptional(e)&&!S.IsOptional(t)?j.False:j.True}function bt(e,t){return S.IsUnknown(e)?j.False:S.IsAny(e)?j.Union:S.IsNever(e)||S.IsLiteralString(e)&&Xu(t)||S.IsLiteralNumber(e)&&vo(t)||S.IsLiteralBoolean(e)&&tl(t)||S.IsSymbol(e)&&el(t)||S.IsBigInt(e)&&gh(t)||S.IsString(e)&&Xu(t)||S.IsSymbol(e)&&el(t)||S.IsNumber(e)&&vo(t)||S.IsInteger(e)&&vo(t)||S.IsBoolean(e)&&tl(t)||S.IsUint8Array(e)&&vh(t)||S.IsDate(e)&&yh(t)||S.IsConstructor(e)&&bh(t)||S.IsFunction(e)&&_h(t)?j.True:S.IsRecord(e)&&S.IsString(bo(e))?t[Vt]==="Record"?j.True:j.False:S.IsRecord(e)&&S.IsNumber(bo(e))&&Et(t,0)?j.True:j.False}function Ih(e,t){return it(t)?st(e,t):S.IsRecord(t)?Gt(e,t):S.IsObject(t)?(()=>{for(let r of Object.getOwnPropertyNames(t.properties)){if(!(r in e.properties)&&!S.IsOptional(t.properties[r]))return j.False;if(S.IsOptional(t.properties[r]))return j.True;if(ol(e.properties[r],t.properties[r])===j.False)return j.False}return j.True})():j.False}function $h(e,t){return it(t)?st(e,t):S.IsObject(t)&&wh(t)?j.True:S.IsPromise(t)?Ht(Re(e.item,t.item)):j.False}function bo(e){return Ar in e.patternProperties?Zt():Mr in e.patternProperties?or():Sn("Unknown record key pattern")}function wo(e){return Ar in e.patternProperties?e.patternProperties[Ar]:Mr in e.patternProperties?e.patternProperties[Mr]:Sn("Unable to get record value schema")}function Gt(e,t){let[r,n]=[bo(t),wo(t)];return S.IsLiteralString(e)&&S.IsNumber(r)&&Ht(Re(e,n))===j.True?j.True:S.IsUint8Array(e)&&S.IsNumber(r)||S.IsString(e)&&S.IsNumber(r)||S.IsArray(e)&&S.IsNumber(r)?Re(e,n):S.IsObject(e)?(()=>{for(let i of Object.getOwnPropertyNames(e.properties))if(ol(n,e.properties[i])===j.False)return j.False;return j.True})():j.False}function xh(e,t){return it(t)?st(e,t):S.IsObject(t)?bt(e,t):S.IsRecord(t)?Re(wo(e),wo(t)):j.False}function Sh(e,t){let r=S.IsRegExp(e)?or():e,n=S.IsRegExp(t)?or():t;return Re(r,n)}function al(e,t){return S.IsLiteral(e)&&yt.IsString(e.const)||S.IsString(e)?j.True:j.False}function kh(e,t){return it(t)?st(e,t):S.IsObject(t)?bt(e,t):S.IsRecord(t)?Gt(e,t):S.IsString(t)?j.True:j.False}function Th(e,t){return it(t)?st(e,t):S.IsObject(t)?bt(e,t):S.IsRecord(t)?Gt(e,t):S.IsSymbol(t)?j.True:j.False}function Ph(e,t){return S.IsTemplateLiteral(e)?Re(rn(e),t):S.IsTemplateLiteral(t)?Re(e,rn(t)):Sn("Invalid fallthrough for TemplateLiteral")}function Oh(e,t){return S.IsArray(t)&&e.items!==void 0&&e.items.every(r=>Re(r,t.items)===j.True)}function Ch(e,t){return S.IsNever(e)?j.True:S.IsUnknown(e)?j.False:S.IsAny(e)?j.Union:j.False}function Eh(e,t){return it(t)?st(e,t):S.IsObject(t)&&cs(t)||S.IsArray(t)&&Oh(e,t)?j.True:S.IsTuple(t)?yt.IsUndefined(e.items)&&!yt.IsUndefined(t.items)||!yt.IsUndefined(e.items)&&yt.IsUndefined(t.items)?j.False:yt.IsUndefined(e.items)&&!yt.IsUndefined(t.items)||e.items.every((r,n)=>Re(r,t.items[n])===j.True)?j.True:j.False:j.False}function Rh(e,t){return it(t)?st(e,t):S.IsObject(t)?bt(e,t):S.IsRecord(t)?Gt(e,t):S.IsUint8Array(t)?j.True:j.False}function Nh(e,t){return it(t)?st(e,t):S.IsObject(t)?bt(e,t):S.IsRecord(t)?Gt(e,t):S.IsVoid(t)?Mh(e,t):S.IsUndefined(t)?j.True:j.False}function $o(e,t){return t.anyOf.some(r=>Re(e,r)===j.True)?j.True:j.False}function jh(e,t){return e.anyOf.every(r=>Re(r,t)===j.True)?j.True:j.False}function ul(e,t){return j.True}function Ah(e,t){return S.IsNever(t)?il(e,t):S.IsIntersect(t)?ds(e,t):S.IsUnion(t)?$o(e,t):S.IsAny(t)?Io(e,t):S.IsString(t)?al(e,t):S.IsNumber(t)?sl(e,t):S.IsInteger(t)?nl(e,t):S.IsBoolean(t)?rl(e,t):S.IsArray(t)?eh(e,t):S.IsTuple(t)?Ch(e,t):S.IsObject(t)?bt(e,t):S.IsUnknown(t)?j.True:j.False}function Mh(e,t){return S.IsUndefined(e)||S.IsUndefined(e)?j.True:j.False}function Fh(e,t){return S.IsIntersect(t)?ds(e,t):S.IsUnion(t)?$o(e,t):S.IsUnknown(t)?ul(e,t):S.IsAny(t)?Io(e,t):S.IsObject(t)?bt(e,t):S.IsVoid(t)?j.True:j.False}function Re(e,t){return S.IsTemplateLiteral(e)||S.IsTemplateLiteral(t)?Ph(e,t):S.IsRegExp(e)||S.IsRegExp(t)?Sh(e,t):S.IsNot(e)||S.IsNot(t)?ph(e,t):S.IsAny(e)?Xm(e,t):S.IsArray(e)?th(e,t):S.IsBigInt(e)?nh(e,t):S.IsBoolean(e)?ih(e,t):S.IsAsyncIterator(e)?rh(e,t):S.IsConstructor(e)?sh(e,t):S.IsDate(e)?oh(e,t):S.IsFunction(e)?ah(e,t):S.IsInteger(e)?uh(e,t):S.IsIntersect(e)?lh(e,t):S.IsIterator(e)?dh(e,t):S.IsLiteral(e)?ch(e,t):S.IsNever(e)?fh(e,t):S.IsNull(e)?mh(e,t):S.IsNumber(e)?hh(e,t):S.IsObject(e)?Ih(e,t):S.IsRecord(e)?xh(e,t):S.IsString(e)?kh(e,t):S.IsSymbol(e)?Th(e,t):S.IsTuple(e)?Eh(e,t):S.IsPromise(e)?$h(e,t):S.IsUint8Array(e)?Rh(e,t):S.IsUndefined(e)?Nh(e,t):S.IsUnion(e)?jh(e,t):S.IsUnknown(e)?Ah(e,t):S.IsVoid(e)?Fh(e,t):Sn(`Unknown left type operand '${e[V]}'`)}function Dr(e,t){return Re(e,t)}function zh(e,t,r,n,i){let s={};for(let o of globalThis.Object.getOwnPropertyNames(e))s[o]=kn(e[o],t,r,n,Ue(i));return s}function Uh(e,t,r,n,i){return zh(e.properties,t,r,n,i)}function ll(e,t,r,n,i){let s=Uh(e,t,r,n,i);return Ie(s)}function Dh(e,t,r,n){let i=Dr(e,t);return i===j.Union?Pe([r,n]):i===j.True?r:n}function kn(e,t,r,n,i){return De(e)?ll(e,t,r,n,i):Ft(e)?N(dl(e,t,r,n,i)):N(Dh(e,t,r,n),i)}function qh(e,t,r,n,i){return{[e]:kn(ke(e),t,r,n,Ue(i))}}function Lh(e,t,r,n,i){return e.reduce((s,o)=>({...s,...qh(o,t,r,n,i)}),{})}function Kh(e,t,r,n,i){return Lh(e.keys,t,r,n,i)}function dl(e,t,r,n,i){let s=Kh(e,t,r,n,i);return Ie(s)}function cl(e,t){return Tn(rn(e),t)}function Vh(e,t){let r=e.filter(n=>Dr(n,t)===j.False);return r.length===1?r[0]:Pe(r)}function Tn(e,t,r={}){return zt(e)?N(cl(e,t),r):De(e)?N(fl(e,t),r):N(be(e)?Vh(e.anyOf,t):Dr(e,t)!==j.False?we():e,r)}function Zh(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Tn(e[n],t);return r}function Wh(e,t){return Zh(e.properties,t)}function fl(e,t){let r=Wh(e,t);return Ie(r)}function pl(e,t){return Pn(rn(e),t)}function Bh(e,t){let r=e.filter(n=>Dr(n,t)!==j.False);return r.length===1?r[0]:Pe(r)}function Pn(e,t,r){return zt(e)?N(pl(e,t),r):De(e)?N(ml(e,t),r):N(be(e)?Bh(e.anyOf,t):Dr(e,t)!==j.False?e:we(),r)}function Hh(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Pn(e[n],t);return r}function Gh(e,t){return Hh(e.properties,t)}function ml(e,t){let r=Gh(e,t);return Ie(r)}function hl(e,t){return rr(e)?N(e.returns,t):we(t)}function fs(e){return Ct(vt(e))}function nn(e,t,r){return N({[V]:"Record",type:"object",patternProperties:{[e]:t}},r)}function xo(e,t,r){let n={};for(let i of e)n[i]=t;return Ee(n,{...r,[Vt]:"Record"})}function Yh(e,t,r){return Eu(e)?xo(Ot(e),t,r):nn(e.pattern,t,r)}function Jh(e,t,r){return xo(Ot(Pe(e)),t,r)}function Qh(e,t,r){return xo([e.toString()],t,r)}function Xh(e,t,r){return nn(e.source,t,r)}function eg(e,t,r){let n=et(e.pattern)?Mr:e.pattern;return nn(n,t,r)}function tg(e,t,r){return nn(Mr,t,r)}function rg(e,t,r){return nn($u,t,r)}function ng(e,t,r){return Ee({true:t,false:t},r)}function ig(e,t,r){return nn(Ar,t,r)}function sg(e,t,r){return nn(Ar,t,r)}function ps(e,t,r={}){return be(e)?Jh(e.anyOf,t,r):zt(e)?Yh(e,t,r):Mt(e)?Qh(e.const,t,r):Ir(e)?ng(e,t,r):ir(e)?ig(e,t,r):sr(e)?sg(e,t,r):ro(e)?Xh(e,t,r):$r(e)?eg(e,t,r):eo(e)?tg(e,t,r):Nr(e)?rg(e,t,r):we(r)}function ms(e){return globalThis.Object.getOwnPropertyNames(e.patternProperties)[0]}function gl(e){let t=ms(e);return t===Mr?or():t===Ar?Zt():or({pattern:t})}function hs(e){return e.patternProperties[ms(e)]}function og(e,t){return t.parameters=wi(e,t.parameters),t.returns=ar(e,t.returns),t}function ag(e,t){return t.parameters=wi(e,t.parameters),t.returns=ar(e,t.returns),t}function ug(e,t){return t.allOf=wi(e,t.allOf),t}function lg(e,t){return t.anyOf=wi(e,t.anyOf),t}function dg(e,t){return et(t.items)||(t.items=wi(e,t.items)),t}function cg(e,t){return t.items=ar(e,t.items),t}function fg(e,t){return t.items=ar(e,t.items),t}function pg(e,t){return t.items=ar(e,t.items),t}function mg(e,t){return t.item=ar(e,t.item),t}function hg(e,t){let r=_g(e,t.properties);return{...t,...Ee(r)}}function gg(e,t){let r=ar(e,gl(t)),n=ar(e,hs(t)),i=ps(r,n);return{...t,...i}}function yg(e,t){return t.index in e?e[t.index]:Ur()}function vg(e,t){let r=hn(t),n=Pt(t),i=ar(e,t);return r&&n?fs(i):r&&!n?Ct(i):!r&&n?vt(i):i}function _g(e,t){return globalThis.Object.getOwnPropertyNames(t).reduce((r,n)=>({...r,[n]:vg(e,t[n])}),{})}function wi(e,t){return t.map(r=>ar(e,r))}function ar(e,t){return rr(t)?og(e,t):nr(t)?ag(e,t):We(t)?ug(e,t):be(t)?lg(e,t):Ut(t)?dg(e,t):er(t)?cg(e,t):Yr(t)?fg(e,t):Qr(t)?pg(e,t):Xr(t)?mg(e,t):tt(t)?hg(e,t):en(t)?gg(e,t):to(t)?yg(e,t):t}function yl(e,t){return ar(t,mn(e))}function vl(e){return N({[V]:"Integer",type:"integer"},e)}function bg(e,t,r){return{[e]:ur(ke(e),t,Ue(r))}}function wg(e,t,r){return e.reduce((i,s)=>({...i,...bg(s,t,r)}),{})}function Ig(e,t,r){return wg(e.keys,t,r)}function _l(e,t,r){let n=Ig(e,t,r);return Ie(n)}function $g(e){let[t,r]=[e.slice(0,1),e.slice(1)];return[t.toLowerCase(),r].join("")}function xg(e){let[t,r]=[e.slice(0,1),e.slice(1)];return[t.toUpperCase(),r].join("")}function Sg(e){return e.toUpperCase()}function kg(e){return e.toLowerCase()}function Tg(e,t,r){let n=bn(e.pattern);if(!tn(n))return{...e,pattern:bl(e.pattern,t)};let o=[...yi(n)].map(l=>ke(l)),a=wl(o,t),u=Pe(a);return ts([u],r)}function bl(e,t){return typeof e=="string"?t==="Uncapitalize"?$g(e):t==="Capitalize"?xg(e):t==="Uppercase"?Sg(e):t==="Lowercase"?kg(e):e:e.toString()}function wl(e,t){return e.map(r=>ur(r,t))}function ur(e,t,r={}){return Ft(e)?_l(e,t,r):zt(e)?Tg(e,t,r):be(e)?Pe(wl(e.anyOf,t),r):Mt(e)?ke(bl(e.const,t),r):N(e,r)}function Il(e,t={}){return ur(e,"Capitalize",t)}function $l(e,t={}){return ur(e,"Lowercase",t)}function xl(e,t={}){return ur(e,"Uncapitalize",t)}function Sl(e,t={}){return ur(e,"Uppercase",t)}function Pg(e,t,r){let n={};for(let i of globalThis.Object.getOwnPropertyNames(e))n[i]=qr(e[i],t,Ue(r));return n}function Og(e,t,r){return Pg(e.properties,t,r)}function kl(e,t,r){let n=Og(e,t,r);return Ie(n)}function Cg(e,t){return e.map(r=>So(r,t))}function Eg(e,t){return e.map(r=>So(r,t))}function Rg(e,t){let{[t]:r,...n}=e;return n}function Ng(e,t){return t.reduce((r,n)=>Rg(r,n),e)}function jg(e,t,r){let n=Be(e,[nt,"$id","required","properties"]),i=Ng(r,t);return Ee(i,n)}function Ag(e){let t=e.reduce((r,n)=>Yi(n)?[...r,ke(n)]:r,[]);return Pe(t)}function So(e,t){return We(e)?_t(Cg(e.allOf,t)):be(e)?Pe(Eg(e.anyOf,t)):tt(e)?jg(e,t,e.properties):Ee({})}function qr(e,t,r){let n=Xe(t)?Ag(t):t,i=Dt(t)?Ot(t):t,s=Qe(e),o=Qe(t);return De(e)?kl(e,i,r):Ft(t)?Tl(e,t,r):s&&o?Ae("Omit",[e,n],r):!s&&o?Ae("Omit",[e,n],r):s&&!o?Ae("Omit",[e,n],r):N({...So(e,i),...r})}function Mg(e,t,r){return{[t]:qr(e,[t],Ue(r))}}function Fg(e,t,r){return t.reduce((n,i)=>({...n,...Mg(e,i,r)}),{})}function zg(e,t,r){return Fg(e,t.keys,r)}function Tl(e,t,r){let n=zg(e,t,r);return Ie(n)}function Ug(e,t,r){let n={};for(let i of globalThis.Object.getOwnPropertyNames(e))n[i]=Lr(e[i],t,Ue(r));return n}function Dg(e,t,r){return Ug(e.properties,t,r)}function Pl(e,t,r){let n=Dg(e,t,r);return Ie(n)}function qg(e,t){return e.map(r=>ko(r,t))}function Lg(e,t){return e.map(r=>ko(r,t))}function Kg(e,t){let r={};for(let n of t)n in e&&(r[n]=e[n]);return r}function Vg(e,t,r){let n=Be(e,[nt,"$id","required","properties"]),i=Kg(r,t);return Ee(i,n)}function Zg(e){let t=e.reduce((r,n)=>Yi(n)?[...r,ke(n)]:r,[]);return Pe(t)}function ko(e,t){return We(e)?_t(qg(e.allOf,t)):be(e)?Pe(Lg(e.anyOf,t)):tt(e)?Vg(e,t,e.properties):Ee({})}function Lr(e,t,r){let n=Xe(t)?Zg(t):t,i=Dt(t)?Ot(t):t,s=Qe(e),o=Qe(t);return De(e)?Pl(e,i,r):Ft(t)?Ol(e,t,r):s&&o?Ae("Pick",[e,n],r):!s&&o?Ae("Pick",[e,n],r):s&&!o?Ae("Pick",[e,n],r):N({...ko(e,i),...r})}function Wg(e,t,r){return{[t]:Lr(e,[t],Ue(r))}}function Bg(e,t,r){return t.reduce((n,i)=>({...n,...Wg(e,i,r)}),{})}function Hg(e,t,r){return Bg(e,t.keys,r)}function Ol(e,t,r){let n=Hg(e,t,r);return Ie(n)}function Gg(e,t){return Ae("Partial",[Ae(e,t)])}function Yg(e){return Ae("Partial",[hr(e)])}function Jg(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=vt(e[r]);return t}function Qg(e,t){let r=Be(e,[nt,"$id","required","properties"]),n=Jg(t);return Ee(n,r)}function Cl(e){return e.map(t=>El(t))}function El(e){return tr(e)?Gg(e.target,e.parameters):Qe(e)?Yg(e.$ref):We(e)?_t(Cl(e.allOf)):be(e)?Pe(Cl(e.anyOf)):tt(e)?Qg(e,e.properties):Jr(e)||Ir(e)||ir(e)||Mt(e)||li(e)||sr(e)||$r(e)||di(e)||ci(e)?e:Ee({})}function On(e,t){return De(e)?Rl(e,t):N({...El(e),...t})}function Xg(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=On(e[n],Ue(t));return r}function ey(e,t){return Xg(e.properties,t)}function Rl(e,t){let r=ey(e,t);return Ie(r)}function ty(e,t){return Ae("Required",[Ae(e,t)])}function ry(e){return Ae("Required",[hr(e)])}function ny(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=Be(e[r],[mt]);return t}function iy(e,t){let r=Be(e,[nt,"$id","required","properties"]),n=ny(t);return Ee(n,r)}function Nl(e){return e.map(t=>jl(t))}function jl(e){return tr(e)?ty(e.target,e.parameters):Qe(e)?ry(e.$ref):We(e)?_t(Nl(e.allOf)):be(e)?Pe(Nl(e.anyOf)):tt(e)?iy(e,e.properties):Jr(e)||Ir(e)||ir(e)||Mt(e)||li(e)||sr(e)||$r(e)||di(e)||ci(e)?e:Ee({})}function Cn(e,t){return De(e)?Al(e,t):N({...jl(e),...t})}function sy(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Cn(e[n],t);return r}function oy(e,t){return sy(e.properties,t)}function Al(e,t){let r=oy(e,t);return Ie(r)}function ay(e,t){return t.map(r=>Qe(r)?To(e,r.$ref):qt(e,r))}function To(e,t){return t in e?Qe(e[t])?To(e,e[t].$ref):qt(e,e[t]):we()}function uy(e){return $n(e[0])}function ly(e){return zr(e[0],e[1])}function dy(e){return xn(e[0])}function cy(e){return On(e[0])}function fy(e){return qr(e[0],e[1])}function py(e){return Lr(e[0],e[1])}function my(e){return Cn(e[0])}function hy(e,t,r){let n=ay(e,r);return t==="Awaited"?uy(n):t==="Index"?ly(n):t==="KeyOf"?dy(n):t==="Partial"?cy(n):t==="Omit"?fy(n):t==="Pick"?py(n):t==="Required"?my(n):we()}function gy(e,t){return gn(qt(e,t))}function yy(e,t){return yn(qt(e,t))}function vy(e,t,r){return vn(Ii(e,t),qt(e,r))}function _y(e,t,r){return pr(Ii(e,t),qt(e,r))}function by(e,t){return _t(Ii(e,t))}function wy(e,t){return In(qt(e,t))}function Iy(e,t){return Ee(globalThis.Object.keys(t).reduce((r,n)=>({...r,[n]:qt(e,t[n])}),{}))}function $y(e,t){let[r,n]=[qt(e,hs(t)),ms(t)],i=mn(t);return i.patternProperties[n]=r,i}function xy(e,t){return Qe(t)?{...To(e,t.$ref),[nt]:t[nt]}:t}function Sy(e,t){return Wt(Ii(e,t))}function ky(e,t){return Pe(Ii(e,t))}function Ii(e,t){return t.map(r=>qt(e,r))}function qt(e,t){return Pt(t)?N(qt(e,Be(t,[mt])),t):hn(t)?N(qt(e,Be(t,[Xt])),t):jr(t)?N(xy(e,t),t):er(t)?N(gy(e,t.items),t):Yr(t)?N(yy(e,t.items),t):tr(t)?N(hy(e,t.target,t.parameters)):rr(t)?N(vy(e,t.parameters,t.returns),t):nr(t)?N(_y(e,t.parameters,t.returns),t):We(t)?N(by(e,t.allOf),t):Qr(t)?N(wy(e,t.items),t):tt(t)?N(Iy(e,t.properties),t):en(t)?N($y(e,t)):Ut(t)?N(Sy(e,t.items||[]),t):be(t)?N(ky(e,t.anyOf),t):t}function Ty(e,t){return t in e?qt(e,e[t]):we()}function Ml(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,r)=>({...t,[r]:Ty(e,r)}),{})}var Po=class{constructor(t){let r=Ml(t),n=this.WithIdentifiers(r);this.$defs=n}Import(t,r){let n={...this.$defs,[t]:N(this.$defs[t],r)};return N({[V]:"Import",$defs:n,$ref:t})}WithIdentifiers(t){return globalThis.Object.getOwnPropertyNames(t).reduce((r,n)=>({...r,[n]:{...t[n],$id:n}}),{})}};function Fl(e){return new Po(e)}function zl(e,t){return N({[V]:"Not",not:e},t)}function Ul(e,t){return nr(e)?Wt(e.parameters,t):we()}var Py=0;function Dl(e,t={}){et(t.$id)&&(t.$id=`T${Py++}`);let r=mn(e({[V]:"This",$ref:`${t.$id}`}));return r.$id=t.$id,N({[Vt]:"Recursive",...r},t)}function ql(e,t){let r=Ne(e)?new globalThis.RegExp(e):e;return N({[V]:"RegExp",type:"RegExp",source:r.source,flags:r.flags},t)}function Oy(e){return We(e)?e.allOf:be(e)?e.anyOf:Ut(e)?e.items??[]:[]}function Ll(e){return Oy(e)}function Kl(e,t){return nr(e)?N(e.returns,t):we(t)}var Oo=class{constructor(t){this.schema=t}Decode(t){return new Co(this.schema,t)}},Co=class{constructor(t,r){this.schema=t,this.decode=r}EncodeTransform(t,r){let s={Encode:o=>r[nt].Encode(t(o)),Decode:o=>this.decode(r[nt].Decode(o))};return{...r,[nt]:s}}EncodeSchema(t,r){let n={Decode:this.decode,Encode:t};return{...r,[nt]:n}}Encode(t){return jr(this.schema)?this.EncodeTransform(t,this.schema):this.EncodeSchema(t,this.schema)}};function Vl(e){return new Oo(e)}function Zl(e={}){return N({[V]:e[V]??"Unsafe"},e)}function Wl(e){return N({[V]:"Void",type:"void"},e)}var Eo={};Wi(Eo,{Any:()=>Fr,Argument:()=>Pu,Array:()=>gn,AsyncIterator:()=>yn,Awaited:()=>$n,BigInt:()=>wn,Boolean:()=>es,Capitalize:()=>Il,Composite:()=>Hu,Const:()=>Gu,Constructor:()=>vn,ConstructorParameters:()=>Yu,Date:()=>is,Enum:()=>Ju,Exclude:()=>Tn,Extends:()=>kn,Extract:()=>Pn,Function:()=>pr,Index:()=>zr,InstanceType:()=>hl,Instantiate:()=>yl,Integer:()=>vl,Intersect:()=>_t,Iterator:()=>In,KeyOf:()=>xn,Literal:()=>ke,Lowercase:()=>$l,Mapped:()=>Lu,Module:()=>Fl,Never:()=>we,Not:()=>zl,Null:()=>ss,Number:()=>Zt,Object:()=>Ee,Omit:()=>qr,Optional:()=>vt,Parameters:()=>Ul,Partial:()=>On,Pick:()=>Lr,Promise:()=>ns,Readonly:()=>Ct,ReadonlyOptional:()=>fs,Record:()=>ps,Recursive:()=>Dl,Ref:()=>hr,RegExp:()=>ql,Required:()=>Cn,Rest:()=>Ll,ReturnType:()=>Kl,String:()=>or,Symbol:()=>os,TemplateLiteral:()=>ts,Transform:()=>Vl,Tuple:()=>Wt,Uint8Array:()=>us,Uncapitalize:()=>xl,Undefined:()=>as,Union:()=>Pe,Unknown:()=>Ur,Unsafe:()=>Zl,Uppercase:()=>Sl,Void:()=>Wl});var ee=Eo;var J=null,sn=null,He={maxSessions:5,defaultBudgetUsd:5,idleTimeoutMinutes:30,maxPersistedSessions:50};function Bl(e){He={maxSessions:e.maxSessions??5,defaultBudgetUsd:e.defaultBudgetUsd??5,defaultModel:e.defaultModel,defaultWorkdir:e.defaultWorkdir,idleTimeoutMinutes:e.idleTimeoutMinutes??30,maxPersistedSessions:e.maxPersistedSessions??50,fallbackChannel:e.fallbackChannel}}function Ro(e){J=e}function No(e){sn=e}function xt(e,t){if(t&&String(t).includes(":"))return String(t);if(e?.channel&&e?.chatId)return`${e.channel}:${e.chatId}`;if(e?.channel&&e?.senderId)return`${e.channel}:${e.senderId}`;if(e?.id&&/^-?\d+$/.test(String(e.id)))return`telegram:${e.id}`;if(e?.channelId&&String(e.channelId).includes(":"))return String(e.channelId);let r=He.fallbackChannel??"unknown";return console.log(`[resolveOriginChannel] Could not resolve channel from ctx keys: ${e?Object.keys(e).join(", "):"null"}, using fallback=${r}`),r}function ht(e){let t=Math.floor(e/1e3),r=Math.floor(t/60),n=t%60;return r>0?`${r}m${n}s`:`${n}s`}var Cy=new Set(["a","an","the","is","are","was","were","be","been","being","have","has","had","do","does","did","will","would","could","should","may","might","shall","can","need","must","i","me","my","we","our","you","your","it","its","he","she","to","of","in","for","on","with","at","by","from","as","into","through","about","that","this","these","those","and","or","but","if","then","so","not","no","please","just","also","very","all","some","any","each","make","write","create","build","implement","add","update"]);function Hl(e){let r=e.toLowerCase().replace(/[^a-z0-9\s-]/g," ").split(/\s+/).filter(n=>n.length>1&&!Cy.has(n)).slice(0,3);return r.length===0?"session":r.join("-")}var Ey={starting:"\u{1F7E1}",running:"\u{1F7E2}",completed:"\u2705",failed:"\u274C",killed:"\u26D4"};function En(e){let t=Ey[e.status]??"\u2753",r=ht(e.duration),n=e.foregroundChannels.size>0?"foreground":"background",i=e.multiTurn?"multi-turn":"single",s=e.prompt.length>80?e.prompt.slice(0,80)+"...":e.prompt,o=[`${t} ${e.name} [${e.id}] (${r}) \u2014 ${n}, ${i}`,` \u{1F4C1} ${e.workdir}`,` \u{1F4DD} "${s}"`];return e.claudeSessionId&&o.push(` \u{1F517} Claude ID: ${e.claudeSessionId}`),e.resumeSessionId&&o.push(` \u21A9\uFE0F Resumed from: ${e.resumeSessionId}${e.forkSession?" (forked)":""}`),o.join(`
2
+ `)}function Rn(e){let t=e.sessionsWithDuration>0?e.totalDurationMs/e.sessionsWithDuration:0,r=J?J.list("running").length:0,{completed:n,failed:i,killed:s}=e.sessionsByStatus,o=n+i+s,a=["\u{1F4CA} Claude Code Plugin Stats","","\u{1F4CB} Sessions",` Launched: ${e.totalLaunched}`,` Running: ${r}`,` Completed: ${n}`,` Failed: ${i}`,` Killed: ${s}`,"",`\u23F1\uFE0F Average duration: ${t>0?ht(t):"n/a"}`];if(e.mostExpensive){let u=e.mostExpensive;a.push("","\u{1F3C6} Notable session",` ${u.name} [${u.id}]`,` \u{1F4DD} "${u.prompt}"`)}return a.join(`
3
+ `)}function Gl(e){e.registerTool({name:"claude_launch",description:"Launch a Claude Code session in background to execute a development task. Supports resuming previous sessions and multi-turn conversations. Returns a session ID and name for tracking.",parameters:ee.Object({prompt:ee.String({description:"The task prompt to execute"}),name:ee.Optional(ee.String({description:"Short human-readable name for the session (kebab-case, e.g. 'fix-auth'). Auto-generated from prompt if omitted."})),workdir:ee.Optional(ee.String({description:"Working directory (defaults to cwd)"})),model:ee.Optional(ee.String({description:"Model name to use"})),max_budget_usd:ee.Optional(ee.Number({description:"Maximum budget in USD (default 5)"})),system_prompt:ee.Optional(ee.String({description:"Additional system prompt"})),allowed_tools:ee.Optional(ee.Array(ee.String(),{description:"List of allowed tools"})),resume_session_id:ee.Optional(ee.String({description:"Claude session ID to resume (from a previous session's claudeSessionId). Continues the conversation from where it left off."})),fork_session:ee.Optional(ee.Boolean({description:"When resuming, fork to a new session instead of continuing the existing one. Use with resume_session_id."})),multi_turn:ee.Optional(ee.Boolean({description:"Enable multi-turn mode. The session stays open for follow-up messages via claude_respond. Default: false."})),permission_mode:ee.Optional(ee.Union([ee.Literal("default"),ee.Literal("plan"),ee.Literal("acceptEdits"),ee.Literal("bypassPermissions")],{description:"Permission mode for the session. Defaults to plugin config or 'bypassPermissions'."})),channel:ee.Optional(ee.String({description:'Origin channel for notifications, in "channel:target" format (e.g. "telegram:123456789"). Pass this when calling from an agent tool context so notifications reach the right channel.'}))}),async execute(t,r){if(!J)return{content:[{type:"text",text:"Error: SessionManager not initialized. The claude-code service must be running."}]};let n=r.workdir||He.defaultWorkdir||process.cwd(),i=r.max_budget_usd??He.defaultBudgetUsd??5;try{let s=r.resume_session_id;if(s){let l=J.resolveClaudeSessionId(s);if(!l)return{content:[{type:"text",text:`Error: Could not resolve resume_session_id "${s}" to a Claude session ID. Use claude_sessions to list available sessions.`}]};s=l}let o=J.spawn({prompt:r.prompt,name:r.name,workdir:n,model:r.model||He.defaultModel,maxBudgetUsd:i,systemPrompt:r.system_prompt,allowedTools:r.allowed_tools,resumeSessionId:s,forkSession:r.fork_session,multiTurn:r.multi_turn,permissionMode:r.permission_mode,originChannel:xt({id:t},r.channel)}),a=r.prompt.length>80?r.prompt.slice(0,80)+"...":r.prompt,u=["Session launched successfully.",` Name: ${o.name}`,` ID: ${o.id}`,` Dir: ${n}`,` Model: ${o.model??"default"}`,` Prompt: "${a}"`];return r.resume_session_id&&u.push(` Resume: ${r.resume_session_id}${r.fork_session?" (forked)":""}`),r.multi_turn&&u.push(" Mode: multi-turn (use claude_respond to send follow-up messages)"),u.push(""),u.push("Use claude_sessions to check status, claude_output to see output."),{content:[{type:"text",text:u.join(`
4
+ `)}]}}catch(s){return{content:[{type:"text",text:`Error launching session: ${s.message}`}]}}}},{optional:!1})}function Yl(e){e.registerTool({name:"claude_sessions",description:"List all Claude Code sessions with their status and progress.",parameters:ee.Object({status:ee.Optional(ee.Union([ee.Literal("all"),ee.Literal("running"),ee.Literal("completed"),ee.Literal("failed")],{description:'Filter by status (default "all")'}))}),async execute(t,r){if(!J)return{content:[{type:"text",text:"Error: SessionManager not initialized. The claude-code service must be running."}]};let n=r.status||"all",i=J.list(n);return i.length===0?{content:[{type:"text",text:"No sessions found."}]}:{content:[{type:"text",text:i.map(En).join(`
5
+
6
+ `)}]}}},{optional:!1})}function Jl(e){e.registerTool({name:"claude_kill",description:"Terminate a running Claude Code session by name or ID.",parameters:ee.Object({session:ee.String({description:"Session name or ID to terminate"})}),async execute(t,r){if(!J)return{content:[{type:"text",text:"Error: SessionManager not initialized. The claude-code service must be running."}]};let n=J.resolve(r.session);return n?n.status==="completed"||n.status==="failed"||n.status==="killed"?{content:[{type:"text",text:`Session ${n.name} [${n.id}] is already ${n.status}. No action needed.`}]}:(J.kill(n.id),{content:[{type:"text",text:`Session ${n.name} [${n.id}] has been terminated.`}]}):{content:[{type:"text",text:`Error: Session "${r.session}" not found.`}]}}},{optional:!1})}function Ql(e){e.registerTool({name:"claude_output",description:"Show recent output from a Claude Code session (by name or ID).",parameters:ee.Object({session:ee.String({description:"Session name or ID to get output from"}),lines:ee.Optional(ee.Number({description:"Number of recent lines to show (default 50)"})),full:ee.Optional(ee.Boolean({description:"Show all available output"}))}),async execute(t,r){if(!J)return{content:[{type:"text",text:"Error: SessionManager not initialized. The claude-code service must be running."}]};let n=J.resolve(r.session);if(!n)return{content:[{type:"text",text:`Error: Session "${r.session}" not found.`}]};let i=r.full?n.getOutput():n.getOutput(r.lines??50),s=ht(n.duration),o=[`Session: ${n.name} [${n.id}] | Status: ${n.status.toUpperCase()} | Duration: ${s}`,`${"\u2500".repeat(60)}`].join(`
7
+ `);return i.length===0?{content:[{type:"text",text:`${o}
8
+ (no output yet)`}]}:{content:[{type:"text",text:`${o}
9
+ ${i.join(`
10
+ `)}`}]}}},{optional:!1})}function Xl(e){e.registerTool({name:"claude_fg",description:"Bring a Claude Code session to foreground (by name or ID). Shows buffered output and streams new output.",parameters:ee.Object({session:ee.String({description:"Session name or ID to bring to foreground"}),lines:ee.Optional(ee.Number({description:"Number of recent buffered lines to show (default 30)"})),channel:ee.Optional(ee.String({description:'Origin channel in "channel:target" format (e.g. "telegram:123456789"). Pass this when calling from an agent tool context.'}))}),async execute(t,r){if(!J)return{content:[{type:"text",text:"Error: SessionManager not initialized. The claude-code service must be running."}]};let n=J.resolve(r.session);if(!n)return{content:[{type:"text",text:`Error: Session "${r.session}" not found.`}]};let i=xt({id:t},r.channel),s=n.getCatchupOutput(i);n.foregroundChannels.add(i);let o=ht(n.duration),a=[`Session ${n.name} [${n.id}] now in foreground.`,`Status: ${n.status.toUpperCase()} | Duration: ${o}`,`${"\u2500".repeat(60)}`].join(`
11
+ `),u="";s.length>0&&(u=[`\u{1F4CB} Catchup (${s.length} missed output${s.length===1?"":"s"}):`,s.join(`
12
+ `),`${"\u2500".repeat(60)}`].join(`
13
+ `));let l=s.length>0?u:n.getOutput(r.lines??30).length>0?n.getOutput(r.lines??30).join(`
14
+ `):"(no output yet)",m=n.status==="running"||n.status==="starting"?`
15
+ ${"\u2500".repeat(60)}
16
+ Streaming new output... Use claude_bg to detach.`:`
17
+ ${"\u2500".repeat(60)}
18
+ Session is ${n.status}. No more output expected.`;return n.markFgOutputSeen(i),{content:[{type:"text",text:`${a}
19
+ ${l}${m}`}]}}},{optional:!1})}function ed(e){e.registerTool({name:"claude_bg",description:"Send a Claude Code session back to background (stop streaming). If no session specified, detaches whichever session is currently in foreground.",parameters:ee.Object({session:ee.Optional(ee.String({description:"Session name or ID to send to background. If omitted, detaches the current foreground session."})),channel:ee.Optional(ee.String({description:'Origin channel in "channel:target" format (e.g. "telegram:123456789"). Pass this when calling from an agent tool context.'}))}),async execute(t,r){if(!J)return{content:[{type:"text",text:"Error: SessionManager not initialized. The claude-code service must be running."}]};if(r.session){let a=J.resolve(r.session);if(!a)return{content:[{type:"text",text:`Error: Session "${r.session}" not found.`}]};let u=xt({id:t},r.channel);return a.saveFgOutputOffset(u),a.foregroundChannels.delete(u),{content:[{type:"text",text:`Session ${a.name} [${a.id}] moved to background.`}]}}let n=xt({id:t},r.channel),s=J.list("all").filter(a=>a.foregroundChannels.has(n));if(s.length===0)return{content:[{type:"text",text:"No session is currently in foreground."}]};let o=[];for(let a of s)a.saveFgOutputOffset(n),a.foregroundChannels.delete(n),o.push(`${a.name} [${a.id}]`);return{content:[{type:"text",text:`Moved to background: ${o.join(", ")}`}]}}},{optional:!1})}function td(e){e.registerTool({name:"claude_respond",description:"Send a follow-up message to a running Claude Code session. The session must be running. Works with multi-turn sessions (launched with multi_turn: true) or any running session via SDK streamInput.",parameters:ee.Object({session:ee.String({description:"Session name or ID to respond to"}),message:ee.String({description:"The message to send to the session"}),interrupt:ee.Optional(ee.Boolean({description:"If true, interrupt the current turn before sending the message. Useful to redirect the session mid-response."}))}),async execute(t,r){if(!J)return{content:[{type:"text",text:"Error: SessionManager not initialized. The claude-code service must be running."}]};let n=J.resolve(r.session);if(!n)return{content:[{type:"text",text:`Error: Session "${r.session}" not found.`}]};if(n.status!=="running")return{content:[{type:"text",text:`Error: Session ${n.name} [${n.id}] is not running (status: ${n.status}). Cannot send a message to a non-running session.`}]};try{if(r.interrupt&&await n.interrupt(),await n.sendMessage(r.message),sn&&n.originChannel){let s=[`\u21A9\uFE0F [${n.name}] Responded:`,r.message].join(`
20
+ `);sn.emitToChannel(n.originChannel,s)}let i=r.message.length>80?r.message.slice(0,80)+"...":r.message;return{content:[{type:"text",text:[`Message sent to session ${n.name} [${n.id}].`,r.interrupt?" (interrupted current turn first)":"",` Message: "${i}"`,"","Use claude_output to see the response."].filter(Boolean).join(`
21
+ `)}]}}catch(i){return{content:[{type:"text",text:`Error sending message: ${i.message}`}]}}}},{optional:!1})}function rd(e){e.registerTool({name:"claude_stats",description:"Show Claude Code Plugin usage metrics: session counts by status, average duration, and notable sessions.",parameters:ee.Object({}),async execute(t,r){if(!J)return{content:[{type:"text",text:"Error: SessionManager not initialized. The claude-code service must be running."}]};let n=J.getMetrics();return{content:[{type:"text",text:Rn(n)}]}}},{optional:!1})}function nd(e){e.registerCommand({name:"claude",description:"Launch a Claude Code session. Usage: /claude [--name <name>] <prompt>",acceptsArgs:!0,requireAuth:!0,handler:t=>{if(!J)return{text:"Error: SessionManager not initialized. The claude-code service must be running."};let r=(t.args??"").trim();if(!r)return{text:"Usage: /claude [--name <name>] <prompt>"};let n,i=r.match(/^--name\s+(\S+)\s+/);i&&(n=i[1],r=r.slice(i[0].length).trim());let s=r;if(!s)return{text:"Usage: /claude [--name <name>] <prompt>"};try{let o=J.spawn({prompt:s,name:n,workdir:He.defaultWorkdir||process.cwd(),model:He.defaultModel,maxBudgetUsd:He.defaultBudgetUsd??5,originChannel:xt(t)}),a=s.length>80?s.slice(0,80)+"...":s;return{text:["Session launched.",` Name: ${o.name}`,` ID: ${o.id}`,` Prompt: "${a}"`,` Status: ${o.status}`].join(`
22
+ `)}}catch(o){return{text:`Error: ${o.message}`}}}})}function id(e){e.registerCommand({name:"claude_sessions",description:"List all Claude Code sessions",acceptsArgs:!1,requireAuth:!0,handler:()=>{if(!J)return{text:"Error: SessionManager not initialized. The claude-code service must be running."};let t=J.list("all");return t.length===0?{text:"No sessions found."}:{text:t.map(En).join(`
23
+
24
+ `)}}})}function sd(e){e.registerCommand({name:"claude_kill",description:"Kill a Claude Code session by name or ID",acceptsArgs:!0,requireAuth:!0,handler:t=>{if(!J)return{text:"Error: SessionManager not initialized. The claude-code service must be running."};let r=t.args?.trim();if(!r)return{text:"Usage: /claude_kill <name-or-id>"};let n=J.resolve(r);return n?n.status==="completed"||n.status==="failed"||n.status==="killed"?{text:`Session ${n.name} [${n.id}] is already ${n.status}. No action needed.`}:(J.kill(n.id),{text:`Session ${n.name} [${n.id}] has been terminated.`}):{text:`Error: Session "${r}" not found.`}}})}function od(e){e.registerCommand({name:"claude_fg",description:"Bring a Claude Code session to foreground by name or ID",acceptsArgs:!0,requireAuth:!0,handler:t=>{if(!J)return{text:"Error: SessionManager not initialized. The claude-code service must be running."};let r=t.args?.trim();if(!r)return{text:"Usage: /claude_fg <name-or-id>"};let n=J.resolve(r);if(!n)return{text:`Error: Session "${r}" not found.`};let i=xt(t),s=n.getCatchupOutput(i);n.foregroundChannels.add(i);let o=ht(n.duration),a=[`Session ${n.name} [${n.id}] now in foreground.`,`Status: ${n.status.toUpperCase()} | Duration: ${o}`,`${"\u2500".repeat(60)}`].join(`
25
+ `),u="";s.length>0&&(u=[`\u{1F4CB} Catchup (${s.length} missed output${s.length===1?"":"s"}):`,s.join(`
26
+ `),`${"\u2500".repeat(60)}`].join(`
27
+ `));let l=s.length>0?u:n.getOutput(30).length>0?n.getOutput(30).join(`
28
+ `):"(no output yet)",m=n.status==="running"||n.status==="starting"?`
29
+ ${"\u2500".repeat(60)}
30
+ Streaming... Use /claude_bg to detach.`:`
31
+ ${"\u2500".repeat(60)}
32
+ Session is ${n.status}.`;return n.markFgOutputSeen(i),{text:`${a}
33
+ ${l}${m}`}}})}function ad(e){e.registerCommand({name:"claude_bg",description:"Send the current foreground session back to background",acceptsArgs:!0,requireAuth:!0,handler:t=>{if(!J)return{text:"Error: SessionManager not initialized. The claude-code service must be running."};let r=xt(t),n=t.args?.trim();if(n){let a=J.resolve(n);return a?(a.saveFgOutputOffset(r),a.foregroundChannels.delete(r),{text:`Session ${a.name} [${a.id}] moved to background.`}):{text:`Error: Session "${n}" not found.`}}let s=J.list("all").filter(a=>a.foregroundChannels.has(r));if(s.length===0)return{text:"No session is currently in foreground."};let o=[];for(let a of s)a.saveFgOutputOffset(r),a.foregroundChannels.delete(r),o.push(`${a.name} [${a.id}]`);return{text:`Moved to background: ${o.join(", ")}`}}})}function ud(e){e.registerCommand({name:"claude_resume",description:"Resume a previous Claude Code session. Usage: /claude_resume <id-or-name> [prompt] or /claude_resume --list to see resumable sessions.",acceptsArgs:!0,requireAuth:!0,handler:t=>{if(!J)return{text:"Error: SessionManager not initialized. The claude-code service must be running."};let r=(t.args??"").trim();if(!r)return{text:`Usage: /claude_resume <id-or-name> [prompt]
34
+ /claude_resume --list \u2014 list resumable sessions
35
+ /claude_resume --fork <id-or-name> [prompt] \u2014 fork instead of continuing`};if(r==="--list"){let v=J.listPersistedSessions();return v.length===0?{text:"No resumable sessions found. Sessions are persisted after completion."}:{text:`Resumable sessions:
36
+
37
+ ${v.map(I=>{let T=I.prompt.length>60?I.prompt.slice(0,60)+"...":I.prompt,k=I.completedAt?`completed ${ht(Date.now()-I.completedAt)} ago`:I.status;return[` ${I.name} \u2014 ${k}`,` Claude ID: ${I.claudeSessionId}`,` \u{1F4C1} ${I.workdir}`,` \u{1F4DD} "${T}"`].join(`
38
+ `)}).join(`
39
+
40
+ `)}`}}let n=!1;r.startsWith("--fork ")&&(n=!0,r=r.slice(7).trim());let i=r.indexOf(" "),s,o;i===-1?(s=r,o="Continue where you left off."):(s=r.slice(0,i),o=r.slice(i+1).trim()||"Continue where you left off.");let a=J.resolveClaudeSessionId(s);if(!a)return{text:`Error: Could not find a Claude session ID for "${s}".
41
+ Use /claude_resume --list to see available sessions.`};let u=t.config??{},l=J.getPersistedSession(s),m=l?.workdir??process.cwd();try{let v=J.spawn({prompt:o,workdir:m,model:l?.model??u.defaultModel,maxBudgetUsd:u.defaultBudgetUsd??5,resumeSessionId:a,forkSession:n,originChannel:xt(t)}),w=o.length>80?o.slice(0,80)+"...":o;return{text:[`Session resumed${n?" (forked)":""}.`,` Name: ${v.name}`,` ID: ${v.id}`,` Resume from: ${a}`,` Dir: ${m}`,` Prompt: "${w}"`].join(`
42
+ `)}}catch(v){return{text:`Error: ${v.message}`}}}})}function ld(e){e.registerCommand({name:"claude_respond",description:"Send a follow-up message to a running Claude Code session. Usage: /claude_respond <id-or-name> <message>",acceptsArgs:!0,requireAuth:!0,handler:async t=>{if(!J)return{text:"Error: SessionManager not initialized. The claude-code service must be running."};let r=(t.args??"").trim();if(!r)return{text:`Usage: /claude_respond <id-or-name> <message>
43
+ /claude_respond --interrupt <id-or-name> <message>`};let n=!1,i=r;i.startsWith("--interrupt ")&&(n=!0,i=i.slice(12).trim());let s=i.indexOf(" ");if(s===-1)return{text:"Error: Missing message. Usage: /claude_respond <id-or-name> <message>"};let o=i.slice(0,s),a=i.slice(s+1).trim();if(!a)return{text:"Error: Empty message. Usage: /claude_respond <id-or-name> <message>"};let u=J.resolve(o);if(!u)return{text:`Error: Session "${o}" not found.`};if(u.status!=="running")return{text:`Error: Session ${u.name} [${u.id}] is not running (status: ${u.status}).`};try{if(n&&await u.interrupt(),await u.sendMessage(a),sn&&u.originChannel){let m=[`\u21A9\uFE0F [${u.name}] Responded:`,a].join(`
44
+ `);sn.emitToChannel(u.originChannel,m)}let l=a.length>80?a.slice(0,80)+"...":a;return{text:[`Message sent to ${u.name} [${u.id}].`,n?" (interrupted current turn)":"",` "${l}"`].filter(Boolean).join(`
45
+ `)}}catch(l){return{text:`Error: ${l.message}`}}}})}function dd(e){e.registerCommand({name:"claude_stats",description:"Show Claude Code Plugin usage metrics",acceptsArgs:!1,requireAuth:!0,handler:()=>{if(!J)return{text:"Error: SessionManager not initialized. The claude-code service must be running."};let t=J.getMetrics();return{text:Rn(t)}}})}function cd(e){e.registerGatewayMethod("claude-code.sessions",({respond:t,params:r})=>{if(!J)return t(!1,{error:"SessionManager not initialized"});let n=r?.status??"all",s=J.list(n).map(o=>({id:o.id,name:o.name,status:o.status,prompt:o.prompt,workdir:o.workdir,model:o.model,costUsd:o.costUsd,startedAt:o.startedAt,completedAt:o.completedAt,durationMs:o.duration,claudeSessionId:o.claudeSessionId,foreground:o.foregroundChannels.size>0,multiTurn:o.multiTurn,display:En(o)}));t(!0,{sessions:s,count:s.length})}),e.registerGatewayMethod("claude-code.launch",({respond:t,params:r})=>{if(!J)return t(!1,{error:"SessionManager not initialized"});if(!r?.prompt)return t(!1,{error:"Missing required parameter: prompt"});try{let n=J.spawn({prompt:r.prompt,name:r.name,workdir:r.workdir||He.defaultWorkdir||process.cwd(),model:r.model||He.defaultModel,maxBudgetUsd:r.maxBudgetUsd??r.max_budget_usd??He.defaultBudgetUsd??5,systemPrompt:r.systemPrompt??r.system_prompt,allowedTools:r.allowedTools??r.allowed_tools,resumeSessionId:r.resumeSessionId??r.resume_session_id,forkSession:r.forkSession??r.fork_session,multiTurn:r.multiTurn??r.multi_turn,originChannel:r.originChannel??"gateway"});t(!0,{id:n.id,name:n.name,status:n.status,workdir:n.workdir,model:n.model})}catch(n){t(!1,{error:n.message})}}),e.registerGatewayMethod("claude-code.kill",({respond:t,params:r})=>{if(!J)return t(!1,{error:"SessionManager not initialized"});let n=r?.session??r?.id;if(!n)return t(!1,{error:"Missing required parameter: session (name or ID)"});let i=J.resolve(n);if(!i)return t(!1,{error:`Session "${n}" not found`});if(i.status==="completed"||i.status==="failed"||i.status==="killed")return t(!0,{id:i.id,name:i.name,status:i.status,message:`Session already ${i.status}`});J.kill(i.id),t(!0,{id:i.id,name:i.name,status:"killed",message:`Session ${i.name} [${i.id}] terminated`})}),e.registerGatewayMethod("claude-code.output",({respond:t,params:r})=>{if(!J)return t(!1,{error:"SessionManager not initialized"});let n=r?.session??r?.id;if(!n)return t(!1,{error:"Missing required parameter: session (name or ID)"});let i=J.resolve(n);if(!i)return t(!1,{error:`Session "${n}" not found`});let s=r?.full?i.getOutput():i.getOutput(r?.lines??50);t(!0,{id:i.id,name:i.name,status:i.status,costUsd:i.costUsd,durationMs:i.duration,duration:ht(i.duration),lines:s,lineCount:s.length,result:i.result??null})}),e.registerGatewayMethod("claude-code.stats",({respond:t,params:r})=>{if(!J)return t(!1,{error:"SessionManager not initialized"});let n=J.getMetrics(),i={};for(let[o,a]of n.costPerDay)i[o]=a;let s=J.list("running").length;t(!0,{totalCostUsd:n.totalCostUsd,costPerDay:i,sessionsByStatus:{...n.sessionsByStatus,running:s},totalLaunched:n.totalLaunched,averageDurationMs:n.sessionsWithDuration>0?n.totalDurationMs/n.sessionsWithDuration:0,mostExpensive:n.mostExpensive,display:Rn(n)})})}var ka=require("child_process");var Uo=require("path"),Jd=require("url"),Qd=require("events"),ec=require("child_process"),tc=require("readline"),ce=Ca(require("fs"),1),_r=require("fs/promises"),oc=require("path"),ac=require("os"),un=require("path"),lc=require("process"),Do=require("fs"),dc=require("crypto"),_c=require("crypto"),ei=require("fs"),qo=require("path"),bc=require("crypto");var JS={},Ry=Object.create,{getPrototypeOf:Ny,defineProperty:zo,getOwnPropertyNames:jy}=Object,Ay=Object.prototype.hasOwnProperty,Ld=(e,t,r)=>{r=e!=null?Ry(Ny(e)):{};let n=t||!e||!e.__esModule?zo(r,"default",{value:e,enumerable:!0}):r;for(let i of jy(e))Ay.call(n,i)||zo(n,i,{get:()=>e[i],enumerable:!0});return n},Q=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Kd=(e,t)=>{for(var r in t)zo(e,r,{get:t[r],enumerable:!0,configurable:!0,set:n=>t[r]=()=>n})};var ws=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends t{constructor(p){if(super(),!e.IDENTIFIER.test(p))throw Error("CodeGen: name must be a valid identifier");this.str=p}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(p){super(),this._items=typeof p=="string"?[p]:p}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let p=this._items[0];return p===""||p==='""'}get str(){var p;return(p=this._str)!==null&&p!==void 0?p:this._str=this._items.reduce((c,d)=>`${c}${d}`,"")}get names(){var p;return(p=this._names)!==null&&p!==void 0?p:this._names=this._items.reduce((c,d)=>(d instanceof r&&(c[d.str]=(c[d.str]||0)+1),c),{})}}e._Code=n,e.nil=new n("");function i(f,...p){let c=[f[0]],d=0;for(;d<p.length;)a(c,p[d]),c.push(f[++d]);return new n(c)}e._=i;var s=new n("+");function o(f,...p){let c=[I(f[0])],d=0;for(;d<p.length;)c.push(s),a(c,p[d]),c.push(s,I(f[++d]));return u(c),new n(c)}e.str=o;function a(f,p){p instanceof n?f.push(...p._items):p instanceof r?f.push(p):f.push(v(p))}e.addCodeArg=a;function u(f){let p=1;for(;p<f.length-1;){if(f[p]===s){let c=l(f[p-1],f[p+1]);if(c!==void 0){f.splice(p-1,3,c);continue}f[p++]="+"}p++}}function l(f,p){if(p==='""')return f;if(f==='""')return p;if(typeof f=="string")return p instanceof r||f[f.length-1]!=='"'?void 0:typeof p!="string"?`${f.slice(0,-1)}${p}"`:p[0]==='"'?f.slice(0,-1)+p.slice(1):void 0;if(typeof p=="string"&&p[0]==='"'&&!(f instanceof r))return`"${f}${p.slice(1)}`}function m(f,p){return p.emptyStr()?f:f.emptyStr()?p:o`${f}${p}`}e.strConcat=m;function v(f){return typeof f=="number"||typeof f=="boolean"||f===null?f:I(Array.isArray(f)?f.join(","):f)}function w(f){return new n(I(f))}e.stringify=w;function I(f){return JSON.stringify(f).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=I;function T(f){return typeof f=="string"&&e.IDENTIFIER.test(f)?new n(`.${f}`):i`[${f}]`}e.getProperty=T;function k(f){if(typeof f=="string"&&e.IDENTIFIER.test(f))return new n(`${f}`);throw Error(`CodeGen: invalid export name: ${f}, use explicit $id name mapping`)}e.getEsmExportName=k;function b(f){return new n(f.toString())}e.regexpCode=b}),fd=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;var t=ws();class r extends Error{constructor(l){super(`CodeGen: "code" for ${l} not defined`),this.value=l.value}}var n;(function(u){u[u.Started=0]="Started",u[u.Completed=1]="Completed"})(n||(e.UsedValueState=n={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class i{constructor({prefixes:l,parent:m}={}){this._names={},this._prefixes=l,this._parent=m}toName(l){return l instanceof t.Name?l:this.name(l)}name(l){return new t.Name(this._newName(l))}_newName(l){let m=this._names[l]||this._nameGroup(l);return`${l}${m.index++}`}_nameGroup(l){var m,v;if(!((v=(m=this._parent)===null||m===void 0?void 0:m._prefixes)===null||v===void 0)&&v.has(l)||this._prefixes&&!this._prefixes.has(l))throw Error(`CodeGen: prefix "${l}" is not allowed in this scope`);return this._names[l]={prefix:l,index:0}}}e.Scope=i;class s extends t.Name{constructor(l,m){super(m),this.prefix=l}setValue(l,{property:m,itemIndex:v}){this.value=l,this.scopePath=t._`.${new t.Name(m)}[${v}]`}}e.ValueScopeName=s;var o=t._`\n`;class a extends i{constructor(l){super(l),this._values={},this._scope=l.scope,this.opts={...l,_n:l.lines?o:t.nil}}get(){return this._scope}name(l){return new s(l,this._newName(l))}value(l,m){var v;if(m.ref===void 0)throw Error("CodeGen: ref must be passed in value");let w=this.toName(l),{prefix:I}=w,T=(v=m.key)!==null&&v!==void 0?v:m.ref,k=this._values[I];if(k){let p=k.get(T);if(p)return p}else k=this._values[I]=new Map;k.set(T,w);let b=this._scope[I]||(this._scope[I]=[]),f=b.length;return b[f]=m.ref,w.setValue(m,{property:I,itemIndex:f}),w}getValue(l,m){let v=this._values[l];if(v)return v.get(m)}scopeRefs(l,m=this._values){return this._reduceValues(m,v=>{if(v.scopePath===void 0)throw Error(`CodeGen: name "${v}" has no value`);return t._`${l}${v.scopePath}`})}scopeCode(l=this._values,m,v){return this._reduceValues(l,w=>{if(w.value===void 0)throw Error(`CodeGen: name "${w}" has no value`);return w.value.code},m,v)}_reduceValues(l,m,v={},w){let I=t.nil;for(let T in l){let k=l[T];if(!k)continue;let b=v[T]=v[T]||new Map;k.forEach(f=>{if(b.has(f))return;b.set(f,n.Started);let p=m(f);if(p){let c=this.opts.es5?e.varKinds.var:e.varKinds.const;I=t._`${I}${c} ${f} = ${p};${this.opts._n}`}else if(p=w?.(f))I=t._`${I}${p}${this.opts._n}`;else throw new r(f);b.set(f,n.Completed)})}return I}}e.ValueScope=a}),me=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;var t=ws(),r=fd(),n=ws();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var i=fd();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class s{optimizeNodes(){return this}optimizeNames(g,x){return this}}class o extends s{constructor(g,x,M){super(),this.varKind=g,this.name=x,this.rhs=M}render({es5:g,_n:x}){let M=g?r.varKinds.var:this.varKind,re=this.rhs===void 0?"":` = ${this.rhs}`;return`${M} ${this.name}${re};`+x}optimizeNames(g,x){if(g[this.name.str])return this.rhs&&(this.rhs=X(this.rhs,g,x)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class a extends s{constructor(g,x,M){super(),this.lhs=g,this.rhs=x,this.sideEffects=M}render({_n:g}){return`${this.lhs} = ${this.rhs};`+g}optimizeNames(g,x){if(!(this.lhs instanceof t.Name&&!g[this.lhs.str]&&!this.sideEffects))return this.rhs=X(this.rhs,g,x),this}get names(){let g=this.lhs instanceof t.Name?{}:{...this.lhs.names};return W(g,this.rhs)}}class u extends a{constructor(g,x,M,re){super(g,M,re),this.op=x}render({_n:g}){return`${this.lhs} ${this.op}= ${this.rhs};`+g}}class l extends s{constructor(g){super(),this.label=g,this.names={}}render({_n:g}){return`${this.label}:`+g}}class m extends s{constructor(g){super(),this.label=g,this.names={}}render({_n:g}){return`break${this.label?` ${this.label}`:""};`+g}}class v extends s{constructor(g){super(),this.error=g}render({_n:g}){return`throw ${this.error};`+g}get names(){return this.error.names}}class w extends s{constructor(g){super(),this.code=g}render({_n:g}){return`${this.code};`+g}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(g,x){return this.code=X(this.code,g,x),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class I extends s{constructor(g=[]){super(),this.nodes=g}render(g){return this.nodes.reduce((x,M)=>x+M.render(g),"")}optimizeNodes(){let{nodes:g}=this,x=g.length;for(;x--;){let M=g[x].optimizeNodes();Array.isArray(M)?g.splice(x,1,...M):M?g[x]=M:g.splice(x,1)}return g.length>0?this:void 0}optimizeNames(g,x){let{nodes:M}=this,re=M.length;for(;re--;){let se=M[re];se.optimizeNames(g,x)||(G(g,se.names),M.splice(re,1))}return M.length>0?this:void 0}get names(){return this.nodes.reduce((g,x)=>L(g,x.names),{})}}class T extends I{render(g){return"{"+g._n+super.render(g)+"}"+g._n}}class k extends I{}class b extends T{}b.kind="else";class f extends T{constructor(g,x){super(x),this.condition=g}render(g){let x=`if(${this.condition})`+super.render(g);return this.else&&(x+="else "+this.else.render(g)),x}optimizeNodes(){super.optimizeNodes();let g=this.condition;if(g===!0)return this.nodes;let x=this.else;if(x){let M=x.optimizeNodes();x=this.else=Array.isArray(M)?new b(M):M}if(x)return g===!1?x instanceof f?x:x.nodes:this.nodes.length?this:new f(Je(g),x instanceof f?[x]:x.nodes);if(!(g===!1||!this.nodes.length))return this}optimizeNames(g,x){var M;if(this.else=(M=this.else)===null||M===void 0?void 0:M.optimizeNames(g,x),!!(super.optimizeNames(g,x)||this.else))return this.condition=X(this.condition,g,x),this}get names(){let g=super.names;return W(g,this.condition),this.else&&L(g,this.else.names),g}}f.kind="if";class p extends T{}p.kind="for";class c extends p{constructor(g){super(),this.iteration=g}render(g){return`for(${this.iteration})`+super.render(g)}optimizeNames(g,x){if(super.optimizeNames(g,x))return this.iteration=X(this.iteration,g,x),this}get names(){return L(super.names,this.iteration.names)}}class d extends p{constructor(g,x,M,re){super(),this.varKind=g,this.name=x,this.from=M,this.to=re}render(g){let x=g.es5?r.varKinds.var:this.varKind,{name:M,from:re,to:se}=this;return`for(${x} ${M}=${re}; ${M}<${se}; ${M}++)`+super.render(g)}get names(){let g=W(super.names,this.from);return W(g,this.to)}}class y extends p{constructor(g,x,M,re){super(),this.loop=g,this.varKind=x,this.name=M,this.iterable=re}render(g){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(g)}optimizeNames(g,x){if(super.optimizeNames(g,x))return this.iterable=X(this.iterable,g,x),this}get names(){return L(super.names,this.iterable.names)}}class h extends T{constructor(g,x,M){super(),this.name=g,this.args=x,this.async=M}render(g){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(g)}}h.kind="func";class _ extends I{render(g){return"return "+super.render(g)}}_.kind="return";class $ extends T{render(g){let x="try"+super.render(g);return this.catch&&(x+=this.catch.render(g)),this.finally&&(x+=this.finally.render(g)),x}optimizeNodes(){var g,x;return super.optimizeNodes(),(g=this.catch)===null||g===void 0||g.optimizeNodes(),(x=this.finally)===null||x===void 0||x.optimizeNodes(),this}optimizeNames(g,x){var M,re;return super.optimizeNames(g,x),(M=this.catch)===null||M===void 0||M.optimizeNames(g,x),(re=this.finally)===null||re===void 0||re.optimizeNames(g,x),this}get names(){let g=super.names;return this.catch&&L(g,this.catch.names),this.finally&&L(g,this.finally.names),g}}class E extends T{constructor(g){super(),this.error=g}render(g){return`catch(${this.error})`+super.render(g)}}E.kind="catch";class q extends T{render(g){return"finally"+super.render(g)}}q.kind="finally";class z{constructor(g,x={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...x,_n:x.lines?`
46
+ `:""},this._extScope=g,this._scope=new r.Scope({parent:g}),this._nodes=[new k]}toString(){return this._root.render(this.opts)}name(g){return this._scope.name(g)}scopeName(g){return this._extScope.name(g)}scopeValue(g,x){let M=this._extScope.value(g,x);return(this._values[M.prefix]||(this._values[M.prefix]=new Set)).add(M),M}getScopeValue(g,x){return this._extScope.getValue(g,x)}scopeRefs(g){return this._extScope.scopeRefs(g,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(g,x,M,re){let se=this._scope.toName(x);return M!==void 0&&re&&(this._constants[se.str]=M),this._leafNode(new o(g,se,M)),se}const(g,x,M){return this._def(r.varKinds.const,g,x,M)}let(g,x,M){return this._def(r.varKinds.let,g,x,M)}var(g,x,M){return this._def(r.varKinds.var,g,x,M)}assign(g,x,M){return this._leafNode(new a(g,x,M))}add(g,x){return this._leafNode(new u(g,e.operators.ADD,x))}code(g){return typeof g=="function"?g():g!==t.nil&&this._leafNode(new w(g)),this}object(...g){let x=["{"];for(let[M,re]of g)x.length>1&&x.push(","),x.push(M),(M!==re||this.opts.es5)&&(x.push(":"),(0,t.addCodeArg)(x,re));return x.push("}"),new t._Code(x)}if(g,x,M){if(this._blockNode(new f(g)),x&&M)this.code(x).else().code(M).endIf();else if(x)this.code(x).endIf();else if(M)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(g){return this._elseNode(new f(g))}else(){return this._elseNode(new b)}endIf(){return this._endBlockNode(f,b)}_for(g,x){return this._blockNode(g),x&&this.code(x).endFor(),this}for(g,x){return this._for(new c(g),x)}forRange(g,x,M,re,se=this.opts.es5?r.varKinds.var:r.varKinds.let){let xe=this._scope.toName(g);return this._for(new d(se,xe,x,M),()=>re(xe))}forOf(g,x,M,re=r.varKinds.const){let se=this._scope.toName(g);if(this.opts.es5){let xe=x instanceof t.Name?x:this.var("_arr",x);return this.forRange("_i",0,t._`${xe}.length`,_e=>{this.var(se,t._`${xe}[${_e}]`),M(se)})}return this._for(new y("of",re,se,x),()=>M(se))}forIn(g,x,M,re=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(g,t._`Object.keys(${x})`,M);let se=this._scope.toName(g);return this._for(new y("in",re,se,x),()=>M(se))}endFor(){return this._endBlockNode(p)}label(g){return this._leafNode(new l(g))}break(g){return this._leafNode(new m(g))}return(g){let x=new _;if(this._blockNode(x),this.code(g),x.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(_)}try(g,x,M){if(!x&&!M)throw Error('CodeGen: "try" without "catch" and "finally"');let re=new $;if(this._blockNode(re),this.code(g),x){let se=this.name("e");this._currNode=re.catch=new E(se),x(se)}return M&&(this._currNode=re.finally=new q,this.code(M)),this._endBlockNode(E,q)}throw(g){return this._leafNode(new v(g))}block(g,x){return this._blockStarts.push(this._nodes.length),g&&this.code(g).endBlock(x),this}endBlock(g){let x=this._blockStarts.pop();if(x===void 0)throw Error("CodeGen: not in self-balancing block");let M=this._nodes.length-x;if(M<0||g!==void 0&&M!==g)throw Error(`CodeGen: wrong number of nodes: ${M} vs ${g} expected`);return this._nodes.length=x,this}func(g,x=t.nil,M,re){return this._blockNode(new h(g,x,M)),re&&this.code(re).endFunc(),this}endFunc(){return this._endBlockNode(h)}optimize(g=1){for(;g-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(g){return this._currNode.nodes.push(g),this}_blockNode(g){this._currNode.nodes.push(g),this._nodes.push(g)}_endBlockNode(g,x){let M=this._currNode;if(M instanceof g||x&&M instanceof x)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${x?`${g.kind}/${x.kind}`:g.kind}"`)}_elseNode(g){let x=this._currNode;if(!(x instanceof f))throw Error('CodeGen: "else" without "if"');return this._currNode=x.else=g,this}get _root(){return this._nodes[0]}get _currNode(){let g=this._nodes;return g[g.length-1]}set _currNode(g){let x=this._nodes;x[x.length-1]=g}}e.CodeGen=z;function L(R,g){for(let x in g)R[x]=(R[x]||0)+(g[x]||0);return R}function W(R,g){return g instanceof t._CodeOrName?L(R,g.names):R}function X(R,g,x){if(R instanceof t.Name)return M(R);if(!re(R))return R;return new t._Code(R._items.reduce((se,xe)=>(xe instanceof t.Name&&(xe=M(xe)),xe instanceof t._Code?se.push(...xe._items):se.push(xe),se),[]));function M(se){let xe=x[se.str];return xe===void 0||g[se.str]!==1?se:(delete g[se.str],xe)}function re(se){return se instanceof t._Code&&se._items.some(xe=>xe instanceof t.Name&&g[xe.str]===1&&x[xe.str]!==void 0)}}function G(R,g){for(let x in g)R[x]=(R[x]||0)-(g[x]||0)}function Je(R){return typeof R=="boolean"||typeof R=="number"||R===null?!R:t._`!${U(R)}`}e.not=Je;var rt=P(e.operators.AND);function lt(...R){return R.reduce(rt)}e.and=lt;var ye=P(e.operators.OR);function Z(...R){return R.reduce(ye)}e.or=Z;function P(R){return(g,x)=>g===t.nil?x:x===t.nil?g:t._`${U(g)} ${R} ${U(x)}`}function U(R){return R instanceof t.Name?R:t._`(${R})`}}),Te=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;var t=me(),r=ws();function n(h){let _={};for(let $ of h)_[$]=!0;return _}e.toHash=n;function i(h,_){return typeof _=="boolean"?_:Object.keys(_).length===0?!0:(s(h,_),!o(_,h.self.RULES.all))}e.alwaysValidSchema=i;function s(h,_=h.schema){let{opts:$,self:E}=h;if(!$.strictSchema||typeof _=="boolean")return;let q=E.RULES.keywords;for(let z in _)q[z]||y(h,`unknown keyword: "${z}"`)}e.checkUnknownRules=s;function o(h,_){if(typeof h=="boolean")return!h;for(let $ in h)if(_[$])return!0;return!1}e.schemaHasRules=o;function a(h,_){if(typeof h=="boolean")return!h;for(let $ in h)if($!=="$ref"&&_.all[$])return!0;return!1}e.schemaHasRulesButRef=a;function u({topSchemaRef:h,schemaPath:_},$,E,q){if(!q){if(typeof $=="number"||typeof $=="boolean")return $;if(typeof $=="string")return t._`${$}`}return t._`${h}${_}${(0,t.getProperty)(E)}`}e.schemaRefOrVal=u;function l(h){return w(decodeURIComponent(h))}e.unescapeFragment=l;function m(h){return encodeURIComponent(v(h))}e.escapeFragment=m;function v(h){return typeof h=="number"?`${h}`:h.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=v;function w(h){return h.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=w;function I(h,_){if(Array.isArray(h))for(let $ of h)_($);else _(h)}e.eachItem=I;function T({mergeNames:h,mergeToName:_,mergeValues:$,resultToName:E}){return(q,z,L,W)=>{let X=L===void 0?z:L instanceof t.Name?(z instanceof t.Name?h(q,z,L):_(q,z,L),L):z instanceof t.Name?(_(q,L,z),z):$(z,L);return W===t.Name&&!(X instanceof t.Name)?E(q,X):X}}e.mergeEvaluated={props:T({mergeNames:(h,_,$)=>h.if(t._`${$} !== true && ${_} !== undefined`,()=>{h.if(t._`${_} === true`,()=>h.assign($,!0),()=>h.assign($,t._`${$} || {}`).code(t._`Object.assign(${$}, ${_})`))}),mergeToName:(h,_,$)=>h.if(t._`${$} !== true`,()=>{_===!0?h.assign($,!0):(h.assign($,t._`${$} || {}`),b(h,$,_))}),mergeValues:(h,_)=>h===!0?!0:{...h,..._},resultToName:k}),items:T({mergeNames:(h,_,$)=>h.if(t._`${$} !== true && ${_} !== undefined`,()=>h.assign($,t._`${_} === true ? true : ${$} > ${_} ? ${$} : ${_}`)),mergeToName:(h,_,$)=>h.if(t._`${$} !== true`,()=>h.assign($,_===!0?!0:t._`${$} > ${_} ? ${$} : ${_}`)),mergeValues:(h,_)=>h===!0?!0:Math.max(h,_),resultToName:(h,_)=>h.var("items",_)})};function k(h,_){if(_===!0)return h.var("props",!0);let $=h.var("props",t._`{}`);return _!==void 0&&b(h,$,_),$}e.evaluatedPropsToName=k;function b(h,_,$){Object.keys($).forEach(E=>h.assign(t._`${_}${(0,t.getProperty)(E)}`,!0))}e.setEvaluated=b;var f={};function p(h,_){return h.scopeValue("func",{ref:_,code:f[_.code]||(f[_.code]=new r._Code(_.code))})}e.useFunc=p;var c;(function(h){h[h.Num=0]="Num",h[h.Str=1]="Str"})(c||(e.Type=c={}));function d(h,_,$){if(h instanceof t.Name){let E=_===c.Num;return $?E?t._`"[" + ${h} + "]"`:t._`"['" + ${h} + "']"`:E?t._`"/" + ${h}`:t._`"/" + ${h}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return $?(0,t.getProperty)(h).toString():"/"+v(h)}e.getErrorPath=d;function y(h,_,$=h.opts.strictSchema){if($){if(_=`strict mode: ${_}`,$===!0)throw Error(_);h.self.logger.warn(_)}}e.checkStrictMode=y}),Hr=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=me(),r={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")};e.default=r}),Os=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;var t=me(),r=Te(),n=Hr();e.keywordError={message:({keyword:b})=>t.str`must pass "${b}" keyword validation`},e.keyword$DataError={message:({keyword:b,schemaType:f})=>f?t.str`"${b}" keyword must be ${f} ($data)`:t.str`"${b}" keyword is invalid ($data)`};function i(b,f=e.keywordError,p,c){let{it:d}=b,{gen:y,compositeRule:h,allErrors:_}=d,$=v(b,f,p);c??(h||_)?u(y,$):l(d,t._`[${$}]`)}e.reportError=i;function s(b,f=e.keywordError,p){let{it:c}=b,{gen:d,compositeRule:y,allErrors:h}=c,_=v(b,f,p);u(d,_),!(y||h)&&l(c,n.default.vErrors)}e.reportExtraError=s;function o(b,f){b.assign(n.default.errors,f),b.if(t._`${n.default.vErrors} !== null`,()=>b.if(f,()=>b.assign(t._`${n.default.vErrors}.length`,f),()=>b.assign(n.default.vErrors,null)))}e.resetErrorsCount=o;function a({gen:b,keyword:f,schemaValue:p,data:c,errsCount:d,it:y}){if(d===void 0)throw Error("ajv implementation error");let h=b.name("err");b.forRange("i",d,n.default.errors,_=>{b.const(h,t._`${n.default.vErrors}[${_}]`),b.if(t._`${h}.instancePath === undefined`,()=>b.assign(t._`${h}.instancePath`,(0,t.strConcat)(n.default.instancePath,y.errorPath))),b.assign(t._`${h}.schemaPath`,t.str`${y.errSchemaPath}/${f}`),y.opts.verbose&&(b.assign(t._`${h}.schema`,p),b.assign(t._`${h}.data`,c))})}e.extendErrors=a;function u(b,f){let p=b.const("err",f);b.if(t._`${n.default.vErrors} === null`,()=>b.assign(n.default.vErrors,t._`[${p}]`),t._`${n.default.vErrors}.push(${p})`),b.code(t._`${n.default.errors}++`)}function l(b,f){let{gen:p,validateName:c,schemaEnv:d}=b;d.$async?p.throw(t._`new ${b.ValidationError}(${f})`):(p.assign(t._`${c}.errors`,f),p.return(!1))}var m={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function v(b,f,p){let{createErrors:c}=b.it;return c===!1?t._`{}`:w(b,f,p)}function w(b,f,p={}){let{gen:c,it:d}=b,y=[I(d,p),T(b,p)];return k(b,f,y),c.object(...y)}function I({errorPath:b},{instancePath:f}){let p=f?t.str`${b}${(0,r.getErrorPath)(f,r.Type.Str)}`:b;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,p)]}function T({keyword:b,it:{errSchemaPath:f}},{schemaPath:p,parentSchema:c}){let d=c?f:t.str`${f}/${b}`;return p&&(d=t.str`${d}${(0,r.getErrorPath)(p,r.Type.Str)}`),[m.schemaPath,d]}function k(b,{params:f,message:p},c){let{keyword:d,data:y,schemaValue:h,it:_}=b,{opts:$,propertyName:E,topSchemaRef:q,schemaPath:z}=_;c.push([m.keyword,d],[m.params,typeof f=="function"?f(b):f||t._`{}`]),$.messages&&c.push([m.message,typeof p=="function"?p(b):p]),$.verbose&&c.push([m.schema,h],[m.parentSchema,t._`${q}${z}`],[n.default.data,y]),E&&c.push([m.propertyName,E])}}),My=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;var t=Os(),r=me(),n=Hr(),i={message:"boolean schema is false"};function s(u){let{gen:l,schema:m,validateName:v}=u;m===!1?a(u,!1):typeof m=="object"&&m.$async===!0?l.return(n.default.data):(l.assign(r._`${v}.errors`,null),l.return(!0))}e.topBoolOrEmptySchema=s;function o(u,l){let{gen:m,schema:v}=u;v===!1?(m.var(l,!1),a(u)):m.var(l,!0)}e.boolOrEmptySchema=o;function a(u,l){let{gen:m,data:v}=u,w={gen:m,keyword:"false schema",data:v,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:u};(0,t.reportError)(w,i,void 0,l)}}),Vd=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;var t=["string","number","integer","boolean","null","object","array"],r=new Set(t);function n(s){return typeof s=="string"&&r.has(s)}e.isJSONType=n;function i(){let s={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...s,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},s.number,s.string,s.array,s.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=i}),Zd=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:i,self:s},o){let a=s.RULES.types[o];return a&&a!==!0&&r(i,a)}e.schemaHasRulesForType=t;function r(i,s){return s.rules.some(o=>n(i,o))}e.shouldUseGroup=r;function n(i,s){var o;return i[s.keyword]!==void 0||((o=s.definition.implements)===null||o===void 0?void 0:o.some(a=>i[a]!==void 0))}e.shouldUseRule=n}),Is=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;var t=Vd(),r=Zd(),n=Os(),i=me(),s=Te(),o;(function(c){c[c.Correct=0]="Correct",c[c.Wrong=1]="Wrong"})(o||(e.DataType=o={}));function a(c){let d=u(c.type);if(d.includes("null")){if(c.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!d.length&&c.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');c.nullable===!0&&d.push("null")}return d}e.getSchemaTypes=a;function u(c){let d=Array.isArray(c)?c:c?[c]:[];if(d.every(t.isJSONType))return d;throw Error("type must be JSONType or JSONType[]: "+d.join(","))}e.getJSONTypes=u;function l(c,d){let{gen:y,data:h,opts:_}=c,$=v(d,_.coerceTypes),E=d.length>0&&!($.length===0&&d.length===1&&(0,r.schemaHasRulesForType)(c,d[0]));if(E){let q=k(d,h,_.strictNumbers,o.Wrong);y.if(q,()=>{$.length?w(c,d,$):f(c)})}return E}e.coerceAndCheckDataType=l;var m=new Set(["string","number","integer","boolean","null"]);function v(c,d){return d?c.filter(y=>m.has(y)||d==="array"&&y==="array"):[]}function w(c,d,y){let{gen:h,data:_,opts:$}=c,E=h.let("dataType",i._`typeof ${_}`),q=h.let("coerced",i._`undefined`);$.coerceTypes==="array"&&h.if(i._`${E} == 'object' && Array.isArray(${_}) && ${_}.length == 1`,()=>h.assign(_,i._`${_}[0]`).assign(E,i._`typeof ${_}`).if(k(d,_,$.strictNumbers),()=>h.assign(q,_))),h.if(i._`${q} !== undefined`);for(let L of y)(m.has(L)||L==="array"&&$.coerceTypes==="array")&&z(L);h.else(),f(c),h.endIf(),h.if(i._`${q} !== undefined`,()=>{h.assign(_,q),I(c,q)});function z(L){switch(L){case"string":h.elseIf(i._`${E} == "number" || ${E} == "boolean"`).assign(q,i._`"" + ${_}`).elseIf(i._`${_} === null`).assign(q,i._`""`);return;case"number":h.elseIf(i._`${E} == "boolean" || ${_} === null
47
+ || (${E} == "string" && ${_} && ${_} == +${_})`).assign(q,i._`+${_}`);return;case"integer":h.elseIf(i._`${E} === "boolean" || ${_} === null
48
+ || (${E} === "string" && ${_} && ${_} == +${_} && !(${_} % 1))`).assign(q,i._`+${_}`);return;case"boolean":h.elseIf(i._`${_} === "false" || ${_} === 0 || ${_} === null`).assign(q,!1).elseIf(i._`${_} === "true" || ${_} === 1`).assign(q,!0);return;case"null":h.elseIf(i._`${_} === "" || ${_} === 0 || ${_} === false`),h.assign(q,null);return;case"array":h.elseIf(i._`${E} === "string" || ${E} === "number"
49
+ || ${E} === "boolean" || ${_} === null`).assign(q,i._`[${_}]`)}}}function I({gen:c,parentData:d,parentDataProperty:y},h){c.if(i._`${d} !== undefined`,()=>c.assign(i._`${d}[${y}]`,h))}function T(c,d,y,h=o.Correct){let _=h===o.Correct?i.operators.EQ:i.operators.NEQ,$;switch(c){case"null":return i._`${d} ${_} null`;case"array":$=i._`Array.isArray(${d})`;break;case"object":$=i._`${d} && typeof ${d} == "object" && !Array.isArray(${d})`;break;case"integer":$=E(i._`!(${d} % 1) && !isNaN(${d})`);break;case"number":$=E();break;default:return i._`typeof ${d} ${_} ${c}`}return h===o.Correct?$:(0,i.not)($);function E(q=i.nil){return(0,i.and)(i._`typeof ${d} == "number"`,q,y?i._`isFinite(${d})`:i.nil)}}e.checkDataType=T;function k(c,d,y,h){if(c.length===1)return T(c[0],d,y,h);let _,$=(0,s.toHash)(c);if($.array&&$.object){let E=i._`typeof ${d} != "object"`;_=$.null?E:i._`!${d} || ${E}`,delete $.null,delete $.array,delete $.object}else _=i.nil;$.number&&delete $.integer;for(let E in $)_=(0,i.and)(_,T(E,d,y,h));return _}e.checkDataTypes=k;var b={message:({schema:c})=>`must be ${c}`,params:({schema:c,schemaValue:d})=>typeof c=="string"?i._`{type: ${c}}`:i._`{type: ${d}}`};function f(c){let d=p(c);(0,n.reportError)(d,b)}e.reportTypeError=f;function p(c){let{gen:d,data:y,schema:h}=c,_=(0,s.schemaRefOrVal)(c,h,"type");return{gen:d,keyword:"type",data:y,schema:h.type,schemaCode:_,schemaValue:_,parentSchema:h,params:{},it:c}}}),Fy=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;var t=me(),r=Te();function n(s,o){let{properties:a,items:u}=s.schema;if(o==="object"&&a)for(let l in a)i(s,l,a[l].default);else o==="array"&&Array.isArray(u)&&u.forEach((l,m)=>i(s,m,l.default))}e.assignDefaults=n;function i(s,o,a){let{gen:u,compositeRule:l,data:m,opts:v}=s;if(a===void 0)return;let w=t._`${m}${(0,t.getProperty)(o)}`;if(l){(0,r.checkStrictMode)(s,`default is ignored for: ${w}`);return}let I=t._`${w} === undefined`;v.useDefaults==="empty"&&(I=t._`${I} || ${w} === null || ${w} === ""`),u.if(I,t._`${w} = ${(0,t.stringify)(a)}`)}}),fr=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;var t=me(),r=Te(),n=Hr(),i=Te();function s(c,d){let{gen:y,data:h,it:_}=c;y.if(v(y,h,d,_.opts.ownProperties),()=>{c.setParams({missingProperty:t._`${d}`},!0),c.error()})}e.checkReportMissingProp=s;function o({gen:c,data:d,it:{opts:y}},h,_){return(0,t.or)(...h.map($=>(0,t.and)(v(c,d,$,y.ownProperties),t._`${_} = ${$}`)))}e.checkMissingProp=o;function a(c,d){c.setParams({missingProperty:d},!0),c.error()}e.reportMissingProp=a;function u(c){return c.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:t._`Object.prototype.hasOwnProperty`})}e.hasPropFunc=u;function l(c,d,y){return t._`${u(c)}.call(${d}, ${y})`}e.isOwnProperty=l;function m(c,d,y,h){let _=t._`${d}${(0,t.getProperty)(y)} !== undefined`;return h?t._`${_} && ${l(c,d,y)}`:_}e.propertyInData=m;function v(c,d,y,h){let _=t._`${d}${(0,t.getProperty)(y)} === undefined`;return h?(0,t.or)(_,(0,t.not)(l(c,d,y))):_}e.noPropertyInData=v;function w(c){return c?Object.keys(c).filter(d=>d!=="__proto__"):[]}e.allSchemaProperties=w;function I(c,d){return w(d).filter(y=>!(0,r.alwaysValidSchema)(c,d[y]))}e.schemaProperties=I;function T({schemaCode:c,data:d,it:{gen:y,topSchemaRef:h,schemaPath:_,errorPath:$},it:E},q,z,L){let W=L?t._`${c}, ${d}, ${h}${_}`:d,X=[[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,$)],[n.default.parentData,E.parentData],[n.default.parentDataProperty,E.parentDataProperty],[n.default.rootData,n.default.rootData]];E.opts.dynamicRef&&X.push([n.default.dynamicAnchors,n.default.dynamicAnchors]);let G=t._`${W}, ${y.object(...X)}`;return z!==t.nil?t._`${q}.call(${z}, ${G})`:t._`${q}(${G})`}e.callValidateCode=T;var k=t._`new RegExp`;function b({gen:c,it:{opts:d}},y){let h=d.unicodeRegExp?"u":"",{regExp:_}=d.code,$=_(y,h);return c.scopeValue("pattern",{key:$.toString(),ref:$,code:t._`${_.code==="new RegExp"?k:(0,i.useFunc)(c,_)}(${y}, ${h})`})}e.usePattern=b;function f(c){let{gen:d,data:y,keyword:h,it:_}=c,$=d.name("valid");if(_.allErrors){let q=d.let("valid",!0);return E(()=>d.assign(q,!1)),q}return d.var($,!0),E(()=>d.break()),$;function E(q){let z=d.const("len",t._`${y}.length`);d.forRange("i",0,z,L=>{c.subschema({keyword:h,dataProp:L,dataPropType:r.Type.Num},$),d.if((0,t.not)($),q)})}}e.validateArray=f;function p(c){let{gen:d,schema:y,keyword:h,it:_}=c;if(!Array.isArray(y))throw Error("ajv implementation error");if(y.some(q=>(0,r.alwaysValidSchema)(_,q))&&!_.opts.unevaluated)return;let $=d.let("valid",!1),E=d.name("_valid");d.block(()=>y.forEach((q,z)=>{let L=c.subschema({keyword:h,schemaProp:z,compositeRule:!0},E);d.assign($,t._`${$} || ${E}`),!c.mergeValidEvaluated(L,E)&&d.if((0,t.not)($))})),c.result($,()=>c.reset(),()=>c.error(!0))}e.validateUnion=p}),zy=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;var t=me(),r=Hr(),n=fr(),i=Os();function s(I,T){let{gen:k,keyword:b,schema:f,parentSchema:p,it:c}=I,d=T.macro.call(c.self,f,p,c),y=m(k,b,d);c.opts.validateSchema!==!1&&c.self.validateSchema(d,!0);let h=k.name("valid");I.subschema({schema:d,schemaPath:t.nil,errSchemaPath:`${c.errSchemaPath}/${b}`,topSchemaRef:y,compositeRule:!0},h),I.pass(h,()=>I.error(!0))}e.macroKeywordCode=s;function o(I,T){var k;let{gen:b,keyword:f,schema:p,parentSchema:c,$data:d,it:y}=I;l(y,T);let h=!d&&T.compile?T.compile.call(y.self,p,c,y):T.validate,_=m(b,f,h),$=b.let("valid");I.block$data($,E),I.ok((k=T.valid)!==null&&k!==void 0?k:$);function E(){if(T.errors===!1)L(),T.modifying&&a(I),W(()=>I.error());else{let X=T.async?q():z();T.modifying&&a(I),W(()=>u(I,X))}}function q(){let X=b.let("ruleErrs",null);return b.try(()=>L(t._`await `),G=>b.assign($,!1).if(t._`${G} instanceof ${y.ValidationError}`,()=>b.assign(X,t._`${G}.errors`),()=>b.throw(G))),X}function z(){let X=t._`${_}.errors`;return b.assign(X,null),L(t.nil),X}function L(X=T.async?t._`await `:t.nil){let G=y.opts.passContext?r.default.this:r.default.self,Je=!("compile"in T&&!d||T.schema===!1);b.assign($,t._`${X}${(0,n.callValidateCode)(I,_,G,Je)}`,T.modifying)}function W(X){var G;b.if((0,t.not)((G=T.valid)!==null&&G!==void 0?G:$),X)}}e.funcKeywordCode=o;function a(I){let{gen:T,data:k,it:b}=I;T.if(b.parentData,()=>T.assign(k,t._`${b.parentData}[${b.parentDataProperty}]`))}function u(I,T){let{gen:k}=I;k.if(t._`Array.isArray(${T})`,()=>{k.assign(r.default.vErrors,t._`${r.default.vErrors} === null ? ${T} : ${r.default.vErrors}.concat(${T})`).assign(r.default.errors,t._`${r.default.vErrors}.length`),(0,i.extendErrors)(I)},()=>I.error())}function l({schemaEnv:I},T){if(T.async&&!I.$async)throw Error("async keyword in sync schema")}function m(I,T,k){if(k===void 0)throw Error(`keyword "${T}" failed to compile`);return I.scopeValue("keyword",typeof k=="function"?{ref:k}:{ref:k,code:(0,t.stringify)(k)})}function v(I,T,k=!1){return!T.length||T.some(b=>b==="array"?Array.isArray(I):b==="object"?I&&typeof I=="object"&&!Array.isArray(I):typeof I==b||k&&typeof I>"u")}e.validSchemaType=v;function w({schema:I,opts:T,self:k,errSchemaPath:b},f,p){if(Array.isArray(f.keyword)?!f.keyword.includes(p):f.keyword!==p)throw Error("ajv implementation error");let c=f.dependencies;if(c?.some(d=>!Object.prototype.hasOwnProperty.call(I,d)))throw Error(`parent schema must have dependencies of ${p}: ${c.join(",")}`);if(f.validateSchema&&!f.validateSchema(I[p])){let d=`keyword "${p}" value is invalid at path "${b}": `+k.errorsText(f.validateSchema.errors);if(T.validateSchema==="log")k.logger.error(d);else throw Error(d)}}e.validateKeywordUsage=w}),Uy=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;var t=me(),r=Te();function n(o,{keyword:a,schemaProp:u,schema:l,schemaPath:m,errSchemaPath:v,topSchemaRef:w}){if(a!==void 0&&l!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(a!==void 0){let I=o.schema[a];return u===void 0?{schema:I,schemaPath:t._`${o.schemaPath}${(0,t.getProperty)(a)}`,errSchemaPath:`${o.errSchemaPath}/${a}`}:{schema:I[u],schemaPath:t._`${o.schemaPath}${(0,t.getProperty)(a)}${(0,t.getProperty)(u)}`,errSchemaPath:`${o.errSchemaPath}/${a}/${(0,r.escapeFragment)(u)}`}}if(l!==void 0){if(m===void 0||v===void 0||w===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:l,schemaPath:m,topSchemaRef:w,errSchemaPath:v}}throw Error('either "keyword" or "schema" must be passed')}e.getSubschema=n;function i(o,a,{dataProp:u,dataPropType:l,data:m,dataTypes:v,propertyName:w}){if(m!==void 0&&u!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:I}=a;if(u!==void 0){let{errorPath:k,dataPathArr:b,opts:f}=a,p=I.let("data",t._`${a.data}${(0,t.getProperty)(u)}`,!0);T(p),o.errorPath=t.str`${k}${(0,r.getErrorPath)(u,l,f.jsPropertySyntax)}`,o.parentDataProperty=t._`${u}`,o.dataPathArr=[...b,o.parentDataProperty]}if(m!==void 0){let k=m instanceof t.Name?m:I.let("data",m,!0);T(k),w!==void 0&&(o.propertyName=w)}v&&(o.dataTypes=v);function T(k){o.data=k,o.dataLevel=a.dataLevel+1,o.dataTypes=[],a.definedProperties=new Set,o.parentData=a.data,o.dataNames=[...a.dataNames,k]}}e.extendSubschemaData=i;function s(o,{jtdDiscriminator:a,jtdMetadata:u,compositeRule:l,createErrors:m,allErrors:v}){l!==void 0&&(o.compositeRule=l),m!==void 0&&(o.createErrors=m),v!==void 0&&(o.allErrors=v),o.jtdDiscriminator=a,o.jtdMetadata=u}e.extendSubschemaMode=s}),Wd=Q((e,t)=>{t.exports=function r(n,i){if(n===i)return!0;if(n&&i&&typeof n=="object"&&typeof i=="object"){if(n.constructor!==i.constructor)return!1;var s,o,a;if(Array.isArray(n)){if(s=n.length,s!=i.length)return!1;for(o=s;o--!==0;)if(!r(n[o],i[o]))return!1;return!0}if(n.constructor===RegExp)return n.source===i.source&&n.flags===i.flags;if(n.valueOf!==Object.prototype.valueOf)return n.valueOf()===i.valueOf();if(n.toString!==Object.prototype.toString)return n.toString()===i.toString();if(a=Object.keys(n),s=a.length,s!==Object.keys(i).length)return!1;for(o=s;o--!==0;)if(!Object.prototype.hasOwnProperty.call(i,a[o]))return!1;for(o=s;o--!==0;){var u=a[o];if(!r(n[u],i[u]))return!1}return!0}return n!==n&&i!==i}}),Dy=Q((e,t)=>{var r=t.exports=function(s,o,a){typeof o=="function"&&(a=o,o={}),a=o.cb||a;var u=typeof a=="function"?a:a.pre||function(){},l=a.post||function(){};n(o,u,l,s,"",s)};r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},r.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},r.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function n(s,o,a,u,l,m,v,w,I,T){if(u&&typeof u=="object"&&!Array.isArray(u)){o(u,l,m,v,w,I,T);for(var k in u){var b=u[k];if(Array.isArray(b)){if(k in r.arrayKeywords)for(var f=0;f<b.length;f++)n(s,o,a,b[f],l+"/"+k+"/"+f,m,l,k,u,f)}else if(k in r.propsKeywords){if(b&&typeof b=="object")for(var p in b)n(s,o,a,b[p],l+"/"+k+"/"+i(p),m,l,k,u,p)}else(k in r.keywords||s.allKeys&&!(k in r.skipKeywords))&&n(s,o,a,b,l+"/"+k,m,l,k,u)}a(u,l,m,v,w,I,T)}}function i(s){return s.replace(/~/g,"~0").replace(/\//g,"~1")}}),Cs=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;var t=Te(),r=Wd(),n=Dy(),i=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function s(b,f=!0){return typeof b=="boolean"?!0:f===!0?!a(b):f?u(b)<=f:!1}e.inlineRef=s;var o=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function a(b){for(let f in b){if(o.has(f))return!0;let p=b[f];if(Array.isArray(p)&&p.some(a)||typeof p=="object"&&a(p))return!0}return!1}function u(b){let f=0;for(let p in b){if(p==="$ref")return 1/0;if(f++,!i.has(p)&&(typeof b[p]=="object"&&(0,t.eachItem)(b[p],c=>f+=u(c)),f===1/0))return 1/0}return f}function l(b,f="",p){p!==!1&&(f=w(f));let c=b.parse(f);return m(b,c)}e.getFullPath=l;function m(b,f){return b.serialize(f).split("#")[0]+"#"}e._getFullPath=m;var v=/#\/?$/;function w(b){return b?b.replace(v,""):""}e.normalizeId=w;function I(b,f,p){return p=w(p),b.resolve(f,p)}e.resolveUrl=I;var T=/^[a-z_][-a-z0-9._]*$/i;function k(b,f){if(typeof b=="boolean")return{};let{schemaId:p,uriResolver:c}=this.opts,d=w(b[p]||f),y={"":d},h=l(c,d,!1),_={},$=new Set;return n(b,{allKeys:!0},(z,L,W,X)=>{if(X===void 0)return;let G=h+L,Je=y[X];typeof z[p]=="string"&&(Je=rt.call(this,z[p])),lt.call(this,z.$anchor),lt.call(this,z.$dynamicAnchor),y[L]=Je;function rt(ye){let Z=this.opts.uriResolver.resolve;if(ye=w(Je?Z(Je,ye):ye),$.has(ye))throw q(ye);$.add(ye);let P=this.refs[ye];return typeof P=="string"&&(P=this.refs[P]),typeof P=="object"?E(z,P.schema,ye):ye!==w(G)&&(ye[0]==="#"?(E(z,_[ye],ye),_[ye]=z):this.refs[ye]=G),ye}function lt(ye){if(typeof ye=="string"){if(!T.test(ye))throw Error(`invalid anchor "${ye}"`);rt.call(this,`#${ye}`)}}}),_;function E(z,L,W){if(L!==void 0&&!r(z,L))throw q(W)}function q(z){return Error(`reference "${z}" resolves to more than one schema`)}}e.getSchemaRefs=k}),Es=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;var t=My(),r=Is(),n=Zd(),i=Is(),s=Fy(),o=zy(),a=Uy(),u=me(),l=Hr(),m=Cs(),v=Te(),w=Os();function I(O){if(h(O)&&($(O),y(O))){f(O);return}T(O,()=>(0,t.topBoolOrEmptySchema)(O))}e.validateFunctionCode=I;function T({gen:O,validateName:C,schema:D,schemaEnv:B,opts:ne},pe){ne.code.es5?O.func(C,u._`${l.default.data}, ${l.default.valCxt}`,B.$async,()=>{O.code(u._`"use strict"; ${c(D,ne)}`),b(O,ne),O.code(pe)}):O.func(C,u._`${l.default.data}, ${k(ne)}`,B.$async,()=>O.code(c(D,ne)).code(pe))}function k(O){return u._`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${O.dynamicRef?u._`, ${l.default.dynamicAnchors}={}`:u.nil}}={}`}function b(O,C){O.if(l.default.valCxt,()=>{O.var(l.default.instancePath,u._`${l.default.valCxt}.${l.default.instancePath}`),O.var(l.default.parentData,u._`${l.default.valCxt}.${l.default.parentData}`),O.var(l.default.parentDataProperty,u._`${l.default.valCxt}.${l.default.parentDataProperty}`),O.var(l.default.rootData,u._`${l.default.valCxt}.${l.default.rootData}`),C.dynamicRef&&O.var(l.default.dynamicAnchors,u._`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{O.var(l.default.instancePath,u._`""`),O.var(l.default.parentData,u._`undefined`),O.var(l.default.parentDataProperty,u._`undefined`),O.var(l.default.rootData,l.default.data),C.dynamicRef&&O.var(l.default.dynamicAnchors,u._`{}`)})}function f(O){let{schema:C,opts:D,gen:B}=O;T(O,()=>{D.$comment&&C.$comment&&X(O),z(O),B.let(l.default.vErrors,null),B.let(l.default.errors,0),D.unevaluated&&p(O),E(O),G(O)})}function p(O){let{gen:C,validateName:D}=O;O.evaluated=C.const("evaluated",u._`${D}.evaluated`),C.if(u._`${O.evaluated}.dynamicProps`,()=>C.assign(u._`${O.evaluated}.props`,u._`undefined`)),C.if(u._`${O.evaluated}.dynamicItems`,()=>C.assign(u._`${O.evaluated}.items`,u._`undefined`))}function c(O,C){let D=typeof O=="object"&&O[C.schemaId];return D&&(C.code.source||C.code.process)?u._`/*# sourceURL=${D} */`:u.nil}function d(O,C){if(h(O)&&($(O),y(O))){_(O,C);return}(0,t.boolOrEmptySchema)(O,C)}function y({schema:O,self:C}){if(typeof O=="boolean")return!O;for(let D in O)if(C.RULES.all[D])return!0;return!1}function h(O){return typeof O.schema!="boolean"}function _(O,C){let{schema:D,gen:B,opts:ne}=O;ne.$comment&&D.$comment&&X(O),L(O),W(O);let pe=B.const("_errs",l.default.errors);E(O,pe),B.var(C,u._`${pe} === ${l.default.errors}`)}function $(O){(0,v.checkUnknownRules)(O),q(O)}function E(O,C){if(O.opts.jtd)return rt(O,[],!1,C);let D=(0,r.getSchemaTypes)(O.schema),B=(0,r.coerceAndCheckDataType)(O,D);rt(O,D,!B,C)}function q(O){let{schema:C,errSchemaPath:D,opts:B,self:ne}=O;C.$ref&&B.ignoreKeywordsWithRef&&(0,v.schemaHasRulesButRef)(C,ne.RULES)&&ne.logger.warn(`$ref: keywords ignored in schema at path "${D}"`)}function z(O){let{schema:C,opts:D}=O;C.default!==void 0&&D.useDefaults&&D.strictSchema&&(0,v.checkStrictMode)(O,"default is ignored in the schema root")}function L(O){let C=O.schema[O.opts.schemaId];C&&(O.baseId=(0,m.resolveUrl)(O.opts.uriResolver,O.baseId,C))}function W(O){if(O.schema.$async&&!O.schemaEnv.$async)throw Error("async schema in sync schema")}function X({gen:O,schemaEnv:C,schema:D,errSchemaPath:B,opts:ne}){let pe=D.$comment;if(ne.$comment===!0)O.code(u._`${l.default.self}.logger.log(${pe})`);else if(typeof ne.$comment=="function"){let Ke=u.str`${B}/$comment`,dt=O.scopeValue("root",{ref:C.root});O.code(u._`${l.default.self}.opts.$comment(${pe}, ${Ke}, ${dt}.schema)`)}}function G(O){let{gen:C,schemaEnv:D,validateName:B,ValidationError:ne,opts:pe}=O;D.$async?C.if(u._`${l.default.errors} === 0`,()=>C.return(l.default.data),()=>C.throw(u._`new ${ne}(${l.default.vErrors})`)):(C.assign(u._`${B}.errors`,l.default.vErrors),pe.unevaluated&&Je(O),C.return(u._`${l.default.errors} === 0`))}function Je({gen:O,evaluated:C,props:D,items:B}){D instanceof u.Name&&O.assign(u._`${C}.props`,D),B instanceof u.Name&&O.assign(u._`${C}.items`,B)}function rt(O,C,D,B){let{gen:ne,schema:pe,data:Ke,allErrors:dt,opts:kt,self:Tt}=O,{RULES:pt}=Tt;if(pe.$ref&&(kt.ignoreKeywordsWithRef||!(0,v.schemaHasRulesButRef)(pe,pt))){ne.block(()=>se(O,"$ref",pt.all.$ref.definition));return}kt.jtd||ye(O,C),ne.block(()=>{for(let Kt of pt.rules)pn(Kt);pn(pt.post)});function pn(Kt){(0,n.shouldUseGroup)(pe,Kt)&&(Kt.type?(ne.if((0,i.checkDataType)(Kt.type,Ke,kt.strictNumbers)),lt(O,Kt),C.length===1&&C[0]===Kt.type&&D&&(ne.else(),(0,i.reportTypeError)(O)),ne.endIf()):lt(O,Kt),dt||ne.if(u._`${l.default.errors} === ${B||0}`))}}function lt(O,C){let{gen:D,schema:B,opts:{useDefaults:ne}}=O;ne&&(0,s.assignDefaults)(O,C.type),D.block(()=>{for(let pe of C.rules)(0,n.shouldUseRule)(B,pe)&&se(O,pe.keyword,pe.definition,C.type)})}function ye(O,C){O.schemaEnv.meta||!O.opts.strictTypes||(Z(O,C),!O.opts.allowUnionTypes&&P(O,C),U(O,O.dataTypes))}function Z(O,C){if(C.length){if(!O.dataTypes.length){O.dataTypes=C;return}C.forEach(D=>{g(O.dataTypes,D)||M(O,`type "${D}" not allowed by context "${O.dataTypes.join(",")}"`)}),x(O,C)}}function P(O,C){C.length>1&&!(C.length===2&&C.includes("null"))&&M(O,"use allowUnionTypes to allow union type keyword")}function U(O,C){let D=O.self.RULES.all;for(let B in D){let ne=D[B];if(typeof ne=="object"&&(0,n.shouldUseRule)(O.schema,ne)){let{type:pe}=ne.definition;pe.length&&!pe.some(Ke=>R(C,Ke))&&M(O,`missing type "${pe.join(",")}" for keyword "${B}"`)}}}function R(O,C){return O.includes(C)||C==="number"&&O.includes("integer")}function g(O,C){return O.includes(C)||C==="integer"&&O.includes("number")}function x(O,C){let D=[];for(let B of O.dataTypes)g(C,B)?D.push(B):C.includes("integer")&&B==="number"&&D.push("integer");O.dataTypes=D}function M(O,C){let D=O.schemaEnv.baseId+O.errSchemaPath;C+=` at "${D}" (strictTypes)`,(0,v.checkStrictMode)(O,C,O.opts.strictTypes)}class re{constructor(C,D,B){if((0,o.validateKeywordUsage)(C,D,B),this.gen=C.gen,this.allErrors=C.allErrors,this.keyword=B,this.data=C.data,this.schema=C.schema[B],this.$data=D.$data&&C.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,v.schemaRefOrVal)(C,this.schema,B,this.$data),this.schemaType=D.schemaType,this.parentSchema=C.schema,this.params={},this.it=C,this.def=D,this.$data)this.schemaCode=C.gen.const("vSchema",Le(this.$data,C));else if(this.schemaCode=this.schemaValue,!(0,o.validSchemaType)(this.schema,D.schemaType,D.allowUndefined))throw Error(`${B} value must be ${JSON.stringify(D.schemaType)}`);("code"in D?D.trackErrors:D.errors!==!1)&&(this.errsCount=C.gen.const("_errs",l.default.errors))}result(C,D,B){this.failResult((0,u.not)(C),D,B)}failResult(C,D,B){this.gen.if(C),B?B():this.error(),D?(this.gen.else(),D(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(C,D){this.failResult((0,u.not)(C),void 0,D)}fail(C){if(C===void 0){this.error(),!this.allErrors&&this.gen.if(!1);return}this.gen.if(C),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(C){if(!this.$data)return this.fail(C);let{schemaCode:D}=this;this.fail(u._`${D} !== undefined && (${(0,u.or)(this.invalid$data(),C)})`)}error(C,D,B){if(D){this.setParams(D),this._error(C,B),this.setParams({});return}this._error(C,B)}_error(C,D){(C?w.reportExtraError:w.reportError)(this,this.def.error,D)}$dataError(){(0,w.reportError)(this,this.def.$dataError||w.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,w.resetErrorsCount)(this.gen,this.errsCount)}ok(C){this.allErrors||this.gen.if(C)}setParams(C,D){D?Object.assign(this.params,C):this.params=C}block$data(C,D,B=u.nil){this.gen.block(()=>{this.check$data(C,B),D()})}check$data(C=u.nil,D=u.nil){if(!this.$data)return;let{gen:B,schemaCode:ne,schemaType:pe,def:Ke}=this;B.if((0,u.or)(u._`${ne} === undefined`,D)),C!==u.nil&&B.assign(C,!0),(pe.length||Ke.validateSchema)&&(B.elseIf(this.invalid$data()),this.$dataError(),C!==u.nil&&B.assign(C,!1)),B.else()}invalid$data(){let{gen:C,schemaCode:D,schemaType:B,def:ne,it:pe}=this;return(0,u.or)(Ke(),dt());function Ke(){if(B.length){if(!(D instanceof u.Name))throw Error("ajv implementation error");let kt=Array.isArray(B)?B:[B];return u._`${(0,i.checkDataTypes)(kt,D,pe.opts.strictNumbers,i.DataType.Wrong)}`}return u.nil}function dt(){if(ne.validateSchema){let kt=C.scopeValue("validate$data",{ref:ne.validateSchema});return u._`!${kt}(${D})`}return u.nil}}subschema(C,D){let B=(0,a.getSubschema)(this.it,C);(0,a.extendSubschemaData)(B,this.it,C),(0,a.extendSubschemaMode)(B,C);let ne={...this.it,...B,items:void 0,props:void 0};return d(ne,D),ne}mergeEvaluated(C,D){let{it:B,gen:ne}=this;B.opts.unevaluated&&(B.props!==!0&&C.props!==void 0&&(B.props=v.mergeEvaluated.props(ne,C.props,B.props,D)),B.items!==!0&&C.items!==void 0&&(B.items=v.mergeEvaluated.items(ne,C.items,B.items,D)))}mergeValidEvaluated(C,D){let{it:B,gen:ne}=this;if(B.opts.unevaluated&&(B.props!==!0||B.items!==!0))return ne.if(D,()=>this.mergeEvaluated(C,u.Name)),!0}}e.KeywordCxt=re;function se(O,C,D,B){let ne=new re(O,D,C);"code"in D?D.code(ne,B):ne.$data&&D.validate?(0,o.funcKeywordCode)(ne,D):"macro"in D?(0,o.macroKeywordCode)(ne,D):(D.compile||D.validate)&&(0,o.funcKeywordCode)(ne,D)}var xe=/^\/(?:[^~]|~0|~1)*$/,_e=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Le(O,{dataLevel:C,dataNames:D,dataPathArr:B}){let ne,pe;if(O==="")return l.default.rootData;if(O[0]==="/"){if(!xe.test(O))throw Error(`Invalid JSON-pointer: ${O}`);ne=O,pe=l.default.rootData}else{let Tt=_e.exec(O);if(!Tt)throw Error(`Invalid JSON-pointer: ${O}`);let pt=+Tt[1];if(ne=Tt[2],ne==="#"){if(pt>=C)throw Error(kt("property/index",pt));return B[C-pt]}if(pt>C)throw Error(kt("data",pt));if(pe=D[C-pt],!ne)return pe}let Ke=pe,dt=ne.split("/");for(let Tt of dt)Tt&&(pe=u._`${pe}${(0,u.getProperty)((0,v.unescapeJsonPointer)(Tt))}`,Ke=u._`${Ke} && ${pe}`);return Ke;function kt(Tt,pt){return`Cannot access ${Tt} ${pt} levels up, current level is ${C}`}}e.getData=Le}),oa=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});class t extends Error{constructor(n){super("validation failed"),this.errors=n,this.ajv=this.validation=!0}}e.default=t}),Rs=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Cs();class r extends Error{constructor(i,s,o,a){super(a||`can't resolve reference ${o} from id ${s}`),this.missingRef=(0,t.resolveUrl)(i,s,o),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(i,this.missingRef))}}e.default=r}),aa=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;var t=me(),r=oa(),n=Hr(),i=Cs(),s=Te(),o=Es();class a{constructor(p){var c;this.refs={},this.dynamicAnchors={};let d;typeof p.schema=="object"&&(d=p.schema),this.schema=p.schema,this.schemaId=p.schemaId,this.root=p.root||this,this.baseId=(c=p.baseId)!==null&&c!==void 0?c:(0,i.normalizeId)(d?.[p.schemaId||"$id"]),this.schemaPath=p.schemaPath,this.localRefs=p.localRefs,this.meta=p.meta,this.$async=d?.$async,this.refs={}}}e.SchemaEnv=a;function u(f){let p=v.call(this,f);if(p)return p;let c=(0,i.getFullPath)(this.opts.uriResolver,f.root.baseId),{es5:d,lines:y}=this.opts.code,{ownProperties:h}=this.opts,_=new t.CodeGen(this.scope,{es5:d,lines:y,ownProperties:h}),$;f.$async&&($=_.scopeValue("Error",{ref:r.default,code:t._`require("ajv/dist/runtime/validation_error").default`}));let E=_.scopeName("validate");f.validateName=E;let q={gen:_,allErrors:this.opts.allErrors,data:n.default.data,parentData:n.default.parentData,parentDataProperty:n.default.parentDataProperty,dataNames:[n.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:_.scopeValue("schema",this.opts.code.source===!0?{ref:f.schema,code:(0,t.stringify)(f.schema)}:{ref:f.schema}),validateName:E,ValidationError:$,schema:f.schema,schemaEnv:f,rootId:c,baseId:f.baseId||c,schemaPath:t.nil,errSchemaPath:f.schemaPath||(this.opts.jtd?"":"#"),errorPath:t._`""`,opts:this.opts,self:this},z;try{this._compilations.add(f),(0,o.validateFunctionCode)(q),_.optimize(this.opts.code.optimize);let L=_.toString();z=`${_.scopeRefs(n.default.scope)}return ${L}`,this.opts.code.process&&(z=this.opts.code.process(z,f));let W=Function(`${n.default.self}`,`${n.default.scope}`,z)(this,this.scope.get());if(this.scope.value(E,{ref:W}),W.errors=null,W.schema=f.schema,W.schemaEnv=f,f.$async&&(W.$async=!0),this.opts.code.source===!0&&(W.source={validateName:E,validateCode:L,scopeValues:_._values}),this.opts.unevaluated){let{props:X,items:G}=q;W.evaluated={props:X instanceof t.Name?void 0:X,items:G instanceof t.Name?void 0:G,dynamicProps:X instanceof t.Name,dynamicItems:G instanceof t.Name},W.source&&(W.source.evaluated=(0,t.stringify)(W.evaluated))}return f.validate=W,f}catch(L){throw delete f.validate,delete f.validateName,z&&this.logger.error("Error compiling schema, function code:",z),L}finally{this._compilations.delete(f)}}e.compileSchema=u;function l(f,p,c){var d;c=(0,i.resolveUrl)(this.opts.uriResolver,p,c);let y=f.refs[c];if(y)return y;let h=I.call(this,f,c);if(h===void 0){let _=(d=f.localRefs)===null||d===void 0?void 0:d[c],{schemaId:$}=this.opts;_&&(h=new a({schema:_,schemaId:$,root:f,baseId:p}))}if(h!==void 0)return f.refs[c]=m.call(this,h)}e.resolveRef=l;function m(f){return(0,i.inlineRef)(f.schema,this.opts.inlineRefs)?f.schema:f.validate?f:u.call(this,f)}function v(f){for(let p of this._compilations)if(w(p,f))return p}e.getCompilingSchema=v;function w(f,p){return f.schema===p.schema&&f.root===p.root&&f.baseId===p.baseId}function I(f,p){let c;for(;typeof(c=this.refs[p])=="string";)p=c;return c||this.schemas[p]||T.call(this,f,p)}function T(f,p){let c=this.opts.uriResolver.parse(p),d=(0,i._getFullPath)(this.opts.uriResolver,c),y=(0,i.getFullPath)(this.opts.uriResolver,f.baseId,void 0);if(Object.keys(f.schema).length>0&&d===y)return b.call(this,c,f);let h=(0,i.normalizeId)(d),_=this.refs[h]||this.schemas[h];if(typeof _=="string"){let $=T.call(this,f,_);return typeof $?.schema!="object"?void 0:b.call(this,c,$)}if(typeof _?.schema=="object"){if(_.validate||u.call(this,_),h===(0,i.normalizeId)(p)){let{schema:$}=_,{schemaId:E}=this.opts,q=$[E];return q&&(y=(0,i.resolveUrl)(this.opts.uriResolver,y,q)),new a({schema:$,schemaId:E,root:f,baseId:y})}return b.call(this,c,_)}}e.resolveSchema=T;var k=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function b(f,{baseId:p,schema:c,root:d}){var y;if(((y=f.fragment)===null||y===void 0?void 0:y[0])!=="/")return;for(let $ of f.fragment.slice(1).split("/")){if(typeof c=="boolean")return;let E=c[(0,s.unescapeFragment)($)];if(E===void 0)return;c=E;let q=typeof c=="object"&&c[this.opts.schemaId];!k.has($)&&q&&(p=(0,i.resolveUrl)(this.opts.uriResolver,p,q))}let h;if(typeof c!="boolean"&&c.$ref&&!(0,s.schemaHasRulesButRef)(c,this.RULES)){let $=(0,i.resolveUrl)(this.opts.uriResolver,p,c.$ref);h=T.call(this,d,$)}let{schemaId:_}=this.opts;if(h=h||new a({schema:c,schemaId:_,root:d,baseId:p}),h.schema!==h.root.schema)return h}}),qy=Q((e,t)=>{t.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),Ly=Q((e,t)=>{var r={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};t.exports={HEX:r}}),Ky=Q((e,t)=>{var{HEX:r}=Ly(),n=/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u;function i(f){if(l(f,".")<3)return{host:f,isIPV4:!1};let p=f.match(n)||[],[c]=p;return c?{host:u(c,"."),isIPV4:!0}:{host:f,isIPV4:!1}}function s(f,p=!1){let c="",d=!0;for(let y of f){if(r[y]===void 0)return;y!=="0"&&d===!0&&(d=!1),d||(c+=y)}return p&&c.length===0&&(c="0"),c}function o(f){let p=0,c={error:!1,address:"",zone:""},d=[],y=[],h=!1,_=!1,$=!1;function E(){if(y.length){if(h===!1){let q=s(y);if(q!==void 0)d.push(q);else return c.error=!0,!1}y.length=0}return!0}for(let q=0;q<f.length;q++){let z=f[q];if(!(z==="["||z==="]"))if(z===":"){if(_===!0&&($=!0),!E())break;if(p++,d.push(":"),p>7){c.error=!0;break}q-1>=0&&f[q-1]===":"&&(_=!0);continue}else if(z==="%"){if(!E())break;h=!0}else{y.push(z);continue}}return y.length&&(h?c.zone=y.join(""):$?d.push(y.join("")):d.push(s(y))),c.address=d.join(""),c}function a(f){if(l(f,":")<2)return{host:f,isIPV6:!1};let p=o(f);if(p.error)return{host:f,isIPV6:!1};{let{address:c,address:d}=p;return p.zone&&(c+="%"+p.zone,d+="%25"+p.zone),{host:c,escapedHost:d,isIPV6:!0}}}function u(f,p){let c="",d=!0,y=f.length;for(let h=0;h<y;h++){let _=f[h];_==="0"&&d?(h+1<=y&&f[h+1]===p||h+1===y)&&(c+=_,d=!1):(_===p?d=!0:d=!1,c+=_)}return c}function l(f,p){let c=0;for(let d=0;d<f.length;d++)f[d]===p&&c++;return c}var m=/^\.\.?\//u,v=/^\/\.(?:\/|$)/u,w=/^\/\.\.(?:\/|$)/u,I=/^\/?(?:.|\n)*?(?=\/|$)/u;function T(f){let p=[];for(;f.length;)if(f.match(m))f=f.replace(m,"");else if(f.match(v))f=f.replace(v,"/");else if(f.match(w))f=f.replace(w,"/"),p.pop();else if(f==="."||f==="..")f="";else{let c=f.match(I);if(c){let d=c[0];f=f.slice(d.length),p.push(d)}else throw Error("Unexpected dot segment condition")}return p.join("")}function k(f,p){let c=p!==!0?escape:unescape;return f.scheme!==void 0&&(f.scheme=c(f.scheme)),f.userinfo!==void 0&&(f.userinfo=c(f.userinfo)),f.host!==void 0&&(f.host=c(f.host)),f.path!==void 0&&(f.path=c(f.path)),f.query!==void 0&&(f.query=c(f.query)),f.fragment!==void 0&&(f.fragment=c(f.fragment)),f}function b(f){let p=[];if(f.userinfo!==void 0&&(p.push(f.userinfo),p.push("@")),f.host!==void 0){let c=unescape(f.host),d=i(c);if(d.isIPV4)c=d.host;else{let y=a(d.host);y.isIPV6===!0?c=`[${y.escapedHost}]`:c=f.host}p.push(c)}return(typeof f.port=="number"||typeof f.port=="string")&&(p.push(":"),p.push(String(f.port))),p.length?p.join(""):void 0}t.exports={recomposeAuthority:b,normalizeComponentEncoding:k,removeDotSegments:T,normalizeIPv4:i,normalizeIPv6:a,stringArrayToHexStripped:s}}),Vy=Q((e,t)=>{var r=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,n=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function i(d){return typeof d.secure=="boolean"?d.secure:String(d.scheme).toLowerCase()==="wss"}function s(d){return d.host||(d.error=d.error||"HTTP URIs must have a host."),d}function o(d){let y=String(d.scheme).toLowerCase()==="https";return(d.port===(y?443:80)||d.port==="")&&(d.port=void 0),d.path||(d.path="/"),d}function a(d){return d.secure=i(d),d.resourceName=(d.path||"/")+(d.query?"?"+d.query:""),d.path=void 0,d.query=void 0,d}function u(d){if((d.port===(i(d)?443:80)||d.port==="")&&(d.port=void 0),typeof d.secure=="boolean"&&(d.scheme=d.secure?"wss":"ws",d.secure=void 0),d.resourceName){let[y,h]=d.resourceName.split("?");d.path=y&&y!=="/"?y:void 0,d.query=h,d.resourceName=void 0}return d.fragment=void 0,d}function l(d,y){if(!d.path)return d.error="URN can not be parsed",d;let h=d.path.match(n);if(h){let _=y.scheme||d.scheme||"urn";d.nid=h[1].toLowerCase(),d.nss=h[2];let $=`${_}:${y.nid||d.nid}`,E=c[$];d.path=void 0,E&&(d=E.parse(d,y))}else d.error=d.error||"URN can not be parsed.";return d}function m(d,y){let h=y.scheme||d.scheme||"urn",_=d.nid.toLowerCase(),$=`${h}:${y.nid||_}`,E=c[$];E&&(d=E.serialize(d,y));let q=d,z=d.nss;return q.path=`${_||y.nid}:${z}`,y.skipEscape=!0,q}function v(d,y){let h=d;return h.uuid=h.nss,h.nss=void 0,!y.tolerant&&(!h.uuid||!r.test(h.uuid))&&(h.error=h.error||"UUID is not valid."),h}function w(d){let y=d;return y.nss=(d.uuid||"").toLowerCase(),y}var I={scheme:"http",domainHost:!0,parse:s,serialize:o},T={scheme:"https",domainHost:I.domainHost,parse:s,serialize:o},k={scheme:"ws",domainHost:!0,parse:a,serialize:u},b={scheme:"wss",domainHost:k.domainHost,parse:k.parse,serialize:k.serialize},f={scheme:"urn",parse:l,serialize:m,skipNormalize:!0},p={scheme:"urn:uuid",parse:v,serialize:w,skipNormalize:!0},c={http:I,https:T,ws:k,wss:b,urn:f,"urn:uuid":p};t.exports=c}),Zy=Q((e,t)=>{var{normalizeIPv6:r,normalizeIPv4:n,removeDotSegments:i,recomposeAuthority:s,normalizeComponentEncoding:o}=Ky(),a=Vy();function u(p,c){return typeof p=="string"?p=w(b(p,c),c):typeof p=="object"&&(p=b(w(p,c),c)),p}function l(p,c,d){let y=Object.assign({scheme:"null"},d),h=m(b(p,y),b(c,y),y,!0);return w(h,{...y,skipEscape:!0})}function m(p,c,d,y){let h={};return y||(p=b(w(p,d),d),c=b(w(c,d),d)),d=d||{},!d.tolerant&&c.scheme?(h.scheme=c.scheme,h.userinfo=c.userinfo,h.host=c.host,h.port=c.port,h.path=i(c.path||""),h.query=c.query):(c.userinfo!==void 0||c.host!==void 0||c.port!==void 0?(h.userinfo=c.userinfo,h.host=c.host,h.port=c.port,h.path=i(c.path||""),h.query=c.query):(c.path?(c.path.charAt(0)==="/"?h.path=i(c.path):((p.userinfo!==void 0||p.host!==void 0||p.port!==void 0)&&!p.path?h.path="/"+c.path:p.path?h.path=p.path.slice(0,p.path.lastIndexOf("/")+1)+c.path:h.path=c.path,h.path=i(h.path)),h.query=c.query):(h.path=p.path,c.query!==void 0?h.query=c.query:h.query=p.query),h.userinfo=p.userinfo,h.host=p.host,h.port=p.port),h.scheme=p.scheme),h.fragment=c.fragment,h}function v(p,c,d){return typeof p=="string"?(p=unescape(p),p=w(o(b(p,d),!0),{...d,skipEscape:!0})):typeof p=="object"&&(p=w(o(p,!0),{...d,skipEscape:!0})),typeof c=="string"?(c=unescape(c),c=w(o(b(c,d),!0),{...d,skipEscape:!0})):typeof c=="object"&&(c=w(o(c,!0),{...d,skipEscape:!0})),p.toLowerCase()===c.toLowerCase()}function w(p,c){let d={host:p.host,scheme:p.scheme,userinfo:p.userinfo,port:p.port,path:p.path,query:p.query,nid:p.nid,nss:p.nss,uuid:p.uuid,fragment:p.fragment,reference:p.reference,resourceName:p.resourceName,secure:p.secure,error:""},y=Object.assign({},c),h=[],_=a[(y.scheme||d.scheme||"").toLowerCase()];_&&_.serialize&&_.serialize(d,y),d.path!==void 0&&(y.skipEscape?d.path=unescape(d.path):(d.path=escape(d.path),d.scheme!==void 0&&(d.path=d.path.split("%3A").join(":")))),y.reference!=="suffix"&&d.scheme&&h.push(d.scheme,":");let $=s(d);if($!==void 0&&(y.reference!=="suffix"&&h.push("//"),h.push($),d.path&&d.path.charAt(0)!=="/"&&h.push("/")),d.path!==void 0){let E=d.path;!y.absolutePath&&(!_||!_.absolutePath)&&(E=i(E)),$===void 0&&(E=E.replace(/^\/\//u,"/%2F")),h.push(E)}return d.query!==void 0&&h.push("?",d.query),d.fragment!==void 0&&h.push("#",d.fragment),h.join("")}var I=Array.from({length:127},(p,c)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(c)));function T(p){let c=0;for(let d=0,y=p.length;d<y;++d)if(c=p.charCodeAt(d),c>126||I[c])return!0;return!1}var k=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function b(p,c){let d=Object.assign({},c),y={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},h=p.indexOf("%")!==-1,_=!1;d.reference==="suffix"&&(p=(d.scheme?d.scheme+":":"")+"//"+p);let $=p.match(k);if($){if(y.scheme=$[1],y.userinfo=$[3],y.host=$[4],y.port=parseInt($[5],10),y.path=$[6]||"",y.query=$[7],y.fragment=$[8],isNaN(y.port)&&(y.port=$[5]),y.host){let q=n(y.host);if(q.isIPV4===!1){let z=r(q.host);y.host=z.host.toLowerCase(),_=z.isIPV6}else y.host=q.host,_=!0}y.scheme===void 0&&y.userinfo===void 0&&y.host===void 0&&y.port===void 0&&y.query===void 0&&!y.path?y.reference="same-document":y.scheme===void 0?y.reference="relative":y.fragment===void 0?y.reference="absolute":y.reference="uri",d.reference&&d.reference!=="suffix"&&d.reference!==y.reference&&(y.error=y.error||"URI is not a "+d.reference+" reference.");let E=a[(d.scheme||y.scheme||"").toLowerCase()];if(!d.unicodeSupport&&(!E||!E.unicodeSupport)&&y.host&&(d.domainHost||E&&E.domainHost)&&_===!1&&T(y.host))try{y.host=URL.domainToASCII(y.host.toLowerCase())}catch(q){y.error=y.error||"Host's domain name can not be converted to ASCII: "+q}(!E||E&&!E.skipNormalize)&&(h&&y.scheme!==void 0&&(y.scheme=unescape(y.scheme)),h&&y.host!==void 0&&(y.host=unescape(y.host)),y.path&&(y.path=escape(unescape(y.path))),y.fragment&&(y.fragment=encodeURI(decodeURIComponent(y.fragment)))),E&&E.parse&&E.parse(y,d)}else y.error=y.error||"URI can not be parsed.";return y}var f={SCHEMES:a,normalize:u,resolve:l,resolveComponents:m,equal:v,serialize:w,parse:b};t.exports=f,t.exports.default=f,t.exports.fastUri=f}),Wy=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Zy();t.code='require("ajv/dist/runtime/uri").default',e.default=t}),By=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=Es();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=me();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});var n=oa(),i=Rs(),s=Vd(),o=aa(),a=me(),u=Cs(),l=Is(),m=Te(),v=qy(),w=Wy(),I=(Z,P)=>new RegExp(Z,P);I.code="new RegExp";var T=["removeAdditional","useDefaults","coerceTypes"],k=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),b={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},f={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},p=200;function c(Z){var P,U,R,g,x,M,re,se,xe,_e,Le,O,C,D,B,ne,pe,Ke,dt,kt,Tt,pt,pn,Kt,Bs;let si=Z.strict,Hs=(P=Z.code)===null||P===void 0?void 0:P.optimize,Ta=Hs===!0||Hs===void 0?1:Hs||0,Pa=(R=(U=Z.code)===null||U===void 0?void 0:U.regExp)!==null&&R!==void 0?R:I,Bf=(g=Z.uriResolver)!==null&&g!==void 0?g:w.default;return{strictSchema:(M=(x=Z.strictSchema)!==null&&x!==void 0?x:si)!==null&&M!==void 0?M:!0,strictNumbers:(se=(re=Z.strictNumbers)!==null&&re!==void 0?re:si)!==null&&se!==void 0?se:!0,strictTypes:(_e=(xe=Z.strictTypes)!==null&&xe!==void 0?xe:si)!==null&&_e!==void 0?_e:"log",strictTuples:(O=(Le=Z.strictTuples)!==null&&Le!==void 0?Le:si)!==null&&O!==void 0?O:"log",strictRequired:(D=(C=Z.strictRequired)!==null&&C!==void 0?C:si)!==null&&D!==void 0?D:!1,code:Z.code?{...Z.code,optimize:Ta,regExp:Pa}:{optimize:Ta,regExp:Pa},loopRequired:(B=Z.loopRequired)!==null&&B!==void 0?B:p,loopEnum:(ne=Z.loopEnum)!==null&&ne!==void 0?ne:p,meta:(pe=Z.meta)!==null&&pe!==void 0?pe:!0,messages:(Ke=Z.messages)!==null&&Ke!==void 0?Ke:!0,inlineRefs:(dt=Z.inlineRefs)!==null&&dt!==void 0?dt:!0,schemaId:(kt=Z.schemaId)!==null&&kt!==void 0?kt:"$id",addUsedSchema:(Tt=Z.addUsedSchema)!==null&&Tt!==void 0?Tt:!0,validateSchema:(pt=Z.validateSchema)!==null&&pt!==void 0?pt:!0,validateFormats:(pn=Z.validateFormats)!==null&&pn!==void 0?pn:!0,unicodeRegExp:(Kt=Z.unicodeRegExp)!==null&&Kt!==void 0?Kt:!0,int32range:(Bs=Z.int32range)!==null&&Bs!==void 0?Bs:!0,uriResolver:Bf}}class d{constructor(P={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,P=this.opts={...P,...c(P)};let{es5:U,lines:R}=this.opts.code;this.scope=new a.ValueScope({scope:{},prefixes:k,es5:U,lines:R}),this.logger=L(P.logger);let g=P.validateFormats;P.validateFormats=!1,this.RULES=(0,s.getRules)(),y.call(this,b,P,"NOT SUPPORTED"),y.call(this,f,P,"DEPRECATED","warn"),this._metaOpts=q.call(this),P.formats&&$.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),P.keywords&&E.call(this,P.keywords),typeof P.meta=="object"&&this.addMetaSchema(P.meta),_.call(this),P.validateFormats=g}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:P,meta:U,schemaId:R}=this.opts,g=v;R==="id"&&(g={...v},g.id=g.$id,delete g.$id),U&&P&&this.addMetaSchema(g,g[R],!1)}defaultMeta(){let{meta:P,schemaId:U}=this.opts;return this.opts.defaultMeta=typeof P=="object"?P[U]||P:void 0}validate(P,U){let R;if(typeof P=="string"){if(R=this.getSchema(P),!R)throw Error(`no schema with key or ref "${P}"`)}else R=this.compile(P);let g=R(U);return"$async"in R||(this.errors=R.errors),g}compile(P,U){let R=this._addSchema(P,U);return R.validate||this._compileSchemaEnv(R)}compileAsync(P,U){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:R}=this.opts;return g.call(this,P,U);async function g(_e,Le){await x.call(this,_e.$schema);let O=this._addSchema(_e,Le);return O.validate||M.call(this,O)}async function x(_e){_e&&!this.getSchema(_e)&&await g.call(this,{$ref:_e},!0)}async function M(_e){try{return this._compileSchemaEnv(_e)}catch(Le){if(!(Le instanceof i.default))throw Le;return re.call(this,Le),await se.call(this,Le.missingSchema),M.call(this,_e)}}function re({missingSchema:_e,missingRef:Le}){if(this.refs[_e])throw Error(`AnySchema ${_e} is loaded but ${Le} cannot be resolved`)}async function se(_e){let Le=await xe.call(this,_e);this.refs[_e]||await x.call(this,Le.$schema),this.refs[_e]||this.addSchema(Le,_e,U)}async function xe(_e){let Le=this._loading[_e];if(Le)return Le;try{return await(this._loading[_e]=R(_e))}finally{delete this._loading[_e]}}}addSchema(P,U,R,g=this.opts.validateSchema){if(Array.isArray(P)){for(let M of P)this.addSchema(M,void 0,R,g);return this}let x;if(typeof P=="object"){let{schemaId:M}=this.opts;if(x=P[M],x!==void 0&&typeof x!="string")throw Error(`schema ${M} must be string`)}return U=(0,u.normalizeId)(U||x),this._checkUnique(U),this.schemas[U]=this._addSchema(P,R,U,g,!0),this}addMetaSchema(P,U,R=this.opts.validateSchema){return this.addSchema(P,U,!0,R),this}validateSchema(P,U){if(typeof P=="boolean")return!0;let R;if(R=P.$schema,R!==void 0&&typeof R!="string")throw Error("$schema must be a string");if(R=R||this.opts.defaultMeta||this.defaultMeta(),!R)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let g=this.validate(R,P);if(!g&&U){let x="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(x);else throw Error(x)}return g}getSchema(P){let U;for(;typeof(U=h.call(this,P))=="string";)P=U;if(U===void 0){let{schemaId:R}=this.opts,g=new o.SchemaEnv({schema:{},schemaId:R});if(U=o.resolveSchema.call(this,g,P),!U)return;this.refs[P]=U}return U.validate||this._compileSchemaEnv(U)}removeSchema(P){if(P instanceof RegExp)return this._removeAllSchemas(this.schemas,P),this._removeAllSchemas(this.refs,P),this;switch(typeof P){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let U=h.call(this,P);return typeof U=="object"&&this._cache.delete(U.schema),delete this.schemas[P],delete this.refs[P],this}case"object":{let U=P;this._cache.delete(U);let R=P[this.opts.schemaId];return R&&(R=(0,u.normalizeId)(R),delete this.schemas[R],delete this.refs[R]),this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(P){for(let U of P)this.addKeyword(U);return this}addKeyword(P,U){let R;if(typeof P=="string")R=P,typeof U=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),U.keyword=R);else if(typeof P=="object"&&U===void 0){if(U=P,R=U.keyword,Array.isArray(R)&&!R.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(X.call(this,R,U),!U)return(0,m.eachItem)(R,x=>G.call(this,x)),this;rt.call(this,U);let g={...U,type:(0,l.getJSONTypes)(U.type),schemaType:(0,l.getJSONTypes)(U.schemaType)};return(0,m.eachItem)(R,g.type.length===0?x=>G.call(this,x,g):x=>g.type.forEach(M=>G.call(this,x,g,M))),this}getKeyword(P){let U=this.RULES.all[P];return typeof U=="object"?U.definition:!!U}removeKeyword(P){let{RULES:U}=this;delete U.keywords[P],delete U.all[P];for(let R of U.rules){let g=R.rules.findIndex(x=>x.keyword===P);g>=0&&R.rules.splice(g,1)}return this}addFormat(P,U){return typeof U=="string"&&(U=new RegExp(U)),this.formats[P]=U,this}errorsText(P=this.errors,{separator:U=", ",dataVar:R="data"}={}){return!P||P.length===0?"No errors":P.map(g=>`${R}${g.instancePath} ${g.message}`).reduce((g,x)=>g+U+x)}$dataMetaSchema(P,U){let R=this.RULES.all;P=JSON.parse(JSON.stringify(P));for(let g of U){let x=g.split("/").slice(1),M=P;for(let re of x)M=M[re];for(let re in R){let se=R[re];if(typeof se!="object")continue;let{$data:xe}=se.definition,_e=M[re];xe&&_e&&(M[re]=ye(_e))}}return P}_removeAllSchemas(P,U){for(let R in P){let g=P[R];(!U||U.test(R))&&(typeof g=="string"?delete P[R]:g&&!g.meta&&(this._cache.delete(g.schema),delete P[R]))}}_addSchema(P,U,R,g=this.opts.validateSchema,x=this.opts.addUsedSchema){let M,{schemaId:re}=this.opts;if(typeof P=="object")M=P[re];else{if(this.opts.jtd)throw Error("schema must be object");if(typeof P!="boolean")throw Error("schema must be object or boolean")}let se=this._cache.get(P);if(se!==void 0)return se;R=(0,u.normalizeId)(M||R);let xe=u.getSchemaRefs.call(this,P,R);return se=new o.SchemaEnv({schema:P,schemaId:re,meta:U,baseId:R,localRefs:xe}),this._cache.set(se.schema,se),x&&!R.startsWith("#")&&(R&&this._checkUnique(R),this.refs[R]=se),g&&this.validateSchema(P,!0),se}_checkUnique(P){if(this.schemas[P]||this.refs[P])throw Error(`schema with key or id "${P}" already exists`)}_compileSchemaEnv(P){if(P.meta?this._compileMetaSchema(P):o.compileSchema.call(this,P),!P.validate)throw Error("ajv implementation error");return P.validate}_compileMetaSchema(P){let U=this.opts;this.opts=this._metaOpts;try{o.compileSchema.call(this,P)}finally{this.opts=U}}}d.ValidationError=n.default,d.MissingRefError=i.default,e.default=d;function y(Z,P,U,R="error"){for(let g in Z){let x=g;x in P&&this.logger[R](`${U}: option ${g}. ${Z[x]}`)}}function h(Z){return Z=(0,u.normalizeId)(Z),this.schemas[Z]||this.refs[Z]}function _(){let Z=this.opts.schemas;if(Z)if(Array.isArray(Z))this.addSchema(Z);else for(let P in Z)this.addSchema(Z[P],P)}function $(){for(let Z in this.opts.formats){let P=this.opts.formats[Z];P&&this.addFormat(Z,P)}}function E(Z){if(Array.isArray(Z)){this.addVocabulary(Z);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let P in Z){let U=Z[P];U.keyword||(U.keyword=P),this.addKeyword(U)}}function q(){let Z={...this.opts};for(let P of T)delete Z[P];return Z}var z={log(){},warn(){},error(){}};function L(Z){if(Z===!1)return z;if(Z===void 0)return console;if(Z.log&&Z.warn&&Z.error)return Z;throw Error("logger must implement log, warn and error methods")}var W=/^[a-z_$][a-z0-9_$:-]*$/i;function X(Z,P){let{RULES:U}=this;if((0,m.eachItem)(Z,R=>{if(U.keywords[R])throw Error(`Keyword ${R} is already defined`);if(!W.test(R))throw Error(`Keyword ${R} has invalid name`)}),!!P&&P.$data&&!("code"in P||"validate"in P))throw Error('$data keyword must have "code" or "validate" function')}function G(Z,P,U){var R;let g=P?.post;if(U&&g)throw Error('keyword with "post" flag cannot have "type"');let{RULES:x}=this,M=g?x.post:x.rules.find(({type:se})=>se===U);if(M||(M={type:U,rules:[]},x.rules.push(M)),x.keywords[Z]=!0,!P)return;let re={keyword:Z,definition:{...P,type:(0,l.getJSONTypes)(P.type),schemaType:(0,l.getJSONTypes)(P.schemaType)}};P.before?Je.call(this,M,re,P.before):M.rules.push(re),x.all[Z]=re,(R=P.implements)===null||R===void 0||R.forEach(se=>this.addKeyword(se))}function Je(Z,P,U){let R=Z.rules.findIndex(g=>g.keyword===U);R>=0?Z.rules.splice(R,0,P):(Z.rules.push(P),this.logger.warn(`rule ${U} is not defined`))}function rt(Z){let{metaSchema:P}=Z;P!==void 0&&(Z.$data&&this.opts.$data&&(P=ye(P)),Z.validateSchema=this.compile(P,!0))}var lt={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function ye(Z){return{anyOf:[Z,lt]}}}),Hy=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};e.default=t}),Gy=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;var t=Rs(),r=fr(),n=me(),i=Hr(),s=aa(),o=Te(),a={keyword:"$ref",schemaType:"string",code(m){let{gen:v,schema:w,it:I}=m,{baseId:T,schemaEnv:k,validateName:b,opts:f,self:p}=I,{root:c}=k;if((w==="#"||w==="#/")&&T===c.baseId)return y();let d=s.resolveRef.call(p,c,T,w);if(d===void 0)throw new t.default(I.opts.uriResolver,T,w);if(d instanceof s.SchemaEnv)return h(d);return _(d);function y(){if(k===c)return l(m,b,k,k.$async);let $=v.scopeValue("root",{ref:c});return l(m,n._`${$}.validate`,c,c.$async)}function h($){let E=u(m,$);l(m,E,$,$.$async)}function _($){let E=v.scopeValue("schema",f.code.source===!0?{ref:$,code:(0,n.stringify)($)}:{ref:$}),q=v.name("valid"),z=m.subschema({schema:$,dataTypes:[],schemaPath:n.nil,topSchemaRef:E,errSchemaPath:w},q);m.mergeEvaluated(z),m.ok(q)}}};function u(m,v){let{gen:w}=m;return v.validate?w.scopeValue("validate",{ref:v.validate}):n._`${w.scopeValue("wrapper",{ref:v})}.validate`}e.getValidate=u;function l(m,v,w,I){let{gen:T,it:k}=m,{allErrors:b,schemaEnv:f,opts:p}=k,c=p.passContext?i.default.this:n.nil;I?d():y();function d(){if(!f.$async)throw Error("async schema referenced by sync schema");let $=T.let("valid");T.try(()=>{T.code(n._`await ${(0,r.callValidateCode)(m,v,c)}`),_(v),!b&&T.assign($,!0)},E=>{T.if(n._`!(${E} instanceof ${k.ValidationError})`,()=>T.throw(E)),h(E),!b&&T.assign($,!1)}),m.ok($)}function y(){m.result((0,r.callValidateCode)(m,v,c),()=>_(v),()=>h(v))}function h($){let E=n._`${$}.errors`;T.assign(i.default.vErrors,n._`${i.default.vErrors} === null ? ${E} : ${i.default.vErrors}.concat(${E})`),T.assign(i.default.errors,n._`${i.default.vErrors}.length`)}function _($){var E;if(!k.opts.unevaluated)return;let q=(E=w?.validate)===null||E===void 0?void 0:E.evaluated;if(k.props!==!0)if(q&&!q.dynamicProps)q.props!==void 0&&(k.props=o.mergeEvaluated.props(T,q.props,k.props));else{let z=T.var("props",n._`${$}.evaluated.props`);k.props=o.mergeEvaluated.props(T,z,k.props,n.Name)}if(k.items!==!0)if(q&&!q.dynamicItems)q.items!==void 0&&(k.items=o.mergeEvaluated.items(T,q.items,k.items));else{let z=T.var("items",n._`${$}.evaluated.items`);k.items=o.mergeEvaluated.items(T,z,k.items,n.Name)}}}e.callRef=l,e.default=a}),Yy=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Hy(),r=Gy(),n=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,r.default];e.default=n}),Jy=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=me(),r=t.operators,n={maximum:{okStr:"<=",ok:r.LTE,fail:r.GT},minimum:{okStr:">=",ok:r.GTE,fail:r.LT},exclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},exclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},i={message:({keyword:o,schemaCode:a})=>t.str`must be ${n[o].okStr} ${a}`,params:({keyword:o,schemaCode:a})=>t._`{comparison: ${n[o].okStr}, limit: ${a}}`},s={keyword:Object.keys(n),type:"number",schemaType:"number",$data:!0,error:i,code(o){let{keyword:a,data:u,schemaCode:l}=o;o.fail$data(t._`${u} ${n[a].fail} ${l} || isNaN(${u})`)}};e.default=s}),Qy=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=me(),r={message:({schemaCode:i})=>t.str`must be multiple of ${i}`,params:({schemaCode:i})=>t._`{multipleOf: ${i}}`},n={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:r,code(i){let{gen:s,data:o,schemaCode:a,it:u}=i,l=u.opts.multipleOfPrecision,m=s.let("res"),v=l?t._`Math.abs(Math.round(${m}) - ${m}) > 1e-${l}`:t._`${m} !== parseInt(${m})`;i.fail$data(t._`(${a} === 0 || (${m} = ${o}/${a}, ${v}))`)}};e.default=n}),Xy=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(r){let n=r.length,i=0,s=0,o;for(;s<n;)i++,o=r.charCodeAt(s++),o>=55296&&o<=56319&&s<n&&(o=r.charCodeAt(s),(o&64512)===56320&&s++);return i}e.default=t,t.code='require("ajv/dist/runtime/ucs2length").default'}),ev=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=me(),r=Te(),n=Xy(),i={message({keyword:o,schemaCode:a}){let u=o==="maxLength"?"more":"fewer";return t.str`must NOT have ${u} than ${a} characters`},params:({schemaCode:o})=>t._`{limit: ${o}}`},s={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:i,code(o){let{keyword:a,data:u,schemaCode:l,it:m}=o,v=a==="maxLength"?t.operators.GT:t.operators.LT,w=m.opts.unicode===!1?t._`${u}.length`:t._`${(0,r.useFunc)(o.gen,n.default)}(${u})`;o.fail$data(t._`${w} ${v} ${l}`)}};e.default=s}),tv=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=fr(),r=me(),n={message:({schemaCode:s})=>r.str`must match pattern "${s}"`,params:({schemaCode:s})=>r._`{pattern: ${s}}`},i={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:n,code(s){let{data:o,$data:a,schema:u,schemaCode:l,it:m}=s,v=m.opts.unicodeRegExp?"u":"",w=a?r._`(new RegExp(${l}, ${v}))`:(0,t.usePattern)(s,u);s.fail$data(r._`!${w}.test(${o})`)}};e.default=i}),rv=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=me(),r={message({keyword:i,schemaCode:s}){let o=i==="maxProperties"?"more":"fewer";return t.str`must NOT have ${o} than ${s} properties`},params:({schemaCode:i})=>t._`{limit: ${i}}`},n={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:r,code(i){let{keyword:s,data:o,schemaCode:a}=i,u=s==="maxProperties"?t.operators.GT:t.operators.LT;i.fail$data(t._`Object.keys(${o}).length ${u} ${a}`)}};e.default=n}),nv=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=fr(),r=me(),n=Te(),i={message:({params:{missingProperty:o}})=>r.str`must have required property '${o}'`,params:({params:{missingProperty:o}})=>r._`{missingProperty: ${o}}`},s={keyword:"required",type:"object",schemaType:"array",$data:!0,error:i,code(o){let{gen:a,schema:u,schemaCode:l,data:m,$data:v,it:w}=o,{opts:I}=w;if(!v&&u.length===0)return;let T=u.length>=I.loopRequired;if(w.allErrors?k():b(),I.strictRequired){let c=o.parentSchema.properties,{definedProperties:d}=o.it;for(let y of u)if(c?.[y]===void 0&&!d.has(y)){let h=w.schemaEnv.baseId+w.errSchemaPath,_=`required property "${y}" is not defined at "${h}" (strictRequired)`;(0,n.checkStrictMode)(w,_,w.opts.strictRequired)}}function k(){if(T||v)o.block$data(r.nil,f);else for(let c of u)(0,t.checkReportMissingProp)(o,c)}function b(){let c=a.let("missing");if(T||v){let d=a.let("valid",!0);o.block$data(d,()=>p(c,d)),o.ok(d)}else a.if((0,t.checkMissingProp)(o,u,c)),(0,t.reportMissingProp)(o,c),a.else()}function f(){a.forOf("prop",l,c=>{o.setParams({missingProperty:c}),a.if((0,t.noPropertyInData)(a,m,c,I.ownProperties),()=>o.error())})}function p(c,d){o.setParams({missingProperty:c}),a.forOf(c,l,()=>{a.assign(d,(0,t.propertyInData)(a,m,c,I.ownProperties)),a.if((0,r.not)(d),()=>{o.error(),a.break()})},r.nil)}}};e.default=s}),iv=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=me(),r={message({keyword:i,schemaCode:s}){let o=i==="maxItems"?"more":"fewer";return t.str`must NOT have ${o} than ${s} items`},params:({schemaCode:i})=>t._`{limit: ${i}}`},n={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:r,code(i){let{keyword:s,data:o,schemaCode:a}=i,u=s==="maxItems"?t.operators.GT:t.operators.LT;i.fail$data(t._`${o}.length ${u} ${a}`)}};e.default=n}),ua=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Wd();t.code='require("ajv/dist/runtime/equal").default',e.default=t}),sv=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Is(),r=me(),n=Te(),i=ua(),s={message:({params:{i:a,j:u}})=>r.str`must NOT have duplicate items (items ## ${u} and ${a} are identical)`,params:({params:{i:a,j:u}})=>r._`{i: ${a}, j: ${u}}`},o={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:s,code(a){let{gen:u,data:l,$data:m,schema:v,parentSchema:w,schemaCode:I,it:T}=a;if(!m&&!v)return;let k=u.let("valid"),b=w.items?(0,t.getSchemaTypes)(w.items):[];a.block$data(k,f,r._`${I} === false`),a.ok(k);function f(){let y=u.let("i",r._`${l}.length`),h=u.let("j");a.setParams({i:y,j:h}),u.assign(k,!0),u.if(r._`${y} > 1`,()=>(p()?c:d)(y,h))}function p(){return b.length>0&&!b.some(y=>y==="object"||y==="array")}function c(y,h){let _=u.name("item"),$=(0,t.checkDataTypes)(b,_,T.opts.strictNumbers,t.DataType.Wrong),E=u.const("indices",r._`{}`);u.for(r._`;${y}--;`,()=>{u.let(_,r._`${l}[${y}]`),u.if($,r._`continue`),b.length>1&&u.if(r._`typeof ${_} == "string"`,r._`${_} += "_"`),u.if(r._`typeof ${E}[${_}] == "number"`,()=>{u.assign(h,r._`${E}[${_}]`),a.error(),u.assign(k,!1).break()}).code(r._`${E}[${_}] = ${y}`)})}function d(y,h){let _=(0,n.useFunc)(u,i.default),$=u.name("outer");u.label($).for(r._`;${y}--;`,()=>u.for(r._`${h} = ${y}; ${h}--;`,()=>u.if(r._`${_}(${l}[${y}], ${l}[${h}])`,()=>{a.error(),u.assign(k,!1).break($)})))}}};e.default=o}),ov=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=me(),r=Te(),n=ua(),i={message:"must be equal to constant",params:({schemaCode:o})=>t._`{allowedValue: ${o}}`},s={keyword:"const",$data:!0,error:i,code(o){let{gen:a,data:u,$data:l,schemaCode:m,schema:v}=o;l||v&&typeof v=="object"?o.fail$data(t._`!${(0,r.useFunc)(a,n.default)}(${u}, ${m})`):o.fail(t._`${v} !== ${u}`)}};e.default=s}),av=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=me(),r=Te(),n=ua(),i={message:"must be equal to one of the allowed values",params:({schemaCode:o})=>t._`{allowedValues: ${o}}`},s={keyword:"enum",schemaType:"array",$data:!0,error:i,code(o){let{gen:a,data:u,$data:l,schema:m,schemaCode:v,it:w}=o;if(!l&&m.length===0)throw Error("enum must have non-empty array");let I=m.length>=w.opts.loopEnum,T,k=()=>T??(T=(0,r.useFunc)(a,n.default)),b;if(I||l)b=a.let("valid"),o.block$data(b,f);else{if(!Array.isArray(m))throw Error("ajv implementation error");let c=a.const("vSchema",v);b=(0,t.or)(...m.map((d,y)=>p(c,y)))}o.pass(b);function f(){a.assign(b,!1),a.forOf("v",v,c=>a.if(t._`${k()}(${u}, ${c})`,()=>a.assign(b,!0).break()))}function p(c,d){let y=m[d];return typeof y=="object"&&y!==null?t._`${k()}(${u}, ${c}[${d}])`:t._`${u} === ${y}`}}};e.default=s}),uv=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Jy(),r=Qy(),n=ev(),i=tv(),s=rv(),o=nv(),a=iv(),u=sv(),l=ov(),m=av(),v=[t.default,r.default,n.default,i.default,s.default,o.default,a.default,u.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},l.default,m.default];e.default=v}),Bd=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;var t=me(),r=Te(),n={message:({params:{len:o}})=>t.str`must NOT have more than ${o} items`,params:({params:{len:o}})=>t._`{limit: ${o}}`},i={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:n,code(o){let{parentSchema:a,it:u}=o,{items:l}=a;if(!Array.isArray(l)){(0,r.checkStrictMode)(u,'"additionalItems" is ignored when "items" is not an array of schemas');return}s(o,l)}};function s(o,a){let{gen:u,schema:l,data:m,keyword:v,it:w}=o;w.items=!0;let I=u.const("len",t._`${m}.length`);if(l===!1)o.setParams({len:a.length}),o.pass(t._`${I} <= ${a.length}`);else if(typeof l=="object"&&!(0,r.alwaysValidSchema)(w,l)){let k=u.var("valid",t._`${I} <= ${a.length}`);u.if((0,t.not)(k),()=>T(k)),o.ok(k)}function T(k){u.forRange("i",a.length,I,b=>{o.subschema({keyword:v,dataProp:b,dataPropType:r.Type.Num},k),!w.allErrors&&u.if((0,t.not)(k),()=>u.break())})}}e.validateAdditionalItems=s,e.default=i}),Hd=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;var t=me(),r=Te(),n=fr(),i={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(o){let{schema:a,it:u}=o;if(Array.isArray(a))return s(o,"additionalItems",a);u.items=!0,!(0,r.alwaysValidSchema)(u,a)&&o.ok((0,n.validateArray)(o))}};function s(o,a,u=o.schema){let{gen:l,parentSchema:m,data:v,keyword:w,it:I}=o;b(m),I.opts.unevaluated&&u.length&&I.items!==!0&&(I.items=r.mergeEvaluated.items(l,u.length,I.items));let T=l.name("valid"),k=l.const("len",t._`${v}.length`);u.forEach((f,p)=>{(0,r.alwaysValidSchema)(I,f)||(l.if(t._`${k} > ${p}`,()=>o.subschema({keyword:w,schemaProp:p,dataProp:p},T)),o.ok(T))});function b(f){let{opts:p,errSchemaPath:c}=I,d=u.length,y=d===f.minItems&&(d===f.maxItems||f[a]===!1);if(p.strictTuples&&!y){let h=`"${w}" is ${d}-tuple, but minItems or maxItems/${a} are not specified or different at path "${c}"`;(0,r.checkStrictMode)(I,h,p.strictTuples)}}}e.validateTuple=s,e.default=i}),lv=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Hd(),r={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:n=>(0,t.validateTuple)(n,"items")};e.default=r}),dv=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=me(),r=Te(),n=fr(),i=Bd(),s={message:({params:{len:a}})=>t.str`must NOT have more than ${a} items`,params:({params:{len:a}})=>t._`{limit: ${a}}`},o={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:s,code(a){let{schema:u,parentSchema:l,it:m}=a,{prefixItems:v}=l;m.items=!0,!(0,r.alwaysValidSchema)(m,u)&&(v?(0,i.validateAdditionalItems)(a,v):a.ok((0,n.validateArray)(a)))}};e.default=o}),cv=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=me(),r=Te(),n={message:({params:{min:s,max:o}})=>o===void 0?t.str`must contain at least ${s} valid item(s)`:t.str`must contain at least ${s} and no more than ${o} valid item(s)`,params:({params:{min:s,max:o}})=>o===void 0?t._`{minContains: ${s}}`:t._`{minContains: ${s}, maxContains: ${o}}`},i={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:n,code(s){let{gen:o,schema:a,parentSchema:u,data:l,it:m}=s,v,w,{minContains:I,maxContains:T}=u;m.opts.next?(v=I===void 0?1:I,w=T):v=1;let k=o.const("len",t._`${l}.length`);if(s.setParams({min:v,max:w}),w===void 0&&v===0){(0,r.checkStrictMode)(m,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(w!==void 0&&v>w){(0,r.checkStrictMode)(m,'"minContains" > "maxContains" is always invalid'),s.fail();return}if((0,r.alwaysValidSchema)(m,a)){let d=t._`${k} >= ${v}`;w!==void 0&&(d=t._`${d} && ${k} <= ${w}`),s.pass(d);return}m.items=!0;let b=o.name("valid");w===void 0&&v===1?p(b,()=>o.if(b,()=>o.break())):v===0?(o.let(b,!0),w!==void 0&&o.if(t._`${l}.length > 0`,f)):(o.let(b,!1),f()),s.result(b,()=>s.reset());function f(){let d=o.name("_valid"),y=o.let("count",0);p(d,()=>o.if(d,()=>c(y)))}function p(d,y){o.forRange("i",0,k,h=>{s.subschema({keyword:"contains",dataProp:h,dataPropType:r.Type.Num,compositeRule:!0},d),y()})}function c(d){o.code(t._`${d}++`),w===void 0?o.if(t._`${d} >= ${v}`,()=>o.assign(b,!0).break()):(o.if(t._`${d} > ${w}`,()=>o.assign(b,!1).break()),v===1?o.assign(b,!0):o.if(t._`${d} >= ${v}`,()=>o.assign(b,!0)))}}};e.default=i}),fv=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;var t=me(),r=Te(),n=fr();e.error={message:({params:{property:u,depsCount:l,deps:m}})=>{let v=l===1?"property":"properties";return t.str`must have ${v} ${m} when property ${u} is present`},params:({params:{property:u,depsCount:l,deps:m,missingProperty:v}})=>t._`{property: ${u},
50
+ missingProperty: ${v},
51
+ depsCount: ${l},
52
+ deps: ${m}}`};var i={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(u){let[l,m]=s(u);o(u,l),a(u,m)}};function s({schema:u}){let l={},m={};for(let v in u){if(v==="__proto__")continue;let w=Array.isArray(u[v])?l:m;w[v]=u[v]}return[l,m]}function o(u,l=u.schema){let{gen:m,data:v,it:w}=u;if(Object.keys(l).length===0)return;let I=m.let("missing");for(let T in l){let k=l[T];if(k.length===0)continue;let b=(0,n.propertyInData)(m,v,T,w.opts.ownProperties);u.setParams({property:T,depsCount:k.length,deps:k.join(", ")}),w.allErrors?m.if(b,()=>{for(let f of k)(0,n.checkReportMissingProp)(u,f)}):(m.if(t._`${b} && (${(0,n.checkMissingProp)(u,k,I)})`),(0,n.reportMissingProp)(u,I),m.else())}}e.validatePropertyDeps=o;function a(u,l=u.schema){let{gen:m,data:v,keyword:w,it:I}=u,T=m.name("valid");for(let k in l)(0,r.alwaysValidSchema)(I,l[k])||(m.if((0,n.propertyInData)(m,v,k,I.opts.ownProperties),()=>{let b=u.subschema({keyword:w,schemaProp:k},T);u.mergeValidEvaluated(b,T)},()=>m.var(T,!0)),u.ok(T))}e.validateSchemaDeps=a,e.default=i}),pv=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=me(),r=Te(),n={message:"property name must be valid",params:({params:s})=>t._`{propertyName: ${s.propertyName}}`},i={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:n,code(s){let{gen:o,schema:a,data:u,it:l}=s;if((0,r.alwaysValidSchema)(l,a))return;let m=o.name("valid");o.forIn("key",u,v=>{s.setParams({propertyName:v}),s.subschema({keyword:"propertyNames",data:v,dataTypes:["string"],propertyName:v,compositeRule:!0},m),o.if((0,t.not)(m),()=>{s.error(!0),!l.allErrors&&o.break()})}),s.ok(m)}};e.default=i}),Gd=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=fr(),r=me(),n=Hr(),i=Te(),s={message:"must NOT have additional properties",params:({params:a})=>r._`{additionalProperty: ${a.additionalProperty}}`},o={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:s,code(a){let{gen:u,schema:l,parentSchema:m,data:v,errsCount:w,it:I}=a;if(!w)throw Error("ajv implementation error");let{allErrors:T,opts:k}=I;if(I.props=!0,k.removeAdditional!=="all"&&(0,i.alwaysValidSchema)(I,l))return;let b=(0,t.allSchemaProperties)(m.properties),f=(0,t.allSchemaProperties)(m.patternProperties);p(),a.ok(r._`${w} === ${n.default.errors}`);function p(){u.forIn("key",v,_=>{!b.length&&!f.length?y(_):u.if(c(_),()=>y(_))})}function c(_){let $;if(b.length>8){let E=(0,i.schemaRefOrVal)(I,m.properties,"properties");$=(0,t.isOwnProperty)(u,E,_)}else b.length?$=(0,r.or)(...b.map(E=>r._`${_} === ${E}`)):$=r.nil;return f.length&&($=(0,r.or)($,...f.map(E=>r._`${(0,t.usePattern)(a,E)}.test(${_})`))),(0,r.not)($)}function d(_){u.code(r._`delete ${v}[${_}]`)}function y(_){if(k.removeAdditional==="all"||k.removeAdditional&&l===!1){d(_);return}if(l===!1){a.setParams({additionalProperty:_}),a.error(),!T&&u.break();return}if(typeof l=="object"&&!(0,i.alwaysValidSchema)(I,l)){let $=u.name("valid");k.removeAdditional==="failing"?(h(_,$,!1),u.if((0,r.not)($),()=>{a.reset(),d(_)})):(h(_,$),!T&&u.if((0,r.not)($),()=>u.break()))}}function h(_,$,E){let q={keyword:"additionalProperties",dataProp:_,dataPropType:i.Type.Str};E===!1&&Object.assign(q,{compositeRule:!0,createErrors:!1,allErrors:!1}),a.subschema(q,$)}}};e.default=o}),mv=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Es(),r=fr(),n=Te(),i=Gd(),s={keyword:"properties",type:"object",schemaType:"object",code(o){let{gen:a,schema:u,parentSchema:l,data:m,it:v}=o;v.opts.removeAdditional==="all"&&l.additionalProperties===void 0&&i.default.code(new t.KeywordCxt(v,i.default,"additionalProperties"));let w=(0,r.allSchemaProperties)(u);for(let f of w)v.definedProperties.add(f);v.opts.unevaluated&&w.length&&v.props!==!0&&(v.props=n.mergeEvaluated.props(a,(0,n.toHash)(w),v.props));let I=w.filter(f=>!(0,n.alwaysValidSchema)(v,u[f]));if(I.length===0)return;let T=a.name("valid");for(let f of I)k(f)?b(f):(a.if((0,r.propertyInData)(a,m,f,v.opts.ownProperties)),b(f),!v.allErrors&&a.else().var(T,!0),a.endIf()),o.it.definedProperties.add(f),o.ok(T);function k(f){return v.opts.useDefaults&&!v.compositeRule&&u[f].default!==void 0}function b(f){o.subschema({keyword:"properties",schemaProp:f,dataProp:f},T)}}};e.default=s}),hv=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=fr(),r=me(),n=Te(),i=Te(),s={keyword:"patternProperties",type:"object",schemaType:"object",code(o){let{gen:a,schema:u,data:l,parentSchema:m,it:v}=o,{opts:w}=v,I=(0,t.allSchemaProperties)(u),T=I.filter(y=>(0,n.alwaysValidSchema)(v,u[y]));if(I.length===0||T.length===I.length&&(!v.opts.unevaluated||v.props===!0))return;let k=w.strictSchema&&!w.allowMatchingProperties&&m.properties,b=a.name("valid");v.props!==!0&&!(v.props instanceof r.Name)&&(v.props=(0,i.evaluatedPropsToName)(a,v.props));let{props:f}=v;p();function p(){for(let y of I)k&&c(y),v.allErrors?d(y):(a.var(b,!0),d(y),a.if(b))}function c(y){for(let h in k)new RegExp(y).test(h)&&(0,n.checkStrictMode)(v,`property ${h} matches pattern ${y} (use allowMatchingProperties)`)}function d(y){a.forIn("key",l,h=>{a.if(r._`${(0,t.usePattern)(o,y)}.test(${h})`,()=>{let _=T.includes(y);_||o.subschema({keyword:"patternProperties",schemaProp:y,dataProp:h,dataPropType:i.Type.Str},b),v.opts.unevaluated&&f!==!0?a.assign(r._`${f}[${h}]`,!0):!_&&!v.allErrors&&a.if((0,r.not)(b),()=>a.break())})})}}};e.default=s}),gv=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Te(),r={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(n){let{gen:i,schema:s,it:o}=n;if((0,t.alwaysValidSchema)(o,s)){n.fail();return}let a=i.name("valid");n.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},a),n.failResult(a,()=>n.reset(),()=>n.error())},error:{message:"must NOT be valid"}};e.default=r}),yv=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=fr(),r={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:t.validateUnion,error:{message:"must match a schema in anyOf"}};e.default=r}),vv=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=me(),r=Te(),n={message:"must match exactly one schema in oneOf",params:({params:s})=>t._`{passingSchemas: ${s.passing}}`},i={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:n,code(s){let{gen:o,schema:a,parentSchema:u,it:l}=s;if(!Array.isArray(a))throw Error("ajv implementation error");if(l.opts.discriminator&&u.discriminator)return;let m=a,v=o.let("valid",!1),w=o.let("passing",null),I=o.name("_valid");s.setParams({passing:w}),o.block(T),s.result(v,()=>s.reset(),()=>s.error(!0));function T(){m.forEach((k,b)=>{let f;(0,r.alwaysValidSchema)(l,k)?o.var(I,!0):f=s.subschema({keyword:"oneOf",schemaProp:b,compositeRule:!0},I),b>0&&o.if(t._`${I} && ${v}`).assign(v,!1).assign(w,t._`[${w}, ${b}]`).else(),o.if(I,()=>{o.assign(v,!0),o.assign(w,b),f&&s.mergeEvaluated(f,t.Name)})})}}};e.default=i}),_v=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Te(),r={keyword:"allOf",schemaType:"array",code(n){let{gen:i,schema:s,it:o}=n;if(!Array.isArray(s))throw Error("ajv implementation error");let a=i.name("valid");s.forEach((u,l)=>{if((0,t.alwaysValidSchema)(o,u))return;let m=n.subschema({keyword:"allOf",schemaProp:l},a);n.ok(a),n.mergeEvaluated(m)})}};e.default=r}),bv=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=me(),r=Te(),n={message:({params:o})=>t.str`must match "${o.ifClause}" schema`,params:({params:o})=>t._`{failingKeyword: ${o.ifClause}}`},i={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:n,code(o){let{gen:a,parentSchema:u,it:l}=o;u.then===void 0&&u.else===void 0&&(0,r.checkStrictMode)(l,'"if" without "then" and "else" is ignored');let m=s(l,"then"),v=s(l,"else");if(!m&&!v)return;let w=a.let("valid",!0),I=a.name("_valid");if(T(),o.reset(),m&&v){let b=a.let("ifClause");o.setParams({ifClause:b}),a.if(I,k("then",b),k("else",b))}else m?a.if(I,k("then")):a.if((0,t.not)(I),k("else"));o.pass(w,()=>o.error(!0));function T(){let b=o.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},I);o.mergeEvaluated(b)}function k(b,f){return()=>{let p=o.subschema({keyword:b},I);a.assign(w,I),o.mergeValidEvaluated(p,w),f?a.assign(f,t._`${b}`):o.setParams({ifClause:b})}}}};function s(o,a){let u=o.schema[a];return u!==void 0&&!(0,r.alwaysValidSchema)(o,u)}e.default=i}),wv=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Te(),r={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:n,parentSchema:i,it:s}){i.if===void 0&&(0,t.checkStrictMode)(s,`"${n}" without "if" is ignored`)}};e.default=r}),Iv=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Bd(),r=lv(),n=Hd(),i=dv(),s=cv(),o=fv(),a=pv(),u=Gd(),l=mv(),m=hv(),v=gv(),w=yv(),I=vv(),T=_v(),k=bv(),b=wv();function f(p=!1){let c=[v.default,w.default,I.default,T.default,k.default,b.default,a.default,u.default,o.default,l.default,m.default];return p?c.push(r.default,i.default):c.push(t.default,n.default),c.push(s.default),c}e.default=f}),$v=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=me(),r={message:({schemaCode:i})=>t.str`must match format "${i}"`,params:({schemaCode:i})=>t._`{format: ${i}}`},n={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:r,code(i,s){let{gen:o,data:a,$data:u,schema:l,schemaCode:m,it:v}=i,{opts:w,errSchemaPath:I,schemaEnv:T,self:k}=v;if(!w.validateFormats)return;u?b():f();function b(){let p=o.scopeValue("formats",{ref:k.formats,code:w.code.formats}),c=o.const("fDef",t._`${p}[${m}]`),d=o.let("fType"),y=o.let("format");o.if(t._`typeof ${c} == "object" && !(${c} instanceof RegExp)`,()=>o.assign(d,t._`${c}.type || "string"`).assign(y,t._`${c}.validate`),()=>o.assign(d,t._`"string"`).assign(y,c)),i.fail$data((0,t.or)(h(),_()));function h(){return w.strictSchema===!1?t.nil:t._`${m} && !${y}`}function _(){let $=T.$async?t._`(${c}.async ? await ${y}(${a}) : ${y}(${a}))`:t._`${y}(${a})`,E=t._`(typeof ${y} == "function" ? ${$} : ${y}.test(${a}))`;return t._`${y} && ${y} !== true && ${d} === ${s} && !${E}`}}function f(){let p=k.formats[l];if(!p){h();return}if(p===!0)return;let[c,d,y]=_(p);c===s&&i.pass($());function h(){if(w.strictSchema===!1){k.logger.warn(E());return}throw Error(E());function E(){return`unknown format "${l}" ignored in schema at path "${I}"`}}function _(E){let q=E instanceof RegExp?(0,t.regexpCode)(E):w.code.formats?t._`${w.code.formats}${(0,t.getProperty)(l)}`:void 0,z=o.scopeValue("formats",{key:l,ref:E,code:q});return typeof E=="object"&&!(E instanceof RegExp)?[E.type||"string",E.validate,t._`${z}.validate`]:["string",E,z]}function $(){if(typeof p=="object"&&!(p instanceof RegExp)&&p.async){if(!T.$async)throw Error("async format in sync schema");return t._`await ${y}(${a})`}return typeof d=="function"?t._`${y}(${a})`:t._`${y}.test(${a})`}}}};e.default=n}),xv=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=$v(),r=[t.default];e.default=r}),Sv=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),kv=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Yy(),r=uv(),n=Iv(),i=xv(),s=Sv(),o=[t.default,r.default,(0,n.default)(),i.default,s.metadataVocabulary,s.contentVocabulary];e.default=o}),Tv=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(r){r.Tag="tag",r.Mapping="mapping"})(t||(e.DiscrError=t={}))}),Pv=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=me(),r=Tv(),n=aa(),i=Rs(),s=Te(),o={message:({params:{discrError:u,tagName:l}})=>u===r.DiscrError.Tag?`tag "${l}" must be string`:`value of tag "${l}" must be in oneOf`,params:({params:{discrError:u,tag:l,tagName:m}})=>t._`{error: ${u}, tag: ${m}, tagValue: ${l}}`},a={keyword:"discriminator",type:"object",schemaType:"object",error:o,code(u){let{gen:l,data:m,schema:v,parentSchema:w,it:I}=u,{oneOf:T}=w;if(!I.opts.discriminator)throw Error("discriminator: requires discriminator option");let k=v.propertyName;if(typeof k!="string")throw Error("discriminator: requires propertyName");if(v.mapping)throw Error("discriminator: mapping is not supported");if(!T)throw Error("discriminator: requires oneOf keyword");let b=l.let("valid",!1),f=l.const("tag",t._`${m}${(0,t.getProperty)(k)}`);l.if(t._`typeof ${f} == "string"`,()=>p(),()=>u.error(!1,{discrError:r.DiscrError.Tag,tag:f,tagName:k})),u.ok(b);function p(){let y=d();l.if(!1);for(let h in y)l.elseIf(t._`${f} === ${h}`),l.assign(b,c(y[h]));l.else(),u.error(!1,{discrError:r.DiscrError.Mapping,tag:f,tagName:k}),l.endIf()}function c(y){let h=l.name("valid"),_=u.subschema({keyword:"oneOf",schemaProp:y},h);return u.mergeEvaluated(_,t.Name),h}function d(){var y;let h={},_=E(w),$=!0;for(let L=0;L<T.length;L++){let W=T[L];if(W?.$ref&&!(0,s.schemaHasRulesButRef)(W,I.self.RULES)){let G=W.$ref;if(W=n.resolveRef.call(I.self,I.schemaEnv.root,I.baseId,G),W instanceof n.SchemaEnv&&(W=W.schema),W===void 0)throw new i.default(I.opts.uriResolver,I.baseId,G)}let X=(y=W?.properties)===null||y===void 0?void 0:y[k];if(typeof X!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${k}"`);$=$&&(_||E(W)),q(X,L)}if(!$)throw Error(`discriminator: "${k}" must be required`);return h;function E({required:L}){return Array.isArray(L)&&L.includes(k)}function q(L,W){if(L.const)z(L.const,W);else if(L.enum)for(let X of L.enum)z(X,W);else throw Error(`discriminator: "properties/${k}" must have "const" or "enum"`)}function z(L,W){if(typeof L!="string"||L in h)throw Error(`discriminator: "${k}" values must be unique strings`);h[L]=W}}}};e.default=a}),Ov=Q((e,t)=>{t.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}),Yd=Q((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;var r=By(),n=kv(),i=Pv(),s=Ov(),o=["/properties"],a="http://json-schema.org/draft-07/schema";class u extends r.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(T=>this.addVocabulary(T)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let T=this.opts.$data?this.$dataMetaSchema(s,o):s;this.addMetaSchema(T,a,!1),this.refs["http://json-schema.org/schema"]=a}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(a)?a:void 0)}}e.Ajv=u,t.exports=e=u,t.exports.Ajv=u,Object.defineProperty(e,"__esModule",{value:!0}),e.default=u;var l=Es();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var m=me();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return m._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return m.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return m.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return m.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return m.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return m.CodeGen}});var v=oa();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return v.default}});var w=Rs();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return w.default}})}),Cv=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(z,L){return{validate:z,compare:L}}e.fullFormats={date:t(s,o),time:t(u(!0),l),"date-time":t(w(!0),I),"iso-time":t(u(),m),"iso-date-time":t(w(),T),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:f,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:q,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:c,int32:{type:"number",validate:h},int64:{type:"number",validate:_},float:{type:"number",validate:$},double:{type:"number",validate:$},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,I),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,m),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,T),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function r(z){return z%4===0&&(z%100!==0||z%400===0)}var n=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function s(z){let L=n.exec(z);if(!L)return!1;let W=+L[1],X=+L[2],G=+L[3];return X>=1&&X<=12&&G>=1&&G<=(X===2&&r(W)?29:i[X])}function o(z,L){if(z&&L)return z>L?1:z<L?-1:0}var a=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function u(z){return function(L){let W=a.exec(L);if(!W)return!1;let X=+W[1],G=+W[2],Je=+W[3],rt=W[4],lt=W[5]==="-"?-1:1,ye=+(W[6]||0),Z=+(W[7]||0);if(ye>23||Z>59||z&&!rt)return!1;if(X<=23&&G<=59&&Je<60)return!0;let P=G-Z*lt,U=X-ye*lt-(P<0?1:0);return(U===23||U===-1)&&(P===59||P===-1)&&Je<61}}function l(z,L){if(!(z&&L))return;let W=new Date("2020-01-01T"+z).valueOf(),X=new Date("2020-01-01T"+L).valueOf();if(W&&X)return W-X}function m(z,L){if(!(z&&L))return;let W=a.exec(z),X=a.exec(L);if(W&&X)return z=W[1]+W[2]+W[3],L=X[1]+X[2]+X[3],z>L?1:z<L?-1:0}var v=/t|\s/i;function w(z){let L=u(z);return function(W){let X=W.split(v);return X.length===2&&s(X[0])&&L(X[1])}}function I(z,L){if(!(z&&L))return;let W=new Date(z).valueOf(),X=new Date(L).valueOf();if(W&&X)return W-X}function T(z,L){if(!(z&&L))return;let[W,X]=z.split(v),[G,Je]=L.split(v),rt=o(W,G);if(rt!==void 0)return rt||l(X,Je)}var k=/\/|:/,b=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function f(z){return k.test(z)&&b.test(z)}var p=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function c(z){return p.lastIndex=0,p.test(z)}var d=-2147483648,y=2147483647;function h(z){return Number.isInteger(z)&&z<=y&&z>=d}function _(z){return Number.isInteger(z)}function $(){return!0}var E=/[^\\]\\Z/;function q(z){if(E.test(z))return!1;try{return new RegExp(z),!0}catch{return!1}}}),Ev=Q(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;var t=Yd(),r=me(),n=r.operators,i={formatMaximum:{okStr:"<=",ok:n.LTE,fail:n.GT},formatMinimum:{okStr:">=",ok:n.GTE,fail:n.LT},formatExclusiveMaximum:{okStr:"<",ok:n.LT,fail:n.GTE},formatExclusiveMinimum:{okStr:">",ok:n.GT,fail:n.LTE}},s={message:({keyword:a,schemaCode:u})=>r.str`should be ${i[a].okStr} ${u}`,params:({keyword:a,schemaCode:u})=>r._`{comparison: ${i[a].okStr}, limit: ${u}}`};e.formatLimitDefinition={keyword:Object.keys(i),type:"string",schemaType:"string",$data:!0,error:s,code(a){let{gen:u,data:l,schemaCode:m,keyword:v,it:w}=a,{opts:I,self:T}=w;if(!I.validateFormats)return;let k=new t.KeywordCxt(w,T.RULES.all.format.definition,"format");k.$data?b():f();function b(){let c=u.scopeValue("formats",{ref:T.formats,code:I.code.formats}),d=u.const("fmt",r._`${c}[${k.schemaCode}]`);a.fail$data((0,r.or)(r._`typeof ${d} != "object"`,r._`${d} instanceof RegExp`,r._`typeof ${d}.compare != "function"`,p(d)))}function f(){let c=k.schema,d=T.formats[c];if(!d||d===!0)return;if(typeof d!="object"||d instanceof RegExp||typeof d.compare!="function")throw Error(`"${v}": format "${c}" does not define "compare" function`);let y=u.scopeValue("formats",{key:c,ref:d,code:I.code.formats?r._`${I.code.formats}${(0,r.getProperty)(c)}`:void 0});a.fail$data(p(y))}function p(c){return r._`${c}.compare(${l}, ${m}) ${i[v].fail} 0`}},dependencies:["format"]};var o=a=>(a.addKeyword(e.formatLimitDefinition),a);e.default=o}),Rv=Q((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});var r=Cv(),n=Ev(),i=me(),s=new i.Name("fullFormats"),o=new i.Name("fastFormats"),a=(l,m={keywords:!0})=>{if(Array.isArray(m))return u(l,m,r.fullFormats,s),l;let[v,w]=m.mode==="fast"?[r.fastFormats,o]:[r.fullFormats,s],I=m.formats||r.formatNames;return u(l,I,v,w),m.keywords&&(0,n.default)(l),l};a.get=(l,m="full")=>{let v=(m==="fast"?r.fastFormats:r.fullFormats)[l];if(!v)throw Error(`Unknown format "${l}"`);return v};function u(l,m,v,w){var I,T;(I=(T=l.opts.code).formats)!==null&&I!==void 0||(T.formats=i._`require("ajv-formats/dist/formats").${w}`);for(let k of m)l.addFormat(k,v[k])}t.exports=e=a,Object.defineProperty(e,"__esModule",{value:!0}),e.default=a}),Nv=50;function Xd(e=Nv){let t=new AbortController;return(0,Qd.setMaxListeners)(e,t.signal),t}var jv=typeof global=="object"&&global&&global.Object===Object&&global,Av=jv,Mv=typeof self=="object"&&self&&self.Object===Object&&self,Fv=Av||Mv||Function("return this")(),la=Fv,zv=la.Symbol,$s=zv,rc=Object.prototype,Uv=rc.hasOwnProperty,Dv=rc.toString,$i=$s?$s.toStringTag:void 0;function qv(e){var t=Uv.call(e,$i),r=e[$i];try{e[$i]=void 0;var n=!0}catch{}var i=Dv.call(e);return n&&(t?e[$i]=r:delete e[$i]),i}var Lv=qv,Kv=Object.prototype,Vv=Kv.toString;function Zv(e){return Vv.call(e)}var Wv=Zv,Bv="[object Null]",Hv="[object Undefined]",pd=$s?$s.toStringTag:void 0;function Gv(e){return e==null?e===void 0?Hv:Bv:pd&&pd in Object(e)?Lv(e):Wv(e)}var Yv=Gv;function Jv(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var nc=Jv,Qv="[object AsyncFunction]",Xv="[object Function]",e0="[object GeneratorFunction]",t0="[object Proxy]";function r0(e){if(!nc(e))return!1;var t=Yv(e);return t==Xv||t==e0||t==Qv||t==t0}var n0=r0,i0=la["__core-js_shared__"],jo=i0,md=(function(){var e=/[^.]+$/.exec(jo&&jo.keys&&jo.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function s0(e){return!!md&&md in e}var o0=s0,a0=Function.prototype,u0=a0.toString;function l0(e){if(e!=null){try{return u0.call(e)}catch{}try{return e+""}catch{}}return""}var d0=l0,c0=/[\\^$.*+?()[\]{}|]/g,f0=/^\[object .+?Constructor\]$/,p0=Function.prototype,m0=Object.prototype,h0=p0.toString,g0=m0.hasOwnProperty,y0=RegExp("^"+h0.call(g0).replace(c0,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function v0(e){if(!nc(e)||o0(e))return!1;var t=n0(e)?y0:f0;return t.test(d0(e))}var _0=v0;function b0(e,t){return e?.[t]}var w0=b0;function I0(e,t){var r=w0(e,t);return _0(r)?r:void 0}var ic=I0,$0=ic(Object,"create"),ki=$0;function x0(){this.__data__=ki?ki(null):{},this.size=0}var S0=x0;function k0(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var T0=k0,P0="__lodash_hash_undefined__",O0=Object.prototype,C0=O0.hasOwnProperty;function E0(e){var t=this.__data__;if(ki){var r=t[e];return r===P0?void 0:r}return C0.call(t,e)?t[e]:void 0}var R0=E0,N0=Object.prototype,j0=N0.hasOwnProperty;function A0(e){var t=this.__data__;return ki?t[e]!==void 0:j0.call(t,e)}var M0=A0,F0="__lodash_hash_undefined__";function z0(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ki&&t===void 0?F0:t,this}var U0=z0;function Yn(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Yn.prototype.clear=S0;Yn.prototype.delete=T0;Yn.prototype.get=R0;Yn.prototype.has=M0;Yn.prototype.set=U0;var hd=Yn;function D0(){this.__data__=[],this.size=0}var q0=D0;function L0(e,t){return e===t||e!==e&&t!==t}var K0=L0;function V0(e,t){for(var r=e.length;r--;)if(K0(e[r][0],t))return r;return-1}var Ns=V0,Z0=Array.prototype,W0=Z0.splice;function B0(e){var t=this.__data__,r=Ns(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():W0.call(t,r,1),--this.size,!0}var H0=B0;function G0(e){var t=this.__data__,r=Ns(t,e);return r<0?void 0:t[r][1]}var Y0=G0;function J0(e){return Ns(this.__data__,e)>-1}var Q0=J0;function X0(e,t){var r=this.__data__,n=Ns(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var e_=X0;function Jn(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Jn.prototype.clear=q0;Jn.prototype.delete=H0;Jn.prototype.get=Y0;Jn.prototype.has=Q0;Jn.prototype.set=e_;var t_=Jn,r_=ic(la,"Map"),n_=r_;function i_(){this.size=0,this.__data__={hash:new hd,map:new(n_||t_),string:new hd}}var s_=i_;function o_(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var a_=o_;function u_(e,t){var r=e.__data__;return a_(t)?r[typeof t=="string"?"string":"hash"]:r.map}var js=u_;function l_(e){var t=js(this,e).delete(e);return this.size-=t?1:0,t}var d_=l_;function c_(e){return js(this,e).get(e)}var f_=c_;function p_(e){return js(this,e).has(e)}var m_=p_;function h_(e,t){var r=js(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var g_=h_;function Qn(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Qn.prototype.clear=s_;Qn.prototype.delete=d_;Qn.prototype.get=f_;Qn.prototype.has=m_;Qn.prototype.set=g_;var sc=Qn,y_="Expected a function";function da(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw TypeError(y_);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=e.apply(this,n);return r.cache=s.set(i,o)||s,o};return r.cache=new(da.Cache||sc),r}da.Cache=sc;var Xn=da;function v_(e,t){e.destroyed||e.write(t)}function __(e){v_(process.stderr,e)}var b_=Xn(e=>{if(!e||e.trim()==="")return null;let t=e.split(",").map(s=>s.trim()).filter(Boolean);if(t.length===0)return null;let r=t.some(s=>s.startsWith("!")),n=t.some(s=>!s.startsWith("!"));if(r&&n)return null;let i=t.map(s=>s.replace(/^!/,"").toLowerCase());return{include:r?[]:i,exclude:r?i:[],isExclusive:r}});function w_(e){let t=[],r=e.match(/^MCP server ["']([^"']+)["']/);if(r&&r[1])t.push("mcp"),t.push(r[1].toLowerCase());else{let s=e.match(/^([^:[]+):/);s&&s[1]&&t.push(s[1].trim().toLowerCase())}let n=e.match(/^\[([^\]]+)]/);n&&n[1]&&t.push(n[1].trim().toLowerCase()),e.toLowerCase().includes("1p event:")&&t.push("1p");let i=e.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(i&&i[1]){let s=i[1].trim().toLowerCase();s.length<30&&!s.includes(" ")&&t.push(s)}return Array.from(new Set(t))}function I_(e,t){return t?e.length===0?!1:t.isExclusive?!e.some(r=>t.exclude.includes(r)):e.some(r=>t.include.includes(r)):!0}function $_(e,t){if(!t)return!0;let r=w_(e);return I_(r,t)}function uc(){return process.env.CLAUDE_CONFIG_DIR??(0,oc.join)((0,ac.homedir)(),".claude")}function gd(e){if(!e)return!1;if(typeof e=="boolean")return e;let t=e.toLowerCase().trim();return["1","true","yes","on"].includes(t)}function cc(e){return{name:e,default:3e4,validate:t=>{if(!t)return{effective:3e4,status:"valid"};let r=parseInt(t,10);return isNaN(r)||r<=0?{effective:3e4,status:"invalid",message:`Invalid value "${t}" (using default: 30000)`}:r>15e4?{effective:15e4,status:"capped",message:`Capped from ${r} to 150000`}:{effective:r,status:"valid"}}}}var x_=cc("BASH_MAX_OUTPUT_LENGTH"),OM=cc("TASK_MAX_OUTPUT_LENGTH"),S_={name:"CLAUDE_CODE_MAX_OUTPUT_TOKENS",default:32e3,validate:e=>{if(!e)return{effective:32e3,status:"valid"};let t=parseInt(e,10);return isNaN(t)||t<=0?{effective:32e3,status:"invalid",message:`Invalid value "${e}" (using default: 32000)`}:t>64e3?{effective:64e3,status:"capped",message:`Capped from ${t} to 64000`}:{effective:t,status:"valid"}}};function k_(){let e="";return typeof process<"u"&&typeof process.cwd=="function"&&typeof Do.realpathSync=="function"&&(e=(0,Do.realpathSync)((0,lc.cwd)())),{originalCwd:e,projectRoot:e,totalCostUSD:0,totalAPIDuration:0,totalAPIDurationWithoutRetries:0,totalToolDuration:0,startTime:Date.now(),lastInteractionTime:Date.now(),totalLinesAdded:0,totalLinesRemoved:0,hasUnknownModelCost:!1,cwd:e,modelUsage:{},mainLoopModelOverride:void 0,initialMainLoopModel:null,modelStrings:null,isInteractive:!1,clientType:"cli",sessionIngressToken:void 0,oauthTokenFromFd:void 0,apiKeyFromFd:void 0,flagSettingsPath:void 0,allowedSettingSources:["userSettings","projectSettings","localSettings","flagSettings","policySettings"],meter:null,sessionCounter:null,locCounter:null,prCounter:null,commitCounter:null,costCounter:null,tokenCounter:null,codeEditToolDecisionCounter:null,activeTimeCounter:null,sessionId:(0,dc.randomUUID)(),parentSessionId:void 0,loggerProvider:null,eventLogger:null,meterProvider:null,tracerProvider:null,agentColorMap:new Map,agentColorIndex:0,envVarValidators:[x_,S_],lastAPIRequest:null,inMemoryErrorLog:[],inlinePlugins:[],useCoworkPlugins:!1,sessionBypassPermissionsMode:!1,sessionTrustAccepted:!1,sessionPersistenceDisabled:!1,hasExitedPlanMode:!1,needsPlanModeExitAttachment:!1,hasExitedDelegateMode:!1,needsDelegateModeExitAttachment:!1,lspRecommendationShownThisSession:!1,initJsonSchema:null,registeredHooks:null,planSlugCache:new Map,teleportedSessionInfo:null,invokedSkills:new Map,slowOperations:[],promptCacheBreaks:[],sdkBetas:void 0,mainThreadAgentType:void 0,isRemoteMode:!1,directConnectServerUrl:void 0,systemPromptSectionCache:new Map,additionalDirectoriesForClaudeMd:[],resumedTranscriptPath:null}}var T_=k_();function P_(){return T_.sessionId}function O_({writeFn:e,flushIntervalMs:t=1e3,maxBufferSize:r=100,immediateMode:n=!1}){let i=[],s=null;function o(){s&&(clearTimeout(s),s=null)}function a(){i.length!==0&&(e(i.join("")),i=[],o())}function u(){s||(s=setTimeout(a,t))}return{write(l){if(n){e(l);return}i.push(l),u(),i.length>=r&&a()},flush:a,dispose(){a()}}}var yd=new Set;function C_(e){return yd.add(e),()=>yd.delete(e)}var fc=1/0;function E_(e){return e===null?"null":e===void 0?"undefined":Array.isArray(e)?`Array[${e.length}]`:typeof e=="object"?`Object{${Object.keys(e).length} keys}`:typeof e=="string"?`string(${e.length} chars)`:typeof e}function pc(e,t){let r=performance.now();try{return t()}finally{performance.now()-r>fc}}function gr(e,t,r){let n=E_(e);return pc(`JSON.stringify(${n})`,()=>JSON.stringify(e,t,r))}var mc=(e,t)=>{let r=typeof e=="string"?e.length:0;return pc(`JSON.parse(${r} chars)`,()=>JSON.parse(e,t))},R_=Xn(()=>gd(process.env.DEBUG)||gd(process.env.DEBUG_SDK)||process.argv.includes("--debug")||process.argv.includes("-d")||hc()||process.argv.some(e=>e.startsWith("--debug="))||gc()!==null),N_=Xn(()=>{let e=process.argv.find(r=>r.startsWith("--debug="));if(!e)return null;let t=e.substring(8);return b_(t)}),hc=Xn(()=>process.argv.includes("--debug-to-stderr")||process.argv.includes("-d2e")),gc=Xn(()=>{for(let e=0;e<process.argv.length;e++){let t=process.argv[e];if(t.startsWith("--debug-file="))return t.substring(13);if(t==="--debug-file"&&e+1<process.argv.length)return process.argv[e+1]}return null});function j_(e){if(typeof process>"u"||typeof process.versions>"u"||typeof process.versions.node>"u")return!1;let t=N_();return $_(e,t)}var A_=!1,gs=null;function M_(){return gs||(gs=O_({writeFn:e=>{let t=yc();Tr().existsSync((0,un.dirname)(t))||Tr().mkdirSync((0,un.dirname)(t)),Tr().appendFileSync(t,e),F_()},flushIntervalMs:1e3,maxBufferSize:100,immediateMode:R_()}),C_(async()=>gs?.dispose())),gs}function on(e,{level:t}={level:"debug"}){if(!j_(e))return;A_&&e.includes(`
53
+ `)&&(e=gr(e));let r=`${new Date().toISOString()} [${t.toUpperCase()}] ${e.trim()}
54
+ `;if(hc()){__(r);return}M_().write(r)}function yc(){return gc()??process.env.CLAUDE_CODE_DEBUG_LOGS_DIR??(0,un.join)(uc(),"debug",`${P_()}.txt`)}var F_=Xn(()=>{if(process.argv[2]!=="--ripgrep")try{let e=yc(),t=(0,un.dirname)(e),r=(0,un.join)(t,"latest");if(Tr().existsSync(t)||Tr().mkdirSync(t),Tr().existsSync(r))try{Tr().unlinkSync(r)}catch{}Tr().symlinkSync(e,r)}catch{}});function ot(e,t){let r=performance.now();try{return t()}finally{performance.now()-r>fc}}var z_={cwd(){return process.cwd()},existsSync(e){return ot(`existsSync(${e})`,()=>ce.existsSync(e))},async stat(e){return(0,_r.stat)(e)},async readdir(e){return(0,_r.readdir)(e,{withFileTypes:!0})},async unlink(e){return(0,_r.unlink)(e)},async rmdir(e){return(0,_r.rmdir)(e)},async rm(e,t){return(0,_r.rm)(e,t)},statSync(e){return ot(`statSync(${e})`,()=>ce.statSync(e))},lstatSync(e){return ot(`lstatSync(${e})`,()=>ce.lstatSync(e))},readFileSync(e,t){return ot(`readFileSync(${e})`,()=>ce.readFileSync(e,{encoding:t.encoding}))},readFileBytesSync(e){return ot(`readFileBytesSync(${e})`,()=>ce.readFileSync(e))},readSync(e,t){return ot(`readSync(${e}, ${t.length} bytes)`,()=>{let r;try{r=ce.openSync(e,"r");let n=Buffer.alloc(t.length),i=ce.readSync(r,n,0,t.length,0);return{buffer:n,bytesRead:i}}finally{r&&ce.closeSync(r)}})},appendFileSync(e,t,r){return ot(`appendFileSync(${e}, ${t.length} chars)`,()=>{if(!ce.existsSync(e)&&r?.mode!==void 0){let n=ce.openSync(e,"a",r.mode);try{ce.appendFileSync(n,t)}finally{ce.closeSync(n)}}else ce.appendFileSync(e,t)})},copyFileSync(e,t){return ot(`copyFileSync(${e} \u2192 ${t})`,()=>ce.copyFileSync(e,t))},unlinkSync(e){return ot(`unlinkSync(${e})`,()=>ce.unlinkSync(e))},renameSync(e,t){return ot(`renameSync(${e} \u2192 ${t})`,()=>ce.renameSync(e,t))},linkSync(e,t){return ot(`linkSync(${e} \u2192 ${t})`,()=>ce.linkSync(e,t))},symlinkSync(e,t){return ot(`symlinkSync(${e} \u2192 ${t})`,()=>ce.symlinkSync(e,t))},readlinkSync(e){return ot(`readlinkSync(${e})`,()=>ce.readlinkSync(e))},realpathSync(e){return ot(`realpathSync(${e})`,()=>ce.realpathSync(e))},mkdirSync(e,t){return ot(`mkdirSync(${e})`,()=>{if(!ce.existsSync(e)){let r={recursive:!0};t?.mode!==void 0&&(r.mode=t.mode),ce.mkdirSync(e,r)}})},readdirSync(e){return ot(`readdirSync(${e})`,()=>ce.readdirSync(e,{withFileTypes:!0}))},readdirStringSync(e){return ot(`readdirStringSync(${e})`,()=>ce.readdirSync(e))},isDirEmptySync(e){return ot(`isDirEmptySync(${e})`,()=>this.readdirSync(e).length===0)},rmdirSync(e){return ot(`rmdirSync(${e})`,()=>ce.rmdirSync(e))},rmSync(e,t){return ot(`rmSync(${e})`,()=>ce.rmSync(e,t))},createWriteStream(e){return ce.createWriteStream(e)}},U_=z_;function Tr(){return U_}var an=class extends Error{};function vc(){return process.versions.bun!==void 0}var ys=null,vd=!1;function D_(){if(vd)return ys;if(vd=!0,!process.env.DEBUG_CLAUDE_AGENT_SDK)return null;let e=(0,qo.join)(uc(),"debug");return ys=(0,qo.join)(e,`sdk-${(0,_c.randomUUID)()}.txt`),!(0,ei.existsSync)(e)&&(0,ei.mkdirSync)(e,{recursive:!0}),process.stderr.write(`SDK debug logs: ${ys}
55
+ `),ys}function Kr(e){let t=D_();if(!t)return;let r=`${new Date().toISOString()} ${e}
56
+ `;(0,ei.appendFileSync)(t,r)}function q_(e,t){let r={...e};if(t){let n={sandbox:t};if(r.settings)try{n={...mc(r.settings),sandbox:t}}catch{}r.settings=gr(n)}return r}var Lo=class{options;process;processStdin;processStdout;ready=!1;abortController;exitError;exitListeners=[];processExitHandler;abortHandler;constructor(t){this.options=t,this.abortController=t.abortController||Xd(),this.initialize()}getDefaultExecutable(){return vc()?"bun":"node"}spawnLocalProcess(t){let{command:r,args:n,cwd:i,env:s,signal:o}=t,a=s.DEBUG_CLAUDE_AGENT_SDK||this.options.stderr?"pipe":"ignore",u=(0,ec.spawn)(r,n,{cwd:i,stdio:["pipe","pipe",a],signal:o,env:s,windowsHide:!0});return(s.DEBUG_CLAUDE_AGENT_SDK||this.options.stderr)&&u.stderr.on("data",l=>{let m=l.toString();Kr(m),this.options.stderr&&this.options.stderr(m)}),{stdin:u.stdin,stdout:u.stdout,get killed(){return u.killed},get exitCode(){return u.exitCode},kill:u.kill.bind(u),on:u.on.bind(u),once:u.once.bind(u),off:u.off.bind(u)}}initialize(){try{let{additionalDirectories:t=[],agent:r,betas:n,cwd:i,executable:s=this.getDefaultExecutable(),executableArgs:o=[],extraArgs:a={},pathToClaudeCodeExecutable:u,env:l={...process.env},maxThinkingTokens:m,maxTurns:v,maxBudgetUsd:w,model:I,fallbackModel:T,jsonSchema:k,permissionMode:b,allowDangerouslySkipPermissions:f,permissionPromptToolName:p,continueConversation:c,resume:d,settingSources:y,allowedTools:h=[],disallowedTools:_=[],tools:$,mcpServers:E,strictMcpConfig:q,canUseTool:z,includePartialMessages:L,plugins:W,sandbox:X}=this.options,G=["--output-format","stream-json","--verbose","--input-format","stream-json"];if(m!==void 0&&G.push("--max-thinking-tokens",m.toString()),v&&G.push("--max-turns",v.toString()),w!==void 0&&G.push("--max-budget-usd",w.toString()),I&&G.push("--model",I),r&&G.push("--agent",r),n&&n.length>0&&G.push("--betas",n.join(",")),k&&G.push("--json-schema",gr(k)),this.options.debugFile?G.push("--debug-file",this.options.debugFile):this.options.debug&&G.push("--debug"),l.DEBUG_CLAUDE_AGENT_SDK&&G.push("--debug-to-stderr"),z){if(p)throw Error("canUseTool callback cannot be used with permissionPromptToolName. Please use one or the other.");G.push("--permission-prompt-tool","stdio")}else p&&G.push("--permission-prompt-tool",p);if(c&&G.push("--continue"),d&&G.push("--resume",d),h.length>0&&G.push("--allowedTools",h.join(",")),_.length>0&&G.push("--disallowedTools",_.join(",")),$!==void 0&&(Array.isArray($)?$.length===0?G.push("--tools",""):G.push("--tools",$.join(",")):G.push("--tools","default")),E&&Object.keys(E).length>0&&G.push("--mcp-config",gr({mcpServers:E})),y&&G.push("--setting-sources",y.join(",")),q&&G.push("--strict-mcp-config"),b&&G.push("--permission-mode",b),f&&G.push("--allow-dangerously-skip-permissions"),T){if(I&&T===I)throw Error("Fallback model cannot be the same as the main model. Please specify a different model for fallbackModel option.");G.push("--fallback-model",T)}L&&G.push("--include-partial-messages");for(let U of t)G.push("--add-dir",U);if(W&&W.length>0)for(let U of W)if(U.type==="local")G.push("--plugin-dir",U.path);else throw Error(`Unsupported plugin type: ${U.type}`);this.options.forkSession&&G.push("--fork-session"),this.options.resumeSessionAt&&G.push("--resume-session-at",this.options.resumeSessionAt),this.options.sessionId&&G.push("--session-id",this.options.sessionId),this.options.persistSession===!1&&G.push("--no-session-persistence");let Je=q_(a??{},X);for(let[U,R]of Object.entries(Je))R===null?G.push(`--${U}`):G.push(`--${U}`,R);l.CLAUDE_CODE_ENTRYPOINT||(l.CLAUDE_CODE_ENTRYPOINT="sdk-ts"),delete l.NODE_OPTIONS,l.DEBUG_CLAUDE_AGENT_SDK?l.DEBUG="1":delete l.DEBUG;let rt=L_(u),lt=rt?u:s,ye=rt?[...o,...G]:[...o,u,...G],Z={command:lt,args:ye,cwd:i,env:l,signal:this.abortController.signal};if(this.options.spawnClaudeCodeProcess)Kr(`Spawning Claude Code (custom): ${lt} ${ye.join(" ")}`),this.process=this.options.spawnClaudeCodeProcess(Z);else{if(!Tr().existsSync(u)){let U=rt?`Claude Code native binary not found at ${u}. Please ensure Claude Code is installed via native installer or specify a valid path with options.pathToClaudeCodeExecutable.`:`Claude Code executable not found at ${u}. Is options.pathToClaudeCodeExecutable set?`;throw ReferenceError(U)}Kr(`Spawning Claude Code: ${lt} ${ye.join(" ")}`),this.process=this.spawnLocalProcess(Z)}this.processStdin=this.process.stdin,this.processStdout=this.process.stdout;let P=()=>{this.process&&!this.process.killed&&this.process.kill("SIGTERM")};this.processExitHandler=P,this.abortHandler=P,process.on("exit",this.processExitHandler),this.abortController.signal.addEventListener("abort",this.abortHandler),this.process.on("error",U=>{this.ready=!1,this.abortController.signal.aborted?this.exitError=new an("Claude Code process aborted by user"):(this.exitError=Error(`Failed to spawn Claude Code process: ${U.message}`),Kr(this.exitError.message))}),this.process.on("exit",(U,R)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new an("Claude Code process aborted by user");else{let g=this.getProcessExitError(U,R);g&&(this.exitError=g,Kr(g.message))}}),this.ready=!0}catch(t){throw this.ready=!1,t}}getProcessExitError(t,r){if(t!==0&&t!==null)return Error(`Claude Code process exited with code ${t}`);if(r)return Error(`Claude Code process terminated by signal ${r}`)}write(t){if(this.abortController.signal.aborted)throw new an("Operation aborted");if(!this.ready||!this.processStdin)throw Error("ProcessTransport is not ready for writing");if(this.process?.killed||this.process?.exitCode!==null)throw Error("Cannot write to terminated process");if(this.exitError)throw Error(`Cannot write to process that exited with error: ${this.exitError.message}`);Kr(`[ProcessTransport] Writing to stdin: ${t.substring(0,100)}`);try{this.processStdin.write(t)||Kr("[ProcessTransport] Write buffer full, data queued")}catch(r){throw this.ready=!1,Error(`Failed to write to process stdin: ${r.message}`)}}close(){this.processStdin&&(this.processStdin.end(),this.processStdin=void 0),this.abortHandler&&(this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0);for(let{handler:t}of this.exitListeners)this.process?.off("exit",t);this.exitListeners=[],this.process&&!this.process.killed&&(this.process.kill("SIGTERM"),setTimeout(()=>{this.process&&!this.process.killed&&this.process.kill("SIGKILL")},5e3)),this.ready=!1,this.processExitHandler&&(process.off("exit",this.processExitHandler),this.processExitHandler=void 0)}isReady(){return this.ready}async*readMessages(){if(!this.processStdout)throw Error("ProcessTransport output stream not available");let t=(0,tc.createInterface)({input:this.processStdout});try{for await(let r of t)if(r.trim())try{yield mc(r)}catch{throw Kr(`Non-JSON stdout: ${r}`),Error(`CLI output was not valid JSON. This may indicate an error during startup. Output: ${r.slice(0,200)}${r.length>200?"...":""}`)}await this.waitForExit()}catch(r){throw r}finally{t.close()}}endInput(){this.processStdin&&this.processStdin.end()}getInputStream(){return this.processStdin}onExit(t){if(!this.process)return()=>{};let r=(n,i)=>{let s=this.getProcessExitError(n,i);t(s)};return this.process.on("exit",r),this.exitListeners.push({callback:t,handler:r}),()=>{this.process&&this.process.off("exit",r);let n=this.exitListeners.findIndex(i=>i.handler===r);n!==-1&&this.exitListeners.splice(n,1)}}async waitForExit(){if(!this.process){if(this.exitError)throw this.exitError;return}if(this.process.exitCode!==null||this.process.killed){if(this.exitError)throw this.exitError;return}return new Promise((t,r)=>{let n=(s,o)=>{if(this.abortController.signal.aborted){r(new an("Operation aborted"));return}let a=this.getProcessExitError(s,o);a?r(a):t()};this.process.once("exit",n);let i=s=>{this.process.off("exit",n),r(s)};this.process.once("error",i),this.process.once("exit",()=>{this.process.off("error",i)})})}};function L_(e){return![".js",".mjs",".tsx",".ts",".jsx"].some(t=>e.endsWith(t))}var Ko=class{returned;queue=[];readResolve;readReject;isDone=!1;hasError;started=!1;constructor(t){this.returned=t}[Symbol.asyncIterator](){if(this.started)throw Error("Stream can only be iterated once");return this.started=!0,this}next(){return this.queue.length>0?Promise.resolve({done:!1,value:this.queue.shift()}):this.isDone?Promise.resolve({done:!0,value:void 0}):this.hasError?Promise.reject(this.hasError):new Promise((t,r)=>{this.readResolve=t,this.readReject=r})}enqueue(t){if(this.readResolve){let r=this.readResolve;this.readResolve=void 0,this.readReject=void 0,r({done:!1,value:t})}else this.queue.push(t)}done(){if(this.isDone=!0,this.readResolve){let t=this.readResolve;this.readResolve=void 0,this.readReject=void 0,t({done:!0,value:void 0})}}error(t){if(this.hasError=t,this.readReject){let r=this.readReject;this.readResolve=void 0,this.readReject=void 0,r(t)}}return(){return this.isDone=!0,this.returned&&this.returned(),Promise.resolve({done:!0,value:void 0})}},Vo=class{sendMcpMessage;isClosed=!1;constructor(t){this.sendMcpMessage=t}onclose;onerror;onmessage;async start(){}async send(t){if(this.isClosed)throw Error("Transport is closed");this.sendMcpMessage(t)}async close(){this.isClosed||(this.isClosed=!0,this.onclose?.())}},Zo=class{transport;isSingleUserTurn;canUseTool;hooks;abortController;jsonSchema;initConfig;pendingControlResponses=new Map;cleanupPerformed=!1;sdkMessages;inputStream=new Ko;initialization;cancelControllers=new Map;hookCallbacks=new Map;nextCallbackId=0;sdkMcpTransports=new Map;sdkMcpServerInstances=new Map;pendingMcpResponses=new Map;firstResultReceivedResolve;firstResultReceived=!1;hasBidirectionalNeeds(){return this.sdkMcpTransports.size>0||this.hooks!==void 0&&Object.keys(this.hooks).length>0||this.canUseTool!==void 0}constructor(t,r,n,i,s,o=new Map,a,u){this.transport=t,this.isSingleUserTurn=r,this.canUseTool=n,this.hooks=i,this.abortController=s,this.jsonSchema=a,this.initConfig=u;for(let[l,m]of o)this.connectSdkMcpServer(l,m);this.sdkMessages=this.readSdkMessages(),this.readMessages(),this.initialization=this.initialize(),this.initialization.catch(()=>{})}setError(t){this.inputStream.error(t)}close(){this.cleanup()}cleanup(t){if(!this.cleanupPerformed){this.cleanupPerformed=!0;try{this.transport.close(),this.pendingControlResponses.clear(),this.pendingMcpResponses.clear(),this.cancelControllers.clear(),this.hookCallbacks.clear();for(let r of this.sdkMcpTransports.values())try{r.close()}catch{}this.sdkMcpTransports.clear(),t?this.inputStream.error(t):this.inputStream.done()}catch{}}}next(...[t]){return this.sdkMessages.next(t)}return(t){return this.sdkMessages.return(t)}throw(t){return this.sdkMessages.throw(t)}[Symbol.asyncIterator](){return this.sdkMessages}[Symbol.asyncDispose](){return this.sdkMessages[Symbol.asyncDispose]()}async readMessages(){try{for await(let t of this.transport.readMessages()){if(t.type==="control_response"){let r=this.pendingControlResponses.get(t.response.request_id);r&&r(t.response);continue}else if(t.type==="control_request"){this.handleControlRequest(t);continue}else if(t.type==="control_cancel_request"){this.handleControlCancelRequest(t);continue}else if(t.type==="keep_alive")continue;t.type==="streamlined_text"||t.type==="streamlined_tool_use_summary"||(t.type==="result"&&(this.firstResultReceived=!0,this.firstResultReceivedResolve&&this.firstResultReceivedResolve(),this.isSingleUserTurn&&(on("[Query.readMessages] First result received for single-turn query, closing stdin"),this.transport.endInput())),this.inputStream.enqueue(t))}this.firstResultReceivedResolve&&this.firstResultReceivedResolve(),this.inputStream.done(),this.cleanup()}catch(t){this.firstResultReceivedResolve&&this.firstResultReceivedResolve(),this.inputStream.error(t),this.cleanup(t)}}async handleControlRequest(t){let r=new AbortController;this.cancelControllers.set(t.request_id,r);try{let n=await this.processControlRequest(t,r.signal),i={type:"control_response",response:{subtype:"success",request_id:t.request_id,response:n}};await Promise.resolve(this.transport.write(gr(i)+`
57
+ `))}catch(n){let i={type:"control_response",response:{subtype:"error",request_id:t.request_id,error:n.message||String(n)}};await Promise.resolve(this.transport.write(gr(i)+`
58
+ `))}finally{this.cancelControllers.delete(t.request_id)}}handleControlCancelRequest(t){let r=this.cancelControllers.get(t.request_id);r&&(r.abort(),this.cancelControllers.delete(t.request_id))}async processControlRequest(t,r){if(t.request.subtype==="can_use_tool"){if(!this.canUseTool)throw Error("canUseTool callback is not provided.");return{...await this.canUseTool(t.request.tool_name,t.request.input,{signal:r,suggestions:t.request.permission_suggestions,blockedPath:t.request.blocked_path,decisionReason:t.request.decision_reason,toolUseID:t.request.tool_use_id,agentID:t.request.agent_id}),toolUseID:t.request.tool_use_id}}else{if(t.request.subtype==="hook_callback")return await this.handleHookCallbacks(t.request.callback_id,t.request.input,t.request.tool_use_id,r);if(t.request.subtype==="mcp_message"){let n=t.request,i=this.sdkMcpTransports.get(n.server_name);if(!i)throw Error(`SDK MCP server not found: ${n.server_name}`);return"method"in n.message&&"id"in n.message&&n.message.id!==null?{mcp_response:await this.handleMcpControlRequest(n.server_name,n,i)}:(i.onmessage&&i.onmessage(n.message),{mcp_response:{jsonrpc:"2.0",result:{},id:0}})}}throw Error("Unsupported control request subtype: "+t.request.subtype)}async*readSdkMessages(){for await(let t of this.inputStream)yield t}async initialize(){let t;if(this.hooks){t={};for(let[i,s]of Object.entries(this.hooks))s.length>0&&(t[i]=s.map(o=>{let a=[];for(let u of o.hooks){let l=`hook_${this.nextCallbackId++}`;this.hookCallbacks.set(l,u),a.push(l)}return{matcher:o.matcher,hookCallbackIds:a,timeout:o.timeout}}))}let r=this.sdkMcpTransports.size>0?Array.from(this.sdkMcpTransports.keys()):void 0,n={subtype:"initialize",hooks:t,sdkMcpServers:r,jsonSchema:this.jsonSchema,systemPrompt:this.initConfig?.systemPrompt,appendSystemPrompt:this.initConfig?.appendSystemPrompt,agents:this.initConfig?.agents};return(await this.request(n)).response}async interrupt(){await this.request({subtype:"interrupt"})}async setPermissionMode(t){await this.request({subtype:"set_permission_mode",mode:t})}async setModel(t){await this.request({subtype:"set_model",model:t})}async setMaxThinkingTokens(t){await this.request({subtype:"set_max_thinking_tokens",max_thinking_tokens:t})}async rewindFiles(t,r){return(await this.request({subtype:"rewind_files",user_message_id:t,dry_run:r?.dryRun})).response}async processPendingPermissionRequests(t){for(let r of t)r.request.subtype==="can_use_tool"&&this.handleControlRequest(r).catch(()=>{})}request(t){let r=Math.random().toString(36).substring(2,15),n={request_id:r,type:"control_request",request:t};return new Promise((i,s)=>{this.pendingControlResponses.set(r,o=>{o.subtype==="success"?i(o):(s(Error(o.error)),o.pending_permission_requests&&this.processPendingPermissionRequests(o.pending_permission_requests))}),Promise.resolve(this.transport.write(gr(n)+`
59
+ `))})}async initializationResult(){return this.initialization}async supportedCommands(){return(await this.initialization).commands}async supportedModels(){return(await this.initialization).models}async reconnectMcpServer(t){await this.request({subtype:"mcp_reconnect",serverName:t})}async toggleMcpServer(t,r){await this.request({subtype:"mcp_toggle",serverName:t,enabled:r})}async mcpServerStatus(){return(await this.request({subtype:"mcp_status"})).response.mcpServers}async setMcpServers(t){let r={},n={};for(let[a,u]of Object.entries(t))u.type==="sdk"&&"instance"in u?r[a]=u.instance:n[a]=u;let i=new Set(this.sdkMcpServerInstances.keys()),s=new Set(Object.keys(r));for(let a of i)s.has(a)||await this.disconnectSdkMcpServer(a);for(let[a,u]of Object.entries(r))i.has(a)||this.connectSdkMcpServer(a,u);let o={};for(let a of Object.keys(r))o[a]={type:"sdk",name:a};return(await this.request({subtype:"mcp_set_servers",servers:{...n,...o}})).response}async accountInfo(){return(await this.initialization).account}async streamInput(t){on("[Query.streamInput] Starting to process input stream");try{let r=0;for await(let n of t){if(r++,on(`[Query.streamInput] Processing message ${r}: ${n.type}`),this.abortController?.signal.aborted)break;await Promise.resolve(this.transport.write(gr(n)+`
60
+ `))}on(`[Query.streamInput] Finished processing ${r} messages from input stream`),r>0&&this.hasBidirectionalNeeds()&&(on("[Query.streamInput] Has bidirectional needs, waiting for first result"),await this.waitForFirstResult()),on("[Query] Calling transport.endInput() to close stdin to CLI process"),this.transport.endInput()}catch(r){if(!(r instanceof an))throw r}}waitForFirstResult(){return this.firstResultReceived?(on("[Query.waitForFirstResult] Result already received, returning immediately"),Promise.resolve()):new Promise(t=>{if(this.abortController?.signal.aborted){t();return}this.abortController?.signal.addEventListener("abort",()=>t(),{once:!0}),this.firstResultReceivedResolve=t})}handleHookCallbacks(t,r,n,i){let s=this.hookCallbacks.get(t);if(!s)throw Error(`No hook callback found for ID: ${t}`);return s(r,n,{signal:i})}connectSdkMcpServer(t,r){let n=new Vo(i=>this.sendMcpServerMessageToCli(t,i));this.sdkMcpTransports.set(t,n),this.sdkMcpServerInstances.set(t,r),r.connect(n)}async disconnectSdkMcpServer(t){let r=this.sdkMcpTransports.get(t);r&&(await r.close(),this.sdkMcpTransports.delete(t)),this.sdkMcpServerInstances.delete(t)}sendMcpServerMessageToCli(t,r){if("id"in r&&r.id!==null&&r.id!==void 0){let i=`${t}:${r.id}`,s=this.pendingMcpResponses.get(i);if(s){s.resolve(r),this.pendingMcpResponses.delete(i);return}}let n={type:"control_request",request_id:(0,bc.randomUUID)(),request:{subtype:"mcp_message",server_name:t,message:r}};this.transport.write(gr(n)+`
61
+ `)}handleMcpControlRequest(t,r,n){let i="id"in r.message?r.message.id:null,s=`${t}:${i}`;return new Promise((o,a)=>{let u=()=>{this.pendingMcpResponses.delete(s)},l=v=>{u(),o(v)},m=v=>{u(),a(v)};if(this.pendingMcpResponses.set(s,{resolve:l,reject:m}),n.onmessage)n.onmessage(r.message);else{u(),a(Error("No message handler registered"));return}})}};var Se;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function r(i){throw Error()}e.assertNever=r,e.arrayToEnum=i=>{let s={};for(let o of i)s[o]=o;return s},e.getValidEnumValues=i=>{let s=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(let a of s)o[a]=i[a];return e.objectValues(o)},e.objectValues=i=>e.objectKeys(i).map(function(s){return i[s]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let s=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},e.find=(i,s)=>{for(let o of i)if(s(o))return o},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}e.joinValues=n,e.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(Se||(Se={}));var _d;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(_d||(_d={}));var te=Se.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Vr=e=>{switch(typeof e){case"undefined":return te.undefined;case"string":return te.string;case"number":return Number.isNaN(e)?te.nan:te.number;case"boolean":return te.boolean;case"function":return te.function;case"bigint":return te.bigint;case"symbol":return te.symbol;case"object":return Array.isArray(e)?te.array:e===null?te.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?te.promise:typeof Map<"u"&&e instanceof Map?te.map:typeof Set<"u"&&e instanceof Set?te.set:typeof Date<"u"&&e instanceof Date?te.date:te.object;default:return te.unknown}},K=Se.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Yt=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(s){return s.message},n={_errors:[]},i=s=>{for(let o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let a=n,u=0;for(;u<o.path.length;){let l=o.path[u];u!==o.path.length-1?a[l]=a[l]||{_errors:[]}:(a[l]=a[l]||{_errors:[]},a[l]._errors.push(r(o))),a=a[l],u++}}};return i(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Se.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let i of this.issues)if(i.path.length>0){let s=i.path[0];r[s]=r[s]||[],r[s].push(t(i))}else n.push(t(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Yt.create=e=>new Yt(e);var K_=(e,t)=>{let r;switch(e.code){case K.invalid_type:e.received===te.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case K.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Se.jsonStringifyReplacer)}`;break;case K.unrecognized_keys:r=`Unrecognized key(s) in object: ${Se.joinValues(e.keys,", ")}`;break;case K.invalid_union:r="Invalid input";break;case K.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Se.joinValues(e.options)}`;break;case K.invalid_enum_value:r=`Invalid enum value. Expected ${Se.joinValues(e.options)}, received '${e.received}'`;break;case K.invalid_arguments:r="Invalid function arguments";break;case K.invalid_return_type:r="Invalid function return type";break;case K.invalid_date:r="Invalid date";break;case K.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Se.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case K.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case K.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case K.custom:r="Invalid input";break;case K.invalid_intersection_types:r="Intersection results could not be merged";break;case K.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case K.not_finite:r="Number must be finite";break;default:r=t.defaultError,Se.assertNever(e)}return{message:r}},Ti=K_,V_=Ti;function Wo(){return V_}var Bo=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,s=[...r,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let a="",u=n.filter(l=>!!l).slice().reverse();for(let l of u)a=l(o,{data:t,defaultError:a}).message;return{...i,path:s,message:a}};function Y(e,t){let r=Wo(),n=Bo({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Ti?void 0:Ti].filter(i=>!!i)});e.common.issues.push(n)}var St=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let i of r){if(i.status==="aborted")return le;i.status==="dirty"&&t.dirty(),n.push(i.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let i of r){let s=await i.key,o=await i.value;n.push({key:s,value:o})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let i of r){let{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return le;s.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(n[s.value]=o.value)}return{status:t.value,value:n}}},le=Object.freeze({status:"aborted"}),xi=e=>({status:"dirty",value:e}),Rt=e=>({status:"valid",value:e}),bd=e=>e.status==="aborted",wd=e=>e.status==="dirty",Mn=e=>e.status==="valid",xs=e=>typeof Promise<"u"&&e instanceof Promise,ie;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(ie||(ie={}));var Jt=class{constructor(t,r,n,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Id=(e,t)=>{if(Mn(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Yt(e.common.issues);return this._error=r,this._error}}};function fe(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(s,o)=>{let{message:a}=e;return s.code==="invalid_enum_value"?{message:a??o.defaultError}:typeof o.data>"u"?{message:a??n??o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:a??r??o.defaultError}},description:i}}var he=class{get description(){return this._def.description}_getType(t){return Vr(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Vr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new St,ctx:{common:t.parent.common,data:t.data,parsedType:Vr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(xs(r))throw Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Vr(t)},i=this._parseSync({data:t,path:n.path,parent:n});return Id(n,i)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Vr(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Mn(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>Mn(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Vr(t)},i=this._parse({data:t,path:n.path,parent:n}),s=await(xs(i)?i:Promise.resolve(i));return Id(n,s)}refine(t,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,s)=>{let o=t(i),a=()=>s.addIssue({code:K.custom,...n(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(u=>u?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,i)=>t(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(t){return new dr({schema:this,typeName:de.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return lr.create(this,this._def)}nullable(){return Or.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Br.create(this)}promise(){return ln.create(this,this._def)}or(t){return Dn.create([this,t],this._def)}and(t){return qn.create(this,t,this._def)}transform(t){return new dr({...fe(this._def),schema:this,typeName:de.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Wn({...fe(this._def),innerType:this,defaultValue:r,typeName:de.ZodDefault})}brand(){return new Ss({typeName:de.ZodBranded,type:this,...fe(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Bn({...fe(this._def),innerType:this,catchValue:r,typeName:de.ZodCatch})}describe(t){return new this.constructor({...this._def,description:t})}pipe(t){return ks.create(this,t)}readonly(){return Hn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Z_=/^c[^\s-]{8,}$/i,W_=/^[0-9a-z]+$/,B_=/^[0-9A-HJKMNP-TV-Z]{26}$/i,H_=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,G_=/^[a-z0-9_-]{21}$/i,Y_=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,J_=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Q_=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,X_="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ao,eb=/^(?:(?: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])$/,tb=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,rb=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,nb=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ib=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,sb=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,wc="((\\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])))",ob=new RegExp(`^${wc}$`);function Ic(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function ab(e){return new RegExp(`^${Ic(e)}$`)}function ub(e){let t=`${wc}T${Ic(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function lb(e,t){return!!((t==="v4"||!t)&&eb.test(e)||(t==="v6"||!t)&&rb.test(e))}function db(e,t){if(!Y_.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function cb(e,t){return!!((t==="v4"||!t)&&tb.test(e)||(t==="v6"||!t)&&nb.test(e))}var Fn=class e extends he{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==te.string){let i=this._getOrReturnCtx(t);return Y(i,{code:K.invalid_type,expected:te.string,received:i.parsedType}),le}let r=new St,n;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(n=this._getOrReturnCtx(t,n),Y(n,{code:K.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(n=this._getOrReturnCtx(t,n),Y(n,{code:K.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let s=t.data.length>i.value,o=t.data.length<i.value;(s||o)&&(n=this._getOrReturnCtx(t,n),s?Y(n,{code:K.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&Y(n,{code:K.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")Q_.test(t.data)||(n=this._getOrReturnCtx(t,n),Y(n,{validation:"email",code:K.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Ao||(Ao=new RegExp(X_,"u")),Ao.test(t.data)||(n=this._getOrReturnCtx(t,n),Y(n,{validation:"emoji",code:K.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")H_.test(t.data)||(n=this._getOrReturnCtx(t,n),Y(n,{validation:"uuid",code:K.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")G_.test(t.data)||(n=this._getOrReturnCtx(t,n),Y(n,{validation:"nanoid",code:K.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")Z_.test(t.data)||(n=this._getOrReturnCtx(t,n),Y(n,{validation:"cuid",code:K.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")W_.test(t.data)||(n=this._getOrReturnCtx(t,n),Y(n,{validation:"cuid2",code:K.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")B_.test(t.data)||(n=this._getOrReturnCtx(t,n),Y(n,{validation:"ulid",code:K.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{n=this._getOrReturnCtx(t,n),Y(n,{validation:"url",code:K.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,!i.regex.test(t.data)&&(n=this._getOrReturnCtx(t,n),Y(n,{validation:"regex",code:K.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(t,n),Y(n,{code:K.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(n=this._getOrReturnCtx(t,n),Y(n,{code:K.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(n=this._getOrReturnCtx(t,n),Y(n,{code:K.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?ub(i).test(t.data)||(n=this._getOrReturnCtx(t,n),Y(n,{code:K.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?ob.test(t.data)||(n=this._getOrReturnCtx(t,n),Y(n,{code:K.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?ab(i).test(t.data)||(n=this._getOrReturnCtx(t,n),Y(n,{code:K.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?J_.test(t.data)||(n=this._getOrReturnCtx(t,n),Y(n,{validation:"duration",code:K.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?lb(t.data,i.version)||(n=this._getOrReturnCtx(t,n),Y(n,{validation:"ip",code:K.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?db(t.data,i.alg)||(n=this._getOrReturnCtx(t,n),Y(n,{validation:"jwt",code:K.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?cb(t.data,i.version)||(n=this._getOrReturnCtx(t,n),Y(n,{validation:"cidr",code:K.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?ib.test(t.data)||(n=this._getOrReturnCtx(t,n),Y(n,{validation:"base64",code:K.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?sb.test(t.data)||(n=this._getOrReturnCtx(t,n),Y(n,{validation:"base64url",code:K.invalid_string,message:i.message}),r.dirty()):Se.assertNever(i);return{status:r.value,value:t.data}}_regex(t,r,n){return this.refinement(i=>t.test(i),{validation:r,code:K.invalid_string,...ie.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ie.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ie.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ie.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ie.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ie.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ie.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ie.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ie.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ie.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ie.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ie.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ie.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ie.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...ie.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...ie.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...ie.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...ie.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...ie.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...ie.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...ie.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...ie.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...ie.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...ie.errToObj(r)})}nonempty(t){return this.min(1,ie.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Fn.create=e=>new Fn({checks:[],typeName:de.ZodString,coerce:e?.coerce??!1,...fe(e)});function fb(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,s=Number.parseInt(e.toFixed(i).replace(".","")),o=Number.parseInt(t.toFixed(i).replace(".",""));return s%o/10**i}var Pi=class e extends he{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==te.number){let i=this._getOrReturnCtx(t);return Y(i,{code:K.invalid_type,expected:te.number,received:i.parsedType}),le}let r,n=new St;for(let i of this._def.checks)i.kind==="int"?Se.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),Y(r,{code:K.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),Y(r,{code:K.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),Y(r,{code:K.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?fb(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),Y(r,{code:K.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),Y(r,{code:K.not_finite,message:i.message}),n.dirty()):Se.assertNever(i);return{status:n.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,ie.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ie.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ie.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ie.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ie.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ie.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ie.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ie.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ie.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ie.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ie.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:ie.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ie.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ie.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Se.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};Pi.create=e=>new Pi({checks:[],typeName:de.ZodNumber,coerce:e?.coerce||!1,...fe(e)});var Oi=class e extends he{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==te.bigint)return this._getInvalidInput(t);let r,n=new St;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),Y(r,{code:K.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),Y(r,{code:K.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),Y(r,{code:K.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):Se.assertNever(i);return{status:n.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return Y(r,{code:K.invalid_type,expected:te.bigint,received:r.parsedType}),le}gte(t,r){return this.setLimit("min",t,!0,ie.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ie.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ie.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ie.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ie.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ie.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ie.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ie.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ie.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ie.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Oi.create=e=>new Oi({checks:[],typeName:de.ZodBigInt,coerce:e?.coerce??!1,...fe(e)});var Ci=class extends he{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==te.boolean){let r=this._getOrReturnCtx(t);return Y(r,{code:K.invalid_type,expected:te.boolean,received:r.parsedType}),le}return Rt(t.data)}};Ci.create=e=>new Ci({typeName:de.ZodBoolean,coerce:e?.coerce||!1,...fe(e)});var Ei=class e extends he{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==te.date){let i=this._getOrReturnCtx(t);return Y(i,{code:K.invalid_type,expected:te.date,received:i.parsedType}),le}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return Y(i,{code:K.invalid_date}),le}let r=new St,n;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(n=this._getOrReturnCtx(t,n),Y(n,{code:K.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(n=this._getOrReturnCtx(t,n),Y(n,{code:K.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):Se.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:ie.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:ie.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};Ei.create=e=>new Ei({checks:[],coerce:e?.coerce||!1,typeName:de.ZodDate,...fe(e)});var Ri=class extends he{_parse(t){if(this._getType(t)!==te.symbol){let r=this._getOrReturnCtx(t);return Y(r,{code:K.invalid_type,expected:te.symbol,received:r.parsedType}),le}return Rt(t.data)}};Ri.create=e=>new Ri({typeName:de.ZodSymbol,...fe(e)});var zn=class extends he{_parse(t){if(this._getType(t)!==te.undefined){let r=this._getOrReturnCtx(t);return Y(r,{code:K.invalid_type,expected:te.undefined,received:r.parsedType}),le}return Rt(t.data)}};zn.create=e=>new zn({typeName:de.ZodUndefined,...fe(e)});var Un=class extends he{_parse(t){if(this._getType(t)!==te.null){let r=this._getOrReturnCtx(t);return Y(r,{code:K.invalid_type,expected:te.null,received:r.parsedType}),le}return Rt(t.data)}};Un.create=e=>new Un({typeName:de.ZodNull,...fe(e)});var Ni=class extends he{constructor(){super(...arguments),this._any=!0}_parse(t){return Rt(t.data)}};Ni.create=e=>new Ni({typeName:de.ZodAny,...fe(e)});var Wr=class extends he{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Rt(t.data)}};Wr.create=e=>new Wr({typeName:de.ZodUnknown,...fe(e)});var vr=class extends he{_parse(t){let r=this._getOrReturnCtx(t);return Y(r,{code:K.invalid_type,expected:te.never,received:r.parsedType}),le}};vr.create=e=>new vr({typeName:de.ZodNever,...fe(e)});var ji=class extends he{_parse(t){if(this._getType(t)!==te.undefined){let r=this._getOrReturnCtx(t);return Y(r,{code:K.invalid_type,expected:te.void,received:r.parsedType}),le}return Rt(t.data)}};ji.create=e=>new ji({typeName:de.ZodVoid,...fe(e)});var Br=class e extends he{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),i=this._def;if(r.parsedType!==te.array)return Y(r,{code:K.invalid_type,expected:te.array,received:r.parsedType}),le;if(i.exactLength!==null){let o=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(o||a)&&(Y(r,{code:o?K.too_big:K.too_small,minimum:a?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(Y(r,{code:K.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(Y(r,{code:K.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,a)=>i.type._parseAsync(new Jt(r,o,r.path,a)))).then(o=>St.mergeArray(n,o));let s=[...r.data].map((o,a)=>i.type._parseSync(new Jt(r,o,r.path,a)));return St.mergeArray(n,s)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:ie.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:ie.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:ie.toString(r)}})}nonempty(t){return this.min(1,t)}};Br.create=(e,t)=>new Br({type:e,minLength:null,maxLength:null,exactLength:null,typeName:de.ZodArray,...fe(t)});function Nn(e){if(e instanceof Lt){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=lr.create(Nn(n))}return new Lt({...e._def,shape:()=>t})}else return e instanceof Br?new Br({...e._def,type:Nn(e.element)}):e instanceof lr?lr.create(Nn(e.unwrap())):e instanceof Or?Or.create(Nn(e.unwrap())):e instanceof Pr?Pr.create(e.items.map(t=>Nn(t))):e}var Lt=class e extends he{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=Se.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==te.object){let u=this._getOrReturnCtx(t);return Y(u,{code:K.invalid_type,expected:te.object,received:u.parsedType}),le}let{status:r,ctx:n}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),o=[];if(!(this._def.catchall instanceof vr&&this._def.unknownKeys==="strip"))for(let u in n.data)s.includes(u)||o.push(u);let a=[];for(let u of s){let l=i[u],m=n.data[u];a.push({key:{status:"valid",value:u},value:l._parse(new Jt(n,m,n.path,u)),alwaysSet:u in n.data})}if(this._def.catchall instanceof vr){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of o)a.push({key:{status:"valid",value:l},value:{status:"valid",value:n.data[l]}});else if(u==="strict")o.length>0&&(Y(n,{code:K.unrecognized_keys,keys:o}),r.dirty());else if(u!=="strip")throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of o){let m=n.data[l];a.push({key:{status:"valid",value:l},value:u._parse(new Jt(n,m,n.path,l)),alwaysSet:l in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of a){let m=await l.key,v=await l.value;u.push({key:m,value:v,alwaysSet:l.alwaysSet})}return u}).then(u=>St.mergeObjectSync(r,u)):St.mergeObjectSync(r,a)}get shape(){return this._def.shape()}strict(t){return ie.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:ie.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:de.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of Se.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of Se.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Nn(this)}partial(t){let r={};for(let n of Se.objectKeys(this.shape)){let i=this.shape[n];t&&!t[n]?r[n]=i:r[n]=i.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of Se.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof lr;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return $c(Se.objectKeys(this.shape))}};Lt.create=(e,t)=>new Lt({shape:()=>e,unknownKeys:"strip",catchall:vr.create(),typeName:de.ZodObject,...fe(t)});Lt.strictCreate=(e,t)=>new Lt({shape:()=>e,unknownKeys:"strict",catchall:vr.create(),typeName:de.ZodObject,...fe(t)});Lt.lazycreate=(e,t)=>new Lt({shape:e,unknownKeys:"strip",catchall:vr.create(),typeName:de.ZodObject,...fe(t)});var Dn=class extends he{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function i(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let o=s.map(a=>new Yt(a.ctx.common.issues));return Y(r,{code:K.invalid_union,unionErrors:o}),le}if(r.common.async)return Promise.all(n.map(async s=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(i);{let s,o=[];for(let u of n){let l={...r,common:{...r.common,issues:[]},parent:null},m=u._parseSync({data:r.data,path:r.path,parent:l});if(m.status==="valid")return m;m.status==="dirty"&&!s&&(s={result:m,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let a=o.map(u=>new Yt(u));return Y(r,{code:K.invalid_union,unionErrors:a}),le}}get options(){return this._def.options}};Dn.create=(e,t)=>new Dn({options:e,typeName:de.ZodUnion,...fe(t)});var kr=e=>e instanceof Ln?kr(e.schema):e instanceof dr?kr(e.innerType()):e instanceof Kn?[e.value]:e instanceof Vn?e.options:e instanceof Zn?Se.objectValues(e.enum):e instanceof Wn?kr(e._def.innerType):e instanceof zn?[void 0]:e instanceof Un?[null]:e instanceof lr?[void 0,...kr(e.unwrap())]:e instanceof Or?[null,...kr(e.unwrap())]:e instanceof Ss||e instanceof Hn?kr(e.unwrap()):e instanceof Bn?kr(e._def.innerType):[],Ho=class e extends he{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==te.object)return Y(r,{code:K.invalid_type,expected:te.object,received:r.parsedType}),le;let n=this.discriminator,i=r.data[n],s=this.optionsMap.get(i);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(Y(r,{code:K.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),le)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let i=new Map;for(let s of r){let o=kr(s.shape[t]);if(!o.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of o){if(i.has(a))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);i.set(a,s)}}return new e({typeName:de.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...fe(n)})}};function Go(e,t){let r=Vr(e),n=Vr(t);if(e===t)return{valid:!0,data:e};if(r===te.object&&n===te.object){let i=Se.objectKeys(t),s=Se.objectKeys(e).filter(a=>i.indexOf(a)!==-1),o={...e,...t};for(let a of s){let u=Go(e[a],t[a]);if(!u.valid)return{valid:!1};o[a]=u.data}return{valid:!0,data:o}}else if(r===te.array&&n===te.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let s=0;s<e.length;s++){let o=e[s],a=t[s],u=Go(o,a);if(!u.valid)return{valid:!1};i.push(u.data)}return{valid:!0,data:i}}else return r===te.date&&n===te.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var qn=class extends he{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=(s,o)=>{if(bd(s)||bd(o))return le;let a=Go(s.value,o.value);return a.valid?((wd(s)||wd(o))&&r.dirty(),{status:r.value,value:a.data}):(Y(n,{code:K.invalid_intersection_types}),le)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};qn.create=(e,t,r)=>new qn({left:e,right:t,typeName:de.ZodIntersection,...fe(r)});var Pr=class e extends he{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.array)return Y(n,{code:K.invalid_type,expected:te.array,received:n.parsedType}),le;if(n.data.length<this._def.items.length)return Y(n,{code:K.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),le;!this._def.rest&&n.data.length>this._def.items.length&&(Y(n,{code:K.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,o)=>{let a=this._def.items[o]||this._def.rest;return a?a._parse(new Jt(n,s,n.path,o)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>St.mergeArray(r,s)):St.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Pr.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new Pr({items:e,typeName:de.ZodTuple,rest:null,...fe(t)})};var Yo=class e extends he{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.object)return Y(n,{code:K.invalid_type,expected:te.object,received:n.parsedType}),le;let i=[],s=this._def.keyType,o=this._def.valueType;for(let a in n.data)i.push({key:s._parse(new Jt(n,a,n.path,a)),value:o._parse(new Jt(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?St.mergeObjectAsync(r,i):St.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof he?new e({keyType:t,valueType:r,typeName:de.ZodRecord,...fe(n)}):new e({keyType:Fn.create(),valueType:t,typeName:de.ZodRecord,...fe(r)})}},Ai=class extends he{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.map)return Y(n,{code:K.invalid_type,expected:te.map,received:n.parsedType}),le;let i=this._def.keyType,s=this._def.valueType,o=[...n.data.entries()].map(([a,u],l)=>({key:i._parse(new Jt(n,a,n.path,[l,"key"])),value:s._parse(new Jt(n,u,n.path,[l,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let u of o){let l=await u.key,m=await u.value;if(l.status==="aborted"||m.status==="aborted")return le;(l.status==="dirty"||m.status==="dirty")&&r.dirty(),a.set(l.value,m.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let u of o){let{key:l,value:m}=u;if(l.status==="aborted"||m.status==="aborted")return le;(l.status==="dirty"||m.status==="dirty")&&r.dirty(),a.set(l.value,m.value)}return{status:r.value,value:a}}}};Ai.create=(e,t,r)=>new Ai({valueType:t,keyType:e,typeName:de.ZodMap,...fe(r)});var Mi=class e extends he{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.set)return Y(n,{code:K.invalid_type,expected:te.set,received:n.parsedType}),le;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(Y(n,{code:K.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(Y(n,{code:K.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let s=this._def.valueType;function o(u){let l=new Set;for(let m of u){if(m.status==="aborted")return le;m.status==="dirty"&&r.dirty(),l.add(m.value)}return{status:r.value,value:l}}let a=[...n.data.values()].map((u,l)=>s._parse(new Jt(n,u,n.path,l)));return n.common.async?Promise.all(a).then(u=>o(u)):o(a)}min(t,r){return new e({...this._def,minSize:{value:t,message:ie.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:ie.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Mi.create=(e,t)=>new Mi({valueType:e,minSize:null,maxSize:null,typeName:de.ZodSet,...fe(t)});var Jo=class e extends he{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==te.function)return Y(r,{code:K.invalid_type,expected:te.function,received:r.parsedType}),le;function n(a,u){return Bo({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Wo(),Ti].filter(l=>!!l),issueData:{code:K.invalid_arguments,argumentsError:u}})}function i(a,u){return Bo({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Wo(),Ti].filter(l=>!!l),issueData:{code:K.invalid_return_type,returnTypeError:u}})}let s={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof ln){let a=this;return Rt(async function(...u){let l=new Yt([]),m=await a._def.args.parseAsync(u,s).catch(w=>{throw l.addIssue(n(u,w)),l}),v=await Reflect.apply(o,this,m);return await a._def.returns._def.type.parseAsync(v,s).catch(w=>{throw l.addIssue(i(v,w)),l})})}else{let a=this;return Rt(function(...u){let l=a._def.args.safeParse(u,s);if(!l.success)throw new Yt([n(u,l.error)]);let m=Reflect.apply(o,this,l.data),v=a._def.returns.safeParse(m,s);if(!v.success)throw new Yt([i(m,v.error)]);return v.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Pr.create(t).rest(Wr.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Pr.create([]).rest(Wr.create()),returns:r||Wr.create(),typeName:de.ZodFunction,...fe(n)})}},Ln=class extends he{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Ln.create=(e,t)=>new Ln({getter:e,typeName:de.ZodLazy,...fe(t)});var Kn=class extends he{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return Y(r,{received:r.data,code:K.invalid_literal,expected:this._def.value}),le}return{status:"valid",value:t.data}}get value(){return this._def.value}};Kn.create=(e,t)=>new Kn({value:e,typeName:de.ZodLiteral,...fe(t)});function $c(e,t){return new Vn({values:e,typeName:de.ZodEnum,...fe(t)})}var Vn=class e extends he{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return Y(r,{expected:Se.joinValues(n),received:r.parsedType,code:K.invalid_type}),le}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return Y(r,{received:r.data,code:K.invalid_enum_value,options:n}),le}return Rt(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};Vn.create=$c;var Zn=class extends he{_parse(t){let r=Se.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==te.string&&n.parsedType!==te.number){let i=Se.objectValues(r);return Y(n,{expected:Se.joinValues(i),received:n.parsedType,code:K.invalid_type}),le}if(this._cache||(this._cache=new Set(Se.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let i=Se.objectValues(r);return Y(n,{received:n.data,code:K.invalid_enum_value,options:i}),le}return Rt(t.data)}get enum(){return this._def.values}};Zn.create=(e,t)=>new Zn({values:e,typeName:de.ZodNativeEnum,...fe(t)});var ln=class extends he{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==te.promise&&r.common.async===!1)return Y(r,{code:K.invalid_type,expected:te.promise,received:r.parsedType}),le;let n=r.parsedType===te.promise?r.data:Promise.resolve(r.data);return Rt(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};ln.create=(e,t)=>new ln({type:e,typeName:de.ZodPromise,...fe(t)});var dr=class extends he{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===de.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=this._def.effect||null,s={addIssue:o=>{Y(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){let o=i.transform(n.data,s);if(n.common.async)return Promise.resolve(o).then(async a=>{if(r.value==="aborted")return le;let u=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return u.status==="aborted"?le:u.status==="dirty"||r.value==="dirty"?xi(u.value):u});{if(r.value==="aborted")return le;let a=this._def.schema._parseSync({data:o,path:n.path,parent:n});return a.status==="aborted"?le:a.status==="dirty"||r.value==="dirty"?xi(a.value):a}}if(i.type==="refinement"){let o=a=>{let u=i.refinement(a,s);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?le:(a.status==="dirty"&&r.dirty(),o(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?le:(a.status==="dirty"&&r.dirty(),o(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Mn(o))return le;let a=i.transform(o.value,s);if(a instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>Mn(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:r.value,value:a})):le);Se.assertNever(i)}};dr.create=(e,t,r)=>new dr({schema:e,typeName:de.ZodEffects,effect:t,...fe(r)});dr.createWithPreprocess=(e,t,r)=>new dr({schema:t,effect:{type:"preprocess",transform:e},typeName:de.ZodEffects,...fe(r)});var lr=class extends he{_parse(t){return this._getType(t)===te.undefined?Rt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};lr.create=(e,t)=>new lr({innerType:e,typeName:de.ZodOptional,...fe(t)});var Or=class extends he{_parse(t){return this._getType(t)===te.null?Rt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Or.create=(e,t)=>new Or({innerType:e,typeName:de.ZodNullable,...fe(t)});var Wn=class extends he{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===te.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Wn.create=(e,t)=>new Wn({innerType:e,typeName:de.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...fe(t)});var Bn=class extends he{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return xs(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Yt(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Yt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Bn.create=(e,t)=>new Bn({innerType:e,typeName:de.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...fe(t)});var Fi=class extends he{_parse(t){if(this._getType(t)!==te.nan){let r=this._getOrReturnCtx(t);return Y(r,{code:K.invalid_type,expected:te.nan,received:r.parsedType}),le}return{status:"valid",value:t.data}}};Fi.create=e=>new Fi({typeName:de.ZodNaN,...fe(e)});var Ss=class extends he{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},ks=class e extends he{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?le:i.status==="dirty"?(r.dirty(),xi(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?le:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:de.ZodPipeline})}},Hn=class extends he{_parse(t){let r=this._def.innerType._parse(t),n=i=>(Mn(i)&&(i.value=Object.freeze(i.value)),i);return xs(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};Hn.create=(e,t)=>new Hn({innerType:e,typeName:de.ZodReadonly,...fe(t)});var CM={object:Lt.lazycreate},de;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(de||(de={}));var EM=Fn.create,RM=Pi.create,NM=Fi.create,jM=Oi.create,AM=Ci.create,MM=Ei.create,FM=Ri.create,zM=zn.create,UM=Un.create,DM=Ni.create,qM=Wr.create,LM=vr.create,KM=ji.create,VM=Br.create,ZM=Lt.create,WM=Lt.strictCreate,BM=Dn.create,HM=Ho.create,GM=qn.create,YM=Pr.create,JM=Yo.create,QM=Ai.create,XM=Mi.create,eF=Jo.create,tF=Ln.create,rF=Kn.create,nF=Vn.create,iF=Zn.create,sF=ln.create,oF=dr.create,aF=lr.create,uF=Or.create,lF=dr.createWithPreprocess,dF=ks.create,cF=Object.freeze({status:"aborted"});function F(e,t,r){function n(a,u){var l;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(l=a._zod).traits??(l.traits=new Set),a._zod.traits.add(e),t(a,u);for(let m in o.prototype)m in a||Object.defineProperty(a,m,{value:o.prototype[m].bind(a)});a._zod.constr=o,a._zod.def=u}let i=r?.Parent??Object;class s extends i{}Object.defineProperty(s,"name",{value:e});function o(a){var u;let l=r?.Parent?new s:this;n(l,a),(u=l._zod).deferred??(u.deferred=[]);for(let m of l._zod.deferred)m();return l}return Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var dn=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Qo={};function Cr(e){return e&&Object.assign(Qo,e),Qo}var Me={};Kd(Me,{unwrapMessage:()=>Si,stringifyPrimitive:()=>pa,required:()=>Eb,randomString:()=>bb,propertyKeyTypes:()=>Pc,promiseAllObject:()=>_b,primitiveTypes:()=>$b,prefixIssues:()=>Zr,pick:()=>kb,partial:()=>Cb,optionalKeys:()=>Oc,omit:()=>Tb,numKeys:()=>wb,nullish:()=>Ms,normalizeParams:()=>ue,merge:()=>Ob,jsonStringifyReplacer:()=>Sc,joinValues:()=>Xo,issue:()=>Ec,isPlainObject:()=>Ui,isObject:()=>zi,getSizableOrigin:()=>Rb,getParsedType:()=>Ib,getLengthableOrigin:()=>zs,getEnumValues:()=>xc,getElementAtPath:()=>vb,floatSafeRemainder:()=>kc,finalizeIssue:()=>Er,extend:()=>Pb,escapeRegex:()=>ti,esc:()=>jn,defineLazy:()=>qe,createTransparentProxy:()=>xb,clone:()=>Rr,cleanRegex:()=>Fs,cleanEnum:()=>Nb,captureStackTrace:()=>fa,cached:()=>As,assignProp:()=>ca,assertNotEqual:()=>mb,assertNever:()=>gb,assertIs:()=>hb,assertEqual:()=>pb,assert:()=>yb,allowsEval:()=>Tc,aborted:()=>An,NUMBER_FORMAT_RANGES:()=>Cc,Class:()=>ea,BIGINT_FORMAT_RANGES:()=>Sb});function pb(e){return e}function mb(e){return e}function hb(e){}function gb(e){throw Error()}function yb(e){}function xc(e){let t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,n])=>t.indexOf(+r)===-1).map(([r,n])=>n)}function Xo(e,t="|"){return e.map(r=>pa(r)).join(t)}function Sc(e,t){return typeof t=="bigint"?t.toString():t}function As(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error("cached value already set")}}}function Ms(e){return e==null}function Fs(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function kc(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,s=Number.parseInt(e.toFixed(i).replace(".","")),o=Number.parseInt(t.toFixed(i).replace(".",""));return s%o/10**i}function qe(e,t,r){Object.defineProperty(e,t,{get(){{let n=r();return e[t]=n,n}throw Error("cached value already set")},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function ca(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function vb(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function _b(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let i={};for(let s=0;s<t.length;s++)i[t[s]]=n[s];return i})}function bb(e=10){let t="";for(let r=0;r<e;r++)t+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return t}function jn(e){return JSON.stringify(e)}var fa=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function zi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Tc=As(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch{return!1}});function Ui(e){if(zi(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let r=t.prototype;return!(zi(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function wb(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var Ib=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw Error(`Unknown data type: ${t}`)}},Pc=new Set(["string","number","symbol"]),$b=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ti(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Rr(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function ue(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}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function xb(e){let t;return new Proxy({},{get(r,n,i){return t??(t=e()),Reflect.get(t,n,i)},set(r,n,i,s){return t??(t=e()),Reflect.set(t,n,i,s)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,i){return t??(t=e()),Reflect.defineProperty(t,n,i)}})}function pa(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Oc(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Cc={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Sb={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function kb(e,t){let r={},n=e._zod.def;for(let i in t){if(!(i in n.shape))throw Error(`Unrecognized key: "${i}"`);t[i]&&(r[i]=n.shape[i])}return Rr(e,{...e._zod.def,shape:r,checks:[]})}function Tb(e,t){let r={...e._zod.def.shape},n=e._zod.def;for(let i in t){if(!(i in n.shape))throw Error(`Unrecognized key: "${i}"`);t[i]&&delete r[i]}return Rr(e,{...e._zod.def,shape:r,checks:[]})}function Pb(e,t){if(!Ui(t))throw Error("Invalid input to extend: expected a plain object");let r={...e._zod.def,get shape(){let n={...e._zod.def.shape,...t};return ca(this,"shape",n),n},checks:[]};return Rr(e,r)}function Ob(e,t){return Rr(e,{...e._zod.def,get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return ca(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}function Cb(e,t,r){let n=t._zod.def.shape,i={...n};if(r)for(let s in r){if(!(s in n))throw Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=e?new e({type:"optional",innerType:n[s]}):n[s])}else for(let s in n)i[s]=e?new e({type:"optional",innerType:n[s]}):n[s];return Rr(t,{...t._zod.def,shape:i,checks:[]})}function Eb(e,t,r){let n=t._zod.def.shape,i={...n};if(r)for(let s in r){if(!(s in i))throw Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=new e({type:"nonoptional",innerType:n[s]}))}else for(let s in n)i[s]=new e({type:"nonoptional",innerType:n[s]});return Rr(t,{...t._zod.def,shape:i,checks:[]})}function An(e,t=0){for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Zr(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Si(e){return typeof e=="string"?e:e?.message}function Er(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let i=Si(e.inst?._zod.def?.error?.(e))??Si(t?.error?.(e))??Si(r.customError?.(e))??Si(r.localeError?.(e))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,!t?.reportInput&&delete n.input,n}function Rb(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function zs(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ec(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function Nb(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}var ea=class{constructor(...t){}},Rc=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,Sc,2)},enumerable:!0})},Nc=F("$ZodError",Rc),Us=F("$ZodError",Rc,{Parent:Error});function jb(e,t=r=>r.message){let r={},n=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}function Ab(e,t){let r=t||function(s){return s.message},n={_errors:[]},i=s=>{for(let o of s.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(a=>i({issues:a}));else if(o.code==="invalid_key")i({issues:o.issues});else if(o.code==="invalid_element")i({issues:o.issues});else if(o.path.length===0)n._errors.push(r(o));else{let a=n,u=0;for(;u<o.path.length;){let l=o.path[u];u!==o.path.length-1?a[l]=a[l]||{_errors:[]}:(a[l]=a[l]||{_errors:[]},a[l]._errors.push(r(o))),a=a[l],u++}}};return i(e),n}var jc=e=>(t,r,n,i)=>{let s=n?Object.assign(n,{async:!1}):{async:!1},o=t._zod.run({value:r,issues:[]},s);if(o instanceof Promise)throw new dn;if(o.issues.length){let a=new(i?.Err??e)(o.issues.map(u=>Er(u,s,Cr())));throw fa(a,i?.callee),a}return o.value},Mb=jc(Us),Ac=e=>async(t,r,n,i)=>{let s=n?Object.assign(n,{async:!0}):{async:!0},o=t._zod.run({value:r,issues:[]},s);if(o instanceof Promise&&(o=await o),o.issues.length){let a=new(i?.Err??e)(o.issues.map(u=>Er(u,s,Cr())));throw fa(a,i?.callee),a}return o.value},Fb=Ac(Us),Mc=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new dn;return s.issues.length?{success:!1,error:new(e??Nc)(s.issues.map(o=>Er(o,i,Cr())))}:{success:!0,data:s.value}},Fc=Mc(Us),zc=e=>async(t,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(o=>Er(o,i,Cr())))}:{success:!0,data:s.value}},Uc=zc(Us),zb=/^[cC][^\s-]{8,}$/,Ub=/^[0-9a-z]+$/,Db=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,qb=/^[0-9a-vA-V]{20}$/,Lb=/^[A-Za-z0-9]{27}$/,Kb=/^[a-zA-Z0-9_-]{21}$/,Vb=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Zb=/^([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})$/,$d=e=>e?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})$`):/^([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)$/,Wb=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function Bb(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var Hb=/^(?:(?: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])$/,Gb=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,Yb=/^((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])$/,Jb=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Qb=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Dc=/^[A-Za-z0-9_-]*$/,Xb=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,ew=/^\+(?:[0-9]){6,14}[0-9]$/,qc="(?:(?:\\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])))",tw=new RegExp(`^${qc}$`);function Lc(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}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function rw(e){return new RegExp(`^${Lc(e)}$`)}function nw(e){let t=Lc({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-]\\d{2}:\\d{2})");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${qc}T(?:${n})$`)}var iw=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},sw=/^\d+$/,ow=/^-?\d+(?:\.\d+)?/i,aw=/true|false/i,uw=/null/i,lw=/^[^A-Z]*$/,dw=/^[^a-z]*$/,Nt=F("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Kc={number:"number",bigint:"bigint",object:"date"},Vc=F("$ZodCheckLessThan",(e,t)=>{Nt.init(e,t);let r=Kc[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,s=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Zc=F("$ZodCheckGreaterThan",(e,t)=>{Nt.init(e,t);let r=Kc[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,s=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),cw=F("$ZodCheckMultipleOf",(e,t)=>{Nt.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):kc(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),fw=F("$ZodCheckNumberFormat",(e,t)=>{Nt.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,s]=Cc[t.format];e._zod.onattach.push(o=>{let a=o._zod.bag;a.format=t.format,a.minimum=i,a.maximum=s,r&&(a.pattern=sw)}),e._zod.check=o=>{let a=o.value;if(r){if(!Number.isInteger(a)){o.issues.push({expected:n,format:t.format,code:"invalid_type",input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?o.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort}):o.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort});return}}a<i&&o.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),a>s&&o.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inst:e})}}),pw=F("$ZodCheckMaxLength",(e,t)=>{Nt.init(e,t),e._zod.when=r=>{let n=r.value;return!Ms(n)&&n.length!==void 0},e._zod.onattach.push(r=>{let n=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let n=r.value;if(n.length<=t.maximum)return;let i=zs(n);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),mw=F("$ZodCheckMinLength",(e,t)=>{Nt.init(e,t),e._zod.when=r=>{let n=r.value;return!Ms(n)&&n.length!==void 0},e._zod.onattach.push(r=>{let n=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let n=r.value;if(n.length>=t.minimum)return;let i=zs(n);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),hw=F("$ZodCheckLengthEquals",(e,t)=>{Nt.init(e,t),e._zod.when=r=>{let n=r.value;return!Ms(n)&&n.length!==void 0},e._zod.onattach.push(r=>{let n=r._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=r=>{let n=r.value,i=n.length;if(i===t.length)return;let s=zs(n),o=i>t.length;r.issues.push({origin:s,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Ds=F("$ZodCheckStringFormat",(e,t)=>{var r,n;Nt.init(e,t),e._zod.onattach.push(i=>{let s=i._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),gw=F("$ZodCheckRegex",(e,t)=>{Ds.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),yw=F("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=lw),Ds.init(e,t)}),vw=F("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=dw),Ds.init(e,t)}),_w=F("$ZodCheckIncludes",(e,t)=>{Nt.init(e,t);let r=ti(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(i=>{let s=i._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),bw=F("$ZodCheckStartsWith",(e,t)=>{Nt.init(e,t);let r=new RegExp(`^${ti(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),ww=F("$ZodCheckEndsWith",(e,t)=>{Nt.init(e,t);let r=new RegExp(`.*${ti(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Iw=F("$ZodCheckOverwrite",(e,t)=>{Nt.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}}),ta=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let r=t.split(`
62
+ `).filter(s=>s),n=Math.min(...r.map(s=>s.length-s.trimStart().length)),i=r.map(s=>s.slice(n)).map(s=>" ".repeat(this.indent*2)+s);for(let s of i)this.content.push(s)}compile(){let t=Function,r=this?.args,n=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...r,n.join(`
63
+ `))}},$w={major:4,minor:0,patch:0},ze=F("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=$w;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let i of n)for(let s of i._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(s,o,a)=>{let u=An(s),l;for(let m of o){if(m._zod.when){if(!m._zod.when(s))continue}else if(u)continue;let v=s.issues.length,w=m._zod.check(s);if(w instanceof Promise&&a?.async===!1)throw new dn;if(l||w instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await w,s.issues.length!==v&&(u||(u=An(s,v)))});else{if(s.issues.length===v)continue;u||(u=An(s,v))}}return l?l.then(()=>s):s};e._zod.run=(s,o)=>{let a=e._zod.parse(s,o);if(a instanceof Promise){if(o.async===!1)throw new dn;return a.then(u=>i(u,n,o))}return i(a,n,o)}}e["~standard"]={validate:i=>{try{let s=Fc(e,i);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return Uc(e,i).then(o=>o.success?{value:o.data}:{issues:o.error?.issues})}},vendor:"zod",version:1}}),ma=F("$ZodString",(e,t)=>{ze.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??iw(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Ve=F("$ZodStringFormat",(e,t)=>{Ds.init(e,t),ma.init(e,t)}),xw=F("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Zb),Ve.init(e,t)}),Sw=F("$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=$d(r))}else t.pattern??(t.pattern=$d());Ve.init(e,t)}),kw=F("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Wb),Ve.init(e,t)}),Tw=F("$ZodURL",(e,t)=>{Ve.init(e,t),e._zod.check=r=>{try{let n=r.value,i=new URL(n),s=i.href;t.hostname&&(t.hostname.lastIndex=0,!t.hostname.test(i.hostname)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Xb.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,!t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),!n.endsWith("/")&&s.endsWith("/")?r.value=s.slice(0,-1):r.value=s;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Pw=F("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Bb()),Ve.init(e,t)}),Ow=F("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Kb),Ve.init(e,t)}),Cw=F("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=zb),Ve.init(e,t)}),Ew=F("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ub),Ve.init(e,t)}),Rw=F("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Db),Ve.init(e,t)}),Nw=F("$ZodXID",(e,t)=>{t.pattern??(t.pattern=qb),Ve.init(e,t)}),jw=F("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Lb),Ve.init(e,t)}),Aw=F("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=nw(t)),Ve.init(e,t)}),Mw=F("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=tw),Ve.init(e,t)}),Fw=F("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=rw(t)),Ve.init(e,t)}),zw=F("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Vb),Ve.init(e,t)}),Uw=F("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Hb),Ve.init(e,t),e._zod.onattach.push(r=>{let n=r._zod.bag;n.format="ipv4"})}),Dw=F("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Gb),Ve.init(e,t),e._zod.onattach.push(r=>{let n=r._zod.bag;n.format="ipv6"}),e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),qw=F("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Yb),Ve.init(e,t)}),Lw=F("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Jb),Ve.init(e,t),e._zod.check=r=>{let[n,i]=r.value.split("/");try{if(!i)throw Error();let s=Number(i);if(`${s}`!==i||s<0||s>128)throw Error();new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Wc(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Kw=F("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Qb),Ve.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),e._zod.check=r=>{Wc(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Vw(e){if(!Dc.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Wc(r)}var Zw=F("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Dc),Ve.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),e._zod.check=r=>{Vw(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Ww=F("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ew),Ve.init(e,t)});function Bw(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}var Hw=F("$ZodJWT",(e,t)=>{Ve.init(e,t),e._zod.check=r=>{Bw(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Bc=F("$ZodNumber",(e,t)=>{ze.init(e,t),e._zod.pattern=e._zod.bag.pattern??ow,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let s=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...s?{received:s}:{}}),r}}),Gw=F("$ZodNumber",(e,t)=>{fw.init(e,t),Bc.init(e,t)}),Yw=F("$ZodBoolean",(e,t)=>{ze.init(e,t),e._zod.pattern=aw,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),Jw=F("$ZodNull",(e,t)=>{ze.init(e,t),e._zod.pattern=uw,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let i=r.value;return i===null||r.issues.push({expected:"null",code:"invalid_type",input:i,inst:e}),r}}),Qw=F("$ZodUnknown",(e,t)=>{ze.init(e,t),e._zod.parse=r=>r}),Xw=F("$ZodNever",(e,t)=>{ze.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function xd(e,t,r){e.issues.length&&t.issues.push(...Zr(r,e.issues)),t.value[r]=e.value}var eI=F("$ZodArray",(e,t)=>{ze.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let s=[];for(let o=0;o<i.length;o++){let a=i[o],u=t.element._zod.run({value:a,issues:[]},n);u instanceof Promise?s.push(u.then(l=>xd(l,r,o))):xd(u,r,o)}return s.length?Promise.all(s).then(()=>r):r}});function vs(e,t,r){e.issues.length&&t.issues.push(...Zr(r,e.issues)),t.value[r]=e.value}function Sd(e,t,r,n){e.issues.length?n[r]===void 0?r in n?t.value[r]=void 0:t.value[r]=e.value:t.issues.push(...Zr(r,e.issues)):e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}var Hc=F("$ZodObject",(e,t)=>{ze.init(e,t);let r=As(()=>{let m=Object.keys(t.shape);for(let w of m)if(!(t.shape[w]instanceof ze))throw Error(`Invalid element at key "${w}": expected a Zod schema`);let v=Oc(t.shape);return{shape:t.shape,keys:m,keySet:new Set(m),numKeys:m.length,optionalKeys:new Set(v)}});qe(e._zod,"propValues",()=>{let m=t.shape,v={};for(let w in m){let I=m[w]._zod;if(I.values){v[w]??(v[w]=new Set);for(let T of I.values)v[w].add(T)}}return v});let n=m=>{let v=new ta(["shape","payload","ctx"]),w=r.value,I=f=>{let p=jn(f);return`shape[${p}]._zod.run({ value: input[${p}], issues: [] }, ctx)`};v.write("const input = payload.value;");let T=Object.create(null),k=0;for(let f of w.keys)T[f]=`key_${k++}`;v.write("const newResult = {}");for(let f of w.keys)if(w.optionalKeys.has(f)){let p=T[f];v.write(`const ${p} = ${I(f)};`);let c=jn(f);v.write(`
64
+ if (${p}.issues.length) {
65
+ if (input[${c}] === undefined) {
66
+ if (${c} in input) {
67
+ newResult[${c}] = undefined;
68
+ }
69
+ } else {
70
+ payload.issues = payload.issues.concat(
71
+ ${p}.issues.map((iss) => ({
72
+ ...iss,
73
+ path: iss.path ? [${c}, ...iss.path] : [${c}],
74
+ }))
75
+ );
76
+ }
77
+ } else if (${p}.value === undefined) {
78
+ if (${c} in input) newResult[${c}] = undefined;
79
+ } else {
80
+ newResult[${c}] = ${p}.value;
81
+ }
82
+ `)}else{let p=T[f];v.write(`const ${p} = ${I(f)};`),v.write(`
83
+ if (${p}.issues.length) payload.issues = payload.issues.concat(${p}.issues.map(iss => ({
84
+ ...iss,
85
+ path: iss.path ? [${jn(f)}, ...iss.path] : [${jn(f)}]
86
+ })));`),v.write(`newResult[${jn(f)}] = ${p}.value`)}v.write("payload.value = newResult;"),v.write("return payload;");let b=v.compile();return(f,p)=>b(m,f,p)},i,s=zi,o=!Qo.jitless,a=o&&Tc.value,u=t.catchall,l;e._zod.parse=(m,v)=>{l??(l=r.value);let w=m.value;if(!s(w))return m.issues.push({expected:"object",code:"invalid_type",input:w,inst:e}),m;let I=[];if(o&&a&&v?.async===!1&&v.jitless!==!0)i||(i=n(t.shape)),m=i(m,v);else{m.value={};let p=l.shape;for(let c of l.keys){let d=p[c],y=d._zod.run({value:w[c],issues:[]},v),h=d._zod.optin==="optional"&&d._zod.optout==="optional";y instanceof Promise?I.push(y.then(_=>h?Sd(_,m,c,w):vs(_,m,c))):h?Sd(y,m,c,w):vs(y,m,c)}}if(!u)return I.length?Promise.all(I).then(()=>m):m;let T=[],k=l.keySet,b=u._zod,f=b.def.type;for(let p of Object.keys(w)){if(k.has(p))continue;if(f==="never"){T.push(p);continue}let c=b.run({value:w[p],issues:[]},v);c instanceof Promise?I.push(c.then(d=>vs(d,m,p))):vs(c,m,p)}return T.length&&m.issues.push({code:"unrecognized_keys",keys:T,input:w,inst:e}),I.length?Promise.all(I).then(()=>m):m}});function kd(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(s=>Er(s,n,Cr())))}),t}var Gc=F("$ZodUnion",(e,t)=>{ze.init(e,t),qe(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),qe(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),qe(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),qe(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){let r=t.options.map(n=>n._zod.pattern);return new RegExp(`^(${r.map(n=>Fs(n.source)).join("|")})$`)}}),e._zod.parse=(r,n)=>{let i=!1,s=[];for(let o of t.options){let a=o._zod.run({value:r.value,issues:[]},n);if(a instanceof Promise)s.push(a),i=!0;else{if(a.issues.length===0)return a;s.push(a)}}return i?Promise.all(s).then(o=>kd(o,r,e,n)):kd(s,r,e,n)}}),tI=F("$ZodDiscriminatedUnion",(e,t)=>{Gc.init(e,t);let r=e._zod.parse;qe(e._zod,"propValues",()=>{let i={};for(let s of t.options){let o=s._zod.propValues;if(!o||Object.keys(o).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[a,u]of Object.entries(o)){i[a]||(i[a]=new Set);for(let l of u)i[a].add(l)}}return i});let n=As(()=>{let i=t.options,s=new Map;for(let o of i){let a=o._zod.propValues[t.discriminator];if(!a||a.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(let u of a){if(s.has(u))throw Error(`Duplicate discriminator value "${String(u)}"`);s.set(u,o)}}return s});e._zod.parse=(i,s)=>{let o=i.value;if(!zi(o))return i.issues.push({code:"invalid_type",expected:"object",input:o,inst:e}),i;let a=n.value.get(o?.[t.discriminator]);return a?a._zod.run(i,s):t.unionFallback?r(i,s):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:o,path:[t.discriminator],inst:e}),i)}}),rI=F("$ZodIntersection",(e,t)=>{ze.init(e,t),e._zod.parse=(r,n)=>{let i=r.value,s=t.left._zod.run({value:i,issues:[]},n),o=t.right._zod.run({value:i,issues:[]},n);return s instanceof Promise||o instanceof Promise?Promise.all([s,o]).then(([a,u])=>Td(r,a,u)):Td(r,s,o)}});function ra(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(Ui(e)&&Ui(t)){let r=Object.keys(t),n=Object.keys(e).filter(s=>r.indexOf(s)!==-1),i={...e,...t};for(let s of n){let o=ra(e[s],t[s]);if(!o.valid)return{valid:!1,mergeErrorPath:[s,...o.mergeErrorPath]};i[s]=o.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let i=e[n],s=t[n],o=ra(i,s);if(!o.valid)return{valid:!1,mergeErrorPath:[n,...o.mergeErrorPath]};r.push(o.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Td(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),An(e))return e;let n=ra(t.value,r.value);if(!n.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}var nI=F("$ZodRecord",(e,t)=>{ze.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Ui(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let s=[];if(t.keyType._zod.values){let o=t.keyType._zod.values;r.value={};for(let u of o)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){let l=t.valueType._zod.run({value:i[u],issues:[]},n);l instanceof Promise?s.push(l.then(m=>{m.issues.length&&r.issues.push(...Zr(u,m.issues)),r.value[u]=m.value})):(l.issues.length&&r.issues.push(...Zr(u,l.issues)),r.value[u]=l.value)}let a;for(let u in i)o.has(u)||(a=a??[],a.push(u));a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:a})}else{r.value={};for(let o of Reflect.ownKeys(i)){if(o==="__proto__")continue;let a=t.keyType._zod.run({value:o,issues:[]},n);if(a instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(a.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(l=>Er(l,n,Cr())),input:o,path:[o],inst:e}),r.value[a.value]=a.value;continue}let u=t.valueType._zod.run({value:i[o],issues:[]},n);u instanceof Promise?s.push(u.then(l=>{l.issues.length&&r.issues.push(...Zr(o,l.issues)),r.value[a.value]=l.value})):(u.issues.length&&r.issues.push(...Zr(o,u.issues)),r.value[a.value]=u.value)}}return s.length?Promise.all(s).then(()=>r):r}}),iI=F("$ZodEnum",(e,t)=>{ze.init(e,t);let r=xc(t.entries);e._zod.values=new Set(r),e._zod.pattern=new RegExp(`^(${r.filter(n=>Pc.has(typeof n)).map(n=>typeof n=="string"?ti(n):n.toString()).join("|")})$`),e._zod.parse=(n,i)=>{let s=n.value;return e._zod.values.has(s)||n.issues.push({code:"invalid_value",values:r,input:s,inst:e}),n}}),sI=F("$ZodLiteral",(e,t)=>{ze.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?ti(r):r?r.toString():String(r)).join("|")})$`),e._zod.parse=(r,n)=>{let i=r.value;return e._zod.values.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),oI=F("$ZodTransform",(e,t)=>{ze.init(e,t),e._zod.parse=(r,n)=>{let i=t.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(s=>(r.value=s,r));if(i instanceof Promise)throw new dn;return r.value=i,r}}),aI=F("$ZodOptional",(e,t)=>{ze.init(e,t),e._zod.optin="optional",e._zod.optout="optional",qe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),qe(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Fs(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>t.innerType._zod.optin==="optional"?t.innerType._zod.run(r,n):r.value===void 0?r:t.innerType._zod.run(r,n)}),uI=F("$ZodNullable",(e,t)=>{ze.init(e,t),qe(e._zod,"optin",()=>t.innerType._zod.optin),qe(e._zod,"optout",()=>t.innerType._zod.optout),qe(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Fs(r.source)}|null)$`):void 0}),qe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),lI=F("$ZodDefault",(e,t)=>{ze.init(e,t),e._zod.optin="optional",qe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(r.value===void 0)return r.value=t.defaultValue,r;let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(s=>Pd(s,t)):Pd(i,t)}});function Pd(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var dI=F("$ZodPrefault",(e,t)=>{ze.init(e,t),e._zod.optin="optional",qe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),cI=F("$ZodNonOptional",(e,t)=>{ze.init(e,t),qe(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(s=>Od(s,e)):Od(i,e)}});function Od(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var fI=F("$ZodCatch",(e,t)=>{ze.init(e,t),e._zod.optin="optional",qe(e._zod,"optout",()=>t.innerType._zod.optout),qe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(s=>(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(o=>Er(o,n,Cr()))},input:r.value}),r.issues=[]),r)):(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(s=>Er(s,n,Cr()))},input:r.value}),r.issues=[]),r)}}),pI=F("$ZodPipe",(e,t)=>{ze.init(e,t),qe(e._zod,"values",()=>t.in._zod.values),qe(e._zod,"optin",()=>t.in._zod.optin),qe(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(r,n)=>{let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(s=>Cd(s,t,n)):Cd(i,t,n)}});function Cd(e,t,r){return An(e)?e:t.out._zod.run({value:e.value,issues:e.issues},r)}var mI=F("$ZodReadonly",(e,t)=>{ze.init(e,t),qe(e._zod,"propValues",()=>t.innerType._zod.propValues),qe(e._zod,"values",()=>t.innerType._zod.values),qe(e._zod,"optin",()=>t.innerType._zod.optin),qe(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(r,n)=>{let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(Ed):Ed(i)}});function Ed(e){return e.value=Object.freeze(e.value),e}var hI=F("$ZodCustom",(e,t)=>{Nt.init(e,t),ze.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,i=t.fn(n);if(i instanceof Promise)return i.then(s=>Rd(s,r,n,e));Rd(i,r,n,e)}});function Rd(e,t,r,n){if(!e){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),t.issues.push(Ec(i))}}var gI=e=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},yI=()=>{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"}};function t(n){return e[n]??null}let r={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",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Invalid input: expected ${n.expected}, received ${gI(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${pa(n.values[0])}`:`Invalid option: expected one of ${Xo(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Too big: expected ${n.origin??"value"} to have ${i}${n.maximum.toString()} ${s.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Too small: expected ${n.origin} to have ${i}${n.minimum.toString()} ${s.unit}`:`Too small: expected ${n.origin} to be ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${Xo(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function vI(){return{localeError:yI()}}var na=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];if(this._map.set(t,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,t)}return this}remove(t){return this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};return delete n.id,{...n,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}};function _I(){return new na}var _s=_I();function bI(e,t){return new e({type:"string",...ue(t)})}function wI(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ue(t)})}function Nd(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ue(t)})}function II(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ue(t)})}function $I(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ue(t)})}function xI(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ue(t)})}function SI(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ue(t)})}function kI(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ue(t)})}function TI(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ue(t)})}function PI(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ue(t)})}function OI(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ue(t)})}function CI(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ue(t)})}function EI(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ue(t)})}function RI(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ue(t)})}function NI(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ue(t)})}function jI(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ue(t)})}function AI(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ue(t)})}function MI(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ue(t)})}function FI(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ue(t)})}function zI(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ue(t)})}function UI(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ue(t)})}function DI(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ue(t)})}function qI(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ue(t)})}function LI(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ue(t)})}function KI(e,t){return new e({type:"string",format:"date",check:"string_format",...ue(t)})}function VI(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ue(t)})}function ZI(e,t){return new e({type:"string",format:"duration",check:"string_format",...ue(t)})}function WI(e,t){return new e({type:"number",checks:[],...ue(t)})}function BI(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ue(t)})}function HI(e,t){return new e({type:"boolean",...ue(t)})}function GI(e,t){return new e({type:"null",...ue(t)})}function YI(e){return new e({type:"unknown"})}function JI(e,t){return new e({type:"never",...ue(t)})}function jd(e,t){return new Vc({check:"less_than",...ue(t),value:e,inclusive:!1})}function Mo(e,t){return new Vc({check:"less_than",...ue(t),value:e,inclusive:!0})}function Ad(e,t){return new Zc({check:"greater_than",...ue(t),value:e,inclusive:!1})}function Fo(e,t){return new Zc({check:"greater_than",...ue(t),value:e,inclusive:!0})}function Md(e,t){return new cw({check:"multiple_of",...ue(t),value:e})}function Yc(e,t){return new pw({check:"max_length",...ue(t),maximum:e})}function Ts(e,t){return new mw({check:"min_length",...ue(t),minimum:e})}function Jc(e,t){return new hw({check:"length_equals",...ue(t),length:e})}function QI(e,t){return new gw({check:"string_format",format:"regex",...ue(t),pattern:e})}function XI(e){return new yw({check:"string_format",format:"lowercase",...ue(e)})}function e$(e){return new vw({check:"string_format",format:"uppercase",...ue(e)})}function t$(e,t){return new _w({check:"string_format",format:"includes",...ue(t),includes:e})}function r$(e,t){return new bw({check:"string_format",format:"starts_with",...ue(t),prefix:e})}function n$(e,t){return new ww({check:"string_format",format:"ends_with",...ue(t),suffix:e})}function Di(e){return new Iw({check:"overwrite",tx:e})}function i$(e){return Di(t=>t.normalize(e))}function s$(){return Di(e=>e.trim())}function o$(){return Di(e=>e.toLowerCase())}function a$(){return Di(e=>e.toUpperCase())}function u$(e,t,r){return new e({type:"array",element:t,...ue(r)})}function l$(e,t,r){let n=ue(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function d$(e,t,r){return new e({type:"custom",check:"custom",fn:t,...ue(r)})}var c$=F("ZodMiniType",(e,t)=>{if(!e._zod)throw Error("Uninitialized schema in ZodMiniType.");ze.init(e,t),e.def=t,e.parse=(r,n)=>Mb(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Fc(e,r,n),e.parseAsync=async(r,n)=>Fb(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Uc(e,r,n),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),e.clone=(r,n)=>Rr(e,r,n),e.brand=()=>e,e.register=(r,n)=>(r.add(e,n),e)}),fF=F("ZodMiniObject",(e,t)=>{Hc.init(e,t),c$.init(e,t),Me.defineLazy(e,"shape",()=>t.shape)});var Qc={};Kd(Qc,{time:()=>sf,duration:()=>af,datetime:()=>ef,date:()=>rf,ZodISOTime:()=>nf,ZodISODuration:()=>of,ZodISODateTime:()=>Xc,ZodISODate:()=>tf});var Xc=F("ZodISODateTime",(e,t)=>{Aw.init(e,t),Ye.init(e,t)});function ef(e){return LI(Xc,e)}var tf=F("ZodISODate",(e,t)=>{Mw.init(e,t),Ye.init(e,t)});function rf(e){return KI(tf,e)}var nf=F("ZodISOTime",(e,t)=>{Fw.init(e,t),Ye.init(e,t)});function sf(e){return VI(nf,e)}var of=F("ZodISODuration",(e,t)=>{zw.init(e,t),Ye.init(e,t)});function af(e){return ZI(of,e)}var uf=(e,t)=>{Nc.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Ab(e,r)},flatten:{value:r=>jb(e,r)},addIssue:{value:r=>e.issues.push(r)},addIssues:{value:r=>e.issues.push(...r)},isEmpty:{get(){return e.issues.length===0}}})},pF=F("ZodError",uf),qs=F("ZodError",uf,{Parent:Error}),f$=jc(qs),p$=Ac(qs),m$=Mc(qs),h$=zc(qs),Ge=F("ZodType",(e,t)=>(ze.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),e.clone=(r,n)=>Rr(e,r,n),e.brand=()=>e,e.register=(r,n)=>(r.add(e,n),e),e.parse=(r,n)=>f$(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>m$(e,r,n),e.parseAsync=async(r,n)=>p$(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>h$(e,r,n),e.spa=e.safeParseAsync,e.refine=(r,n)=>e.check(sx(r,n)),e.superRefine=r=>e.check(ox(r)),e.overwrite=r=>e.check(Di(r)),e.optional=()=>oe(e),e.nullable=()=>Ud(e),e.nullish=()=>oe(Ud(e)),e.nonoptional=r=>J$(e,r),e.array=()=>$e(e),e.or=r=>Ze([e,r]),e.and=r=>ha(e,r),e.transform=r=>sa(e,hf(r)),e.default=r=>H$(e,r),e.prefault=r=>Y$(e,r),e.catch=r=>X$(e,r),e.pipe=r=>sa(e,r),e.readonly=()=>rx(e),e.describe=r=>{let n=e.clone();return _s.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return _s.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return _s.get(e);let n=e.clone();return _s.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),lf=F("_ZodString",(e,t)=>{ma.init(e,t),Ge.init(e,t);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(QI(...n)),e.includes=(...n)=>e.check(t$(...n)),e.startsWith=(...n)=>e.check(r$(...n)),e.endsWith=(...n)=>e.check(n$(...n)),e.min=(...n)=>e.check(Ts(...n)),e.max=(...n)=>e.check(Yc(...n)),e.length=(...n)=>e.check(Jc(...n)),e.nonempty=(...n)=>e.check(Ts(1,...n)),e.lowercase=n=>e.check(XI(n)),e.uppercase=n=>e.check(e$(n)),e.trim=()=>e.check(s$()),e.normalize=(...n)=>e.check(i$(...n)),e.toLowerCase=()=>e.check(o$()),e.toUpperCase=()=>e.check(a$())}),g$=F("ZodString",(e,t)=>{ma.init(e,t),lf.init(e,t),e.email=r=>e.check(wI(y$,r)),e.url=r=>e.check(kI(v$,r)),e.jwt=r=>e.check(qI(N$,r)),e.emoji=r=>e.check(TI(_$,r)),e.guid=r=>e.check(Nd(Fd,r)),e.uuid=r=>e.check(II(bs,r)),e.uuidv4=r=>e.check($I(bs,r)),e.uuidv6=r=>e.check(xI(bs,r)),e.uuidv7=r=>e.check(SI(bs,r)),e.nanoid=r=>e.check(PI(b$,r)),e.guid=r=>e.check(Nd(Fd,r)),e.cuid=r=>e.check(OI(w$,r)),e.cuid2=r=>e.check(CI(I$,r)),e.ulid=r=>e.check(EI($$,r)),e.base64=r=>e.check(zI(C$,r)),e.base64url=r=>e.check(UI(E$,r)),e.xid=r=>e.check(RI(x$,r)),e.ksuid=r=>e.check(NI(S$,r)),e.ipv4=r=>e.check(jI(k$,r)),e.ipv6=r=>e.check(AI(T$,r)),e.cidrv4=r=>e.check(MI(P$,r)),e.cidrv6=r=>e.check(FI(O$,r)),e.e164=r=>e.check(DI(R$,r)),e.datetime=r=>e.check(ef(r)),e.date=r=>e.check(rf(r)),e.time=r=>e.check(sf(r)),e.duration=r=>e.check(af(r))});function A(e){return bI(g$,e)}var Ye=F("ZodStringFormat",(e,t)=>{Ve.init(e,t),lf.init(e,t)}),y$=F("ZodEmail",(e,t)=>{kw.init(e,t),Ye.init(e,t)}),Fd=F("ZodGUID",(e,t)=>{xw.init(e,t),Ye.init(e,t)}),bs=F("ZodUUID",(e,t)=>{Sw.init(e,t),Ye.init(e,t)}),v$=F("ZodURL",(e,t)=>{Tw.init(e,t),Ye.init(e,t)}),_$=F("ZodEmoji",(e,t)=>{Pw.init(e,t),Ye.init(e,t)}),b$=F("ZodNanoID",(e,t)=>{Ow.init(e,t),Ye.init(e,t)}),w$=F("ZodCUID",(e,t)=>{Cw.init(e,t),Ye.init(e,t)}),I$=F("ZodCUID2",(e,t)=>{Ew.init(e,t),Ye.init(e,t)}),$$=F("ZodULID",(e,t)=>{Rw.init(e,t),Ye.init(e,t)}),x$=F("ZodXID",(e,t)=>{Nw.init(e,t),Ye.init(e,t)}),S$=F("ZodKSUID",(e,t)=>{jw.init(e,t),Ye.init(e,t)}),k$=F("ZodIPv4",(e,t)=>{Uw.init(e,t),Ye.init(e,t)}),T$=F("ZodIPv6",(e,t)=>{Dw.init(e,t),Ye.init(e,t)}),P$=F("ZodCIDRv4",(e,t)=>{qw.init(e,t),Ye.init(e,t)}),O$=F("ZodCIDRv6",(e,t)=>{Lw.init(e,t),Ye.init(e,t)}),C$=F("ZodBase64",(e,t)=>{Kw.init(e,t),Ye.init(e,t)}),E$=F("ZodBase64URL",(e,t)=>{Zw.init(e,t),Ye.init(e,t)}),R$=F("ZodE164",(e,t)=>{Ww.init(e,t),Ye.init(e,t)}),N$=F("ZodJWT",(e,t)=>{Hw.init(e,t),Ye.init(e,t)}),df=F("ZodNumber",(e,t)=>{Bc.init(e,t),Ge.init(e,t),e.gt=(n,i)=>e.check(Ad(n,i)),e.gte=(n,i)=>e.check(Fo(n,i)),e.min=(n,i)=>e.check(Fo(n,i)),e.lt=(n,i)=>e.check(jd(n,i)),e.lte=(n,i)=>e.check(Mo(n,i)),e.max=(n,i)=>e.check(Mo(n,i)),e.int=n=>e.check(zd(n)),e.safe=n=>e.check(zd(n)),e.positive=n=>e.check(Ad(0,n)),e.nonnegative=n=>e.check(Fo(0,n)),e.negative=n=>e.check(jd(0,n)),e.nonpositive=n=>e.check(Mo(0,n)),e.multipleOf=(n,i)=>e.check(Md(n,i)),e.step=(n,i)=>e.check(Md(n,i)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function Fe(e){return WI(df,e)}var j$=F("ZodNumberFormat",(e,t)=>{Gw.init(e,t),df.init(e,t)});function zd(e){return BI(j$,e)}var A$=F("ZodBoolean",(e,t)=>{Yw.init(e,t),Ge.init(e,t)});function wt(e){return HI(A$,e)}var M$=F("ZodNull",(e,t)=>{Jw.init(e,t),Ge.init(e,t)});function cf(e){return GI(M$,e)}var F$=F("ZodUnknown",(e,t)=>{Qw.init(e,t),Ge.init(e,t)});function at(){return YI(F$)}var z$=F("ZodNever",(e,t)=>{Xw.init(e,t),Ge.init(e,t)});function U$(e){return JI(z$,e)}var D$=F("ZodArray",(e,t)=>{eI.init(e,t),Ge.init(e,t),e.element=t.element,e.min=(r,n)=>e.check(Ts(r,n)),e.nonempty=r=>e.check(Ts(1,r)),e.max=(r,n)=>e.check(Yc(r,n)),e.length=(r,n)=>e.check(Jc(r,n)),e.unwrap=()=>e.element});function $e(e,t){return u$(D$,e,t)}var ff=F("ZodObject",(e,t)=>{Hc.init(e,t),Ge.init(e,t),Me.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>It(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:at()}),e.loose=()=>e.clone({...e._zod.def,catchall:at()}),e.strict=()=>e.clone({...e._zod.def,catchall:U$()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>Me.extend(e,r),e.merge=r=>Me.merge(e,r),e.pick=r=>Me.pick(e,r),e.omit=r=>Me.omit(e,r),e.partial=(...r)=>Me.partial(gf,e,r[0]),e.required=(...r)=>Me.required(yf,e,r[0])});function H(e,t){let r={type:"object",get shape(){return Me.assignProp(this,"shape",{...e}),this.shape},...Me.normalizeParams(t)};return new ff(r)}function cr(e,t){return new ff({type:"object",get shape(){return Me.assignProp(this,"shape",{...e}),this.shape},catchall:at(),...Me.normalizeParams(t)})}var pf=F("ZodUnion",(e,t)=>{Gc.init(e,t),Ge.init(e,t),e.options=t.options});function Ze(e,t){return new pf({type:"union",options:e,...Me.normalizeParams(t)})}var q$=F("ZodDiscriminatedUnion",(e,t)=>{pf.init(e,t),tI.init(e,t)});function mf(e,t,r){return new q$({type:"union",options:t,discriminator:e,...Me.normalizeParams(r)})}var L$=F("ZodIntersection",(e,t)=>{rI.init(e,t),Ge.init(e,t)});function ha(e,t){return new L$({type:"intersection",left:e,right:t})}var K$=F("ZodRecord",(e,t)=>{nI.init(e,t),Ge.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function ut(e,t,r){return new K$({type:"record",keyType:e,valueType:t,...Me.normalizeParams(r)})}var ia=F("ZodEnum",(e,t)=>{iI.init(e,t),Ge.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,i)=>{let s={};for(let o of n)if(r.has(o))s[o]=t.entries[o];else throw Error(`Key ${o} not found in enum`);return new ia({...t,checks:[],...Me.normalizeParams(i),entries:s})},e.exclude=(n,i)=>{let s={...t.entries};for(let o of n)if(r.has(o))delete s[o];else throw Error(`Key ${o} not found in enum`);return new ia({...t,checks:[],...Me.normalizeParams(i),entries:s})}});function It(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new ia({type:"enum",entries:r,...Me.normalizeParams(t)})}var V$=F("ZodLiteral",(e,t)=>{sI.init(e,t),Ge.init(e,t),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 ae(e,t){return new V$({type:"literal",values:Array.isArray(e)?e:[e],...Me.normalizeParams(t)})}var Z$=F("ZodTransform",(e,t)=>{oI.init(e,t),Ge.init(e,t),e._zod.parse=(r,n)=>{r.addIssue=s=>{if(typeof s=="string")r.issues.push(Me.issue(s,r.value,t));else{let o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),o.continue??(o.continue=!0),r.issues.push(Me.issue(o))}};let i=t.transform(r.value,r);return i instanceof Promise?i.then(s=>(r.value=s,r)):(r.value=i,r)}});function hf(e){return new Z$({type:"transform",transform:e})}var gf=F("ZodOptional",(e,t)=>{aI.init(e,t),Ge.init(e,t),e.unwrap=()=>e._zod.def.innerType});function oe(e){return new gf({type:"optional",innerType:e})}var W$=F("ZodNullable",(e,t)=>{uI.init(e,t),Ge.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Ud(e){return new W$({type:"nullable",innerType:e})}var B$=F("ZodDefault",(e,t)=>{lI.init(e,t),Ge.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function H$(e,t){return new B$({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}var G$=F("ZodPrefault",(e,t)=>{dI.init(e,t),Ge.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Y$(e,t){return new G$({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}var yf=F("ZodNonOptional",(e,t)=>{cI.init(e,t),Ge.init(e,t),e.unwrap=()=>e._zod.def.innerType});function J$(e,t){return new yf({type:"nonoptional",innerType:e,...Me.normalizeParams(t)})}var Q$=F("ZodCatch",(e,t)=>{fI.init(e,t),Ge.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function X$(e,t){return new Q$({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var ex=F("ZodPipe",(e,t)=>{pI.init(e,t),Ge.init(e,t),e.in=t.in,e.out=t.out});function sa(e,t){return new ex({type:"pipe",in:e,out:t})}var tx=F("ZodReadonly",(e,t)=>{mI.init(e,t),Ge.init(e,t)});function rx(e){return new tx({type:"readonly",innerType:e})}var vf=F("ZodCustom",(e,t)=>{hI.init(e,t),Ge.init(e,t)});function nx(e,t){let r=new Nt({check:"custom",...Me.normalizeParams(t)});return r._zod.check=e,r}function ix(e,t){return l$(vf,e??(()=>!0),t)}function sx(e,t={}){return d$(vf,e,t)}function ox(e,t){let r=nx(n=>(n.addIssue=i=>{if(typeof i=="string")n.issues.push(Me.issue(i,n.value,r._zod.def));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),n.issues.push(Me.issue(s))}},e(n.value,n)),t);return r}function _f(e,t){return sa(hf(e),t)}Cr(vI());var ga="io.modelcontextprotocol/related-task",Ls="2.0",yr=ix(e=>e!==null&&(typeof e=="object"||typeof e=="function")),bf=Ze([A(),Fe().int()]),wf=A(),ax=cr({ttl:Ze([Fe(),cf()]).optional(),pollInterval:Fe().optional()}),ya=cr({taskId:A()}),ux=cr({progressToken:bf.optional(),[ga]:ya.optional()}),jt=cr({task:ax.optional(),_meta:ux.optional()}),gt=H({method:A(),params:jt.optional()}),cn=cr({_meta:H({[ga]:oe(ya)}).passthrough().optional()}),Qt=H({method:A(),params:cn.optional()}),$t=cr({_meta:cr({[ga]:ya.optional()}).optional()}),Ks=Ze([A(),Fe().int()]),lx=H({jsonrpc:ae(Ls),id:Ks,...gt.shape}).strict();var dx=H({jsonrpc:ae(Ls),...Qt.shape}).strict();var cx=H({jsonrpc:ae(Ls),id:Ks,result:$t}).strict();var Dd;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(Dd||(Dd={}));var fx=H({jsonrpc:ae(Ls),id:Ks,error:H({code:Fe().int(),message:A(),data:oe(at())})}).strict();var mF=Ze([lx,dx,cx,fx]),If=$t.strict(),px=cn.extend({requestId:Ks,reason:A().optional()}),$f=Qt.extend({method:ae("notifications/cancelled"),params:px}),mx=H({src:A(),mimeType:A().optional(),sizes:$e(A()).optional()}),qi=H({icons:$e(mx).optional()}),Gn=H({name:A(),title:A().optional()}),xf=Gn.extend({...Gn.shape,...qi.shape,version:A(),websiteUrl:A().optional()}),hx=ha(H({applyDefaults:wt().optional()}),ut(A(),at())),gx=_f(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,ha(H({form:hx.optional(),url:yr.optional()}),ut(A(),at()).optional())),yx=H({list:oe(H({}).passthrough()),cancel:oe(H({}).passthrough()),requests:oe(H({sampling:oe(H({createMessage:oe(H({}).passthrough())}).passthrough()),elicitation:oe(H({create:oe(H({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),vx=H({list:oe(H({}).passthrough()),cancel:oe(H({}).passthrough()),requests:oe(H({tools:oe(H({call:oe(H({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),_x=H({experimental:ut(A(),yr).optional(),sampling:H({context:yr.optional(),tools:yr.optional()}).optional(),elicitation:gx.optional(),roots:H({listChanged:wt().optional()}).optional(),tasks:oe(yx)}),bx=jt.extend({protocolVersion:A(),capabilities:_x,clientInfo:xf}),wx=gt.extend({method:ae("initialize"),params:bx}),Ix=H({experimental:ut(A(),yr).optional(),logging:yr.optional(),completions:yr.optional(),prompts:oe(H({listChanged:oe(wt())})),resources:H({subscribe:wt().optional(),listChanged:wt().optional()}).optional(),tools:H({listChanged:wt().optional()}).optional(),tasks:oe(vx)}).passthrough(),$x=$t.extend({protocolVersion:A(),capabilities:Ix,serverInfo:xf,instructions:A().optional()}),xx=Qt.extend({method:ae("notifications/initialized")}),Sf=gt.extend({method:ae("ping")}),Sx=H({progress:Fe(),total:oe(Fe()),message:oe(A())}),kx=H({...cn.shape,...Sx.shape,progressToken:bf}),kf=Qt.extend({method:ae("notifications/progress"),params:kx}),Tx=jt.extend({cursor:wf.optional()}),Li=gt.extend({params:Tx.optional()}),Ki=$t.extend({nextCursor:oe(wf)}),Vi=H({taskId:A(),status:It(["working","input_required","completed","failed","cancelled"]),ttl:Ze([Fe(),cf()]),createdAt:A(),lastUpdatedAt:A(),pollInterval:oe(Fe()),statusMessage:oe(A())}),Tf=$t.extend({task:Vi}),Px=cn.merge(Vi),Pf=Qt.extend({method:ae("notifications/tasks/status"),params:Px}),Of=gt.extend({method:ae("tasks/get"),params:jt.extend({taskId:A()})}),Cf=$t.merge(Vi),Ef=gt.extend({method:ae("tasks/result"),params:jt.extend({taskId:A()})}),Rf=Li.extend({method:ae("tasks/list")}),Nf=Ki.extend({tasks:$e(Vi)}),hF=gt.extend({method:ae("tasks/cancel"),params:jt.extend({taskId:A()})}),gF=$t.merge(Vi),jf=H({uri:A(),mimeType:oe(A()),_meta:ut(A(),at()).optional()}),Af=jf.extend({text:A()}),va=A().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Mf=jf.extend({blob:va}),ri=H({audience:$e(It(["user","assistant"])).optional(),priority:Fe().min(0).max(1).optional(),lastModified:Qc.datetime({offset:!0}).optional()}),Ff=H({...Gn.shape,...qi.shape,uri:A(),description:oe(A()),mimeType:oe(A()),annotations:ri.optional(),_meta:oe(cr({}))}),Ox=H({...Gn.shape,...qi.shape,uriTemplate:A(),description:oe(A()),mimeType:oe(A()),annotations:ri.optional(),_meta:oe(cr({}))}),Cx=Li.extend({method:ae("resources/list")}),Ex=Ki.extend({resources:$e(Ff)}),Rx=Li.extend({method:ae("resources/templates/list")}),Nx=Ki.extend({resourceTemplates:$e(Ox)}),_a=jt.extend({uri:A()}),jx=_a,Ax=gt.extend({method:ae("resources/read"),params:jx}),Mx=$t.extend({contents:$e(Ze([Af,Mf]))}),Fx=Qt.extend({method:ae("notifications/resources/list_changed")}),zx=_a,Ux=gt.extend({method:ae("resources/subscribe"),params:zx}),Dx=_a,qx=gt.extend({method:ae("resources/unsubscribe"),params:Dx}),Lx=cn.extend({uri:A()}),Kx=Qt.extend({method:ae("notifications/resources/updated"),params:Lx}),Vx=H({name:A(),description:oe(A()),required:oe(wt())}),Zx=H({...Gn.shape,...qi.shape,description:oe(A()),arguments:oe($e(Vx)),_meta:oe(cr({}))}),Wx=Li.extend({method:ae("prompts/list")}),Bx=Ki.extend({prompts:$e(Zx)}),Hx=jt.extend({name:A(),arguments:ut(A(),A()).optional()}),Gx=gt.extend({method:ae("prompts/get"),params:Hx}),ba=H({type:ae("text"),text:A(),annotations:ri.optional(),_meta:ut(A(),at()).optional()}),wa=H({type:ae("image"),data:va,mimeType:A(),annotations:ri.optional(),_meta:ut(A(),at()).optional()}),Ia=H({type:ae("audio"),data:va,mimeType:A(),annotations:ri.optional(),_meta:ut(A(),at()).optional()}),Yx=H({type:ae("tool_use"),name:A(),id:A(),input:H({}).passthrough(),_meta:oe(H({}).passthrough())}).passthrough(),Jx=H({type:ae("resource"),resource:Ze([Af,Mf]),annotations:ri.optional(),_meta:ut(A(),at()).optional()}),Qx=Ff.extend({type:ae("resource_link")}),$a=Ze([ba,wa,Ia,Qx,Jx]),Xx=H({role:It(["user","assistant"]),content:$a}),eS=$t.extend({description:oe(A()),messages:$e(Xx)}),tS=Qt.extend({method:ae("notifications/prompts/list_changed")}),rS=H({title:A().optional(),readOnlyHint:wt().optional(),destructiveHint:wt().optional(),idempotentHint:wt().optional(),openWorldHint:wt().optional()}),nS=H({taskSupport:It(["required","optional","forbidden"]).optional()}),zf=H({...Gn.shape,...qi.shape,description:A().optional(),inputSchema:H({type:ae("object"),properties:ut(A(),yr).optional(),required:$e(A()).optional()}).catchall(at()),outputSchema:H({type:ae("object"),properties:ut(A(),yr).optional(),required:$e(A()).optional()}).catchall(at()).optional(),annotations:oe(rS),execution:oe(nS),_meta:ut(A(),at()).optional()}),iS=Li.extend({method:ae("tools/list")}),sS=Ki.extend({tools:$e(zf)}),Uf=$t.extend({content:$e($a).default([]),structuredContent:ut(A(),at()).optional(),isError:oe(wt())}),yF=Uf.or($t.extend({toolResult:at()})),oS=jt.extend({name:A(),arguments:oe(ut(A(),at()))}),aS=gt.extend({method:ae("tools/call"),params:oS}),uS=Qt.extend({method:ae("notifications/tools/list_changed")}),Df=It(["debug","info","notice","warning","error","critical","alert","emergency"]),lS=jt.extend({level:Df}),dS=gt.extend({method:ae("logging/setLevel"),params:lS}),cS=cn.extend({level:Df,logger:A().optional(),data:at()}),fS=Qt.extend({method:ae("notifications/message"),params:cS}),pS=H({name:A().optional()}),mS=H({hints:oe($e(pS)),costPriority:oe(Fe().min(0).max(1)),speedPriority:oe(Fe().min(0).max(1)),intelligencePriority:oe(Fe().min(0).max(1))}),hS=H({mode:oe(It(["auto","required","none"]))}),gS=H({type:ae("tool_result"),toolUseId:A().describe("The unique identifier for the corresponding tool call."),content:$e($a).default([]),structuredContent:H({}).passthrough().optional(),isError:oe(wt()),_meta:oe(H({}).passthrough())}).passthrough(),yS=mf("type",[ba,wa,Ia]),Ps=mf("type",[ba,wa,Ia,Yx,gS]),vS=H({role:It(["user","assistant"]),content:Ze([Ps,$e(Ps)]),_meta:oe(H({}).passthrough())}).passthrough(),_S=jt.extend({messages:$e(vS),modelPreferences:mS.optional(),systemPrompt:A().optional(),includeContext:It(["none","thisServer","allServers"]).optional(),temperature:Fe().optional(),maxTokens:Fe().int(),stopSequences:$e(A()).optional(),metadata:yr.optional(),tools:oe($e(zf)),toolChoice:oe(hS)}),bS=gt.extend({method:ae("sampling/createMessage"),params:_S}),wS=$t.extend({model:A(),stopReason:oe(It(["endTurn","stopSequence","maxTokens"]).or(A())),role:It(["user","assistant"]),content:yS}),IS=$t.extend({model:A(),stopReason:oe(It(["endTurn","stopSequence","maxTokens","toolUse"]).or(A())),role:It(["user","assistant"]),content:Ze([Ps,$e(Ps)])}),$S=H({type:ae("boolean"),title:A().optional(),description:A().optional(),default:wt().optional()}),xS=H({type:ae("string"),title:A().optional(),description:A().optional(),minLength:Fe().optional(),maxLength:Fe().optional(),format:It(["email","uri","date","date-time"]).optional(),default:A().optional()}),SS=H({type:It(["number","integer"]),title:A().optional(),description:A().optional(),minimum:Fe().optional(),maximum:Fe().optional(),default:Fe().optional()}),kS=H({type:ae("string"),title:A().optional(),description:A().optional(),enum:$e(A()),default:A().optional()}),TS=H({type:ae("string"),title:A().optional(),description:A().optional(),oneOf:$e(H({const:A(),title:A()})),default:A().optional()}),PS=H({type:ae("string"),title:A().optional(),description:A().optional(),enum:$e(A()),enumNames:$e(A()).optional(),default:A().optional()}),OS=Ze([kS,TS]),CS=H({type:ae("array"),title:A().optional(),description:A().optional(),minItems:Fe().optional(),maxItems:Fe().optional(),items:H({type:ae("string"),enum:$e(A())}),default:$e(A()).optional()}),ES=H({type:ae("array"),title:A().optional(),description:A().optional(),minItems:Fe().optional(),maxItems:Fe().optional(),items:H({anyOf:$e(H({const:A(),title:A()}))}),default:$e(A()).optional()}),RS=Ze([CS,ES]),NS=Ze([PS,OS,RS]),jS=Ze([NS,$S,xS,SS]),AS=jt.extend({mode:ae("form").optional(),message:A(),requestedSchema:H({type:ae("object"),properties:ut(A(),jS),required:$e(A()).optional()})}),MS=jt.extend({mode:ae("url"),message:A(),elicitationId:A(),url:A().url()}),FS=Ze([AS,MS]),zS=gt.extend({method:ae("elicitation/create"),params:FS}),US=cn.extend({elicitationId:A()}),DS=Qt.extend({method:ae("notifications/elicitation/complete"),params:US}),qS=$t.extend({action:It(["accept","decline","cancel"]),content:_f(e=>e===null?void 0:e,ut(A(),Ze([A(),Fe(),wt(),$e(A())])).optional())}),LS=H({type:ae("ref/resource"),uri:A()}),KS=H({type:ae("ref/prompt"),name:A()}),VS=jt.extend({ref:Ze([KS,LS]),argument:H({name:A(),value:A()}),context:H({arguments:ut(A(),A()).optional()}).optional()}),ZS=gt.extend({method:ae("completion/complete"),params:VS});var WS=$t.extend({completion:cr({values:$e(A()).max(100),total:oe(Fe().int()),hasMore:oe(wt())})}),BS=H({uri:A().startsWith("file://"),name:A().optional(),_meta:ut(A(),at()).optional()}),HS=gt.extend({method:ae("roots/list")}),GS=$t.extend({roots:$e(BS)}),YS=Qt.extend({method:ae("notifications/roots/list_changed")}),vF=Ze([Sf,wx,ZS,dS,Gx,Wx,Cx,Rx,Ax,Ux,qx,aS,iS,Of,Ef,Rf]),_F=Ze([$f,kf,xx,YS,Pf]),bF=Ze([If,wS,IS,qS,GS,Cf,Nf,Tf]),wF=Ze([Sf,bS,zS,HS,Of,Ef,Rf]),IF=Ze([$f,kf,fS,Kx,Fx,uS,tS,Pf,DS]),$F=Ze([If,$x,WS,eS,Bx,Ex,Nx,Mx,Uf,sS,Cf,Nf,Tf]);var xF=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var SF=Ld(Yd(),1),kF=Ld(Rv(),1);var qd;(function(e){e.Completable="McpCompletable"})(qd||(qd={}));function qf({prompt:e,options:t}){let{systemPrompt:r,settingSources:n,sandbox:i,...s}=t??{},o,a;r===void 0?o="":typeof r=="string"?o=r:r.type==="preset"&&(a=r.append);let u=s.pathToClaudeCodeExecutable;if(!u){let Ke=(0,Jd.fileURLToPath)(JS.url),dt=(0,Uo.join)(Ke,"..");u=(0,Uo.join)(dt,"cli.js")}process.env.CLAUDE_AGENT_SDK_VERSION="0.2.37";let{abortController:l=Xd(),additionalDirectories:m=[],agent:v,agents:w,allowedTools:I=[],betas:T,canUseTool:k,continue:b,cwd:f,debug:p,debugFile:c,disallowedTools:d=[],tools:y,env:h,executable:_=vc()?"bun":"node",executableArgs:$=[],extraArgs:E={},fallbackModel:q,enableFileCheckpointing:z,forkSession:L,hooks:W,includePartialMessages:X,persistSession:G,maxThinkingTokens:Je,maxTurns:rt,maxBudgetUsd:lt,mcpServers:ye,model:Z,outputFormat:P,permissionMode:U="default",allowDangerouslySkipPermissions:R=!1,permissionPromptToolName:g,plugins:x,resume:M,resumeSessionAt:re,sessionId:se,stderr:xe,strictMcpConfig:_e}=s,Le=P?.type==="json_schema"?P.schema:void 0,O=h;if(O||(O={...process.env}),O.CLAUDE_CODE_ENTRYPOINT||(O.CLAUDE_CODE_ENTRYPOINT="sdk-ts"),z&&(O.CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING="true"),!u)throw Error("pathToClaudeCodeExecutable is required");let C={},D=new Map;if(ye)for(let[Ke,dt]of Object.entries(ye))dt.type==="sdk"&&"instance"in dt?(D.set(Ke,dt.instance),C[Ke]={type:"sdk",name:Ke}):C[Ke]=dt;let B=typeof e=="string",ne=new Lo({abortController:l,additionalDirectories:m,agent:v,betas:T,cwd:f,debug:p,debugFile:c,executable:_,executableArgs:$,extraArgs:E,pathToClaudeCodeExecutable:u,env:O,forkSession:L,stderr:xe,maxThinkingTokens:Je,maxTurns:rt,maxBudgetUsd:lt,model:Z,fallbackModel:q,jsonSchema:Le,permissionMode:U,allowDangerouslySkipPermissions:R,permissionPromptToolName:g,continueConversation:b,resume:M,resumeSessionAt:re,sessionId:se,settingSources:n??[],allowedTools:I,disallowedTools:d,tools:y,mcpServers:C,strictMcpConfig:_e,canUseTool:!!k,hooks:!!W,includePartialMessages:X,persistSession:G,plugins:x,sandbox:i,spawnClaudeCodeProcess:s.spawnClaudeCodeProcess}),pe=new Zo(ne,B,k,W,l,D,Le,{systemPrompt:o,appendSystemPrompt:a,agents:w});return typeof e=="string"?ne.write(gr({type:"user",session_id:"",message:{role:"user",content:[{type:"text",text:e}]},parent_tool_use_id:null})+`
87
+ `):pe.streamInput(e),pe}var xa=Ca(require("crypto"),1);var Lf="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var QS=128,fn,ni,XS=e=>{!fn||fn.length<e?(fn=Buffer.allocUnsafe(e*QS),xa.default.randomFillSync(fn),ni=0):ni+e>fn.length&&(xa.default.randomFillSync(fn),ni=0),ni+=e};var Kf=(e=21)=>{XS(e|=0);let t="";for(let r=ni-e;r<ni;r++)t+=Lf[fn[r]&63];return t};var Vf=200,Sa=class{queue=[];resolve=null;done=!1;push(t,r){let n={type:"user",message:{role:"user",content:t},parent_tool_use_id:null,session_id:r};this.queue.push(n),this.resolve&&(this.resolve(),this.resolve=null)}end(){this.done=!0,this.resolve&&(this.resolve(),this.resolve=null)}async*[Symbol.asyncIterator](){for(;;){for(;this.queue.length>0;)yield this.queue.shift();if(this.done)return;await new Promise(t=>{this.resolve=t})}}},Vs=class e{id;name;claudeSessionId;prompt;workdir;model;maxBudgetUsd;systemPrompt;allowedTools;permissionMode;resumeSessionId;forkSession;multiTurn;messageStream;queryHandle;idleTimer;safetyNetTimer;static SAFETY_NET_IDLE_MS=15e3;status="starting";error;startedAt;completedAt;abortController;outputBuffer=[];result;costUsd=0;foregroundChannels=new Set;fgOutputOffsets=new Map;originChannel;budgetExhausted=!1;waitingForInputFired=!1;onOutput;onToolUse;onBudgetExhausted;onComplete;onWaitingForInput;constructor(t,r){this.id=Kf(8),this.name=r,this.prompt=t.prompt,this.workdir=t.workdir,this.model=t.model,this.maxBudgetUsd=t.maxBudgetUsd,this.systemPrompt=t.systemPrompt,this.allowedTools=t.allowedTools,this.permissionMode=t.permissionMode??He.permissionMode??"bypassPermissions",this.originChannel=t.originChannel,this.resumeSessionId=t.resumeSessionId,this.forkSession=t.forkSession,this.multiTurn=t.multiTurn??!1,this.startedAt=Date.now(),this.abortController=new AbortController}async start(){let t;try{let r={cwd:this.workdir,model:this.model,maxBudgetUsd:this.maxBudgetUsd,permissionMode:this.permissionMode,allowDangerouslySkipPermissions:this.permissionMode==="bypassPermissions",allowedTools:this.allowedTools,includePartialMessages:!0,abortController:this.abortController,...this.systemPrompt?{systemPrompt:this.systemPrompt}:{}};this.resumeSessionId&&(r.resume=this.resumeSessionId,this.forkSession&&(r.forkSession=!0));let n;this.multiTurn?(this.messageStream=new Sa,this.messageStream.push(this.prompt,""),n=this.messageStream):n=this.prompt,t=qf({prompt:n,options:r}),this.queryHandle=t}catch(r){this.status="failed",this.error=r?.message??String(r),this.completedAt=Date.now();return}this.consumeMessages(t).catch(r=>{(this.status==="starting"||this.status==="running")&&(this.status="failed",this.error=r?.message??String(r),this.completedAt=Date.now())})}resetSafetyNetTimer(){this.clearSafetyNetTimer(),this.safetyNetTimer=setTimeout(()=>{this.safetyNetTimer=void 0,this.status==="running"&&this.onWaitingForInput&&!this.waitingForInputFired&&(console.log(`[Session] ${this.id} no messages for ${e.SAFETY_NET_IDLE_MS/1e3}s \u2014 firing onWaitingForInput (safety-net)`),this.waitingForInputFired=!0,this.onWaitingForInput(this))},e.SAFETY_NET_IDLE_MS)}clearSafetyNetTimer(){this.safetyNetTimer&&(clearTimeout(this.safetyNetTimer),this.safetyNetTimer=void 0)}resetIdleTimer(){if(this.idleTimer&&clearTimeout(this.idleTimer),!this.multiTurn)return;let t=(He.idleTimeoutMinutes??30)*60*1e3;this.idleTimer=setTimeout(()=>{this.status==="running"&&(console.log(`[Session] ${this.id} idle timeout reached (${He.idleTimeoutMinutes??30}min), auto-killing`),this.kill())},t)}async sendMessage(t){if(this.status!=="running")throw new Error(`Session is not running (status: ${this.status})`);if(this.resetIdleTimer(),this.waitingForInputFired=!1,this.multiTurn&&this.messageStream)this.messageStream.push(t,this.claudeSessionId??"");else if(this.queryHandle&&typeof this.queryHandle.streamInput=="function"){let r={type:"user",message:{role:"user",content:t},parent_tool_use_id:null,session_id:this.claudeSessionId??""};async function*n(){yield r}await this.queryHandle.streamInput(n())}else throw new Error("Session does not support multi-turn messaging. Launch with multiTurn: true or use the SDK streamInput.")}async interrupt(){this.queryHandle&&typeof this.queryHandle.interrupt=="function"&&await this.queryHandle.interrupt()}async consumeMessages(t){for await(let r of t)if(this.resetSafetyNetTimer(),r.type==="system"&&r.subtype==="init")this.claudeSessionId=r.session_id,this.status="running",this.resetIdleTimer();else if(r.type==="assistant"){this.waitingForInputFired=!1;let n=r.message?.content??[];console.log(`[Session] ${this.id} assistant message received, blocks=${n.length}, fgChannels=${JSON.stringify([...this.foregroundChannels])}`);for(let i of n)if(i.type==="text"){let s=i.text;this.outputBuffer.push(s),this.outputBuffer.length>Vf&&this.outputBuffer.splice(0,this.outputBuffer.length-Vf),this.onOutput?(console.log(`[Session] ${this.id} calling onOutput, textLen=${s.length}`),this.onOutput(s)):console.log(`[Session] ${this.id} onOutput callback NOT set`)}else i.type==="tool_use"&&(this.onToolUse?(console.log(`[Session] ${this.id} calling onToolUse, tool=${i.name}`),this.onToolUse(i.name,i.input)):console.log(`[Session] ${this.id} onToolUse callback NOT set`))}else r.type==="result"&&(this.result={subtype:r.subtype,duration_ms:r.duration_ms,total_cost_usd:r.total_cost_usd,num_turns:r.num_turns,result:r.result,is_error:r.is_error,session_id:r.session_id},this.costUsd=r.total_cost_usd,this.multiTurn&&this.messageStream&&r.subtype==="success"?(console.log(`[Session] ${this.id} multi-turn end-of-turn (turn ${r.num_turns}), staying open`),this.clearSafetyNetTimer(),this.resetIdleTimer(),this.onWaitingForInput&&!this.waitingForInputFired&&(console.log(`[Session] ${this.id} calling onWaitingForInput`),this.waitingForInputFired=!0,this.onWaitingForInput(this))):(this.clearSafetyNetTimer(),this.idleTimer&&clearTimeout(this.idleTimer),this.status=r.subtype==="success"?"completed":"failed",this.completedAt=Date.now(),this.messageStream&&this.messageStream.end(),r.subtype==="error_max_budget_usd"&&(this.budgetExhausted=!0,this.onBudgetExhausted&&this.onBudgetExhausted(this)),this.onComplete?(console.log(`[Session] ${this.id} calling onComplete, status=${this.status}`),this.onComplete(this)):console.log(`[Session] ${this.id} onComplete callback NOT set`)))}kill(){this.status!=="starting"&&this.status!=="running"||(this.idleTimer&&clearTimeout(this.idleTimer),this.clearSafetyNetTimer(),this.status="killed",this.completedAt=Date.now(),this.messageStream&&this.messageStream.end(),this.abortController.abort())}getOutput(t){return t===void 0?this.outputBuffer.slice():this.outputBuffer.slice(-t)}getCatchupOutput(t){let r=this.fgOutputOffsets.get(t)??0,n=this.outputBuffer.length;return r>=n?[]:this.outputBuffer.slice(r)}markFgOutputSeen(t){this.fgOutputOffsets.set(t,this.outputBuffer.length)}saveFgOutputOffset(t){this.fgOutputOffsets.set(t,this.outputBuffer.length)}get duration(){return(this.completedAt??Date.now())-this.startedAt}};var ek=3600*1e3,Zs=class{sessions=new Map;maxSessions;maxPersistedSessions;notificationRouter=null;persistedSessions=new Map;_metrics={totalCostUsd:0,costPerDay:new Map,sessionsByStatus:{completed:0,failed:0,killed:0},totalLaunched:0,totalDurationMs:0,sessionsWithDuration:0,mostExpensive:null};constructor(t=5,r=50){this.maxSessions=t,this.maxPersistedSessions=r}uniqueName(t){let r=new Set([...this.sessions.values()].map(i=>i.name));if(!r.has(t))return t;let n=2;for(;r.has(`${t}-${n}`);)n++;return`${t}-${n}`}spawn(t){if([...this.sessions.values()].filter(o=>o.status==="starting"||o.status==="running").length>=this.maxSessions)throw new Error(`Max sessions reached (${this.maxSessions}). Kill a session first.`);let n=t.name||Hl(t.prompt),i=this.uniqueName(n),s=new Vs(t,i);if(this.sessions.set(s.id,s),this._metrics.totalLaunched++,this.notificationRouter){let o=this.notificationRouter;console.log(`[SessionManager] Wiring notification callbacks for session=${s.id} (${s.name}), originChannel=${s.originChannel}`),s.onOutput=a=>{console.log(`[SessionManager] session.onOutput fired for session=${s.id}, textLen=${a.length}, fgChannels=${JSON.stringify([...s.foregroundChannels])}`),o.onAssistantText(s,a);for(let u of s.foregroundChannels)s.markFgOutputSeen(u)},s.onToolUse=(a,u)=>{console.log(`[SessionManager] session.onToolUse fired for session=${s.id}, tool=${a}`),o.onToolUse(s,a,u)},s.onBudgetExhausted=()=>{console.log(`[SessionManager] session.onBudgetExhausted fired for session=${s.id}`),o.onBudgetExhausted(s,s.originChannel)},s.onWaitingForInput=()=>{console.log(`[SessionManager] session.onWaitingForInput fired for session=${s.id}`),o.onWaitingForInput(s,s.originChannel),this.triggerWaitingForInputEvent(s)},s.onComplete=()=>{console.log(`[SessionManager] session.onComplete fired for session=${s.id}, budgetExhausted=${s.budgetExhausted}`),this.persistSession(s),s.budgetExhausted||o.onSessionComplete(s,s.originChannel),this.triggerAgentEvent(s)}}else console.warn(`[SessionManager] No NotificationRouter available when spawning session=${s.id} (${s.name})`);return s.start(),s}persistSession(t){if(this.persistedSessions.has(t.id)||this.recordSessionMetrics(t),!t.claudeSessionId)return;let n={claudeSessionId:t.claudeSessionId,name:t.name,prompt:t.prompt,workdir:t.workdir,model:t.model,completedAt:t.completedAt,status:t.status,costUsd:t.costUsd};this.persistedSessions.set(t.id,n),this.persistedSessions.set(t.name,n),this.persistedSessions.set(t.claudeSessionId,n),console.log(`[SessionManager] Persisted session ${t.name} [${t.id}] -> claudeSessionId=${t.claudeSessionId}`)}recordSessionMetrics(t){let r=t.costUsd??0,n=t.status;this._metrics.totalCostUsd+=r;let i=new Date(t.completedAt??t.startedAt).toISOString().slice(0,10);if(this._metrics.costPerDay.set(i,(this._metrics.costPerDay.get(i)??0)+r),(n==="completed"||n==="failed"||n==="killed")&&this._metrics.sessionsByStatus[n]++,t.completedAt){let s=t.completedAt-t.startedAt;this._metrics.totalDurationMs+=s,this._metrics.sessionsWithDuration++}(!this._metrics.mostExpensive||r>this._metrics.mostExpensive.costUsd)&&(this._metrics.mostExpensive={id:t.id,name:t.name,costUsd:r,prompt:t.prompt.length>80?t.prompt.slice(0,80)+"...":t.prompt})}getMetrics(){return this._metrics}triggerAgentEvent(t){let r=t.status,i=t.getOutput(5).join(`
88
+ `);i.length>500&&(i=i.slice(-500));let s=["Claude Code session completed.",`Name: ${t.name} | ID: ${t.id}`,`Status: ${r}`,"","Output preview:",i,"",`Use claude_output(session='${t.id}', full=true) to get the full result and transmit the analysis to the user.`].join(`
89
+ `);console.log(`[SessionManager] Triggering agent event for session=${t.id}`),(0,ka.execFile)("openclaw",["system","event","--text",s,"--mode","now"],(o,a,u)=>{o?(console.error(`[SessionManager] Failed to trigger agent event for session=${t.id}: ${o.message}`),u&&console.error(`[SessionManager] stderr: ${u}`)):console.log(`[SessionManager] Agent event triggered for session=${t.id}`)})}triggerWaitingForInputEvent(t){let n=t.getOutput(5).join(`
90
+ `);n.length>500&&(n=n.slice(-500));let s=[`${t.multiTurn?"Multi-turn session":"Session"} is waiting for input.`,`Name: ${t.name} | ID: ${t.id}`,"","Last output:",n,"",`Use claude_respond(session='${t.id}', message='...') to send a reply, or claude_output(session='${t.id}') to see full context.`].join(`
91
+ `);console.log(`[SessionManager] Triggering waiting-for-input event for session=${t.id} (multiTurn=${t.multiTurn})`),(0,ka.execFile)("openclaw",["system","event","--text",s,"--mode","now"],(o,a,u)=>{o?(console.error(`[SessionManager] Failed to trigger waiting-for-input event for session=${t.id}: ${o.message}`),u&&console.error(`[SessionManager] stderr: ${u}`)):console.log(`[SessionManager] Waiting-for-input event triggered for session=${t.id}`)})}resolveClaudeSessionId(t){let r=this.resolve(t);if(r?.claudeSessionId)return r.claudeSessionId;let n=this.persistedSessions.get(t);if(n?.claudeSessionId)return n.claudeSessionId;if(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t))return t}getPersistedSession(t){return this.persistedSessions.get(t)}listPersistedSessions(){let t=new Set,r=[];for(let n of this.persistedSessions.values())t.has(n.claudeSessionId)||(t.add(n.claudeSessionId),r.push(n));return r.sort((n,i)=>(i.completedAt??0)-(n.completedAt??0))}resolve(t){let r=this.sessions.get(t);if(r)return r;for(let n of this.sessions.values())if(n.name===t)return n}get(t){return this.sessions.get(t)}list(t){let r=[...this.sessions.values()];return t&&t!=="all"&&(r=r.filter(n=>n.status===t)),r.sort((n,i)=>i.startedAt-n.startedAt)}kill(t){let r=this.sessions.get(t);return r?(r.kill(),this.persistedSessions.has(r.id)||this.recordSessionMetrics(r),this.persistSession(r),this.notificationRouter&&this.notificationRouter.onSessionComplete(r,r.originChannel),this.triggerAgentEvent(r),!0):!1}killAll(){for(let t of this.sessions.values())(t.status==="starting"||t.status==="running")&&t.kill()}cleanup(){let t=Date.now();for(let[n,i]of this.sessions)i.completedAt&&(i.status==="completed"||i.status==="failed"||i.status==="killed")&&t-i.completedAt>ek&&(this.persistSession(i),this.sessions.delete(n));let r=this.listPersistedSessions();if(r.length>this.maxPersistedSessions){let n=r.slice(this.maxPersistedSessions);for(let i of n)for(let[s,o]of this.persistedSessions)o.claudeSessionId===i.claudeSessionId&&this.persistedSessions.delete(s);console.log(`[SessionManager] Evicted ${n.length} oldest persisted sessions (cap=${this.maxPersistedSessions})`)}}};var Zf=500,tk=600*1e3,Ws=class{sendMessage;debounceMap=new Map;longRunningReminded=new Set;reminderInterval=null;getActiveSessions=null;constructor(t){this.sendMessage=(r,n)=>{console.log(`[NotificationRouter] sendMessage -> channel=${r}, textLen=${n.length}, preview=${n.slice(0,120)}`),t(r,n)},console.log("[NotificationRouter] Initialized")}startReminderCheck(t){this.getActiveSessions=t,this.reminderInterval=setInterval(()=>this.checkLongRunning(),6e4)}stop(){this.reminderInterval&&(clearInterval(this.reminderInterval),this.reminderInterval=null);for(let[t,r]of this.debounceMap)if(clearTimeout(r.timer),r.buffer){let[n,i]=t.split("|",2);this.sendMessage(i,r.buffer)}this.debounceMap.clear(),this.longRunningReminded.clear()}onAssistantText(t,r){if(console.log(`[NotificationRouter] onAssistantText session=${t.id} (${t.name}), fgChannels=${JSON.stringify([...t.foregroundChannels])}, textLen=${r.length}`),t.foregroundChannels.size===0){console.log("[NotificationRouter] onAssistantText SKIPPED \u2014 no foreground channels");return}for(let n of t.foregroundChannels)console.log(`[NotificationRouter] appendDebounced -> session=${t.id}, channel=${n}`),this.appendDebounced(t.id,n,r)}onToolUse(t,r,n){if(console.log(`[NotificationRouter] onToolUse session=${t.id}, tool=${r}, fgChannels=${JSON.stringify([...t.foregroundChannels])}`),t.foregroundChannels.size===0)return;let i=nk(n),s=`\u{1F527} ${r}${i?` \u2014 ${i}`:""}`;for(let o of t.foregroundChannels)this.flushDebounced(t.id,o),this.sendMessage(o,s)}onSessionComplete(t,r){console.log(`[NotificationRouter] onSessionComplete session=${t.id} (${t.name}), status=${t.status}, originChannel=${r}, fgChannels=${JSON.stringify([...t.foregroundChannels])}`);for(let s of t.foregroundChannels)this.flushDebounced(t.id,s);let n=rk(t),i=new Set(t.foregroundChannels);r&&i.add(r);for(let s of i)this.sendMessage(s,n);this.cleanupSession(t.id)}onBudgetExhausted(t,r){for(let o of t.foregroundChannels)this.flushDebounced(t.id,o);let n=ht(t.duration),i=[`\u26D4 Session limit reached \u2014 ${t.name} [${t.id}] (${n})`,` \u{1F4C1} ${t.workdir}`].join(`
92
+ `),s=new Set(t.foregroundChannels);r&&s.add(r);for(let o of s)this.sendMessage(o,i);this.cleanupSession(t.id)}onWaitingForInput(t,r){console.log(`[NotificationRouter] onWaitingForInput session=${t.id} (${t.name}), originChannel=${r}, fgChannels=${JSON.stringify([...t.foregroundChannels])}`);for(let a of t.foregroundChannels)this.flushDebounced(t.id,a);let i=t.getOutput(5).join(`
93
+ `);i.length>500&&(i=i.slice(-500));let s=new Set(t.foregroundChannels),o=new Set(t.foregroundChannels);r&&o.add(r);for(let a of o)if(!s.has(a)){let l=[`\u{1F514} [${t.name}] Claude asks:`,i||"(no output captured)"].join(`
94
+ `);this.sendMessage(a,l)}else{let l=ht(t.duration),m=[`\u{1F4AC} Session ${t.name} [${t.id}] is waiting for input (${l})`," Use claude_respond to reply."].join(`
95
+ `);this.sendMessage(a,m)}}emitToChannel(t,r){this.sendMessage(t,r)}checkLongRunning(){if(!this.getActiveSessions)return;let t=this.getActiveSessions(),r=Date.now();for(let n of t)if((n.status==="running"||n.status==="starting")&&n.foregroundChannels.size===0&&!this.longRunningReminded.has(n.id)&&r-n.startedAt>tk){this.longRunningReminded.add(n.id);let i=ht(r-n.startedAt),s=[`\u23F1\uFE0F Session ${n.name} [${n.id}] running for ${i}`,` \u{1F4C1} ${n.workdir}`," Use claude_fg to check on it, or claude_kill to stop it."].join(`
96
+ `);n.originChannel&&this.sendMessage(n.originChannel,s)}}debounceKey(t,r){return`${t}|${r}`}appendDebounced(t,r,n){let i=this.debounceKey(t,r),s=this.debounceMap.get(i);if(s)clearTimeout(s.timer),s.buffer+=n,s.timer=setTimeout(()=>{this.flushDebounced(t,r)},Zf);else{let o=setTimeout(()=>{this.flushDebounced(t,r)},Zf);this.debounceMap.set(i,{buffer:n,timer:o})}}flushDebounced(t,r){let n=this.debounceKey(t,r),i=this.debounceMap.get(n);i&&(clearTimeout(i.timer),i.buffer&&(console.log(`[NotificationRouter] flushDebounced -> session=${t}, channel=${r}, bufferLen=${i.buffer.length}`),this.sendMessage(r,i.buffer)),this.debounceMap.delete(n))}cleanupSession(t){for(let r of this.debounceMap.keys())if(r.startsWith(`${t}|`)){let n=this.debounceMap.get(r);clearTimeout(n.timer),this.debounceMap.delete(r)}this.longRunningReminded.delete(t)}};function rk(e){let t=ht(e.duration),r=e.prompt.length>60?e.prompt.slice(0,60)+"...":e.prompt;if(e.status==="completed")return[`\u2705 Claude Code [${e.id}] completed (${t})`,` \u{1F4C1} ${e.workdir}`,` \u{1F4DD} "${r}"`].join(`
97
+ `);if(e.status==="failed"){let n=e.error?` \u26A0\uFE0F ${e.error}`:e.result?.subtype?` \u26A0\uFE0F ${e.result.subtype}`:"";return[`\u274C Claude Code [${e.id}] failed (${t})`,` \u{1F4C1} ${e.workdir}`,` \u{1F4DD} "${r}"`,...n?[n]:[]].join(`
98
+ `)}return e.status==="killed"?[`\u26D4 Claude Code [${e.id}] killed (${t})`,` \u{1F4C1} ${e.workdir}`,` \u{1F4DD} "${r}"`].join(`
99
+ `):`Session [${e.id}] finished with status: ${e.status}`}function nk(e){if(!e||typeof e!="object")return"";if(e.file_path)return ii(e.file_path,60);if(e.path)return ii(e.path,60);if(e.command)return ii(e.command,80);if(e.pattern)return ii(e.pattern,60);if(e.glob)return ii(e.glob,60);let t=Object.values(e).find(r=>typeof r=="string"&&r.length>0);return t?ii(String(t),60):""}function ii(e,t){return e.length<=t?e:e.slice(0,t-3)+"..."}var Wf=require("child_process");function ik(e){let t=null,r=null,n=null;Gl(e),Yl(e),Jl(e),Ql(e),Xl(e),ed(e),td(e),rd(e),nd(e),id(e),sd(e),od(e),ad(e),ud(e),ld(e),dd(e),cd(e),e.registerService({id:"openclaw-claude-code-plugin",start:()=>{let i=e.getConfig?.()??{};Bl(i),t=new Zs(He.maxSessions,He.maxPersistedSessions),Ro(t);let s=(o,a)=>{let u="telegram",l="";if(He.fallbackChannel?.includes(":")){let[w,I]=He.fallbackChannel.split(":",2);w&&I&&(u=w,l=I)}let m=u,v=l;if(o==="unknown"||!o)if(l)console.log(`[claude-code] sendMessage: channelId="${o}", using fallback ${u}:${l}`);else{console.warn(`[claude-code] sendMessage: channelId="${o}" and no fallbackChannel configured \u2014 message will not be sent`);return}else if(o.includes(":")){let[w,I]=o.split(":",2);w&&I&&(m=w,v=I)}else if(/^-?\d+$/.test(o))m="telegram",v=o;else if(l)console.log(`[claude-code] sendMessage: unrecognized channelId="${o}", using fallback ${u}:${l}`);else{console.warn(`[claude-code] sendMessage: unrecognized channelId="${o}" and no fallbackChannel configured \u2014 message will not be sent`);return}console.log(`[claude-code] sendMessage -> channel=${m}, target=${v}, textLen=${a.length}`),(0,Wf.execFile)("openclaw",["message","send","--channel",m,"--target",v,"-m",a],{timeout:15e3},(w,I,T)=>{w?(console.error(`[claude-code] sendMessage CLI ERROR: ${w.message}`),T&&console.error(`[claude-code] sendMessage CLI STDERR: ${T}`)):(console.log(`[claude-code] sendMessage CLI OK -> channel=${m}, target=${v}`),I.trim()&&console.log(`[claude-code] sendMessage CLI STDOUT: ${I.trim()}`))})};r=new Ws(s),No(r),t.notificationRouter=r,r.startReminderCheck(()=>t?.list("running")??[]),n=setInterval(()=>t.cleanup(),300*1e3)},stop:()=>{r&&r.stop(),t&&t.killAll(),n&&clearInterval(n),n=null,t=null,r=null,Ro(null),No(null)}})}0&&(module.exports={register});