@typescape-ai/mcp 1.9.25 → 1.9.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/mcp.js +2 -2
  2. package/package.json +1 -1
package/dist/mcp.js CHANGED
@@ -1,4 +1,4 @@
1
- import{createRequire as QX}from"node:module";var _X=Object.create;var{getPrototypeOf:bX,defineProperty:t_,getOwnPropertyNames:UX}=Object;var kX=Object.prototype.hasOwnProperty;function lX(n){return this[n]}var DX,JX,y0=(n,i,$)=>{var g=n!=null&&typeof n==="object";if(g){var v=i?DX??=new WeakMap:JX??=new WeakMap,w=v.get(n);if(w)return w}$=n!=null?_X(bX(n)):{};let _=i||!n||!n.__esModule?t_($,"default",{value:n,enumerable:!0}):$;for(let U of UX(n))if(!kX.call(_,U))t_(_,U,{get:lX.bind(n,U),enumerable:!0});if(g)v.set(n,_);return _};var XX=(n,i)=>()=>(i||n((i={exports:{}}).exports,i),i.exports);var GX=(n)=>n;function tX(n,i){this[n]=GX.bind(null,i)}var Nn=(n,i)=>{for(var $ in i)t_(n,$,{get:i[$],enumerable:!0,configurable:!0,set:tX.bind(i,$)})};var d0=QX(import.meta.url);var Q_=XX((eY,WX)=>{WX.exports={name:"@typescape-ai/mcp",version:"1.9.25",description:"Typescape MCP server for review, finding, and rules workflows in external agent harnesses",type:"module",bin:{"typescape-mcp":"./bin/typescape-mcp"},files:["bin","dist","README.md"],exports:{".":"./dist/mcp.js"},publishConfig:{access:"public"},scripts:{build:"bun build src/index.ts --outfile=dist/mcp.js --target=node --bundle --minify",dev:"bun run --watch src/index.ts",test:"bun test",typecheck:"tsc --noEmit",lint:"eslint src",prepublishOnly:"bun run build"},dependencies:{},devDependencies:{"@modelcontextprotocol/sdk":"1.0.4","@types/bun":"1.3.8","@typescape/schemas":"workspace:*",zod:"4.3.0"},engines:{node:">=18.17.0",bun:">=1.0.0"},keywords:["typescape","mcp","mcp-server","model-context-protocol","agent","automation","review","finding","rules","cursor","windsurf","bun"],repository:{type:"git",url:"https://github.com/voidserf/typescape-docs.git",directory:"apps/mcp"},license:"MIT"}});function e0(){let n=new Map;return{register(i,$){n.set(i.name,{definition:i,handler:$})},getTools(){return Array.from(n.values()).map((i)=>i.definition)},getHandler(i){return n.get(i)?.handler}}}var YX=await Promise.resolve().then(() => y0(Q_(),1)),IX=`typescape-mcp/${YX.version}`;class D extends Error{status;code;requestId;details;fixHint;constructor(n,i,$,g,v,w){super($);this.status=n;this.code=i;this.requestId=g;this.details=v;this.fixHint=w;this.name="ApiError"}}var Bw=30000;function W_(n,i,$,g){let v=`${n}${i}${$}`;if(g&&Object.keys(g).length>0){let w=new URLSearchParams(g);v+=`?${w.toString()}`}return v}function Y_(n,i){return{Authorization:`Bearer ${n}`,Accept:"application/json","User-Agent":IX,...i}}function s0(n){let i=n.headers.get("X-Request-Id");if(typeof i!=="string"||i.trim().length===0)return null;return i}function n2(){return"missing_request_id"}function v2(n,i){if(typeof n.request_id==="string"&&n.request_id.trim().length>0)return n.request_id;let $=s0(i);if($!==null)return $;return n2()}function p0(n){let i=s0(n);if(i!==null)return i;return n2()}async function a0(n,i,$){let g;try{g=await fetch(n,{...i,signal:AbortSignal.timeout($)})}catch(U){if(U instanceof DOMException&&(U.name==="TimeoutError"||U.name==="AbortError")){let J=Math.round($/1000);throw new D(0,"request_timeout",`Request timed out after ${J}s. Check your network connection and server URL.`,"unknown")}let l=U instanceof Error?U.message:String(U);throw new D(0,"network_error",`Network error: ${l}`,"unknown")}let v=g.headers.get("Content-Type");if(v===null)throw new D(g.status,"invalid_response","Response missing Content-Type header","unknown");if(!v.includes("application/json"))throw new D(g.status,"invalid_response",`Unexpected Content-Type: ${v}`,"unknown");let w;try{w=await g.json()}catch(U){throw new D(g.status,"invalid_response",`Failed to parse JSON response: ${U instanceof Error?U.message:String(U)}`,"unknown")}let _=v2(w,g);if(typeof _!=="string"||_.trim().length===0)throw new D(g.status,"invalid_response","Response missing request_id","unknown");if(!g.ok){let U=w,k=U.error?.code;if(typeof k!=="string"||k.trim().length===0)throw new D(g.status,"invalid_response","Error response missing error.code",_);let l=U.error?.message;if(typeof l!=="string"||l.trim().length===0)throw new D(g.status,"invalid_response","Error response missing error.message",_);throw new D(g.status,k,l,_,U.error?.details,U.error?.fix_hint)}return{status:g.status,body:w,requestId:_}}async function jX(n,i,$){let g;try{g=await fetch(n,{...i,signal:AbortSignal.timeout($)})}catch(_){if(_ instanceof DOMException&&(_.name==="TimeoutError"||_.name==="AbortError")){let l=Math.round($/1000);throw new D(0,"request_timeout",`Request timed out after ${l}s. Check your network connection and server URL.`,"unknown")}let k=_ instanceof Error?_.message:String(_);throw new D(0,"network_error",`Network error: ${k}`,"unknown")}let v=g.headers.get("Content-Type");if(v===null)throw new D(g.status,"invalid_response","Response missing Content-Type header","unknown");if(v.includes("application/json")){let _;try{_=await g.json()}catch(k){throw new D(g.status,"invalid_response",`Failed to parse JSON response: ${k instanceof Error?k.message:String(k)}`,"unknown")}let U=v2(_,g);if(!g.ok){let k=_.error?.code,l=_.error?.message;if(typeof k!=="string"||k.trim().length===0||typeof l!=="string"||l.trim().length===0)throw new D(g.status,"invalid_response","Error response missing error.code or error.message",U);throw new D(g.status,k,l,U,_.error?.details,_.error?.fix_hint)}throw new D(g.status,"invalid_response","Expected text response but received JSON payload",U)}let w;try{w=await g.text()}catch(_){throw new D(g.status,"invalid_response",`Failed to read text response: ${_ instanceof Error?_.message:String(_)}`,p0(g))}return{status:g.status,body:w,requestId:p0(g)}}function i2(n,i,$=Bw){let v=n.replace(/\/$/,"");async function w(_,U,k={}){let l=W_(v,"/v1",U,k.query),J=Y_(i,k.headers);if(k.body!==void 0)J["Content-Type"]="application/json";return a0(l,{method:_,headers:J,body:k.body!==void 0?JSON.stringify(k.body):void 0},$)}return{async get(_,U){return w("GET",_,U)},async getText(_,U){let k=W_(v,"/v1",_,U?.query),l=Y_(i,{Accept:"text/plain, application/json",...U?.headers});return jX(k,{method:"GET",headers:l},$)},async post(_,U){return w("POST",_,U)},async patch(_,U){return w("PATCH",_,U)},async postFormData(_,U,k){let l=W_(v,"/v1",_,k?.query),J=Y_(i,k?.headers);return a0(l,{method:"POST",headers:J,body:U},$)},request:w}}var Z;(function(n){n.assertEqual=(v)=>v;function i(v){}n.assertIs=i;function $(v){throw Error()}n.assertNever=$,n.arrayToEnum=(v)=>{let w={};for(let _ of v)w[_]=_;return w},n.getValidEnumValues=(v)=>{let w=n.objectKeys(v).filter((U)=>typeof v[v[U]]!=="number"),_={};for(let U of w)_[U]=v[U];return n.objectValues(_)},n.objectValues=(v)=>{return n.objectKeys(v).map(function(w){return v[w]})},n.objectKeys=typeof Object.keys==="function"?(v)=>Object.keys(v):(v)=>{let w=[];for(let _ in v)if(Object.prototype.hasOwnProperty.call(v,_))w.push(_);return w},n.find=(v,w)=>{for(let _ of v)if(w(_))return _;return},n.isInteger=typeof Number.isInteger==="function"?(v)=>Number.isInteger(v):(v)=>typeof v==="number"&&isFinite(v)&&Math.floor(v)===v;function g(v,w=" | "){return v.map((_)=>typeof _==="string"?`'${_}'`:_).join(w)}n.joinValues=g,n.jsonStringifyReplacer=(v,w)=>{if(typeof w==="bigint")return w.toString();return w}})(Z||(Z={}));var j_;(function(n){n.mergeShapes=(i,$)=>{return{...i,...$}}})(j_||(j_={}));var c=Z.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),vv=(n)=>{switch(typeof n){case"undefined":return c.undefined;case"string":return c.string;case"number":return isNaN(n)?c.nan:c.number;case"boolean":return c.boolean;case"function":return c.function;case"bigint":return c.bigint;case"symbol":return c.symbol;case"object":if(Array.isArray(n))return c.array;if(n===null)return c.null;if(n.then&&typeof n.then==="function"&&n.catch&&typeof n.catch==="function")return c.promise;if(typeof Map<"u"&&n instanceof Map)return c.map;if(typeof Set<"u"&&n instanceof Set)return c.set;if(typeof Date<"u"&&n instanceof Date)return c.date;return c.object;default:return c.unknown}},q=Z.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"]),uX=(n)=>{return JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:")};class In extends Error{get errors(){return this.issues}constructor(n){super();this.issues=[],this.addIssue=($)=>{this.issues=[...this.issues,$]},this.addIssues=($=[])=>{this.issues=[...this.issues,...$]};let i=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,i);else this.__proto__=i;this.name="ZodError",this.issues=n}format(n){let i=n||function(v){return v.message},$={_errors:[]},g=(v)=>{for(let w of v.issues)if(w.code==="invalid_union")w.unionErrors.map(g);else if(w.code==="invalid_return_type")g(w.returnTypeError);else if(w.code==="invalid_arguments")g(w.argumentsError);else if(w.path.length===0)$._errors.push(i(w));else{let _=$,U=0;while(U<w.path.length){let k=w.path[U];if(U!==w.path.length-1)_[k]=_[k]||{_errors:[]};else _[k]=_[k]||{_errors:[]},_[k]._errors.push(i(w));_=_[k],U++}}};return g(this),$}static assert(n){if(!(n instanceof In))throw Error(`Not a ZodError: ${n}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Z.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(n=(i)=>i.message){let i={},$=[];for(let g of this.issues)if(g.path.length>0)i[g.path[0]]=i[g.path[0]]||[],i[g.path[0]].push(n(g));else $.push(n(g));return{formErrors:$,fieldErrors:i}}get formErrors(){return this.flatten()}}In.create=(n)=>{return new In(n)};var fi=(n,i)=>{let $;switch(n.code){case q.invalid_type:if(n.received===c.undefined)$="Required";else $=`Expected ${n.expected}, received ${n.received}`;break;case q.invalid_literal:$=`Invalid literal value, expected ${JSON.stringify(n.expected,Z.jsonStringifyReplacer)}`;break;case q.unrecognized_keys:$=`Unrecognized key(s) in object: ${Z.joinValues(n.keys,", ")}`;break;case q.invalid_union:$="Invalid input";break;case q.invalid_union_discriminator:$=`Invalid discriminator value. Expected ${Z.joinValues(n.options)}`;break;case q.invalid_enum_value:$=`Invalid enum value. Expected ${Z.joinValues(n.options)}, received '${n.received}'`;break;case q.invalid_arguments:$="Invalid function arguments";break;case q.invalid_return_type:$="Invalid function return type";break;case q.invalid_date:$="Invalid date";break;case q.invalid_string:if(typeof n.validation==="object")if("includes"in n.validation){if($=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position==="number")$=`${$} at one or more positions greater than or equal to ${n.validation.position}`}else if("startsWith"in n.validation)$=`Invalid input: must start with "${n.validation.startsWith}"`;else if("endsWith"in n.validation)$=`Invalid input: must end with "${n.validation.endsWith}"`;else Z.assertNever(n.validation);else if(n.validation!=="regex")$=`Invalid ${n.validation}`;else $="Invalid";break;case q.too_small:if(n.type==="array")$=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`;else if(n.type==="string")$=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`;else if(n.type==="number")$=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`;else if(n.type==="date")$=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`;else $="Invalid input";break;case q.too_big:if(n.type==="array")$=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`;else if(n.type==="string")$=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`;else if(n.type==="number")$=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`;else if(n.type==="bigint")$=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`;else if(n.type==="date")$=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`;else $="Invalid input";break;case q.custom:$="Invalid input";break;case q.invalid_intersection_types:$="Intersection results could not be merged";break;case q.not_multiple_of:$=`Number must be a multiple of ${n.multipleOf}`;break;case q.not_finite:$="Number must be finite";break;default:$=i.defaultError,Z.assertNever(n)}return{message:$}},w2=fi;function HX(n){w2=n}function Fw(){return w2}var Nw=(n)=>{let{data:i,path:$,errorMaps:g,issueData:v}=n,w=[...$,...v.path||[]],_={...v,path:w};if(v.message!==void 0)return{...v,path:w,message:v.message};let U="",k=g.filter((l)=>!!l).slice().reverse();for(let l of k)U=l(_,{data:i,defaultError:U}).message;return{...v,path:w,message:U}},VX=[];function F(n,i){let $=Fw(),g=Nw({issueData:i,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,$,$===fi?void 0:fi].filter((v)=>!!v)});n.common.issues.push(g)}class kn{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(n,i){let $=[];for(let g of i){if(g.status==="aborted")return z;if(g.status==="dirty")n.dirty();$.push(g.value)}return{status:n.value,value:$}}static async mergeObjectAsync(n,i){let $=[];for(let g of i){let v=await g.key,w=await g.value;$.push({key:v,value:w})}return kn.mergeObjectSync(n,$)}static mergeObjectSync(n,i){let $={};for(let g of i){let{key:v,value:w}=g;if(v.status==="aborted")return z;if(w.status==="aborted")return z;if(v.status==="dirty")n.dirty();if(w.status==="dirty")n.dirty();if(v.value!=="__proto__"&&(typeof w.value<"u"||g.alwaysSet))$[v.value]=w.value}return{status:n.value,value:$}}}var z=Object.freeze({status:"aborted"}),Hi=(n)=>({status:"dirty",value:n}),Jn=(n)=>({status:"valid",value:n}),u_=(n)=>n.status==="aborted",H_=(n)=>n.status==="dirty",dv=(n)=>n.status==="valid",E$=(n)=>typeof Promise<"u"&&n instanceof Promise;function cw(n,i,$,g){if($==="a"&&!g)throw TypeError("Private accessor was defined without a getter");if(typeof i==="function"?n!==i||!g:!i.has(n))throw TypeError("Cannot read private member from an object whose class did not declare it");return $==="m"?g:$==="a"?g.call(n):g?g.value:i.get(n)}function _2(n,i,$,g,v){if(g==="m")throw TypeError("Private method is not writable");if(g==="a"&&!v)throw TypeError("Private accessor was defined without a setter");if(typeof i==="function"?n!==i||!v:!i.has(n))throw TypeError("Cannot write private member to an object whose class did not declare it");return g==="a"?v.call(n,$):v?v.value=$:i.set(n,$),$}var P;(function(n){n.errToObj=(i)=>typeof i==="string"?{message:i}:i||{},n.toString=(i)=>typeof i==="string"?i:i===null||i===void 0?void 0:i.message})(P||(P={}));var h$,C$;class zn{constructor(n,i,$,g){this._cachedPath=[],this.parent=n,this.data=i,this._path=$,this._key=g}get path(){if(!this._cachedPath.length)if(this._key instanceof Array)this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var $2=(n,i)=>{if(dv(i))return{success:!0,data:i.value};else{if(!n.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let $=new In(n.common.issues);return this._error=$,this._error}}}};function A(n){if(!n)return{};let{errorMap:i,invalid_type_error:$,required_error:g,description:v}=n;if(i&&($||g))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(i)return{errorMap:i,description:v};return{errorMap:(_,U)=>{var k,l;let{message:J}=n;if(_.code==="invalid_enum_value")return{message:J!==null&&J!==void 0?J:U.defaultError};if(typeof U.data>"u")return{message:(k=J!==null&&J!==void 0?J:g)!==null&&k!==void 0?k:U.defaultError};if(_.code!=="invalid_type")return{message:U.defaultError};return{message:(l=J!==null&&J!==void 0?J:$)!==null&&l!==void 0?l:U.defaultError}},description:v}}class x{get description(){return this._def.description}_getType(n){return vv(n.data)}_getOrReturnCtx(n,i){return i||{common:n.parent.common,data:n.data,parsedType:vv(n.data),schemaErrorMap:this._def.errorMap,path:n.path,parent:n.parent}}_processInputParams(n){return{status:new kn,ctx:{common:n.parent.common,data:n.data,parsedType:vv(n.data),schemaErrorMap:this._def.errorMap,path:n.path,parent:n.parent}}}_parseSync(n){let i=this._parse(n);if(E$(i))throw Error("Synchronous parse encountered promise.");return i}_parseAsync(n){let i=this._parse(n);return Promise.resolve(i)}parse(n,i){let $=this.safeParse(n,i);if($.success)return $.data;throw $.error}safeParse(n,i){var $;let g={common:{issues:[],async:($=i===null||i===void 0?void 0:i.async)!==null&&$!==void 0?$:!1,contextualErrorMap:i===null||i===void 0?void 0:i.errorMap},path:(i===null||i===void 0?void 0:i.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:n,parsedType:vv(n)},v=this._parseSync({data:n,path:g.path,parent:g});return $2(g,v)}"~validate"(n){var i,$;let g={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:n,parsedType:vv(n)};if(!this["~standard"].async)try{let v=this._parseSync({data:n,path:[],parent:g});return dv(v)?{value:v.value}:{issues:g.common.issues}}catch(v){if(($=(i=v===null||v===void 0?void 0:v.message)===null||i===void 0?void 0:i.toLowerCase())===null||$===void 0?void 0:$.includes("encountered"))this["~standard"].async=!0;g.common={issues:[],async:!0}}return this._parseAsync({data:n,path:[],parent:g}).then((v)=>dv(v)?{value:v.value}:{issues:g.common.issues})}async parseAsync(n,i){let $=await this.safeParseAsync(n,i);if($.success)return $.data;throw $.error}async safeParseAsync(n,i){let $={common:{issues:[],contextualErrorMap:i===null||i===void 0?void 0:i.errorMap,async:!0},path:(i===null||i===void 0?void 0:i.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:n,parsedType:vv(n)},g=this._parse({data:n,path:$.path,parent:$}),v=await(E$(g)?g:Promise.resolve(g));return $2($,v)}refine(n,i){let $=(g)=>{if(typeof i==="string"||typeof i>"u")return{message:i};else if(typeof i==="function")return i(g);else return i};return this._refinement((g,v)=>{let w=n(g),_=()=>v.addIssue({code:q.custom,...$(g)});if(typeof Promise<"u"&&w instanceof Promise)return w.then((U)=>{if(!U)return _(),!1;else return!0});if(!w)return _(),!1;else return!0})}refinement(n,i){return this._refinement(($,g)=>{if(!n($))return g.addIssue(typeof i==="function"?i($,g):i),!1;else return!0})}_refinement(n){return new Vn({schema:this,typeName:S.ZodEffects,effect:{type:"refinement",refinement:n}})}superRefine(n){return this._refinement(n)}constructor(n){this.spa=this.safeParseAsync,this._def=n,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:(i)=>this["~validate"](i)}}optional(){return Sn.create(this,this._def)}nullable(){return iv.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Pn.create(this)}promise(){return sv.create(this,this._def)}or(n){return Oi.create([this,n],this._def)}and(n){return Bi.create(this,n,this._def)}transform(n){return new Vn({...A(this._def),schema:this,typeName:S.ZodEffects,effect:{type:"transform",transform:n}})}default(n){let i=typeof n==="function"?n:()=>n;return new Pi({...A(this._def),innerType:this,defaultValue:i,typeName:S.ZodDefault})}brand(){return new Sw({typeName:S.ZodBranded,type:this,...A(this._def)})}catch(n){let i=typeof n==="function"?n:()=>n;return new Si({...A(this._def),innerType:this,catchValue:i,typeName:S.ZodCatch})}describe(n){return new this.constructor({...this._def,description:n})}pipe(n){return y$.create(this,n)}readonly(){return zi.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var fX=/^c[^\s-]{8,}$/i,qX=/^[0-9a-z]+$/,LX=/^[0-9A-HJKMNP-TV-Z]{26}$/i,KX=/^[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,OX=/^[a-z0-9_-]{21}$/i,BX=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,FX=/^[-+]?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)?)??$/,NX=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,cX="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",I_,PX=/^(?:(?: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])$/,SX=/^(?:(?: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])$/,zX=/^(([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]))$/,MX=/^(([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])$/,RX=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,AX=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,b2="((\\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])))",xX=new RegExp(`^${b2}$`);function U2(n){let i="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";if(n.precision)i=`${i}\\.\\d{${n.precision}}`;else if(n.precision==null)i=`${i}(\\.\\d+)?`;return i}function hX(n){return new RegExp(`^${U2(n)}$`)}function k2(n){let i=`${b2}T${U2(n)}`,$=[];if($.push(n.local?"Z?":"Z"),n.offset)$.push("([+-]\\d{2}:?\\d{2})");return i=`${i}(${$.join("|")})`,new RegExp(`^${i}$`)}function CX(n,i){if((i==="v4"||!i)&&PX.test(n))return!0;if((i==="v6"||!i)&&zX.test(n))return!0;return!1}function EX(n,i){if(!BX.test(n))return!1;try{let[$]=n.split("."),g=$.replace(/-/g,"+").replace(/_/g,"/").padEnd($.length+(4-$.length%4)%4,"="),v=JSON.parse(atob(g));if(typeof v!=="object"||v===null)return!1;if(!v.typ||!v.alg)return!1;if(i&&v.alg!==i)return!1;return!0}catch($){return!1}}function oX(n,i){if((i==="v4"||!i)&&SX.test(n))return!0;if((i==="v6"||!i)&&MX.test(n))return!0;return!1}class cn extends x{_parse(n){if(this._def.coerce)n.data=String(n.data);if(this._getType(n)!==c.string){let v=this._getOrReturnCtx(n);return F(v,{code:q.invalid_type,expected:c.string,received:v.parsedType}),z}let $=new kn,g=void 0;for(let v of this._def.checks)if(v.kind==="min"){if(n.data.length<v.value)g=this._getOrReturnCtx(n,g),F(g,{code:q.too_small,minimum:v.value,type:"string",inclusive:!0,exact:!1,message:v.message}),$.dirty()}else if(v.kind==="max"){if(n.data.length>v.value)g=this._getOrReturnCtx(n,g),F(g,{code:q.too_big,maximum:v.value,type:"string",inclusive:!0,exact:!1,message:v.message}),$.dirty()}else if(v.kind==="length"){let w=n.data.length>v.value,_=n.data.length<v.value;if(w||_){if(g=this._getOrReturnCtx(n,g),w)F(g,{code:q.too_big,maximum:v.value,type:"string",inclusive:!0,exact:!0,message:v.message});else if(_)F(g,{code:q.too_small,minimum:v.value,type:"string",inclusive:!0,exact:!0,message:v.message});$.dirty()}}else if(v.kind==="email"){if(!NX.test(n.data))g=this._getOrReturnCtx(n,g),F(g,{validation:"email",code:q.invalid_string,message:v.message}),$.dirty()}else if(v.kind==="emoji"){if(!I_)I_=new RegExp(cX,"u");if(!I_.test(n.data))g=this._getOrReturnCtx(n,g),F(g,{validation:"emoji",code:q.invalid_string,message:v.message}),$.dirty()}else if(v.kind==="uuid"){if(!KX.test(n.data))g=this._getOrReturnCtx(n,g),F(g,{validation:"uuid",code:q.invalid_string,message:v.message}),$.dirty()}else if(v.kind==="nanoid"){if(!OX.test(n.data))g=this._getOrReturnCtx(n,g),F(g,{validation:"nanoid",code:q.invalid_string,message:v.message}),$.dirty()}else if(v.kind==="cuid"){if(!fX.test(n.data))g=this._getOrReturnCtx(n,g),F(g,{validation:"cuid",code:q.invalid_string,message:v.message}),$.dirty()}else if(v.kind==="cuid2"){if(!qX.test(n.data))g=this._getOrReturnCtx(n,g),F(g,{validation:"cuid2",code:q.invalid_string,message:v.message}),$.dirty()}else if(v.kind==="ulid"){if(!LX.test(n.data))g=this._getOrReturnCtx(n,g),F(g,{validation:"ulid",code:q.invalid_string,message:v.message}),$.dirty()}else if(v.kind==="url")try{new URL(n.data)}catch(w){g=this._getOrReturnCtx(n,g),F(g,{validation:"url",code:q.invalid_string,message:v.message}),$.dirty()}else if(v.kind==="regex"){if(v.regex.lastIndex=0,!v.regex.test(n.data))g=this._getOrReturnCtx(n,g),F(g,{validation:"regex",code:q.invalid_string,message:v.message}),$.dirty()}else if(v.kind==="trim")n.data=n.data.trim();else if(v.kind==="includes"){if(!n.data.includes(v.value,v.position))g=this._getOrReturnCtx(n,g),F(g,{code:q.invalid_string,validation:{includes:v.value,position:v.position},message:v.message}),$.dirty()}else if(v.kind==="toLowerCase")n.data=n.data.toLowerCase();else if(v.kind==="toUpperCase")n.data=n.data.toUpperCase();else if(v.kind==="startsWith"){if(!n.data.startsWith(v.value))g=this._getOrReturnCtx(n,g),F(g,{code:q.invalid_string,validation:{startsWith:v.value},message:v.message}),$.dirty()}else if(v.kind==="endsWith"){if(!n.data.endsWith(v.value))g=this._getOrReturnCtx(n,g),F(g,{code:q.invalid_string,validation:{endsWith:v.value},message:v.message}),$.dirty()}else if(v.kind==="datetime"){if(!k2(v).test(n.data))g=this._getOrReturnCtx(n,g),F(g,{code:q.invalid_string,validation:"datetime",message:v.message}),$.dirty()}else if(v.kind==="date"){if(!xX.test(n.data))g=this._getOrReturnCtx(n,g),F(g,{code:q.invalid_string,validation:"date",message:v.message}),$.dirty()}else if(v.kind==="time"){if(!hX(v).test(n.data))g=this._getOrReturnCtx(n,g),F(g,{code:q.invalid_string,validation:"time",message:v.message}),$.dirty()}else if(v.kind==="duration"){if(!FX.test(n.data))g=this._getOrReturnCtx(n,g),F(g,{validation:"duration",code:q.invalid_string,message:v.message}),$.dirty()}else if(v.kind==="ip"){if(!CX(n.data,v.version))g=this._getOrReturnCtx(n,g),F(g,{validation:"ip",code:q.invalid_string,message:v.message}),$.dirty()}else if(v.kind==="jwt"){if(!EX(n.data,v.alg))g=this._getOrReturnCtx(n,g),F(g,{validation:"jwt",code:q.invalid_string,message:v.message}),$.dirty()}else if(v.kind==="cidr"){if(!oX(n.data,v.version))g=this._getOrReturnCtx(n,g),F(g,{validation:"cidr",code:q.invalid_string,message:v.message}),$.dirty()}else if(v.kind==="base64"){if(!RX.test(n.data))g=this._getOrReturnCtx(n,g),F(g,{validation:"base64",code:q.invalid_string,message:v.message}),$.dirty()}else if(v.kind==="base64url"){if(!AX.test(n.data))g=this._getOrReturnCtx(n,g),F(g,{validation:"base64url",code:q.invalid_string,message:v.message}),$.dirty()}else Z.assertNever(v);return{status:$.value,value:n.data}}_regex(n,i,$){return this.refinement((g)=>n.test(g),{validation:i,code:q.invalid_string,...P.errToObj($)})}_addCheck(n){return new cn({...this._def,checks:[...this._def.checks,n]})}email(n){return this._addCheck({kind:"email",...P.errToObj(n)})}url(n){return this._addCheck({kind:"url",...P.errToObj(n)})}emoji(n){return this._addCheck({kind:"emoji",...P.errToObj(n)})}uuid(n){return this._addCheck({kind:"uuid",...P.errToObj(n)})}nanoid(n){return this._addCheck({kind:"nanoid",...P.errToObj(n)})}cuid(n){return this._addCheck({kind:"cuid",...P.errToObj(n)})}cuid2(n){return this._addCheck({kind:"cuid2",...P.errToObj(n)})}ulid(n){return this._addCheck({kind:"ulid",...P.errToObj(n)})}base64(n){return this._addCheck({kind:"base64",...P.errToObj(n)})}base64url(n){return this._addCheck({kind:"base64url",...P.errToObj(n)})}jwt(n){return this._addCheck({kind:"jwt",...P.errToObj(n)})}ip(n){return this._addCheck({kind:"ip",...P.errToObj(n)})}cidr(n){return this._addCheck({kind:"cidr",...P.errToObj(n)})}datetime(n){var i,$;if(typeof n==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:n});return this._addCheck({kind:"datetime",precision:typeof(n===null||n===void 0?void 0:n.precision)>"u"?null:n===null||n===void 0?void 0:n.precision,offset:(i=n===null||n===void 0?void 0:n.offset)!==null&&i!==void 0?i:!1,local:($=n===null||n===void 0?void 0:n.local)!==null&&$!==void 0?$:!1,...P.errToObj(n===null||n===void 0?void 0:n.message)})}date(n){return this._addCheck({kind:"date",message:n})}time(n){if(typeof n==="string")return this._addCheck({kind:"time",precision:null,message:n});return this._addCheck({kind:"time",precision:typeof(n===null||n===void 0?void 0:n.precision)>"u"?null:n===null||n===void 0?void 0:n.precision,...P.errToObj(n===null||n===void 0?void 0:n.message)})}duration(n){return this._addCheck({kind:"duration",...P.errToObj(n)})}regex(n,i){return this._addCheck({kind:"regex",regex:n,...P.errToObj(i)})}includes(n,i){return this._addCheck({kind:"includes",value:n,position:i===null||i===void 0?void 0:i.position,...P.errToObj(i===null||i===void 0?void 0:i.message)})}startsWith(n,i){return this._addCheck({kind:"startsWith",value:n,...P.errToObj(i)})}endsWith(n,i){return this._addCheck({kind:"endsWith",value:n,...P.errToObj(i)})}min(n,i){return this._addCheck({kind:"min",value:n,...P.errToObj(i)})}max(n,i){return this._addCheck({kind:"max",value:n,...P.errToObj(i)})}length(n,i){return this._addCheck({kind:"length",value:n,...P.errToObj(i)})}nonempty(n){return this.min(1,P.errToObj(n))}trim(){return new cn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new cn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new cn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((n)=>n.kind==="datetime")}get isDate(){return!!this._def.checks.find((n)=>n.kind==="date")}get isTime(){return!!this._def.checks.find((n)=>n.kind==="time")}get isDuration(){return!!this._def.checks.find((n)=>n.kind==="duration")}get isEmail(){return!!this._def.checks.find((n)=>n.kind==="email")}get isURL(){return!!this._def.checks.find((n)=>n.kind==="url")}get isEmoji(){return!!this._def.checks.find((n)=>n.kind==="emoji")}get isUUID(){return!!this._def.checks.find((n)=>n.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((n)=>n.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((n)=>n.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((n)=>n.kind==="cuid2")}get isULID(){return!!this._def.checks.find((n)=>n.kind==="ulid")}get isIP(){return!!this._def.checks.find((n)=>n.kind==="ip")}get isCIDR(){return!!this._def.checks.find((n)=>n.kind==="cidr")}get isBase64(){return!!this._def.checks.find((n)=>n.kind==="base64")}get isBase64url(){return!!this._def.checks.find((n)=>n.kind==="base64url")}get minLength(){let n=null;for(let i of this._def.checks)if(i.kind==="min"){if(n===null||i.value>n)n=i.value}return n}get maxLength(){let n=null;for(let i of this._def.checks)if(i.kind==="max"){if(n===null||i.value<n)n=i.value}return n}}cn.create=(n)=>{var i;return new cn({checks:[],typeName:S.ZodString,coerce:(i=n===null||n===void 0?void 0:n.coerce)!==null&&i!==void 0?i:!1,...A(n)})};function TX(n,i){let $=(n.toString().split(".")[1]||"").length,g=(i.toString().split(".")[1]||"").length,v=$>g?$:g,w=parseInt(n.toFixed(v).replace(".","")),_=parseInt(i.toFixed(v).replace(".",""));return w%_/Math.pow(10,v)}class Wv extends x{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(n){if(this._def.coerce)n.data=Number(n.data);if(this._getType(n)!==c.number){let v=this._getOrReturnCtx(n);return F(v,{code:q.invalid_type,expected:c.number,received:v.parsedType}),z}let $=void 0,g=new kn;for(let v of this._def.checks)if(v.kind==="int"){if(!Z.isInteger(n.data))$=this._getOrReturnCtx(n,$),F($,{code:q.invalid_type,expected:"integer",received:"float",message:v.message}),g.dirty()}else if(v.kind==="min"){if(v.inclusive?n.data<v.value:n.data<=v.value)$=this._getOrReturnCtx(n,$),F($,{code:q.too_small,minimum:v.value,type:"number",inclusive:v.inclusive,exact:!1,message:v.message}),g.dirty()}else if(v.kind==="max"){if(v.inclusive?n.data>v.value:n.data>=v.value)$=this._getOrReturnCtx(n,$),F($,{code:q.too_big,maximum:v.value,type:"number",inclusive:v.inclusive,exact:!1,message:v.message}),g.dirty()}else if(v.kind==="multipleOf"){if(TX(n.data,v.value)!==0)$=this._getOrReturnCtx(n,$),F($,{code:q.not_multiple_of,multipleOf:v.value,message:v.message}),g.dirty()}else if(v.kind==="finite"){if(!Number.isFinite(n.data))$=this._getOrReturnCtx(n,$),F($,{code:q.not_finite,message:v.message}),g.dirty()}else Z.assertNever(v);return{status:g.value,value:n.data}}gte(n,i){return this.setLimit("min",n,!0,P.toString(i))}gt(n,i){return this.setLimit("min",n,!1,P.toString(i))}lte(n,i){return this.setLimit("max",n,!0,P.toString(i))}lt(n,i){return this.setLimit("max",n,!1,P.toString(i))}setLimit(n,i,$,g){return new Wv({...this._def,checks:[...this._def.checks,{kind:n,value:i,inclusive:$,message:P.toString(g)}]})}_addCheck(n){return new Wv({...this._def,checks:[...this._def.checks,n]})}int(n){return this._addCheck({kind:"int",message:P.toString(n)})}positive(n){return this._addCheck({kind:"min",value:0,inclusive:!1,message:P.toString(n)})}negative(n){return this._addCheck({kind:"max",value:0,inclusive:!1,message:P.toString(n)})}nonpositive(n){return this._addCheck({kind:"max",value:0,inclusive:!0,message:P.toString(n)})}nonnegative(n){return this._addCheck({kind:"min",value:0,inclusive:!0,message:P.toString(n)})}multipleOf(n,i){return this._addCheck({kind:"multipleOf",value:n,message:P.toString(i)})}finite(n){return this._addCheck({kind:"finite",message:P.toString(n)})}safe(n){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:P.toString(n)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:P.toString(n)})}get minValue(){let n=null;for(let i of this._def.checks)if(i.kind==="min"){if(n===null||i.value>n)n=i.value}return n}get maxValue(){let n=null;for(let i of this._def.checks)if(i.kind==="max"){if(n===null||i.value<n)n=i.value}return n}get isInt(){return!!this._def.checks.find((n)=>n.kind==="int"||n.kind==="multipleOf"&&Z.isInteger(n.value))}get isFinite(){let n=null,i=null;for(let $ of this._def.checks)if($.kind==="finite"||$.kind==="int"||$.kind==="multipleOf")return!0;else if($.kind==="min"){if(i===null||$.value>i)i=$.value}else if($.kind==="max"){if(n===null||$.value<n)n=$.value}return Number.isFinite(i)&&Number.isFinite(n)}}Wv.create=(n)=>{return new Wv({checks:[],typeName:S.ZodNumber,coerce:(n===null||n===void 0?void 0:n.coerce)||!1,...A(n)})};class Yv extends x{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(n){if(this._def.coerce)try{n.data=BigInt(n.data)}catch(v){return this._getInvalidInput(n)}if(this._getType(n)!==c.bigint)return this._getInvalidInput(n);let $=void 0,g=new kn;for(let v of this._def.checks)if(v.kind==="min"){if(v.inclusive?n.data<v.value:n.data<=v.value)$=this._getOrReturnCtx(n,$),F($,{code:q.too_small,type:"bigint",minimum:v.value,inclusive:v.inclusive,message:v.message}),g.dirty()}else if(v.kind==="max"){if(v.inclusive?n.data>v.value:n.data>=v.value)$=this._getOrReturnCtx(n,$),F($,{code:q.too_big,type:"bigint",maximum:v.value,inclusive:v.inclusive,message:v.message}),g.dirty()}else if(v.kind==="multipleOf"){if(n.data%v.value!==BigInt(0))$=this._getOrReturnCtx(n,$),F($,{code:q.not_multiple_of,multipleOf:v.value,message:v.message}),g.dirty()}else Z.assertNever(v);return{status:g.value,value:n.data}}_getInvalidInput(n){let i=this._getOrReturnCtx(n);return F(i,{code:q.invalid_type,expected:c.bigint,received:i.parsedType}),z}gte(n,i){return this.setLimit("min",n,!0,P.toString(i))}gt(n,i){return this.setLimit("min",n,!1,P.toString(i))}lte(n,i){return this.setLimit("max",n,!0,P.toString(i))}lt(n,i){return this.setLimit("max",n,!1,P.toString(i))}setLimit(n,i,$,g){return new Yv({...this._def,checks:[...this._def.checks,{kind:n,value:i,inclusive:$,message:P.toString(g)}]})}_addCheck(n){return new Yv({...this._def,checks:[...this._def.checks,n]})}positive(n){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:P.toString(n)})}negative(n){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:P.toString(n)})}nonpositive(n){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:P.toString(n)})}nonnegative(n){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:P.toString(n)})}multipleOf(n,i){return this._addCheck({kind:"multipleOf",value:n,message:P.toString(i)})}get minValue(){let n=null;for(let i of this._def.checks)if(i.kind==="min"){if(n===null||i.value>n)n=i.value}return n}get maxValue(){let n=null;for(let i of this._def.checks)if(i.kind==="max"){if(n===null||i.value<n)n=i.value}return n}}Yv.create=(n)=>{var i;return new Yv({checks:[],typeName:S.ZodBigInt,coerce:(i=n===null||n===void 0?void 0:n.coerce)!==null&&i!==void 0?i:!1,...A(n)})};class qi extends x{_parse(n){if(this._def.coerce)n.data=Boolean(n.data);if(this._getType(n)!==c.boolean){let $=this._getOrReturnCtx(n);return F($,{code:q.invalid_type,expected:c.boolean,received:$.parsedType}),z}return Jn(n.data)}}qi.create=(n)=>{return new qi({typeName:S.ZodBoolean,coerce:(n===null||n===void 0?void 0:n.coerce)||!1,...A(n)})};class ev extends x{_parse(n){if(this._def.coerce)n.data=new Date(n.data);if(this._getType(n)!==c.date){let v=this._getOrReturnCtx(n);return F(v,{code:q.invalid_type,expected:c.date,received:v.parsedType}),z}if(isNaN(n.data.getTime())){let v=this._getOrReturnCtx(n);return F(v,{code:q.invalid_date}),z}let $=new kn,g=void 0;for(let v of this._def.checks)if(v.kind==="min"){if(n.data.getTime()<v.value)g=this._getOrReturnCtx(n,g),F(g,{code:q.too_small,message:v.message,inclusive:!0,exact:!1,minimum:v.value,type:"date"}),$.dirty()}else if(v.kind==="max"){if(n.data.getTime()>v.value)g=this._getOrReturnCtx(n,g),F(g,{code:q.too_big,message:v.message,inclusive:!0,exact:!1,maximum:v.value,type:"date"}),$.dirty()}else Z.assertNever(v);return{status:$.value,value:new Date(n.data.getTime())}}_addCheck(n){return new ev({...this._def,checks:[...this._def.checks,n]})}min(n,i){return this._addCheck({kind:"min",value:n.getTime(),message:P.toString(i)})}max(n,i){return this._addCheck({kind:"max",value:n.getTime(),message:P.toString(i)})}get minDate(){let n=null;for(let i of this._def.checks)if(i.kind==="min"){if(n===null||i.value>n)n=i.value}return n!=null?new Date(n):null}get maxDate(){let n=null;for(let i of this._def.checks)if(i.kind==="max"){if(n===null||i.value<n)n=i.value}return n!=null?new Date(n):null}}ev.create=(n)=>{return new ev({checks:[],coerce:(n===null||n===void 0?void 0:n.coerce)||!1,typeName:S.ZodDate,...A(n)})};class o$ extends x{_parse(n){if(this._getType(n)!==c.symbol){let $=this._getOrReturnCtx(n);return F($,{code:q.invalid_type,expected:c.symbol,received:$.parsedType}),z}return Jn(n.data)}}o$.create=(n)=>{return new o$({typeName:S.ZodSymbol,...A(n)})};class Li extends x{_parse(n){if(this._getType(n)!==c.undefined){let $=this._getOrReturnCtx(n);return F($,{code:q.invalid_type,expected:c.undefined,received:$.parsedType}),z}return Jn(n.data)}}Li.create=(n)=>{return new Li({typeName:S.ZodUndefined,...A(n)})};class Ki extends x{_parse(n){if(this._getType(n)!==c.null){let $=this._getOrReturnCtx(n);return F($,{code:q.invalid_type,expected:c.null,received:$.parsedType}),z}return Jn(n.data)}}Ki.create=(n)=>{return new Ki({typeName:S.ZodNull,...A(n)})};class pv extends x{constructor(){super(...arguments);this._any=!0}_parse(n){return Jn(n.data)}}pv.create=(n)=>{return new pv({typeName:S.ZodAny,...A(n)})};class Qv extends x{constructor(){super(...arguments);this._unknown=!0}_parse(n){return Jn(n.data)}}Qv.create=(n)=>{return new Qv({typeName:S.ZodUnknown,...A(n)})};class Tn extends x{_parse(n){let i=this._getOrReturnCtx(n);return F(i,{code:q.invalid_type,expected:c.never,received:i.parsedType}),z}}Tn.create=(n)=>{return new Tn({typeName:S.ZodNever,...A(n)})};class T$ extends x{_parse(n){if(this._getType(n)!==c.undefined){let $=this._getOrReturnCtx(n);return F($,{code:q.invalid_type,expected:c.void,received:$.parsedType}),z}return Jn(n.data)}}T$.create=(n)=>{return new T$({typeName:S.ZodVoid,...A(n)})};class Pn extends x{_parse(n){let{ctx:i,status:$}=this._processInputParams(n),g=this._def;if(i.parsedType!==c.array)return F(i,{code:q.invalid_type,expected:c.array,received:i.parsedType}),z;if(g.exactLength!==null){let w=i.data.length>g.exactLength.value,_=i.data.length<g.exactLength.value;if(w||_)F(i,{code:w?q.too_big:q.too_small,minimum:_?g.exactLength.value:void 0,maximum:w?g.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:g.exactLength.message}),$.dirty()}if(g.minLength!==null){if(i.data.length<g.minLength.value)F(i,{code:q.too_small,minimum:g.minLength.value,type:"array",inclusive:!0,exact:!1,message:g.minLength.message}),$.dirty()}if(g.maxLength!==null){if(i.data.length>g.maxLength.value)F(i,{code:q.too_big,maximum:g.maxLength.value,type:"array",inclusive:!0,exact:!1,message:g.maxLength.message}),$.dirty()}if(i.common.async)return Promise.all([...i.data].map((w,_)=>{return g.type._parseAsync(new zn(i,w,i.path,_))})).then((w)=>{return kn.mergeArray($,w)});let v=[...i.data].map((w,_)=>{return g.type._parseSync(new zn(i,w,i.path,_))});return kn.mergeArray($,v)}get element(){return this._def.type}min(n,i){return new Pn({...this._def,minLength:{value:n,message:P.toString(i)}})}max(n,i){return new Pn({...this._def,maxLength:{value:n,message:P.toString(i)}})}length(n,i){return new Pn({...this._def,exactLength:{value:n,message:P.toString(i)}})}nonempty(n){return this.min(1,n)}}Pn.create=(n,i)=>{return new Pn({type:n,minLength:null,maxLength:null,exactLength:null,typeName:S.ZodArray,...A(i)})};function ui(n){if(n instanceof nn){let i={};for(let $ in n.shape){let g=n.shape[$];i[$]=Sn.create(ui(g))}return new nn({...n._def,shape:()=>i})}else if(n instanceof Pn)return new Pn({...n._def,type:ui(n.element)});else if(n instanceof Sn)return Sn.create(ui(n.unwrap()));else if(n instanceof iv)return iv.create(ui(n.unwrap()));else if(n instanceof Zn)return Zn.create(n.items.map((i)=>ui(i)));else return n}class nn extends x{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let n=this._def.shape(),i=Z.objectKeys(n);return this._cached={shape:n,keys:i}}_parse(n){if(this._getType(n)!==c.object){let k=this._getOrReturnCtx(n);return F(k,{code:q.invalid_type,expected:c.object,received:k.parsedType}),z}let{status:$,ctx:g}=this._processInputParams(n),{shape:v,keys:w}=this._getCached(),_=[];if(!(this._def.catchall instanceof Tn&&this._def.unknownKeys==="strip")){for(let k in g.data)if(!w.includes(k))_.push(k)}let U=[];for(let k of w){let l=v[k],J=g.data[k];U.push({key:{status:"valid",value:k},value:l._parse(new zn(g,J,g.path,k)),alwaysSet:k in g.data})}if(this._def.catchall instanceof Tn){let k=this._def.unknownKeys;if(k==="passthrough")for(let l of _)U.push({key:{status:"valid",value:l},value:{status:"valid",value:g.data[l]}});else if(k==="strict"){if(_.length>0)F(g,{code:q.unrecognized_keys,keys:_}),$.dirty()}else if(k==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let k=this._def.catchall;for(let l of _){let J=g.data[l];U.push({key:{status:"valid",value:l},value:k._parse(new zn(g,J,g.path,l)),alwaysSet:l in g.data})}}if(g.common.async)return Promise.resolve().then(async()=>{let k=[];for(let l of U){let J=await l.key,Q=await l.value;k.push({key:J,value:Q,alwaysSet:l.alwaysSet})}return k}).then((k)=>{return kn.mergeObjectSync($,k)});else return kn.mergeObjectSync($,U)}get shape(){return this._def.shape()}strict(n){return P.errToObj,new nn({...this._def,unknownKeys:"strict",...n!==void 0?{errorMap:(i,$)=>{var g,v,w,_;let U=(w=(v=(g=this._def).errorMap)===null||v===void 0?void 0:v.call(g,i,$).message)!==null&&w!==void 0?w:$.defaultError;if(i.code==="unrecognized_keys")return{message:(_=P.errToObj(n).message)!==null&&_!==void 0?_:U};return{message:U}}}:{}})}strip(){return new nn({...this._def,unknownKeys:"strip"})}passthrough(){return new nn({...this._def,unknownKeys:"passthrough"})}extend(n){return new nn({...this._def,shape:()=>({...this._def.shape(),...n})})}merge(n){return new nn({unknownKeys:n._def.unknownKeys,catchall:n._def.catchall,shape:()=>({...this._def.shape(),...n._def.shape()}),typeName:S.ZodObject})}setKey(n,i){return this.augment({[n]:i})}catchall(n){return new nn({...this._def,catchall:n})}pick(n){let i={};return Z.objectKeys(n).forEach(($)=>{if(n[$]&&this.shape[$])i[$]=this.shape[$]}),new nn({...this._def,shape:()=>i})}omit(n){let i={};return Z.objectKeys(this.shape).forEach(($)=>{if(!n[$])i[$]=this.shape[$]}),new nn({...this._def,shape:()=>i})}deepPartial(){return ui(this)}partial(n){let i={};return Z.objectKeys(this.shape).forEach(($)=>{let g=this.shape[$];if(n&&!n[$])i[$]=g;else i[$]=g.optional()}),new nn({...this._def,shape:()=>i})}required(n){let i={};return Z.objectKeys(this.shape).forEach(($)=>{if(n&&!n[$])i[$]=this.shape[$];else{let v=this.shape[$];while(v instanceof Sn)v=v._def.innerType;i[$]=v}}),new nn({...this._def,shape:()=>i})}keyof(){return l2(Z.objectKeys(this.shape))}}nn.create=(n,i)=>{return new nn({shape:()=>n,unknownKeys:"strip",catchall:Tn.create(),typeName:S.ZodObject,...A(i)})};nn.strictCreate=(n,i)=>{return new nn({shape:()=>n,unknownKeys:"strict",catchall:Tn.create(),typeName:S.ZodObject,...A(i)})};nn.lazycreate=(n,i)=>{return new nn({shape:n,unknownKeys:"strip",catchall:Tn.create(),typeName:S.ZodObject,...A(i)})};class Oi extends x{_parse(n){let{ctx:i}=this._processInputParams(n),$=this._def.options;function g(v){for(let _ of v)if(_.result.status==="valid")return _.result;for(let _ of v)if(_.result.status==="dirty")return i.common.issues.push(..._.ctx.common.issues),_.result;let w=v.map((_)=>new In(_.ctx.common.issues));return F(i,{code:q.invalid_union,unionErrors:w}),z}if(i.common.async)return Promise.all($.map(async(v)=>{let w={...i,common:{...i.common,issues:[]},parent:null};return{result:await v._parseAsync({data:i.data,path:i.path,parent:w}),ctx:w}})).then(g);else{let v=void 0,w=[];for(let U of $){let k={...i,common:{...i.common,issues:[]},parent:null},l=U._parseSync({data:i.data,path:i.path,parent:k});if(l.status==="valid")return l;else if(l.status==="dirty"&&!v)v={result:l,ctx:k};if(k.common.issues.length)w.push(k.common.issues)}if(v)return i.common.issues.push(...v.ctx.common.issues),v.result;let _=w.map((U)=>new In(U));return F(i,{code:q.invalid_union,unionErrors:_}),z}}get options(){return this._def.options}}Oi.create=(n,i)=>{return new Oi({options:n,typeName:S.ZodUnion,...A(i)})};var nv=(n)=>{if(n instanceof Fi)return nv(n.schema);else if(n instanceof Vn)return nv(n.innerType());else if(n instanceof Ni)return[n.value];else if(n instanceof Iv)return n.options;else if(n instanceof ci)return Z.objectValues(n.enum);else if(n instanceof Pi)return nv(n._def.innerType);else if(n instanceof Li)return[void 0];else if(n instanceof Ki)return[null];else if(n instanceof Sn)return[void 0,...nv(n.unwrap())];else if(n instanceof iv)return[null,...nv(n.unwrap())];else if(n instanceof Sw)return nv(n.unwrap());else if(n instanceof zi)return nv(n.unwrap());else if(n instanceof Si)return nv(n._def.innerType);else return[]};class Pw extends x{_parse(n){let{ctx:i}=this._processInputParams(n);if(i.parsedType!==c.object)return F(i,{code:q.invalid_type,expected:c.object,received:i.parsedType}),z;let $=this.discriminator,g=i.data[$],v=this.optionsMap.get(g);if(!v)return F(i,{code:q.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[$]}),z;if(i.common.async)return v._parseAsync({data:i.data,path:i.path,parent:i});else return v._parseSync({data:i.data,path:i.path,parent:i})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(n,i,$){let g=new Map;for(let v of i){let w=nv(v.shape[n]);if(!w.length)throw Error(`A discriminator value for key \`${n}\` could not be extracted from all schema options`);for(let _ of w){if(g.has(_))throw Error(`Discriminator property ${String(n)} has duplicate value ${String(_)}`);g.set(_,v)}}return new Pw({typeName:S.ZodDiscriminatedUnion,discriminator:n,options:i,optionsMap:g,...A($)})}}function V_(n,i){let $=vv(n),g=vv(i);if(n===i)return{valid:!0,data:n};else if($===c.object&&g===c.object){let v=Z.objectKeys(i),w=Z.objectKeys(n).filter((U)=>v.indexOf(U)!==-1),_={...n,...i};for(let U of w){let k=V_(n[U],i[U]);if(!k.valid)return{valid:!1};_[U]=k.data}return{valid:!0,data:_}}else if($===c.array&&g===c.array){if(n.length!==i.length)return{valid:!1};let v=[];for(let w=0;w<n.length;w++){let _=n[w],U=i[w],k=V_(_,U);if(!k.valid)return{valid:!1};v.push(k.data)}return{valid:!0,data:v}}else if($===c.date&&g===c.date&&+n===+i)return{valid:!0,data:n};else return{valid:!1}}class Bi extends x{_parse(n){let{status:i,ctx:$}=this._processInputParams(n),g=(v,w)=>{if(u_(v)||u_(w))return z;let _=V_(v.value,w.value);if(!_.valid)return F($,{code:q.invalid_intersection_types}),z;if(H_(v)||H_(w))i.dirty();return{status:i.value,value:_.data}};if($.common.async)return Promise.all([this._def.left._parseAsync({data:$.data,path:$.path,parent:$}),this._def.right._parseAsync({data:$.data,path:$.path,parent:$})]).then(([v,w])=>g(v,w));else return g(this._def.left._parseSync({data:$.data,path:$.path,parent:$}),this._def.right._parseSync({data:$.data,path:$.path,parent:$}))}}Bi.create=(n,i,$)=>{return new Bi({left:n,right:i,typeName:S.ZodIntersection,...A($)})};class Zn extends x{_parse(n){let{status:i,ctx:$}=this._processInputParams(n);if($.parsedType!==c.array)return F($,{code:q.invalid_type,expected:c.array,received:$.parsedType}),z;if($.data.length<this._def.items.length)return F($,{code:q.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),z;if(!this._def.rest&&$.data.length>this._def.items.length)F($,{code:q.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),i.dirty();let v=[...$.data].map((w,_)=>{let U=this._def.items[_]||this._def.rest;if(!U)return null;return U._parse(new zn($,w,$.path,_))}).filter((w)=>!!w);if($.common.async)return Promise.all(v).then((w)=>{return kn.mergeArray(i,w)});else return kn.mergeArray(i,v)}get items(){return this._def.items}rest(n){return new Zn({...this._def,rest:n})}}Zn.create=(n,i)=>{if(!Array.isArray(n))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new Zn({items:n,typeName:S.ZodTuple,rest:null,...A(i)})};class Z$ extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(n){let{status:i,ctx:$}=this._processInputParams(n);if($.parsedType!==c.object)return F($,{code:q.invalid_type,expected:c.object,received:$.parsedType}),z;let g=[],v=this._def.keyType,w=this._def.valueType;for(let _ in $.data)g.push({key:v._parse(new zn($,_,$.path,_)),value:w._parse(new zn($,$.data[_],$.path,_)),alwaysSet:_ in $.data});if($.common.async)return kn.mergeObjectAsync(i,g);else return kn.mergeObjectSync(i,g)}get element(){return this._def.valueType}static create(n,i,$){if(i instanceof x)return new Z$({keyType:n,valueType:i,typeName:S.ZodRecord,...A($)});return new Z$({keyType:cn.create(),valueType:n,typeName:S.ZodRecord,...A(i)})}}class r$ extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(n){let{status:i,ctx:$}=this._processInputParams(n);if($.parsedType!==c.map)return F($,{code:q.invalid_type,expected:c.map,received:$.parsedType}),z;let g=this._def.keyType,v=this._def.valueType,w=[...$.data.entries()].map(([_,U],k)=>{return{key:g._parse(new zn($,_,$.path,[k,"key"])),value:v._parse(new zn($,U,$.path,[k,"value"]))}});if($.common.async){let _=new Map;return Promise.resolve().then(async()=>{for(let U of w){let k=await U.key,l=await U.value;if(k.status==="aborted"||l.status==="aborted")return z;if(k.status==="dirty"||l.status==="dirty")i.dirty();_.set(k.value,l.value)}return{status:i.value,value:_}})}else{let _=new Map;for(let U of w){let{key:k,value:l}=U;if(k.status==="aborted"||l.status==="aborted")return z;if(k.status==="dirty"||l.status==="dirty")i.dirty();_.set(k.value,l.value)}return{status:i.value,value:_}}}}r$.create=(n,i,$)=>{return new r$({valueType:i,keyType:n,typeName:S.ZodMap,...A($)})};class av extends x{_parse(n){let{status:i,ctx:$}=this._processInputParams(n);if($.parsedType!==c.set)return F($,{code:q.invalid_type,expected:c.set,received:$.parsedType}),z;let g=this._def;if(g.minSize!==null){if($.data.size<g.minSize.value)F($,{code:q.too_small,minimum:g.minSize.value,type:"set",inclusive:!0,exact:!1,message:g.minSize.message}),i.dirty()}if(g.maxSize!==null){if($.data.size>g.maxSize.value)F($,{code:q.too_big,maximum:g.maxSize.value,type:"set",inclusive:!0,exact:!1,message:g.maxSize.message}),i.dirty()}let v=this._def.valueType;function w(U){let k=new Set;for(let l of U){if(l.status==="aborted")return z;if(l.status==="dirty")i.dirty();k.add(l.value)}return{status:i.value,value:k}}let _=[...$.data.values()].map((U,k)=>v._parse(new zn($,U,$.path,k)));if($.common.async)return Promise.all(_).then((U)=>w(U));else return w(_)}min(n,i){return new av({...this._def,minSize:{value:n,message:P.toString(i)}})}max(n,i){return new av({...this._def,maxSize:{value:n,message:P.toString(i)}})}size(n,i){return this.min(n,i).max(n,i)}nonempty(n){return this.min(1,n)}}av.create=(n,i)=>{return new av({valueType:n,minSize:null,maxSize:null,typeName:S.ZodSet,...A(i)})};class Vi extends x{constructor(){super(...arguments);this.validate=this.implement}_parse(n){let{ctx:i}=this._processInputParams(n);if(i.parsedType!==c.function)return F(i,{code:q.invalid_type,expected:c.function,received:i.parsedType}),z;function $(_,U){return Nw({data:_,path:i.path,errorMaps:[i.common.contextualErrorMap,i.schemaErrorMap,Fw(),fi].filter((k)=>!!k),issueData:{code:q.invalid_arguments,argumentsError:U}})}function g(_,U){return Nw({data:_,path:i.path,errorMaps:[i.common.contextualErrorMap,i.schemaErrorMap,Fw(),fi].filter((k)=>!!k),issueData:{code:q.invalid_return_type,returnTypeError:U}})}let v={errorMap:i.common.contextualErrorMap},w=i.data;if(this._def.returns instanceof sv){let _=this;return Jn(async function(...U){let k=new In([]),l=await _._def.args.parseAsync(U,v).catch((j)=>{throw k.addIssue($(U,j)),k}),J=await Reflect.apply(w,this,l);return await _._def.returns._def.type.parseAsync(J,v).catch((j)=>{throw k.addIssue(g(J,j)),k})})}else{let _=this;return Jn(function(...U){let k=_._def.args.safeParse(U,v);if(!k.success)throw new In([$(U,k.error)]);let l=Reflect.apply(w,this,k.data),J=_._def.returns.safeParse(l,v);if(!J.success)throw new In([g(l,J.error)]);return J.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...n){return new Vi({...this._def,args:Zn.create(n).rest(Qv.create())})}returns(n){return new Vi({...this._def,returns:n})}implement(n){return this.parse(n)}strictImplement(n){return this.parse(n)}static create(n,i,$){return new Vi({args:n?n:Zn.create([]).rest(Qv.create()),returns:i||Qv.create(),typeName:S.ZodFunction,...A($)})}}class Fi extends x{get schema(){return this._def.getter()}_parse(n){let{ctx:i}=this._processInputParams(n);return this._def.getter()._parse({data:i.data,path:i.path,parent:i})}}Fi.create=(n,i)=>{return new Fi({getter:n,typeName:S.ZodLazy,...A(i)})};class Ni extends x{_parse(n){if(n.data!==this._def.value){let i=this._getOrReturnCtx(n);return F(i,{received:i.data,code:q.invalid_literal,expected:this._def.value}),z}return{status:"valid",value:n.data}}get value(){return this._def.value}}Ni.create=(n,i)=>{return new Ni({value:n,typeName:S.ZodLiteral,...A(i)})};function l2(n,i){return new Iv({values:n,typeName:S.ZodEnum,...A(i)})}class Iv extends x{constructor(){super(...arguments);h$.set(this,void 0)}_parse(n){if(typeof n.data!=="string"){let i=this._getOrReturnCtx(n),$=this._def.values;return F(i,{expected:Z.joinValues($),received:i.parsedType,code:q.invalid_type}),z}if(!cw(this,h$,"f"))_2(this,h$,new Set(this._def.values),"f");if(!cw(this,h$,"f").has(n.data)){let i=this._getOrReturnCtx(n),$=this._def.values;return F(i,{received:i.data,code:q.invalid_enum_value,options:$}),z}return Jn(n.data)}get options(){return this._def.values}get enum(){let n={};for(let i of this._def.values)n[i]=i;return n}get Values(){let n={};for(let i of this._def.values)n[i]=i;return n}get Enum(){let n={};for(let i of this._def.values)n[i]=i;return n}extract(n,i=this._def){return Iv.create(n,{...this._def,...i})}exclude(n,i=this._def){return Iv.create(this.options.filter(($)=>!n.includes($)),{...this._def,...i})}}h$=new WeakMap;Iv.create=l2;class ci extends x{constructor(){super(...arguments);C$.set(this,void 0)}_parse(n){let i=Z.getValidEnumValues(this._def.values),$=this._getOrReturnCtx(n);if($.parsedType!==c.string&&$.parsedType!==c.number){let g=Z.objectValues(i);return F($,{expected:Z.joinValues(g),received:$.parsedType,code:q.invalid_type}),z}if(!cw(this,C$,"f"))_2(this,C$,new Set(Z.getValidEnumValues(this._def.values)),"f");if(!cw(this,C$,"f").has(n.data)){let g=Z.objectValues(i);return F($,{received:$.data,code:q.invalid_enum_value,options:g}),z}return Jn(n.data)}get enum(){return this._def.values}}C$=new WeakMap;ci.create=(n,i)=>{return new ci({values:n,typeName:S.ZodNativeEnum,...A(i)})};class sv extends x{unwrap(){return this._def.type}_parse(n){let{ctx:i}=this._processInputParams(n);if(i.parsedType!==c.promise&&i.common.async===!1)return F(i,{code:q.invalid_type,expected:c.promise,received:i.parsedType}),z;let $=i.parsedType===c.promise?i.data:Promise.resolve(i.data);return Jn($.then((g)=>{return this._def.type.parseAsync(g,{path:i.path,errorMap:i.common.contextualErrorMap})}))}}sv.create=(n,i)=>{return new sv({type:n,typeName:S.ZodPromise,...A(i)})};class Vn extends x{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===S.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(n){let{status:i,ctx:$}=this._processInputParams(n),g=this._def.effect||null,v={addIssue:(w)=>{if(F($,w),w.fatal)i.abort();else i.dirty()},get path(){return $.path}};if(v.addIssue=v.addIssue.bind(v),g.type==="preprocess"){let w=g.transform($.data,v);if($.common.async)return Promise.resolve(w).then(async(_)=>{if(i.value==="aborted")return z;let U=await this._def.schema._parseAsync({data:_,path:$.path,parent:$});if(U.status==="aborted")return z;if(U.status==="dirty")return Hi(U.value);if(i.value==="dirty")return Hi(U.value);return U});else{if(i.value==="aborted")return z;let _=this._def.schema._parseSync({data:w,path:$.path,parent:$});if(_.status==="aborted")return z;if(_.status==="dirty")return Hi(_.value);if(i.value==="dirty")return Hi(_.value);return _}}if(g.type==="refinement"){let w=(_)=>{let U=g.refinement(_,v);if($.common.async)return Promise.resolve(U);if(U instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return _};if($.common.async===!1){let _=this._def.schema._parseSync({data:$.data,path:$.path,parent:$});if(_.status==="aborted")return z;if(_.status==="dirty")i.dirty();return w(_.value),{status:i.value,value:_.value}}else return this._def.schema._parseAsync({data:$.data,path:$.path,parent:$}).then((_)=>{if(_.status==="aborted")return z;if(_.status==="dirty")i.dirty();return w(_.value).then(()=>{return{status:i.value,value:_.value}})})}if(g.type==="transform")if($.common.async===!1){let w=this._def.schema._parseSync({data:$.data,path:$.path,parent:$});if(!dv(w))return w;let _=g.transform(w.value,v);if(_ instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:i.value,value:_}}else return this._def.schema._parseAsync({data:$.data,path:$.path,parent:$}).then((w)=>{if(!dv(w))return w;return Promise.resolve(g.transform(w.value,v)).then((_)=>({status:i.value,value:_}))});Z.assertNever(g)}}Vn.create=(n,i,$)=>{return new Vn({schema:n,typeName:S.ZodEffects,effect:i,...A($)})};Vn.createWithPreprocess=(n,i,$)=>{return new Vn({schema:i,effect:{type:"preprocess",transform:n},typeName:S.ZodEffects,...A($)})};class Sn extends x{_parse(n){if(this._getType(n)===c.undefined)return Jn(void 0);return this._def.innerType._parse(n)}unwrap(){return this._def.innerType}}Sn.create=(n,i)=>{return new Sn({innerType:n,typeName:S.ZodOptional,...A(i)})};class iv extends x{_parse(n){if(this._getType(n)===c.null)return Jn(null);return this._def.innerType._parse(n)}unwrap(){return this._def.innerType}}iv.create=(n,i)=>{return new iv({innerType:n,typeName:S.ZodNullable,...A(i)})};class Pi extends x{_parse(n){let{ctx:i}=this._processInputParams(n),$=i.data;if(i.parsedType===c.undefined)$=this._def.defaultValue();return this._def.innerType._parse({data:$,path:i.path,parent:i})}removeDefault(){return this._def.innerType}}Pi.create=(n,i)=>{return new Pi({innerType:n,typeName:S.ZodDefault,defaultValue:typeof i.default==="function"?i.default:()=>i.default,...A(i)})};class Si extends x{_parse(n){let{ctx:i}=this._processInputParams(n),$={...i,common:{...i.common,issues:[]}},g=this._def.innerType._parse({data:$.data,path:$.path,parent:{...$}});if(E$(g))return g.then((v)=>{return{status:"valid",value:v.status==="valid"?v.value:this._def.catchValue({get error(){return new In($.common.issues)},input:$.data})}});else return{status:"valid",value:g.status==="valid"?g.value:this._def.catchValue({get error(){return new In($.common.issues)},input:$.data})}}removeCatch(){return this._def.innerType}}Si.create=(n,i)=>{return new Si({innerType:n,typeName:S.ZodCatch,catchValue:typeof i.catch==="function"?i.catch:()=>i.catch,...A(i)})};class m$ extends x{_parse(n){if(this._getType(n)!==c.nan){let $=this._getOrReturnCtx(n);return F($,{code:q.invalid_type,expected:c.nan,received:$.parsedType}),z}return{status:"valid",value:n.data}}}m$.create=(n)=>{return new m$({typeName:S.ZodNaN,...A(n)})};var ZX=Symbol("zod_brand");class Sw extends x{_parse(n){let{ctx:i}=this._processInputParams(n),$=i.data;return this._def.type._parse({data:$,path:i.path,parent:i})}unwrap(){return this._def.type}}class y$ extends x{_parse(n){let{status:i,ctx:$}=this._processInputParams(n);if($.common.async)return(async()=>{let v=await this._def.in._parseAsync({data:$.data,path:$.path,parent:$});if(v.status==="aborted")return z;if(v.status==="dirty")return i.dirty(),Hi(v.value);else return this._def.out._parseAsync({data:v.value,path:$.path,parent:$})})();else{let g=this._def.in._parseSync({data:$.data,path:$.path,parent:$});if(g.status==="aborted")return z;if(g.status==="dirty")return i.dirty(),{status:"dirty",value:g.value};else return this._def.out._parseSync({data:g.value,path:$.path,parent:$})}}static create(n,i){return new y$({in:n,out:i,typeName:S.ZodPipeline})}}class zi extends x{_parse(n){let i=this._def.innerType._parse(n),$=(g)=>{if(dv(g))g.value=Object.freeze(g.value);return g};return E$(i)?i.then((g)=>$(g)):$(i)}unwrap(){return this._def.innerType}}zi.create=(n,i)=>{return new zi({innerType:n,typeName:S.ZodReadonly,...A(i)})};function D2(n,i={},$){if(n)return pv.create().superRefine((g,v)=>{var w,_;if(!n(g)){let U=typeof i==="function"?i(g):typeof i==="string"?{message:i}:i,k=(_=(w=U.fatal)!==null&&w!==void 0?w:$)!==null&&_!==void 0?_:!0,l=typeof U==="string"?{message:U}:U;v.addIssue({code:"custom",...l,fatal:k})}});return pv.create()}var rX={object:nn.lazycreate},S;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(S||(S={}));var mX=(n,i={message:`Input not instance of ${n.name}`})=>D2(($)=>$ instanceof n,i),J2=cn.create,X2=Wv.create,yX=m$.create,dX=Yv.create,G2=qi.create,eX=ev.create,pX=o$.create,aX=Li.create,sX=Ki.create,nG=pv.create,vG=Qv.create,iG=Tn.create,$G=T$.create,gG=Pn.create,wG=nn.create,_G=nn.strictCreate,bG=Oi.create,UG=Pw.create,kG=Bi.create,lG=Zn.create,DG=Z$.create,JG=r$.create,XG=av.create,GG=Vi.create,tG=Fi.create,QG=Ni.create,WG=Iv.create,YG=ci.create,IG=sv.create,g2=Vn.create,jG=Sn.create,uG=iv.create,HG=Vn.createWithPreprocess,VG=y$.create,fG=()=>J2().optional(),qG=()=>X2().optional(),LG=()=>G2().optional(),KG={string:(n)=>cn.create({...n,coerce:!0}),number:(n)=>Wv.create({...n,coerce:!0}),boolean:(n)=>qi.create({...n,coerce:!0}),bigint:(n)=>Yv.create({...n,coerce:!0}),date:(n)=>ev.create({...n,coerce:!0})},OG=z,X=Object.freeze({__proto__:null,defaultErrorMap:fi,setErrorMap:HX,getErrorMap:Fw,makeIssue:Nw,EMPTY_PATH:VX,addIssueToContext:F,ParseStatus:kn,INVALID:z,DIRTY:Hi,OK:Jn,isAborted:u_,isDirty:H_,isValid:dv,isAsync:E$,get util(){return Z},get objectUtil(){return j_},ZodParsedType:c,getParsedType:vv,ZodType:x,datetimeRegex:k2,ZodString:cn,ZodNumber:Wv,ZodBigInt:Yv,ZodBoolean:qi,ZodDate:ev,ZodSymbol:o$,ZodUndefined:Li,ZodNull:Ki,ZodAny:pv,ZodUnknown:Qv,ZodNever:Tn,ZodVoid:T$,ZodArray:Pn,ZodObject:nn,ZodUnion:Oi,ZodDiscriminatedUnion:Pw,ZodIntersection:Bi,ZodTuple:Zn,ZodRecord:Z$,ZodMap:r$,ZodSet:av,ZodFunction:Vi,ZodLazy:Fi,ZodLiteral:Ni,ZodEnum:Iv,ZodNativeEnum:ci,ZodPromise:sv,ZodEffects:Vn,ZodTransformer:Vn,ZodOptional:Sn,ZodNullable:iv,ZodDefault:Pi,ZodCatch:Si,ZodNaN:m$,BRAND:ZX,ZodBranded:Sw,ZodPipeline:y$,ZodReadonly:zi,custom:D2,Schema:x,ZodSchema:x,late:rX,get ZodFirstPartyTypeKind(){return S},coerce:KG,any:nG,array:gG,bigint:dX,boolean:G2,date:eX,discriminatedUnion:UG,effect:g2,enum:WG,function:GG,instanceof:mX,intersection:kG,lazy:tG,literal:QG,map:JG,nan:yX,nativeEnum:YG,never:iG,null:sX,nullable:uG,number:X2,object:wG,oboolean:LG,onumber:qG,optional:jG,ostring:fG,pipeline:VG,preprocess:HG,promise:IG,record:DG,set:XG,strictObject:_G,string:J2,symbol:pX,transformer:g2,tuple:lG,undefined:aX,union:bG,unknown:vG,void:$G,NEVER:OG,ZodIssueCode:q,quotelessJson:uX,ZodError:In});var f_="2024-11-05",t2=[f_,"2024-10-07"],zw="2.0",Q2=X.union([X.string(),X.number().int()]),W2=X.string(),Mn=X.object({_meta:X.optional(X.object({progressToken:X.optional(Q2)}).passthrough())}).passthrough(),jn=X.object({method:X.string(),params:X.optional(Mn)}),d$=X.object({_meta:X.optional(X.object({}).passthrough())}).passthrough(),rn=X.object({method:X.string(),params:X.optional(d$)}),Rn=X.object({_meta:X.optional(X.object({}).passthrough())}).passthrough(),Mw=X.union([X.string(),X.number().int()]),BG=X.object({jsonrpc:X.literal(zw),id:Mw}).merge(jn).strict(),FG=X.object({jsonrpc:X.literal(zw)}).merge(rn).strict(),NG=X.object({jsonrpc:X.literal(zw),id:Mw,result:Rn}).strict(),ni;(function(n){n[n.ConnectionClosed=-1]="ConnectionClosed",n[n.RequestTimeout=-2]="RequestTimeout",n[n.ParseError=-32700]="ParseError",n[n.InvalidRequest=-32600]="InvalidRequest",n[n.MethodNotFound=-32601]="MethodNotFound",n[n.InvalidParams=-32602]="InvalidParams",n[n.InternalError=-32603]="InternalError"})(ni||(ni={}));var cG=X.object({jsonrpc:X.literal(zw),id:Mw,error:X.object({code:X.number().int(),message:X.string(),data:X.optional(X.unknown())})}).strict(),Y2=X.union([BG,FG,NG,cG]),Rw=Rn.strict(),Aw=rn.extend({method:X.literal("notifications/cancelled"),params:d$.extend({requestId:Mw,reason:X.string().optional()})}),I2=X.object({name:X.string(),version:X.string()}).passthrough(),PG=X.object({experimental:X.optional(X.object({}).passthrough()),sampling:X.optional(X.object({}).passthrough()),roots:X.optional(X.object({listChanged:X.optional(X.boolean())}).passthrough())}).passthrough(),q_=jn.extend({method:X.literal("initialize"),params:Mn.extend({protocolVersion:X.string(),capabilities:PG,clientInfo:I2})}),SG=X.object({experimental:X.optional(X.object({}).passthrough()),logging:X.optional(X.object({}).passthrough()),prompts:X.optional(X.object({listChanged:X.optional(X.boolean())}).passthrough()),resources:X.optional(X.object({subscribe:X.optional(X.boolean()),listChanged:X.optional(X.boolean())}).passthrough()),tools:X.optional(X.object({listChanged:X.optional(X.boolean())}).passthrough())}).passthrough(),zG=Rn.extend({protocolVersion:X.string(),capabilities:SG,serverInfo:I2}),L_=rn.extend({method:X.literal("notifications/initialized")}),xw=jn.extend({method:X.literal("ping")}),MG=X.object({progress:X.number(),total:X.optional(X.number())}).passthrough(),hw=rn.extend({method:X.literal("notifications/progress"),params:d$.merge(MG).extend({progressToken:Q2})}),Cw=jn.extend({params:Mn.extend({cursor:X.optional(W2)}).optional()}),Ew=Rn.extend({nextCursor:X.optional(W2)}),j2=X.object({uri:X.string(),mimeType:X.optional(X.string())}).passthrough(),u2=j2.extend({text:X.string()}),H2=j2.extend({blob:X.string().base64()}),RG=X.object({uri:X.string(),name:X.string(),description:X.optional(X.string()),mimeType:X.optional(X.string())}).passthrough(),AG=X.object({uriTemplate:X.string(),name:X.string(),description:X.optional(X.string()),mimeType:X.optional(X.string())}).passthrough(),xG=Cw.extend({method:X.literal("resources/list")}),hG=Ew.extend({resources:X.array(RG)}),CG=Cw.extend({method:X.literal("resources/templates/list")}),EG=Ew.extend({resourceTemplates:X.array(AG)}),oG=jn.extend({method:X.literal("resources/read"),params:Mn.extend({uri:X.string()})}),TG=Rn.extend({contents:X.array(X.union([u2,H2]))}),ZG=rn.extend({method:X.literal("notifications/resources/list_changed")}),rG=jn.extend({method:X.literal("resources/subscribe"),params:Mn.extend({uri:X.string()})}),mG=jn.extend({method:X.literal("resources/unsubscribe"),params:Mn.extend({uri:X.string()})}),yG=rn.extend({method:X.literal("notifications/resources/updated"),params:d$.extend({uri:X.string()})}),dG=X.object({name:X.string(),description:X.optional(X.string()),required:X.optional(X.boolean())}).passthrough(),eG=X.object({name:X.string(),description:X.optional(X.string()),arguments:X.optional(X.array(dG))}).passthrough(),pG=Cw.extend({method:X.literal("prompts/list")}),aG=Ew.extend({prompts:X.array(eG)}),sG=jn.extend({method:X.literal("prompts/get"),params:Mn.extend({name:X.string(),arguments:X.optional(X.record(X.string()))})}),ow=X.object({type:X.literal("text"),text:X.string()}).passthrough(),Tw=X.object({type:X.literal("image"),data:X.string().base64(),mimeType:X.string()}).passthrough(),V2=X.object({type:X.literal("resource"),resource:X.union([u2,H2])}).passthrough(),nt=X.object({role:X.enum(["user","assistant"]),content:X.union([ow,Tw,V2])}).passthrough(),vt=Rn.extend({description:X.optional(X.string()),messages:X.array(nt)}),it=rn.extend({method:X.literal("notifications/prompts/list_changed")}),$t=X.object({name:X.string(),description:X.optional(X.string()),inputSchema:X.object({type:X.literal("object"),properties:X.optional(X.object({}).passthrough())}).passthrough()}).passthrough(),K_=Cw.extend({method:X.literal("tools/list")}),gt=Ew.extend({tools:X.array($t)}),f2=Rn.extend({content:X.array(X.union([ow,Tw,V2])),isError:X.boolean().default(!1).optional()}),nI=f2.or(Rn.extend({toolResult:X.unknown()})),O_=jn.extend({method:X.literal("tools/call"),params:Mn.extend({name:X.string(),arguments:X.optional(X.record(X.unknown()))})}),wt=rn.extend({method:X.literal("notifications/tools/list_changed")}),q2=X.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),_t=jn.extend({method:X.literal("logging/setLevel"),params:Mn.extend({level:q2})}),bt=rn.extend({method:X.literal("notifications/message"),params:d$.extend({level:q2,logger:X.optional(X.string()),data:X.unknown()})}),Ut=X.object({name:X.string().optional()}).passthrough(),kt=X.object({hints:X.optional(X.array(Ut)),costPriority:X.optional(X.number().min(0).max(1)),speedPriority:X.optional(X.number().min(0).max(1)),intelligencePriority:X.optional(X.number().min(0).max(1))}).passthrough(),lt=X.object({role:X.enum(["user","assistant"]),content:X.union([ow,Tw])}).passthrough(),Dt=jn.extend({method:X.literal("sampling/createMessage"),params:Mn.extend({messages:X.array(lt),systemPrompt:X.optional(X.string()),includeContext:X.optional(X.enum(["none","thisServer","allServers"])),temperature:X.optional(X.number()),maxTokens:X.number().int(),stopSequences:X.optional(X.array(X.string())),metadata:X.optional(X.object({}).passthrough()),modelPreferences:X.optional(kt)})}),B_=Rn.extend({model:X.string(),stopReason:X.optional(X.enum(["endTurn","stopSequence","maxTokens"]).or(X.string())),role:X.enum(["user","assistant"]),content:X.discriminatedUnion("type",[ow,Tw])}),Jt=X.object({type:X.literal("ref/resource"),uri:X.string()}).passthrough(),Xt=X.object({type:X.literal("ref/prompt"),name:X.string()}).passthrough(),Gt=jn.extend({method:X.literal("completion/complete"),params:Mn.extend({ref:X.union([Xt,Jt]),argument:X.object({name:X.string(),value:X.string()}).passthrough()})}),tt=Rn.extend({completion:X.object({values:X.array(X.string()).max(100),total:X.optional(X.number().int()),hasMore:X.optional(X.boolean())}).passthrough()}),Qt=X.object({uri:X.string().startsWith("file://"),name:X.optional(X.string())}).passthrough(),Wt=jn.extend({method:X.literal("roots/list")}),F_=Rn.extend({roots:X.array(Qt)}),Yt=rn.extend({method:X.literal("notifications/roots/list_changed")}),vI=X.union([xw,q_,Gt,_t,sG,pG,xG,CG,oG,rG,mG,O_,K_]),iI=X.union([Aw,hw,L_,Yt]),$I=X.union([Rw,B_,F_]),gI=X.union([xw,Dt,Wt]),wI=X.union([Aw,hw,bt,yG,ZG,wt,it]),_I=X.union([Rw,zG,tt,vt,aG,hG,EG,TG,f2,gt]);class e$ extends Error{constructor(n,i,$){super(`MCP error ${n}: ${i}`);this.code=n,this.data=$}}var It=60000;class N_{constructor(n){this._options=n,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this.setNotificationHandler(Aw,(i)=>{let $=this._requestHandlerAbortControllers.get(i.params.requestId);$===null||$===void 0||$.abort(i.params.reason)}),this.setNotificationHandler(hw,(i)=>{this._onprogress(i)}),this.setRequestHandler(xw,(i)=>({}))}async connect(n){this._transport=n,this._transport.onclose=()=>{this._onclose()},this._transport.onerror=(i)=>{this._onerror(i)},this._transport.onmessage=(i)=>{if(!("method"in i))this._onresponse(i);else if("id"in i)this._onrequest(i);else this._onnotification(i)},await this._transport.start()}_onclose(){var n;let i=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._transport=void 0,(n=this.onclose)===null||n===void 0||n.call(this);let $=new e$(ni.ConnectionClosed,"Connection closed");for(let g of i.values())g($)}_onerror(n){var i;(i=this.onerror)===null||i===void 0||i.call(this,n)}_onnotification(n){var i;let $=(i=this._notificationHandlers.get(n.method))!==null&&i!==void 0?i:this.fallbackNotificationHandler;if($===void 0)return;Promise.resolve().then(()=>$(n)).catch((g)=>this._onerror(Error(`Uncaught error in notification handler: ${g}`)))}_onrequest(n){var i,$;let g=(i=this._requestHandlers.get(n.method))!==null&&i!==void 0?i:this.fallbackRequestHandler;if(g===void 0){($=this._transport)===null||$===void 0||$.send({jsonrpc:"2.0",id:n.id,error:{code:ni.MethodNotFound,message:"Method not found"}}).catch((w)=>this._onerror(Error(`Failed to send an error response: ${w}`)));return}let v=new AbortController;this._requestHandlerAbortControllers.set(n.id,v),Promise.resolve().then(()=>g(n,{signal:v.signal})).then((w)=>{var _;if(v.signal.aborted)return;return(_=this._transport)===null||_===void 0?void 0:_.send({result:w,jsonrpc:"2.0",id:n.id})},(w)=>{var _,U;if(v.signal.aborted)return;return(_=this._transport)===null||_===void 0?void 0:_.send({jsonrpc:"2.0",id:n.id,error:{code:Number.isSafeInteger(w.code)?w.code:ni.InternalError,message:(U=w.message)!==null&&U!==void 0?U:"Internal error"}})}).catch((w)=>this._onerror(Error(`Failed to send response: ${w}`))).finally(()=>{this._requestHandlerAbortControllers.delete(n.id)})}_onprogress(n){let{progressToken:i,...$}=n.params,g=this._progressHandlers.get(Number(i));if(g===void 0){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(n)}`));return}g($)}_onresponse(n){let i=n.id,$=this._responseHandlers.get(Number(i));if($===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(n)}`));return}if(this._responseHandlers.delete(Number(i)),this._progressHandlers.delete(Number(i)),"result"in n)$(n);else{let g=new e$(n.error.code,n.error.message,n.error.data);$(g)}}get transport(){return this._transport}async close(){var n;await((n=this._transport)===null||n===void 0?void 0:n.close())}request(n,i,$){return new Promise((g,v)=>{var w,_,U,k;if(!this._transport){v(Error("Not connected"));return}if(((w=this._options)===null||w===void 0?void 0:w.enforceStrictCapabilities)===!0)this.assertCapabilityForMethod(n.method);(_=$===null||$===void 0?void 0:$.signal)===null||_===void 0||_.throwIfAborted();let l=this._requestMessageId++,J={...n,jsonrpc:"2.0",id:l};if($===null||$===void 0?void 0:$.onprogress)this._progressHandlers.set(l,$.onprogress),J.params={...n.params,_meta:{progressToken:l}};let Q=void 0;this._responseHandlers.set(l,(W)=>{var Y;if(Q!==void 0)clearTimeout(Q);if((Y=$===null||$===void 0?void 0:$.signal)===null||Y===void 0?void 0:Y.aborted)return;if(W instanceof Error)return v(W);try{let B=i.parse(W.result);g(B)}catch(B){v(B)}});let j=(W)=>{var Y;this._responseHandlers.delete(l),this._progressHandlers.delete(l),(Y=this._transport)===null||Y===void 0||Y.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:l,reason:String(W)}}).catch((B)=>this._onerror(Error(`Failed to send cancellation: ${B}`))),v(W)};(U=$===null||$===void 0?void 0:$.signal)===null||U===void 0||U.addEventListener("abort",()=>{var W;if(Q!==void 0)clearTimeout(Q);j((W=$===null||$===void 0?void 0:$.signal)===null||W===void 0?void 0:W.reason)});let u=(k=$===null||$===void 0?void 0:$.timeout)!==null&&k!==void 0?k:It;Q=setTimeout(()=>j(new e$(ni.RequestTimeout,"Request timed out",{timeout:u})),u),this._transport.send(J).catch((W)=>{if(Q!==void 0)clearTimeout(Q);v(W)})})}async notification(n){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(n.method);let i={...n,jsonrpc:"2.0"};await this._transport.send(i)}setRequestHandler(n,i){let $=n.shape.method.value;this.assertRequestHandlerCapability($),this._requestHandlers.set($,(g,v)=>Promise.resolve(i(n.parse(g),v)))}removeRequestHandler(n){this._requestHandlers.delete(n)}setNotificationHandler(n,i){this._notificationHandlers.set(n.shape.method.value,($)=>Promise.resolve(i(n.parse($))))}removeNotificationHandler(n){this._notificationHandlers.delete(n)}}class c_ extends N_{constructor(n,i){super(i);this._serverInfo=n,this._capabilities=i.capabilities,this.setRequestHandler(q_,($)=>this._oninitialize($)),this.setNotificationHandler(L_,()=>{var $;return($=this.oninitialized)===null||$===void 0?void 0:$.call(this)})}assertCapabilityForMethod(n){var i,$;switch(n){case"sampling/createMessage":if(!((i=this._clientCapabilities)===null||i===void 0?void 0:i.sampling))throw Error(`Client does not support sampling (required for ${n})`);break;case"roots/list":if(!(($=this._clientCapabilities)===null||$===void 0?void 0:$.roots))throw Error(`Client does not support listing roots (required for ${n})`);break;case"ping":break}}assertNotificationCapability(n){switch(n){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${n})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${n})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${n})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${n})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(n){switch(n){case"sampling/createMessage":if(!this._capabilities.sampling)throw Error(`Server does not support sampling (required for ${n})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${n})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${n})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${n})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${n})`);break;case"ping":case"initialize":break}}async _oninitialize(n){let i=n.params.protocolVersion;return this._clientCapabilities=n.params.capabilities,this._clientVersion=n.params.clientInfo,{protocolVersion:t2.includes(i)?i:f_,capabilities:this.getCapabilities(),serverInfo:this._serverInfo}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Rw)}async createMessage(n,i){return this.request({method:"sampling/createMessage",params:n},B_,i)}async listRoots(n,i){return this.request({method:"roots/list",params:n},F_,i)}async sendLoggingMessage(n){return this.notification({method:"notifications/message",params:n})}async sendResourceUpdated(n){return this.notification({method:"notifications/resources/updated",params:n})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}import K2 from"node:process";class P_{append(n){this._buffer=this._buffer?Buffer.concat([this._buffer,n]):n}readMessage(){if(!this._buffer)return null;let n=this._buffer.indexOf(`
1
+ import{createRequire as QX}from"node:module";var _X=Object.create;var{getPrototypeOf:bX,defineProperty:t_,getOwnPropertyNames:UX}=Object;var kX=Object.prototype.hasOwnProperty;function lX(n){return this[n]}var DX,JX,y0=(n,i,$)=>{var g=n!=null&&typeof n==="object";if(g){var v=i?DX??=new WeakMap:JX??=new WeakMap,w=v.get(n);if(w)return w}$=n!=null?_X(bX(n)):{};let _=i||!n||!n.__esModule?t_($,"default",{value:n,enumerable:!0}):$;for(let U of UX(n))if(!kX.call(_,U))t_(_,U,{get:lX.bind(n,U),enumerable:!0});if(g)v.set(n,_);return _};var XX=(n,i)=>()=>(i||n((i={exports:{}}).exports,i),i.exports);var GX=(n)=>n;function tX(n,i){this[n]=GX.bind(null,i)}var Nn=(n,i)=>{for(var $ in i)t_(n,$,{get:i[$],enumerable:!0,configurable:!0,set:tX.bind(i,$)})};var d0=QX(import.meta.url);var Q_=XX((eY,WX)=>{WX.exports={name:"@typescape-ai/mcp",version:"1.9.26",description:"Typescape MCP server for review, finding, and rules workflows in external agent harnesses",type:"module",bin:{"typescape-mcp":"./bin/typescape-mcp"},files:["bin","dist","README.md"],exports:{".":"./dist/mcp.js"},publishConfig:{access:"public"},scripts:{build:"bun build src/index.ts --outfile=dist/mcp.js --target=node --bundle --minify",dev:"bun run --watch src/index.ts",test:"bun test",typecheck:"tsc --noEmit",lint:"eslint src",prepublishOnly:"bun run build"},dependencies:{},devDependencies:{"@modelcontextprotocol/sdk":"1.0.4","@types/bun":"1.3.8","@typescape/schemas":"workspace:*",zod:"4.3.0"},engines:{node:">=18.17.0",bun:">=1.0.0"},keywords:["typescape","mcp","mcp-server","model-context-protocol","agent","automation","review","finding","rules","cursor","windsurf","bun"],repository:{type:"git",url:"https://github.com/voidserf/typescape-docs.git",directory:"apps/mcp"},license:"MIT"}});function e0(){let n=new Map;return{register(i,$){n.set(i.name,{definition:i,handler:$})},getTools(){return Array.from(n.values()).map((i)=>i.definition)},getHandler(i){return n.get(i)?.handler}}}var YX=await Promise.resolve().then(() => y0(Q_(),1)),IX=`typescape-mcp/${YX.version}`;class D extends Error{status;code;requestId;details;fixHint;constructor(n,i,$,g,v,w){super($);this.status=n;this.code=i;this.requestId=g;this.details=v;this.fixHint=w;this.name="ApiError"}}var Bw=30000;function W_(n,i,$,g){let v=`${n}${i}${$}`;if(g&&Object.keys(g).length>0){let w=new URLSearchParams(g);v+=`?${w.toString()}`}return v}function Y_(n,i){return{Authorization:`Bearer ${n}`,Accept:"application/json","User-Agent":IX,...i}}function s0(n){let i=n.headers.get("X-Request-Id");if(typeof i!=="string"||i.trim().length===0)return null;return i}function n2(){return"missing_request_id"}function v2(n,i){if(typeof n.request_id==="string"&&n.request_id.trim().length>0)return n.request_id;let $=s0(i);if($!==null)return $;return n2()}function p0(n){let i=s0(n);if(i!==null)return i;return n2()}async function a0(n,i,$){let g;try{g=await fetch(n,{...i,signal:AbortSignal.timeout($)})}catch(U){if(U instanceof DOMException&&(U.name==="TimeoutError"||U.name==="AbortError")){let J=Math.round($/1000);throw new D(0,"request_timeout",`Request timed out after ${J}s. Check your network connection and server URL.`,"unknown")}let l=U instanceof Error?U.message:String(U);throw new D(0,"network_error",`Network error: ${l}`,"unknown")}let v=g.headers.get("Content-Type");if(v===null)throw new D(g.status,"invalid_response","Response missing Content-Type header","unknown");if(!v.includes("application/json"))throw new D(g.status,"invalid_response",`Unexpected Content-Type: ${v}`,"unknown");let w;try{w=await g.json()}catch(U){throw new D(g.status,"invalid_response",`Failed to parse JSON response: ${U instanceof Error?U.message:String(U)}`,"unknown")}let _=v2(w,g);if(typeof _!=="string"||_.trim().length===0)throw new D(g.status,"invalid_response","Response missing request_id","unknown");if(!g.ok){let U=w,k=U.error?.code;if(typeof k!=="string"||k.trim().length===0)throw new D(g.status,"invalid_response","Error response missing error.code",_);let l=U.error?.message;if(typeof l!=="string"||l.trim().length===0)throw new D(g.status,"invalid_response","Error response missing error.message",_);throw new D(g.status,k,l,_,U.error?.details,U.error?.fix_hint)}return{status:g.status,body:w,requestId:_}}async function jX(n,i,$){let g;try{g=await fetch(n,{...i,signal:AbortSignal.timeout($)})}catch(_){if(_ instanceof DOMException&&(_.name==="TimeoutError"||_.name==="AbortError")){let l=Math.round($/1000);throw new D(0,"request_timeout",`Request timed out after ${l}s. Check your network connection and server URL.`,"unknown")}let k=_ instanceof Error?_.message:String(_);throw new D(0,"network_error",`Network error: ${k}`,"unknown")}let v=g.headers.get("Content-Type");if(v===null)throw new D(g.status,"invalid_response","Response missing Content-Type header","unknown");if(v.includes("application/json")){let _;try{_=await g.json()}catch(k){throw new D(g.status,"invalid_response",`Failed to parse JSON response: ${k instanceof Error?k.message:String(k)}`,"unknown")}let U=v2(_,g);if(!g.ok){let k=_.error?.code,l=_.error?.message;if(typeof k!=="string"||k.trim().length===0||typeof l!=="string"||l.trim().length===0)throw new D(g.status,"invalid_response","Error response missing error.code or error.message",U);throw new D(g.status,k,l,U,_.error?.details,_.error?.fix_hint)}throw new D(g.status,"invalid_response","Expected text response but received JSON payload",U)}let w;try{w=await g.text()}catch(_){throw new D(g.status,"invalid_response",`Failed to read text response: ${_ instanceof Error?_.message:String(_)}`,p0(g))}return{status:g.status,body:w,requestId:p0(g)}}function i2(n,i,$=Bw){let v=n.replace(/\/$/,"");async function w(_,U,k={}){let l=W_(v,"/v1",U,k.query),J=Y_(i,k.headers);if(k.body!==void 0)J["Content-Type"]="application/json";return a0(l,{method:_,headers:J,body:k.body!==void 0?JSON.stringify(k.body):void 0},$)}return{async get(_,U){return w("GET",_,U)},async getText(_,U){let k=W_(v,"/v1",_,U?.query),l=Y_(i,{Accept:"text/plain, application/json",...U?.headers});return jX(k,{method:"GET",headers:l},$)},async post(_,U){return w("POST",_,U)},async patch(_,U){return w("PATCH",_,U)},async postFormData(_,U,k){let l=W_(v,"/v1",_,k?.query),J=Y_(i,k?.headers);return a0(l,{method:"POST",headers:J,body:U},$)},request:w}}var Z;(function(n){n.assertEqual=(v)=>v;function i(v){}n.assertIs=i;function $(v){throw Error()}n.assertNever=$,n.arrayToEnum=(v)=>{let w={};for(let _ of v)w[_]=_;return w},n.getValidEnumValues=(v)=>{let w=n.objectKeys(v).filter((U)=>typeof v[v[U]]!=="number"),_={};for(let U of w)_[U]=v[U];return n.objectValues(_)},n.objectValues=(v)=>{return n.objectKeys(v).map(function(w){return v[w]})},n.objectKeys=typeof Object.keys==="function"?(v)=>Object.keys(v):(v)=>{let w=[];for(let _ in v)if(Object.prototype.hasOwnProperty.call(v,_))w.push(_);return w},n.find=(v,w)=>{for(let _ of v)if(w(_))return _;return},n.isInteger=typeof Number.isInteger==="function"?(v)=>Number.isInteger(v):(v)=>typeof v==="number"&&isFinite(v)&&Math.floor(v)===v;function g(v,w=" | "){return v.map((_)=>typeof _==="string"?`'${_}'`:_).join(w)}n.joinValues=g,n.jsonStringifyReplacer=(v,w)=>{if(typeof w==="bigint")return w.toString();return w}})(Z||(Z={}));var j_;(function(n){n.mergeShapes=(i,$)=>{return{...i,...$}}})(j_||(j_={}));var c=Z.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),vv=(n)=>{switch(typeof n){case"undefined":return c.undefined;case"string":return c.string;case"number":return isNaN(n)?c.nan:c.number;case"boolean":return c.boolean;case"function":return c.function;case"bigint":return c.bigint;case"symbol":return c.symbol;case"object":if(Array.isArray(n))return c.array;if(n===null)return c.null;if(n.then&&typeof n.then==="function"&&n.catch&&typeof n.catch==="function")return c.promise;if(typeof Map<"u"&&n instanceof Map)return c.map;if(typeof Set<"u"&&n instanceof Set)return c.set;if(typeof Date<"u"&&n instanceof Date)return c.date;return c.object;default:return c.unknown}},q=Z.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"]),uX=(n)=>{return JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:")};class In extends Error{get errors(){return this.issues}constructor(n){super();this.issues=[],this.addIssue=($)=>{this.issues=[...this.issues,$]},this.addIssues=($=[])=>{this.issues=[...this.issues,...$]};let i=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,i);else this.__proto__=i;this.name="ZodError",this.issues=n}format(n){let i=n||function(v){return v.message},$={_errors:[]},g=(v)=>{for(let w of v.issues)if(w.code==="invalid_union")w.unionErrors.map(g);else if(w.code==="invalid_return_type")g(w.returnTypeError);else if(w.code==="invalid_arguments")g(w.argumentsError);else if(w.path.length===0)$._errors.push(i(w));else{let _=$,U=0;while(U<w.path.length){let k=w.path[U];if(U!==w.path.length-1)_[k]=_[k]||{_errors:[]};else _[k]=_[k]||{_errors:[]},_[k]._errors.push(i(w));_=_[k],U++}}};return g(this),$}static assert(n){if(!(n instanceof In))throw Error(`Not a ZodError: ${n}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Z.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(n=(i)=>i.message){let i={},$=[];for(let g of this.issues)if(g.path.length>0)i[g.path[0]]=i[g.path[0]]||[],i[g.path[0]].push(n(g));else $.push(n(g));return{formErrors:$,fieldErrors:i}}get formErrors(){return this.flatten()}}In.create=(n)=>{return new In(n)};var fi=(n,i)=>{let $;switch(n.code){case q.invalid_type:if(n.received===c.undefined)$="Required";else $=`Expected ${n.expected}, received ${n.received}`;break;case q.invalid_literal:$=`Invalid literal value, expected ${JSON.stringify(n.expected,Z.jsonStringifyReplacer)}`;break;case q.unrecognized_keys:$=`Unrecognized key(s) in object: ${Z.joinValues(n.keys,", ")}`;break;case q.invalid_union:$="Invalid input";break;case q.invalid_union_discriminator:$=`Invalid discriminator value. Expected ${Z.joinValues(n.options)}`;break;case q.invalid_enum_value:$=`Invalid enum value. Expected ${Z.joinValues(n.options)}, received '${n.received}'`;break;case q.invalid_arguments:$="Invalid function arguments";break;case q.invalid_return_type:$="Invalid function return type";break;case q.invalid_date:$="Invalid date";break;case q.invalid_string:if(typeof n.validation==="object")if("includes"in n.validation){if($=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position==="number")$=`${$} at one or more positions greater than or equal to ${n.validation.position}`}else if("startsWith"in n.validation)$=`Invalid input: must start with "${n.validation.startsWith}"`;else if("endsWith"in n.validation)$=`Invalid input: must end with "${n.validation.endsWith}"`;else Z.assertNever(n.validation);else if(n.validation!=="regex")$=`Invalid ${n.validation}`;else $="Invalid";break;case q.too_small:if(n.type==="array")$=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`;else if(n.type==="string")$=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`;else if(n.type==="number")$=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`;else if(n.type==="date")$=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`;else $="Invalid input";break;case q.too_big:if(n.type==="array")$=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`;else if(n.type==="string")$=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`;else if(n.type==="number")$=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`;else if(n.type==="bigint")$=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`;else if(n.type==="date")$=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`;else $="Invalid input";break;case q.custom:$="Invalid input";break;case q.invalid_intersection_types:$="Intersection results could not be merged";break;case q.not_multiple_of:$=`Number must be a multiple of ${n.multipleOf}`;break;case q.not_finite:$="Number must be finite";break;default:$=i.defaultError,Z.assertNever(n)}return{message:$}},w2=fi;function HX(n){w2=n}function Fw(){return w2}var Nw=(n)=>{let{data:i,path:$,errorMaps:g,issueData:v}=n,w=[...$,...v.path||[]],_={...v,path:w};if(v.message!==void 0)return{...v,path:w,message:v.message};let U="",k=g.filter((l)=>!!l).slice().reverse();for(let l of k)U=l(_,{data:i,defaultError:U}).message;return{...v,path:w,message:U}},VX=[];function F(n,i){let $=Fw(),g=Nw({issueData:i,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,$,$===fi?void 0:fi].filter((v)=>!!v)});n.common.issues.push(g)}class kn{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(n,i){let $=[];for(let g of i){if(g.status==="aborted")return z;if(g.status==="dirty")n.dirty();$.push(g.value)}return{status:n.value,value:$}}static async mergeObjectAsync(n,i){let $=[];for(let g of i){let v=await g.key,w=await g.value;$.push({key:v,value:w})}return kn.mergeObjectSync(n,$)}static mergeObjectSync(n,i){let $={};for(let g of i){let{key:v,value:w}=g;if(v.status==="aborted")return z;if(w.status==="aborted")return z;if(v.status==="dirty")n.dirty();if(w.status==="dirty")n.dirty();if(v.value!=="__proto__"&&(typeof w.value<"u"||g.alwaysSet))$[v.value]=w.value}return{status:n.value,value:$}}}var z=Object.freeze({status:"aborted"}),Hi=(n)=>({status:"dirty",value:n}),Jn=(n)=>({status:"valid",value:n}),u_=(n)=>n.status==="aborted",H_=(n)=>n.status==="dirty",dv=(n)=>n.status==="valid",E$=(n)=>typeof Promise<"u"&&n instanceof Promise;function cw(n,i,$,g){if($==="a"&&!g)throw TypeError("Private accessor was defined without a getter");if(typeof i==="function"?n!==i||!g:!i.has(n))throw TypeError("Cannot read private member from an object whose class did not declare it");return $==="m"?g:$==="a"?g.call(n):g?g.value:i.get(n)}function _2(n,i,$,g,v){if(g==="m")throw TypeError("Private method is not writable");if(g==="a"&&!v)throw TypeError("Private accessor was defined without a setter");if(typeof i==="function"?n!==i||!v:!i.has(n))throw TypeError("Cannot write private member to an object whose class did not declare it");return g==="a"?v.call(n,$):v?v.value=$:i.set(n,$),$}var P;(function(n){n.errToObj=(i)=>typeof i==="string"?{message:i}:i||{},n.toString=(i)=>typeof i==="string"?i:i===null||i===void 0?void 0:i.message})(P||(P={}));var h$,C$;class zn{constructor(n,i,$,g){this._cachedPath=[],this.parent=n,this.data=i,this._path=$,this._key=g}get path(){if(!this._cachedPath.length)if(this._key instanceof Array)this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var $2=(n,i)=>{if(dv(i))return{success:!0,data:i.value};else{if(!n.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let $=new In(n.common.issues);return this._error=$,this._error}}}};function A(n){if(!n)return{};let{errorMap:i,invalid_type_error:$,required_error:g,description:v}=n;if(i&&($||g))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(i)return{errorMap:i,description:v};return{errorMap:(_,U)=>{var k,l;let{message:J}=n;if(_.code==="invalid_enum_value")return{message:J!==null&&J!==void 0?J:U.defaultError};if(typeof U.data>"u")return{message:(k=J!==null&&J!==void 0?J:g)!==null&&k!==void 0?k:U.defaultError};if(_.code!=="invalid_type")return{message:U.defaultError};return{message:(l=J!==null&&J!==void 0?J:$)!==null&&l!==void 0?l:U.defaultError}},description:v}}class x{get description(){return this._def.description}_getType(n){return vv(n.data)}_getOrReturnCtx(n,i){return i||{common:n.parent.common,data:n.data,parsedType:vv(n.data),schemaErrorMap:this._def.errorMap,path:n.path,parent:n.parent}}_processInputParams(n){return{status:new kn,ctx:{common:n.parent.common,data:n.data,parsedType:vv(n.data),schemaErrorMap:this._def.errorMap,path:n.path,parent:n.parent}}}_parseSync(n){let i=this._parse(n);if(E$(i))throw Error("Synchronous parse encountered promise.");return i}_parseAsync(n){let i=this._parse(n);return Promise.resolve(i)}parse(n,i){let $=this.safeParse(n,i);if($.success)return $.data;throw $.error}safeParse(n,i){var $;let g={common:{issues:[],async:($=i===null||i===void 0?void 0:i.async)!==null&&$!==void 0?$:!1,contextualErrorMap:i===null||i===void 0?void 0:i.errorMap},path:(i===null||i===void 0?void 0:i.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:n,parsedType:vv(n)},v=this._parseSync({data:n,path:g.path,parent:g});return $2(g,v)}"~validate"(n){var i,$;let g={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:n,parsedType:vv(n)};if(!this["~standard"].async)try{let v=this._parseSync({data:n,path:[],parent:g});return dv(v)?{value:v.value}:{issues:g.common.issues}}catch(v){if(($=(i=v===null||v===void 0?void 0:v.message)===null||i===void 0?void 0:i.toLowerCase())===null||$===void 0?void 0:$.includes("encountered"))this["~standard"].async=!0;g.common={issues:[],async:!0}}return this._parseAsync({data:n,path:[],parent:g}).then((v)=>dv(v)?{value:v.value}:{issues:g.common.issues})}async parseAsync(n,i){let $=await this.safeParseAsync(n,i);if($.success)return $.data;throw $.error}async safeParseAsync(n,i){let $={common:{issues:[],contextualErrorMap:i===null||i===void 0?void 0:i.errorMap,async:!0},path:(i===null||i===void 0?void 0:i.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:n,parsedType:vv(n)},g=this._parse({data:n,path:$.path,parent:$}),v=await(E$(g)?g:Promise.resolve(g));return $2($,v)}refine(n,i){let $=(g)=>{if(typeof i==="string"||typeof i>"u")return{message:i};else if(typeof i==="function")return i(g);else return i};return this._refinement((g,v)=>{let w=n(g),_=()=>v.addIssue({code:q.custom,...$(g)});if(typeof Promise<"u"&&w instanceof Promise)return w.then((U)=>{if(!U)return _(),!1;else return!0});if(!w)return _(),!1;else return!0})}refinement(n,i){return this._refinement(($,g)=>{if(!n($))return g.addIssue(typeof i==="function"?i($,g):i),!1;else return!0})}_refinement(n){return new Vn({schema:this,typeName:S.ZodEffects,effect:{type:"refinement",refinement:n}})}superRefine(n){return this._refinement(n)}constructor(n){this.spa=this.safeParseAsync,this._def=n,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:(i)=>this["~validate"](i)}}optional(){return Sn.create(this,this._def)}nullable(){return iv.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Pn.create(this)}promise(){return sv.create(this,this._def)}or(n){return Oi.create([this,n],this._def)}and(n){return Bi.create(this,n,this._def)}transform(n){return new Vn({...A(this._def),schema:this,typeName:S.ZodEffects,effect:{type:"transform",transform:n}})}default(n){let i=typeof n==="function"?n:()=>n;return new Pi({...A(this._def),innerType:this,defaultValue:i,typeName:S.ZodDefault})}brand(){return new Sw({typeName:S.ZodBranded,type:this,...A(this._def)})}catch(n){let i=typeof n==="function"?n:()=>n;return new Si({...A(this._def),innerType:this,catchValue:i,typeName:S.ZodCatch})}describe(n){return new this.constructor({...this._def,description:n})}pipe(n){return y$.create(this,n)}readonly(){return zi.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var fX=/^c[^\s-]{8,}$/i,qX=/^[0-9a-z]+$/,LX=/^[0-9A-HJKMNP-TV-Z]{26}$/i,KX=/^[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,OX=/^[a-z0-9_-]{21}$/i,BX=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,FX=/^[-+]?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)?)??$/,NX=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,cX="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",I_,PX=/^(?:(?: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])$/,SX=/^(?:(?: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])$/,zX=/^(([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]))$/,MX=/^(([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])$/,RX=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,AX=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,b2="((\\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])))",xX=new RegExp(`^${b2}$`);function U2(n){let i="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";if(n.precision)i=`${i}\\.\\d{${n.precision}}`;else if(n.precision==null)i=`${i}(\\.\\d+)?`;return i}function hX(n){return new RegExp(`^${U2(n)}$`)}function k2(n){let i=`${b2}T${U2(n)}`,$=[];if($.push(n.local?"Z?":"Z"),n.offset)$.push("([+-]\\d{2}:?\\d{2})");return i=`${i}(${$.join("|")})`,new RegExp(`^${i}$`)}function CX(n,i){if((i==="v4"||!i)&&PX.test(n))return!0;if((i==="v6"||!i)&&zX.test(n))return!0;return!1}function EX(n,i){if(!BX.test(n))return!1;try{let[$]=n.split("."),g=$.replace(/-/g,"+").replace(/_/g,"/").padEnd($.length+(4-$.length%4)%4,"="),v=JSON.parse(atob(g));if(typeof v!=="object"||v===null)return!1;if(!v.typ||!v.alg)return!1;if(i&&v.alg!==i)return!1;return!0}catch($){return!1}}function oX(n,i){if((i==="v4"||!i)&&SX.test(n))return!0;if((i==="v6"||!i)&&MX.test(n))return!0;return!1}class cn extends x{_parse(n){if(this._def.coerce)n.data=String(n.data);if(this._getType(n)!==c.string){let v=this._getOrReturnCtx(n);return F(v,{code:q.invalid_type,expected:c.string,received:v.parsedType}),z}let $=new kn,g=void 0;for(let v of this._def.checks)if(v.kind==="min"){if(n.data.length<v.value)g=this._getOrReturnCtx(n,g),F(g,{code:q.too_small,minimum:v.value,type:"string",inclusive:!0,exact:!1,message:v.message}),$.dirty()}else if(v.kind==="max"){if(n.data.length>v.value)g=this._getOrReturnCtx(n,g),F(g,{code:q.too_big,maximum:v.value,type:"string",inclusive:!0,exact:!1,message:v.message}),$.dirty()}else if(v.kind==="length"){let w=n.data.length>v.value,_=n.data.length<v.value;if(w||_){if(g=this._getOrReturnCtx(n,g),w)F(g,{code:q.too_big,maximum:v.value,type:"string",inclusive:!0,exact:!0,message:v.message});else if(_)F(g,{code:q.too_small,minimum:v.value,type:"string",inclusive:!0,exact:!0,message:v.message});$.dirty()}}else if(v.kind==="email"){if(!NX.test(n.data))g=this._getOrReturnCtx(n,g),F(g,{validation:"email",code:q.invalid_string,message:v.message}),$.dirty()}else if(v.kind==="emoji"){if(!I_)I_=new RegExp(cX,"u");if(!I_.test(n.data))g=this._getOrReturnCtx(n,g),F(g,{validation:"emoji",code:q.invalid_string,message:v.message}),$.dirty()}else if(v.kind==="uuid"){if(!KX.test(n.data))g=this._getOrReturnCtx(n,g),F(g,{validation:"uuid",code:q.invalid_string,message:v.message}),$.dirty()}else if(v.kind==="nanoid"){if(!OX.test(n.data))g=this._getOrReturnCtx(n,g),F(g,{validation:"nanoid",code:q.invalid_string,message:v.message}),$.dirty()}else if(v.kind==="cuid"){if(!fX.test(n.data))g=this._getOrReturnCtx(n,g),F(g,{validation:"cuid",code:q.invalid_string,message:v.message}),$.dirty()}else if(v.kind==="cuid2"){if(!qX.test(n.data))g=this._getOrReturnCtx(n,g),F(g,{validation:"cuid2",code:q.invalid_string,message:v.message}),$.dirty()}else if(v.kind==="ulid"){if(!LX.test(n.data))g=this._getOrReturnCtx(n,g),F(g,{validation:"ulid",code:q.invalid_string,message:v.message}),$.dirty()}else if(v.kind==="url")try{new URL(n.data)}catch(w){g=this._getOrReturnCtx(n,g),F(g,{validation:"url",code:q.invalid_string,message:v.message}),$.dirty()}else if(v.kind==="regex"){if(v.regex.lastIndex=0,!v.regex.test(n.data))g=this._getOrReturnCtx(n,g),F(g,{validation:"regex",code:q.invalid_string,message:v.message}),$.dirty()}else if(v.kind==="trim")n.data=n.data.trim();else if(v.kind==="includes"){if(!n.data.includes(v.value,v.position))g=this._getOrReturnCtx(n,g),F(g,{code:q.invalid_string,validation:{includes:v.value,position:v.position},message:v.message}),$.dirty()}else if(v.kind==="toLowerCase")n.data=n.data.toLowerCase();else if(v.kind==="toUpperCase")n.data=n.data.toUpperCase();else if(v.kind==="startsWith"){if(!n.data.startsWith(v.value))g=this._getOrReturnCtx(n,g),F(g,{code:q.invalid_string,validation:{startsWith:v.value},message:v.message}),$.dirty()}else if(v.kind==="endsWith"){if(!n.data.endsWith(v.value))g=this._getOrReturnCtx(n,g),F(g,{code:q.invalid_string,validation:{endsWith:v.value},message:v.message}),$.dirty()}else if(v.kind==="datetime"){if(!k2(v).test(n.data))g=this._getOrReturnCtx(n,g),F(g,{code:q.invalid_string,validation:"datetime",message:v.message}),$.dirty()}else if(v.kind==="date"){if(!xX.test(n.data))g=this._getOrReturnCtx(n,g),F(g,{code:q.invalid_string,validation:"date",message:v.message}),$.dirty()}else if(v.kind==="time"){if(!hX(v).test(n.data))g=this._getOrReturnCtx(n,g),F(g,{code:q.invalid_string,validation:"time",message:v.message}),$.dirty()}else if(v.kind==="duration"){if(!FX.test(n.data))g=this._getOrReturnCtx(n,g),F(g,{validation:"duration",code:q.invalid_string,message:v.message}),$.dirty()}else if(v.kind==="ip"){if(!CX(n.data,v.version))g=this._getOrReturnCtx(n,g),F(g,{validation:"ip",code:q.invalid_string,message:v.message}),$.dirty()}else if(v.kind==="jwt"){if(!EX(n.data,v.alg))g=this._getOrReturnCtx(n,g),F(g,{validation:"jwt",code:q.invalid_string,message:v.message}),$.dirty()}else if(v.kind==="cidr"){if(!oX(n.data,v.version))g=this._getOrReturnCtx(n,g),F(g,{validation:"cidr",code:q.invalid_string,message:v.message}),$.dirty()}else if(v.kind==="base64"){if(!RX.test(n.data))g=this._getOrReturnCtx(n,g),F(g,{validation:"base64",code:q.invalid_string,message:v.message}),$.dirty()}else if(v.kind==="base64url"){if(!AX.test(n.data))g=this._getOrReturnCtx(n,g),F(g,{validation:"base64url",code:q.invalid_string,message:v.message}),$.dirty()}else Z.assertNever(v);return{status:$.value,value:n.data}}_regex(n,i,$){return this.refinement((g)=>n.test(g),{validation:i,code:q.invalid_string,...P.errToObj($)})}_addCheck(n){return new cn({...this._def,checks:[...this._def.checks,n]})}email(n){return this._addCheck({kind:"email",...P.errToObj(n)})}url(n){return this._addCheck({kind:"url",...P.errToObj(n)})}emoji(n){return this._addCheck({kind:"emoji",...P.errToObj(n)})}uuid(n){return this._addCheck({kind:"uuid",...P.errToObj(n)})}nanoid(n){return this._addCheck({kind:"nanoid",...P.errToObj(n)})}cuid(n){return this._addCheck({kind:"cuid",...P.errToObj(n)})}cuid2(n){return this._addCheck({kind:"cuid2",...P.errToObj(n)})}ulid(n){return this._addCheck({kind:"ulid",...P.errToObj(n)})}base64(n){return this._addCheck({kind:"base64",...P.errToObj(n)})}base64url(n){return this._addCheck({kind:"base64url",...P.errToObj(n)})}jwt(n){return this._addCheck({kind:"jwt",...P.errToObj(n)})}ip(n){return this._addCheck({kind:"ip",...P.errToObj(n)})}cidr(n){return this._addCheck({kind:"cidr",...P.errToObj(n)})}datetime(n){var i,$;if(typeof n==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:n});return this._addCheck({kind:"datetime",precision:typeof(n===null||n===void 0?void 0:n.precision)>"u"?null:n===null||n===void 0?void 0:n.precision,offset:(i=n===null||n===void 0?void 0:n.offset)!==null&&i!==void 0?i:!1,local:($=n===null||n===void 0?void 0:n.local)!==null&&$!==void 0?$:!1,...P.errToObj(n===null||n===void 0?void 0:n.message)})}date(n){return this._addCheck({kind:"date",message:n})}time(n){if(typeof n==="string")return this._addCheck({kind:"time",precision:null,message:n});return this._addCheck({kind:"time",precision:typeof(n===null||n===void 0?void 0:n.precision)>"u"?null:n===null||n===void 0?void 0:n.precision,...P.errToObj(n===null||n===void 0?void 0:n.message)})}duration(n){return this._addCheck({kind:"duration",...P.errToObj(n)})}regex(n,i){return this._addCheck({kind:"regex",regex:n,...P.errToObj(i)})}includes(n,i){return this._addCheck({kind:"includes",value:n,position:i===null||i===void 0?void 0:i.position,...P.errToObj(i===null||i===void 0?void 0:i.message)})}startsWith(n,i){return this._addCheck({kind:"startsWith",value:n,...P.errToObj(i)})}endsWith(n,i){return this._addCheck({kind:"endsWith",value:n,...P.errToObj(i)})}min(n,i){return this._addCheck({kind:"min",value:n,...P.errToObj(i)})}max(n,i){return this._addCheck({kind:"max",value:n,...P.errToObj(i)})}length(n,i){return this._addCheck({kind:"length",value:n,...P.errToObj(i)})}nonempty(n){return this.min(1,P.errToObj(n))}trim(){return new cn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new cn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new cn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((n)=>n.kind==="datetime")}get isDate(){return!!this._def.checks.find((n)=>n.kind==="date")}get isTime(){return!!this._def.checks.find((n)=>n.kind==="time")}get isDuration(){return!!this._def.checks.find((n)=>n.kind==="duration")}get isEmail(){return!!this._def.checks.find((n)=>n.kind==="email")}get isURL(){return!!this._def.checks.find((n)=>n.kind==="url")}get isEmoji(){return!!this._def.checks.find((n)=>n.kind==="emoji")}get isUUID(){return!!this._def.checks.find((n)=>n.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((n)=>n.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((n)=>n.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((n)=>n.kind==="cuid2")}get isULID(){return!!this._def.checks.find((n)=>n.kind==="ulid")}get isIP(){return!!this._def.checks.find((n)=>n.kind==="ip")}get isCIDR(){return!!this._def.checks.find((n)=>n.kind==="cidr")}get isBase64(){return!!this._def.checks.find((n)=>n.kind==="base64")}get isBase64url(){return!!this._def.checks.find((n)=>n.kind==="base64url")}get minLength(){let n=null;for(let i of this._def.checks)if(i.kind==="min"){if(n===null||i.value>n)n=i.value}return n}get maxLength(){let n=null;for(let i of this._def.checks)if(i.kind==="max"){if(n===null||i.value<n)n=i.value}return n}}cn.create=(n)=>{var i;return new cn({checks:[],typeName:S.ZodString,coerce:(i=n===null||n===void 0?void 0:n.coerce)!==null&&i!==void 0?i:!1,...A(n)})};function TX(n,i){let $=(n.toString().split(".")[1]||"").length,g=(i.toString().split(".")[1]||"").length,v=$>g?$:g,w=parseInt(n.toFixed(v).replace(".","")),_=parseInt(i.toFixed(v).replace(".",""));return w%_/Math.pow(10,v)}class Wv extends x{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(n){if(this._def.coerce)n.data=Number(n.data);if(this._getType(n)!==c.number){let v=this._getOrReturnCtx(n);return F(v,{code:q.invalid_type,expected:c.number,received:v.parsedType}),z}let $=void 0,g=new kn;for(let v of this._def.checks)if(v.kind==="int"){if(!Z.isInteger(n.data))$=this._getOrReturnCtx(n,$),F($,{code:q.invalid_type,expected:"integer",received:"float",message:v.message}),g.dirty()}else if(v.kind==="min"){if(v.inclusive?n.data<v.value:n.data<=v.value)$=this._getOrReturnCtx(n,$),F($,{code:q.too_small,minimum:v.value,type:"number",inclusive:v.inclusive,exact:!1,message:v.message}),g.dirty()}else if(v.kind==="max"){if(v.inclusive?n.data>v.value:n.data>=v.value)$=this._getOrReturnCtx(n,$),F($,{code:q.too_big,maximum:v.value,type:"number",inclusive:v.inclusive,exact:!1,message:v.message}),g.dirty()}else if(v.kind==="multipleOf"){if(TX(n.data,v.value)!==0)$=this._getOrReturnCtx(n,$),F($,{code:q.not_multiple_of,multipleOf:v.value,message:v.message}),g.dirty()}else if(v.kind==="finite"){if(!Number.isFinite(n.data))$=this._getOrReturnCtx(n,$),F($,{code:q.not_finite,message:v.message}),g.dirty()}else Z.assertNever(v);return{status:g.value,value:n.data}}gte(n,i){return this.setLimit("min",n,!0,P.toString(i))}gt(n,i){return this.setLimit("min",n,!1,P.toString(i))}lte(n,i){return this.setLimit("max",n,!0,P.toString(i))}lt(n,i){return this.setLimit("max",n,!1,P.toString(i))}setLimit(n,i,$,g){return new Wv({...this._def,checks:[...this._def.checks,{kind:n,value:i,inclusive:$,message:P.toString(g)}]})}_addCheck(n){return new Wv({...this._def,checks:[...this._def.checks,n]})}int(n){return this._addCheck({kind:"int",message:P.toString(n)})}positive(n){return this._addCheck({kind:"min",value:0,inclusive:!1,message:P.toString(n)})}negative(n){return this._addCheck({kind:"max",value:0,inclusive:!1,message:P.toString(n)})}nonpositive(n){return this._addCheck({kind:"max",value:0,inclusive:!0,message:P.toString(n)})}nonnegative(n){return this._addCheck({kind:"min",value:0,inclusive:!0,message:P.toString(n)})}multipleOf(n,i){return this._addCheck({kind:"multipleOf",value:n,message:P.toString(i)})}finite(n){return this._addCheck({kind:"finite",message:P.toString(n)})}safe(n){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:P.toString(n)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:P.toString(n)})}get minValue(){let n=null;for(let i of this._def.checks)if(i.kind==="min"){if(n===null||i.value>n)n=i.value}return n}get maxValue(){let n=null;for(let i of this._def.checks)if(i.kind==="max"){if(n===null||i.value<n)n=i.value}return n}get isInt(){return!!this._def.checks.find((n)=>n.kind==="int"||n.kind==="multipleOf"&&Z.isInteger(n.value))}get isFinite(){let n=null,i=null;for(let $ of this._def.checks)if($.kind==="finite"||$.kind==="int"||$.kind==="multipleOf")return!0;else if($.kind==="min"){if(i===null||$.value>i)i=$.value}else if($.kind==="max"){if(n===null||$.value<n)n=$.value}return Number.isFinite(i)&&Number.isFinite(n)}}Wv.create=(n)=>{return new Wv({checks:[],typeName:S.ZodNumber,coerce:(n===null||n===void 0?void 0:n.coerce)||!1,...A(n)})};class Yv extends x{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(n){if(this._def.coerce)try{n.data=BigInt(n.data)}catch(v){return this._getInvalidInput(n)}if(this._getType(n)!==c.bigint)return this._getInvalidInput(n);let $=void 0,g=new kn;for(let v of this._def.checks)if(v.kind==="min"){if(v.inclusive?n.data<v.value:n.data<=v.value)$=this._getOrReturnCtx(n,$),F($,{code:q.too_small,type:"bigint",minimum:v.value,inclusive:v.inclusive,message:v.message}),g.dirty()}else if(v.kind==="max"){if(v.inclusive?n.data>v.value:n.data>=v.value)$=this._getOrReturnCtx(n,$),F($,{code:q.too_big,type:"bigint",maximum:v.value,inclusive:v.inclusive,message:v.message}),g.dirty()}else if(v.kind==="multipleOf"){if(n.data%v.value!==BigInt(0))$=this._getOrReturnCtx(n,$),F($,{code:q.not_multiple_of,multipleOf:v.value,message:v.message}),g.dirty()}else Z.assertNever(v);return{status:g.value,value:n.data}}_getInvalidInput(n){let i=this._getOrReturnCtx(n);return F(i,{code:q.invalid_type,expected:c.bigint,received:i.parsedType}),z}gte(n,i){return this.setLimit("min",n,!0,P.toString(i))}gt(n,i){return this.setLimit("min",n,!1,P.toString(i))}lte(n,i){return this.setLimit("max",n,!0,P.toString(i))}lt(n,i){return this.setLimit("max",n,!1,P.toString(i))}setLimit(n,i,$,g){return new Yv({...this._def,checks:[...this._def.checks,{kind:n,value:i,inclusive:$,message:P.toString(g)}]})}_addCheck(n){return new Yv({...this._def,checks:[...this._def.checks,n]})}positive(n){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:P.toString(n)})}negative(n){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:P.toString(n)})}nonpositive(n){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:P.toString(n)})}nonnegative(n){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:P.toString(n)})}multipleOf(n,i){return this._addCheck({kind:"multipleOf",value:n,message:P.toString(i)})}get minValue(){let n=null;for(let i of this._def.checks)if(i.kind==="min"){if(n===null||i.value>n)n=i.value}return n}get maxValue(){let n=null;for(let i of this._def.checks)if(i.kind==="max"){if(n===null||i.value<n)n=i.value}return n}}Yv.create=(n)=>{var i;return new Yv({checks:[],typeName:S.ZodBigInt,coerce:(i=n===null||n===void 0?void 0:n.coerce)!==null&&i!==void 0?i:!1,...A(n)})};class qi extends x{_parse(n){if(this._def.coerce)n.data=Boolean(n.data);if(this._getType(n)!==c.boolean){let $=this._getOrReturnCtx(n);return F($,{code:q.invalid_type,expected:c.boolean,received:$.parsedType}),z}return Jn(n.data)}}qi.create=(n)=>{return new qi({typeName:S.ZodBoolean,coerce:(n===null||n===void 0?void 0:n.coerce)||!1,...A(n)})};class ev extends x{_parse(n){if(this._def.coerce)n.data=new Date(n.data);if(this._getType(n)!==c.date){let v=this._getOrReturnCtx(n);return F(v,{code:q.invalid_type,expected:c.date,received:v.parsedType}),z}if(isNaN(n.data.getTime())){let v=this._getOrReturnCtx(n);return F(v,{code:q.invalid_date}),z}let $=new kn,g=void 0;for(let v of this._def.checks)if(v.kind==="min"){if(n.data.getTime()<v.value)g=this._getOrReturnCtx(n,g),F(g,{code:q.too_small,message:v.message,inclusive:!0,exact:!1,minimum:v.value,type:"date"}),$.dirty()}else if(v.kind==="max"){if(n.data.getTime()>v.value)g=this._getOrReturnCtx(n,g),F(g,{code:q.too_big,message:v.message,inclusive:!0,exact:!1,maximum:v.value,type:"date"}),$.dirty()}else Z.assertNever(v);return{status:$.value,value:new Date(n.data.getTime())}}_addCheck(n){return new ev({...this._def,checks:[...this._def.checks,n]})}min(n,i){return this._addCheck({kind:"min",value:n.getTime(),message:P.toString(i)})}max(n,i){return this._addCheck({kind:"max",value:n.getTime(),message:P.toString(i)})}get minDate(){let n=null;for(let i of this._def.checks)if(i.kind==="min"){if(n===null||i.value>n)n=i.value}return n!=null?new Date(n):null}get maxDate(){let n=null;for(let i of this._def.checks)if(i.kind==="max"){if(n===null||i.value<n)n=i.value}return n!=null?new Date(n):null}}ev.create=(n)=>{return new ev({checks:[],coerce:(n===null||n===void 0?void 0:n.coerce)||!1,typeName:S.ZodDate,...A(n)})};class o$ extends x{_parse(n){if(this._getType(n)!==c.symbol){let $=this._getOrReturnCtx(n);return F($,{code:q.invalid_type,expected:c.symbol,received:$.parsedType}),z}return Jn(n.data)}}o$.create=(n)=>{return new o$({typeName:S.ZodSymbol,...A(n)})};class Li extends x{_parse(n){if(this._getType(n)!==c.undefined){let $=this._getOrReturnCtx(n);return F($,{code:q.invalid_type,expected:c.undefined,received:$.parsedType}),z}return Jn(n.data)}}Li.create=(n)=>{return new Li({typeName:S.ZodUndefined,...A(n)})};class Ki extends x{_parse(n){if(this._getType(n)!==c.null){let $=this._getOrReturnCtx(n);return F($,{code:q.invalid_type,expected:c.null,received:$.parsedType}),z}return Jn(n.data)}}Ki.create=(n)=>{return new Ki({typeName:S.ZodNull,...A(n)})};class pv extends x{constructor(){super(...arguments);this._any=!0}_parse(n){return Jn(n.data)}}pv.create=(n)=>{return new pv({typeName:S.ZodAny,...A(n)})};class Qv extends x{constructor(){super(...arguments);this._unknown=!0}_parse(n){return Jn(n.data)}}Qv.create=(n)=>{return new Qv({typeName:S.ZodUnknown,...A(n)})};class Tn extends x{_parse(n){let i=this._getOrReturnCtx(n);return F(i,{code:q.invalid_type,expected:c.never,received:i.parsedType}),z}}Tn.create=(n)=>{return new Tn({typeName:S.ZodNever,...A(n)})};class T$ extends x{_parse(n){if(this._getType(n)!==c.undefined){let $=this._getOrReturnCtx(n);return F($,{code:q.invalid_type,expected:c.void,received:$.parsedType}),z}return Jn(n.data)}}T$.create=(n)=>{return new T$({typeName:S.ZodVoid,...A(n)})};class Pn extends x{_parse(n){let{ctx:i,status:$}=this._processInputParams(n),g=this._def;if(i.parsedType!==c.array)return F(i,{code:q.invalid_type,expected:c.array,received:i.parsedType}),z;if(g.exactLength!==null){let w=i.data.length>g.exactLength.value,_=i.data.length<g.exactLength.value;if(w||_)F(i,{code:w?q.too_big:q.too_small,minimum:_?g.exactLength.value:void 0,maximum:w?g.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:g.exactLength.message}),$.dirty()}if(g.minLength!==null){if(i.data.length<g.minLength.value)F(i,{code:q.too_small,minimum:g.minLength.value,type:"array",inclusive:!0,exact:!1,message:g.minLength.message}),$.dirty()}if(g.maxLength!==null){if(i.data.length>g.maxLength.value)F(i,{code:q.too_big,maximum:g.maxLength.value,type:"array",inclusive:!0,exact:!1,message:g.maxLength.message}),$.dirty()}if(i.common.async)return Promise.all([...i.data].map((w,_)=>{return g.type._parseAsync(new zn(i,w,i.path,_))})).then((w)=>{return kn.mergeArray($,w)});let v=[...i.data].map((w,_)=>{return g.type._parseSync(new zn(i,w,i.path,_))});return kn.mergeArray($,v)}get element(){return this._def.type}min(n,i){return new Pn({...this._def,minLength:{value:n,message:P.toString(i)}})}max(n,i){return new Pn({...this._def,maxLength:{value:n,message:P.toString(i)}})}length(n,i){return new Pn({...this._def,exactLength:{value:n,message:P.toString(i)}})}nonempty(n){return this.min(1,n)}}Pn.create=(n,i)=>{return new Pn({type:n,minLength:null,maxLength:null,exactLength:null,typeName:S.ZodArray,...A(i)})};function ui(n){if(n instanceof nn){let i={};for(let $ in n.shape){let g=n.shape[$];i[$]=Sn.create(ui(g))}return new nn({...n._def,shape:()=>i})}else if(n instanceof Pn)return new Pn({...n._def,type:ui(n.element)});else if(n instanceof Sn)return Sn.create(ui(n.unwrap()));else if(n instanceof iv)return iv.create(ui(n.unwrap()));else if(n instanceof Zn)return Zn.create(n.items.map((i)=>ui(i)));else return n}class nn extends x{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let n=this._def.shape(),i=Z.objectKeys(n);return this._cached={shape:n,keys:i}}_parse(n){if(this._getType(n)!==c.object){let k=this._getOrReturnCtx(n);return F(k,{code:q.invalid_type,expected:c.object,received:k.parsedType}),z}let{status:$,ctx:g}=this._processInputParams(n),{shape:v,keys:w}=this._getCached(),_=[];if(!(this._def.catchall instanceof Tn&&this._def.unknownKeys==="strip")){for(let k in g.data)if(!w.includes(k))_.push(k)}let U=[];for(let k of w){let l=v[k],J=g.data[k];U.push({key:{status:"valid",value:k},value:l._parse(new zn(g,J,g.path,k)),alwaysSet:k in g.data})}if(this._def.catchall instanceof Tn){let k=this._def.unknownKeys;if(k==="passthrough")for(let l of _)U.push({key:{status:"valid",value:l},value:{status:"valid",value:g.data[l]}});else if(k==="strict"){if(_.length>0)F(g,{code:q.unrecognized_keys,keys:_}),$.dirty()}else if(k==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let k=this._def.catchall;for(let l of _){let J=g.data[l];U.push({key:{status:"valid",value:l},value:k._parse(new zn(g,J,g.path,l)),alwaysSet:l in g.data})}}if(g.common.async)return Promise.resolve().then(async()=>{let k=[];for(let l of U){let J=await l.key,Q=await l.value;k.push({key:J,value:Q,alwaysSet:l.alwaysSet})}return k}).then((k)=>{return kn.mergeObjectSync($,k)});else return kn.mergeObjectSync($,U)}get shape(){return this._def.shape()}strict(n){return P.errToObj,new nn({...this._def,unknownKeys:"strict",...n!==void 0?{errorMap:(i,$)=>{var g,v,w,_;let U=(w=(v=(g=this._def).errorMap)===null||v===void 0?void 0:v.call(g,i,$).message)!==null&&w!==void 0?w:$.defaultError;if(i.code==="unrecognized_keys")return{message:(_=P.errToObj(n).message)!==null&&_!==void 0?_:U};return{message:U}}}:{}})}strip(){return new nn({...this._def,unknownKeys:"strip"})}passthrough(){return new nn({...this._def,unknownKeys:"passthrough"})}extend(n){return new nn({...this._def,shape:()=>({...this._def.shape(),...n})})}merge(n){return new nn({unknownKeys:n._def.unknownKeys,catchall:n._def.catchall,shape:()=>({...this._def.shape(),...n._def.shape()}),typeName:S.ZodObject})}setKey(n,i){return this.augment({[n]:i})}catchall(n){return new nn({...this._def,catchall:n})}pick(n){let i={};return Z.objectKeys(n).forEach(($)=>{if(n[$]&&this.shape[$])i[$]=this.shape[$]}),new nn({...this._def,shape:()=>i})}omit(n){let i={};return Z.objectKeys(this.shape).forEach(($)=>{if(!n[$])i[$]=this.shape[$]}),new nn({...this._def,shape:()=>i})}deepPartial(){return ui(this)}partial(n){let i={};return Z.objectKeys(this.shape).forEach(($)=>{let g=this.shape[$];if(n&&!n[$])i[$]=g;else i[$]=g.optional()}),new nn({...this._def,shape:()=>i})}required(n){let i={};return Z.objectKeys(this.shape).forEach(($)=>{if(n&&!n[$])i[$]=this.shape[$];else{let v=this.shape[$];while(v instanceof Sn)v=v._def.innerType;i[$]=v}}),new nn({...this._def,shape:()=>i})}keyof(){return l2(Z.objectKeys(this.shape))}}nn.create=(n,i)=>{return new nn({shape:()=>n,unknownKeys:"strip",catchall:Tn.create(),typeName:S.ZodObject,...A(i)})};nn.strictCreate=(n,i)=>{return new nn({shape:()=>n,unknownKeys:"strict",catchall:Tn.create(),typeName:S.ZodObject,...A(i)})};nn.lazycreate=(n,i)=>{return new nn({shape:n,unknownKeys:"strip",catchall:Tn.create(),typeName:S.ZodObject,...A(i)})};class Oi extends x{_parse(n){let{ctx:i}=this._processInputParams(n),$=this._def.options;function g(v){for(let _ of v)if(_.result.status==="valid")return _.result;for(let _ of v)if(_.result.status==="dirty")return i.common.issues.push(..._.ctx.common.issues),_.result;let w=v.map((_)=>new In(_.ctx.common.issues));return F(i,{code:q.invalid_union,unionErrors:w}),z}if(i.common.async)return Promise.all($.map(async(v)=>{let w={...i,common:{...i.common,issues:[]},parent:null};return{result:await v._parseAsync({data:i.data,path:i.path,parent:w}),ctx:w}})).then(g);else{let v=void 0,w=[];for(let U of $){let k={...i,common:{...i.common,issues:[]},parent:null},l=U._parseSync({data:i.data,path:i.path,parent:k});if(l.status==="valid")return l;else if(l.status==="dirty"&&!v)v={result:l,ctx:k};if(k.common.issues.length)w.push(k.common.issues)}if(v)return i.common.issues.push(...v.ctx.common.issues),v.result;let _=w.map((U)=>new In(U));return F(i,{code:q.invalid_union,unionErrors:_}),z}}get options(){return this._def.options}}Oi.create=(n,i)=>{return new Oi({options:n,typeName:S.ZodUnion,...A(i)})};var nv=(n)=>{if(n instanceof Fi)return nv(n.schema);else if(n instanceof Vn)return nv(n.innerType());else if(n instanceof Ni)return[n.value];else if(n instanceof Iv)return n.options;else if(n instanceof ci)return Z.objectValues(n.enum);else if(n instanceof Pi)return nv(n._def.innerType);else if(n instanceof Li)return[void 0];else if(n instanceof Ki)return[null];else if(n instanceof Sn)return[void 0,...nv(n.unwrap())];else if(n instanceof iv)return[null,...nv(n.unwrap())];else if(n instanceof Sw)return nv(n.unwrap());else if(n instanceof zi)return nv(n.unwrap());else if(n instanceof Si)return nv(n._def.innerType);else return[]};class Pw extends x{_parse(n){let{ctx:i}=this._processInputParams(n);if(i.parsedType!==c.object)return F(i,{code:q.invalid_type,expected:c.object,received:i.parsedType}),z;let $=this.discriminator,g=i.data[$],v=this.optionsMap.get(g);if(!v)return F(i,{code:q.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[$]}),z;if(i.common.async)return v._parseAsync({data:i.data,path:i.path,parent:i});else return v._parseSync({data:i.data,path:i.path,parent:i})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(n,i,$){let g=new Map;for(let v of i){let w=nv(v.shape[n]);if(!w.length)throw Error(`A discriminator value for key \`${n}\` could not be extracted from all schema options`);for(let _ of w){if(g.has(_))throw Error(`Discriminator property ${String(n)} has duplicate value ${String(_)}`);g.set(_,v)}}return new Pw({typeName:S.ZodDiscriminatedUnion,discriminator:n,options:i,optionsMap:g,...A($)})}}function V_(n,i){let $=vv(n),g=vv(i);if(n===i)return{valid:!0,data:n};else if($===c.object&&g===c.object){let v=Z.objectKeys(i),w=Z.objectKeys(n).filter((U)=>v.indexOf(U)!==-1),_={...n,...i};for(let U of w){let k=V_(n[U],i[U]);if(!k.valid)return{valid:!1};_[U]=k.data}return{valid:!0,data:_}}else if($===c.array&&g===c.array){if(n.length!==i.length)return{valid:!1};let v=[];for(let w=0;w<n.length;w++){let _=n[w],U=i[w],k=V_(_,U);if(!k.valid)return{valid:!1};v.push(k.data)}return{valid:!0,data:v}}else if($===c.date&&g===c.date&&+n===+i)return{valid:!0,data:n};else return{valid:!1}}class Bi extends x{_parse(n){let{status:i,ctx:$}=this._processInputParams(n),g=(v,w)=>{if(u_(v)||u_(w))return z;let _=V_(v.value,w.value);if(!_.valid)return F($,{code:q.invalid_intersection_types}),z;if(H_(v)||H_(w))i.dirty();return{status:i.value,value:_.data}};if($.common.async)return Promise.all([this._def.left._parseAsync({data:$.data,path:$.path,parent:$}),this._def.right._parseAsync({data:$.data,path:$.path,parent:$})]).then(([v,w])=>g(v,w));else return g(this._def.left._parseSync({data:$.data,path:$.path,parent:$}),this._def.right._parseSync({data:$.data,path:$.path,parent:$}))}}Bi.create=(n,i,$)=>{return new Bi({left:n,right:i,typeName:S.ZodIntersection,...A($)})};class Zn extends x{_parse(n){let{status:i,ctx:$}=this._processInputParams(n);if($.parsedType!==c.array)return F($,{code:q.invalid_type,expected:c.array,received:$.parsedType}),z;if($.data.length<this._def.items.length)return F($,{code:q.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),z;if(!this._def.rest&&$.data.length>this._def.items.length)F($,{code:q.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),i.dirty();let v=[...$.data].map((w,_)=>{let U=this._def.items[_]||this._def.rest;if(!U)return null;return U._parse(new zn($,w,$.path,_))}).filter((w)=>!!w);if($.common.async)return Promise.all(v).then((w)=>{return kn.mergeArray(i,w)});else return kn.mergeArray(i,v)}get items(){return this._def.items}rest(n){return new Zn({...this._def,rest:n})}}Zn.create=(n,i)=>{if(!Array.isArray(n))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new Zn({items:n,typeName:S.ZodTuple,rest:null,...A(i)})};class Z$ extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(n){let{status:i,ctx:$}=this._processInputParams(n);if($.parsedType!==c.object)return F($,{code:q.invalid_type,expected:c.object,received:$.parsedType}),z;let g=[],v=this._def.keyType,w=this._def.valueType;for(let _ in $.data)g.push({key:v._parse(new zn($,_,$.path,_)),value:w._parse(new zn($,$.data[_],$.path,_)),alwaysSet:_ in $.data});if($.common.async)return kn.mergeObjectAsync(i,g);else return kn.mergeObjectSync(i,g)}get element(){return this._def.valueType}static create(n,i,$){if(i instanceof x)return new Z$({keyType:n,valueType:i,typeName:S.ZodRecord,...A($)});return new Z$({keyType:cn.create(),valueType:n,typeName:S.ZodRecord,...A(i)})}}class r$ extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(n){let{status:i,ctx:$}=this._processInputParams(n);if($.parsedType!==c.map)return F($,{code:q.invalid_type,expected:c.map,received:$.parsedType}),z;let g=this._def.keyType,v=this._def.valueType,w=[...$.data.entries()].map(([_,U],k)=>{return{key:g._parse(new zn($,_,$.path,[k,"key"])),value:v._parse(new zn($,U,$.path,[k,"value"]))}});if($.common.async){let _=new Map;return Promise.resolve().then(async()=>{for(let U of w){let k=await U.key,l=await U.value;if(k.status==="aborted"||l.status==="aborted")return z;if(k.status==="dirty"||l.status==="dirty")i.dirty();_.set(k.value,l.value)}return{status:i.value,value:_}})}else{let _=new Map;for(let U of w){let{key:k,value:l}=U;if(k.status==="aborted"||l.status==="aborted")return z;if(k.status==="dirty"||l.status==="dirty")i.dirty();_.set(k.value,l.value)}return{status:i.value,value:_}}}}r$.create=(n,i,$)=>{return new r$({valueType:i,keyType:n,typeName:S.ZodMap,...A($)})};class av extends x{_parse(n){let{status:i,ctx:$}=this._processInputParams(n);if($.parsedType!==c.set)return F($,{code:q.invalid_type,expected:c.set,received:$.parsedType}),z;let g=this._def;if(g.minSize!==null){if($.data.size<g.minSize.value)F($,{code:q.too_small,minimum:g.minSize.value,type:"set",inclusive:!0,exact:!1,message:g.minSize.message}),i.dirty()}if(g.maxSize!==null){if($.data.size>g.maxSize.value)F($,{code:q.too_big,maximum:g.maxSize.value,type:"set",inclusive:!0,exact:!1,message:g.maxSize.message}),i.dirty()}let v=this._def.valueType;function w(U){let k=new Set;for(let l of U){if(l.status==="aborted")return z;if(l.status==="dirty")i.dirty();k.add(l.value)}return{status:i.value,value:k}}let _=[...$.data.values()].map((U,k)=>v._parse(new zn($,U,$.path,k)));if($.common.async)return Promise.all(_).then((U)=>w(U));else return w(_)}min(n,i){return new av({...this._def,minSize:{value:n,message:P.toString(i)}})}max(n,i){return new av({...this._def,maxSize:{value:n,message:P.toString(i)}})}size(n,i){return this.min(n,i).max(n,i)}nonempty(n){return this.min(1,n)}}av.create=(n,i)=>{return new av({valueType:n,minSize:null,maxSize:null,typeName:S.ZodSet,...A(i)})};class Vi extends x{constructor(){super(...arguments);this.validate=this.implement}_parse(n){let{ctx:i}=this._processInputParams(n);if(i.parsedType!==c.function)return F(i,{code:q.invalid_type,expected:c.function,received:i.parsedType}),z;function $(_,U){return Nw({data:_,path:i.path,errorMaps:[i.common.contextualErrorMap,i.schemaErrorMap,Fw(),fi].filter((k)=>!!k),issueData:{code:q.invalid_arguments,argumentsError:U}})}function g(_,U){return Nw({data:_,path:i.path,errorMaps:[i.common.contextualErrorMap,i.schemaErrorMap,Fw(),fi].filter((k)=>!!k),issueData:{code:q.invalid_return_type,returnTypeError:U}})}let v={errorMap:i.common.contextualErrorMap},w=i.data;if(this._def.returns instanceof sv){let _=this;return Jn(async function(...U){let k=new In([]),l=await _._def.args.parseAsync(U,v).catch((j)=>{throw k.addIssue($(U,j)),k}),J=await Reflect.apply(w,this,l);return await _._def.returns._def.type.parseAsync(J,v).catch((j)=>{throw k.addIssue(g(J,j)),k})})}else{let _=this;return Jn(function(...U){let k=_._def.args.safeParse(U,v);if(!k.success)throw new In([$(U,k.error)]);let l=Reflect.apply(w,this,k.data),J=_._def.returns.safeParse(l,v);if(!J.success)throw new In([g(l,J.error)]);return J.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...n){return new Vi({...this._def,args:Zn.create(n).rest(Qv.create())})}returns(n){return new Vi({...this._def,returns:n})}implement(n){return this.parse(n)}strictImplement(n){return this.parse(n)}static create(n,i,$){return new Vi({args:n?n:Zn.create([]).rest(Qv.create()),returns:i||Qv.create(),typeName:S.ZodFunction,...A($)})}}class Fi extends x{get schema(){return this._def.getter()}_parse(n){let{ctx:i}=this._processInputParams(n);return this._def.getter()._parse({data:i.data,path:i.path,parent:i})}}Fi.create=(n,i)=>{return new Fi({getter:n,typeName:S.ZodLazy,...A(i)})};class Ni extends x{_parse(n){if(n.data!==this._def.value){let i=this._getOrReturnCtx(n);return F(i,{received:i.data,code:q.invalid_literal,expected:this._def.value}),z}return{status:"valid",value:n.data}}get value(){return this._def.value}}Ni.create=(n,i)=>{return new Ni({value:n,typeName:S.ZodLiteral,...A(i)})};function l2(n,i){return new Iv({values:n,typeName:S.ZodEnum,...A(i)})}class Iv extends x{constructor(){super(...arguments);h$.set(this,void 0)}_parse(n){if(typeof n.data!=="string"){let i=this._getOrReturnCtx(n),$=this._def.values;return F(i,{expected:Z.joinValues($),received:i.parsedType,code:q.invalid_type}),z}if(!cw(this,h$,"f"))_2(this,h$,new Set(this._def.values),"f");if(!cw(this,h$,"f").has(n.data)){let i=this._getOrReturnCtx(n),$=this._def.values;return F(i,{received:i.data,code:q.invalid_enum_value,options:$}),z}return Jn(n.data)}get options(){return this._def.values}get enum(){let n={};for(let i of this._def.values)n[i]=i;return n}get Values(){let n={};for(let i of this._def.values)n[i]=i;return n}get Enum(){let n={};for(let i of this._def.values)n[i]=i;return n}extract(n,i=this._def){return Iv.create(n,{...this._def,...i})}exclude(n,i=this._def){return Iv.create(this.options.filter(($)=>!n.includes($)),{...this._def,...i})}}h$=new WeakMap;Iv.create=l2;class ci extends x{constructor(){super(...arguments);C$.set(this,void 0)}_parse(n){let i=Z.getValidEnumValues(this._def.values),$=this._getOrReturnCtx(n);if($.parsedType!==c.string&&$.parsedType!==c.number){let g=Z.objectValues(i);return F($,{expected:Z.joinValues(g),received:$.parsedType,code:q.invalid_type}),z}if(!cw(this,C$,"f"))_2(this,C$,new Set(Z.getValidEnumValues(this._def.values)),"f");if(!cw(this,C$,"f").has(n.data)){let g=Z.objectValues(i);return F($,{received:$.data,code:q.invalid_enum_value,options:g}),z}return Jn(n.data)}get enum(){return this._def.values}}C$=new WeakMap;ci.create=(n,i)=>{return new ci({values:n,typeName:S.ZodNativeEnum,...A(i)})};class sv extends x{unwrap(){return this._def.type}_parse(n){let{ctx:i}=this._processInputParams(n);if(i.parsedType!==c.promise&&i.common.async===!1)return F(i,{code:q.invalid_type,expected:c.promise,received:i.parsedType}),z;let $=i.parsedType===c.promise?i.data:Promise.resolve(i.data);return Jn($.then((g)=>{return this._def.type.parseAsync(g,{path:i.path,errorMap:i.common.contextualErrorMap})}))}}sv.create=(n,i)=>{return new sv({type:n,typeName:S.ZodPromise,...A(i)})};class Vn extends x{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===S.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(n){let{status:i,ctx:$}=this._processInputParams(n),g=this._def.effect||null,v={addIssue:(w)=>{if(F($,w),w.fatal)i.abort();else i.dirty()},get path(){return $.path}};if(v.addIssue=v.addIssue.bind(v),g.type==="preprocess"){let w=g.transform($.data,v);if($.common.async)return Promise.resolve(w).then(async(_)=>{if(i.value==="aborted")return z;let U=await this._def.schema._parseAsync({data:_,path:$.path,parent:$});if(U.status==="aborted")return z;if(U.status==="dirty")return Hi(U.value);if(i.value==="dirty")return Hi(U.value);return U});else{if(i.value==="aborted")return z;let _=this._def.schema._parseSync({data:w,path:$.path,parent:$});if(_.status==="aborted")return z;if(_.status==="dirty")return Hi(_.value);if(i.value==="dirty")return Hi(_.value);return _}}if(g.type==="refinement"){let w=(_)=>{let U=g.refinement(_,v);if($.common.async)return Promise.resolve(U);if(U instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return _};if($.common.async===!1){let _=this._def.schema._parseSync({data:$.data,path:$.path,parent:$});if(_.status==="aborted")return z;if(_.status==="dirty")i.dirty();return w(_.value),{status:i.value,value:_.value}}else return this._def.schema._parseAsync({data:$.data,path:$.path,parent:$}).then((_)=>{if(_.status==="aborted")return z;if(_.status==="dirty")i.dirty();return w(_.value).then(()=>{return{status:i.value,value:_.value}})})}if(g.type==="transform")if($.common.async===!1){let w=this._def.schema._parseSync({data:$.data,path:$.path,parent:$});if(!dv(w))return w;let _=g.transform(w.value,v);if(_ instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:i.value,value:_}}else return this._def.schema._parseAsync({data:$.data,path:$.path,parent:$}).then((w)=>{if(!dv(w))return w;return Promise.resolve(g.transform(w.value,v)).then((_)=>({status:i.value,value:_}))});Z.assertNever(g)}}Vn.create=(n,i,$)=>{return new Vn({schema:n,typeName:S.ZodEffects,effect:i,...A($)})};Vn.createWithPreprocess=(n,i,$)=>{return new Vn({schema:i,effect:{type:"preprocess",transform:n},typeName:S.ZodEffects,...A($)})};class Sn extends x{_parse(n){if(this._getType(n)===c.undefined)return Jn(void 0);return this._def.innerType._parse(n)}unwrap(){return this._def.innerType}}Sn.create=(n,i)=>{return new Sn({innerType:n,typeName:S.ZodOptional,...A(i)})};class iv extends x{_parse(n){if(this._getType(n)===c.null)return Jn(null);return this._def.innerType._parse(n)}unwrap(){return this._def.innerType}}iv.create=(n,i)=>{return new iv({innerType:n,typeName:S.ZodNullable,...A(i)})};class Pi extends x{_parse(n){let{ctx:i}=this._processInputParams(n),$=i.data;if(i.parsedType===c.undefined)$=this._def.defaultValue();return this._def.innerType._parse({data:$,path:i.path,parent:i})}removeDefault(){return this._def.innerType}}Pi.create=(n,i)=>{return new Pi({innerType:n,typeName:S.ZodDefault,defaultValue:typeof i.default==="function"?i.default:()=>i.default,...A(i)})};class Si extends x{_parse(n){let{ctx:i}=this._processInputParams(n),$={...i,common:{...i.common,issues:[]}},g=this._def.innerType._parse({data:$.data,path:$.path,parent:{...$}});if(E$(g))return g.then((v)=>{return{status:"valid",value:v.status==="valid"?v.value:this._def.catchValue({get error(){return new In($.common.issues)},input:$.data})}});else return{status:"valid",value:g.status==="valid"?g.value:this._def.catchValue({get error(){return new In($.common.issues)},input:$.data})}}removeCatch(){return this._def.innerType}}Si.create=(n,i)=>{return new Si({innerType:n,typeName:S.ZodCatch,catchValue:typeof i.catch==="function"?i.catch:()=>i.catch,...A(i)})};class m$ extends x{_parse(n){if(this._getType(n)!==c.nan){let $=this._getOrReturnCtx(n);return F($,{code:q.invalid_type,expected:c.nan,received:$.parsedType}),z}return{status:"valid",value:n.data}}}m$.create=(n)=>{return new m$({typeName:S.ZodNaN,...A(n)})};var ZX=Symbol("zod_brand");class Sw extends x{_parse(n){let{ctx:i}=this._processInputParams(n),$=i.data;return this._def.type._parse({data:$,path:i.path,parent:i})}unwrap(){return this._def.type}}class y$ extends x{_parse(n){let{status:i,ctx:$}=this._processInputParams(n);if($.common.async)return(async()=>{let v=await this._def.in._parseAsync({data:$.data,path:$.path,parent:$});if(v.status==="aborted")return z;if(v.status==="dirty")return i.dirty(),Hi(v.value);else return this._def.out._parseAsync({data:v.value,path:$.path,parent:$})})();else{let g=this._def.in._parseSync({data:$.data,path:$.path,parent:$});if(g.status==="aborted")return z;if(g.status==="dirty")return i.dirty(),{status:"dirty",value:g.value};else return this._def.out._parseSync({data:g.value,path:$.path,parent:$})}}static create(n,i){return new y$({in:n,out:i,typeName:S.ZodPipeline})}}class zi extends x{_parse(n){let i=this._def.innerType._parse(n),$=(g)=>{if(dv(g))g.value=Object.freeze(g.value);return g};return E$(i)?i.then((g)=>$(g)):$(i)}unwrap(){return this._def.innerType}}zi.create=(n,i)=>{return new zi({innerType:n,typeName:S.ZodReadonly,...A(i)})};function D2(n,i={},$){if(n)return pv.create().superRefine((g,v)=>{var w,_;if(!n(g)){let U=typeof i==="function"?i(g):typeof i==="string"?{message:i}:i,k=(_=(w=U.fatal)!==null&&w!==void 0?w:$)!==null&&_!==void 0?_:!0,l=typeof U==="string"?{message:U}:U;v.addIssue({code:"custom",...l,fatal:k})}});return pv.create()}var rX={object:nn.lazycreate},S;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(S||(S={}));var mX=(n,i={message:`Input not instance of ${n.name}`})=>D2(($)=>$ instanceof n,i),J2=cn.create,X2=Wv.create,yX=m$.create,dX=Yv.create,G2=qi.create,eX=ev.create,pX=o$.create,aX=Li.create,sX=Ki.create,nG=pv.create,vG=Qv.create,iG=Tn.create,$G=T$.create,gG=Pn.create,wG=nn.create,_G=nn.strictCreate,bG=Oi.create,UG=Pw.create,kG=Bi.create,lG=Zn.create,DG=Z$.create,JG=r$.create,XG=av.create,GG=Vi.create,tG=Fi.create,QG=Ni.create,WG=Iv.create,YG=ci.create,IG=sv.create,g2=Vn.create,jG=Sn.create,uG=iv.create,HG=Vn.createWithPreprocess,VG=y$.create,fG=()=>J2().optional(),qG=()=>X2().optional(),LG=()=>G2().optional(),KG={string:(n)=>cn.create({...n,coerce:!0}),number:(n)=>Wv.create({...n,coerce:!0}),boolean:(n)=>qi.create({...n,coerce:!0}),bigint:(n)=>Yv.create({...n,coerce:!0}),date:(n)=>ev.create({...n,coerce:!0})},OG=z,X=Object.freeze({__proto__:null,defaultErrorMap:fi,setErrorMap:HX,getErrorMap:Fw,makeIssue:Nw,EMPTY_PATH:VX,addIssueToContext:F,ParseStatus:kn,INVALID:z,DIRTY:Hi,OK:Jn,isAborted:u_,isDirty:H_,isValid:dv,isAsync:E$,get util(){return Z},get objectUtil(){return j_},ZodParsedType:c,getParsedType:vv,ZodType:x,datetimeRegex:k2,ZodString:cn,ZodNumber:Wv,ZodBigInt:Yv,ZodBoolean:qi,ZodDate:ev,ZodSymbol:o$,ZodUndefined:Li,ZodNull:Ki,ZodAny:pv,ZodUnknown:Qv,ZodNever:Tn,ZodVoid:T$,ZodArray:Pn,ZodObject:nn,ZodUnion:Oi,ZodDiscriminatedUnion:Pw,ZodIntersection:Bi,ZodTuple:Zn,ZodRecord:Z$,ZodMap:r$,ZodSet:av,ZodFunction:Vi,ZodLazy:Fi,ZodLiteral:Ni,ZodEnum:Iv,ZodNativeEnum:ci,ZodPromise:sv,ZodEffects:Vn,ZodTransformer:Vn,ZodOptional:Sn,ZodNullable:iv,ZodDefault:Pi,ZodCatch:Si,ZodNaN:m$,BRAND:ZX,ZodBranded:Sw,ZodPipeline:y$,ZodReadonly:zi,custom:D2,Schema:x,ZodSchema:x,late:rX,get ZodFirstPartyTypeKind(){return S},coerce:KG,any:nG,array:gG,bigint:dX,boolean:G2,date:eX,discriminatedUnion:UG,effect:g2,enum:WG,function:GG,instanceof:mX,intersection:kG,lazy:tG,literal:QG,map:JG,nan:yX,nativeEnum:YG,never:iG,null:sX,nullable:uG,number:X2,object:wG,oboolean:LG,onumber:qG,optional:jG,ostring:fG,pipeline:VG,preprocess:HG,promise:IG,record:DG,set:XG,strictObject:_G,string:J2,symbol:pX,transformer:g2,tuple:lG,undefined:aX,union:bG,unknown:vG,void:$G,NEVER:OG,ZodIssueCode:q,quotelessJson:uX,ZodError:In});var f_="2024-11-05",t2=[f_,"2024-10-07"],zw="2.0",Q2=X.union([X.string(),X.number().int()]),W2=X.string(),Mn=X.object({_meta:X.optional(X.object({progressToken:X.optional(Q2)}).passthrough())}).passthrough(),jn=X.object({method:X.string(),params:X.optional(Mn)}),d$=X.object({_meta:X.optional(X.object({}).passthrough())}).passthrough(),rn=X.object({method:X.string(),params:X.optional(d$)}),Rn=X.object({_meta:X.optional(X.object({}).passthrough())}).passthrough(),Mw=X.union([X.string(),X.number().int()]),BG=X.object({jsonrpc:X.literal(zw),id:Mw}).merge(jn).strict(),FG=X.object({jsonrpc:X.literal(zw)}).merge(rn).strict(),NG=X.object({jsonrpc:X.literal(zw),id:Mw,result:Rn}).strict(),ni;(function(n){n[n.ConnectionClosed=-1]="ConnectionClosed",n[n.RequestTimeout=-2]="RequestTimeout",n[n.ParseError=-32700]="ParseError",n[n.InvalidRequest=-32600]="InvalidRequest",n[n.MethodNotFound=-32601]="MethodNotFound",n[n.InvalidParams=-32602]="InvalidParams",n[n.InternalError=-32603]="InternalError"})(ni||(ni={}));var cG=X.object({jsonrpc:X.literal(zw),id:Mw,error:X.object({code:X.number().int(),message:X.string(),data:X.optional(X.unknown())})}).strict(),Y2=X.union([BG,FG,NG,cG]),Rw=Rn.strict(),Aw=rn.extend({method:X.literal("notifications/cancelled"),params:d$.extend({requestId:Mw,reason:X.string().optional()})}),I2=X.object({name:X.string(),version:X.string()}).passthrough(),PG=X.object({experimental:X.optional(X.object({}).passthrough()),sampling:X.optional(X.object({}).passthrough()),roots:X.optional(X.object({listChanged:X.optional(X.boolean())}).passthrough())}).passthrough(),q_=jn.extend({method:X.literal("initialize"),params:Mn.extend({protocolVersion:X.string(),capabilities:PG,clientInfo:I2})}),SG=X.object({experimental:X.optional(X.object({}).passthrough()),logging:X.optional(X.object({}).passthrough()),prompts:X.optional(X.object({listChanged:X.optional(X.boolean())}).passthrough()),resources:X.optional(X.object({subscribe:X.optional(X.boolean()),listChanged:X.optional(X.boolean())}).passthrough()),tools:X.optional(X.object({listChanged:X.optional(X.boolean())}).passthrough())}).passthrough(),zG=Rn.extend({protocolVersion:X.string(),capabilities:SG,serverInfo:I2}),L_=rn.extend({method:X.literal("notifications/initialized")}),xw=jn.extend({method:X.literal("ping")}),MG=X.object({progress:X.number(),total:X.optional(X.number())}).passthrough(),hw=rn.extend({method:X.literal("notifications/progress"),params:d$.merge(MG).extend({progressToken:Q2})}),Cw=jn.extend({params:Mn.extend({cursor:X.optional(W2)}).optional()}),Ew=Rn.extend({nextCursor:X.optional(W2)}),j2=X.object({uri:X.string(),mimeType:X.optional(X.string())}).passthrough(),u2=j2.extend({text:X.string()}),H2=j2.extend({blob:X.string().base64()}),RG=X.object({uri:X.string(),name:X.string(),description:X.optional(X.string()),mimeType:X.optional(X.string())}).passthrough(),AG=X.object({uriTemplate:X.string(),name:X.string(),description:X.optional(X.string()),mimeType:X.optional(X.string())}).passthrough(),xG=Cw.extend({method:X.literal("resources/list")}),hG=Ew.extend({resources:X.array(RG)}),CG=Cw.extend({method:X.literal("resources/templates/list")}),EG=Ew.extend({resourceTemplates:X.array(AG)}),oG=jn.extend({method:X.literal("resources/read"),params:Mn.extend({uri:X.string()})}),TG=Rn.extend({contents:X.array(X.union([u2,H2]))}),ZG=rn.extend({method:X.literal("notifications/resources/list_changed")}),rG=jn.extend({method:X.literal("resources/subscribe"),params:Mn.extend({uri:X.string()})}),mG=jn.extend({method:X.literal("resources/unsubscribe"),params:Mn.extend({uri:X.string()})}),yG=rn.extend({method:X.literal("notifications/resources/updated"),params:d$.extend({uri:X.string()})}),dG=X.object({name:X.string(),description:X.optional(X.string()),required:X.optional(X.boolean())}).passthrough(),eG=X.object({name:X.string(),description:X.optional(X.string()),arguments:X.optional(X.array(dG))}).passthrough(),pG=Cw.extend({method:X.literal("prompts/list")}),aG=Ew.extend({prompts:X.array(eG)}),sG=jn.extend({method:X.literal("prompts/get"),params:Mn.extend({name:X.string(),arguments:X.optional(X.record(X.string()))})}),ow=X.object({type:X.literal("text"),text:X.string()}).passthrough(),Tw=X.object({type:X.literal("image"),data:X.string().base64(),mimeType:X.string()}).passthrough(),V2=X.object({type:X.literal("resource"),resource:X.union([u2,H2])}).passthrough(),nt=X.object({role:X.enum(["user","assistant"]),content:X.union([ow,Tw,V2])}).passthrough(),vt=Rn.extend({description:X.optional(X.string()),messages:X.array(nt)}),it=rn.extend({method:X.literal("notifications/prompts/list_changed")}),$t=X.object({name:X.string(),description:X.optional(X.string()),inputSchema:X.object({type:X.literal("object"),properties:X.optional(X.object({}).passthrough())}).passthrough()}).passthrough(),K_=Cw.extend({method:X.literal("tools/list")}),gt=Ew.extend({tools:X.array($t)}),f2=Rn.extend({content:X.array(X.union([ow,Tw,V2])),isError:X.boolean().default(!1).optional()}),nI=f2.or(Rn.extend({toolResult:X.unknown()})),O_=jn.extend({method:X.literal("tools/call"),params:Mn.extend({name:X.string(),arguments:X.optional(X.record(X.unknown()))})}),wt=rn.extend({method:X.literal("notifications/tools/list_changed")}),q2=X.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),_t=jn.extend({method:X.literal("logging/setLevel"),params:Mn.extend({level:q2})}),bt=rn.extend({method:X.literal("notifications/message"),params:d$.extend({level:q2,logger:X.optional(X.string()),data:X.unknown()})}),Ut=X.object({name:X.string().optional()}).passthrough(),kt=X.object({hints:X.optional(X.array(Ut)),costPriority:X.optional(X.number().min(0).max(1)),speedPriority:X.optional(X.number().min(0).max(1)),intelligencePriority:X.optional(X.number().min(0).max(1))}).passthrough(),lt=X.object({role:X.enum(["user","assistant"]),content:X.union([ow,Tw])}).passthrough(),Dt=jn.extend({method:X.literal("sampling/createMessage"),params:Mn.extend({messages:X.array(lt),systemPrompt:X.optional(X.string()),includeContext:X.optional(X.enum(["none","thisServer","allServers"])),temperature:X.optional(X.number()),maxTokens:X.number().int(),stopSequences:X.optional(X.array(X.string())),metadata:X.optional(X.object({}).passthrough()),modelPreferences:X.optional(kt)})}),B_=Rn.extend({model:X.string(),stopReason:X.optional(X.enum(["endTurn","stopSequence","maxTokens"]).or(X.string())),role:X.enum(["user","assistant"]),content:X.discriminatedUnion("type",[ow,Tw])}),Jt=X.object({type:X.literal("ref/resource"),uri:X.string()}).passthrough(),Xt=X.object({type:X.literal("ref/prompt"),name:X.string()}).passthrough(),Gt=jn.extend({method:X.literal("completion/complete"),params:Mn.extend({ref:X.union([Xt,Jt]),argument:X.object({name:X.string(),value:X.string()}).passthrough()})}),tt=Rn.extend({completion:X.object({values:X.array(X.string()).max(100),total:X.optional(X.number().int()),hasMore:X.optional(X.boolean())}).passthrough()}),Qt=X.object({uri:X.string().startsWith("file://"),name:X.optional(X.string())}).passthrough(),Wt=jn.extend({method:X.literal("roots/list")}),F_=Rn.extend({roots:X.array(Qt)}),Yt=rn.extend({method:X.literal("notifications/roots/list_changed")}),vI=X.union([xw,q_,Gt,_t,sG,pG,xG,CG,oG,rG,mG,O_,K_]),iI=X.union([Aw,hw,L_,Yt]),$I=X.union([Rw,B_,F_]),gI=X.union([xw,Dt,Wt]),wI=X.union([Aw,hw,bt,yG,ZG,wt,it]),_I=X.union([Rw,zG,tt,vt,aG,hG,EG,TG,f2,gt]);class e$ extends Error{constructor(n,i,$){super(`MCP error ${n}: ${i}`);this.code=n,this.data=$}}var It=60000;class N_{constructor(n){this._options=n,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this.setNotificationHandler(Aw,(i)=>{let $=this._requestHandlerAbortControllers.get(i.params.requestId);$===null||$===void 0||$.abort(i.params.reason)}),this.setNotificationHandler(hw,(i)=>{this._onprogress(i)}),this.setRequestHandler(xw,(i)=>({}))}async connect(n){this._transport=n,this._transport.onclose=()=>{this._onclose()},this._transport.onerror=(i)=>{this._onerror(i)},this._transport.onmessage=(i)=>{if(!("method"in i))this._onresponse(i);else if("id"in i)this._onrequest(i);else this._onnotification(i)},await this._transport.start()}_onclose(){var n;let i=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._transport=void 0,(n=this.onclose)===null||n===void 0||n.call(this);let $=new e$(ni.ConnectionClosed,"Connection closed");for(let g of i.values())g($)}_onerror(n){var i;(i=this.onerror)===null||i===void 0||i.call(this,n)}_onnotification(n){var i;let $=(i=this._notificationHandlers.get(n.method))!==null&&i!==void 0?i:this.fallbackNotificationHandler;if($===void 0)return;Promise.resolve().then(()=>$(n)).catch((g)=>this._onerror(Error(`Uncaught error in notification handler: ${g}`)))}_onrequest(n){var i,$;let g=(i=this._requestHandlers.get(n.method))!==null&&i!==void 0?i:this.fallbackRequestHandler;if(g===void 0){($=this._transport)===null||$===void 0||$.send({jsonrpc:"2.0",id:n.id,error:{code:ni.MethodNotFound,message:"Method not found"}}).catch((w)=>this._onerror(Error(`Failed to send an error response: ${w}`)));return}let v=new AbortController;this._requestHandlerAbortControllers.set(n.id,v),Promise.resolve().then(()=>g(n,{signal:v.signal})).then((w)=>{var _;if(v.signal.aborted)return;return(_=this._transport)===null||_===void 0?void 0:_.send({result:w,jsonrpc:"2.0",id:n.id})},(w)=>{var _,U;if(v.signal.aborted)return;return(_=this._transport)===null||_===void 0?void 0:_.send({jsonrpc:"2.0",id:n.id,error:{code:Number.isSafeInteger(w.code)?w.code:ni.InternalError,message:(U=w.message)!==null&&U!==void 0?U:"Internal error"}})}).catch((w)=>this._onerror(Error(`Failed to send response: ${w}`))).finally(()=>{this._requestHandlerAbortControllers.delete(n.id)})}_onprogress(n){let{progressToken:i,...$}=n.params,g=this._progressHandlers.get(Number(i));if(g===void 0){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(n)}`));return}g($)}_onresponse(n){let i=n.id,$=this._responseHandlers.get(Number(i));if($===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(n)}`));return}if(this._responseHandlers.delete(Number(i)),this._progressHandlers.delete(Number(i)),"result"in n)$(n);else{let g=new e$(n.error.code,n.error.message,n.error.data);$(g)}}get transport(){return this._transport}async close(){var n;await((n=this._transport)===null||n===void 0?void 0:n.close())}request(n,i,$){return new Promise((g,v)=>{var w,_,U,k;if(!this._transport){v(Error("Not connected"));return}if(((w=this._options)===null||w===void 0?void 0:w.enforceStrictCapabilities)===!0)this.assertCapabilityForMethod(n.method);(_=$===null||$===void 0?void 0:$.signal)===null||_===void 0||_.throwIfAborted();let l=this._requestMessageId++,J={...n,jsonrpc:"2.0",id:l};if($===null||$===void 0?void 0:$.onprogress)this._progressHandlers.set(l,$.onprogress),J.params={...n.params,_meta:{progressToken:l}};let Q=void 0;this._responseHandlers.set(l,(W)=>{var Y;if(Q!==void 0)clearTimeout(Q);if((Y=$===null||$===void 0?void 0:$.signal)===null||Y===void 0?void 0:Y.aborted)return;if(W instanceof Error)return v(W);try{let B=i.parse(W.result);g(B)}catch(B){v(B)}});let j=(W)=>{var Y;this._responseHandlers.delete(l),this._progressHandlers.delete(l),(Y=this._transport)===null||Y===void 0||Y.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:l,reason:String(W)}}).catch((B)=>this._onerror(Error(`Failed to send cancellation: ${B}`))),v(W)};(U=$===null||$===void 0?void 0:$.signal)===null||U===void 0||U.addEventListener("abort",()=>{var W;if(Q!==void 0)clearTimeout(Q);j((W=$===null||$===void 0?void 0:$.signal)===null||W===void 0?void 0:W.reason)});let u=(k=$===null||$===void 0?void 0:$.timeout)!==null&&k!==void 0?k:It;Q=setTimeout(()=>j(new e$(ni.RequestTimeout,"Request timed out",{timeout:u})),u),this._transport.send(J).catch((W)=>{if(Q!==void 0)clearTimeout(Q);v(W)})})}async notification(n){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(n.method);let i={...n,jsonrpc:"2.0"};await this._transport.send(i)}setRequestHandler(n,i){let $=n.shape.method.value;this.assertRequestHandlerCapability($),this._requestHandlers.set($,(g,v)=>Promise.resolve(i(n.parse(g),v)))}removeRequestHandler(n){this._requestHandlers.delete(n)}setNotificationHandler(n,i){this._notificationHandlers.set(n.shape.method.value,($)=>Promise.resolve(i(n.parse($))))}removeNotificationHandler(n){this._notificationHandlers.delete(n)}}class c_ extends N_{constructor(n,i){super(i);this._serverInfo=n,this._capabilities=i.capabilities,this.setRequestHandler(q_,($)=>this._oninitialize($)),this.setNotificationHandler(L_,()=>{var $;return($=this.oninitialized)===null||$===void 0?void 0:$.call(this)})}assertCapabilityForMethod(n){var i,$;switch(n){case"sampling/createMessage":if(!((i=this._clientCapabilities)===null||i===void 0?void 0:i.sampling))throw Error(`Client does not support sampling (required for ${n})`);break;case"roots/list":if(!(($=this._clientCapabilities)===null||$===void 0?void 0:$.roots))throw Error(`Client does not support listing roots (required for ${n})`);break;case"ping":break}}assertNotificationCapability(n){switch(n){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${n})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${n})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${n})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${n})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(n){switch(n){case"sampling/createMessage":if(!this._capabilities.sampling)throw Error(`Server does not support sampling (required for ${n})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${n})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${n})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${n})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${n})`);break;case"ping":case"initialize":break}}async _oninitialize(n){let i=n.params.protocolVersion;return this._clientCapabilities=n.params.capabilities,this._clientVersion=n.params.clientInfo,{protocolVersion:t2.includes(i)?i:f_,capabilities:this.getCapabilities(),serverInfo:this._serverInfo}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Rw)}async createMessage(n,i){return this.request({method:"sampling/createMessage",params:n},B_,i)}async listRoots(n,i){return this.request({method:"roots/list",params:n},F_,i)}async sendLoggingMessage(n){return this.notification({method:"notifications/message",params:n})}async sendResourceUpdated(n){return this.notification({method:"notifications/resources/updated",params:n})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}import K2 from"node:process";class P_{append(n){this._buffer=this._buffer?Buffer.concat([this._buffer,n]):n}readMessage(){if(!this._buffer)return null;let n=this._buffer.indexOf(`
2
2
  `);if(n===-1)return null;let i=this._buffer.toString("utf8",0,n);return this._buffer=this._buffer.subarray(n+1),jt(i)}clear(){this._buffer=void 0}}function jt(n){return Y2.parse(JSON.parse(n))}function L2(n){return JSON.stringify(n)+`
3
3
  `}class S_{constructor(n=K2.stdin,i=K2.stdout){this._stdin=n,this._stdout=i,this._readBuffer=new P_,this._started=!1,this._ondata=($)=>{this._readBuffer.append($),this.processReadBuffer()},this._onerror=($)=>{var g;(g=this.onerror)===null||g===void 0||g.call(this,$)}}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){var n,i;while(!0)try{let $=this._readBuffer.readMessage();if($===null)break;(n=this.onmessage)===null||n===void 0||n.call(this,$)}catch($){(i=this.onerror)===null||i===void 0||i.call(this,$)}}async close(){var n;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._readBuffer.clear(),(n=this.onclose)===null||n===void 0||n.call(this)}send(n){return new Promise((i)=>{let $=L2(n);if(this._stdout.write($))i();else this._stdout.once("drain",i)})}}function Ri(n,i){var $={};for(var g in n)if(Object.prototype.hasOwnProperty.call(n,g)&&i.indexOf(g)<0)$[g]=n[g];if(n!=null&&typeof Object.getOwnPropertySymbols==="function"){for(var v=0,g=Object.getOwnPropertySymbols(n);v<g.length;v++)if(i.indexOf(g[v])<0&&Object.prototype.propertyIsEnumerable.call(n,g[v]))$[g[v]]=n[g[v]]}return $}var ut={ZodAny:"any",ZodArray:"array",ZodBigInt:"bigint",ZodBoolean:"boolean",ZodDefault:"default",ZodPrefault:"prefault",ZodTransform:"transform",ZodEnum:"enum",ZodIntersection:"intersection",ZodLazy:"lazy",ZodLiteral:"literal",ZodNever:"never",ZodNull:"null",ZodNullable:"nullable",ZodNumber:"number",ZodNonOptional:"nonoptional",ZodObject:"object",ZodOptional:"optional",ZodPipe:"pipe",ZodReadonly:"readonly",ZodRecord:"record",ZodString:"string",ZodTuple:"tuple",ZodType:"type",ZodUnion:"union",ZodDiscriminatedUnion:"union",ZodUnknown:"unknown",ZodVoid:"void",ZodDate:"date",ZodTemplateLiteral:"template_literal"};function gv(n,i){return(Array.isArray(i)?i:[i]).some((g)=>{var v;let w=((v=n===null||n===void 0?void 0:n.def)===null||v===void 0?void 0:v.type)===ut[g];if(g==="ZodDiscriminatedUnion")return w&&"discriminator"in n.def;return w})}function Mi(n){return n&&"def"in n}class B2{constructor(){this._map=new Map,this._idmap=new Map}add(n,...i){let $=i[0];if(this._map.set(n,$),$&&typeof $==="object"&&"id"in $){if(this._idmap.has($.id))throw Error(`ID ${$.id} already exists in the registry`);this._idmap.set($.id,n)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(n){let i=this._map.get(n);if(i&&typeof i==="object"&&"id"in i)this._idmap.delete(i.id);return this._map.delete(n),this}get(n){let i=n._zod.parent;if(i){let $={...this.get(i)??{}};return delete $.id,{...$,...this._map.get(n)}}return this._map.get(n)}has(n){return this._map.has(n)}}function Ht(){return new B2}function z_(n){return n===void 0}function Vt(n,i){let $={};return Object.entries(n).forEach(([g,v])=>{if(!i.some((w)=>w===g))$[g]=v}),$}function M_(n,i){let $={};return Object.entries(n).forEach(([g,v])=>{if(!i(v,g))$[g]=v}),$}var O2=Ht();class wv{static collectMetadata(n,i){let $=this.getMetadataFromRegistry(n),g=Object.assign(Object.assign({},$===null||$===void 0?void 0:$._internal),i===null||i===void 0?void 0:i._internal),v=Object.assign(Object.assign({},$===null||$===void 0?void 0:$.param),i===null||i===void 0?void 0:i.param),w=Object.assign(Object.assign(Object.assign(Object.assign({},Object.keys(g).length>0?{_internal:g}:{}),$),i),Object.keys(v).length>0?{param:v}:{});if(gv(n,["ZodOptional","ZodNullable","ZodDefault","ZodPrefault","ZodReadonly","ZodNonOptional"])&&Mi(n._zod.def.innerType))return this.collectMetadata(n._zod.def.innerType,w);if(gv(n,"ZodPipe")){let _=n._zod.def.in,U=n._zod.def.out;if(gv(_,"ZodTransform")&&Mi(U))return this.collectMetadata(U,w);if(Mi(_))return this.collectMetadata(_,w)}return w}static getMetadata(n){return this.collectMetadata(n)}static getOpenApiMetadata(n){let i=this.collectMetadata(n);return Ri(i!==null&&i!==void 0?i:{},["_internal"])}static getInternalMetadata(n){var i;return(i=this.collectMetadata(n))===null||i===void 0?void 0:i._internal}static getParamMetadata(n){let i=this.collectMetadata(n);return Object.assign(Object.assign({},i),{param:Object.assign(Object.assign({},(i===null||i===void 0?void 0:i.description)?{description:i.description}:{}),i===null||i===void 0?void 0:i.param)})}static buildSchemaMetadata(n){return M_(Vt(n,["param","_internal"]),z_)}static buildParameterMetadata(n){return M_(n,z_)}static applySchemaMetadata(n,i){return M_(Object.assign(Object.assign({},n),this.buildSchemaMetadata(i)),z_)}static getRefId(n){var i;return(i=this.getInternalMetadata(n))===null||i===void 0?void 0:i.refId}static unwrapChained(n){return this.unwrapUntil(n)}static getDefaultValue(n){var i;let $=(i=this.unwrapUntil(n,"ZodDefault"))!==null&&i!==void 0?i:this.unwrapUntil(n,"ZodPrefault");return $===null||$===void 0?void 0:$._zod.def.defaultValue}static unwrapUntil(n,i){if(i&&gv(n,i))return n;if(gv(n,["ZodOptional","ZodNullable","ZodDefault","ZodPrefault","ZodReadonly","ZodNonOptional"])&&Mi(n._zod.def.innerType))return this.unwrapUntil(n._zod.def.innerType,i);if(gv(n,"ZodPipe")){let $=n._zod.def.in,g=n._zod.def.out;if(gv($,"ZodTransform")&&Mi(g))return this.unwrapUntil(g,i);if(Mi($))return this.unwrapUntil($,i)}return i?void 0:n}static getMetadataFromInternalRegistry(n){return O2.get(n)}static getMetadataFromRegistry(n){let i=this.getMetadataFromInternalRegistry(n),$=n.meta();if(!i)return $;let{_internal:g}=i,v=Ri(i,["_internal"]),w=$!==null&&$!==void 0?$:{},{id:_,title:U}=w,k=Ri(w,["id","title"]);return Object.assign(Object.assign(Object.assign({_internal:Object.assign(Object.assign({},_?{refId:_}:{}),g)},v),U?{description:U}:{}),k)}static setMetadataInRegistry(n,i){O2.add(n,i)}}function $v(n,i){let $=n[i];if(typeof $!=="function")return;n[i]=function(...g){let v=$.apply(this,g),w=wv.getMetadataFromRegistry(this);if(w)wv.setMetadataInRegistry(v,w);return v}}function ft(n){if(typeof n.ZodType.prototype.openapi<"u")return;n.ZodType.prototype.openapi=function(...i){let{refId:$,metadata:g,options:v}=qt(...i),w=g!==null&&g!==void 0?g:{},{param:_}=w,U=Ri(w,["param"]),k=wv.getMetadataFromRegistry(this),l=k!==null&&k!==void 0?k:{},{_internal:J}=l,Q=Ri(l,["_internal"]),j=Object.assign(Object.assign(Object.assign({},J),v),$?{refId:$}:void 0),u=Object.assign(Object.assign(Object.assign({},Q),U),(Q===null||Q===void 0?void 0:Q.param)||_?{param:Object.assign(Object.assign({},Q===null||Q===void 0?void 0:Q.param),_)}:void 0),W=new this.constructor(this._def);function Y(O){wv.setMetadataInRegistry(O,Object.assign(Object.assign({},Object.keys(j).length>0?{_internal:j}:void 0),u))}if(Y(W),gv(W,"ZodLazy"))Y(this);if(gv(W,"ZodObject")){let O=wv.getMetadataFromRegistry(W),E=W.extend;W.extend=function(...T){let a=E.apply(W,T),s=O!==null&&O!==void 0?O:{},{_internal:r}=s,gn=Ri(s,["_internal"]);return wv.setMetadataInRegistry(a,{_internal:{extendedFrom:(r===null||r===void 0?void 0:r.refId)?{refId:r.refId,schema:W}:r===null||r===void 0?void 0:r.extendedFrom}}),a.openapi(gn)},$v(W,"catchall")}$v(W,"optional"),$v(W,"nullable"),$v(W,"default"),$v(W,"transform"),$v(W,"refine"),$v(W,"length"),$v(W,"min"),$v(W,"max");let B=W.meta;return W.meta=function(...O){let E=B.apply(this,O);if(O[0]){let T=wv.getMetadataFromInternalRegistry(this);if(T)wv.setMetadataInRegistry(E,Object.assign(Object.assign({},T),O[0]))}return E},W}}function qt(n,i,$){if(typeof n==="string")return{refId:n,metadata:i,options:$};return{refId:void 0,metadata:n,options:i}}var R_=ft;var b={};Nn(b,{z:()=>h,xor:()=>B6,xid:()=>s4,void:()=>f6,uuidv7:()=>Z4,uuidv6:()=>T4,uuidv4:()=>o4,uuid:()=>E4,util:()=>f,url:()=>r4,uppercase:()=>Lv,unknown:()=>tn,union:()=>K$,undefined:()=>H6,ulid:()=>a4,uint64:()=>j6,uint32:()=>W6,tuple:()=>pg,trim:()=>cv,treeifyError:()=>_g,transform:()=>B$,toUpperCase:()=>Sv,toLowerCase:()=>Pv,toJSONSchema:()=>i$,templateLiteral:()=>h6,symbol:()=>u6,superRefine:()=>Vw,success:()=>R6,stringbool:()=>y6,stringFormat:()=>l6,string:()=>o,strictObject:()=>K6,startsWith:()=>Ov,slugify:()=>zv,size:()=>bv,setErrorMap:()=>I0,set:()=>P6,safeParseAsync:()=>Kg,safeParse:()=>Lg,safeEncodeAsync:()=>Sg,safeEncode:()=>cg,safeDecodeAsync:()=>zg,safeDecode:()=>Pg,registry:()=>yi,regexes:()=>Yn,regex:()=>fv,refine:()=>Hw,record:()=>pn,readonly:()=>Qw,property:()=>si,promise:()=>C6,prettifyError:()=>bg,preprocess:()=>e6,prefault:()=>kw,positive:()=>di,pipe:()=>Di,partialRecord:()=>F6,parseAsync:()=>qg,parse:()=>fg,overwrite:()=>Hn,optional:()=>ki,object:()=>$n,number:()=>Tv,nullish:()=>M6,nullable:()=>li,null:()=>hg,normalize:()=>Nv,nonpositive:()=>pi,nonoptional:()=>lw,nonnegative:()=>ai,never:()=>L$,negative:()=>ei,nativeEnum:()=>S6,nanoid:()=>d4,nan:()=>A6,multipleOf:()=>yn,minSize:()=>Kn,minLength:()=>An,mime:()=>Fv,meta:()=>r6,maxSize:()=>dn,maxLength:()=>Uv,map:()=>c6,mac:()=>i6,lte:()=>Xn,lt:()=>qn,lowercase:()=>qv,looseRecord:()=>N6,looseObject:()=>O6,locales:()=>bi,literal:()=>Cn,length:()=>kv,lazy:()=>Iw,ksuid:()=>n6,keyof:()=>L6,jwt:()=>k6,json:()=>d6,iso:()=>xv,ipv6:()=>$6,ipv4:()=>v6,intersection:()=>dg,int64:()=>I6,int32:()=>Q6,int:()=>b$,instanceof:()=>m6,includes:()=>Kv,httpUrl:()=>m4,hostname:()=>D6,hex:()=>J6,hash:()=>X6,guid:()=>C4,gte:()=>Un,gt:()=>Ln,globalRegistry:()=>wn,getErrorMap:()=>j0,function:()=>E6,fromJSONSchema:()=>p6,formatError:()=>gi,float64:()=>t6,float32:()=>G6,flattenError:()=>$i,file:()=>z6,exactOptional:()=>gw,enum:()=>O$,endsWith:()=>Bv,encodeAsync:()=>Fg,encode:()=>Og,emoji:()=>y4,email:()=>h4,e164:()=>U6,discriminatedUnion:()=>Qi,describe:()=>Z6,decodeAsync:()=>Ng,decode:()=>Bg,date:()=>q6,custom:()=>T6,cuid2:()=>p4,cuid:()=>e4,core:()=>xn,config:()=>vn,coerce:()=>Ii,codec:()=>x6,clone:()=>bn,cidrv6:()=>w6,cidrv4:()=>g6,check:()=>o6,catch:()=>Xw,boolean:()=>en,bigint:()=>Y6,base64url:()=>b6,base64:()=>_6,array:()=>hn,any:()=>V6,_function:()=>E6,_default:()=>bw,_ZodString:()=>U$,ZodXor:()=>rg,ZodXID:()=>t$,ZodVoid:()=>Tg,ZodUnknown:()=>Eg,ZodUnion:()=>ti,ZodUndefined:()=>Ag,ZodUUID:()=>On,ZodURL:()=>Ji,ZodULID:()=>G$,ZodType:()=>R,ZodTuple:()=>eg,ZodTransform:()=>iw,ZodTemplateLiteral:()=>Ww,ZodSymbol:()=>Rg,ZodSuccess:()=>Dw,ZodStringFormat:()=>m,ZodString:()=>Cv,ZodSet:()=>sg,ZodRecord:()=>Wi,ZodRealError:()=>ln,ZodReadonly:()=>tw,ZodPromise:()=>jw,ZodPrefault:()=>Uw,ZodPipe:()=>c$,ZodOptional:()=>F$,ZodObject:()=>Gi,ZodNumberFormat:()=>lv,ZodNumber:()=>ov,ZodNullable:()=>ww,ZodNull:()=>xg,ZodNonOptional:()=>N$,ZodNever:()=>og,ZodNanoID:()=>D$,ZodNaN:()=>Gw,ZodMap:()=>ag,ZodMAC:()=>Mg,ZodLiteral:()=>nw,ZodLazy:()=>Yw,ZodKSUID:()=>Q$,ZodJWT:()=>f$,ZodIssueCode:()=>Dv,ZodIntersection:()=>yg,ZodISOTime:()=>w$,ZodISODuration:()=>_$,ZodISODateTime:()=>$$,ZodISODate:()=>g$,ZodIPv6:()=>Y$,ZodIPv4:()=>W$,ZodGUID:()=>Ui,ZodFunction:()=>uw,ZodFirstPartyTypeKind:()=>fw,ZodFile:()=>vw,ZodExactOptional:()=>$w,ZodError:()=>Y0,ZodEnum:()=>hv,ZodEmoji:()=>l$,ZodEmail:()=>k$,ZodE164:()=>V$,ZodDiscriminatedUnion:()=>mg,ZodDefault:()=>_w,ZodDate:()=>Xi,ZodCustomStringFormat:()=>Ev,ZodCustom:()=>Yi,ZodCodec:()=>P$,ZodCatch:()=>Jw,ZodCUID2:()=>X$,ZodCUID:()=>J$,ZodCIDRv6:()=>j$,ZodCIDRv4:()=>I$,ZodBoolean:()=>Zv,ZodBigIntFormat:()=>q$,ZodBigInt:()=>rv,ZodBase64URL:()=>H$,ZodBase64:()=>u$,ZodArray:()=>Zg,ZodAny:()=>Cg,TimePrecision:()=>Hg,NEVER:()=>a$,$output:()=>Yg,$input:()=>Ig,$brand:()=>s$});var u0={};Nn(u0,{z:()=>S$,xor:()=>B6,xid:()=>s4,void:()=>f6,uuidv7:()=>Z4,uuidv6:()=>T4,uuidv4:()=>o4,uuid:()=>E4,util:()=>f,url:()=>r4,uppercase:()=>Lv,unknown:()=>tn,union:()=>K$,undefined:()=>H6,ulid:()=>a4,uint64:()=>j6,uint32:()=>W6,tuple:()=>pg,trim:()=>cv,treeifyError:()=>_g,transform:()=>B$,toUpperCase:()=>Sv,toLowerCase:()=>Pv,toJSONSchema:()=>i$,templateLiteral:()=>h6,symbol:()=>u6,superRefine:()=>Vw,success:()=>R6,stringbool:()=>y6,stringFormat:()=>l6,string:()=>o,strictObject:()=>K6,startsWith:()=>Ov,slugify:()=>zv,size:()=>bv,setErrorMap:()=>I0,set:()=>P6,safeParseAsync:()=>Kg,safeParse:()=>Lg,safeEncodeAsync:()=>Sg,safeEncode:()=>cg,safeDecodeAsync:()=>zg,safeDecode:()=>Pg,registry:()=>yi,regexes:()=>Yn,regex:()=>fv,refine:()=>Hw,record:()=>pn,readonly:()=>Qw,property:()=>si,promise:()=>C6,prettifyError:()=>bg,preprocess:()=>e6,prefault:()=>kw,positive:()=>di,pipe:()=>Di,partialRecord:()=>F6,parseAsync:()=>qg,parse:()=>fg,overwrite:()=>Hn,optional:()=>ki,object:()=>$n,number:()=>Tv,nullish:()=>M6,nullable:()=>li,null:()=>hg,normalize:()=>Nv,nonpositive:()=>pi,nonoptional:()=>lw,nonnegative:()=>ai,never:()=>L$,negative:()=>ei,nativeEnum:()=>S6,nanoid:()=>d4,nan:()=>A6,multipleOf:()=>yn,minSize:()=>Kn,minLength:()=>An,mime:()=>Fv,meta:()=>r6,maxSize:()=>dn,maxLength:()=>Uv,map:()=>c6,mac:()=>i6,lte:()=>Xn,lt:()=>qn,lowercase:()=>qv,looseRecord:()=>N6,looseObject:()=>O6,locales:()=>bi,literal:()=>Cn,length:()=>kv,lazy:()=>Iw,ksuid:()=>n6,keyof:()=>L6,jwt:()=>k6,json:()=>d6,iso:()=>xv,ipv6:()=>$6,ipv4:()=>v6,intersection:()=>dg,int64:()=>I6,int32:()=>Q6,int:()=>b$,instanceof:()=>m6,includes:()=>Kv,httpUrl:()=>m4,hostname:()=>D6,hex:()=>J6,hash:()=>X6,guid:()=>C4,gte:()=>Un,gt:()=>Ln,globalRegistry:()=>wn,getErrorMap:()=>j0,function:()=>E6,fromJSONSchema:()=>p6,formatError:()=>gi,float64:()=>t6,float32:()=>G6,flattenError:()=>$i,file:()=>z6,exactOptional:()=>gw,enum:()=>O$,endsWith:()=>Bv,encodeAsync:()=>Fg,encode:()=>Og,emoji:()=>y4,email:()=>h4,e164:()=>U6,discriminatedUnion:()=>Qi,describe:()=>Z6,default:()=>U3,decodeAsync:()=>Ng,decode:()=>Bg,date:()=>q6,custom:()=>T6,cuid2:()=>p4,cuid:()=>e4,core:()=>xn,config:()=>vn,coerce:()=>Ii,codec:()=>x6,clone:()=>bn,cidrv6:()=>w6,cidrv4:()=>g6,check:()=>o6,catch:()=>Xw,boolean:()=>en,bigint:()=>Y6,base64url:()=>b6,base64:()=>_6,array:()=>hn,any:()=>V6,_function:()=>E6,_default:()=>bw,_ZodString:()=>U$,ZodXor:()=>rg,ZodXID:()=>t$,ZodVoid:()=>Tg,ZodUnknown:()=>Eg,ZodUnion:()=>ti,ZodUndefined:()=>Ag,ZodUUID:()=>On,ZodURL:()=>Ji,ZodULID:()=>G$,ZodType:()=>R,ZodTuple:()=>eg,ZodTransform:()=>iw,ZodTemplateLiteral:()=>Ww,ZodSymbol:()=>Rg,ZodSuccess:()=>Dw,ZodStringFormat:()=>m,ZodString:()=>Cv,ZodSet:()=>sg,ZodRecord:()=>Wi,ZodRealError:()=>ln,ZodReadonly:()=>tw,ZodPromise:()=>jw,ZodPrefault:()=>Uw,ZodPipe:()=>c$,ZodOptional:()=>F$,ZodObject:()=>Gi,ZodNumberFormat:()=>lv,ZodNumber:()=>ov,ZodNullable:()=>ww,ZodNull:()=>xg,ZodNonOptional:()=>N$,ZodNever:()=>og,ZodNanoID:()=>D$,ZodNaN:()=>Gw,ZodMap:()=>ag,ZodMAC:()=>Mg,ZodLiteral:()=>nw,ZodLazy:()=>Yw,ZodKSUID:()=>Q$,ZodJWT:()=>f$,ZodIssueCode:()=>Dv,ZodIntersection:()=>yg,ZodISOTime:()=>w$,ZodISODuration:()=>_$,ZodISODateTime:()=>$$,ZodISODate:()=>g$,ZodIPv6:()=>Y$,ZodIPv4:()=>W$,ZodGUID:()=>Ui,ZodFunction:()=>uw,ZodFirstPartyTypeKind:()=>fw,ZodFile:()=>vw,ZodExactOptional:()=>$w,ZodError:()=>Y0,ZodEnum:()=>hv,ZodEmoji:()=>l$,ZodEmail:()=>k$,ZodE164:()=>V$,ZodDiscriminatedUnion:()=>mg,ZodDefault:()=>_w,ZodDate:()=>Xi,ZodCustomStringFormat:()=>Ev,ZodCustom:()=>Yi,ZodCodec:()=>P$,ZodCatch:()=>Jw,ZodCUID2:()=>X$,ZodCUID:()=>J$,ZodCIDRv6:()=>j$,ZodCIDRv4:()=>I$,ZodBoolean:()=>Zv,ZodBigIntFormat:()=>q$,ZodBigInt:()=>rv,ZodBase64URL:()=>H$,ZodBase64:()=>u$,ZodArray:()=>Zg,ZodAny:()=>Cg,TimePrecision:()=>Hg,NEVER:()=>a$,$output:()=>Yg,$input:()=>Ig,$brand:()=>s$});var S$={};Nn(S$,{xor:()=>B6,xid:()=>s4,void:()=>f6,uuidv7:()=>Z4,uuidv6:()=>T4,uuidv4:()=>o4,uuid:()=>E4,util:()=>f,url:()=>r4,uppercase:()=>Lv,unknown:()=>tn,union:()=>K$,undefined:()=>H6,ulid:()=>a4,uint64:()=>j6,uint32:()=>W6,tuple:()=>pg,trim:()=>cv,treeifyError:()=>_g,transform:()=>B$,toUpperCase:()=>Sv,toLowerCase:()=>Pv,toJSONSchema:()=>i$,templateLiteral:()=>h6,symbol:()=>u6,superRefine:()=>Vw,success:()=>R6,stringbool:()=>y6,stringFormat:()=>l6,string:()=>o,strictObject:()=>K6,startsWith:()=>Ov,slugify:()=>zv,size:()=>bv,setErrorMap:()=>I0,set:()=>P6,safeParseAsync:()=>Kg,safeParse:()=>Lg,safeEncodeAsync:()=>Sg,safeEncode:()=>cg,safeDecodeAsync:()=>zg,safeDecode:()=>Pg,registry:()=>yi,regexes:()=>Yn,regex:()=>fv,refine:()=>Hw,record:()=>pn,readonly:()=>Qw,property:()=>si,promise:()=>C6,prettifyError:()=>bg,preprocess:()=>e6,prefault:()=>kw,positive:()=>di,pipe:()=>Di,partialRecord:()=>F6,parseAsync:()=>qg,parse:()=>fg,overwrite:()=>Hn,optional:()=>ki,object:()=>$n,number:()=>Tv,nullish:()=>M6,nullable:()=>li,null:()=>hg,normalize:()=>Nv,nonpositive:()=>pi,nonoptional:()=>lw,nonnegative:()=>ai,never:()=>L$,negative:()=>ei,nativeEnum:()=>S6,nanoid:()=>d4,nan:()=>A6,multipleOf:()=>yn,minSize:()=>Kn,minLength:()=>An,mime:()=>Fv,meta:()=>r6,maxSize:()=>dn,maxLength:()=>Uv,map:()=>c6,mac:()=>i6,lte:()=>Xn,lt:()=>qn,lowercase:()=>qv,looseRecord:()=>N6,looseObject:()=>O6,locales:()=>bi,literal:()=>Cn,length:()=>kv,lazy:()=>Iw,ksuid:()=>n6,keyof:()=>L6,jwt:()=>k6,json:()=>d6,iso:()=>xv,ipv6:()=>$6,ipv4:()=>v6,intersection:()=>dg,int64:()=>I6,int32:()=>Q6,int:()=>b$,instanceof:()=>m6,includes:()=>Kv,httpUrl:()=>m4,hostname:()=>D6,hex:()=>J6,hash:()=>X6,guid:()=>C4,gte:()=>Un,gt:()=>Ln,globalRegistry:()=>wn,getErrorMap:()=>j0,function:()=>E6,fromJSONSchema:()=>p6,formatError:()=>gi,float64:()=>t6,float32:()=>G6,flattenError:()=>$i,file:()=>z6,exactOptional:()=>gw,enum:()=>O$,endsWith:()=>Bv,encodeAsync:()=>Fg,encode:()=>Og,emoji:()=>y4,email:()=>h4,e164:()=>U6,discriminatedUnion:()=>Qi,describe:()=>Z6,decodeAsync:()=>Ng,decode:()=>Bg,date:()=>q6,custom:()=>T6,cuid2:()=>p4,cuid:()=>e4,core:()=>xn,config:()=>vn,coerce:()=>Ii,codec:()=>x6,clone:()=>bn,cidrv6:()=>w6,cidrv4:()=>g6,check:()=>o6,catch:()=>Xw,boolean:()=>en,bigint:()=>Y6,base64url:()=>b6,base64:()=>_6,array:()=>hn,any:()=>V6,_function:()=>E6,_default:()=>bw,_ZodString:()=>U$,ZodXor:()=>rg,ZodXID:()=>t$,ZodVoid:()=>Tg,ZodUnknown:()=>Eg,ZodUnion:()=>ti,ZodUndefined:()=>Ag,ZodUUID:()=>On,ZodURL:()=>Ji,ZodULID:()=>G$,ZodType:()=>R,ZodTuple:()=>eg,ZodTransform:()=>iw,ZodTemplateLiteral:()=>Ww,ZodSymbol:()=>Rg,ZodSuccess:()=>Dw,ZodStringFormat:()=>m,ZodString:()=>Cv,ZodSet:()=>sg,ZodRecord:()=>Wi,ZodRealError:()=>ln,ZodReadonly:()=>tw,ZodPromise:()=>jw,ZodPrefault:()=>Uw,ZodPipe:()=>c$,ZodOptional:()=>F$,ZodObject:()=>Gi,ZodNumberFormat:()=>lv,ZodNumber:()=>ov,ZodNullable:()=>ww,ZodNull:()=>xg,ZodNonOptional:()=>N$,ZodNever:()=>og,ZodNanoID:()=>D$,ZodNaN:()=>Gw,ZodMap:()=>ag,ZodMAC:()=>Mg,ZodLiteral:()=>nw,ZodLazy:()=>Yw,ZodKSUID:()=>Q$,ZodJWT:()=>f$,ZodIssueCode:()=>Dv,ZodIntersection:()=>yg,ZodISOTime:()=>w$,ZodISODuration:()=>_$,ZodISODateTime:()=>$$,ZodISODate:()=>g$,ZodIPv6:()=>Y$,ZodIPv4:()=>W$,ZodGUID:()=>Ui,ZodFunction:()=>uw,ZodFirstPartyTypeKind:()=>fw,ZodFile:()=>vw,ZodExactOptional:()=>$w,ZodError:()=>Y0,ZodEnum:()=>hv,ZodEmoji:()=>l$,ZodEmail:()=>k$,ZodE164:()=>V$,ZodDiscriminatedUnion:()=>mg,ZodDefault:()=>_w,ZodDate:()=>Xi,ZodCustomStringFormat:()=>Ev,ZodCustom:()=>Yi,ZodCodec:()=>P$,ZodCatch:()=>Jw,ZodCUID2:()=>X$,ZodCUID:()=>J$,ZodCIDRv6:()=>j$,ZodCIDRv4:()=>I$,ZodBoolean:()=>Zv,ZodBigIntFormat:()=>q$,ZodBigInt:()=>rv,ZodBase64URL:()=>H$,ZodBase64:()=>u$,ZodArray:()=>Zg,ZodAny:()=>Cg,TimePrecision:()=>Hg,NEVER:()=>a$,$output:()=>Yg,$input:()=>Ig,$brand:()=>s$});var xn={};Nn(xn,{version:()=>Cb,util:()=>f,treeifyError:()=>_g,toJSONSchema:()=>i$,toDotPath:()=>z2,safeParseAsync:()=>y_,safeParse:()=>m_,safeEncodeAsync:()=>gQ,safeEncode:()=>iQ,safeDecodeAsync:()=>wQ,safeDecode:()=>$Q,registry:()=>yi,regexes:()=>Yn,process:()=>y,prettifyError:()=>bg,parseAsync:()=>yw,parse:()=>mw,meta:()=>Kk,locales:()=>bi,isValidJWT:()=>nl,isValidBase64URL:()=>s2,isValidBase64:()=>kU,initializeContext:()=>Mv,globalRegistry:()=>wn,globalConfig:()=>p$,formatError:()=>gi,flattenError:()=>$i,finalize:()=>Av,extractDefs:()=>Rv,encodeAsync:()=>nQ,encode:()=>at,describe:()=>Lk,decodeAsync:()=>vQ,decode:()=>st,createToJSONSchemaMethod:()=>Bk,createStandardJSONSchemaMethod:()=>v$,config:()=>vn,clone:()=>bn,_xor:()=>B9,_xid:()=>L4,_void:()=>Wk,_uuidv7:()=>j4,_uuidv6:()=>I4,_uuidv4:()=>Y4,_uuid:()=>W4,_url:()=>ug,_uppercase:()=>Lv,_unknown:()=>tk,_union:()=>O9,_undefined:()=>Jk,_ulid:()=>q4,_uint64:()=>lk,_uint32:()=>gk,_tuple:()=>c9,_trim:()=>cv,_transform:()=>x9,_toUpperCase:()=>Sv,_toLowerCase:()=>Pv,_templateLiteral:()=>y9,_symbol:()=>Dk,_superRefine:()=>qk,_success:()=>T9,_stringbool:()=>Ok,_stringFormat:()=>n$,_string:()=>Z1,_startsWith:()=>Ov,_slugify:()=>zv,_size:()=>bv,_set:()=>z9,_safeParseAsync:()=>Zi,_safeParse:()=>Ti,_safeEncodeAsync:()=>v4,_safeEncode:()=>sw,_safeDecodeAsync:()=>i4,_safeDecode:()=>n4,_regex:()=>fv,_refine:()=>fk,_record:()=>P9,_readonly:()=>m9,_property:()=>si,_promise:()=>e9,_positive:()=>di,_pipe:()=>r9,_parseAsync:()=>oi,_parse:()=>Ei,_overwrite:()=>Hn,_optional:()=>h9,_number:()=>a1,_nullable:()=>C9,_null:()=>Xk,_normalize:()=>Nv,_nonpositive:()=>pi,_nonoptional:()=>o9,_nonnegative:()=>ai,_never:()=>Qk,_negative:()=>ei,_nativeEnum:()=>R9,_nanoid:()=>H4,_nan:()=>jk,_multipleOf:()=>yn,_minSize:()=>Kn,_minLength:()=>An,_min:()=>Un,_mime:()=>Fv,_maxSize:()=>dn,_maxLength:()=>Uv,_max:()=>Xn,_map:()=>S9,_mac:()=>m1,_lte:()=>Xn,_lt:()=>qn,_lowercase:()=>qv,_literal:()=>A9,_length:()=>kv,_lazy:()=>d9,_ksuid:()=>K4,_jwt:()=>z4,_isoTime:()=>e1,_isoDuration:()=>p1,_isoDateTime:()=>y1,_isoDate:()=>d1,_ipv6:()=>B4,_ipv4:()=>O4,_intersection:()=>N9,_int64:()=>kk,_int32:()=>$k,_int:()=>nk,_includes:()=>Kv,_guid:()=>jg,_gte:()=>Un,_gt:()=>Ln,_float64:()=>ik,_float32:()=>vk,_file:()=>Hk,_enum:()=>M9,_endsWith:()=>Bv,_encodeAsync:()=>pw,_encode:()=>dw,_emoji:()=>u4,_email:()=>Q4,_e164:()=>S4,_discriminatedUnion:()=>F9,_default:()=>E9,_decodeAsync:()=>aw,_decode:()=>ew,_date:()=>Yk,_custom:()=>Vk,_cuid2:()=>f4,_cuid:()=>V4,_coercedString:()=>r1,_coercedNumber:()=>s1,_coercedDate:()=>Ik,_coercedBoolean:()=>_k,_coercedBigint:()=>Uk,_cidrv6:()=>N4,_cidrv4:()=>F4,_check:()=>kl,_catch:()=>Z9,_boolean:()=>wk,_bigint:()=>bk,_base64url:()=>P4,_base64:()=>c4,_array:()=>uk,_any:()=>Gk,TimePrecision:()=>Hg,NEVER:()=>a$,JSONSchemaGenerator:()=>X0,JSONSchema:()=>ll,Doc:()=>_4,$output:()=>Yg,$input:()=>Ig,$constructor:()=>t,$brand:()=>s$,$ZodXor:()=>KU,$ZodXID:()=>ab,$ZodVoid:()=>VU,$ZodUnknown:()=>uU,$ZodUnion:()=>Jg,$ZodUndefined:()=>YU,$ZodUUID:()=>Tb,$ZodURL:()=>rb,$ZodULID:()=>pb,$ZodType:()=>M,$ZodTuple:()=>G4,$ZodTransform:()=>MU,$ZodTemplateLiteral:()=>mU,$ZodSymbol:()=>WU,$ZodSuccess:()=>EU,$ZodStringFormat:()=>e,$ZodString:()=>_i,$ZodSet:()=>cU,$ZodRegistry:()=>T1,$ZodRecord:()=>FU,$ZodRealError:()=>Wn,$ZodReadonly:()=>rU,$ZodPromise:()=>dU,$ZodPrefault:()=>hU,$ZodPipe:()=>ZU,$ZodOptional:()=>t4,$ZodObjectJIT:()=>LU,$ZodObject:()=>$l,$ZodNumberFormat:()=>tU,$ZodNumber:()=>J4,$ZodNullable:()=>AU,$ZodNull:()=>IU,$ZodNonOptional:()=>CU,$ZodNever:()=>HU,$ZodNanoID:()=>yb,$ZodNaN:()=>TU,$ZodMap:()=>NU,$ZodMAC:()=>_U,$ZodLiteral:()=>SU,$ZodLazy:()=>eU,$ZodKSUID:()=>sb,$ZodJWT:()=>XU,$ZodIntersection:()=>BU,$ZodISOTime:()=>iU,$ZodISODuration:()=>$U,$ZodISODateTime:()=>nU,$ZodISODate:()=>vU,$ZodIPv6:()=>wU,$ZodIPv4:()=>gU,$ZodGUID:()=>ob,$ZodFunction:()=>yU,$ZodFile:()=>zU,$ZodExactOptional:()=>RU,$ZodError:()=>wg,$ZodEnum:()=>PU,$ZodEncodeError:()=>vi,$ZodEmoji:()=>mb,$ZodEmail:()=>Zb,$ZodE164:()=>JU,$ZodDiscriminatedUnion:()=>OU,$ZodDefault:()=>xU,$ZodDate:()=>fU,$ZodCustomStringFormat:()=>GU,$ZodCustom:()=>pU,$ZodCodec:()=>Xg,$ZodCheckUpperCase:()=>Sb,$ZodCheckStringFormat:()=>ri,$ZodCheckStartsWith:()=>Mb,$ZodCheckSizeEquals:()=>Ob,$ZodCheckRegex:()=>cb,$ZodCheckProperty:()=>Ab,$ZodCheckOverwrite:()=>hb,$ZodCheckNumberFormat:()=>fb,$ZodCheckMultipleOf:()=>Vb,$ZodCheckMinSize:()=>Kb,$ZodCheckMinLength:()=>Fb,$ZodCheckMimeType:()=>xb,$ZodCheckMaxSize:()=>Lb,$ZodCheckMaxLength:()=>Bb,$ZodCheckLowerCase:()=>Pb,$ZodCheckLessThan:()=>g4,$ZodCheckLengthEquals:()=>Nb,$ZodCheckIncludes:()=>zb,$ZodCheckGreaterThan:()=>w4,$ZodCheckEndsWith:()=>Rb,$ZodCheckBigIntFormat:()=>qb,$ZodCheck:()=>p,$ZodCatch:()=>oU,$ZodCUID2:()=>eb,$ZodCUID:()=>db,$ZodCIDRv6:()=>UU,$ZodCIDRv4:()=>bU,$ZodBoolean:()=>Dg,$ZodBigIntFormat:()=>QU,$ZodBigInt:()=>X4,$ZodBase64URL:()=>DU,$ZodBase64:()=>lU,$ZodAsyncError:()=>mn,$ZodArray:()=>qU,$ZodAny:()=>jU});var a$=Object.freeze({status:"aborted"});function t(n,i,$){function g(U,k){if(!U._zod)Object.defineProperty(U,"_zod",{value:{def:k,constr:_,traits:new Set},enumerable:!1});if(U._zod.traits.has(n))return;U._zod.traits.add(n),i(U,k);let l=_.prototype,J=Object.keys(l);for(let Q=0;Q<J.length;Q++){let j=J[Q];if(!(j in U))U[j]=l[j].bind(U)}}let v=$?.Parent??Object;class w extends v{}Object.defineProperty(w,"name",{value:n});function _(U){var k;let l=$?.Parent?new w:this;g(l,U),(k=l._zod).deferred??(k.deferred=[]);for(let J of l._zod.deferred)J();return l}return Object.defineProperty(_,"init",{value:g}),Object.defineProperty(_,Symbol.hasInstance,{value:(U)=>{if($?.Parent&&U instanceof $.Parent)return!0;return U?._zod?.traits?.has(n)}}),Object.defineProperty(_,"name",{value:n}),_}var s$=Symbol("zod_brand");class mn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class vi extends Error{constructor(n){super(`Encountered unidirectional transform during encode: ${n}`);this.name="ZodEncodeError"}}var p$={};function vn(n){if(n)Object.assign(p$,n);return p$}var f={};Nn(f,{unwrapMessage:()=>ng,uint8ArrayToHex:()=>et,uint8ArrayToBase64url:()=>yt,uint8ArrayToBase64:()=>c2,stringifyPrimitive:()=>V,slugify:()=>h_,shallowClone:()=>E_,safeExtend:()=>Et,required:()=>Zt,randomString:()=>zt,propertyKeyTypes:()=>ig,promiseAllObject:()=>St,primitiveTypes:()=>o_,prefixIssues:()=>un,pick:()=>xt,partial:()=>Tt,parsedType:()=>L,optionalKeys:()=>T_,omit:()=>ht,objectClone:()=>Nt,numKeys:()=>Mt,nullish:()=>jv,normalizeParams:()=>K,mergeDefs:()=>_v,merge:()=>ot,jsonStringifyReplacer:()=>xi,joinValues:()=>I,issue:()=>Ci,isPlainObject:()=>Hv,isObject:()=>ii,hexToUint8Array:()=>dt,getSizableOrigin:()=>$g,getParsedType:()=>Rt,getLengthableOrigin:()=>gg,getEnumValues:()=>Ai,getElementAtPath:()=>Pt,floatSafeRemainder:()=>x_,finalizeIssue:()=>Qn,extend:()=>Ct,escapeRegex:()=>fn,esc:()=>Zw,defineLazy:()=>C,createTransparentProxy:()=>At,cloneDef:()=>ct,clone:()=>bn,cleanRegex:()=>vg,cleanEnum:()=>rt,captureStackTrace:()=>rw,cached:()=>hi,base64urlToUint8Array:()=>mt,base64ToUint8Array:()=>N2,assignProp:()=>uv,assertNotEqual:()=>Kt,assertNever:()=>Bt,assertIs:()=>Ot,assertEqual:()=>Lt,assert:()=>Ft,allowsEval:()=>C_,aborted:()=>Vv,NUMBER_FORMAT_RANGES:()=>Z_,Class:()=>P2,BIGINT_FORMAT_RANGES:()=>r_});function Lt(n){return n}function Kt(n){return n}function Ot(n){}function Bt(n){throw Error("Unexpected value in exhaustive check")}function Ft(n){}function Ai(n){let i=Object.values(n).filter((g)=>typeof g==="number");return Object.entries(n).filter(([g,v])=>i.indexOf(+g)===-1).map(([g,v])=>v)}function I(n,i="|"){return n.map(($)=>V($)).join(i)}function xi(n,i){if(typeof i==="bigint")return i.toString();return i}function hi(n){return{get value(){{let $=n();return Object.defineProperty(this,"value",{value:$}),$}throw Error("cached value already set")}}}function jv(n){return n===null||n===void 0}function vg(n){let i=n.startsWith("^")?1:0,$=n.endsWith("$")?n.length-1:n.length;return n.slice(i,$)}function x_(n,i){let $=(n.toString().split(".")[1]||"").length,g=i.toString(),v=(g.split(".")[1]||"").length;if(v===0&&/\d?e-\d?/.test(g)){let k=g.match(/\d?e-(\d?)/);if(k?.[1])v=Number.parseInt(k[1])}let w=$>v?$:v,_=Number.parseInt(n.toFixed(w).replace(".","")),U=Number.parseInt(i.toFixed(w).replace(".",""));return _%U/10**w}var F2=Symbol("evaluating");function C(n,i,$){let g=void 0;Object.defineProperty(n,i,{get(){if(g===F2)return;if(g===void 0)g=F2,g=$();return g},set(v){Object.defineProperty(n,i,{value:v})},configurable:!0})}function Nt(n){return Object.create(Object.getPrototypeOf(n),Object.getOwnPropertyDescriptors(n))}function uv(n,i,$){Object.defineProperty(n,i,{value:$,writable:!0,enumerable:!0,configurable:!0})}function _v(...n){let i={};for(let $ of n){let g=Object.getOwnPropertyDescriptors($);Object.assign(i,g)}return Object.defineProperties({},i)}function ct(n){return _v(n._zod.def)}function Pt(n,i){if(!i)return n;return i.reduce(($,g)=>$?.[g],n)}function St(n){let i=Object.keys(n),$=i.map((g)=>n[g]);return Promise.all($).then((g)=>{let v={};for(let w=0;w<i.length;w++)v[i[w]]=g[w];return v})}function zt(n=10){let $="";for(let g=0;g<n;g++)$+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return $}function Zw(n){return JSON.stringify(n)}function h_(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var rw="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function ii(n){return typeof n==="object"&&n!==null&&!Array.isArray(n)}var C_=hi(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(n){return!1}});function Hv(n){if(ii(n)===!1)return!1;let i=n.constructor;if(i===void 0)return!0;if(typeof i!=="function")return!0;let $=i.prototype;if(ii($)===!1)return!1;if(Object.prototype.hasOwnProperty.call($,"isPrototypeOf")===!1)return!1;return!0}function E_(n){if(Hv(n))return{...n};if(Array.isArray(n))return[...n];return n}function Mt(n){let i=0;for(let $ in n)if(Object.prototype.hasOwnProperty.call(n,$))i++;return i}var Rt=(n)=>{let i=typeof n;switch(i){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(n)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(n))return"array";if(n===null)return"null";if(n.then&&typeof n.then==="function"&&n.catch&&typeof n.catch==="function")return"promise";if(typeof Map<"u"&&n instanceof Map)return"map";if(typeof Set<"u"&&n instanceof Set)return"set";if(typeof Date<"u"&&n instanceof Date)return"date";if(typeof File<"u"&&n instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${i}`)}},ig=new Set(["string","number","symbol"]),o_=new Set(["string","number","bigint","boolean","symbol","undefined"]);function fn(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function bn(n,i,$){let g=new n._zod.constr(i??n._zod.def);if(!i||$?.parent)g._zod.parent=n;return g}function K(n){let i=n;if(!i)return{};if(typeof i==="string")return{error:()=>i};if(i?.message!==void 0){if(i?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");i.error=i.message}if(delete i.message,typeof i.error==="string")return{...i,error:()=>i.error};return i}function At(n){let i;return new Proxy({},{get($,g,v){return i??(i=n()),Reflect.get(i,g,v)},set($,g,v,w){return i??(i=n()),Reflect.set(i,g,v,w)},has($,g){return i??(i=n()),Reflect.has(i,g)},deleteProperty($,g){return i??(i=n()),Reflect.deleteProperty(i,g)},ownKeys($){return i??(i=n()),Reflect.ownKeys(i)},getOwnPropertyDescriptor($,g){return i??(i=n()),Reflect.getOwnPropertyDescriptor(i,g)},defineProperty($,g,v){return i??(i=n()),Reflect.defineProperty(i,g,v)}})}function V(n){if(typeof n==="bigint")return n.toString()+"n";if(typeof n==="string")return`"${n}"`;return`${n}`}function T_(n){return Object.keys(n).filter((i)=>{return n[i]._zod.optin==="optional"&&n[i]._zod.optout==="optional"})}var Z_={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},r_={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function xt(n,i){let $=n._zod.def,g=$.checks;if(g&&g.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let w=_v(n._zod.def,{get shape(){let _={};for(let U in i){if(!(U in $.shape))throw Error(`Unrecognized key: "${U}"`);if(!i[U])continue;_[U]=$.shape[U]}return uv(this,"shape",_),_},checks:[]});return bn(n,w)}function ht(n,i){let $=n._zod.def,g=$.checks;if(g&&g.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let w=_v(n._zod.def,{get shape(){let _={...n._zod.def.shape};for(let U in i){if(!(U in $.shape))throw Error(`Unrecognized key: "${U}"`);if(!i[U])continue;delete _[U]}return uv(this,"shape",_),_},checks:[]});return bn(n,w)}function Ct(n,i){if(!Hv(i))throw Error("Invalid input to extend: expected a plain object");let $=n._zod.def.checks;if($&&$.length>0)throw Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let v=_v(n._zod.def,{get shape(){let w={...n._zod.def.shape,...i};return uv(this,"shape",w),w},checks:[]});return bn(n,v)}function Et(n,i){if(!Hv(i))throw Error("Invalid input to safeExtend: expected a plain object");let $=_v(n._zod.def,{get shape(){let g={...n._zod.def.shape,...i};return uv(this,"shape",g),g}});return bn(n,$)}function ot(n,i){let $=_v(n._zod.def,{get shape(){let g={...n._zod.def.shape,...i._zod.def.shape};return uv(this,"shape",g),g},get catchall(){return i._zod.def.catchall},checks:[]});return bn(n,$)}function Tt(n,i,$){let v=i._zod.def.checks;if(v&&v.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let _=_v(i._zod.def,{get shape(){let U=i._zod.def.shape,k={...U};if($)for(let l in $){if(!(l in U))throw Error(`Unrecognized key: "${l}"`);if(!$[l])continue;k[l]=n?new n({type:"optional",innerType:U[l]}):U[l]}else for(let l in U)k[l]=n?new n({type:"optional",innerType:U[l]}):U[l];return uv(this,"shape",k),k},checks:[]});return bn(i,_)}function Zt(n,i,$){let g=_v(i._zod.def,{get shape(){let v=i._zod.def.shape,w={...v};if($)for(let _ in $){if(!(_ in w))throw Error(`Unrecognized key: "${_}"`);if(!$[_])continue;w[_]=new n({type:"nonoptional",innerType:v[_]})}else for(let _ in v)w[_]=new n({type:"nonoptional",innerType:v[_]});return uv(this,"shape",w),w}});return bn(i,g)}function Vv(n,i=0){if(n.aborted===!0)return!0;for(let $=i;$<n.issues.length;$++)if(n.issues[$]?.continue!==!0)return!0;return!1}function un(n,i){return i.map(($)=>{var g;return(g=$).path??(g.path=[]),$.path.unshift(n),$})}function ng(n){return typeof n==="string"?n:n?.message}function Qn(n,i,$){let g={...n,path:n.path??[]};if(!n.message){let v=ng(n.inst?._zod.def?.error?.(n))??ng(i?.error?.(n))??ng($.customError?.(n))??ng($.localeError?.(n))??"Invalid input";g.message=v}if(delete g.inst,delete g.continue,!i?.reportInput)delete g.input;return g}function $g(n){if(n instanceof Set)return"set";if(n instanceof Map)return"map";if(n instanceof File)return"file";return"unknown"}function gg(n){if(Array.isArray(n))return"array";if(typeof n==="string")return"string";return"unknown"}function L(n){let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"nan":"number";case"object":{if(n===null)return"null";if(Array.isArray(n))return"array";let $=n;if($&&Object.getPrototypeOf($)!==Object.prototype&&"constructor"in $&&$.constructor)return $.constructor.name}}return i}function Ci(...n){let[i,$,g]=n;if(typeof i==="string")return{message:i,code:"custom",input:$,inst:g};return{...i}}function rt(n){return Object.entries(n).filter(([i,$])=>{return Number.isNaN(Number.parseInt(i,10))}).map((i)=>i[1])}function N2(n){let i=atob(n),$=new Uint8Array(i.length);for(let g=0;g<i.length;g++)$[g]=i.charCodeAt(g);return $}function c2(n){let i="";for(let $=0;$<n.length;$++)i+=String.fromCharCode(n[$]);return btoa(i)}function mt(n){let i=n.replace(/-/g,"+").replace(/_/g,"/"),$="=".repeat((4-i.length%4)%4);return N2(i+$)}function yt(n){return c2(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function dt(n){let i=n.replace(/^0x/,"");if(i.length%2!==0)throw Error("Invalid hex string length");let $=new Uint8Array(i.length/2);for(let g=0;g<i.length;g+=2)$[g/2]=Number.parseInt(i.slice(g,g+2),16);return $}function et(n){return Array.from(n).map((i)=>i.toString(16).padStart(2,"0")).join("")}class P2{constructor(...n){}}var S2=(n,i)=>{n.name="$ZodError",Object.defineProperty(n,"_zod",{value:n._zod,enumerable:!1}),Object.defineProperty(n,"issues",{value:i,enumerable:!1}),n.message=JSON.stringify(i,xi,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},wg=t("$ZodError",S2),Wn=t("$ZodError",S2,{Parent:Error});function $i(n,i=($)=>$.message){let $={},g=[];for(let v of n.issues)if(v.path.length>0)$[v.path[0]]=$[v.path[0]]||[],$[v.path[0]].push(i(v));else g.push(i(v));return{formErrors:g,fieldErrors:$}}function gi(n,i=($)=>$.message){let $={_errors:[]},g=(v)=>{for(let w of v.issues)if(w.code==="invalid_union"&&w.errors.length)w.errors.map((_)=>g({issues:_}));else if(w.code==="invalid_key")g({issues:w.issues});else if(w.code==="invalid_element")g({issues:w.issues});else if(w.path.length===0)$._errors.push(i(w));else{let _=$,U=0;while(U<w.path.length){let k=w.path[U];if(U!==w.path.length-1)_[k]=_[k]||{_errors:[]};else _[k]=_[k]||{_errors:[]},_[k]._errors.push(i(w));_=_[k],U++}}};return g(n),$}function _g(n,i=($)=>$.message){let $={errors:[]},g=(v,w=[])=>{var _,U;for(let k of v.issues)if(k.code==="invalid_union"&&k.errors.length)k.errors.map((l)=>g({issues:l},k.path));else if(k.code==="invalid_key")g({issues:k.issues},k.path);else if(k.code==="invalid_element")g({issues:k.issues},k.path);else{let l=[...w,...k.path];if(l.length===0){$.errors.push(i(k));continue}let J=$,Q=0;while(Q<l.length){let j=l[Q],u=Q===l.length-1;if(typeof j==="string")J.properties??(J.properties={}),(_=J.properties)[j]??(_[j]={errors:[]}),J=J.properties[j];else J.items??(J.items=[]),(U=J.items)[j]??(U[j]={errors:[]}),J=J.items[j];if(u)J.errors.push(i(k));Q++}}};return g(n),$}function z2(n){let i=[],$=n.map((g)=>typeof g==="object"?g.key:g);for(let g of $)if(typeof g==="number")i.push(`[${g}]`);else if(typeof g==="symbol")i.push(`[${JSON.stringify(String(g))}]`);else if(/[^\w$]/.test(g))i.push(`[${JSON.stringify(g)}]`);else{if(i.length)i.push(".");i.push(g)}return i.join("")}function bg(n){let i=[],$=[...n.issues].sort((g,v)=>(g.path??[]).length-(v.path??[]).length);for(let g of $)if(i.push(`✖ ${g.message}`),g.path?.length)i.push(` → at ${z2(g.path)}`);return i.join(`
4
4
  `)}var Ei=(n)=>(i,$,g,v)=>{let w=g?Object.assign(g,{async:!1}):{async:!1},_=i._zod.run({value:$,issues:[]},w);if(_ instanceof Promise)throw new mn;if(_.issues.length){let U=new(v?.Err??n)(_.issues.map((k)=>Qn(k,w,vn())));throw rw(U,v?.callee),U}return _.value},mw=Ei(Wn),oi=(n)=>async(i,$,g,v)=>{let w=g?Object.assign(g,{async:!0}):{async:!0},_=i._zod.run({value:$,issues:[]},w);if(_ instanceof Promise)_=await _;if(_.issues.length){let U=new(v?.Err??n)(_.issues.map((k)=>Qn(k,w,vn())));throw rw(U,v?.callee),U}return _.value},yw=oi(Wn),Ti=(n)=>(i,$,g)=>{let v=g?{...g,async:!1}:{async:!1},w=i._zod.run({value:$,issues:[]},v);if(w instanceof Promise)throw new mn;return w.issues.length?{success:!1,error:new(n??wg)(w.issues.map((_)=>Qn(_,v,vn())))}:{success:!0,data:w.value}},m_=Ti(Wn),Zi=(n)=>async(i,$,g)=>{let v=g?Object.assign(g,{async:!0}):{async:!0},w=i._zod.run({value:$,issues:[]},v);if(w instanceof Promise)w=await w;return w.issues.length?{success:!1,error:new n(w.issues.map((_)=>Qn(_,v,vn())))}:{success:!0,data:w.value}},y_=Zi(Wn),dw=(n)=>(i,$,g)=>{let v=g?Object.assign(g,{direction:"backward"}):{direction:"backward"};return Ei(n)(i,$,v)},at=dw(Wn),ew=(n)=>(i,$,g)=>{return Ei(n)(i,$,g)},st=ew(Wn),pw=(n)=>async(i,$,g)=>{let v=g?Object.assign(g,{direction:"backward"}):{direction:"backward"};return oi(n)(i,$,v)},nQ=pw(Wn),aw=(n)=>async(i,$,g)=>{return oi(n)(i,$,g)},vQ=aw(Wn),sw=(n)=>(i,$,g)=>{let v=g?Object.assign(g,{direction:"backward"}):{direction:"backward"};return Ti(n)(i,$,v)},iQ=sw(Wn),n4=(n)=>(i,$,g)=>{return Ti(n)(i,$,g)},$Q=n4(Wn),v4=(n)=>async(i,$,g)=>{let v=g?Object.assign(g,{direction:"backward"}):{direction:"backward"};return Zi(n)(i,$,v)},gQ=v4(Wn),i4=(n)=>async(i,$,g)=>{return Zi(n)(i,$,g)},wQ=i4(Wn);var Yn={};Nn(Yn,{xid:()=>a_,uuid7:()=>kQ,uuid6:()=>UQ,uuid4:()=>bQ,uuid:()=>wi,uppercase:()=>Hb,unicodeEmail:()=>M2,undefined:()=>jb,ulid:()=>p_,time:()=>Xb,string:()=>tb,sha512_hex:()=>FQ,sha512_base64url:()=>cQ,sha512_base64:()=>NQ,sha384_hex:()=>KQ,sha384_base64url:()=>BQ,sha384_base64:()=>OQ,sha256_hex:()=>fQ,sha256_base64url:()=>LQ,sha256_base64:()=>qQ,sha1_hex:()=>uQ,sha1_base64url:()=>VQ,sha1_base64:()=>HQ,rfc5322Email:()=>DQ,number:()=>Ug,null:()=>Ib,nanoid:()=>nb,md5_hex:()=>YQ,md5_base64url:()=>jQ,md5_base64:()=>IQ,mac:()=>bb,lowercase:()=>ub,ksuid:()=>s_,ipv6:()=>_b,ipv4:()=>wb,integer:()=>Wb,idnEmail:()=>JQ,html5Email:()=>lQ,hostname:()=>tQ,hex:()=>WQ,guid:()=>ib,extendedDuration:()=>_Q,emoji:()=>gb,email:()=>$b,e164:()=>Db,duration:()=>vb,domain:()=>QQ,datetime:()=>Gb,date:()=>Jb,cuid2:()=>e_,cuid:()=>d_,cidrv6:()=>kb,cidrv4:()=>Ub,browserEmail:()=>XQ,boolean:()=>Yb,bigint:()=>Qb,base64url:()=>$4,base64:()=>lb});var d_=/^[cC][^\s-]{8,}$/,e_=/^[0-9a-z]+$/,p_=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,a_=/^[0-9a-vA-V]{20}$/,s_=/^[A-Za-z0-9]{27}$/,nb=/^[a-zA-Z0-9_-]{21}$/,vb=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,_Q=/^[-+]?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)?)??$/,ib=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,wi=(n)=>{if(!n)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${n}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},bQ=wi(4),UQ=wi(6),kQ=wi(7),$b=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,lQ=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,DQ=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,M2=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,JQ=M2,XQ=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,GQ="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function gb(){return new RegExp(GQ,"u")}var wb=/^(?:(?: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])$/,_b=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,bb=(n)=>{let i=fn(n??":");return new RegExp(`^(?:[0-9A-F]{2}${i}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${i}){5}[0-9a-f]{2}$`)},Ub=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,kb=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,lb=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$4=/^[A-Za-z0-9_-]*$/,tQ=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,QQ=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Db=/^\+[1-9]\d{6,14}$/,R2="(?:(?:\\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])))",Jb=new RegExp(`^${R2}$`);function A2(n){return typeof n.precision==="number"?n.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":n.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${n.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Xb(n){return new RegExp(`^${A2(n)}$`)}function Gb(n){let i=A2({precision:n.precision}),$=["Z"];if(n.local)$.push("");if(n.offset)$.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let g=`${i}(?:${$.join("|")})`;return new RegExp(`^${R2}T(?:${g})$`)}var tb=(n)=>{let i=n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${i}$`)},Qb=/^-?\d+n?$/,Wb=/^-?\d+$/,Ug=/^-?\d+(?:\.\d+)?$/,Yb=/^(?:true|false)$/i,Ib=/^null$/i;var jb=/^undefined$/i;var ub=/^[^A-Z]*$/,Hb=/^[^a-z]*$/,WQ=/^[0-9a-fA-F]*$/;function kg(n,i){return new RegExp(`^[A-Za-z0-9+/]{${n}}${i}$`)}function lg(n){return new RegExp(`^[A-Za-z0-9_-]{${n}}$`)}var YQ=/^[0-9a-fA-F]{32}$/,IQ=kg(22,"=="),jQ=lg(22),uQ=/^[0-9a-fA-F]{40}$/,HQ=kg(27,"="),VQ=lg(27),fQ=/^[0-9a-fA-F]{64}$/,qQ=kg(43,"="),LQ=lg(43),KQ=/^[0-9a-fA-F]{96}$/,OQ=kg(64,""),BQ=lg(64),FQ=/^[0-9a-fA-F]{128}$/,NQ=kg(86,"=="),cQ=lg(86);var p=t("$ZodCheck",(n,i)=>{var $;n._zod??(n._zod={}),n._zod.def=i,($=n._zod).onattach??($.onattach=[])}),h2={number:"number",bigint:"bigint",object:"date"},g4=t("$ZodCheckLessThan",(n,i)=>{p.init(n,i);let $=h2[typeof i.value];n._zod.onattach.push((g)=>{let v=g._zod.bag,w=(i.inclusive?v.maximum:v.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(i.value<w)if(i.inclusive)v.maximum=i.value;else v.exclusiveMaximum=i.value}),n._zod.check=(g)=>{if(i.inclusive?g.value<=i.value:g.value<i.value)return;g.issues.push({origin:$,code:"too_big",maximum:typeof i.value==="object"?i.value.getTime():i.value,input:g.value,inclusive:i.inclusive,inst:n,continue:!i.abort})}}),w4=t("$ZodCheckGreaterThan",(n,i)=>{p.init(n,i);let $=h2[typeof i.value];n._zod.onattach.push((g)=>{let v=g._zod.bag,w=(i.inclusive?v.minimum:v.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(i.value>w)if(i.inclusive)v.minimum=i.value;else v.exclusiveMinimum=i.value}),n._zod.check=(g)=>{if(i.inclusive?g.value>=i.value:g.value>i.value)return;g.issues.push({origin:$,code:"too_small",minimum:typeof i.value==="object"?i.value.getTime():i.value,input:g.value,inclusive:i.inclusive,inst:n,continue:!i.abort})}}),Vb=t("$ZodCheckMultipleOf",(n,i)=>{p.init(n,i),n._zod.onattach.push(($)=>{var g;(g=$._zod.bag).multipleOf??(g.multipleOf=i.value)}),n._zod.check=($)=>{if(typeof $.value!==typeof i.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof $.value==="bigint"?$.value%i.value===BigInt(0):x_($.value,i.value)===0)return;$.issues.push({origin:typeof $.value,code:"not_multiple_of",divisor:i.value,input:$.value,inst:n,continue:!i.abort})}}),fb=t("$ZodCheckNumberFormat",(n,i)=>{p.init(n,i),i.format=i.format||"float64";let $=i.format?.includes("int"),g=$?"int":"number",[v,w]=Z_[i.format];n._zod.onattach.push((_)=>{let U=_._zod.bag;if(U.format=i.format,U.minimum=v,U.maximum=w,$)U.pattern=Wb}),n._zod.check=(_)=>{let U=_.value;if($){if(!Number.isInteger(U)){_.issues.push({expected:g,format:i.format,code:"invalid_type",continue:!1,input:U,inst:n});return}if(!Number.isSafeInteger(U)){if(U>0)_.issues.push({input:U,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:g,inclusive:!0,continue:!i.abort});else _.issues.push({input:U,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:g,inclusive:!0,continue:!i.abort});return}}if(U<v)_.issues.push({origin:"number",input:U,code:"too_small",minimum:v,inclusive:!0,inst:n,continue:!i.abort});if(U>w)_.issues.push({origin:"number",input:U,code:"too_big",maximum:w,inclusive:!0,inst:n,continue:!i.abort})}}),qb=t("$ZodCheckBigIntFormat",(n,i)=>{p.init(n,i);let[$,g]=r_[i.format];n._zod.onattach.push((v)=>{let w=v._zod.bag;w.format=i.format,w.minimum=$,w.maximum=g}),n._zod.check=(v)=>{let w=v.value;if(w<$)v.issues.push({origin:"bigint",input:w,code:"too_small",minimum:$,inclusive:!0,inst:n,continue:!i.abort});if(w>g)v.issues.push({origin:"bigint",input:w,code:"too_big",maximum:g,inclusive:!0,inst:n,continue:!i.abort})}}),Lb=t("$ZodCheckMaxSize",(n,i)=>{var $;p.init(n,i),($=n._zod.def).when??($.when=(g)=>{let v=g.value;return!jv(v)&&v.size!==void 0}),n._zod.onattach.push((g)=>{let v=g._zod.bag.maximum??Number.POSITIVE_INFINITY;if(i.maximum<v)g._zod.bag.maximum=i.maximum}),n._zod.check=(g)=>{let v=g.value;if(v.size<=i.maximum)return;g.issues.push({origin:$g(v),code:"too_big",maximum:i.maximum,inclusive:!0,input:v,inst:n,continue:!i.abort})}}),Kb=t("$ZodCheckMinSize",(n,i)=>{var $;p.init(n,i),($=n._zod.def).when??($.when=(g)=>{let v=g.value;return!jv(v)&&v.size!==void 0}),n._zod.onattach.push((g)=>{let v=g._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(i.minimum>v)g._zod.bag.minimum=i.minimum}),n._zod.check=(g)=>{let v=g.value;if(v.size>=i.minimum)return;g.issues.push({origin:$g(v),code:"too_small",minimum:i.minimum,inclusive:!0,input:v,inst:n,continue:!i.abort})}}),Ob=t("$ZodCheckSizeEquals",(n,i)=>{var $;p.init(n,i),($=n._zod.def).when??($.when=(g)=>{let v=g.value;return!jv(v)&&v.size!==void 0}),n._zod.onattach.push((g)=>{let v=g._zod.bag;v.minimum=i.size,v.maximum=i.size,v.size=i.size}),n._zod.check=(g)=>{let v=g.value,w=v.size;if(w===i.size)return;let _=w>i.size;g.issues.push({origin:$g(v),..._?{code:"too_big",maximum:i.size}:{code:"too_small",minimum:i.size},inclusive:!0,exact:!0,input:g.value,inst:n,continue:!i.abort})}}),Bb=t("$ZodCheckMaxLength",(n,i)=>{var $;p.init(n,i),($=n._zod.def).when??($.when=(g)=>{let v=g.value;return!jv(v)&&v.length!==void 0}),n._zod.onattach.push((g)=>{let v=g._zod.bag.maximum??Number.POSITIVE_INFINITY;if(i.maximum<v)g._zod.bag.maximum=i.maximum}),n._zod.check=(g)=>{let v=g.value;if(v.length<=i.maximum)return;let _=gg(v);g.issues.push({origin:_,code:"too_big",maximum:i.maximum,inclusive:!0,input:v,inst:n,continue:!i.abort})}}),Fb=t("$ZodCheckMinLength",(n,i)=>{var $;p.init(n,i),($=n._zod.def).when??($.when=(g)=>{let v=g.value;return!jv(v)&&v.length!==void 0}),n._zod.onattach.push((g)=>{let v=g._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(i.minimum>v)g._zod.bag.minimum=i.minimum}),n._zod.check=(g)=>{let v=g.value;if(v.length>=i.minimum)return;let _=gg(v);g.issues.push({origin:_,code:"too_small",minimum:i.minimum,inclusive:!0,input:v,inst:n,continue:!i.abort})}}),Nb=t("$ZodCheckLengthEquals",(n,i)=>{var $;p.init(n,i),($=n._zod.def).when??($.when=(g)=>{let v=g.value;return!jv(v)&&v.length!==void 0}),n._zod.onattach.push((g)=>{let v=g._zod.bag;v.minimum=i.length,v.maximum=i.length,v.length=i.length}),n._zod.check=(g)=>{let v=g.value,w=v.length;if(w===i.length)return;let _=gg(v),U=w>i.length;g.issues.push({origin:_,...U?{code:"too_big",maximum:i.length}:{code:"too_small",minimum:i.length},inclusive:!0,exact:!0,input:g.value,inst:n,continue:!i.abort})}}),ri=t("$ZodCheckStringFormat",(n,i)=>{var $,g;if(p.init(n,i),n._zod.onattach.push((v)=>{let w=v._zod.bag;if(w.format=i.format,i.pattern)w.patterns??(w.patterns=new Set),w.patterns.add(i.pattern)}),i.pattern)($=n._zod).check??($.check=(v)=>{if(i.pattern.lastIndex=0,i.pattern.test(v.value))return;v.issues.push({origin:"string",code:"invalid_format",format:i.format,input:v.value,...i.pattern?{pattern:i.pattern.toString()}:{},inst:n,continue:!i.abort})});else(g=n._zod).check??(g.check=()=>{})}),cb=t("$ZodCheckRegex",(n,i)=>{ri.init(n,i),n._zod.check=($)=>{if(i.pattern.lastIndex=0,i.pattern.test($.value))return;$.issues.push({origin:"string",code:"invalid_format",format:"regex",input:$.value,pattern:i.pattern.toString(),inst:n,continue:!i.abort})}}),Pb=t("$ZodCheckLowerCase",(n,i)=>{i.pattern??(i.pattern=ub),ri.init(n,i)}),Sb=t("$ZodCheckUpperCase",(n,i)=>{i.pattern??(i.pattern=Hb),ri.init(n,i)}),zb=t("$ZodCheckIncludes",(n,i)=>{p.init(n,i);let $=fn(i.includes),g=new RegExp(typeof i.position==="number"?`^.{${i.position}}${$}`:$);i.pattern=g,n._zod.onattach.push((v)=>{let w=v._zod.bag;w.patterns??(w.patterns=new Set),w.patterns.add(g)}),n._zod.check=(v)=>{if(v.value.includes(i.includes,i.position))return;v.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:i.includes,input:v.value,inst:n,continue:!i.abort})}}),Mb=t("$ZodCheckStartsWith",(n,i)=>{p.init(n,i);let $=new RegExp(`^${fn(i.prefix)}.*`);i.pattern??(i.pattern=$),n._zod.onattach.push((g)=>{let v=g._zod.bag;v.patterns??(v.patterns=new Set),v.patterns.add($)}),n._zod.check=(g)=>{if(g.value.startsWith(i.prefix))return;g.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:i.prefix,input:g.value,inst:n,continue:!i.abort})}}),Rb=t("$ZodCheckEndsWith",(n,i)=>{p.init(n,i);let $=new RegExp(`.*${fn(i.suffix)}$`);i.pattern??(i.pattern=$),n._zod.onattach.push((g)=>{let v=g._zod.bag;v.patterns??(v.patterns=new Set),v.patterns.add($)}),n._zod.check=(g)=>{if(g.value.endsWith(i.suffix))return;g.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:i.suffix,input:g.value,inst:n,continue:!i.abort})}});function x2(n,i,$){if(n.issues.length)i.issues.push(...un($,n.issues))}var Ab=t("$ZodCheckProperty",(n,i)=>{p.init(n,i),n._zod.check=($)=>{let g=i.schema._zod.run({value:$.value[i.property],issues:[]},{});if(g instanceof Promise)return g.then((v)=>x2(v,$,i.property));x2(g,$,i.property);return}}),xb=t("$ZodCheckMimeType",(n,i)=>{p.init(n,i);let $=new Set(i.mime);n._zod.onattach.push((g)=>{g._zod.bag.mime=i.mime}),n._zod.check=(g)=>{if($.has(g.value.type))return;g.issues.push({code:"invalid_value",values:i.mime,input:g.value.type,inst:n,continue:!i.abort})}}),hb=t("$ZodCheckOverwrite",(n,i)=>{p.init(n,i),n._zod.check=($)=>{$.value=i.tx($.value)}});class _4{constructor(n=[]){if(this.content=[],this.indent=0,this)this.args=n}indented(n){this.indent+=1,n(this),this.indent-=1}write(n){if(typeof n==="function"){n(this,{execution:"sync"}),n(this,{execution:"async"});return}let $=n.split(`
@@ -40,7 +40,7 @@ import{createRequire as QX}from"node:module";var _X=Object.create;var{getPrototy
40
40
  `)}u.write("payload.value = newResult;"),u.write("return payload;");let E=u.compile();return(T,a)=>E(j,T,a)},w,_=ii,U=!p$.jitless,l=U&&C_.value,J=i.catchall,Q;n._zod.parse=(j,u)=>{Q??(Q=g.value);let W=j.value;if(!_(W))return j.issues.push({expected:"object",code:"invalid_type",input:W,inst:n}),j;if(U&&l&&u?.async===!1&&u.jitless!==!0){if(!w)w=v(i.shape);if(j=w(j,u),!J)return j;return il([],W,j,u,Q,n)}return $(j,u)}});function o2(n,i,$,g){for(let w of n)if(w.issues.length===0)return i.value=w.value,i;let v=n.filter((w)=>!Vv(w));if(v.length===1)return i.value=v[0].value,v[0];return i.issues.push({code:"invalid_union",input:i.value,inst:$,errors:n.map((w)=>w.issues.map((_)=>Qn(_,g,vn())))}),i}var Jg=t("$ZodUnion",(n,i)=>{M.init(n,i),C(n._zod,"optin",()=>i.options.some((v)=>v._zod.optin==="optional")?"optional":void 0),C(n._zod,"optout",()=>i.options.some((v)=>v._zod.optout==="optional")?"optional":void 0),C(n._zod,"values",()=>{if(i.options.every((v)=>v._zod.values))return new Set(i.options.flatMap((v)=>Array.from(v._zod.values)));return}),C(n._zod,"pattern",()=>{if(i.options.every((v)=>v._zod.pattern)){let v=i.options.map((w)=>w._zod.pattern);return new RegExp(`^(${v.map((w)=>vg(w.source)).join("|")})$`)}return});let $=i.options.length===1,g=i.options[0]._zod.run;n._zod.parse=(v,w)=>{if($)return g(v,w);let _=!1,U=[];for(let k of i.options){let l=k._zod.run({value:v.value,issues:[]},w);if(l instanceof Promise)U.push(l),_=!0;else{if(l.issues.length===0)return l;U.push(l)}}if(!_)return o2(U,v,n,w);return Promise.all(U).then((k)=>{return o2(k,v,n,w)})}});function T2(n,i,$,g){let v=n.filter((w)=>w.issues.length===0);if(v.length===1)return i.value=v[0].value,i;if(v.length===0)i.issues.push({code:"invalid_union",input:i.value,inst:$,errors:n.map((w)=>w.issues.map((_)=>Qn(_,g,vn())))});else i.issues.push({code:"invalid_union",input:i.value,inst:$,errors:[],inclusive:!1});return i}var KU=t("$ZodXor",(n,i)=>{Jg.init(n,i),i.inclusive=!1;let $=i.options.length===1,g=i.options[0]._zod.run;n._zod.parse=(v,w)=>{if($)return g(v,w);let _=!1,U=[];for(let k of i.options){let l=k._zod.run({value:v.value,issues:[]},w);if(l instanceof Promise)U.push(l),_=!0;else U.push(l)}if(!_)return T2(U,v,n,w);return Promise.all(U).then((k)=>{return T2(k,v,n,w)})}}),OU=t("$ZodDiscriminatedUnion",(n,i)=>{i.inclusive=!1,Jg.init(n,i);let $=n._zod.parse;C(n._zod,"propValues",()=>{let v={};for(let w of i.options){let _=w._zod.propValues;if(!_||Object.keys(_).length===0)throw Error(`Invalid discriminated union option at index "${i.options.indexOf(w)}"`);for(let[U,k]of Object.entries(_)){if(!v[U])v[U]=new Set;for(let l of k)v[U].add(l)}}return v});let g=hi(()=>{let v=i.options,w=new Map;for(let _ of v){let U=_._zod.propValues?.[i.discriminator];if(!U||U.size===0)throw Error(`Invalid discriminated union option at index "${i.options.indexOf(_)}"`);for(let k of U){if(w.has(k))throw Error(`Duplicate discriminator value "${String(k)}"`);w.set(k,_)}}return w});n._zod.parse=(v,w)=>{let _=v.value;if(!ii(_))return v.issues.push({code:"invalid_type",expected:"object",input:_,inst:n}),v;let U=g.value.get(_?.[i.discriminator]);if(U)return U._zod.run(v,w);if(i.unionFallback)return $(v,w);return v.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:i.discriminator,input:_,path:[i.discriminator],inst:n}),v}}),BU=t("$ZodIntersection",(n,i)=>{M.init(n,i),n._zod.parse=($,g)=>{let v=$.value,w=i.left._zod.run({value:v,issues:[]},g),_=i.right._zod.run({value:v,issues:[]},g);if(w instanceof Promise||_ instanceof Promise)return Promise.all([w,_]).then(([k,l])=>{return Z2($,k,l)});return Z2($,w,_)}});function Eb(n,i){if(n===i)return{valid:!0,data:n};if(n instanceof Date&&i instanceof Date&&+n===+i)return{valid:!0,data:n};if(Hv(n)&&Hv(i)){let $=Object.keys(i),g=Object.keys(n).filter((w)=>$.indexOf(w)!==-1),v={...n,...i};for(let w of g){let _=Eb(n[w],i[w]);if(!_.valid)return{valid:!1,mergeErrorPath:[w,..._.mergeErrorPath]};v[w]=_.data}return{valid:!0,data:v}}if(Array.isArray(n)&&Array.isArray(i)){if(n.length!==i.length)return{valid:!1,mergeErrorPath:[]};let $=[];for(let g=0;g<n.length;g++){let v=n[g],w=i[g],_=Eb(v,w);if(!_.valid)return{valid:!1,mergeErrorPath:[g,..._.mergeErrorPath]};$.push(_.data)}return{valid:!0,data:$}}return{valid:!1,mergeErrorPath:[]}}function Z2(n,i,$){if(i.issues.length)n.issues.push(...i.issues);if($.issues.length)n.issues.push(...$.issues);if(Vv(n))return n;let g=Eb(i.value,$.value);if(!g.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(g.mergeErrorPath)}`);return n.value=g.data,n}var G4=t("$ZodTuple",(n,i)=>{M.init(n,i);let $=i.items;n._zod.parse=(g,v)=>{let w=g.value;if(!Array.isArray(w))return g.issues.push({input:w,inst:n,expected:"tuple",code:"invalid_type"}),g;g.value=[];let _=[],U=[...$].reverse().findIndex((J)=>J._zod.optin!=="optional"),k=U===-1?0:$.length-U;if(!i.rest){let J=w.length>$.length,Q=w.length<k-1;if(J||Q)return g.issues.push({...J?{code:"too_big",maximum:$.length,inclusive:!0}:{code:"too_small",minimum:$.length},input:w,inst:n,origin:"array"}),g}let l=-1;for(let J of $){if(l++,l>=w.length){if(l>=k)continue}let Q=J._zod.run({value:w[l],issues:[]},v);if(Q instanceof Promise)_.push(Q.then((j)=>b4(j,g,l)));else b4(Q,g,l)}if(i.rest){let J=w.slice($.length);for(let Q of J){l++;let j=i.rest._zod.run({value:Q,issues:[]},v);if(j instanceof Promise)_.push(j.then((u)=>b4(u,g,l)));else b4(j,g,l)}}if(_.length)return Promise.all(_).then(()=>g);return g}});function b4(n,i,$){if(n.issues.length)i.issues.push(...un($,n.issues));i.value[$]=n.value}var FU=t("$ZodRecord",(n,i)=>{M.init(n,i),n._zod.parse=($,g)=>{let v=$.value;if(!Hv(v))return $.issues.push({expected:"record",code:"invalid_type",input:v,inst:n}),$;let w=[],_=i.keyType._zod.values;if(_){$.value={};let U=new Set;for(let l of _)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){U.add(typeof l==="number"?l.toString():l);let J=i.valueType._zod.run({value:v[l],issues:[]},g);if(J instanceof Promise)w.push(J.then((Q)=>{if(Q.issues.length)$.issues.push(...un(l,Q.issues));$.value[l]=Q.value}));else{if(J.issues.length)$.issues.push(...un(l,J.issues));$.value[l]=J.value}}let k;for(let l in v)if(!U.has(l))k=k??[],k.push(l);if(k&&k.length>0)$.issues.push({code:"unrecognized_keys",input:v,inst:n,keys:k})}else{$.value={};for(let U of Reflect.ownKeys(v)){if(U==="__proto__")continue;let k=i.keyType._zod.run({value:U,issues:[]},g);if(k instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof U==="string"&&Ug.test(U)&&k.issues.length&&k.issues.some((Q)=>Q.code==="invalid_type"&&Q.expected==="number")){let Q=i.keyType._zod.run({value:Number(U),issues:[]},g);if(Q instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(Q.issues.length===0)k=Q}if(k.issues.length){if(i.mode==="loose")$.value[U]=v[U];else $.issues.push({code:"invalid_key",origin:"record",issues:k.issues.map((Q)=>Qn(Q,g,vn())),input:U,path:[U],inst:n});continue}let J=i.valueType._zod.run({value:v[U],issues:[]},g);if(J instanceof Promise)w.push(J.then((Q)=>{if(Q.issues.length)$.issues.push(...un(U,Q.issues));$.value[k.value]=Q.value}));else{if(J.issues.length)$.issues.push(...un(U,J.issues));$.value[k.value]=J.value}}}if(w.length)return Promise.all(w).then(()=>$);return $}}),NU=t("$ZodMap",(n,i)=>{M.init(n,i),n._zod.parse=($,g)=>{let v=$.value;if(!(v instanceof Map))return $.issues.push({expected:"map",code:"invalid_type",input:v,inst:n}),$;let w=[];$.value=new Map;for(let[_,U]of v){let k=i.keyType._zod.run({value:_,issues:[]},g),l=i.valueType._zod.run({value:U,issues:[]},g);if(k instanceof Promise||l instanceof Promise)w.push(Promise.all([k,l]).then(([J,Q])=>{r2(J,Q,$,_,v,n,g)}));else r2(k,l,$,_,v,n,g)}if(w.length)return Promise.all(w).then(()=>$);return $}});function r2(n,i,$,g,v,w,_){if(n.issues.length)if(ig.has(typeof g))$.issues.push(...un(g,n.issues));else $.issues.push({code:"invalid_key",origin:"map",input:v,inst:w,issues:n.issues.map((U)=>Qn(U,_,vn()))});if(i.issues.length)if(ig.has(typeof g))$.issues.push(...un(g,i.issues));else $.issues.push({origin:"map",code:"invalid_element",input:v,inst:w,key:g,issues:i.issues.map((U)=>Qn(U,_,vn()))});$.value.set(n.value,i.value)}var cU=t("$ZodSet",(n,i)=>{M.init(n,i),n._zod.parse=($,g)=>{let v=$.value;if(!(v instanceof Set))return $.issues.push({input:v,inst:n,expected:"set",code:"invalid_type"}),$;let w=[];$.value=new Set;for(let _ of v){let U=i.valueType._zod.run({value:_,issues:[]},g);if(U instanceof Promise)w.push(U.then((k)=>m2(k,$)));else m2(U,$)}if(w.length)return Promise.all(w).then(()=>$);return $}});function m2(n,i){if(n.issues.length)i.issues.push(...n.issues);i.value.add(n.value)}var PU=t("$ZodEnum",(n,i)=>{M.init(n,i);let $=Ai(i.entries),g=new Set($);n._zod.values=g,n._zod.pattern=new RegExp(`^(${$.filter((v)=>ig.has(typeof v)).map((v)=>typeof v==="string"?fn(v):v.toString()).join("|")})$`),n._zod.parse=(v,w)=>{let _=v.value;if(g.has(_))return v;return v.issues.push({code:"invalid_value",values:$,input:_,inst:n}),v}}),SU=t("$ZodLiteral",(n,i)=>{if(M.init(n,i),i.values.length===0)throw Error("Cannot create literal schema with no valid values");let $=new Set(i.values);n._zod.values=$,n._zod.pattern=new RegExp(`^(${i.values.map((g)=>typeof g==="string"?fn(g):g?fn(g.toString()):String(g)).join("|")})$`),n._zod.parse=(g,v)=>{let w=g.value;if($.has(w))return g;return g.issues.push({code:"invalid_value",values:i.values,input:w,inst:n}),g}}),zU=t("$ZodFile",(n,i)=>{M.init(n,i),n._zod.parse=($,g)=>{let v=$.value;if(v instanceof File)return $;return $.issues.push({expected:"file",code:"invalid_type",input:v,inst:n}),$}}),MU=t("$ZodTransform",(n,i)=>{M.init(n,i),n._zod.parse=($,g)=>{if(g.direction==="backward")throw new vi(n.constructor.name);let v=i.transform($.value,$);if(g.async)return(v instanceof Promise?v:Promise.resolve(v)).then((_)=>{return $.value=_,$});if(v instanceof Promise)throw new mn;return $.value=v,$}});function y2(n,i){if(n.issues.length&&i===void 0)return{issues:[],value:void 0};return n}var t4=t("$ZodOptional",(n,i)=>{M.init(n,i),n._zod.optin="optional",n._zod.optout="optional",C(n._zod,"values",()=>{return i.innerType._zod.values?new Set([...i.innerType._zod.values,void 0]):void 0}),C(n._zod,"pattern",()=>{let $=i.innerType._zod.pattern;return $?new RegExp(`^(${vg($.source)})?$`):void 0}),n._zod.parse=($,g)=>{if(i.innerType._zod.optin==="optional"){let v=i.innerType._zod.run($,g);if(v instanceof Promise)return v.then((w)=>y2(w,$.value));return y2(v,$.value)}if($.value===void 0)return $;return i.innerType._zod.run($,g)}}),RU=t("$ZodExactOptional",(n,i)=>{t4.init(n,i),C(n._zod,"values",()=>i.innerType._zod.values),C(n._zod,"pattern",()=>i.innerType._zod.pattern),n._zod.parse=($,g)=>{return i.innerType._zod.run($,g)}}),AU=t("$ZodNullable",(n,i)=>{M.init(n,i),C(n._zod,"optin",()=>i.innerType._zod.optin),C(n._zod,"optout",()=>i.innerType._zod.optout),C(n._zod,"pattern",()=>{let $=i.innerType._zod.pattern;return $?new RegExp(`^(${vg($.source)}|null)$`):void 0}),C(n._zod,"values",()=>{return i.innerType._zod.values?new Set([...i.innerType._zod.values,null]):void 0}),n._zod.parse=($,g)=>{if($.value===null)return $;return i.innerType._zod.run($,g)}}),xU=t("$ZodDefault",(n,i)=>{M.init(n,i),n._zod.optin="optional",C(n._zod,"values",()=>i.innerType._zod.values),n._zod.parse=($,g)=>{if(g.direction==="backward")return i.innerType._zod.run($,g);if($.value===void 0)return $.value=i.defaultValue,$;let v=i.innerType._zod.run($,g);if(v instanceof Promise)return v.then((w)=>d2(w,i));return d2(v,i)}});function d2(n,i){if(n.value===void 0)n.value=i.defaultValue;return n}var hU=t("$ZodPrefault",(n,i)=>{M.init(n,i),n._zod.optin="optional",C(n._zod,"values",()=>i.innerType._zod.values),n._zod.parse=($,g)=>{if(g.direction==="backward")return i.innerType._zod.run($,g);if($.value===void 0)$.value=i.defaultValue;return i.innerType._zod.run($,g)}}),CU=t("$ZodNonOptional",(n,i)=>{M.init(n,i),C(n._zod,"values",()=>{let $=i.innerType._zod.values;return $?new Set([...$].filter((g)=>g!==void 0)):void 0}),n._zod.parse=($,g)=>{let v=i.innerType._zod.run($,g);if(v instanceof Promise)return v.then((w)=>e2(w,n));return e2(v,n)}});function e2(n,i){if(!n.issues.length&&n.value===void 0)n.issues.push({code:"invalid_type",expected:"nonoptional",input:n.value,inst:i});return n}var EU=t("$ZodSuccess",(n,i)=>{M.init(n,i),n._zod.parse=($,g)=>{if(g.direction==="backward")throw new vi("ZodSuccess");let v=i.innerType._zod.run($,g);if(v instanceof Promise)return v.then((w)=>{return $.value=w.issues.length===0,$});return $.value=v.issues.length===0,$}}),oU=t("$ZodCatch",(n,i)=>{M.init(n,i),C(n._zod,"optin",()=>i.innerType._zod.optin),C(n._zod,"optout",()=>i.innerType._zod.optout),C(n._zod,"values",()=>i.innerType._zod.values),n._zod.parse=($,g)=>{if(g.direction==="backward")return i.innerType._zod.run($,g);let v=i.innerType._zod.run($,g);if(v instanceof Promise)return v.then((w)=>{if($.value=w.value,w.issues.length)$.value=i.catchValue({...$,error:{issues:w.issues.map((_)=>Qn(_,g,vn()))},input:$.value}),$.issues=[];return $});if($.value=v.value,v.issues.length)$.value=i.catchValue({...$,error:{issues:v.issues.map((w)=>Qn(w,g,vn()))},input:$.value}),$.issues=[];return $}}),TU=t("$ZodNaN",(n,i)=>{M.init(n,i),n._zod.parse=($,g)=>{if(typeof $.value!=="number"||!Number.isNaN($.value))return $.issues.push({input:$.value,inst:n,expected:"nan",code:"invalid_type"}),$;return $}}),ZU=t("$ZodPipe",(n,i)=>{M.init(n,i),C(n._zod,"values",()=>i.in._zod.values),C(n._zod,"optin",()=>i.in._zod.optin),C(n._zod,"optout",()=>i.out._zod.optout),C(n._zod,"propValues",()=>i.in._zod.propValues),n._zod.parse=($,g)=>{if(g.direction==="backward"){let w=i.out._zod.run($,g);if(w instanceof Promise)return w.then((_)=>U4(_,i.in,g));return U4(w,i.in,g)}let v=i.in._zod.run($,g);if(v instanceof Promise)return v.then((w)=>U4(w,i.out,g));return U4(v,i.out,g)}});function U4(n,i,$){if(n.issues.length)return n.aborted=!0,n;return i._zod.run({value:n.value,issues:n.issues},$)}var Xg=t("$ZodCodec",(n,i)=>{M.init(n,i),C(n._zod,"values",()=>i.in._zod.values),C(n._zod,"optin",()=>i.in._zod.optin),C(n._zod,"optout",()=>i.out._zod.optout),C(n._zod,"propValues",()=>i.in._zod.propValues),n._zod.parse=($,g)=>{if((g.direction||"forward")==="forward"){let w=i.in._zod.run($,g);if(w instanceof Promise)return w.then((_)=>k4(_,i,g));return k4(w,i,g)}else{let w=i.out._zod.run($,g);if(w instanceof Promise)return w.then((_)=>k4(_,i,g));return k4(w,i,g)}}});function k4(n,i,$){if(n.issues.length)return n.aborted=!0,n;if(($.direction||"forward")==="forward"){let v=i.transform(n.value,n);if(v instanceof Promise)return v.then((w)=>l4(n,w,i.out,$));return l4(n,v,i.out,$)}else{let v=i.reverseTransform(n.value,n);if(v instanceof Promise)return v.then((w)=>l4(n,w,i.in,$));return l4(n,v,i.in,$)}}function l4(n,i,$,g){if(n.issues.length)return n.aborted=!0,n;return $._zod.run({value:i,issues:n.issues},g)}var rU=t("$ZodReadonly",(n,i)=>{M.init(n,i),C(n._zod,"propValues",()=>i.innerType._zod.propValues),C(n._zod,"values",()=>i.innerType._zod.values),C(n._zod,"optin",()=>i.innerType?._zod?.optin),C(n._zod,"optout",()=>i.innerType?._zod?.optout),n._zod.parse=($,g)=>{if(g.direction==="backward")return i.innerType._zod.run($,g);let v=i.innerType._zod.run($,g);if(v instanceof Promise)return v.then(p2);return p2(v)}});function p2(n){return n.value=Object.freeze(n.value),n}var mU=t("$ZodTemplateLiteral",(n,i)=>{M.init(n,i);let $=[];for(let g of i.parts)if(typeof g==="object"&&g!==null){if(!g._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...g._zod.traits].shift()}`);let v=g._zod.pattern instanceof RegExp?g._zod.pattern.source:g._zod.pattern;if(!v)throw Error(`Invalid template literal part: ${g._zod.traits}`);let w=v.startsWith("^")?1:0,_=v.endsWith("$")?v.length-1:v.length;$.push(v.slice(w,_))}else if(g===null||o_.has(typeof g))$.push(fn(`${g}`));else throw Error(`Invalid template literal part: ${g}`);n._zod.pattern=new RegExp(`^${$.join("")}$`),n._zod.parse=(g,v)=>{if(typeof g.value!=="string")return g.issues.push({input:g.value,inst:n,expected:"string",code:"invalid_type"}),g;if(n._zod.pattern.lastIndex=0,!n._zod.pattern.test(g.value))return g.issues.push({input:g.value,inst:n,code:"invalid_format",format:i.format??"template_literal",pattern:n._zod.pattern.source}),g;return g}}),yU=t("$ZodFunction",(n,i)=>{return M.init(n,i),n._def=i,n._zod.def=i,n.implement=($)=>{if(typeof $!=="function")throw Error("implement() must be called with a function");return function(...g){let v=n._def.input?mw(n._def.input,g):g,w=Reflect.apply($,this,v);if(n._def.output)return mw(n._def.output,w);return w}},n.implementAsync=($)=>{if(typeof $!=="function")throw Error("implementAsync() must be called with a function");return async function(...g){let v=n._def.input?await yw(n._def.input,g):g,w=await Reflect.apply($,this,v);if(n._def.output)return await yw(n._def.output,w);return w}},n._zod.parse=($,g)=>{if(typeof $.value!=="function")return $.issues.push({code:"invalid_type",expected:"function",input:$.value,inst:n}),$;if(n._def.output&&n._def.output._zod.def.type==="promise")$.value=n.implementAsync($.value);else $.value=n.implement($.value);return $},n.input=(...$)=>{let g=n.constructor;if(Array.isArray($[0]))return new g({type:"function",input:new G4({type:"tuple",items:$[0],rest:$[1]}),output:n._def.output});return new g({type:"function",input:$[0],output:n._def.output})},n.output=($)=>{return new n.constructor({type:"function",input:n._def.input,output:$})},n}),dU=t("$ZodPromise",(n,i)=>{M.init(n,i),n._zod.parse=($,g)=>{return Promise.resolve($.value).then((v)=>i.innerType._zod.run({value:v,issues:[]},g))}}),eU=t("$ZodLazy",(n,i)=>{M.init(n,i),C(n._zod,"innerType",()=>i.getter()),C(n._zod,"pattern",()=>n._zod.innerType?._zod?.pattern),C(n._zod,"propValues",()=>n._zod.innerType?._zod?.propValues),C(n._zod,"optin",()=>n._zod.innerType?._zod?.optin??void 0),C(n._zod,"optout",()=>n._zod.innerType?._zod?.optout??void 0),n._zod.parse=($,g)=>{return n._zod.innerType._zod.run($,g)}}),pU=t("$ZodCustom",(n,i)=>{p.init(n,i),M.init(n,i),n._zod.parse=($,g)=>{return $},n._zod.check=($)=>{let g=$.value,v=i.fn(g);if(v instanceof Promise)return v.then((w)=>a2(w,$,g,n));a2(v,$,g,n);return}});function a2(n,i,$,g){if(!n){let v={code:"custom",input:$,inst:g,path:[...g._zod.def.path??[]],continue:!g._zod.def.abort};if(g._zod.def.params)v.params=g._zod.def.params;i.issues.push(Ci(v))}}var bi={};Nn(bi,{zhTW:()=>E1,zhCN:()=>C1,yo:()=>o1,vi:()=>h1,uz:()=>x1,ur:()=>A1,uk:()=>Wg,ua:()=>R1,tr:()=>M1,th:()=>z1,ta:()=>S1,sv:()=>P1,sl:()=>c1,ru:()=>N1,pt:()=>F1,ps:()=>O1,pl:()=>B1,ota:()=>K1,no:()=>L1,nl:()=>q1,ms:()=>f1,mk:()=>V1,lt:()=>H1,ko:()=>u1,km:()=>tg,kh:()=>j1,ka:()=>I1,ja:()=>Y1,it:()=>W1,is:()=>Q1,id:()=>t1,hy:()=>G1,hu:()=>X1,he:()=>J1,frCA:()=>D1,fr:()=>l1,fi:()=>k1,fa:()=>U1,es:()=>b1,eo:()=>_1,en:()=>Gg,de:()=>w1,da:()=>g1,cs:()=>$1,ca:()=>i1,bg:()=>v1,be:()=>n1,az:()=>sU,ar:()=>aU});var SQ=()=>{let n={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function i(v){return n[v]??null}let $={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`مدخلات غير مقبولة: يفترض إدخال instanceof ${v.expected}، ولكن تم إدخال ${U}`;return`مدخلات غير مقبولة: يفترض إدخال ${w}، ولكن تم إدخال ${U}`}case"invalid_value":if(v.values.length===1)return`مدخلات غير مقبولة: يفترض إدخال ${V(v.values[0])}`;return`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return` أكبر من اللازم: يفترض أن تكون ${v.origin??"القيمة"} ${w} ${v.maximum.toString()} ${_.unit??"عنصر"}`;return`أكبر من اللازم: يفترض أن تكون ${v.origin??"القيمة"} ${w} ${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`أصغر من اللازم: يفترض لـ ${v.origin} أن يكون ${w} ${v.minimum.toString()} ${_.unit}`;return`أصغر من اللازم: يفترض لـ ${v.origin} أن يكون ${w} ${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`نَص غير مقبول: يجب أن يبدأ بـ "${v.prefix}"`;if(w.format==="ends_with")return`نَص غير مقبول: يجب أن ينتهي بـ "${w.suffix}"`;if(w.format==="includes")return`نَص غير مقبول: يجب أن يتضمَّن "${w.includes}"`;if(w.format==="regex")return`نَص غير مقبول: يجب أن يطابق النمط ${w.pattern}`;return`${$[w.format]??v.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${v.divisor}`;case"unrecognized_keys":return`معرف${v.keys.length>1?"ات":""} غريب${v.keys.length>1?"ة":""}: ${I(v.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${v.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${v.origin}`;default:return"مدخل غير مقبول"}}};function aU(){return{localeError:SQ()}}var zQ=()=>{let n={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function i(v){return n[v]??null}let $={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Yanlış dəyər: gözlənilən instanceof ${v.expected}, daxil olan ${U}`;return`Yanlış dəyər: gözlənilən ${w}, daxil olan ${U}`}case"invalid_value":if(v.values.length===1)return`Yanlış dəyər: gözlənilən ${V(v.values[0])}`;return`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`Çox böyük: gözlənilən ${v.origin??"dəyər"} ${w}${v.maximum.toString()} ${_.unit??"element"}`;return`Çox böyük: gözlənilən ${v.origin??"dəyər"} ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`Çox kiçik: gözlənilən ${v.origin} ${w}${v.minimum.toString()} ${_.unit}`;return`Çox kiçik: gözlənilən ${v.origin} ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Yanlış mətn: "${w.prefix}" ilə başlamalıdır`;if(w.format==="ends_with")return`Yanlış mətn: "${w.suffix}" ilə bitməlidir`;if(w.format==="includes")return`Yanlış mətn: "${w.includes}" daxil olmalıdır`;if(w.format==="regex")return`Yanlış mətn: ${w.pattern} şablonuna uyğun olmalıdır`;return`Yanlış ${$[w.format]??v.format}`}case"not_multiple_of":return`Yanlış ədəd: ${v.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${v.keys.length>1?"lar":""}: ${I(v.keys,", ")}`;case"invalid_key":return`${v.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${v.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function sU(){return{localeError:zQ()}}function gl(n,i,$,g){let v=Math.abs(n),w=v%10,_=v%100;if(_>=11&&_<=19)return g;if(w===1)return i;if(w>=2&&w<=4)return $;return g}var MQ=()=>{let n={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function i(v){return n[v]??null}let $={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"},g={nan:"NaN",number:"лік",array:"масіў"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Няправільны ўвод: чакаўся instanceof ${v.expected}, атрымана ${U}`;return`Няправільны ўвод: чакаўся ${w}, атрымана ${U}`}case"invalid_value":if(v.values.length===1)return`Няправільны ўвод: чакалася ${V(v.values[0])}`;return`Няправільны варыянт: чакаўся адзін з ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_){let U=Number(v.maximum),k=gl(U,_.unit.one,_.unit.few,_.unit.many);return`Занадта вялікі: чакалася, што ${v.origin??"значэнне"} павінна ${_.verb} ${w}${v.maximum.toString()} ${k}`}return`Занадта вялікі: чакалася, што ${v.origin??"значэнне"} павінна быць ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_){let U=Number(v.minimum),k=gl(U,_.unit.one,_.unit.few,_.unit.many);return`Занадта малы: чакалася, што ${v.origin} павінна ${_.verb} ${w}${v.minimum.toString()} ${k}`}return`Занадта малы: чакалася, што ${v.origin} павінна быць ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Няправільны радок: павінен пачынацца з "${w.prefix}"`;if(w.format==="ends_with")return`Няправільны радок: павінен заканчвацца на "${w.suffix}"`;if(w.format==="includes")return`Няправільны радок: павінен змяшчаць "${w.includes}"`;if(w.format==="regex")return`Няправільны радок: павінен адпавядаць шаблону ${w.pattern}`;return`Няправільны ${$[w.format]??v.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${v.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${v.keys.length>1?"ключы":"ключ"}: ${I(v.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${v.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${v.origin}`;default:return"Няправільны ўвод"}}};function n1(){return{localeError:MQ()}}var RQ=()=>{let n={string:{unit:"символа",verb:"да съдържа"},file:{unit:"байта",verb:"да съдържа"},array:{unit:"елемента",verb:"да съдържа"},set:{unit:"елемента",verb:"да съдържа"}};function i(v){return n[v]??null}let $={regex:"вход",email:"имейл адрес",url:"URL",emoji:"емоджи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO време",date:"ISO дата",time:"ISO време",duration:"ISO продължителност",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"base64-кодиран низ",base64url:"base64url-кодиран низ",json_string:"JSON низ",e164:"E.164 номер",jwt:"JWT",template_literal:"вход"},g={nan:"NaN",number:"число",array:"масив"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Невалиден вход: очакван instanceof ${v.expected}, получен ${U}`;return`Невалиден вход: очакван ${w}, получен ${U}`}case"invalid_value":if(v.values.length===1)return`Невалиден вход: очакван ${V(v.values[0])}`;return`Невалидна опция: очаквано едно от ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`Твърде голямо: очаква се ${v.origin??"стойност"} да съдържа ${w}${v.maximum.toString()} ${_.unit??"елемента"}`;return`Твърде голямо: очаква се ${v.origin??"стойност"} да бъде ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`Твърде малко: очаква се ${v.origin} да съдържа ${w}${v.minimum.toString()} ${_.unit}`;return`Твърде малко: очаква се ${v.origin} да бъде ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Невалиден низ: трябва да започва с "${w.prefix}"`;if(w.format==="ends_with")return`Невалиден низ: трябва да завършва с "${w.suffix}"`;if(w.format==="includes")return`Невалиден низ: трябва да включва "${w.includes}"`;if(w.format==="regex")return`Невалиден низ: трябва да съвпада с ${w.pattern}`;let _="Невалиден";if(w.format==="emoji")_="Невалидно";if(w.format==="datetime")_="Невалидно";if(w.format==="date")_="Невалидна";if(w.format==="time")_="Невалидно";if(w.format==="duration")_="Невалидна";return`${_} ${$[w.format]??v.format}`}case"not_multiple_of":return`Невалидно число: трябва да бъде кратно на ${v.divisor}`;case"unrecognized_keys":return`Неразпознат${v.keys.length>1?"и":""} ключ${v.keys.length>1?"ове":""}: ${I(v.keys,", ")}`;case"invalid_key":return`Невалиден ключ в ${v.origin}`;case"invalid_union":return"Невалиден вход";case"invalid_element":return`Невалидна стойност в ${v.origin}`;default:return"Невалиден вход"}}};function v1(){return{localeError:RQ()}}var AQ=()=>{let n={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function i(v){return n[v]??null}let $={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Tipus invàlid: s'esperava instanceof ${v.expected}, s'ha rebut ${U}`;return`Tipus invàlid: s'esperava ${w}, s'ha rebut ${U}`}case"invalid_value":if(v.values.length===1)return`Valor invàlid: s'esperava ${V(v.values[0])}`;return`Opció invàlida: s'esperava una de ${I(v.values," o ")}`;case"too_big":{let w=v.inclusive?"com a màxim":"menys de",_=i(v.origin);if(_)return`Massa gran: s'esperava que ${v.origin??"el valor"} contingués ${w} ${v.maximum.toString()} ${_.unit??"elements"}`;return`Massa gran: s'esperava que ${v.origin??"el valor"} fos ${w} ${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?"com a mínim":"més de",_=i(v.origin);if(_)return`Massa petit: s'esperava que ${v.origin} contingués ${w} ${v.minimum.toString()} ${_.unit}`;return`Massa petit: s'esperava que ${v.origin} fos ${w} ${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Format invàlid: ha de començar amb "${w.prefix}"`;if(w.format==="ends_with")return`Format invàlid: ha d'acabar amb "${w.suffix}"`;if(w.format==="includes")return`Format invàlid: ha d'incloure "${w.includes}"`;if(w.format==="regex")return`Format invàlid: ha de coincidir amb el patró ${w.pattern}`;return`Format invàlid per a ${$[w.format]??v.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${v.divisor}`;case"unrecognized_keys":return`Clau${v.keys.length>1?"s":""} no reconeguda${v.keys.length>1?"s":""}: ${I(v.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${v.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${v.origin}`;default:return"Entrada invàlida"}}};function i1(){return{localeError:AQ()}}var xQ=()=>{let n={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function i(v){return n[v]??null}let $={regex:"regulární výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"},g={nan:"NaN",number:"číslo",string:"řetězec",function:"funkce",array:"pole"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Neplatný vstup: očekáváno instanceof ${v.expected}, obdrženo ${U}`;return`Neplatný vstup: očekáváno ${w}, obdrženo ${U}`}case"invalid_value":if(v.values.length===1)return`Neplatný vstup: očekáváno ${V(v.values[0])}`;return`Neplatná možnost: očekávána jedna z hodnot ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`Hodnota je příliš velká: ${v.origin??"hodnota"} musí mít ${w}${v.maximum.toString()} ${_.unit??"prvků"}`;return`Hodnota je příliš velká: ${v.origin??"hodnota"} musí být ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`Hodnota je příliš malá: ${v.origin??"hodnota"} musí mít ${w}${v.minimum.toString()} ${_.unit??"prvků"}`;return`Hodnota je příliš malá: ${v.origin??"hodnota"} musí být ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Neplatný řetězec: musí začínat na "${w.prefix}"`;if(w.format==="ends_with")return`Neplatný řetězec: musí končit na "${w.suffix}"`;if(w.format==="includes")return`Neplatný řetězec: musí obsahovat "${w.includes}"`;if(w.format==="regex")return`Neplatný řetězec: musí odpovídat vzoru ${w.pattern}`;return`Neplatný formát ${$[w.format]??v.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${v.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${I(v.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${v.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${v.origin}`;default:return"Neplatný vstup"}}};function $1(){return{localeError:xQ()}}var hQ=()=>{let n={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function i(v){return n[v]??null}let $={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslæt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},g={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Ugyldigt input: forventede instanceof ${v.expected}, fik ${U}`;return`Ugyldigt input: forventede ${w}, fik ${U}`}case"invalid_value":if(v.values.length===1)return`Ugyldig værdi: forventede ${V(v.values[0])}`;return`Ugyldigt valg: forventede en af følgende ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin),U=g[v.origin]??v.origin;if(_)return`For stor: forventede ${U??"value"} ${_.verb} ${w} ${v.maximum.toString()} ${_.unit??"elementer"}`;return`For stor: forventede ${U??"value"} havde ${w} ${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin),U=g[v.origin]??v.origin;if(_)return`For lille: forventede ${U} ${_.verb} ${w} ${v.minimum.toString()} ${_.unit}`;return`For lille: forventede ${U} havde ${w} ${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Ugyldig streng: skal starte med "${w.prefix}"`;if(w.format==="ends_with")return`Ugyldig streng: skal ende med "${w.suffix}"`;if(w.format==="includes")return`Ugyldig streng: skal indeholde "${w.includes}"`;if(w.format==="regex")return`Ugyldig streng: skal matche mønsteret ${w.pattern}`;return`Ugyldig ${$[w.format]??v.format}`}case"not_multiple_of":return`Ugyldigt tal: skal være deleligt med ${v.divisor}`;case"unrecognized_keys":return`${v.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${I(v.keys,", ")}`;case"invalid_key":return`Ugyldig nøgle i ${v.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig værdi i ${v.origin}`;default:return"Ugyldigt input"}}};function g1(){return{localeError:hQ()}}var CQ=()=>{let n={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function i(v){return n[v]??null}let $={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},g={nan:"NaN",number:"Zahl",array:"Array"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Ungültige Eingabe: erwartet instanceof ${v.expected}, erhalten ${U}`;return`Ungültige Eingabe: erwartet ${w}, erhalten ${U}`}case"invalid_value":if(v.values.length===1)return`Ungültige Eingabe: erwartet ${V(v.values[0])}`;return`Ungültige Option: erwartet eine von ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`Zu groß: erwartet, dass ${v.origin??"Wert"} ${w}${v.maximum.toString()} ${_.unit??"Elemente"} hat`;return`Zu groß: erwartet, dass ${v.origin??"Wert"} ${w}${v.maximum.toString()} ist`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`Zu klein: erwartet, dass ${v.origin} ${w}${v.minimum.toString()} ${_.unit} hat`;return`Zu klein: erwartet, dass ${v.origin} ${w}${v.minimum.toString()} ist`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Ungültiger String: muss mit "${w.prefix}" beginnen`;if(w.format==="ends_with")return`Ungültiger String: muss mit "${w.suffix}" enden`;if(w.format==="includes")return`Ungültiger String: muss "${w.includes}" enthalten`;if(w.format==="regex")return`Ungültiger String: muss dem Muster ${w.pattern} entsprechen`;return`Ungültig: ${$[w.format]??v.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${v.divisor} sein`;case"unrecognized_keys":return`${v.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${I(v.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${v.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${v.origin}`;default:return"Ungültige Eingabe"}}};function w1(){return{localeError:CQ()}}var EQ=()=>{let n={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function i(v){return n[v]??null}let $={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;return`Invalid input: expected ${w}, received ${U}`}case"invalid_value":if(v.values.length===1)return`Invalid input: expected ${V(v.values[0])}`;return`Invalid option: expected one of ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`Too big: expected ${v.origin??"value"} to have ${w}${v.maximum.toString()} ${_.unit??"elements"}`;return`Too big: expected ${v.origin??"value"} to be ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`Too small: expected ${v.origin} to have ${w}${v.minimum.toString()} ${_.unit}`;return`Too small: expected ${v.origin} to be ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Invalid string: must start with "${w.prefix}"`;if(w.format==="ends_with")return`Invalid string: must end with "${w.suffix}"`;if(w.format==="includes")return`Invalid string: must include "${w.includes}"`;if(w.format==="regex")return`Invalid string: must match pattern ${w.pattern}`;return`Invalid ${$[w.format]??v.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${v.divisor}`;case"unrecognized_keys":return`Unrecognized key${v.keys.length>1?"s":""}: ${I(v.keys,", ")}`;case"invalid_key":return`Invalid key in ${v.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${v.origin}`;default:return"Invalid input"}}};function Gg(){return{localeError:EQ()}}var oQ=()=>{let n={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function i(v){return n[v]??null}let $={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},g={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Nevalida enigo: atendiĝis instanceof ${v.expected}, riceviĝis ${U}`;return`Nevalida enigo: atendiĝis ${w}, riceviĝis ${U}`}case"invalid_value":if(v.values.length===1)return`Nevalida enigo: atendiĝis ${V(v.values[0])}`;return`Nevalida opcio: atendiĝis unu el ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`Tro granda: atendiĝis ke ${v.origin??"valoro"} havu ${w}${v.maximum.toString()} ${_.unit??"elementojn"}`;return`Tro granda: atendiĝis ke ${v.origin??"valoro"} havu ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`Tro malgranda: atendiĝis ke ${v.origin} havu ${w}${v.minimum.toString()} ${_.unit}`;return`Tro malgranda: atendiĝis ke ${v.origin} estu ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Nevalida karaktraro: devas komenciĝi per "${w.prefix}"`;if(w.format==="ends_with")return`Nevalida karaktraro: devas finiĝi per "${w.suffix}"`;if(w.format==="includes")return`Nevalida karaktraro: devas inkluzivi "${w.includes}"`;if(w.format==="regex")return`Nevalida karaktraro: devas kongrui kun la modelo ${w.pattern}`;return`Nevalida ${$[w.format]??v.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${v.divisor}`;case"unrecognized_keys":return`Nekonata${v.keys.length>1?"j":""} ŝlosilo${v.keys.length>1?"j":""}: ${I(v.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${v.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${v.origin}`;default:return"Nevalida enigo"}}};function _1(){return{localeError:oQ()}}var TQ=()=>{let n={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function i(v){return n[v]??null}let $={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},g={nan:"NaN",string:"texto",number:"número",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"número grande",symbol:"símbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacío",never:"nunca",unknown:"desconocido",any:"cualquiera"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Entrada inválida: se esperaba instanceof ${v.expected}, recibido ${U}`;return`Entrada inválida: se esperaba ${w}, recibido ${U}`}case"invalid_value":if(v.values.length===1)return`Entrada inválida: se esperaba ${V(v.values[0])}`;return`Opción inválida: se esperaba una de ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin),U=g[v.origin]??v.origin;if(_)return`Demasiado grande: se esperaba que ${U??"valor"} tuviera ${w}${v.maximum.toString()} ${_.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${U??"valor"} fuera ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin),U=g[v.origin]??v.origin;if(_)return`Demasiado pequeño: se esperaba que ${U} tuviera ${w}${v.minimum.toString()} ${_.unit}`;return`Demasiado pequeño: se esperaba que ${U} fuera ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Cadena inválida: debe comenzar con "${w.prefix}"`;if(w.format==="ends_with")return`Cadena inválida: debe terminar en "${w.suffix}"`;if(w.format==="includes")return`Cadena inválida: debe incluir "${w.includes}"`;if(w.format==="regex")return`Cadena inválida: debe coincidir con el patrón ${w.pattern}`;return`Inválido ${$[w.format]??v.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${v.divisor}`;case"unrecognized_keys":return`Llave${v.keys.length>1?"s":""} desconocida${v.keys.length>1?"s":""}: ${I(v.keys,", ")}`;case"invalid_key":return`Llave inválida en ${g[v.origin]??v.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${g[v.origin]??v.origin}`;default:return"Entrada inválida"}}};function b1(){return{localeError:TQ()}}var ZQ=()=>{let n={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function i(v){return n[v]??null}let $={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"},g={nan:"NaN",number:"عدد",array:"آرایه"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`ورودی نامعتبر: می‌بایست instanceof ${v.expected} می‌بود، ${U} دریافت شد`;return`ورودی نامعتبر: می‌بایست ${w} می‌بود، ${U} دریافت شد`}case"invalid_value":if(v.values.length===1)return`ورودی نامعتبر: می‌بایست ${V(v.values[0])} می‌بود`;return`گزینه نامعتبر: می‌بایست یکی از ${I(v.values,"|")} می‌بود`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`خیلی بزرگ: ${v.origin??"مقدار"} باید ${w}${v.maximum.toString()} ${_.unit??"عنصر"} باشد`;return`خیلی بزرگ: ${v.origin??"مقدار"} باید ${w}${v.maximum.toString()} باشد`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`خیلی کوچک: ${v.origin} باید ${w}${v.minimum.toString()} ${_.unit} باشد`;return`خیلی کوچک: ${v.origin} باید ${w}${v.minimum.toString()} باشد`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`رشته نامعتبر: باید با "${w.prefix}" شروع شود`;if(w.format==="ends_with")return`رشته نامعتبر: باید با "${w.suffix}" تمام شود`;if(w.format==="includes")return`رشته نامعتبر: باید شامل "${w.includes}" باشد`;if(w.format==="regex")return`رشته نامعتبر: باید با الگوی ${w.pattern} مطابقت داشته باشد`;return`${$[w.format]??v.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${v.divisor} باشد`;case"unrecognized_keys":return`کلید${v.keys.length>1?"های":""} ناشناس: ${I(v.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${v.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${v.origin}`;default:return"ورودی نامعتبر"}}};function U1(){return{localeError:ZQ()}}var rQ=()=>{let n={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function i(v){return n[v]??null}let $={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Virheellinen tyyppi: odotettiin instanceof ${v.expected}, oli ${U}`;return`Virheellinen tyyppi: odotettiin ${w}, oli ${U}`}case"invalid_value":if(v.values.length===1)return`Virheellinen syöte: täytyy olla ${V(v.values[0])}`;return`Virheellinen valinta: täytyy olla yksi seuraavista: ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`Liian suuri: ${_.subject} täytyy olla ${w}${v.maximum.toString()} ${_.unit}`.trim();return`Liian suuri: arvon täytyy olla ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`Liian pieni: ${_.subject} täytyy olla ${w}${v.minimum.toString()} ${_.unit}`.trim();return`Liian pieni: arvon täytyy olla ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Virheellinen syöte: täytyy alkaa "${w.prefix}"`;if(w.format==="ends_with")return`Virheellinen syöte: täytyy loppua "${w.suffix}"`;if(w.format==="includes")return`Virheellinen syöte: täytyy sisältää "${w.includes}"`;if(w.format==="regex")return`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${w.pattern}`;return`Virheellinen ${$[w.format]??v.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${v.divisor} monikerta`;case"unrecognized_keys":return`${v.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${I(v.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function k1(){return{localeError:rQ()}}var mQ=()=>{let n={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function i(v){return n[v]??null}let $={regex:"entrée",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},g={nan:"NaN",number:"nombre",array:"tableau"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Entrée invalide : instanceof ${v.expected} attendu, ${U} reçu`;return`Entrée invalide : ${w} attendu, ${U} reçu`}case"invalid_value":if(v.values.length===1)return`Entrée invalide : ${V(v.values[0])} attendu`;return`Option invalide : une valeur parmi ${I(v.values,"|")} attendue`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`Trop grand : ${v.origin??"valeur"} doit ${_.verb} ${w}${v.maximum.toString()} ${_.unit??"élément(s)"}`;return`Trop grand : ${v.origin??"valeur"} doit être ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`Trop petit : ${v.origin} doit ${_.verb} ${w}${v.minimum.toString()} ${_.unit}`;return`Trop petit : ${v.origin} doit être ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Chaîne invalide : doit commencer par "${w.prefix}"`;if(w.format==="ends_with")return`Chaîne invalide : doit se terminer par "${w.suffix}"`;if(w.format==="includes")return`Chaîne invalide : doit inclure "${w.includes}"`;if(w.format==="regex")return`Chaîne invalide : doit correspondre au modèle ${w.pattern}`;return`${$[w.format]??v.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${v.divisor}`;case"unrecognized_keys":return`Clé${v.keys.length>1?"s":""} non reconnue${v.keys.length>1?"s":""} : ${I(v.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${v.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${v.origin}`;default:return"Entrée invalide"}}};function l1(){return{localeError:mQ()}}var yQ=()=>{let n={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function i(v){return n[v]??null}let $={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Entrée invalide : attendu instanceof ${v.expected}, reçu ${U}`;return`Entrée invalide : attendu ${w}, reçu ${U}`}case"invalid_value":if(v.values.length===1)return`Entrée invalide : attendu ${V(v.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"≤":"<",_=i(v.origin);if(_)return`Trop grand : attendu que ${v.origin??"la valeur"} ait ${w}${v.maximum.toString()} ${_.unit}`;return`Trop grand : attendu que ${v.origin??"la valeur"} soit ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?"≥":">",_=i(v.origin);if(_)return`Trop petit : attendu que ${v.origin} ait ${w}${v.minimum.toString()} ${_.unit}`;return`Trop petit : attendu que ${v.origin} soit ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Chaîne invalide : doit commencer par "${w.prefix}"`;if(w.format==="ends_with")return`Chaîne invalide : doit se terminer par "${w.suffix}"`;if(w.format==="includes")return`Chaîne invalide : doit inclure "${w.includes}"`;if(w.format==="regex")return`Chaîne invalide : doit correspondre au motif ${w.pattern}`;return`${$[w.format]??v.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${v.divisor}`;case"unrecognized_keys":return`Clé${v.keys.length>1?"s":""} non reconnue${v.keys.length>1?"s":""} : ${I(v.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${v.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${v.origin}`;default:return"Entrée invalide"}}};function D1(){return{localeError:yQ()}}var dQ=()=>{let n={string:{label:"מחרוזת",gender:"f"},number:{label:"מספר",gender:"m"},boolean:{label:"ערך בוליאני",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"תאריך",gender:"m"},array:{label:"מערך",gender:"m"},object:{label:"אובייקט",gender:"m"},null:{label:"ערך ריק (null)",gender:"m"},undefined:{label:"ערך לא מוגדר (undefined)",gender:"m"},symbol:{label:"סימבול (Symbol)",gender:"m"},function:{label:"פונקציה",gender:"f"},map:{label:"מפה (Map)",gender:"f"},set:{label:"קבוצה (Set)",gender:"f"},file:{label:"קובץ",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"ערך לא ידוע",gender:"m"},value:{label:"ערך",gender:"m"}},i={string:{unit:"תווים",shortLabel:"קצר",longLabel:"ארוך"},file:{unit:"בייטים",shortLabel:"קטן",longLabel:"גדול"},array:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},set:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},number:{unit:"",shortLabel:"קטן",longLabel:"גדול"}},$=(l)=>l?n[l]:void 0,g=(l)=>{let J=$(l);if(J)return J.label;return l??n.unknown.label},v=(l)=>`ה${g(l)}`,w=(l)=>{return($(l)?.gender??"m")==="f"?"צריכה להיות":"צריך להיות"},_=(l)=>{if(!l)return null;return i[l]??null},U={regex:{label:"קלט",gender:"m"},email:{label:"כתובת אימייל",gender:"f"},url:{label:"כתובת רשת",gender:"f"},emoji:{label:"אימוג'י",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"תאריך וזמן ISO",gender:"m"},date:{label:"תאריך ISO",gender:"m"},time:{label:"זמן ISO",gender:"m"},duration:{label:"משך זמן ISO",gender:"m"},ipv4:{label:"כתובת IPv4",gender:"f"},ipv6:{label:"כתובת IPv6",gender:"f"},cidrv4:{label:"טווח IPv4",gender:"m"},cidrv6:{label:"טווח IPv6",gender:"m"},base64:{label:"מחרוזת בבסיס 64",gender:"f"},base64url:{label:"מחרוזת בבסיס 64 לכתובות רשת",gender:"f"},json_string:{label:"מחרוזת JSON",gender:"f"},e164:{label:"מספר E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"קלט",gender:"m"},includes:{label:"קלט",gender:"m"},lowercase:{label:"קלט",gender:"m"},starts_with:{label:"קלט",gender:"m"},uppercase:{label:"קלט",gender:"m"}},k={nan:"NaN"};return(l)=>{switch(l.code){case"invalid_type":{let J=l.expected,Q=k[J??""]??g(J),j=L(l.input),u=k[j]??n[j]?.label??j;if(/^[A-Z]/.test(l.expected))return`קלט לא תקין: צריך להיות instanceof ${l.expected}, התקבל ${u}`;return`קלט לא תקין: צריך להיות ${Q}, התקבל ${u}`}case"invalid_value":{if(l.values.length===1)return`ערך לא תקין: הערך חייב להיות ${V(l.values[0])}`;let J=l.values.map((u)=>V(u));if(l.values.length===2)return`ערך לא תקין: האפשרויות המתאימות הן ${J[0]} או ${J[1]}`;let Q=J[J.length-1];return`ערך לא תקין: האפשרויות המתאימות הן ${J.slice(0,-1).join(", ")} או ${Q}`}case"too_big":{let J=_(l.origin),Q=v(l.origin??"value");if(l.origin==="string")return`${J?.longLabel??"ארוך"} מדי: ${Q} צריכה להכיל ${l.maximum.toString()} ${J?.unit??""} ${l.inclusive?"או פחות":"לכל היותר"}`.trim();if(l.origin==="number"){let W=l.inclusive?`קטן או שווה ל-${l.maximum}`:`קטן מ-${l.maximum}`;return`גדול מדי: ${Q} צריך להיות ${W}`}if(l.origin==="array"||l.origin==="set"){let W=l.origin==="set"?"צריכה":"צריך",Y=l.inclusive?`${l.maximum} ${J?.unit??""} או פחות`:`פחות מ-${l.maximum} ${J?.unit??""}`;return`גדול מדי: ${Q} ${W} להכיל ${Y}`.trim()}let j=l.inclusive?"<=":"<",u=w(l.origin??"value");if(J?.unit)return`${J.longLabel} מדי: ${Q} ${u} ${j}${l.maximum.toString()} ${J.unit}`;return`${J?.longLabel??"גדול"} מדי: ${Q} ${u} ${j}${l.maximum.toString()}`}case"too_small":{let J=_(l.origin),Q=v(l.origin??"value");if(l.origin==="string")return`${J?.shortLabel??"קצר"} מדי: ${Q} צריכה להכיל ${l.minimum.toString()} ${J?.unit??""} ${l.inclusive?"או יותר":"לפחות"}`.trim();if(l.origin==="number"){let W=l.inclusive?`גדול או שווה ל-${l.minimum}`:`גדול מ-${l.minimum}`;return`קטן מדי: ${Q} צריך להיות ${W}`}if(l.origin==="array"||l.origin==="set"){let W=l.origin==="set"?"צריכה":"צריך";if(l.minimum===1&&l.inclusive){let B=l.origin==="set"?"לפחות פריט אחד":"לפחות פריט אחד";return`קטן מדי: ${Q} ${W} להכיל ${B}`}let Y=l.inclusive?`${l.minimum} ${J?.unit??""} או יותר`:`יותר מ-${l.minimum} ${J?.unit??""}`;return`קטן מדי: ${Q} ${W} להכיל ${Y}`.trim()}let j=l.inclusive?">=":">",u=w(l.origin??"value");if(J?.unit)return`${J.shortLabel} מדי: ${Q} ${u} ${j}${l.minimum.toString()} ${J.unit}`;return`${J?.shortLabel??"קטן"} מדי: ${Q} ${u} ${j}${l.minimum.toString()}`}case"invalid_format":{let J=l;if(J.format==="starts_with")return`המחרוזת חייבת להתחיל ב "${J.prefix}"`;if(J.format==="ends_with")return`המחרוזת חייבת להסתיים ב "${J.suffix}"`;if(J.format==="includes")return`המחרוזת חייבת לכלול "${J.includes}"`;if(J.format==="regex")return`המחרוזת חייבת להתאים לתבנית ${J.pattern}`;let Q=U[J.format],j=Q?.label??J.format,W=(Q?.gender??"m")==="f"?"תקינה":"תקין";return`${j} לא ${W}`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${l.divisor}`;case"unrecognized_keys":return`מפתח${l.keys.length>1?"ות":""} לא מזוה${l.keys.length>1?"ים":"ה"}: ${I(l.keys,", ")}`;case"invalid_key":return"שדה לא תקין באובייקט";case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${v(l.origin??"array")}`;default:return"קלט לא תקין"}}};function J1(){return{localeError:dQ()}}var eQ=()=>{let n={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function i(v){return n[v]??null}let $={regex:"bemenet",email:"email cím",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"},g={nan:"NaN",number:"szám",array:"tömb"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Érvénytelen bemenet: a várt érték instanceof ${v.expected}, a kapott érték ${U}`;return`Érvénytelen bemenet: a várt érték ${w}, a kapott érték ${U}`}case"invalid_value":if(v.values.length===1)return`Érvénytelen bemenet: a várt érték ${V(v.values[0])}`;return`Érvénytelen opció: valamelyik érték várt ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`Túl nagy: ${v.origin??"érték"} mérete túl nagy ${w}${v.maximum.toString()} ${_.unit??"elem"}`;return`Túl nagy: a bemeneti érték ${v.origin??"érték"} túl nagy: ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`Túl kicsi: a bemeneti érték ${v.origin} mérete túl kicsi ${w}${v.minimum.toString()} ${_.unit}`;return`Túl kicsi: a bemeneti érték ${v.origin} túl kicsi ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Érvénytelen string: "${w.prefix}" értékkel kell kezdődnie`;if(w.format==="ends_with")return`Érvénytelen string: "${w.suffix}" értékkel kell végződnie`;if(w.format==="includes")return`Érvénytelen string: "${w.includes}" értéket kell tartalmaznia`;if(w.format==="regex")return`Érvénytelen string: ${w.pattern} mintának kell megfelelnie`;return`Érvénytelen ${$[w.format]??v.format}`}case"not_multiple_of":return`Érvénytelen szám: ${v.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${v.keys.length>1?"s":""}: ${I(v.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${v.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${v.origin}`;default:return"Érvénytelen bemenet"}}};function X1(){return{localeError:eQ()}}function wl(n,i,$){return Math.abs(n)===1?i:$}function mi(n){if(!n)return"";let i=["ա","ե","ը","ի","ո","ու","օ"],$=n[n.length-1];return n+(i.includes($)?"ն":"ը")}var pQ=()=>{let n={string:{unit:{one:"նշան",many:"նշաններ"},verb:"ունենալ"},file:{unit:{one:"բայթ",many:"բայթեր"},verb:"ունենալ"},array:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"},set:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"}};function i(v){return n[v]??null}let $={regex:"մուտք",email:"էլ. հասցե",url:"URL",emoji:"էմոջի",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ամսաթիվ և ժամ",date:"ISO ամսաթիվ",time:"ISO ժամ",duration:"ISO տևողություն",ipv4:"IPv4 հասցե",ipv6:"IPv6 հասցե",cidrv4:"IPv4 միջակայք",cidrv6:"IPv6 միջակայք",base64:"base64 ձևաչափով տող",base64url:"base64url ձևաչափով տող",json_string:"JSON տող",e164:"E.164 համար",jwt:"JWT",template_literal:"մուտք"},g={nan:"NaN",number:"թիվ",array:"զանգված"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Սխալ մուտքագրում․ սպասվում էր instanceof ${v.expected}, ստացվել է ${U}`;return`Սխալ մուտքագրում․ սպասվում էր ${w}, ստացվել է ${U}`}case"invalid_value":if(v.values.length===1)return`Սխալ մուտքագրում․ սպասվում էր ${V(v.values[1])}`;return`Սխալ տարբերակ․ սպասվում էր հետևյալներից մեկը՝ ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_){let U=Number(v.maximum),k=wl(U,_.unit.one,_.unit.many);return`Չափազանց մեծ արժեք․ սպասվում է, որ ${mi(v.origin??"արժեք")} կունենա ${w}${v.maximum.toString()} ${k}`}return`Չափազանց մեծ արժեք․ սպասվում է, որ ${mi(v.origin??"արժեք")} լինի ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_){let U=Number(v.minimum),k=wl(U,_.unit.one,_.unit.many);return`Չափազանց փոքր արժեք․ սպասվում է, որ ${mi(v.origin)} կունենա ${w}${v.minimum.toString()} ${k}`}return`Չափազանց փոքր արժեք․ սպասվում է, որ ${mi(v.origin)} լինի ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Սխալ տող․ պետք է սկսվի "${w.prefix}"-ով`;if(w.format==="ends_with")return`Սխալ տող․ պետք է ավարտվի "${w.suffix}"-ով`;if(w.format==="includes")return`Սխալ տող․ պետք է պարունակի "${w.includes}"`;if(w.format==="regex")return`Սխալ տող․ պետք է համապատասխանի ${w.pattern} ձևաչափին`;return`Սխալ ${$[w.format]??v.format}`}case"not_multiple_of":return`Սխալ թիվ․ պետք է բազմապատիկ լինի ${v.divisor}-ի`;case"unrecognized_keys":return`Չճանաչված բանալի${v.keys.length>1?"ներ":""}. ${I(v.keys,", ")}`;case"invalid_key":return`Սխալ բանալի ${mi(v.origin)}-ում`;case"invalid_union":return"Սխալ մուտքագրում";case"invalid_element":return`Սխալ արժեք ${mi(v.origin)}-ում`;default:return"Սխալ մուտքագրում"}}};function G1(){return{localeError:pQ()}}var aQ=()=>{let n={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function i(v){return n[v]??null}let $={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Input tidak valid: diharapkan instanceof ${v.expected}, diterima ${U}`;return`Input tidak valid: diharapkan ${w}, diterima ${U}`}case"invalid_value":if(v.values.length===1)return`Input tidak valid: diharapkan ${V(v.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`Terlalu besar: diharapkan ${v.origin??"value"} memiliki ${w}${v.maximum.toString()} ${_.unit??"elemen"}`;return`Terlalu besar: diharapkan ${v.origin??"value"} menjadi ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`Terlalu kecil: diharapkan ${v.origin} memiliki ${w}${v.minimum.toString()} ${_.unit}`;return`Terlalu kecil: diharapkan ${v.origin} menjadi ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`String tidak valid: harus dimulai dengan "${w.prefix}"`;if(w.format==="ends_with")return`String tidak valid: harus berakhir dengan "${w.suffix}"`;if(w.format==="includes")return`String tidak valid: harus menyertakan "${w.includes}"`;if(w.format==="regex")return`String tidak valid: harus sesuai pola ${w.pattern}`;return`${$[w.format]??v.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${v.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${v.keys.length>1?"s":""}: ${I(v.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${v.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${v.origin}`;default:return"Input tidak valid"}}};function t1(){return{localeError:aQ()}}var sQ=()=>{let n={string:{unit:"stafi",verb:"að hafa"},file:{unit:"bæti",verb:"að hafa"},array:{unit:"hluti",verb:"að hafa"},set:{unit:"hluti",verb:"að hafa"}};function i(v){return n[v]??null}let $={regex:"gildi",email:"netfang",url:"vefslóð",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og tími",date:"ISO dagsetning",time:"ISO tími",duration:"ISO tímalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 tölugildi",jwt:"JWT",template_literal:"gildi"},g={nan:"NaN",number:"númer",array:"fylki"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Rangt gildi: Þú slóst inn ${U} þar sem á að vera instanceof ${v.expected}`;return`Rangt gildi: Þú slóst inn ${U} þar sem á að vera ${w}`}case"invalid_value":if(v.values.length===1)return`Rangt gildi: gert ráð fyrir ${V(v.values[0])}`;return`Ógilt val: má vera eitt af eftirfarandi ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`Of stórt: gert er ráð fyrir að ${v.origin??"gildi"} hafi ${w}${v.maximum.toString()} ${_.unit??"hluti"}`;return`Of stórt: gert er ráð fyrir að ${v.origin??"gildi"} sé ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`Of lítið: gert er ráð fyrir að ${v.origin} hafi ${w}${v.minimum.toString()} ${_.unit}`;return`Of lítið: gert er ráð fyrir að ${v.origin} sé ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Ógildur strengur: verður að byrja á "${w.prefix}"`;if(w.format==="ends_with")return`Ógildur strengur: verður að enda á "${w.suffix}"`;if(w.format==="includes")return`Ógildur strengur: verður að innihalda "${w.includes}"`;if(w.format==="regex")return`Ógildur strengur: verður að fylgja mynstri ${w.pattern}`;return`Rangt ${$[w.format]??v.format}`}case"not_multiple_of":return`Röng tala: verður að vera margfeldi af ${v.divisor}`;case"unrecognized_keys":return`Óþekkt ${v.keys.length>1?"ir lyklar":"ur lykill"}: ${I(v.keys,", ")}`;case"invalid_key":return`Rangur lykill í ${v.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi í ${v.origin}`;default:return"Rangt gildi"}}};function Q1(){return{localeError:sQ()}}var n9=()=>{let n={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function i(v){return n[v]??null}let $={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},g={nan:"NaN",number:"numero",array:"vettore"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Input non valido: atteso instanceof ${v.expected}, ricevuto ${U}`;return`Input non valido: atteso ${w}, ricevuto ${U}`}case"invalid_value":if(v.values.length===1)return`Input non valido: atteso ${V(v.values[0])}`;return`Opzione non valida: atteso uno tra ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`Troppo grande: ${v.origin??"valore"} deve avere ${w}${v.maximum.toString()} ${_.unit??"elementi"}`;return`Troppo grande: ${v.origin??"valore"} deve essere ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`Troppo piccolo: ${v.origin} deve avere ${w}${v.minimum.toString()} ${_.unit}`;return`Troppo piccolo: ${v.origin} deve essere ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Stringa non valida: deve iniziare con "${w.prefix}"`;if(w.format==="ends_with")return`Stringa non valida: deve terminare con "${w.suffix}"`;if(w.format==="includes")return`Stringa non valida: deve includere "${w.includes}"`;if(w.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${w.pattern}`;return`Invalid ${$[w.format]??v.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${v.divisor}`;case"unrecognized_keys":return`Chiav${v.keys.length>1?"i":"e"} non riconosciut${v.keys.length>1?"e":"a"}: ${I(v.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${v.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${v.origin}`;default:return"Input non valido"}}};function W1(){return{localeError:n9()}}var v9=()=>{let n={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function i(v){return n[v]??null}let $={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"},g={nan:"NaN",number:"数値",array:"配列"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`無効な入力: instanceof ${v.expected}が期待されましたが、${U}が入力されました`;return`無効な入力: ${w}が期待されましたが、${U}が入力されました`}case"invalid_value":if(v.values.length===1)return`無効な入力: ${V(v.values[0])}が期待されました`;return`無効な選択: ${I(v.values,"、")}のいずれかである必要があります`;case"too_big":{let w=v.inclusive?"以下である":"より小さい",_=i(v.origin);if(_)return`大きすぎる値: ${v.origin??"値"}は${v.maximum.toString()}${_.unit??"要素"}${w}必要があります`;return`大きすぎる値: ${v.origin??"値"}は${v.maximum.toString()}${w}必要があります`}case"too_small":{let w=v.inclusive?"以上である":"より大きい",_=i(v.origin);if(_)return`小さすぎる値: ${v.origin}は${v.minimum.toString()}${_.unit}${w}必要があります`;return`小さすぎる値: ${v.origin}は${v.minimum.toString()}${w}必要があります`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`無効な文字列: "${w.prefix}"で始まる必要があります`;if(w.format==="ends_with")return`無効な文字列: "${w.suffix}"で終わる必要があります`;if(w.format==="includes")return`無効な文字列: "${w.includes}"を含む必要があります`;if(w.format==="regex")return`無効な文字列: パターン${w.pattern}に一致する必要があります`;return`無効な${$[w.format]??v.format}`}case"not_multiple_of":return`無効な数値: ${v.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${v.keys.length>1?"群":""}: ${I(v.keys,"、")}`;case"invalid_key":return`${v.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${v.origin}内の無効な値`;default:return"無効な入力"}}};function Y1(){return{localeError:v9()}}var i9=()=>{let n={string:{unit:"სიმბოლო",verb:"უნდა შეიცავდეს"},file:{unit:"ბაიტი",verb:"უნდა შეიცავდეს"},array:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},set:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"}};function i(v){return n[v]??null}let $={regex:"შეყვანა",email:"ელ-ფოსტის მისამართი",url:"URL",emoji:"ემოჯი",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"თარიღი-დრო",date:"თარიღი",time:"დრო",duration:"ხანგრძლივობა",ipv4:"IPv4 მისამართი",ipv6:"IPv6 მისამართი",cidrv4:"IPv4 დიაპაზონი",cidrv6:"IPv6 დიაპაზონი",base64:"base64-კოდირებული სტრინგი",base64url:"base64url-კოდირებული სტრინგი",json_string:"JSON სტრინგი",e164:"E.164 ნომერი",jwt:"JWT",template_literal:"შეყვანა"},g={nan:"NaN",number:"რიცხვი",string:"სტრინგი",boolean:"ბულეანი",function:"ფუნქცია",array:"მასივი"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`არასწორი შეყვანა: მოსალოდნელი instanceof ${v.expected}, მიღებული ${U}`;return`არასწორი შეყვანა: მოსალოდნელი ${w}, მიღებული ${U}`}case"invalid_value":if(v.values.length===1)return`არასწორი შეყვანა: მოსალოდნელი ${V(v.values[0])}`;return`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${I(v.values,"|")}-დან`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`ზედმეტად დიდი: მოსალოდნელი ${v.origin??"მნიშვნელობა"} ${_.verb} ${w}${v.maximum.toString()} ${_.unit}`;return`ზედმეტად დიდი: მოსალოდნელი ${v.origin??"მნიშვნელობა"} იყოს ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`ზედმეტად პატარა: მოსალოდნელი ${v.origin} ${_.verb} ${w}${v.minimum.toString()} ${_.unit}`;return`ზედმეტად პატარა: მოსალოდნელი ${v.origin} იყოს ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`არასწორი სტრინგი: უნდა იწყებოდეს "${w.prefix}"-ით`;if(w.format==="ends_with")return`არასწორი სტრინგი: უნდა მთავრდებოდეს "${w.suffix}"-ით`;if(w.format==="includes")return`არასწორი სტრინგი: უნდა შეიცავდეს "${w.includes}"-ს`;if(w.format==="regex")return`არასწორი სტრინგი: უნდა შეესაბამებოდეს შაბლონს ${w.pattern}`;return`არასწორი ${$[w.format]??v.format}`}case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${v.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${v.keys.length>1?"ები":"ი"}: ${I(v.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${v.origin}-ში`;case"invalid_union":return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${v.origin}-ში`;default:return"არასწორი შეყვანა"}}};function I1(){return{localeError:i9()}}var $9=()=>{let n={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function i(v){return n[v]??null}let $={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"},g={nan:"NaN",number:"លេខ",array:"អារេ (Array)",null:"គ្មានតម្លៃ (null)"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ instanceof ${v.expected} ប៉ុន្តែទទួលបាន ${U}`;return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${w} ប៉ុន្តែទទួលបាន ${U}`}case"invalid_value":if(v.values.length===1)return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${V(v.values[0])}`;return`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`ធំពេក៖ ត្រូវការ ${v.origin??"តម្លៃ"} ${w} ${v.maximum.toString()} ${_.unit??"ធាតុ"}`;return`ធំពេក៖ ត្រូវការ ${v.origin??"តម្លៃ"} ${w} ${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`តូចពេក៖ ត្រូវការ ${v.origin} ${w} ${v.minimum.toString()} ${_.unit}`;return`តូចពេក៖ ត្រូវការ ${v.origin} ${w} ${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${w.prefix}"`;if(w.format==="ends_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${w.suffix}"`;if(w.format==="includes")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${w.includes}"`;if(w.format==="regex")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${w.pattern}`;return`មិនត្រឹមត្រូវ៖ ${$[w.format]??v.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${v.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${I(v.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${v.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${v.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function tg(){return{localeError:$9()}}function j1(){return tg()}var g9=()=>{let n={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function i(v){return n[v]??null}let $={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`잘못된 입력: 예상 타입은 instanceof ${v.expected}, 받은 타입은 ${U}입니다`;return`잘못된 입력: 예상 타입은 ${w}, 받은 타입은 ${U}입니다`}case"invalid_value":if(v.values.length===1)return`잘못된 입력: 값은 ${V(v.values[0])} 이어야 합니다`;return`잘못된 옵션: ${I(v.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{let w=v.inclusive?"이하":"미만",_=w==="미만"?"이어야 합니다":"여야 합니다",U=i(v.origin),k=U?.unit??"요소";if(U)return`${v.origin??"값"}이 너무 큽니다: ${v.maximum.toString()}${k} ${w}${_}`;return`${v.origin??"값"}이 너무 큽니다: ${v.maximum.toString()} ${w}${_}`}case"too_small":{let w=v.inclusive?"이상":"초과",_=w==="이상"?"이어야 합니다":"여야 합니다",U=i(v.origin),k=U?.unit??"요소";if(U)return`${v.origin??"값"}이 너무 작습니다: ${v.minimum.toString()}${k} ${w}${_}`;return`${v.origin??"값"}이 너무 작습니다: ${v.minimum.toString()} ${w}${_}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`잘못된 문자열: "${w.prefix}"(으)로 시작해야 합니다`;if(w.format==="ends_with")return`잘못된 문자열: "${w.suffix}"(으)로 끝나야 합니다`;if(w.format==="includes")return`잘못된 문자열: "${w.includes}"을(를) 포함해야 합니다`;if(w.format==="regex")return`잘못된 문자열: 정규식 ${w.pattern} 패턴과 일치해야 합니다`;return`잘못된 ${$[w.format]??v.format}`}case"not_multiple_of":return`잘못된 숫자: ${v.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${I(v.keys,", ")}`;case"invalid_key":return`잘못된 키: ${v.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${v.origin}`;default:return"잘못된 입력"}}};function u1(){return{localeError:g9()}}var Qg=(n)=>{return n.charAt(0).toUpperCase()+n.slice(1)};function _l(n){let i=Math.abs(n),$=i%10,g=i%100;if(g>=11&&g<=19||$===0)return"many";if($===1)return"one";return"few"}var w9=()=>{let n={string:{unit:{one:"simbolis",few:"simboliai",many:"simbolių"},verb:{smaller:{inclusive:"turi būti ne ilgesnė kaip",notInclusive:"turi būti trumpesnė kaip"},bigger:{inclusive:"turi būti ne trumpesnė kaip",notInclusive:"turi būti ilgesnė kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"baitų"},verb:{smaller:{inclusive:"turi būti ne didesnis kaip",notInclusive:"turi būti mažesnis kaip"},bigger:{inclusive:"turi būti ne mažesnis kaip",notInclusive:"turi būti didesnis kaip"}}},array:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}},set:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}}};function i(v,w,_,U){let k=n[v]??null;if(k===null)return k;return{unit:k.unit[w],verb:k.verb[U][_?"inclusive":"notInclusive"]}}let $={regex:"įvestis",email:"el. pašto adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukmė",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 užkoduota eilutė",base64url:"base64url užkoduota eilutė",json_string:"JSON eilutė",e164:"E.164 numeris",jwt:"JWT",template_literal:"įvestis"},g={nan:"NaN",number:"skaičius",bigint:"sveikasis skaičius",string:"eilutė",boolean:"loginė reikšmė",undefined:"neapibrėžta reikšmė",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulinė reikšmė"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Gautas tipas ${U}, o tikėtasi - instanceof ${v.expected}`;return`Gautas tipas ${U}, o tikėtasi - ${w}`}case"invalid_value":if(v.values.length===1)return`Privalo būti ${V(v.values[0])}`;return`Privalo būti vienas iš ${I(v.values,"|")} pasirinkimų`;case"too_big":{let w=g[v.origin]??v.origin,_=i(v.origin,_l(Number(v.maximum)),v.inclusive??!1,"smaller");if(_?.verb)return`${Qg(w??v.origin??"reikšmė")} ${_.verb} ${v.maximum.toString()} ${_.unit??"elementų"}`;let U=v.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${Qg(w??v.origin??"reikšmė")} turi būti ${U} ${v.maximum.toString()} ${_?.unit}`}case"too_small":{let w=g[v.origin]??v.origin,_=i(v.origin,_l(Number(v.minimum)),v.inclusive??!1,"bigger");if(_?.verb)return`${Qg(w??v.origin??"reikšmė")} ${_.verb} ${v.minimum.toString()} ${_.unit??"elementų"}`;let U=v.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${Qg(w??v.origin??"reikšmė")} turi būti ${U} ${v.minimum.toString()} ${_?.unit}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Eilutė privalo prasidėti "${w.prefix}"`;if(w.format==="ends_with")return`Eilutė privalo pasibaigti "${w.suffix}"`;if(w.format==="includes")return`Eilutė privalo įtraukti "${w.includes}"`;if(w.format==="regex")return`Eilutė privalo atitikti ${w.pattern}`;return`Neteisingas ${$[w.format]??v.format}`}case"not_multiple_of":return`Skaičius privalo būti ${v.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${v.keys.length>1?"i":"as"} rakt${v.keys.length>1?"ai":"as"}: ${I(v.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga įvestis";case"invalid_element":{let w=g[v.origin]??v.origin;return`${Qg(w??v.origin??"reikšmė")} turi klaidingą įvestį`}default:return"Klaidinga įvestis"}}};function H1(){return{localeError:w9()}}var _9=()=>{let n={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function i(v){return n[v]??null}let $={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"},g={nan:"NaN",number:"број",array:"низа"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Грешен внес: се очекува instanceof ${v.expected}, примено ${U}`;return`Грешен внес: се очекува ${w}, примено ${U}`}case"invalid_value":if(v.values.length===1)return`Invalid input: expected ${V(v.values[0])}`;return`Грешана опција: се очекува една ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`Премногу голем: се очекува ${v.origin??"вредноста"} да има ${w}${v.maximum.toString()} ${_.unit??"елементи"}`;return`Премногу голем: се очекува ${v.origin??"вредноста"} да биде ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`Премногу мал: се очекува ${v.origin} да има ${w}${v.minimum.toString()} ${_.unit}`;return`Премногу мал: се очекува ${v.origin} да биде ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Неважечка низа: мора да започнува со "${w.prefix}"`;if(w.format==="ends_with")return`Неважечка низа: мора да завршува со "${w.suffix}"`;if(w.format==="includes")return`Неважечка низа: мора да вклучува "${w.includes}"`;if(w.format==="regex")return`Неважечка низа: мора да одгоара на патернот ${w.pattern}`;return`Invalid ${$[w.format]??v.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${v.divisor}`;case"unrecognized_keys":return`${v.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${I(v.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${v.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${v.origin}`;default:return"Грешен внес"}}};function V1(){return{localeError:_9()}}var b9=()=>{let n={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function i(v){return n[v]??null}let $={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},g={nan:"NaN",number:"nombor"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Input tidak sah: dijangka instanceof ${v.expected}, diterima ${U}`;return`Input tidak sah: dijangka ${w}, diterima ${U}`}case"invalid_value":if(v.values.length===1)return`Input tidak sah: dijangka ${V(v.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`Terlalu besar: dijangka ${v.origin??"nilai"} ${_.verb} ${w}${v.maximum.toString()} ${_.unit??"elemen"}`;return`Terlalu besar: dijangka ${v.origin??"nilai"} adalah ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`Terlalu kecil: dijangka ${v.origin} ${_.verb} ${w}${v.minimum.toString()} ${_.unit}`;return`Terlalu kecil: dijangka ${v.origin} adalah ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`String tidak sah: mesti bermula dengan "${w.prefix}"`;if(w.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${w.suffix}"`;if(w.format==="includes")return`String tidak sah: mesti mengandungi "${w.includes}"`;if(w.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${w.pattern}`;return`${$[w.format]??v.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${v.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${I(v.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${v.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${v.origin}`;default:return"Input tidak sah"}}};function f1(){return{localeError:b9()}}var U9=()=>{let n={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function i(v){return n[v]??null}let $={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},g={nan:"NaN",number:"getal"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Ongeldige invoer: verwacht instanceof ${v.expected}, ontving ${U}`;return`Ongeldige invoer: verwacht ${w}, ontving ${U}`}case"invalid_value":if(v.values.length===1)return`Ongeldige invoer: verwacht ${V(v.values[0])}`;return`Ongeldige optie: verwacht één van ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin),U=v.origin==="date"?"laat":v.origin==="string"?"lang":"groot";if(_)return`Te ${U}: verwacht dat ${v.origin??"waarde"} ${w}${v.maximum.toString()} ${_.unit??"elementen"} ${_.verb}`;return`Te ${U}: verwacht dat ${v.origin??"waarde"} ${w}${v.maximum.toString()} is`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin),U=v.origin==="date"?"vroeg":v.origin==="string"?"kort":"klein";if(_)return`Te ${U}: verwacht dat ${v.origin} ${w}${v.minimum.toString()} ${_.unit} ${_.verb}`;return`Te ${U}: verwacht dat ${v.origin} ${w}${v.minimum.toString()} is`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Ongeldige tekst: moet met "${w.prefix}" beginnen`;if(w.format==="ends_with")return`Ongeldige tekst: moet op "${w.suffix}" eindigen`;if(w.format==="includes")return`Ongeldige tekst: moet "${w.includes}" bevatten`;if(w.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${w.pattern}`;return`Ongeldig: ${$[w.format]??v.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${v.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${v.keys.length>1?"s":""}: ${I(v.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${v.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${v.origin}`;default:return"Ongeldige invoer"}}};function q1(){return{localeError:U9()}}var k9=()=>{let n={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function i(v){return n[v]??null}let $={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},g={nan:"NaN",number:"tall",array:"liste"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Ugyldig input: forventet instanceof ${v.expected}, fikk ${U}`;return`Ugyldig input: forventet ${w}, fikk ${U}`}case"invalid_value":if(v.values.length===1)return`Ugyldig verdi: forventet ${V(v.values[0])}`;return`Ugyldig valg: forventet en av ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`For stor(t): forventet ${v.origin??"value"} til å ha ${w}${v.maximum.toString()} ${_.unit??"elementer"}`;return`For stor(t): forventet ${v.origin??"value"} til å ha ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`For lite(n): forventet ${v.origin} til å ha ${w}${v.minimum.toString()} ${_.unit}`;return`For lite(n): forventet ${v.origin} til å ha ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Ugyldig streng: må starte med "${w.prefix}"`;if(w.format==="ends_with")return`Ugyldig streng: må ende med "${w.suffix}"`;if(w.format==="includes")return`Ugyldig streng: må inneholde "${w.includes}"`;if(w.format==="regex")return`Ugyldig streng: må matche mønsteret ${w.pattern}`;return`Ugyldig ${$[w.format]??v.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${v.divisor}`;case"unrecognized_keys":return`${v.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${I(v.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${v.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${v.origin}`;default:return"Ugyldig input"}}};function L1(){return{localeError:k9()}}var l9=()=>{let n={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function i(v){return n[v]??null}let $={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"},g={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Fâsit giren: umulan instanceof ${v.expected}, alınan ${U}`;return`Fâsit giren: umulan ${w}, alınan ${U}`}case"invalid_value":if(v.values.length===1)return`Fâsit giren: umulan ${V(v.values[0])}`;return`Fâsit tercih: mûteberler ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`Fazla büyük: ${v.origin??"value"}, ${w}${v.maximum.toString()} ${_.unit??"elements"} sahip olmalıydı.`;return`Fazla büyük: ${v.origin??"value"}, ${w}${v.maximum.toString()} olmalıydı.`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`Fazla küçük: ${v.origin}, ${w}${v.minimum.toString()} ${_.unit} sahip olmalıydı.`;return`Fazla küçük: ${v.origin}, ${w}${v.minimum.toString()} olmalıydı.`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Fâsit metin: "${w.prefix}" ile başlamalı.`;if(w.format==="ends_with")return`Fâsit metin: "${w.suffix}" ile bitmeli.`;if(w.format==="includes")return`Fâsit metin: "${w.includes}" ihtivâ etmeli.`;if(w.format==="regex")return`Fâsit metin: ${w.pattern} nakşına uymalı.`;return`Fâsit ${$[w.format]??v.format}`}case"not_multiple_of":return`Fâsit sayı: ${v.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${v.keys.length>1?"s":""}: ${I(v.keys,", ")}`;case"invalid_key":return`${v.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${v.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function K1(){return{localeError:l9()}}var D9=()=>{let n={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function i(v){return n[v]??null}let $={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"},g={nan:"NaN",number:"عدد",array:"ارې"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`ناسم ورودي: باید instanceof ${v.expected} وای, مګر ${U} ترلاسه شو`;return`ناسم ورودي: باید ${w} وای, مګر ${U} ترلاسه شو`}case"invalid_value":if(v.values.length===1)return`ناسم ورودي: باید ${V(v.values[0])} وای`;return`ناسم انتخاب: باید یو له ${I(v.values,"|")} څخه وای`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`ډیر لوی: ${v.origin??"ارزښت"} باید ${w}${v.maximum.toString()} ${_.unit??"عنصرونه"} ولري`;return`ډیر لوی: ${v.origin??"ارزښت"} باید ${w}${v.maximum.toString()} وي`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`ډیر کوچنی: ${v.origin} باید ${w}${v.minimum.toString()} ${_.unit} ولري`;return`ډیر کوچنی: ${v.origin} باید ${w}${v.minimum.toString()} وي`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`ناسم متن: باید د "${w.prefix}" سره پیل شي`;if(w.format==="ends_with")return`ناسم متن: باید د "${w.suffix}" سره پای ته ورسيږي`;if(w.format==="includes")return`ناسم متن: باید "${w.includes}" ولري`;if(w.format==="regex")return`ناسم متن: باید د ${w.pattern} سره مطابقت ولري`;return`${$[w.format]??v.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${v.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${v.keys.length>1?"کلیډونه":"کلیډ"}: ${I(v.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${v.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${v.origin} کې`;default:return"ناسمه ورودي"}}};function O1(){return{localeError:D9()}}var J9=()=>{let n={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function i(v){return n[v]??null}let $={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"},g={nan:"NaN",number:"liczba",array:"tablica"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Nieprawidłowe dane wejściowe: oczekiwano instanceof ${v.expected}, otrzymano ${U}`;return`Nieprawidłowe dane wejściowe: oczekiwano ${w}, otrzymano ${U}`}case"invalid_value":if(v.values.length===1)return`Nieprawidłowe dane wejściowe: oczekiwano ${V(v.values[0])}`;return`Nieprawidłowa opcja: oczekiwano jednej z wartości ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`Za duża wartość: oczekiwano, że ${v.origin??"wartość"} będzie mieć ${w}${v.maximum.toString()} ${_.unit??"elementów"}`;return`Zbyt duż(y/a/e): oczekiwano, że ${v.origin??"wartość"} będzie wynosić ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`Za mała wartość: oczekiwano, że ${v.origin??"wartość"} będzie mieć ${w}${v.minimum.toString()} ${_.unit??"elementów"}`;return`Zbyt mał(y/a/e): oczekiwano, że ${v.origin??"wartość"} będzie wynosić ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Nieprawidłowy ciąg znaków: musi zaczynać się od "${w.prefix}"`;if(w.format==="ends_with")return`Nieprawidłowy ciąg znaków: musi kończyć się na "${w.suffix}"`;if(w.format==="includes")return`Nieprawidłowy ciąg znaków: musi zawierać "${w.includes}"`;if(w.format==="regex")return`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${w.pattern}`;return`Nieprawidłow(y/a/e) ${$[w.format]??v.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${v.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${v.keys.length>1?"s":""}: ${I(v.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${v.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${v.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function B1(){return{localeError:J9()}}var X9=()=>{let n={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function i(v){return n[v]??null}let $={regex:"padrão",email:"endereço de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},g={nan:"NaN",number:"número",null:"nulo"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Tipo inválido: esperado instanceof ${v.expected}, recebido ${U}`;return`Tipo inválido: esperado ${w}, recebido ${U}`}case"invalid_value":if(v.values.length===1)return`Entrada inválida: esperado ${V(v.values[0])}`;return`Opção inválida: esperada uma das ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`Muito grande: esperado que ${v.origin??"valor"} tivesse ${w}${v.maximum.toString()} ${_.unit??"elementos"}`;return`Muito grande: esperado que ${v.origin??"valor"} fosse ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`Muito pequeno: esperado que ${v.origin} tivesse ${w}${v.minimum.toString()} ${_.unit}`;return`Muito pequeno: esperado que ${v.origin} fosse ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Texto inválido: deve começar com "${w.prefix}"`;if(w.format==="ends_with")return`Texto inválido: deve terminar com "${w.suffix}"`;if(w.format==="includes")return`Texto inválido: deve incluir "${w.includes}"`;if(w.format==="regex")return`Texto inválido: deve corresponder ao padrão ${w.pattern}`;return`${$[w.format]??v.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${v.divisor}`;case"unrecognized_keys":return`Chave${v.keys.length>1?"s":""} desconhecida${v.keys.length>1?"s":""}: ${I(v.keys,", ")}`;case"invalid_key":return`Chave inválida em ${v.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${v.origin}`;default:return"Campo inválido"}}};function F1(){return{localeError:X9()}}function bl(n,i,$,g){let v=Math.abs(n),w=v%10,_=v%100;if(_>=11&&_<=19)return g;if(w===1)return i;if(w>=2&&w<=4)return $;return g}var G9=()=>{let n={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function i(v){return n[v]??null}let $={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"},g={nan:"NaN",number:"число",array:"массив"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Неверный ввод: ожидалось instanceof ${v.expected}, получено ${U}`;return`Неверный ввод: ожидалось ${w}, получено ${U}`}case"invalid_value":if(v.values.length===1)return`Неверный ввод: ожидалось ${V(v.values[0])}`;return`Неверный вариант: ожидалось одно из ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_){let U=Number(v.maximum),k=bl(U,_.unit.one,_.unit.few,_.unit.many);return`Слишком большое значение: ожидалось, что ${v.origin??"значение"} будет иметь ${w}${v.maximum.toString()} ${k}`}return`Слишком большое значение: ожидалось, что ${v.origin??"значение"} будет ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_){let U=Number(v.minimum),k=bl(U,_.unit.one,_.unit.few,_.unit.many);return`Слишком маленькое значение: ожидалось, что ${v.origin} будет иметь ${w}${v.minimum.toString()} ${k}`}return`Слишком маленькое значение: ожидалось, что ${v.origin} будет ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Неверная строка: должна начинаться с "${w.prefix}"`;if(w.format==="ends_with")return`Неверная строка: должна заканчиваться на "${w.suffix}"`;if(w.format==="includes")return`Неверная строка: должна содержать "${w.includes}"`;if(w.format==="regex")return`Неверная строка: должна соответствовать шаблону ${w.pattern}`;return`Неверный ${$[w.format]??v.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${v.divisor}`;case"unrecognized_keys":return`Нераспознанн${v.keys.length>1?"ые":"ый"} ключ${v.keys.length>1?"и":""}: ${I(v.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${v.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${v.origin}`;default:return"Неверные входные данные"}}};function N1(){return{localeError:G9()}}var t9=()=>{let n={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function i(v){return n[v]??null}let $={regex:"vnos",email:"e-poštni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"},g={nan:"NaN",number:"število",array:"tabela"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Neveljaven vnos: pričakovano instanceof ${v.expected}, prejeto ${U}`;return`Neveljaven vnos: pričakovano ${w}, prejeto ${U}`}case"invalid_value":if(v.values.length===1)return`Neveljaven vnos: pričakovano ${V(v.values[0])}`;return`Neveljavna možnost: pričakovano eno izmed ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`Preveliko: pričakovano, da bo ${v.origin??"vrednost"} imelo ${w}${v.maximum.toString()} ${_.unit??"elementov"}`;return`Preveliko: pričakovano, da bo ${v.origin??"vrednost"} ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`Premajhno: pričakovano, da bo ${v.origin} imelo ${w}${v.minimum.toString()} ${_.unit}`;return`Premajhno: pričakovano, da bo ${v.origin} ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Neveljaven niz: mora se začeti z "${w.prefix}"`;if(w.format==="ends_with")return`Neveljaven niz: mora se končati z "${w.suffix}"`;if(w.format==="includes")return`Neveljaven niz: mora vsebovati "${w.includes}"`;if(w.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${w.pattern}`;return`Neveljaven ${$[w.format]??v.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${v.divisor}`;case"unrecognized_keys":return`Neprepoznan${v.keys.length>1?"i ključi":" ključ"}: ${I(v.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${v.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${v.origin}`;default:return"Neveljaven vnos"}}};function c1(){return{localeError:t9()}}var Q9=()=>{let n={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function i(v){return n[v]??null}let $={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},g={nan:"NaN",number:"antal",array:"lista"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Ogiltig inmatning: förväntat instanceof ${v.expected}, fick ${U}`;return`Ogiltig inmatning: förväntat ${w}, fick ${U}`}case"invalid_value":if(v.values.length===1)return`Ogiltig inmatning: förväntat ${V(v.values[0])}`;return`Ogiltigt val: förväntade en av ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`För stor(t): förväntade ${v.origin??"värdet"} att ha ${w}${v.maximum.toString()} ${_.unit??"element"}`;return`För stor(t): förväntat ${v.origin??"värdet"} att ha ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`För lite(t): förväntade ${v.origin??"värdet"} att ha ${w}${v.minimum.toString()} ${_.unit}`;return`För lite(t): förväntade ${v.origin??"värdet"} att ha ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Ogiltig sträng: måste börja med "${w.prefix}"`;if(w.format==="ends_with")return`Ogiltig sträng: måste sluta med "${w.suffix}"`;if(w.format==="includes")return`Ogiltig sträng: måste innehålla "${w.includes}"`;if(w.format==="regex")return`Ogiltig sträng: måste matcha mönstret "${w.pattern}"`;return`Ogiltig(t) ${$[w.format]??v.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${v.divisor}`;case"unrecognized_keys":return`${v.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${I(v.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${v.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${v.origin??"värdet"}`;default:return"Ogiltig input"}}};function P1(){return{localeError:Q9()}}var W9=()=>{let n={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function i(v){return n[v]??null}let $={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"},g={nan:"NaN",number:"எண்",array:"அணி",null:"வெறுமை"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது instanceof ${v.expected}, பெறப்பட்டது ${U}`;return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${w}, பெறப்பட்டது ${U}`}case"invalid_value":if(v.values.length===1)return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${V(v.values[0])}`;return`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${I(v.values,"|")} இல் ஒன்று`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${v.origin??"மதிப்பு"} ${w}${v.maximum.toString()} ${_.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`;return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${v.origin??"மதிப்பு"} ${w}${v.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${v.origin} ${w}${v.minimum.toString()} ${_.unit} ஆக இருக்க வேண்டும்`;return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${v.origin} ${w}${v.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`தவறான சரம்: "${w.prefix}" இல் தொடங்க வேண்டும்`;if(w.format==="ends_with")return`தவறான சரம்: "${w.suffix}" இல் முடிவடைய வேண்டும்`;if(w.format==="includes")return`தவறான சரம்: "${w.includes}" ஐ உள்ளடக்க வேண்டும்`;if(w.format==="regex")return`தவறான சரம்: ${w.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`;return`தவறான ${$[w.format]??v.format}`}case"not_multiple_of":return`தவறான எண்: ${v.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${v.keys.length>1?"கள்":""}: ${I(v.keys,", ")}`;case"invalid_key":return`${v.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${v.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function S1(){return{localeError:W9()}}var Y9=()=>{let n={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function i(v){return n[v]??null}let $={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"},g={nan:"NaN",number:"ตัวเลข",array:"อาร์เรย์ (Array)",null:"ไม่มีค่า (null)"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น instanceof ${v.expected} แต่ได้รับ ${U}`;return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${w} แต่ได้รับ ${U}`}case"invalid_value":if(v.values.length===1)return`ค่าไม่ถูกต้อง: ควรเป็น ${V(v.values[0])}`;return`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"ไม่เกิน":"น้อยกว่า",_=i(v.origin);if(_)return`เกินกำหนด: ${v.origin??"ค่า"} ควรมี${w} ${v.maximum.toString()} ${_.unit??"รายการ"}`;return`เกินกำหนด: ${v.origin??"ค่า"} ควรมี${w} ${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?"อย่างน้อย":"มากกว่า",_=i(v.origin);if(_)return`น้อยกว่ากำหนด: ${v.origin} ควรมี${w} ${v.minimum.toString()} ${_.unit}`;return`น้อยกว่ากำหนด: ${v.origin} ควรมี${w} ${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${w.prefix}"`;if(w.format==="ends_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${w.suffix}"`;if(w.format==="includes")return`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${w.includes}" อยู่ในข้อความ`;if(w.format==="regex")return`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${w.pattern}`;return`รูปแบบไม่ถูกต้อง: ${$[w.format]??v.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${v.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${I(v.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${v.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${v.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function z1(){return{localeError:Y9()}}var I9=()=>{let n={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function i(v){return n[v]??null}let $={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Geçersiz değer: beklenen instanceof ${v.expected}, alınan ${U}`;return`Geçersiz değer: beklenen ${w}, alınan ${U}`}case"invalid_value":if(v.values.length===1)return`Geçersiz değer: beklenen ${V(v.values[0])}`;return`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`Çok büyük: beklenen ${v.origin??"değer"} ${w}${v.maximum.toString()} ${_.unit??"öğe"}`;return`Çok büyük: beklenen ${v.origin??"değer"} ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`Çok küçük: beklenen ${v.origin} ${w}${v.minimum.toString()} ${_.unit}`;return`Çok küçük: beklenen ${v.origin} ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Geçersiz metin: "${w.prefix}" ile başlamalı`;if(w.format==="ends_with")return`Geçersiz metin: "${w.suffix}" ile bitmeli`;if(w.format==="includes")return`Geçersiz metin: "${w.includes}" içermeli`;if(w.format==="regex")return`Geçersiz metin: ${w.pattern} desenine uymalı`;return`Geçersiz ${$[w.format]??v.format}`}case"not_multiple_of":return`Geçersiz sayı: ${v.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${v.keys.length>1?"lar":""}: ${I(v.keys,", ")}`;case"invalid_key":return`${v.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${v.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function M1(){return{localeError:I9()}}var j9=()=>{let n={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function i(v){return n[v]??null}let $={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"},g={nan:"NaN",number:"число",array:"масив"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Неправильні вхідні дані: очікується instanceof ${v.expected}, отримано ${U}`;return`Неправильні вхідні дані: очікується ${w}, отримано ${U}`}case"invalid_value":if(v.values.length===1)return`Неправильні вхідні дані: очікується ${V(v.values[0])}`;return`Неправильна опція: очікується одне з ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`Занадто велике: очікується, що ${v.origin??"значення"} ${_.verb} ${w}${v.maximum.toString()} ${_.unit??"елементів"}`;return`Занадто велике: очікується, що ${v.origin??"значення"} буде ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`Занадто мале: очікується, що ${v.origin} ${_.verb} ${w}${v.minimum.toString()} ${_.unit}`;return`Занадто мале: очікується, що ${v.origin} буде ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Неправильний рядок: повинен починатися з "${w.prefix}"`;if(w.format==="ends_with")return`Неправильний рядок: повинен закінчуватися на "${w.suffix}"`;if(w.format==="includes")return`Неправильний рядок: повинен містити "${w.includes}"`;if(w.format==="regex")return`Неправильний рядок: повинен відповідати шаблону ${w.pattern}`;return`Неправильний ${$[w.format]??v.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${v.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${v.keys.length>1?"і":""}: ${I(v.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${v.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${v.origin}`;default:return"Неправильні вхідні дані"}}};function Wg(){return{localeError:j9()}}function R1(){return Wg()}var u9=()=>{let n={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function i(v){return n[v]??null}let $={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"},g={nan:"NaN",number:"نمبر",array:"آرے",null:"نل"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`غلط ان پٹ: instanceof ${v.expected} متوقع تھا، ${U} موصول ہوا`;return`غلط ان پٹ: ${w} متوقع تھا، ${U} موصول ہوا`}case"invalid_value":if(v.values.length===1)return`غلط ان پٹ: ${V(v.values[0])} متوقع تھا`;return`غلط آپشن: ${I(v.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`بہت بڑا: ${v.origin??"ویلیو"} کے ${w}${v.maximum.toString()} ${_.unit??"عناصر"} ہونے متوقع تھے`;return`بہت بڑا: ${v.origin??"ویلیو"} کا ${w}${v.maximum.toString()} ہونا متوقع تھا`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`بہت چھوٹا: ${v.origin} کے ${w}${v.minimum.toString()} ${_.unit} ہونے متوقع تھے`;return`بہت چھوٹا: ${v.origin} کا ${w}${v.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`غلط سٹرنگ: "${w.prefix}" سے شروع ہونا چاہیے`;if(w.format==="ends_with")return`غلط سٹرنگ: "${w.suffix}" پر ختم ہونا چاہیے`;if(w.format==="includes")return`غلط سٹرنگ: "${w.includes}" شامل ہونا چاہیے`;if(w.format==="regex")return`غلط سٹرنگ: پیٹرن ${w.pattern} سے میچ ہونا چاہیے`;return`غلط ${$[w.format]??v.format}`}case"not_multiple_of":return`غلط نمبر: ${v.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${v.keys.length>1?"ز":""}: ${I(v.keys,"، ")}`;case"invalid_key":return`${v.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${v.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function A1(){return{localeError:u9()}}var H9=()=>{let n={string:{unit:"belgi",verb:"bo‘lishi kerak"},file:{unit:"bayt",verb:"bo‘lishi kerak"},array:{unit:"element",verb:"bo‘lishi kerak"},set:{unit:"element",verb:"bo‘lishi kerak"}};function i(v){return n[v]??null}let $={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},g={nan:"NaN",number:"raqam",array:"massiv"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Noto‘g‘ri kirish: kutilgan instanceof ${v.expected}, qabul qilingan ${U}`;return`Noto‘g‘ri kirish: kutilgan ${w}, qabul qilingan ${U}`}case"invalid_value":if(v.values.length===1)return`Noto‘g‘ri kirish: kutilgan ${V(v.values[0])}`;return`Noto‘g‘ri variant: quyidagilardan biri kutilgan ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`Juda katta: kutilgan ${v.origin??"qiymat"} ${w}${v.maximum.toString()} ${_.unit} ${_.verb}`;return`Juda katta: kutilgan ${v.origin??"qiymat"} ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`Juda kichik: kutilgan ${v.origin} ${w}${v.minimum.toString()} ${_.unit} ${_.verb}`;return`Juda kichik: kutilgan ${v.origin} ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Noto‘g‘ri satr: "${w.prefix}" bilan boshlanishi kerak`;if(w.format==="ends_with")return`Noto‘g‘ri satr: "${w.suffix}" bilan tugashi kerak`;if(w.format==="includes")return`Noto‘g‘ri satr: "${w.includes}" ni o‘z ichiga olishi kerak`;if(w.format==="regex")return`Noto‘g‘ri satr: ${w.pattern} shabloniga mos kelishi kerak`;return`Noto‘g‘ri ${$[w.format]??v.format}`}case"not_multiple_of":return`Noto‘g‘ri raqam: ${v.divisor} ning karralisi bo‘lishi kerak`;case"unrecognized_keys":return`Noma’lum kalit${v.keys.length>1?"lar":""}: ${I(v.keys,", ")}`;case"invalid_key":return`${v.origin} dagi kalit noto‘g‘ri`;case"invalid_union":return"Noto‘g‘ri kirish";case"invalid_element":return`${v.origin} da noto‘g‘ri qiymat`;default:return"Noto‘g‘ri kirish"}}};function x1(){return{localeError:H9()}}var V9=()=>{let n={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function i(v){return n[v]??null}let $={regex:"đầu vào",email:"địa chỉ email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"},g={nan:"NaN",number:"số",array:"mảng"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Đầu vào không hợp lệ: mong đợi instanceof ${v.expected}, nhận được ${U}`;return`Đầu vào không hợp lệ: mong đợi ${w}, nhận được ${U}`}case"invalid_value":if(v.values.length===1)return`Đầu vào không hợp lệ: mong đợi ${V(v.values[0])}`;return`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`Quá lớn: mong đợi ${v.origin??"giá trị"} ${_.verb} ${w}${v.maximum.toString()} ${_.unit??"phần tử"}`;return`Quá lớn: mong đợi ${v.origin??"giá trị"} ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`Quá nhỏ: mong đợi ${v.origin} ${_.verb} ${w}${v.minimum.toString()} ${_.unit}`;return`Quá nhỏ: mong đợi ${v.origin} ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Chuỗi không hợp lệ: phải bắt đầu bằng "${w.prefix}"`;if(w.format==="ends_with")return`Chuỗi không hợp lệ: phải kết thúc bằng "${w.suffix}"`;if(w.format==="includes")return`Chuỗi không hợp lệ: phải bao gồm "${w.includes}"`;if(w.format==="regex")return`Chuỗi không hợp lệ: phải khớp với mẫu ${w.pattern}`;return`${$[w.format]??v.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${v.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${I(v.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${v.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${v.origin}`;default:return"Đầu vào không hợp lệ"}}};function h1(){return{localeError:V9()}}var f9=()=>{let n={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function i(v){return n[v]??null}let $={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"},g={nan:"NaN",number:"数字",array:"数组",null:"空值(null)"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`无效输入:期望 instanceof ${v.expected},实际接收 ${U}`;return`无效输入:期望 ${w},实际接收 ${U}`}case"invalid_value":if(v.values.length===1)return`无效输入:期望 ${V(v.values[0])}`;return`无效选项:期望以下之一 ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`数值过大:期望 ${v.origin??"值"} ${w}${v.maximum.toString()} ${_.unit??"个元素"}`;return`数值过大:期望 ${v.origin??"值"} ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`数值过小:期望 ${v.origin} ${w}${v.minimum.toString()} ${_.unit}`;return`数值过小:期望 ${v.origin} ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`无效字符串:必须以 "${w.prefix}" 开头`;if(w.format==="ends_with")return`无效字符串:必须以 "${w.suffix}" 结尾`;if(w.format==="includes")return`无效字符串:必须包含 "${w.includes}"`;if(w.format==="regex")return`无效字符串:必须满足正则表达式 ${w.pattern}`;return`无效${$[w.format]??v.format}`}case"not_multiple_of":return`无效数字:必须是 ${v.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${I(v.keys,", ")}`;case"invalid_key":return`${v.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${v.origin} 中包含无效值(value)`;default:return"无效输入"}}};function C1(){return{localeError:f9()}}var q9=()=>{let n={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function i(v){return n[v]??null}let $={regex:"輸入",email:"郵件地址",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`無效的輸入值:預期為 instanceof ${v.expected},但收到 ${U}`;return`無效的輸入值:預期為 ${w},但收到 ${U}`}case"invalid_value":if(v.values.length===1)return`無效的輸入值:預期為 ${V(v.values[0])}`;return`無效的選項:預期為以下其中之一 ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`數值過大:預期 ${v.origin??"值"} 應為 ${w}${v.maximum.toString()} ${_.unit??"個元素"}`;return`數值過大:預期 ${v.origin??"值"} 應為 ${w}${v.maximum.toString()}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`數值過小:預期 ${v.origin} 應為 ${w}${v.minimum.toString()} ${_.unit}`;return`數值過小:預期 ${v.origin} 應為 ${w}${v.minimum.toString()}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`無效的字串:必須以 "${w.prefix}" 開頭`;if(w.format==="ends_with")return`無效的字串:必須以 "${w.suffix}" 結尾`;if(w.format==="includes")return`無效的字串:必須包含 "${w.includes}"`;if(w.format==="regex")return`無效的字串:必須符合格式 ${w.pattern}`;return`無效的 ${$[w.format]??v.format}`}case"not_multiple_of":return`無效的數字:必須為 ${v.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${v.keys.length>1?"們":""}:${I(v.keys,"、")}`;case"invalid_key":return`${v.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${v.origin} 中有無效的值`;default:return"無效的輸入值"}}};function E1(){return{localeError:q9()}}var L9=()=>{let n={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"}};function i(v){return n[v]??null}let $={regex:"ẹ̀rọ ìbáwọlé",email:"àdírẹ́sì ìmẹ́lì",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"àkókò ISO",date:"ọjọ́ ISO",time:"àkókò ISO",duration:"àkókò tó pé ISO",ipv4:"àdírẹ́sì IPv4",ipv6:"àdírẹ́sì IPv6",cidrv4:"àgbègbè IPv4",cidrv6:"àgbègbè IPv6",base64:"ọ̀rọ̀ tí a kọ́ ní base64",base64url:"ọ̀rọ̀ base64url",json_string:"ọ̀rọ̀ JSON",e164:"nọ́mbà E.164",jwt:"JWT",template_literal:"ẹ̀rọ ìbáwọlé"},g={nan:"NaN",number:"nọ́mbà",array:"akopọ"};return(v)=>{switch(v.code){case"invalid_type":{let w=g[v.expected]??v.expected,_=L(v.input),U=g[_]??_;if(/^[A-Z]/.test(v.expected))return`Ìbáwọlé aṣìṣe: a ní láti fi instanceof ${v.expected}, àmọ̀ a rí ${U}`;return`Ìbáwọlé aṣìṣe: a ní láti fi ${w}, àmọ̀ a rí ${U}`}case"invalid_value":if(v.values.length===1)return`Ìbáwọlé aṣìṣe: a ní láti fi ${V(v.values[0])}`;return`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${I(v.values,"|")}`;case"too_big":{let w=v.inclusive?"<=":"<",_=i(v.origin);if(_)return`Tó pọ̀ jù: a ní láti jẹ́ pé ${v.origin??"iye"} ${_.verb} ${w}${v.maximum} ${_.unit}`;return`Tó pọ̀ jù: a ní láti jẹ́ ${w}${v.maximum}`}case"too_small":{let w=v.inclusive?">=":">",_=i(v.origin);if(_)return`Kéré ju: a ní láti jẹ́ pé ${v.origin} ${_.verb} ${w}${v.minimum} ${_.unit}`;return`Kéré ju: a ní láti jẹ́ ${w}${v.minimum}`}case"invalid_format":{let w=v;if(w.format==="starts_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${w.prefix}"`;if(w.format==="ends_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${w.suffix}"`;if(w.format==="includes")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${w.includes}"`;if(w.format==="regex")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${w.pattern}`;return`Aṣìṣe: ${$[w.format]??v.format}`}case"not_multiple_of":return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${v.divisor}`;case"unrecognized_keys":return`Bọtìnì àìmọ̀: ${I(v.keys,", ")}`;case"invalid_key":return`Bọtìnì aṣìṣe nínú ${v.origin}`;case"invalid_union":return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣìṣe nínú ${v.origin}`;default:return"Ìbáwọlé aṣìṣe"}}};function o1(){return{localeError:L9()}}var Ul,Yg=Symbol("ZodOutput"),Ig=Symbol("ZodInput");class T1{constructor(){this._map=new WeakMap,this._idmap=new Map}add(n,...i){let $=i[0];if(this._map.set(n,$),$&&typeof $==="object"&&"id"in $)this._idmap.set($.id,n);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(n){let i=this._map.get(n);if(i&&typeof i==="object"&&"id"in i)this._idmap.delete(i.id);return this._map.delete(n),this}get(n){let i=n._zod.parent;if(i){let $={...this.get(i)??{}};delete $.id;let g={...$,...this._map.get(n)};return Object.keys(g).length?g:void 0}return this._map.get(n)}has(n){return this._map.has(n)}}function yi(){return new T1}(Ul=globalThis).__zod_globalRegistry??(Ul.__zod_globalRegistry=yi());var wn=globalThis.__zod_globalRegistry;function Z1(n,i){return new n({type:"string",...K(i)})}function r1(n,i){return new n({type:"string",coerce:!0,...K(i)})}function Q4(n,i){return new n({type:"string",format:"email",check:"string_format",abort:!1,...K(i)})}function jg(n,i){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...K(i)})}function W4(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...K(i)})}function Y4(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...K(i)})}function I4(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...K(i)})}function j4(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...K(i)})}function ug(n,i){return new n({type:"string",format:"url",check:"string_format",abort:!1,...K(i)})}function u4(n,i){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...K(i)})}function H4(n,i){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...K(i)})}function V4(n,i){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...K(i)})}function f4(n,i){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...K(i)})}function q4(n,i){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...K(i)})}function L4(n,i){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...K(i)})}function K4(n,i){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...K(i)})}function O4(n,i){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...K(i)})}function B4(n,i){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...K(i)})}function m1(n,i){return new n({type:"string",format:"mac",check:"string_format",abort:!1,...K(i)})}function F4(n,i){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...K(i)})}function N4(n,i){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...K(i)})}function c4(n,i){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...K(i)})}function P4(n,i){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...K(i)})}function S4(n,i){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...K(i)})}function z4(n,i){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...K(i)})}var Hg={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function y1(n,i){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...K(i)})}function d1(n,i){return new n({type:"string",format:"date",check:"string_format",...K(i)})}function e1(n,i){return new n({type:"string",format:"time",check:"string_format",precision:null,...K(i)})}function p1(n,i){return new n({type:"string",format:"duration",check:"string_format",...K(i)})}function a1(n,i){return new n({type:"number",checks:[],...K(i)})}function s1(n,i){return new n({type:"number",coerce:!0,checks:[],...K(i)})}function nk(n,i){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...K(i)})}function vk(n,i){return new n({type:"number",check:"number_format",abort:!1,format:"float32",...K(i)})}function ik(n,i){return new n({type:"number",check:"number_format",abort:!1,format:"float64",...K(i)})}function $k(n,i){return new n({type:"number",check:"number_format",abort:!1,format:"int32",...K(i)})}function gk(n,i){return new n({type:"number",check:"number_format",abort:!1,format:"uint32",...K(i)})}function wk(n,i){return new n({type:"boolean",...K(i)})}function _k(n,i){return new n({type:"boolean",coerce:!0,...K(i)})}function bk(n,i){return new n({type:"bigint",...K(i)})}function Uk(n,i){return new n({type:"bigint",coerce:!0,...K(i)})}function kk(n,i){return new n({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...K(i)})}function lk(n,i){return new n({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...K(i)})}function Dk(n,i){return new n({type:"symbol",...K(i)})}function Jk(n,i){return new n({type:"undefined",...K(i)})}function Xk(n,i){return new n({type:"null",...K(i)})}function Gk(n){return new n({type:"any"})}function tk(n){return new n({type:"unknown"})}function Qk(n,i){return new n({type:"never",...K(i)})}function Wk(n,i){return new n({type:"void",...K(i)})}function Yk(n,i){return new n({type:"date",...K(i)})}function Ik(n,i){return new n({type:"date",coerce:!0,...K(i)})}function jk(n,i){return new n({type:"nan",...K(i)})}function qn(n,i){return new g4({check:"less_than",...K(i),value:n,inclusive:!1})}function Xn(n,i){return new g4({check:"less_than",...K(i),value:n,inclusive:!0})}function Ln(n,i){return new w4({check:"greater_than",...K(i),value:n,inclusive:!1})}function Un(n,i){return new w4({check:"greater_than",...K(i),value:n,inclusive:!0})}function di(n){return Ln(0,n)}function ei(n){return qn(0,n)}function pi(n){return Xn(0,n)}function ai(n){return Un(0,n)}function yn(n,i){return new Vb({check:"multiple_of",...K(i),value:n})}function dn(n,i){return new Lb({check:"max_size",...K(i),maximum:n})}function Kn(n,i){return new Kb({check:"min_size",...K(i),minimum:n})}function bv(n,i){return new Ob({check:"size_equals",...K(i),size:n})}function Uv(n,i){return new Bb({check:"max_length",...K(i),maximum:n})}function An(n,i){return new Fb({check:"min_length",...K(i),minimum:n})}function kv(n,i){return new Nb({check:"length_equals",...K(i),length:n})}function fv(n,i){return new cb({check:"string_format",format:"regex",...K(i),pattern:n})}function qv(n){return new Pb({check:"string_format",format:"lowercase",...K(n)})}function Lv(n){return new Sb({check:"string_format",format:"uppercase",...K(n)})}function Kv(n,i){return new zb({check:"string_format",format:"includes",...K(i),includes:n})}function Ov(n,i){return new Mb({check:"string_format",format:"starts_with",...K(i),prefix:n})}function Bv(n,i){return new Rb({check:"string_format",format:"ends_with",...K(i),suffix:n})}function si(n,i,$){return new Ab({check:"property",property:n,schema:i,...K($)})}function Fv(n,i){return new xb({check:"mime_type",mime:n,...K(i)})}function Hn(n){return new hb({check:"overwrite",tx:n})}function Nv(n){return Hn((i)=>i.normalize(n))}function cv(){return Hn((n)=>n.trim())}function Pv(){return Hn((n)=>n.toLowerCase())}function Sv(){return Hn((n)=>n.toUpperCase())}function zv(){return Hn((n)=>h_(n))}function uk(n,i,$){return new n({type:"array",element:i,...K($)})}function O9(n,i,$){return new n({type:"union",options:i,...K($)})}function B9(n,i,$){return new n({type:"union",options:i,inclusive:!1,...K($)})}function F9(n,i,$,g){return new n({type:"union",options:$,discriminator:i,...K(g)})}function N9(n,i,$){return new n({type:"intersection",left:i,right:$})}function c9(n,i,$,g){let v=$ instanceof M;return new n({type:"tuple",items:i,rest:v?$:null,...K(v?g:$)})}function P9(n,i,$,g){return new n({type:"record",keyType:i,valueType:$,...K(g)})}function S9(n,i,$,g){return new n({type:"map",keyType:i,valueType:$,...K(g)})}function z9(n,i,$){return new n({type:"set",valueType:i,...K($)})}function M9(n,i,$){let g=Array.isArray(i)?Object.fromEntries(i.map((v)=>[v,v])):i;return new n({type:"enum",entries:g,...K($)})}function R9(n,i,$){return new n({type:"enum",entries:i,...K($)})}function A9(n,i,$){return new n({type:"literal",values:Array.isArray(i)?i:[i],...K($)})}function Hk(n,i){return new n({type:"file",...K(i)})}function x9(n,i){return new n({type:"transform",transform:i})}function h9(n,i){return new n({type:"optional",innerType:i})}function C9(n,i){return new n({type:"nullable",innerType:i})}function E9(n,i,$){return new n({type:"default",innerType:i,get defaultValue(){return typeof $==="function"?$():E_($)}})}function o9(n,i,$){return new n({type:"nonoptional",innerType:i,...K($)})}function T9(n,i){return new n({type:"success",innerType:i})}function Z9(n,i,$){return new n({type:"catch",innerType:i,catchValue:typeof $==="function"?$:()=>$})}function r9(n,i,$){return new n({type:"pipe",in:i,out:$})}function m9(n,i){return new n({type:"readonly",innerType:i})}function y9(n,i,$){return new n({type:"template_literal",parts:i,...K($)})}function d9(n,i){return new n({type:"lazy",getter:i})}function e9(n,i){return new n({type:"promise",innerType:i})}function Vk(n,i,$){let g=K($);return g.abort??(g.abort=!0),new n({type:"custom",check:"custom",fn:i,...g})}function fk(n,i,$){return new n({type:"custom",check:"custom",fn:i,...K($)})}function qk(n){let i=kl(($)=>{return $.addIssue=(g)=>{if(typeof g==="string")$.issues.push(Ci(g,$.value,i._zod.def));else{let v=g;if(v.fatal)v.continue=!1;v.code??(v.code="custom"),v.input??(v.input=$.value),v.inst??(v.inst=i),v.continue??(v.continue=!i._zod.def.abort),$.issues.push(Ci(v))}},n($.value,$)});return i}function kl(n,i){let $=new p({check:"custom",...K(i)});return $._zod.check=n,$}function Lk(n){let i=new p({check:"describe"});return i._zod.onattach=[($)=>{let g=wn.get($)??{};wn.add($,{...g,description:n})}],i._zod.check=()=>{},i}function Kk(n){let i=new p({check:"meta"});return i._zod.onattach=[($)=>{let g=wn.get($)??{};wn.add($,{...g,...n})}],i._zod.check=()=>{},i}function Ok(n,i){let $=K(i),g=$.truthy??["true","1","yes","on","y","enabled"],v=$.falsy??["false","0","no","off","n","disabled"];if($.case!=="sensitive")g=g.map((u)=>typeof u==="string"?u.toLowerCase():u),v=v.map((u)=>typeof u==="string"?u.toLowerCase():u);let w=new Set(g),_=new Set(v),U=n.Codec??Xg,k=n.Boolean??Dg,J=new(n.String??_i)({type:"string",error:$.error}),Q=new k({type:"boolean",error:$.error}),j=new U({type:"pipe",in:J,out:Q,transform:(u,W)=>{let Y=u;if($.case!=="sensitive")Y=Y.toLowerCase();if(w.has(Y))return!0;else if(_.has(Y))return!1;else return W.issues.push({code:"invalid_value",expected:"stringbool",values:[...w,..._],input:W.value,inst:j,continue:!1}),{}},reverseTransform:(u,W)=>{if(u===!0)return g[0]||"true";else return v[0]||"false"},error:$.error});return j}function n$(n,i,$,g={}){let v=K(g),w={...K(g),check:"string_format",type:"string",format:i,fn:typeof $==="function"?$:(U)=>$.test(U),...v};if($ instanceof RegExp)w.pattern=$;return new n(w)}function Mv(n){let i=n?.target??"draft-2020-12";if(i==="draft-4")i="draft-04";if(i==="draft-7")i="draft-07";return{processors:n.processors??{},metadataRegistry:n?.metadata??wn,target:i,unrepresentable:n?.unrepresentable??"throw",override:n?.override??(()=>{}),io:n?.io??"output",counter:0,seen:new Map,cycles:n?.cycles??"ref",reused:n?.reused??"inline",external:n?.external??void 0}}function y(n,i,$={path:[],schemaPath:[]}){var g;let v=n._zod.def,w=i.seen.get(n);if(w){if(w.count++,$.schemaPath.includes(n))w.cycle=$.path;return w.schema}let _={schema:{},count:1,cycle:void 0,path:$.path};i.seen.set(n,_);let U=n._zod.toJSONSchema?.();if(U)_.schema=U;else{let J={...$,schemaPath:[...$.schemaPath,n],path:$.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(i,_.schema,J);else{let j=_.schema,u=i.processors[v.type];if(!u)throw Error(`[toJSONSchema]: Non-representable type encountered: ${v.type}`);u(n,i,j,J)}let Q=n._zod.parent;if(Q){if(!_.ref)_.ref=Q;y(Q,i,J),i.seen.get(Q).isParent=!0}}let k=i.metadataRegistry.get(n);if(k)Object.assign(_.schema,k);if(i.io==="input"&&Gn(n))delete _.schema.examples,delete _.schema.default;if(i.io==="input"&&_.schema._prefault)(g=_.schema).default??(g.default=_.schema._prefault);return delete _.schema._prefault,i.seen.get(n).schema}function Rv(n,i){let $=n.seen.get(i);if(!$)throw Error("Unprocessed schema. This is a bug in Zod.");let g=new Map;for(let _ of n.seen.entries()){let U=n.metadataRegistry.get(_[0])?.id;if(U){let k=g.get(U);if(k&&k!==_[0])throw Error(`Duplicate schema id "${U}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);g.set(U,_[0])}}let v=(_)=>{let U=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let Q=n.external.registry.get(_[0])?.id,j=n.external.uri??((W)=>W);if(Q)return{ref:j(Q)};let u=_[1].defId??_[1].schema.id??`schema${n.counter++}`;return _[1].defId=u,{defId:u,ref:`${j("__shared")}#/${U}/${u}`}}if(_[1]===$)return{ref:"#"};let l=`${"#"}/${U}/`,J=_[1].schema.id??`__schema${n.counter++}`;return{defId:J,ref:l+J}},w=(_)=>{if(_[1].schema.$ref)return;let U=_[1],{ref:k,defId:l}=v(_);if(U.def={...U.schema},l)U.defId=l;let J=U.schema;for(let Q in J)delete J[Q];J.$ref=k};if(n.cycles==="throw")for(let _ of n.seen.entries()){let U=_[1];if(U.cycle)throw Error(`Cycle detected: #/${U.cycle?.join("/")}/<root>
41
41
 
42
42
  Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let _ of n.seen.entries()){let U=_[1];if(i===_[0]){w(_);continue}if(n.external){let l=n.external.registry.get(_[0])?.id;if(i!==_[0]&&l){w(_);continue}}if(n.metadataRegistry.get(_[0])?.id){w(_);continue}if(U.cycle){w(_);continue}if(U.count>1){if(n.reused==="ref"){w(_);continue}}}}function Av(n,i){let $=n.seen.get(i);if(!$)throw Error("Unprocessed schema. This is a bug in Zod.");let g=(_)=>{let U=n.seen.get(_);if(U.ref===null)return;let k=U.def??U.schema,l={...k},J=U.ref;if(U.ref=null,J){g(J);let j=n.seen.get(J),u=j.schema;if(u.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0"))k.allOf=k.allOf??[],k.allOf.push(u);else Object.assign(k,u);if(Object.assign(k,l),_._zod.parent===J)for(let Y in k){if(Y==="$ref"||Y==="allOf")continue;if(!(Y in l))delete k[Y]}if(u.$ref)for(let Y in k){if(Y==="$ref"||Y==="allOf")continue;if(Y in j.def&&JSON.stringify(k[Y])===JSON.stringify(j.def[Y]))delete k[Y]}}let Q=_._zod.parent;if(Q&&Q!==J){g(Q);let j=n.seen.get(Q);if(j?.schema.$ref){if(k.$ref=j.schema.$ref,j.def)for(let u in k){if(u==="$ref"||u==="allOf")continue;if(u in j.def&&JSON.stringify(k[u])===JSON.stringify(j.def[u]))delete k[u]}}}n.override({zodSchema:_,jsonSchema:k,path:U.path??[]})};for(let _ of[...n.seen.entries()].reverse())g(_[0]);let v={};if(n.target==="draft-2020-12")v.$schema="https://json-schema.org/draft/2020-12/schema";else if(n.target==="draft-07")v.$schema="http://json-schema.org/draft-07/schema#";else if(n.target==="draft-04")v.$schema="http://json-schema.org/draft-04/schema#";else if(n.target==="openapi-3.0");if(n.external?.uri){let _=n.external.registry.get(i)?.id;if(!_)throw Error("Schema is missing an `id` property");v.$id=n.external.uri(_)}Object.assign(v,$.def??$.schema);let w=n.external?.defs??{};for(let _ of n.seen.entries()){let U=_[1];if(U.def&&U.defId)w[U.defId]=U.def}if(n.external);else if(Object.keys(w).length>0)if(n.target==="draft-2020-12")v.$defs=w;else v.definitions=w;try{let _=JSON.parse(JSON.stringify(v));return Object.defineProperty(_,"~standard",{value:{...i["~standard"],jsonSchema:{input:v$(i,"input",n.processors),output:v$(i,"output",n.processors)}},enumerable:!1,writable:!1}),_}catch(_){throw Error("Error converting schema to JSON.")}}function Gn(n,i){let $=i??{seen:new Set};if($.seen.has(n))return!1;$.seen.add(n);let g=n._zod.def;if(g.type==="transform")return!0;if(g.type==="array")return Gn(g.element,$);if(g.type==="set")return Gn(g.valueType,$);if(g.type==="lazy")return Gn(g.getter(),$);if(g.type==="promise"||g.type==="optional"||g.type==="nonoptional"||g.type==="nullable"||g.type==="readonly"||g.type==="default"||g.type==="prefault")return Gn(g.innerType,$);if(g.type==="intersection")return Gn(g.left,$)||Gn(g.right,$);if(g.type==="record"||g.type==="map")return Gn(g.keyType,$)||Gn(g.valueType,$);if(g.type==="pipe")return Gn(g.in,$)||Gn(g.out,$);if(g.type==="object"){for(let v in g.shape)if(Gn(g.shape[v],$))return!0;return!1}if(g.type==="union"){for(let v of g.options)if(Gn(v,$))return!0;return!1}if(g.type==="tuple"){for(let v of g.items)if(Gn(v,$))return!0;if(g.rest&&Gn(g.rest,$))return!0;return!1}return!1}var Bk=(n,i={})=>($)=>{let g=Mv({...$,processors:i});return y(n,g),Rv(g,n),Av(g,n)},v$=(n,i,$={})=>(g)=>{let{libraryOptions:v,target:w}=g??{},_=Mv({...v??{},target:w,io:i,processors:$});return y(n,_),Rv(_,n),Av(_,n)};var p9={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Fk=(n,i,$,g)=>{let v=$;v.type="string";let{minimum:w,maximum:_,format:U,patterns:k,contentEncoding:l}=n._zod.bag;if(typeof w==="number")v.minLength=w;if(typeof _==="number")v.maxLength=_;if(U){if(v.format=p9[U]??U,v.format==="")delete v.format;if(U==="time")delete v.format}if(l)v.contentEncoding=l;if(k&&k.size>0){let J=[...k];if(J.length===1)v.pattern=J[0].source;else if(J.length>1)v.allOf=[...J.map((Q)=>({...i.target==="draft-07"||i.target==="draft-04"||i.target==="openapi-3.0"?{type:"string"}:{},pattern:Q.source}))]}},Nk=(n,i,$,g)=>{let v=$,{minimum:w,maximum:_,format:U,multipleOf:k,exclusiveMaximum:l,exclusiveMinimum:J}=n._zod.bag;if(typeof U==="string"&&U.includes("int"))v.type="integer";else v.type="number";if(typeof J==="number")if(i.target==="draft-04"||i.target==="openapi-3.0")v.minimum=J,v.exclusiveMinimum=!0;else v.exclusiveMinimum=J;if(typeof w==="number"){if(v.minimum=w,typeof J==="number"&&i.target!=="draft-04")if(J>=w)delete v.minimum;else delete v.exclusiveMinimum}if(typeof l==="number")if(i.target==="draft-04"||i.target==="openapi-3.0")v.maximum=l,v.exclusiveMaximum=!0;else v.exclusiveMaximum=l;if(typeof _==="number"){if(v.maximum=_,typeof l==="number"&&i.target!=="draft-04")if(l<=_)delete v.maximum;else delete v.exclusiveMaximum}if(typeof k==="number")v.multipleOf=k},ck=(n,i,$,g)=>{$.type="boolean"},Pk=(n,i,$,g)=>{if(i.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},Sk=(n,i,$,g)=>{if(i.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},zk=(n,i,$,g)=>{if(i.target==="openapi-3.0")$.type="string",$.nullable=!0,$.enum=[null];else $.type="null"},Mk=(n,i,$,g)=>{if(i.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},Rk=(n,i,$,g)=>{if(i.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},Ak=(n,i,$,g)=>{$.not={}},xk=(n,i,$,g)=>{},hk=(n,i,$,g)=>{},Ck=(n,i,$,g)=>{if(i.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},Ek=(n,i,$,g)=>{let v=n._zod.def,w=Ai(v.entries);if(w.every((_)=>typeof _==="number"))$.type="number";if(w.every((_)=>typeof _==="string"))$.type="string";$.enum=w},ok=(n,i,$,g)=>{let v=n._zod.def,w=[];for(let _ of v.values)if(_===void 0){if(i.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof _==="bigint")if(i.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else w.push(Number(_));else w.push(_);if(w.length===0);else if(w.length===1){let _=w[0];if($.type=_===null?"null":typeof _,i.target==="draft-04"||i.target==="openapi-3.0")$.enum=[_];else $.const=_}else{if(w.every((_)=>typeof _==="number"))$.type="number";if(w.every((_)=>typeof _==="string"))$.type="string";if(w.every((_)=>typeof _==="boolean"))$.type="boolean";if(w.every((_)=>_===null))$.type="null";$.enum=w}},Tk=(n,i,$,g)=>{if(i.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},Zk=(n,i,$,g)=>{let v=$,w=n._zod.pattern;if(!w)throw Error("Pattern not found in template literal");v.type="string",v.pattern=w.source},rk=(n,i,$,g)=>{let v=$,w={type:"string",format:"binary",contentEncoding:"binary"},{minimum:_,maximum:U,mime:k}=n._zod.bag;if(_!==void 0)w.minLength=_;if(U!==void 0)w.maxLength=U;if(k)if(k.length===1)w.contentMediaType=k[0],Object.assign(v,w);else Object.assign(v,w),v.anyOf=k.map((l)=>({contentMediaType:l}));else Object.assign(v,w)},mk=(n,i,$,g)=>{$.type="boolean"},yk=(n,i,$,g)=>{if(i.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},dk=(n,i,$,g)=>{if(i.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},ek=(n,i,$,g)=>{if(i.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},pk=(n,i,$,g)=>{if(i.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},ak=(n,i,$,g)=>{if(i.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},sk=(n,i,$,g)=>{let v=$,w=n._zod.def,{minimum:_,maximum:U}=n._zod.bag;if(typeof _==="number")v.minItems=_;if(typeof U==="number")v.maxItems=U;v.type="array",v.items=y(w.element,i,{...g,path:[...g.path,"items"]})},n0=(n,i,$,g)=>{let v=$,w=n._zod.def;v.type="object",v.properties={};let _=w.shape;for(let l in _)v.properties[l]=y(_[l],i,{...g,path:[...g.path,"properties",l]});let U=new Set(Object.keys(_)),k=new Set([...U].filter((l)=>{let J=w.shape[l]._zod;if(i.io==="input")return J.optin===void 0;else return J.optout===void 0}));if(k.size>0)v.required=Array.from(k);if(w.catchall?._zod.def.type==="never")v.additionalProperties=!1;else if(!w.catchall){if(i.io==="output")v.additionalProperties=!1}else if(w.catchall)v.additionalProperties=y(w.catchall,i,{...g,path:[...g.path,"additionalProperties"]})},R4=(n,i,$,g)=>{let v=n._zod.def,w=v.inclusive===!1,_=v.options.map((U,k)=>y(U,i,{...g,path:[...g.path,w?"oneOf":"anyOf",k]}));if(w)$.oneOf=_;else $.anyOf=_},v0=(n,i,$,g)=>{let v=n._zod.def,w=y(v.left,i,{...g,path:[...g.path,"allOf",0]}),_=y(v.right,i,{...g,path:[...g.path,"allOf",1]}),U=(l)=>("allOf"in l)&&Object.keys(l).length===1,k=[...U(w)?w.allOf:[w],...U(_)?_.allOf:[_]];$.allOf=k},i0=(n,i,$,g)=>{let v=$,w=n._zod.def;v.type="array";let _=i.target==="draft-2020-12"?"prefixItems":"items",U=i.target==="draft-2020-12"?"items":i.target==="openapi-3.0"?"items":"additionalItems",k=w.items.map((j,u)=>y(j,i,{...g,path:[...g.path,_,u]})),l=w.rest?y(w.rest,i,{...g,path:[...g.path,U,...i.target==="openapi-3.0"?[w.items.length]:[]]}):null;if(i.target==="draft-2020-12"){if(v.prefixItems=k,l)v.items=l}else if(i.target==="openapi-3.0"){if(v.items={anyOf:k},l)v.items.anyOf.push(l);if(v.minItems=k.length,!l)v.maxItems=k.length}else if(v.items=k,l)v.additionalItems=l;let{minimum:J,maximum:Q}=n._zod.bag;if(typeof J==="number")v.minItems=J;if(typeof Q==="number")v.maxItems=Q},$0=(n,i,$,g)=>{let v=$,w=n._zod.def;if(v.type="object",i.target==="draft-07"||i.target==="draft-2020-12")v.propertyNames=y(w.keyType,i,{...g,path:[...g.path,"propertyNames"]});v.additionalProperties=y(w.valueType,i,{...g,path:[...g.path,"additionalProperties"]});let _=w.keyType._zod.def;if(_.type==="enum"){let k=Ai(_.entries).filter((l)=>typeof l==="string"||typeof l==="number");if(k.length>0)v.required=k}},g0=(n,i,$,g)=>{let v=n._zod.def,w=y(v.innerType,i,g),_=i.seen.get(n);if(i.target==="openapi-3.0")_.ref=v.innerType,$.nullable=!0;else $.anyOf=[w,{type:"null"}]},w0=(n,i,$,g)=>{let v=n._zod.def;y(v.innerType,i,g);let w=i.seen.get(n);w.ref=v.innerType},_0=(n,i,$,g)=>{let v=n._zod.def;y(v.innerType,i,g);let w=i.seen.get(n);w.ref=v.innerType,$.default=JSON.parse(JSON.stringify(v.defaultValue))},b0=(n,i,$,g)=>{let v=n._zod.def;y(v.innerType,i,g);let w=i.seen.get(n);if(w.ref=v.innerType,i.io==="input")$._prefault=JSON.parse(JSON.stringify(v.defaultValue))},U0=(n,i,$,g)=>{let v=n._zod.def;y(v.innerType,i,g);let w=i.seen.get(n);w.ref=v.innerType;let _;try{_=v.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}$.default=_},k0=(n,i,$,g)=>{let v=n._zod.def,w=i.io==="input"?v.in._zod.def.type==="transform"?v.out:v.in:v.out;y(w,i,g);let _=i.seen.get(n);_.ref=w},l0=(n,i,$,g)=>{let v=n._zod.def;y(v.innerType,i,g);let w=i.seen.get(n);w.ref=v.innerType,$.readOnly=!0},D0=(n,i,$,g)=>{let v=n._zod.def;y(v.innerType,i,g);let w=i.seen.get(n);w.ref=v.innerType},A4=(n,i,$,g)=>{let v=n._zod.def;y(v.innerType,i,g);let w=i.seen.get(n);w.ref=v.innerType},J0=(n,i,$,g)=>{let v=n._zod.innerType;y(v,i,g);let w=i.seen.get(n);w.ref=v},M4={string:Fk,number:Nk,boolean:ck,bigint:Pk,symbol:Sk,null:zk,undefined:Mk,void:Rk,never:Ak,any:xk,unknown:hk,date:Ck,enum:Ek,literal:ok,nan:Tk,template_literal:Zk,file:rk,success:mk,custom:yk,function:dk,transform:ek,map:pk,set:ak,array:sk,object:n0,union:R4,intersection:v0,tuple:i0,record:$0,nullable:g0,nonoptional:w0,default:_0,prefault:b0,catch:U0,pipe:k0,readonly:l0,promise:D0,optional:A4,lazy:J0};function i$(n,i){if("_idmap"in n){let g=n,v=Mv({...i,processors:M4}),w={};for(let k of g._idmap.entries()){let[l,J]=k;y(J,v)}let _={},U={registry:g,uri:i?.uri,defs:w};v.external=U;for(let k of g._idmap.entries()){let[l,J]=k;Rv(v,J),_[l]=Av(v,J)}if(Object.keys(w).length>0){let k=v.target==="draft-2020-12"?"$defs":"definitions";_.__shared={[k]:w}}return{schemas:_}}let $=Mv({...i,processors:M4});return y(n,$),Rv($,n),Av($,n)}class X0{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(n){this.ctx.counter=n}get seen(){return this.ctx.seen}constructor(n){let i=n?.target??"draft-2020-12";if(i==="draft-4")i="draft-04";if(i==="draft-7")i="draft-07";this.ctx=Mv({processors:M4,target:i,...n?.metadata&&{metadata:n.metadata},...n?.unrepresentable&&{unrepresentable:n.unrepresentable},...n?.override&&{override:n.override},...n?.io&&{io:n.io}})}process(n,i={path:[],schemaPath:[]}){return y(n,this.ctx,i)}emit(n,i){if(i){if(i.cycles)this.ctx.cycles=i.cycles;if(i.reused)this.ctx.reused=i.reused;if(i.external)this.ctx.external=i.external}Rv(this.ctx,n);let $=Av(this.ctx,n),{"~standard":g,...v}=$;return v}}var ll={};var Vg={};Nn(Vg,{xor:()=>B6,xid:()=>s4,void:()=>f6,uuidv7:()=>Z4,uuidv6:()=>T4,uuidv4:()=>o4,uuid:()=>E4,url:()=>r4,unknown:()=>tn,union:()=>K$,undefined:()=>H6,ulid:()=>a4,uint64:()=>j6,uint32:()=>W6,tuple:()=>pg,transform:()=>B$,templateLiteral:()=>h6,symbol:()=>u6,superRefine:()=>Vw,success:()=>R6,stringbool:()=>y6,stringFormat:()=>l6,string:()=>o,strictObject:()=>K6,set:()=>P6,refine:()=>Hw,record:()=>pn,readonly:()=>Qw,promise:()=>C6,preprocess:()=>e6,prefault:()=>kw,pipe:()=>Di,partialRecord:()=>F6,optional:()=>ki,object:()=>$n,number:()=>Tv,nullish:()=>M6,nullable:()=>li,null:()=>hg,nonoptional:()=>lw,never:()=>L$,nativeEnum:()=>S6,nanoid:()=>d4,nan:()=>A6,meta:()=>r6,map:()=>c6,mac:()=>i6,looseRecord:()=>N6,looseObject:()=>O6,literal:()=>Cn,lazy:()=>Iw,ksuid:()=>n6,keyof:()=>L6,jwt:()=>k6,json:()=>d6,ipv6:()=>$6,ipv4:()=>v6,intersection:()=>dg,int64:()=>I6,int32:()=>Q6,int:()=>b$,instanceof:()=>m6,httpUrl:()=>m4,hostname:()=>D6,hex:()=>J6,hash:()=>X6,guid:()=>C4,function:()=>E6,float64:()=>t6,float32:()=>G6,file:()=>z6,exactOptional:()=>gw,enum:()=>O$,emoji:()=>y4,email:()=>h4,e164:()=>U6,discriminatedUnion:()=>Qi,describe:()=>Z6,date:()=>q6,custom:()=>T6,cuid2:()=>p4,cuid:()=>e4,codec:()=>x6,cidrv6:()=>w6,cidrv4:()=>g6,check:()=>o6,catch:()=>Xw,boolean:()=>en,bigint:()=>Y6,base64url:()=>b6,base64:()=>_6,array:()=>hn,any:()=>V6,_function:()=>E6,_default:()=>bw,_ZodString:()=>U$,ZodXor:()=>rg,ZodXID:()=>t$,ZodVoid:()=>Tg,ZodUnknown:()=>Eg,ZodUnion:()=>ti,ZodUndefined:()=>Ag,ZodUUID:()=>On,ZodURL:()=>Ji,ZodULID:()=>G$,ZodType:()=>R,ZodTuple:()=>eg,ZodTransform:()=>iw,ZodTemplateLiteral:()=>Ww,ZodSymbol:()=>Rg,ZodSuccess:()=>Dw,ZodStringFormat:()=>m,ZodString:()=>Cv,ZodSet:()=>sg,ZodRecord:()=>Wi,ZodReadonly:()=>tw,ZodPromise:()=>jw,ZodPrefault:()=>Uw,ZodPipe:()=>c$,ZodOptional:()=>F$,ZodObject:()=>Gi,ZodNumberFormat:()=>lv,ZodNumber:()=>ov,ZodNullable:()=>ww,ZodNull:()=>xg,ZodNonOptional:()=>N$,ZodNever:()=>og,ZodNanoID:()=>D$,ZodNaN:()=>Gw,ZodMap:()=>ag,ZodMAC:()=>Mg,ZodLiteral:()=>nw,ZodLazy:()=>Yw,ZodKSUID:()=>Q$,ZodJWT:()=>f$,ZodIntersection:()=>yg,ZodIPv6:()=>Y$,ZodIPv4:()=>W$,ZodGUID:()=>Ui,ZodFunction:()=>uw,ZodFile:()=>vw,ZodExactOptional:()=>$w,ZodEnum:()=>hv,ZodEmoji:()=>l$,ZodEmail:()=>k$,ZodE164:()=>V$,ZodDiscriminatedUnion:()=>mg,ZodDefault:()=>_w,ZodDate:()=>Xi,ZodCustomStringFormat:()=>Ev,ZodCustom:()=>Yi,ZodCodec:()=>P$,ZodCatch:()=>Jw,ZodCUID2:()=>X$,ZodCUID:()=>J$,ZodCIDRv6:()=>j$,ZodCIDRv4:()=>I$,ZodBoolean:()=>Zv,ZodBigIntFormat:()=>q$,ZodBigInt:()=>rv,ZodBase64URL:()=>H$,ZodBase64:()=>u$,ZodArray:()=>Zg,ZodAny:()=>Cg});var x4={};Nn(x4,{uppercase:()=>Lv,trim:()=>cv,toUpperCase:()=>Sv,toLowerCase:()=>Pv,startsWith:()=>Ov,slugify:()=>zv,size:()=>bv,regex:()=>fv,property:()=>si,positive:()=>di,overwrite:()=>Hn,normalize:()=>Nv,nonpositive:()=>pi,nonnegative:()=>ai,negative:()=>ei,multipleOf:()=>yn,minSize:()=>Kn,minLength:()=>An,mime:()=>Fv,maxSize:()=>dn,maxLength:()=>Uv,lte:()=>Xn,lt:()=>qn,lowercase:()=>qv,length:()=>kv,includes:()=>Kv,gte:()=>Un,gt:()=>Ln,endsWith:()=>Bv});var xv={};Nn(xv,{time:()=>Q0,duration:()=>W0,datetime:()=>G0,date:()=>t0,ZodISOTime:()=>w$,ZodISODuration:()=>_$,ZodISODateTime:()=>$$,ZodISODate:()=>g$});var $$=t("ZodISODateTime",(n,i)=>{nU.init(n,i),m.init(n,i)});function G0(n){return y1($$,n)}var g$=t("ZodISODate",(n,i)=>{vU.init(n,i),m.init(n,i)});function t0(n){return d1(g$,n)}var w$=t("ZodISOTime",(n,i)=>{iU.init(n,i),m.init(n,i)});function Q0(n){return e1(w$,n)}var _$=t("ZodISODuration",(n,i)=>{$U.init(n,i),m.init(n,i)});function W0(n){return p1(_$,n)}var Dl=(n,i)=>{wg.init(n,i),n.name="ZodError",Object.defineProperties(n,{format:{value:($)=>gi(n,$)},flatten:{value:($)=>$i(n,$)},addIssue:{value:($)=>{n.issues.push($),n.message=JSON.stringify(n.issues,xi,2)}},addIssues:{value:($)=>{n.issues.push(...$),n.message=JSON.stringify(n.issues,xi,2)}},isEmpty:{get(){return n.issues.length===0}}})},Y0=t("ZodError",Dl),ln=t("ZodError",Dl,{Parent:Error});var fg=Ei(ln),qg=oi(ln),Lg=Ti(ln),Kg=Zi(ln),Og=dw(ln),Bg=ew(ln),Fg=pw(ln),Ng=aw(ln),cg=sw(ln),Pg=n4(ln),Sg=v4(ln),zg=i4(ln);var R=t("ZodType",(n,i)=>{return M.init(n,i),Object.assign(n["~standard"],{jsonSchema:{input:v$(n,"input"),output:v$(n,"output")}}),n.toJSONSchema=Bk(n,{}),n.def=i,n.type=i.type,Object.defineProperty(n,"_def",{value:i}),n.check=(...$)=>{return n.clone(f.mergeDefs(i,{checks:[...i.checks??[],...$.map((g)=>typeof g==="function"?{_zod:{check:g,def:{check:"custom"},onattach:[]}}:g)]}),{parent:!0})},n.with=n.check,n.clone=($,g)=>bn(n,$,g),n.brand=()=>n,n.register=($,g)=>{return $.add(n,g),n},n.parse=($,g)=>fg(n,$,g,{callee:n.parse}),n.safeParse=($,g)=>Lg(n,$,g),n.parseAsync=async($,g)=>qg(n,$,g,{callee:n.parseAsync}),n.safeParseAsync=async($,g)=>Kg(n,$,g),n.spa=n.safeParseAsync,n.encode=($,g)=>Og(n,$,g),n.decode=($,g)=>Bg(n,$,g),n.encodeAsync=async($,g)=>Fg(n,$,g),n.decodeAsync=async($,g)=>Ng(n,$,g),n.safeEncode=($,g)=>cg(n,$,g),n.safeDecode=($,g)=>Pg(n,$,g),n.safeEncodeAsync=async($,g)=>Sg(n,$,g),n.safeDecodeAsync=async($,g)=>zg(n,$,g),n.refine=($,g)=>n.check(Hw($,g)),n.superRefine=($)=>n.check(Vw($)),n.overwrite=($)=>n.check(Hn($)),n.optional=()=>ki(n),n.exactOptional=()=>gw(n),n.nullable=()=>li(n),n.nullish=()=>ki(li(n)),n.nonoptional=($)=>lw(n,$),n.array=()=>hn(n),n.or=($)=>K$([n,$]),n.and=($)=>dg(n,$),n.transform=($)=>Di(n,B$($)),n.default=($)=>bw(n,$),n.prefault=($)=>kw(n,$),n.catch=($)=>Xw(n,$),n.pipe=($)=>Di(n,$),n.readonly=()=>Qw(n),n.describe=($)=>{let g=n.clone();return wn.add(g,{description:$}),g},Object.defineProperty(n,"description",{get(){return wn.get(n)?.description},configurable:!0}),n.meta=(...$)=>{if($.length===0)return wn.get(n);let g=n.clone();return wn.add(g,$[0]),g},n.isOptional=()=>n.safeParse(void 0).success,n.isNullable=()=>n.safeParse(null).success,n.apply=($)=>$(n),n}),U$=t("_ZodString",(n,i)=>{_i.init(n,i),R.init(n,i),n._zod.processJSONSchema=(g,v,w)=>Fk(n,g,v,w);let $=n._zod.bag;n.format=$.format??null,n.minLength=$.minimum??null,n.maxLength=$.maximum??null,n.regex=(...g)=>n.check(fv(...g)),n.includes=(...g)=>n.check(Kv(...g)),n.startsWith=(...g)=>n.check(Ov(...g)),n.endsWith=(...g)=>n.check(Bv(...g)),n.min=(...g)=>n.check(An(...g)),n.max=(...g)=>n.check(Uv(...g)),n.length=(...g)=>n.check(kv(...g)),n.nonempty=(...g)=>n.check(An(1,...g)),n.lowercase=(g)=>n.check(qv(g)),n.uppercase=(g)=>n.check(Lv(g)),n.trim=()=>n.check(cv()),n.normalize=(...g)=>n.check(Nv(...g)),n.toLowerCase=()=>n.check(Pv()),n.toUpperCase=()=>n.check(Sv()),n.slugify=()=>n.check(zv())}),Cv=t("ZodString",(n,i)=>{_i.init(n,i),U$.init(n,i),n.email=($)=>n.check(Q4(k$,$)),n.url=($)=>n.check(ug(Ji,$)),n.jwt=($)=>n.check(z4(f$,$)),n.emoji=($)=>n.check(u4(l$,$)),n.guid=($)=>n.check(jg(Ui,$)),n.uuid=($)=>n.check(W4(On,$)),n.uuidv4=($)=>n.check(Y4(On,$)),n.uuidv6=($)=>n.check(I4(On,$)),n.uuidv7=($)=>n.check(j4(On,$)),n.nanoid=($)=>n.check(H4(D$,$)),n.guid=($)=>n.check(jg(Ui,$)),n.cuid=($)=>n.check(V4(J$,$)),n.cuid2=($)=>n.check(f4(X$,$)),n.ulid=($)=>n.check(q4(G$,$)),n.base64=($)=>n.check(c4(u$,$)),n.base64url=($)=>n.check(P4(H$,$)),n.xid=($)=>n.check(L4(t$,$)),n.ksuid=($)=>n.check(K4(Q$,$)),n.ipv4=($)=>n.check(O4(W$,$)),n.ipv6=($)=>n.check(B4(Y$,$)),n.cidrv4=($)=>n.check(F4(I$,$)),n.cidrv6=($)=>n.check(N4(j$,$)),n.e164=($)=>n.check(S4(V$,$)),n.datetime=($)=>n.check(G0($)),n.date=($)=>n.check(t0($)),n.time=($)=>n.check(Q0($)),n.duration=($)=>n.check(W0($))});function o(n){return Z1(Cv,n)}var m=t("ZodStringFormat",(n,i)=>{e.init(n,i),U$.init(n,i)}),k$=t("ZodEmail",(n,i)=>{Zb.init(n,i),m.init(n,i)});function h4(n){return Q4(k$,n)}var Ui=t("ZodGUID",(n,i)=>{ob.init(n,i),m.init(n,i)});function C4(n){return jg(Ui,n)}var On=t("ZodUUID",(n,i)=>{Tb.init(n,i),m.init(n,i)});function E4(n){return W4(On,n)}function o4(n){return Y4(On,n)}function T4(n){return I4(On,n)}function Z4(n){return j4(On,n)}var Ji=t("ZodURL",(n,i)=>{rb.init(n,i),m.init(n,i)});function r4(n){return ug(Ji,n)}function m4(n){return ug(Ji,{protocol:/^https?$/,hostname:Yn.domain,...f.normalizeParams(n)})}var l$=t("ZodEmoji",(n,i)=>{mb.init(n,i),m.init(n,i)});function y4(n){return u4(l$,n)}var D$=t("ZodNanoID",(n,i)=>{yb.init(n,i),m.init(n,i)});function d4(n){return H4(D$,n)}var J$=t("ZodCUID",(n,i)=>{db.init(n,i),m.init(n,i)});function e4(n){return V4(J$,n)}var X$=t("ZodCUID2",(n,i)=>{eb.init(n,i),m.init(n,i)});function p4(n){return f4(X$,n)}var G$=t("ZodULID",(n,i)=>{pb.init(n,i),m.init(n,i)});function a4(n){return q4(G$,n)}var t$=t("ZodXID",(n,i)=>{ab.init(n,i),m.init(n,i)});function s4(n){return L4(t$,n)}var Q$=t("ZodKSUID",(n,i)=>{sb.init(n,i),m.init(n,i)});function n6(n){return K4(Q$,n)}var W$=t("ZodIPv4",(n,i)=>{gU.init(n,i),m.init(n,i)});function v6(n){return O4(W$,n)}var Mg=t("ZodMAC",(n,i)=>{_U.init(n,i),m.init(n,i)});function i6(n){return m1(Mg,n)}var Y$=t("ZodIPv6",(n,i)=>{wU.init(n,i),m.init(n,i)});function $6(n){return B4(Y$,n)}var I$=t("ZodCIDRv4",(n,i)=>{bU.init(n,i),m.init(n,i)});function g6(n){return F4(I$,n)}var j$=t("ZodCIDRv6",(n,i)=>{UU.init(n,i),m.init(n,i)});function w6(n){return N4(j$,n)}var u$=t("ZodBase64",(n,i)=>{lU.init(n,i),m.init(n,i)});function _6(n){return c4(u$,n)}var H$=t("ZodBase64URL",(n,i)=>{DU.init(n,i),m.init(n,i)});function b6(n){return P4(H$,n)}var V$=t("ZodE164",(n,i)=>{JU.init(n,i),m.init(n,i)});function U6(n){return S4(V$,n)}var f$=t("ZodJWT",(n,i)=>{XU.init(n,i),m.init(n,i)});function k6(n){return z4(f$,n)}var Ev=t("ZodCustomStringFormat",(n,i)=>{GU.init(n,i),m.init(n,i)});function l6(n,i,$={}){return n$(Ev,n,i,$)}function D6(n){return n$(Ev,"hostname",Yn.hostname,n)}function J6(n){return n$(Ev,"hex",Yn.hex,n)}function X6(n,i){let $=i?.enc??"hex",g=`${n}_${$}`,v=Yn[g];if(!v)throw Error(`Unrecognized hash format: ${g}`);return n$(Ev,g,v,i)}var ov=t("ZodNumber",(n,i)=>{J4.init(n,i),R.init(n,i),n._zod.processJSONSchema=(g,v,w)=>Nk(n,g,v,w),n.gt=(g,v)=>n.check(Ln(g,v)),n.gte=(g,v)=>n.check(Un(g,v)),n.min=(g,v)=>n.check(Un(g,v)),n.lt=(g,v)=>n.check(qn(g,v)),n.lte=(g,v)=>n.check(Xn(g,v)),n.max=(g,v)=>n.check(Xn(g,v)),n.int=(g)=>n.check(b$(g)),n.safe=(g)=>n.check(b$(g)),n.positive=(g)=>n.check(Ln(0,g)),n.nonnegative=(g)=>n.check(Un(0,g)),n.negative=(g)=>n.check(qn(0,g)),n.nonpositive=(g)=>n.check(Xn(0,g)),n.multipleOf=(g,v)=>n.check(yn(g,v)),n.step=(g,v)=>n.check(yn(g,v)),n.finite=()=>n;let $=n._zod.bag;n.minValue=Math.max($.minimum??Number.NEGATIVE_INFINITY,$.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,n.maxValue=Math.min($.maximum??Number.POSITIVE_INFINITY,$.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,n.isInt=($.format??"").includes("int")||Number.isSafeInteger($.multipleOf??0.5),n.isFinite=!0,n.format=$.format??null});function Tv(n){return a1(ov,n)}var lv=t("ZodNumberFormat",(n,i)=>{tU.init(n,i),ov.init(n,i)});function b$(n){return nk(lv,n)}function G6(n){return vk(lv,n)}function t6(n){return ik(lv,n)}function Q6(n){return $k(lv,n)}function W6(n){return gk(lv,n)}var Zv=t("ZodBoolean",(n,i)=>{Dg.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>ck(n,$,g,v)});function en(n){return wk(Zv,n)}var rv=t("ZodBigInt",(n,i)=>{X4.init(n,i),R.init(n,i),n._zod.processJSONSchema=(g,v,w)=>Pk(n,g,v,w),n.gte=(g,v)=>n.check(Un(g,v)),n.min=(g,v)=>n.check(Un(g,v)),n.gt=(g,v)=>n.check(Ln(g,v)),n.gte=(g,v)=>n.check(Un(g,v)),n.min=(g,v)=>n.check(Un(g,v)),n.lt=(g,v)=>n.check(qn(g,v)),n.lte=(g,v)=>n.check(Xn(g,v)),n.max=(g,v)=>n.check(Xn(g,v)),n.positive=(g)=>n.check(Ln(BigInt(0),g)),n.negative=(g)=>n.check(qn(BigInt(0),g)),n.nonpositive=(g)=>n.check(Xn(BigInt(0),g)),n.nonnegative=(g)=>n.check(Un(BigInt(0),g)),n.multipleOf=(g,v)=>n.check(yn(g,v));let $=n._zod.bag;n.minValue=$.minimum??null,n.maxValue=$.maximum??null,n.format=$.format??null});function Y6(n){return bk(rv,n)}var q$=t("ZodBigIntFormat",(n,i)=>{QU.init(n,i),rv.init(n,i)});function I6(n){return kk(q$,n)}function j6(n){return lk(q$,n)}var Rg=t("ZodSymbol",(n,i)=>{WU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>Sk(n,$,g,v)});function u6(n){return Dk(Rg,n)}var Ag=t("ZodUndefined",(n,i)=>{YU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>Mk(n,$,g,v)});function H6(n){return Jk(Ag,n)}var xg=t("ZodNull",(n,i)=>{IU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>zk(n,$,g,v)});function hg(n){return Xk(xg,n)}var Cg=t("ZodAny",(n,i)=>{jU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>xk(n,$,g,v)});function V6(){return Gk(Cg)}var Eg=t("ZodUnknown",(n,i)=>{uU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>hk(n,$,g,v)});function tn(){return tk(Eg)}var og=t("ZodNever",(n,i)=>{HU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>Ak(n,$,g,v)});function L$(n){return Qk(og,n)}var Tg=t("ZodVoid",(n,i)=>{VU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>Rk(n,$,g,v)});function f6(n){return Wk(Tg,n)}var Xi=t("ZodDate",(n,i)=>{fU.init(n,i),R.init(n,i),n._zod.processJSONSchema=(g,v,w)=>Ck(n,g,v,w),n.min=(g,v)=>n.check(Un(g,v)),n.max=(g,v)=>n.check(Xn(g,v));let $=n._zod.bag;n.minDate=$.minimum?new Date($.minimum):null,n.maxDate=$.maximum?new Date($.maximum):null});function q6(n){return Yk(Xi,n)}var Zg=t("ZodArray",(n,i)=>{qU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>sk(n,$,g,v),n.element=i.element,n.min=($,g)=>n.check(An($,g)),n.nonempty=($)=>n.check(An(1,$)),n.max=($,g)=>n.check(Uv($,g)),n.length=($,g)=>n.check(kv($,g)),n.unwrap=()=>n.element});function hn(n,i){return uk(Zg,n,i)}function L6(n){let i=n._zod.def.shape;return O$(Object.keys(i))}var Gi=t("ZodObject",(n,i)=>{LU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>n0(n,$,g,v),f.defineLazy(n,"shape",()=>{return i.shape}),n.keyof=()=>O$(Object.keys(n._zod.def.shape)),n.catchall=($)=>n.clone({...n._zod.def,catchall:$}),n.passthrough=()=>n.clone({...n._zod.def,catchall:tn()}),n.loose=()=>n.clone({...n._zod.def,catchall:tn()}),n.strict=()=>n.clone({...n._zod.def,catchall:L$()}),n.strip=()=>n.clone({...n._zod.def,catchall:void 0}),n.extend=($)=>{return f.extend(n,$)},n.safeExtend=($)=>{return f.safeExtend(n,$)},n.merge=($)=>f.merge(n,$),n.pick=($)=>f.pick(n,$),n.omit=($)=>f.omit(n,$),n.partial=(...$)=>f.partial(F$,n,$[0]),n.required=(...$)=>f.required(N$,n,$[0])});function $n(n,i){let $={type:"object",shape:n??{},...f.normalizeParams(i)};return new Gi($)}function K6(n,i){return new Gi({type:"object",shape:n,catchall:L$(),...f.normalizeParams(i)})}function O6(n,i){return new Gi({type:"object",shape:n,catchall:tn(),...f.normalizeParams(i)})}var ti=t("ZodUnion",(n,i)=>{Jg.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>R4(n,$,g,v),n.options=i.options});function K$(n,i){return new ti({type:"union",options:n,...f.normalizeParams(i)})}var rg=t("ZodXor",(n,i)=>{ti.init(n,i),KU.init(n,i),n._zod.processJSONSchema=($,g,v)=>R4(n,$,g,v),n.options=i.options});function B6(n,i){return new rg({type:"union",options:n,inclusive:!1,...f.normalizeParams(i)})}var mg=t("ZodDiscriminatedUnion",(n,i)=>{ti.init(n,i),OU.init(n,i)});function Qi(n,i,$){return new mg({type:"union",options:i,discriminator:n,...f.normalizeParams($)})}var yg=t("ZodIntersection",(n,i)=>{BU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>v0(n,$,g,v)});function dg(n,i){return new yg({type:"intersection",left:n,right:i})}var eg=t("ZodTuple",(n,i)=>{G4.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>i0(n,$,g,v),n.rest=($)=>n.clone({...n._zod.def,rest:$})});function pg(n,i,$){let g=i instanceof M,v=g?$:i;return new eg({type:"tuple",items:n,rest:g?i:null,...f.normalizeParams(v)})}var Wi=t("ZodRecord",(n,i)=>{FU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>$0(n,$,g,v),n.keyType=i.keyType,n.valueType=i.valueType});function pn(n,i,$){return new Wi({type:"record",keyType:n,valueType:i,...f.normalizeParams($)})}function F6(n,i,$){let g=bn(n);return g._zod.values=void 0,new Wi({type:"record",keyType:g,valueType:i,...f.normalizeParams($)})}function N6(n,i,$){return new Wi({type:"record",keyType:n,valueType:i,mode:"loose",...f.normalizeParams($)})}var ag=t("ZodMap",(n,i)=>{NU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>pk(n,$,g,v),n.keyType=i.keyType,n.valueType=i.valueType,n.min=(...$)=>n.check(Kn(...$)),n.nonempty=($)=>n.check(Kn(1,$)),n.max=(...$)=>n.check(dn(...$)),n.size=(...$)=>n.check(bv(...$))});function c6(n,i,$){return new ag({type:"map",keyType:n,valueType:i,...f.normalizeParams($)})}var sg=t("ZodSet",(n,i)=>{cU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>ak(n,$,g,v),n.min=(...$)=>n.check(Kn(...$)),n.nonempty=($)=>n.check(Kn(1,$)),n.max=(...$)=>n.check(dn(...$)),n.size=(...$)=>n.check(bv(...$))});function P6(n,i){return new sg({type:"set",valueType:n,...f.normalizeParams(i)})}var hv=t("ZodEnum",(n,i)=>{PU.init(n,i),R.init(n,i),n._zod.processJSONSchema=(g,v,w)=>Ek(n,g,v,w),n.enum=i.entries,n.options=Object.values(i.entries);let $=new Set(Object.keys(i.entries));n.extract=(g,v)=>{let w={};for(let _ of g)if($.has(_))w[_]=i.entries[_];else throw Error(`Key ${_} not found in enum`);return new hv({...i,checks:[],...f.normalizeParams(v),entries:w})},n.exclude=(g,v)=>{let w={...i.entries};for(let _ of g)if($.has(_))delete w[_];else throw Error(`Key ${_} not found in enum`);return new hv({...i,checks:[],...f.normalizeParams(v),entries:w})}});function O$(n,i){let $=Array.isArray(n)?Object.fromEntries(n.map((g)=>[g,g])):n;return new hv({type:"enum",entries:$,...f.normalizeParams(i)})}function S6(n,i){return new hv({type:"enum",entries:n,...f.normalizeParams(i)})}var nw=t("ZodLiteral",(n,i)=>{SU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>ok(n,$,g,v),n.values=new Set(i.values),Object.defineProperty(n,"value",{get(){if(i.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return i.values[0]}})});function Cn(n,i){return new nw({type:"literal",values:Array.isArray(n)?n:[n],...f.normalizeParams(i)})}var vw=t("ZodFile",(n,i)=>{zU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>rk(n,$,g,v),n.min=($,g)=>n.check(Kn($,g)),n.max=($,g)=>n.check(dn($,g)),n.mime=($,g)=>n.check(Fv(Array.isArray($)?$:[$],g))});function z6(n){return Hk(vw,n)}var iw=t("ZodTransform",(n,i)=>{MU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>ek(n,$,g,v),n._zod.parse=($,g)=>{if(g.direction==="backward")throw new vi(n.constructor.name);$.addIssue=(w)=>{if(typeof w==="string")$.issues.push(f.issue(w,$.value,i));else{let _=w;if(_.fatal)_.continue=!1;_.code??(_.code="custom"),_.input??(_.input=$.value),_.inst??(_.inst=n),$.issues.push(f.issue(_))}};let v=i.transform($.value,$);if(v instanceof Promise)return v.then((w)=>{return $.value=w,$});return $.value=v,$}});function B$(n){return new iw({type:"transform",transform:n})}var F$=t("ZodOptional",(n,i)=>{t4.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>A4(n,$,g,v),n.unwrap=()=>n._zod.def.innerType});function ki(n){return new F$({type:"optional",innerType:n})}var $w=t("ZodExactOptional",(n,i)=>{RU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>A4(n,$,g,v),n.unwrap=()=>n._zod.def.innerType});function gw(n){return new $w({type:"optional",innerType:n})}var ww=t("ZodNullable",(n,i)=>{AU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>g0(n,$,g,v),n.unwrap=()=>n._zod.def.innerType});function li(n){return new ww({type:"nullable",innerType:n})}function M6(n){return ki(li(n))}var _w=t("ZodDefault",(n,i)=>{xU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>_0(n,$,g,v),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function bw(n,i){return new _w({type:"default",innerType:n,get defaultValue(){return typeof i==="function"?i():f.shallowClone(i)}})}var Uw=t("ZodPrefault",(n,i)=>{hU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>b0(n,$,g,v),n.unwrap=()=>n._zod.def.innerType});function kw(n,i){return new Uw({type:"prefault",innerType:n,get defaultValue(){return typeof i==="function"?i():f.shallowClone(i)}})}var N$=t("ZodNonOptional",(n,i)=>{CU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>w0(n,$,g,v),n.unwrap=()=>n._zod.def.innerType});function lw(n,i){return new N$({type:"nonoptional",innerType:n,...f.normalizeParams(i)})}var Dw=t("ZodSuccess",(n,i)=>{EU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>mk(n,$,g,v),n.unwrap=()=>n._zod.def.innerType});function R6(n){return new Dw({type:"success",innerType:n})}var Jw=t("ZodCatch",(n,i)=>{oU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>U0(n,$,g,v),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function Xw(n,i){return new Jw({type:"catch",innerType:n,catchValue:typeof i==="function"?i:()=>i})}var Gw=t("ZodNaN",(n,i)=>{TU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>Tk(n,$,g,v)});function A6(n){return jk(Gw,n)}var c$=t("ZodPipe",(n,i)=>{ZU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>k0(n,$,g,v),n.in=i.in,n.out=i.out});function Di(n,i){return new c$({type:"pipe",in:n,out:i})}var P$=t("ZodCodec",(n,i)=>{c$.init(n,i),Xg.init(n,i)});function x6(n,i,$){return new P$({type:"pipe",in:n,out:i,transform:$.decode,reverseTransform:$.encode})}var tw=t("ZodReadonly",(n,i)=>{rU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>l0(n,$,g,v),n.unwrap=()=>n._zod.def.innerType});function Qw(n){return new tw({type:"readonly",innerType:n})}var Ww=t("ZodTemplateLiteral",(n,i)=>{mU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>Zk(n,$,g,v)});function h6(n,i){return new Ww({type:"template_literal",parts:n,...f.normalizeParams(i)})}var Yw=t("ZodLazy",(n,i)=>{eU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>J0(n,$,g,v),n.unwrap=()=>n._zod.def.getter()});function Iw(n){return new Yw({type:"lazy",getter:n})}var jw=t("ZodPromise",(n,i)=>{dU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>D0(n,$,g,v),n.unwrap=()=>n._zod.def.innerType});function C6(n){return new jw({type:"promise",innerType:n})}var uw=t("ZodFunction",(n,i)=>{yU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>dk(n,$,g,v)});function E6(n){return new uw({type:"function",input:Array.isArray(n?.input)?pg(n?.input):n?.input??hn(tn()),output:n?.output??tn()})}var Yi=t("ZodCustom",(n,i)=>{pU.init(n,i),R.init(n,i),n._zod.processJSONSchema=($,g,v)=>yk(n,$,g,v)});function o6(n){let i=new p({check:"custom"});return i._zod.check=n,i}function T6(n,i){return Vk(Yi,n??(()=>!0),i)}function Hw(n,i={}){return fk(Yi,n,i)}function Vw(n){return qk(n)}var Z6=Lk,r6=Kk;function m6(n,i={}){let $=new Yi({type:"custom",check:"custom",fn:(g)=>g instanceof n,abort:!0,...f.normalizeParams(i)});return $._zod.bag.Class=n,$._zod.check=(g)=>{if(!(g.value instanceof n))g.issues.push({code:"invalid_type",expected:n.name,input:g.value,inst:$,path:[...$._zod.def.path??[]]})},$}var y6=(...n)=>Ok({Codec:P$,Boolean:Zv,String:Cv},...n);function d6(n){let i=Iw(()=>{return K$([o(n),Tv(),en(),hg(),hn(i),pn(o(),i)])});return i}function e6(n,i){return Di(B$(n),i)}var Dv={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function I0(n){vn({customError:n})}function j0(){return vn().customError}var fw;(function(n){})(fw||(fw={}));var N={...Vg,...x4,iso:xv},n3=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function v3(n,i){let $=n.$schema;if($==="https://json-schema.org/draft/2020-12/schema")return"draft-2020-12";if($==="http://json-schema.org/draft-07/schema#")return"draft-7";if($==="http://json-schema.org/draft-04/schema#")return"draft-4";return i??"draft-2020-12"}function i3(n,i){if(!n.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let $=n.slice(1).split("/").filter(Boolean);if($.length===0)return i.rootSchema;let g=i.version==="draft-2020-12"?"$defs":"definitions";if($[0]===g){let v=$[1];if(!v||!i.defs[v])throw Error(`Reference not found: ${n}`);return i.defs[v]}throw Error(`Reference not found: ${n}`)}function Jl(n,i){if(n.not!==void 0){if(typeof n.not==="object"&&Object.keys(n.not).length===0)return N.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if(n.unevaluatedItems!==void 0)throw Error("unevaluatedItems is not supported");if(n.unevaluatedProperties!==void 0)throw Error("unevaluatedProperties is not supported");if(n.if!==void 0||n.then!==void 0||n.else!==void 0)throw Error("Conditional schemas (if/then/else) are not supported");if(n.dependentSchemas!==void 0||n.dependentRequired!==void 0)throw Error("dependentSchemas and dependentRequired are not supported");if(n.$ref){let v=n.$ref;if(i.refs.has(v))return i.refs.get(v);if(i.processing.has(v))return N.lazy(()=>{if(!i.refs.has(v))throw Error(`Circular reference not resolved: ${v}`);return i.refs.get(v)});i.processing.add(v);let w=i3(v,i),_=Dn(w,i);return i.refs.set(v,_),i.processing.delete(v),_}if(n.enum!==void 0){let v=n.enum;if(i.version==="openapi-3.0"&&n.nullable===!0&&v.length===1&&v[0]===null)return N.null();if(v.length===0)return N.never();if(v.length===1)return N.literal(v[0]);if(v.every((_)=>typeof _==="string"))return N.enum(v);let w=v.map((_)=>N.literal(_));if(w.length<2)return w[0];return N.union([w[0],w[1],...w.slice(2)])}if(n.const!==void 0)return N.literal(n.const);let $=n.type;if(Array.isArray($)){let v=$.map((w)=>{let _={...n,type:w};return Jl(_,i)});if(v.length===0)return N.never();if(v.length===1)return v[0];return N.union(v)}if(!$)return N.any();let g;switch($){case"string":{let v=N.string();if(n.format){let w=n.format;if(w==="email")v=v.check(N.email());else if(w==="uri"||w==="uri-reference")v=v.check(N.url());else if(w==="uuid"||w==="guid")v=v.check(N.uuid());else if(w==="date-time")v=v.check(N.iso.datetime());else if(w==="date")v=v.check(N.iso.date());else if(w==="time")v=v.check(N.iso.time());else if(w==="duration")v=v.check(N.iso.duration());else if(w==="ipv4")v=v.check(N.ipv4());else if(w==="ipv6")v=v.check(N.ipv6());else if(w==="mac")v=v.check(N.mac());else if(w==="cidr")v=v.check(N.cidrv4());else if(w==="cidr-v6")v=v.check(N.cidrv6());else if(w==="base64")v=v.check(N.base64());else if(w==="base64url")v=v.check(N.base64url());else if(w==="e164")v=v.check(N.e164());else if(w==="jwt")v=v.check(N.jwt());else if(w==="emoji")v=v.check(N.emoji());else if(w==="nanoid")v=v.check(N.nanoid());else if(w==="cuid")v=v.check(N.cuid());else if(w==="cuid2")v=v.check(N.cuid2());else if(w==="ulid")v=v.check(N.ulid());else if(w==="xid")v=v.check(N.xid());else if(w==="ksuid")v=v.check(N.ksuid())}if(typeof n.minLength==="number")v=v.min(n.minLength);if(typeof n.maxLength==="number")v=v.max(n.maxLength);if(n.pattern)v=v.regex(new RegExp(n.pattern));g=v;break}case"number":case"integer":{let v=$==="integer"?N.number().int():N.number();if(typeof n.minimum==="number")v=v.min(n.minimum);if(typeof n.maximum==="number")v=v.max(n.maximum);if(typeof n.exclusiveMinimum==="number")v=v.gt(n.exclusiveMinimum);else if(n.exclusiveMinimum===!0&&typeof n.minimum==="number")v=v.gt(n.minimum);if(typeof n.exclusiveMaximum==="number")v=v.lt(n.exclusiveMaximum);else if(n.exclusiveMaximum===!0&&typeof n.maximum==="number")v=v.lt(n.maximum);if(typeof n.multipleOf==="number")v=v.multipleOf(n.multipleOf);g=v;break}case"boolean":{g=N.boolean();break}case"null":{g=N.null();break}case"object":{let v={},w=n.properties||{},_=new Set(n.required||[]);for(let[k,l]of Object.entries(w)){let J=Dn(l,i);v[k]=_.has(k)?J:J.optional()}if(n.propertyNames){let k=Dn(n.propertyNames,i),l=n.additionalProperties&&typeof n.additionalProperties==="object"?Dn(n.additionalProperties,i):N.any();if(Object.keys(v).length===0){g=N.record(k,l);break}let J=N.object(v).passthrough(),Q=N.looseRecord(k,l);g=N.intersection(J,Q);break}if(n.patternProperties){let k=n.patternProperties,l=Object.keys(k),J=[];for(let j of l){let u=Dn(k[j],i),W=N.string().regex(new RegExp(j));J.push(N.looseRecord(W,u))}let Q=[];if(Object.keys(v).length>0)Q.push(N.object(v).passthrough());if(Q.push(...J),Q.length===0)g=N.object({}).passthrough();else if(Q.length===1)g=Q[0];else{let j=N.intersection(Q[0],Q[1]);for(let u=2;u<Q.length;u++)j=N.intersection(j,Q[u]);g=j}break}let U=N.object(v);if(n.additionalProperties===!1)g=U.strict();else if(typeof n.additionalProperties==="object")g=U.catchall(Dn(n.additionalProperties,i));else g=U.passthrough();break}case"array":{let{prefixItems:v,items:w}=n;if(v&&Array.isArray(v)){let _=v.map((k)=>Dn(k,i)),U=w&&typeof w==="object"&&!Array.isArray(w)?Dn(w,i):void 0;if(U)g=N.tuple(_).rest(U);else g=N.tuple(_);if(typeof n.minItems==="number")g=g.check(N.minLength(n.minItems));if(typeof n.maxItems==="number")g=g.check(N.maxLength(n.maxItems))}else if(Array.isArray(w)){let _=w.map((k)=>Dn(k,i)),U=n.additionalItems&&typeof n.additionalItems==="object"?Dn(n.additionalItems,i):void 0;if(U)g=N.tuple(_).rest(U);else g=N.tuple(_);if(typeof n.minItems==="number")g=g.check(N.minLength(n.minItems));if(typeof n.maxItems==="number")g=g.check(N.maxLength(n.maxItems))}else if(w!==void 0){let _=Dn(w,i),U=N.array(_);if(typeof n.minItems==="number")U=U.min(n.minItems);if(typeof n.maxItems==="number")U=U.max(n.maxItems);g=U}else g=N.array(N.any());break}default:throw Error(`Unsupported type: ${$}`)}if(n.description)g=g.describe(n.description);if(n.default!==void 0)g=g.default(n.default);return g}function Dn(n,i){if(typeof n==="boolean")return n?N.any():N.never();let $=Jl(n,i),g=n.type||n.enum!==void 0||n.const!==void 0;if(n.anyOf&&Array.isArray(n.anyOf)){let U=n.anyOf.map((l)=>Dn(l,i)),k=N.union(U);$=g?N.intersection($,k):k}if(n.oneOf&&Array.isArray(n.oneOf)){let U=n.oneOf.map((l)=>Dn(l,i)),k=N.xor(U);$=g?N.intersection($,k):k}if(n.allOf&&Array.isArray(n.allOf))if(n.allOf.length===0)$=g?$:N.any();else{let U=g?$:Dn(n.allOf[0],i),k=g?0:1;for(let l=k;l<n.allOf.length;l++)U=N.intersection(U,Dn(n.allOf[l],i));$=U}if(n.nullable===!0&&i.version==="openapi-3.0")$=N.nullable($);if(n.readOnly===!0)$=N.readonly($);let v={},w=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let U of w)if(U in n)v[U]=n[U];let _=["contentEncoding","contentMediaType","contentSchema"];for(let U of _)if(U in n)v[U]=n[U];for(let U of Object.keys(n))if(!n3.has(U))v[U]=n[U];if(Object.keys(v).length>0)i.registry.add($,v);return $}function p6(n,i){if(typeof n==="boolean")return n?N.any():N.never();let $=v3(n,i?.defaultTarget),g=n.$defs||n.definitions||{},v={version:$,defs:g,refs:new Map,processing:new Set,rootSchema:n,registry:i?.registry??wn};return Dn(n,v)}var Ii={};Nn(Ii,{string:()=>$3,number:()=>g3,date:()=>b3,boolean:()=>w3,bigint:()=>_3});function $3(n){return r1(Cv,n)}function g3(n){return s1(ov,n)}function w3(n){return _k(Zv,n)}function _3(n){return Uk(rv,n)}function b3(n){return Ik(Xi,n)}vn(Gg());var U3=S$;var Xl=S$??u0;if(typeof Xl.object!=="function")throw Error("Failed to resolve Zod namespace");var h=Xl;R_(b);var Wl=$n({}).passthrough().openapi({description:"Structured context for the error (varies by error code)"}),H0=$n({code:o().openapi({description:"Machine-stable error code from the error catalog",example:"session_not_found"}),message:o().openapi({description:"Human-readable error description",example:"The requested session does not exist."}),retryable:en().openapi({description:"Whether clients SHOULD retry this request",example:!1}),details:Wl.optional(),fix_hint:o().optional().openapi({description:"Actionable guidance for humans to resolve the error",example:"Verify the session ID is correct."})}).openapi("ErrorObject"),a6=$n({code:o().openapi({description:"Machine-stable warning code",example:"partial_data"}),message:o().openapi({description:"Human-readable warning description",example:"Some optional fields were unavailable."}),details:Wl.optional()}).openapi("ErrorWarning"),U7=$n({error:H0,trace_id:o().optional().openapi({description:"Distributed tracing correlation ID",example:"trace_abc123"}),request_id:o().openapi({description:"Unique request identifier",example:"req_xyz789"}),warnings:hn(a6).optional().openapi({description:"Non-fatal warnings returned alongside the error"})}).openapi("ErrorResponse"),Jv=o().min(1).max(64).regex(/^(?:[a-zA-Z0-9_-]+|[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+)$/,'repo_id must be a configured repo id or an "owner/repo" identifier').openapi({description:'Repository identifier or canonical "owner/repo" handle',example:"acme/docs"}),En=o().regex(/^[0-9a-f]{40}$|^[0-9a-f]{64}$/,"git_sha must be 40 or 64 lowercase hex characters").openapi({description:"Full Git SHA (40 chars for SHA-1, 64 for SHA-256)",example:"9f86d081884c7d659a2feaa0c55ad015a3bf4f1b"}),d=o().min(1).max(512).refine((n)=>!n.startsWith("/"),"file_path must be relative (no leading /)").refine((n)=>!n.includes(".."),"file_path must not contain path traversal (..)").refine((n)=>!n.includes("\x00"),"file_path must not contain NUL bytes").openapi({description:"Relative file path with no leading slash, traversal, or NUL bytes",example:"docs/guide.md"}),k3=$n({source_type:Cn("git"),repo_id:Jv,git_sha:En,file_path:d}).openapi("GitContentRef"),l3=$n({source_type:Cn("upload"),project_id:o().openapi({description:"Project identifier",example:"proj_docs"}),upload_batch_id:o().openapi({description:"Upload batch identifier",example:"upload_20260208"}),file_path:d.openapi({description:"Path to file in upload batch",example:"spec.md"})}).openapi("UploadContentRef"),ji=Qi("source_type",[k3,l3]).openapi("ContentRef"),D3=$n({type:Cn("session")}).openapi("SessionAnchor"),J3=$n({type:Cn("review")}).openapi("ReviewAnchor"),s6=o().regex(/^[a-z2-7]{16}$/,"block_id must be 16 lowercase base32 characters").openapi({description:"16-character lowercase base32 block identifier (truncated SHA-256)",example:"abcdefgh234567ab"}),X3=$n({type:Cn("block"),block_id:s6}).openapi("BlockAnchor"),G3=$n({type:Cn("range"),block_id:s6,start_offset:Tv().int().min(0).openapi({description:"Start byte offset within the block"}),end_offset:Tv().int().min(0).openapi({description:"End byte offset within the block"})}).openapi("RangeAnchor"),Xv=Qi("type",[D3,J3,X3,G3]).openapi("Anchor"),k7=o().optional().openapi({description:"Client-generated idempotency key for safe retries",example:"scope:install_abc:op_123"}),Yl=$n({limit:Ii.number().int().min(1).max(100).default(50).optional(),cursor:o().optional()}),l7=$n({next_cursor:o().nullable(),has_more:en()}),Gl=20,tl=64,Ql=256,t3=/^[a-zA-Z][a-zA-Z0-9_-]*$/,Gv=pn(o(),tn()).superRefine((n,i)=>{let $=Object.keys(n);if($.length>Gl){i.addIssue({code:Dv.custom,message:`Too many keys: ${$.length} exceeds maximum of ${Gl}`});return}for(let g of $){if(g.length<1||g.length>tl){i.addIssue({code:Dv.custom,message:`Key "${g}" length ${g.length} is outside range 1-${tl}`,path:[g]});continue}if(!t3.test(g))i.addIssue({code:Dv.custom,message:`Key "${g}" must start with a letter and contain only letters, digits, underscores, and hyphens`,path:[g]});let v=n[g];if(typeof v!=="string"){i.addIssue({code:Dv.custom,message:`Value for key "${g}" must be a string, got ${typeof v}`,path:[g]});continue}if(v.length>Ql)i.addIssue({code:Dv.custom,message:`Value for key "${g}" length ${v.length} exceeds maximum of ${Ql}`,path:[g]})}}).openapi("FlatJsonbMap"),D7=Gv.optional().default({});var Q3=$n({code:o(),message:o(),retryable:en(),details:pn(o(),tn()).optional(),fix_hint:o().optional()}),X7=$n({error:Q3,trace_id:o().optional(),request_id:o()}),W3=$n({code:o(),message:o().optional(),details:pn(o(),tn()).optional()}),G7=$n({data:tn().optional(),warnings:hn(W3).optional(),request_id:o()}),z$={UNAUTHORIZED:"unauthorized",TOKEN_EXPIRED:"token_expired",TOKEN_INVALID:"token_invalid",FORBIDDEN:"forbidden",STEP_UP_REQUIRED:"step_up_required",EXPORT_NOT_ALLOWED:"export_not_allowed",SESSION_READ_ONLY:"session_read_only",NOT_FOUND:"not_found",SESSION_NOT_FOUND:"session_not_found",THREAD_NOT_FOUND:"thread_not_found",COMMENT_NOT_FOUND:"comment_not_found",BLOCK_NOT_FOUND:"block_not_found",SOURCE_FILE_NOT_FOUND:"source_file_not_found",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotency_key_in_flight",VERSION_CONFLICT:"version_conflict",SOURCE_MISMATCH:"source_mismatch",PAYLOAD_TOO_LARGE:"payload_too_large",INVALID_ARGUMENT:"invalid_argument",INVALID_BLOCK_ID:"invalid_block_id",INVALID_ANCHOR:"invalid_anchor",INVALID_SHA:"invalid_sha",INVALID_PATH:"invalid_path",UNKNOWN_SCHEMA:"unknown_schema",VALIDATION_FAILED:"validation_failed",RATE_LIMITED:"rate_limited",DB_ERROR:"db_error",RENDER_ERROR:"render_error",STORAGE_ERROR:"storage_error",INTERNAL_ERROR:"internal_error",SOURCE_UNAVAILABLE:"source_unavailable",SOURCE_TIMEOUT:"source_timeout",SERVICE_UNAVAILABLE:"service_unavailable"};function Il(n){return[z$.IDEMPOTENCY_KEY_IN_FLIGHT,z$.RATE_LIMITED,z$.DB_ERROR,z$.SOURCE_UNAVAILABLE,z$.SOURCE_TIMEOUT,z$.SERVICE_UNAVAILABLE].includes(n)}var Hl=b.object({idempotency:b.enum(["always","keyed","none"]).optional(),retry_classification:b.enum(["safe","transient","manual"]).optional()}).openapi("AgentSurfaceRetrySemantics"),Y3=b.object({next_cursor:b.string().nullable().optional(),has_more:b.boolean().optional(),total:b.number().int().nonnegative().optional(),limit:b.number().int().positive().optional(),offset:b.number().int().nonnegative().optional()}).openapi("AgentSurfacePagination"),I3=b.object({artifact_kind:b.string().optional(),non_authoritative:b.boolean().optional(),status:b.string().optional(),target_type:b.string().optional(),target_id:b.string().optional(),provenance:b.object({source_type:b.string().optional(),source_label:b.string().optional(),source_model:b.string().optional()}).optional()}).openapi("AdvisorySurfaceSummary"),j3=b.object({ok:b.literal(!0),request_id:b.string(),result:b.unknown(),warnings:b.array(a6).optional(),pagination:Y3.optional(),advisory:I3.optional(),retry:Hl.optional()}).openapi("AgentSurfaceSuccessEnvelope"),u3=b.object({ok:b.literal(!1),error:H0,request_id:b.string(),warnings:b.array(a6).optional(),retry:Hl.optional()}).openapi("AgentSurfaceErrorEnvelope");function an(n){if(typeof n!=="object"||n===null||Array.isArray(n))return null;return n}function tv(n,i){let $=n[i];return typeof $==="string"&&$.trim().length>0?$:void 0}function Vl(n,i){let $=n[i];return typeof $==="boolean"?$:void 0}function V0(n,i){let $=n[i];if(typeof $!=="number"||!Number.isInteger($)||$<0)return;return $}function fl(n){if(!Array.isArray(n))return[];return n.flatMap((i)=>{if(typeof i==="string"&&i.trim().length>0)return[{code:"warning",message:i}];let $=an(i);if(!$)return[];let g=tv($,"message");if(!g)return[];let v=tv($,"code")??"warning",w=an($.details)??void 0;return[{code:v,message:g,...w?{details:w}:{}}]})}function jl(n){let i=an(n);if(!i)return;let $={},g=i.next_cursor;if(typeof g==="string"||g===null)$.next_cursor=g;if($.next_cursor===void 0&&(typeof i.cursor==="string"||i.cursor===null))$.next_cursor=i.cursor;let v=Vl(i,"has_more");if(v!==void 0)$.has_more=v;let w=V0(i,"total");if(w!==void 0)$.total=w;let _=V0(i,"limit");if(_!==void 0&&_>0)$.limit=_;let U=V0(i,"offset");if(U!==void 0)$.offset=U;return Object.keys($).length>0?$:void 0}function ul(n){let i=an(n);if(!i)return;let $=an(i.advisory_artifact)??an(i.advisory)??i,g=tv($,"artifact_kind"),v=Vl($,"non_authoritative"),w=tv($,"status"),_=an($.target),U=an($.provenance);if(g===void 0&&v===void 0&&_===null&&U===null)return;let k={};if(g!==void 0)k.artifact_kind=g;if(v!==void 0)k.non_authoritative=v;if(w!==void 0)k.status=w;if(_){let l=tv(_,"target_type"),J=tv(_,"target_id");if(l!==void 0)k.target_type=l;if(J!==void 0)k.target_id=J}if(U){let l={},J=tv(U,"source_type"),Q=tv(U,"source_label"),j=tv(U,"source_model");if(J!==void 0)l.source_type=J;if(Q!==void 0)l.source_label=Q;if(j!==void 0)l.source_model=j;if(Object.keys(l).length>0)k.provenance=l}return k}function ql(n){if(n.operation==="read")return"always";return n.hasIdempotencyKey?"keyed":"none"}function H3(n){if(typeof n.retryable==="boolean")return n.retryable;if(typeof n.errorCode==="string"&&Il(n.errorCode))return!0;if(n.statusCode===0||n.statusCode===429)return!0;return typeof n.statusCode==="number"&&n.statusCode>=500}function on(n){let i=ql(n);return{idempotency:i,retry_classification:i==="none"?"manual":"safe"}}function Ll(n){let i=ql(n);if(!H3(n))return{idempotency:i,retry_classification:"manual"};return{idempotency:i,retry_classification:i==="none"?"transient":"safe"}}function Kl(n,i,$){let g=fl(an(n)?.warnings),v={ok:!0,request_id:i,result:n,...g.length>0?{warnings:g}:{},...jl(n)?{pagination:jl(n)}:{},...ul(n)?{advisory:ul(n)}:{},...$?.retry?{retry:$.retry}:{}};return j3.parse(v),v}function Ol(n){let i=an(n.error.details)??void 0,$=fl(n.warnings),g={ok:!1,request_id:n.requestId,error:{code:n.error.code,message:n.error.message,retryable:n.error.retryable,request_id:n.requestId,...i?{details:i}:{},...n.error.fix_hint?{fix_hint:n.error.fix_hint}:{}},...$.length>0?{warnings:$}:{},...n.retry?{retry:n.retry}:{}};return u3.parse(g),g}var n_=b.enum(["content","rules"]).openapi("ReviewRole"),v_=b.enum(["draft","created","active","closed","expired","superseded","archived","deleted"]).openapi("ReviewState"),Bl=b.enum(["draft","published","deprecated"]).openapi("ReviewPublicationStatus"),V3=b.enum(["git","upload"]).openapi("ReviewSourceType"),f0=b.enum(["reviewer","approver","observer","owner"]).openapi("ReviewParticipantRole"),Fl=b.enum(["read","comment","approve","admin"]).openapi("ReviewParticipantScope"),Nl=b.enum(["pending","invited","active","failed","bounced"]).openapi("ReviewParticipantInviteStatus"),cl=b.enum(["pending","delivered","failed","bounced"]).openapi("ReviewParticipantDeliveryState"),f3=b.enum(["not_started","in_progress","complete"]).openapi("ReviewParticipantReviewStatus"),q3=b.object({email:b.string().email(),name:b.string().max(256).optional(),role:f0,scopes:b.array(Fl).min(1)}).openapi("ReviewParticipantInput"),L3=b.object({participant_id:b.string(),email:b.string().email(),roles:b.array(f0),display_name:b.string().nullable(),joined_at:b.string().datetime().nullable(),last_seen_at:b.string().datetime().nullable(),invite_status:Nl,review_status:f3,review_completed_at:b.string().datetime().nullable(),magic_link_opened_at:b.string().datetime().nullable(),delivery_state:cl.nullable()}).openapi("ReviewParticipantSummary"),K3=b.object({participant_id:b.string(),email:b.string().email(),roles:b.array(f0),review_link_id:b.string(),scope:Fl,expires_at:b.string().datetime().nullable(),revoked_at:b.string().datetime().nullable(),invite_status:Nl,delivery_state:cl.nullable()}).openapi("ReviewInvitationSummary"),j7=b.object({repo_id:Jv.optional(),git_sha:En.optional(),file_path:d,document_type:b.enum(["markdown","pdf","image_set"]).default("markdown"),title:b.string().max(512).optional(),source_context:b.record(b.string(),b.unknown()).optional(),extra:b.record(b.string(),b.unknown()).optional(),role:n_.default("content"),applicability:Gv.optional(),properties:Gv.optional(),identity_restriction:b.enum(["open","participants_only","domain"]).default("open"),allowed_email_domains:b.array(b.string().min(1).max(253)).max(50).optional(),participants:b.array(q3).max(100).optional(),idempotency_key:b.string().max(256).optional(),supersedes_review_id:b.string().optional(),carry_forward_threads:b.boolean().optional(),carry_forward_filter:b.enum(["all","blocking","needs_changes"]).optional(),project_id:b.string().optional(),upload_batch_id:b.string().optional(),content_body:b.string().max(1048576).optional(),focus_areas:b.array(b.string().max(100)).max(10).optional(),framing:b.string().max(1000).optional(),operator_name:b.string().max(200).optional()}).superRefine((n,i)=>{if(n.role!=="rules"&&n.applicability!==void 0&&Object.keys(n.applicability).length>0)i.addIssue({code:b.ZodIssueCode.custom,message:"applicability is only valid when role is 'rules'. Content reviews must not specify applicability.",path:["applicability"]});if(n.identity_restriction==="domain"&&(!Array.isArray(n.allowed_email_domains)||n.allowed_email_domains.length===0))i.addIssue({code:b.ZodIssueCode.custom,message:'allowed_email_domains is required and must be non-empty when identity_restriction is "domain"',path:["allowed_email_domains"]})}).openapi("CreateReviewRequest"),O3=b.object({review_id:b.string(),role:n_,state:v_,publication_status:Bl.nullable().optional(),title:b.string().nullable(),file_path:b.string(),block_count:b.number().int().nonnegative(),created_at:b.string().datetime(),updated_at:b.string().datetime()}).openapi("ReviewSummary"),u7=b.object({review_id:b.string(),role:n_,state:v_,publication_status:Bl.nullable().optional(),source_type:V3,document_type:b.enum(["markdown","pdf","image_set"]),repo_id:b.string().nullable(),git_sha:b.string().nullable(),file_path:b.string(),title:b.string().nullable(),source_context:b.record(b.string(),b.unknown()).nullable(),extra:b.record(b.string(),b.unknown()).nullable(),identity_restriction:b.enum(["open","participants_only","domain"]),allowed_email_domains:b.array(b.string()).nullable(),applicability:b.record(b.string(),b.unknown()),properties:b.record(b.string(),b.unknown()),block_count:b.number().int().nonnegative(),root_review_id:b.string(),supersedes_review_id:b.string().nullable(),superseded_by_review_id:b.string().nullable(),created_at:b.string().datetime(),updated_at:b.string().datetime(),participants:b.array(L3),invitations:b.array(K3),summary:b.object({total_threads:b.number().int().nonnegative(),open_threads:b.number().int().nonnegative(),blocking_threads:b.number().int().nonnegative(),resolved_threads:b.number().int().nonnegative(),total_findings:b.number().int().nonnegative().optional(),open_findings:b.number().int().nonnegative().optional(),blocking_findings:b.number().int().nonnegative().optional(),resolved_findings:b.number().int().nonnegative().optional()}),request_id:b.string()}).openapi("ReviewDetailResponse"),H7=b.object({role:n_.optional(),state:v_.optional(),cursor:b.string().optional(),limit:b.coerce.number().int().min(1).max(100).default(25)}).openapi("ListReviewsQuery"),V7=b.object({reviews:b.array(O3),next_cursor:b.string().nullable(),has_more:b.boolean(),request_id:b.string()}).openapi("ListReviewsResponse"),f7=b.object({state:v_}).openapi("PatchReviewRequest"),q7=b.object({git_sha:b.string().optional(),file_path:b.string().optional(),title:b.string().max(512).optional(),applicability:Gv.optional(),properties:Gv.optional(),idempotency_key:b.string().max(256).optional(),changes_summary:b.string().max(5000).optional(),carry_forward_threads:b.boolean().optional(),carry_forward_filter:b.enum(["all","blocking","needs_changes"]).optional()}).openapi("ReviseReviewRequest");var Pl=b.enum(["suggestion","needs_changes","blocking"]).openapi({description:"Thread severity level"}),Sl=b.enum(["inline","append","hero"]).openapi("CommentAttachmentPlacement"),zl=b.enum(["before","after"]).openapi("CommentAttachmentAnchorPosition"),B3=b.object({mime_type:b.string().min(1),width:b.number().int().nullable(),height:b.number().int().nullable(),blurhash:b.string().nullable()}).openapi("CommentAttachmentAsset"),q0=b.object({asset_id:b.string().min(1),sort_order:b.number().int().nonnegative(),placement:Sl,alt_text:b.string().max(500).nullable().optional(),caption:b.string().max(2000).nullable().optional(),anchor_block_id:b.string().nullable().optional(),anchor_position:zl.nullable().optional(),spatial_x:b.number().min(0).max(100).nullable().optional(),spatial_y:b.number().min(0).max(100).nullable().optional()}).openapi("CommentAttachmentRequest"),i_=b.object({asset_id:b.string().min(1),sort_order:b.number().int().nonnegative(),placement:Sl,alt_text:b.string().nullable(),caption:b.string().nullable(),anchor_block_id:b.string().nullable(),anchor_position:zl.nullable(),spatial_x:b.number().nullable(),spatial_y:b.number().nullable(),asset:B3}).openapi("CommentAttachmentResponse"),Ml=b.object({id:b.string().openapi({description:"Unique comment identifier",example:"cmt_xyz789"}),thread_id:b.string(),author_email:b.string().email(),author_name:b.string().nullable(),body_md:b.string().openapi({description:"Comment body in Markdown"}),body_html:b.string().openapi({description:"Rendered HTML of the comment body"}),created_at:b.string().datetime(),updated_at:b.string().datetime().nullable(),version:b.number().int().min(1).openapi({description:"Edit version (starts at 1)"})}).openapi("Comment"),O7=b.object({anchor:Xv.openapi({description:"Where this thread is anchored in the document"}),body_md:b.string().min(1).max(65536).openapi({description:"Initial comment body in Markdown (UTF-8, max 64KB)"}),severity:Pl.optional().default("suggestion")}).openapi("CreateThreadRequest"),Rl=b.object({id:b.string().openapi({description:"Unique thread identifier",example:"thr_abc123"}),session_id:b.string(),anchor:Xv,status:b.enum(["open","resolved"]).openapi({description:"Thread status"}),severity:Pl,created_at:b.string().datetime(),updated_at:b.string().datetime(),comment_count:b.number().int().min(1),comments:b.array(Ml).optional().openapi({description:"Comments in this thread (included on creation)"})}).openapi("Thread"),B7=Rl.openapi("CreateThreadResponse"),F7=b.object({body_md:b.string().min(1).max(65536).openapi({description:"Comment body in Markdown (UTF-8, max 64KB)"})}).openapi("CreateCommentRequest"),N7=Ml.openapi("CreateCommentResponse"),c7=b.object({status:b.enum(["open","resolved"])}).openapi("UpdateThreadStatusRequest"),P7=Rl.openapi("UpdateThreadStatusResponse"),S7=b.object({session_id:b.string(),thread_id:b.string()}),z7=b.object({session_id:b.string(),thread_id:b.string(),comment_id:b.string()});var qw=b.enum(["open","resolved","withdrawn","wont_fix"]).openapi("FindingStatus"),M$=b.enum(["suggestion","needs_changes","blocking"]).openapi("FindingSeverity"),F3=["undecided","accepted","rejected","deferred","duplicate","needs_more_info","dismissed","waived"],L0=b.enum(F3).openapi("FindingDecisionState"),x7=b.object({anchor:Xv,body_md:b.string().min(1).max(65536),severity:M$.optional(),attachments:b.array(q0).max(50).optional(),idempotency_key:b.string().max(256).optional(),source_review_id:b.string().optional(),source_finding_id:b.string().optional()}).openapi("CreateFindingRequest"),h7=b.object({finding_id:b.string(),comment_id:b.string(),attachments:b.array(i_),request_id:b.string()}).openapi("CreateFindingResponse"),C7=b.object({status:qw.optional(),severity:M$.optional(),block_id:b.string().optional(),q:b.string().max(200).optional(),cursor:b.string().optional(),limit:b.coerce.number().int().min(1).max(100).default(50)}).openapi("ListFindingsQuery"),N3=b.object({finding_id:b.string(),status:qw,severity:M$.nullable(),anchor:Xv,comment_count:b.number().int().nonnegative(),body_preview:b.string().nullable().optional(),created_at:b.string().datetime(),updated_at:b.string().datetime()}).openapi("FindingSummary"),E7=b.object({findings:b.array(N3),next_cursor:b.string().nullable(),has_more:b.boolean(),request_id:b.string()}).openapi("ListFindingsResponse"),c3=b.object({comment_id:b.string(),body_md:b.string(),author_name:b.string().nullable(),author_email:b.string().nullable(),attachments:b.array(i_),created_at:b.string().datetime()}).openapi("FindingComment"),P3=b.object({block_id:b.string(),block_key:b.string().nullable(),block_type:b.string(),properties:b.record(b.string(),b.unknown())}).openapi("FindingBlockContext"),S3=b.object({outcome:L0,decided_at:b.string().datetime(),decided_by:b.string().nullable()}).openapi("FindingDecision"),o7=b.object({finding_id:b.string(),review_id:b.string(),status:qw,severity:M$.nullable(),anchor:Xv,block_context:P3.nullable(),comments:b.array(c3),decision:S3.nullable(),created_at:b.string().datetime(),updated_at:b.string().datetime(),request_id:b.string()}).openapi("FindingDetailResponse"),T7=b.object({status:qw.optional(),severity:M$.optional(),expected_version:b.number().int().positive().optional()}).openapi("PatchFindingRequest"),Z7=b.object({finding_id:b.string(),review_id:b.string(),status:qw,severity:M$.nullable(),version:b.number().int().positive(),updated_at:b.string().datetime(),request_id:b.string()}).openapi("PatchFindingResponse"),r7=b.object({body_md:b.string().min(1).max(65536),attachments:b.array(q0).max(50).optional(),idempotency_key:b.string().max(256).optional()}).openapi("CreateFindingCommentRequest"),m7=b.object({comment_id:b.string(),attachments:b.array(i_),request_id:b.string()}).openapi("CreateFindingCommentResponse"),y7=b.object({state:L0,rationale_md:b.string().min(1).max(65536).optional(),expected_version:b.number().int().positive().optional()}).openapi("CreateFindingDecisionRequest"),d7=b.object({decision_id:b.string(),finding_id:b.string(),state:L0,request_id:b.string()}).openapi("CreateFindingDecisionResponse"),e7=b.object({evidence_type:b.string().min(1),evidence_json:b.record(b.string(),b.unknown()),dedupe_key:b.string().max(256).optional()}).openapi("CreateFindingEvidenceRequest"),p7=b.object({evidence_id:b.string(),finding_id:b.string(),type:b.string(),request_id:b.string()}).openapi("CreateFindingEvidenceResponse");var z3=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function sn(n,i){return n>>>i|n<<32-i}function xl(n){let i=new TextEncoder().encode(n),$=i.length+9+63>>6<<6>>>0,g=new Uint8Array($);g.set(i),g[i.length]=128;let v=i.length*8,w=new DataView(g.buffer);w.setUint32($-8,Math.floor(v/4294967296),!1),w.setUint32($-4,v>>>0,!1);let _=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],U=new Uint32Array(64);for(let k=0;k<$;k+=64){for(let O=0;O<16;O++)U[O]=w.getUint32(k+O*4,!1);for(let O=16;O<64;O++){let E=sn(U[O-15],7)^sn(U[O-15],18)^U[O-15]>>>3,T=sn(U[O-2],17)^sn(U[O-2],19)^U[O-2]>>>10;U[O]=(U[O-16]+E|0)+(U[O-7]+T|0)>>>0}let[l,J,Q,j,u,W,Y,B]=_;for(let O=0;O<64;O++){let E=sn(u,6)^sn(u,11)^sn(u,25),T=u&W^~u&Y,a=B+E+T+z3[O]+U[O]>>>0,s=sn(l,2)^sn(l,13)^sn(l,22),r=l&J^l&Q^J&Q,gn=s+r>>>0;B=Y,Y=W,W=u,u=j+a>>>0,j=Q,Q=J,J=l,l=a+gn>>>0}_[0]=_[0]+l>>>0,_[1]=_[1]+J>>>0,_[2]=_[2]+Q>>>0,_[3]=_[3]+j>>>0,_[4]=_[4]+u>>>0,_[5]=_[5]+W>>>0,_[6]=_[6]+Y>>>0,_[7]=_[7]+B>>>0}return _.map((k)=>k.toString(16).padStart(8,"0")).join("")}var $_=h.object({rule_session_id:h.string(),rule_block_id:h.string(),rule_block_key:h.string().optional(),strength:h.enum(["must","should","may","must_not"]),category:h.string(),rule_content:h.string(),rule_session_name:h.string(),applicability_match_reason:h.string().optional()}),M3=3600000,Al=86400000,R3=h.object({repo_id:h.string().nullable(),file_path:h.string().nullable(),review_id:h.string().nullable()}),A3=h.object({fetched_at:h.string(),server_etag:h.string(),latest_rule_session_updated_at:h.string().nullable(),contributing_session_count:h.number().int().nonnegative(),total_rule_count:h.number().int().nonnegative()}),x3=h.object({text:h.string(),json_payload:h.unknown().optional(),structured_payload:h.unknown().optional()}),h3=h.object({scope:R3,compiled_hash:h.string(),rules:h.array(h.object({source_review_id:h.string(),block_id:h.string(),block_index:h.number().int().nonnegative(),strength:h.enum(["must","should","may","must_not"]),category:h.string().nullable(),rule_text:h.string(),specificity:h.number().int().nonnegative(),applicability:h.record(h.string(),h.string())})),plain_text_bundle:h.string(),freshness:A3,rulepack_schema_version:h.literal("rulepack.v1"),renderings:x3.optional()});function C3(n,i){return xl(JSON.stringify({plain_text_bundle:n,rules:i}))}function g_(n){return xl(JSON.stringify({repo_id:n.repo_id,file_path:n.file_path,review_id:n.review_id}))}function K0(n){let i=typeof n.compiled_hash==="string"&&n.compiled_hash.length>0?n.compiled_hash:C3(n.plain_text_bundle,n.rules),$={scope:n.scope,compiled_hash:i,rules:n.rules,plain_text_bundle:n.plain_text_bundle,freshness:{fetched_at:n.fetched_at,server_etag:n.server_etag??`"rules:${i}"`,latest_rule_session_updated_at:n.freshness.latest_rule_session_updated_at,contributing_session_count:n.freshness.contributing_session_count,total_rule_count:n.freshness.total_rule_count},rulepack_schema_version:"rulepack.v1",...n.renderings?{renderings:n.renderings}:{}};return h3.parse($),$}function E3(n){let i=Math.max(0,Math.floor(n/1000));if(i<60)return`${i}s`;let $=Math.floor(i/60);if($<60)return`${$}m`;let g=Math.floor($/60);if(g<48)return`${g}h`;return`${Math.floor(g/24)}d`}function hl(n,i=new Date){let $=Date.parse(n);if(!Number.isFinite($))return{status:"confirmed_stale",age_ms:Number.POSITIVE_INFINITY,age_seconds:Number.POSITIVE_INFINITY,warning:"Using cached rules with an invalid fetched_at timestamp. Rules may have changed."};let g=Math.max(0,i.getTime()-$),v=Math.floor(g/1000);if(g<=M3)return{status:"fresh",age_ms:g,age_seconds:v,warning:null};let w=E3(g),_=g>Al?`Cached rules are over ${w} old. Strongly recommend reconnecting to verify rules are current.`:`Using cached rules (fetched ${w} ago). Rules may have changed.`;return{status:g>Al?"confirmed_stale":"presumed_stale",age_ms:g,age_seconds:v,warning:_}}var Cl=b.enum(["must","should","may","must_not"]).openapi("RuleStrength"),o3=b.enum(["error","warning","info"]).openapi("RuleCheckFindingSeverity"),T3=b.enum(["document"]).openapi("RuleCheckAnchorMode"),Z3=b.object({rule_text:b.string(),strength:Cl,category:b.string().nullable(),source_review_id:b.string(),block_id:b.string(),block_index:b.number().int().nonnegative(),specificity:b.number().int().nonnegative(),applicability:b.record(b.string(),b.string())}).openapi("MatchedRuleResponse"),El=b.object({latest_rule_session_updated_at:b.string().datetime().nullable(),contributing_session_count:b.number().int().nonnegative(),total_rule_count:b.number().int().nonnegative()}).openapi("RuleBundleFreshness"),$u=b.object({format:b.enum(["json","text","prompt"]).default("json"),limit:b.coerce.number().int().min(1).max(200).default(50),offset:b.coerce.number().int().nonnegative().default(0),collection_id:b.string().optional()}).openapi("ListRulesQuery"),gu=b.object({rules:b.array(Z3),total:b.number().int().nonnegative(),limit:b.number().int().positive(),offset:b.number().int().nonnegative(),freshness:El,compiled_hash:b.string(),request_id:b.string()}).openapi("ListRulesResponse"),wu=b.object({content:b.string().min(1).max(1048576),properties:Gv.optional().default({}),collection_id:b.string().optional(),idempotency_key:b.string().max(256).optional()}).strict().openapi("RuleCheckRequest"),r3=b.object({block_index:b.number().int().nonnegative(),severity:o3,message:b.string(),rule_ref:$_.optional()}).openapi("RuleCheckFinding"),m3=b.object({total:b.number().int().nonnegative(),blocking:b.number().int().nonnegative(),warnings:b.number().int().nonnegative(),suggestions:b.number().int().nonnegative()}).openapi("RuleCheckSummary"),_u=b.object({findings:b.array(r3),summary:m3,anchor_mode:T3.optional(),rules_evaluated:b.number().int().nonnegative(),freshness:El,compiled_hash:b.string(),request_id:b.string()}).openapi("RuleCheckResponse"),y3=b.object({source:b.enum(["manual","findings","external"]),source_review_id:b.string().optional(),source_label:b.string().max(256).optional()}).openapi("RuleImportProvenance"),bu=b.object({content:b.string().min(1).max(524288),title:b.string().max(512).optional(),applicability:Gv.optional(),provenance:y3.optional(),preview:b.boolean().default(!1),idempotency_key:b.string().max(256).optional()}).strict().openapi("RuleImportRequest"),ol=b.object({source:b.enum(["manual","findings","external"]),source_review_id:b.string().optional(),source_label:b.string().max(256).optional(),content_bytes:b.number().int().positive(),review_title:b.string().nullable()}).openapi("RuleImportMetadata"),Tl=b.object({block_index:b.number().int().nonnegative(),strength:Cl,category:b.string().nullable(),plaintext:b.string()}).openapi("ParsedRuleBlock"),d3=b.object({preview:b.literal(!0),parsed_rules:b.array(Tl),total_rules:b.number().int().nonnegative(),warnings:b.array(b.string()),import_metadata:ol,request_id:b.string()}).openapi("RuleImportPreviewResponse"),e3=b.object({preview:b.literal(!1),review_id:b.string(),state:b.literal("draft"),parsed_rules:b.array(Tl),total_rules:b.number().int().nonnegative(),warnings:b.array(b.string()),import_metadata:ol,request_id:b.string()}).openapi("RuleImportCreateResponse"),Uu=b.discriminatedUnion("preview",[d3,e3]);var O0=b.record(b.string(),b.unknown()).openapi("ProjectConfig"),p3=b.enum(["active","deleting","deleted"]).openapi("ProjectState"),Du=b.object({name:b.string().min(1).max(256),config:O0.optional()}).openapi("CreateProjectRequest"),Ju=b.object({name:b.string().min(1).max(256).optional(),config:O0.optional()}).openapi("UpdateProjectRequest"),Xu=b.object({cursor:b.string().optional(),limit:b.coerce.number().int().min(1).max(100).default(20)}).openapi("ListProjectsQuery"),a3=b.object({id:b.string(),status:b.string(),file_count:b.number().int().nonnegative(),total_size_bytes:b.number().int().nonnegative(),created_at:b.string().datetime()}).openapi("ProjectLatestBatch"),s3=b.object({id:b.string(),name:b.string(),state:p3,tenant_id:b.string(),config_hash:b.string().nullable(),config:O0.nullable(),created_by_user_id:b.string().nullable(),created_at:b.string().datetime(),latest_batch:a3.nullable().optional(),request_id:b.string()}).openapi("ProjectResponse"),Gu=b.object({items:b.array(s3.omit({request_id:!0})),next_cursor:b.string().nullable(),has_more:b.boolean(),request_id:b.string()}).openapi("ListProjectsResponse"),tu=b.object({project_id:b.string(),state:b.literal("deleting"),deletion_job_id:b.string(),request_id:b.string()}).openapi("DeleteProjectResponse"),Qu=b.object({from_path:d,to_path:d}).refine((n)=>n.from_path!==n.to_path,{message:"from_path and to_path must differ",path:["to_path"]}).openapi("CreateProjectMoveRequest"),Wu=b.object({id:b.string(),project_id:b.string(),from_path:d,to_path:d,declared_at:b.string().datetime(),request_id:b.string()}).openapi("ProjectMoveResponse");var B0=b.enum(["git","upload"]).openapi("SessionTemplateSourceType"),nW=b.object({participant_id:b.string().min(1).max(256),scope:b.enum(["read","comment","approve"])}).openapi("SessionTemplateParticipantConfig"),vW=b.object({slack_channel:b.string().max(256).optional(),email_participants:b.boolean().optional()}).openapi("SessionTemplateNotificationConfig"),Zl=b.object({participants:b.array(nW).max(100).optional(),checks_enabled:b.boolean().optional(),policy_enabled:b.boolean().optional(),steering_enabled:b.boolean().optional(),extra_json:b.record(b.string(),b.unknown()).optional(),notification_config:vW.optional()}).openapi("SessionTemplateConfig"),ju=b.object({name:b.string().min(1).max(256),description:b.string().max(4000).optional(),source_type:B0,repo_id:b.string().max(256).optional(),project_id:b.string().max(256).optional(),config:Zl}).openapi("CreateSessionTemplateRequest"),uu=b.object({source_type:B0.optional(),repo_id:b.string().optional(),project_id:b.string().optional(),include_archived:b.boolean().optional(),cursor:b.string().optional(),limit:b.coerce.number().int().min(1).max(100).default(20)}).openapi("ListSessionTemplatesQuery"),iW=b.object({id:b.string(),tenant_id:b.string(),name:b.string(),description:b.string().nullable(),source_type:B0,repo_id:b.string().nullable(),project_id:b.string().nullable(),config:Zl,created_by_user_id:b.string().nullable(),created_at:b.string().datetime(),updated_at:b.string().datetime(),archived_at:b.string().datetime().nullable(),request_id:b.string()}).openapi("SessionTemplateResponse"),Hu=b.object({items:b.array(iW.omit({request_id:!0})),next_cursor:b.string().nullable(),request_id:b.string()}).openapi("ListSessionTemplatesResponse");var Lw=b.string().min(1).max(36).openapi("ReviewSetId"),R$=b.enum(["git","upload"]).openapi("ReviewSetSourceType"),w_=b.enum(["review_set","release_bundle","packet"]).openapi("ReviewSetKind"),rl=b.enum(["active","closed","archived","deleted"]).openapi("ReviewSetState"),$W=b.enum(["topo","lex","lex_fallback"]).openapi("ReviewSetOrderingMethod"),gW=b.enum(["reviewer","approver"]).openapi("ReviewSetParticipantRole"),wW=b.object({email:b.string().email(),roles:b.array(gW).min(1)}).openapi("ReviewSetParticipant"),_W=b.union([b.string(),b.object({review_id:b.string().optional(),session_id:b.string().optional(),required:b.boolean().optional()}).refine((n)=>typeof n.review_id==="string"||typeof n.session_id==="string",{message:"review_id is required for review entries",path:["review_id"]})]).openapi("ReviewSetSessionEntry"),bW=b.object({repo_id:Jv,git_sha:En,file_path:d,required:b.boolean().optional()}).openapi("ReviewSetGitFileEntry"),UW=b.object({project_id:b.string(),upload_batch_id:b.string(),file_path:d,required:b.boolean().optional()}).openapi("ReviewSetUploadFileEntry"),kW=b.union([bW,UW]).openapi("ReviewSetFileEntry"),lW=b.object({allow_mixed_shas:b.boolean().optional(),require_all_files_reviewed:b.boolean().optional()}).openapi("ReviewSetConfig"),qu=b.object({title:b.string().optional(),kind:w_.optional(),source_type:R$,reviews:b.array(_W).max(200).optional(),files:b.array(kW).max(200).optional(),participants:b.array(wW).max(100).optional(),recipe_json:b.record(b.string(),b.unknown()).optional(),config:lW.optional()}).openapi("CreateReviewSetRequest"),DW=b.object({review_id:b.string(),file_path:d,position:b.number().int().nonnegative(),required:b.boolean()}).openapi("ReviewSetItem"),JW=b.object({email:b.string().email(),roles:b.array(b.string()),review_url:b.string().url(),delivery:b.object({channel:b.literal("email"),state:b.literal("pending")})}).openapi("ReviewSetInvitation"),XW=b.object({review_id:b.string(),invitations:b.array(JW)}).openapi("ReviewSetPerFileLinks"),Lu=b.object({id:Lw,title:b.string(),kind:w_,state:b.literal("active"),source_type:R$,repo_id:b.string().nullable(),git_sha:b.string().nullable(),project_id:b.string().nullable(),upload_batch_id:b.string().nullable(),ordering_method:$W,items:b.array(DW),links:b.object({set_link:b.string().url()}),per_file_links:b.array(XW),event_id:b.string(),created_at:b.string().datetime(),request_id:b.string().nullable()}).openapi("CreateReviewSetResponse"),ml=b.object({id:Lw,title:b.string().nullable(),kind:w_,state:rl,source_type:R$,repo_id:b.string().nullable(),git_sha:b.string().nullable(),project_id:b.string().nullable(),upload_batch_id:b.string().nullable(),item_count:b.number().int().nonnegative(),created_at:b.string().datetime(),updated_at:b.string().datetime()}).openapi("ReviewSetSummary"),Ku=b.object({source_type:R$.optional(),repo_id:Jv.optional(),git_sha:En.optional(),project_id:b.string().optional(),upload_batch_id:b.string().optional(),kind:w_.optional(),state:rl.optional(),cursor:b.string().optional(),limit:b.coerce.number().int().min(1).max(100).default(20)}).openapi("ListReviewSetsQuery"),Ou=b.object({items:b.array(ml),next_cursor:b.string().nullable(),request_id:b.string()}).openapi("ListReviewSetsResponse"),Bu=b.object({title:b.string().min(1).max(4096).optional(),state:b.enum(["active","closed","archived"]).optional()}).refine((n)=>n.title!==void 0||n.state!==void 0,"At least one field must be provided").openapi("UpdateReviewSetRequest"),Fu=ml.extend({request_id:b.string()}).openapi("UpdateReviewSetResponse"),yl=b.enum(["pass","fail","warn"]).openapi("ReviewSetStatusVerdict"),dl=b.object({code:b.string(),message:b.string(),pointers:b.array(b.string())}).openapi("ReviewSetReasonCode"),GW=b.object({review_id:b.string(),file_path:d,required:b.boolean(),verdict:yl,reason_codes:b.array(dl)}).openapi("ReviewSetStatusItem"),tW=b.object({action:b.string(),review_id:b.string(),finding_id:b.string().optional(),approver_email:b.string().email().optional(),reason_code:b.string(),message:b.string()}).openapi("ReviewSetActionRequired"),Nu=b.object({review_set_id:Lw,verdict:yl,reason_codes:b.array(dl),items:b.array(GW),policy_snapshot_id:b.string().nullable(),actions_required:b.array(tW).optional(),request_id:b.string()}).openapi("GetReviewSetStatusResponse"),QW=b.enum(["blocked","needs_changes","suggestions","approved","not_started","in_progress"]).openapi("ReviewSetStatusIndicator"),WW=b.object({requested:b.boolean(),decided:b.boolean(),decision:b.enum(["approved","rejected","conditional","pending"])}).openapi("ReviewSetApprovalState"),YW=b.object({review_id:b.string(),role:b.enum(["content","rules"]),file_path:d,position:b.number().int().nonnegative(),required:b.boolean(),status_summary:b.object({review_state:b.string(),thread_counts:b.object({total:b.number().int().nonnegative(),open:b.number().int().nonnegative(),resolved:b.number().int().nonnegative()}),severity_counts:b.object({blocking:b.number().int().nonnegative(),needs_changes:b.number().int().nonnegative(),suggestion:b.number().int().nonnegative()}),has_system_findings:b.boolean(),approval_state:WW.nullable(),status_indicator:QW})}).openapi("ReviewSetOverviewItem"),el=b.object({total_items:b.number().int().nonnegative(),reviewed_items:b.number().int().nonnegative(),approved_items:b.number().int().nonnegative(),completion_pct:b.number().int().min(0).max(100)}).openapi("ReviewSetProgress"),cu=b.object({id:Lw,title:b.string().nullable(),kind:b.string(),state:b.string(),source_type:R$,repo_id:b.string().nullable(),git_sha:b.string().nullable(),project_id:b.string().nullable(),upload_batch_id:b.string().nullable(),snapshot_id:b.string().nullable(),ordering_method:b.string().nullable(),recipe_json:b.record(b.string(),b.unknown()).nullable(),created_at:b.string().datetime(),updated_at:b.string().datetime(),items:b.array(YW),progress:el,next_unresolved:b.object({review_id:b.string(),file_path:d,block_id:b.string().nullable()}).nullable(),links:b.object({set_link:b.string().url().nullable()}),request_id:b.string()}).openapi("GetReviewSetResponse"),IW=b.object({id:Lw,title:b.string().nullable(),kind:b.string(),state:b.string(),source_type:R$,repo_id:b.string().nullable(),git_sha:b.string().nullable(),project_id:b.string().nullable(),upload_batch_id:b.string().nullable(),snapshot_id:b.string().nullable(),ordering_method:b.string().nullable(),recipe_json:b.record(b.string(),b.unknown()).nullable(),created_at:b.string().datetime(),updated_at:b.string().datetime()}).openapi("ReviewSetExportMetadata"),jW=b.object({review_id:b.string(),file_path:d,position:b.number().int().nonnegative(),required:b.boolean(),review_export:b.record(b.string(),b.unknown())}).openapi("ReviewSetExportItem"),uW=b.object({canonicalization:b.literal("jcs"),export_sha256:b.string().regex(/^[0-9a-f]{64}$/).nullable()}).openapi("ReviewSetExportIntegrity"),Pu=b.object({schema:b.literal("v2"),view_requested:b.string().nullable(),view_resolved:b.literal("review_set.v1"),set:IW,items:b.array(jW),progress:el,integrity:uW}).openapi("GetReviewSetExportResponse");var HW=b.object({id:b.string(),tenant_id:b.string(),name:b.string(),description:b.string().nullable(),color:b.string().nullable(),created_by:b.string(),created_at:b.string().datetime().nullable(),updated_at:b.string().datetime().nullable(),archived_at:b.string().datetime().nullable(),request_id:b.string()}).openapi("CollectionResponse"),Mu=b.object({name:b.string().min(1),description:b.string().nullable().optional(),color:b.string().nullable().optional()}).openapi("CreateCollectionRequest"),Ru=b.object({name:b.string().min(1).optional(),description:b.string().nullable().optional(),color:b.string().nullable().optional(),archived:b.boolean().optional()}).openapi("UpdateCollectionRequest"),Au=b.object({cursor:b.string().optional(),limit:b.coerce.number().int().min(1).max(100).optional(),include_archived:b.boolean().optional()}).openapi("ListCollectionsQuery"),VW=b.object({collection_id:b.string(),session_id:b.string(),added_at:b.string().datetime().nullable(),added_by:b.string(),request_id:b.string()}).openapi("CollectionSessionResponse"),xu=b.object({session_id:b.string()}).openapi("AddCollectionSessionRequest"),fW=b.object({id:b.string(),collection_id:b.string(),url:b.string().url(),title:b.string(),link_type:b.string(),created_by:b.string(),created_at:b.string().datetime().nullable(),request_id:b.string()}).openapi("CollectionSourceLinkResponse"),hu=b.object({url:b.string().url(),title:b.string(),link_type:b.string()}).openapi("CreateCollectionSourceLinkRequest"),Cu=b.object({items:b.array(HW.omit({request_id:!0})),cursor:b.string().nullable(),has_more:b.boolean(),request_id:b.string()}).openapi("ListCollectionsResponse"),Eu=b.object({id:b.string(),tenant_id:b.string(),name:b.string(),description:b.string().nullable(),color:b.string().nullable(),created_by:b.string(),created_at:b.string().datetime().nullable(),updated_at:b.string().datetime().nullable(),archived_at:b.string().datetime().nullable(),source_links:b.array(fW.omit({request_id:!0})),sessions:b.array(VW.omit({request_id:!0})),request_id:b.string()}).openapi("CollectionDetailResponse"),ou=b.object({request_id:b.string()}).openapi("CollectionMutationAck");var pl=b.enum(["git","upload"]).openapi("CorpusSourceType"),qW=b.enum(["building","ready","failed"]).openapi("CorpusSnapshotStatus"),LW=b.enum(["frontmatter","marker","sidecar","auto"]).openapi("CorpusDocIdentityMode"),al=b.object({in_scope_globs:b.array(b.string().min(1)).min(1).optional(),exclude_globs:b.array(b.string().min(1)).optional(),max_files:b.number().int().positive().optional(),max_total_bytes:b.number().int().positive().optional(),max_snapshot_build_seconds:b.number().int().positive().optional(),doc_identity_mode:LW.optional(),include_external_links:b.boolean().optional()}).openapi("CorpusConfig"),ru=b.object({git_sha:En,corpus_config:al.optional()}).openapi("RequestGitSnapshot"),mu=b.object({upload_batch_id:b.string(),corpus_config:al.optional()}).openapi("RequestUploadSnapshot"),yu=b.object({snapshot_id:b.string(),status:qW,source_type:pl,repo_id:Jv.optional(),git_sha:En.optional(),project_id:b.string().optional(),upload_batch_id:b.string().optional(),indexer_version:b.string(),config_hash:b.string(),snapshot_sha256:b.string().nullable().optional(),error_json:b.unknown().optional(),created_at:b.string().datetime(),request_id:b.string()}).openapi("CorpusSnapshotStatusResponse"),KW=b.object({source_path:d,source_doc_key:b.string().nullable(),source_block_id:b.string().nullable(),link_kind:b.string(),context:b.null()}).openapi("CorpusBacklinkItem"),du=b.object({snapshot_id:b.string(),file_path:d,anchor:b.string().nullable(),backlinks:b.array(KW),request_id:b.string()}).openapi("CorpusBacklinksResponse"),sl=b.object({file_path:d,doc_key:b.string().nullable(),doc_type:b.string().nullable(),title:b.string().nullable()}).openapi("CorpusRepoMapItem"),eu=b.object({snapshot_id:b.string(),git_sha:En,files:b.array(sl),request_id:b.string()}).openapi("CorpusGitRepoMapResponse"),pu=b.object({snapshot_id:b.string(),upload_batch_id:b.string(),files:b.array(sl),request_id:b.string()}).openapi("CorpusUploadRepoMapResponse"),OW=b.object({file_path:d,doc_key:b.string().nullable(),distance:b.number().int().positive(),link_kind:b.string(),via_path:d}).openapi("CorpusImpactRadiusItem"),au=b.object({snapshot_id:b.string(),session_id:b.string(),file_path:d,impacted_files:b.array(OW),request_id:b.string()}).openapi("CorpusImpactResponse"),su=b.object({target_file:d,anchor:b.string().nullable(),block_id:b.string(),plaintext:b.string(),html:b.string(),request_id:b.string()}).openapi("CorpusLinkPreviewResponse"),BW=b.object({file_path:d,doc_key:b.string().nullable(),violation_type:b.enum(["unknown_doc_type","missing_required_field","invalid_field_type","unknown_tag","unknown_category","invalid_locale"]),field:b.string(),expected:b.string(),actual:b.string(),message:b.string()}).openapi("CorpusTaxonomyViolation"),FW=b.object({file_path:d,doc_key:b.string().min(1).optional(),doc_type:b.string().min(1).optional(),title:b.string().optional(),source_content_sha256:b.string().regex(/^[0-9a-f]{64}$/),frontmatter:b.object({raw:b.record(b.string(),b.unknown()).nullable(),normalized:b.record(b.string(),b.unknown()).nullable()}).optional(),taxonomy_violations:b.array(BW).optional()}).openapi("CorpusSnapshotArtifactDoc"),NW=b.object({source_file_path:d,target_file_path:d.optional(),target_url:b.string().url().optional(),edge_type:b.enum(["link","image","include","xref"]),resolved:b.boolean()}).refine((n)=>n.target_file_path!==void 0!==(n.target_url!==void 0),{message:"exactly one of target_file_path or target_url must be present"}).openapi("CorpusSnapshotArtifactEdge"),nH=b.object({schema_version:b.literal("corpus_snapshot.v1"),snapshot_id:b.string(),source_type:pl,repo_id:Jv.optional(),git_sha:En.optional(),project_id:b.string().optional(),upload_batch_id:b.string().optional(),scope:b.object({include_globs:b.array(b.string().min(1)).min(1),exclude_globs:b.array(b.string().min(1)).optional()}),status:b.literal("ready"),docs:b.array(FW),edges:b.array(NW),indexer_version:b.string(),config_hash:b.string(),created_at:b.string().datetime(),completed_at:b.string().datetime()}).openapi("CorpusSnapshotArtifact");var $H=b.object({content_ref:ji.openapi({description:"Reference to the content to review"}),participants:b.array(b.object({email:b.string().email(),name:b.string().optional(),role:b.enum(["reviewer","operator","observer"]).default("reviewer")})).optional().openapi({description:"Optional list of participants to invite"}),options:b.object({block_id_scheme:b.literal("v1").default("v1").optional(),render_profile:b.string().optional()}).optional(),operator_name:b.string().max(200).optional().openapi({description:"Name of the operator initiating the review"}),focus_areas:b.array(b.string().max(100)).max(10).optional().openapi({description:"Areas the reviewer should focus on"}),framing:b.string().max(1000).optional().openapi({description:"Context framing text shown to reviewers"}),carry_forward_threads:b.boolean().optional().openapi({description:"Whether to carry forward threads from the superseded session"}),carry_forward_filter:b.enum(["all","blocking","needs_changes"]).optional().openapi({description:"Filter for which threads to carry forward"})}).openapi("CreateSessionRequest"),cW=b.object({thread_id:b.string().openapi({description:"Thread ID to resolve"}),disposition:b.enum(["fixed","wont_fix","duplicate","by_design"]).openapi({description:"Resolution disposition"}),evidence:b.string().max(2000).optional().openapi({description:"Optional evidence or explanation"})}).openapi("ThreadResolution"),gH=b.object({git_sha:b.string().optional().openapi({description:"Git commit SHA for the new revision"}),file_path:b.string().optional().openapi({description:"File path (defaults to predecessor's)"}),title:b.string().max(512).optional().openapi({description:"Title for the new session"}),changes_summary:b.string().max(5000).optional().openapi({description:"Summary of changes for round-transition emails"}),resolutions:b.array(cW).optional().openapi({description:"Resolution manifest for predecessor threads"}),auto_read_only_on_supersede:b.boolean().default(!0).optional().openapi({description:"Whether to mark predecessor as read-only (default: true)"})}).openapi("SupersedeSessionRequest"),PW=b.object({block_id:b.string(),block_id_scheme:b.literal("v1"),block_index:b.number().int().min(0),block_type:b.string(),block_key:b.string().nullable(),block_key_source:b.enum(["marker","sidecar","auto"]).nullable(),start_line:b.number().int().min(1),end_line:b.number().int().min(1),start_offset:b.number().int().min(0),end_offset:b.number().int().min(0)}).openapi("BlockSummary"),nD=b.object({id:b.string().openapi({description:"Unique session identifier",example:"ses_abc123"}),created_at:b.string().datetime().openapi({description:"ISO 8601 timestamp of session creation"}),state:b.enum(["draft","created","active","closed","expired","superseded","archived","deleted"]).openapi({description:"Current session lifecycle state"}),content_ref:ji,source_content_sha256:b.string().regex(/^[a-f0-9]{64}$/).openapi({description:"SHA-256 hash of canonical source content"}),block_count:b.number().int().min(0).openapi({description:"Number of blocks in the session"}),thread_count:b.number().int().min(0).openapi({description:"Total number of threads in the session"}),open_thread_count:b.number().int().min(0).openapi({description:"Number of open (unresolved) threads"})}).openapi("Session"),wH=nD.extend({blocks:b.array(PW).optional().openapi({description:"Block summaries (included on creation)"})}).openapi("CreateSessionResponse"),_H=b.object({session_id:b.string().openapi({description:"Session identifier",example:"ses_abc123"})}),bH=nD.openapi("GetSessionResponse"),UH=Yl.openapi("GetSessionBlocksQueryParams"),SW=b.object({block_id:b.string(),block_key:b.string().nullable(),block_key_source:b.enum(["marker","sidecar","auto"]).nullable(),block_index:b.number().int().min(0),block_type:b.string(),start_line:b.number().int().min(1),end_line:b.number().int().min(1),start_offset:b.number().int().min(0),end_offset:b.number().int().min(0)}).openapi("SessionBlockListItem"),kH=b.object({session_id:b.string(),block_id_scheme:b.literal("v1"),block_key_scheme:b.literal("v1"),total_blocks:b.number().int().min(0),blocks:b.array(SW),next_cursor:b.string().nullable(),has_more:b.boolean(),request_id:b.string()}).openapi("GetSessionBlocksResponse"),zW=b.object({block_id:b.string(),block_key:b.string().nullable().optional(),block_key_source:b.string().nullable().optional(),block_index:b.number().int(),block_type:b.string(),properties:b.record(b.string(),b.unknown()).nullable().optional(),html:b.string().openapi({description:"Rendered HTML for this block"}),start_line:b.number().int(),end_line:b.number().int(),start_offset:b.number().int().optional(),end_offset:b.number().int().optional()}).openapi("RenderBlock"),lH=b.object({session_id:b.string(),source_content_sha256:b.string(),blocks:b.array(zW),render_profile:b.string().nullable(),etag:b.string().openapi({description:"ETag for cache validation"})}).openapi("GetSessionRenderResponse"),MW=b.object({block_id:b.string(),thread_count:b.number().int().min(0),open_thread_count:b.number().int().min(0),has_unread:b.boolean().optional(),severity_max:b.enum(["suggestion","needs_changes","blocking"]).nullable()}).openapi("BlockAnnotation"),DH=b.object({session_id:b.string(),blocks:b.array(MW),updated_at:b.string().datetime()}).openapi("GetSessionAnnotationsResponse");var GH=b.object({token:b.string().openapi({description:"URL token from magic link",example:"tok_abc123xyz..."})}).openapi("ExchangeTokenRequest"),tH=b.object({access_token:b.string().openapi({description:"Short-lived access token for API requests"}),token_type:b.literal("Bearer"),expires_in:b.number().int().openapi({description:"Token lifetime in seconds",example:3600}),refresh_grant:b.boolean().optional().openapi({description:"Whether a refresh cookie was set"})}).openapi("ExchangeTokenResponse"),QH=b.object({access_token:b.string(),token_type:b.literal("Bearer"),expires_in:b.number().int()}).openapi("RefreshTokenResponse"),WH=b.object({email:b.string().email().openapi({description:"Email address to send OTP to"})}).openapi("SendOtpRequest"),YH=b.object({code:b.string().length(6).regex(/^\d{6}$/).openapi({description:"6-digit OTP code",example:"123456"})}).openapi("VerifyOtpRequest"),IH=b.object({access_token:b.string().openapi({description:"Access token with elevated verification tier"}),token_type:b.literal("Bearer"),expires_in:b.number().int(),verification_tier:b.enum(["step_up"]).openapi({description:"Verification tier achieved"})}).openapi("VerifyOtpResponse");var RW=["full","redacted","pseudonymous","block_window.v1","unresolved.v1","response_matrix.v1","delta_review.v1","corpus_context.v1"],AW=["repair_kit.v1"],xW={block_window:"block_window.v1",unresolved:"unresolved.v1",response_matrix:"response_matrix.v1",repair_kit:"repair_kit.v1",delta_review:"delta_review.v1",corpus_context:"corpus_context.v1"};function hW(n){if(RW.includes(n))return n;if(AW.includes(n))return n;let i=xW[n];if(i)return i;throw Error(`Unknown export view: ${n}`)}var CW=b.enum(["full","redacted","pseudonymous","block_window","block_window.v1","unresolved","unresolved.v1","response_matrix","response_matrix.v1","repair_kit","repair_kit.v1","delta_review","delta_review.v1","corpus_context","corpus_context.v1"]),EW=b.enum(["json","llm_prompt","llm_prompt.v1"]),VH=b.object({schema:b.literal("v2").default("v2"),view:CW.default("full"),format:EW.default("json"),allow_partial:b.boolean().default(!1),anchors:b.string().optional(),window_before:b.coerce.number().int().min(0).default(2),window_after:b.coerce.number().int().min(0).default(2),severity:b.string().optional(),tags:b.string().optional(),assignee:b.string().optional(),signed:b.boolean().optional(),include_derived_keys:b.boolean().optional()}).superRefine((n,i)=>{if(hW(n.view)==="block_window.v1"){if(!n.anchors||n.anchors.trim().length===0)i.addIssue({code:b.ZodIssueCode.custom,path:["anchors"],message:"anchors is required when view=block_window.v1"})}}),oW=b.object({block_id:b.string(),block_id_scheme:b.literal("v1"),block_index:b.number().int().min(0),block_type:b.string(),block_key:b.string().nullable(),block_key_source:b.enum(["marker","sidecar","auto"]).nullable(),start_line:b.number().int().min(1),end_line:b.number().int().min(1),start_offset:b.number().int().min(0),end_offset:b.number().int().min(0),plaintext_sha256:b.string().regex(/^[a-f0-9]{64}$/).nullable()}).openapi("ExportBlock"),TW=b.object({id:b.string(),author_email:b.string().email().nullable().optional(),author_name:b.string().nullable(),author_source:b.string().nullable().optional(),body_md:b.string(),created_at:b.string().datetime(),updated_at:b.string().datetime().nullable(),version:b.number().int().min(1)}).openapi("ExportComment"),ZW=b.object({id:b.string(),anchor:Xv,block_id:b.string().nullable().optional(),status:b.enum(["open","resolved"]),severity:b.enum(["suggestion","needs_changes","blocking"]),created_at:b.string().datetime(),updated_at:b.string().datetime().nullable().optional(),finding_id:b.string().nullable().optional(),rule_id:b.string().nullable().optional(),rule_fingerprint:b.string().nullable().optional(),check_run_id:b.string().nullable().optional(),rule_ref:$_.optional(),comments:b.array(TW)}).openapi("ExportThread"),rW=b.object({open_threads:b.number().int().nonnegative(),resolved_threads:b.number().int().nonnegative(),blocking_threads:b.number().int().nonnegative()}).openapi("ExportIssuePerAnchorStatus"),mW=b.object({anchor_id:b.string(),block_id:b.string().nullable(),anchor_type:b.enum(["session","block","range"]),linked_thread_ids:b.array(b.string()),per_anchor_status:rW}).openapi("ExportIssueAnchor"),yW=b.object({issue_id:b.string(),title:b.string(),status:b.string(),severity:b.string().nullable(),tags:b.array(b.string()),anchor_count:b.number().int().nonnegative(),thread_count:b.number().int().nonnegative(),anchors_in_this_session:b.array(mW)}).openapi("ExportIssue"),dW=b.object({disposition_id:b.string(),thread_id:b.string(),state:b.string(),rationale_md:b.string().nullable(),reason_code:b.string().nullable(),waiver_expires_at:b.string().datetime().nullable(),decided_by_participant_id:b.string().nullable(),decided_by_user_id:b.string().nullable(),decided_by_verification_level:b.string().nullable(),decided_by_display:b.string(),decided_at:b.string().datetime(),provenance_json:b.record(b.string(),b.unknown()).nullable(),created_at:b.string().datetime()}).openapi("ExportDisposition"),eW=b.object({evidence_id:b.string(),thread_id:b.string(),evidence_type:b.string(),evidence_json:b.record(b.string(),b.unknown()),verification_status:b.string(),verification_tier:b.number().int().nullable(),verified_at:b.string().datetime().nullable(),verifier_version:b.string().nullable(),dedupe_key:b.string().nullable(),created_by_participant_id:b.string().nullable(),created_by_user_id:b.string().nullable(),created_by_verification_level:b.string().nullable(),created_by_display:b.string(),created_at:b.string().datetime()}).openapi("ExportEvidence"),pW=b.string().regex(/^[a-z][a-z0-9_.-]*$/),aW=b.string().regex(/^[a-z][a-z0-9_.-]*\.v[0-9]+$/),sW=b.object({schema_version:aW,authoritative:b.boolean()}).passthrough().openapi("ExtensionEnvelope");var n8=b.object({canonicalization:b.string(),export_sha256:b.string().regex(/^[a-f0-9]{64}$/).nullable(),export_full_sha256:b.string().regex(/^[a-f0-9]{64}$/).nullable().optional()}).passthrough().openapi("ExportIntegrity"),v8=b.object({section:b.enum(["threads","comments","approvals","proposed_changes","extensions"]),reason:b.enum(["db_timeout","permission_denied","section_disabled","internal_error"]),count_missing:b.number().int().min(0).optional()}).openapi("ExportIncompleteSection"),fH=b.object({schema_version:b.literal("export.v1"),exported_at:b.string().datetime(),view_requested:b.string().nullable().optional(),view_resolved:b.string().optional(),integrity:n8,partial:b.boolean().optional(),incomplete_sections:b.array(v8).optional(),session:b.object({id:b.string(),created_at:b.string().datetime(),status:b.enum(["active","closed","archived"]),content_ref:ji,source_content_sha256:b.string().regex(/^[a-f0-9]{64}$/),root_session_id:b.string().nullable().optional(),supersedes_session_id:b.string().nullable().optional()}),blocks:b.array(oW),threads:b.array(ZW),issues:b.array(yW).default([]).openapi({description:"Issue summaries with per-anchor status for anchors in this session"}),dispositions:b.array(dW).default([]).openapi({description:"Thread disposition log entries exported for audit/compliance workflows"}),evidence:b.array(eW).default([]).openapi({description:"Thread evidence records exported for audit/compliance workflows"}),approvals:b.object({}).passthrough().optional().openapi({description:"Approval state summary (M0.5+)"}),extensions:b.record(pW,sW).optional().openapi({description:"Optional extension envelopes keyed by namespace (extensions.{namespace})"}),metadata:b.object({export_view:b.string().optional(),integrity_hash:b.string().optional()}).optional()}).openapi("ExportResponse");var i8=b.object({code:b.string(),details:b.record(b.string(),b.unknown()).optional(),thread_ids:b.array(b.string()).optional(),approval_ids:b.array(b.string()).optional()}).openapi("PolicyReason"),$8=b.object({supersedes_session_id:b.string(),blocks_added:b.number().int().min(0),blocks_removed:b.number().int().min(0),blocks_changed:b.number().int().min(0),blocks_unchanged:b.number().int().min(0),orphaned_threads_count:b.number().int().min(0)}).openapi("BriefingDeltaSummary"),g8=b.object({verdict:b.enum(["pass","fail","warn"]),reasons:b.array(i8)}).openapi("BriefingPolicyStatus"),w8=b.object({thread_id:b.string(),block_id:b.string().nullable(),severity:b.string(),snippet:b.string().max(120),source:b.enum(["human","system","automation"]),has_disposition:b.boolean()}).openapi("BriefingBlockerItem"),_8=b.object({items:b.array(w8),total:b.number().int().min(0)}).openapi("BriefingBlockers"),b8=b.object({decision:b.enum(["approved","rejected","conditional"]),decided_by:b.string(),decided_at:b.string().datetime(),pending_conditions:b.number().int().min(0)}).openapi("BriefingApprovalDecision"),U8=b.object({requested:b.boolean(),decisions:b.array(b8),pending_count:b.number().int().min(0)}).openapi("BriefingApprovalsSummary"),k8=b.object({last_run_id:b.string(),status:b.enum(["completed","running","failed"]),total_findings:b.number().int().min(0),gating_findings:b.number().int().min(0),informational_findings:b.number().int().min(0)}).openapi("BriefingChecksSummary"),l8=b.object({total:b.number().int().min(0),unresolved:b.number().int().min(0),blocking:b.number().int().min(0),system_findings:b.number().int().min(0),human:b.number().int().min(0)}).openapi("BriefingThreadsSummary"),KH=b.object({schema_version:b.literal("briefing.v1"),session_id:b.string(),content_ref:ji,title:b.string().nullable(),created_at:b.string().datetime(),delta:$8.optional(),policy_status:g8,blockers:_8,approvals:U8,checks:k8.optional(),threads:l8,computed_at:b.string().datetime(),annotations_version:b.number().int().min(1)}).openapi("BriefingBundle");var D8=b.enum(["review","repo","tenant"]).openapi("SearchScope"),vD=b.enum(["fts","semantic"]).openapi({description:"`fts` is the canonical public search mode. `semantic` remains compatibility-only, non-authoritative retrieval and must not be treated as required launch behavior."}).openapi("SearchMode"),J8=b.enum(["review","block","finding","comment"]).openapi("SearchKind"),__=b.enum(["open","resolved","draft"]).openapi("SearchStatus"),iD=b.enum(["suggestion","needs_changes","blocking"]).openapi("SearchSeverity"),FH=b.object({q:b.string().trim().min(1),scope:D8.default("tenant").optional(),mode:vD.default("fts").optional().openapi({description:"Canonical public search uses `fts`. `semantic` is compatibility-only and may be disabled per tenant."}),review_id:b.string().trim().min(1).optional(),repo_id:b.string().trim().min(1).max(256).optional(),project_id:b.string().trim().min(1).max(256).optional(),model:b.string().trim().min(1).max(128).optional().openapi({description:"Compatibility-only semantic-search model hint. Canonical FTS callers should omit this field."}),min_score:b.coerce.number().min(0).max(1).optional().openapi({description:"Compatibility-only semantic-search threshold. Canonical FTS callers should omit this field."}),kind:b.string().trim().min(1).optional().openapi({description:"Single kind or comma-separated kinds"}),status:__.optional(),severity:iD.optional(),assignee:b.string().trim().min(1).optional(),tags:b.string().trim().min(1).optional().openapi({description:"Comma-separated tag list"}),from:b.string().datetime().optional(),to:b.string().datetime().optional(),filters:b.string().trim().min(1).optional().openapi({description:"JSON-encoded or key=value,key=value filter expression"}),cursor:b.string().min(1).optional(),limit:b.coerce.number().int().min(1).max(100).optional()}).strict().openapi("SearchQueryParams"),X8=b.discriminatedUnion("type",[b.object({type:b.literal("review")}).strict(),b.object({type:b.literal("block"),block_id:s6}).strict()]).openapi("SearchAnchor"),G8=b.object({schema_version:b.literal("anchor_ref.v1"),source_type:b.enum(["git","upload"]),repo_id:b.string().nullable(),git_sha:b.string().nullable(),project_id:b.string().nullable(),upload_batch_id:b.string().nullable(),file_path:b.string().min(1),doc_key:b.string().nullable(),anchor:X8}).strict().openapi("SearchTarget"),t8=b.object({kind:J8,score:b.number(),entity_id:b.string().min(1),review_id:b.string().min(1),target:G8,snippet:b.string(),finding:b.object({finding_id:b.string().min(1),status:__,severity:iD.nullable(),assignee:b.string().nullable(),updated_at:b.string().datetime().nullable()}).strict().nullable().optional(),highlight_ranges:b.array(b.object({start:b.number().int().nonnegative(),end:b.number().int().positive()}).strict()),non_authoritative:b.literal(!0).optional(),provenance:b.object({model_id:b.string().min(1),model_version:b.string().min(1),similarity_score:b.number().min(0).max(1)}).strict().openapi({description:"Compatibility-only semantic-search provenance for non-authoritative results."}).optional()}).strict().openapi("SearchResult"),NH=b.object({results:b.array(t8),total_count:b.number().int().nonnegative(),cursor:b.string().nullable(),has_more:b.boolean(),metadata:b.object({search_mode:vD,model_id:b.string().min(1).optional(),model_version:b.string().min(1).optional()}).strict().openapi({description:"Canonical metadata reports `fts`. Semantic metadata fields are compatibility-only."}).optional(),request_id:b.string()}).strict().openapi("SearchResponse");var Q8=["properties","applicability"],$D=["ts_"],W8="^[a-z][a-z0-9_]{0,63}$",Y8=b.object({key:b.string(),targets:b.array(b.enum(Q8)).min(1),value_format:b.enum(["slug","string"]),description:b.string(),examples:b.array(b.string()).min(1)}).openapi("PropertyVocabularyEntry"),SH=b.object({naming:b.object({case:b.literal("snake_case"),key_pattern:b.string(),max_key_length:b.number().int().positive()}).openapi("PropertyVocabularyNaming"),reserved:b.object({canonical_keys:b.array(b.string()),internal_prefixes:b.array(b.string())}).openapi("PropertyVocabularyReserved"),tenant_extensions:b.object({allowed:b.boolean(),forbidden_prefixes:b.array(b.string()),discoverable:b.boolean(),notes:b.string()}).openapi("PropertyVocabularyTenantExtensions"),canonical_keys:b.array(Y8)}).openapi("PropertyVocabulary"),zH={naming:{case:"snake_case",key_pattern:W8,max_key_length:64},reserved:{canonical_keys:["client","content_type","source_kind","audience","market","surface"],internal_prefixes:[...$D]},tenant_extensions:{allowed:!0,forbidden_prefixes:[...$D],discoverable:!1,notes:"Tenant-defined keys are allowed but remain out-of-band until custom property-schema discovery lands."},canonical_keys:[{key:"client",targets:["properties","applicability"],value_format:"slug",description:"Brand, customer, product line, or account identifier used to scope rules and reviews.",examples:["acme","globex","internal_docs"]},{key:"content_type",targets:["properties","applicability"],value_format:"slug",description:"The kind of material under review, expressed as a stable slug rather than free-form prose.",examples:["landing_page","blog_post","ad_copy"]},{key:"source_kind",targets:["properties","applicability"],value_format:"slug",description:"The intake/source family for the reviewable artifact or the rule targeting it.",examples:["git","upload","paste"]},{key:"audience",targets:["properties","applicability"],value_format:"slug",description:"Intended reader or stakeholder audience segment for the reviewed content.",examples:["external","internal","partner"]},{key:"market",targets:["properties","applicability"],value_format:"slug",description:"Geographic, regulatory, or commercial market segment affected by the content or rule.",examples:["us","de","healthcare"]},{key:"surface",targets:["properties","applicability"],value_format:"slug",description:"Delivery surface or channel used for migration from legacy workstream language.",examples:["website","email","reddit"]}]};function A$(n){if(!n||typeof n!=="object"||Array.isArray(n))return null;return n}function Bn(n,i){let $=n[i];if(typeof $!=="string")return;let g=$.trim();return g.length>0?g:void 0}function gD(n,i){let $=n[i];return typeof $==="string"?$:void 0}function I8(n,i){let $=n[i];return typeof $==="number"&&Number.isFinite($)?$:void 0}function j8(n,i){let $=n[i];return typeof $==="boolean"?$:void 0}function F0(n,i){return A$(n[i])??void 0}function N0(n){return Bn(n,"request_id")}function u8(n){if(Array.isArray(n))return{entries:n,record:null};let i=A$(n);if(!i)throw Error("Expected array or object list payload from upstream API");if(Array.isArray(i.data))return{entries:i.data,record:i};if(Array.isArray(i.items))return{entries:i.items,record:i};return{entries:[],record:i}}function H8(n,i){let{entries:$,record:g}=u8(n),w={data:$.flatMap((_)=>{let U=A$(_);if(!U)return[];let k=i(U);return k?[k]:[]})};if(g){let _=I8(g,"total");if(_!==void 0)w.total=_;let U=Bn(g,"next_cursor");if(U!==void 0)w.next_cursor=U;let k=j8(g,"has_more");if(k!==void 0)w.has_more=k;let l=N0(g);if(l!==void 0)w.request_id=l}return w}function V8(n){let i=Bn(n,"id");if(!i)return null;let $=F0(n,"proposed_content")??F0(n,"proposedContent"),g=Bn(n,"title")??$?.title,v=Bn(n,"source_type")??Bn(n,"sourceType"),w=Bn(n,"status"),_=Bn(n,"priority")??Bn($??{},"priority"),U=Bn(n,"created_at")??Bn(n,"createdAt"),k=typeof g==="string"&&g.trim().length>0?g.trim():void 0;if(!k||!v||!w||!_||!U)throw Error(`GCI list response missing required fields for id '${i}'`);return{...n,...$&&n.proposed_content===void 0?{proposed_content:$}:{},id:i,title:k,source_type:v,status:w,priority:_,created_at:U}}function b_(n){return H8(n,V8)}function wD(n){let i=A$(n);if(!i)throw Error("Expected object payload from upstream API");let $=F0(i,"data")??{...i},g=gD($,"prompt_fragment")??gD($,"prompt"),v=N0(i)??N0($),w={...$};if(g!==void 0)w.prompt_fragment=g;if(v!==void 0&&Bn(w,"request_id")===void 0)w.request_id=v;return w}function _D(n){let i=n.rules;if(Array.isArray(i))return i.filter((w)=>w!==null&&typeof w==="object");let $=[],g=n.active_rules;if(Array.isArray(g))for(let w of g){let _=A$(w);if(!_)continue;$.push({id:_.artifact_id,title:_.artifact_type,kind:"artifact",content:_.severity})}let v=n.check_rules;if(Array.isArray(v))for(let w of v){let _=A$(w);if(!_)continue;let{pattern:U,assertion_config:k}=_,l=typeof _.message_template==="string"?_.message_template:typeof _.rule_id==="string"?_.rule_id:null,J=typeof U==="string"?U:typeof k==="string"?k:l;if(typeof J!=="string")continue;$.push({id:_.rule_id,title:_.message_template,kind:_.rule_type,content:J,scope:_.source_artifact_id})}return $}function c0(n){return wD(n)}function P0(n){return _D(n)}var S0=/^[A-Za-z0-9+/]*={0,2}$/,U_="local";function Kw(n){if(typeof n!=="object"||n===null||Array.isArray(n))return null;return n}function f8(n,i,$){let g=Kw(n);if(!g)return i;let v=g.ok===!0&&"result"in g,w=v?Kw(g.result):g,_=w!==null?{...w}:{result:v?g.result:n};_.ok=!0,_.request_id=i.request_id;let U=v&&Array.isArray(g.warnings)?g.warnings:i.warnings;if(U!==void 0)_.warnings=U;let k=(v?Kw(g.pagination):null)??i.pagination;if(k!==void 0)_.pagination=k;let l=(v?Kw(g.advisory):null)??i.advisory;if(l!==void 0)_.advisory=l;let J=$?.retry??(v?Kw(g.retry):null);if(J!==null&&J!==void 0)_.retry=J;else if(i.retry!==void 0)_.retry=i.retry;return _}function H(n,i,$){let g=Kl(n,i,$),v=f8(n,g,$);return{content:[{type:"text",text:JSON.stringify(v,null,2)}]}}function G(n,i){let $=n.status===0||n.status>=500||n.status===429,g=Ol({requestId:n.requestId,error:{code:n.code,message:n.message,retryable:$,details:n.details,fix_hint:n.fixHint},retry:i?.operation?Ll({operation:i.operation,hasIdempotencyKey:i.hasIdempotencyKey,retryable:$,statusCode:n.status,errorCode:n.code}):{retry_classification:$?"transient":"manual"}});return{content:[{type:"text",text:JSON.stringify(g,null,2)}],isError:!0}}function mv(n,i,$,g){return new D(n,i,$,g?.requestId??U_,g?.details,g?.fixHint)}function kD(n,i){if(n instanceof D)return n;let $=i?.message??(n instanceof Error?n.message:String(n));return mv(i?.status??500,i?.code??"internal_error",$,i)}function _n(n){if(!n||typeof n!=="object"||Array.isArray(n))throw Error("Expected object payload from upstream API");let i=n,$=i.data;if($&&typeof $==="object"&&!Array.isArray($))return $;return i}var lD=1e7;function bD(n){if(typeof n==="string"){let v=n.trim();return v.length>0?v:null}if(!n||typeof n!=="object"||Array.isArray(n))return null;let i=n,$=i.base64??i.content_base64??i.content??i.data??i.bytes;if(typeof $!=="string")return null;let g=$.trim();return g.length>0?g:null}function UD(n){if(typeof n==="string"){let g=n.trim();return g.length>0?g:null}if(!n||typeof n!=="object"||Array.isArray(n))return null;let i=n,$=i.path??i.file_path??i.filename??i.file_name??i.name;if(typeof $==="string"&&$.trim().length>0)return $.trim();return null}function DD(n){if(n===void 0||n===null)return{assets:{}};let i={};if(Array.isArray(n)){for(let[g,v]of n.entries()){let w=UD(v),_=bD(v);if(!w||!_)return{error:new D(422,"invalid_argument",`inline_assets[${g}] requires both a path and base64 payload`,"local")};i[w]=_}return{assets:i}}if(typeof n!=="object")return{error:new D(422,"invalid_argument","inline_assets must be an object map or array","local")};let $=Object.entries(n);for(let[g,v]of $){let w=v&&typeof v==="object"&&!Array.isArray(v)?UD(v):g,_=bD(v);if(!w||!_)return{error:new D(422,"invalid_argument",`inline_assets entry '${g}' requires base64 content`,"local")};i[w]=_}return{assets:i}}function JD(n){if(!n||n.length===0)return"Asset path is empty";if(n.includes("\x00"))return"Asset path contains NUL byte";let i=n.replace(/\\/g,"/");if(i.startsWith("/"))return"Asset path must be relative (no leading /)";if(i.includes(".."))return"Asset path must not contain '..'";return null}function z0(n){let i=n.replace(/\s+/g,"");if(i.length===0)return new Uint8Array;if(i.length%4!==0||!S0.test(i))return null;let $=Buffer.from(i,"base64"),g=i.replace(/=+$/,""),v=$.toString("base64").replace(/=+$/,"");if(g!==v)return null;return Uint8Array.from($)}var q8=await Promise.resolve().then(() => y0(Q_(),1)),XD=q8.version,L8={Server:c_,StdioServerTransport:S_,CallToolRequestSchema:O_,ListToolsRequestSchema:K_};function k_(n){return{content:n.content.map((i)=>({type:i.type,text:i.text})),...n.isError===void 0?{}:{isError:n.isError}}}async function GD(n,i=L8){let $=new i.Server({name:"typescape",version:XD},{capabilities:{tools:{}}});$.setRequestHandler(i.ListToolsRequestSchema,async()=>{return{tools:n.getTools().map((w)=>({name:w.name,description:w.description,inputSchema:w.inputSchema}))}}),$.setRequestHandler(i.CallToolRequestSchema,async(v)=>{let{name:w,arguments:_}=v.params,U=n.getHandler(w);if(!U)return k_(G(mv(404,"not_found",`Unknown tool: ${w}`,{details:{tool:w},fixHint:"Use tools/list to inspect the registered Typescape tools."})));try{if(_===void 0)return k_(G(mv(400,"invalid_request",`Missing arguments payload for tool: ${w}`,{details:{tool:w},fixHint:"Provide an arguments object for the tool call, even if it is empty."})));let k=await U(_);return k_(k)}catch(k){return k_(G(kD(k)))}});let g=new i.StdioServerTransport;await $.connect(g),process.stderr.write(`Typescape MCP server v${XD} started
43
- `)}var K8=300000;function tD(n){let i=null;return{async getCapabilities(){let $=Date.now();if(i&&$-i.fetchedAt<K8)return i.features;try{let g=await n.get("/me/capabilities");if(!g.body.features||typeof g.body.features!=="object")throw Error("Capabilities response missing features object");return i={features:g.body.features,fetchedAt:$},i.features}catch(g){if(g instanceof D)throw g;throw g}},featureDisabledResult($){return G(mv(403,"feature_disabled",`Feature '${$}' is not enabled on this server`,{details:{feature:$}}))}}}var O8=__.options.filter((n)=>n!=="draft"),QD={type:"object",properties:{repo_id:{type:"string",description:"Repository identifier (short slug, e.g. 'typescape'; not a GitHub path like 'org/repo')"},git_sha:{type:"string",description:"Concrete 40-hex Git commit SHA (agent must resolve; no symbolic refs)"},file_path:{type:"string",description:"Path to the source document (required)"},filename:{type:"string",description:'PDF filename when document_type is "pdf" (optional; defaults to the file_path basename)'},project_id:{type:"string",description:"Upload project ID for upload-backed reviews (requires upload_batch_id)"},upload_batch_id:{type:"string",description:"Upload batch ID for upload-backed reviews (requires project_id)"},title:{type:"string",description:"Review title (optional)"},participants:{type:"array",items:{type:"object",properties:{email:{type:"string"},name:{type:"string"},role:{type:"string",enum:["reviewer","approver","observer","owner"]},scopes:{type:"array",minItems:1,items:{type:"string",enum:["read","comment","approve","admin"]}}},required:["email","role"]},description:"Participants to invite (optional). Scopes are optional and default by role."},reviewer_emails:{type:"array",items:{type:"string"},description:"Legacy alias for participants. Each email is invited as a reviewer."},idempotency_key:{type:"string",description:"Idempotency key for safe retries (optional)"},expected_version:{type:"string",description:"Expected version for optimistic concurrency (If-Match header, optional)"},identity_restriction:{type:"string",enum:["open","participants_only","domain"],description:'Identity verification mode for OTP step-up. "open" (default) accepts any email. "participants_only": only invited participant emails. "domain": only emails from allowed_email_domains.'},allowed_email_domains:{type:"array",items:{type:"string"},description:'Allowed email domains when identity_restriction is "domain" (e.g., ["acme.com", "example.org"])'},operator_name:{type:"string",maxLength:200,description:"Name of the operator initiating the review (optional)"},focus_areas:{type:"array",items:{type:"string",maxLength:100},maxItems:10,description:"Areas the reviewer should focus on (optional)"},framing:{type:"string",maxLength:1000,description:"Context framing text shown to reviewers (optional)"},carry_forward_findings:{type:"boolean",description:"Whether to carry forward findings from the superseded review (optional)"},carry_forward_filter:{type:"string",enum:["all","blocking","needs_changes"],description:"Filter for which findings to carry forward (optional)"},content_body:{type:"string",maxLength:1048576,description:"Inline Markdown content (alternative to repo_id+git_sha). Creates an upload-backed review automatically."},inline_assets:{oneOf:[{type:"object",additionalProperties:{oneOf:[{type:"string"},{type:"object",properties:{base64:{type:"string"},content_base64:{type:"string"},content:{type:"string"},data:{type:"string"}},additionalProperties:!0}]}},{type:"array",items:{type:"object",properties:{path:{type:"string"},file_path:{type:"string"},filename:{type:"string"},file_name:{type:"string"},name:{type:"string"},base64:{type:"string"},content_base64:{type:"string"},content:{type:"string"},data:{type:"string"}},additionalProperties:!0}}],description:'Companion assets as either a map of relative path => base64 content, or a list of asset objects. Map example: { "images/fig.png": "iVBORw0KGgo..." }. Array example: [{ "path": "images/fig.png", "base64": "iVBORw0KGgo..." }]. Total decoded size must be <= 10MB.'},document_type:{type:"string",enum:["markdown","image_set","pdf"],description:'Document type (default: "markdown"). Use "image_set" for image-only reviews or "pdf" for PDF reviews.'},asset_resolution_mode:{type:"string",enum:["strict","warn"],description:'Asset resolution mode (default: "strict"). Use "warn" to create upload-backed reviews even if some referenced assets are missing.'},filenames:{type:"array",items:{type:"string"},minItems:1,maxItems:100,description:'Ordered list of image filenames (required when document_type is "image_set"). Each filename must be a relative path. Supported formats: PNG, JPEG, WebP, GIF, SVG.'},purpose:{type:"string",enum:["review","rules"],description:'Review purpose (default: "review"). Use "rules" to create a rule review that feeds the rules governance pipeline.'},properties:{type:"object",additionalProperties:{type:"string"},description:"Content properties for rule matching (flat key-value map). Used when purpose=rules or for rule-aware content reviews."}},required:["file_path"]},WD={type:"object",properties:{review_id:{type:"string",description:"ID of the review to revise (the predecessor, e.g., rev_01HXYZ...)"},git_sha:{type:"string",description:"Concrete 40-hex Git commit SHA for the new revision (agent must resolve; no symbolic refs)"},content_body:{type:"string",description:"Inline Markdown content for upload-backed revised reviews (alternative to git_sha/upload_batch_id)"},project_id:{type:"string",description:"Upload project ID for upload-backed revised reviews (required with upload_batch_id)"},upload_batch_id:{type:"string",description:"Upload batch ID for upload-backed revised reviews (alternative to git_sha/content_body)"},file_path:{type:"string",description:"Path to the source document (optional; defaults to predecessor's file_path)"},document_type:{type:"string",enum:["markdown","image_set","pdf"],description:"Document type for revision (optional; defaults to predecessor document_type)"},filename:{type:"string",description:"PDF filename for document_type=pdf revisions (optional; defaults to file_path)"},filenames:{type:"array",items:{type:"string"},minItems:1,description:"Ordered image filenames for document_type=image_set revisions"},title:{type:"string",description:"Title for the new review (optional; defaults to predecessor's title)"},changes_summary:{type:"string",maxLength:5000,description:"Summary of changes for round-transition emails and the superseded banner (optional)"},resolutions:{type:"array",items:{type:"object",properties:{finding_id:{type:"string",description:"Finding ID from the predecessor review"},disposition:{type:"string",enum:["fixed","wont_fix","duplicate","by_design"],description:"How the finding was resolved"},evidence:{type:"string",maxLength:2000,description:"Optional evidence or explanation for the resolution"}},required:["finding_id","disposition"]},description:"Resolution manifest for findings from the predecessor review (optional)"},idempotency_key:{type:"string",description:"Idempotency key for safe retries (optional)"}},required:["review_id"]},YD={type:"object",properties:{review_id:{type:"string",description:"Review ID to export (e.g., rev_01HXYZ...)"},schema:{type:"string",default:"v2",description:"Export schema version (default: v2). Explicit retired or unknown schema values fail with machine-readable API errors."},view:{type:"string",description:"Export view variant (optional). Values: redacted, response_matrix.v1, delta_review.v1"},expected_version:{type:"string",description:"Expected version for optimistic concurrency (If-Match header, optional)"},include_rule_context:{type:"boolean",description:"Include rule context metadata in the export (rule_context block with compiled_hash, policy_snapshot_id, and source rule refs). Default: false."}},required:["review_id"]},ID={type:"object",properties:{review_id:{type:"string",description:"Review ID to fetch the handoff bundle for"},include_rules:{type:"boolean",description:"Whether to include rule context (default: true)"},include_lineage:{type:"boolean",description:"Whether to include lineage summaries (default: true)"},include_advisory:{type:"boolean",description:"Whether to include advisory artifacts (default: true)"},include_blocks:{type:"boolean",description:"Whether to include block slices (default: true)"},max_rules:{type:"number",description:"Maximum number of structured rules to inline"}},required:["review_id"]},jD={type:"object",properties:{repo_id:{type:"string",description:"Filter reviews by repository identifier (short slug, e.g. 'typescape'; optional)"},state:{type:"string",description:"Filter by review state: active, closed, archived (optional)"},file_paths:{type:"string",description:"Comma-separated list of file paths to filter by (optional)"},cursor:{type:"string",description:"Pagination cursor from previous response (optional)"},limit:{type:"number",description:"Maximum number of reviews to return (optional, default: 20)"},root_review_id:{type:"string",description:"Filter by supersede chain root review ID (optional, e.g., rev_...)"},supersedes_review_id:{type:"string",description:"Filter by immediate predecessor review ID (optional, e.g., rev_...)"},has_successor:{type:"boolean",description:"If true, return only reviews that have been superseded; if false, only chain heads (optional)"},q:{type:"string",description:"Search query for title/file path (alias: search, optional)."},search:{type:"string",description:"Alias for q. Search query text (optional)."}},required:[]},uD={type:"object",properties:{review_id:{type:"string",description:"Review ID to retrieve (e.g., rev_01HXYZ...)"}},required:["review_id"]},HD={type:"object",properties:{review_id:{type:"string",description:"Review ID to render (e.g., rev_01HXYZ...)"},include_plaintext:{type:"boolean",description:"Include plaintext representation alongside HTML (optional, default: false)"}},required:["review_id"]},VD={type:"object",properties:{review_id:{type:"string",description:"Review ID to list findings for (e.g., rev_01HXYZ...)"},block_id:{type:"string",description:"Filter findings by block_id anchor (optional)"},status:{type:"string",description:"Filter findings by status: open, resolved, all (optional, default: all)"},cursor:{type:"string",description:"Pagination cursor from previous response (optional)"},limit:{type:"number",description:"Maximum number of findings to return (optional, default: 50)"},q:{type:"string",description:"Search query across finding id, block id, and comment text (optional; alias: search)."},search:{type:"string",description:"Alias for q. Search query text (optional)."}},required:["review_id"]},M0={type:"object",properties:{review_id:{type:"string",description:"Review ID (e.g., rev_01HXYZ...)"}},required:["review_id"]},fD={type:"object",properties:{query:{type:"string",description:"Search query text for reviews (title/file path)."},limit:{type:"number",description:"Maximum reviews to return (optional, default: 20)."},cursor:{type:"string",description:"Pagination cursor from previous response (optional)."}},required:["query"]},qD={type:"object",properties:{review_id:{type:"string",description:"Review ID to search within."},query:{type:"string",description:"Search query text for findings/comments."},block_id:{type:"string",description:"Optional block filter."},status:{type:"string",enum:O8,description:"Optional status filter: open | resolved."},limit:{type:"number",description:"Maximum findings to return (optional, default: 50)."},cursor:{type:"string",description:"Pagination cursor from previous response (optional)."}},required:["review_id","query"]};var LD=["typescape_create_review","typescape_revise_review","typescape_export_review","typescape_get_handoff","typescape_list_reviews","typescape_get_review","typescape_get_render","typescape_list_findings","typescape_search_reviews","typescape_search_findings","typescape_close_review","typescape_reopen_review"],B8="markdown",F8="open",N8="strict";function c8(n){if(n==="approver")return["read","comment","approve"];if(n==="observer")return["read"];if(n==="owner")return["read","comment","approve","admin"];return["read","comment"]}function P8(n){return n.map((i)=>{let $=i.scopes&&i.scopes.length>0?[...new Set(i.scopes)]:c8(i.role);return{email:i.email,...i.name?{name:i.name}:{},role:i.role,scopes:$}})}function S8(n,i){let $=[];if(Array.isArray(n))$.push(...n);if(Array.isArray(i))for(let w of i){if(typeof w!=="string")continue;let _=w.trim();if(_.length===0)continue;$.push({email:_,role:"reviewer"})}let g=new Set,v=[];for(let w of $){if(!w||typeof w.email!=="string")continue;let _=w.email.trim();if(_.length===0)continue;let U=_.toLowerCase();if(g.has(U))continue;g.add(U),v.push({...w,email:_})}return v}function z8(n){if(!Array.isArray(n))return[];let i=new Set,$=[];for(let g of n){if(typeof g!=="string")continue;let v=g.trim().toLowerCase();if(v.length===0)continue;if(i.has(v))continue;i.add(v),$.push(v)}return $}function M8(n){if(!n||typeof n!=="object"||Array.isArray(n))return null;let i=n.id;return typeof i==="string"&&i.length>0?i:null}function R8(n){if(!n||typeof n!=="object"||Array.isArray(n))return null;let i=n;if(typeof i.id==="string"&&i.id.length>0)return i.id;let $=i.project;if($&&typeof $==="object"&&!Array.isArray($)&&typeof $.id==="string")return $.id;return null}function A8(n){if(!n||typeof n!=="object"||Array.isArray(n))return null;let i=n;if(typeof i.upload_batch_id==="string"&&i.upload_batch_id.length>0)return i.upload_batch_id;let $=i.upload;if($&&typeof $==="object"&&!Array.isArray($)&&typeof $.upload_batch_id==="string")return $.upload_batch_id;return null}function x8(n){let i=DD(n.inline_assets);if("error"in i)return i.error;let $=i.assets;if(!n.file_path)return new D(400,"missing_param","Missing required parameter: file_path","local");let g=typeof n.repo_id==="string"&&n.repo_id.length>0,v=typeof n.git_sha==="string"&&n.git_sha.length>0,w=typeof n.project_id==="string"&&n.project_id.length>0,_=typeof n.upload_batch_id==="string"&&n.upload_batch_id.length>0,U=g&&v,k=w&&_,l=!!n.content_body,J=Object.keys($).length>0;if(g&&!v||!g&&v)return new D(422,"invalid_argument","Both repo_id and git_sha are required for git-backed reviews","local");if(w&&!_||!w&&_)return new D(422,"invalid_argument","Both project_id and upload_batch_id are required for upload-backed reviews","local");if(n.document_type!==void 0&&n.document_type!=="markdown"&&n.document_type!=="image_set"&&n.document_type!=="pdf")return new D(422,"invalid_argument",`Unsupported document_type: ${n.document_type}. Supported values: "markdown", "image_set", "pdf".`,"local");if(n.asset_resolution_mode!==void 0&&n.asset_resolution_mode!=="strict"&&n.asset_resolution_mode!=="warn")return new D(422,"invalid_argument",`Unsupported asset_resolution_mode: ${n.asset_resolution_mode}. Supported values: "strict", "warn".`,"local");let Q=n.document_type??B8,j=n.identity_restriction??F8,u=n.asset_resolution_mode??N8,W=Q==="image_set",Y=Q==="pdf";if(W){if(!J&&!k)return new D(400,"image_set_empty","image_set reviews require inline_assets or upload-batch input (project_id + upload_batch_id)","local");if(k&&(!n.filenames||n.filenames.length===0))return new D(400,"missing_param",'document_type "image_set" with upload-batch mode requires filenames.',"local");let r=new Set([".png",".jpg",".jpeg",".webp",".gif",".svg"]);if(J){for(let gn of Object.keys($)){let yv=gn.slice(gn.lastIndexOf(".")).toLowerCase();if(!r.has(yv))return new D(422,"unsupported_media_type",`Unsupported image format for image_set: ${gn}. Supported extensions: ${[...r].join(", ")}`,"local")}if(Object.keys($).length>100)return new D(422,"image_set_limit_exceeded",`Image set has ${Object.keys($).length} images, exceeding the maximum of 100`,"local")}}if(Y){if(U)return new D(422,"invalid_argument",'document_type "pdf" is only supported with upload-backed sources (inline_assets or project_id+upload_batch_id).',"local");if(l)return new D(422,"invalid_argument",'document_type "pdf" does not support content_body; provide inline_assets with one .pdf file.',"local");if(!J&&!k)return new D(400,"missing_param",'document_type "pdf" requires either inline_assets with one .pdf file, or upload-batch input (project_id + upload_batch_id).',"local");if(J&&k)return new D(422,"invalid_argument",'document_type "pdf" cannot mix inline_assets and upload-batch inputs.',"local");if(J&&Object.keys($).length!==1)return new D(422,"invalid_argument",'document_type "pdf" requires exactly one inline asset.',"local");if(J){let[r]=Object.keys($);if(!r)return new D(400,"missing_param",'document_type "pdf" requires inline_assets with exactly one .pdf file.',"local");if(r.slice(r.lastIndexOf(".")).toLowerCase()!==".pdf")return new D(422,"unsupported_media_type",`Unsupported PDF format: ${r}. Supported extension: .pdf`,"local");if(n.file_path!==r)return new D(422,"invalid_argument",`For document_type "pdf", file_path must match inline_assets key: ${r}`,"local")}}let B=[U,l,k].filter(Boolean).length;if(!W&&!Y&&B===0)return new D(400,"missing_param","Provide one source mode: (repo_id + git_sha), (content_body), or (project_id + upload_batch_id)","local");if(B>1)return new D(422,"ambiguous_review_input","Cannot mix source modes: choose exactly one of git-backed, inline content_body, or upload-backed.","local");if(!W&&n.filenames&&n.filenames.length>0)return new D(422,"invalid_argument","filenames is only valid when document_type is image_set.","local");if(!Y&&n.filename&&n.filename.trim().length>0)return new D(422,"invalid_argument",'filename is only valid when document_type is "pdf".',"local");if(j==="domain"&&(!n.allowed_email_domains||n.allowed_email_domains.length===0))return new D(422,"invalid_argument",'allowed_email_domains is required when identity_restriction is "domain"',"local");if(Object.keys($).length>0){if(!l&&!W&&!Y)return new D(422,"invalid_argument","inline_assets requires content_body (inline mode)","local");let r=0;for(let[gn,yv]of Object.entries($)){let r0=JD(gn);if(r0)return new D(422,"invalid_argument",`${r0}: ${gn}`,"local");let m0=z0(yv);if(m0===null)return new D(422,"invalid_argument",`Invalid base64 content for asset: ${gn}`,"local");r+=m0.byteLength}if(r>lD)return new D(413,"inline_payload_too_large",`Total decoded inline assets (${r} bytes) exceed 10MB limit. Use the Typescape CLI with upload batch for larger payloads.`,"local")}let O={file_path:n.file_path,document_type:Q,identity_restriction:j,asset_resolution_mode:u};if(U)O.repo_id=n.repo_id,O.git_sha=n.git_sha;if(k)O.project_id=n.project_id,O.upload_batch_id=n.upload_batch_id;if(l)O.content_body=n.content_body;if(Object.keys($).length>0)O.inline_assets=$;let E=S8(n.participants,n.reviewer_emails);if(E.length>0)O.participants=P8(E);if(n.title!==void 0)O.title=n.title;if(n.allowed_email_domains!==void 0&&n.allowed_email_domains.length>0)O.allowed_email_domains=n.allowed_email_domains;if(n.operator_name!==void 0)O.operator_name=n.operator_name;if(n.focus_areas!==void 0&&n.focus_areas.length>0)O.focus_areas=n.focus_areas;if(n.framing!==void 0)O.framing=n.framing;if(n.carry_forward_findings!==void 0)O.carry_forward_findings=n.carry_forward_findings;if(n.carry_forward_filter!==void 0)O.carry_forward_filter=n.carry_forward_filter;if(Y)O.filename=n.filename?.trim()||n.file_path.split("/").filter(Boolean).at(-1)||n.file_path;if(W)O.filenames=n.filenames&&n.filenames.length>0?n.filenames:Object.keys($).sort();if(n.purpose!==void 0)O.purpose=n.purpose;if(n.properties!==void 0)O.properties=n.properties;let T={};if(n.idempotency_key)T["Idempotency-Key"]=n.idempotency_key;if(n.expected_version)T["If-Match"]=n.expected_version;let a=z8(n.reviewer_emails),s=Y&&J?(()=>{let r=Object.entries($)[0];if(!r)return null;let[gn,yv]=r;return gn&&yv?{assetPath:gn,base64Content:yv}:null})():null;return{body:O,headers:T,reviewerEmails:a,pdfInlineFallback:s}}async function h8(n,i,$){let g=Array.isArray($.invitations)?$.invitations:[];if(i.length===0||g.length>0)return g;let v=M8($.review);if(!v)throw new D(500,"invalid_upstream_response","Review create response missing review.id; cannot invite reviewer_emails","local");let w=await n.post(`/reviews/${encodeURIComponent(v)}/participants`,{body:{participants:i.map((U)=>({email:U,role:"reviewer"}))}}),_=Array.isArray(w.body.invitations)?w.body.invitations:[];if(_.length>0)return _;throw new D(502,"invalid_upstream_response","Reviewer invitation follow-up returned no invitations",w.requestId)}async function KD(n,i,$){return n.post("/reviews",{body:i,headers:$})}async function C8(n,i){if(!i.pdfInlineFallback)throw new D(500,"invalid_local_state","PDF fallback requires exactly one inline asset","local");let $=z0(i.pdfInlineFallback.base64Content);if($===null)throw new D(422,"invalid_argument",`Invalid base64 content for asset: ${i.pdfInlineFallback.assetPath}`,"local");let g=await n.post("/projects",{body:{name:`MCP Upload ${i.pdfInlineFallback.assetPath}`}}),v=R8(g.body);if(!v)throw new D(502,"invalid_upstream_response","Project create response missing project id",g.requestId);let w=new FormData;w.append(i.pdfInlineFallback.assetPath,new Blob([$],{type:"application/pdf"}),i.pdfInlineFallback.assetPath);let _=await n.postFormData(`/projects/${encodeURIComponent(v)}/upload`,w),U=A8(_.body);if(!U)throw new D(502,"invalid_upstream_response","Upload response missing upload_batch_id",_.requestId);let k={...i.body,project_id:v,upload_batch_id:U};return delete k.inline_assets,KD(n,k,i.headers)}async function E8(n,i){let $=async(g)=>{let v=await h8(n,i.reviewerEmails,g.body);return H({review:g.body.review,invitations:v},g.requestId)};try{let g=await KD(n,i.body,i.headers);return await $(g)}catch(g){if(g instanceof D&&i.pdfInlineFallback&&g.code==="feature_disabled"&&g.details?.feature==="inline_assets_enabled")try{let v=await C8(n,i);return await $(v)}catch(v){if(v instanceof D)return G(v);throw v}if(g instanceof D)return G(g);throw g}}function o8(n){if(!n.review_id)return new D(400,"missing_param","Missing required parameter: review_id","local");let i=typeof n.git_sha==="string"&&n.git_sha.length>0,$=typeof n.content_body==="string"&&n.content_body.length>0,g=typeof n.upload_batch_id==="string"&&n.upload_batch_id.length>0,v=typeof n.project_id==="string"&&n.project_id.length>0;if(v&&!g||!v&&g)return new D(422,"invalid_argument","Both project_id and upload_batch_id are required for upload-backed revision","local");let w=[i,$,g].filter(Boolean).length;if(w===0)return new D(400,"missing_param","One of git_sha, content_body, or upload_batch_id is required","local");if(w>1)return new D(422,"invalid_argument","git_sha, content_body, and upload_batch_id are mutually exclusive","local");let _=i?n.git_sha:void 0;if(_&&!/^[a-f0-9]{40}$/i.test(_))return new D(400,"invalid_param",`Invalid git_sha format: must be a 40-character hex string, got "${n.git_sha}"`,"local");let U={};if(_)U.git_sha=_.toLowerCase();if($)U.content_body=n.content_body;if(g)U.project_id=n.project_id,U.upload_batch_id=n.upload_batch_id;if(n.file_path!==void 0)U.file_path=n.file_path;if(n.document_type!==void 0)U.document_type=n.document_type;if(n.filename!==void 0)U.filename=n.filename;else if(n.document_type==="pdf"&&n.file_path!==void 0)U.filename=n.file_path;if(n.filenames!==void 0&&n.filenames.length>0)U.filenames=n.filenames;if(n.title!==void 0)U.title=n.title;if(n.changes_summary!==void 0)U.changes_summary=n.changes_summary;if(n.resolutions!==void 0&&n.resolutions.length>0)U.resolutions=n.resolutions;let k={};if(n.idempotency_key)k["Idempotency-Key"]=n.idempotency_key;return{reviewId:n.review_id,body:U,headers:k}}async function T8(n,i){try{let $=await n.post(`/reviews/${encodeURIComponent(i.reviewId)}/revise`,{body:i.body,headers:i.headers});return H($.body,$.requestId)}catch($){if($ instanceof D)return G($);throw $}}function OD(n,i){let $=new Map;function g(W){let Y=W.indexOf("#");if(Y===-1)throw new D(500,"invalid_review_url","Review link URL is missing fragment token","local");return W.slice(Y+1)}async function v(W){let Y=$.get(W);if(Y&&Y.expiresAtMs>Date.now())return Y.token;let B=await i.get(`/sessions/${W}/participants`,{query:{role:"reviewer"}}),O=B.body.items?.[0]?.participant_id;if(!O)O=(await i.get(`/sessions/${W}/participants`,{query:{limit:"1"}})).body.items?.[0]?.participant_id;if(!O)throw new D(422,"no_participants","No participants available to mint a render token",B.requestId);let E=await i.post(`/sessions/${W}/links`,{body:{participant_id:O,scope:"read",single_use:!0,url_token_ttl_minutes:60}}),T=E.body.url;if(!T||typeof T!=="string")throw new D(500,"invalid_link_response","Failed to mint review link for render",E.requestId);let a=await i.post("/auth/exchange",{body:{url_token:g(T)}}),s=a.body.session_access_token,r=a.body.expires_in_seconds;if(!s||typeof s!=="string")throw new D(500,"token_exchange_failed","Failed to exchange review link for review access token",a.requestId);let gn=typeof r==="number"&&Number.isFinite(r)?Math.max(0,Math.trunc(r)-30)*1000:300000;return $.set(W,{token:s,expiresAtMs:Date.now()+gn}),s}let w={name:"typescape_create_review",description:"Create a new Typescape review for Markdown, image-set, or PDF content. Supports three source modes: (1) git-backed with repo_id+git_sha, (2) inline with content_body and optional inline_assets (base64), or (3) upload-backed with project_id+upload_batch_id. Returns the review ID and any invitations sent.",inputSchema:QD};n.register(w,async(W)=>{let Y=x8(W);if(Y instanceof D)return G(Y);return E8(i,Y)});let _={name:"typescape_revise_review",description:"Compatibility-only helper for product-owned revise flows. Preferred pattern: external agent revises content, then create a new Typescape review pinned to a newer revision, superseding an existing review. The predecessor becomes read-only and unresolved findings are carried forward to the new review. Supports git revision (git_sha) and upload revision (content_body or upload_batch_id+project_id).",inputSchema:WD};n.register(_,async(W)=>{let Y=o8(W);if(Y instanceof D)return G(Y);return T8(i,Y)});let U={name:"typescape_export_review",description:"Export all feedback from a Typescape review as structured JSON. Returns the full export document including findings, comments, and anchors.",inputSchema:YD};n.register(U,async(W)=>{let Y=W;if(!Y.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));let O={schema:typeof Y.schema==="string"&&Y.schema.trim().length>0?Y.schema.trim():"v2"};if(Y.view)O.view=Y.view;if(Y.include_rule_context)O.include_rule_context="true";let E={};if(Y.expected_version)E["If-Match"]=Y.expected_version;try{let T=await i.get(`/reviews/${Y.review_id}/export`,{query:O,headers:E});return H(T.body,T.requestId)}catch(T){if(T instanceof D)return G(T);throw T}});let k={name:"typescape_get_handoff",description:"Fetch the canonical agent handoff bundle for a Typescape review. Returns review state, findings, lineage, rules, artifacts, and next actions in one read-only package.",inputSchema:ID};n.register(k,async(W)=>{let Y=W;if(!Y.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));let B={};if(typeof Y.include_rules==="boolean")B.include_rules=Y.include_rules?"true":"false";if(typeof Y.include_lineage==="boolean")B.include_lineage=Y.include_lineage?"true":"false";if(typeof Y.include_advisory==="boolean")B.include_advisory=Y.include_advisory?"true":"false";if(typeof Y.include_blocks==="boolean")B.include_blocks=Y.include_blocks?"true":"false";if(typeof Y.max_rules==="number")B.max_rules=String(Y.max_rules);try{let O=await i.get(`/reviews/${encodeURIComponent(Y.review_id)}/handoff`,{query:B});return H(O.body,O.requestId)}catch(O){if(O instanceof D)return G(O);throw O}});let l={name:"typescape_list_reviews",description:"List Typescape reviews with optional filters. Returns paginated review summaries. Use cursor from previous response for pagination.",inputSchema:jD};n.register(l,async(W)=>{let Y=W,B={};if(Y.repo_id)B.repo_id=Y.repo_id;if(Y.state)B.state=Y.state;if(Y.file_paths)B.file_paths=Y.file_paths;if(Y.cursor)B.cursor=Y.cursor;if(Y.limit!==void 0)B.limit=String(Y.limit);if(Y.root_review_id)B.root_review_id=Y.root_review_id;if(Y.supersedes_review_id)B.supersedes_review_id=Y.supersedes_review_id;if(Y.has_successor!==void 0)B.has_successor=Y.has_successor?"true":"false";let O=Y.q??Y.search;if(O)B.q=O;try{let E=await i.get("/reviews",{query:B});return H(E.body,E.requestId)}catch(E){if(E instanceof D)return G(E);throw E}});let J={name:"typescape_get_review",description:"Get details of a specific Typescape review. Returns full review metadata including participants, stats, and provenance.",inputSchema:uD};n.register(J,async(W)=>{let Y=W;if(!Y.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));try{let B=await i.get(`/reviews/${encodeURIComponent(Y.review_id)}`);return H(B.body,B.requestId)}catch(B){if(B instanceof D)return G(B);throw B}});let Q={name:"typescape_get_render",description:"Get the rendered content of a review. Returns immutable block-level HTML structure with block_ids for anchoring.",inputSchema:HD};n.register(Q,async(W)=>{let Y=W;if(!Y.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));let B={};if(Y.include_plaintext)B.include_plaintext="true";try{let O=await v(Y.review_id),E=await i.get(`/sessions/${Y.review_id}/render`,{query:B,headers:{Authorization:`Bearer ${O}`}});return H(E.body,E.requestId)}catch(O){if(O instanceof D)return G(O);throw O}});let j={name:"typescape_list_findings",description:"List findings (review comments) for a review. Optionally filter by block_id anchor or finding status. Returns paginated finding list with comments.",inputSchema:VD},u=async(W)=>{if(!W.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));let Y={};if(W.block_id)Y.block_id=W.block_id;if(W.status)Y.status=W.status;if(W.cursor)Y.cursor=W.cursor;if(W.limit!==void 0)Y.limit=String(W.limit);let B=W.q??W.search;if(B)Y.q=B;try{let O=await i.get(`/reviews/${encodeURIComponent(W.review_id)}/findings`,{query:Y});return H(O.body,O.requestId)}catch(O){if(O instanceof D)return G(O);throw O}};n.register(j,async(W)=>{return u(W)}),n.register({name:"typescape_search_reviews",description:"Search reviews by title/file path using server-side query matching.",inputSchema:fD},async(W)=>{let Y=W,B=typeof Y.query==="string"?Y.query.trim():"";if(!B)return G(new D(400,"missing_param","Missing required parameter: query","local"));let O={q:B};if(Y.limit!==void 0)O.limit=String(Y.limit);if(Y.cursor)O.cursor=Y.cursor;try{let E=await i.get("/reviews",{query:O});return H(E.body,E.requestId)}catch(E){if(E instanceof D)return G(E);throw E}}),n.register({name:"typescape_search_findings",description:"Search findings/comments within a review using server-side query matching.",inputSchema:qD},async(W)=>{let Y=W,B=typeof Y.query==="string"?Y.query.trim():"";if(!Y.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));if(!B)return G(new D(400,"missing_param","Missing required parameter: query","local"));return u({review_id:Y.review_id,q:B,block_id:Y.block_id,status:Y.status,limit:Y.limit,cursor:Y.cursor})}),n.register({name:"typescape_close_review",description:"Close an active review, making it read-only for reviewers.",inputSchema:M0},async(W)=>{let Y=W;if(!Y.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));try{let B=await i.post(`/reviews/${encodeURIComponent(Y.review_id)}/close`,{body:{}});return H(B.body,B.requestId)}catch(B){if(B instanceof D)return G(B);throw B}}),n.register({name:"typescape_reopen_review",description:"Reopen a closed review and return it to active state.",inputSchema:M0},async(W)=>{let Y=W;if(!Y.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));try{let B=await i.post(`/reviews/${encodeURIComponent(Y.review_id)}/reopen`,{body:{}});return H(B.body,B.requestId)}catch(B){if(B instanceof D)return G(B);throw B}})}var BD={type:"object",properties:{review_id:{type:"string",description:"Review ID to export response matrix for (e.g., sess_01HXYZ...)"}},required:["review_id"]},FD={type:"object",properties:{review_id:{type:"string",description:"Review ID to create finding in (e.g., sess_01HXYZ...)"},body_md:{type:"string",description:"Finding body in Markdown"},body:{type:"string",description:"Compatibility alias for body_md"},block_id:{type:"string",description:"Block ID to anchor finding to (optional; omit for review-level)"},anchor:{type:"object",properties:{type:{type:"string",enum:["session","block","range"],description:"Anchor type (default: session if no block_id, block if block_id provided)"},start_offset:{type:"number",description:"Start offset for range anchor"},end_offset:{type:"number",description:"End offset for range anchor"}},description:"Anchor details (optional)"},severity:{type:"string",enum:["suggestion","needs_changes","blocking"],description:"Thread severity. Note: 'blocking' from automation is coerced to 'needs_changes' per Ch 11 L6250"},tags:{type:"array",items:{type:"string"},description:"Tags for categorization (optional)"},suggestion:{type:"object",properties:{type:{type:"string",enum:["replace","insert","delete"]}},description:"Suggested change (optional)"},idempotency_key:{type:"string",description:"Idempotency key for safe retries (optional)"}},required:["review_id","body_md"]},ND={type:"object",properties:{review_id:{type:"string",description:"Review ID containing the finding"},finding_id:{type:"string",description:"Finding ID to post comment to"},body_md:{type:"string",description:"Comment body in Markdown"},body:{type:"string",description:"Compatibility alias for body_md"},idempotency_key:{type:"string",description:"Idempotency key for safe retries (optional)"}},required:["review_id","finding_id","body_md"]},cD={type:"object",properties:{review_id:{type:"string",description:"Review ID containing the finding"},finding_id:{type:"string",description:"Finding ID to resolve"},decision:{type:"object",properties:{state:{type:"string",enum:["accepted","rejected","deferred","duplicate","needs_more_info"],description:"Decision state"},rationale_md:{type:"string",description:"Rationale in Markdown (optional)"}},required:["state"],description:"Decision to record with resolution (optional)"},expected_version:{type:"string",description:"Expected version for optimistic concurrency (thread ETag or integer version, optional)"},if_match:{type:"string",description:"Alias for expected_version (thread ETag or integer version, optional)"}},required:["review_id","finding_id"]},PD={type:"object",properties:{review_id:{type:"string",description:"Review ID containing the finding"},finding_id:{type:"string",description:"Finding ID to reopen"},expected_version:{type:"string",description:"Expected version for optimistic concurrency (thread ETag or integer version, optional)"},if_match:{type:"string",description:"Alias for expected_version (thread ETag or integer version, optional)"}},required:["review_id","finding_id"]},SD={type:"object",properties:{review_id:{type:"string",description:"Review ID containing the finding"},finding_id:{type:"string",description:"Finding ID to record decision for"},state:{type:"string",enum:["undecided","accepted","rejected","deferred","duplicate","needs_more_info","dismissed","waived"],description:"Decision state"},rationale_md:{type:"string",description:"Rationale in Markdown (optional)"}},required:["review_id","finding_id","state"]},zD={type:"object",properties:{review_id:{type:"string",description:"Review ID containing the finding"},finding_id:{type:"string",description:"Finding ID to attach evidence to"},evidence_type:{type:"string",enum:["commit","proposed_change","pr","attestation","external_ticket","note"],description:"Evidence type (required). Determines which additional fields are relevant."},commit_sha:{type:"string",description:"Git commit SHA (for evidence_type=commit)"},repo_url:{type:"string",description:"Repository URL (for evidence_type=commit)"},message:{type:"string",description:"Commit message (for evidence_type=commit)"},proposed_change_id:{type:"string",description:"Proposed change ID (for evidence_type=proposed_change)"},patch_sha256:{type:"string",description:"Patch SHA256 (for evidence_type=proposed_change)"},pr_url:{type:"string",description:"PR URL (for evidence_type=pr)"},pr_number:{type:"number",description:"PR number (for evidence_type=pr)"},attestation_id:{type:"string",description:"Attestation ID (for evidence_type=attestation)"},attestor:{type:"string",description:"Attestor identity (optional, for attestation type)"},ticket_url:{type:"string",description:"Ticket URL (for evidence_type=external_ticket)"},ticket_id:{type:"string",description:"Ticket ID (for evidence_type=external_ticket)"},system:{type:"string",description:"Ticket system (for evidence_type=external_ticket)"},note_md:{type:"string",description:"Note text (for evidence_type=note)"},body_md:{type:"string",description:"Markdown evidence body (alias for note_md/text; useful for attestation/external_ticket notes)"},dedupe_key:{type:"string",description:"Optional idempotency/deduplication key for evidence attach"}},required:["review_id","finding_id","evidence_type"]},MD={type:"object",properties:{review_id:{type:"string",description:"Review ID containing the finding."},finding_id:{type:"string",description:"Finding ID to fetch latest decision for."}},required:["review_id","finding_id"]},RD={type:"object",properties:{review_id:{type:"string",description:"Review ID containing the finding."},finding_id:{type:"string",description:"Finding ID to list evidence for."},limit:{type:"number",description:"Maximum evidence entries to return (optional)."},cursor:{type:"string",description:"Pagination cursor from previous response (optional)."}},required:["review_id","finding_id"]};var xD=["typescape_export_response_matrix","typescape_create_finding","typescape_post_comment","typescape_resolve_finding","typescape_reopen_finding","typescape_record_decision","typescape_attach_evidence","typescape_get_decision","typescape_list_evidence"],R0=on({operation:"read"});function x$(n){return on({operation:"write",hasIdempotencyKey:n})}var Z8="X-Typescape-If-Match";function AD(n,i,$){if(!n)return;if(/^[1-9]\d*$/.test(n)){i.expected_version=Number.parseInt(n,10);return}$[Z8]=n}function hD(n,i){n.register({name:"typescape_export_response_matrix",description:"Export the response matrix for a review. Returns per-finding decision and evidence summary.",inputSchema:BD},async($)=>{let g=$;if(!g.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));try{let v=await i.get(`/reviews/${g.review_id}/export`,{query:{view:"response_matrix.v1"}});return H(v.body,v.requestId,{retry:R0})}catch(v){if(v instanceof D)return G(v,{operation:"read"});throw v}}),n.register({name:"typescape_create_finding",description:"Create a new finding (comment) on a review. Optionally anchor to a specific block_id. Agent-created findings are tagged source='automation'. Severity 'blocking' is coerced to 'needs_changes' for automation sources.",inputSchema:FD},async($)=>{let g=$,v=g.body_md??g.body;if(!g.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));if(!v)return G(new D(400,"missing_param","Missing required parameter: body_md","local"));let w={body_md:v,source:"automation"},_=typeof g.block_id==="string"?g.block_id.trim():void 0;if(_)w.block_id=_;if(g.anchor!==void 0)w.anchor=g.anchor;else if(_)w.anchor={type:"block"};if(g.severity!==void 0)w.severity=g.severity;if(g.tags!==void 0)w.tags=g.tags;if(g.suggestion!==void 0)w.suggestion=g.suggestion;let U={};if(g.idempotency_key)U["Idempotency-Key"]=g.idempotency_key;try{let k=await i.post(`/reviews/${encodeURIComponent(g.review_id)}/findings`,{body:w,headers:U});return H(k.body,k.requestId,{retry:x$(Boolean(g.idempotency_key))})}catch(k){if(k instanceof D)return G(k,{operation:"write",hasIdempotencyKey:Boolean(g.idempotency_key)});throw k}}),n.register({name:"typescape_post_comment",description:"Post a comment (reply) to an existing finding. Returns the created comment with its ID.",inputSchema:ND},async($)=>{let g=$,v=g.body_md??g.body;if(!g.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));if(!g.finding_id)return G(new D(400,"missing_param","Missing required parameter: finding_id","local"));if(!v)return G(new D(400,"missing_param","Missing required parameter: body_md","local"));let w={body_md:v,source:"automation"},_={};if(g.idempotency_key)_["Idempotency-Key"]=g.idempotency_key;try{let U=await i.post(`/reviews/${encodeURIComponent(g.review_id)}/findings/${encodeURIComponent(g.finding_id)}/comments`,{body:w,headers:_});return H(U.body,U.requestId,{retry:x$(Boolean(g.idempotency_key))})}catch(U){if(U instanceof D)return G(U,{operation:"write",hasIdempotencyKey:Boolean(g.idempotency_key)});throw U}}),n.register({name:"typescape_resolve_finding",description:"Resolve (close) a finding. Optionally include a decision. Use expected_version or if_match for optimistic concurrency.",inputSchema:cD},async($)=>{let g=$;if(!g.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));if(!g.finding_id)return G(new D(400,"missing_param","Missing required parameter: finding_id","local"));let v=g.decision===void 0?{status:"resolved"}:{disposition:g.decision},w={};AD(g.expected_version??g.if_match,v,w);try{let _=g.decision===void 0?await i.patch(`/reviews/${encodeURIComponent(g.review_id)}/findings/${encodeURIComponent(g.finding_id)}`,{body:v,headers:w}):await i.post(`/sessions/${g.review_id}/threads/${g.finding_id}/resolve`,{body:v,headers:w});return H(_.body,_.requestId,{retry:x$(!1)})}catch(_){if(_ instanceof D)return G(_,{operation:"write"});throw _}}),n.register({name:"typescape_reopen_finding",description:"Reopen a previously resolved finding. Use expected_version or if_match for optimistic concurrency.",inputSchema:PD},async($)=>{let g=$;if(!g.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));if(!g.finding_id)return G(new D(400,"missing_param","Missing required parameter: finding_id","local"));let v={},w={};AD(g.expected_version??g.if_match,v,w);try{v.status="open";let _=await i.patch(`/reviews/${encodeURIComponent(g.review_id)}/findings/${encodeURIComponent(g.finding_id)}`,{body:v,headers:w});return H(_.body,_.requestId,{retry:x$(!1)})}catch(_){if(_ instanceof D)return G(_,{operation:"write"});throw _}}),n.register({name:"typescape_record_decision",description:"Record a decision (decision) on a finding. Decisions track how feedback was addressed. Note: recording a resolving decision may automatically resolve the finding.",inputSchema:SD},async($)=>{let g=$;if(!g.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));if(!g.finding_id)return G(new D(400,"missing_param","Missing required parameter: finding_id","local"));if(!g.state)return G(new D(400,"missing_param","Missing required parameter: state","local"));let v={state:g.state};if(g.rationale_md!==void 0)v.rationale_md=g.rationale_md;try{let w=await i.post(`/reviews/${encodeURIComponent(g.review_id)}/findings/${encodeURIComponent(g.finding_id)}/decision`,{body:v});return H(w.body,w.requestId,{retry:x$(!1)})}catch(w){if(w instanceof D)return G(w,{operation:"write"});throw w}}),n.register({name:"typescape_attach_evidence",description:"Attach evidence to a finding. Evidence proves that feedback was addressed (e.g., commit SHA, proposed change, PR URL, or attestation).",inputSchema:zD},async($)=>{let g=$;if(!g.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));if(!g.finding_id)return G(new D(400,"missing_param","Missing required parameter: finding_id","local"));let v,w;if(g.evidence_type){v=g.evidence_type.trim(),w={};let U=["commit_sha","repo_url","message","proposed_change_id","patch_sha256","pr_url","pr_number","attestation_id","attestor","ticket_url","ticket_id","system","note_md","body_md"];for(let k of U)if(g[k]!==void 0)w[k]=g[k];if(g.body_md!==void 0)w.body=g.body_md,w.text=g.body_md;else if(g.note_md!==void 0)w.body=g.note_md,w.text=g.note_md}else if(g.evidence)v=typeof g.evidence.type==="string"?g.evidence.type.trim():"",w={...g.evidence},delete w.type;else return G(new D(400,"missing_param","Missing required parameter: evidence_type","local"));if(!v)return G(new D(422,"invalid_argument","evidence_type is required","local"));let _={evidence_type:v,evidence_json:w};if(g.dedupe_key)_.dedupe_key=g.dedupe_key;try{let U=await i.post(`/reviews/${encodeURIComponent(g.review_id)}/findings/${encodeURIComponent(g.finding_id)}/evidence`,{body:_});return H(U.body,U.requestId,{retry:x$(!1)})}catch(U){if(U instanceof D)return G(U,{operation:"write"});throw U}}),n.register({name:"typescape_get_decision",description:"Get the latest decision for a specific finding.",inputSchema:MD},async($)=>{let g=$;if(!g.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));if(!g.finding_id)return G(new D(400,"missing_param","Missing required parameter: finding_id","local"));try{let v=await i.get(`/reviews/${encodeURIComponent(g.review_id)}/findings/${encodeURIComponent(g.finding_id)}/decision`);return H(v.body,v.requestId,{retry:R0})}catch(v){if(v instanceof D)return G(v,{operation:"read"});throw v}}),n.register({name:"typescape_list_evidence",description:"List evidence entries attached to a finding.",inputSchema:RD},async($)=>{let g=$;if(!g.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));if(!g.finding_id)return G(new D(400,"missing_param","Missing required parameter: finding_id","local"));let v={};if(g.limit!==void 0)v.limit=String(g.limit);if(g.cursor)v.cursor=g.cursor;try{let w=await i.get(`/reviews/${encodeURIComponent(g.review_id)}/findings/${encodeURIComponent(g.finding_id)}/evidence`,{query:v});return H(w.body,w.requestId,{retry:R0})}catch(w){if(w instanceof D)return G(w,{operation:"read"});throw w}})}var l_=["file","doc","pr","custom"],CD=new Set(l_),ED={type:"object",properties:{source_type:{type:"string",enum:["git","upload"],description:"Source type for the review set"},title:{type:"string",description:"Review set title (optional)"},kind:{type:"string",enum:["review_set","release_bundle","packet"],description:"Kind of review set (optional, default: review_set)"},participants:{type:"array",items:{type:"object",properties:{email:{type:"string"},role:{type:"string",enum:["reviewer","approver"]},roles:{type:"array",items:{type:"string",enum:["reviewer","approver"]},minItems:1}},required:["email"]},description:"Participants to invite (optional). Supports role (single) or roles (array)."},reviews:{type:"array",items:{oneOf:[{type:"string"},{type:"object",properties:{review_id:{type:"string"},session_id:{type:"string"},required:{type:"boolean"}},anyOf:[{required:["review_id"]},{required:["session_id"]}],additionalProperties:!1}]},minItems:1,description:"Review IDs (or review entry objects) to include in this review set."},files:{type:"array",items:{type:"object",properties:{repo_id:{type:"string"},git_sha:{type:"string"},project_id:{type:"string"},upload_batch_id:{type:"string"},file_path:{type:"string"},required:{type:"boolean"}},required:["file_path"],additionalProperties:!1},minItems:1,description:"File entries for git or upload source types (must include file_path plus source identifiers)."},idempotency_key:{type:"string",description:"Idempotency key for safe retries (optional)"}},required:["source_type"]},oD={type:"object",properties:{review_set_id:{type:"string",description:"Review set ID to export"},schema:{type:"string",description:"Export schema version (optional, default: v2). Canonical first-party review-set export uses schema=v2."},view:{type:"string",description:"Export view variant (optional). Values: full, redacted, response_matrix.v1, etc."}},required:["review_set_id"]},TD={type:"object",properties:{limit:{type:"number",description:"Maximum number of review sets to return (default: 20, max: 100)"},cursor:{type:"string",description:"Pagination cursor from a previous response"}}},ZD={type:"object",properties:{review_set_id:{type:"string",description:"Review set ID to retrieve"}},required:["review_set_id"]},rD={type:"object",properties:{source_type:{type:"string",enum:["git","upload"],description:"Source type for the review ref"},repo_id:{type:"string",description:"Repository identifier (required for git source_type; short slug, e.g. 'typescape')"},project_id:{type:"string",description:"Project identifier (required for upload source_type; omit for git)"},kind:{type:"string",enum:l_,description:"Review ref kind"},key:{type:"string",description:"Review ref key (e.g., file path, doc slug, PR number, custom name)"},head_session_id:{type:"string",description:"Session ID to use as the initial head (required, e.g., sess_01HXYZ...)"}},required:["source_type","kind","key","head_session_id"]},mD={type:"object",properties:{review_ref_id:{type:"string",description:"Review ref ID to resolve"}},required:["review_ref_id"]},yD={type:"object",properties:{review_ref_id:{type:"string",description:"Review ref ID to advance"},head_session_id:{type:"string",description:"New head review ID to advance to"},expected_head_session_id:{type:"string",description:"Expected current head for optimistic concurrency (optional)"}},required:["review_ref_id","head_session_id"]},dD={type:"object",properties:{review_id:{type:"string",description:"Review ID to request approval for"},approver_emails:{type:"array",items:{type:"string"},description:"Email addresses of approvers"},message:{type:"string",description:"Message to include with the approval request (optional)"},notify:{type:"object",properties:{email:{type:"boolean"},slack:{type:"boolean"}},description:"Notification channels (optional)"},idempotency_key:{type:"string",description:"Idempotency key for safe retries (optional)"}},required:["review_id","approver_emails"]},eD={type:"object",properties:{review_id:{type:"string",description:"Review ID to get status for"},simulate:{type:"boolean",description:"Run policy evaluation without side effects (optional)"},wait:{type:"number",description:"Long-poll timeout in seconds (optional)"}},required:["review_id"]},pD={type:"object",properties:{review_id:{type:"string",description:"Review ID to run checks against"}},required:["review_id"]},aD={type:"object",properties:{},additionalProperties:!1},sD={type:"object",properties:{},additionalProperties:!1},nJ={type:"object",properties:{},additionalProperties:!1};var vJ=["typescape_create_review_set","typescape_export_review_set","typescape_list_review_sets","typescape_get_review_set","typescape_create_review_ref","typescape_resolve_review_ref","typescape_advance_review_ref","typescape_request_approval","typescape_get_status","typescape_run_checks","typescape_account_usage","typescape_account_plan","typescape_get_capabilities"];function r8(n){return n.replace(/\bSession\b/g,"Review").replace(/\bsession\b/g,"review").replace(/\bThread\b/g,"Finding").replace(/\bthread\b/g,"finding")}function A0(n){if(Array.isArray(n))return n.map((g)=>A0(g));if(n===null||typeof n!=="object")return n;let i=new Map([["session_id","review_id"],["thread_id","finding_id"],["thread_ids","finding_ids"]]),$=Object.entries(n).map(([g,v])=>{let w=i.get(g)??g,_=typeof v==="string"&&(g==="description"||g==="message")?r8(v):A0(v);return[w,_]});return Object.fromEntries($)}function iJ(n,i,$){n.register({name:"typescape_create_review_set",description:"Create a new review set (multi-file review pack). Requires features.review_sets to be enabled.",inputSchema:ED},async(g)=>{let v=g;try{if(!(await $.getCapabilities()).review_sets)return $.featureDisabledResult("review_sets")}catch(J){if(J instanceof D)return G(J);throw J}if(!v.source_type)return G(new D(400,"missing_param","Missing required parameter: source_type","local"));if(v.source_type!=="git"&&v.source_type!=="upload")return G(new D(422,"invalid_argument","source_type must be one of: git, upload","local"));let w=Array.isArray(v.reviews)&&v.reviews.length>0?v.reviews:Array.isArray(v.sessions)&&v.sessions.length>0?v.sessions:void 0,_=Array.isArray(w)&&w.length>0,U=Array.isArray(v.files)&&v.files.length>0;if(!_&&!U)return G(new D(400,"missing_param","At least one of reviews[] or files[] is required","local"));let k={source_type:v.source_type};if(v.title!==void 0)k.title=v.title;if(v.kind!==void 0)k.kind=v.kind;if(_)k.reviews=w;if(U)k.files=v.files;if(v.participants!==void 0)k.participants=v.participants.map((J)=>{if(Array.isArray(J.roles)&&J.roles.length>0)return{email:J.email,roles:J.roles};if(J.role)return{email:J.email,roles:[J.role]};return J});let l={};if(v.idempotency_key)l["Idempotency-Key"]=v.idempotency_key;try{let J=await i.post("/review-sets",{body:k,headers:l});return H(J.body,J.requestId)}catch(J){if(J instanceof D)return G(J);throw J}}),n.register({name:"typescape_export_review_set",description:"Export feedback from a review set. Requires features.review_sets to be enabled.",inputSchema:oD},async(g)=>{let v=g;try{if(!(await $.getCapabilities()).review_sets)return $.featureDisabledResult("review_sets")}catch(U){if(U instanceof D)return G(U);throw U}if(!v.review_set_id)return G(new D(400,"missing_param","Missing required parameter: review_set_id","local"));let _={schema:typeof v.schema==="string"&&v.schema.trim().length>0?v.schema.trim():"v2"};if(v.view)_.view=v.view;try{let U=await i.get(`/review-sets/${encodeURIComponent(v.review_set_id)}/export`,{query:_});return H(U.body,U.requestId)}catch(U){if(U instanceof D)return G(U);throw U}}),n.register({name:"typescape_list_review_sets",description:"List review sets with optional cursor pagination. Requires features.review_sets to be enabled. Returns an array of review sets with pagination metadata.",inputSchema:TD},async(g)=>{let v=g;try{if(!(await $.getCapabilities()).review_sets)return $.featureDisabledResult("review_sets")}catch(_){if(_ instanceof D)return G(_);throw _}let w={};if(v.limit!==void 0)w.limit=String(v.limit);if(v.cursor!==void 0)w.cursor=v.cursor;try{let _=await i.get("/review-sets",{query:w});return H(_.body,_.requestId)}catch(_){if(_ instanceof D)return G(_);throw _}}),n.register({name:"typescape_get_review_set",description:"Get a review set by ID. Returns the review set details including status, review memberships, and configuration. Requires features.review_sets to be enabled.",inputSchema:ZD},async(g)=>{let v=g;try{if(!(await $.getCapabilities()).review_sets)return $.featureDisabledResult("review_sets")}catch(w){if(w instanceof D)return G(w);throw w}if(!v.review_set_id)return G(new D(400,"missing_param","Missing required parameter: review_set_id","local"));try{let w=await i.get(`/review-sets/${encodeURIComponent(v.review_set_id)}`);return H(w.body,w.requestId)}catch(w){if(w instanceof D)return G(w);throw w}}),n.register({name:"typescape_create_review_ref",description:"Create a stable review reference that tracks HEAD review for doc/file/PR/custom keys. Always available (core primitive).",inputSchema:rD},async(g)=>{let v=g;if(!v.source_type)return G(new D(400,"missing_param","Missing required parameter: source_type","local"));if(!v.kind)return G(new D(400,"missing_param","Missing required parameter: kind","local"));if(!v.key)return G(new D(400,"missing_param","Missing required parameter: key","local"));if(!v.head_session_id)return G(new D(400,"missing_param","Missing required parameter: head_session_id","local"));let w=v.kind.trim().toLowerCase();if(!CD.has(w))return G(new D(400,"invalid_param",`Invalid parameter: kind must be one of ${l_.join(", ")}`,"local"));let _={source_type:v.source_type,kind:w,key:v.key,head_session_id:v.head_session_id};if(v.repo_id!==void 0)_.repo_id=v.repo_id;if(v.project_id!==void 0)_.project_id=v.project_id;try{let U=await i.post("/review-refs",{body:_});return H(U.body,U.requestId)}catch(U){if(U instanceof D)return G(U);throw U}}),n.register({name:"typescape_resolve_review_ref",description:"Resolve a review ref to its current head review. Returns the head review ID and pinned content details.",inputSchema:mD},async(g)=>{let v=g;if(!v.review_ref_id)return G(new D(400,"missing_param","Missing required parameter: review_ref_id","local"));try{let w=await i.get(`/review-refs/${encodeURIComponent(v.review_ref_id)}/resolve`);return H(w.body,w.requestId)}catch(w){if(w instanceof D)return G(w);throw w}}),n.register({name:"typescape_advance_review_ref",description:"Advance a review ref to a new head review. Use expected_head_session_id for optimistic concurrency.",inputSchema:yD},async(g)=>{let v=g;if(!v.review_ref_id)return G(new D(400,"missing_param","Missing required parameter: review_ref_id","local"));if(!v.head_session_id)return G(new D(400,"missing_param","Missing required parameter: head_session_id","local"));let w={head_session_id:v.head_session_id};if(v.expected_head_session_id!==void 0)w.expected_head_session_id=v.expected_head_session_id;try{let _=await i.post(`/review-refs/${encodeURIComponent(v.review_ref_id)}/advance`,{body:w});return H(_.body,_.requestId)}catch(_){if(_ instanceof D)return G(_);throw _}}),n.register({name:"typescape_request_approval",description:"Request approval for a review from specified approvers. Sends notifications via configured channels.",inputSchema:dD},async(g)=>{let v=g;if(!v.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));if(!v.approver_emails||v.approver_emails.length===0)return G(new D(400,"missing_param","Missing required parameter: approver_emails","local"));let w={approver_emails:v.approver_emails};if(v.message!==void 0)w.message=v.message;if(v.notify!==void 0)w.notify=v.notify;let _={};if(v.idempotency_key)_["Idempotency-Key"]=v.idempotency_key;try{let U=await i.post(`/reviews/${encodeURIComponent(v.review_id)}/request-approval`,{body:w,headers:_});return H(U.body,U.requestId)}catch(U){if(U instanceof D)return G(U);throw U}}),n.register({name:"typescape_get_status",description:"Get the policy verdict for a review. Returns pass/fail/needs_review with reasons. Requires features.policy to be enabled.",inputSchema:eD},async(g)=>{let v=g;try{if(!(await $.getCapabilities()).policy)return $.featureDisabledResult("policy")}catch(_){if(_ instanceof D)return G(_);throw _}if(!v.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));let w={};if(v.simulate)w.simulate="true";if(v.wait!==void 0)w.wait=String(v.wait);try{let _=await i.get(`/reviews/${encodeURIComponent(v.review_id)}/status`,{query:w});return H(A0(_.body),_.requestId)}catch(_){if(_ instanceof D)return G(_);throw _}}),n.register({name:"typescape_run_checks",description:"Trigger quality checks (DocLint) for a review. Returns the check run ID. Requires features.checks to be enabled.",inputSchema:pD},async(g)=>{let v=g;try{if(!(await $.getCapabilities()).checks)return $.featureDisabledResult("checks")}catch(w){if(w instanceof D)return G(w);throw w}if(!v.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));try{let w=await i.post(`/reviews/${encodeURIComponent(v.review_id)}/run-checks`,{body:{}});return H(w.body,w.requestId)}catch(w){if(w instanceof D)return G(w);throw w}}),n.register({name:"typescape_account_usage",description:"Get account usage and quota information (reviews used/limit, remaining, and billing period).",inputSchema:aD},async()=>{try{let g=await i.get("/account/usage");return H(g.body,g.requestId)}catch(g){if(g instanceof D)return G(g);throw g}}),n.register({name:"typescape_account_plan",description:"Get account plan details (plan name/id, status, and limits metadata).",inputSchema:sD},async()=>{try{let g=await i.get("/account/plan");return H(g.body,g.requestId)}catch(g){if(g instanceof D)return G(g);throw g}}),n.register({name:"typescape_get_capabilities",description:"Get authenticated capabilities and effective feature flags. Returns the same payload shape as GET /v1/me/capabilities.",inputSchema:nJ},async()=>{try{let g=await i.get("/me/capabilities");return H(g.body,g.requestId)}catch(g){if(g instanceof D)return G(g);throw g}})}var $J=["typescape_request_snapshot","typescape_get_snapshot","typescape_list_backlinks","typescape_get_impact"],m8={type:"object",properties:{repo_id:{type:"string",description:"Repository identifier to build a corpus snapshot for"}},required:["repo_id"]},y8={type:"object",properties:{repo_id:{type:"string",description:"Repository identifier"},git_sha:{type:"string",description:"Git commit SHA for the snapshot"}},required:["repo_id","git_sha"]},d8={type:"object",properties:{repo_id:{type:"string",description:"Repository identifier"},git_sha:{type:"string",description:"Git commit SHA for the snapshot"},path:{type:"string",description:"Target file path to query backlinks for"},anchor:{type:"string",description:"Optional anchor within the file to narrow backlinks"}},required:["repo_id","git_sha","path"]},e8={type:"object",properties:{review_id:{type:"string",description:"Review identifier to compute impact radius for"}},required:["review_id"]};function gJ(n,i,$){n.register({name:"typescape_request_snapshot",description:"Request a corpus snapshot build for a repository. Returns the snapshot ID and build status. The snapshot builds "+"asynchronously — use typescape_get_snapshot to poll for completion. "+"Requires features.corpus_snapshots to be enabled.",inputSchema:m8},async(g)=>{let v=g;try{if(!(await $.getCapabilities()).corpus_snapshots)return $.featureDisabledResult("corpus_snapshots")}catch(w){if(w instanceof D)return G(w);throw w}if(!v.repo_id)return G(new D(400,"missing_param","Missing required parameter: repo_id","local"));try{let w=await i.post(`/repos/${encodeURIComponent(v.repo_id)}/snapshots`,{body:{}});return H(w.body,w.requestId)}catch(w){if(w instanceof D)return G(w);throw w}}),n.register({name:"typescape_get_snapshot",description:"Get corpus snapshot metadata for a Git repo at a specific commit. Returns snapshot status, config hash, and source type. Requires features.corpus_snapshots to be enabled.",inputSchema:y8},async(g)=>{let v=g;try{if(!(await $.getCapabilities()).corpus_snapshots)return $.featureDisabledResult("corpus_snapshots")}catch(w){if(w instanceof D)return G(w);throw w}if(!v.repo_id)return G(new D(400,"missing_param","Missing required parameter: repo_id","local"));if(!v.git_sha)return G(new D(400,"missing_param","Missing required parameter: git_sha","local"));try{let w=await i.get(`/repos/${encodeURIComponent(v.repo_id)}/snapshots/${encodeURIComponent(v.git_sha)}`);return H(w.body,w.requestId)}catch(w){if(w instanceof D)return G(w);throw w}}),n.register({name:"typescape_list_backlinks",description:"List inbound backlinks for a target file (and optional anchor) within a corpus snapshot. Returns deterministic, authoritative data. Requires features.corpus_snapshots to be enabled.",inputSchema:d8},async(g)=>{let v=g;try{if(!(await $.getCapabilities()).corpus_snapshots)return $.featureDisabledResult("corpus_snapshots")}catch(w){if(w instanceof D)return G(w);throw w}if(!v.repo_id)return G(new D(400,"missing_param","Missing required parameter: repo_id","local"));if(!v.git_sha)return G(new D(400,"missing_param","Missing required parameter: git_sha","local"));if(!v.path)return G(new D(400,"missing_param","Missing required parameter: path","local"));try{let w=new URLSearchParams({path:v.path});if(v.anchor)w.set("anchor",v.anchor);let _=await i.get(`/repos/${encodeURIComponent(v.repo_id)}/snapshots/${encodeURIComponent(v.git_sha)}/backlinks?${w}`);return H(_.body,_.requestId)}catch(w){if(w instanceof D)return G(w);throw w}}),n.register({name:"typescape_get_impact",description:"Compute the impact radius for a review: which other files are affected by changes to the review's target file (via backlinks). Returns deterministic, authoritative data. Requires features.corpus_snapshots to be enabled.",inputSchema:e8},async(g)=>{let v=g;try{if(!(await $.getCapabilities()).corpus_snapshots)return $.featureDisabledResult("corpus_snapshots")}catch(w){if(w instanceof D)return G(w);throw w}if(!v.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));try{let w=await i.get(`/reviews/${encodeURIComponent(v.review_id)}/impact`);return H(w.body,w.requestId)}catch(w){if(w instanceof D)return G(w);throw w}})}var JJ=["typescape_get_rules","typescape_rules_pack","typescape_check_content","typescape_import_rules","typescape_propose_rule","typescape_list_rule_proposals","typescape_list_rule_proposals_legacy","typescape_rules_dashboard","typescape_promote_rule_proposal","typescape_decide_rule_proposal"],Fn=on({operation:"read"}),x0=new Map;function D_(n){return on({operation:"write",hasIdempotencyKey:n})}function wJ(n){return n.status===0||n.status===429||n.status>=500}function _J(n){return{repo_id:typeof n.repo_id==="string"&&n.repo_id.trim().length>0?n.repo_id.trim():null,review_id:typeof n.review_id==="string"&&n.review_id.trim().length>0?n.review_id.trim():null,file_path:typeof n.file_path==="string"&&n.file_path.trim().length>0?n.file_path.trim():null}}function bJ(n,i){if(n.repo_id)return`/repos/${encodeURIComponent(n.repo_id)}/steering-pack?${i}`;return`/sessions/${encodeURIComponent(n.review_id)}/steering-pack?${i}`}function J_(n,i){let $=hl(n.freshness.fetched_at);return{...i,cache_status:$.status,cache_age_seconds:$.age_seconds,cache_compiled_hash:n.compiled_hash,...$.warning?{warnings:[{code:"cached_rules",message:$.warning}],cache_warning:$.warning}:{}}}function h0(n){if(!n||typeof n!=="object"||Array.isArray(n))return;let i=n.request_id;return typeof i==="string"?i:void 0}function C0(n){let i=n.compiledHash===void 0?null:n.compiledHash;return{rules:n.rules,compiled_hash:i,freshness:n.freshness,...n.requestId?{request_id:n.requestId}:{},...n.cacheMetadata??{}}}function XJ(n){if(!Array.isArray(n))return[];return n.filter((i)=>typeof i==="object"&&i!==null&&!Array.isArray(i))}function p8(n){if(!n||typeof n!=="object"||Array.isArray(n))return{latest_rule_session_updated_at:null,contributing_session_count:0,total_rule_count:0};let i=n;return{latest_rule_session_updated_at:typeof i.latest_rule_session_updated_at==="string"?i.latest_rule_session_updated_at:null,contributing_session_count:typeof i.contributing_session_count==="number"&&Number.isFinite(i.contributing_session_count)?i.contributing_session_count:0,total_rule_count:typeof i.total_rule_count==="number"&&Number.isFinite(i.total_rule_count)?i.total_rule_count:0}}function a8(n){if(!n||typeof n!=="object"||Array.isArray(n))return{};let i={};for(let[$,g]of Object.entries(n))if(typeof g==="string"&&g.length>0)i[$]=g;return i}function GJ(n,i,$){try{return _n(n)}catch{throw new D(502,"invalid_upstream_response",$,i)}}function UJ(n){let i=new URLSearchParams({format:n.format}),$=Object.entries(n.contentProperties).sort(([g],[v])=>g.localeCompare(v));for(let[g,v]of $)i.set(g,v);return`/rules?${i.toString()}`}async function s8(n){let i=await n.api.get(`/reviews/${encodeURIComponent(n.reviewId)}`),$=GJ(i.body,i.requestId,"Review detail response was not an object"),g=a8($.properties),v=typeof $.repo_id==="string"&&$.repo_id.length>0?$.repo_id:null,w=typeof $.file_path==="string"&&$.file_path.length>0?$.file_path:null,_=n.filePath??w;if(v)g.repo_id=v;if(_)g.file_path=_;return{reviewId:n.reviewId,repoId:v,filePath:_,contentProperties:g}}async function kJ(n){let i=new URLSearchParams({format:"text.v1"}),$=new URLSearchParams({format:"prompt_fragment.v1"});if(n.scope.file_path)i.set("file_path",n.scope.file_path),$.set("file_path",n.scope.file_path);if(n.policySnapshotId)i.set("policy_snapshot_id",n.policySnapshotId),$.set("policy_snapshot_id",n.policySnapshotId);if(n.tokenBudget!==void 0&&n.tokenBudget!==null)$.set("token_budget",String(n.tokenBudget));let[g,v]=await Promise.all([n.api.getText(bJ(n.scope,i)),n.api.get(bJ(n.scope,$))]),w=c0(v.body),_=P0(w),U=K0({scope:n.scope,rules:[],plain_text_bundle:g.body,freshness:{latest_rule_session_updated_at:null,contributing_session_count:0,total_rule_count:_.length},compiled_hash:typeof w.compiled_hash==="string"?w.compiled_hash:void 0,fetched_at:new Date().toISOString(),renderings:{text:g.body,json_payload:w,structured_payload:_}});return x0.set(g_(n.scope),U),{text:g.body,normalizedBody:w,structuredPayload:C0({rules:_,compiledHash:typeof w.compiled_hash==="string"?w.compiled_hash:null,freshness:{latest_rule_session_updated_at:null,contributing_session_count:0,total_rule_count:_.length},requestId:h0(w)})}}async function lJ(n){let i=await s8({api:n.api,reviewId:n.reviewId,filePath:n.filePath}),[$,g]=await Promise.all([n.api.getText(UJ({format:"text",contentProperties:i.contentProperties})),n.api.get(UJ({format:"json",contentProperties:i.contentProperties}))]),v=GJ(g.body,g.requestId,"Rules response payload was not an object"),w=XJ(v.rules),_=p8(v.freshness),U=h0(v),k=U===void 0?g.requestId:U,l=typeof v.compiled_hash==="string"?v.compiled_hash:null,J={...v,prompt_fragment:$.body,request_id:k},Q=C0({rules:w,compiledHash:l,freshness:_,requestId:k}),j=K0({scope:{repo_id:i.repoId,review_id:i.reviewId,file_path:i.filePath},rules:[],plain_text_bundle:$.body,freshness:_,compiled_hash:l??void 0,fetched_at:new Date().toISOString(),renderings:{text:$.body,json_payload:J,structured_payload:w}});return x0.set(g_({repo_id:i.repoId,review_id:i.reviewId,file_path:i.filePath}),j),{text:$.body,normalizedBody:J,structuredPayload:Q}}function DJ(n,i){let $=x0.get(g_(n));if(!$)return null;if(i==="text")return J_($,{text:$.plain_text_bundle,format:"text",cached:!0});if(i==="structured"){let v=XJ($.renderings?.structured_payload);return J_($,{...C0({rules:v,compiledHash:$.compiled_hash,freshness:$.freshness,requestId:h0($.renderings?.json_payload)}),cached:!0})}if(i==="prompt_fragment"){let v=$.renderings?.json_payload;if(v&&typeof v==="object"&&!Array.isArray(v))return J_($,{...v,non_authoritative:!0,compatibility_only:!0,cached:!0});return null}let g=$.renderings?.json_payload;if(!g||typeof g!=="object"||Array.isArray(g))return null;return J_($,{...g,cached:!0})}var nY={type:"object",properties:{repo_id:{type:"string",description:"Repository identifier"},review_id:{type:"string",description:"Review identifier. Use for upload-backed reviews or when repo_id is not known."},policy_snapshot_id:{type:"string",description:"Optional policy snapshot ID used to compile rules context"},file_path:{type:"string",description:"Optional file path to scope rules"},path:{type:"string",description:"Alias for file_path. If both are provided, file_path takes precedence."},format:{type:"string",enum:["text","structured","prompt_fragment"],description:'Output format: "text" returns the canonical plain-text rule bundle, "structured" returns governed JSON rules (authoritative), and "prompt_fragment" returns a compatibility prompt-shaped text view. Default: text.'},token_budget:{type:"number",description:"Maximum token count for prompt_fragment format (100-10000, default 2000)",minimum:100,maximum:1e4}}},vY={type:"object",properties:{source_type:{type:"string",enum:["thread","doc_review","slack","email","interview","automation","admin"],description:"How this rule was discovered"},source_ref:{type:"string",description:"Stable source reference (URL, message ID, document path). Required for non-thread source types."},source_excerpt:{type:"string",description:"Optional short excerpt from source context"},proposed_type:{type:"string",enum:["claim","knowledge","voice","constraint","steering_rule"],description:"Proposed rule type (default: constraint for non-thread rule proposals)"},proposed_content:{type:"object",additionalProperties:!0,description:"Structured proposed content payload"},related_item_ids:{type:"array",items:{type:"string",pattern:"^gci_[0-9A-HJKMNP-TV-Z]{26}$"},description:"Related rule proposal IDs (gci_<26-char ULID>)"},title:{type:"string",description:"Backward-compatible alias used to populate proposed_content.title"},content:{type:"string",description:"Backward-compatible alias used to populate proposed_content.content"},rationale:{type:"string",description:"Why this should become a rule"},target_document:{type:"string",description:"Target canonical document path"},priority:{type:"string",enum:["low","medium","high","critical"],description:"Priority level (default: medium)"},finding_id:{type:"string",description:"Source finding ID (required when source_type is 'thread')"},tags:{type:"array",items:{type:"string"},description:"Classification tags"}},required:["source_type"]},iY={type:"object",properties:{status:{type:"string",enum:["pending","in_review","needs_revision","approved","rejected","published"],description:"Filter by lifecycle status (default: pending)"},limit:{type:"number",default:20,description:"Maximum number of results"}}},$Y={type:"object",properties:{status:{type:"string",enum:["proposed","accepted","rejected","superseded"],description:"Filter by status (default: all)"},kind:{type:"string",enum:["terminology","style","structure","claim_policy","evidence_policy","voice","constraint"],description:"Filter by rule kind"},limit:{type:"number",default:20,description:"Maximum number of results"}}},gY={type:"object",properties:{repo_id:{type:"string",description:"Repository identifier for rules-pack lookup."},review_id:{type:"string",description:"Review identifier for rules-pack lookup when repo is unknown."},file_path:{type:"string",description:"Optional file path scope for rule selection."},path:{type:"string",description:"Alias for file_path."},format:{type:"string",enum:["text","prompt","structured","json"],description:'Output format. "text" returns the canonical plain-text rule bundle, "prompt" is a compatibility alias, "structured" returns normalized rules, and "json" returns the raw pack payload.'},token_budget:{type:"number",description:"Optional token budget for prompt_fragment generation."}}},wY={type:"object",properties:{content:{type:"string",description:"Markdown content to check against applicable rules (max 1MB)."},properties:{type:"object",additionalProperties:{type:"string"},description:"Content properties for rule matching (flat key-value map, e.g. { doc_type: 'procedure' })."},collection_id:{type:"string",description:"Optional collection ID to scope rule matching."},idempotency_key:{type:"string",description:"Idempotency key for safe retries (optional)."}},required:["content"]},_Y={type:"object",properties:{content:{type:"string",description:"Rule markdown content to import (max 512KB). Each list item is a rule block."},title:{type:"string",description:"Human-readable title for the imported rule review (optional)."},applicability:{type:"object",additionalProperties:{type:"string"},description:"Applicability selector for rule matching (flat key-value map, optional)."},provenance:{type:"object",properties:{source:{type:"string",enum:["manual","findings","external"],description:"Import source classification."},source_review_id:{type:"string",description:"Source review ID when imported from findings."},source_label:{type:"string",description:"Human-readable source label."}},description:"Provenance metadata for finding-seeded imports (optional)."},preview:{type:"boolean",description:"If true, returns a preview without creating a review (dry run). Default: false."},idempotency_key:{type:"string",description:"Idempotency key for safe retries (optional)."}},required:["content"]},bY={type:"object",properties:{include_degraded:{type:"boolean",default:!0,description:"Include degraded rule details"}}},UY={type:"object",properties:{gci_id:{type:"string",description:"Rule proposal ID to promote (must be in 'approved' status)"},repo_id:{type:"string",description:"Repository ID where the rule proposal should be created"},kind:{type:"string",enum:["terminology","style","structure","claim_policy","evidence_policy","voice","constraint"],description:"Rule kind for the proposal"},reviewer_notes:{type:"string",description:"Optional reviewer notes recorded on publish"}},required:["gci_id","repo_id"]},kY={type:"object",properties:{proposal_id:{type:"string",description:"Proposal ID to act on"},decision:{type:"string",enum:["accept","reject","deprecate"],description:"Decision to apply"},notes:{type:"string",description:"Decision rationale. Alias for reviewer_notes/reason for compatibility."},reviewer_notes:{type:"string",description:"Decision rationale for accept/reject actions"},reason:{type:"string",description:"Required reason for deprecate action"}},required:["proposal_id","decision"]};function tJ(n,i,$){n.register({name:"typescape_get_rules",description:'Canonical rules-first discovery surface for repository or review context. format="text" returns the canonical plain-text rule bundle. format="structured" returns the deterministic rulepack with compiled hash and freshness metadata. format="prompt_fragment" returns a compatibility prompt-shaped text view. Requires rules to be enabled.',inputSchema:nY},async(w)=>{let _=w;try{if(!(await $.getCapabilities()).rules)return $.featureDisabledResult("rules")}catch(u){if(u instanceof D)return G(u);throw u}let U=typeof _.repo_id==="string"&&_.repo_id.length>0,k=typeof _.review_id==="string"&&_.review_id.length>0;if(!U&&!k)return G(new D(400,"missing_param","Missing required parameter: repo_id or review_id","local"));let l=_.format==="structured"?"structured":_.format==="prompt_fragment"?"prompt_fragment":"text",J=typeof _.file_path==="string"&&_.file_path.trim().length>0?_.file_path.trim():typeof _.path==="string"&&_.path.trim().length>0?_.path.trim():null,Q=(u)=>{let W=new URLSearchParams({format:u});if(J)W.set("file_path",J);if(_.policy_snapshot_id)W.set("policy_snapshot_id",_.policy_snapshot_id);if(_.token_budget!==void 0&&_.token_budget!==null)W.set("token_budget",String(_.token_budget));return W},j=_J({repo_id:U?_.repo_id:void 0,review_id:k?_.review_id:void 0,file_path:J});try{let u=k&&!U?await lJ({api:i,reviewId:_.review_id,filePath:J}):await kJ({api:i,scope:j,tokenBudget:_.token_budget,policySnapshotId:_.policy_snapshot_id});if(l==="text")return H({text:u.text,format:"text"},u.normalizedBody.request_id??"missing_request_id",{retry:Fn});let W={...u.normalizedBody};if(W.prompt_fragment&&l==="prompt_fragment")W.non_authoritative=!0,W.compatibility_only=!0;if(l==="structured")W.rules=u.structuredPayload.rules,W.compiled_hash=u.structuredPayload.compiled_hash,W.freshness=u.structuredPayload.freshness;return H(W,W.request_id??"missing_request_id",{retry:Fn})}catch(u){if(u instanceof D){if(wJ(u)){let W=DJ(j,l);if(W)return H(W,u.requestId,{retry:Fn})}return G(u,{operation:"read"})}throw u}}),n.register({name:"typescape_rules_pack",description:"Compatibility-only alias for typescape_get_rules. Prefer typescape_get_rules in new harnesses and workflows.",inputSchema:gY},async(w)=>{let _=w;try{if(!(await $.getCapabilities()).rules)return $.featureDisabledResult("rules")}catch(j){if(j instanceof D)return G(j);throw j}let U=typeof _.repo_id==="string"?_.repo_id.trim():"",k=typeof _.review_id==="string"?_.review_id.trim():"";if(!U&&!k)return G(new D(400,"missing_param","Missing required parameter: repo_id or review_id","local"));let l=_.format??"text",J=typeof _.file_path==="string"&&_.file_path.trim().length>0?_.file_path.trim():typeof _.path==="string"&&_.path.trim().length>0?_.path.trim():null,Q=_J({repo_id:U,review_id:k,file_path:J});try{let j=k&&!U?await lJ({api:i,reviewId:k,filePath:J}):await kJ({api:i,scope:Q,tokenBudget:_.token_budget});if(l==="text")return H({text:j.text,format:"text"},j.normalizedBody.request_id??"missing_request_id",{retry:Fn});let u=j.normalizedBody;if(l==="structured")return H(j.structuredPayload,u.request_id??"missing_request_id",{retry:Fn});if(l==="json")return H(u,u.request_id??"missing_request_id",{retry:Fn});let W=typeof u.prompt==="string"?u.prompt:typeof u.prompt_fragment==="string"?u.prompt_fragment:null;if(!W)throw new D(502,"invalid_upstream_response","Rules pack response is missing prompt content",u.request_id??"missing_request_id");return H({prompt:W,prompt_fragment:W,compatibility_only:!0},u.request_id??"missing_request_id",{retry:Fn})}catch(j){if(j instanceof D){let u=l==="prompt"?"prompt_fragment":l;if(wJ(j)){let W=DJ(Q,u);if(W)return H(W,j.requestId,{retry:Fn})}return G(j,{operation:"read"})}throw j}}),n.register({name:"typescape_check_content",description:"Check markdown content against applicable rules (pre-submission advisory). Returns advisory findings with severity and rule references. Requires rules to be enabled.",inputSchema:wY},async(w)=>{let _=w;try{if(!(await $.getCapabilities()).rules)return $.featureDisabledResult("rules")}catch(k){if(k instanceof D)return G(k);throw k}if(!_.content||_.content.length===0)return G(new D(400,"missing_param","Missing required parameter: content","local"));let U={content:_.content};if(_.properties!==void 0)U.properties=_.properties;if(_.collection_id!==void 0)U.collection_id=_.collection_id;if(_.idempotency_key!==void 0)U.idempotency_key=_.idempotency_key;try{let k=await i.post("/rules/check",{body:U});return H(k.body,k.requestId,{retry:Fn})}catch(k){if(k instanceof D)return G(k,{operation:"read"});throw k}}),n.register({name:"typescape_import_rules",description:"Import rules from markdown content, creating a draft rule review. Each list item in the markdown becomes a rule block. Set preview=true for a dry run. Returns the review ID and parsed rules. Requires rules to be enabled.",inputSchema:_Y},async(w)=>{let _=w;try{if(!(await $.getCapabilities()).rules)return $.featureDisabledResult("rules")}catch(l){if(l instanceof D)return G(l);throw l}if(!_.content||_.content.length===0)return G(new D(400,"missing_param","Missing required parameter: content","local"));let U={content:_.content};if(_.title!==void 0)U.title=_.title;if(_.applicability!==void 0)U.applicability=_.applicability;if(_.provenance!==void 0)U.provenance=_.provenance;if(_.preview!==void 0)U.preview=_.preview;if(_.idempotency_key!==void 0)U.idempotency_key=_.idempotency_key;let k={};if(_.idempotency_key)k["Idempotency-Key"]=_.idempotency_key;try{let l=await i.post("/rules/import",{body:U,headers:k});return H(l.body,l.requestId,{retry:D_(Boolean(_.idempotency_key))})}catch(l){if(l instanceof D)return G(l,{operation:"write",hasIdempotencyKey:Boolean(_.idempotency_key)});throw l}});let g=/^gci_[0-9A-HJKMNP-TV-Z]{26}$/;n.register({name:"typescape_propose_rule",description:"Create a rule proposal from observed patterns, thread feedback, or automated analysis. Rule proposals flow through the rules governance pipeline. Requires features.rules.",inputSchema:vY},async(w)=>{let _=w;try{if(!(await $.getCapabilities()).rules)return $.featureDisabledResult("rules")}catch(k){if(k instanceof D)return G(k);throw k}if(!_.source_type)return G(new D(400,"missing_param","Missing required parameter: source_type","local"));if(_.source_type==="thread"&&!_.finding_id)return G(new D(422,"invalid_argument","finding_id is required when source_type is 'thread'","local"));if(_.related_item_ids){let k=_.related_item_ids.findIndex((l)=>!g.test(l));if(k>=0)return G(new D(422,"invalid_argument",`related_item_ids[${k}] must be a valid rule proposal id (gci_<26-char ULID>)`,"local"))}let U={};if(_.proposed_content!==void 0){if(typeof _.proposed_content!=="object"||_.proposed_content===null||Array.isArray(_.proposed_content))return G(new D(422,"invalid_argument","proposed_content must be an object when provided","local"));Object.assign(U,_.proposed_content)}if(_.title!==void 0&&U.title===void 0)U.title=_.title;if(_.content!==void 0&&U.content===void 0)U.content=_.content;if(_.target_document!==void 0&&U.target_document===void 0)U.target_document=_.target_document;if(_.priority!==void 0&&U.priority===void 0)U.priority=_.priority;if(_.tags!==void 0&&U.tags===void 0)U.tags=_.tags;try{let k=_.source_type==="thread"?"/steering/gcis/from-thread":"/steering/gcis",l=_.source_type==="thread"?{finding_id:_.finding_id,..._.proposed_type?{proposed_type:_.proposed_type}:{},..._.rationale!==void 0?{rationale:_.rationale}:{},...Object.keys(U).length>0?{proposed_content:U}:{}}:{source_type:_.source_type,..._.source_ref?{source_ref:_.source_ref}:{},..._.proposed_type?{proposed_type:_.proposed_type}:{},...Object.keys(U).length>0?{proposed_content:U}:{},..._.tags!==void 0?{tags:_.tags}:{},..._.source_excerpt!==void 0?{source_excerpt:_.source_excerpt}:{},..._.rationale!==void 0?{rationale:_.rationale}:{},..._.related_item_ids!==void 0?{related_item_ids:_.related_item_ids}:{}},J=await i.post(k,{body:l});return H(_n(J.body),J.requestId,{retry:D_(!1)})}catch(k){if(k instanceof D)return G(k,{operation:"write"});throw k}}),n.register({name:"typescape_list_rule_proposals",description:"Canonical rule proposal listing surface. Use to monitor the rules governance pipeline. Requires features.rules.",inputSchema:iY},async(w)=>{let _=w;try{if(!(await $.getCapabilities()).rules)return $.featureDisabledResult("rules")}catch(U){if(U instanceof D)return G(U);throw U}try{let U={};if(_.status)U.status=_.status;if(_.limit!==void 0&&_.limit!==null)U.limit=String(_.limit);let k=new URLSearchParams(U).toString(),l=await i.get(`/steering/gcis${k?`?${k}`:""}`);return H(b_(l.body),l.requestId,{retry:Fn})}catch(U){if(U instanceof D)return G(U,{operation:"read"});throw U}}),n.register({name:"typescape_list_rule_proposals_legacy",description:"Compatibility-only legacy proposal listing surface. Use typescape_list_rule_proposals in new harnesses. Requires features.rules.",inputSchema:$Y},async(w)=>{let _=w;try{if(!(await $.getCapabilities()).rules)return $.featureDisabledResult("rules")}catch(U){if(U instanceof D)return G(U);throw U}try{let U={};if(_.status)U.status=_.status;if(_.kind)U.kind=_.kind;if(_.limit!==void 0&&_.limit!==null)U.limit=String(_.limit);let k=new URLSearchParams(U).toString(),l=await i.get(`/steering/proposals${k?`?${k}`:""}`);return H(l.body,l.requestId,{retry:Fn})}catch(U){if(U instanceof D)return G(U,{operation:"read"});throw U}}),n.register({name:"typescape_rules_dashboard",description:"Get aggregate rules health metrics: active rule count, average health, degraded rules. Requires features.rules.",inputSchema:bY},async(w)=>{let _=w;try{if(!(await $.getCapabilities()).rules)return $.featureDisabledResult("rules")}catch(U){if(U instanceof D)return G(U);throw U}try{let U=_.include_degraded!==!1,k,l;try{let J=await i.get("/steering/dashboard/summary");k=J.requestId,l={..._n(J.body)}}catch(J){if(!(J instanceof D))throw J;let Q=await i.get("/steering/dashboard/rules?limit=1&offset=0"),j=_n(Q.body),u=typeof j.total==="number"?j.total:typeof j.total_rules==="number"?j.total_rules:0;k=Q.requestId,l={summary_unavailable:{code:J.code,message:J.message,request_id:J.requestId},rule_health:{total_rules:u}}}if(U){let J=await i.get("/steering/dashboard/degradation"),Q=_n(J.body),j=Array.isArray(Q.degraded_rules)?Q.degraded_rules:Array.isArray(Q.data)?Q.data:null;if(!Array.isArray(j))throw new D(502,"invalid_upstream_response","degraded_rules must be an array",J.requestId);l.degraded_rules=j}return H(l,k,{retry:Fn})}catch(U){if(U instanceof D)return G(U,{operation:"read"});throw U}}),n.register({name:"typescape_promote_rule_proposal",description:"Convert an approved rule proposal into a rule for operator acceptance. Requires features.rules.",inputSchema:UY},async(w)=>{let _=w;try{if(!(await $.getCapabilities()).rules)return $.featureDisabledResult("rules")}catch(k){if(k instanceof D)return G(k);throw k}if(!_.gci_id)return G(new D(400,"missing_param","Missing required parameter: gci_id","local"));let U={};if(_.kind!==void 0)U.kind=_.kind;if(_.scope!==void 0)U.scope=_.scope;if(_.content_override!==void 0)U.content_override=_.content_override;try{let k=await i.post(`/steering/gcis/${encodeURIComponent(_.gci_id)}/publish`,{body:U});return H(k.body,k.requestId,{retry:D_(!1)})}catch(k){if(k instanceof D)return G(k,{operation:"write"});throw k}});let v=async(w)=>{let _=w;try{if(!(await $.getCapabilities()).rules)return $.featureDisabledResult("rules")}catch(J){if(J instanceof D)return G(J);throw J}if(!_.proposal_id)return G(new D(400,"missing_param","Missing required parameter: proposal_id","local"));if(!_.decision)return G(new D(400,"missing_param","Missing required parameter: decision","local"));if(_.decision==="reject"&&!_.notes)return G(new D(422,"invalid_argument","notes is required when decision is 'reject'","local"));let k={accept:"activate",reject:"reject",deprecate:"deprecate"}[_.decision],l={};if(_.notes!==void 0)l.notes=_.notes;try{let J=await i.post(`/steering/proposals/${encodeURIComponent(_.proposal_id)}/${k}`,{body:l});return H(J.body,J.requestId,{retry:D_(!1)})}catch(J){if(J instanceof D)return G(J,{operation:"write"});throw J}};n.register({name:"typescape_decide_rule_proposal",description:"Accept, reject, or deprecate a rule proposal. Accepting activates the rule immediately. Requires features.rules.",inputSchema:kY},async(w)=>{return v(w)})}var QJ=["typescape_list_repos","typescape_connect_repo","typescape_repo_branches","typescape_upload_reviewer_asset"];function lY(n){switch(n){case"image/png":return"png";case"image/jpeg":return"jpg";case"image/gif":return"gif";case"image/webp":return"webp";default:return"bin"}}var DY=5242880,JY=new Set(["image/png","image/jpeg","image/gif","image/webp"]);function WJ(n,i){let $={name:"typescape_list_repos",description:"List connected repositories in the workspace. Returns paginated list of repos with their origin URLs and metadata.",inputSchema:{type:"object",properties:{include_archived:{type:"boolean",description:"Include archived repositories (default: false)"},limit:{type:"number",description:"Maximum repos to return (1-100, default: 50)"},cursor:{type:"string",description:"Pagination cursor from previous response"}}}};n.register($,async(_)=>{let U=_,k={};if(U.include_archived)k.include_archived="true";if(U.limit!==void 0)k.limit=String(U.limit);if(U.cursor)k.cursor=U.cursor;try{let l=await i.get("/repos",{query:k});return H(l.body,l.requestId)}catch(l){if(l instanceof D)return G(l);throw l}});let g={name:"typescape_connect_repo",description:"Connect a Git repository by its origin URL. If the URL is a GitHub repo and a GitHub App installation exists, it will be automatically linked for branch/file browsing.",inputSchema:{type:"object",properties:{origin_url:{type:"string",description:"Git remote URL (HTTPS or SSH), e.g. https://github.com/acme/docs"},display_name:{type:"string",description:"Human-readable display name (optional, auto-derived from URL)"}},required:["origin_url"]}};n.register(g,async(_)=>{let U=_;if(!U.origin_url)return G(new D(400,"missing_param","Missing required parameter: origin_url","local"));let k={origin_url:U.origin_url};if(U.display_name)k.display_name=U.display_name;try{let l=await i.post("/repos",{body:k});return H(l.body,l.requestId)}catch(l){if(l instanceof D)return G(l);throw l}});let v={name:"typescape_repo_branches",description:"List branches for a connected repository. Requires a GitHub App installation to be linked to the repo. Returns branch names and their head SHAs.",inputSchema:{type:"object",properties:{repo_id:{type:"string",description:"Repository ID (e.g. repo_abc123)"}},required:["repo_id"]}};n.register(v,async(_)=>{let U=_;if(!U.repo_id)return G(new D(400,"missing_param","Missing required parameter: repo_id","local"));try{let k=await i.get(`/repos/${encodeURIComponent(U.repo_id)}/branches`);return H(k.body,k.requestId)}catch(k){if(k instanceof D)return G(k);throw k}});let w={name:"typescape_upload_reviewer_asset",description:"Upload a reviewer asset (image) to a review. Accepts base64-encoded image data (PNG, JPEG, GIF, WebP). Maximum size: 5MB. For larger files, use the CLI or web UI.",inputSchema:{type:"object",properties:{review_id:{type:"string",description:"Review ID to upload the asset to"},base64_content:{type:"string",description:"Base64-encoded image data"},mime_type:{type:"string",enum:["image/png","image/jpeg","image/gif","image/webp"],description:"MIME type of the image"},alt_text:{type:"string",description:"Alt text for the image (optional)"},filename:{type:"string",description:"Original filename (optional)"}},required:["review_id","base64_content","mime_type"]}};n.register(w,async(_)=>{let U=_;if(!U.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));if(!U.base64_content)return G(new D(400,"missing_param","Missing required parameter: base64_content","local"));if(!U.mime_type)return G(new D(400,"missing_param","Missing required parameter: mime_type","local"));if(!JY.has(U.mime_type))return G(new D(415,"unsupported_media_type",`Unsupported MIME type "${U.mime_type}". Allowed: PNG, JPEG, GIF, WebP.`,"local"));if(!S0.test(U.base64_content))return G(new D(400,"invalid_base64","base64_content is not valid base64-encoded data","local"));let k;try{let Q=Buffer.from(U.base64_content,"base64");k=new Uint8Array(Q)}catch{return G(new D(400,"invalid_base64","Failed to decode base64_content","local"))}if(k.byteLength>DY){let Q=(k.byteLength/1048576).toFixed(1);return G(new D(413,"asset_too_large",`Image is ${Q}MB, exceeding the 5MB MCP limit. Use the CLI ("typescape asset upload") or web UI for larger files.`,"local"))}let l=new Blob([k],{type:U.mime_type}),J=new FormData;if(J.append("file",l,U.filename||`upload.${lY(U.mime_type)}`),J.append("mime_type",U.mime_type),U.alt_text)J.append("alt_text",U.alt_text);try{let Q=await i.postFormData(`/sessions/${encodeURIComponent(U.review_id)}/reviewer-assets`,J);return H(Q.body,Q.requestId)}catch(Q){if(Q instanceof D)return G(Q);throw Q}})}var YJ=["typescape_create_collection","typescape_add_review_to_collection"],XY={type:"object",properties:{name:{type:"string",description:"Collection name (1-100 characters, unique per tenant among non-archived collections)"},description:{type:"string",description:"Optional Markdown description (max 2000 characters)"},color:{type:"string",description:"Optional hex color (e.g., #12A594)"}},required:["name"]},GY={type:"object",properties:{collection_id:{type:"string",description:"Collection ID (e.g., col_01HXYZ...)"},review_id:{type:"string",description:"Review ID to add (opaque identifier)"}},required:["collection_id","review_id"]};function IJ(n,i,$){n.register({name:"typescape_create_collection",description:"Create a new collection to group related reviews. Requires collections_enabled feature flag. Returns the created collection with its ID.",inputSchema:XY},async(g)=>{let v=g;if(!v.name)return G(new D(400,"missing_param","Missing required parameter: name","local"));try{if(!(await $.getCapabilities()).collections_enabled)return $.featureDisabledResult("collections_enabled")}catch(_){if(_ instanceof D)return G(_);throw _}let w={name:v.name};if(v.description!==void 0)w.description=v.description;if(v.color!==void 0)w.color=v.color;try{let _=await i.post("/collections",{body:w});return H(_n(_.body),_.requestId)}catch(_){if(_ instanceof D)return G(_);throw _}}),n.register({name:"typescape_add_review_to_collection",description:"Add a review to an existing collection. Idempotent: re-adding an already-present review is a no-op. Requires collections_enabled feature flag.",inputSchema:GY},async(g)=>{let v=g;if(!v.collection_id)return G(new D(400,"missing_param","Missing required parameter: collection_id","local"));if(!v.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));try{if(!(await $.getCapabilities()).collections_enabled)return $.featureDisabledResult("collections_enabled")}catch(w){if(w instanceof D)return G(w);throw w}try{let w=await i.post(`/collections/${encodeURIComponent(v.collection_id)}/sessions`,{body:{session_id:v.review_id}});return H(_n(w.body),w.requestId)}catch(w){if(w instanceof D)return G(w);throw w}})}var jJ={type:"object",properties:{artifact_kind:{type:"string",description:"Advisory artifact kind: recommendation, classification, contradiction, synthesis, proposal, or challenge"},kind:{type:"string",description:"Compatibility alias for artifact_kind"},target_type:{type:"string",enum:["review","finding","rule_review","rule_block","review_set"],description:"Type of entity this advisory targets"},target_id:{type:"string",description:"ID of the target entity (e.g., sess_01HXYZ... or finding ID)"},review_id:{type:"string",description:"Review scope for this advisory (optional; enables review-scoped queries)"},body_md:{type:"string",description:"Advisory body in Markdown (required, max 64KB)"},body:{type:"string",description:"Compatibility alias for body_md"},source_type:{type:"string",enum:["human","agent"],description:"Provenance source type (default: agent)"},source_label:{type:"string",description:"Label identifying the source (e.g., agent name or tool)"},submitted_by:{type:"string",description:"Identity of the submitter (agent ID or user ID)"},confidence:{type:"number",description:"Confidence score between 0 and 1 (optional)"},severity_hint:{type:"string",description:"Severity hint: suggestion, needs_changes, blocking (optional)"},structured_data:{type:"object",description:"Machine-readable structured data payload (optional)"},evidence_refs:{type:"array",items:{type:"string"},description:"References to supporting evidence (optional)"},basis:{type:"object",properties:{export_sha256:{type:"string",description:"SHA256 of export used as basis"},rulepack_sha256:{type:"string",description:"SHA256 of rulepack used"},source_content_sha256:{type:"string",description:"SHA256 of source content"},basis_review_ids:{type:"array",items:{type:"string"},description:"Review IDs used as basis"},basis_finding_ids:{type:"array",items:{type:"string"},description:"Finding IDs used as basis"}},description:"Deterministic inputs the advisory was derived from (optional)"},idempotency_key:{type:"string",description:"Idempotency key for safe retries (optional)"}},required:["artifact_kind","target_type","target_id","body_md","source_label","submitted_by"]},uJ={type:"object",properties:{review_id:{type:"string",description:"Filter by review ID (optional)"},target_type:{type:"string",enum:["review","finding","rule_review","rule_block","review_set"],description:"Filter by target type (optional)"},target_id:{type:"string",description:"Filter by target ID (optional)"},artifact_kind:{type:"string",description:"Filter by artifact kind (optional)"},status:{type:"string",enum:["submitted","adopted","rejected","superseded"],description:"Filter by status (optional)"},submitted_by:{type:"string",description:"Filter by submitter identity (optional)"},limit:{type:"number",description:"Maximum items to return (1-200, default 50)"},offset:{type:"number",description:"Pagination offset (default 0)"}},required:[]},HJ={type:"object",properties:{artifact_id:{type:"string",description:"Advisory artifact ID to retrieve"}},required:["artifact_id"]},VJ={type:"object",properties:{artifact_id:{type:"string",description:"Advisory artifact ID to adopt"},rationale:{type:"string",description:"Rationale for adoption (optional)"},adoption_review_id:{type:"string",description:"Review ID associated with adoption (optional)"},adoption_proposed_change_id:{type:"string",description:"Proposed change ID associated with adoption (optional)"}},required:["artifact_id"]},fJ={type:"object",properties:{artifact_id:{type:"string",description:"Advisory artifact ID to reject"},rejection_reason:{type:"string",description:"Reason for rejection (required)"}},required:["artifact_id","rejection_reason"]};var LJ=["typescape_submit_advisory","typescape_list_advisories","typescape_get_advisory","typescape_adopt_advisory","typescape_reject_advisory"],qJ=on({operation:"read"});function E0(n){return on({operation:"write",hasIdempotencyKey:n})}function tY(n){if(!n)return;return{...n,export_sha256:n.export_sha256??n.export_hash,rulepack_sha256:n.rulepack_sha256??n.rulepack_hash,source_content_sha256:n.source_content_sha256??n.source_hash}}function KJ(n,i){n.register({name:"typescape_submit_advisory",description:"Submit an advisory artifact (recommendation, classification, challenge, etc.) targeting a review, finding, or rule entity. Advisory artifacts are non-authoritative and require explicit adoption. Supports idempotency keys for safe retries.",inputSchema:jJ},async($)=>{let g=$,v=g.artifact_kind??g.kind,w=g.body_md??g.body,_=tY(g.basis);if(!v)return G(new D(400,"missing_param","Missing required parameter: artifact_kind","local"));if(!g.target_type)return G(new D(400,"missing_param","Missing required parameter: target_type","local"));if(!g.target_id)return G(new D(400,"missing_param","Missing required parameter: target_id","local"));if(!w)return G(new D(400,"missing_param","Missing required parameter: body_md","local"));if(!g.source_label)return G(new D(400,"missing_param","Missing required parameter: source_label","local"));if(!g.submitted_by)return G(new D(400,"missing_param","Missing required parameter: submitted_by","local"));let U={artifact_kind:v,target:{target_type:g.target_type,target_id:g.target_id},provenance:{source_type:g.source_type??"agent",source_label:g.source_label,submitted_by:g.submitted_by,submitted_at:new Date().toISOString()},payload:{body_md:w,...g.confidence!==void 0&&{confidence:g.confidence},...g.severity_hint!==void 0&&{severity_hint:g.severity_hint},...g.structured_data!==void 0&&{structured_data:g.structured_data},...g.evidence_refs!==void 0&&{evidence_refs:g.evidence_refs}}};if(g.review_id)U.review_id=g.review_id;if(_)U.basis=_;if(g.idempotency_key)U.idempotency_key=g.idempotency_key;let k={};if(g.idempotency_key)k["Idempotency-Key"]=g.idempotency_key;try{let l=await i.post("/advisory-artifacts",{body:U,headers:k});return H(l.body,l.requestId,{retry:E0(Boolean(g.idempotency_key))})}catch(l){if(l instanceof D)return G(l,{operation:"write",hasIdempotencyKey:Boolean(g.idempotency_key)});throw l}}),n.register({name:"typescape_list_advisories",description:"List advisory artifacts with optional filters. Filter by review, target, kind, status, or submitter.",inputSchema:uJ},async($)=>{let g=$,v={};if(g.review_id)v.review_id=g.review_id;if(g.target_type)v.target_type=g.target_type;if(g.target_id)v.target_id=g.target_id;if(g.artifact_kind)v.artifact_kind=g.artifact_kind;if(g.status)v.status=g.status;if(g.submitted_by)v.submitted_by=g.submitted_by;if(g.limit!==void 0)v.limit=String(g.limit);if(g.offset!==void 0)v.offset=String(g.offset);try{let w=await i.get("/advisory-artifacts",{query:v});return H(w.body,w.requestId,{retry:qJ})}catch(w){if(w instanceof D)return G(w,{operation:"read"});throw w}}),n.register({name:"typescape_get_advisory",description:"Get a single advisory artifact by ID. Returns full artifact with provenance, payload, and adoption state.",inputSchema:HJ},async($)=>{let g=$;if(!g.artifact_id)return G(new D(400,"missing_param","Missing required parameter: artifact_id","local"));try{let v=await i.get(`/advisory-artifacts/${encodeURIComponent(g.artifact_id)}`);return H(v.body,v.requestId,{retry:qJ})}catch(v){if(v instanceof D)return G(v,{operation:"read"});throw v}}),n.register({name:"typescape_adopt_advisory",description:"Adopt an advisory artifact, transitioning it from 'submitted' to 'adopted'. "+"Adoption is an explicit act — advisory artifacts never silently become authoritative.",inputSchema:VJ},async($)=>{let g=$;if(!g.artifact_id)return G(new D(400,"missing_param","Missing required parameter: artifact_id","local"));let v={};if(g.rationale)v.rationale=g.rationale;if(g.adoption_review_id)v.adoption_review_id=g.adoption_review_id;if(g.adoption_proposed_change_id)v.adoption_proposed_change_id=g.adoption_proposed_change_id;try{let w=await i.post(`/advisory-artifacts/${encodeURIComponent(g.artifact_id)}/adopt`,{body:v});return H(w.body,w.requestId,{retry:E0(!1)})}catch(w){if(w instanceof D)return G(w,{operation:"write"});throw w}}),n.register({name:"typescape_reject_advisory",description:"Reject an advisory artifact with a reason. Transitions from 'submitted' to 'rejected'. Terminal state.",inputSchema:fJ},async($)=>{let g=$;if(!g.artifact_id)return G(new D(400,"missing_param","Missing required parameter: artifact_id","local"));if(!g.rejection_reason)return G(new D(400,"missing_param","Missing required parameter: rejection_reason","local"));let v={rejection_reason:g.rejection_reason};try{let w=await i.post(`/advisory-artifacts/${encodeURIComponent(g.artifact_id)}/reject`,{body:v});return H(w.body,w.requestId,{retry:E0(!1)})}catch(w){if(w instanceof D)return G(w,{operation:"write"});throw w}})}var OJ={type:"object",properties:{artifact_id:{type:"string",description:"Filter by advisory artifact ID (optional)"},action_type:{type:"string",enum:["advisory_submit","advisory_adopt","advisory_reject","advisory_supersede","revision_recommend"],description:"Filter by action type (optional)"},actor_id:{type:"string",description:"Filter by actor ID (optional)"},actor_type:{type:"string",enum:["agent","human","system"],description:"Filter by actor type (optional)"},review_id:{type:"string",description:"Filter by review scope (optional)"},limit:{type:"number",description:"Maximum items to return (1-200, default 50)"},offset:{type:"number",description:"Pagination offset (default 0)"}},required:[]},BJ={type:"object",properties:{receipt_id:{type:"string",description:"Action receipt ID to retrieve"}},required:["receipt_id"]},FJ={type:"object",properties:{artifact_id:{type:"string",description:"Advisory artifact ID to list receipts for"}},required:["artifact_id"]};var NJ=["typescape_list_action_receipts","typescape_get_action_receipt","typescape_list_artifact_receipts"],o0=on({operation:"read"});function cJ(n,i){n.register({name:"typescape_list_action_receipts",description:"List action receipts with optional filters. Filter by artifact, action type, actor, or review scope. Receipts capture basis attestation and tool metadata for advisory operations.",inputSchema:OJ},async($)=>{let g=$,v={};if(g.artifact_id)v.artifact_id=g.artifact_id;if(g.action_type)v.action_type=g.action_type;if(g.actor_id)v.actor_id=g.actor_id;if(g.actor_type)v.actor_type=g.actor_type;if(g.review_id)v.review_id=g.review_id;if(g.limit!==void 0)v.limit=String(g.limit);if(g.offset!==void 0)v.offset=String(g.offset);try{let w=await i.get("/action-receipts",{query:v});return H(w.body,w.requestId,{retry:o0})}catch(w){if(w instanceof D)return G(w,{operation:"read"});throw w}}),n.register({name:"typescape_get_action_receipt",description:"Get a single action receipt by ID. Returns full receipt with basis snapshot, tool metadata, and result summary.",inputSchema:BJ},async($)=>{let g=$;if(!g.receipt_id)return G(new D(400,"missing_param","Missing required parameter: receipt_id","local"));try{let v=await i.get(`/action-receipts/${encodeURIComponent(g.receipt_id)}`);return H(v.body,v.requestId,{retry:o0})}catch(v){if(v instanceof D)return G(v,{operation:"read"});throw v}}),n.register({name:"typescape_list_artifact_receipts",description:"List all action receipts for a specific advisory artifact. Shows the full execution journal for an artifact's lifecycle.",inputSchema:FJ},async($)=>{let g=$;if(!g.artifact_id)return G(new D(400,"missing_param","Missing required parameter: artifact_id","local"));try{let v=await i.get(`/advisory-artifacts/${encodeURIComponent(g.artifact_id)}/receipts`);return H(v.body,v.requestId,{retry:o0})}catch(v){if(v instanceof D)return G(v,{operation:"read"});throw v}})}var PJ=["typescape_create_project","typescape_list_projects","typescape_get_project","typescape_update_project"],QY={type:"object",properties:{name:{type:"string",description:"Project name (required, 1-200 characters)"},description:{type:"string",description:"Optional project description (Markdown, max 2000 characters)"}},required:["name"]},WY={type:"object",properties:{limit:{type:"number",description:"Maximum number of projects to return (default: 20, max: 100)"},cursor:{type:"string",description:"Pagination cursor from a previous response"}}},YY={type:"object",properties:{project_id:{type:"string",description:"Project ID (e.g., prj_01HXYZ...)"}},required:["project_id"]},IY={type:"object",properties:{project_id:{type:"string",description:"Project ID to update"},name:{type:"string",description:"New project name (1-200 characters)"},description:{type:"string",description:"New project description (Markdown, max 2000 characters)"}},required:["project_id"]};function SJ(n,i){n.register({name:"typescape_create_project",description:"Create a new project for organizing document-upload-based reviews. Returns the created project with its ID.",inputSchema:QY},async($)=>{let g=$;if(!g.name)return G(new D(400,"missing_param","Missing required parameter: name","local"));let v={name:g.name};if(g.description!==void 0)v.description=g.description;try{let w=await i.post("/projects",{body:v});return H(_n(w.body),w.requestId)}catch(w){if(w instanceof D)return G(w);throw w}}),n.register({name:"typescape_list_projects",description:"List projects with optional cursor pagination. Returns an array of projects with pagination metadata.",inputSchema:WY},async($)=>{let g=$,v={};if(g.limit!==void 0)v.limit=String(g.limit);if(g.cursor!==void 0)v.cursor=g.cursor;try{let w=await i.get("/projects",{query:v});return H(w.body,w.requestId)}catch(w){if(w instanceof D)return G(w);throw w}}),n.register({name:"typescape_get_project",description:"Get a project by ID. Returns the project details including configuration.",inputSchema:YY},async($)=>{let g=$;if(!g.project_id)return G(new D(400,"missing_param","Missing required parameter: project_id","local"));try{let v=await i.get(`/projects/${encodeURIComponent(g.project_id)}`);return H(_n(v.body),v.requestId)}catch(v){if(v instanceof D)return G(v);throw v}}),n.register({name:"typescape_update_project",description:"Update a project's name or description. Only provided fields are changed; omitted fields are left unchanged.",inputSchema:IY},async($)=>{let g=$;if(!g.project_id)return G(new D(400,"missing_param","Missing required parameter: project_id","local"));let v={};if(g.name!==void 0)v.name=g.name;if(g.description!==void 0)v.description=g.description;try{let w=await i.request("PATCH",`/projects/${encodeURIComponent(g.project_id)}`,{body:v});return H(_n(w.body),w.requestId)}catch(w){if(w instanceof D)return G(w);throw w}})}var zJ=["typescape_create_template","typescape_list_templates","typescape_get_template"],jY={type:"object",properties:{name:{type:"string",description:"Template name (required, 1-200 characters)"},description:{type:"string",description:"Optional template description"},source_type:{type:"string",enum:["git","upload"],description:"Source type for reviews created from this template (default: git)"},repo_id:{type:"string",description:"Repository ID (required when source_type is git)"},project_id:{type:"string",description:"Project ID (required when source_type is upload)"},config:{type:"object",description:"Optional configuration object for the template (e.g., default participants, rules, settings)"}},required:["name"]},uY={type:"object",properties:{limit:{type:"number",description:"Maximum number of templates to return (default: 20, max: 100)"},cursor:{type:"string",description:"Pagination cursor from a previous response"}}},HY={type:"object",properties:{template_id:{type:"string",description:"Template ID (e.g., tpl_01HXYZ...)"}},required:["template_id"]};function MJ(n,i){n.register({name:"typescape_create_template",description:"Create a review template for repeatable review creation. Templates capture default settings so operators don't re-specify parameters each time. Returns the created template with its ID.",inputSchema:jY},async($)=>{let g=$;if(!g.name)return G(new D(400,"missing_param","Missing required parameter: name","local"));let v={name:g.name};if(g.description!==void 0)v.description=g.description;if(g.source_type!==void 0)v.source_type=g.source_type;if(g.repo_id!==void 0)v.repo_id=g.repo_id;if(g.project_id!==void 0)v.project_id=g.project_id;if(g.config!==void 0)v.config=g.config;try{let w=await i.post("/session-templates",{body:v});return H(_n(w.body),w.requestId)}catch(w){if(w instanceof D)return G(w);throw w}}),n.register({name:"typescape_list_templates",description:"List review templates with optional cursor pagination. Returns an array of templates with pagination metadata.",inputSchema:uY},async($)=>{let g=$,v={};if(g.limit!==void 0)v.limit=String(g.limit);if(g.cursor!==void 0)v.cursor=g.cursor;try{let w=await i.get("/session-templates",{query:v});return H(w.body,w.requestId)}catch(w){if(w instanceof D)return G(w);throw w}}),n.register({name:"typescape_get_template",description:"Get a review template by ID. Returns the template details including configuration.",inputSchema:HY},async($)=>{let g=$;if(!g.template_id)return G(new D(400,"missing_param","Missing required parameter: template_id","local"));try{let v=await i.get(`/session-templates/${encodeURIComponent(g.template_id)}`);return H(_n(v.body),v.requestId)}catch(v){if(v instanceof D)return G(v);throw v}})}var RJ=["typescape_list_issues","typescape_get_issue","typescape_update_issue"],VY={type:"object",properties:{session_id:{type:"string",description:"Review/session ID to list issues for (required)"},status:{type:"string",enum:["open","closed","all"],description:"Filter by issue status (default: all)"},severity:{type:"string",enum:["critical","high","medium","low","info"],description:"Filter by severity level"},limit:{type:"number",description:"Maximum number of issues to return (default: 20, max: 100)"},offset:{type:"number",description:"Offset for pagination (default: 0)"}},required:["session_id"]},fY={type:"object",properties:{issue_id:{type:"string",description:"Issue ID (e.g., iss_01HXYZ...)"}},required:["issue_id"]},qY={type:"object",properties:{issue_id:{type:"string",description:"Issue ID to update"},status:{type:"string",enum:["open","closed"],description:"New status for the issue"},assignee:{type:"string",description:"User ID or email to assign the issue to (null to unassign)"},priority:{type:"string",enum:["critical","high","medium","low"],description:"New priority level"}},required:["issue_id"]};function AJ(n,i){n.register({name:"typescape_list_issues",description:"List issues for a review. Supports filtering by status and severity, with offset-based pagination. Returns issues ordered by creation time descending.",inputSchema:VY},async($)=>{let g=$;if(!g.session_id)return G(new D(400,"missing_param","Missing required parameter: session_id","local"));let v={};if(g.status!==void 0)v.status=g.status;if(g.severity!==void 0)v.severity=g.severity;if(g.limit!==void 0)v.limit=String(g.limit);if(g.offset!==void 0)v.offset=String(g.offset);try{let w=await i.get("/issues",{query:{...v,session_id:g.session_id}});return H(w.body,w.requestId)}catch(w){if(w instanceof D)return G(w);throw w}}),n.register({name:"typescape_get_issue",description:"Get an issue by ID. Returns the full issue details including anchors, associated threads, and current status.",inputSchema:fY},async($)=>{let g=$;if(!g.issue_id)return G(new D(400,"missing_param","Missing required parameter: issue_id","local"));try{let v=await i.get(`/issues/${encodeURIComponent(g.issue_id)}`);return H(_n(v.body),v.requestId)}catch(v){if(v instanceof D)return G(v);throw v}}),n.register({name:"typescape_update_issue",description:"Update an issue's status, assignee, or priority. Only provided fields are changed; omitted fields are left unchanged.",inputSchema:qY},async($)=>{let g=$;if(!g.issue_id)return G(new D(400,"missing_param","Missing required parameter: issue_id","local"));let v={};if(g.status!==void 0)v.status=g.status;if(g.assignee!==void 0)v.assignee=g.assignee;if(g.priority!==void 0)v.priority=g.priority;try{let w=await i.request("PATCH",`/issues/${encodeURIComponent(g.issue_id)}`,{body:v});return H(_n(w.body),w.requestId)}catch(w){if(w instanceof D)return G(w);throw w}})}var xJ=["typescape_list_webhooks","typescape_create_webhook","typescape_delete_webhook"],LY={type:"object",properties:{status:{type:"string",description:"Filter by webhook status. One of: active, paused, disabled."},limit:{type:"integer",description:"Maximum number of results to return (default 25)."}},required:[]},KY={type:"object",properties:{url:{type:"string",description:"The HTTPS URL to deliver webhook events to."},events:{type:"array",items:{type:"string"},description:'Array of event types to subscribe to (e.g., ["review.created", "thread.resolved"]).'},description:{type:"string",description:"Optional human-readable description of the webhook."}},required:["url","events"]},OY={type:"object",properties:{webhook_id:{type:"string",description:"The webhook subscription ID to delete."}},required:["webhook_id"]};function hJ(n,i){n.register({name:"typescape_list_webhooks",description:"List webhook subscriptions for the current tenant. Use this to audit which external systems receive event notifications and verify delivery targets before creating new subscriptions. Returns subscription details including URL, events, and status.",inputSchema:LY},async($)=>{let g=$;try{let v=new URLSearchParams;if(g.status)v.set("status",g.status);if(g.limit)v.set("limit",String(g.limit));let w=v.toString(),_=w?`/webhooks?${w}`:"/webhooks",U=await i.get(_);return H(U.body,U.requestId)}catch(v){if(v instanceof D)return G(v);throw v}}),n.register({name:"typescape_create_webhook",description:"Create a new webhook subscription to receive event notifications at an HTTPS endpoint. Common events include review.created, thread.resolved, and check_run.completed. Use this to integrate Typescape with external CI/CD pipelines or notification systems.",inputSchema:KY},async($)=>{let g=$;if(!g.url)return G(new D(400,"missing_param","Missing required parameter: url","local"));if(!g.events||g.events.length===0)return G(new D(400,"missing_param","Missing required parameter: events (must be a non-empty array)","local"));try{let v=await i.post("/webhooks",{body:{url:g.url,events:g.events,description:g.description}});return H(v.body,v.requestId)}catch(v){if(v instanceof D)return G(v);throw v}}),n.register({name:"typescape_delete_webhook",description:"Delete a webhook subscription by ID, permanently stopping all deliveries to the target URL. Use typescape_list_webhooks first to find the subscription ID. This action cannot be undone.",inputSchema:OY},async($)=>{let g=$;if(!g.webhook_id)return G(new D(400,"missing_param","Missing required parameter: webhook_id","local"));try{let v=await i.request("DELETE",`/webhooks/${encodeURIComponent(g.webhook_id)}`,{});return H({deleted:!0,webhook_id:g.webhook_id},v.requestId)}catch(v){if(v instanceof D)return G(v);throw v}})}var CJ=["typescape_list_events"],BY={type:"object",properties:{review_id:{type:"string",description:"Review (session) ID to list events for."},cursor:{type:"string",description:"Pagination cursor from a previous response. Events after this cursor are returned."},limit:{type:"integer",description:"Maximum number of events to return (default 50)."}},required:["review_id"]};function EJ(n,i){n.register({name:"typescape_list_events",description:"List timeline events for a review. Use this to monitor review activity without re-fetching full review data. Returns an ordered list of events (comments, thread changes, status changes, check completions) with cursor-based pagination. Pass the cursor from the previous response for efficient incremental polling.",inputSchema:BY},async($)=>{let g=$;if(!g.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));try{let v=new URLSearchParams;if(g.cursor)v.set("cursor",g.cursor);if(g.limit)v.set("limit",String(g.limit));let w=v.toString(),_=`/sessions/${encodeURIComponent(g.review_id)}/events${w?`?${w}`:""}`,U=await i.get(_);return H(U.body,U.requestId)}catch(v){if(v instanceof D)return G(v);throw v}})}var oJ=`---
43
+ `)}var K8=300000;function tD(n){let i=null;return{async getCapabilities(){let $=Date.now();if(i&&$-i.fetchedAt<K8)return i.features;try{let g=await n.get("/me/capabilities");if(!g.body.features||typeof g.body.features!=="object")throw Error("Capabilities response missing features object");return i={features:g.body.features,fetchedAt:$},i.features}catch(g){if(g instanceof D)throw g;throw g}},featureDisabledResult($){return G(mv(403,"feature_disabled",`Feature '${$}' is not enabled on this server`,{details:{feature:$}}))}}}var O8=__.options.filter((n)=>n!=="draft"),QD={type:"object",properties:{repo_id:{type:"string",description:"Repository identifier (short slug, e.g. 'typescape'; not a GitHub path like 'org/repo')"},git_sha:{type:"string",description:"Concrete 40-hex Git commit SHA (agent must resolve; no symbolic refs)"},file_path:{type:"string",description:"Path to the source document (required)"},filename:{type:"string",description:'PDF filename when document_type is "pdf" (optional; defaults to the file_path basename)'},project_id:{type:"string",description:"Upload project ID for upload-backed reviews (requires upload_batch_id)"},upload_batch_id:{type:"string",description:"Upload batch ID for upload-backed reviews (requires project_id)"},title:{type:"string",description:"Review title (optional)"},participants:{type:"array",items:{type:"object",properties:{email:{type:"string"},name:{type:"string"},role:{type:"string",enum:["reviewer","approver","observer","owner"]},scopes:{type:"array",minItems:1,items:{type:"string",enum:["read","comment","approve","admin"]}}},required:["email","role"]},description:"Participants to invite (optional). Scopes are optional and default by role."},reviewer_emails:{type:"array",items:{type:"string"},description:"Legacy alias for participants. Each email is invited as a reviewer."},idempotency_key:{type:"string",description:"Idempotency key for safe retries (optional)"},expected_version:{type:"string",description:"Expected version for optimistic concurrency (If-Match header, optional)"},identity_restriction:{type:"string",enum:["open","participants_only","domain"],description:'Identity verification mode for OTP step-up. "open" (default) accepts any email. "participants_only": only invited participant emails. "domain": only emails from allowed_email_domains.'},allowed_email_domains:{type:"array",items:{type:"string"},description:'Allowed email domains when identity_restriction is "domain" (e.g., ["acme.com", "example.org"])'},operator_name:{type:"string",maxLength:200,description:"Name of the operator initiating the review (optional)"},focus_areas:{type:"array",items:{type:"string",maxLength:100},maxItems:10,description:"Areas the reviewer should focus on (optional)"},framing:{type:"string",maxLength:1000,description:"Context framing text shown to reviewers (optional)"},carry_forward_findings:{type:"boolean",description:"Whether to carry forward findings from the superseded review (optional)"},carry_forward_filter:{type:"string",enum:["all","blocking","needs_changes"],description:"Filter for which findings to carry forward (optional)"},content_body:{type:"string",maxLength:1048576,description:"Inline Markdown content (alternative to repo_id+git_sha). Creates an upload-backed review automatically."},inline_assets:{oneOf:[{type:"object",additionalProperties:{oneOf:[{type:"string"},{type:"object",properties:{base64:{type:"string"},content_base64:{type:"string"},content:{type:"string"},data:{type:"string"}},additionalProperties:!0}]}},{type:"array",items:{type:"object",properties:{path:{type:"string"},file_path:{type:"string"},filename:{type:"string"},file_name:{type:"string"},name:{type:"string"},base64:{type:"string"},content_base64:{type:"string"},content:{type:"string"},data:{type:"string"}},additionalProperties:!0}}],description:'Companion assets as either a map of relative path => base64 content, or a list of asset objects. Map example: { "images/fig.png": "iVBORw0KGgo..." }. Array example: [{ "path": "images/fig.png", "base64": "iVBORw0KGgo..." }]. Total decoded size must be <= 10MB.'},document_type:{type:"string",enum:["markdown","image_set","pdf"],description:'Document type (default: "markdown"). Use "image_set" for image-only reviews or "pdf" for PDF reviews.'},asset_resolution_mode:{type:"string",enum:["strict","warn"],description:'Asset resolution mode (default: "strict"). Use "warn" to create upload-backed reviews even if some referenced assets are missing.'},filenames:{type:"array",items:{type:"string"},minItems:1,maxItems:100,description:'Ordered list of image filenames (required when document_type is "image_set"). Each filename must be a relative path. Supported formats: PNG, JPEG, WebP, GIF, SVG.'},purpose:{type:"string",enum:["review","rules"],description:'Review purpose (default: "review"). Use "rules" to create a rule review that feeds the rules governance pipeline.'},properties:{type:"object",additionalProperties:{type:"string"},description:"Content properties for rule matching (flat key-value map). Used when purpose=rules or for rule-aware content reviews."}},required:["file_path"]},WD={type:"object",properties:{review_id:{type:"string",description:"ID of the review to revise (the predecessor, e.g., rev_01HXYZ...)"},git_sha:{type:"string",description:"Concrete 40-hex Git commit SHA for the new revision (agent must resolve; no symbolic refs)"},content_body:{type:"string",description:"Inline Markdown content for upload-backed revised reviews (alternative to git_sha/upload_batch_id)"},project_id:{type:"string",description:"Upload project ID for upload-backed revised reviews (required with upload_batch_id)"},upload_batch_id:{type:"string",description:"Upload batch ID for upload-backed revised reviews (alternative to git_sha/content_body)"},file_path:{type:"string",description:"Path to the source document (optional; defaults to predecessor's file_path)"},document_type:{type:"string",enum:["markdown","image_set","pdf"],description:"Document type for revision (optional; defaults to predecessor document_type)"},filename:{type:"string",description:"PDF filename for document_type=pdf revisions (optional; defaults to file_path)"},filenames:{type:"array",items:{type:"string"},minItems:1,description:"Ordered image filenames for document_type=image_set revisions"},title:{type:"string",description:"Title for the new review (optional; defaults to predecessor's title)"},changes_summary:{type:"string",maxLength:5000,description:"Summary of changes for round-transition emails and the superseded banner (optional)"},resolutions:{type:"array",items:{type:"object",properties:{finding_id:{type:"string",description:"Finding ID from the predecessor review"},disposition:{type:"string",enum:["fixed","wont_fix","duplicate","by_design"],description:"How the finding was resolved"},evidence:{type:"string",maxLength:2000,description:"Optional evidence or explanation for the resolution"}},required:["finding_id","disposition"]},description:"Resolution manifest for findings from the predecessor review (optional)"},idempotency_key:{type:"string",description:"Idempotency key for safe retries (optional)"}},required:["review_id"]},YD={type:"object",properties:{review_id:{type:"string",description:"Review ID to export (e.g., rev_01HXYZ...)"},schema:{type:"string",default:"v2",description:"Export schema version (default: v2). Explicit retired or unknown schema values fail with machine-readable API errors."},view:{type:"string",description:"Export view variant (optional). Values: redacted, response_matrix.v1, delta_review.v1"},expected_version:{type:"string",description:"Expected version for optimistic concurrency (If-Match header, optional)"},include_rule_context:{type:"boolean",description:"Include rule context metadata in the export (rule_context block with compiled_hash, policy_snapshot_id, and source rule refs). Default: false."}},required:["review_id"]},ID={type:"object",properties:{review_id:{type:"string",description:"Review ID to fetch the handoff bundle for"},include_rules:{type:"boolean",description:"Whether to include rule context (default: true)"},include_lineage:{type:"boolean",description:"Whether to include lineage summaries (default: true)"},include_advisory:{type:"boolean",description:"Whether to include advisory artifacts (default: true)"},include_blocks:{type:"boolean",description:"Whether to include block slices (default: true)"},max_rules:{type:"number",description:"Maximum number of structured rules to inline"}},required:["review_id"]},jD={type:"object",properties:{repo_id:{type:"string",description:"Filter reviews by repository identifier (short slug, e.g. 'typescape'; optional)"},state:{type:"string",description:"Filter by review state: active, closed, archived (optional)"},file_paths:{type:"string",description:"Comma-separated list of file paths to filter by (optional)"},cursor:{type:"string",description:"Pagination cursor from previous response (optional)"},limit:{type:"number",description:"Maximum number of reviews to return (optional, default: 20)"},root_review_id:{type:"string",description:"Filter by supersede chain root review ID (optional, e.g., rev_...)"},supersedes_review_id:{type:"string",description:"Filter by immediate predecessor review ID (optional, e.g., rev_...)"},has_successor:{type:"boolean",description:"If true, return only reviews that have been superseded; if false, only chain heads (optional)"},q:{type:"string",description:"Search query for title/file path (alias: search, optional)."},search:{type:"string",description:"Alias for q. Search query text (optional)."}},required:[]},uD={type:"object",properties:{review_id:{type:"string",description:"Review ID to retrieve (e.g., rev_01HXYZ...)"}},required:["review_id"]},HD={type:"object",properties:{review_id:{type:"string",description:"Review ID to render (e.g., rev_01HXYZ...)"},include_plaintext:{type:"boolean",description:"Include plaintext representation alongside HTML (optional, default: false)"}},required:["review_id"]},VD={type:"object",properties:{review_id:{type:"string",description:"Review ID to list findings for (e.g., rev_01HXYZ...)"},block_id:{type:"string",description:"Filter findings by block_id anchor (optional)"},status:{type:"string",description:"Filter findings by status: open, resolved, all (optional, default: all)"},cursor:{type:"string",description:"Pagination cursor from previous response (optional)"},limit:{type:"number",description:"Maximum number of findings to return (optional, default: 50)"},q:{type:"string",description:"Search query across finding id, block id, and comment text (optional; alias: search)."},search:{type:"string",description:"Alias for q. Search query text (optional)."}},required:["review_id"]},M0={type:"object",properties:{review_id:{type:"string",description:"Review ID (e.g., rev_01HXYZ...)"}},required:["review_id"]},fD={type:"object",properties:{query:{type:"string",description:"Search query text for reviews (title/file path)."},limit:{type:"number",description:"Maximum reviews to return (optional, default: 20)."},cursor:{type:"string",description:"Pagination cursor from previous response (optional)."}},required:["query"]},qD={type:"object",properties:{review_id:{type:"string",description:"Review ID to search within."},query:{type:"string",description:"Search query text for findings/comments."},block_id:{type:"string",description:"Optional block filter."},status:{type:"string",enum:O8,description:"Optional status filter: open | resolved."},limit:{type:"number",description:"Maximum findings to return (optional, default: 50)."},cursor:{type:"string",description:"Pagination cursor from previous response (optional)."}},required:["review_id","query"]};var LD=["typescape_create_review","typescape_revise_review","typescape_export_review","typescape_get_handoff","typescape_list_reviews","typescape_get_review","typescape_get_render","typescape_list_findings","typescape_search_reviews","typescape_search_findings","typescape_close_review","typescape_reopen_review"],B8="markdown",F8="open",N8="strict";function c8(n){if(n==="approver")return["read","comment","approve"];if(n==="observer")return["read"];if(n==="owner")return["read","comment","approve","admin"];return["read","comment"]}function P8(n){return n.map((i)=>{let $=i.scopes&&i.scopes.length>0?[...new Set(i.scopes)]:c8(i.role);return{email:i.email,...i.name?{name:i.name}:{},role:i.role,scopes:$}})}function S8(n,i){let $=[];if(Array.isArray(n))$.push(...n);if(Array.isArray(i))for(let w of i){if(typeof w!=="string")continue;let _=w.trim();if(_.length===0)continue;$.push({email:_,role:"reviewer"})}let g=new Set,v=[];for(let w of $){if(!w||typeof w.email!=="string")continue;let _=w.email.trim();if(_.length===0)continue;let U=_.toLowerCase();if(g.has(U))continue;g.add(U),v.push({...w,email:_})}return v}function z8(n){if(!Array.isArray(n))return[];let i=new Set,$=[];for(let g of n){if(typeof g!=="string")continue;let v=g.trim().toLowerCase();if(v.length===0)continue;if(i.has(v))continue;i.add(v),$.push(v)}return $}function M8(n){if(!n||typeof n!=="object"||Array.isArray(n))return null;let i=n.id;return typeof i==="string"&&i.length>0?i:null}function R8(n){if(!n||typeof n!=="object"||Array.isArray(n))return null;let i=n;if(typeof i.id==="string"&&i.id.length>0)return i.id;let $=i.project;if($&&typeof $==="object"&&!Array.isArray($)&&typeof $.id==="string")return $.id;return null}function A8(n){if(!n||typeof n!=="object"||Array.isArray(n))return null;let i=n;if(typeof i.upload_batch_id==="string"&&i.upload_batch_id.length>0)return i.upload_batch_id;let $=i.upload;if($&&typeof $==="object"&&!Array.isArray($)&&typeof $.upload_batch_id==="string")return $.upload_batch_id;return null}function x8(n){let i=DD(n.inline_assets);if("error"in i)return i.error;let $=i.assets;if(!n.file_path)return new D(400,"missing_param","Missing required parameter: file_path","local");let g=typeof n.repo_id==="string"&&n.repo_id.length>0,v=typeof n.git_sha==="string"&&n.git_sha.length>0,w=typeof n.project_id==="string"&&n.project_id.length>0,_=typeof n.upload_batch_id==="string"&&n.upload_batch_id.length>0,U=g&&v,k=w&&_,l=!!n.content_body,J=Object.keys($).length>0;if(g&&!v||!g&&v)return new D(422,"invalid_argument","Both repo_id and git_sha are required for git-backed reviews","local");if(w&&!_||!w&&_)return new D(422,"invalid_argument","Both project_id and upload_batch_id are required for upload-backed reviews","local");if(n.document_type!==void 0&&n.document_type!=="markdown"&&n.document_type!=="image_set"&&n.document_type!=="pdf")return new D(422,"invalid_argument",`Unsupported document_type: ${n.document_type}. Supported values: "markdown", "image_set", "pdf".`,"local");if(n.asset_resolution_mode!==void 0&&n.asset_resolution_mode!=="strict"&&n.asset_resolution_mode!=="warn")return new D(422,"invalid_argument",`Unsupported asset_resolution_mode: ${n.asset_resolution_mode}. Supported values: "strict", "warn".`,"local");let Q=n.document_type??B8,j=n.identity_restriction??F8,u=n.asset_resolution_mode??N8,W=Q==="image_set",Y=Q==="pdf";if(W){if(!J&&!k)return new D(400,"image_set_empty","image_set reviews require inline_assets or upload-batch input (project_id + upload_batch_id)","local");if(k&&(!n.filenames||n.filenames.length===0))return new D(400,"missing_param",'document_type "image_set" with upload-batch mode requires filenames.',"local");let r=new Set([".png",".jpg",".jpeg",".webp",".gif",".svg"]);if(J){for(let gn of Object.keys($)){let yv=gn.slice(gn.lastIndexOf(".")).toLowerCase();if(!r.has(yv))return new D(422,"unsupported_media_type",`Unsupported image format for image_set: ${gn}. Supported extensions: ${[...r].join(", ")}`,"local")}if(Object.keys($).length>100)return new D(422,"image_set_limit_exceeded",`Image set has ${Object.keys($).length} images, exceeding the maximum of 100`,"local")}}if(Y){if(U)return new D(422,"invalid_argument",'document_type "pdf" is only supported with upload-backed sources (inline_assets or project_id+upload_batch_id).',"local");if(l)return new D(422,"invalid_argument",'document_type "pdf" does not support content_body; provide inline_assets with one .pdf file.',"local");if(!J&&!k)return new D(400,"missing_param",'document_type "pdf" requires either inline_assets with one .pdf file, or upload-batch input (project_id + upload_batch_id).',"local");if(J&&k)return new D(422,"invalid_argument",'document_type "pdf" cannot mix inline_assets and upload-batch inputs.',"local");if(J&&Object.keys($).length!==1)return new D(422,"invalid_argument",'document_type "pdf" requires exactly one inline asset.',"local");if(J){let[r]=Object.keys($);if(!r)return new D(400,"missing_param",'document_type "pdf" requires inline_assets with exactly one .pdf file.',"local");if(r.slice(r.lastIndexOf(".")).toLowerCase()!==".pdf")return new D(422,"unsupported_media_type",`Unsupported PDF format: ${r}. Supported extension: .pdf`,"local");if(n.file_path!==r)return new D(422,"invalid_argument",`For document_type "pdf", file_path must match inline_assets key: ${r}`,"local")}}let B=[U,l,k].filter(Boolean).length;if(!W&&!Y&&B===0)return new D(400,"missing_param","Provide one source mode: (repo_id + git_sha), (content_body), or (project_id + upload_batch_id)","local");if(B>1)return new D(422,"ambiguous_review_input","Cannot mix source modes: choose exactly one of git-backed, inline content_body, or upload-backed.","local");if(!W&&n.filenames&&n.filenames.length>0)return new D(422,"invalid_argument","filenames is only valid when document_type is image_set.","local");if(!Y&&n.filename&&n.filename.trim().length>0)return new D(422,"invalid_argument",'filename is only valid when document_type is "pdf".',"local");if(j==="domain"&&(!n.allowed_email_domains||n.allowed_email_domains.length===0))return new D(422,"invalid_argument",'allowed_email_domains is required when identity_restriction is "domain"',"local");if(Object.keys($).length>0){if(!l&&!W&&!Y)return new D(422,"invalid_argument","inline_assets requires content_body (inline mode)","local");let r=0;for(let[gn,yv]of Object.entries($)){let r0=JD(gn);if(r0)return new D(422,"invalid_argument",`${r0}: ${gn}`,"local");let m0=z0(yv);if(m0===null)return new D(422,"invalid_argument",`Invalid base64 content for asset: ${gn}`,"local");r+=m0.byteLength}if(r>lD)return new D(413,"inline_payload_too_large",`Total decoded inline assets (${r} bytes) exceed 10MB limit. Use the Typescape CLI with upload batch for larger payloads.`,"local")}let O={file_path:n.file_path,document_type:Q,identity_restriction:j,asset_resolution_mode:u};if(U)O.repo_id=n.repo_id,O.git_sha=n.git_sha;if(k)O.project_id=n.project_id,O.upload_batch_id=n.upload_batch_id;if(l)O.content_body=n.content_body;if(Object.keys($).length>0)O.inline_assets=$;let E=S8(n.participants,n.reviewer_emails);if(E.length>0)O.participants=P8(E);if(n.title!==void 0)O.title=n.title;if(n.allowed_email_domains!==void 0&&n.allowed_email_domains.length>0)O.allowed_email_domains=n.allowed_email_domains;if(n.operator_name!==void 0)O.operator_name=n.operator_name;if(n.focus_areas!==void 0&&n.focus_areas.length>0)O.focus_areas=n.focus_areas;if(n.framing!==void 0)O.framing=n.framing;if(n.carry_forward_findings!==void 0)O.carry_forward_findings=n.carry_forward_findings;if(n.carry_forward_filter!==void 0)O.carry_forward_filter=n.carry_forward_filter;if(Y)O.filename=n.filename?.trim()||n.file_path.split("/").filter(Boolean).at(-1)||n.file_path;if(W)O.filenames=n.filenames&&n.filenames.length>0?n.filenames:Object.keys($).sort();if(n.purpose!==void 0)O.purpose=n.purpose;if(n.properties!==void 0)O.properties=n.properties;let T={};if(n.idempotency_key)T["Idempotency-Key"]=n.idempotency_key;if(n.expected_version)T["If-Match"]=n.expected_version;let a=z8(n.reviewer_emails),s=Y&&J?(()=>{let r=Object.entries($)[0];if(!r)return null;let[gn,yv]=r;return gn&&yv?{assetPath:gn,base64Content:yv}:null})():null;return{body:O,headers:T,reviewerEmails:a,pdfInlineFallback:s}}async function h8(n,i,$){let g=Array.isArray($.invitations)?$.invitations:[];if(i.length===0||g.length>0)return g;let v=M8($.review);if(!v)throw new D(500,"invalid_upstream_response","Review create response missing review.id; cannot invite reviewer_emails","local");let w=await n.post(`/reviews/${encodeURIComponent(v)}/participants`,{body:{participants:i.map((U)=>({email:U,role:"reviewer"}))}}),_=Array.isArray(w.body.invitations)?w.body.invitations:[];if(_.length>0)return _;throw new D(502,"invalid_upstream_response","Reviewer invitation follow-up returned no invitations",w.requestId)}async function KD(n,i,$){return n.post("/reviews",{body:i,headers:$})}async function C8(n,i){if(!i.pdfInlineFallback)throw new D(500,"invalid_local_state","PDF fallback requires exactly one inline asset","local");let $=z0(i.pdfInlineFallback.base64Content);if($===null)throw new D(422,"invalid_argument",`Invalid base64 content for asset: ${i.pdfInlineFallback.assetPath}`,"local");let g=await n.post("/projects",{body:{name:`MCP Upload ${i.pdfInlineFallback.assetPath}`}}),v=R8(g.body);if(!v)throw new D(502,"invalid_upstream_response","Project create response missing project id",g.requestId);let w=new FormData;w.append(i.pdfInlineFallback.assetPath,new Blob([$],{type:"application/pdf"}),i.pdfInlineFallback.assetPath);let _=await n.postFormData(`/projects/${encodeURIComponent(v)}/upload`,w),U=A8(_.body);if(!U)throw new D(502,"invalid_upstream_response","Upload response missing upload_batch_id",_.requestId);let k={...i.body,project_id:v,upload_batch_id:U};return delete k.inline_assets,KD(n,k,i.headers)}async function E8(n,i){let $=async(g)=>{let v=await h8(n,i.reviewerEmails,g.body);return H({review:g.body.review,invitations:v},g.requestId)};try{let g=await KD(n,i.body,i.headers);return await $(g)}catch(g){if(g instanceof D&&i.pdfInlineFallback&&g.code==="feature_disabled"&&g.details?.feature==="inline_assets_enabled")try{let v=await C8(n,i);return await $(v)}catch(v){if(v instanceof D)return G(v);throw v}if(g instanceof D)return G(g);throw g}}function o8(n){if(!n.review_id)return new D(400,"missing_param","Missing required parameter: review_id","local");let i=typeof n.git_sha==="string"&&n.git_sha.length>0,$=typeof n.content_body==="string"&&n.content_body.length>0,g=typeof n.upload_batch_id==="string"&&n.upload_batch_id.length>0,v=typeof n.project_id==="string"&&n.project_id.length>0;if(v&&!g||!v&&g)return new D(422,"invalid_argument","Both project_id and upload_batch_id are required for upload-backed revision","local");let w=[i,$,g].filter(Boolean).length;if(w===0)return new D(400,"missing_param","One of git_sha, content_body, or upload_batch_id is required","local");if(w>1)return new D(422,"invalid_argument","git_sha, content_body, and upload_batch_id are mutually exclusive","local");let _=i?n.git_sha:void 0;if(_&&!/^[a-f0-9]{40}$/i.test(_))return new D(400,"invalid_param",`Invalid git_sha format: must be a 40-character hex string, got "${n.git_sha}"`,"local");let U={};if(_)U.git_sha=_.toLowerCase();if($)U.content_body=n.content_body;if(g)U.project_id=n.project_id,U.upload_batch_id=n.upload_batch_id;if(n.file_path!==void 0)U.file_path=n.file_path;if(n.document_type!==void 0)U.document_type=n.document_type;if(n.filename!==void 0)U.filename=n.filename;else if(n.document_type==="pdf"&&n.file_path!==void 0)U.filename=n.file_path;if(n.filenames!==void 0&&n.filenames.length>0)U.filenames=n.filenames;if(n.title!==void 0)U.title=n.title;if(n.changes_summary!==void 0)U.changes_summary=n.changes_summary;if(n.resolutions!==void 0&&n.resolutions.length>0)U.resolutions=n.resolutions;let k={};if(n.idempotency_key)k["Idempotency-Key"]=n.idempotency_key;return{reviewId:n.review_id,body:U,headers:k}}async function T8(n,i){try{let $=await n.post(`/reviews/${encodeURIComponent(i.reviewId)}/revise`,{body:i.body,headers:i.headers});return H($.body,$.requestId)}catch($){if($ instanceof D)return G($);throw $}}function OD(n,i){let $=new Map;function g(W){let Y=W.indexOf("#");if(Y===-1)throw new D(500,"invalid_review_url","Review link URL is missing fragment token","local");return W.slice(Y+1)}async function v(W){let Y=$.get(W);if(Y&&Y.expiresAtMs>Date.now())return Y.token;let B=await i.get(`/sessions/${W}/participants`,{query:{role:"reviewer"}}),O=B.body.items?.[0]?.participant_id;if(!O)O=(await i.get(`/sessions/${W}/participants`,{query:{limit:"1"}})).body.items?.[0]?.participant_id;if(!O)throw new D(422,"no_participants","No participants available to mint a render token",B.requestId);let E=await i.post(`/sessions/${W}/links`,{body:{participant_id:O,scope:"read",single_use:!0,url_token_ttl_minutes:60}}),T=E.body.url;if(!T||typeof T!=="string")throw new D(500,"invalid_link_response","Failed to mint review link for render",E.requestId);let a=await i.post("/auth/exchange",{body:{url_token:g(T)}}),s=a.body.session_access_token,r=a.body.expires_in_seconds;if(!s||typeof s!=="string")throw new D(500,"token_exchange_failed","Failed to exchange review link for review access token",a.requestId);let gn=typeof r==="number"&&Number.isFinite(r)?Math.max(0,Math.trunc(r)-30)*1000:300000;return $.set(W,{token:s,expiresAtMs:Date.now()+gn}),s}let w={name:"typescape_create_review",description:"Create a new Typescape review for Markdown, image-set, or PDF content. Supports three source modes: (1) git-backed with repo_id+git_sha, (2) inline with content_body and optional inline_assets (base64), or (3) upload-backed with project_id+upload_batch_id. Returns the review ID and any invitations sent.",inputSchema:QD};n.register(w,async(W)=>{let Y=x8(W);if(Y instanceof D)return G(Y);return E8(i,Y)});let _={name:"typescape_revise_review",description:"Compatibility-only helper for product-owned revise flows. Preferred pattern: external agent revises content, then create a new Typescape review pinned to a newer revision, superseding an existing review. The predecessor becomes read-only and unresolved findings are carried forward to the new review. Supports git revision (git_sha) and upload revision (content_body or upload_batch_id+project_id).",inputSchema:WD};n.register(_,async(W)=>{let Y=o8(W);if(Y instanceof D)return G(Y);return T8(i,Y)});let U={name:"typescape_export_review",description:"Export all feedback from a Typescape review as structured JSON. Returns the full export document including findings, comments, and anchors.",inputSchema:YD};n.register(U,async(W)=>{let Y=W;if(!Y.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));let O={schema:typeof Y.schema==="string"&&Y.schema.trim().length>0?Y.schema.trim():"v2"};if(Y.view)O.view=Y.view;if(Y.include_rule_context)O.include_rule_context="true";let E={};if(Y.expected_version)E["If-Match"]=Y.expected_version;try{let T=await i.get(`/reviews/${Y.review_id}/export`,{query:O,headers:E});return H(T.body,T.requestId)}catch(T){if(T instanceof D)return G(T);throw T}});let k={name:"typescape_get_handoff",description:"Fetch the canonical agent handoff bundle for a Typescape review. Returns review state, findings, lineage, rules, artifacts, and next actions in one read-only package.",inputSchema:ID};n.register(k,async(W)=>{let Y=W;if(!Y.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));let B={};if(typeof Y.include_rules==="boolean")B.include_rules=Y.include_rules?"true":"false";if(typeof Y.include_lineage==="boolean")B.include_lineage=Y.include_lineage?"true":"false";if(typeof Y.include_advisory==="boolean")B.include_advisory=Y.include_advisory?"true":"false";if(typeof Y.include_blocks==="boolean")B.include_blocks=Y.include_blocks?"true":"false";if(typeof Y.max_rules==="number")B.max_rules=String(Y.max_rules);try{let O=await i.get(`/reviews/${encodeURIComponent(Y.review_id)}/handoff`,{query:B});return H(O.body,O.requestId)}catch(O){if(O instanceof D)return G(O);throw O}});let l={name:"typescape_list_reviews",description:"List Typescape reviews with optional filters. Returns paginated review summaries. Use cursor from previous response for pagination.",inputSchema:jD};n.register(l,async(W)=>{let Y=W,B={};if(Y.repo_id)B.repo_id=Y.repo_id;if(Y.state)B.state=Y.state;if(Y.file_paths)B.file_paths=Y.file_paths;if(Y.cursor)B.cursor=Y.cursor;if(Y.limit!==void 0)B.limit=String(Y.limit);if(Y.root_review_id)B.root_review_id=Y.root_review_id;if(Y.supersedes_review_id)B.supersedes_review_id=Y.supersedes_review_id;if(Y.has_successor!==void 0)B.has_successor=Y.has_successor?"true":"false";let O=Y.q??Y.search;if(O)B.q=O;try{let E=await i.get("/reviews",{query:B});return H(E.body,E.requestId)}catch(E){if(E instanceof D)return G(E);throw E}});let J={name:"typescape_get_review",description:"Get details of a specific Typescape review. Returns full review metadata including participants, stats, and provenance.",inputSchema:uD};n.register(J,async(W)=>{let Y=W;if(!Y.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));try{let B=await i.get(`/reviews/${encodeURIComponent(Y.review_id)}`);return H(B.body,B.requestId)}catch(B){if(B instanceof D)return G(B);throw B}});let Q={name:"typescape_get_render",description:"Get the rendered content of a review. Returns immutable block-level HTML structure with block_ids for anchoring.",inputSchema:HD};n.register(Q,async(W)=>{let Y=W;if(!Y.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));let B={};if(Y.include_plaintext)B.include_plaintext="true";try{let O=await v(Y.review_id),E=await i.get(`/sessions/${Y.review_id}/render`,{query:B,headers:{Authorization:`Bearer ${O}`}});return H(E.body,E.requestId)}catch(O){if(O instanceof D)return G(O);throw O}});let j={name:"typescape_list_findings",description:"List findings (review comments) for a review in the same plain-language form the reviewer or agent wrote them. Optionally filter by block_id anchor or finding status. Returns paginated finding list with comments.",inputSchema:VD},u=async(W)=>{if(!W.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));let Y={};if(W.block_id)Y.block_id=W.block_id;if(W.status)Y.status=W.status;if(W.cursor)Y.cursor=W.cursor;if(W.limit!==void 0)Y.limit=String(W.limit);let B=W.q??W.search;if(B)Y.q=B;try{let O=await i.get(`/reviews/${encodeURIComponent(W.review_id)}/findings`,{query:Y});return H(O.body,O.requestId)}catch(O){if(O instanceof D)return G(O);throw O}};n.register(j,async(W)=>{return u(W)}),n.register({name:"typescape_search_reviews",description:"Search reviews by title/file path using server-side query matching.",inputSchema:fD},async(W)=>{let Y=W,B=typeof Y.query==="string"?Y.query.trim():"";if(!B)return G(new D(400,"missing_param","Missing required parameter: query","local"));let O={q:B};if(Y.limit!==void 0)O.limit=String(Y.limit);if(Y.cursor)O.cursor=Y.cursor;try{let E=await i.get("/reviews",{query:O});return H(E.body,E.requestId)}catch(E){if(E instanceof D)return G(E);throw E}}),n.register({name:"typescape_search_findings",description:"Search findings/comments within a review using server-side query matching.",inputSchema:qD},async(W)=>{let Y=W,B=typeof Y.query==="string"?Y.query.trim():"";if(!Y.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));if(!B)return G(new D(400,"missing_param","Missing required parameter: query","local"));return u({review_id:Y.review_id,q:B,block_id:Y.block_id,status:Y.status,limit:Y.limit,cursor:Y.cursor})}),n.register({name:"typescape_close_review",description:"Close an active review, making it read-only for reviewers.",inputSchema:M0},async(W)=>{let Y=W;if(!Y.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));try{let B=await i.post(`/reviews/${encodeURIComponent(Y.review_id)}/close`,{body:{}});return H(B.body,B.requestId)}catch(B){if(B instanceof D)return G(B);throw B}}),n.register({name:"typescape_reopen_review",description:"Reopen a closed review and return it to active state.",inputSchema:M0},async(W)=>{let Y=W;if(!Y.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));try{let B=await i.post(`/reviews/${encodeURIComponent(Y.review_id)}/reopen`,{body:{}});return H(B.body,B.requestId)}catch(B){if(B instanceof D)return G(B);throw B}})}var BD={type:"object",properties:{review_id:{type:"string",description:"Review ID to export response matrix for (e.g., sess_01HXYZ...)"}},required:["review_id"]},FD={type:"object",properties:{review_id:{type:"string",description:"Review ID to attach the finding to (e.g., sess_01HXYZ...)"},body_md:{type:"string",description:"Plain-language finding body in Markdown. Say what is wrong, unclear, or missing."},body:{type:"string",description:"Compatibility alias for body_md."},block_id:{type:"string",description:"Block ID to anchor the finding to when feedback targets a specific passage (optional; omit for review-level)."},anchor:{type:"object",properties:{type:{type:"string",enum:["session","block","range"],description:"Anchor type (default: session if no block_id, block if block_id provided)"},start_offset:{type:"number",description:"Start offset for range anchor"},end_offset:{type:"number",description:"End offset for range anchor"}},description:"Optional anchor details. Omit for review-level feedback or provide block/range details when you have them."},severity:{type:"string",enum:["suggestion","needs_changes","blocking"],description:"Optional severity hint. Omit unless the finding clearly blocks approval or needs explicit escalation. Note: 'blocking' from automation is coerced to 'needs_changes' per Ch 11 L6250."},tags:{type:"array",items:{type:"string"},description:"Optional machine tags for downstream automation. Most agent loops should omit this."},suggestion:{type:"object",properties:{type:{type:"string",enum:["replace","insert","delete"]}},description:"Optional structured edit payload when you want to carry an explicit replacement."},idempotency_key:{type:"string",description:"Idempotency key for safe retries (optional)"}},required:["review_id","body_md"]},ND={type:"object",properties:{review_id:{type:"string",description:"Review ID containing the finding"},finding_id:{type:"string",description:"Finding ID to post comment to"},body_md:{type:"string",description:"Plain-language comment body in Markdown."},body:{type:"string",description:"Compatibility alias for body_md"},idempotency_key:{type:"string",description:"Idempotency key for safe retries (optional)"}},required:["review_id","finding_id","body_md"]},cD={type:"object",properties:{review_id:{type:"string",description:"Review ID containing the finding"},finding_id:{type:"string",description:"Finding ID to resolve"},decision:{type:"object",properties:{state:{type:"string",enum:["accepted","rejected","deferred","duplicate","needs_more_info"],description:"Decision state"},rationale_md:{type:"string",description:"Rationale in Markdown (optional)"}},required:["state"],description:"Decision to record with resolution (optional)"},expected_version:{type:"string",description:"Expected version for optimistic concurrency (thread ETag or integer version, optional)"},if_match:{type:"string",description:"Alias for expected_version (thread ETag or integer version, optional)"}},required:["review_id","finding_id"]},PD={type:"object",properties:{review_id:{type:"string",description:"Review ID containing the finding"},finding_id:{type:"string",description:"Finding ID to reopen"},expected_version:{type:"string",description:"Expected version for optimistic concurrency (thread ETag or integer version, optional)"},if_match:{type:"string",description:"Alias for expected_version (thread ETag or integer version, optional)"}},required:["review_id","finding_id"]},SD={type:"object",properties:{review_id:{type:"string",description:"Review ID containing the finding"},finding_id:{type:"string",description:"Finding ID to record decision for"},state:{type:"string",enum:["undecided","accepted","rejected","deferred","duplicate","needs_more_info","dismissed","waived"],description:"Decision state"},rationale_md:{type:"string",description:"Rationale in Markdown (optional)"}},required:["review_id","finding_id","state"]},zD={type:"object",properties:{review_id:{type:"string",description:"Review ID containing the finding"},finding_id:{type:"string",description:"Finding ID to attach evidence to"},evidence_type:{type:"string",enum:["commit","proposed_change","pr","attestation","external_ticket","note"],description:"Evidence type (required). Determines which additional fields are relevant."},commit_sha:{type:"string",description:"Git commit SHA (for evidence_type=commit)"},repo_url:{type:"string",description:"Repository URL (for evidence_type=commit)"},message:{type:"string",description:"Commit message (for evidence_type=commit)"},proposed_change_id:{type:"string",description:"Proposed change ID (for evidence_type=proposed_change)"},patch_sha256:{type:"string",description:"Patch SHA256 (for evidence_type=proposed_change)"},pr_url:{type:"string",description:"PR URL (for evidence_type=pr)"},pr_number:{type:"number",description:"PR number (for evidence_type=pr)"},attestation_id:{type:"string",description:"Attestation ID (for evidence_type=attestation)"},attestor:{type:"string",description:"Attestor identity (optional, for attestation type)"},ticket_url:{type:"string",description:"Ticket URL (for evidence_type=external_ticket)"},ticket_id:{type:"string",description:"Ticket ID (for evidence_type=external_ticket)"},system:{type:"string",description:"Ticket system (for evidence_type=external_ticket)"},note_md:{type:"string",description:"Note text (for evidence_type=note)"},body_md:{type:"string",description:"Markdown evidence body (alias for note_md/text; useful for attestation/external_ticket notes)"},dedupe_key:{type:"string",description:"Optional idempotency/deduplication key for evidence attach"}},required:["review_id","finding_id","evidence_type"]},MD={type:"object",properties:{review_id:{type:"string",description:"Review ID containing the finding."},finding_id:{type:"string",description:"Finding ID to fetch latest decision for."}},required:["review_id","finding_id"]},RD={type:"object",properties:{review_id:{type:"string",description:"Review ID containing the finding."},finding_id:{type:"string",description:"Finding ID to list evidence for."},limit:{type:"number",description:"Maximum evidence entries to return (optional)."},cursor:{type:"string",description:"Pagination cursor from previous response (optional)."}},required:["review_id","finding_id"]};var xD=["typescape_export_response_matrix","typescape_create_finding","typescape_post_comment","typescape_resolve_finding","typescape_reopen_finding","typescape_record_decision","typescape_attach_evidence","typescape_get_decision","typescape_list_evidence"],R0=on({operation:"read"});function x$(n){return on({operation:"write",hasIdempotencyKey:n})}var Z8="X-Typescape-If-Match";function AD(n,i,$){if(!n)return;if(/^[1-9]\d*$/.test(n)){i.expected_version=Number.parseInt(n,10);return}$[Z8]=n}function hD(n,i){n.register({name:"typescape_export_response_matrix",description:"Export the response matrix for a review. Returns per-finding decision and evidence summary.",inputSchema:BD},async($)=>{let g=$;if(!g.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));try{let v=await i.get(`/reviews/${g.review_id}/export`,{query:{view:"response_matrix.v1"}});return H(v.body,v.requestId,{retry:R0})}catch(v){if(v instanceof D)return G(v,{operation:"read"});throw v}}),n.register({name:"typescape_create_finding",description:"Create a new finding (comment) on a review after the agent has read the content and formed its own judgment. Use plain-language body text that a reviewer or operator can read directly. Optionally anchor to a specific block_id. Agent-created findings are tagged source='automation'. Severity 'blocking' is coerced to 'needs_changes' for automation sources.",inputSchema:FD},async($)=>{let g=$,v=g.body_md??g.body;if(!g.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));if(!v)return G(new D(400,"missing_param","Missing required parameter: body_md","local"));let w={body_md:v,source:"automation"},_=typeof g.block_id==="string"?g.block_id.trim():void 0;if(_)w.block_id=_;if(g.anchor!==void 0)w.anchor=g.anchor;else if(_)w.anchor={type:"block"};if(g.severity!==void 0)w.severity=g.severity;if(g.tags!==void 0)w.tags=g.tags;if(g.suggestion!==void 0)w.suggestion=g.suggestion;let U={};if(g.idempotency_key)U["Idempotency-Key"]=g.idempotency_key;try{let k=await i.post(`/reviews/${encodeURIComponent(g.review_id)}/findings`,{body:w,headers:U});return H(k.body,k.requestId,{retry:x$(Boolean(g.idempotency_key))})}catch(k){if(k instanceof D)return G(k,{operation:"write",hasIdempotencyKey:Boolean(g.idempotency_key)});throw k}}),n.register({name:"typescape_post_comment",description:"Post a comment (reply) to an existing finding. Returns the created comment with its ID.",inputSchema:ND},async($)=>{let g=$,v=g.body_md??g.body;if(!g.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));if(!g.finding_id)return G(new D(400,"missing_param","Missing required parameter: finding_id","local"));if(!v)return G(new D(400,"missing_param","Missing required parameter: body_md","local"));let w={body_md:v,source:"automation"},_={};if(g.idempotency_key)_["Idempotency-Key"]=g.idempotency_key;try{let U=await i.post(`/reviews/${encodeURIComponent(g.review_id)}/findings/${encodeURIComponent(g.finding_id)}/comments`,{body:w,headers:_});return H(U.body,U.requestId,{retry:x$(Boolean(g.idempotency_key))})}catch(U){if(U instanceof D)return G(U,{operation:"write",hasIdempotencyKey:Boolean(g.idempotency_key)});throw U}}),n.register({name:"typescape_resolve_finding",description:"Resolve (close) a finding. Optionally include a decision. Use expected_version or if_match for optimistic concurrency.",inputSchema:cD},async($)=>{let g=$;if(!g.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));if(!g.finding_id)return G(new D(400,"missing_param","Missing required parameter: finding_id","local"));let v=g.decision===void 0?{status:"resolved"}:{disposition:g.decision},w={};AD(g.expected_version??g.if_match,v,w);try{let _=g.decision===void 0?await i.patch(`/reviews/${encodeURIComponent(g.review_id)}/findings/${encodeURIComponent(g.finding_id)}`,{body:v,headers:w}):await i.post(`/sessions/${g.review_id}/threads/${g.finding_id}/resolve`,{body:v,headers:w});return H(_.body,_.requestId,{retry:x$(!1)})}catch(_){if(_ instanceof D)return G(_,{operation:"write"});throw _}}),n.register({name:"typescape_reopen_finding",description:"Reopen a previously resolved finding. Use expected_version or if_match for optimistic concurrency.",inputSchema:PD},async($)=>{let g=$;if(!g.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));if(!g.finding_id)return G(new D(400,"missing_param","Missing required parameter: finding_id","local"));let v={},w={};AD(g.expected_version??g.if_match,v,w);try{v.status="open";let _=await i.patch(`/reviews/${encodeURIComponent(g.review_id)}/findings/${encodeURIComponent(g.finding_id)}`,{body:v,headers:w});return H(_.body,_.requestId,{retry:x$(!1)})}catch(_){if(_ instanceof D)return G(_,{operation:"write"});throw _}}),n.register({name:"typescape_record_decision",description:"Record a decision (decision) on a finding. Decisions track how feedback was addressed. Note: recording a resolving decision may automatically resolve the finding.",inputSchema:SD},async($)=>{let g=$;if(!g.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));if(!g.finding_id)return G(new D(400,"missing_param","Missing required parameter: finding_id","local"));if(!g.state)return G(new D(400,"missing_param","Missing required parameter: state","local"));let v={state:g.state};if(g.rationale_md!==void 0)v.rationale_md=g.rationale_md;try{let w=await i.post(`/reviews/${encodeURIComponent(g.review_id)}/findings/${encodeURIComponent(g.finding_id)}/decision`,{body:v});return H(w.body,w.requestId,{retry:x$(!1)})}catch(w){if(w instanceof D)return G(w,{operation:"write"});throw w}}),n.register({name:"typescape_attach_evidence",description:"Attach evidence to a finding. Evidence proves that feedback was addressed (e.g., commit SHA, proposed change, PR URL, or attestation).",inputSchema:zD},async($)=>{let g=$;if(!g.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));if(!g.finding_id)return G(new D(400,"missing_param","Missing required parameter: finding_id","local"));let v,w;if(g.evidence_type){v=g.evidence_type.trim(),w={};let U=["commit_sha","repo_url","message","proposed_change_id","patch_sha256","pr_url","pr_number","attestation_id","attestor","ticket_url","ticket_id","system","note_md","body_md"];for(let k of U)if(g[k]!==void 0)w[k]=g[k];if(g.body_md!==void 0)w.body=g.body_md,w.text=g.body_md;else if(g.note_md!==void 0)w.body=g.note_md,w.text=g.note_md}else if(g.evidence)v=typeof g.evidence.type==="string"?g.evidence.type.trim():"",w={...g.evidence},delete w.type;else return G(new D(400,"missing_param","Missing required parameter: evidence_type","local"));if(!v)return G(new D(422,"invalid_argument","evidence_type is required","local"));let _={evidence_type:v,evidence_json:w};if(g.dedupe_key)_.dedupe_key=g.dedupe_key;try{let U=await i.post(`/reviews/${encodeURIComponent(g.review_id)}/findings/${encodeURIComponent(g.finding_id)}/evidence`,{body:_});return H(U.body,U.requestId,{retry:x$(!1)})}catch(U){if(U instanceof D)return G(U,{operation:"write"});throw U}}),n.register({name:"typescape_get_decision",description:"Get the latest decision for a specific finding.",inputSchema:MD},async($)=>{let g=$;if(!g.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));if(!g.finding_id)return G(new D(400,"missing_param","Missing required parameter: finding_id","local"));try{let v=await i.get(`/reviews/${encodeURIComponent(g.review_id)}/findings/${encodeURIComponent(g.finding_id)}/decision`);return H(v.body,v.requestId,{retry:R0})}catch(v){if(v instanceof D)return G(v,{operation:"read"});throw v}}),n.register({name:"typescape_list_evidence",description:"List evidence entries attached to a finding.",inputSchema:RD},async($)=>{let g=$;if(!g.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));if(!g.finding_id)return G(new D(400,"missing_param","Missing required parameter: finding_id","local"));let v={};if(g.limit!==void 0)v.limit=String(g.limit);if(g.cursor)v.cursor=g.cursor;try{let w=await i.get(`/reviews/${encodeURIComponent(g.review_id)}/findings/${encodeURIComponent(g.finding_id)}/evidence`,{query:v});return H(w.body,w.requestId,{retry:R0})}catch(w){if(w instanceof D)return G(w,{operation:"read"});throw w}})}var l_=["file","doc","pr","custom"],CD=new Set(l_),ED={type:"object",properties:{source_type:{type:"string",enum:["git","upload"],description:"Source type for the review set"},title:{type:"string",description:"Review set title (optional)"},kind:{type:"string",enum:["review_set","release_bundle","packet"],description:"Kind of review set (optional, default: review_set)"},participants:{type:"array",items:{type:"object",properties:{email:{type:"string"},role:{type:"string",enum:["reviewer","approver"]},roles:{type:"array",items:{type:"string",enum:["reviewer","approver"]},minItems:1}},required:["email"]},description:"Participants to invite (optional). Supports role (single) or roles (array)."},reviews:{type:"array",items:{oneOf:[{type:"string"},{type:"object",properties:{review_id:{type:"string"},session_id:{type:"string"},required:{type:"boolean"}},anyOf:[{required:["review_id"]},{required:["session_id"]}],additionalProperties:!1}]},minItems:1,description:"Review IDs (or review entry objects) to include in this review set."},files:{type:"array",items:{type:"object",properties:{repo_id:{type:"string"},git_sha:{type:"string"},project_id:{type:"string"},upload_batch_id:{type:"string"},file_path:{type:"string"},required:{type:"boolean"}},required:["file_path"],additionalProperties:!1},minItems:1,description:"File entries for git or upload source types (must include file_path plus source identifiers)."},idempotency_key:{type:"string",description:"Idempotency key for safe retries (optional)"}},required:["source_type"]},oD={type:"object",properties:{review_set_id:{type:"string",description:"Review set ID to export"},schema:{type:"string",description:"Export schema version (optional, default: v2). Canonical first-party review-set export uses schema=v2."},view:{type:"string",description:"Export view variant (optional). Values: full, redacted, response_matrix.v1, etc."}},required:["review_set_id"]},TD={type:"object",properties:{limit:{type:"number",description:"Maximum number of review sets to return (default: 20, max: 100)"},cursor:{type:"string",description:"Pagination cursor from a previous response"}}},ZD={type:"object",properties:{review_set_id:{type:"string",description:"Review set ID to retrieve"}},required:["review_set_id"]},rD={type:"object",properties:{source_type:{type:"string",enum:["git","upload"],description:"Source type for the review ref"},repo_id:{type:"string",description:"Repository identifier (required for git source_type; short slug, e.g. 'typescape')"},project_id:{type:"string",description:"Project identifier (required for upload source_type; omit for git)"},kind:{type:"string",enum:l_,description:"Review ref kind"},key:{type:"string",description:"Review ref key (e.g., file path, doc slug, PR number, custom name)"},head_session_id:{type:"string",description:"Session ID to use as the initial head (required, e.g., sess_01HXYZ...)"}},required:["source_type","kind","key","head_session_id"]},mD={type:"object",properties:{review_ref_id:{type:"string",description:"Review ref ID to resolve"}},required:["review_ref_id"]},yD={type:"object",properties:{review_ref_id:{type:"string",description:"Review ref ID to advance"},head_session_id:{type:"string",description:"New head review ID to advance to"},expected_head_session_id:{type:"string",description:"Expected current head for optimistic concurrency (optional)"}},required:["review_ref_id","head_session_id"]},dD={type:"object",properties:{review_id:{type:"string",description:"Review ID to request approval for"},approver_emails:{type:"array",items:{type:"string"},description:"Email addresses of approvers"},message:{type:"string",description:"Message to include with the approval request (optional)"},notify:{type:"object",properties:{email:{type:"boolean"},slack:{type:"boolean"}},description:"Notification channels (optional)"},idempotency_key:{type:"string",description:"Idempotency key for safe retries (optional)"}},required:["review_id","approver_emails"]},eD={type:"object",properties:{review_id:{type:"string",description:"Review ID to get status for"},simulate:{type:"boolean",description:"Run policy evaluation without side effects (optional)"},wait:{type:"number",description:"Long-poll timeout in seconds (optional)"}},required:["review_id"]},pD={type:"object",properties:{review_id:{type:"string",description:"Review ID to run deterministic product-owned checks against"}},required:["review_id"]},aD={type:"object",properties:{},additionalProperties:!1},sD={type:"object",properties:{},additionalProperties:!1},nJ={type:"object",properties:{},additionalProperties:!1};var vJ=["typescape_create_review_set","typescape_export_review_set","typescape_list_review_sets","typescape_get_review_set","typescape_create_review_ref","typescape_resolve_review_ref","typescape_advance_review_ref","typescape_request_approval","typescape_get_status","typescape_run_checks","typescape_account_usage","typescape_account_plan","typescape_get_capabilities"];function r8(n){return n.replace(/\bSession\b/g,"Review").replace(/\bsession\b/g,"review").replace(/\bThread\b/g,"Finding").replace(/\bthread\b/g,"finding")}function A0(n){if(Array.isArray(n))return n.map((g)=>A0(g));if(n===null||typeof n!=="object")return n;let i=new Map([["session_id","review_id"],["thread_id","finding_id"],["thread_ids","finding_ids"]]),$=Object.entries(n).map(([g,v])=>{let w=i.get(g)??g,_=typeof v==="string"&&(g==="description"||g==="message")?r8(v):A0(v);return[w,_]});return Object.fromEntries($)}function iJ(n,i,$){n.register({name:"typescape_create_review_set",description:"Create a new review set (multi-file review pack). Requires features.review_sets to be enabled.",inputSchema:ED},async(g)=>{let v=g;try{if(!(await $.getCapabilities()).review_sets)return $.featureDisabledResult("review_sets")}catch(J){if(J instanceof D)return G(J);throw J}if(!v.source_type)return G(new D(400,"missing_param","Missing required parameter: source_type","local"));if(v.source_type!=="git"&&v.source_type!=="upload")return G(new D(422,"invalid_argument","source_type must be one of: git, upload","local"));let w=Array.isArray(v.reviews)&&v.reviews.length>0?v.reviews:Array.isArray(v.sessions)&&v.sessions.length>0?v.sessions:void 0,_=Array.isArray(w)&&w.length>0,U=Array.isArray(v.files)&&v.files.length>0;if(!_&&!U)return G(new D(400,"missing_param","At least one of reviews[] or files[] is required","local"));let k={source_type:v.source_type};if(v.title!==void 0)k.title=v.title;if(v.kind!==void 0)k.kind=v.kind;if(_)k.reviews=w;if(U)k.files=v.files;if(v.participants!==void 0)k.participants=v.participants.map((J)=>{if(Array.isArray(J.roles)&&J.roles.length>0)return{email:J.email,roles:J.roles};if(J.role)return{email:J.email,roles:[J.role]};return J});let l={};if(v.idempotency_key)l["Idempotency-Key"]=v.idempotency_key;try{let J=await i.post("/review-sets",{body:k,headers:l});return H(J.body,J.requestId)}catch(J){if(J instanceof D)return G(J);throw J}}),n.register({name:"typescape_export_review_set",description:"Export feedback from a review set. Requires features.review_sets to be enabled.",inputSchema:oD},async(g)=>{let v=g;try{if(!(await $.getCapabilities()).review_sets)return $.featureDisabledResult("review_sets")}catch(U){if(U instanceof D)return G(U);throw U}if(!v.review_set_id)return G(new D(400,"missing_param","Missing required parameter: review_set_id","local"));let _={schema:typeof v.schema==="string"&&v.schema.trim().length>0?v.schema.trim():"v2"};if(v.view)_.view=v.view;try{let U=await i.get(`/review-sets/${encodeURIComponent(v.review_set_id)}/export`,{query:_});return H(U.body,U.requestId)}catch(U){if(U instanceof D)return G(U);throw U}}),n.register({name:"typescape_list_review_sets",description:"List review sets with optional cursor pagination. Requires features.review_sets to be enabled. Returns an array of review sets with pagination metadata.",inputSchema:TD},async(g)=>{let v=g;try{if(!(await $.getCapabilities()).review_sets)return $.featureDisabledResult("review_sets")}catch(_){if(_ instanceof D)return G(_);throw _}let w={};if(v.limit!==void 0)w.limit=String(v.limit);if(v.cursor!==void 0)w.cursor=v.cursor;try{let _=await i.get("/review-sets",{query:w});return H(_.body,_.requestId)}catch(_){if(_ instanceof D)return G(_);throw _}}),n.register({name:"typescape_get_review_set",description:"Get a review set by ID. Returns the review set details including status, review memberships, and configuration. Requires features.review_sets to be enabled.",inputSchema:ZD},async(g)=>{let v=g;try{if(!(await $.getCapabilities()).review_sets)return $.featureDisabledResult("review_sets")}catch(w){if(w instanceof D)return G(w);throw w}if(!v.review_set_id)return G(new D(400,"missing_param","Missing required parameter: review_set_id","local"));try{let w=await i.get(`/review-sets/${encodeURIComponent(v.review_set_id)}`);return H(w.body,w.requestId)}catch(w){if(w instanceof D)return G(w);throw w}}),n.register({name:"typescape_create_review_ref",description:"Create a stable review reference that tracks HEAD review for doc/file/PR/custom keys. Always available (core primitive).",inputSchema:rD},async(g)=>{let v=g;if(!v.source_type)return G(new D(400,"missing_param","Missing required parameter: source_type","local"));if(!v.kind)return G(new D(400,"missing_param","Missing required parameter: kind","local"));if(!v.key)return G(new D(400,"missing_param","Missing required parameter: key","local"));if(!v.head_session_id)return G(new D(400,"missing_param","Missing required parameter: head_session_id","local"));let w=v.kind.trim().toLowerCase();if(!CD.has(w))return G(new D(400,"invalid_param",`Invalid parameter: kind must be one of ${l_.join(", ")}`,"local"));let _={source_type:v.source_type,kind:w,key:v.key,head_session_id:v.head_session_id};if(v.repo_id!==void 0)_.repo_id=v.repo_id;if(v.project_id!==void 0)_.project_id=v.project_id;try{let U=await i.post("/review-refs",{body:_});return H(U.body,U.requestId)}catch(U){if(U instanceof D)return G(U);throw U}}),n.register({name:"typescape_resolve_review_ref",description:"Resolve a review ref to its current head review. Returns the head review ID and pinned content details.",inputSchema:mD},async(g)=>{let v=g;if(!v.review_ref_id)return G(new D(400,"missing_param","Missing required parameter: review_ref_id","local"));try{let w=await i.get(`/review-refs/${encodeURIComponent(v.review_ref_id)}/resolve`);return H(w.body,w.requestId)}catch(w){if(w instanceof D)return G(w);throw w}}),n.register({name:"typescape_advance_review_ref",description:"Advance a review ref to a new head review. Use expected_head_session_id for optimistic concurrency.",inputSchema:yD},async(g)=>{let v=g;if(!v.review_ref_id)return G(new D(400,"missing_param","Missing required parameter: review_ref_id","local"));if(!v.head_session_id)return G(new D(400,"missing_param","Missing required parameter: head_session_id","local"));let w={head_session_id:v.head_session_id};if(v.expected_head_session_id!==void 0)w.expected_head_session_id=v.expected_head_session_id;try{let _=await i.post(`/review-refs/${encodeURIComponent(v.review_ref_id)}/advance`,{body:w});return H(_.body,_.requestId)}catch(_){if(_ instanceof D)return G(_);throw _}}),n.register({name:"typescape_request_approval",description:"Request approval for a review from specified approvers. Sends notifications via configured channels.",inputSchema:dD},async(g)=>{let v=g;if(!v.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));if(!v.approver_emails||v.approver_emails.length===0)return G(new D(400,"missing_param","Missing required parameter: approver_emails","local"));let w={approver_emails:v.approver_emails};if(v.message!==void 0)w.message=v.message;if(v.notify!==void 0)w.notify=v.notify;let _={};if(v.idempotency_key)_["Idempotency-Key"]=v.idempotency_key;try{let U=await i.post(`/reviews/${encodeURIComponent(v.review_id)}/request-approval`,{body:w,headers:_});return H(U.body,U.requestId)}catch(U){if(U instanceof D)return G(U);throw U}}),n.register({name:"typescape_get_status",description:"Get the policy verdict for a review. Returns pass/fail/needs_review with reasons. Requires features.policy to be enabled.",inputSchema:eD},async(g)=>{let v=g;try{if(!(await $.getCapabilities()).policy)return $.featureDisabledResult("policy")}catch(_){if(_ instanceof D)return G(_);throw _}if(!v.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));let w={};if(v.simulate)w.simulate="true";if(v.wait!==void 0)w.wait=String(v.wait);try{let _=await i.get(`/reviews/${encodeURIComponent(v.review_id)}/status`,{query:w});return H(A0(_.body),_.requestId)}catch(_){if(_ instanceof D)return G(_);throw _}}),n.register({name:"typescape_run_checks",description:"Trigger deterministic product checks (DocLint and related server-owned checks) for a review. This is separate from agent judgment against the rule bundle. Returns the check run ID. Requires features.checks to be enabled.",inputSchema:pD},async(g)=>{let v=g;try{if(!(await $.getCapabilities()).checks)return $.featureDisabledResult("checks")}catch(w){if(w instanceof D)return G(w);throw w}if(!v.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));try{let w=await i.post(`/reviews/${encodeURIComponent(v.review_id)}/run-checks`,{body:{}});return H(w.body,w.requestId)}catch(w){if(w instanceof D)return G(w);throw w}}),n.register({name:"typescape_account_usage",description:"Get account usage and quota information (reviews used/limit, remaining, and billing period).",inputSchema:aD},async()=>{try{let g=await i.get("/account/usage");return H(g.body,g.requestId)}catch(g){if(g instanceof D)return G(g);throw g}}),n.register({name:"typescape_account_plan",description:"Get account plan details (plan name/id, status, and limits metadata).",inputSchema:sD},async()=>{try{let g=await i.get("/account/plan");return H(g.body,g.requestId)}catch(g){if(g instanceof D)return G(g);throw g}}),n.register({name:"typescape_get_capabilities",description:"Get authenticated capabilities and effective feature flags. Returns the same payload shape as GET /v1/me/capabilities.",inputSchema:nJ},async()=>{try{let g=await i.get("/me/capabilities");return H(g.body,g.requestId)}catch(g){if(g instanceof D)return G(g);throw g}})}var $J=["typescape_request_snapshot","typescape_get_snapshot","typescape_list_backlinks","typescape_get_impact"],m8={type:"object",properties:{repo_id:{type:"string",description:"Repository identifier to build a corpus snapshot for"}},required:["repo_id"]},y8={type:"object",properties:{repo_id:{type:"string",description:"Repository identifier"},git_sha:{type:"string",description:"Git commit SHA for the snapshot"}},required:["repo_id","git_sha"]},d8={type:"object",properties:{repo_id:{type:"string",description:"Repository identifier"},git_sha:{type:"string",description:"Git commit SHA for the snapshot"},path:{type:"string",description:"Target file path to query backlinks for"},anchor:{type:"string",description:"Optional anchor within the file to narrow backlinks"}},required:["repo_id","git_sha","path"]},e8={type:"object",properties:{review_id:{type:"string",description:"Review identifier to compute impact radius for"}},required:["review_id"]};function gJ(n,i,$){n.register({name:"typescape_request_snapshot",description:"Request a corpus snapshot build for a repository. Returns the snapshot ID and build status. The snapshot builds "+"asynchronously — use typescape_get_snapshot to poll for completion. "+"Requires features.corpus_snapshots to be enabled.",inputSchema:m8},async(g)=>{let v=g;try{if(!(await $.getCapabilities()).corpus_snapshots)return $.featureDisabledResult("corpus_snapshots")}catch(w){if(w instanceof D)return G(w);throw w}if(!v.repo_id)return G(new D(400,"missing_param","Missing required parameter: repo_id","local"));try{let w=await i.post(`/repos/${encodeURIComponent(v.repo_id)}/snapshots`,{body:{}});return H(w.body,w.requestId)}catch(w){if(w instanceof D)return G(w);throw w}}),n.register({name:"typescape_get_snapshot",description:"Get corpus snapshot metadata for a Git repo at a specific commit. Returns snapshot status, config hash, and source type. Requires features.corpus_snapshots to be enabled.",inputSchema:y8},async(g)=>{let v=g;try{if(!(await $.getCapabilities()).corpus_snapshots)return $.featureDisabledResult("corpus_snapshots")}catch(w){if(w instanceof D)return G(w);throw w}if(!v.repo_id)return G(new D(400,"missing_param","Missing required parameter: repo_id","local"));if(!v.git_sha)return G(new D(400,"missing_param","Missing required parameter: git_sha","local"));try{let w=await i.get(`/repos/${encodeURIComponent(v.repo_id)}/snapshots/${encodeURIComponent(v.git_sha)}`);return H(w.body,w.requestId)}catch(w){if(w instanceof D)return G(w);throw w}}),n.register({name:"typescape_list_backlinks",description:"List inbound backlinks for a target file (and optional anchor) within a corpus snapshot. Returns deterministic, authoritative data. Requires features.corpus_snapshots to be enabled.",inputSchema:d8},async(g)=>{let v=g;try{if(!(await $.getCapabilities()).corpus_snapshots)return $.featureDisabledResult("corpus_snapshots")}catch(w){if(w instanceof D)return G(w);throw w}if(!v.repo_id)return G(new D(400,"missing_param","Missing required parameter: repo_id","local"));if(!v.git_sha)return G(new D(400,"missing_param","Missing required parameter: git_sha","local"));if(!v.path)return G(new D(400,"missing_param","Missing required parameter: path","local"));try{let w=new URLSearchParams({path:v.path});if(v.anchor)w.set("anchor",v.anchor);let _=await i.get(`/repos/${encodeURIComponent(v.repo_id)}/snapshots/${encodeURIComponent(v.git_sha)}/backlinks?${w}`);return H(_.body,_.requestId)}catch(w){if(w instanceof D)return G(w);throw w}}),n.register({name:"typescape_get_impact",description:"Compute the impact radius for a review: which other files are affected by changes to the review's target file (via backlinks). Returns deterministic, authoritative data. Requires features.corpus_snapshots to be enabled.",inputSchema:e8},async(g)=>{let v=g;try{if(!(await $.getCapabilities()).corpus_snapshots)return $.featureDisabledResult("corpus_snapshots")}catch(w){if(w instanceof D)return G(w);throw w}if(!v.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));try{let w=await i.get(`/reviews/${encodeURIComponent(v.review_id)}/impact`);return H(w.body,w.requestId)}catch(w){if(w instanceof D)return G(w);throw w}})}var JJ=["typescape_get_rules","typescape_rules_pack","typescape_check_content","typescape_import_rules","typescape_propose_rule","typescape_list_rule_proposals","typescape_list_rule_proposals_legacy","typescape_rules_dashboard","typescape_promote_rule_proposal","typescape_decide_rule_proposal"],Fn=on({operation:"read"}),x0=new Map;function D_(n){return on({operation:"write",hasIdempotencyKey:n})}function wJ(n){return n.status===0||n.status===429||n.status>=500}function _J(n){return{repo_id:typeof n.repo_id==="string"&&n.repo_id.trim().length>0?n.repo_id.trim():null,review_id:typeof n.review_id==="string"&&n.review_id.trim().length>0?n.review_id.trim():null,file_path:typeof n.file_path==="string"&&n.file_path.trim().length>0?n.file_path.trim():null}}function bJ(n,i){if(n.repo_id)return`/repos/${encodeURIComponent(n.repo_id)}/steering-pack?${i}`;return`/sessions/${encodeURIComponent(n.review_id)}/steering-pack?${i}`}function J_(n,i){let $=hl(n.freshness.fetched_at);return{...i,cache_status:$.status,cache_age_seconds:$.age_seconds,cache_compiled_hash:n.compiled_hash,...$.warning?{warnings:[{code:"cached_rules",message:$.warning}],cache_warning:$.warning}:{}}}function h0(n){if(!n||typeof n!=="object"||Array.isArray(n))return;let i=n.request_id;return typeof i==="string"?i:void 0}function C0(n){let i=n.compiledHash===void 0?null:n.compiledHash;return{rules:n.rules,compiled_hash:i,freshness:n.freshness,...n.requestId?{request_id:n.requestId}:{},...n.cacheMetadata??{}}}function XJ(n){if(!Array.isArray(n))return[];return n.filter((i)=>typeof i==="object"&&i!==null&&!Array.isArray(i))}function p8(n){if(!n||typeof n!=="object"||Array.isArray(n))return{latest_rule_session_updated_at:null,contributing_session_count:0,total_rule_count:0};let i=n;return{latest_rule_session_updated_at:typeof i.latest_rule_session_updated_at==="string"?i.latest_rule_session_updated_at:null,contributing_session_count:typeof i.contributing_session_count==="number"&&Number.isFinite(i.contributing_session_count)?i.contributing_session_count:0,total_rule_count:typeof i.total_rule_count==="number"&&Number.isFinite(i.total_rule_count)?i.total_rule_count:0}}function a8(n){if(!n||typeof n!=="object"||Array.isArray(n))return{};let i={};for(let[$,g]of Object.entries(n))if(typeof g==="string"&&g.length>0)i[$]=g;return i}function GJ(n,i,$){try{return _n(n)}catch{throw new D(502,"invalid_upstream_response",$,i)}}function UJ(n){let i=new URLSearchParams({format:n.format}),$=Object.entries(n.contentProperties).sort(([g],[v])=>g.localeCompare(v));for(let[g,v]of $)i.set(g,v);return`/rules?${i.toString()}`}async function s8(n){let i=await n.api.get(`/reviews/${encodeURIComponent(n.reviewId)}`),$=GJ(i.body,i.requestId,"Review detail response was not an object"),g=a8($.properties),v=typeof $.repo_id==="string"&&$.repo_id.length>0?$.repo_id:null,w=typeof $.file_path==="string"&&$.file_path.length>0?$.file_path:null,_=n.filePath??w;if(v)g.repo_id=v;if(_)g.file_path=_;return{reviewId:n.reviewId,repoId:v,filePath:_,contentProperties:g}}async function kJ(n){let i=new URLSearchParams({format:"text.v1"}),$=new URLSearchParams({format:"prompt_fragment.v1"});if(n.scope.file_path)i.set("file_path",n.scope.file_path),$.set("file_path",n.scope.file_path);if(n.policySnapshotId)i.set("policy_snapshot_id",n.policySnapshotId),$.set("policy_snapshot_id",n.policySnapshotId);if(n.tokenBudget!==void 0&&n.tokenBudget!==null)$.set("token_budget",String(n.tokenBudget));let[g,v]=await Promise.all([n.api.getText(bJ(n.scope,i)),n.api.get(bJ(n.scope,$))]),w=c0(v.body),_=P0(w),U=K0({scope:n.scope,rules:[],plain_text_bundle:g.body,freshness:{latest_rule_session_updated_at:null,contributing_session_count:0,total_rule_count:_.length},compiled_hash:typeof w.compiled_hash==="string"?w.compiled_hash:void 0,fetched_at:new Date().toISOString(),renderings:{text:g.body,json_payload:w,structured_payload:_}});return x0.set(g_(n.scope),U),{text:g.body,normalizedBody:w,structuredPayload:C0({rules:_,compiledHash:typeof w.compiled_hash==="string"?w.compiled_hash:null,freshness:{latest_rule_session_updated_at:null,contributing_session_count:0,total_rule_count:_.length},requestId:h0(w)})}}async function lJ(n){let i=await s8({api:n.api,reviewId:n.reviewId,filePath:n.filePath}),[$,g]=await Promise.all([n.api.getText(UJ({format:"text",contentProperties:i.contentProperties})),n.api.get(UJ({format:"json",contentProperties:i.contentProperties}))]),v=GJ(g.body,g.requestId,"Rules response payload was not an object"),w=XJ(v.rules),_=p8(v.freshness),U=h0(v),k=U===void 0?g.requestId:U,l=typeof v.compiled_hash==="string"?v.compiled_hash:null,J={...v,prompt_fragment:$.body,request_id:k},Q=C0({rules:w,compiledHash:l,freshness:_,requestId:k}),j=K0({scope:{repo_id:i.repoId,review_id:i.reviewId,file_path:i.filePath},rules:[],plain_text_bundle:$.body,freshness:_,compiled_hash:l??void 0,fetched_at:new Date().toISOString(),renderings:{text:$.body,json_payload:J,structured_payload:w}});return x0.set(g_({repo_id:i.repoId,review_id:i.reviewId,file_path:i.filePath}),j),{text:$.body,normalizedBody:J,structuredPayload:Q}}function DJ(n,i){let $=x0.get(g_(n));if(!$)return null;if(i==="text")return J_($,{text:$.plain_text_bundle,format:"text",cached:!0});if(i==="structured"){let v=XJ($.renderings?.structured_payload);return J_($,{...C0({rules:v,compiledHash:$.compiled_hash,freshness:$.freshness,requestId:h0($.renderings?.json_payload)}),cached:!0})}if(i==="prompt_fragment"){let v=$.renderings?.json_payload;if(v&&typeof v==="object"&&!Array.isArray(v))return J_($,{...v,non_authoritative:!0,compatibility_only:!0,cached:!0});return null}let g=$.renderings?.json_payload;if(!g||typeof g!=="object"||Array.isArray(g))return null;return J_($,{...g,cached:!0})}var nY={type:"object",properties:{repo_id:{type:"string",description:"Repository identifier"},review_id:{type:"string",description:"Review identifier. Use for upload-backed reviews or when repo_id is not known."},policy_snapshot_id:{type:"string",description:"Optional policy snapshot ID used to compile rules context"},file_path:{type:"string",description:"Optional file path to scope rules"},path:{type:"string",description:"Alias for file_path. If both are provided, file_path takes precedence."},format:{type:"string",enum:["text","structured","prompt_fragment"],description:'Output format: "text" returns the canonical plain-text rule bundle, "structured" returns governed JSON rules (authoritative), and "prompt_fragment" returns a compatibility prompt-shaped text view. Default: text.'},token_budget:{type:"number",description:"Maximum token count for prompt_fragment format (100-10000, default 2000)",minimum:100,maximum:1e4}}},vY={type:"object",properties:{source_type:{type:"string",enum:["thread","doc_review","slack","email","interview","automation","admin"],description:"How this rule was discovered"},source_ref:{type:"string",description:"Stable source reference (URL, message ID, document path). Required for non-thread source types."},source_excerpt:{type:"string",description:"Optional short excerpt from source context"},proposed_type:{type:"string",enum:["claim","knowledge","voice","constraint","steering_rule"],description:"Proposed rule type (default: constraint for non-thread rule proposals)"},proposed_content:{type:"object",additionalProperties:!0,description:"Structured proposed content payload"},related_item_ids:{type:"array",items:{type:"string",pattern:"^gci_[0-9A-HJKMNP-TV-Z]{26}$"},description:"Related rule proposal IDs (gci_<26-char ULID>)"},title:{type:"string",description:"Backward-compatible alias used to populate proposed_content.title"},content:{type:"string",description:"Backward-compatible alias used to populate proposed_content.content"},rationale:{type:"string",description:"Why this should become a rule"},target_document:{type:"string",description:"Target canonical document path"},priority:{type:"string",enum:["low","medium","high","critical"],description:"Priority level (default: medium)"},finding_id:{type:"string",description:"Source finding ID (required when source_type is 'thread')"},tags:{type:"array",items:{type:"string"},description:"Classification tags"}},required:["source_type"]},iY={type:"object",properties:{status:{type:"string",enum:["pending","in_review","needs_revision","approved","rejected","published"],description:"Filter by lifecycle status (default: pending)"},limit:{type:"number",default:20,description:"Maximum number of results"}}},$Y={type:"object",properties:{status:{type:"string",enum:["proposed","accepted","rejected","superseded"],description:"Filter by status (default: all)"},kind:{type:"string",enum:["terminology","style","structure","claim_policy","evidence_policy","voice","constraint"],description:"Filter by rule kind"},limit:{type:"number",default:20,description:"Maximum number of results"}}},gY={type:"object",properties:{repo_id:{type:"string",description:"Repository identifier for rules-pack lookup."},review_id:{type:"string",description:"Review identifier for rules-pack lookup when repo is unknown."},file_path:{type:"string",description:"Optional file path scope for rule selection."},path:{type:"string",description:"Alias for file_path."},format:{type:"string",enum:["text","prompt","structured","json"],description:'Output format. "text" returns the canonical plain-text rule bundle, "prompt" is a compatibility alias, "structured" returns normalized rules, and "json" returns the raw pack payload.'},token_budget:{type:"number",description:"Optional token budget for prompt_fragment generation."}}},wY={type:"object",properties:{content:{type:"string",description:"Markdown content for an optional server-side advisory pass against applicable rules (max 1MB)."},properties:{type:"object",additionalProperties:{type:"string"},description:"Content properties for rule matching (flat key-value map, e.g. { doc_type: 'procedure' }). Use the same context the agent will reason against."},collection_id:{type:"string",description:"Optional collection ID to scope rule matching."},idempotency_key:{type:"string",description:"Idempotency key for safe retries (optional)."}},required:["content"]},_Y={type:"object",properties:{content:{type:"string",description:"Rule markdown content to import (max 512KB). Each list item is a rule block."},title:{type:"string",description:"Human-readable title for the imported rule review (optional)."},applicability:{type:"object",additionalProperties:{type:"string"},description:"Applicability selector for rule matching (flat key-value map, optional)."},provenance:{type:"object",properties:{source:{type:"string",enum:["manual","findings","external"],description:"Import source classification."},source_review_id:{type:"string",description:"Source review ID when imported from findings."},source_label:{type:"string",description:"Human-readable source label."}},description:"Provenance metadata for finding-seeded imports (optional)."},preview:{type:"boolean",description:"If true, returns a preview without creating a review (dry run). Default: false."},idempotency_key:{type:"string",description:"Idempotency key for safe retries (optional)."}},required:["content"]},bY={type:"object",properties:{include_degraded:{type:"boolean",default:!0,description:"Include degraded rule details"}}},UY={type:"object",properties:{gci_id:{type:"string",description:"Rule proposal ID to promote (must be in 'approved' status)"},repo_id:{type:"string",description:"Repository ID where the rule proposal should be created"},kind:{type:"string",enum:["terminology","style","structure","claim_policy","evidence_policy","voice","constraint"],description:"Rule kind for the proposal"},reviewer_notes:{type:"string",description:"Optional reviewer notes recorded on publish"}},required:["gci_id","repo_id"]},kY={type:"object",properties:{proposal_id:{type:"string",description:"Proposal ID to act on"},decision:{type:"string",enum:["accept","reject","deprecate"],description:"Decision to apply"},notes:{type:"string",description:"Decision rationale. Alias for reviewer_notes/reason for compatibility."},reviewer_notes:{type:"string",description:"Decision rationale for accept/reject actions"},reason:{type:"string",description:"Required reason for deprecate action"}},required:["proposal_id","decision"]};function tJ(n,i,$){n.register({name:"typescape_get_rules",description:'Canonical agent read path for repository or review context. Fetch this before reasoning about a draft or reconciling reviewer feedback. format="text" returns the canonical plain-text rule bundle. format="structured" returns the deterministic rulepack with compiled hash and freshness metadata. format="prompt_fragment" returns a compatibility prompt-shaped text view. Requires rules to be enabled.',inputSchema:nY},async(w)=>{let _=w;try{if(!(await $.getCapabilities()).rules)return $.featureDisabledResult("rules")}catch(u){if(u instanceof D)return G(u);throw u}let U=typeof _.repo_id==="string"&&_.repo_id.length>0,k=typeof _.review_id==="string"&&_.review_id.length>0;if(!U&&!k)return G(new D(400,"missing_param","Missing required parameter: repo_id or review_id","local"));let l=_.format==="structured"?"structured":_.format==="prompt_fragment"?"prompt_fragment":"text",J=typeof _.file_path==="string"&&_.file_path.trim().length>0?_.file_path.trim():typeof _.path==="string"&&_.path.trim().length>0?_.path.trim():null,Q=(u)=>{let W=new URLSearchParams({format:u});if(J)W.set("file_path",J);if(_.policy_snapshot_id)W.set("policy_snapshot_id",_.policy_snapshot_id);if(_.token_budget!==void 0&&_.token_budget!==null)W.set("token_budget",String(_.token_budget));return W},j=_J({repo_id:U?_.repo_id:void 0,review_id:k?_.review_id:void 0,file_path:J});try{let u=k&&!U?await lJ({api:i,reviewId:_.review_id,filePath:J}):await kJ({api:i,scope:j,tokenBudget:_.token_budget,policySnapshotId:_.policy_snapshot_id});if(l==="text")return H({text:u.text,format:"text"},u.normalizedBody.request_id??"missing_request_id",{retry:Fn});let W={...u.normalizedBody};if(W.prompt_fragment&&l==="prompt_fragment")W.non_authoritative=!0,W.compatibility_only=!0;if(l==="structured")W.rules=u.structuredPayload.rules,W.compiled_hash=u.structuredPayload.compiled_hash,W.freshness=u.structuredPayload.freshness;return H(W,W.request_id??"missing_request_id",{retry:Fn})}catch(u){if(u instanceof D){if(wJ(u)){let W=DJ(j,l);if(W)return H(W,u.requestId,{retry:Fn})}return G(u,{operation:"read"})}throw u}}),n.register({name:"typescape_rules_pack",description:"Compatibility-only alias for typescape_get_rules. Prefer typescape_get_rules in new harnesses and workflows.",inputSchema:gY},async(w)=>{let _=w;try{if(!(await $.getCapabilities()).rules)return $.featureDisabledResult("rules")}catch(j){if(j instanceof D)return G(j);throw j}let U=typeof _.repo_id==="string"?_.repo_id.trim():"",k=typeof _.review_id==="string"?_.review_id.trim():"";if(!U&&!k)return G(new D(400,"missing_param","Missing required parameter: repo_id or review_id","local"));let l=_.format??"text",J=typeof _.file_path==="string"&&_.file_path.trim().length>0?_.file_path.trim():typeof _.path==="string"&&_.path.trim().length>0?_.path.trim():null,Q=_J({repo_id:U,review_id:k,file_path:J});try{let j=k&&!U?await lJ({api:i,reviewId:k,filePath:J}):await kJ({api:i,scope:Q,tokenBudget:_.token_budget});if(l==="text")return H({text:j.text,format:"text"},j.normalizedBody.request_id??"missing_request_id",{retry:Fn});let u=j.normalizedBody;if(l==="structured")return H(j.structuredPayload,u.request_id??"missing_request_id",{retry:Fn});if(l==="json")return H(u,u.request_id??"missing_request_id",{retry:Fn});let W=typeof u.prompt==="string"?u.prompt:typeof u.prompt_fragment==="string"?u.prompt_fragment:null;if(!W)throw new D(502,"invalid_upstream_response","Rules pack response is missing prompt content",u.request_id??"missing_request_id");return H({prompt:W,prompt_fragment:W,compatibility_only:!0},u.request_id??"missing_request_id",{retry:Fn})}catch(j){if(j instanceof D){let u=l==="prompt"?"prompt_fragment":l;if(wJ(j)){let W=DJ(Q,u);if(W)return H(W,j.requestId,{retry:Fn})}return G(j,{operation:"read"})}throw j}}),n.register({name:"typescape_check_content",description:"Optional server-side advisory pass for markdown content. Do not treat this as a complete review or substitute for agent reasoning. Canonical loop: typescape_get_rules -> read content -> typescape_create_finding. Requires rules to be enabled.",inputSchema:wY},async(w)=>{let _=w;try{if(!(await $.getCapabilities()).rules)return $.featureDisabledResult("rules")}catch(k){if(k instanceof D)return G(k);throw k}if(!_.content||_.content.length===0)return G(new D(400,"missing_param","Missing required parameter: content","local"));let U={content:_.content};if(_.properties!==void 0)U.properties=_.properties;if(_.collection_id!==void 0)U.collection_id=_.collection_id;if(_.idempotency_key!==void 0)U.idempotency_key=_.idempotency_key;try{let k=await i.post("/rules/check",{body:U});return H(k.body,k.requestId,{retry:Fn})}catch(k){if(k instanceof D)return G(k,{operation:"read"});throw k}}),n.register({name:"typescape_import_rules",description:"Import rules from markdown content, creating a draft rule review. Each list item in the markdown becomes a rule block. Set preview=true for a dry run. Returns the review ID and parsed rules. Requires rules to be enabled.",inputSchema:_Y},async(w)=>{let _=w;try{if(!(await $.getCapabilities()).rules)return $.featureDisabledResult("rules")}catch(l){if(l instanceof D)return G(l);throw l}if(!_.content||_.content.length===0)return G(new D(400,"missing_param","Missing required parameter: content","local"));let U={content:_.content};if(_.title!==void 0)U.title=_.title;if(_.applicability!==void 0)U.applicability=_.applicability;if(_.provenance!==void 0)U.provenance=_.provenance;if(_.preview!==void 0)U.preview=_.preview;if(_.idempotency_key!==void 0)U.idempotency_key=_.idempotency_key;let k={};if(_.idempotency_key)k["Idempotency-Key"]=_.idempotency_key;try{let l=await i.post("/rules/import",{body:U,headers:k});return H(l.body,l.requestId,{retry:D_(Boolean(_.idempotency_key))})}catch(l){if(l instanceof D)return G(l,{operation:"write",hasIdempotencyKey:Boolean(_.idempotency_key)});throw l}});let g=/^gci_[0-9A-HJKMNP-TV-Z]{26}$/;n.register({name:"typescape_propose_rule",description:"Create a rule proposal from observed patterns, thread feedback, or automated analysis. Rule proposals flow through the rules governance pipeline. Requires features.rules.",inputSchema:vY},async(w)=>{let _=w;try{if(!(await $.getCapabilities()).rules)return $.featureDisabledResult("rules")}catch(k){if(k instanceof D)return G(k);throw k}if(!_.source_type)return G(new D(400,"missing_param","Missing required parameter: source_type","local"));if(_.source_type==="thread"&&!_.finding_id)return G(new D(422,"invalid_argument","finding_id is required when source_type is 'thread'","local"));if(_.related_item_ids){let k=_.related_item_ids.findIndex((l)=>!g.test(l));if(k>=0)return G(new D(422,"invalid_argument",`related_item_ids[${k}] must be a valid rule proposal id (gci_<26-char ULID>)`,"local"))}let U={};if(_.proposed_content!==void 0){if(typeof _.proposed_content!=="object"||_.proposed_content===null||Array.isArray(_.proposed_content))return G(new D(422,"invalid_argument","proposed_content must be an object when provided","local"));Object.assign(U,_.proposed_content)}if(_.title!==void 0&&U.title===void 0)U.title=_.title;if(_.content!==void 0&&U.content===void 0)U.content=_.content;if(_.target_document!==void 0&&U.target_document===void 0)U.target_document=_.target_document;if(_.priority!==void 0&&U.priority===void 0)U.priority=_.priority;if(_.tags!==void 0&&U.tags===void 0)U.tags=_.tags;try{let k=_.source_type==="thread"?"/steering/gcis/from-thread":"/steering/gcis",l=_.source_type==="thread"?{finding_id:_.finding_id,..._.proposed_type?{proposed_type:_.proposed_type}:{},..._.rationale!==void 0?{rationale:_.rationale}:{},...Object.keys(U).length>0?{proposed_content:U}:{}}:{source_type:_.source_type,..._.source_ref?{source_ref:_.source_ref}:{},..._.proposed_type?{proposed_type:_.proposed_type}:{},...Object.keys(U).length>0?{proposed_content:U}:{},..._.tags!==void 0?{tags:_.tags}:{},..._.source_excerpt!==void 0?{source_excerpt:_.source_excerpt}:{},..._.rationale!==void 0?{rationale:_.rationale}:{},..._.related_item_ids!==void 0?{related_item_ids:_.related_item_ids}:{}},J=await i.post(k,{body:l});return H(_n(J.body),J.requestId,{retry:D_(!1)})}catch(k){if(k instanceof D)return G(k,{operation:"write"});throw k}}),n.register({name:"typescape_list_rule_proposals",description:"Canonical rule proposal listing surface. Use to monitor the rules governance pipeline. Requires features.rules.",inputSchema:iY},async(w)=>{let _=w;try{if(!(await $.getCapabilities()).rules)return $.featureDisabledResult("rules")}catch(U){if(U instanceof D)return G(U);throw U}try{let U={};if(_.status)U.status=_.status;if(_.limit!==void 0&&_.limit!==null)U.limit=String(_.limit);let k=new URLSearchParams(U).toString(),l=await i.get(`/steering/gcis${k?`?${k}`:""}`);return H(b_(l.body),l.requestId,{retry:Fn})}catch(U){if(U instanceof D)return G(U,{operation:"read"});throw U}}),n.register({name:"typescape_list_rule_proposals_legacy",description:"Compatibility-only legacy proposal listing surface. Use typescape_list_rule_proposals in new harnesses. Requires features.rules.",inputSchema:$Y},async(w)=>{let _=w;try{if(!(await $.getCapabilities()).rules)return $.featureDisabledResult("rules")}catch(U){if(U instanceof D)return G(U);throw U}try{let U={};if(_.status)U.status=_.status;if(_.kind)U.kind=_.kind;if(_.limit!==void 0&&_.limit!==null)U.limit=String(_.limit);let k=new URLSearchParams(U).toString(),l=await i.get(`/steering/proposals${k?`?${k}`:""}`);return H(l.body,l.requestId,{retry:Fn})}catch(U){if(U instanceof D)return G(U,{operation:"read"});throw U}}),n.register({name:"typescape_rules_dashboard",description:"Get aggregate rules health metrics: active rule count, average health, degraded rules. Requires features.rules.",inputSchema:bY},async(w)=>{let _=w;try{if(!(await $.getCapabilities()).rules)return $.featureDisabledResult("rules")}catch(U){if(U instanceof D)return G(U);throw U}try{let U=_.include_degraded!==!1,k,l;try{let J=await i.get("/steering/dashboard/summary");k=J.requestId,l={..._n(J.body)}}catch(J){if(!(J instanceof D))throw J;let Q=await i.get("/steering/dashboard/rules?limit=1&offset=0"),j=_n(Q.body),u=typeof j.total==="number"?j.total:typeof j.total_rules==="number"?j.total_rules:0;k=Q.requestId,l={summary_unavailable:{code:J.code,message:J.message,request_id:J.requestId},rule_health:{total_rules:u}}}if(U){let J=await i.get("/steering/dashboard/degradation"),Q=_n(J.body),j=Array.isArray(Q.degraded_rules)?Q.degraded_rules:Array.isArray(Q.data)?Q.data:null;if(!Array.isArray(j))throw new D(502,"invalid_upstream_response","degraded_rules must be an array",J.requestId);l.degraded_rules=j}return H(l,k,{retry:Fn})}catch(U){if(U instanceof D)return G(U,{operation:"read"});throw U}}),n.register({name:"typescape_promote_rule_proposal",description:"Convert an approved rule proposal into a rule for operator acceptance. Requires features.rules.",inputSchema:UY},async(w)=>{let _=w;try{if(!(await $.getCapabilities()).rules)return $.featureDisabledResult("rules")}catch(k){if(k instanceof D)return G(k);throw k}if(!_.gci_id)return G(new D(400,"missing_param","Missing required parameter: gci_id","local"));let U={};if(_.kind!==void 0)U.kind=_.kind;if(_.scope!==void 0)U.scope=_.scope;if(_.content_override!==void 0)U.content_override=_.content_override;try{let k=await i.post(`/steering/gcis/${encodeURIComponent(_.gci_id)}/publish`,{body:U});return H(k.body,k.requestId,{retry:D_(!1)})}catch(k){if(k instanceof D)return G(k,{operation:"write"});throw k}});let v=async(w)=>{let _=w;try{if(!(await $.getCapabilities()).rules)return $.featureDisabledResult("rules")}catch(J){if(J instanceof D)return G(J);throw J}if(!_.proposal_id)return G(new D(400,"missing_param","Missing required parameter: proposal_id","local"));if(!_.decision)return G(new D(400,"missing_param","Missing required parameter: decision","local"));if(_.decision==="reject"&&!_.notes)return G(new D(422,"invalid_argument","notes is required when decision is 'reject'","local"));let k={accept:"activate",reject:"reject",deprecate:"deprecate"}[_.decision],l={};if(_.notes!==void 0)l.notes=_.notes;try{let J=await i.post(`/steering/proposals/${encodeURIComponent(_.proposal_id)}/${k}`,{body:l});return H(J.body,J.requestId,{retry:D_(!1)})}catch(J){if(J instanceof D)return G(J,{operation:"write"});throw J}};n.register({name:"typescape_decide_rule_proposal",description:"Accept, reject, or deprecate a rule proposal. Accepting activates the rule immediately. Requires features.rules.",inputSchema:kY},async(w)=>{return v(w)})}var QJ=["typescape_list_repos","typescape_connect_repo","typescape_repo_branches","typescape_upload_reviewer_asset"];function lY(n){switch(n){case"image/png":return"png";case"image/jpeg":return"jpg";case"image/gif":return"gif";case"image/webp":return"webp";default:return"bin"}}var DY=5242880,JY=new Set(["image/png","image/jpeg","image/gif","image/webp"]);function WJ(n,i){let $={name:"typescape_list_repos",description:"List connected repositories in the workspace. Returns paginated list of repos with their origin URLs and metadata.",inputSchema:{type:"object",properties:{include_archived:{type:"boolean",description:"Include archived repositories (default: false)"},limit:{type:"number",description:"Maximum repos to return (1-100, default: 50)"},cursor:{type:"string",description:"Pagination cursor from previous response"}}}};n.register($,async(_)=>{let U=_,k={};if(U.include_archived)k.include_archived="true";if(U.limit!==void 0)k.limit=String(U.limit);if(U.cursor)k.cursor=U.cursor;try{let l=await i.get("/repos",{query:k});return H(l.body,l.requestId)}catch(l){if(l instanceof D)return G(l);throw l}});let g={name:"typescape_connect_repo",description:"Connect a Git repository by its origin URL. If the URL is a GitHub repo and a GitHub App installation exists, it will be automatically linked for branch/file browsing.",inputSchema:{type:"object",properties:{origin_url:{type:"string",description:"Git remote URL (HTTPS or SSH), e.g. https://github.com/acme/docs"},display_name:{type:"string",description:"Human-readable display name (optional, auto-derived from URL)"}},required:["origin_url"]}};n.register(g,async(_)=>{let U=_;if(!U.origin_url)return G(new D(400,"missing_param","Missing required parameter: origin_url","local"));let k={origin_url:U.origin_url};if(U.display_name)k.display_name=U.display_name;try{let l=await i.post("/repos",{body:k});return H(l.body,l.requestId)}catch(l){if(l instanceof D)return G(l);throw l}});let v={name:"typescape_repo_branches",description:"List branches for a connected repository. Requires a GitHub App installation to be linked to the repo. Returns branch names and their head SHAs.",inputSchema:{type:"object",properties:{repo_id:{type:"string",description:"Repository ID (e.g. repo_abc123)"}},required:["repo_id"]}};n.register(v,async(_)=>{let U=_;if(!U.repo_id)return G(new D(400,"missing_param","Missing required parameter: repo_id","local"));try{let k=await i.get(`/repos/${encodeURIComponent(U.repo_id)}/branches`);return H(k.body,k.requestId)}catch(k){if(k instanceof D)return G(k);throw k}});let w={name:"typescape_upload_reviewer_asset",description:"Upload a reviewer asset (image) to a review. Accepts base64-encoded image data (PNG, JPEG, GIF, WebP). Maximum size: 5MB. For larger files, use the CLI or web UI.",inputSchema:{type:"object",properties:{review_id:{type:"string",description:"Review ID to upload the asset to"},base64_content:{type:"string",description:"Base64-encoded image data"},mime_type:{type:"string",enum:["image/png","image/jpeg","image/gif","image/webp"],description:"MIME type of the image"},alt_text:{type:"string",description:"Alt text for the image (optional)"},filename:{type:"string",description:"Original filename (optional)"}},required:["review_id","base64_content","mime_type"]}};n.register(w,async(_)=>{let U=_;if(!U.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));if(!U.base64_content)return G(new D(400,"missing_param","Missing required parameter: base64_content","local"));if(!U.mime_type)return G(new D(400,"missing_param","Missing required parameter: mime_type","local"));if(!JY.has(U.mime_type))return G(new D(415,"unsupported_media_type",`Unsupported MIME type "${U.mime_type}". Allowed: PNG, JPEG, GIF, WebP.`,"local"));if(!S0.test(U.base64_content))return G(new D(400,"invalid_base64","base64_content is not valid base64-encoded data","local"));let k;try{let Q=Buffer.from(U.base64_content,"base64");k=new Uint8Array(Q)}catch{return G(new D(400,"invalid_base64","Failed to decode base64_content","local"))}if(k.byteLength>DY){let Q=(k.byteLength/1048576).toFixed(1);return G(new D(413,"asset_too_large",`Image is ${Q}MB, exceeding the 5MB MCP limit. Use the CLI ("typescape asset upload") or web UI for larger files.`,"local"))}let l=new Blob([k],{type:U.mime_type}),J=new FormData;if(J.append("file",l,U.filename||`upload.${lY(U.mime_type)}`),J.append("mime_type",U.mime_type),U.alt_text)J.append("alt_text",U.alt_text);try{let Q=await i.postFormData(`/sessions/${encodeURIComponent(U.review_id)}/reviewer-assets`,J);return H(Q.body,Q.requestId)}catch(Q){if(Q instanceof D)return G(Q);throw Q}})}var YJ=["typescape_create_collection","typescape_add_review_to_collection"],XY={type:"object",properties:{name:{type:"string",description:"Collection name (1-100 characters, unique per tenant among non-archived collections)"},description:{type:"string",description:"Optional Markdown description (max 2000 characters)"},color:{type:"string",description:"Optional hex color (e.g., #12A594)"}},required:["name"]},GY={type:"object",properties:{collection_id:{type:"string",description:"Collection ID (e.g., col_01HXYZ...)"},review_id:{type:"string",description:"Review ID to add (opaque identifier)"}},required:["collection_id","review_id"]};function IJ(n,i,$){n.register({name:"typescape_create_collection",description:"Create a new collection to group related reviews. Requires collections_enabled feature flag. Returns the created collection with its ID.",inputSchema:XY},async(g)=>{let v=g;if(!v.name)return G(new D(400,"missing_param","Missing required parameter: name","local"));try{if(!(await $.getCapabilities()).collections_enabled)return $.featureDisabledResult("collections_enabled")}catch(_){if(_ instanceof D)return G(_);throw _}let w={name:v.name};if(v.description!==void 0)w.description=v.description;if(v.color!==void 0)w.color=v.color;try{let _=await i.post("/collections",{body:w});return H(_n(_.body),_.requestId)}catch(_){if(_ instanceof D)return G(_);throw _}}),n.register({name:"typescape_add_review_to_collection",description:"Add a review to an existing collection. Idempotent: re-adding an already-present review is a no-op. Requires collections_enabled feature flag.",inputSchema:GY},async(g)=>{let v=g;if(!v.collection_id)return G(new D(400,"missing_param","Missing required parameter: collection_id","local"));if(!v.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));try{if(!(await $.getCapabilities()).collections_enabled)return $.featureDisabledResult("collections_enabled")}catch(w){if(w instanceof D)return G(w);throw w}try{let w=await i.post(`/collections/${encodeURIComponent(v.collection_id)}/sessions`,{body:{session_id:v.review_id}});return H(_n(w.body),w.requestId)}catch(w){if(w instanceof D)return G(w);throw w}})}var jJ={type:"object",properties:{artifact_kind:{type:"string",description:"Advisory artifact kind: recommendation, classification, contradiction, synthesis, proposal, or challenge"},kind:{type:"string",description:"Compatibility alias for artifact_kind"},target_type:{type:"string",enum:["review","finding","rule_review","rule_block","review_set"],description:"Type of entity this advisory targets"},target_id:{type:"string",description:"ID of the target entity (e.g., sess_01HXYZ... or finding ID)"},review_id:{type:"string",description:"Review scope for this advisory (optional; enables review-scoped queries)"},body_md:{type:"string",description:"Advisory body in Markdown (required, max 64KB)"},body:{type:"string",description:"Compatibility alias for body_md"},source_type:{type:"string",enum:["human","agent"],description:"Provenance source type (default: agent)"},source_label:{type:"string",description:"Label identifying the source (e.g., agent name or tool)"},submitted_by:{type:"string",description:"Identity of the submitter (agent ID or user ID)"},confidence:{type:"number",description:"Confidence score between 0 and 1 (optional)"},severity_hint:{type:"string",description:"Severity hint: suggestion, needs_changes, blocking (optional)"},structured_data:{type:"object",description:"Machine-readable structured data payload (optional)"},evidence_refs:{type:"array",items:{type:"string"},description:"References to supporting evidence (optional)"},basis:{type:"object",properties:{export_sha256:{type:"string",description:"SHA256 of export used as basis"},rulepack_sha256:{type:"string",description:"SHA256 of rulepack used"},source_content_sha256:{type:"string",description:"SHA256 of source content"},basis_review_ids:{type:"array",items:{type:"string"},description:"Review IDs used as basis"},basis_finding_ids:{type:"array",items:{type:"string"},description:"Finding IDs used as basis"}},description:"Deterministic inputs the advisory was derived from (optional)"},idempotency_key:{type:"string",description:"Idempotency key for safe retries (optional)"}},required:["artifact_kind","target_type","target_id","body_md","source_label","submitted_by"]},uJ={type:"object",properties:{review_id:{type:"string",description:"Filter by review ID (optional)"},target_type:{type:"string",enum:["review","finding","rule_review","rule_block","review_set"],description:"Filter by target type (optional)"},target_id:{type:"string",description:"Filter by target ID (optional)"},artifact_kind:{type:"string",description:"Filter by artifact kind (optional)"},status:{type:"string",enum:["submitted","adopted","rejected","superseded"],description:"Filter by status (optional)"},submitted_by:{type:"string",description:"Filter by submitter identity (optional)"},limit:{type:"number",description:"Maximum items to return (1-200, default 50)"},offset:{type:"number",description:"Pagination offset (default 0)"}},required:[]},HJ={type:"object",properties:{artifact_id:{type:"string",description:"Advisory artifact ID to retrieve"}},required:["artifact_id"]},VJ={type:"object",properties:{artifact_id:{type:"string",description:"Advisory artifact ID to adopt"},rationale:{type:"string",description:"Rationale for adoption (optional)"},adoption_review_id:{type:"string",description:"Review ID associated with adoption (optional)"},adoption_proposed_change_id:{type:"string",description:"Proposed change ID associated with adoption (optional)"}},required:["artifact_id"]},fJ={type:"object",properties:{artifact_id:{type:"string",description:"Advisory artifact ID to reject"},rejection_reason:{type:"string",description:"Reason for rejection (required)"}},required:["artifact_id","rejection_reason"]};var LJ=["typescape_submit_advisory","typescape_list_advisories","typescape_get_advisory","typescape_adopt_advisory","typescape_reject_advisory"],qJ=on({operation:"read"});function E0(n){return on({operation:"write",hasIdempotencyKey:n})}function tY(n){if(!n)return;return{...n,export_sha256:n.export_sha256??n.export_hash,rulepack_sha256:n.rulepack_sha256??n.rulepack_hash,source_content_sha256:n.source_content_sha256??n.source_hash}}function KJ(n,i){n.register({name:"typescape_submit_advisory",description:"Submit an advisory artifact (recommendation, classification, challenge, etc.) targeting a review, finding, or rule entity. Advisory artifacts are non-authoritative and require explicit adoption. Supports idempotency keys for safe retries.",inputSchema:jJ},async($)=>{let g=$,v=g.artifact_kind??g.kind,w=g.body_md??g.body,_=tY(g.basis);if(!v)return G(new D(400,"missing_param","Missing required parameter: artifact_kind","local"));if(!g.target_type)return G(new D(400,"missing_param","Missing required parameter: target_type","local"));if(!g.target_id)return G(new D(400,"missing_param","Missing required parameter: target_id","local"));if(!w)return G(new D(400,"missing_param","Missing required parameter: body_md","local"));if(!g.source_label)return G(new D(400,"missing_param","Missing required parameter: source_label","local"));if(!g.submitted_by)return G(new D(400,"missing_param","Missing required parameter: submitted_by","local"));let U={artifact_kind:v,target:{target_type:g.target_type,target_id:g.target_id},provenance:{source_type:g.source_type??"agent",source_label:g.source_label,submitted_by:g.submitted_by,submitted_at:new Date().toISOString()},payload:{body_md:w,...g.confidence!==void 0&&{confidence:g.confidence},...g.severity_hint!==void 0&&{severity_hint:g.severity_hint},...g.structured_data!==void 0&&{structured_data:g.structured_data},...g.evidence_refs!==void 0&&{evidence_refs:g.evidence_refs}}};if(g.review_id)U.review_id=g.review_id;if(_)U.basis=_;if(g.idempotency_key)U.idempotency_key=g.idempotency_key;let k={};if(g.idempotency_key)k["Idempotency-Key"]=g.idempotency_key;try{let l=await i.post("/advisory-artifacts",{body:U,headers:k});return H(l.body,l.requestId,{retry:E0(Boolean(g.idempotency_key))})}catch(l){if(l instanceof D)return G(l,{operation:"write",hasIdempotencyKey:Boolean(g.idempotency_key)});throw l}}),n.register({name:"typescape_list_advisories",description:"List advisory artifacts with optional filters. Filter by review, target, kind, status, or submitter.",inputSchema:uJ},async($)=>{let g=$,v={};if(g.review_id)v.review_id=g.review_id;if(g.target_type)v.target_type=g.target_type;if(g.target_id)v.target_id=g.target_id;if(g.artifact_kind)v.artifact_kind=g.artifact_kind;if(g.status)v.status=g.status;if(g.submitted_by)v.submitted_by=g.submitted_by;if(g.limit!==void 0)v.limit=String(g.limit);if(g.offset!==void 0)v.offset=String(g.offset);try{let w=await i.get("/advisory-artifacts",{query:v});return H(w.body,w.requestId,{retry:qJ})}catch(w){if(w instanceof D)return G(w,{operation:"read"});throw w}}),n.register({name:"typescape_get_advisory",description:"Get a single advisory artifact by ID. Returns full artifact with provenance, payload, and adoption state.",inputSchema:HJ},async($)=>{let g=$;if(!g.artifact_id)return G(new D(400,"missing_param","Missing required parameter: artifact_id","local"));try{let v=await i.get(`/advisory-artifacts/${encodeURIComponent(g.artifact_id)}`);return H(v.body,v.requestId,{retry:qJ})}catch(v){if(v instanceof D)return G(v,{operation:"read"});throw v}}),n.register({name:"typescape_adopt_advisory",description:"Adopt an advisory artifact, transitioning it from 'submitted' to 'adopted'. "+"Adoption is an explicit act — advisory artifacts never silently become authoritative.",inputSchema:VJ},async($)=>{let g=$;if(!g.artifact_id)return G(new D(400,"missing_param","Missing required parameter: artifact_id","local"));let v={};if(g.rationale)v.rationale=g.rationale;if(g.adoption_review_id)v.adoption_review_id=g.adoption_review_id;if(g.adoption_proposed_change_id)v.adoption_proposed_change_id=g.adoption_proposed_change_id;try{let w=await i.post(`/advisory-artifacts/${encodeURIComponent(g.artifact_id)}/adopt`,{body:v});return H(w.body,w.requestId,{retry:E0(!1)})}catch(w){if(w instanceof D)return G(w,{operation:"write"});throw w}}),n.register({name:"typescape_reject_advisory",description:"Reject an advisory artifact with a reason. Transitions from 'submitted' to 'rejected'. Terminal state.",inputSchema:fJ},async($)=>{let g=$;if(!g.artifact_id)return G(new D(400,"missing_param","Missing required parameter: artifact_id","local"));if(!g.rejection_reason)return G(new D(400,"missing_param","Missing required parameter: rejection_reason","local"));let v={rejection_reason:g.rejection_reason};try{let w=await i.post(`/advisory-artifacts/${encodeURIComponent(g.artifact_id)}/reject`,{body:v});return H(w.body,w.requestId,{retry:E0(!1)})}catch(w){if(w instanceof D)return G(w,{operation:"write"});throw w}})}var OJ={type:"object",properties:{artifact_id:{type:"string",description:"Filter by advisory artifact ID (optional)"},action_type:{type:"string",enum:["advisory_submit","advisory_adopt","advisory_reject","advisory_supersede","revision_recommend"],description:"Filter by action type (optional)"},actor_id:{type:"string",description:"Filter by actor ID (optional)"},actor_type:{type:"string",enum:["agent","human","system"],description:"Filter by actor type (optional)"},review_id:{type:"string",description:"Filter by review scope (optional)"},limit:{type:"number",description:"Maximum items to return (1-200, default 50)"},offset:{type:"number",description:"Pagination offset (default 0)"}},required:[]},BJ={type:"object",properties:{receipt_id:{type:"string",description:"Action receipt ID to retrieve"}},required:["receipt_id"]},FJ={type:"object",properties:{artifact_id:{type:"string",description:"Advisory artifact ID to list receipts for"}},required:["artifact_id"]};var NJ=["typescape_list_action_receipts","typescape_get_action_receipt","typescape_list_artifact_receipts"],o0=on({operation:"read"});function cJ(n,i){n.register({name:"typescape_list_action_receipts",description:"List action receipts with optional filters. Filter by artifact, action type, actor, or review scope. Receipts capture basis attestation and tool metadata for advisory operations.",inputSchema:OJ},async($)=>{let g=$,v={};if(g.artifact_id)v.artifact_id=g.artifact_id;if(g.action_type)v.action_type=g.action_type;if(g.actor_id)v.actor_id=g.actor_id;if(g.actor_type)v.actor_type=g.actor_type;if(g.review_id)v.review_id=g.review_id;if(g.limit!==void 0)v.limit=String(g.limit);if(g.offset!==void 0)v.offset=String(g.offset);try{let w=await i.get("/action-receipts",{query:v});return H(w.body,w.requestId,{retry:o0})}catch(w){if(w instanceof D)return G(w,{operation:"read"});throw w}}),n.register({name:"typescape_get_action_receipt",description:"Get a single action receipt by ID. Returns full receipt with basis snapshot, tool metadata, and result summary.",inputSchema:BJ},async($)=>{let g=$;if(!g.receipt_id)return G(new D(400,"missing_param","Missing required parameter: receipt_id","local"));try{let v=await i.get(`/action-receipts/${encodeURIComponent(g.receipt_id)}`);return H(v.body,v.requestId,{retry:o0})}catch(v){if(v instanceof D)return G(v,{operation:"read"});throw v}}),n.register({name:"typescape_list_artifact_receipts",description:"List all action receipts for a specific advisory artifact. Shows the full execution journal for an artifact's lifecycle.",inputSchema:FJ},async($)=>{let g=$;if(!g.artifact_id)return G(new D(400,"missing_param","Missing required parameter: artifact_id","local"));try{let v=await i.get(`/advisory-artifacts/${encodeURIComponent(g.artifact_id)}/receipts`);return H(v.body,v.requestId,{retry:o0})}catch(v){if(v instanceof D)return G(v,{operation:"read"});throw v}})}var PJ=["typescape_create_project","typescape_list_projects","typescape_get_project","typescape_update_project"],QY={type:"object",properties:{name:{type:"string",description:"Project name (required, 1-200 characters)"},description:{type:"string",description:"Optional project description (Markdown, max 2000 characters)"}},required:["name"]},WY={type:"object",properties:{limit:{type:"number",description:"Maximum number of projects to return (default: 20, max: 100)"},cursor:{type:"string",description:"Pagination cursor from a previous response"}}},YY={type:"object",properties:{project_id:{type:"string",description:"Project ID (e.g., prj_01HXYZ...)"}},required:["project_id"]},IY={type:"object",properties:{project_id:{type:"string",description:"Project ID to update"},name:{type:"string",description:"New project name (1-200 characters)"},description:{type:"string",description:"New project description (Markdown, max 2000 characters)"}},required:["project_id"]};function SJ(n,i){n.register({name:"typescape_create_project",description:"Create a new project for organizing document-upload-based reviews. Returns the created project with its ID.",inputSchema:QY},async($)=>{let g=$;if(!g.name)return G(new D(400,"missing_param","Missing required parameter: name","local"));let v={name:g.name};if(g.description!==void 0)v.description=g.description;try{let w=await i.post("/projects",{body:v});return H(_n(w.body),w.requestId)}catch(w){if(w instanceof D)return G(w);throw w}}),n.register({name:"typescape_list_projects",description:"List projects with optional cursor pagination. Returns an array of projects with pagination metadata.",inputSchema:WY},async($)=>{let g=$,v={};if(g.limit!==void 0)v.limit=String(g.limit);if(g.cursor!==void 0)v.cursor=g.cursor;try{let w=await i.get("/projects",{query:v});return H(w.body,w.requestId)}catch(w){if(w instanceof D)return G(w);throw w}}),n.register({name:"typescape_get_project",description:"Get a project by ID. Returns the project details including configuration.",inputSchema:YY},async($)=>{let g=$;if(!g.project_id)return G(new D(400,"missing_param","Missing required parameter: project_id","local"));try{let v=await i.get(`/projects/${encodeURIComponent(g.project_id)}`);return H(_n(v.body),v.requestId)}catch(v){if(v instanceof D)return G(v);throw v}}),n.register({name:"typescape_update_project",description:"Update a project's name or description. Only provided fields are changed; omitted fields are left unchanged.",inputSchema:IY},async($)=>{let g=$;if(!g.project_id)return G(new D(400,"missing_param","Missing required parameter: project_id","local"));let v={};if(g.name!==void 0)v.name=g.name;if(g.description!==void 0)v.description=g.description;try{let w=await i.request("PATCH",`/projects/${encodeURIComponent(g.project_id)}`,{body:v});return H(_n(w.body),w.requestId)}catch(w){if(w instanceof D)return G(w);throw w}})}var zJ=["typescape_create_template","typescape_list_templates","typescape_get_template"],jY={type:"object",properties:{name:{type:"string",description:"Template name (required, 1-200 characters)"},description:{type:"string",description:"Optional template description"},source_type:{type:"string",enum:["git","upload"],description:"Source type for reviews created from this template (default: git)"},repo_id:{type:"string",description:"Repository ID (required when source_type is git)"},project_id:{type:"string",description:"Project ID (required when source_type is upload)"},config:{type:"object",description:"Optional configuration object for the template (e.g., default participants, rules, settings)"}},required:["name"]},uY={type:"object",properties:{limit:{type:"number",description:"Maximum number of templates to return (default: 20, max: 100)"},cursor:{type:"string",description:"Pagination cursor from a previous response"}}},HY={type:"object",properties:{template_id:{type:"string",description:"Template ID (e.g., tpl_01HXYZ...)"}},required:["template_id"]};function MJ(n,i){n.register({name:"typescape_create_template",description:"Create a review template for repeatable review creation. Templates capture default settings so operators don't re-specify parameters each time. Returns the created template with its ID.",inputSchema:jY},async($)=>{let g=$;if(!g.name)return G(new D(400,"missing_param","Missing required parameter: name","local"));let v={name:g.name};if(g.description!==void 0)v.description=g.description;if(g.source_type!==void 0)v.source_type=g.source_type;if(g.repo_id!==void 0)v.repo_id=g.repo_id;if(g.project_id!==void 0)v.project_id=g.project_id;if(g.config!==void 0)v.config=g.config;try{let w=await i.post("/session-templates",{body:v});return H(_n(w.body),w.requestId)}catch(w){if(w instanceof D)return G(w);throw w}}),n.register({name:"typescape_list_templates",description:"List review templates with optional cursor pagination. Returns an array of templates with pagination metadata.",inputSchema:uY},async($)=>{let g=$,v={};if(g.limit!==void 0)v.limit=String(g.limit);if(g.cursor!==void 0)v.cursor=g.cursor;try{let w=await i.get("/session-templates",{query:v});return H(w.body,w.requestId)}catch(w){if(w instanceof D)return G(w);throw w}}),n.register({name:"typescape_get_template",description:"Get a review template by ID. Returns the template details including configuration.",inputSchema:HY},async($)=>{let g=$;if(!g.template_id)return G(new D(400,"missing_param","Missing required parameter: template_id","local"));try{let v=await i.get(`/session-templates/${encodeURIComponent(g.template_id)}`);return H(_n(v.body),v.requestId)}catch(v){if(v instanceof D)return G(v);throw v}})}var RJ=["typescape_list_issues","typescape_get_issue","typescape_update_issue"],VY={type:"object",properties:{session_id:{type:"string",description:"Review/session ID to list issues for (required)"},status:{type:"string",enum:["open","closed","all"],description:"Filter by issue status (default: all)"},severity:{type:"string",enum:["critical","high","medium","low","info"],description:"Filter by severity level"},limit:{type:"number",description:"Maximum number of issues to return (default: 20, max: 100)"},offset:{type:"number",description:"Offset for pagination (default: 0)"}},required:["session_id"]},fY={type:"object",properties:{issue_id:{type:"string",description:"Issue ID (e.g., iss_01HXYZ...)"}},required:["issue_id"]},qY={type:"object",properties:{issue_id:{type:"string",description:"Issue ID to update"},status:{type:"string",enum:["open","closed"],description:"New status for the issue"},assignee:{type:"string",description:"User ID or email to assign the issue to (null to unassign)"},priority:{type:"string",enum:["critical","high","medium","low"],description:"New priority level"}},required:["issue_id"]};function AJ(n,i){n.register({name:"typescape_list_issues",description:"List issues for a review. Supports filtering by status and severity, with offset-based pagination. Returns issues ordered by creation time descending.",inputSchema:VY},async($)=>{let g=$;if(!g.session_id)return G(new D(400,"missing_param","Missing required parameter: session_id","local"));let v={};if(g.status!==void 0)v.status=g.status;if(g.severity!==void 0)v.severity=g.severity;if(g.limit!==void 0)v.limit=String(g.limit);if(g.offset!==void 0)v.offset=String(g.offset);try{let w=await i.get("/issues",{query:{...v,session_id:g.session_id}});return H(w.body,w.requestId)}catch(w){if(w instanceof D)return G(w);throw w}}),n.register({name:"typescape_get_issue",description:"Get an issue by ID. Returns the full issue details including anchors, associated threads, and current status.",inputSchema:fY},async($)=>{let g=$;if(!g.issue_id)return G(new D(400,"missing_param","Missing required parameter: issue_id","local"));try{let v=await i.get(`/issues/${encodeURIComponent(g.issue_id)}`);return H(_n(v.body),v.requestId)}catch(v){if(v instanceof D)return G(v);throw v}}),n.register({name:"typescape_update_issue",description:"Update an issue's status, assignee, or priority. Only provided fields are changed; omitted fields are left unchanged.",inputSchema:qY},async($)=>{let g=$;if(!g.issue_id)return G(new D(400,"missing_param","Missing required parameter: issue_id","local"));let v={};if(g.status!==void 0)v.status=g.status;if(g.assignee!==void 0)v.assignee=g.assignee;if(g.priority!==void 0)v.priority=g.priority;try{let w=await i.request("PATCH",`/issues/${encodeURIComponent(g.issue_id)}`,{body:v});return H(_n(w.body),w.requestId)}catch(w){if(w instanceof D)return G(w);throw w}})}var xJ=["typescape_list_webhooks","typescape_create_webhook","typescape_delete_webhook"],LY={type:"object",properties:{status:{type:"string",description:"Filter by webhook status. One of: active, paused, disabled."},limit:{type:"integer",description:"Maximum number of results to return (default 25)."}},required:[]},KY={type:"object",properties:{url:{type:"string",description:"The HTTPS URL to deliver webhook events to."},events:{type:"array",items:{type:"string"},description:'Array of event types to subscribe to (e.g., ["review.created", "thread.resolved"]).'},description:{type:"string",description:"Optional human-readable description of the webhook."}},required:["url","events"]},OY={type:"object",properties:{webhook_id:{type:"string",description:"The webhook subscription ID to delete."}},required:["webhook_id"]};function hJ(n,i){n.register({name:"typescape_list_webhooks",description:"List webhook subscriptions for the current tenant. Use this to audit which external systems receive event notifications and verify delivery targets before creating new subscriptions. Returns subscription details including URL, events, and status.",inputSchema:LY},async($)=>{let g=$;try{let v=new URLSearchParams;if(g.status)v.set("status",g.status);if(g.limit)v.set("limit",String(g.limit));let w=v.toString(),_=w?`/webhooks?${w}`:"/webhooks",U=await i.get(_);return H(U.body,U.requestId)}catch(v){if(v instanceof D)return G(v);throw v}}),n.register({name:"typescape_create_webhook",description:"Create a new webhook subscription to receive event notifications at an HTTPS endpoint. Common events include review.created, thread.resolved, and check_run.completed. Use this to integrate Typescape with external CI/CD pipelines or notification systems.",inputSchema:KY},async($)=>{let g=$;if(!g.url)return G(new D(400,"missing_param","Missing required parameter: url","local"));if(!g.events||g.events.length===0)return G(new D(400,"missing_param","Missing required parameter: events (must be a non-empty array)","local"));try{let v=await i.post("/webhooks",{body:{url:g.url,events:g.events,description:g.description}});return H(v.body,v.requestId)}catch(v){if(v instanceof D)return G(v);throw v}}),n.register({name:"typescape_delete_webhook",description:"Delete a webhook subscription by ID, permanently stopping all deliveries to the target URL. Use typescape_list_webhooks first to find the subscription ID. This action cannot be undone.",inputSchema:OY},async($)=>{let g=$;if(!g.webhook_id)return G(new D(400,"missing_param","Missing required parameter: webhook_id","local"));try{let v=await i.request("DELETE",`/webhooks/${encodeURIComponent(g.webhook_id)}`,{});return H({deleted:!0,webhook_id:g.webhook_id},v.requestId)}catch(v){if(v instanceof D)return G(v);throw v}})}var CJ=["typescape_list_events"],BY={type:"object",properties:{review_id:{type:"string",description:"Review (session) ID to list events for."},cursor:{type:"string",description:"Pagination cursor from a previous response. Events after this cursor are returned."},limit:{type:"integer",description:"Maximum number of events to return (default 50)."}},required:["review_id"]};function EJ(n,i){n.register({name:"typescape_list_events",description:"List timeline events for a review. Use this to monitor review activity without re-fetching full review data. Returns an ordered list of events (comments, thread changes, status changes, check completions) with cursor-based pagination. Pass the cursor from the previous response for efficient incremental polling.",inputSchema:BY},async($)=>{let g=$;if(!g.review_id)return G(new D(400,"missing_param","Missing required parameter: review_id","local"));try{let v=new URLSearchParams;if(g.cursor)v.set("cursor",g.cursor);if(g.limit)v.set("limit",String(g.limit));let w=v.toString(),_=`/sessions/${encodeURIComponent(g.review_id)}/events${w?`?${w}`:""}`,U=await i.get(_);return H(U.body,U.requestId)}catch(v){if(v instanceof D)return G(v);throw v}})}var oJ=`---
44
44
  name: agent-review-loop
45
45
  version: "1.0.0"
46
46
  summary: "Run the end-to-end agent review loop while keeping user, reviewer, and operator decisions explicit."