palmagent 0.1.0-alpha.74 → 0.1.0-alpha.76
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/build-info.json +2 -2
- package/package.json +1 -1
- package/server.js +1 -1
- package/web/assets/{CodeHighlight-7pypm6d4.js → CodeHighlight-D5CZqeFS.js} +1 -1
- package/web/assets/{MermaidViewport-CSVMOGvU.js → MermaidViewport-BLpzOOM_.js} +1 -1
- package/web/assets/{abnfDiagram-O67JEVCF-20lO_caA.js → abnfDiagram-O67JEVCF-BAr6X_FK.js} +1 -1
- package/web/assets/{arc-Bn-HBD4r.js → arc-B-sRT2Dj.js} +1 -1
- package/web/assets/{architectureDiagram-NJMV4G6O-Bz3gl6_9.js → architectureDiagram-NJMV4G6O-DoXnbdWb.js} +1 -1
- package/web/assets/{blockDiagram-BEXU5L5S-CsiQv4Da.js → blockDiagram-BEXU5L5S-BzJirSiZ.js} +1 -1
- package/web/assets/{c4Diagram-YGBWAQC7-uEFtNXgU.js → c4Diagram-YGBWAQC7-DDpqnvxR.js} +1 -1
- package/web/assets/channel-wklMiwYY.js +1 -0
- package/web/assets/{chunk-2Q5K7J3B-D3DVtdtT.js → chunk-2Q5K7J3B-B8ZM5mgI.js} +1 -1
- package/web/assets/{chunk-3FUC2YCW-C029LS8O.js → chunk-3FUC2YCW-Ct37rWb1.js} +2 -2
- package/web/assets/{chunk-5VM5RSS4-CbDZBUIt.js → chunk-5VM5RSS4-DFTI5b-I.js} +1 -1
- package/web/assets/{chunk-GTNCS2PH-Bjunv7Od.js → chunk-GTNCS2PH-C984CLlP.js} +1 -1
- package/web/assets/{chunk-GWA4HPMP-BgRztdN_.js → chunk-GWA4HPMP-B_vqCQAP.js} +1 -1
- package/web/assets/{chunk-JWPE2WC7-czMyElS9.js → chunk-JWPE2WC7-JuvbR3Iw.js} +1 -1
- package/web/assets/{chunk-NETBCI7D-CYyjvbjH.js → chunk-NETBCI7D-ZP5NNdwp.js} +1 -1
- package/web/assets/{chunk-WEXAMYUT-XVcgYqKq.js → chunk-WEXAMYUT-Ox_l1phM.js} +1 -1
- package/web/assets/{chunk-XXDRQBXY-DTy2lzPB.js → chunk-XXDRQBXY-Xct1YeaC.js} +1 -1
- package/web/assets/{classDiagram-v2-NBCMYWYE-BXuo6GVZ.js → classDiagram-v2-NBCMYWYE-BgVXVLC5.js} +1 -1
- package/web/assets/{cose-bilkent-JH36ORCC-CsCFkLZR.js → cose-bilkent-JH36ORCC-rI464vVs.js} +1 -1
- package/web/assets/{cynefin-OW5HDTMX-IaTG8Wpb.js → cynefin-OW5HDTMX-BtdZobQK.js} +1 -1
- package/web/assets/{cynefinDiagram-VND7K2PF-CqDXAhfU.js → cynefinDiagram-VND7K2PF-DIxdHa4T.js} +1 -1
- package/web/assets/{dagre-6A5THRUB-Dpy6xm__.js → dagre-6A5THRUB-Cli09zDR.js} +1 -1
- package/web/assets/{diagram-22UHCM2B-CEKpc4wH.js → diagram-22UHCM2B-DIGNkNVA.js} +1 -1
- package/web/assets/{diagram-3UASUU5V-BxLjP8RU.js → diagram-3UASUU5V-DqlzZ6Hu.js} +1 -1
- package/web/assets/{diagram-ATOU4E4O-NxQa7x9Q.js → diagram-ATOU4E4O-BV4Fuc42.js} +1 -1
- package/web/assets/{diagram-CDSNMT55-BowoQ-JW.js → diagram-CDSNMT55-CUQXv0Xq.js} +1 -1
- package/web/assets/{diagram-MLGK6HIB-pjTizzjl.js → diagram-MLGK6HIB-Geltthy3.js} +1 -1
- package/web/assets/{diagram-MPIPVDR6-Cemu-3uO.js → diagram-MPIPVDR6-BNm-oAms.js} +1 -1
- package/web/assets/{ebnfDiagram-ZINNZB2B-CDRYR-vq.js → ebnfDiagram-ZINNZB2B-BrRmUhWF.js} +1 -1
- package/web/assets/{elk-276RUBZZ-CY5HUFVJ.js → elk-276RUBZZ-NGbfhcKG.js} +1 -1
- package/web/assets/{erDiagram-OPXOYQCR-CzLd5uqZ.js → erDiagram-OPXOYQCR-pkariIrA.js} +1 -1
- package/web/assets/{flowDiagram-KWPJA3E3-DANiCqpx.js → flowDiagram-KWPJA3E3-BFLh8wTX.js} +1 -1
- package/web/assets/{ganttDiagram-FUAMR5RP-D-tEU5Ml.js → ganttDiagram-FUAMR5RP-B-n_AhXJ.js} +1 -1
- package/web/assets/{gitGraphDiagram-X574FWY7-CThIxGVI.js → gitGraphDiagram-X574FWY7-CAg_k3Sd.js} +1 -1
- package/web/assets/index-9CEalPFy.js +446 -0
- package/web/assets/{infoDiagram-VRGFBTTK-BNJHrBaI.js → infoDiagram-VRGFBTTK-DF6E3U8i.js} +1 -1
- package/web/assets/{ishikawaDiagram-OU5B5YK6-DBO874V5.js → ishikawaDiagram-OU5B5YK6-Cd4LfGgk.js} +1 -1
- package/web/assets/{journeyDiagram-ZHPQQLJL-DrjXOd01.js → journeyDiagram-ZHPQQLJL-BfpqrX7k.js} +1 -1
- package/web/assets/{kanban-definition-PNTS6WVX-yb9q-cpN.js → kanban-definition-PNTS6WVX-BuO88AS0.js} +1 -1
- package/web/assets/{linear-B2xb8tqv.js → linear-BRjS6wKr.js} +1 -1
- package/web/assets/{mermaid.core-Dr6muPg7.js → mermaid.core-DEl-PlAg.js} +4 -4
- package/web/assets/{mindmap-definition-NLK3R4M7-BhFHRJKE.js → mindmap-definition-NLK3R4M7-BYV-kY_h.js} +1 -1
- package/web/assets/{pegDiagram-GJSIUBJH-C2P9LyrW.js → pegDiagram-GJSIUBJH-B-nV6iPf.js} +1 -1
- package/web/assets/{pieDiagram-5QR66LMP-BGzvu6rp.js → pieDiagram-5QR66LMP-CWnp-f4h.js} +1 -1
- package/web/assets/{quadrantDiagram-O4NWA36T-ChYB1jlt.js → quadrantDiagram-O4NWA36T-BMobQr2I.js} +1 -1
- package/web/assets/{railroadDiagram-XR7U4H2S-LugrTb5q.js → railroadDiagram-XR7U4H2S-MmeXwnnQ.js} +1 -1
- package/web/assets/{requirementDiagram-PLB6GJNP-Bqno6lPI.js → requirementDiagram-PLB6GJNP-ChbXtLML.js} +1 -1
- package/web/assets/{sankeyDiagram-IPEJSGJF-DyEz234_.js → sankeyDiagram-IPEJSGJF-Bjhwza-t.js} +1 -1
- package/web/assets/{sequenceDiagram-PO4LG4MO-VjNqa8Qy.js → sequenceDiagram-PO4LG4MO-CAxxIOYD.js} +1 -1
- package/web/assets/{sizeCapture-INFHLROL-DR6TbhFv.js → sizeCapture-INFHLROL-BIbgbbIk.js} +1 -1
- package/web/assets/{stateDiagram-v2-GCMORJYK-DTeR53t1.js → stateDiagram-v2-GCMORJYK-BuvWjtfh.js} +1 -1
- package/web/assets/{swimlanes-2SLR337P-BoE_re2d.js → swimlanes-2SLR337P-BBA7-cAO.js} +1 -1
- package/web/assets/swimlanesDiagram-TC7HE7FX-BtlNBCNs.js +8 -0
- package/web/assets/{timeline-definition-EJHVYXUP-DgP1-JFL.js → timeline-definition-EJHVYXUP-DndC64oL.js} +1 -1
- package/web/assets/{usecaseDiagram-POWQR4AR-NU8II2Fm.js → usecaseDiagram-POWQR4AR-CcaWsUTt.js} +1 -1
- package/web/assets/{vennDiagram-UO4OBE2U-D9tJKHj5.js → vennDiagram-UO4OBE2U-tW8Ut7uF.js} +1 -1
- package/web/assets/{wardleyDiagram-VNRHLVJA-OUqAjjQ5.js → wardleyDiagram-VNRHLVJA-HguREGqg.js} +1 -1
- package/web/assets/{xychartDiagram-PMCCYNJV-DlhLeIzT.js → xychartDiagram-PMCCYNJV-Dv7PYyd7.js} +1 -1
- package/web/index.html +1 -1
- package/web/sw.js +1 -1
- package/web/assets/channel-BxNVkYqP.js +0 -1
- package/web/assets/index-UyTSeNf_.js +0 -451
- package/web/assets/swimlanesDiagram-TC7HE7FX-CCN4oJpG.js +0 -8
package/build-info.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.1.0-alpha.
|
|
2
|
+
"version": "0.1.0-alpha.76",
|
|
3
3
|
"agentCliCompatibility": {
|
|
4
4
|
"claude": {
|
|
5
5
|
"range": ">=2.1.268 <2.2.0",
|
|
@@ -12,6 +12,6 @@
|
|
|
12
12
|
"exclusiveMaximum": "0.156.0"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
|
-
"sourceCommit": "
|
|
15
|
+
"sourceCommit": "c1d915e6d3b95d0f847700b591db9cf92e9f926c",
|
|
16
16
|
"dirty": false
|
|
17
17
|
}
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Od=Object.defineProperty;var Pd=(r,e)=>{for(var t in e)Od(r,t,{get:e[t],enumerable:!0})};var f={version:"0.1.0-alpha.74",agentCliCompatibility:{claude:{range:">=2.1.268 <2.2.0",minimum:"2.1.268",exclusiveMaximum:"2.2.0"},codex:{range:">=0.154.0 <0.156.0",minimum:"0.154.0",exclusiveMaximum:"0.156.0"}},sourceCommit:"81d2d6a9e02ea54761dd4db54ffc3737675c9dfb",dirty:!1};import{randomBytes as zu}from"node:crypto";import{WebSocketServer as Vu,WebSocket as Hi}from"ws";var u={};Pd(u,{BRAND:()=>ou,DIRTY:()=>at,EMPTY_PATH:()=>Ud,INVALID:()=>O,NEVER:()=>Wu,OK:()=>ie,ParseStatus:()=>te,Schema:()=>L,ZodAny:()=>Ke,ZodArray:()=>Le,ZodBigInt:()=>dt,ZodBoolean:()=>ut,ZodBranded:()=>er,ZodCatch:()=>Et,ZodDate:()=>lt,ZodDefault:()=>wt,ZodDiscriminatedUnion:()=>Or,ZodEffects:()=>he,ZodEnum:()=>bt,ZodError:()=>oe,ZodFirstPartyTypeKind:()=>P,ZodFunction:()=>Dr,ZodIntersection:()=>mt,ZodIssueCode:()=>v,ZodLazy:()=>gt,ZodLiteral:()=>yt,ZodMap:()=>jt,ZodNaN:()=>Ut,ZodNativeEnum:()=>vt,ZodNever:()=>be,ZodNull:()=>ht,ZodNullable:()=>Se,ZodNumber:()=>ct,ZodObject:()=>ae,ZodOptional:()=>le,ZodParsedType:()=>_,ZodPipeline:()=>tr,ZodPromise:()=>Xe,ZodReadonly:()=>St,ZodRecord:()=>Pr,ZodSchema:()=>L,ZodSet:()=>Mt,ZodString:()=>Ge,ZodSymbol:()=>Dt,ZodTransformer:()=>he,ZodTuple:()=>Ee,ZodType:()=>L,ZodUndefined:()=>pt,ZodUnion:()=>ft,ZodUnknown:()=>De,ZodVoid:()=>Lt,addIssueToContext:()=>S,any:()=>mu,array:()=>vu,bigint:()=>uu,boolean:()=>Di,coerce:()=>Fu,custom:()=>Ni,date:()=>lu,datetimeRegex:()=>Ii,defaultErrorMap:()=>Oe,discriminatedUnion:()=>Tu,effect:()=>Lu,enum:()=>Ou,function:()=>Iu,getErrorMap:()=>Nt,getParsedType:()=>we,instanceof:()=>cu,intersection:()=>_u,isAborted:()=>Cr,isAsync:()=>Ot,isDirty:()=>Nr,isValid:()=>Je,late:()=>au,lazy:()=>Cu,literal:()=>Nu,makeIssue:()=>Qt,map:()=>Ru,nan:()=>du,nativeEnum:()=>Pu,never:()=>yu,null:()=>fu,nullable:()=>Mu,number:()=>Pi,object:()=>wu,objectUtil:()=>Xn,oboolean:()=>Bu,onumber:()=>$u,optional:()=>ju,ostring:()=>qu,pipeline:()=>Hu,preprocess:()=>Uu,promise:()=>Du,quotelessJson:()=>Ld,record:()=>ku,set:()=>Au,setErrorMap:()=>Md,strictObject:()=>Eu,string:()=>Oi,symbol:()=>pu,transformer:()=>Lu,tuple:()=>xu,undefined:()=>hu,union:()=>Su,unknown:()=>gu,util:()=>H,void:()=>bu});var H;(function(r){r.assertEqual=s=>{};function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{let i={};for(let o of s)i[o]=o;return i},r.getValidEnumValues=s=>{let i=r.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(let a of i)o[a]=s[a];return r.objectValues(o)},r.objectValues=s=>r.objectKeys(s).map(function(i){return s[i]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let i=[];for(let o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},r.find=(s,i)=>{for(let o of s)if(i(o))return o},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}r.joinValues=n,r.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(H||(H={}));var Xn;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Xn||(Xn={}));var _=H.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),we=r=>{switch(typeof r){case"undefined":return _.undefined;case"string":return _.string;case"number":return Number.isNaN(r)?_.nan:_.number;case"boolean":return _.boolean;case"function":return _.function;case"bigint":return _.bigint;case"symbol":return _.symbol;case"object":return Array.isArray(r)?_.array:r===null?_.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?_.promise:typeof Map<"u"&&r instanceof Map?_.map:typeof Set<"u"&&r instanceof Set?_.set:typeof Date<"u"&&r instanceof Date?_.date:_.object;default:return _.unknown}};var v=H.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"]),Ld=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),oe=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(i){return i.message},n={_errors:[]},s=i=>{for(let o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)n._errors.push(t(o));else{let a=n,c=0;for(;c<o.path.length;){let d=o.path[c];c===o.path.length-1?(a[d]=a[d]||{_errors:[]},a[d]._errors.push(t(o))):a[d]=a[d]||{_errors:[]},a=a[d],c++}}};return s(this),n}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,H.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];for(let s of this.issues)if(s.path.length>0){let i=s.path[0];t[i]=t[i]||[],t[i].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};oe.create=r=>new oe(r);var jd=(r,e)=>{let t;switch(r.code){case v.invalid_type:r.received===_.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case v.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,H.jsonStringifyReplacer)}`;break;case v.unrecognized_keys:t=`Unrecognized key(s) in object: ${H.joinValues(r.keys,", ")}`;break;case v.invalid_union:t="Invalid input";break;case v.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${H.joinValues(r.options)}`;break;case v.invalid_enum_value:t=`Invalid enum value. Expected ${H.joinValues(r.options)}, received '${r.received}'`;break;case v.invalid_arguments:t="Invalid function arguments";break;case v.invalid_return_type:t="Invalid function return type";break;case v.invalid_date:t="Invalid date";break;case v.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:H.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case v.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case v.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case v.custom:t="Invalid input";break;case v.invalid_intersection_types:t="Intersection results could not be merged";break;case v.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case v.not_finite:t="Number must be finite";break;default:t=e.defaultError,H.assertNever(r)}return{message:t}},Oe=jd;var _i=Oe;function Md(r){_i=r}function Nt(){return _i}var Qt=r=>{let{data:e,path:t,errorMaps:n,issueData:s}=r,i=[...t,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let a="",c=n.filter(d=>!!d).slice().reverse();for(let d of c)a=d(o,{data:e,defaultError:a}).message;return{...s,path:i,message:a}},Ud=[];function S(r,e){let t=Nt(),n=Qt({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Oe?void 0:Oe].filter(s=>!!s)});r.common.issues.push(n)}var te=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let s of t){if(s.status==="aborted")return O;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let s of t){let i=await s.key,o=await s.value;n.push({key:i,value:o})}return r.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let s of t){let{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return O;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(n[i.value]=o.value)}return{status:e.value,value:n}}},O=Object.freeze({status:"aborted"}),at=r=>({status:"dirty",value:r}),ie=r=>({status:"valid",value:r}),Cr=r=>r.status==="aborted",Nr=r=>r.status==="dirty",Je=r=>r.status==="valid",Ot=r=>typeof Promise<"u"&&r instanceof Promise;var R;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(R||(R={}));var pe=class{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}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}},xi=(r,e)=>{if(Je(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new oe(r.common.issues);return this._error=t,this._error}}};function D(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,a)=>{let{message:c}=r;return o.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:c??t??a.defaultError}},description:s}}var L=class{get description(){return this._def.description}_getType(e){return we(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:we(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new te,ctx:{common:e.parent.common,data:e.data,parsedType:we(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Ot(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:we(e)},s=this._parseSync({data:e,path:n.path,parent:n});return xi(n,s)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:we(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return Je(n)?{value:n.value}:{issues:t.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>Je(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:we(e)},s=this._parse({data:e,path:n.path,parent:n}),i=await(Ot(s)?s:Promise.resolve(s));return xi(n,i)}refine(e,t){let n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,i)=>{let o=e(s),a=()=>i.addIssue({code:v.custom,...n(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new he({schema:this,typeName:P.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,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:t=>this["~validate"](t)}}optional(){return le.create(this,this._def)}nullable(){return Se.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Le.create(this)}promise(){return Xe.create(this,this._def)}or(e){return ft.create([this,e],this._def)}and(e){return mt.create(this,e,this._def)}transform(e){return new he({...D(this._def),schema:this,typeName:P.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new wt({...D(this._def),innerType:this,defaultValue:t,typeName:P.ZodDefault})}brand(){return new er({typeName:P.ZodBranded,type:this,...D(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Et({...D(this._def),innerType:this,catchValue:t,typeName:P.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return tr.create(this,e)}readonly(){return St.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Hd=/^c[^\s-]{8,}$/i,qd=/^[0-9a-z]+$/,$d=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Bd=/^[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,Fd=/^[a-z0-9_-]{21}$/i,Wd=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,zd=/^[-+]?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)?)??$/,Vd=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Jd="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Yn,Gd=/^(?:(?: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])$/,Kd=/^(?:(?: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])$/,Xd=/^(([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]))$/,Yd=/^(([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])$/,Zd=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Qd=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ri="((\\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])))",eu=new RegExp(`^${Ri}$`);function Ai(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);let t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function tu(r){return new RegExp(`^${Ai(r)}$`)}function Ii(r){let e=`${Ri}T${Ai(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function ru(r,e){return!!((e==="v4"||!e)&&Gd.test(r)||(e==="v6"||!e)&&Xd.test(r))}function nu(r,e){if(!Wd.test(r))return!1;try{let[t]=r.split(".");if(!t)return!1;let n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function su(r,e){return!!((e==="v4"||!e)&&Kd.test(r)||(e==="v6"||!e)&&Yd.test(r))}var Ge=class r extends L{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==_.string){let i=this._getOrReturnCtx(e);return S(i,{code:v.invalid_type,expected:_.string,received:i.parsedType}),O}let n=new te,s;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),S(s,{code:v.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),S(s,{code:v.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(e,s),o?S(s,{code:v.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&S(s,{code:v.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Vd.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"email",code:v.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Yn||(Yn=new RegExp(Jd,"u")),Yn.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"emoji",code:v.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Bd.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"uuid",code:v.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Fd.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"nanoid",code:v.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Hd.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"cuid",code:v.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")qd.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"cuid2",code:v.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")$d.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"ulid",code:v.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),S(s,{validation:"url",code:v.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"regex",code:v.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),S(s,{code:v.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),S(s,{code:v.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),S(s,{code:v.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Ii(i).test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{code:v.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?eu.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{code:v.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?tu(i).test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{code:v.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?zd.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"duration",code:v.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?ru(e.data,i.version)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"ip",code:v.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?nu(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"jwt",code:v.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?su(e.data,i.version)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"cidr",code:v.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Zd.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"base64",code:v.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Qd.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"base64url",code:v.invalid_string,message:i.message}),n.dirty()):H.assertNever(i);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:v.invalid_string,...R.errToObj(n)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...R.errToObj(e)})}url(e){return this._addCheck({kind:"url",...R.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...R.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...R.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...R.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...R.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...R.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...R.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...R.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...R.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...R.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...R.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...R.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...R.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...R.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...R.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...R.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...R.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...R.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...R.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...R.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...R.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...R.errToObj(t)})}nonempty(e){return this.min(1,R.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Ge.create=r=>new Ge({checks:[],typeName:P.ZodString,coerce:r?.coerce??!1,...D(r)});function iu(r,e){let t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,i=Number.parseInt(r.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return i%o/10**s}var ct=class r extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==_.number){let i=this._getOrReturnCtx(e);return S(i,{code:v.invalid_type,expected:_.number,received:i.parsedType}),O}let n,s=new te;for(let i of this._def.checks)i.kind==="int"?H.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{code:v.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?iu(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{code:v.not_finite,message:i.message}),s.dirty()):H.assertNever(i);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,R.toString(t))}gt(e,t){return this.setLimit("min",e,!1,R.toString(t))}lte(e,t){return this.setLimit("max",e,!0,R.toString(t))}lt(e,t){return this.setLimit("max",e,!1,R.toString(t))}setLimit(e,t,n,s){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:R.toString(s)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:R.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:R.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:R.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:R.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:R.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:R.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:R.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:R.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:R.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&H.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};ct.create=r=>new ct({checks:[],typeName:P.ZodNumber,coerce:r?.coerce||!1,...D(r)});var dt=class r extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==_.bigint)return this._getInvalidInput(e);let n,s=new te;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):H.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return S(t,{code:v.invalid_type,expected:_.bigint,received:t.parsedType}),O}gte(e,t){return this.setLimit("min",e,!0,R.toString(t))}gt(e,t){return this.setLimit("min",e,!1,R.toString(t))}lte(e,t){return this.setLimit("max",e,!0,R.toString(t))}lt(e,t){return this.setLimit("max",e,!1,R.toString(t))}setLimit(e,t,n,s){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:R.toString(s)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:R.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:R.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:R.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:R.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:R.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};dt.create=r=>new dt({checks:[],typeName:P.ZodBigInt,coerce:r?.coerce??!1,...D(r)});var ut=class extends L{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==_.boolean){let n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:_.boolean,received:n.parsedType}),O}return ie(e.data)}};ut.create=r=>new ut({typeName:P.ZodBoolean,coerce:r?.coerce||!1,...D(r)});var lt=class r extends L{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==_.date){let i=this._getOrReturnCtx(e);return S(i,{code:v.invalid_type,expected:_.date,received:i.parsedType}),O}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return S(i,{code:v.invalid_date}),O}let n=new te,s;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),S(s,{code:v.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),S(s,{code:v.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):H.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:R.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:R.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};lt.create=r=>new lt({checks:[],coerce:r?.coerce||!1,typeName:P.ZodDate,...D(r)});var Dt=class extends L{_parse(e){if(this._getType(e)!==_.symbol){let n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:_.symbol,received:n.parsedType}),O}return ie(e.data)}};Dt.create=r=>new Dt({typeName:P.ZodSymbol,...D(r)});var pt=class extends L{_parse(e){if(this._getType(e)!==_.undefined){let n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:_.undefined,received:n.parsedType}),O}return ie(e.data)}};pt.create=r=>new pt({typeName:P.ZodUndefined,...D(r)});var ht=class extends L{_parse(e){if(this._getType(e)!==_.null){let n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:_.null,received:n.parsedType}),O}return ie(e.data)}};ht.create=r=>new ht({typeName:P.ZodNull,...D(r)});var Ke=class extends L{constructor(){super(...arguments),this._any=!0}_parse(e){return ie(e.data)}};Ke.create=r=>new Ke({typeName:P.ZodAny,...D(r)});var De=class extends L{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ie(e.data)}};De.create=r=>new De({typeName:P.ZodUnknown,...D(r)});var be=class extends L{_parse(e){let t=this._getOrReturnCtx(e);return S(t,{code:v.invalid_type,expected:_.never,received:t.parsedType}),O}};be.create=r=>new be({typeName:P.ZodNever,...D(r)});var Lt=class extends L{_parse(e){if(this._getType(e)!==_.undefined){let n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:_.void,received:n.parsedType}),O}return ie(e.data)}};Lt.create=r=>new Lt({typeName:P.ZodVoid,...D(r)});var Le=class r extends L{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==_.array)return S(t,{code:v.invalid_type,expected:_.array,received:t.parsedType}),O;if(s.exactLength!==null){let o=t.data.length>s.exactLength.value,a=t.data.length<s.exactLength.value;(o||a)&&(S(t,{code:o?v.too_big:v.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(S(t,{code:v.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(S(t,{code:v.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((o,a)=>s.type._parseAsync(new pe(t,o,t.path,a)))).then(o=>te.mergeArray(n,o));let i=[...t.data].map((o,a)=>s.type._parseSync(new pe(t,o,t.path,a)));return te.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:R.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:R.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:R.toString(t)}})}nonempty(e){return this.min(1,e)}};Le.create=(r,e)=>new Le({type:r,minLength:null,maxLength:null,exactLength:null,typeName:P.ZodArray,...D(e)});function Pt(r){if(r instanceof ae){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=le.create(Pt(n))}return new ae({...r._def,shape:()=>e})}else return r instanceof Le?new Le({...r._def,type:Pt(r.element)}):r instanceof le?le.create(Pt(r.unwrap())):r instanceof Se?Se.create(Pt(r.unwrap())):r instanceof Ee?Ee.create(r.items.map(e=>Pt(e))):r}var ae=class r extends L{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=H.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==_.object){let d=this._getOrReturnCtx(e);return S(d,{code:v.invalid_type,expected:_.object,received:d.parsedType}),O}let{status:n,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof be&&this._def.unknownKeys==="strip"))for(let d in s.data)o.includes(d)||a.push(d);let c=[];for(let d of o){let l=i[d],p=s.data[d];c.push({key:{status:"valid",value:d},value:l._parse(new pe(s,p,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof be){let d=this._def.unknownKeys;if(d==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:s.data[l]}});else if(d==="strict")a.length>0&&(S(s,{code:v.unrecognized_keys,keys:a}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let l of a){let p=s.data[l];c.push({key:{status:"valid",value:l},value:d._parse(new pe(s,p,s.path,l)),alwaysSet:l in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let d=[];for(let l of c){let p=await l.key,h=await l.value;d.push({key:p,value:h,alwaysSet:l.alwaysSet})}return d}).then(d=>te.mergeObjectSync(n,d)):te.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return R.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{let s=this._def.errorMap?.(t,n).message??n.defaultError;return t.code==="unrecognized_keys"?{message:R.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:P.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};for(let n of H.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new r({...this._def,shape:()=>t})}omit(e){let t={};for(let n of H.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new r({...this._def,shape:()=>t})}deepPartial(){return Pt(this)}partial(e){let t={};for(let n of H.objectKeys(this.shape)){let s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}return new r({...this._def,shape:()=>t})}required(e){let t={};for(let n of H.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof le;)i=i._def.innerType;t[n]=i}return new r({...this._def,shape:()=>t})}keyof(){return Ci(H.objectKeys(this.shape))}};ae.create=(r,e)=>new ae({shape:()=>r,unknownKeys:"strip",catchall:be.create(),typeName:P.ZodObject,...D(e)});ae.strictCreate=(r,e)=>new ae({shape:()=>r,unknownKeys:"strict",catchall:be.create(),typeName:P.ZodObject,...D(e)});ae.lazycreate=(r,e)=>new ae({shape:r,unknownKeys:"strip",catchall:be.create(),typeName:P.ZodObject,...D(e)});var ft=class extends L{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function s(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return t.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(a=>new oe(a.ctx.common.issues));return S(t,{code:v.invalid_union,unionErrors:o}),O}if(t.common.async)return Promise.all(n.map(async i=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(s);{let i,o=[];for(let c of n){let d={...t,common:{...t.common,issues:[]},parent:null},l=c._parseSync({data:t.data,path:t.path,parent:d});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:d}),d.common.issues.length&&o.push(d.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;let a=o.map(c=>new oe(c));return S(t,{code:v.invalid_union,unionErrors:a}),O}}get options(){return this._def.options}};ft.create=(r,e)=>new ft({options:r,typeName:P.ZodUnion,...D(e)});var Pe=r=>r instanceof gt?Pe(r.schema):r instanceof he?Pe(r.innerType()):r instanceof yt?[r.value]:r instanceof bt?r.options:r instanceof vt?H.objectValues(r.enum):r instanceof wt?Pe(r._def.innerType):r instanceof pt?[void 0]:r instanceof ht?[null]:r instanceof le?[void 0,...Pe(r.unwrap())]:r instanceof Se?[null,...Pe(r.unwrap())]:r instanceof er||r instanceof St?Pe(r.unwrap()):r instanceof Et?Pe(r._def.innerType):[],Or=class r extends L{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==_.object)return S(t,{code:v.invalid_type,expected:_.object,received:t.parsedType}),O;let n=this.discriminator,s=t.data[n],i=this.optionsMap.get(s);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(S(t,{code:v.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),O)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let s=new Map;for(let i of t){let o=Pe(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of o){if(s.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);s.set(a,i)}}return new r({typeName:P.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...D(n)})}};function Zn(r,e){let t=we(r),n=we(e);if(r===e)return{valid:!0,data:r};if(t===_.object&&n===_.object){let s=H.objectKeys(e),i=H.objectKeys(r).filter(a=>s.indexOf(a)!==-1),o={...r,...e};for(let a of i){let c=Zn(r[a],e[a]);if(!c.valid)return{valid:!1};o[a]=c.data}return{valid:!0,data:o}}else if(t===_.array&&n===_.array){if(r.length!==e.length)return{valid:!1};let s=[];for(let i=0;i<r.length;i++){let o=r[i],a=e[i],c=Zn(o,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return t===_.date&&n===_.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var mt=class extends L{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),s=(i,o)=>{if(Cr(i)||Cr(o))return O;let a=Zn(i.value,o.value);return a.valid?((Nr(i)||Nr(o))&&t.dirty(),{status:t.value,value:a.data}):(S(n,{code:v.invalid_intersection_types}),O)};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(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};mt.create=(r,e,t)=>new mt({left:r,right:e,typeName:P.ZodIntersection,...D(t)});var Ee=class r extends L{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_.array)return S(n,{code:v.invalid_type,expected:_.array,received:n.parsedType}),O;if(n.data.length<this._def.items.length)return S(n,{code:v.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),O;!this._def.rest&&n.data.length>this._def.items.length&&(S(n,{code:v.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let i=[...n.data].map((o,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new pe(n,o,n.path,a)):null}).filter(o=>!!o);return n.common.async?Promise.all(i).then(o=>te.mergeArray(t,o)):te.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};Ee.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ee({items:r,typeName:P.ZodTuple,rest:null,...D(e)})};var Pr=class r extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_.object)return S(n,{code:v.invalid_type,expected:_.object,received:n.parsedType}),O;let s=[],i=this._def.keyType,o=this._def.valueType;for(let a in n.data)s.push({key:i._parse(new pe(n,a,n.path,a)),value:o._parse(new pe(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?te.mergeObjectAsync(t,s):te.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof L?new r({keyType:e,valueType:t,typeName:P.ZodRecord,...D(n)}):new r({keyType:Ge.create(),valueType:e,typeName:P.ZodRecord,...D(t)})}},jt=class extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_.map)return S(n,{code:v.invalid_type,expected:_.map,received:n.parsedType}),O;let s=this._def.keyType,i=this._def.valueType,o=[...n.data.entries()].map(([a,c],d)=>({key:s._parse(new pe(n,a,n.path,[d,"key"])),value:i._parse(new pe(n,c,n.path,[d,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of o){let d=await c.key,l=await c.value;if(d.status==="aborted"||l.status==="aborted")return O;(d.status==="dirty"||l.status==="dirty")&&t.dirty(),a.set(d.value,l.value)}return{status:t.value,value:a}})}else{let a=new Map;for(let c of o){let d=c.key,l=c.value;if(d.status==="aborted"||l.status==="aborted")return O;(d.status==="dirty"||l.status==="dirty")&&t.dirty(),a.set(d.value,l.value)}return{status:t.value,value:a}}}};jt.create=(r,e,t)=>new jt({valueType:e,keyType:r,typeName:P.ZodMap,...D(t)});var Mt=class r extends L{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_.set)return S(n,{code:v.invalid_type,expected:_.set,received:n.parsedType}),O;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(S(n,{code:v.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(S(n,{code:v.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());let i=this._def.valueType;function o(c){let d=new Set;for(let l of c){if(l.status==="aborted")return O;l.status==="dirty"&&t.dirty(),d.add(l.value)}return{status:t.value,value:d}}let a=[...n.data.values()].map((c,d)=>i._parse(new pe(n,c,n.path,d)));return n.common.async?Promise.all(a).then(c=>o(c)):o(a)}min(e,t){return new r({...this._def,minSize:{value:e,message:R.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:R.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Mt.create=(r,e)=>new Mt({valueType:r,minSize:null,maxSize:null,typeName:P.ZodSet,...D(e)});var Dr=class r extends L{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==_.function)return S(t,{code:v.invalid_type,expected:_.function,received:t.parsedType}),O;function n(a,c){return Qt({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Nt(),Oe].filter(d=>!!d),issueData:{code:v.invalid_arguments,argumentsError:c}})}function s(a,c){return Qt({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Nt(),Oe].filter(d=>!!d),issueData:{code:v.invalid_return_type,returnTypeError:c}})}let i={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Xe){let a=this;return ie(async function(...c){let d=new oe([]),l=await a._def.args.parseAsync(c,i).catch(m=>{throw d.addIssue(n(c,m)),d}),p=await Reflect.apply(o,this,l);return await a._def.returns._def.type.parseAsync(p,i).catch(m=>{throw d.addIssue(s(p,m)),d})})}else{let a=this;return ie(function(...c){let d=a._def.args.safeParse(c,i);if(!d.success)throw new oe([n(c,d.error)]);let l=Reflect.apply(o,this,d.data),p=a._def.returns.safeParse(l,i);if(!p.success)throw new oe([s(l,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:Ee.create(e).rest(De.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new r({args:e||Ee.create([]).rest(De.create()),returns:t||De.create(),typeName:P.ZodFunction,...D(n)})}},gt=class extends L{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};gt.create=(r,e)=>new gt({getter:r,typeName:P.ZodLazy,...D(e)});var yt=class extends L{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return S(t,{received:t.data,code:v.invalid_literal,expected:this._def.value}),O}return{status:"valid",value:e.data}}get value(){return this._def.value}};yt.create=(r,e)=>new yt({value:r,typeName:P.ZodLiteral,...D(e)});function Ci(r,e){return new bt({values:r,typeName:P.ZodEnum,...D(e)})}var bt=class r extends L{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return S(t,{expected:H.joinValues(n),received:t.parsedType,code:v.invalid_type}),O}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return S(t,{received:t.data,code:v.invalid_enum_value,options:n}),O}return ie(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};bt.create=Ci;var vt=class extends L{_parse(e){let t=H.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==_.string&&n.parsedType!==_.number){let s=H.objectValues(t);return S(n,{expected:H.joinValues(s),received:n.parsedType,code:v.invalid_type}),O}if(this._cache||(this._cache=new Set(H.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=H.objectValues(t);return S(n,{received:n.data,code:v.invalid_enum_value,options:s}),O}return ie(e.data)}get enum(){return this._def.values}};vt.create=(r,e)=>new vt({values:r,typeName:P.ZodNativeEnum,...D(e)});var Xe=class extends L{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==_.promise&&t.common.async===!1)return S(t,{code:v.invalid_type,expected:_.promise,received:t.parsedType}),O;let n=t.parsedType===_.promise?t.data:Promise.resolve(t.data);return ie(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Xe.create=(r,e)=>new Xe({type:r,typeName:P.ZodPromise,...D(e)});var he=class extends L{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===P.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{S(n,o),o.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){let o=s.transform(n.data,i);if(n.common.async)return Promise.resolve(o).then(async a=>{if(t.value==="aborted")return O;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?O:c.status==="dirty"?at(c.value):t.value==="dirty"?at(c.value):c});{if(t.value==="aborted")return O;let a=this._def.schema._parseSync({data:o,path:n.path,parent:n});return a.status==="aborted"?O:a.status==="dirty"?at(a.value):t.value==="dirty"?at(a.value):a}}if(s.type==="refinement"){let o=a=>{let c=s.refinement(a,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new 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"?O:(a.status==="dirty"&&t.dirty(),o(a.value),{status:t.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?O:(a.status==="dirty"&&t.dirty(),o(a.value).then(()=>({status:t.value,value:a.value}))))}if(s.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Je(o))return O;let a=s.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>Je(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:t.value,value:a})):O);H.assertNever(s)}};he.create=(r,e,t)=>new he({schema:r,typeName:P.ZodEffects,effect:e,...D(t)});he.createWithPreprocess=(r,e,t)=>new he({schema:e,effect:{type:"preprocess",transform:r},typeName:P.ZodEffects,...D(t)});var le=class extends L{_parse(e){return this._getType(e)===_.undefined?ie(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};le.create=(r,e)=>new le({innerType:r,typeName:P.ZodOptional,...D(e)});var Se=class extends L{_parse(e){return this._getType(e)===_.null?ie(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Se.create=(r,e)=>new Se({innerType:r,typeName:P.ZodNullable,...D(e)});var wt=class extends L{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===_.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};wt.create=(r,e)=>new wt({innerType:r,typeName:P.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...D(e)});var Et=class extends L{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ot(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new oe(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new oe(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Et.create=(r,e)=>new Et({innerType:r,typeName:P.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...D(e)});var Ut=class extends L{_parse(e){if(this._getType(e)!==_.nan){let n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:_.nan,received:n.parsedType}),O}return{status:"valid",value:e.data}}};Ut.create=r=>new Ut({typeName:P.ZodNaN,...D(r)});var ou=Symbol("zod_brand"),er=class extends L{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},tr=class r extends L{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);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"?O:i.status==="dirty"?(t.dirty(),at(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?O:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new r({in:e,out:t,typeName:P.ZodPipeline})}},St=class extends L{_parse(e){let t=this._def.innerType._parse(e),n=s=>(Je(s)&&(s.value=Object.freeze(s.value)),s);return Ot(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}};St.create=(r,e)=>new St({innerType:r,typeName:P.ZodReadonly,...D(e)});function ki(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function Ni(r,e={},t){return r?Ke.create().superRefine((n,s)=>{let i=r(n);if(i instanceof Promise)return i.then(o=>{if(!o){let a=ki(e,n),c=a.fatal??t??!0;s.addIssue({code:"custom",...a,fatal:c})}});if(!i){let o=ki(e,n),a=o.fatal??t??!0;s.addIssue({code:"custom",...o,fatal:a})}}):Ke.create()}var au={object:ae.lazycreate},P;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(P||(P={}));var cu=(r,e={message:`Input not instance of ${r.name}`})=>Ni(t=>t instanceof r,e),Oi=Ge.create,Pi=ct.create,du=Ut.create,uu=dt.create,Di=ut.create,lu=lt.create,pu=Dt.create,hu=pt.create,fu=ht.create,mu=Ke.create,gu=De.create,yu=be.create,bu=Lt.create,vu=Le.create,wu=ae.create,Eu=ae.strictCreate,Su=ft.create,Tu=Or.create,_u=mt.create,xu=Ee.create,ku=Pr.create,Ru=jt.create,Au=Mt.create,Iu=Dr.create,Cu=gt.create,Nu=yt.create,Ou=bt.create,Pu=vt.create,Du=Xe.create,Lu=he.create,ju=le.create,Mu=Se.create,Uu=he.createWithPreprocess,Hu=tr.create,qu=()=>Oi().optional(),$u=()=>Pi().optional(),Bu=()=>Di().optional(),Fu={string:r=>Ge.create({...r,coerce:!0}),number:r=>ct.create({...r,coerce:!0}),boolean:r=>ut.create({...r,coerce:!0}),bigint:r=>dt.create({...r,coerce:!0}),date:r=>lt.create({...r,coerce:!0})};var Wu=O;var Lr=1,Li=3e4,Ht=u.string().uuid(),ji=u.object({cols:u.number().int().min(2).max(500),rows:u.number().int().min(1).max(200)}),jr=ji.extend({requestId:u.string().uuid(),target:u.union([u.object({taskId:u.string().min(1).max(200)}).strict(),u.object({repoId:u.string().min(1).max(200)}).strict()]),title:u.string().trim().min(1).max(80).optional()}).strict(),Mr=u.object({title:u.string().trim().min(1).max(80)}).strict(),Mi=u.object({taskId:u.string().optional(),repoId:u.string().optional()}),Ui=u.discriminatedUnion("type",[u.object({type:u.literal("attach"),ticket:u.string().min(1).max(200),protocol:u.literal(1)}).strict(),u.object({type:u.literal("input"),epoch:u.number().int().nonnegative(),data:u.string().max(16384)}).strict(),ji.extend({type:u.literal("resize"),epoch:u.number().int().nonnegative()}).strict(),u.object({type:u.literal("claim-control"),ifAvailable:u.boolean().optional()}).strict(),u.object({type:u.literal("release-control")}).strict(),u.object({type:u.literal("ack"),seq:u.number().int().nonnegative()}).strict()]);var Ur=class{tickets=new Map;issue(e,t){for(let[s,i]of this.tickets)i.expires<Date.now()&&this.tickets.delete(s);if(this.tickets.size>=128)throw new Error("Too many terminal connection requests");let n=zu(32).toString("base64url");return this.tickets.set(n,{token:e,id:t,expires:Date.now()+3e4}),{ticket:n,protocol:Lr}}consume(e,t,n){let s=this.tickets.get(e);return this.tickets.delete(e),!!s&&s.token===t&&s.id===n&&s.expires>=Date.now()}};function qi(r,e){let t=new Vu({noServer:!0,maxPayload:7e4,perMessageDeflate:!1}),n=(s,i,o)=>{let a=()=>{i.end(`HTTP/1.1 403 Forbidden\r
|
|
1
|
+
var Od=Object.defineProperty;var Pd=(r,e)=>{for(var t in e)Od(r,t,{get:e[t],enumerable:!0})};var f={version:"0.1.0-alpha.76",agentCliCompatibility:{claude:{range:">=2.1.268 <2.2.0",minimum:"2.1.268",exclusiveMaximum:"2.2.0"},codex:{range:">=0.154.0 <0.156.0",minimum:"0.154.0",exclusiveMaximum:"0.156.0"}},sourceCommit:"c1d915e6d3b95d0f847700b591db9cf92e9f926c",dirty:!1};import{randomBytes as zu}from"node:crypto";import{WebSocketServer as Vu,WebSocket as Hi}from"ws";var u={};Pd(u,{BRAND:()=>ou,DIRTY:()=>at,EMPTY_PATH:()=>Ud,INVALID:()=>O,NEVER:()=>Wu,OK:()=>ie,ParseStatus:()=>te,Schema:()=>L,ZodAny:()=>Ke,ZodArray:()=>Le,ZodBigInt:()=>dt,ZodBoolean:()=>ut,ZodBranded:()=>er,ZodCatch:()=>Et,ZodDate:()=>lt,ZodDefault:()=>wt,ZodDiscriminatedUnion:()=>Or,ZodEffects:()=>he,ZodEnum:()=>bt,ZodError:()=>oe,ZodFirstPartyTypeKind:()=>P,ZodFunction:()=>Dr,ZodIntersection:()=>mt,ZodIssueCode:()=>v,ZodLazy:()=>gt,ZodLiteral:()=>yt,ZodMap:()=>jt,ZodNaN:()=>Ut,ZodNativeEnum:()=>vt,ZodNever:()=>be,ZodNull:()=>ht,ZodNullable:()=>Se,ZodNumber:()=>ct,ZodObject:()=>ae,ZodOptional:()=>le,ZodParsedType:()=>_,ZodPipeline:()=>tr,ZodPromise:()=>Xe,ZodReadonly:()=>St,ZodRecord:()=>Pr,ZodSchema:()=>L,ZodSet:()=>Mt,ZodString:()=>Ge,ZodSymbol:()=>Dt,ZodTransformer:()=>he,ZodTuple:()=>Ee,ZodType:()=>L,ZodUndefined:()=>pt,ZodUnion:()=>ft,ZodUnknown:()=>De,ZodVoid:()=>Lt,addIssueToContext:()=>S,any:()=>mu,array:()=>vu,bigint:()=>uu,boolean:()=>Di,coerce:()=>Fu,custom:()=>Ni,date:()=>lu,datetimeRegex:()=>Ii,defaultErrorMap:()=>Oe,discriminatedUnion:()=>Tu,effect:()=>Lu,enum:()=>Ou,function:()=>Iu,getErrorMap:()=>Nt,getParsedType:()=>we,instanceof:()=>cu,intersection:()=>_u,isAborted:()=>Cr,isAsync:()=>Ot,isDirty:()=>Nr,isValid:()=>Je,late:()=>au,lazy:()=>Cu,literal:()=>Nu,makeIssue:()=>Qt,map:()=>Ru,nan:()=>du,nativeEnum:()=>Pu,never:()=>yu,null:()=>fu,nullable:()=>Mu,number:()=>Pi,object:()=>wu,objectUtil:()=>Xn,oboolean:()=>Bu,onumber:()=>$u,optional:()=>ju,ostring:()=>qu,pipeline:()=>Hu,preprocess:()=>Uu,promise:()=>Du,quotelessJson:()=>Ld,record:()=>ku,set:()=>Au,setErrorMap:()=>Md,strictObject:()=>Eu,string:()=>Oi,symbol:()=>pu,transformer:()=>Lu,tuple:()=>xu,undefined:()=>hu,union:()=>Su,unknown:()=>gu,util:()=>H,void:()=>bu});var H;(function(r){r.assertEqual=s=>{};function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{let i={};for(let o of s)i[o]=o;return i},r.getValidEnumValues=s=>{let i=r.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(let a of i)o[a]=s[a];return r.objectValues(o)},r.objectValues=s=>r.objectKeys(s).map(function(i){return s[i]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let i=[];for(let o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},r.find=(s,i)=>{for(let o of s)if(i(o))return o},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}r.joinValues=n,r.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(H||(H={}));var Xn;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Xn||(Xn={}));var _=H.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),we=r=>{switch(typeof r){case"undefined":return _.undefined;case"string":return _.string;case"number":return Number.isNaN(r)?_.nan:_.number;case"boolean":return _.boolean;case"function":return _.function;case"bigint":return _.bigint;case"symbol":return _.symbol;case"object":return Array.isArray(r)?_.array:r===null?_.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?_.promise:typeof Map<"u"&&r instanceof Map?_.map:typeof Set<"u"&&r instanceof Set?_.set:typeof Date<"u"&&r instanceof Date?_.date:_.object;default:return _.unknown}};var v=H.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"]),Ld=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),oe=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(i){return i.message},n={_errors:[]},s=i=>{for(let o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)n._errors.push(t(o));else{let a=n,c=0;for(;c<o.path.length;){let d=o.path[c];c===o.path.length-1?(a[d]=a[d]||{_errors:[]},a[d]._errors.push(t(o))):a[d]=a[d]||{_errors:[]},a=a[d],c++}}};return s(this),n}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,H.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];for(let s of this.issues)if(s.path.length>0){let i=s.path[0];t[i]=t[i]||[],t[i].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};oe.create=r=>new oe(r);var jd=(r,e)=>{let t;switch(r.code){case v.invalid_type:r.received===_.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case v.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,H.jsonStringifyReplacer)}`;break;case v.unrecognized_keys:t=`Unrecognized key(s) in object: ${H.joinValues(r.keys,", ")}`;break;case v.invalid_union:t="Invalid input";break;case v.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${H.joinValues(r.options)}`;break;case v.invalid_enum_value:t=`Invalid enum value. Expected ${H.joinValues(r.options)}, received '${r.received}'`;break;case v.invalid_arguments:t="Invalid function arguments";break;case v.invalid_return_type:t="Invalid function return type";break;case v.invalid_date:t="Invalid date";break;case v.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:H.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case v.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case v.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case v.custom:t="Invalid input";break;case v.invalid_intersection_types:t="Intersection results could not be merged";break;case v.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case v.not_finite:t="Number must be finite";break;default:t=e.defaultError,H.assertNever(r)}return{message:t}},Oe=jd;var _i=Oe;function Md(r){_i=r}function Nt(){return _i}var Qt=r=>{let{data:e,path:t,errorMaps:n,issueData:s}=r,i=[...t,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let a="",c=n.filter(d=>!!d).slice().reverse();for(let d of c)a=d(o,{data:e,defaultError:a}).message;return{...s,path:i,message:a}},Ud=[];function S(r,e){let t=Nt(),n=Qt({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Oe?void 0:Oe].filter(s=>!!s)});r.common.issues.push(n)}var te=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let s of t){if(s.status==="aborted")return O;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let s of t){let i=await s.key,o=await s.value;n.push({key:i,value:o})}return r.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let s of t){let{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return O;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(n[i.value]=o.value)}return{status:e.value,value:n}}},O=Object.freeze({status:"aborted"}),at=r=>({status:"dirty",value:r}),ie=r=>({status:"valid",value:r}),Cr=r=>r.status==="aborted",Nr=r=>r.status==="dirty",Je=r=>r.status==="valid",Ot=r=>typeof Promise<"u"&&r instanceof Promise;var R;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(R||(R={}));var pe=class{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}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}},xi=(r,e)=>{if(Je(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new oe(r.common.issues);return this._error=t,this._error}}};function D(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,a)=>{let{message:c}=r;return o.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:c??t??a.defaultError}},description:s}}var L=class{get description(){return this._def.description}_getType(e){return we(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:we(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new te,ctx:{common:e.parent.common,data:e.data,parsedType:we(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Ot(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:we(e)},s=this._parseSync({data:e,path:n.path,parent:n});return xi(n,s)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:we(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return Je(n)?{value:n.value}:{issues:t.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>Je(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:we(e)},s=this._parse({data:e,path:n.path,parent:n}),i=await(Ot(s)?s:Promise.resolve(s));return xi(n,i)}refine(e,t){let n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,i)=>{let o=e(s),a=()=>i.addIssue({code:v.custom,...n(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new he({schema:this,typeName:P.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,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:t=>this["~validate"](t)}}optional(){return le.create(this,this._def)}nullable(){return Se.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Le.create(this)}promise(){return Xe.create(this,this._def)}or(e){return ft.create([this,e],this._def)}and(e){return mt.create(this,e,this._def)}transform(e){return new he({...D(this._def),schema:this,typeName:P.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new wt({...D(this._def),innerType:this,defaultValue:t,typeName:P.ZodDefault})}brand(){return new er({typeName:P.ZodBranded,type:this,...D(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Et({...D(this._def),innerType:this,catchValue:t,typeName:P.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return tr.create(this,e)}readonly(){return St.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Hd=/^c[^\s-]{8,}$/i,qd=/^[0-9a-z]+$/,$d=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Bd=/^[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,Fd=/^[a-z0-9_-]{21}$/i,Wd=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,zd=/^[-+]?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)?)??$/,Vd=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Jd="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Yn,Gd=/^(?:(?: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])$/,Kd=/^(?:(?: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])$/,Xd=/^(([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]))$/,Yd=/^(([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])$/,Zd=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Qd=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ri="((\\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])))",eu=new RegExp(`^${Ri}$`);function Ai(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);let t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function tu(r){return new RegExp(`^${Ai(r)}$`)}function Ii(r){let e=`${Ri}T${Ai(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function ru(r,e){return!!((e==="v4"||!e)&&Gd.test(r)||(e==="v6"||!e)&&Xd.test(r))}function nu(r,e){if(!Wd.test(r))return!1;try{let[t]=r.split(".");if(!t)return!1;let n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function su(r,e){return!!((e==="v4"||!e)&&Kd.test(r)||(e==="v6"||!e)&&Yd.test(r))}var Ge=class r extends L{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==_.string){let i=this._getOrReturnCtx(e);return S(i,{code:v.invalid_type,expected:_.string,received:i.parsedType}),O}let n=new te,s;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),S(s,{code:v.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),S(s,{code:v.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(e,s),o?S(s,{code:v.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&S(s,{code:v.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Vd.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"email",code:v.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Yn||(Yn=new RegExp(Jd,"u")),Yn.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"emoji",code:v.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Bd.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"uuid",code:v.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Fd.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"nanoid",code:v.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Hd.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"cuid",code:v.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")qd.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"cuid2",code:v.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")$d.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"ulid",code:v.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),S(s,{validation:"url",code:v.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"regex",code:v.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),S(s,{code:v.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),S(s,{code:v.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),S(s,{code:v.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Ii(i).test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{code:v.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?eu.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{code:v.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?tu(i).test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{code:v.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?zd.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"duration",code:v.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?ru(e.data,i.version)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"ip",code:v.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?nu(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"jwt",code:v.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?su(e.data,i.version)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"cidr",code:v.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Zd.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"base64",code:v.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Qd.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"base64url",code:v.invalid_string,message:i.message}),n.dirty()):H.assertNever(i);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:v.invalid_string,...R.errToObj(n)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...R.errToObj(e)})}url(e){return this._addCheck({kind:"url",...R.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...R.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...R.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...R.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...R.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...R.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...R.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...R.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...R.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...R.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...R.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...R.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...R.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...R.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...R.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...R.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...R.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...R.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...R.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...R.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...R.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...R.errToObj(t)})}nonempty(e){return this.min(1,R.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Ge.create=r=>new Ge({checks:[],typeName:P.ZodString,coerce:r?.coerce??!1,...D(r)});function iu(r,e){let t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,i=Number.parseInt(r.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return i%o/10**s}var ct=class r extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==_.number){let i=this._getOrReturnCtx(e);return S(i,{code:v.invalid_type,expected:_.number,received:i.parsedType}),O}let n,s=new te;for(let i of this._def.checks)i.kind==="int"?H.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{code:v.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?iu(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{code:v.not_finite,message:i.message}),s.dirty()):H.assertNever(i);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,R.toString(t))}gt(e,t){return this.setLimit("min",e,!1,R.toString(t))}lte(e,t){return this.setLimit("max",e,!0,R.toString(t))}lt(e,t){return this.setLimit("max",e,!1,R.toString(t))}setLimit(e,t,n,s){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:R.toString(s)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:R.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:R.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:R.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:R.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:R.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:R.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:R.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:R.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:R.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&H.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};ct.create=r=>new ct({checks:[],typeName:P.ZodNumber,coerce:r?.coerce||!1,...D(r)});var dt=class r extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==_.bigint)return this._getInvalidInput(e);let n,s=new te;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):H.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return S(t,{code:v.invalid_type,expected:_.bigint,received:t.parsedType}),O}gte(e,t){return this.setLimit("min",e,!0,R.toString(t))}gt(e,t){return this.setLimit("min",e,!1,R.toString(t))}lte(e,t){return this.setLimit("max",e,!0,R.toString(t))}lt(e,t){return this.setLimit("max",e,!1,R.toString(t))}setLimit(e,t,n,s){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:R.toString(s)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:R.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:R.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:R.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:R.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:R.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};dt.create=r=>new dt({checks:[],typeName:P.ZodBigInt,coerce:r?.coerce??!1,...D(r)});var ut=class extends L{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==_.boolean){let n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:_.boolean,received:n.parsedType}),O}return ie(e.data)}};ut.create=r=>new ut({typeName:P.ZodBoolean,coerce:r?.coerce||!1,...D(r)});var lt=class r extends L{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==_.date){let i=this._getOrReturnCtx(e);return S(i,{code:v.invalid_type,expected:_.date,received:i.parsedType}),O}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return S(i,{code:v.invalid_date}),O}let n=new te,s;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),S(s,{code:v.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),S(s,{code:v.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):H.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:R.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:R.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};lt.create=r=>new lt({checks:[],coerce:r?.coerce||!1,typeName:P.ZodDate,...D(r)});var Dt=class extends L{_parse(e){if(this._getType(e)!==_.symbol){let n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:_.symbol,received:n.parsedType}),O}return ie(e.data)}};Dt.create=r=>new Dt({typeName:P.ZodSymbol,...D(r)});var pt=class extends L{_parse(e){if(this._getType(e)!==_.undefined){let n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:_.undefined,received:n.parsedType}),O}return ie(e.data)}};pt.create=r=>new pt({typeName:P.ZodUndefined,...D(r)});var ht=class extends L{_parse(e){if(this._getType(e)!==_.null){let n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:_.null,received:n.parsedType}),O}return ie(e.data)}};ht.create=r=>new ht({typeName:P.ZodNull,...D(r)});var Ke=class extends L{constructor(){super(...arguments),this._any=!0}_parse(e){return ie(e.data)}};Ke.create=r=>new Ke({typeName:P.ZodAny,...D(r)});var De=class extends L{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ie(e.data)}};De.create=r=>new De({typeName:P.ZodUnknown,...D(r)});var be=class extends L{_parse(e){let t=this._getOrReturnCtx(e);return S(t,{code:v.invalid_type,expected:_.never,received:t.parsedType}),O}};be.create=r=>new be({typeName:P.ZodNever,...D(r)});var Lt=class extends L{_parse(e){if(this._getType(e)!==_.undefined){let n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:_.void,received:n.parsedType}),O}return ie(e.data)}};Lt.create=r=>new Lt({typeName:P.ZodVoid,...D(r)});var Le=class r extends L{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==_.array)return S(t,{code:v.invalid_type,expected:_.array,received:t.parsedType}),O;if(s.exactLength!==null){let o=t.data.length>s.exactLength.value,a=t.data.length<s.exactLength.value;(o||a)&&(S(t,{code:o?v.too_big:v.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(S(t,{code:v.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(S(t,{code:v.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((o,a)=>s.type._parseAsync(new pe(t,o,t.path,a)))).then(o=>te.mergeArray(n,o));let i=[...t.data].map((o,a)=>s.type._parseSync(new pe(t,o,t.path,a)));return te.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:R.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:R.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:R.toString(t)}})}nonempty(e){return this.min(1,e)}};Le.create=(r,e)=>new Le({type:r,minLength:null,maxLength:null,exactLength:null,typeName:P.ZodArray,...D(e)});function Pt(r){if(r instanceof ae){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=le.create(Pt(n))}return new ae({...r._def,shape:()=>e})}else return r instanceof Le?new Le({...r._def,type:Pt(r.element)}):r instanceof le?le.create(Pt(r.unwrap())):r instanceof Se?Se.create(Pt(r.unwrap())):r instanceof Ee?Ee.create(r.items.map(e=>Pt(e))):r}var ae=class r extends L{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=H.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==_.object){let d=this._getOrReturnCtx(e);return S(d,{code:v.invalid_type,expected:_.object,received:d.parsedType}),O}let{status:n,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof be&&this._def.unknownKeys==="strip"))for(let d in s.data)o.includes(d)||a.push(d);let c=[];for(let d of o){let l=i[d],p=s.data[d];c.push({key:{status:"valid",value:d},value:l._parse(new pe(s,p,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof be){let d=this._def.unknownKeys;if(d==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:s.data[l]}});else if(d==="strict")a.length>0&&(S(s,{code:v.unrecognized_keys,keys:a}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let l of a){let p=s.data[l];c.push({key:{status:"valid",value:l},value:d._parse(new pe(s,p,s.path,l)),alwaysSet:l in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let d=[];for(let l of c){let p=await l.key,h=await l.value;d.push({key:p,value:h,alwaysSet:l.alwaysSet})}return d}).then(d=>te.mergeObjectSync(n,d)):te.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return R.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{let s=this._def.errorMap?.(t,n).message??n.defaultError;return t.code==="unrecognized_keys"?{message:R.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:P.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};for(let n of H.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new r({...this._def,shape:()=>t})}omit(e){let t={};for(let n of H.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new r({...this._def,shape:()=>t})}deepPartial(){return Pt(this)}partial(e){let t={};for(let n of H.objectKeys(this.shape)){let s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}return new r({...this._def,shape:()=>t})}required(e){let t={};for(let n of H.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof le;)i=i._def.innerType;t[n]=i}return new r({...this._def,shape:()=>t})}keyof(){return Ci(H.objectKeys(this.shape))}};ae.create=(r,e)=>new ae({shape:()=>r,unknownKeys:"strip",catchall:be.create(),typeName:P.ZodObject,...D(e)});ae.strictCreate=(r,e)=>new ae({shape:()=>r,unknownKeys:"strict",catchall:be.create(),typeName:P.ZodObject,...D(e)});ae.lazycreate=(r,e)=>new ae({shape:r,unknownKeys:"strip",catchall:be.create(),typeName:P.ZodObject,...D(e)});var ft=class extends L{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function s(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return t.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(a=>new oe(a.ctx.common.issues));return S(t,{code:v.invalid_union,unionErrors:o}),O}if(t.common.async)return Promise.all(n.map(async i=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(s);{let i,o=[];for(let c of n){let d={...t,common:{...t.common,issues:[]},parent:null},l=c._parseSync({data:t.data,path:t.path,parent:d});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:d}),d.common.issues.length&&o.push(d.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;let a=o.map(c=>new oe(c));return S(t,{code:v.invalid_union,unionErrors:a}),O}}get options(){return this._def.options}};ft.create=(r,e)=>new ft({options:r,typeName:P.ZodUnion,...D(e)});var Pe=r=>r instanceof gt?Pe(r.schema):r instanceof he?Pe(r.innerType()):r instanceof yt?[r.value]:r instanceof bt?r.options:r instanceof vt?H.objectValues(r.enum):r instanceof wt?Pe(r._def.innerType):r instanceof pt?[void 0]:r instanceof ht?[null]:r instanceof le?[void 0,...Pe(r.unwrap())]:r instanceof Se?[null,...Pe(r.unwrap())]:r instanceof er||r instanceof St?Pe(r.unwrap()):r instanceof Et?Pe(r._def.innerType):[],Or=class r extends L{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==_.object)return S(t,{code:v.invalid_type,expected:_.object,received:t.parsedType}),O;let n=this.discriminator,s=t.data[n],i=this.optionsMap.get(s);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(S(t,{code:v.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),O)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let s=new Map;for(let i of t){let o=Pe(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of o){if(s.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);s.set(a,i)}}return new r({typeName:P.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...D(n)})}};function Zn(r,e){let t=we(r),n=we(e);if(r===e)return{valid:!0,data:r};if(t===_.object&&n===_.object){let s=H.objectKeys(e),i=H.objectKeys(r).filter(a=>s.indexOf(a)!==-1),o={...r,...e};for(let a of i){let c=Zn(r[a],e[a]);if(!c.valid)return{valid:!1};o[a]=c.data}return{valid:!0,data:o}}else if(t===_.array&&n===_.array){if(r.length!==e.length)return{valid:!1};let s=[];for(let i=0;i<r.length;i++){let o=r[i],a=e[i],c=Zn(o,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return t===_.date&&n===_.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var mt=class extends L{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),s=(i,o)=>{if(Cr(i)||Cr(o))return O;let a=Zn(i.value,o.value);return a.valid?((Nr(i)||Nr(o))&&t.dirty(),{status:t.value,value:a.data}):(S(n,{code:v.invalid_intersection_types}),O)};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(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};mt.create=(r,e,t)=>new mt({left:r,right:e,typeName:P.ZodIntersection,...D(t)});var Ee=class r extends L{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_.array)return S(n,{code:v.invalid_type,expected:_.array,received:n.parsedType}),O;if(n.data.length<this._def.items.length)return S(n,{code:v.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),O;!this._def.rest&&n.data.length>this._def.items.length&&(S(n,{code:v.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let i=[...n.data].map((o,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new pe(n,o,n.path,a)):null}).filter(o=>!!o);return n.common.async?Promise.all(i).then(o=>te.mergeArray(t,o)):te.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};Ee.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ee({items:r,typeName:P.ZodTuple,rest:null,...D(e)})};var Pr=class r extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_.object)return S(n,{code:v.invalid_type,expected:_.object,received:n.parsedType}),O;let s=[],i=this._def.keyType,o=this._def.valueType;for(let a in n.data)s.push({key:i._parse(new pe(n,a,n.path,a)),value:o._parse(new pe(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?te.mergeObjectAsync(t,s):te.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof L?new r({keyType:e,valueType:t,typeName:P.ZodRecord,...D(n)}):new r({keyType:Ge.create(),valueType:e,typeName:P.ZodRecord,...D(t)})}},jt=class extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_.map)return S(n,{code:v.invalid_type,expected:_.map,received:n.parsedType}),O;let s=this._def.keyType,i=this._def.valueType,o=[...n.data.entries()].map(([a,c],d)=>({key:s._parse(new pe(n,a,n.path,[d,"key"])),value:i._parse(new pe(n,c,n.path,[d,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of o){let d=await c.key,l=await c.value;if(d.status==="aborted"||l.status==="aborted")return O;(d.status==="dirty"||l.status==="dirty")&&t.dirty(),a.set(d.value,l.value)}return{status:t.value,value:a}})}else{let a=new Map;for(let c of o){let d=c.key,l=c.value;if(d.status==="aborted"||l.status==="aborted")return O;(d.status==="dirty"||l.status==="dirty")&&t.dirty(),a.set(d.value,l.value)}return{status:t.value,value:a}}}};jt.create=(r,e,t)=>new jt({valueType:e,keyType:r,typeName:P.ZodMap,...D(t)});var Mt=class r extends L{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_.set)return S(n,{code:v.invalid_type,expected:_.set,received:n.parsedType}),O;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(S(n,{code:v.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(S(n,{code:v.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());let i=this._def.valueType;function o(c){let d=new Set;for(let l of c){if(l.status==="aborted")return O;l.status==="dirty"&&t.dirty(),d.add(l.value)}return{status:t.value,value:d}}let a=[...n.data.values()].map((c,d)=>i._parse(new pe(n,c,n.path,d)));return n.common.async?Promise.all(a).then(c=>o(c)):o(a)}min(e,t){return new r({...this._def,minSize:{value:e,message:R.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:R.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Mt.create=(r,e)=>new Mt({valueType:r,minSize:null,maxSize:null,typeName:P.ZodSet,...D(e)});var Dr=class r extends L{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==_.function)return S(t,{code:v.invalid_type,expected:_.function,received:t.parsedType}),O;function n(a,c){return Qt({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Nt(),Oe].filter(d=>!!d),issueData:{code:v.invalid_arguments,argumentsError:c}})}function s(a,c){return Qt({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Nt(),Oe].filter(d=>!!d),issueData:{code:v.invalid_return_type,returnTypeError:c}})}let i={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Xe){let a=this;return ie(async function(...c){let d=new oe([]),l=await a._def.args.parseAsync(c,i).catch(m=>{throw d.addIssue(n(c,m)),d}),p=await Reflect.apply(o,this,l);return await a._def.returns._def.type.parseAsync(p,i).catch(m=>{throw d.addIssue(s(p,m)),d})})}else{let a=this;return ie(function(...c){let d=a._def.args.safeParse(c,i);if(!d.success)throw new oe([n(c,d.error)]);let l=Reflect.apply(o,this,d.data),p=a._def.returns.safeParse(l,i);if(!p.success)throw new oe([s(l,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:Ee.create(e).rest(De.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new r({args:e||Ee.create([]).rest(De.create()),returns:t||De.create(),typeName:P.ZodFunction,...D(n)})}},gt=class extends L{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};gt.create=(r,e)=>new gt({getter:r,typeName:P.ZodLazy,...D(e)});var yt=class extends L{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return S(t,{received:t.data,code:v.invalid_literal,expected:this._def.value}),O}return{status:"valid",value:e.data}}get value(){return this._def.value}};yt.create=(r,e)=>new yt({value:r,typeName:P.ZodLiteral,...D(e)});function Ci(r,e){return new bt({values:r,typeName:P.ZodEnum,...D(e)})}var bt=class r extends L{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return S(t,{expected:H.joinValues(n),received:t.parsedType,code:v.invalid_type}),O}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return S(t,{received:t.data,code:v.invalid_enum_value,options:n}),O}return ie(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};bt.create=Ci;var vt=class extends L{_parse(e){let t=H.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==_.string&&n.parsedType!==_.number){let s=H.objectValues(t);return S(n,{expected:H.joinValues(s),received:n.parsedType,code:v.invalid_type}),O}if(this._cache||(this._cache=new Set(H.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=H.objectValues(t);return S(n,{received:n.data,code:v.invalid_enum_value,options:s}),O}return ie(e.data)}get enum(){return this._def.values}};vt.create=(r,e)=>new vt({values:r,typeName:P.ZodNativeEnum,...D(e)});var Xe=class extends L{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==_.promise&&t.common.async===!1)return S(t,{code:v.invalid_type,expected:_.promise,received:t.parsedType}),O;let n=t.parsedType===_.promise?t.data:Promise.resolve(t.data);return ie(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Xe.create=(r,e)=>new Xe({type:r,typeName:P.ZodPromise,...D(e)});var he=class extends L{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===P.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{S(n,o),o.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){let o=s.transform(n.data,i);if(n.common.async)return Promise.resolve(o).then(async a=>{if(t.value==="aborted")return O;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?O:c.status==="dirty"?at(c.value):t.value==="dirty"?at(c.value):c});{if(t.value==="aborted")return O;let a=this._def.schema._parseSync({data:o,path:n.path,parent:n});return a.status==="aborted"?O:a.status==="dirty"?at(a.value):t.value==="dirty"?at(a.value):a}}if(s.type==="refinement"){let o=a=>{let c=s.refinement(a,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new 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"?O:(a.status==="dirty"&&t.dirty(),o(a.value),{status:t.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?O:(a.status==="dirty"&&t.dirty(),o(a.value).then(()=>({status:t.value,value:a.value}))))}if(s.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Je(o))return O;let a=s.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>Je(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:t.value,value:a})):O);H.assertNever(s)}};he.create=(r,e,t)=>new he({schema:r,typeName:P.ZodEffects,effect:e,...D(t)});he.createWithPreprocess=(r,e,t)=>new he({schema:e,effect:{type:"preprocess",transform:r},typeName:P.ZodEffects,...D(t)});var le=class extends L{_parse(e){return this._getType(e)===_.undefined?ie(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};le.create=(r,e)=>new le({innerType:r,typeName:P.ZodOptional,...D(e)});var Se=class extends L{_parse(e){return this._getType(e)===_.null?ie(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Se.create=(r,e)=>new Se({innerType:r,typeName:P.ZodNullable,...D(e)});var wt=class extends L{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===_.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};wt.create=(r,e)=>new wt({innerType:r,typeName:P.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...D(e)});var Et=class extends L{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ot(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new oe(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new oe(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Et.create=(r,e)=>new Et({innerType:r,typeName:P.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...D(e)});var Ut=class extends L{_parse(e){if(this._getType(e)!==_.nan){let n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:_.nan,received:n.parsedType}),O}return{status:"valid",value:e.data}}};Ut.create=r=>new Ut({typeName:P.ZodNaN,...D(r)});var ou=Symbol("zod_brand"),er=class extends L{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},tr=class r extends L{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);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"?O:i.status==="dirty"?(t.dirty(),at(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?O:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new r({in:e,out:t,typeName:P.ZodPipeline})}},St=class extends L{_parse(e){let t=this._def.innerType._parse(e),n=s=>(Je(s)&&(s.value=Object.freeze(s.value)),s);return Ot(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}};St.create=(r,e)=>new St({innerType:r,typeName:P.ZodReadonly,...D(e)});function ki(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function Ni(r,e={},t){return r?Ke.create().superRefine((n,s)=>{let i=r(n);if(i instanceof Promise)return i.then(o=>{if(!o){let a=ki(e,n),c=a.fatal??t??!0;s.addIssue({code:"custom",...a,fatal:c})}});if(!i){let o=ki(e,n),a=o.fatal??t??!0;s.addIssue({code:"custom",...o,fatal:a})}}):Ke.create()}var au={object:ae.lazycreate},P;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(P||(P={}));var cu=(r,e={message:`Input not instance of ${r.name}`})=>Ni(t=>t instanceof r,e),Oi=Ge.create,Pi=ct.create,du=Ut.create,uu=dt.create,Di=ut.create,lu=lt.create,pu=Dt.create,hu=pt.create,fu=ht.create,mu=Ke.create,gu=De.create,yu=be.create,bu=Lt.create,vu=Le.create,wu=ae.create,Eu=ae.strictCreate,Su=ft.create,Tu=Or.create,_u=mt.create,xu=Ee.create,ku=Pr.create,Ru=jt.create,Au=Mt.create,Iu=Dr.create,Cu=gt.create,Nu=yt.create,Ou=bt.create,Pu=vt.create,Du=Xe.create,Lu=he.create,ju=le.create,Mu=Se.create,Uu=he.createWithPreprocess,Hu=tr.create,qu=()=>Oi().optional(),$u=()=>Pi().optional(),Bu=()=>Di().optional(),Fu={string:r=>Ge.create({...r,coerce:!0}),number:r=>ct.create({...r,coerce:!0}),boolean:r=>ut.create({...r,coerce:!0}),bigint:r=>dt.create({...r,coerce:!0}),date:r=>lt.create({...r,coerce:!0})};var Wu=O;var Lr=1,Li=3e4,Ht=u.string().uuid(),ji=u.object({cols:u.number().int().min(2).max(500),rows:u.number().int().min(1).max(200)}),jr=ji.extend({requestId:u.string().uuid(),target:u.union([u.object({taskId:u.string().min(1).max(200)}).strict(),u.object({repoId:u.string().min(1).max(200)}).strict()]),title:u.string().trim().min(1).max(80).optional()}).strict(),Mr=u.object({title:u.string().trim().min(1).max(80)}).strict(),Mi=u.object({taskId:u.string().optional(),repoId:u.string().optional()}),Ui=u.discriminatedUnion("type",[u.object({type:u.literal("attach"),ticket:u.string().min(1).max(200),protocol:u.literal(1)}).strict(),u.object({type:u.literal("input"),epoch:u.number().int().nonnegative(),data:u.string().max(16384)}).strict(),ji.extend({type:u.literal("resize"),epoch:u.number().int().nonnegative()}).strict(),u.object({type:u.literal("claim-control"),ifAvailable:u.boolean().optional()}).strict(),u.object({type:u.literal("release-control")}).strict(),u.object({type:u.literal("ack"),seq:u.number().int().nonnegative()}).strict()]);var Ur=class{tickets=new Map;issue(e,t){for(let[s,i]of this.tickets)i.expires<Date.now()&&this.tickets.delete(s);if(this.tickets.size>=128)throw new Error("Too many terminal connection requests");let n=zu(32).toString("base64url");return this.tickets.set(n,{token:e,id:t,expires:Date.now()+3e4}),{ticket:n,protocol:Lr}}consume(e,t,n){let s=this.tickets.get(e);return this.tickets.delete(e),!!s&&s.token===t&&s.id===n&&s.expires>=Date.now()}};function qi(r,e){let t=new Vu({noServer:!0,maxPayload:7e4,perMessageDeflate:!1}),n=(s,i,o)=>{let a=()=>{i.end(`HTTP/1.1 403 Forbidden\r
|
|
2
2
|
Connection: close\r
|
|
3
3
|
\r
|
|
4
4
|
`)},c=/^\/api\/terminals\/([^/]+)\/stream$/.exec(s.url??""),d=s.headers.cookie?.split(";").map(p=>p.trim()).find(p=>p.startsWith(e.cookieName+"="))?.slice(e.cookieName.length+1);if(!c||!Ht.safeParse(c[1]).success||!e.auth.enabled||s.headers.origin!==e.origin||!d||!e.auth.sessionValid(d)||!e.service.capabilities().available||t.clients.size>=32){a();return}let l=c[1];try{e.service.get(l)}catch{a();return}t.handleUpgrade(s,i,o,p=>{let h,m=!1,b=!1,y=!0,w=0,A=setTimeout(()=>{m||p.close(1008,"Attach timed out")},5e3),N=setInterval(()=>{if(w=0,!e.auth.sessionValid(d)||!y){p.terminate();return}y=!1,p.ping()},1e4);p.on("pong",()=>{y=!0}),p.on("error",()=>p.terminate()),p.on("close",()=>{clearTimeout(A),clearInterval(N),h?.close()}),p.on("message",async(I,T)=>{try{if(T||!e.auth.sessionValid(d)){p.close(1008,"Authentication required");return}if(w+=I.toString().length,w>512e3){p.close(1008,"Input limit exceeded");return}let x=Ui.parse(JSON.parse(I.toString()));if(m){if(x.type==="attach"){p.close(1008,"Already attached");return}h?.send(x)}else{if(b||x.type!=="attach"||!e.tickets.consume(x.ticket,d,l)){p.close(1008,"Invalid attach");return}b=!0;let E=e.service.get(l);if(E.state!=="running"){p.close(1013,"Terminal is not running");return}if(h=await e.transport.connect(E.directory,l),p.readyState!==Hi.OPEN){h.close();return}m=!0,clearTimeout(A),h.onMessage(k=>{if(!e.auth.sessionValid(d)||p.bufferedAmount>2e6){p.close(1013,"Reconnect to synchronize");return}p.readyState===Hi.OPEN&&p.send(JSON.stringify(k))}),h.onClose(()=>p.close(1e3,"Terminal disconnected"))}}catch{p.close(1008,"Invalid terminal request")}})})};return r.on("upgrade",n),()=>{r.off("upgrade",n);for(let s of t.clients){s.close(1012,"Application restarting");let i=setTimeout(()=>s.terminate(),1e3);i.unref(),s.once("close",()=>clearTimeout(i))}t.close()}}import{execFile as Yu}from"node:child_process";import{promisify as Zu}from"node:util";import{userInfo as Qu}from"node:os";import{createServer as el,createConnection as tl}from"node:net";import{chmodSync as rl,existsSync as nr,lstatSync as Xi,unlinkSync as nl}from"node:fs";import{createHash as sl}from"node:crypto";import{join as Ji}from"node:path";import{spawn as il}from"node-pty";import{chmodSync as zi,mkdirSync as Vi,openSync as $i,closeSync as Bi,fsyncSync as Fi,writeFileSync as Ju,renameSync as Gu,unlinkSync as Ku}from"node:fs";import{dirname as Wi}from"node:path";import{randomUUID as Xu}from"node:crypto";function je(r){Vi(r,{recursive:!0,mode:448}),zi(r,448)}function fe(r){Vi(r,{recursive:!0,mode:448})}function Te(r){zi(r,384)}function Ye(r,e){fe(Wi(r));let t=`${r}.${Xu()}.tmp`,n=$i(t,"wx",384);try{try{Ju(n,e),Fi(n)}finally{Bi(n)}Gu(t,r);let s=$i(Wi(r),"r");try{Fi(s)}finally{Bi(s)}}finally{try{Ku(t)}catch(s){if(s.code!=="ENOENT")throw s}}}var rr=Zu(Yu),Yi={diagnosticCommand(r){if(!/^[A-Za-z0-9_]+$/.test(r))throw new Error("Invalid diagnostic marker");return`command printf '\\n%s%s\\n' '${r.slice(0,15)}' '${r.slice(15)}'\r`},resolve(){let r=Qu(),e=r.shell&&nr(r.shell)?r.shell:"/bin/sh",t={HOME:r.homedir,USER:r.username,LOGNAME:r.username,PATH:process.env.PATH??"/usr/local/bin:/usr/bin:/bin",TERM:"xterm-256color",LANG:process.env.LANG??"C.UTF-8"};return{executable:e,args:["-l"],env:t}}},Zi={spawn(r,e,t,n){let s=il(r.executable,r.args,{cwd:e,cols:t,rows:n,env:r.env,name:"xterm-256color"});return{write:i=>s.write(i),resize:(i,o)=>s.resize(i,o),terminate:()=>s.kill(),pause:()=>s.pause(),resume:()=>s.resume(),onOutput:i=>{let o=s.onData(i);return()=>o.dispose()},onExit:i=>{let o=s.onExit(a=>i(a.exitCode));return()=>o.dispose()}}}};function Qi(r,e=()=>nr("/usr/local/libexec/palmagent-terminal-control")&&nr("/etc/systemd/system/palmagent-terminal@.service")){return{get capabilities(){let t=r&&e();return{available:t,persistent:t,...t?{}:{reason:r?"Terminal services are not installed. Run palmagent setup to repair this installation.":"Run palmagent setup on a package installation to enable terminals."}}},async inspect(){let t="00000000-0000-4000-8000-000000000000";if((await rr("systemctl",["show","palmagent-terminal@"+t+".service","--property=LoadState","--value"],{timeout:3e3})).stdout.trim()!=="loaded")throw new Error("Terminal service template is not loaded; run palmagent setup");try{await rr("sudo",["-n","-l","/usr/local/libexec/palmagent-terminal-control","start",t],{timeout:3e3})}catch{throw new Error("Terminal service permissions are unavailable; run palmagent setup as the installation owner")}},async launch(t){try{await rr("sudo",["-n","/usr/local/libexec/palmagent-terminal-control","start",t.id],{timeout:1e4})}catch{throw new Error("Terminal launch is unconfirmed. Check terminal status before retrying.")}},async terminate(t){try{await rr("sudo",["-n","/usr/local/libexec/palmagent-terminal-control","stop",t.id],{timeout:1e4})}catch{throw new Error("Terminal termination could not be confirmed")}},async alive(t){let n=await rr("systemctl",["show","--property=ActiveState","--value","palmagent-terminal@"+t.id+".service"],{timeout:3e3});return!["inactive","failed"].includes(n.stdout.trim())}}}function Gi(r,e){let t=Ji("/tmp","palmagent-term-"+process.getuid?.()+"-"+sl("sha256").update(r).digest("hex").slice(0,12));if(nr(t)){let n=Xi(t);if(!n.isDirectory()||n.isSymbolicLink()||n.uid!==process.getuid?.()||n.mode&63)throw new Error("Unsafe terminal socket directory")}else je(t);return Ji(t,e+".sock")}function Ki(r){let e="",t=()=>{},n=()=>{};return r.setEncoding("utf8"),r.on("error",()=>r.destroy()),r.on("close",()=>n()),r.on("data",s=>{if(e+=s,e.length>4e6){r.destroy();return}let i;for(;(i=e.indexOf(`
|