diff --git a/dist/claude-mem.min.js b/dist/claude-mem.min.js index 9d9d1fa5..11474ddb 100755 --- a/dist/claude-mem.min.js +++ b/dist/claude-mem.min.js @@ -37,7 +37,7 @@ ${j}`:"",f=F_();return I6(`✅ ${q} completed successfully${K}${Y}`,f)}function `))}catch(j){let K={type:"control_response",response:{subtype:"error",request_id:q.request_id,error:j.message||String(j)}};await Promise.resolve(this.transport.write(JSON.stringify(K)+` `))}finally{this.cancelControllers.delete(q.request_id)}}handleControlCancelRequest(q){let _=this.cancelControllers.get(q.request_id);if(_)_.abort(),this.cancelControllers.delete(q.request_id)}async processControlRequest(q,_){if(q.request.subtype==="can_use_tool"){if(!this.canUseTool)throw new Error("canUseTool callback is not provided.");return this.canUseTool(q.request.tool_name,q.request.input,{signal:_,suggestions:q.request.permission_suggestions})}else if(q.request.subtype==="hook_callback")return await this.handleHookCallbacks(q.request.callback_id,q.request.input,q.request.tool_use_id,_);else if(q.request.subtype==="mcp_message"){let j=q.request,K=this.sdkMcpTransports.get(j.server_name);if(!K)throw new Error(`SDK MCP server not found: ${j.server_name}`);if("method"in j.message&&"id"in j.message&&j.message.id!==null)return{mcp_response:await this.handleMcpControlRequest(j.server_name,j,K)};else{if(K.onmessage)K.onmessage(j.message);return{mcp_response:{jsonrpc:"2.0",result:{},id:0}}}}throw new Error("Unsupported control request subtype: "+q.request.subtype)}async*readSdkMessages(){for await(let q of this.inputStream)yield q}async initialize(){let q;if(this.hooks){q={};for(let[K,Y]of Object.entries(this.hooks))if(Y.length>0)q[K]=Y.map((f)=>{let P=[];for(let $ of f.hooks){let w=`hook_${this.nextCallbackId++}`;this.hookCallbacks.set(w,$),P.push(w)}return{matcher:f.matcher,hookCallbackIds:P}})}let _={subtype:"initialize",hooks:q};return(await this.request(_)).response}async interrupt(){if(!this.isStreamingMode)throw new Error("Interrupt requires --input-format stream-json");await this.request({subtype:"interrupt"})}async setPermissionMode(q){if(!this.isStreamingMode)throw new Error("setPermissionMode requires --input-format stream-json");await this.request({subtype:"set_permission_mode",mode:q})}request(q){let _=Math.random().toString(36).substring(2,15),j={request_id:_,type:"control_request",request:q};return new Promise((K,Y)=>{this.pendingControlResponses.set(_,(f)=>{if(f.subtype==="success")K(f);else Y(new Error(f.error))}),Promise.resolve(this.transport.write(JSON.stringify(j)+` `))})}async supportedCommands(){if(!this.isStreamingMode)throw new Error("supportedCommands requires --input-format stream-json");if(!this.intialization)throw new Error("supportedCommands requires transport with bidirectional communication");return(await this.intialization).commands}async streamInput(q){try{for await(let _ of q){if(this.abortController?.signal.aborted)break;await Promise.resolve(this.transport.write(JSON.stringify(_)+` -`))}this.transport.endInput()}catch(_){if(!(_ instanceof Q_))throw _}}handleHookCallbacks(q,_,j,K){let Y=this.hookCallbacks.get(q);if(!Y)throw new Error(`No hook callback found for ID: ${q}`);return Y(_,j,{signal:K})}sendMcpServerMessageToCli(q,_){if("id"in _&&_.id!==null&&_.id!==void 0){let j=`${q}:${_.id}`,K=this.pendingMcpResponses.get(j);if(K){K.resolve(_),this.pendingMcpResponses.delete(j);return}}throw new Error("No pending request found")}handleMcpControlRequest(q,_,j){let K="id"in _.message?_.message.id:null,Y=`${q}:${K}`;return new Promise((f,P)=>{let $=null,w=()=>{if($)clearTimeout($);this.pendingMcpResponses.delete(Y)},O=(W)=>{w(),f(W)},z=(W)=>{w(),P(W)};if(this.pendingMcpResponses.set(Y,{resolve:O,reject:z}),j.onmessage)j.onmessage(_.message);else{w(),P(new Error("No message handler registered"));return}$=setTimeout(()=>{if(this.pendingMcpResponses.has(Y))w(),P(new Error("Request timeout"))},30000)})}};X={};Bz(X,{void:()=>Gv,util:()=>h8,unknown:()=>Xv,union:()=>Dv,undefined:()=>Tv,tuple:()=>Nv,transformer:()=>C1,symbol:()=>Jv,string:()=>x1,strictObject:()=>Cv,setErrorMap:()=>lW,set:()=>Ev,record:()=>bv,quotelessJson:()=>LW,promise:()=>dv,preprocess:()=>lv,pipeline:()=>xv,ostring:()=>nv,optional:()=>Lv,onumber:()=>cv,oboolean:()=>rv,objectUtil:()=>n4,object:()=>hv,number:()=>n1,nullable:()=>pv,null:()=>Zv,never:()=>Av,nativeEnum:()=>yv,nan:()=>Wv,map:()=>Sv,makeIssue:()=>Y7,literal:()=>mv,lazy:()=>Iv,late:()=>wv,isValid:()=>X_,isDirty:()=>r4,isAsync:()=>FK,isAborted:()=>c4,intersection:()=>Mv,instanceof:()=>zv,getParsedType:()=>pq,getErrorMap:()=>P7,function:()=>Rv,enum:()=>gv,effect:()=>C1,discriminatedUnion:()=>Vv,defaultErrorMap:()=>KK,datetimeRegex:()=>L1,date:()=>Hv,custom:()=>l1,coerce:()=>iv,boolean:()=>c1,bigint:()=>vv,array:()=>uv,any:()=>kv,addIssueToContext:()=>U,ZodVoid:()=>UK,ZodUnknown:()=>Uq,ZodUnion:()=>fK,ZodUndefined:()=>PK,ZodType:()=>k8,ZodTuple:()=>Cq,ZodTransformer:()=>e6,ZodSymbol:()=>eK,ZodString:()=>Oq,ZodSet:()=>u_,ZodSchema:()=>k8,ZodRecord:()=>sK,ZodReadonly:()=>HK,ZodPromise:()=>h_,ZodPipeline:()=>_3,ZodParsedType:()=>Q,ZodOptional:()=>zq,ZodObject:()=>B8,ZodNumber:()=>sq,ZodNullable:()=>lq,ZodNull:()=>YK,ZodNever:()=>hq,ZodNativeEnum:()=>zK,ZodNaN:()=>q3,ZodMap:()=>QK,ZodLiteral:()=>wK,ZodLazy:()=>OK,ZodIssueCode:()=>t,ZodIntersection:()=>$K,ZodFunction:()=>_K,ZodFirstPartyTypeKind:()=>v8,ZodError:()=>l6,ZodEnum:()=>q_,ZodEffects:()=>e6,ZodDiscriminatedUnion:()=>f7,ZodDefault:()=>WK,ZodDate:()=>A_,ZodCatch:()=>vK,ZodBranded:()=>$7,ZodBoolean:()=>jK,ZodBigInt:()=>Qq,ZodArray:()=>wq,ZodAny:()=>G_,Schema:()=>k8,ParseStatus:()=>A6,OK:()=>M6,NEVER:()=>ov,INVALID:()=>W8,EMPTY_PATH:()=>xW,DIRTY:()=>qK,BRAND:()=>Ov});(function(q){q.assertEqual=(Y)=>{};function _(Y){}q.assertIs=_;function j(Y){throw new Error}q.assertNever=j,q.arrayToEnum=(Y)=>{let f={};for(let P of Y)f[P]=P;return f},q.getValidEnumValues=(Y)=>{let f=q.objectKeys(Y).filter(($)=>typeof Y[Y[$]]!=="number"),P={};for(let $ of f)P[$]=Y[$];return q.objectValues(P)},q.objectValues=(Y)=>{return q.objectKeys(Y).map(function(f){return Y[f]})},q.objectKeys=typeof Object.keys==="function"?(Y)=>Object.keys(Y):(Y)=>{let f=[];for(let P in Y)if(Object.prototype.hasOwnProperty.call(Y,P))f.push(P);return f},q.find=(Y,f)=>{for(let P of Y)if(f(P))return P;return},q.isInteger=typeof Number.isInteger==="function"?(Y)=>Number.isInteger(Y):(Y)=>typeof Y==="number"&&Number.isFinite(Y)&&Math.floor(Y)===Y;function K(Y,f=" | "){return Y.map((P)=>typeof P==="string"?`'${P}'`:P).join(f)}q.joinValues=K,q.jsonStringifyReplacer=(Y,f)=>{if(typeof f==="bigint")return f.toString();return f}})(h8||(h8={}));(function(q){q.mergeShapes=(_,j)=>{return{..._,...j}}})(n4||(n4={}));Q=h8.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),t=h8.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"]);l6=class l6 extends Error{get errors(){return this.issues}constructor(q){super();this.issues=[],this.addIssue=(j)=>{this.issues=[...this.issues,j]},this.addIssues=(j=[])=>{this.issues=[...this.issues,...j]};let _=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,_);else this.__proto__=_;this.name="ZodError",this.issues=q}format(q){let _=q||function(Y){return Y.message},j={_errors:[]},K=(Y)=>{for(let f of Y.issues)if(f.code==="invalid_union")f.unionErrors.map(K);else if(f.code==="invalid_return_type")K(f.returnTypeError);else if(f.code==="invalid_arguments")K(f.argumentsError);else if(f.path.length===0)j._errors.push(_(f));else{let P=j,$=0;while($_.message){let _={},j=[];for(let K of this.issues)if(K.path.length>0){let Y=K.path[0];_[Y]=_[Y]||[],_[Y].push(q(K))}else j.push(q(K));return{formErrors:j,fieldErrors:_}}get formErrors(){return this.flatten()}};l6.create=(q)=>{return new l6(q)};KK=pW,g1=KK;xW=[];W8=Object.freeze({status:"aborted"});(function(q){q.errToObj=(_)=>typeof _==="string"?{message:_}:_||{},q.toString=(_)=>typeof _==="string"?_:_?.message})($8||($8={}));nW=/^c[^\s-]{8,}$/i,cW=/^[0-9a-z]+$/,rW=/^[0-9A-HJKMNP-TV-Z]{26}$/i,iW=/^[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,oW=/^[a-z0-9_-]{21}$/i,aW=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,BW=/^[-+]?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)?)??$/,tW=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,eW=/^(?:(?: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])$/,UW=/^(?:(?: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])$/,sW=/^(([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]))$/,QW=/^(([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])$/,qv=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,_v=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Kv=new RegExp(`^${y1}$`);Oq=class Oq extends k8{_parse(q){if(this._def.coerce)q.data=String(q.data);if(this._getType(q)!==Q.string){let Y=this._getOrReturnCtx(q);return U(Y,{code:t.invalid_type,expected:Q.string,received:Y.parsedType}),W8}let j=new A6,K=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if(q.data.lengthY.value)K=this._getOrReturnCtx(q,K),U(K,{code:t.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),j.dirty()}else if(Y.kind==="length"){let f=q.data.length>Y.value,P=q.data.lengthq.test(K),{validation:_,code:t.invalid_string,...$8.errToObj(j)})}_addCheck(q){return new Oq({...this._def,checks:[...this._def.checks,q]})}email(q){return this._addCheck({kind:"email",...$8.errToObj(q)})}url(q){return this._addCheck({kind:"url",...$8.errToObj(q)})}emoji(q){return this._addCheck({kind:"emoji",...$8.errToObj(q)})}uuid(q){return this._addCheck({kind:"uuid",...$8.errToObj(q)})}nanoid(q){return this._addCheck({kind:"nanoid",...$8.errToObj(q)})}cuid(q){return this._addCheck({kind:"cuid",...$8.errToObj(q)})}cuid2(q){return this._addCheck({kind:"cuid2",...$8.errToObj(q)})}ulid(q){return this._addCheck({kind:"ulid",...$8.errToObj(q)})}base64(q){return this._addCheck({kind:"base64",...$8.errToObj(q)})}base64url(q){return this._addCheck({kind:"base64url",...$8.errToObj(q)})}jwt(q){return this._addCheck({kind:"jwt",...$8.errToObj(q)})}ip(q){return this._addCheck({kind:"ip",...$8.errToObj(q)})}cidr(q){return this._addCheck({kind:"cidr",...$8.errToObj(q)})}datetime(q){if(typeof q==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:q});return this._addCheck({kind:"datetime",precision:typeof q?.precision==="undefined"?null:q?.precision,offset:q?.offset??!1,local:q?.local??!1,...$8.errToObj(q?.message)})}date(q){return this._addCheck({kind:"date",message:q})}time(q){if(typeof q==="string")return this._addCheck({kind:"time",precision:null,message:q});return this._addCheck({kind:"time",precision:typeof q?.precision==="undefined"?null:q?.precision,...$8.errToObj(q?.message)})}duration(q){return this._addCheck({kind:"duration",...$8.errToObj(q)})}regex(q,_){return this._addCheck({kind:"regex",regex:q,...$8.errToObj(_)})}includes(q,_){return this._addCheck({kind:"includes",value:q,position:_?.position,...$8.errToObj(_?.message)})}startsWith(q,_){return this._addCheck({kind:"startsWith",value:q,...$8.errToObj(_)})}endsWith(q,_){return this._addCheck({kind:"endsWith",value:q,...$8.errToObj(_)})}min(q,_){return this._addCheck({kind:"min",value:q,...$8.errToObj(_)})}max(q,_){return this._addCheck({kind:"max",value:q,...$8.errToObj(_)})}length(q,_){return this._addCheck({kind:"length",value:q,...$8.errToObj(_)})}nonempty(q){return this.min(1,$8.errToObj(q))}trim(){return new Oq({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Oq({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Oq({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((q)=>q.kind==="datetime")}get isDate(){return!!this._def.checks.find((q)=>q.kind==="date")}get isTime(){return!!this._def.checks.find((q)=>q.kind==="time")}get isDuration(){return!!this._def.checks.find((q)=>q.kind==="duration")}get isEmail(){return!!this._def.checks.find((q)=>q.kind==="email")}get isURL(){return!!this._def.checks.find((q)=>q.kind==="url")}get isEmoji(){return!!this._def.checks.find((q)=>q.kind==="emoji")}get isUUID(){return!!this._def.checks.find((q)=>q.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((q)=>q.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((q)=>q.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((q)=>q.kind==="cuid2")}get isULID(){return!!this._def.checks.find((q)=>q.kind==="ulid")}get isIP(){return!!this._def.checks.find((q)=>q.kind==="ip")}get isCIDR(){return!!this._def.checks.find((q)=>q.kind==="cidr")}get isBase64(){return!!this._def.checks.find((q)=>q.kind==="base64")}get isBase64url(){return!!this._def.checks.find((q)=>q.kind==="base64url")}get minLength(){let q=null;for(let _ of this._def.checks)if(_.kind==="min"){if(q===null||_.value>q)q=_.value}return q}get maxLength(){let q=null;for(let _ of this._def.checks)if(_.kind==="max"){if(q===null||_.value{return new Oq({checks:[],typeName:v8.ZodString,coerce:q?.coerce??!1,...Z8(q)})};sq=class sq extends k8{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(q){if(this._def.coerce)q.data=Number(q.data);if(this._getType(q)!==Q.number){let Y=this._getOrReturnCtx(q);return U(Y,{code:t.invalid_type,expected:Q.number,received:Y.parsedType}),W8}let j=void 0,K=new A6;for(let Y of this._def.checks)if(Y.kind==="int"){if(!h8.isInteger(q.data))j=this._getOrReturnCtx(q,j),U(j,{code:t.invalid_type,expected:"integer",received:"float",message:Y.message}),K.dirty()}else if(Y.kind==="min"){if(Y.inclusive?q.dataY.value:q.data>=Y.value)j=this._getOrReturnCtx(q,j),U(j,{code:t.too_big,maximum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),K.dirty()}else if(Y.kind==="multipleOf"){if($v(q.data,Y.value)!==0)j=this._getOrReturnCtx(q,j),U(j,{code:t.not_multiple_of,multipleOf:Y.value,message:Y.message}),K.dirty()}else if(Y.kind==="finite"){if(!Number.isFinite(q.data))j=this._getOrReturnCtx(q,j),U(j,{code:t.not_finite,message:Y.message}),K.dirty()}else h8.assertNever(Y);return{status:K.value,value:q.data}}gte(q,_){return this.setLimit("min",q,!0,$8.toString(_))}gt(q,_){return this.setLimit("min",q,!1,$8.toString(_))}lte(q,_){return this.setLimit("max",q,!0,$8.toString(_))}lt(q,_){return this.setLimit("max",q,!1,$8.toString(_))}setLimit(q,_,j,K){return new sq({...this._def,checks:[...this._def.checks,{kind:q,value:_,inclusive:j,message:$8.toString(K)}]})}_addCheck(q){return new sq({...this._def,checks:[...this._def.checks,q]})}int(q){return this._addCheck({kind:"int",message:$8.toString(q)})}positive(q){return this._addCheck({kind:"min",value:0,inclusive:!1,message:$8.toString(q)})}negative(q){return this._addCheck({kind:"max",value:0,inclusive:!1,message:$8.toString(q)})}nonpositive(q){return this._addCheck({kind:"max",value:0,inclusive:!0,message:$8.toString(q)})}nonnegative(q){return this._addCheck({kind:"min",value:0,inclusive:!0,message:$8.toString(q)})}multipleOf(q,_){return this._addCheck({kind:"multipleOf",value:q,message:$8.toString(_)})}finite(q){return this._addCheck({kind:"finite",message:$8.toString(q)})}safe(q){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:$8.toString(q)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:$8.toString(q)})}get minValue(){let q=null;for(let _ of this._def.checks)if(_.kind==="min"){if(q===null||_.value>q)q=_.value}return q}get maxValue(){let q=null;for(let _ of this._def.checks)if(_.kind==="max"){if(q===null||_.valueq.kind==="int"||q.kind==="multipleOf"&&h8.isInteger(q.value))}get isFinite(){let q=null,_=null;for(let j of this._def.checks)if(j.kind==="finite"||j.kind==="int"||j.kind==="multipleOf")return!0;else if(j.kind==="min"){if(_===null||j.value>_)_=j.value}else if(j.kind==="max"){if(q===null||j.value{return new sq({checks:[],typeName:v8.ZodNumber,coerce:q?.coerce||!1,...Z8(q)})};Qq=class Qq extends k8{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(q){if(this._def.coerce)try{q.data=BigInt(q.data)}catch{return this._getInvalidInput(q)}if(this._getType(q)!==Q.bigint)return this._getInvalidInput(q);let j=void 0,K=new A6;for(let Y of this._def.checks)if(Y.kind==="min"){if(Y.inclusive?q.dataY.value:q.data>=Y.value)j=this._getOrReturnCtx(q,j),U(j,{code:t.too_big,type:"bigint",maximum:Y.value,inclusive:Y.inclusive,message:Y.message}),K.dirty()}else if(Y.kind==="multipleOf"){if(q.data%Y.value!==BigInt(0))j=this._getOrReturnCtx(q,j),U(j,{code:t.not_multiple_of,multipleOf:Y.value,message:Y.message}),K.dirty()}else h8.assertNever(Y);return{status:K.value,value:q.data}}_getInvalidInput(q){let _=this._getOrReturnCtx(q);return U(_,{code:t.invalid_type,expected:Q.bigint,received:_.parsedType}),W8}gte(q,_){return this.setLimit("min",q,!0,$8.toString(_))}gt(q,_){return this.setLimit("min",q,!1,$8.toString(_))}lte(q,_){return this.setLimit("max",q,!0,$8.toString(_))}lt(q,_){return this.setLimit("max",q,!1,$8.toString(_))}setLimit(q,_,j,K){return new Qq({...this._def,checks:[...this._def.checks,{kind:q,value:_,inclusive:j,message:$8.toString(K)}]})}_addCheck(q){return new Qq({...this._def,checks:[...this._def.checks,q]})}positive(q){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:$8.toString(q)})}negative(q){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:$8.toString(q)})}nonpositive(q){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:$8.toString(q)})}nonnegative(q){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:$8.toString(q)})}multipleOf(q,_){return this._addCheck({kind:"multipleOf",value:q,message:$8.toString(_)})}get minValue(){let q=null;for(let _ of this._def.checks)if(_.kind==="min"){if(q===null||_.value>q)q=_.value}return q}get maxValue(){let q=null;for(let _ of this._def.checks)if(_.kind==="max"){if(q===null||_.value{return new Qq({checks:[],typeName:v8.ZodBigInt,coerce:q?.coerce??!1,...Z8(q)})};jK=class jK extends k8{_parse(q){if(this._def.coerce)q.data=Boolean(q.data);if(this._getType(q)!==Q.boolean){let j=this._getOrReturnCtx(q);return U(j,{code:t.invalid_type,expected:Q.boolean,received:j.parsedType}),W8}return M6(q.data)}};jK.create=(q)=>{return new jK({typeName:v8.ZodBoolean,coerce:q?.coerce||!1,...Z8(q)})};A_=class A_ extends k8{_parse(q){if(this._def.coerce)q.data=new Date(q.data);if(this._getType(q)!==Q.date){let Y=this._getOrReturnCtx(q);return U(Y,{code:t.invalid_type,expected:Q.date,received:Y.parsedType}),W8}if(Number.isNaN(q.data.getTime())){let Y=this._getOrReturnCtx(q);return U(Y,{code:t.invalid_date}),W8}let j=new A6,K=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if(q.data.getTime()Y.value)K=this._getOrReturnCtx(q,K),U(K,{code:t.too_big,message:Y.message,inclusive:!0,exact:!1,maximum:Y.value,type:"date"}),j.dirty()}else h8.assertNever(Y);return{status:j.value,value:new Date(q.data.getTime())}}_addCheck(q){return new A_({...this._def,checks:[...this._def.checks,q]})}min(q,_){return this._addCheck({kind:"min",value:q.getTime(),message:$8.toString(_)})}max(q,_){return this._addCheck({kind:"max",value:q.getTime(),message:$8.toString(_)})}get minDate(){let q=null;for(let _ of this._def.checks)if(_.kind==="min"){if(q===null||_.value>q)q=_.value}return q!=null?new Date(q):null}get maxDate(){let q=null;for(let _ of this._def.checks)if(_.kind==="max"){if(q===null||_.value{return new A_({checks:[],coerce:q?.coerce||!1,typeName:v8.ZodDate,...Z8(q)})};eK=class eK extends k8{_parse(q){if(this._getType(q)!==Q.symbol){let j=this._getOrReturnCtx(q);return U(j,{code:t.invalid_type,expected:Q.symbol,received:j.parsedType}),W8}return M6(q.data)}};eK.create=(q)=>{return new eK({typeName:v8.ZodSymbol,...Z8(q)})};PK=class PK extends k8{_parse(q){if(this._getType(q)!==Q.undefined){let j=this._getOrReturnCtx(q);return U(j,{code:t.invalid_type,expected:Q.undefined,received:j.parsedType}),W8}return M6(q.data)}};PK.create=(q)=>{return new PK({typeName:v8.ZodUndefined,...Z8(q)})};YK=class YK extends k8{_parse(q){if(this._getType(q)!==Q.null){let j=this._getOrReturnCtx(q);return U(j,{code:t.invalid_type,expected:Q.null,received:j.parsedType}),W8}return M6(q.data)}};YK.create=(q)=>{return new YK({typeName:v8.ZodNull,...Z8(q)})};G_=class G_ extends k8{constructor(){super(...arguments);this._any=!0}_parse(q){return M6(q.data)}};G_.create=(q)=>{return new G_({typeName:v8.ZodAny,...Z8(q)})};Uq=class Uq extends k8{constructor(){super(...arguments);this._unknown=!0}_parse(q){return M6(q.data)}};Uq.create=(q)=>{return new Uq({typeName:v8.ZodUnknown,...Z8(q)})};hq=class hq extends k8{_parse(q){let _=this._getOrReturnCtx(q);return U(_,{code:t.invalid_type,expected:Q.never,received:_.parsedType}),W8}};hq.create=(q)=>{return new hq({typeName:v8.ZodNever,...Z8(q)})};UK=class UK extends k8{_parse(q){if(this._getType(q)!==Q.undefined){let j=this._getOrReturnCtx(q);return U(j,{code:t.invalid_type,expected:Q.void,received:j.parsedType}),W8}return M6(q.data)}};UK.create=(q)=>{return new UK({typeName:v8.ZodVoid,...Z8(q)})};wq=class wq extends k8{_parse(q){let{ctx:_,status:j}=this._processInputParams(q),K=this._def;if(_.parsedType!==Q.array)return U(_,{code:t.invalid_type,expected:Q.array,received:_.parsedType}),W8;if(K.exactLength!==null){let f=_.data.length>K.exactLength.value,P=_.data.lengthK.maxLength.value)U(_,{code:t.too_big,maximum:K.maxLength.value,type:"array",inclusive:!0,exact:!1,message:K.maxLength.message}),j.dirty()}if(_.common.async)return Promise.all([..._.data].map((f,P)=>{return K.type._parseAsync(new Wq(_,f,_.path,P))})).then((f)=>{return A6.mergeArray(j,f)});let Y=[..._.data].map((f,P)=>{return K.type._parseSync(new Wq(_,f,_.path,P))});return A6.mergeArray(j,Y)}get element(){return this._def.type}min(q,_){return new wq({...this._def,minLength:{value:q,message:$8.toString(_)}})}max(q,_){return new wq({...this._def,maxLength:{value:q,message:$8.toString(_)}})}length(q,_){return new wq({...this._def,exactLength:{value:q,message:$8.toString(_)}})}nonempty(q){return this.min(1,q)}};wq.create=(q,_)=>{return new wq({type:q,minLength:null,maxLength:null,exactLength:null,typeName:v8.ZodArray,...Z8(_)})};B8=class B8 extends k8{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let q=this._def.shape(),_=h8.objectKeys(q);return this._cached={shape:q,keys:_},this._cached}_parse(q){if(this._getType(q)!==Q.object){let w=this._getOrReturnCtx(q);return U(w,{code:t.invalid_type,expected:Q.object,received:w.parsedType}),W8}let{status:j,ctx:K}=this._processInputParams(q),{shape:Y,keys:f}=this._getCached(),P=[];if(!(this._def.catchall instanceof hq&&this._def.unknownKeys==="strip")){for(let w in K.data)if(!f.includes(w))P.push(w)}let $=[];for(let w of f){let O=Y[w],z=K.data[w];$.push({key:{status:"valid",value:w},value:O._parse(new Wq(K,z,K.path,w)),alwaysSet:w in K.data})}if(this._def.catchall instanceof hq){let w=this._def.unknownKeys;if(w==="passthrough")for(let O of P)$.push({key:{status:"valid",value:O},value:{status:"valid",value:K.data[O]}});else if(w==="strict"){if(P.length>0)U(K,{code:t.unrecognized_keys,keys:P}),j.dirty()}else if(w==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let w=this._def.catchall;for(let O of P){let z=K.data[O];$.push({key:{status:"valid",value:O},value:w._parse(new Wq(K,z,K.path,O)),alwaysSet:O in K.data})}}if(K.common.async)return Promise.resolve().then(async()=>{let w=[];for(let O of $){let z=await O.key,W=await O.value;w.push({key:z,value:W,alwaysSet:O.alwaysSet})}return w}).then((w)=>{return A6.mergeObjectSync(j,w)});else return A6.mergeObjectSync(j,$)}get shape(){return this._def.shape()}strict(q){return $8.errToObj,new B8({...this._def,unknownKeys:"strict",...q!==void 0?{errorMap:(_,j)=>{let K=this._def.errorMap?.(_,j).message??j.defaultError;if(_.code==="unrecognized_keys")return{message:$8.errToObj(q).message??K};return{message:K}}}:{}})}strip(){return new B8({...this._def,unknownKeys:"strip"})}passthrough(){return new B8({...this._def,unknownKeys:"passthrough"})}extend(q){return new B8({...this._def,shape:()=>({...this._def.shape(),...q})})}merge(q){return new B8({unknownKeys:q._def.unknownKeys,catchall:q._def.catchall,shape:()=>({...this._def.shape(),...q._def.shape()}),typeName:v8.ZodObject})}setKey(q,_){return this.augment({[q]:_})}catchall(q){return new B8({...this._def,catchall:q})}pick(q){let _={};for(let j of h8.objectKeys(q))if(q[j]&&this.shape[j])_[j]=this.shape[j];return new B8({...this._def,shape:()=>_})}omit(q){let _={};for(let j of h8.objectKeys(this.shape))if(!q[j])_[j]=this.shape[j];return new B8({...this._def,shape:()=>_})}deepPartial(){return s_(this)}partial(q){let _={};for(let j of h8.objectKeys(this.shape)){let K=this.shape[j];if(q&&!q[j])_[j]=K;else _[j]=K.optional()}return new B8({...this._def,shape:()=>_})}required(q){let _={};for(let j of h8.objectKeys(this.shape))if(q&&!q[j])_[j]=this.shape[j];else{let Y=this.shape[j];while(Y instanceof zq)Y=Y._def.innerType;_[j]=Y}return new B8({...this._def,shape:()=>_})}keyof(){return p1(h8.objectKeys(this.shape))}};B8.create=(q,_)=>{return new B8({shape:()=>q,unknownKeys:"strip",catchall:hq.create(),typeName:v8.ZodObject,...Z8(_)})};B8.strictCreate=(q,_)=>{return new B8({shape:()=>q,unknownKeys:"strict",catchall:hq.create(),typeName:v8.ZodObject,...Z8(_)})};B8.lazycreate=(q,_)=>{return new B8({shape:q,unknownKeys:"strip",catchall:hq.create(),typeName:v8.ZodObject,...Z8(_)})};fK=class fK extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j=this._def.options;function K(Y){for(let P of Y)if(P.result.status==="valid")return P.result;for(let P of Y)if(P.result.status==="dirty")return _.common.issues.push(...P.ctx.common.issues),P.result;let f=Y.map((P)=>new l6(P.ctx.common.issues));return U(_,{code:t.invalid_union,unionErrors:f}),W8}if(_.common.async)return Promise.all(j.map(async(Y)=>{let f={..._,common:{..._.common,issues:[]},parent:null};return{result:await Y._parseAsync({data:_.data,path:_.path,parent:f}),ctx:f}})).then(K);else{let Y=void 0,f=[];for(let $ of j){let w={..._,common:{..._.common,issues:[]},parent:null},O=$._parseSync({data:_.data,path:_.path,parent:w});if(O.status==="valid")return O;else if(O.status==="dirty"&&!Y)Y={result:O,ctx:w};if(w.common.issues.length)f.push(w.common.issues)}if(Y)return _.common.issues.push(...Y.ctx.common.issues),Y.result;let P=f.map(($)=>new l6($));return U(_,{code:t.invalid_union,unionErrors:P}),W8}}get options(){return this._def.options}};fK.create=(q,_)=>{return new fK({options:q,typeName:v8.ZodUnion,...Z8(_)})};f7=class f7 extends k8{_parse(q){let{ctx:_}=this._processInputParams(q);if(_.parsedType!==Q.object)return U(_,{code:t.invalid_type,expected:Q.object,received:_.parsedType}),W8;let j=this.discriminator,K=_.data[j],Y=this.optionsMap.get(K);if(!Y)return U(_,{code:t.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[j]}),W8;if(_.common.async)return Y._parseAsync({data:_.data,path:_.path,parent:_});else return Y._parseSync({data:_.data,path:_.path,parent:_})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(q,_,j){let K=new Map;for(let Y of _){let f=Lq(Y.shape[q]);if(!f.length)throw new Error(`A discriminator value for key \`${q}\` could not be extracted from all schema options`);for(let P of f){if(K.has(P))throw new Error(`Discriminator property ${String(q)} has duplicate value ${String(P)}`);K.set(P,Y)}}return new f7({typeName:v8.ZodDiscriminatedUnion,discriminator:q,options:_,optionsMap:K,...Z8(j)})}};$K=class $K extends k8{_parse(q){let{status:_,ctx:j}=this._processInputParams(q),K=(Y,f)=>{if(c4(Y)||c4(f))return W8;let P=i4(Y.value,f.value);if(!P.valid)return U(j,{code:t.invalid_intersection_types}),W8;if(r4(Y)||r4(f))_.dirty();return{status:_.value,value:P.data}};if(j.common.async)return Promise.all([this._def.left._parseAsync({data:j.data,path:j.path,parent:j}),this._def.right._parseAsync({data:j.data,path:j.path,parent:j})]).then(([Y,f])=>K(Y,f));else return K(this._def.left._parseSync({data:j.data,path:j.path,parent:j}),this._def.right._parseSync({data:j.data,path:j.path,parent:j}))}};$K.create=(q,_,j)=>{return new $K({left:q,right:_,typeName:v8.ZodIntersection,...Z8(j)})};Cq=class Cq extends k8{_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.parsedType!==Q.array)return U(j,{code:t.invalid_type,expected:Q.array,received:j.parsedType}),W8;if(j.data.lengththis._def.items.length)U(j,{code:t.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_.dirty();let Y=[...j.data].map((f,P)=>{let $=this._def.items[P]||this._def.rest;if(!$)return null;return $._parse(new Wq(j,f,j.path,P))}).filter((f)=>!!f);if(j.common.async)return Promise.all(Y).then((f)=>{return A6.mergeArray(_,f)});else return A6.mergeArray(_,Y)}get items(){return this._def.items}rest(q){return new Cq({...this._def,rest:q})}};Cq.create=(q,_)=>{if(!Array.isArray(q))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Cq({items:q,typeName:v8.ZodTuple,rest:null,...Z8(_)})};sK=class sK extends k8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.parsedType!==Q.object)return U(j,{code:t.invalid_type,expected:Q.object,received:j.parsedType}),W8;let K=[],Y=this._def.keyType,f=this._def.valueType;for(let P in j.data)K.push({key:Y._parse(new Wq(j,P,j.path,P)),value:f._parse(new Wq(j,j.data[P],j.path,P)),alwaysSet:P in j.data});if(j.common.async)return A6.mergeObjectAsync(_,K);else return A6.mergeObjectSync(_,K)}get element(){return this._def.valueType}static create(q,_,j){if(_ instanceof k8)return new sK({keyType:q,valueType:_,typeName:v8.ZodRecord,...Z8(j)});return new sK({keyType:Oq.create(),valueType:q,typeName:v8.ZodRecord,...Z8(_)})}};QK=class QK extends k8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.parsedType!==Q.map)return U(j,{code:t.invalid_type,expected:Q.map,received:j.parsedType}),W8;let K=this._def.keyType,Y=this._def.valueType,f=[...j.data.entries()].map(([P,$],w)=>{return{key:K._parse(new Wq(j,P,j.path,[w,"key"])),value:Y._parse(new Wq(j,$,j.path,[w,"value"]))}});if(j.common.async){let P=new Map;return Promise.resolve().then(async()=>{for(let $ of f){let w=await $.key,O=await $.value;if(w.status==="aborted"||O.status==="aborted")return W8;if(w.status==="dirty"||O.status==="dirty")_.dirty();P.set(w.value,O.value)}return{status:_.value,value:P}})}else{let P=new Map;for(let $ of f){let{key:w,value:O}=$;if(w.status==="aborted"||O.status==="aborted")return W8;if(w.status==="dirty"||O.status==="dirty")_.dirty();P.set(w.value,O.value)}return{status:_.value,value:P}}}};QK.create=(q,_,j)=>{return new QK({valueType:_,keyType:q,typeName:v8.ZodMap,...Z8(j)})};u_=class u_ extends k8{_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.parsedType!==Q.set)return U(j,{code:t.invalid_type,expected:Q.set,received:j.parsedType}),W8;let K=this._def;if(K.minSize!==null){if(j.data.sizeK.maxSize.value)U(j,{code:t.too_big,maximum:K.maxSize.value,type:"set",inclusive:!0,exact:!1,message:K.maxSize.message}),_.dirty()}let Y=this._def.valueType;function f($){let w=new Set;for(let O of $){if(O.status==="aborted")return W8;if(O.status==="dirty")_.dirty();w.add(O.value)}return{status:_.value,value:w}}let P=[...j.data.values()].map(($,w)=>Y._parse(new Wq(j,$,j.path,w)));if(j.common.async)return Promise.all(P).then(($)=>f($));else return f(P)}min(q,_){return new u_({...this._def,minSize:{value:q,message:$8.toString(_)}})}max(q,_){return new u_({...this._def,maxSize:{value:q,message:$8.toString(_)}})}size(q,_){return this.min(q,_).max(q,_)}nonempty(q){return this.min(1,q)}};u_.create=(q,_)=>{return new u_({valueType:q,minSize:null,maxSize:null,typeName:v8.ZodSet,...Z8(_)})};_K=class _K extends k8{constructor(){super(...arguments);this.validate=this.implement}_parse(q){let{ctx:_}=this._processInputParams(q);if(_.parsedType!==Q.function)return U(_,{code:t.invalid_type,expected:Q.function,received:_.parsedType}),W8;function j(P,$){return Y7({data:P,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,P7(),KK].filter((w)=>!!w),issueData:{code:t.invalid_arguments,argumentsError:$}})}function K(P,$){return Y7({data:P,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,P7(),KK].filter((w)=>!!w),issueData:{code:t.invalid_return_type,returnTypeError:$}})}let Y={errorMap:_.common.contextualErrorMap},f=_.data;if(this._def.returns instanceof h_){let P=this;return M6(async function(...$){let w=new l6([]),O=await P._def.args.parseAsync($,Y).catch((v)=>{throw w.addIssue(j($,v)),w}),z=await Reflect.apply(f,this,O);return await P._def.returns._def.type.parseAsync(z,Y).catch((v)=>{throw w.addIssue(K(z,v)),w})})}else{let P=this;return M6(function(...$){let w=P._def.args.safeParse($,Y);if(!w.success)throw new l6([j($,w.error)]);let O=Reflect.apply(f,this,w.data),z=P._def.returns.safeParse(O,Y);if(!z.success)throw new l6([K(O,z.error)]);return z.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...q){return new _K({...this._def,args:Cq.create(q).rest(Uq.create())})}returns(q){return new _K({...this._def,returns:q})}implement(q){return this.parse(q)}strictImplement(q){return this.parse(q)}static create(q,_,j){return new _K({args:q?q:Cq.create([]).rest(Uq.create()),returns:_||Uq.create(),typeName:v8.ZodFunction,...Z8(j)})}};OK=class OK extends k8{get schema(){return this._def.getter()}_parse(q){let{ctx:_}=this._processInputParams(q);return this._def.getter()._parse({data:_.data,path:_.path,parent:_})}};OK.create=(q,_)=>{return new OK({getter:q,typeName:v8.ZodLazy,...Z8(_)})};wK=class wK extends k8{_parse(q){if(q.data!==this._def.value){let _=this._getOrReturnCtx(q);return U(_,{received:_.data,code:t.invalid_literal,expected:this._def.value}),W8}return{status:"valid",value:q.data}}get value(){return this._def.value}};wK.create=(q,_)=>{return new wK({value:q,typeName:v8.ZodLiteral,...Z8(_)})};q_=class q_ extends k8{_parse(q){if(typeof q.data!=="string"){let _=this._getOrReturnCtx(q),j=this._def.values;return U(_,{expected:h8.joinValues(j),received:_.parsedType,code:t.invalid_type}),W8}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(q.data)){let _=this._getOrReturnCtx(q),j=this._def.values;return U(_,{received:_.data,code:t.invalid_enum_value,options:j}),W8}return M6(q.data)}get options(){return this._def.values}get enum(){let q={};for(let _ of this._def.values)q[_]=_;return q}get Values(){let q={};for(let _ of this._def.values)q[_]=_;return q}get Enum(){let q={};for(let _ of this._def.values)q[_]=_;return q}extract(q,_=this._def){return q_.create(q,{...this._def,..._})}exclude(q,_=this._def){return q_.create(this.options.filter((j)=>!q.includes(j)),{...this._def,..._})}};q_.create=p1;zK=class zK extends k8{_parse(q){let _=h8.getValidEnumValues(this._def.values),j=this._getOrReturnCtx(q);if(j.parsedType!==Q.string&&j.parsedType!==Q.number){let K=h8.objectValues(_);return U(j,{expected:h8.joinValues(K),received:j.parsedType,code:t.invalid_type}),W8}if(!this._cache)this._cache=new Set(h8.getValidEnumValues(this._def.values));if(!this._cache.has(q.data)){let K=h8.objectValues(_);return U(j,{received:j.data,code:t.invalid_enum_value,options:K}),W8}return M6(q.data)}get enum(){return this._def.values}};zK.create=(q,_)=>{return new zK({values:q,typeName:v8.ZodNativeEnum,...Z8(_)})};h_=class h_ extends k8{unwrap(){return this._def.type}_parse(q){let{ctx:_}=this._processInputParams(q);if(_.parsedType!==Q.promise&&_.common.async===!1)return U(_,{code:t.invalid_type,expected:Q.promise,received:_.parsedType}),W8;let j=_.parsedType===Q.promise?_.data:Promise.resolve(_.data);return M6(j.then((K)=>{return this._def.type.parseAsync(K,{path:_.path,errorMap:_.common.contextualErrorMap})}))}};h_.create=(q,_)=>{return new h_({type:q,typeName:v8.ZodPromise,...Z8(_)})};e6=class e6 extends k8{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===v8.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(q){let{status:_,ctx:j}=this._processInputParams(q),K=this._def.effect||null,Y={addIssue:(f)=>{if(U(j,f),f.fatal)_.abort();else _.dirty()},get path(){return j.path}};if(Y.addIssue=Y.addIssue.bind(Y),K.type==="preprocess"){let f=K.transform(j.data,Y);if(j.common.async)return Promise.resolve(f).then(async(P)=>{if(_.value==="aborted")return W8;let $=await this._def.schema._parseAsync({data:P,path:j.path,parent:j});if($.status==="aborted")return W8;if($.status==="dirty")return qK($.value);if(_.value==="dirty")return qK($.value);return $});else{if(_.value==="aborted")return W8;let P=this._def.schema._parseSync({data:f,path:j.path,parent:j});if(P.status==="aborted")return W8;if(P.status==="dirty")return qK(P.value);if(_.value==="dirty")return qK(P.value);return P}}if(K.type==="refinement"){let f=(P)=>{let $=K.refinement(P,Y);if(j.common.async)return Promise.resolve($);if($ instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return P};if(j.common.async===!1){let P=this._def.schema._parseSync({data:j.data,path:j.path,parent:j});if(P.status==="aborted")return W8;if(P.status==="dirty")_.dirty();return f(P.value),{status:_.value,value:P.value}}else return this._def.schema._parseAsync({data:j.data,path:j.path,parent:j}).then((P)=>{if(P.status==="aborted")return W8;if(P.status==="dirty")_.dirty();return f(P.value).then(()=>{return{status:_.value,value:P.value}})})}if(K.type==="transform")if(j.common.async===!1){let f=this._def.schema._parseSync({data:j.data,path:j.path,parent:j});if(!X_(f))return W8;let P=K.transform(f.value,Y);if(P instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:_.value,value:P}}else return this._def.schema._parseAsync({data:j.data,path:j.path,parent:j}).then((f)=>{if(!X_(f))return W8;return Promise.resolve(K.transform(f.value,Y)).then((P)=>({status:_.value,value:P}))});h8.assertNever(K)}};e6.create=(q,_,j)=>{return new e6({schema:q,typeName:v8.ZodEffects,effect:_,...Z8(j)})};e6.createWithPreprocess=(q,_,j)=>{return new e6({schema:_,effect:{type:"preprocess",transform:q},typeName:v8.ZodEffects,...Z8(j)})};zq=class zq extends k8{_parse(q){if(this._getType(q)===Q.undefined)return M6(void 0);return this._def.innerType._parse(q)}unwrap(){return this._def.innerType}};zq.create=(q,_)=>{return new zq({innerType:q,typeName:v8.ZodOptional,...Z8(_)})};lq=class lq extends k8{_parse(q){if(this._getType(q)===Q.null)return M6(null);return this._def.innerType._parse(q)}unwrap(){return this._def.innerType}};lq.create=(q,_)=>{return new lq({innerType:q,typeName:v8.ZodNullable,...Z8(_)})};WK=class WK extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j=_.data;if(_.parsedType===Q.undefined)j=this._def.defaultValue();return this._def.innerType._parse({data:j,path:_.path,parent:_})}removeDefault(){return this._def.innerType}};WK.create=(q,_)=>{return new WK({innerType:q,typeName:v8.ZodDefault,defaultValue:typeof _.default==="function"?_.default:()=>_.default,...Z8(_)})};vK=class vK extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j={..._,common:{..._.common,issues:[]}},K=this._def.innerType._parse({data:j.data,path:j.path,parent:{...j}});if(FK(K))return K.then((Y)=>{return{status:"valid",value:Y.status==="valid"?Y.value:this._def.catchValue({get error(){return new l6(j.common.issues)},input:j.data})}});else return{status:"valid",value:K.status==="valid"?K.value:this._def.catchValue({get error(){return new l6(j.common.issues)},input:j.data})}}removeCatch(){return this._def.innerType}};vK.create=(q,_)=>{return new vK({innerType:q,typeName:v8.ZodCatch,catchValue:typeof _.catch==="function"?_.catch:()=>_.catch,...Z8(_)})};q3=class q3 extends k8{_parse(q){if(this._getType(q)!==Q.nan){let j=this._getOrReturnCtx(q);return U(j,{code:t.invalid_type,expected:Q.nan,received:j.parsedType}),W8}return{status:"valid",value:q.data}}};q3.create=(q)=>{return new q3({typeName:v8.ZodNaN,...Z8(q)})};Ov=Symbol("zod_brand");$7=class $7 extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j=_.data;return this._def.type._parse({data:j,path:_.path,parent:_})}unwrap(){return this._def.type}};_3=class _3 extends k8{_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.common.async)return(async()=>{let Y=await this._def.in._parseAsync({data:j.data,path:j.path,parent:j});if(Y.status==="aborted")return W8;if(Y.status==="dirty")return _.dirty(),qK(Y.value);else return this._def.out._parseAsync({data:Y.value,path:j.path,parent:j})})();else{let K=this._def.in._parseSync({data:j.data,path:j.path,parent:j});if(K.status==="aborted")return W8;if(K.status==="dirty")return _.dirty(),{status:"dirty",value:K.value};else return this._def.out._parseSync({data:K.value,path:j.path,parent:j})}}static create(q,_){return new _3({in:q,out:_,typeName:v8.ZodPipeline})}};HK=class HK extends k8{_parse(q){let _=this._def.innerType._parse(q),j=(K)=>{if(X_(K))K.value=Object.freeze(K.value);return K};return FK(_)?_.then((K)=>j(K)):j(_)}unwrap(){return this._def.innerType}};HK.create=(q,_)=>{return new HK({innerType:q,typeName:v8.ZodReadonly,...Z8(_)})};wv={object:B8.lazycreate};(function(q){q.ZodString="ZodString",q.ZodNumber="ZodNumber",q.ZodNaN="ZodNaN",q.ZodBigInt="ZodBigInt",q.ZodBoolean="ZodBoolean",q.ZodDate="ZodDate",q.ZodSymbol="ZodSymbol",q.ZodUndefined="ZodUndefined",q.ZodNull="ZodNull",q.ZodAny="ZodAny",q.ZodUnknown="ZodUnknown",q.ZodNever="ZodNever",q.ZodVoid="ZodVoid",q.ZodArray="ZodArray",q.ZodObject="ZodObject",q.ZodUnion="ZodUnion",q.ZodDiscriminatedUnion="ZodDiscriminatedUnion",q.ZodIntersection="ZodIntersection",q.ZodTuple="ZodTuple",q.ZodRecord="ZodRecord",q.ZodMap="ZodMap",q.ZodSet="ZodSet",q.ZodFunction="ZodFunction",q.ZodLazy="ZodLazy",q.ZodLiteral="ZodLiteral",q.ZodEnum="ZodEnum",q.ZodEffects="ZodEffects",q.ZodNativeEnum="ZodNativeEnum",q.ZodOptional="ZodOptional",q.ZodNullable="ZodNullable",q.ZodDefault="ZodDefault",q.ZodCatch="ZodCatch",q.ZodPromise="ZodPromise",q.ZodBranded="ZodBranded",q.ZodPipeline="ZodPipeline",q.ZodReadonly="ZodReadonly"})(v8||(v8={}));x1=Oq.create,n1=sq.create,Wv=q3.create,vv=Qq.create,c1=jK.create,Hv=A_.create,Jv=eK.create,Tv=PK.create,Zv=YK.create,kv=G_.create,Xv=Uq.create,Av=hq.create,Gv=UK.create,uv=wq.create,hv=B8.create,Cv=B8.strictCreate,Dv=fK.create,Vv=f7.create,Mv=$K.create,Nv=Cq.create,bv=sK.create,Sv=QK.create,Ev=u_.create,Rv=_K.create,Iv=OK.create,mv=wK.create,gv=q_.create,yv=zK.create,dv=h_.create,C1=e6.create,Lv=zq.create,pv=lq.create,lv=e6.createWithPreprocess,xv=_3.create,iv={string:(q)=>Oq.create({...q,coerce:!0}),number:(q)=>sq.create({...q,coerce:!0}),boolean:(q)=>jK.create({...q,coerce:!0}),bigint:(q)=>Qq.create({...q,coerce:!0}),date:(q)=>A_.create({...q,coerce:!0})},ov=W8,r1=X.union([X.string(),X.number().int()]),i1=X.string(),av=X.object({progressToken:X.optional(r1)}).passthrough(),U6=X.object({_meta:X.optional(av)}).passthrough(),m6=X.object({method:X.string(),params:X.optional(U6)}),K3=X.object({_meta:X.optional(X.object({}).passthrough())}).passthrough(),Dq=X.object({method:X.string(),params:X.optional(K3)}),s6=X.object({_meta:X.optional(X.object({}).passthrough())}).passthrough(),w7=X.union([X.string(),X.number().int()]),Bv=X.object({jsonrpc:X.literal(O7),id:w7}).merge(m6).strict(),tv=X.object({jsonrpc:X.literal(O7)}).merge(Dq).strict(),Fv=X.object({jsonrpc:X.literal(O7),id:w7,result:s6}).strict();(function(q){q[q.ConnectionClosed=-32000]="ConnectionClosed",q[q.RequestTimeout=-32001]="RequestTimeout",q[q.ParseError=-32700]="ParseError",q[q.InvalidRequest=-32600]="InvalidRequest",q[q.MethodNotFound=-32601]="MethodNotFound",q[q.InvalidParams=-32602]="InvalidParams",q[q.InternalError=-32603]="InternalError"})(D1||(D1={}));ev=X.object({jsonrpc:X.literal(O7),id:w7,error:X.object({code:X.number().int(),message:X.string(),data:X.optional(X.unknown())})}).strict(),dM=X.union([Bv,tv,Fv,ev]),o1=s6.strict(),a1=Dq.extend({method:X.literal("notifications/cancelled"),params:K3.extend({requestId:w7,reason:X.string().optional()})}),j3=X.object({name:X.string(),title:X.optional(X.string())}).passthrough(),B1=j3.extend({version:X.string()}),Uv=X.object({experimental:X.optional(X.object({}).passthrough()),sampling:X.optional(X.object({}).passthrough()),elicitation:X.optional(X.object({}).passthrough()),roots:X.optional(X.object({listChanged:X.optional(X.boolean())}).passthrough())}).passthrough(),sv=m6.extend({method:X.literal("initialize"),params:U6.extend({protocolVersion:X.string(),capabilities:Uv,clientInfo:B1})}),Qv=X.object({experimental:X.optional(X.object({}).passthrough()),logging:X.optional(X.object({}).passthrough()),completions: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(),qH=s6.extend({protocolVersion:X.string(),capabilities:Qv,serverInfo:B1,instructions:X.optional(X.string())}),_H=Dq.extend({method:X.literal("notifications/initialized")}),t1=m6.extend({method:X.literal("ping")}),KH=X.object({progress:X.number(),total:X.optional(X.number()),message:X.optional(X.string())}).passthrough(),F1=Dq.extend({method:X.literal("notifications/progress"),params:K3.merge(KH).extend({progressToken:r1})}),z7=m6.extend({params:U6.extend({cursor:X.optional(i1)}).optional()}),W7=s6.extend({nextCursor:X.optional(i1)}),e1=X.object({uri:X.string(),mimeType:X.optional(X.string()),_meta:X.optional(X.object({}).passthrough())}).passthrough(),U1=e1.extend({text:X.string()}),e4=X.string().refine((q)=>{try{return atob(q),!0}catch(_){return!1}},{message:"Invalid Base64 string"}),s1=e1.extend({blob:e4}),Q1=j3.extend({uri:X.string(),description:X.optional(X.string()),mimeType:X.optional(X.string()),_meta:X.optional(X.object({}).passthrough())}),jH=j3.extend({uriTemplate:X.string(),description:X.optional(X.string()),mimeType:X.optional(X.string()),_meta:X.optional(X.object({}).passthrough())}),PH=z7.extend({method:X.literal("resources/list")}),YH=W7.extend({resources:X.array(Q1)}),fH=z7.extend({method:X.literal("resources/templates/list")}),$H=W7.extend({resourceTemplates:X.array(jH)}),OH=m6.extend({method:X.literal("resources/read"),params:U6.extend({uri:X.string()})}),wH=s6.extend({contents:X.array(X.union([U1,s1]))}),zH=Dq.extend({method:X.literal("notifications/resources/list_changed")}),WH=m6.extend({method:X.literal("resources/subscribe"),params:U6.extend({uri:X.string()})}),vH=m6.extend({method:X.literal("resources/unsubscribe"),params:U6.extend({uri:X.string()})}),HH=Dq.extend({method:X.literal("notifications/resources/updated"),params:K3.extend({uri:X.string()})}),JH=X.object({name:X.string(),description:X.optional(X.string()),required:X.optional(X.boolean())}).passthrough(),TH=j3.extend({description:X.optional(X.string()),arguments:X.optional(X.array(JH)),_meta:X.optional(X.object({}).passthrough())}),ZH=z7.extend({method:X.literal("prompts/list")}),kH=W7.extend({prompts:X.array(TH)}),XH=m6.extend({method:X.literal("prompts/get"),params:U6.extend({name:X.string(),arguments:X.optional(X.record(X.string()))})}),U4=X.object({type:X.literal("text"),text:X.string(),_meta:X.optional(X.object({}).passthrough())}).passthrough(),s4=X.object({type:X.literal("image"),data:e4,mimeType:X.string(),_meta:X.optional(X.object({}).passthrough())}).passthrough(),Q4=X.object({type:X.literal("audio"),data:e4,mimeType:X.string(),_meta:X.optional(X.object({}).passthrough())}).passthrough(),AH=X.object({type:X.literal("resource"),resource:X.union([U1,s1]),_meta:X.optional(X.object({}).passthrough())}).passthrough(),GH=Q1.extend({type:X.literal("resource_link")}),qj=X.union([U4,s4,Q4,GH,AH]),uH=X.object({role:X.enum(["user","assistant"]),content:qj}).passthrough(),hH=s6.extend({description:X.optional(X.string()),messages:X.array(uH)}),CH=Dq.extend({method:X.literal("notifications/prompts/list_changed")}),DH=X.object({title:X.optional(X.string()),readOnlyHint:X.optional(X.boolean()),destructiveHint:X.optional(X.boolean()),idempotentHint:X.optional(X.boolean()),openWorldHint:X.optional(X.boolean())}).passthrough(),VH=j3.extend({description:X.optional(X.string()),inputSchema:X.object({type:X.literal("object"),properties:X.optional(X.object({}).passthrough()),required:X.optional(X.array(X.string()))}).passthrough(),outputSchema:X.optional(X.object({type:X.literal("object"),properties:X.optional(X.object({}).passthrough()),required:X.optional(X.array(X.string()))}).passthrough()),annotations:X.optional(DH),_meta:X.optional(X.object({}).passthrough())}),MH=z7.extend({method:X.literal("tools/list")}),NH=W7.extend({tools:X.array(VH)}),_j=s6.extend({content:X.array(qj).default([]),structuredContent:X.object({}).passthrough().optional(),isError:X.optional(X.boolean())}),LM=_j.or(s6.extend({toolResult:X.unknown()})),bH=m6.extend({method:X.literal("tools/call"),params:U6.extend({name:X.string(),arguments:X.optional(X.record(X.unknown()))})}),SH=Dq.extend({method:X.literal("notifications/tools/list_changed")}),Kj=X.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),EH=m6.extend({method:X.literal("logging/setLevel"),params:U6.extend({level:Kj})}),RH=Dq.extend({method:X.literal("notifications/message"),params:K3.extend({level:Kj,logger:X.optional(X.string()),data:X.unknown()})}),IH=X.object({name:X.string().optional()}).passthrough(),mH=X.object({hints:X.optional(X.array(IH)),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(),gH=X.object({role:X.enum(["user","assistant"]),content:X.union([U4,s4,Q4])}).passthrough(),yH=m6.extend({method:X.literal("sampling/createMessage"),params:U6.extend({messages:X.array(gH),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(mH)})}),dH=s6.extend({model:X.string(),stopReason:X.optional(X.enum(["endTurn","stopSequence","maxTokens"]).or(X.string())),role:X.enum(["user","assistant"]),content:X.discriminatedUnion("type",[U4,s4,Q4])}),LH=X.object({type:X.literal("boolean"),title:X.optional(X.string()),description:X.optional(X.string()),default:X.optional(X.boolean())}).passthrough(),pH=X.object({type:X.literal("string"),title:X.optional(X.string()),description:X.optional(X.string()),minLength:X.optional(X.number()),maxLength:X.optional(X.number()),format:X.optional(X.enum(["email","uri","date","date-time"]))}).passthrough(),lH=X.object({type:X.enum(["number","integer"]),title:X.optional(X.string()),description:X.optional(X.string()),minimum:X.optional(X.number()),maximum:X.optional(X.number())}).passthrough(),xH=X.object({type:X.literal("string"),title:X.optional(X.string()),description:X.optional(X.string()),enum:X.array(X.string()),enumNames:X.optional(X.array(X.string()))}).passthrough(),nH=X.union([LH,pH,lH,xH]),cH=m6.extend({method:X.literal("elicitation/create"),params:U6.extend({message:X.string(),requestedSchema:X.object({type:X.literal("object"),properties:X.record(X.string(),nH),required:X.optional(X.array(X.string()))}).passthrough()})}),rH=s6.extend({action:X.enum(["accept","decline","cancel"]),content:X.optional(X.record(X.string(),X.unknown()))}),iH=X.object({type:X.literal("ref/resource"),uri:X.string()}).passthrough(),oH=X.object({type:X.literal("ref/prompt"),name:X.string()}).passthrough(),aH=m6.extend({method:X.literal("completion/complete"),params:U6.extend({ref:X.union([oH,iH]),argument:X.object({name:X.string(),value:X.string()}).passthrough(),context:X.optional(X.object({arguments:X.optional(X.record(X.string(),X.string()))}))})}),BH=s6.extend({completion:X.object({values:X.array(X.string()).max(100),total:X.optional(X.number().int()),hasMore:X.optional(X.boolean())}).passthrough()}),tH=X.object({uri:X.string().startsWith("file://"),name:X.optional(X.string()),_meta:X.optional(X.object({}).passthrough())}).passthrough(),FH=m6.extend({method:X.literal("roots/list")}),eH=s6.extend({roots:X.array(tH)}),UH=Dq.extend({method:X.literal("notifications/roots/list_changed")}),pM=X.union([t1,sv,aH,EH,XH,ZH,PH,fH,OH,WH,vH,bH,MH]),lM=X.union([a1,F1,_H,UH]),xM=X.union([o1,dH,rH,eH]),nM=X.union([t1,yH,cH,FH]),cM=X.union([a1,F1,RH,HH,zH,SH,CH]),rM=X.union([o1,qH,BH,hH,kH,YH,$H,wH,_j,NH]),iM=az(NW(),1),oM=Symbol("Let zodToJsonSchema decide on which parser to use"),aM=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");(function(q){q.Completable="McpCompletable"})(o4||(o4={}));a4=class a4 extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j=_.data;return this._def.type._parse({data:j,path:_.path,parent:_})}unwrap(){return this._def.type}};a4.create=(q,_)=>{return new a4({type:q,typeName:o4.Completable,complete:_.complete,...sH(_)})}});var jj={};$q(jj,{version:()=>_J,type:()=>jJ,scripts:()=>YJ,repository:()=>wJ,publishConfig:()=>vJ,name:()=>qJ,main:()=>PJ,license:()=>OJ,keywords:()=>fJ,homepage:()=>zJ,files:()=>kJ,engines:()=>TJ,devDependencies:()=>JJ,description:()=>KJ,dependencies:()=>HJ,default:()=>XJ,bugs:()=>WJ,bin:()=>ZJ,author:()=>$J});var qJ="claude-mem",_J="3.7.1",KJ="Memory compression system for Claude Code - persist context across sessions",jJ="module",PJ="claude-mem",YJ,fJ,$J="Alex Newman",OJ="SEE LICENSE IN LICENSE",wJ,zJ="https://github.com/thedotmack/claude-mem#readme",WJ,vJ,HJ,JJ,TJ,ZJ,kJ,XJ;var Pj=R8(()=>{YJ={dev:"tsx src/bin/cli.ts","dev:install":"node dist/claude-mem.min.js install --force","dev:status":"node dist/claude-mem.min.js status","dev:compress":"node dist/claude-mem.min.js compress","dev:load":"node dist/claude-mem.min.js load-context","dev:uninstall":"node dist/claude-mem.min.js uninstall",build:"./scripts/build-minified.sh","test:watch":"npm test -- --watch",lint:"eslint 'src/**/*.ts' 'hooks/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix",format:"prettier --write 'src/**/*.ts' 'hooks/**/*.ts' 'test/**/*.ts'","build:npm":"./scripts/npm-publish.sh",publish:"./scripts/publish-with-changelog.sh","publish:latest":"./scripts/publish-with-changelog.sh bump","publish:github":"./scripts/github-publish.sh"},fJ=["claude","claude-code","mcp","memory","compression","knowledge-graph","transcript","cli","typescript","bun"],wJ={type:"git",url:"https://github.com/thedotmack/claude-mem.git"},WJ={url:"https://github.com/thedotmack/claude-mem/issues"},vJ={access:"public",registry:"https://registry.npmjs.org/"},HJ={"@anthropic-ai/claude-code":"^1.0.88","@clack/prompts":"^0.11.0","@modelcontextprotocol/sdk":"^0.5.0","better-sqlite3":"^11.8.0",boxen:"^8.0.1",chalk:"^5.6.0",chromadb:"^3.0.14",commander:"^14.0.0",cors:"^2.8.5",express:"^5.1.0",glob:"^11.0.3","gradient-string":"^3.0.0",handlebars:"^4.7.8",http:"^0.0.1-security","oh-my-logo":"^0.3.2",open:"^10.2.0"},JJ={"@types/chai":"^4.3.0","@types/handlebars":"^4.0.40","@types/node":"^20.0.0","@typescript-eslint/eslint-plugin":"^6.0.0","@typescript-eslint/parser":"^6.0.0",chai:"^4.3.0",eslint:"^8.0.0",prettier:"^3.0.0","ts-node":"^10.0.0",tsx:"^4.20.5",typescript:"^5.0.0"},TJ={node:">=18.0.0",bun:">=1.0.0"},ZJ={"claude-mem":"dist/claude-mem.min.js"},kJ=["dist","hooks","commands","docs","src","CHANGELOG.md"],XJ={name:qJ,version:_J,description:KJ,type:jJ,main:PJ,scripts:YJ,keywords:fJ,author:$J,license:OJ,repository:wJ,homepage:zJ,bugs:WJ,publishConfig:vJ,dependencies:HJ,devDependencies:JJ,engines:TJ,bin:ZJ,files:kJ}});import{join as Q8,dirname as H7,sep as AJ}from"path";import{homedir as q2}from"os";import{existsSync as P3,statSync as GJ}from"fs";import{execSync as uJ}from"child_process";import{fileURLToPath as hJ}from"url";class _8{static instance=null;_dataDirectory=null;_packageRoot=null;_claudeConfigDirectory=null;static getInstance(){if(!_8.instance)_8.instance=new _8;return _8.instance}getDataDirectory(){if(this._dataDirectory)return this._dataDirectory;return this._dataDirectory=process.env.CLAUDE_MEM_DATA_DIR||Q8(q2(),".claude-mem"),this._dataDirectory}getArchivesDirectory(){return Q8(this.getDataDirectory(),"archives")}getHooksDirectory(){return Q8(this.getDataDirectory(),"hooks")}getLogsDirectory(){return Q8(this.getDataDirectory(),"logs")}getIndexDirectory(){return this.getDataDirectory()}getIndexPath(){return Q8(this.getIndexDirectory(),"claude-mem-index.jsonl")}getTrashDirectory(){return Q8(this.getDataDirectory(),"trash")}getBackupsDirectory(){return Q8(this.getDataDirectory(),"backups")}getChromaDirectory(){return Q8(this.getDataDirectory(),"chroma")}getProjectArchiveDirectory(q){return Q8(this.getArchivesDirectory(),q)}getUserSettingsPath(){return Q8(this.getDataDirectory(),"settings.json")}getClaudeConfigDirectory(){if(this._claudeConfigDirectory)return this._claudeConfigDirectory;return this._claudeConfigDirectory=process.env.CLAUDE_CONFIG_DIR||Q8(q2(),".claude"),this._claudeConfigDirectory}getClaudeSettingsPath(){return Q8(this.getClaudeConfigDirectory(),"settings.json")}getClaudeCommandsDirectory(){return Q8(this.getClaudeConfigDirectory(),"commands")}getClaudeMdPath(){return Q8(this.getClaudeConfigDirectory(),"CLAUDE.md")}getMcpConfigPath(){return Q8(q2(),".claude.json")}getProjectMcpConfigPath(){return Q8(process.cwd(),".mcp.json")}getPackageRoot(){if(this._packageRoot)return this._packageRoot;try{let j=g8.resolve("/Users/alexnewman/Scripts/claude-mem-source/package.json");return this._packageRoot=H7(j),this._packageRoot}catch{}let q=hJ(import.meta.url),_=H7(q);for(let j=0;j<10;j++){let K=Q8(_,"package.json");if(P3(K))try{if(g8(K).name==="claude-mem")return this._packageRoot=_,this._packageRoot}catch{}let Y=H7(_);if(Y===_)break;_=Y}try{let j=uJ("npm list -g claude-mem --json 2>/dev/null || npm list claude-mem --json 2>/dev/null",{encoding:"utf8"}),K=JSON.parse(j);if(K.dependencies?.["claude-mem"]?.resolved)return this._packageRoot=H7(K.dependencies["claude-mem"].resolved),this._packageRoot}catch{}throw new Error("Cannot locate claude-mem package root. Ensure claude-mem is properly installed.")}findPackageHooksDirectory(){let q=this.getPackageRoot(),_=Q8(q,"hooks"),j=["pre-compact.js","session-start.js"];for(let K of j)if(!P3(Q8(_,K)))throw new Error(`Package hooks directory missing required file: ${K}`);return _}findPackageCommandsDirectory(){let q=this.getPackageRoot(),_=Q8(q,"commands"),j=["save.md"];for(let K of j)if(!P3(Q8(_,K)))throw new Error(`Package commands directory missing required file: ${K}`);return _}ensureDirectory(q){if(!P3(q))g8("fs").mkdirSync(q,{recursive:!0})}ensureDirectories(q){q.forEach((_)=>this.ensureDirectory(_))}ensureAllDataDirectories(){this.ensureDirectories([this.getDataDirectory(),this.getArchivesDirectory(),this.getHooksDirectory(),this.getLogsDirectory(),this.getTrashDirectory(),this.getBackupsDirectory(),this.getChromaDirectory()])}ensureAllClaudeDirectories(){this.ensureDirectories([this.getClaudeConfigDirectory(),this.getClaudeCommandsDirectory()])}static extractProjectName(q){let _=q.split(AJ),j=["src","lib","app","project","workspace"];for(let K=_.length-1;K>=0;K--)if(j.includes(_[K])&&K>0)return _[K-1];if(_.length>1)return _[_.length-2];return"unknown-project"}static getCurrentProjectName(){return g8("path").basename(process.cwd())}static createBackupFilename(q){let _=new Date().toISOString().replace(/[:.]/g,"-").replace("T","_").slice(0,19);return`${q}.backup.${_}`}static isPathAccessible(q){try{return P3(q)&&GJ(q).isDirectory()}catch{return!1}}static getDataDirectory(){return _8.getInstance().getDataDirectory()}static getArchivesDirectory(){return _8.getInstance().getArchivesDirectory()}static getHooksDirectory(){return _8.getInstance().getHooksDirectory()}static getLogsDirectory(){return _8.getInstance().getLogsDirectory()}static getClaudeSettingsPath(){return _8.getInstance().getClaudeSettingsPath()}static getClaudeMdPath(){return _8.getInstance().getClaudeMdPath()}static findPackageHooksDirectory(){return _8.getInstance().findPackageHooksDirectory()}static findPackageCommandsDirectory(){return _8.getInstance().findPackageCommandsDirectory()}}var QM;var G6=R8(()=>{QM=_8.getInstance()});class nq{pathDiscovery;constructor(){this.pathDiscovery=_8.getInstance()}getConfigDir(){return this.pathDiscovery.getDataDirectory()}getIndexDir(){return this.pathDiscovery.getIndexDirectory()}getIndexPath(){return this.pathDiscovery.getIndexPath()}getArchiveDir(){return this.pathDiscovery.getArchivesDirectory()}getProjectArchiveDir(q){return this.pathDiscovery.getProjectArchiveDirectory(q)}getLogsDir(){return this.pathDiscovery.getLogsDirectory()}static ensureDirectory(q){_8.getInstance().ensureDirectory(q)}static ensureDirectories(q){_8.getInstance().ensureDirectories(q)}static extractProjectName(q){return _8.extractProjectName(q)}static getCurrentProjectPrefix(){return _8.getCurrentProjectName()}static getCurrentProjectName(){return _8.getCurrentProjectName()}}var _2=R8(()=>{G6()});var N6=F((mJ)=>{mJ.__esModule=!0;mJ.extend=Yj;mJ.indexOf=NJ;mJ.escapeExpression=bJ;mJ.isEmpty=SJ;mJ.createFrame=EJ;mJ.blockParams=RJ;mJ.appendContextPath=IJ;var CJ={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="},DJ=/[&<>"'`=]/g,VJ=/[&<>"'`=]/;function MJ(q){return CJ[q]}function Yj(q){for(var _=1;_{$j.__esModule=!0;var P2=["description","fileName","lineNumber","endLineNumber","message","name","number","stack"];function Y2(q,_){var j=_&&_.loc,K=void 0,Y=void 0,f=void 0,P=void 0;if(j)K=j.start.line,Y=j.end.line,f=j.start.column,P=j.end.column,q+=" - "+K+":"+f;var $=Error.prototype.constructor.call(this,q);for(var w=0;w{wj.__esModule=!0;var f2=N6();wj.default=function(q){q.registerHelper("blockHelperMissing",function(_,j){var{inverse:K,fn:Y}=j;if(_===!0)return Y(this);else if(_===!1||_==null)return K(this);else if(f2.isArray(_))if(_.length>0){if(j.ids)j.ids=[j.name];return q.helpers.each(_,j)}else return K(this);else{if(j.data&&j.ids){var f=f2.createFrame(j.data);f.contextPath=f2.appendContextPath(j.data.contextPath,j.name),j={data:f}}return Y(_,j)}})};zj.exports=wj.default});var Jj=F((vj,Hj)=>{vj.__esModule=!0;function FJ(q){return q&&q.__esModule?q:{default:q}}var Y3=N6(),eJ=Q6(),UJ=FJ(eJ);vj.default=function(q){q.registerHelper("each",function(_,j){if(!j)throw new UJ.default("Must pass iterator to #each");var{fn:K,inverse:Y}=j,f=0,P="",$=void 0,w=void 0;if(j.data&&j.ids)w=Y3.appendContextPath(j.data.contextPath,j.ids[0])+".";if(Y3.isFunction(_))_=_.call(this);if(j.data)$=Y3.createFrame(j.data);function O(T,J,k){if($){if($.key=T,$.index=J,$.first=J===0,$.last=!!k,w)$.contextPath=w+T}P=P+K(_[T],{data:$,blockParams:Y3.blockParams([_[T],T],[w+T,null])})}if(_&&typeof _==="object")if(Y3.isArray(_)){for(var z=_.length;f{Tj.__esModule=!0;function qT(q){return q&&q.__esModule?q:{default:q}}var _T=Q6(),KT=qT(_T);Tj.default=function(q){q.registerHelper("helperMissing",function(){if(arguments.length===1)return;else throw new KT.default('Missing helper: "'+arguments[arguments.length-1].name+'"')})};Zj.exports=Tj.default});var hj=F((Gj,uj)=>{Gj.__esModule=!0;function YT(q){return q&&q.__esModule?q:{default:q}}var Xj=N6(),fT=Q6(),Aj=YT(fT);Gj.default=function(q){q.registerHelper("if",function(_,j){if(arguments.length!=2)throw new Aj.default("#if requires exactly one argument");if(Xj.isFunction(_))_=_.call(this);if(!j.hash.includeZero&&!_||Xj.isEmpty(_))return j.inverse(this);else return j.fn(this)}),q.registerHelper("unless",function(_,j){if(arguments.length!=2)throw new Aj.default("#unless requires exactly one argument");return q.helpers.if.call(this,_,{fn:j.inverse,inverse:j.fn,hash:j.hash})})};uj.exports=Gj.default});var Vj=F((Cj,Dj)=>{Cj.__esModule=!0;Cj.default=function(q){q.registerHelper("log",function(){var _=[void 0],j=arguments[arguments.length-1];for(var K=0;K{Mj.__esModule=!0;Mj.default=function(q){q.registerHelper("lookup",function(_,j,K){if(!_)return _;return K.lookupProperty(_,j)})};Nj.exports=Mj.default});var Rj=F((Sj,Ej)=>{Sj.__esModule=!0;function HT(q){return q&&q.__esModule?q:{default:q}}var f3=N6(),JT=Q6(),TT=HT(JT);Sj.default=function(q){q.registerHelper("with",function(_,j){if(arguments.length!=2)throw new TT.default("#with requires exactly one argument");if(f3.isFunction(_))_=_.call(this);var K=j.fn;if(!f3.isEmpty(_)){var Y=j.data;if(j.data&&j.ids)Y=f3.createFrame(j.data),Y.contextPath=f3.appendContextPath(j.data.contextPath,j.ids[0]);return K(_,{data:Y,blockParams:f3.blockParams([_],[Y&&Y.contextPath])})}else return j.inverse(this)})};Ej.exports=Sj.default});var $2=F((gT)=>{gT.__esModule=!0;gT.registerDefaultHelpers=IT;gT.moveHelperToHooks=mT;function C_(q){return q&&q.__esModule?q:{default:q}}var XT=Wj(),AT=C_(XT),GT=Jj(),uT=C_(GT),hT=kj(),CT=C_(hT),DT=hj(),VT=C_(DT),MT=Vj(),NT=C_(MT),bT=bj(),ST=C_(bT),ET=Rj(),RT=C_(ET);function IT(q){AT.default(q),uT.default(q),CT.default(q),VT.default(q),NT.default(q),ST.default(q),RT.default(q)}function mT(q,_,j){if(q.helpers[_]){if(q.hooks[_]=q.helpers[_],!j)delete q.helpers[_]}}});var gj=F((Ij,mj)=>{Ij.__esModule=!0;var pT=N6();Ij.default=function(q){q.registerDecorator("inline",function(_,j,K,Y){var f=_;if(!j.partials)j.partials={},f=function(P,$){var w=K.partials;K.partials=pT.extend({},w,j.partials);var O=_(P,$);return K.partials=w,O};return j.partials[Y.args[0]]=Y.fn,f})};mj.exports=Ij.default});var yj=F((oT)=>{oT.__esModule=!0;oT.registerDefaultDecorators=iT;function nT(q){return q&&q.__esModule?q:{default:q}}var cT=gj(),rT=nT(cT);function iT(q){rT.default(q)}});var O2=F((dj,Lj)=>{dj.__esModule=!0;var tT=N6(),TK={methodMap:["debug","info","warn","error"],level:"info",lookupLevel:function q(_){if(typeof _==="string"){var j=tT.indexOf(TK.methodMap,_.toLowerCase());if(j>=0)_=j;else _=parseInt(_,10)}return _},log:function q(_){if(_=TK.lookupLevel(_),typeof console!=="undefined"&&TK.lookupLevel(TK.level)<=_){var j=TK.methodMap[_];if(!console[j])j="log";for(var K=arguments.length,Y=Array(K>1?K-1:0),f=1;f{QT.__esModule=!0;QT.createNewLookupObject=sT;var UT=N6();function sT(){for(var q=arguments.length,_=Array(q),j=0;j{wZ.__esModule=!0;wZ.createProtoAccessControl=YZ;wZ.resultIsAllowed=fZ;wZ.resetLoggedProperties=OZ;function KZ(q){return q&&q.__esModule?q:{default:q}}var lj=pj(),jZ=O2(),PZ=KZ(jZ),J7=Object.create(null);function YZ(q){var _=Object.create(null);_.constructor=!1,_.__defineGetter__=!1,_.__defineSetter__=!1,_.__lookupGetter__=!1;var j=Object.create(null);return j.__proto__=!1,{properties:{whitelist:lj.createNewLookupObject(j,q.allowedProtoProperties),defaultValue:q.allowProtoPropertiesByDefault},methods:{whitelist:lj.createNewLookupObject(_,q.allowedProtoMethods),defaultValue:q.allowProtoMethodsByDefault}}}function fZ(q,_,j){if(typeof q==="function")return xj(_.methods,j);else return xj(_.properties,j)}function xj(q,_){if(q.whitelist[_]!==void 0)return q.whitelist[_]===!0;if(q.defaultValue!==void 0)return q.defaultValue;return $Z(_),!1}function $Z(q){if(J7[q]!==!0)J7[q]=!0,PZ.default.log("error",'Handlebars: Access has been denied to resolve the property "'+q+`" because it is not an "own property" of its parent. +`))}this.transport.endInput()}catch(_){if(!(_ instanceof Q_))throw _}}handleHookCallbacks(q,_,j,K){let Y=this.hookCallbacks.get(q);if(!Y)throw new Error(`No hook callback found for ID: ${q}`);return Y(_,j,{signal:K})}sendMcpServerMessageToCli(q,_){if("id"in _&&_.id!==null&&_.id!==void 0){let j=`${q}:${_.id}`,K=this.pendingMcpResponses.get(j);if(K){K.resolve(_),this.pendingMcpResponses.delete(j);return}}throw new Error("No pending request found")}handleMcpControlRequest(q,_,j){let K="id"in _.message?_.message.id:null,Y=`${q}:${K}`;return new Promise((f,P)=>{let $=null,w=()=>{if($)clearTimeout($);this.pendingMcpResponses.delete(Y)},O=(W)=>{w(),f(W)},z=(W)=>{w(),P(W)};if(this.pendingMcpResponses.set(Y,{resolve:O,reject:z}),j.onmessage)j.onmessage(_.message);else{w(),P(new Error("No message handler registered"));return}$=setTimeout(()=>{if(this.pendingMcpResponses.has(Y))w(),P(new Error("Request timeout"))},30000)})}};X={};Bz(X,{void:()=>Gv,util:()=>h8,unknown:()=>Xv,union:()=>Dv,undefined:()=>Tv,tuple:()=>Nv,transformer:()=>C1,symbol:()=>Jv,string:()=>x1,strictObject:()=>Cv,setErrorMap:()=>lW,set:()=>Ev,record:()=>bv,quotelessJson:()=>LW,promise:()=>dv,preprocess:()=>lv,pipeline:()=>xv,ostring:()=>nv,optional:()=>Lv,onumber:()=>cv,oboolean:()=>rv,objectUtil:()=>n4,object:()=>hv,number:()=>n1,nullable:()=>pv,null:()=>Zv,never:()=>Av,nativeEnum:()=>yv,nan:()=>Wv,map:()=>Sv,makeIssue:()=>Y7,literal:()=>mv,lazy:()=>Iv,late:()=>wv,isValid:()=>X_,isDirty:()=>r4,isAsync:()=>FK,isAborted:()=>c4,intersection:()=>Mv,instanceof:()=>zv,getParsedType:()=>pq,getErrorMap:()=>P7,function:()=>Rv,enum:()=>gv,effect:()=>C1,discriminatedUnion:()=>Vv,defaultErrorMap:()=>KK,datetimeRegex:()=>L1,date:()=>Hv,custom:()=>l1,coerce:()=>iv,boolean:()=>c1,bigint:()=>vv,array:()=>uv,any:()=>kv,addIssueToContext:()=>U,ZodVoid:()=>UK,ZodUnknown:()=>Uq,ZodUnion:()=>fK,ZodUndefined:()=>PK,ZodType:()=>k8,ZodTuple:()=>Cq,ZodTransformer:()=>e6,ZodSymbol:()=>eK,ZodString:()=>Oq,ZodSet:()=>u_,ZodSchema:()=>k8,ZodRecord:()=>sK,ZodReadonly:()=>HK,ZodPromise:()=>h_,ZodPipeline:()=>_3,ZodParsedType:()=>Q,ZodOptional:()=>zq,ZodObject:()=>B8,ZodNumber:()=>sq,ZodNullable:()=>lq,ZodNull:()=>YK,ZodNever:()=>hq,ZodNativeEnum:()=>zK,ZodNaN:()=>q3,ZodMap:()=>QK,ZodLiteral:()=>wK,ZodLazy:()=>OK,ZodIssueCode:()=>t,ZodIntersection:()=>$K,ZodFunction:()=>_K,ZodFirstPartyTypeKind:()=>v8,ZodError:()=>l6,ZodEnum:()=>q_,ZodEffects:()=>e6,ZodDiscriminatedUnion:()=>f7,ZodDefault:()=>WK,ZodDate:()=>A_,ZodCatch:()=>vK,ZodBranded:()=>$7,ZodBoolean:()=>jK,ZodBigInt:()=>Qq,ZodArray:()=>wq,ZodAny:()=>G_,Schema:()=>k8,ParseStatus:()=>A6,OK:()=>M6,NEVER:()=>ov,INVALID:()=>W8,EMPTY_PATH:()=>xW,DIRTY:()=>qK,BRAND:()=>Ov});(function(q){q.assertEqual=(Y)=>{};function _(Y){}q.assertIs=_;function j(Y){throw new Error}q.assertNever=j,q.arrayToEnum=(Y)=>{let f={};for(let P of Y)f[P]=P;return f},q.getValidEnumValues=(Y)=>{let f=q.objectKeys(Y).filter(($)=>typeof Y[Y[$]]!=="number"),P={};for(let $ of f)P[$]=Y[$];return q.objectValues(P)},q.objectValues=(Y)=>{return q.objectKeys(Y).map(function(f){return Y[f]})},q.objectKeys=typeof Object.keys==="function"?(Y)=>Object.keys(Y):(Y)=>{let f=[];for(let P in Y)if(Object.prototype.hasOwnProperty.call(Y,P))f.push(P);return f},q.find=(Y,f)=>{for(let P of Y)if(f(P))return P;return},q.isInteger=typeof Number.isInteger==="function"?(Y)=>Number.isInteger(Y):(Y)=>typeof Y==="number"&&Number.isFinite(Y)&&Math.floor(Y)===Y;function K(Y,f=" | "){return Y.map((P)=>typeof P==="string"?`'${P}'`:P).join(f)}q.joinValues=K,q.jsonStringifyReplacer=(Y,f)=>{if(typeof f==="bigint")return f.toString();return f}})(h8||(h8={}));(function(q){q.mergeShapes=(_,j)=>{return{..._,...j}}})(n4||(n4={}));Q=h8.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),t=h8.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"]);l6=class l6 extends Error{get errors(){return this.issues}constructor(q){super();this.issues=[],this.addIssue=(j)=>{this.issues=[...this.issues,j]},this.addIssues=(j=[])=>{this.issues=[...this.issues,...j]};let _=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,_);else this.__proto__=_;this.name="ZodError",this.issues=q}format(q){let _=q||function(Y){return Y.message},j={_errors:[]},K=(Y)=>{for(let f of Y.issues)if(f.code==="invalid_union")f.unionErrors.map(K);else if(f.code==="invalid_return_type")K(f.returnTypeError);else if(f.code==="invalid_arguments")K(f.argumentsError);else if(f.path.length===0)j._errors.push(_(f));else{let P=j,$=0;while($_.message){let _={},j=[];for(let K of this.issues)if(K.path.length>0){let Y=K.path[0];_[Y]=_[Y]||[],_[Y].push(q(K))}else j.push(q(K));return{formErrors:j,fieldErrors:_}}get formErrors(){return this.flatten()}};l6.create=(q)=>{return new l6(q)};KK=pW,g1=KK;xW=[];W8=Object.freeze({status:"aborted"});(function(q){q.errToObj=(_)=>typeof _==="string"?{message:_}:_||{},q.toString=(_)=>typeof _==="string"?_:_?.message})($8||($8={}));nW=/^c[^\s-]{8,}$/i,cW=/^[0-9a-z]+$/,rW=/^[0-9A-HJKMNP-TV-Z]{26}$/i,iW=/^[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,oW=/^[a-z0-9_-]{21}$/i,aW=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,BW=/^[-+]?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)?)??$/,tW=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,eW=/^(?:(?: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])$/,UW=/^(?:(?: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])$/,sW=/^(([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]))$/,QW=/^(([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])$/,qv=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,_v=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Kv=new RegExp(`^${y1}$`);Oq=class Oq extends k8{_parse(q){if(this._def.coerce)q.data=String(q.data);if(this._getType(q)!==Q.string){let Y=this._getOrReturnCtx(q);return U(Y,{code:t.invalid_type,expected:Q.string,received:Y.parsedType}),W8}let j=new A6,K=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if(q.data.lengthY.value)K=this._getOrReturnCtx(q,K),U(K,{code:t.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),j.dirty()}else if(Y.kind==="length"){let f=q.data.length>Y.value,P=q.data.lengthq.test(K),{validation:_,code:t.invalid_string,...$8.errToObj(j)})}_addCheck(q){return new Oq({...this._def,checks:[...this._def.checks,q]})}email(q){return this._addCheck({kind:"email",...$8.errToObj(q)})}url(q){return this._addCheck({kind:"url",...$8.errToObj(q)})}emoji(q){return this._addCheck({kind:"emoji",...$8.errToObj(q)})}uuid(q){return this._addCheck({kind:"uuid",...$8.errToObj(q)})}nanoid(q){return this._addCheck({kind:"nanoid",...$8.errToObj(q)})}cuid(q){return this._addCheck({kind:"cuid",...$8.errToObj(q)})}cuid2(q){return this._addCheck({kind:"cuid2",...$8.errToObj(q)})}ulid(q){return this._addCheck({kind:"ulid",...$8.errToObj(q)})}base64(q){return this._addCheck({kind:"base64",...$8.errToObj(q)})}base64url(q){return this._addCheck({kind:"base64url",...$8.errToObj(q)})}jwt(q){return this._addCheck({kind:"jwt",...$8.errToObj(q)})}ip(q){return this._addCheck({kind:"ip",...$8.errToObj(q)})}cidr(q){return this._addCheck({kind:"cidr",...$8.errToObj(q)})}datetime(q){if(typeof q==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:q});return this._addCheck({kind:"datetime",precision:typeof q?.precision==="undefined"?null:q?.precision,offset:q?.offset??!1,local:q?.local??!1,...$8.errToObj(q?.message)})}date(q){return this._addCheck({kind:"date",message:q})}time(q){if(typeof q==="string")return this._addCheck({kind:"time",precision:null,message:q});return this._addCheck({kind:"time",precision:typeof q?.precision==="undefined"?null:q?.precision,...$8.errToObj(q?.message)})}duration(q){return this._addCheck({kind:"duration",...$8.errToObj(q)})}regex(q,_){return this._addCheck({kind:"regex",regex:q,...$8.errToObj(_)})}includes(q,_){return this._addCheck({kind:"includes",value:q,position:_?.position,...$8.errToObj(_?.message)})}startsWith(q,_){return this._addCheck({kind:"startsWith",value:q,...$8.errToObj(_)})}endsWith(q,_){return this._addCheck({kind:"endsWith",value:q,...$8.errToObj(_)})}min(q,_){return this._addCheck({kind:"min",value:q,...$8.errToObj(_)})}max(q,_){return this._addCheck({kind:"max",value:q,...$8.errToObj(_)})}length(q,_){return this._addCheck({kind:"length",value:q,...$8.errToObj(_)})}nonempty(q){return this.min(1,$8.errToObj(q))}trim(){return new Oq({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Oq({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Oq({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((q)=>q.kind==="datetime")}get isDate(){return!!this._def.checks.find((q)=>q.kind==="date")}get isTime(){return!!this._def.checks.find((q)=>q.kind==="time")}get isDuration(){return!!this._def.checks.find((q)=>q.kind==="duration")}get isEmail(){return!!this._def.checks.find((q)=>q.kind==="email")}get isURL(){return!!this._def.checks.find((q)=>q.kind==="url")}get isEmoji(){return!!this._def.checks.find((q)=>q.kind==="emoji")}get isUUID(){return!!this._def.checks.find((q)=>q.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((q)=>q.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((q)=>q.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((q)=>q.kind==="cuid2")}get isULID(){return!!this._def.checks.find((q)=>q.kind==="ulid")}get isIP(){return!!this._def.checks.find((q)=>q.kind==="ip")}get isCIDR(){return!!this._def.checks.find((q)=>q.kind==="cidr")}get isBase64(){return!!this._def.checks.find((q)=>q.kind==="base64")}get isBase64url(){return!!this._def.checks.find((q)=>q.kind==="base64url")}get minLength(){let q=null;for(let _ of this._def.checks)if(_.kind==="min"){if(q===null||_.value>q)q=_.value}return q}get maxLength(){let q=null;for(let _ of this._def.checks)if(_.kind==="max"){if(q===null||_.value{return new Oq({checks:[],typeName:v8.ZodString,coerce:q?.coerce??!1,...Z8(q)})};sq=class sq extends k8{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(q){if(this._def.coerce)q.data=Number(q.data);if(this._getType(q)!==Q.number){let Y=this._getOrReturnCtx(q);return U(Y,{code:t.invalid_type,expected:Q.number,received:Y.parsedType}),W8}let j=void 0,K=new A6;for(let Y of this._def.checks)if(Y.kind==="int"){if(!h8.isInteger(q.data))j=this._getOrReturnCtx(q,j),U(j,{code:t.invalid_type,expected:"integer",received:"float",message:Y.message}),K.dirty()}else if(Y.kind==="min"){if(Y.inclusive?q.dataY.value:q.data>=Y.value)j=this._getOrReturnCtx(q,j),U(j,{code:t.too_big,maximum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),K.dirty()}else if(Y.kind==="multipleOf"){if($v(q.data,Y.value)!==0)j=this._getOrReturnCtx(q,j),U(j,{code:t.not_multiple_of,multipleOf:Y.value,message:Y.message}),K.dirty()}else if(Y.kind==="finite"){if(!Number.isFinite(q.data))j=this._getOrReturnCtx(q,j),U(j,{code:t.not_finite,message:Y.message}),K.dirty()}else h8.assertNever(Y);return{status:K.value,value:q.data}}gte(q,_){return this.setLimit("min",q,!0,$8.toString(_))}gt(q,_){return this.setLimit("min",q,!1,$8.toString(_))}lte(q,_){return this.setLimit("max",q,!0,$8.toString(_))}lt(q,_){return this.setLimit("max",q,!1,$8.toString(_))}setLimit(q,_,j,K){return new sq({...this._def,checks:[...this._def.checks,{kind:q,value:_,inclusive:j,message:$8.toString(K)}]})}_addCheck(q){return new sq({...this._def,checks:[...this._def.checks,q]})}int(q){return this._addCheck({kind:"int",message:$8.toString(q)})}positive(q){return this._addCheck({kind:"min",value:0,inclusive:!1,message:$8.toString(q)})}negative(q){return this._addCheck({kind:"max",value:0,inclusive:!1,message:$8.toString(q)})}nonpositive(q){return this._addCheck({kind:"max",value:0,inclusive:!0,message:$8.toString(q)})}nonnegative(q){return this._addCheck({kind:"min",value:0,inclusive:!0,message:$8.toString(q)})}multipleOf(q,_){return this._addCheck({kind:"multipleOf",value:q,message:$8.toString(_)})}finite(q){return this._addCheck({kind:"finite",message:$8.toString(q)})}safe(q){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:$8.toString(q)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:$8.toString(q)})}get minValue(){let q=null;for(let _ of this._def.checks)if(_.kind==="min"){if(q===null||_.value>q)q=_.value}return q}get maxValue(){let q=null;for(let _ of this._def.checks)if(_.kind==="max"){if(q===null||_.valueq.kind==="int"||q.kind==="multipleOf"&&h8.isInteger(q.value))}get isFinite(){let q=null,_=null;for(let j of this._def.checks)if(j.kind==="finite"||j.kind==="int"||j.kind==="multipleOf")return!0;else if(j.kind==="min"){if(_===null||j.value>_)_=j.value}else if(j.kind==="max"){if(q===null||j.value{return new sq({checks:[],typeName:v8.ZodNumber,coerce:q?.coerce||!1,...Z8(q)})};Qq=class Qq extends k8{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(q){if(this._def.coerce)try{q.data=BigInt(q.data)}catch{return this._getInvalidInput(q)}if(this._getType(q)!==Q.bigint)return this._getInvalidInput(q);let j=void 0,K=new A6;for(let Y of this._def.checks)if(Y.kind==="min"){if(Y.inclusive?q.dataY.value:q.data>=Y.value)j=this._getOrReturnCtx(q,j),U(j,{code:t.too_big,type:"bigint",maximum:Y.value,inclusive:Y.inclusive,message:Y.message}),K.dirty()}else if(Y.kind==="multipleOf"){if(q.data%Y.value!==BigInt(0))j=this._getOrReturnCtx(q,j),U(j,{code:t.not_multiple_of,multipleOf:Y.value,message:Y.message}),K.dirty()}else h8.assertNever(Y);return{status:K.value,value:q.data}}_getInvalidInput(q){let _=this._getOrReturnCtx(q);return U(_,{code:t.invalid_type,expected:Q.bigint,received:_.parsedType}),W8}gte(q,_){return this.setLimit("min",q,!0,$8.toString(_))}gt(q,_){return this.setLimit("min",q,!1,$8.toString(_))}lte(q,_){return this.setLimit("max",q,!0,$8.toString(_))}lt(q,_){return this.setLimit("max",q,!1,$8.toString(_))}setLimit(q,_,j,K){return new Qq({...this._def,checks:[...this._def.checks,{kind:q,value:_,inclusive:j,message:$8.toString(K)}]})}_addCheck(q){return new Qq({...this._def,checks:[...this._def.checks,q]})}positive(q){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:$8.toString(q)})}negative(q){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:$8.toString(q)})}nonpositive(q){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:$8.toString(q)})}nonnegative(q){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:$8.toString(q)})}multipleOf(q,_){return this._addCheck({kind:"multipleOf",value:q,message:$8.toString(_)})}get minValue(){let q=null;for(let _ of this._def.checks)if(_.kind==="min"){if(q===null||_.value>q)q=_.value}return q}get maxValue(){let q=null;for(let _ of this._def.checks)if(_.kind==="max"){if(q===null||_.value{return new Qq({checks:[],typeName:v8.ZodBigInt,coerce:q?.coerce??!1,...Z8(q)})};jK=class jK extends k8{_parse(q){if(this._def.coerce)q.data=Boolean(q.data);if(this._getType(q)!==Q.boolean){let j=this._getOrReturnCtx(q);return U(j,{code:t.invalid_type,expected:Q.boolean,received:j.parsedType}),W8}return M6(q.data)}};jK.create=(q)=>{return new jK({typeName:v8.ZodBoolean,coerce:q?.coerce||!1,...Z8(q)})};A_=class A_ extends k8{_parse(q){if(this._def.coerce)q.data=new Date(q.data);if(this._getType(q)!==Q.date){let Y=this._getOrReturnCtx(q);return U(Y,{code:t.invalid_type,expected:Q.date,received:Y.parsedType}),W8}if(Number.isNaN(q.data.getTime())){let Y=this._getOrReturnCtx(q);return U(Y,{code:t.invalid_date}),W8}let j=new A6,K=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if(q.data.getTime()Y.value)K=this._getOrReturnCtx(q,K),U(K,{code:t.too_big,message:Y.message,inclusive:!0,exact:!1,maximum:Y.value,type:"date"}),j.dirty()}else h8.assertNever(Y);return{status:j.value,value:new Date(q.data.getTime())}}_addCheck(q){return new A_({...this._def,checks:[...this._def.checks,q]})}min(q,_){return this._addCheck({kind:"min",value:q.getTime(),message:$8.toString(_)})}max(q,_){return this._addCheck({kind:"max",value:q.getTime(),message:$8.toString(_)})}get minDate(){let q=null;for(let _ of this._def.checks)if(_.kind==="min"){if(q===null||_.value>q)q=_.value}return q!=null?new Date(q):null}get maxDate(){let q=null;for(let _ of this._def.checks)if(_.kind==="max"){if(q===null||_.value{return new A_({checks:[],coerce:q?.coerce||!1,typeName:v8.ZodDate,...Z8(q)})};eK=class eK extends k8{_parse(q){if(this._getType(q)!==Q.symbol){let j=this._getOrReturnCtx(q);return U(j,{code:t.invalid_type,expected:Q.symbol,received:j.parsedType}),W8}return M6(q.data)}};eK.create=(q)=>{return new eK({typeName:v8.ZodSymbol,...Z8(q)})};PK=class PK extends k8{_parse(q){if(this._getType(q)!==Q.undefined){let j=this._getOrReturnCtx(q);return U(j,{code:t.invalid_type,expected:Q.undefined,received:j.parsedType}),W8}return M6(q.data)}};PK.create=(q)=>{return new PK({typeName:v8.ZodUndefined,...Z8(q)})};YK=class YK extends k8{_parse(q){if(this._getType(q)!==Q.null){let j=this._getOrReturnCtx(q);return U(j,{code:t.invalid_type,expected:Q.null,received:j.parsedType}),W8}return M6(q.data)}};YK.create=(q)=>{return new YK({typeName:v8.ZodNull,...Z8(q)})};G_=class G_ extends k8{constructor(){super(...arguments);this._any=!0}_parse(q){return M6(q.data)}};G_.create=(q)=>{return new G_({typeName:v8.ZodAny,...Z8(q)})};Uq=class Uq extends k8{constructor(){super(...arguments);this._unknown=!0}_parse(q){return M6(q.data)}};Uq.create=(q)=>{return new Uq({typeName:v8.ZodUnknown,...Z8(q)})};hq=class hq extends k8{_parse(q){let _=this._getOrReturnCtx(q);return U(_,{code:t.invalid_type,expected:Q.never,received:_.parsedType}),W8}};hq.create=(q)=>{return new hq({typeName:v8.ZodNever,...Z8(q)})};UK=class UK extends k8{_parse(q){if(this._getType(q)!==Q.undefined){let j=this._getOrReturnCtx(q);return U(j,{code:t.invalid_type,expected:Q.void,received:j.parsedType}),W8}return M6(q.data)}};UK.create=(q)=>{return new UK({typeName:v8.ZodVoid,...Z8(q)})};wq=class wq extends k8{_parse(q){let{ctx:_,status:j}=this._processInputParams(q),K=this._def;if(_.parsedType!==Q.array)return U(_,{code:t.invalid_type,expected:Q.array,received:_.parsedType}),W8;if(K.exactLength!==null){let f=_.data.length>K.exactLength.value,P=_.data.lengthK.maxLength.value)U(_,{code:t.too_big,maximum:K.maxLength.value,type:"array",inclusive:!0,exact:!1,message:K.maxLength.message}),j.dirty()}if(_.common.async)return Promise.all([..._.data].map((f,P)=>{return K.type._parseAsync(new Wq(_,f,_.path,P))})).then((f)=>{return A6.mergeArray(j,f)});let Y=[..._.data].map((f,P)=>{return K.type._parseSync(new Wq(_,f,_.path,P))});return A6.mergeArray(j,Y)}get element(){return this._def.type}min(q,_){return new wq({...this._def,minLength:{value:q,message:$8.toString(_)}})}max(q,_){return new wq({...this._def,maxLength:{value:q,message:$8.toString(_)}})}length(q,_){return new wq({...this._def,exactLength:{value:q,message:$8.toString(_)}})}nonempty(q){return this.min(1,q)}};wq.create=(q,_)=>{return new wq({type:q,minLength:null,maxLength:null,exactLength:null,typeName:v8.ZodArray,...Z8(_)})};B8=class B8 extends k8{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let q=this._def.shape(),_=h8.objectKeys(q);return this._cached={shape:q,keys:_},this._cached}_parse(q){if(this._getType(q)!==Q.object){let w=this._getOrReturnCtx(q);return U(w,{code:t.invalid_type,expected:Q.object,received:w.parsedType}),W8}let{status:j,ctx:K}=this._processInputParams(q),{shape:Y,keys:f}=this._getCached(),P=[];if(!(this._def.catchall instanceof hq&&this._def.unknownKeys==="strip")){for(let w in K.data)if(!f.includes(w))P.push(w)}let $=[];for(let w of f){let O=Y[w],z=K.data[w];$.push({key:{status:"valid",value:w},value:O._parse(new Wq(K,z,K.path,w)),alwaysSet:w in K.data})}if(this._def.catchall instanceof hq){let w=this._def.unknownKeys;if(w==="passthrough")for(let O of P)$.push({key:{status:"valid",value:O},value:{status:"valid",value:K.data[O]}});else if(w==="strict"){if(P.length>0)U(K,{code:t.unrecognized_keys,keys:P}),j.dirty()}else if(w==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let w=this._def.catchall;for(let O of P){let z=K.data[O];$.push({key:{status:"valid",value:O},value:w._parse(new Wq(K,z,K.path,O)),alwaysSet:O in K.data})}}if(K.common.async)return Promise.resolve().then(async()=>{let w=[];for(let O of $){let z=await O.key,W=await O.value;w.push({key:z,value:W,alwaysSet:O.alwaysSet})}return w}).then((w)=>{return A6.mergeObjectSync(j,w)});else return A6.mergeObjectSync(j,$)}get shape(){return this._def.shape()}strict(q){return $8.errToObj,new B8({...this._def,unknownKeys:"strict",...q!==void 0?{errorMap:(_,j)=>{let K=this._def.errorMap?.(_,j).message??j.defaultError;if(_.code==="unrecognized_keys")return{message:$8.errToObj(q).message??K};return{message:K}}}:{}})}strip(){return new B8({...this._def,unknownKeys:"strip"})}passthrough(){return new B8({...this._def,unknownKeys:"passthrough"})}extend(q){return new B8({...this._def,shape:()=>({...this._def.shape(),...q})})}merge(q){return new B8({unknownKeys:q._def.unknownKeys,catchall:q._def.catchall,shape:()=>({...this._def.shape(),...q._def.shape()}),typeName:v8.ZodObject})}setKey(q,_){return this.augment({[q]:_})}catchall(q){return new B8({...this._def,catchall:q})}pick(q){let _={};for(let j of h8.objectKeys(q))if(q[j]&&this.shape[j])_[j]=this.shape[j];return new B8({...this._def,shape:()=>_})}omit(q){let _={};for(let j of h8.objectKeys(this.shape))if(!q[j])_[j]=this.shape[j];return new B8({...this._def,shape:()=>_})}deepPartial(){return s_(this)}partial(q){let _={};for(let j of h8.objectKeys(this.shape)){let K=this.shape[j];if(q&&!q[j])_[j]=K;else _[j]=K.optional()}return new B8({...this._def,shape:()=>_})}required(q){let _={};for(let j of h8.objectKeys(this.shape))if(q&&!q[j])_[j]=this.shape[j];else{let Y=this.shape[j];while(Y instanceof zq)Y=Y._def.innerType;_[j]=Y}return new B8({...this._def,shape:()=>_})}keyof(){return p1(h8.objectKeys(this.shape))}};B8.create=(q,_)=>{return new B8({shape:()=>q,unknownKeys:"strip",catchall:hq.create(),typeName:v8.ZodObject,...Z8(_)})};B8.strictCreate=(q,_)=>{return new B8({shape:()=>q,unknownKeys:"strict",catchall:hq.create(),typeName:v8.ZodObject,...Z8(_)})};B8.lazycreate=(q,_)=>{return new B8({shape:q,unknownKeys:"strip",catchall:hq.create(),typeName:v8.ZodObject,...Z8(_)})};fK=class fK extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j=this._def.options;function K(Y){for(let P of Y)if(P.result.status==="valid")return P.result;for(let P of Y)if(P.result.status==="dirty")return _.common.issues.push(...P.ctx.common.issues),P.result;let f=Y.map((P)=>new l6(P.ctx.common.issues));return U(_,{code:t.invalid_union,unionErrors:f}),W8}if(_.common.async)return Promise.all(j.map(async(Y)=>{let f={..._,common:{..._.common,issues:[]},parent:null};return{result:await Y._parseAsync({data:_.data,path:_.path,parent:f}),ctx:f}})).then(K);else{let Y=void 0,f=[];for(let $ of j){let w={..._,common:{..._.common,issues:[]},parent:null},O=$._parseSync({data:_.data,path:_.path,parent:w});if(O.status==="valid")return O;else if(O.status==="dirty"&&!Y)Y={result:O,ctx:w};if(w.common.issues.length)f.push(w.common.issues)}if(Y)return _.common.issues.push(...Y.ctx.common.issues),Y.result;let P=f.map(($)=>new l6($));return U(_,{code:t.invalid_union,unionErrors:P}),W8}}get options(){return this._def.options}};fK.create=(q,_)=>{return new fK({options:q,typeName:v8.ZodUnion,...Z8(_)})};f7=class f7 extends k8{_parse(q){let{ctx:_}=this._processInputParams(q);if(_.parsedType!==Q.object)return U(_,{code:t.invalid_type,expected:Q.object,received:_.parsedType}),W8;let j=this.discriminator,K=_.data[j],Y=this.optionsMap.get(K);if(!Y)return U(_,{code:t.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[j]}),W8;if(_.common.async)return Y._parseAsync({data:_.data,path:_.path,parent:_});else return Y._parseSync({data:_.data,path:_.path,parent:_})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(q,_,j){let K=new Map;for(let Y of _){let f=Lq(Y.shape[q]);if(!f.length)throw new Error(`A discriminator value for key \`${q}\` could not be extracted from all schema options`);for(let P of f){if(K.has(P))throw new Error(`Discriminator property ${String(q)} has duplicate value ${String(P)}`);K.set(P,Y)}}return new f7({typeName:v8.ZodDiscriminatedUnion,discriminator:q,options:_,optionsMap:K,...Z8(j)})}};$K=class $K extends k8{_parse(q){let{status:_,ctx:j}=this._processInputParams(q),K=(Y,f)=>{if(c4(Y)||c4(f))return W8;let P=i4(Y.value,f.value);if(!P.valid)return U(j,{code:t.invalid_intersection_types}),W8;if(r4(Y)||r4(f))_.dirty();return{status:_.value,value:P.data}};if(j.common.async)return Promise.all([this._def.left._parseAsync({data:j.data,path:j.path,parent:j}),this._def.right._parseAsync({data:j.data,path:j.path,parent:j})]).then(([Y,f])=>K(Y,f));else return K(this._def.left._parseSync({data:j.data,path:j.path,parent:j}),this._def.right._parseSync({data:j.data,path:j.path,parent:j}))}};$K.create=(q,_,j)=>{return new $K({left:q,right:_,typeName:v8.ZodIntersection,...Z8(j)})};Cq=class Cq extends k8{_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.parsedType!==Q.array)return U(j,{code:t.invalid_type,expected:Q.array,received:j.parsedType}),W8;if(j.data.lengththis._def.items.length)U(j,{code:t.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_.dirty();let Y=[...j.data].map((f,P)=>{let $=this._def.items[P]||this._def.rest;if(!$)return null;return $._parse(new Wq(j,f,j.path,P))}).filter((f)=>!!f);if(j.common.async)return Promise.all(Y).then((f)=>{return A6.mergeArray(_,f)});else return A6.mergeArray(_,Y)}get items(){return this._def.items}rest(q){return new Cq({...this._def,rest:q})}};Cq.create=(q,_)=>{if(!Array.isArray(q))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Cq({items:q,typeName:v8.ZodTuple,rest:null,...Z8(_)})};sK=class sK extends k8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.parsedType!==Q.object)return U(j,{code:t.invalid_type,expected:Q.object,received:j.parsedType}),W8;let K=[],Y=this._def.keyType,f=this._def.valueType;for(let P in j.data)K.push({key:Y._parse(new Wq(j,P,j.path,P)),value:f._parse(new Wq(j,j.data[P],j.path,P)),alwaysSet:P in j.data});if(j.common.async)return A6.mergeObjectAsync(_,K);else return A6.mergeObjectSync(_,K)}get element(){return this._def.valueType}static create(q,_,j){if(_ instanceof k8)return new sK({keyType:q,valueType:_,typeName:v8.ZodRecord,...Z8(j)});return new sK({keyType:Oq.create(),valueType:q,typeName:v8.ZodRecord,...Z8(_)})}};QK=class QK extends k8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.parsedType!==Q.map)return U(j,{code:t.invalid_type,expected:Q.map,received:j.parsedType}),W8;let K=this._def.keyType,Y=this._def.valueType,f=[...j.data.entries()].map(([P,$],w)=>{return{key:K._parse(new Wq(j,P,j.path,[w,"key"])),value:Y._parse(new Wq(j,$,j.path,[w,"value"]))}});if(j.common.async){let P=new Map;return Promise.resolve().then(async()=>{for(let $ of f){let w=await $.key,O=await $.value;if(w.status==="aborted"||O.status==="aborted")return W8;if(w.status==="dirty"||O.status==="dirty")_.dirty();P.set(w.value,O.value)}return{status:_.value,value:P}})}else{let P=new Map;for(let $ of f){let{key:w,value:O}=$;if(w.status==="aborted"||O.status==="aborted")return W8;if(w.status==="dirty"||O.status==="dirty")_.dirty();P.set(w.value,O.value)}return{status:_.value,value:P}}}};QK.create=(q,_,j)=>{return new QK({valueType:_,keyType:q,typeName:v8.ZodMap,...Z8(j)})};u_=class u_ extends k8{_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.parsedType!==Q.set)return U(j,{code:t.invalid_type,expected:Q.set,received:j.parsedType}),W8;let K=this._def;if(K.minSize!==null){if(j.data.sizeK.maxSize.value)U(j,{code:t.too_big,maximum:K.maxSize.value,type:"set",inclusive:!0,exact:!1,message:K.maxSize.message}),_.dirty()}let Y=this._def.valueType;function f($){let w=new Set;for(let O of $){if(O.status==="aborted")return W8;if(O.status==="dirty")_.dirty();w.add(O.value)}return{status:_.value,value:w}}let P=[...j.data.values()].map(($,w)=>Y._parse(new Wq(j,$,j.path,w)));if(j.common.async)return Promise.all(P).then(($)=>f($));else return f(P)}min(q,_){return new u_({...this._def,minSize:{value:q,message:$8.toString(_)}})}max(q,_){return new u_({...this._def,maxSize:{value:q,message:$8.toString(_)}})}size(q,_){return this.min(q,_).max(q,_)}nonempty(q){return this.min(1,q)}};u_.create=(q,_)=>{return new u_({valueType:q,minSize:null,maxSize:null,typeName:v8.ZodSet,...Z8(_)})};_K=class _K extends k8{constructor(){super(...arguments);this.validate=this.implement}_parse(q){let{ctx:_}=this._processInputParams(q);if(_.parsedType!==Q.function)return U(_,{code:t.invalid_type,expected:Q.function,received:_.parsedType}),W8;function j(P,$){return Y7({data:P,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,P7(),KK].filter((w)=>!!w),issueData:{code:t.invalid_arguments,argumentsError:$}})}function K(P,$){return Y7({data:P,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,P7(),KK].filter((w)=>!!w),issueData:{code:t.invalid_return_type,returnTypeError:$}})}let Y={errorMap:_.common.contextualErrorMap},f=_.data;if(this._def.returns instanceof h_){let P=this;return M6(async function(...$){let w=new l6([]),O=await P._def.args.parseAsync($,Y).catch((v)=>{throw w.addIssue(j($,v)),w}),z=await Reflect.apply(f,this,O);return await P._def.returns._def.type.parseAsync(z,Y).catch((v)=>{throw w.addIssue(K(z,v)),w})})}else{let P=this;return M6(function(...$){let w=P._def.args.safeParse($,Y);if(!w.success)throw new l6([j($,w.error)]);let O=Reflect.apply(f,this,w.data),z=P._def.returns.safeParse(O,Y);if(!z.success)throw new l6([K(O,z.error)]);return z.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...q){return new _K({...this._def,args:Cq.create(q).rest(Uq.create())})}returns(q){return new _K({...this._def,returns:q})}implement(q){return this.parse(q)}strictImplement(q){return this.parse(q)}static create(q,_,j){return new _K({args:q?q:Cq.create([]).rest(Uq.create()),returns:_||Uq.create(),typeName:v8.ZodFunction,...Z8(j)})}};OK=class OK extends k8{get schema(){return this._def.getter()}_parse(q){let{ctx:_}=this._processInputParams(q);return this._def.getter()._parse({data:_.data,path:_.path,parent:_})}};OK.create=(q,_)=>{return new OK({getter:q,typeName:v8.ZodLazy,...Z8(_)})};wK=class wK extends k8{_parse(q){if(q.data!==this._def.value){let _=this._getOrReturnCtx(q);return U(_,{received:_.data,code:t.invalid_literal,expected:this._def.value}),W8}return{status:"valid",value:q.data}}get value(){return this._def.value}};wK.create=(q,_)=>{return new wK({value:q,typeName:v8.ZodLiteral,...Z8(_)})};q_=class q_ extends k8{_parse(q){if(typeof q.data!=="string"){let _=this._getOrReturnCtx(q),j=this._def.values;return U(_,{expected:h8.joinValues(j),received:_.parsedType,code:t.invalid_type}),W8}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(q.data)){let _=this._getOrReturnCtx(q),j=this._def.values;return U(_,{received:_.data,code:t.invalid_enum_value,options:j}),W8}return M6(q.data)}get options(){return this._def.values}get enum(){let q={};for(let _ of this._def.values)q[_]=_;return q}get Values(){let q={};for(let _ of this._def.values)q[_]=_;return q}get Enum(){let q={};for(let _ of this._def.values)q[_]=_;return q}extract(q,_=this._def){return q_.create(q,{...this._def,..._})}exclude(q,_=this._def){return q_.create(this.options.filter((j)=>!q.includes(j)),{...this._def,..._})}};q_.create=p1;zK=class zK extends k8{_parse(q){let _=h8.getValidEnumValues(this._def.values),j=this._getOrReturnCtx(q);if(j.parsedType!==Q.string&&j.parsedType!==Q.number){let K=h8.objectValues(_);return U(j,{expected:h8.joinValues(K),received:j.parsedType,code:t.invalid_type}),W8}if(!this._cache)this._cache=new Set(h8.getValidEnumValues(this._def.values));if(!this._cache.has(q.data)){let K=h8.objectValues(_);return U(j,{received:j.data,code:t.invalid_enum_value,options:K}),W8}return M6(q.data)}get enum(){return this._def.values}};zK.create=(q,_)=>{return new zK({values:q,typeName:v8.ZodNativeEnum,...Z8(_)})};h_=class h_ extends k8{unwrap(){return this._def.type}_parse(q){let{ctx:_}=this._processInputParams(q);if(_.parsedType!==Q.promise&&_.common.async===!1)return U(_,{code:t.invalid_type,expected:Q.promise,received:_.parsedType}),W8;let j=_.parsedType===Q.promise?_.data:Promise.resolve(_.data);return M6(j.then((K)=>{return this._def.type.parseAsync(K,{path:_.path,errorMap:_.common.contextualErrorMap})}))}};h_.create=(q,_)=>{return new h_({type:q,typeName:v8.ZodPromise,...Z8(_)})};e6=class e6 extends k8{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===v8.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(q){let{status:_,ctx:j}=this._processInputParams(q),K=this._def.effect||null,Y={addIssue:(f)=>{if(U(j,f),f.fatal)_.abort();else _.dirty()},get path(){return j.path}};if(Y.addIssue=Y.addIssue.bind(Y),K.type==="preprocess"){let f=K.transform(j.data,Y);if(j.common.async)return Promise.resolve(f).then(async(P)=>{if(_.value==="aborted")return W8;let $=await this._def.schema._parseAsync({data:P,path:j.path,parent:j});if($.status==="aborted")return W8;if($.status==="dirty")return qK($.value);if(_.value==="dirty")return qK($.value);return $});else{if(_.value==="aborted")return W8;let P=this._def.schema._parseSync({data:f,path:j.path,parent:j});if(P.status==="aborted")return W8;if(P.status==="dirty")return qK(P.value);if(_.value==="dirty")return qK(P.value);return P}}if(K.type==="refinement"){let f=(P)=>{let $=K.refinement(P,Y);if(j.common.async)return Promise.resolve($);if($ instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return P};if(j.common.async===!1){let P=this._def.schema._parseSync({data:j.data,path:j.path,parent:j});if(P.status==="aborted")return W8;if(P.status==="dirty")_.dirty();return f(P.value),{status:_.value,value:P.value}}else return this._def.schema._parseAsync({data:j.data,path:j.path,parent:j}).then((P)=>{if(P.status==="aborted")return W8;if(P.status==="dirty")_.dirty();return f(P.value).then(()=>{return{status:_.value,value:P.value}})})}if(K.type==="transform")if(j.common.async===!1){let f=this._def.schema._parseSync({data:j.data,path:j.path,parent:j});if(!X_(f))return W8;let P=K.transform(f.value,Y);if(P instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:_.value,value:P}}else return this._def.schema._parseAsync({data:j.data,path:j.path,parent:j}).then((f)=>{if(!X_(f))return W8;return Promise.resolve(K.transform(f.value,Y)).then((P)=>({status:_.value,value:P}))});h8.assertNever(K)}};e6.create=(q,_,j)=>{return new e6({schema:q,typeName:v8.ZodEffects,effect:_,...Z8(j)})};e6.createWithPreprocess=(q,_,j)=>{return new e6({schema:_,effect:{type:"preprocess",transform:q},typeName:v8.ZodEffects,...Z8(j)})};zq=class zq extends k8{_parse(q){if(this._getType(q)===Q.undefined)return M6(void 0);return this._def.innerType._parse(q)}unwrap(){return this._def.innerType}};zq.create=(q,_)=>{return new zq({innerType:q,typeName:v8.ZodOptional,...Z8(_)})};lq=class lq extends k8{_parse(q){if(this._getType(q)===Q.null)return M6(null);return this._def.innerType._parse(q)}unwrap(){return this._def.innerType}};lq.create=(q,_)=>{return new lq({innerType:q,typeName:v8.ZodNullable,...Z8(_)})};WK=class WK extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j=_.data;if(_.parsedType===Q.undefined)j=this._def.defaultValue();return this._def.innerType._parse({data:j,path:_.path,parent:_})}removeDefault(){return this._def.innerType}};WK.create=(q,_)=>{return new WK({innerType:q,typeName:v8.ZodDefault,defaultValue:typeof _.default==="function"?_.default:()=>_.default,...Z8(_)})};vK=class vK extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j={..._,common:{..._.common,issues:[]}},K=this._def.innerType._parse({data:j.data,path:j.path,parent:{...j}});if(FK(K))return K.then((Y)=>{return{status:"valid",value:Y.status==="valid"?Y.value:this._def.catchValue({get error(){return new l6(j.common.issues)},input:j.data})}});else return{status:"valid",value:K.status==="valid"?K.value:this._def.catchValue({get error(){return new l6(j.common.issues)},input:j.data})}}removeCatch(){return this._def.innerType}};vK.create=(q,_)=>{return new vK({innerType:q,typeName:v8.ZodCatch,catchValue:typeof _.catch==="function"?_.catch:()=>_.catch,...Z8(_)})};q3=class q3 extends k8{_parse(q){if(this._getType(q)!==Q.nan){let j=this._getOrReturnCtx(q);return U(j,{code:t.invalid_type,expected:Q.nan,received:j.parsedType}),W8}return{status:"valid",value:q.data}}};q3.create=(q)=>{return new q3({typeName:v8.ZodNaN,...Z8(q)})};Ov=Symbol("zod_brand");$7=class $7 extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j=_.data;return this._def.type._parse({data:j,path:_.path,parent:_})}unwrap(){return this._def.type}};_3=class _3 extends k8{_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.common.async)return(async()=>{let Y=await this._def.in._parseAsync({data:j.data,path:j.path,parent:j});if(Y.status==="aborted")return W8;if(Y.status==="dirty")return _.dirty(),qK(Y.value);else return this._def.out._parseAsync({data:Y.value,path:j.path,parent:j})})();else{let K=this._def.in._parseSync({data:j.data,path:j.path,parent:j});if(K.status==="aborted")return W8;if(K.status==="dirty")return _.dirty(),{status:"dirty",value:K.value};else return this._def.out._parseSync({data:K.value,path:j.path,parent:j})}}static create(q,_){return new _3({in:q,out:_,typeName:v8.ZodPipeline})}};HK=class HK extends k8{_parse(q){let _=this._def.innerType._parse(q),j=(K)=>{if(X_(K))K.value=Object.freeze(K.value);return K};return FK(_)?_.then((K)=>j(K)):j(_)}unwrap(){return this._def.innerType}};HK.create=(q,_)=>{return new HK({innerType:q,typeName:v8.ZodReadonly,...Z8(_)})};wv={object:B8.lazycreate};(function(q){q.ZodString="ZodString",q.ZodNumber="ZodNumber",q.ZodNaN="ZodNaN",q.ZodBigInt="ZodBigInt",q.ZodBoolean="ZodBoolean",q.ZodDate="ZodDate",q.ZodSymbol="ZodSymbol",q.ZodUndefined="ZodUndefined",q.ZodNull="ZodNull",q.ZodAny="ZodAny",q.ZodUnknown="ZodUnknown",q.ZodNever="ZodNever",q.ZodVoid="ZodVoid",q.ZodArray="ZodArray",q.ZodObject="ZodObject",q.ZodUnion="ZodUnion",q.ZodDiscriminatedUnion="ZodDiscriminatedUnion",q.ZodIntersection="ZodIntersection",q.ZodTuple="ZodTuple",q.ZodRecord="ZodRecord",q.ZodMap="ZodMap",q.ZodSet="ZodSet",q.ZodFunction="ZodFunction",q.ZodLazy="ZodLazy",q.ZodLiteral="ZodLiteral",q.ZodEnum="ZodEnum",q.ZodEffects="ZodEffects",q.ZodNativeEnum="ZodNativeEnum",q.ZodOptional="ZodOptional",q.ZodNullable="ZodNullable",q.ZodDefault="ZodDefault",q.ZodCatch="ZodCatch",q.ZodPromise="ZodPromise",q.ZodBranded="ZodBranded",q.ZodPipeline="ZodPipeline",q.ZodReadonly="ZodReadonly"})(v8||(v8={}));x1=Oq.create,n1=sq.create,Wv=q3.create,vv=Qq.create,c1=jK.create,Hv=A_.create,Jv=eK.create,Tv=PK.create,Zv=YK.create,kv=G_.create,Xv=Uq.create,Av=hq.create,Gv=UK.create,uv=wq.create,hv=B8.create,Cv=B8.strictCreate,Dv=fK.create,Vv=f7.create,Mv=$K.create,Nv=Cq.create,bv=sK.create,Sv=QK.create,Ev=u_.create,Rv=_K.create,Iv=OK.create,mv=wK.create,gv=q_.create,yv=zK.create,dv=h_.create,C1=e6.create,Lv=zq.create,pv=lq.create,lv=e6.createWithPreprocess,xv=_3.create,iv={string:(q)=>Oq.create({...q,coerce:!0}),number:(q)=>sq.create({...q,coerce:!0}),boolean:(q)=>jK.create({...q,coerce:!0}),bigint:(q)=>Qq.create({...q,coerce:!0}),date:(q)=>A_.create({...q,coerce:!0})},ov=W8,r1=X.union([X.string(),X.number().int()]),i1=X.string(),av=X.object({progressToken:X.optional(r1)}).passthrough(),U6=X.object({_meta:X.optional(av)}).passthrough(),m6=X.object({method:X.string(),params:X.optional(U6)}),K3=X.object({_meta:X.optional(X.object({}).passthrough())}).passthrough(),Dq=X.object({method:X.string(),params:X.optional(K3)}),s6=X.object({_meta:X.optional(X.object({}).passthrough())}).passthrough(),w7=X.union([X.string(),X.number().int()]),Bv=X.object({jsonrpc:X.literal(O7),id:w7}).merge(m6).strict(),tv=X.object({jsonrpc:X.literal(O7)}).merge(Dq).strict(),Fv=X.object({jsonrpc:X.literal(O7),id:w7,result:s6}).strict();(function(q){q[q.ConnectionClosed=-32000]="ConnectionClosed",q[q.RequestTimeout=-32001]="RequestTimeout",q[q.ParseError=-32700]="ParseError",q[q.InvalidRequest=-32600]="InvalidRequest",q[q.MethodNotFound=-32601]="MethodNotFound",q[q.InvalidParams=-32602]="InvalidParams",q[q.InternalError=-32603]="InternalError"})(D1||(D1={}));ev=X.object({jsonrpc:X.literal(O7),id:w7,error:X.object({code:X.number().int(),message:X.string(),data:X.optional(X.unknown())})}).strict(),dM=X.union([Bv,tv,Fv,ev]),o1=s6.strict(),a1=Dq.extend({method:X.literal("notifications/cancelled"),params:K3.extend({requestId:w7,reason:X.string().optional()})}),j3=X.object({name:X.string(),title:X.optional(X.string())}).passthrough(),B1=j3.extend({version:X.string()}),Uv=X.object({experimental:X.optional(X.object({}).passthrough()),sampling:X.optional(X.object({}).passthrough()),elicitation:X.optional(X.object({}).passthrough()),roots:X.optional(X.object({listChanged:X.optional(X.boolean())}).passthrough())}).passthrough(),sv=m6.extend({method:X.literal("initialize"),params:U6.extend({protocolVersion:X.string(),capabilities:Uv,clientInfo:B1})}),Qv=X.object({experimental:X.optional(X.object({}).passthrough()),logging:X.optional(X.object({}).passthrough()),completions: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(),qH=s6.extend({protocolVersion:X.string(),capabilities:Qv,serverInfo:B1,instructions:X.optional(X.string())}),_H=Dq.extend({method:X.literal("notifications/initialized")}),t1=m6.extend({method:X.literal("ping")}),KH=X.object({progress:X.number(),total:X.optional(X.number()),message:X.optional(X.string())}).passthrough(),F1=Dq.extend({method:X.literal("notifications/progress"),params:K3.merge(KH).extend({progressToken:r1})}),z7=m6.extend({params:U6.extend({cursor:X.optional(i1)}).optional()}),W7=s6.extend({nextCursor:X.optional(i1)}),e1=X.object({uri:X.string(),mimeType:X.optional(X.string()),_meta:X.optional(X.object({}).passthrough())}).passthrough(),U1=e1.extend({text:X.string()}),e4=X.string().refine((q)=>{try{return atob(q),!0}catch(_){return!1}},{message:"Invalid Base64 string"}),s1=e1.extend({blob:e4}),Q1=j3.extend({uri:X.string(),description:X.optional(X.string()),mimeType:X.optional(X.string()),_meta:X.optional(X.object({}).passthrough())}),jH=j3.extend({uriTemplate:X.string(),description:X.optional(X.string()),mimeType:X.optional(X.string()),_meta:X.optional(X.object({}).passthrough())}),PH=z7.extend({method:X.literal("resources/list")}),YH=W7.extend({resources:X.array(Q1)}),fH=z7.extend({method:X.literal("resources/templates/list")}),$H=W7.extend({resourceTemplates:X.array(jH)}),OH=m6.extend({method:X.literal("resources/read"),params:U6.extend({uri:X.string()})}),wH=s6.extend({contents:X.array(X.union([U1,s1]))}),zH=Dq.extend({method:X.literal("notifications/resources/list_changed")}),WH=m6.extend({method:X.literal("resources/subscribe"),params:U6.extend({uri:X.string()})}),vH=m6.extend({method:X.literal("resources/unsubscribe"),params:U6.extend({uri:X.string()})}),HH=Dq.extend({method:X.literal("notifications/resources/updated"),params:K3.extend({uri:X.string()})}),JH=X.object({name:X.string(),description:X.optional(X.string()),required:X.optional(X.boolean())}).passthrough(),TH=j3.extend({description:X.optional(X.string()),arguments:X.optional(X.array(JH)),_meta:X.optional(X.object({}).passthrough())}),ZH=z7.extend({method:X.literal("prompts/list")}),kH=W7.extend({prompts:X.array(TH)}),XH=m6.extend({method:X.literal("prompts/get"),params:U6.extend({name:X.string(),arguments:X.optional(X.record(X.string()))})}),U4=X.object({type:X.literal("text"),text:X.string(),_meta:X.optional(X.object({}).passthrough())}).passthrough(),s4=X.object({type:X.literal("image"),data:e4,mimeType:X.string(),_meta:X.optional(X.object({}).passthrough())}).passthrough(),Q4=X.object({type:X.literal("audio"),data:e4,mimeType:X.string(),_meta:X.optional(X.object({}).passthrough())}).passthrough(),AH=X.object({type:X.literal("resource"),resource:X.union([U1,s1]),_meta:X.optional(X.object({}).passthrough())}).passthrough(),GH=Q1.extend({type:X.literal("resource_link")}),qj=X.union([U4,s4,Q4,GH,AH]),uH=X.object({role:X.enum(["user","assistant"]),content:qj}).passthrough(),hH=s6.extend({description:X.optional(X.string()),messages:X.array(uH)}),CH=Dq.extend({method:X.literal("notifications/prompts/list_changed")}),DH=X.object({title:X.optional(X.string()),readOnlyHint:X.optional(X.boolean()),destructiveHint:X.optional(X.boolean()),idempotentHint:X.optional(X.boolean()),openWorldHint:X.optional(X.boolean())}).passthrough(),VH=j3.extend({description:X.optional(X.string()),inputSchema:X.object({type:X.literal("object"),properties:X.optional(X.object({}).passthrough()),required:X.optional(X.array(X.string()))}).passthrough(),outputSchema:X.optional(X.object({type:X.literal("object"),properties:X.optional(X.object({}).passthrough()),required:X.optional(X.array(X.string()))}).passthrough()),annotations:X.optional(DH),_meta:X.optional(X.object({}).passthrough())}),MH=z7.extend({method:X.literal("tools/list")}),NH=W7.extend({tools:X.array(VH)}),_j=s6.extend({content:X.array(qj).default([]),structuredContent:X.object({}).passthrough().optional(),isError:X.optional(X.boolean())}),LM=_j.or(s6.extend({toolResult:X.unknown()})),bH=m6.extend({method:X.literal("tools/call"),params:U6.extend({name:X.string(),arguments:X.optional(X.record(X.unknown()))})}),SH=Dq.extend({method:X.literal("notifications/tools/list_changed")}),Kj=X.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),EH=m6.extend({method:X.literal("logging/setLevel"),params:U6.extend({level:Kj})}),RH=Dq.extend({method:X.literal("notifications/message"),params:K3.extend({level:Kj,logger:X.optional(X.string()),data:X.unknown()})}),IH=X.object({name:X.string().optional()}).passthrough(),mH=X.object({hints:X.optional(X.array(IH)),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(),gH=X.object({role:X.enum(["user","assistant"]),content:X.union([U4,s4,Q4])}).passthrough(),yH=m6.extend({method:X.literal("sampling/createMessage"),params:U6.extend({messages:X.array(gH),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(mH)})}),dH=s6.extend({model:X.string(),stopReason:X.optional(X.enum(["endTurn","stopSequence","maxTokens"]).or(X.string())),role:X.enum(["user","assistant"]),content:X.discriminatedUnion("type",[U4,s4,Q4])}),LH=X.object({type:X.literal("boolean"),title:X.optional(X.string()),description:X.optional(X.string()),default:X.optional(X.boolean())}).passthrough(),pH=X.object({type:X.literal("string"),title:X.optional(X.string()),description:X.optional(X.string()),minLength:X.optional(X.number()),maxLength:X.optional(X.number()),format:X.optional(X.enum(["email","uri","date","date-time"]))}).passthrough(),lH=X.object({type:X.enum(["number","integer"]),title:X.optional(X.string()),description:X.optional(X.string()),minimum:X.optional(X.number()),maximum:X.optional(X.number())}).passthrough(),xH=X.object({type:X.literal("string"),title:X.optional(X.string()),description:X.optional(X.string()),enum:X.array(X.string()),enumNames:X.optional(X.array(X.string()))}).passthrough(),nH=X.union([LH,pH,lH,xH]),cH=m6.extend({method:X.literal("elicitation/create"),params:U6.extend({message:X.string(),requestedSchema:X.object({type:X.literal("object"),properties:X.record(X.string(),nH),required:X.optional(X.array(X.string()))}).passthrough()})}),rH=s6.extend({action:X.enum(["accept","decline","cancel"]),content:X.optional(X.record(X.string(),X.unknown()))}),iH=X.object({type:X.literal("ref/resource"),uri:X.string()}).passthrough(),oH=X.object({type:X.literal("ref/prompt"),name:X.string()}).passthrough(),aH=m6.extend({method:X.literal("completion/complete"),params:U6.extend({ref:X.union([oH,iH]),argument:X.object({name:X.string(),value:X.string()}).passthrough(),context:X.optional(X.object({arguments:X.optional(X.record(X.string(),X.string()))}))})}),BH=s6.extend({completion:X.object({values:X.array(X.string()).max(100),total:X.optional(X.number().int()),hasMore:X.optional(X.boolean())}).passthrough()}),tH=X.object({uri:X.string().startsWith("file://"),name:X.optional(X.string()),_meta:X.optional(X.object({}).passthrough())}).passthrough(),FH=m6.extend({method:X.literal("roots/list")}),eH=s6.extend({roots:X.array(tH)}),UH=Dq.extend({method:X.literal("notifications/roots/list_changed")}),pM=X.union([t1,sv,aH,EH,XH,ZH,PH,fH,OH,WH,vH,bH,MH]),lM=X.union([a1,F1,_H,UH]),xM=X.union([o1,dH,rH,eH]),nM=X.union([t1,yH,cH,FH]),cM=X.union([a1,F1,RH,HH,zH,SH,CH]),rM=X.union([o1,qH,BH,hH,kH,YH,$H,wH,_j,NH]),iM=az(NW(),1),oM=Symbol("Let zodToJsonSchema decide on which parser to use"),aM=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");(function(q){q.Completable="McpCompletable"})(o4||(o4={}));a4=class a4 extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j=_.data;return this._def.type._parse({data:j,path:_.path,parent:_})}unwrap(){return this._def.type}};a4.create=(q,_)=>{return new a4({type:q,typeName:o4.Completable,complete:_.complete,...sH(_)})}});var jj={};$q(jj,{version:()=>_J,type:()=>jJ,scripts:()=>YJ,repository:()=>wJ,publishConfig:()=>vJ,name:()=>qJ,main:()=>PJ,license:()=>OJ,keywords:()=>fJ,homepage:()=>zJ,files:()=>kJ,engines:()=>TJ,devDependencies:()=>JJ,description:()=>KJ,dependencies:()=>HJ,default:()=>XJ,bugs:()=>WJ,bin:()=>ZJ,author:()=>$J});var qJ="claude-mem",_J="3.7.2",KJ="Memory compression system for Claude Code - persist context across sessions",jJ="module",PJ="claude-mem",YJ,fJ,$J="Alex Newman",OJ="SEE LICENSE IN LICENSE",wJ,zJ="https://github.com/thedotmack/claude-mem#readme",WJ,vJ,HJ,JJ,TJ,ZJ,kJ,XJ;var Pj=R8(()=>{YJ={dev:"tsx src/bin/cli.ts","dev:install":"node dist/claude-mem.min.js install --force","dev:status":"node dist/claude-mem.min.js status","dev:compress":"node dist/claude-mem.min.js compress","dev:load":"node dist/claude-mem.min.js load-context","dev:uninstall":"node dist/claude-mem.min.js uninstall",build:"./scripts/build-minified.sh",test:"bun test","test:unit":"bun test test/unit/","test:integration":"bun test test/integration/","test:e2e":"bun test test/e2e/","test:performance":"bun test test/performance/ --benchmark","test:coverage":"bun test --coverage","test:watch":"bun test --watch",lint:"eslint 'src/**/*.ts' 'hooks/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix",format:"prettier --write 'src/**/*.ts' 'hooks/**/*.ts' 'test/**/*.ts'","build:npm":"./scripts/npm-publish.sh",publish:"./scripts/publish-with-changelog.sh","publish:latest":"./scripts/publish-with-changelog.sh bump","publish:github":"./scripts/github-publish.sh"},fJ=["claude","claude-code","mcp","memory","compression","knowledge-graph","transcript","cli","typescript","bun"],wJ={type:"git",url:"https://github.com/thedotmack/claude-mem.git"},WJ={url:"https://github.com/thedotmack/claude-mem/issues"},vJ={access:"public",registry:"https://registry.npmjs.org/"},HJ={"@anthropic-ai/claude-code":"^1.0.88","@clack/prompts":"^0.11.0","@modelcontextprotocol/sdk":"^0.5.0","better-sqlite3":"^11.8.0",boxen:"^8.0.1",chalk:"^5.6.0",chromadb:"^3.0.14",commander:"^14.0.0",cors:"^2.8.5",express:"^5.1.0",glob:"^11.0.3","gradient-string":"^3.0.0",handlebars:"^4.7.8",http:"^0.0.1-security","oh-my-logo":"^0.3.2",open:"^10.2.0"},JJ={"@types/chai":"^4.3.0","@types/handlebars":"^4.0.40","@types/node":"^20.0.0","@typescript-eslint/eslint-plugin":"^6.0.0","@typescript-eslint/parser":"^6.0.0",chai:"^4.3.0",eslint:"^8.0.0",prettier:"^3.0.0","ts-node":"^10.0.0",tsx:"^4.20.5",typescript:"^5.0.0"},TJ={node:">=18.0.0",bun:">=1.0.0"},ZJ={"claude-mem":"dist/claude-mem.min.js"},kJ=["dist","hooks","commands","docs","src","CHANGELOG.md"],XJ={name:qJ,version:_J,description:KJ,type:jJ,main:PJ,scripts:YJ,keywords:fJ,author:$J,license:OJ,repository:wJ,homepage:zJ,bugs:WJ,publishConfig:vJ,dependencies:HJ,devDependencies:JJ,engines:TJ,bin:ZJ,files:kJ}});import{join as Q8,dirname as H7,sep as AJ}from"path";import{homedir as q2}from"os";import{existsSync as P3,statSync as GJ}from"fs";import{execSync as uJ}from"child_process";import{fileURLToPath as hJ}from"url";class _8{static instance=null;_dataDirectory=null;_packageRoot=null;_claudeConfigDirectory=null;static getInstance(){if(!_8.instance)_8.instance=new _8;return _8.instance}getDataDirectory(){if(this._dataDirectory)return this._dataDirectory;return this._dataDirectory=process.env.CLAUDE_MEM_DATA_DIR||Q8(q2(),".claude-mem"),this._dataDirectory}getArchivesDirectory(){return Q8(this.getDataDirectory(),"archives")}getHooksDirectory(){return Q8(this.getDataDirectory(),"hooks")}getLogsDirectory(){return Q8(this.getDataDirectory(),"logs")}getIndexDirectory(){return this.getDataDirectory()}getIndexPath(){return Q8(this.getIndexDirectory(),"claude-mem-index.jsonl")}getTrashDirectory(){return Q8(this.getDataDirectory(),"trash")}getBackupsDirectory(){return Q8(this.getDataDirectory(),"backups")}getChromaDirectory(){return Q8(this.getDataDirectory(),"chroma")}getProjectArchiveDirectory(q){return Q8(this.getArchivesDirectory(),q)}getUserSettingsPath(){return Q8(this.getDataDirectory(),"settings.json")}getClaudeConfigDirectory(){if(this._claudeConfigDirectory)return this._claudeConfigDirectory;return this._claudeConfigDirectory=process.env.CLAUDE_CONFIG_DIR||Q8(q2(),".claude"),this._claudeConfigDirectory}getClaudeSettingsPath(){return Q8(this.getClaudeConfigDirectory(),"settings.json")}getClaudeCommandsDirectory(){return Q8(this.getClaudeConfigDirectory(),"commands")}getClaudeMdPath(){return Q8(this.getClaudeConfigDirectory(),"CLAUDE.md")}getMcpConfigPath(){return Q8(q2(),".claude.json")}getProjectMcpConfigPath(){return Q8(process.cwd(),".mcp.json")}getPackageRoot(){if(this._packageRoot)return this._packageRoot;try{let j=g8.resolve("/Users/alexnewman/Scripts/claude-mem-source/package.json");return this._packageRoot=H7(j),this._packageRoot}catch{}let q=hJ(import.meta.url),_=H7(q);for(let j=0;j<10;j++){let K=Q8(_,"package.json");if(P3(K))try{if(g8(K).name==="claude-mem")return this._packageRoot=_,this._packageRoot}catch{}let Y=H7(_);if(Y===_)break;_=Y}try{let j=uJ("npm list -g claude-mem --json 2>/dev/null || npm list claude-mem --json 2>/dev/null",{encoding:"utf8"}),K=JSON.parse(j);if(K.dependencies?.["claude-mem"]?.resolved)return this._packageRoot=H7(K.dependencies["claude-mem"].resolved),this._packageRoot}catch{}throw new Error("Cannot locate claude-mem package root. Ensure claude-mem is properly installed.")}findPackageHooksDirectory(){let q=this.getPackageRoot(),_=Q8(q,"hooks"),j=["pre-compact.js","session-start.js"];for(let K of j)if(!P3(Q8(_,K)))throw new Error(`Package hooks directory missing required file: ${K}`);return _}findPackageCommandsDirectory(){let q=this.getPackageRoot(),_=Q8(q,"commands"),j=["save.md"];for(let K of j)if(!P3(Q8(_,K)))throw new Error(`Package commands directory missing required file: ${K}`);return _}ensureDirectory(q){if(!P3(q))g8("fs").mkdirSync(q,{recursive:!0})}ensureDirectories(q){q.forEach((_)=>this.ensureDirectory(_))}ensureAllDataDirectories(){this.ensureDirectories([this.getDataDirectory(),this.getArchivesDirectory(),this.getHooksDirectory(),this.getLogsDirectory(),this.getTrashDirectory(),this.getBackupsDirectory(),this.getChromaDirectory()])}ensureAllClaudeDirectories(){this.ensureDirectories([this.getClaudeConfigDirectory(),this.getClaudeCommandsDirectory()])}static extractProjectName(q){let _=q.split(AJ),j=["src","lib","app","project","workspace"];for(let K=_.length-1;K>=0;K--)if(j.includes(_[K])&&K>0)return _[K-1];if(_.length>1)return _[_.length-2];return"unknown-project"}static getCurrentProjectName(){return g8("path").basename(process.cwd())}static createBackupFilename(q){let _=new Date().toISOString().replace(/[:.]/g,"-").replace("T","_").slice(0,19);return`${q}.backup.${_}`}static isPathAccessible(q){try{return P3(q)&&GJ(q).isDirectory()}catch{return!1}}static getDataDirectory(){return _8.getInstance().getDataDirectory()}static getArchivesDirectory(){return _8.getInstance().getArchivesDirectory()}static getHooksDirectory(){return _8.getInstance().getHooksDirectory()}static getLogsDirectory(){return _8.getInstance().getLogsDirectory()}static getClaudeSettingsPath(){return _8.getInstance().getClaudeSettingsPath()}static getClaudeMdPath(){return _8.getInstance().getClaudeMdPath()}static findPackageHooksDirectory(){return _8.getInstance().findPackageHooksDirectory()}static findPackageCommandsDirectory(){return _8.getInstance().findPackageCommandsDirectory()}}var QM;var G6=R8(()=>{QM=_8.getInstance()});class nq{pathDiscovery;constructor(){this.pathDiscovery=_8.getInstance()}getConfigDir(){return this.pathDiscovery.getDataDirectory()}getIndexDir(){return this.pathDiscovery.getIndexDirectory()}getIndexPath(){return this.pathDiscovery.getIndexPath()}getArchiveDir(){return this.pathDiscovery.getArchivesDirectory()}getProjectArchiveDir(q){return this.pathDiscovery.getProjectArchiveDirectory(q)}getLogsDir(){return this.pathDiscovery.getLogsDirectory()}static ensureDirectory(q){_8.getInstance().ensureDirectory(q)}static ensureDirectories(q){_8.getInstance().ensureDirectories(q)}static extractProjectName(q){return _8.extractProjectName(q)}static getCurrentProjectPrefix(){return _8.getCurrentProjectName()}static getCurrentProjectName(){return _8.getCurrentProjectName()}}var _2=R8(()=>{G6()});var N6=F((mJ)=>{mJ.__esModule=!0;mJ.extend=Yj;mJ.indexOf=NJ;mJ.escapeExpression=bJ;mJ.isEmpty=SJ;mJ.createFrame=EJ;mJ.blockParams=RJ;mJ.appendContextPath=IJ;var CJ={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="},DJ=/[&<>"'`=]/g,VJ=/[&<>"'`=]/;function MJ(q){return CJ[q]}function Yj(q){for(var _=1;_{$j.__esModule=!0;var P2=["description","fileName","lineNumber","endLineNumber","message","name","number","stack"];function Y2(q,_){var j=_&&_.loc,K=void 0,Y=void 0,f=void 0,P=void 0;if(j)K=j.start.line,Y=j.end.line,f=j.start.column,P=j.end.column,q+=" - "+K+":"+f;var $=Error.prototype.constructor.call(this,q);for(var w=0;w{wj.__esModule=!0;var f2=N6();wj.default=function(q){q.registerHelper("blockHelperMissing",function(_,j){var{inverse:K,fn:Y}=j;if(_===!0)return Y(this);else if(_===!1||_==null)return K(this);else if(f2.isArray(_))if(_.length>0){if(j.ids)j.ids=[j.name];return q.helpers.each(_,j)}else return K(this);else{if(j.data&&j.ids){var f=f2.createFrame(j.data);f.contextPath=f2.appendContextPath(j.data.contextPath,j.name),j={data:f}}return Y(_,j)}})};zj.exports=wj.default});var Jj=F((vj,Hj)=>{vj.__esModule=!0;function FJ(q){return q&&q.__esModule?q:{default:q}}var Y3=N6(),eJ=Q6(),UJ=FJ(eJ);vj.default=function(q){q.registerHelper("each",function(_,j){if(!j)throw new UJ.default("Must pass iterator to #each");var{fn:K,inverse:Y}=j,f=0,P="",$=void 0,w=void 0;if(j.data&&j.ids)w=Y3.appendContextPath(j.data.contextPath,j.ids[0])+".";if(Y3.isFunction(_))_=_.call(this);if(j.data)$=Y3.createFrame(j.data);function O(T,J,k){if($){if($.key=T,$.index=J,$.first=J===0,$.last=!!k,w)$.contextPath=w+T}P=P+K(_[T],{data:$,blockParams:Y3.blockParams([_[T],T],[w+T,null])})}if(_&&typeof _==="object")if(Y3.isArray(_)){for(var z=_.length;f{Tj.__esModule=!0;function qT(q){return q&&q.__esModule?q:{default:q}}var _T=Q6(),KT=qT(_T);Tj.default=function(q){q.registerHelper("helperMissing",function(){if(arguments.length===1)return;else throw new KT.default('Missing helper: "'+arguments[arguments.length-1].name+'"')})};Zj.exports=Tj.default});var hj=F((Gj,uj)=>{Gj.__esModule=!0;function YT(q){return q&&q.__esModule?q:{default:q}}var Xj=N6(),fT=Q6(),Aj=YT(fT);Gj.default=function(q){q.registerHelper("if",function(_,j){if(arguments.length!=2)throw new Aj.default("#if requires exactly one argument");if(Xj.isFunction(_))_=_.call(this);if(!j.hash.includeZero&&!_||Xj.isEmpty(_))return j.inverse(this);else return j.fn(this)}),q.registerHelper("unless",function(_,j){if(arguments.length!=2)throw new Aj.default("#unless requires exactly one argument");return q.helpers.if.call(this,_,{fn:j.inverse,inverse:j.fn,hash:j.hash})})};uj.exports=Gj.default});var Vj=F((Cj,Dj)=>{Cj.__esModule=!0;Cj.default=function(q){q.registerHelper("log",function(){var _=[void 0],j=arguments[arguments.length-1];for(var K=0;K{Mj.__esModule=!0;Mj.default=function(q){q.registerHelper("lookup",function(_,j,K){if(!_)return _;return K.lookupProperty(_,j)})};Nj.exports=Mj.default});var Rj=F((Sj,Ej)=>{Sj.__esModule=!0;function HT(q){return q&&q.__esModule?q:{default:q}}var f3=N6(),JT=Q6(),TT=HT(JT);Sj.default=function(q){q.registerHelper("with",function(_,j){if(arguments.length!=2)throw new TT.default("#with requires exactly one argument");if(f3.isFunction(_))_=_.call(this);var K=j.fn;if(!f3.isEmpty(_)){var Y=j.data;if(j.data&&j.ids)Y=f3.createFrame(j.data),Y.contextPath=f3.appendContextPath(j.data.contextPath,j.ids[0]);return K(_,{data:Y,blockParams:f3.blockParams([_],[Y&&Y.contextPath])})}else return j.inverse(this)})};Ej.exports=Sj.default});var $2=F((gT)=>{gT.__esModule=!0;gT.registerDefaultHelpers=IT;gT.moveHelperToHooks=mT;function C_(q){return q&&q.__esModule?q:{default:q}}var XT=Wj(),AT=C_(XT),GT=Jj(),uT=C_(GT),hT=kj(),CT=C_(hT),DT=hj(),VT=C_(DT),MT=Vj(),NT=C_(MT),bT=bj(),ST=C_(bT),ET=Rj(),RT=C_(ET);function IT(q){AT.default(q),uT.default(q),CT.default(q),VT.default(q),NT.default(q),ST.default(q),RT.default(q)}function mT(q,_,j){if(q.helpers[_]){if(q.hooks[_]=q.helpers[_],!j)delete q.helpers[_]}}});var gj=F((Ij,mj)=>{Ij.__esModule=!0;var pT=N6();Ij.default=function(q){q.registerDecorator("inline",function(_,j,K,Y){var f=_;if(!j.partials)j.partials={},f=function(P,$){var w=K.partials;K.partials=pT.extend({},w,j.partials);var O=_(P,$);return K.partials=w,O};return j.partials[Y.args[0]]=Y.fn,f})};mj.exports=Ij.default});var yj=F((oT)=>{oT.__esModule=!0;oT.registerDefaultDecorators=iT;function nT(q){return q&&q.__esModule?q:{default:q}}var cT=gj(),rT=nT(cT);function iT(q){rT.default(q)}});var O2=F((dj,Lj)=>{dj.__esModule=!0;var tT=N6(),TK={methodMap:["debug","info","warn","error"],level:"info",lookupLevel:function q(_){if(typeof _==="string"){var j=tT.indexOf(TK.methodMap,_.toLowerCase());if(j>=0)_=j;else _=parseInt(_,10)}return _},log:function q(_){if(_=TK.lookupLevel(_),typeof console!=="undefined"&&TK.lookupLevel(TK.level)<=_){var j=TK.methodMap[_];if(!console[j])j="log";for(var K=arguments.length,Y=Array(K>1?K-1:0),f=1;f{QT.__esModule=!0;QT.createNewLookupObject=sT;var UT=N6();function sT(){for(var q=arguments.length,_=Array(q),j=0;j{wZ.__esModule=!0;wZ.createProtoAccessControl=YZ;wZ.resultIsAllowed=fZ;wZ.resetLoggedProperties=OZ;function KZ(q){return q&&q.__esModule?q:{default:q}}var lj=pj(),jZ=O2(),PZ=KZ(jZ),J7=Object.create(null);function YZ(q){var _=Object.create(null);_.constructor=!1,_.__defineGetter__=!1,_.__defineSetter__=!1,_.__lookupGetter__=!1;var j=Object.create(null);return j.__proto__=!1,{properties:{whitelist:lj.createNewLookupObject(j,q.allowedProtoProperties),defaultValue:q.allowProtoPropertiesByDefault},methods:{whitelist:lj.createNewLookupObject(_,q.allowedProtoMethods),defaultValue:q.allowProtoMethodsByDefault}}}function fZ(q,_,j){if(typeof q==="function")return xj(_.methods,j);else return xj(_.properties,j)}function xj(q,_){if(q.whitelist[_]!==void 0)return q.whitelist[_]===!0;if(q.defaultValue!==void 0)return q.defaultValue;return $Z(_),!1}function $Z(q){if(J7[q]!==!0)J7[q]=!0,PZ.default.log("error",'Handlebars: Access has been denied to resolve the property "'+q+`" because it is not an "own property" of its parent. You can add a runtime option to disable the check or this warning: See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details`)}function OZ(){Object.keys(J7).forEach(function(q){delete J7[q]})}});var Z7=F((DZ)=>{DZ.__esModule=!0;DZ.HandlebarsEnvironment=v2;function nj(q){return q&&q.__esModule?q:{default:q}}var D_=N6(),JZ=Q6(),z2=nj(JZ),TZ=$2(),ZZ=yj(),kZ=O2(),T7=nj(kZ),XZ=w2(),AZ="4.7.8";DZ.VERSION=AZ;var GZ=8;DZ.COMPILER_REVISION=GZ;var uZ=7;DZ.LAST_COMPATIBLE_COMPILER_REVISION=uZ;var hZ={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};DZ.REVISION_CHANGES=hZ;var W2="[object Object]";function v2(q,_,j){this.helpers=q||{},this.partials=_||{},this.decorators=j||{},TZ.registerDefaultHelpers(this),ZZ.registerDefaultDecorators(this)}v2.prototype={constructor:v2,logger:T7.default,log:T7.default.log,registerHelper:function q(_,j){if(D_.toString.call(_)===W2){if(j)throw new z2.default("Arg not supported with multiple helpers");D_.extend(this.helpers,_)}else this.helpers[_]=j},unregisterHelper:function q(_){delete this.helpers[_]},registerPartial:function q(_,j){if(D_.toString.call(_)===W2)D_.extend(this.partials,_);else{if(typeof j==="undefined")throw new z2.default('Attempting to register a partial called "'+_+'" as undefined');this.partials[_]=j}},unregisterPartial:function q(_){delete this.partials[_]},registerDecorator:function q(_,j){if(D_.toString.call(_)===W2){if(j)throw new z2.default("Arg not supported with multiple decorators");D_.extend(this.decorators,_)}else this.decorators[_]=j},unregisterDecorator:function q(_){delete this.decorators[_]},resetLoggedPropertyAccesses:function q(){XZ.resetLoggedProperties()}};var CZ=T7.default.log;DZ.log=CZ;DZ.createFrame=D_.createFrame;DZ.logger=T7.default});var ij=F((cj,rj)=>{cj.__esModule=!0;function H2(q){this.string=q}H2.prototype.toString=H2.prototype.toHTML=function(){return""+this.string};cj.default=H2;rj.exports=cj.default});var oj=F((LZ)=>{LZ.__esModule=!0;LZ.wrapHelper=dZ;function dZ(q,_){if(typeof q!=="function")return q;var j=function K(){var Y=arguments[arguments.length-1];return arguments[arguments.length-1]=_(Y),q.apply(this,arguments)};return j}});var ej=F((sZ)=>{sZ.__esModule=!0;sZ.checkRevision=oZ;sZ.template=aZ;sZ.wrapProgram=k7;sZ.resolvePartial=BZ;sZ.invokePartial=tZ;sZ.noop=tj;function xZ(q){return q&&q.__esModule?q:{default:q}}function nZ(q){if(q&&q.__esModule)return q;else{var _={};if(q!=null){for(var j in q)if(Object.prototype.hasOwnProperty.call(q,j))_[j]=q[j]}return _.default=q,_}}var cZ=N6(),cq=nZ(cZ),rZ=Q6(),rq=xZ(rZ),iq=Z7(),aj=$2(),iZ=oj(),Bj=w2();function oZ(q){var _=q&&q[0]||1,j=iq.COMPILER_REVISION;if(_>=iq.LAST_COMPATIBLE_COMPILER_REVISION&&_<=iq.COMPILER_REVISION)return;if(_{let _=["titles","archives","diagnostics","memories","overviews","sessions"];for(let j of _)q.exec(`DROP TABLE IF EXISTS ${j}`);console.log("\uD83D\uDDD1️ Dropped all tables from initial migration")}}});function _u(){Nq.getInstance().registerMigration(Kf),console.log("\uD83D\uDCCB Registered all database migrations")}var Pf=R8(()=>{K_();jf();_u()});function T6(q){let _;if(!q)_=new Date;else if(q instanceof Date)_=q;else if(typeof q==="number")_=new Date(q);else if(typeof q==="string"){if(!q.trim())_=new Date;else if(_=new Date(q),isNaN(_.getTime())){let j=q.replace(/\s+/g,"T").replace(/T+/g,"T");if(_=new Date(j),isNaN(_.getTime()))_=new Date}}else _=new Date;return{isoString:_.toISOString(),epoch:_.getTime()}}var Yf={};$q(Yf,{SessionStore:()=>U2});class U2{db;constructor(q){this.db=q||bq()}create(q){let{isoString:_,epoch:j}=T6(q.created_at),Y=this.db.prepare(` + `),console.log("✅ Created initial database schema with all tables and indexes")},down:(q)=>{let _=["titles","archives","diagnostics","memories","overviews","sessions"];for(let j of _)q.exec(`DROP TABLE IF EXISTS ${j}`);console.log("\uD83D\uDDD1️ Dropped all tables from initial migration")}}});function _u(){Nq.getInstance().registerMigration(Kf)}var Pf=R8(()=>{K_();jf();_u()});function T6(q){let _;if(!q)_=new Date;else if(q instanceof Date)_=q;else if(typeof q==="number")_=new Date(q);else if(typeof q==="string"){if(!q.trim())_=new Date;else if(_=new Date(q),isNaN(_.getTime())){let j=q.replace(/\s+/g,"T").replace(/T+/g,"T");if(_=new Date(j),isNaN(_.getTime()))_=new Date}}else _=new Date;return{isoString:_.toISOString(),epoch:_.getTime()}}var Yf={};$q(Yf,{SessionStore:()=>U2});class U2{db;constructor(q){this.db=q||bq()}create(q){let{isoString:_,epoch:j}=T6(q.created_at),Y=this.db.prepare(` INSERT INTO sessions ( session_id, project, created_at, created_at_epoch, source, archive_path, archive_bytes, archive_checksum, archived_at, metadata_json @@ -438,7 +438,7 @@ To restore files: claude-mem restore`),console.log("To empty trash: claude-mem \uD83D\uDCBE Original JSONL file preserved: ${j}`),console.log(" SQLite database is now the primary index");else{let A=e3.join(_.getDataDirectory(),"archive","legacy");J_.mkdirSync(A,{recursive:!0});let G=e3.join(A,`claude-mem-index-${Date.now()}.jsonl`);J_.renameSync(j,G),console.log(` \uD83D\uDCE6 Original JSONL file archived: ${e3.basename(G)}`),console.log(` Backup available at: ${e3.basename(K)}`)}console.log(` \uD83C\uDF89 Migration complete! You can now use claude-mem with SQLite backend.`),console.log(" Run `claude-mem load-context` to verify the migration worked.")}catch(Y){if(console.error(` -❌ Migration failed:`,Y),J_.existsSync(K)&&!J_.existsSync(j))console.log("\uD83D\uDD04 Restoring backup..."),J_.renameSync(K,j);process.exit(1)}}var Tw=R8(()=>{G6();Y9()});var G4={};$q(G4,{sessionStartHook:()=>BV,sessionEndHook:()=>tV,preCompactHook:()=>aV});import{basename as Zw}from"path";async function aV(){try{let q="";process.stdin.setEncoding("utf8");for await(let j of process.stdin)q+=j;let _;if(q)try{_=JSON.parse(q).transcript_path}catch(j){_=q.trim()}if(!_)_=process.env.TRANSCRIPT_PATH||process.argv[2];if(!_){console.log("\uD83D\uDDDC️ Compressing session transcript..."),console.log("❌ No transcript path provided to pre-compact hook"),console.log("Hook data received:",q||"none"),console.log("Environment TRANSCRIPT_PATH:",process.env.TRANSCRIPT_PATH||"not set"),console.log("Command line args:",process.argv.slice(2));return}await A3(_,{dryRun:!1})}catch(q){console.error("Pre-compact hook failed:",q.message),process.exit(1)}}async function BV(){try{let q="";process.stdin.setEncoding("utf8");for await(let j of process.stdin)q+=j;let _;if(q)try{let j=JSON.parse(q);if(j.cwd)_=Zw(j.cwd)}catch(j){console.error("Failed to parse session-start hook data:",j)}if(!_)_=Zw(process.cwd());await q4({format:"session-start",count:"10",project:_})}catch(q){console.error("Session-start hook failed:",q.message),process.exit(1)}}async function tV(){try{let q="";process.stdin.setEncoding("utf8");for await(let _ of process.stdin)q+=_;if(q)try{let _=JSON.parse(q);if(_.reason==="clear"&&_.transcript_path)console.log("\uD83D\uDDDC️ Compressing current session before /clear..."),await A3(_.transcript_path,{dryRun:!1})}catch(_){console.error("Failed to parse hook data:",_)}console.log("Session ended successfully")}catch(q){console.error("Session-end hook failed:",q.message),process.exit(1)}}var u4=R8(()=>{O9();f5()});var K1=F6(_1(),1),{program:vM,createCommand:HM,createArgument:JM,createOption:TM,CommanderError:ZM,InvalidArgumentError:kM,InvalidOptionArgumentError:XM,Command:j1,Argument:AM,Option:GM,Help:uM}=K1.default;import{readFileSync as Rz,existsSync as Iz}from"fs";import{join as mz,dirname as gz}from"path";import{fileURLToPath as yz}from"url";var P1="claude-mem",Y1="3.7.1",f1="Memory compression system for Claude Code - persist context across sessions",$1=P1,O1=Y1,w1=f1;try{let q=yz(import.meta.url),_=gz(q),j=mz(_,"..","..","package.json");if(Iz(j)){let K=JSON.parse(Rz(j,"utf-8"));$1=K.name||P1,O1=K.version||Y1,w1=K.description||f1}}catch{}var eq=$1,z1=O1,W1=w1;O9();NK();import{readFileSync as EK,writeFileSync as d_,existsSync as I8,chmodSync as YC,mkdirSync as IK,copyFileSync as y_,statSync as fC,readdirSync as $C}from"fs";import{join as V8,dirname as RK}from"path";import{homedir as K5,platform as i$}from"os";import{execSync as g_}from"child_process";import{fileURLToPath as o$}from"url";var lf=(q=0)=>(_)=>`\x1B[${_+q}m`,xf=(q=0)=>(_)=>`\x1B[${38+q};5;${_}m`,nf=(q=0)=>(_,j,K)=>`\x1B[${38+q};2;${_};${j};${K}m`,c8={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},mb=Object.keys(c8.modifier),au=Object.keys(c8.color),Bu=Object.keys(c8.bgColor),gb=[...au,...Bu];function tu(){let q=new Map;for(let[_,j]of Object.entries(c8)){for(let[K,Y]of Object.entries(j))c8[K]={open:`\x1B[${Y[0]}m`,close:`\x1B[${Y[1]}m`},j[K]=c8[K],q.set(Y[0],Y[1]);Object.defineProperty(c8,_,{value:j,enumerable:!1})}return Object.defineProperty(c8,"codes",{value:q,enumerable:!1}),c8.color.close="\x1B[39m",c8.bgColor.close="\x1B[49m",c8.color.ansi=lf(),c8.color.ansi256=xf(),c8.color.ansi16m=nf(),c8.bgColor.ansi=lf(10),c8.bgColor.ansi256=xf(10),c8.bgColor.ansi16m=nf(10),Object.defineProperties(c8,{rgbToAnsi256:{value(_,j,K){if(_===j&&j===K){if(_<8)return 16;if(_>248)return 231;return Math.round((_-8)/247*24)+232}return 16+36*Math.round(_/255*5)+6*Math.round(j/255*5)+Math.round(K/255*5)},enumerable:!1},hexToRgb:{value(_){let j=/[a-f\d]{6}|[a-f\d]{3}/i.exec(_.toString(16));if(!j)return[0,0,0];let[K]=j;if(K.length===3)K=[...K].map((f)=>f+f).join("");let Y=Number.parseInt(K,16);return[Y>>16&255,Y>>8&255,Y&255]},enumerable:!1},hexToAnsi256:{value:(_)=>c8.rgbToAnsi256(...c8.hexToRgb(_)),enumerable:!1},ansi256ToAnsi:{value(_){if(_<8)return 30+_;if(_<16)return 90+(_-8);let j,K,Y;if(_>=232)j=((_-232)*10+8)/255,K=j,Y=j;else{_-=16;let $=_%36;j=Math.floor(_/36)/5,K=Math.floor($/6)/5,Y=$%6/5}let f=Math.max(j,K,Y)*2;if(f===0)return 30;let P=30+(Math.round(Y)<<2|Math.round(K)<<1|Math.round(j));if(f===2)P+=60;return P},enumerable:!1},rgbToAnsi:{value:(_,j,K)=>c8.ansi256ToAnsi(c8.rgbToAnsi256(_,j,K)),enumerable:!1},hexToAnsi:{value:(_)=>c8.ansi256ToAnsi(c8.hexToAnsi256(_)),enumerable:!1}}),c8}var Fu=tu(),Zq=Fu;import E9 from"node:process";import eu from"node:os";import cf from"node:tty";function _q(q,_=globalThis.Deno?globalThis.Deno.args:E9.argv){let j=q.startsWith("-")?"":q.length===1?"-":"--",K=_.indexOf(j+q),Y=_.indexOf("--");return K!==-1&&(Y===-1||K=2,has16m:q>=3}}function Qu(q,{streamIsTTY:_,sniffFlags:j=!0}={}){let K=Uu();if(K!==void 0)o7=K;let Y=j?o7:K;if(Y===0)return 0;if(j){if(_q("color=16m")||_q("color=full")||_q("color=truecolor"))return 3;if(_q("color=256"))return 2}if("TF_BUILD"in r8&&"AGENT_NAME"in r8)return 1;if(q&&!_&&Y===void 0)return 0;let f=Y||0;if(r8.TERM==="dumb")return f;if(E9.platform==="win32"){let P=eu.release().split(".");if(Number(P[0])>=10&&Number(P[2])>=10586)return Number(P[2])>=14931?3:2;return 1}if("CI"in r8){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((P)=>(P in r8)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((P)=>(P in r8))||r8.CI_NAME==="codeship")return 1;return f}if("TEAMCITY_VERSION"in r8)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r8.TEAMCITY_VERSION)?1:0;if(r8.COLORTERM==="truecolor")return 3;if(r8.TERM==="xterm-kitty")return 3;if(r8.TERM==="xterm-ghostty")return 3;if(r8.TERM==="wezterm")return 3;if("TERM_PROGRAM"in r8){let P=Number.parseInt((r8.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(r8.TERM_PROGRAM){case"iTerm.app":return P>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(r8.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(r8.TERM))return 1;if("COLORTERM"in r8)return 1;return f}function rf(q,_={}){let j=Qu(q,{streamIsTTY:q&&q.isTTY,..._});return su(j)}var qh={stdout:rf({isTTY:cf.isatty(1)}),stderr:rf({isTTY:cf.isatty(2)})},of=qh;function af(q,_,j){let K=q.indexOf(_);if(K===-1)return q;let Y=_.length,f=0,P="";do P+=q.slice(f,K)+_+j,f=K+Y,K=q.indexOf(_,f);while(K!==-1);return P+=q.slice(f),P}function Bf(q,_,j,K){let Y=0,f="";do{let P=q[K-1]==="\r";f+=q.slice(Y,P?K-1:K)+_+(P?`\r +❌ Migration failed:`,Y),J_.existsSync(K)&&!J_.existsSync(j))console.log("\uD83D\uDD04 Restoring backup..."),J_.renameSync(K,j);process.exit(1)}}var Tw=R8(()=>{G6();Y9()});var G4={};$q(G4,{sessionStartHook:()=>BV,sessionEndHook:()=>tV,preCompactHook:()=>aV});import{basename as Zw}from"path";async function aV(){try{let q="";process.stdin.setEncoding("utf8");for await(let j of process.stdin)q+=j;let _;if(q)try{_=JSON.parse(q).transcript_path}catch(j){_=q.trim()}if(!_)_=process.env.TRANSCRIPT_PATH||process.argv[2];if(!_){console.log("\uD83D\uDDDC️ Compressing session transcript..."),console.log("❌ No transcript path provided to pre-compact hook"),console.log("Hook data received:",q||"none"),console.log("Environment TRANSCRIPT_PATH:",process.env.TRANSCRIPT_PATH||"not set"),console.log("Command line args:",process.argv.slice(2));return}await A3(_,{dryRun:!1})}catch(q){console.error("Pre-compact hook failed:",q.message),process.exit(1)}}async function BV(){try{let q="";process.stdin.setEncoding("utf8");for await(let j of process.stdin)q+=j;let _;if(q)try{let j=JSON.parse(q);if(j.cwd)_=Zw(j.cwd)}catch(j){console.error("Failed to parse session-start hook data:",j)}if(!_)_=Zw(process.cwd());await q4({format:"session-start",count:"10",project:_})}catch(q){console.error("Session-start hook failed:",q.message),process.exit(1)}}async function tV(){try{let q="";process.stdin.setEncoding("utf8");for await(let _ of process.stdin)q+=_;if(q)try{let _=JSON.parse(q);if(_.reason==="clear"&&_.transcript_path)console.log("\uD83D\uDDDC️ Compressing current session before /clear..."),await A3(_.transcript_path,{dryRun:!1})}catch(_){console.error("Failed to parse hook data:",_)}console.log("Session ended successfully")}catch(q){console.error("Session-end hook failed:",q.message),process.exit(1)}}var u4=R8(()=>{O9();f5()});var K1=F6(_1(),1),{program:vM,createCommand:HM,createArgument:JM,createOption:TM,CommanderError:ZM,InvalidArgumentError:kM,InvalidOptionArgumentError:XM,Command:j1,Argument:AM,Option:GM,Help:uM}=K1.default;import{readFileSync as Rz,existsSync as Iz}from"fs";import{join as mz,dirname as gz}from"path";import{fileURLToPath as yz}from"url";var P1="claude-mem",Y1="3.7.2",f1="Memory compression system for Claude Code - persist context across sessions",$1=P1,O1=Y1,w1=f1;try{let q=yz(import.meta.url),_=gz(q),j=mz(_,"..","..","package.json");if(Iz(j)){let K=JSON.parse(Rz(j,"utf-8"));$1=K.name||P1,O1=K.version||Y1,w1=K.description||f1}}catch{}var eq=$1,z1=O1,W1=w1;O9();NK();import{readFileSync as EK,writeFileSync as d_,existsSync as I8,chmodSync as YC,mkdirSync as IK,copyFileSync as y_,statSync as fC,readdirSync as $C}from"fs";import{join as V8,dirname as RK}from"path";import{homedir as K5,platform as i$}from"os";import{execSync as g_}from"child_process";import{fileURLToPath as o$}from"url";var lf=(q=0)=>(_)=>`\x1B[${_+q}m`,xf=(q=0)=>(_)=>`\x1B[${38+q};5;${_}m`,nf=(q=0)=>(_,j,K)=>`\x1B[${38+q};2;${_};${j};${K}m`,c8={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},mb=Object.keys(c8.modifier),au=Object.keys(c8.color),Bu=Object.keys(c8.bgColor),gb=[...au,...Bu];function tu(){let q=new Map;for(let[_,j]of Object.entries(c8)){for(let[K,Y]of Object.entries(j))c8[K]={open:`\x1B[${Y[0]}m`,close:`\x1B[${Y[1]}m`},j[K]=c8[K],q.set(Y[0],Y[1]);Object.defineProperty(c8,_,{value:j,enumerable:!1})}return Object.defineProperty(c8,"codes",{value:q,enumerable:!1}),c8.color.close="\x1B[39m",c8.bgColor.close="\x1B[49m",c8.color.ansi=lf(),c8.color.ansi256=xf(),c8.color.ansi16m=nf(),c8.bgColor.ansi=lf(10),c8.bgColor.ansi256=xf(10),c8.bgColor.ansi16m=nf(10),Object.defineProperties(c8,{rgbToAnsi256:{value(_,j,K){if(_===j&&j===K){if(_<8)return 16;if(_>248)return 231;return Math.round((_-8)/247*24)+232}return 16+36*Math.round(_/255*5)+6*Math.round(j/255*5)+Math.round(K/255*5)},enumerable:!1},hexToRgb:{value(_){let j=/[a-f\d]{6}|[a-f\d]{3}/i.exec(_.toString(16));if(!j)return[0,0,0];let[K]=j;if(K.length===3)K=[...K].map((f)=>f+f).join("");let Y=Number.parseInt(K,16);return[Y>>16&255,Y>>8&255,Y&255]},enumerable:!1},hexToAnsi256:{value:(_)=>c8.rgbToAnsi256(...c8.hexToRgb(_)),enumerable:!1},ansi256ToAnsi:{value(_){if(_<8)return 30+_;if(_<16)return 90+(_-8);let j,K,Y;if(_>=232)j=((_-232)*10+8)/255,K=j,Y=j;else{_-=16;let $=_%36;j=Math.floor(_/36)/5,K=Math.floor($/6)/5,Y=$%6/5}let f=Math.max(j,K,Y)*2;if(f===0)return 30;let P=30+(Math.round(Y)<<2|Math.round(K)<<1|Math.round(j));if(f===2)P+=60;return P},enumerable:!1},rgbToAnsi:{value:(_,j,K)=>c8.ansi256ToAnsi(c8.rgbToAnsi256(_,j,K)),enumerable:!1},hexToAnsi:{value:(_)=>c8.ansi256ToAnsi(c8.hexToAnsi256(_)),enumerable:!1}}),c8}var Fu=tu(),Zq=Fu;import E9 from"node:process";import eu from"node:os";import cf from"node:tty";function _q(q,_=globalThis.Deno?globalThis.Deno.args:E9.argv){let j=q.startsWith("-")?"":q.length===1?"-":"--",K=_.indexOf(j+q),Y=_.indexOf("--");return K!==-1&&(Y===-1||K=2,has16m:q>=3}}function Qu(q,{streamIsTTY:_,sniffFlags:j=!0}={}){let K=Uu();if(K!==void 0)o7=K;let Y=j?o7:K;if(Y===0)return 0;if(j){if(_q("color=16m")||_q("color=full")||_q("color=truecolor"))return 3;if(_q("color=256"))return 2}if("TF_BUILD"in r8&&"AGENT_NAME"in r8)return 1;if(q&&!_&&Y===void 0)return 0;let f=Y||0;if(r8.TERM==="dumb")return f;if(E9.platform==="win32"){let P=eu.release().split(".");if(Number(P[0])>=10&&Number(P[2])>=10586)return Number(P[2])>=14931?3:2;return 1}if("CI"in r8){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((P)=>(P in r8)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((P)=>(P in r8))||r8.CI_NAME==="codeship")return 1;return f}if("TEAMCITY_VERSION"in r8)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r8.TEAMCITY_VERSION)?1:0;if(r8.COLORTERM==="truecolor")return 3;if(r8.TERM==="xterm-kitty")return 3;if(r8.TERM==="xterm-ghostty")return 3;if(r8.TERM==="wezterm")return 3;if("TERM_PROGRAM"in r8){let P=Number.parseInt((r8.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(r8.TERM_PROGRAM){case"iTerm.app":return P>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(r8.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(r8.TERM))return 1;if("COLORTERM"in r8)return 1;return f}function rf(q,_={}){let j=Qu(q,{streamIsTTY:q&&q.isTTY,..._});return su(j)}var qh={stdout:rf({isTTY:cf.isatty(1)}),stderr:rf({isTTY:cf.isatty(2)})},of=qh;function af(q,_,j){let K=q.indexOf(_);if(K===-1)return q;let Y=_.length,f=0,P="";do P+=q.slice(f,K)+_+j,f=K+Y,K=q.indexOf(_,f);while(K!==-1);return P+=q.slice(f),P}function Bf(q,_,j,K){let Y=0,f="";do{let P=q[K-1]==="\r";f+=q.slice(Y,P?K-1:K)+_+(P?`\r `:` `)+j,Y=K+1,K=q.indexOf(` `,Y)}while(K!==-1);return f+=q.slice(Y),f}var{stdout:tf,stderr:Ff}=of,R9=Symbol("GENERATOR"),bK=Symbol("STYLER"),D3=Symbol("IS_EMPTY"),ef=["ansi","ansi","ansi256","ansi16m"],SK=Object.create(null),_h=(q,_={})=>{if(_.level&&!(Number.isInteger(_.level)&&_.level>=0&&_.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let j=tf?tf.level:0;q.level=_.level===void 0?j:_.level};var Kh=(q)=>{let _=(...j)=>j.join(" ");return _h(_,q),Object.setPrototypeOf(_,V3.prototype),_};function V3(q){return Kh(q)}Object.setPrototypeOf(V3.prototype,Function.prototype);for(let[q,_]of Object.entries(Zq))SK[q]={get(){let j=a7(this,m9(_.open,_.close,this[bK]),this[D3]);return Object.defineProperty(this,q,{value:j}),j}};SK.visible={get(){let q=a7(this,this[bK],!0);return Object.defineProperty(this,"visible",{value:q}),q}};var I9=(q,_,j,...K)=>{if(q==="rgb"){if(_==="ansi16m")return Zq[j].ansi16m(...K);if(_==="ansi256")return Zq[j].ansi256(Zq.rgbToAnsi256(...K));return Zq[j].ansi(Zq.rgbToAnsi(...K))}if(q==="hex")return I9("rgb",_,j,...Zq.hexToRgb(...K));return Zq[j][q](...K)},jh=["rgb","hex","ansi256"];for(let q of jh){SK[q]={get(){let{level:j}=this;return function(...K){let Y=m9(I9(q,ef[j],"color",...K),Zq.color.close,this[bK]);return a7(this,Y,this[D3])}}};let _="bg"+q[0].toUpperCase()+q.slice(1);SK[_]={get(){let{level:j}=this;return function(...K){let Y=m9(I9(q,ef[j],"bgColor",...K),Zq.bgColor.close,this[bK]);return a7(this,Y,this[D3])}}}}var Ph=Object.defineProperties(()=>{},{...SK,level:{enumerable:!0,get(){return this[R9].level},set(q){this[R9].level=q}}}),m9=(q,_,j)=>{let K,Y;if(j===void 0)K=q,Y=_;else K=j.openAll+q,Y=_+j.closeAll;return{open:q,close:_,openAll:K,closeAll:Y,parent:j}},a7=(q,_,j)=>{let K=(...Y)=>Yh(K,Y.length===1?""+Y[0]:Y.join(" "));return Object.setPrototypeOf(K,Ph),K[R9]=q,K[bK]=_,K[D3]=j,K},Yh=(q,_)=>{if(q.level<=0||!_)return q[D3]?"":_;let j=q[bK];if(j===void 0)return _;let{openAll:K,closeAll:Y}=j;if(_.includes("\x1B"))while(j!==void 0)_=af(_,j.close,j.open),j=j.parent;let f=_.indexOf(` diff --git a/package.json b/package.json index c480a94c..e52859dc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "claude-mem", - "version": "3.7.1", + "version": "3.7.2", "description": "Memory compression system for Claude Code - persist context across sessions", "keywords": [ "claude", diff --git a/src/services/sqlite/migrations/index.ts b/src/services/sqlite/migrations/index.ts index cc5f2241..c04e218e 100644 --- a/src/services/sqlite/migrations/index.ts +++ b/src/services/sqlite/migrations/index.ts @@ -9,8 +9,6 @@ export function registerMigrations(): void { // Register migrations in order manager.registerMigration(migration001); - - console.log('📋 Registered all database migrations'); } // Auto-register migrations when this module is imported