diff --git a/plugin/scripts/worker-service.cjs b/plugin/scripts/worker-service.cjs index 2631077b..dff1fe77 100755 --- a/plugin/scripts/worker-service.cjs +++ b/plugin/scripts/worker-service.cjs @@ -747,7 +747,7 @@ IMPORTANT: This is not the end of the session. You will receive more requests to `))})}async supportedCommands(){return(await this.initialization).commands}async supportedModels(){return(await this.initialization).models}async mcpServerStatus(){return(await this.request({subtype:"mcp_status"})).response.mcpServers}async accountInfo(){return(await this.initialization).account}async streamInput(e){Jr("[Query.streamInput] Starting to process input stream"),Jr(`[Query.streamInput] this.sdkMcpTransports.size = ${this.sdkMcpTransports.size}`);try{let a=0;for await(let t of e){if(a++,Jr(`[Query.streamInput] Processing message ${a}: ${t.type}`),this.abortController?.signal.aborted)break;await Promise.resolve(this.transport.write(JSON.stringify(t)+` `))}if(Jr(`[Query.streamInput] Finished processing ${a} messages from input stream`),Jr(`[Query.streamInput] About to check MCP servers. this.sdkMcpTransports.size = ${this.sdkMcpTransports.size}`),this.sdkMcpTransports.size>0&&this.firstResultReceivedPromise){Jr("[Query.streamInput] Entering Promise.race to wait for result");let t=1e4,s;await Promise.race([this.firstResultReceivedPromise.then(()=>{Jr("[Query.streamInput] Received first result, closing input stream"),s&&clearTimeout(s)}),new Promise(i=>{s=setTimeout(()=>{Jr("[Query.streamInput] Timed out waiting for first result, closing input stream"),i()},t)})]),s&&clearTimeout(s)}Jr("[Query] Calling transport.endInput() to close stdin to CLI process"),this.transport.endInput()}catch(a){if(!(a instanceof ds))throw a}}handleHookCallbacks(e,a,t,s){let i=this.hookCallbacks.get(e);if(!i)throw new Error(`No hook callback found for ID: ${e}`);return i(a,t,{signal:s})}sendMcpServerMessageToCli(e,a){if("id"in a&&a.id!==null&&a.id!==void 0){let t=`${e}:${a.id}`,s=this.pendingMcpResponses.get(t);if(s){s.resolve(a),this.pendingMcpResponses.delete(t);return}}throw new Error("No pending request found")}handleMcpControlRequest(e,a,t){let s="id"in a.message?a.message.id:null,i=`${e}:${s}`;return new Promise((n,o)=>{let l=null,c=()=>{l&&clearTimeout(l),this.pendingMcpResponses.delete(i)},u=m=>{c(),n(m)},f=m=>{c(),o(m)};if(this.pendingMcpResponses.set(i,{resolve:u,reject:f}),t.onmessage)t.onmessage(a.message);else{c(),o(new Error("No message handler registered"));return}l=setTimeout(()=>{this.pendingMcpResponses.has(i)&&(c(),o(new Error("Request timeout")))},3e4)})}},w={};xj(w,{void:()=>M6,util:()=>Ze,unknown:()=>F6,union:()=>B6,undefined:()=>D6,tuple:()=>G6,transformer:()=>V1,symbol:()=>N6,string:()=>yE,strictObject:()=>H6,setErrorMap:()=>n6,set:()=>K6,record:()=>W6,quotelessJson:()=>a6,promise:()=>r5,preprocess:()=>n5,pipeline:()=>i5,ostring:()=>o5,optional:()=>a5,onumber:()=>c5,oboolean:()=>l5,objectUtil:()=>Pd,object:()=>z6,number:()=>bE,nullable:()=>s5,null:()=>$6,never:()=>L6,nativeEnum:()=>t5,nan:()=>I6,map:()=>Q6,makeIssue:()=>Hc,literal:()=>Y6,lazy:()=>J6,late:()=>O6,isValid:()=>ms,isDirty:()=>Td,isAsync:()=>Ti,isAborted:()=>Rd,intersection:()=>Z6,instanceof:()=>C6,getParsedType:()=>ea,getErrorMap:()=>zc,function:()=>X6,enum:()=>e5,effect:()=>V1,discriminatedUnion:()=>V6,defaultErrorMap:()=>xn,datetimeRegex:()=>hE,date:()=>j6,custom:()=>gE,coerce:()=>u5,boolean:()=>xE,bigint:()=>A6,array:()=>U6,any:()=>q6,addIssueToContext:()=>se,ZodVoid:()=>En,ZodUnknown:()=>ra,ZodUnion:()=>_s,ZodUndefined:()=>bs,ZodType:()=>je,ZodTuple:()=>Lr,ZodTransformer:()=>Qt,ZodSymbol:()=>_n,ZodString:()=>Ra,ZodSet:()=>Sn,ZodSchema:()=>je,ZodRecord:()=>Vc,ZodReadonly:()=>Os,ZodPromise:()=>ka,ZodPipeline:()=>Oi,ZodParsedType:()=>le,ZodOptional:()=>pr,ZodObject:()=>Lt,ZodNumber:()=>hs,ZodNullable:()=>Mr,ZodNull:()=>xs,ZodNever:()=>Sr,ZodNativeEnum:()=>Rs,ZodNaN:()=>Pn,ZodMap:()=>wn,ZodLiteral:()=>Ss,ZodLazy:()=>ws,ZodIssueCode:()=>J,ZodIntersection:()=>Es,ZodFunction:()=>Zc,ZodFirstPartyTypeKind:()=>Pe,ZodError:()=>Wt,ZodEnum:()=>Ps,ZodEffects:()=>Qt,ZodDiscriminatedUnion:()=>Bc,ZodDefault:()=>Ts,ZodDate:()=>ys,ZodCatch:()=>ks,ZodBranded:()=>ki,ZodBoolean:()=>gs,ZodBigInt:()=>vs,ZodArray:()=>aa,ZodAny:()=>Ta,Schema:()=>je,ParseStatus:()=>Pt,OK:()=>kt,NEVER:()=>p5,INVALID:()=>we,EMPTY_PATH:()=>i6,DIRTY:()=>bn,BRAND:()=>k6});var Ze;(function(r){r.assertEqual=s=>{};function e(s){}r.assertIs=e;function a(s){throw new Error}r.assertNever=a,r.arrayToEnum=s=>{let i={};for(let n of s)i[n]=n;return i},r.getValidEnumValues=s=>{let i=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),n={};for(let o of i)n[o]=s[o];return r.objectValues(n)},r.objectValues=s=>r.objectKeys(s).map(function(i){return s[i]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let i=[];for(let n in s)Object.prototype.hasOwnProperty.call(s,n)&&i.push(n);return i},r.find=(s,i)=>{for(let n of s)if(i(n))return n},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function t(s,i=" | "){return s.map(n=>typeof n=="string"?`'${n}'`:n).join(i)}r.joinValues=t,r.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(Ze||(Ze={}));var Pd;(function(r){r.mergeShapes=(e,a)=>({...e,...a})})(Pd||(Pd={}));var le=Ze.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ea=r=>{switch(typeof r){case"undefined":return le.undefined;case"string":return le.string;case"number":return Number.isNaN(r)?le.nan:le.number;case"boolean":return le.boolean;case"function":return le.function;case"bigint":return le.bigint;case"symbol":return le.symbol;case"object":return Array.isArray(r)?le.array:r===null?le.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?le.promise:typeof Map<"u"&&r instanceof Map?le.map:typeof Set<"u"&&r instanceof Set?le.set:typeof Date<"u"&&r instanceof Date?le.date:le.object;default:return le.unknown}},J=Ze.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"]),a6=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),Wt=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=t=>{this.issues=[...this.issues,t]},this.addIssues=(t=[])=>{this.issues=[...this.issues,...t]};let a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}format(e){let a=e||function(i){return i.message},t={_errors:[]},s=i=>{for(let n of i.issues)if(n.code==="invalid_union")n.unionErrors.map(s);else if(n.code==="invalid_return_type")s(n.returnTypeError);else if(n.code==="invalid_arguments")s(n.argumentsError);else if(n.path.length===0)t._errors.push(a(n));else{let o=t,l=0;for(;la.message){let a={},t=[];for(let s of this.issues)if(s.path.length>0){let i=s.path[0];a[i]=a[i]||[],a[i].push(e(s))}else t.push(e(s));return{formErrors:t,fieldErrors:a}}get formErrors(){return this.flatten()}};Wt.create=r=>new Wt(r);var s6=(r,e)=>{let a;switch(r.code){case J.invalid_type:r.received===le.undefined?a="Required":a=`Expected ${r.expected}, received ${r.received}`;break;case J.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(r.expected,Ze.jsonStringifyReplacer)}`;break;case J.unrecognized_keys:a=`Unrecognized key(s) in object: ${Ze.joinValues(r.keys,", ")}`;break;case J.invalid_union:a="Invalid input";break;case J.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${Ze.joinValues(r.options)}`;break;case J.invalid_enum_value:a=`Invalid enum value. Expected ${Ze.joinValues(r.options)}, received '${r.received}'`;break;case J.invalid_arguments:a="Invalid function arguments";break;case J.invalid_return_type:a="Invalid function return type";break;case J.invalid_date:a="Invalid date";break;case J.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(a=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(a=`${a} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?a=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?a=`Invalid input: must end with "${r.validation.endsWith}"`:Ze.assertNever(r.validation):r.validation!=="regex"?a=`Invalid ${r.validation}`:a="Invalid";break;case J.too_small:r.type==="array"?a=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?a=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?a=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?a=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?a=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:a="Invalid input";break;case J.too_big:r.type==="array"?a=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?a=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?a=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?a=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?a=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:a="Invalid input";break;case J.custom:a="Invalid input";break;case J.invalid_intersection_types:a="Intersection results could not be merged";break;case J.not_multiple_of:a=`Number must be a multiple of ${r.multipleOf}`;break;case J.not_finite:a="Number must be finite";break;default:a=e.defaultError,Ze.assertNever(r)}return{message:a}},xn=s6,dE=xn;function n6(r){dE=r}function zc(){return dE}var Hc=r=>{let{data:e,path:a,errorMaps:t,issueData:s}=r,i=[...a,...s.path||[]],n={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let o="",l=t.filter(c=>!!c).slice().reverse();for(let c of l)o=c(n,{data:e,defaultError:o}).message;return{...s,path:i,message:o}},i6=[];function se(r,e){let a=zc(),t=Hc({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,a,a===xn?void 0:xn].filter(s=>!!s)});r.common.issues.push(t)}var Pt=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,a){let t=[];for(let s of a){if(s.status==="aborted")return we;s.status==="dirty"&&e.dirty(),t.push(s.value)}return{status:e.value,value:t}}static async mergeObjectAsync(e,a){let t=[];for(let s of a){let i=await s.key,n=await s.value;t.push({key:i,value:n})}return r.mergeObjectSync(e,t)}static mergeObjectSync(e,a){let t={};for(let s of a){let{key:i,value:n}=s;if(i.status==="aborted"||n.status==="aborted")return we;i.status==="dirty"&&e.dirty(),n.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof n.value<"u"||s.alwaysSet)&&(t[i.value]=n.value)}return{status:e.value,value:t}}},we=Object.freeze({status:"aborted"}),bn=r=>({status:"dirty",value:r}),kt=r=>({status:"valid",value:r}),Rd=r=>r.status==="aborted",Td=r=>r.status==="dirty",ms=r=>r.status==="valid",Ti=r=>typeof Promise<"u"&&r instanceof Promise,me;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(me||(me={}));var dr=class{constructor(e,a,t,s){this._cachedPath=[],this.parent=e,this.data=a,this._path=t,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},H1=(r,e)=>{if(ms(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let a=new Wt(r.common.issues);return this._error=a,this._error}}};function $e(r){if(!r)return{};let{errorMap:e,invalid_type_error:a,required_error:t,description:s}=r;if(e&&(a||t))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(n,o)=>{let{message:l}=r;return n.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??t??o.defaultError}:n.code!=="invalid_type"?{message:o.defaultError}:{message:l??a??o.defaultError}},description:s}}var je=class{get description(){return this._def.description}_getType(e){return ea(e.data)}_getOrReturnCtx(e,a){return a||{common:e.parent.common,data:e.data,parsedType:ea(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Pt,ctx:{common:e.parent.common,data:e.data,parsedType:ea(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let a=this._parse(e);if(Ti(a))throw new Error("Synchronous parse encountered promise.");return a}_parseAsync(e){let a=this._parse(e);return Promise.resolve(a)}parse(e,a){let t=this.safeParse(e,a);if(t.success)return t.data;throw t.error}safeParse(e,a){let t={common:{issues:[],async:a?.async??!1,contextualErrorMap:a?.errorMap},path:a?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ea(e)},s=this._parseSync({data:e,path:t.path,parent:t});return H1(t,s)}"~validate"(e){let a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ea(e)};if(!this["~standard"].async)try{let t=this._parseSync({data:e,path:[],parent:a});return ms(t)?{value:t.value}:{issues:a.common.issues}}catch(t){t?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:a}).then(t=>ms(t)?{value:t.value}:{issues:a.common.issues})}async parseAsync(e,a){let t=await this.safeParseAsync(e,a);if(t.success)return t.data;throw t.error}async safeParseAsync(e,a){let t={common:{issues:[],contextualErrorMap:a?.errorMap,async:!0},path:a?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ea(e)},s=this._parse({data:e,path:t.path,parent:t}),i=await(Ti(s)?s:Promise.resolve(s));return H1(t,i)}refine(e,a){let t=s=>typeof a=="string"||typeof a>"u"?{message:a}:typeof a=="function"?a(s):a;return this._refinement((s,i)=>{let n=e(s),o=()=>i.addIssue({code:J.custom,...t(s)});return typeof Promise<"u"&&n instanceof Promise?n.then(l=>l?!0:(o(),!1)):n?!0:(o(),!1)})}refinement(e,a){return this._refinement((t,s)=>e(t)?!0:(s.addIssue(typeof a=="function"?a(t,s):a),!1))}_refinement(e){return new Qt({schema:this,typeName:Pe.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:a=>this["~validate"](a)}}optional(){return pr.create(this,this._def)}nullable(){return Mr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return aa.create(this)}promise(){return ka.create(this,this._def)}or(e){return _s.create([this,e],this._def)}and(e){return Es.create(this,e,this._def)}transform(e){return new Qt({...$e(this._def),schema:this,typeName:Pe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let a=typeof e=="function"?e:()=>e;return new Ts({...$e(this._def),innerType:this,defaultValue:a,typeName:Pe.ZodDefault})}brand(){return new ki({typeName:Pe.ZodBranded,type:this,...$e(this._def)})}catch(e){let a=typeof e=="function"?e:()=>e;return new ks({...$e(this._def),innerType:this,catchValue:a,typeName:Pe.ZodCatch})}describe(e){let a=this.constructor;return new a({...this._def,description:e})}pipe(e){return Oi.create(this,e)}readonly(){return Os.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},o6=/^c[^\s-]{8,}$/i,c6=/^[0-9a-z]+$/,l6=/^[0-9A-HJKMNP-TV-Z]{26}$/i,u6=/^[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,p6=/^[a-z0-9_-]{21}$/i,d6=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,f6=/^[-+]?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)?)??$/,m6=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,h6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",gd,v6=/^(?:(?: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])$/,g6=/^(?:(?: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])$/,y6=/^(([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]))$/,b6=/^(([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])$/,x6=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,_6=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,fE="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",E6=new RegExp(`^${fE}$`);function mE(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);let a=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${a}`}function w6(r){return new RegExp(`^${mE(r)}$`)}function hE(r){let e=`${fE}T${mE(r)}`,a=[];return a.push(r.local?"Z?":"Z"),r.offset&&a.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${a.join("|")})`,new RegExp(`^${e}$`)}function S6(r,e){return!!((e==="v4"||!e)&&v6.test(r)||(e==="v6"||!e)&&y6.test(r))}function P6(r,e){if(!d6.test(r))return!1;try{let[a]=r.split(".");if(!a)return!1;let t=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),s=JSON.parse(atob(t));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function R6(r,e){return!!((e==="v4"||!e)&&g6.test(r)||(e==="v6"||!e)&&b6.test(r))}var Ra=class r extends je{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==le.string){let i=this._getOrReturnCtx(e);return se(i,{code:J.invalid_type,expected:le.string,received:i.parsedType}),we}let t=new Pt,s;for(let i of this._def.checks)if(i.kind==="min")e.data.lengthi.value&&(s=this._getOrReturnCtx(e,s),se(s,{code:J.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if(i.kind==="length"){let n=e.data.length>i.value,o=e.data.lengthe.test(s),{validation:a,code:J.invalid_string,...me.errToObj(t)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...me.errToObj(e)})}url(e){return this._addCheck({kind:"url",...me.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...me.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...me.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...me.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...me.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...me.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...me.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...me.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...me.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...me.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...me.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...me.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...me.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...me.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...me.errToObj(e)})}regex(e,a){return this._addCheck({kind:"regex",regex:e,...me.errToObj(a)})}includes(e,a){return this._addCheck({kind:"includes",value:e,position:a?.position,...me.errToObj(a?.message)})}startsWith(e,a){return this._addCheck({kind:"startsWith",value:e,...me.errToObj(a)})}endsWith(e,a){return this._addCheck({kind:"endsWith",value:e,...me.errToObj(a)})}min(e,a){return this._addCheck({kind:"min",value:e,...me.errToObj(a)})}max(e,a){return this._addCheck({kind:"max",value:e,...me.errToObj(a)})}length(e,a){return this._addCheck({kind:"length",value:e,...me.errToObj(a)})}nonempty(e){return this.min(1,me.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxLength(){let e=null;for(let a of this._def.checks)a.kind==="max"&&(e===null||a.valuenew Ra({checks:[],typeName:Pe.ZodString,coerce:r?.coerce??!1,...$e(r)});function T6(r,e){let a=(r.toString().split(".")[1]||"").length,t=(e.toString().split(".")[1]||"").length,s=a>t?a:t,i=Number.parseInt(r.toFixed(s).replace(".","")),n=Number.parseInt(e.toFixed(s).replace(".",""));return i%n/10**s}var hs=class r extends je{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==le.number){let i=this._getOrReturnCtx(e);return se(i,{code:J.invalid_type,expected:le.number,received:i.parsedType}),we}let t,s=new Pt;for(let i of this._def.checks)i.kind==="int"?Ze.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),se(t,{code:J.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(t=this._getOrReturnCtx(e,t),se(t,{code:J.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?T6(e.data,i.value)!==0&&(t=this._getOrReturnCtx(e,t),se(t,{code:J.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),se(t,{code:J.not_finite,message:i.message}),s.dirty()):Ze.assertNever(i);return{status:s.value,value:e.data}}gte(e,a){return this.setLimit("min",e,!0,me.toString(a))}gt(e,a){return this.setLimit("min",e,!1,me.toString(a))}lte(e,a){return this.setLimit("max",e,!0,me.toString(a))}lt(e,a){return this.setLimit("max",e,!1,me.toString(a))}setLimit(e,a,t,s){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:t,message:me.toString(s)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:me.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:me.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:me.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:me.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:me.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:me.toString(a)})}finite(e){return this._addCheck({kind:"finite",message:me.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:me.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:me.toString(e)})}get minValue(){let e=null;for(let a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(let a of this._def.checks)a.kind==="max"&&(e===null||a.valuee.kind==="int"||e.kind==="multipleOf"&&Ze.isInteger(e.value))}get isFinite(){let e=null,a=null;for(let t of this._def.checks){if(t.kind==="finite"||t.kind==="int"||t.kind==="multipleOf")return!0;t.kind==="min"?(a===null||t.value>a)&&(a=t.value):t.kind==="max"&&(e===null||t.valuenew hs({checks:[],typeName:Pe.ZodNumber,coerce:r?.coerce||!1,...$e(r)});var vs=class r extends je{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==le.bigint)return this._getInvalidInput(e);let t,s=new Pt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(t=this._getOrReturnCtx(e,t),se(t,{code:J.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),se(t,{code:J.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):Ze.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){let a=this._getOrReturnCtx(e);return se(a,{code:J.invalid_type,expected:le.bigint,received:a.parsedType}),we}gte(e,a){return this.setLimit("min",e,!0,me.toString(a))}gt(e,a){return this.setLimit("min",e,!1,me.toString(a))}lte(e,a){return this.setLimit("max",e,!0,me.toString(a))}lt(e,a){return this.setLimit("max",e,!1,me.toString(a))}setLimit(e,a,t,s){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:t,message:me.toString(s)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:me.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:me.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:me.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:me.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:me.toString(a)})}get minValue(){let e=null;for(let a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(let a of this._def.checks)a.kind==="max"&&(e===null||a.valuenew vs({checks:[],typeName:Pe.ZodBigInt,coerce:r?.coerce??!1,...$e(r)});var gs=class extends je{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==le.boolean){let t=this._getOrReturnCtx(e);return se(t,{code:J.invalid_type,expected:le.boolean,received:t.parsedType}),we}return kt(e.data)}};gs.create=r=>new gs({typeName:Pe.ZodBoolean,coerce:r?.coerce||!1,...$e(r)});var ys=class r extends je{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==le.date){let i=this._getOrReturnCtx(e);return se(i,{code:J.invalid_type,expected:le.date,received:i.parsedType}),we}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return se(i,{code:J.invalid_date}),we}let t=new Pt,s;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()i.value&&(s=this._getOrReturnCtx(e,s),se(s,{code:J.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),t.dirty()):Ze.assertNever(i);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,a){return this._addCheck({kind:"min",value:e.getTime(),message:me.toString(a)})}max(e,a){return this._addCheck({kind:"max",value:e.getTime(),message:me.toString(a)})}get minDate(){let e=null;for(let a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let a of this._def.checks)a.kind==="max"&&(e===null||a.valuenew ys({checks:[],coerce:r?.coerce||!1,typeName:Pe.ZodDate,...$e(r)});var _n=class extends je{_parse(e){if(this._getType(e)!==le.symbol){let t=this._getOrReturnCtx(e);return se(t,{code:J.invalid_type,expected:le.symbol,received:t.parsedType}),we}return kt(e.data)}};_n.create=r=>new _n({typeName:Pe.ZodSymbol,...$e(r)});var bs=class extends je{_parse(e){if(this._getType(e)!==le.undefined){let t=this._getOrReturnCtx(e);return se(t,{code:J.invalid_type,expected:le.undefined,received:t.parsedType}),we}return kt(e.data)}};bs.create=r=>new bs({typeName:Pe.ZodUndefined,...$e(r)});var xs=class extends je{_parse(e){if(this._getType(e)!==le.null){let t=this._getOrReturnCtx(e);return se(t,{code:J.invalid_type,expected:le.null,received:t.parsedType}),we}return kt(e.data)}};xs.create=r=>new xs({typeName:Pe.ZodNull,...$e(r)});var Ta=class extends je{constructor(){super(...arguments),this._any=!0}_parse(e){return kt(e.data)}};Ta.create=r=>new Ta({typeName:Pe.ZodAny,...$e(r)});var ra=class extends je{constructor(){super(...arguments),this._unknown=!0}_parse(e){return kt(e.data)}};ra.create=r=>new ra({typeName:Pe.ZodUnknown,...$e(r)});var Sr=class extends je{_parse(e){let a=this._getOrReturnCtx(e);return se(a,{code:J.invalid_type,expected:le.never,received:a.parsedType}),we}};Sr.create=r=>new Sr({typeName:Pe.ZodNever,...$e(r)});var En=class extends je{_parse(e){if(this._getType(e)!==le.undefined){let t=this._getOrReturnCtx(e);return se(t,{code:J.invalid_type,expected:le.void,received:t.parsedType}),we}return kt(e.data)}};En.create=r=>new En({typeName:Pe.ZodVoid,...$e(r)});var aa=class r extends je{_parse(e){let{ctx:a,status:t}=this._processInputParams(e),s=this._def;if(a.parsedType!==le.array)return se(a,{code:J.invalid_type,expected:le.array,received:a.parsedType}),we;if(s.exactLength!==null){let n=a.data.length>s.exactLength.value,o=a.data.lengths.maxLength.value&&(se(a,{code:J.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),t.dirty()),a.common.async)return Promise.all([...a.data].map((n,o)=>s.type._parseAsync(new dr(a,n,a.path,o)))).then(n=>Pt.mergeArray(t,n));let i=[...a.data].map((n,o)=>s.type._parseSync(new dr(a,n,a.path,o)));return Pt.mergeArray(t,i)}get element(){return this._def.type}min(e,a){return new r({...this._def,minLength:{value:e,message:me.toString(a)}})}max(e,a){return new r({...this._def,maxLength:{value:e,message:me.toString(a)}})}length(e,a){return new r({...this._def,exactLength:{value:e,message:me.toString(a)}})}nonempty(e){return this.min(1,e)}};aa.create=(r,e)=>new aa({type:r,minLength:null,maxLength:null,exactLength:null,typeName:Pe.ZodArray,...$e(e)});function yn(r){if(r instanceof Lt){let e={};for(let a in r.shape){let t=r.shape[a];e[a]=pr.create(yn(t))}return new Lt({...r._def,shape:()=>e})}else return r instanceof aa?new aa({...r._def,type:yn(r.element)}):r instanceof pr?pr.create(yn(r.unwrap())):r instanceof Mr?Mr.create(yn(r.unwrap())):r instanceof Lr?Lr.create(r.items.map(e=>yn(e))):r}var Lt=class r extends je{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),a=Ze.objectKeys(e);return this._cached={shape:e,keys:a},this._cached}_parse(e){if(this._getType(e)!==le.object){let c=this._getOrReturnCtx(e);return se(c,{code:J.invalid_type,expected:le.object,received:c.parsedType}),we}let{status:t,ctx:s}=this._processInputParams(e),{shape:i,keys:n}=this._getCached(),o=[];if(!(this._def.catchall instanceof Sr&&this._def.unknownKeys==="strip"))for(let c in s.data)n.includes(c)||o.push(c);let l=[];for(let c of n){let u=i[c],f=s.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new dr(s,f,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof Sr){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of o)l.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(c==="strict")o.length>0&&(se(s,{code:J.unrecognized_keys,keys:o}),t.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of o){let f=s.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new dr(s,f,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let f=await u.key,m=await u.value;c.push({key:f,value:m,alwaysSet:u.alwaysSet})}return c}).then(c=>Pt.mergeObjectSync(t,c)):Pt.mergeObjectSync(t,l)}get shape(){return this._def.shape()}strict(e){return me.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(a,t)=>{let s=this._def.errorMap?.(a,t).message??t.defaultError;return a.code==="unrecognized_keys"?{message:me.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Pe.ZodObject})}setKey(e,a){return this.augment({[e]:a})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let a={};for(let t of Ze.objectKeys(e))e[t]&&this.shape[t]&&(a[t]=this.shape[t]);return new r({...this._def,shape:()=>a})}omit(e){let a={};for(let t of Ze.objectKeys(this.shape))e[t]||(a[t]=this.shape[t]);return new r({...this._def,shape:()=>a})}deepPartial(){return yn(this)}partial(e){let a={};for(let t of Ze.objectKeys(this.shape)){let s=this.shape[t];e&&!e[t]?a[t]=s:a[t]=s.optional()}return new r({...this._def,shape:()=>a})}required(e){let a={};for(let t of Ze.objectKeys(this.shape))if(e&&!e[t])a[t]=this.shape[t];else{let i=this.shape[t];for(;i instanceof pr;)i=i._def.innerType;a[t]=i}return new r({...this._def,shape:()=>a})}keyof(){return vE(Ze.objectKeys(this.shape))}};Lt.create=(r,e)=>new Lt({shape:()=>r,unknownKeys:"strip",catchall:Sr.create(),typeName:Pe.ZodObject,...$e(e)});Lt.strictCreate=(r,e)=>new Lt({shape:()=>r,unknownKeys:"strict",catchall:Sr.create(),typeName:Pe.ZodObject,...$e(e)});Lt.lazycreate=(r,e)=>new Lt({shape:r,unknownKeys:"strip",catchall:Sr.create(),typeName:Pe.ZodObject,...$e(e)});var _s=class extends je{_parse(e){let{ctx:a}=this._processInputParams(e),t=this._def.options;function s(i){for(let o of i)if(o.result.status==="valid")return o.result;for(let o of i)if(o.result.status==="dirty")return a.common.issues.push(...o.ctx.common.issues),o.result;let n=i.map(o=>new Wt(o.ctx.common.issues));return se(a,{code:J.invalid_union,unionErrors:n}),we}if(a.common.async)return Promise.all(t.map(async i=>{let n={...a,common:{...a.common,issues:[]},parent:null};return{result:await i._parseAsync({data:a.data,path:a.path,parent:n}),ctx:n}})).then(s);{let i,n=[];for(let l of t){let c={...a,common:{...a.common,issues:[]},parent:null},u=l._parseSync({data:a.data,path:a.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&n.push(c.common.issues)}if(i)return a.common.issues.push(...i.ctx.common.issues),i.result;let o=n.map(l=>new Wt(l));return se(a,{code:J.invalid_union,unionErrors:o}),we}}get options(){return this._def.options}};_s.create=(r,e)=>new _s({options:r,typeName:Pe.ZodUnion,...$e(e)});var Yr=r=>r instanceof ws?Yr(r.schema):r instanceof Qt?Yr(r.innerType()):r instanceof Ss?[r.value]:r instanceof Ps?r.options:r instanceof Rs?Ze.objectValues(r.enum):r instanceof Ts?Yr(r._def.innerType):r instanceof bs?[void 0]:r instanceof xs?[null]:r instanceof pr?[void 0,...Yr(r.unwrap())]:r instanceof Mr?[null,...Yr(r.unwrap())]:r instanceof ki||r instanceof Os?Yr(r.unwrap()):r instanceof ks?Yr(r._def.innerType):[],Bc=class r extends je{_parse(e){let{ctx:a}=this._processInputParams(e);if(a.parsedType!==le.object)return se(a,{code:J.invalid_type,expected:le.object,received:a.parsedType}),we;let t=this.discriminator,s=a.data[t],i=this.optionsMap.get(s);return i?a.common.async?i._parseAsync({data:a.data,path:a.path,parent:a}):i._parseSync({data:a.data,path:a.path,parent:a}):(se(a,{code:J.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[t]}),we)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,a,t){let s=new Map;for(let i of a){let n=Yr(i.shape[e]);if(!n.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of n){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,i)}}return new r({typeName:Pe.ZodDiscriminatedUnion,discriminator:e,options:a,optionsMap:s,...$e(t)})}};function kd(r,e){let a=ea(r),t=ea(e);if(r===e)return{valid:!0,data:r};if(a===le.object&&t===le.object){let s=Ze.objectKeys(e),i=Ze.objectKeys(r).filter(o=>s.indexOf(o)!==-1),n={...r,...e};for(let o of i){let l=kd(r[o],e[o]);if(!l.valid)return{valid:!1};n[o]=l.data}return{valid:!0,data:n}}else if(a===le.array&&t===le.array){if(r.length!==e.length)return{valid:!1};let s=[];for(let i=0;i{if(Rd(i)||Rd(n))return we;let o=kd(i.value,n.value);return o.valid?((Td(i)||Td(n))&&a.dirty(),{status:a.value,value:o.data}):(se(t,{code:J.invalid_intersection_types}),we)};return t.common.async?Promise.all([this._def.left._parseAsync({data:t.data,path:t.path,parent:t}),this._def.right._parseAsync({data:t.data,path:t.path,parent:t})]).then(([i,n])=>s(i,n)):s(this._def.left._parseSync({data:t.data,path:t.path,parent:t}),this._def.right._parseSync({data:t.data,path:t.path,parent:t}))}};Es.create=(r,e,a)=>new Es({left:r,right:e,typeName:Pe.ZodIntersection,...$e(a)});var Lr=class r extends je{_parse(e){let{status:a,ctx:t}=this._processInputParams(e);if(t.parsedType!==le.array)return se(t,{code:J.invalid_type,expected:le.array,received:t.parsedType}),we;if(t.data.lengththis._def.items.length&&(se(t,{code:J.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.dirty());let i=[...t.data].map((n,o)=>{let l=this._def.items[o]||this._def.rest;return l?l._parse(new dr(t,n,t.path,o)):null}).filter(n=>!!n);return t.common.async?Promise.all(i).then(n=>Pt.mergeArray(a,n)):Pt.mergeArray(a,i)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};Lr.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Lr({items:r,typeName:Pe.ZodTuple,rest:null,...$e(e)})};var Vc=class r extends je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:a,ctx:t}=this._processInputParams(e);if(t.parsedType!==le.object)return se(t,{code:J.invalid_type,expected:le.object,received:t.parsedType}),we;let s=[],i=this._def.keyType,n=this._def.valueType;for(let o in t.data)s.push({key:i._parse(new dr(t,o,t.path,o)),value:n._parse(new dr(t,t.data[o],t.path,o)),alwaysSet:o in t.data});return t.common.async?Pt.mergeObjectAsync(a,s):Pt.mergeObjectSync(a,s)}get element(){return this._def.valueType}static create(e,a,t){return a instanceof je?new r({keyType:e,valueType:a,typeName:Pe.ZodRecord,...$e(t)}):new r({keyType:Ra.create(),valueType:e,typeName:Pe.ZodRecord,...$e(a)})}},wn=class extends je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:a,ctx:t}=this._processInputParams(e);if(t.parsedType!==le.map)return se(t,{code:J.invalid_type,expected:le.map,received:t.parsedType}),we;let s=this._def.keyType,i=this._def.valueType,n=[...t.data.entries()].map(([o,l],c)=>({key:s._parse(new dr(t,o,t.path,[c,"key"])),value:i._parse(new dr(t,l,t.path,[c,"value"]))}));if(t.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let l of n){let c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return we;(c.status==="dirty"||u.status==="dirty")&&a.dirty(),o.set(c.value,u.value)}return{status:a.value,value:o}})}else{let o=new Map;for(let l of n){let c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return we;(c.status==="dirty"||u.status==="dirty")&&a.dirty(),o.set(c.value,u.value)}return{status:a.value,value:o}}}};wn.create=(r,e,a)=>new wn({valueType:e,keyType:r,typeName:Pe.ZodMap,...$e(a)});var Sn=class r extends je{_parse(e){let{status:a,ctx:t}=this._processInputParams(e);if(t.parsedType!==le.set)return se(t,{code:J.invalid_type,expected:le.set,received:t.parsedType}),we;let s=this._def;s.minSize!==null&&t.data.sizes.maxSize.value&&(se(t,{code:J.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),a.dirty());let i=this._def.valueType;function n(l){let c=new Set;for(let u of l){if(u.status==="aborted")return we;u.status==="dirty"&&a.dirty(),c.add(u.value)}return{status:a.value,value:c}}let o=[...t.data.values()].map((l,c)=>i._parse(new dr(t,l,t.path,c)));return t.common.async?Promise.all(o).then(l=>n(l)):n(o)}min(e,a){return new r({...this._def,minSize:{value:e,message:me.toString(a)}})}max(e,a){return new r({...this._def,maxSize:{value:e,message:me.toString(a)}})}size(e,a){return this.min(e,a).max(e,a)}nonempty(e){return this.min(1,e)}};Sn.create=(r,e)=>new Sn({valueType:r,minSize:null,maxSize:null,typeName:Pe.ZodSet,...$e(e)});var Zc=class r extends je{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:a}=this._processInputParams(e);if(a.parsedType!==le.function)return se(a,{code:J.invalid_type,expected:le.function,received:a.parsedType}),we;function t(o,l){return Hc({data:o,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,zc(),xn].filter(c=>!!c),issueData:{code:J.invalid_arguments,argumentsError:l}})}function s(o,l){return Hc({data:o,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,zc(),xn].filter(c=>!!c),issueData:{code:J.invalid_return_type,returnTypeError:l}})}let i={errorMap:a.common.contextualErrorMap},n=a.data;if(this._def.returns instanceof ka){let o=this;return kt(async function(...l){let c=new Wt([]),u=await o._def.args.parseAsync(l,i).catch(d=>{throw c.addIssue(t(l,d)),c}),f=await Reflect.apply(n,this,u);return await o._def.returns._def.type.parseAsync(f,i).catch(d=>{throw c.addIssue(s(f,d)),c})})}else{let o=this;return kt(function(...l){let c=o._def.args.safeParse(l,i);if(!c.success)throw new Wt([t(l,c.error)]);let u=Reflect.apply(n,this,c.data),f=o._def.returns.safeParse(u,i);if(!f.success)throw new Wt([s(u,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:Lr.create(e).rest(ra.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,a,t){return new r({args:e||Lr.create([]).rest(ra.create()),returns:a||ra.create(),typeName:Pe.ZodFunction,...$e(t)})}},ws=class extends je{get schema(){return this._def.getter()}_parse(e){let{ctx:a}=this._processInputParams(e);return this._def.getter()._parse({data:a.data,path:a.path,parent:a})}};ws.create=(r,e)=>new ws({getter:r,typeName:Pe.ZodLazy,...$e(e)});var Ss=class extends je{_parse(e){if(e.data!==this._def.value){let a=this._getOrReturnCtx(e);return se(a,{received:a.data,code:J.invalid_literal,expected:this._def.value}),we}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ss.create=(r,e)=>new Ss({value:r,typeName:Pe.ZodLiteral,...$e(e)});function vE(r,e){return new Ps({values:r,typeName:Pe.ZodEnum,...$e(e)})}var Ps=class r extends je{_parse(e){if(typeof e.data!="string"){let a=this._getOrReturnCtx(e),t=this._def.values;return se(a,{expected:Ze.joinValues(t),received:a.parsedType,code:J.invalid_type}),we}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let a=this._getOrReturnCtx(e),t=this._def.values;return se(a,{received:a.data,code:J.invalid_enum_value,options:t}),we}return kt(e.data)}get options(){return this._def.values}get enum(){let e={};for(let a of this._def.values)e[a]=a;return e}get Values(){let e={};for(let a of this._def.values)e[a]=a;return e}get Enum(){let e={};for(let a of this._def.values)e[a]=a;return e}extract(e,a=this._def){return r.create(e,{...this._def,...a})}exclude(e,a=this._def){return r.create(this.options.filter(t=>!e.includes(t)),{...this._def,...a})}};Ps.create=vE;var Rs=class extends je{_parse(e){let a=Ze.getValidEnumValues(this._def.values),t=this._getOrReturnCtx(e);if(t.parsedType!==le.string&&t.parsedType!==le.number){let s=Ze.objectValues(a);return se(t,{expected:Ze.joinValues(s),received:t.parsedType,code:J.invalid_type}),we}if(this._cache||(this._cache=new Set(Ze.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=Ze.objectValues(a);return se(t,{received:t.data,code:J.invalid_enum_value,options:s}),we}return kt(e.data)}get enum(){return this._def.values}};Rs.create=(r,e)=>new Rs({values:r,typeName:Pe.ZodNativeEnum,...$e(e)});var ka=class extends je{unwrap(){return this._def.type}_parse(e){let{ctx:a}=this._processInputParams(e);if(a.parsedType!==le.promise&&a.common.async===!1)return se(a,{code:J.invalid_type,expected:le.promise,received:a.parsedType}),we;let t=a.parsedType===le.promise?a.data:Promise.resolve(a.data);return kt(t.then(s=>this._def.type.parseAsync(s,{path:a.path,errorMap:a.common.contextualErrorMap})))}};ka.create=(r,e)=>new ka({type:r,typeName:Pe.ZodPromise,...$e(e)});var Qt=class extends je{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Pe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:a,ctx:t}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:n=>{se(t,n),n.fatal?a.abort():a.dirty()},get path(){return t.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){let n=s.transform(t.data,i);if(t.common.async)return Promise.resolve(n).then(async o=>{if(a.value==="aborted")return we;let l=await this._def.schema._parseAsync({data:o,path:t.path,parent:t});return l.status==="aborted"?we:l.status==="dirty"||a.value==="dirty"?bn(l.value):l});{if(a.value==="aborted")return we;let o=this._def.schema._parseSync({data:n,path:t.path,parent:t});return o.status==="aborted"?we:o.status==="dirty"||a.value==="dirty"?bn(o.value):o}}if(s.type==="refinement"){let n=o=>{let l=s.refinement(o,i);if(t.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(t.common.async===!1){let o=this._def.schema._parseSync({data:t.data,path:t.path,parent:t});return o.status==="aborted"?we:(o.status==="dirty"&&a.dirty(),n(o.value),{status:a.value,value:o.value})}else return this._def.schema._parseAsync({data:t.data,path:t.path,parent:t}).then(o=>o.status==="aborted"?we:(o.status==="dirty"&&a.dirty(),n(o.value).then(()=>({status:a.value,value:o.value}))))}if(s.type==="transform")if(t.common.async===!1){let n=this._def.schema._parseSync({data:t.data,path:t.path,parent:t});if(!ms(n))return we;let o=s.transform(n.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:o}}else return this._def.schema._parseAsync({data:t.data,path:t.path,parent:t}).then(n=>ms(n)?Promise.resolve(s.transform(n.value,i)).then(o=>({status:a.value,value:o})):we);Ze.assertNever(s)}};Qt.create=(r,e,a)=>new Qt({schema:r,typeName:Pe.ZodEffects,effect:e,...$e(a)});Qt.createWithPreprocess=(r,e,a)=>new Qt({schema:e,effect:{type:"preprocess",transform:r},typeName:Pe.ZodEffects,...$e(a)});var pr=class extends je{_parse(e){return this._getType(e)===le.undefined?kt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};pr.create=(r,e)=>new pr({innerType:r,typeName:Pe.ZodOptional,...$e(e)});var Mr=class extends je{_parse(e){return this._getType(e)===le.null?kt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Mr.create=(r,e)=>new Mr({innerType:r,typeName:Pe.ZodNullable,...$e(e)});var Ts=class extends je{_parse(e){let{ctx:a}=this._processInputParams(e),t=a.data;return a.parsedType===le.undefined&&(t=this._def.defaultValue()),this._def.innerType._parse({data:t,path:a.path,parent:a})}removeDefault(){return this._def.innerType}};Ts.create=(r,e)=>new Ts({innerType:r,typeName:Pe.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...$e(e)});var ks=class extends je{_parse(e){let{ctx:a}=this._processInputParams(e),t={...a,common:{...a.common,issues:[]}},s=this._def.innerType._parse({data:t.data,path:t.path,parent:{...t}});return Ti(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Wt(t.common.issues)},input:t.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Wt(t.common.issues)},input:t.data})}}removeCatch(){return this._def.innerType}};ks.create=(r,e)=>new ks({innerType:r,typeName:Pe.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...$e(e)});var Pn=class extends je{_parse(e){if(this._getType(e)!==le.nan){let t=this._getOrReturnCtx(e);return se(t,{code:J.invalid_type,expected:le.nan,received:t.parsedType}),we}return{status:"valid",value:e.data}}};Pn.create=r=>new Pn({typeName:Pe.ZodNaN,...$e(r)});var k6=Symbol("zod_brand"),ki=class extends je{_parse(e){let{ctx:a}=this._processInputParams(e),t=a.data;return this._def.type._parse({data:t,path:a.path,parent:a})}unwrap(){return this._def.type}},Oi=class r extends je{_parse(e){let{status:a,ctx:t}=this._processInputParams(e);if(t.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:t.data,path:t.path,parent:t});return i.status==="aborted"?we:i.status==="dirty"?(a.dirty(),bn(i.value)):this._def.out._parseAsync({data:i.value,path:t.path,parent:t})})();{let s=this._def.in._parseSync({data:t.data,path:t.path,parent:t});return s.status==="aborted"?we:s.status==="dirty"?(a.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:t.path,parent:t})}}static create(e,a){return new r({in:e,out:a,typeName:Pe.ZodPipeline})}},Os=class extends je{_parse(e){let a=this._def.innerType._parse(e),t=s=>(ms(s)&&(s.value=Object.freeze(s.value)),s);return Ti(a)?a.then(s=>t(s)):t(a)}unwrap(){return this._def.innerType}};Os.create=(r,e)=>new Os({innerType:r,typeName:Pe.ZodReadonly,...$e(e)});function B1(r,e){let a=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof a=="string"?{message:a}:a}function gE(r,e={},a){return r?Ta.create().superRefine((t,s)=>{let i=r(t);if(i instanceof Promise)return i.then(n=>{if(!n){let o=B1(e,t),l=o.fatal??a??!0;s.addIssue({code:"custom",...o,fatal:l})}});if(!i){let n=B1(e,t),o=n.fatal??a??!0;s.addIssue({code:"custom",...n,fatal:o})}}):Ta.create()}var O6={object:Lt.lazycreate},Pe;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(Pe||(Pe={}));var C6=(r,e={message:`Input not instance of ${r.name}`})=>gE(a=>a instanceof r,e),yE=Ra.create,bE=hs.create,I6=Pn.create,A6=vs.create,xE=gs.create,j6=ys.create,N6=_n.create,D6=bs.create,$6=xs.create,q6=Ta.create,F6=ra.create,L6=Sr.create,M6=En.create,U6=aa.create,z6=Lt.create,H6=Lt.strictCreate,B6=_s.create,V6=Bc.create,Z6=Es.create,G6=Lr.create,W6=Vc.create,Q6=wn.create,K6=Sn.create,X6=Zc.create,J6=ws.create,Y6=Ss.create,e5=Ps.create,t5=Rs.create,r5=ka.create,V1=Qt.create,a5=pr.create,s5=Mr.create,n5=Qt.createWithPreprocess,i5=Oi.create,o5=()=>yE().optional(),c5=()=>bE().optional(),l5=()=>xE().optional(),u5={string:r=>Ra.create({...r,coerce:!0}),number:r=>hs.create({...r,coerce:!0}),boolean:r=>gs.create({...r,coerce:!0}),bigint:r=>vs.create({...r,coerce:!0}),date:r=>ys.create({...r,coerce:!0})},p5=we;var Kc="2.0",_E=w.union([w.string(),w.number().int()]),EE=w.string(),d5=w.object({progressToken:w.optional(_E)}).passthrough(),fr=w.object({_meta:w.optional(d5)}).passthrough(),Mt=w.object({method:w.string(),params:w.optional(fr)}),Ii=w.object({_meta:w.optional(w.object({}).passthrough())}).passthrough(),Ur=w.object({method:w.string(),params:w.optional(Ii)}),mr=w.object({_meta:w.optional(w.object({}).passthrough())}).passthrough(),Xc=w.union([w.string(),w.number().int()]),f5=w.object({jsonrpc:w.literal(Kc),id:Xc}).merge(Mt).strict();var m5=w.object({jsonrpc:w.literal(Kc)}).merge(Ur).strict();var h5=w.object({jsonrpc:w.literal(Kc),id:Xc,result:mr}).strict();var Z1;(function(r){r[r.ConnectionClosed=-32e3]="ConnectionClosed",r[r.RequestTimeout=-32001]="RequestTimeout",r[r.ParseError=-32700]="ParseError",r[r.InvalidRequest=-32600]="InvalidRequest",r[r.MethodNotFound=-32601]="MethodNotFound",r[r.InvalidParams=-32602]="InvalidParams",r[r.InternalError=-32603]="InternalError"})(Z1||(Z1={}));var v5=w.object({jsonrpc:w.literal(Kc),id:Xc,error:w.object({code:w.number().int(),message:w.string(),data:w.optional(w.unknown())})}).strict();var AM=w.union([f5,m5,h5,v5]),wE=mr.strict(),SE=Ur.extend({method:w.literal("notifications/cancelled"),params:Ii.extend({requestId:Xc,reason:w.string().optional()})}),Ai=w.object({name:w.string(),title:w.optional(w.string())}).passthrough(),PE=Ai.extend({version:w.string()}),g5=w.object({experimental:w.optional(w.object({}).passthrough()),sampling:w.optional(w.object({}).passthrough()),elicitation:w.optional(w.object({}).passthrough()),roots:w.optional(w.object({listChanged:w.optional(w.boolean())}).passthrough())}).passthrough(),y5=Mt.extend({method:w.literal("initialize"),params:fr.extend({protocolVersion:w.string(),capabilities:g5,clientInfo:PE})}),b5=w.object({experimental:w.optional(w.object({}).passthrough()),logging:w.optional(w.object({}).passthrough()),completions:w.optional(w.object({}).passthrough()),prompts:w.optional(w.object({listChanged:w.optional(w.boolean())}).passthrough()),resources:w.optional(w.object({subscribe:w.optional(w.boolean()),listChanged:w.optional(w.boolean())}).passthrough()),tools:w.optional(w.object({listChanged:w.optional(w.boolean())}).passthrough())}).passthrough(),x5=mr.extend({protocolVersion:w.string(),capabilities:b5,serverInfo:PE,instructions:w.optional(w.string())}),_5=Ur.extend({method:w.literal("notifications/initialized")}),RE=Mt.extend({method:w.literal("ping")}),E5=w.object({progress:w.number(),total:w.optional(w.number()),message:w.optional(w.string())}).passthrough(),TE=Ur.extend({method:w.literal("notifications/progress"),params:Ii.merge(E5).extend({progressToken:_E})}),Jc=Mt.extend({params:fr.extend({cursor:w.optional(EE)}).optional()}),Yc=mr.extend({nextCursor:w.optional(EE)}),kE=w.object({uri:w.string(),mimeType:w.optional(w.string()),_meta:w.optional(w.object({}).passthrough())}).passthrough(),OE=kE.extend({text:w.string()}),Dd=w.string().refine(r=>{try{return atob(r),!0}catch{return!1}},{message:"Invalid Base64 string"}),CE=kE.extend({blob:Dd}),IE=Ai.extend({uri:w.string(),description:w.optional(w.string()),mimeType:w.optional(w.string()),_meta:w.optional(w.object({}).passthrough())}),w5=Ai.extend({uriTemplate:w.string(),description:w.optional(w.string()),mimeType:w.optional(w.string()),_meta:w.optional(w.object({}).passthrough())}),S5=Jc.extend({method:w.literal("resources/list")}),P5=Yc.extend({resources:w.array(IE)}),R5=Jc.extend({method:w.literal("resources/templates/list")}),T5=Yc.extend({resourceTemplates:w.array(w5)}),k5=Mt.extend({method:w.literal("resources/read"),params:fr.extend({uri:w.string()})}),O5=mr.extend({contents:w.array(w.union([OE,CE]))}),C5=Ur.extend({method:w.literal("notifications/resources/list_changed")}),I5=Mt.extend({method:w.literal("resources/subscribe"),params:fr.extend({uri:w.string()})}),A5=Mt.extend({method:w.literal("resources/unsubscribe"),params:fr.extend({uri:w.string()})}),j5=Ur.extend({method:w.literal("notifications/resources/updated"),params:Ii.extend({uri:w.string()})}),N5=w.object({name:w.string(),description:w.optional(w.string()),required:w.optional(w.boolean())}).passthrough(),D5=Ai.extend({description:w.optional(w.string()),arguments:w.optional(w.array(N5)),_meta:w.optional(w.object({}).passthrough())}),$5=Jc.extend({method:w.literal("prompts/list")}),q5=Yc.extend({prompts:w.array(D5)}),F5=Mt.extend({method:w.literal("prompts/get"),params:fr.extend({name:w.string(),arguments:w.optional(w.record(w.string()))})}),$d=w.object({type:w.literal("text"),text:w.string(),_meta:w.optional(w.object({}).passthrough())}).passthrough(),qd=w.object({type:w.literal("image"),data:Dd,mimeType:w.string(),_meta:w.optional(w.object({}).passthrough())}).passthrough(),Fd=w.object({type:w.literal("audio"),data:Dd,mimeType:w.string(),_meta:w.optional(w.object({}).passthrough())}).passthrough(),L5=w.object({type:w.literal("resource"),resource:w.union([OE,CE]),_meta:w.optional(w.object({}).passthrough())}).passthrough(),M5=IE.extend({type:w.literal("resource_link")}),AE=w.union([$d,qd,Fd,M5,L5]),U5=w.object({role:w.enum(["user","assistant"]),content:AE}).passthrough(),z5=mr.extend({description:w.optional(w.string()),messages:w.array(U5)}),H5=Ur.extend({method:w.literal("notifications/prompts/list_changed")}),B5=w.object({title:w.optional(w.string()),readOnlyHint:w.optional(w.boolean()),destructiveHint:w.optional(w.boolean()),idempotentHint:w.optional(w.boolean()),openWorldHint:w.optional(w.boolean())}).passthrough(),V5=Ai.extend({description:w.optional(w.string()),inputSchema:w.object({type:w.literal("object"),properties:w.optional(w.object({}).passthrough()),required:w.optional(w.array(w.string()))}).passthrough(),outputSchema:w.optional(w.object({type:w.literal("object"),properties:w.optional(w.object({}).passthrough()),required:w.optional(w.array(w.string()))}).passthrough()),annotations:w.optional(B5),_meta:w.optional(w.object({}).passthrough())}),Z5=Jc.extend({method:w.literal("tools/list")}),G5=Yc.extend({tools:w.array(V5)}),jE=mr.extend({content:w.array(AE).default([]),structuredContent:w.object({}).passthrough().optional(),isError:w.optional(w.boolean())}),jM=jE.or(mr.extend({toolResult:w.unknown()})),W5=Mt.extend({method:w.literal("tools/call"),params:fr.extend({name:w.string(),arguments:w.optional(w.record(w.unknown()))})}),Q5=Ur.extend({method:w.literal("notifications/tools/list_changed")}),NE=w.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),K5=Mt.extend({method:w.literal("logging/setLevel"),params:fr.extend({level:NE})}),X5=Ur.extend({method:w.literal("notifications/message"),params:Ii.extend({level:NE,logger:w.optional(w.string()),data:w.unknown()})}),J5=w.object({name:w.string().optional()}).passthrough(),Y5=w.object({hints:w.optional(w.array(J5)),costPriority:w.optional(w.number().min(0).max(1)),speedPriority:w.optional(w.number().min(0).max(1)),intelligencePriority:w.optional(w.number().min(0).max(1))}).passthrough(),e$=w.object({role:w.enum(["user","assistant"]),content:w.union([$d,qd,Fd])}).passthrough(),t$=Mt.extend({method:w.literal("sampling/createMessage"),params:fr.extend({messages:w.array(e$),systemPrompt:w.optional(w.string()),includeContext:w.optional(w.enum(["none","thisServer","allServers"])),temperature:w.optional(w.number()),maxTokens:w.number().int(),stopSequences:w.optional(w.array(w.string())),metadata:w.optional(w.object({}).passthrough()),modelPreferences:w.optional(Y5)})}),r$=mr.extend({model:w.string(),stopReason:w.optional(w.enum(["endTurn","stopSequence","maxTokens"]).or(w.string())),role:w.enum(["user","assistant"]),content:w.discriminatedUnion("type",[$d,qd,Fd])}),a$=w.object({type:w.literal("boolean"),title:w.optional(w.string()),description:w.optional(w.string()),default:w.optional(w.boolean())}).passthrough(),s$=w.object({type:w.literal("string"),title:w.optional(w.string()),description:w.optional(w.string()),minLength:w.optional(w.number()),maxLength:w.optional(w.number()),format:w.optional(w.enum(["email","uri","date","date-time"]))}).passthrough(),n$=w.object({type:w.enum(["number","integer"]),title:w.optional(w.string()),description:w.optional(w.string()),minimum:w.optional(w.number()),maximum:w.optional(w.number())}).passthrough(),i$=w.object({type:w.literal("string"),title:w.optional(w.string()),description:w.optional(w.string()),enum:w.array(w.string()),enumNames:w.optional(w.array(w.string()))}).passthrough(),o$=w.union([a$,s$,n$,i$]),c$=Mt.extend({method:w.literal("elicitation/create"),params:fr.extend({message:w.string(),requestedSchema:w.object({type:w.literal("object"),properties:w.record(w.string(),o$),required:w.optional(w.array(w.string()))}).passthrough()})}),l$=mr.extend({action:w.enum(["accept","decline","cancel"]),content:w.optional(w.record(w.string(),w.unknown()))}),u$=w.object({type:w.literal("ref/resource"),uri:w.string()}).passthrough(),p$=w.object({type:w.literal("ref/prompt"),name:w.string()}).passthrough(),d$=Mt.extend({method:w.literal("completion/complete"),params:fr.extend({ref:w.union([p$,u$]),argument:w.object({name:w.string(),value:w.string()}).passthrough(),context:w.optional(w.object({arguments:w.optional(w.record(w.string(),w.string()))}))})}),f$=mr.extend({completion:w.object({values:w.array(w.string()).max(100),total:w.optional(w.number().int()),hasMore:w.optional(w.boolean())}).passthrough()}),m$=w.object({uri:w.string().startsWith("file://"),name:w.optional(w.string()),_meta:w.optional(w.object({}).passthrough())}).passthrough(),h$=Mt.extend({method:w.literal("roots/list")}),v$=mr.extend({roots:w.array(m$)}),g$=Ur.extend({method:w.literal("notifications/roots/list_changed")}),NM=w.union([RE,y5,d$,K5,F5,$5,S5,R5,k5,I5,A5,W5,Z5]),DM=w.union([SE,TE,_5,g$]),$M=w.union([wE,r$,l$,v$]),qM=w.union([RE,t$,c$,h$]),FM=w.union([SE,TE,X5,j5,C5,Q5,H5]),LM=w.union([wE,x5,f$,z5,q5,P5,T5,O5,jE,G5]);var MM=bj(eN(),1);var UM=Symbol("Let zodToJsonSchema decide on which parser to use");var zM=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var Od;(function(r){r.Completable="McpCompletable"})(Od||(Od={}));var Gc=class extends je{_parse(e){let{ctx:a}=this._processInputParams(e),t=a.data;return this._def.type._parse({data:t,path:a.path,parent:a})}unwrap(){return this._def.type}};Gc.create=(r,e)=>new Gc({type:r,typeName:Od.Completable,complete:e.complete,...y$(e)});function y$(r){if(!r)return{};let{errorMap:e,invalid_type_error:a,required_error:t,description:s}=r;if(e&&(a||t))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(n,o)=>{var l,c;let{message:u}=r;return n.code==="invalid_enum_value"?{message:u??o.defaultError}:typeof o.data>"u"?{message:(l=u??t)!==null&&l!==void 0?l:o.defaultError}:n.code!=="invalid_type"?{message:o.defaultError}:{message:(c=u??a)!==null&&c!==void 0?c:o.defaultError}},description:s}}function DE({prompt:r,options:e}){let{systemPrompt:a,settingSources:t,...s}=e??{},i,n;a===void 0?i="":typeof a=="string"?i=a:a.type==="preset"&&(n=a.append);let o=s.pathToClaudeCodeExecutable;if(!o){let xe=(0,X1.fileURLToPath)(b$.url),Oe=(0,bd.join)(xe,"..");o=(0,bd.join)(Oe,"cli.js")}process.env.CLAUDE_AGENT_SDK_VERSION="0.1.27";let{abortController:l=Y1(),additionalDirectories:c=[],agents:u,allowedTools:f=[],canUseTool:m,continue:d,cwd:h,disallowedTools:p=[],env:v,executable:g=aE()?"bun":"node",executableArgs:b=[],extraArgs:E={},fallbackModel:k,forkSession:O,hooks:P,includePartialMessages:I,maxThinkingTokens:$,maxTurns:A,mcpServers:L,model:q,permissionMode:C="default",allowDangerouslySkipPermissions:R=!1,permissionPromptToolName:j,plugins:z,resume:H,resumeSessionAt:V,stderr:te,strictMcpConfig:K}=s,B=v;if(B||(B={...process.env}),B.CLAUDE_CODE_ENTRYPOINT||(B.CLAUDE_CODE_ENTRYPOINT="sdk-ts"),!o)throw new Error("pathToClaudeCodeExecutable is required");let re={},ce=new Map;if(L)for(let[xe,Oe]of Object.entries(L))Oe.type==="sdk"&&"instance"in Oe?(ce.set(xe,Oe.instance),re[xe]={type:"sdk",name:xe}):re[xe]=Oe;let Be=typeof r=="string",be=new xd({abortController:l,additionalDirectories:c,agents:u,cwd:h,executable:g,executableArgs:b,extraArgs:E,pathToClaudeCodeExecutable:o,env:B,forkSession:O,stderr:te,customSystemPrompt:i,appendSystemPrompt:n,maxThinkingTokens:$,maxTurns:A,model:q,fallbackModel:k,permissionMode:C,allowDangerouslySkipPermissions:R,permissionPromptToolName:j,continueConversation:d,resume:H,resumeSessionAt:V,settingSources:t??[],allowedTools:f,disallowedTools:p,mcpServers:re,strictMcpConfig:K,canUseTool:!!m,hooks:!!P,includePartialMessages:I,plugins:z}),qe=new Sd(be,Be,m,P,l,ce);return typeof r=="string"?be.write(JSON.stringify({type:"user",session_id:"",message:{role:"user",content:[{type:"text",text:r}]},parent_tool_use_id:null})+` `):qe.streamInput(r),qe}var el=class{dbManager;sessionManager;constructor(e,a){this.dbManager=e,this.sessionManager=a}async startSession(e,a){try{let t=this.findClaudeExecutable(),s=this.getModelId(),i=["Bash"],n=this.createMessageGenerator(e),o=DE({prompt:n,options:{model:s,disallowedTools:i,abortController:e.abortController,pathToClaudeCodeExecutable:t}});for await(let c of o){if(c.type==="assistant"){let u=c.message.content,f=Array.isArray(u)?u.filter(d=>d.type==="text").map(d=>d.text).join(` -`):typeof u=="string"?u:"",m=f.length;ee.dataOut("SDK",`Response received (${m} chars)`,{sessionId:e.sessionDbId,promptNumber:e.lastPromptNumber}),await this.processSDKResponse(e,f,a)}c.type==="result"&&c.subtype}let l=Date.now()-e.startTime;ee.success("SDK","Agent completed",{sessionId:e.sessionDbId,duration:`${(l/1e3).toFixed(1)}s`}),this.dbManager.getSessionStore().markSessionCompleted(e.sessionDbId)}catch(t){throw t.name==="AbortError"?ee.warn("SDK","Agent aborted",{sessionId:e.sessionDbId}):ee.failure("SDK","Agent error",{sessionDbId:e.sessionDbId},t),t}finally{this.sessionManager.deleteSession(e.sessionDbId).catch(()=>{})}}async*createMessageGenerator(e){yield{type:"user",message:{role:"user",content:C1(e.project,e.claudeSessionId,e.userPrompt)},session_id:e.claudeSessionId,parent_tool_use_id:null,isSynthetic:!0};for await(let a of this.sessionManager.getMessageIterator(e.sessionDbId))a.type==="observation"?(a.prompt_number!==void 0&&(e.lastPromptNumber=a.prompt_number),yield{type:"user",message:{role:"user",content:I1({id:0,tool_name:a.tool_name,tool_input:JSON.stringify(a.tool_input),tool_output:JSON.stringify(a.tool_response),created_at_epoch:Date.now()})},session_id:e.claudeSessionId,parent_tool_use_id:null,isSynthetic:!0}):a.type==="summarize"&&(yield{type:"user",message:{role:"user",content:A1({id:e.sessionDbId,sdk_session_id:e.sdkSessionId,project:e.project,user_prompt:e.userPrompt})},session_id:e.claudeSessionId,parent_tool_use_id:null,isSynthetic:!0})}async processSDKResponse(e,a,t){let s=k1(a,e.claudeSessionId);for(let n of s){let{id:o,createdAtEpoch:l}=this.dbManager.getSessionStore().storeObservation(e.claudeSessionId,e.project,n,e.lastPromptNumber);this.dbManager.getChromaSync().syncObservation(o,e.claudeSessionId,e.project,n,e.lastPromptNumber,l).catch(()=>{}),t&&t.sseBroadcaster&&t.sseBroadcaster.broadcast({type:"new_observation",observation:{id:o,session_id:e.claudeSessionId,type:n.type,title:n.title,subtitle:n.subtitle,project:e.project,prompt_number:e.lastPromptNumber,created_at_epoch:l}}),ee.info("SDK","Observation saved",{obsId:o,type:n.type})}let i=O1(a,e.sessionDbId);if(i){let{id:n,createdAtEpoch:o}=this.dbManager.getSessionStore().storeSummary(e.claudeSessionId,e.project,i,e.lastPromptNumber);this.dbManager.getChromaSync().syncSummary(n,e.claudeSessionId,e.project,i,e.lastPromptNumber,o).catch(()=>{}),t&&t.sseBroadcaster&&t.sseBroadcaster.broadcast({type:"new_summary",summary:{id:n,session_id:e.claudeSessionId,request:i.request,investigated:i.investigated,learned:i.learned,completed:i.completed,next_steps:i.next_steps,notes:i.notes,project:e.project,prompt_number:e.lastPromptNumber,created_at_epoch:o}}),ee.info("SDK","Summary saved",{summaryId:n})}t&&typeof t.checkAndStopSpinner=="function"&&t.checkAndStopSpinner()}findClaudeExecutable(){let e=process.env.CLAUDE_CODE_PATH||(0,$E.execSync)(process.platform==="win32"?"where claude":"which claude",{encoding:"utf8"}).trim().split(` +`):typeof u=="string"?u:"",m=f.length;ee.dataOut("SDK",`Response received (${m} chars)`,{sessionId:e.sessionDbId,promptNumber:e.lastPromptNumber}),await this.processSDKResponse(e,f,a)}c.type==="result"&&c.subtype}let l=Date.now()-e.startTime;ee.success("SDK","Agent completed",{sessionId:e.sessionDbId,duration:`${(l/1e3).toFixed(1)}s`}),this.dbManager.getSessionStore().markSessionCompleted(e.sessionDbId)}catch(t){throw t.name==="AbortError"?ee.warn("SDK","Agent aborted",{sessionId:e.sessionDbId}):ee.failure("SDK","Agent error",{sessionDbId:e.sessionDbId},t),t}finally{this.sessionManager.deleteSession(e.sessionDbId).catch(()=>{})}}async*createMessageGenerator(e){yield{type:"user",message:{role:"user",content:C1(e.project,e.claudeSessionId,e.userPrompt)},session_id:e.claudeSessionId,parent_tool_use_id:null,isSynthetic:!0};for await(let a of this.sessionManager.getMessageIterator(e.sessionDbId))a.type==="observation"?(a.prompt_number!==void 0&&(e.lastPromptNumber=a.prompt_number),yield{type:"user",message:{role:"user",content:I1({id:0,tool_name:a.tool_name,tool_input:JSON.stringify(a.tool_input),tool_output:JSON.stringify(a.tool_response),created_at_epoch:Date.now()})},session_id:e.claudeSessionId,parent_tool_use_id:null,isSynthetic:!0}):a.type==="summarize"&&(yield{type:"user",message:{role:"user",content:A1({id:e.sessionDbId,sdk_session_id:e.sdkSessionId,project:e.project,user_prompt:e.userPrompt})},session_id:e.claudeSessionId,parent_tool_use_id:null,isSynthetic:!0})}async processSDKResponse(e,a,t){let s=k1(a,e.claudeSessionId);for(let n of s){let{id:o,createdAtEpoch:l}=this.dbManager.getSessionStore().storeObservation(e.claudeSessionId,e.project,n,e.lastPromptNumber);this.dbManager.getChromaSync().syncObservation(o,e.claudeSessionId,e.project,n,e.lastPromptNumber,l).catch(()=>{}),t&&t.sseBroadcaster&&t.sseBroadcaster.broadcast({type:"new_observation",observation:{id:o,sdk_session_id:e.sdkSessionId,session_id:e.claudeSessionId,type:n.type,title:n.title,subtitle:n.subtitle,text:n.text||null,narrative:null,facts:JSON.stringify(n.facts||[]),concepts:JSON.stringify(n.concepts||[]),files_read:JSON.stringify(n.files||[]),files_modified:JSON.stringify([]),project:e.project,prompt_number:e.lastPromptNumber,created_at_epoch:l}}),ee.info("SDK","Observation saved",{obsId:o,type:n.type})}let i=O1(a,e.sessionDbId);if(i){let{id:n,createdAtEpoch:o}=this.dbManager.getSessionStore().storeSummary(e.claudeSessionId,e.project,i,e.lastPromptNumber);this.dbManager.getChromaSync().syncSummary(n,e.claudeSessionId,e.project,i,e.lastPromptNumber,o).catch(()=>{}),t&&t.sseBroadcaster&&t.sseBroadcaster.broadcast({type:"new_summary",summary:{id:n,session_id:e.claudeSessionId,request:i.request,investigated:i.investigated,learned:i.learned,completed:i.completed,next_steps:i.next_steps,notes:i.notes,project:e.project,prompt_number:e.lastPromptNumber,created_at_epoch:o}}),ee.info("SDK","Summary saved",{summaryId:n})}t&&typeof t.checkAndStopSpinner=="function"&&t.checkAndStopSpinner()}findClaudeExecutable(){let e=process.env.CLAUDE_CODE_PATH||(0,$E.execSync)(process.platform==="win32"?"where claude":"which claude",{encoding:"utf8"}).trim().split(` `)[0].trim();if(!e)throw new Error("Claude executable not found in PATH");return e}getModelId(){try{let e=FE.default.join((0,qE.homedir)(),".claude-mem","settings.json");if((0,tl.existsSync)(e)){let t=JSON.parse((0,tl.readFileSync)(e,"utf-8")).env?.CLAUDE_MEM_MODEL;if(t)return t}}catch{}return process.env.CLAUDE_MEM_MODEL||"claude-haiku-4-5"}};var rl=class{dbManager;constructor(e){this.dbManager=e}stripProjectPath(e,a){let t=`/${a}/`,s=e.indexOf(t);return s!==-1?e.substring(s+t.length):e}stripProjectPaths(e,a){if(!e)return e;try{let s=JSON.parse(e).map(i=>this.stripProjectPath(i,a));return JSON.stringify(s)}catch{return e}}sanitizeObservation(e){return{...e,files_read:this.stripProjectPaths(e.files_read,e.project),files_modified:this.stripProjectPaths(e.files_modified,e.project)}}getObservations(e,a,t){let s=this.paginate("observations","id, sdk_session_id, project, type, title, subtitle, narrative, text, facts, concepts, files_read, files_modified, prompt_number, created_at, created_at_epoch",e,a,t);return{...s,items:s.items.map(i=>this.sanitizeObservation(i))}}getSummaries(e,a,t){let s=this.dbManager.getSessionStore().db,i=` SELECT ss.id, diff --git a/plugin/ui/viewer-bundle.js b/plugin/ui/viewer-bundle.js index e27fa09f..17f4870d 100644 --- a/plugin/ui/viewer-bundle.js +++ b/plugin/ui/viewer-bundle.js @@ -1,13 +1,13 @@ -"use strict";(()=>{var Rf=Object.create;var Cu=Object.defineProperty;var zf=Object.getOwnPropertyDescriptor;var Df=Object.getOwnPropertyNames;var If=Object.getPrototypeOf,Af=Object.prototype.hasOwnProperty;var qe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Uf=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of Df(t))!Af.call(e,l)&&l!==n&&Cu(e,l,{get:()=>t[l],enumerable:!(r=zf(t,l))||r.enumerable});return e};var M=(e,t,n)=>(n=e!=null?Rf(If(e)):{},Uf(t||!e||!e.__esModule?Cu(n,"default",{value:e,enumerable:!0}):n,e));var Uu=qe(T=>{"use strict";var zn=Symbol.for("react.element"),Ff=Symbol.for("react.portal"),jf=Symbol.for("react.fragment"),Bf=Symbol.for("react.strict_mode"),Vf=Symbol.for("react.profiler"),Hf=Symbol.for("react.provider"),Wf=Symbol.for("react.context"),$f=Symbol.for("react.forward_ref"),Qf=Symbol.for("react.suspense"),Kf=Symbol.for("react.memo"),Gf=Symbol.for("react.lazy"),Nu=Symbol.iterator;function Xf(e){return e===null||typeof e!="object"?null:(e=Nu&&e[Nu]||e["@@iterator"],typeof e=="function"?e:null)}var Lu={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ou=Object.assign,Mu={};function Zt(e,t,n){this.props=e,this.context=t,this.refs=Mu,this.updater=n||Lu}Zt.prototype.isReactComponent={};Zt.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Zt.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Ru(){}Ru.prototype=Zt.prototype;function to(e,t,n){this.props=e,this.context=t,this.refs=Mu,this.updater=n||Lu}var no=to.prototype=new Ru;no.constructor=to;Ou(no,Zt.prototype);no.isPureReactComponent=!0;var Tu=Array.isArray,zu=Object.prototype.hasOwnProperty,ro={current:null},Du={key:!0,ref:!0,__self:!0,__source:!0};function Iu(e,t,n){var r,l={},o=null,i=null;if(t!=null)for(r in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(o=""+t.key),t)zu.call(t,r)&&!Du.hasOwnProperty(r)&&(l[r]=t[r]);var u=arguments.length-2;if(u===1)l.children=n;else if(1{"use strict";Fu.exports=Uu()});var Xu=qe(D=>{"use strict";function so(e,t){var n=e.length;e.push(t);e:for(;0>>1,l=e[r];if(0>>1;rOr(u,n))sOr(a,u)?(e[r]=a,e[s]=n,r=s):(e[r]=u,e[i]=n,r=i);else if(sOr(a,n))e[r]=a,e[s]=n,r=s;else break e}}return t}function Or(e,t){var n=e.sortIndex-t.sortIndex;return n!==0?n:e.id-t.id}typeof performance=="object"&&typeof performance.now=="function"?(ju=performance,D.unstable_now=function(){return ju.now()}):(oo=Date,Bu=oo.now(),D.unstable_now=function(){return oo.now()-Bu});var ju,oo,Bu,Qe=[],at=[],bf=1,Ce=null,ne=3,zr=!1,Rt=!1,In=!1,Wu=typeof setTimeout=="function"?setTimeout:null,$u=typeof clearTimeout=="function"?clearTimeout:null,Vu=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function ao(e){for(var t=Ie(at);t!==null;){if(t.callback===null)Rr(at);else if(t.startTime<=e)Rr(at),t.sortIndex=t.expirationTime,so(Qe,t);else break;t=Ie(at)}}function co(e){if(In=!1,ao(e),!Rt)if(Ie(Qe)!==null)Rt=!0,po(fo);else{var t=Ie(at);t!==null&&mo(co,t.startTime-e)}}function fo(e,t){Rt=!1,In&&(In=!1,$u(An),An=-1),zr=!0;var n=ne;try{for(ao(t),Ce=Ie(Qe);Ce!==null&&(!(Ce.expirationTime>t)||e&&!Gu());){var r=Ce.callback;if(typeof r=="function"){Ce.callback=null,ne=Ce.priorityLevel;var l=r(Ce.expirationTime<=t);t=D.unstable_now(),typeof l=="function"?Ce.callback=l:Ce===Ie(Qe)&&Rr(Qe),ao(t)}else Rr(Qe);Ce=Ie(Qe)}if(Ce!==null)var o=!0;else{var i=Ie(at);i!==null&&mo(co,i.startTime-t),o=!1}return o}finally{Ce=null,ne=n,zr=!1}}var Dr=!1,Mr=null,An=-1,Qu=5,Ku=-1;function Gu(){return!(D.unstable_now()-Kue||125r?(e.sortIndex=n,so(at,e),Ie(Qe)===null&&e===Ie(at)&&(In?($u(An),An=-1):In=!0,mo(co,n-r))):(e.sortIndex=l,so(Qe,e),Rt||zr||(Rt=!0,po(fo))),e};D.unstable_shouldYield=Gu;D.unstable_wrapCallback=function(e){var t=ne;return function(){var n=ne;ne=t;try{return e.apply(this,arguments)}finally{ne=n}}}});var Zu=qe((pm,Yu)=>{"use strict";Yu.exports=Xu()});var ef=qe(_e=>{"use strict";var ed=ge(),ke=Zu();function h(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Uo=Object.prototype.hasOwnProperty,td=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Ju={},qu={};function nd(e){return Uo.call(qu,e)?!0:Uo.call(Ju,e)?!1:td.test(e)?qu[e]=!0:(Ju[e]=!0,!1)}function rd(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function ld(e,t,n,r){if(t===null||typeof t>"u"||rd(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function fe(e,t,n,r,l,o,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var te={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){te[e]=new fe(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];te[t]=new fe(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){te[e]=new fe(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){te[e]=new fe(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){te[e]=new fe(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){te[e]=new fe(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){te[e]=new fe(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){te[e]=new fe(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){te[e]=new fe(e,5,!1,e.toLowerCase(),null,!1,!1)});var Li=/[\-:]([a-z])/g;function Oi(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Li,Oi);te[t]=new fe(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Li,Oi);te[t]=new fe(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Li,Oi);te[t]=new fe(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){te[e]=new fe(e,1,!1,e.toLowerCase(),null,!1,!1)});te.xlinkHref=new fe("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){te[e]=new fe(e,1,!1,e.toLowerCase(),null,!0,!0)});function Mi(e,t,n,r){var l=te.hasOwnProperty(t)?te[t]:null;(l!==null?l.type!==0:r||!(2{var If=Object.create;var Tu=Object.defineProperty;var Af=Object.getOwnPropertyDescriptor;var Uf=Object.getOwnPropertyNames;var Ff=Object.getPrototypeOf,jf=Object.prototype.hasOwnProperty;var be=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Vf=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of Uf(t))!jf.call(e,l)&&l!==n&&Tu(e,l,{get:()=>t[l],enumerable:!(r=Af(t,l))||r.enumerable});return e};var L=(e,t,n)=>(n=e!=null?If(Ff(e)):{},Vf(t||!e||!e.__esModule?Tu(n,"default",{value:e,enumerable:!0}):n,e));var ju=be(T=>{"use strict";var zn=Symbol.for("react.element"),Bf=Symbol.for("react.portal"),Hf=Symbol.for("react.fragment"),Wf=Symbol.for("react.strict_mode"),$f=Symbol.for("react.profiler"),Qf=Symbol.for("react.provider"),Kf=Symbol.for("react.context"),Gf=Symbol.for("react.forward_ref"),Xf=Symbol.for("react.suspense"),Yf=Symbol.for("react.memo"),Zf=Symbol.for("react.lazy"),Pu=Symbol.iterator;function Jf(e){return e===null||typeof e!="object"?null:(e=Pu&&e[Pu]||e["@@iterator"],typeof e=="function"?e:null)}var Mu={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ru=Object.assign,zu={};function Zt(e,t,n){this.props=e,this.context=t,this.refs=zu,this.updater=n||Mu}Zt.prototype.isReactComponent={};Zt.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Zt.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Du(){}Du.prototype=Zt.prototype;function no(e,t,n){this.props=e,this.context=t,this.refs=zu,this.updater=n||Mu}var ro=no.prototype=new Du;ro.constructor=no;Ru(ro,Zt.prototype);ro.isPureReactComponent=!0;var Lu=Array.isArray,Iu=Object.prototype.hasOwnProperty,lo={current:null},Au={key:!0,ref:!0,__self:!0,__source:!0};function Uu(e,t,n){var r,l={},o=null,i=null;if(t!=null)for(r in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(o=""+t.key),t)Iu.call(t,r)&&!Au.hasOwnProperty(r)&&(l[r]=t[r]);var u=arguments.length-2;if(u===1)l.children=n;else if(1{"use strict";Vu.exports=ju()});var Zu=be(D=>{"use strict";function ao(e,t){var n=e.length;e.push(t);e:for(;0>>1,l=e[r];if(0>>1;rOr(u,n))sOr(a,u)?(e[r]=a,e[s]=n,r=s):(e[r]=u,e[i]=n,r=i);else if(sOr(a,n))e[r]=a,e[s]=n,r=s;else break e}}return t}function Or(e,t){var n=e.sortIndex-t.sortIndex;return n!==0?n:e.id-t.id}typeof performance=="object"&&typeof performance.now=="function"?(Bu=performance,D.unstable_now=function(){return Bu.now()}):(io=Date,Hu=io.now(),D.unstable_now=function(){return io.now()-Hu});var Bu,io,Hu,Ke=[],ft=[],nd=1,Ne=null,ne=3,zr=!1,zt=!1,In=!1,Qu=typeof setTimeout=="function"?setTimeout:null,Ku=typeof clearTimeout=="function"?clearTimeout:null,Wu=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function co(e){for(var t=Ae(ft);t!==null;){if(t.callback===null)Rr(ft);else if(t.startTime<=e)Rr(ft),t.sortIndex=t.expirationTime,ao(Ke,t);else break;t=Ae(ft)}}function fo(e){if(In=!1,co(e),!zt)if(Ae(Ke)!==null)zt=!0,mo(po);else{var t=Ae(ft);t!==null&&vo(fo,t.startTime-e)}}function po(e,t){zt=!1,In&&(In=!1,Ku(An),An=-1),zr=!0;var n=ne;try{for(co(t),Ne=Ae(Ke);Ne!==null&&(!(Ne.expirationTime>t)||e&&!Yu());){var r=Ne.callback;if(typeof r=="function"){Ne.callback=null,ne=Ne.priorityLevel;var l=r(Ne.expirationTime<=t);t=D.unstable_now(),typeof l=="function"?Ne.callback=l:Ne===Ae(Ke)&&Rr(Ke),co(t)}else Rr(Ke);Ne=Ae(Ke)}if(Ne!==null)var o=!0;else{var i=Ae(ft);i!==null&&vo(fo,i.startTime-t),o=!1}return o}finally{Ne=null,ne=n,zr=!1}}var Dr=!1,Mr=null,An=-1,Gu=5,Xu=-1;function Yu(){return!(D.unstable_now()-Xue||125r?(e.sortIndex=n,ao(ft,e),Ae(Ke)===null&&e===Ae(ft)&&(In?(Ku(An),An=-1):In=!0,vo(fo,n-r))):(e.sortIndex=l,ao(Ke,e),zt||zr||(zt=!0,mo(po))),e};D.unstable_shouldYield=Yu;D.unstable_wrapCallback=function(e){var t=ne;return function(){var n=ne;ne=t;try{return e.apply(this,arguments)}finally{ne=n}}}});var qu=be((hm,Ju)=>{"use strict";Ju.exports=Zu()});var nf=be(_e=>{"use strict";var rd=de(),ke=qu();function h(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Fo=Object.prototype.hasOwnProperty,ld=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,bu={},es={};function od(e){return Fo.call(es,e)?!0:Fo.call(bu,e)?!1:ld.test(e)?es[e]=!0:(bu[e]=!0,!1)}function id(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function ud(e,t,n,r){if(t===null||typeof t>"u"||id(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function fe(e,t,n,r,l,o,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var te={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){te[e]=new fe(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];te[t]=new fe(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){te[e]=new fe(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){te[e]=new fe(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){te[e]=new fe(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){te[e]=new fe(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){te[e]=new fe(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){te[e]=new fe(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){te[e]=new fe(e,5,!1,e.toLowerCase(),null,!1,!1)});var Oi=/[\-:]([a-z])/g;function Mi(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Oi,Mi);te[t]=new fe(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Oi,Mi);te[t]=new fe(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Oi,Mi);te[t]=new fe(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){te[e]=new fe(e,1,!1,e.toLowerCase(),null,!1,!1)});te.xlinkHref=new fe("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){te[e]=new fe(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ri(e,t,n,r){var l=te.hasOwnProperty(t)?te[t]:null;(l!==null?l.type!==0:r||!(2u||l[i]!==o[u]){var s=` -`+l[i].replace(" at new "," at ");return e.displayName&&s.includes("")&&(s=s.replace("",e.displayName)),s}while(1<=i&&0<=u);break}}}finally{ho=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Qn(e):""}function od(e){switch(e.tag){case 5:return Qn(e.type);case 16:return Qn("Lazy");case 13:return Qn("Suspense");case 19:return Qn("SuspenseList");case 0:case 2:case 15:return e=go(e.type,!1),e;case 11:return e=go(e.type.render,!1),e;case 1:return e=go(e.type,!0),e;default:return""}}function Vo(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case en:return"Fragment";case bt:return"Portal";case Fo:return"Profiler";case Ri:return"StrictMode";case jo:return"Suspense";case Bo:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case oa:return(e.displayName||"Context")+".Consumer";case la:return(e._context.displayName||"Context")+".Provider";case zi:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Di:return t=e.displayName||null,t!==null?t:Vo(e.type)||"Memo";case ft:t=e._payload,e=e._init;try{return Vo(e(t))}catch{}}return null}function id(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Vo(t);case 8:return t===Ri?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Ct(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ua(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ud(e){var t=ua(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(i){r=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ar(e){e._valueTracker||(e._valueTracker=ud(e))}function sa(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=ua(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function cl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Ho(e,t){var n=t.checked;return H({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function es(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Ct(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function aa(e,t){t=t.checked,t!=null&&Mi(e,"checked",t,!1)}function Wo(e,t){aa(e,t);var n=Ct(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?$o(e,t.type,n):t.hasOwnProperty("defaultValue")&&$o(e,t.type,Ct(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ts(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function $o(e,t,n){(t!=="number"||cl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Kn=Array.isArray;function dn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=Ur.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function or(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Yn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},sd=["Webkit","ms","Moz","O"];Object.keys(Yn).forEach(function(e){sd.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Yn[t]=Yn[e]})});function pa(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Yn.hasOwnProperty(e)&&Yn[e]?(""+t).trim():t+"px"}function ma(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=pa(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var ad=H({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Go(e,t){if(t){if(ad[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(h(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(h(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(h(61))}if(t.style!=null&&typeof t.style!="object")throw Error(h(62))}}function Xo(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Yo=null;function Ii(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Zo=null,pn=null,mn=null;function ls(e){if(e=_r(e)){if(typeof Zo!="function")throw Error(h(280));var t=e.stateNode;t&&(t=Fl(t),Zo(e.stateNode,e.type,t))}}function va(e){pn?mn?mn.push(e):mn=[e]:pn=e}function ha(){if(pn){var e=pn,t=mn;if(mn=pn=null,ls(e),t)for(e=0;e>>=0,e===0?32:31-(wd(e)/kd|0)|0}var Fr=64,jr=4194304;function Gn(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ml(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,o=e.pingedLanes,i=n&268435455;if(i!==0){var u=i&~l;u!==0?r=Gn(u):(o&=i,o!==0&&(r=Gn(o)))}else i=n&~l,i!==0?r=Gn(i):o!==0&&(r=Gn(o));if(r===0)return 0;if(t!==0&&t!==r&&(t&l)===0&&(l=r&-r,o=t&-t,l>=o||l===16&&(o&4194240)!==0))return t;if((r&4)!==0&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function kr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Be(t),e[t]=n}function Cd(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Jn),ps=" ",ms=!1;function Aa(e,t){switch(e){case"keyup":return bd.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ua(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var tn=!1;function tp(e,t){switch(e){case"compositionend":return Ua(t);case"keypress":return t.which!==32?null:(ms=!0,ps);case"textInput":return e=t.data,e===ps&&ms?null:e;default:return null}}function np(e,t){if(tn)return e==="compositionend"||!Wi&&Aa(e,t)?(e=Da(),tl=Bi=vt=null,tn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=gs(n)}}function Va(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Va(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ha(){for(var e=window,t=cl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=cl(e.document)}return t}function $i(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function fp(e){var t=Ha(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Va(n.ownerDocument.documentElement,n)){if(r!==null&&$i(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,o=Math.min(r.start,l);r=r.end===void 0?o:Math.min(r.end,l),!e.extend&&o>r&&(l=r,r=o,o=l),l=ys(n,o);var i=ys(n,r);l&&i&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,nn=null,ni=null,bn=null,ri=!1;function Ss(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ri||nn==null||nn!==cl(r)||(r=nn,"selectionStart"in r&&$i(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),bn&&fr(bn,r)||(bn=r,r=gl(ni,"onSelect"),0on||(e.current=ai[on],ai[on]=null,on--)}function I(e,t){on++,ai[on]=e.current,e.current=t}var Nt={},ie=Pt(Nt),me=Pt(!1),Bt=Nt;function Sn(e,t){var n=e.type.contextTypes;if(!n)return Nt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},o;for(o in n)l[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function ve(e){return e=e.childContextTypes,e!=null}function Sl(){U(me),U(ie)}function Ps(e,t,n){if(ie.current!==Nt)throw Error(h(168));I(ie,t),I(me,n)}function Ja(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(h(108,id(e)||"Unknown",l));return H({},n,r)}function wl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Nt,Bt=ie.current,I(ie,e),I(me,me.current),!0}function Ls(e,t,n){var r=e.stateNode;if(!r)throw Error(h(169));n?(e=Ja(e,t,Bt),r.__reactInternalMemoizedMergedChildContext=e,U(me),U(ie),I(ie,e)):U(me),I(me,n)}var et=null,jl=!1,Po=!1;function qa(e){et===null?et=[e]:et.push(e)}function kp(e){jl=!0,qa(e)}function Lt(){if(!Po&&et!==null){Po=!0;var e=0,t=R;try{var n=et;for(R=1;e>=i,l-=i,tt=1<<32-Be(t)+l|n<x?(K=C,C=null):K=C.sibling;var P=m(f,C,d[x],g);if(P===null){C===null&&(C=K);break}e&&C&&P.alternate===null&&t(f,C),c=o(P,c,x),N===null?_=P:N.sibling=P,N=P,C=K}if(x===d.length)return n(f,C),j&&zt(f,x),_;if(C===null){for(;xx?(K=C,C=null):K=C.sibling;var $e=m(f,C,P.value,g);if($e===null){C===null&&(C=K);break}e&&C&&$e.alternate===null&&t(f,C),c=o($e,c,x),N===null?_=$e:N.sibling=$e,N=$e,C=K}if(P.done)return n(f,C),j&&zt(f,x),_;if(C===null){for(;!P.done;x++,P=d.next())P=v(f,P.value,g),P!==null&&(c=o(P,c,x),N===null?_=P:N.sibling=P,N=P);return j&&zt(f,x),_}for(C=r(f,C);!P.done;x++,P=d.next())P=y(C,f,x,P.value,g),P!==null&&(e&&P.alternate!==null&&C.delete(P.key===null?x:P.key),c=o(P,c,x),N===null?_=P:N.sibling=P,N=P);return e&&C.forEach(function(Nr){return t(f,Nr)}),j&&zt(f,x),_}function z(f,c,d,g){if(typeof d=="object"&&d!==null&&d.type===en&&d.key===null&&(d=d.props.children),typeof d=="object"&&d!==null){switch(d.$$typeof){case Ir:e:{for(var _=d.key,N=c;N!==null;){if(N.key===_){if(_=d.type,_===en){if(N.tag===7){n(f,N.sibling),c=l(N,d.props.children),c.return=f,f=c;break e}}else if(N.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===ft&&Rs(_)===N.type){n(f,N.sibling),c=l(N,d.props),c.ref=Vn(f,N,d),c.return=f,f=c;break e}n(f,N);break}else t(f,N);N=N.sibling}d.type===en?(c=jt(d.props.children,f.mode,g,d.key),c.return=f,f=c):(g=al(d.type,d.key,d.props,null,f.mode,g),g.ref=Vn(f,c,d),g.return=f,f=g)}return i(f);case bt:e:{for(N=d.key;c!==null;){if(c.key===N)if(c.tag===4&&c.stateNode.containerInfo===d.containerInfo&&c.stateNode.implementation===d.implementation){n(f,c.sibling),c=l(c,d.children||[]),c.return=f,f=c;break e}else{n(f,c);break}else t(f,c);c=c.sibling}c=Ao(d,f.mode,g),c.return=f,f=c}return i(f);case ft:return N=d._init,z(f,c,N(d._payload),g)}if(Kn(d))return w(f,c,d,g);if(Un(d))return S(f,c,d,g);Zr(f,d)}return typeof d=="string"&&d!==""||typeof d=="number"?(d=""+d,c!==null&&c.tag===6?(n(f,c.sibling),c=l(c,d),c.return=f,f=c):(n(f,c),c=Io(d,f.mode,g),c.return=f,f=c),i(f)):n(f,c)}return z}var kn=nc(!0),rc=nc(!1),_l=Pt(null),xl=null,an=null,Xi=null;function Yi(){Xi=an=xl=null}function Zi(e){var t=_l.current;U(_l),e._currentValue=t}function di(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function hn(e,t){xl=e,Xi=an=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(pe=!0),e.firstContext=null)}function Oe(e){var t=e._currentValue;if(Xi!==e)if(e={context:e,memoizedValue:t,next:null},an===null){if(xl===null)throw Error(h(308));an=e,xl.dependencies={lanes:0,firstContext:e}}else an=an.next=e;return t}var At=null;function Ji(e){At===null?At=[e]:At.push(e)}function lc(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Ji(t)):(n.next=l.next,l.next=n),t.interleaved=n,it(e,r)}function it(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var dt=!1;function qi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function oc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function rt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function kt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(O&2)!==0){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,it(e,n)}return l=r.interleaved,l===null?(t.next=t,Ji(r)):(t.next=l.next,l.next=t),r.interleaved=t,it(e,n)}function rl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ui(e,n)}}function zs(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?l=o=i:o=o.next=i,n=n.next}while(n!==null);o===null?l=o=t:o=o.next=t}else l=o=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Cl(e,t,n,r){var l=e.updateQueue;dt=!1;var o=l.firstBaseUpdate,i=l.lastBaseUpdate,u=l.shared.pending;if(u!==null){l.shared.pending=null;var s=u,a=s.next;s.next=null,i===null?o=a:i.next=a,i=s;var p=e.alternate;p!==null&&(p=p.updateQueue,u=p.lastBaseUpdate,u!==i&&(u===null?p.firstBaseUpdate=a:u.next=a,p.lastBaseUpdate=s))}if(o!==null){var v=l.baseState;i=0,p=a=s=null,u=o;do{var m=u.lane,y=u.eventTime;if((r&m)===m){p!==null&&(p=p.next={eventTime:y,lane:0,tag:u.tag,payload:u.payload,callback:u.callback,next:null});e:{var w=e,S=u;switch(m=t,y=n,S.tag){case 1:if(w=S.payload,typeof w=="function"){v=w.call(y,v,m);break e}v=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=S.payload,m=typeof w=="function"?w.call(y,v,m):w,m==null)break e;v=H({},v,m);break e;case 2:dt=!0}}u.callback!==null&&u.lane!==0&&(e.flags|=64,m=l.effects,m===null?l.effects=[u]:m.push(u))}else y={eventTime:y,lane:m,tag:u.tag,payload:u.payload,callback:u.callback,next:null},p===null?(a=p=y,s=v):p=p.next=y,i|=m;if(u=u.next,u===null){if(u=l.shared.pending,u===null)break;m=u,u=m.next,m.next=null,l.lastBaseUpdate=m,l.shared.pending=null}}while(!0);if(p===null&&(s=v),l.baseState=s,l.firstBaseUpdate=a,l.lastBaseUpdate=p,t=l.shared.interleaved,t!==null){l=t;do i|=l.lane,l=l.next;while(l!==t)}else o===null&&(l.shared.lanes=0);Wt|=i,e.lanes=i,e.memoizedState=v}}function Ds(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Oo.transition;Oo.transition={};try{e(!1),t()}finally{R=n,Oo.transition=r}}function Ec(){return Me().memoizedState}function Cp(e,t,n){var r=_t(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},_c(e))xc(t,n);else if(n=lc(e,t,n,r),n!==null){var l=ce();Ve(n,e,r,l),Cc(n,t,r)}}function Np(e,t,n){var r=_t(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(_c(e))xc(t,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,u=o(i,n);if(l.hasEagerState=!0,l.eagerState=u,He(u,i)){var s=t.interleaved;s===null?(l.next=l,Ji(t)):(l.next=s.next,s.next=l),t.interleaved=l;return}}catch{}finally{}n=lc(e,t,l,r),n!==null&&(l=ce(),Ve(n,e,r,l),Cc(n,t,r))}}function _c(e){var t=e.alternate;return e===V||t!==null&&t===V}function xc(e,t){er=Tl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Cc(e,t,n){if((n&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ui(e,n)}}var Pl={readContext:Oe,useCallback:re,useContext:re,useEffect:re,useImperativeHandle:re,useInsertionEffect:re,useLayoutEffect:re,useMemo:re,useReducer:re,useRef:re,useState:re,useDebugValue:re,useDeferredValue:re,useTransition:re,useMutableSource:re,useSyncExternalStore:re,useId:re,unstable_isNewReconciler:!1},Tp={readContext:Oe,useCallback:function(e,t){return Ge().memoizedState=[e,t===void 0?null:t],e},useContext:Oe,useEffect:As,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,ol(4194308,4,gc.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ol(4194308,4,e,t)},useInsertionEffect:function(e,t){return ol(4,2,e,t)},useMemo:function(e,t){var n=Ge();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ge();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Cp.bind(null,V,e),[r.memoizedState,e]},useRef:function(e){var t=Ge();return e={current:e},t.memoizedState=e},useState:Is,useDebugValue:iu,useDeferredValue:function(e){return Ge().memoizedState=e},useTransition:function(){var e=Is(!1),t=e[0];return e=xp.bind(null,e[1]),Ge().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=V,l=Ge();if(j){if(n===void 0)throw Error(h(407));n=n()}else{if(n=t(),q===null)throw Error(h(349));(Ht&30)!==0||ac(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,As(fc.bind(null,r,o,e),[e]),r.flags|=2048,Sr(9,cc.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Ge(),t=q.identifierPrefix;if(j){var n=nt,r=tt;n=(r&~(1<<32-Be(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=gr++,0")&&(s=s.replace("",e.displayName)),s}while(1<=i&&0<=u);break}}}finally{go=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Qn(e):""}function sd(e){switch(e.tag){case 5:return Qn(e.type);case 16:return Qn("Lazy");case 13:return Qn("Suspense");case 19:return Qn("SuspenseList");case 0:case 2:case 15:return e=yo(e.type,!1),e;case 11:return e=yo(e.type.render,!1),e;case 1:return e=yo(e.type,!0),e;default:return""}}function Ho(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case en:return"Fragment";case bt:return"Portal";case jo:return"Profiler";case zi:return"StrictMode";case Vo:return"Suspense";case Bo:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ua:return(e.displayName||"Context")+".Consumer";case ia:return(e._context.displayName||"Context")+".Provider";case Di:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ii:return t=e.displayName||null,t!==null?t:Ho(e.type)||"Memo";case pt:t=e._payload,e=e._init;try{return Ho(e(t))}catch{}}return null}function ad(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ho(t);case 8:return t===zi?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Tt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function aa(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function cd(e){var t=aa(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(i){r=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ar(e){e._valueTracker||(e._valueTracker=cd(e))}function ca(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=aa(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function cl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Wo(e,t){var n=t.checked;return H({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ns(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Tt(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function fa(e,t){t=t.checked,t!=null&&Ri(e,"checked",t,!1)}function $o(e,t){fa(e,t);var n=Tt(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Qo(e,t.type,n):t.hasOwnProperty("defaultValue")&&Qo(e,t.type,Tt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function rs(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Qo(e,t,n){(t!=="number"||cl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Kn=Array.isArray;function dn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=Ur.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function or(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Yn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},fd=["Webkit","ms","Moz","O"];Object.keys(Yn).forEach(function(e){fd.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Yn[t]=Yn[e]})});function va(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Yn.hasOwnProperty(e)&&Yn[e]?(""+t).trim():t+"px"}function ha(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=va(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var dd=H({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Xo(e,t){if(t){if(dd[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(h(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(h(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(h(61))}if(t.style!=null&&typeof t.style!="object")throw Error(h(62))}}function Yo(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Zo=null;function Ai(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Jo=null,pn=null,mn=null;function is(e){if(e=_r(e)){if(typeof Jo!="function")throw Error(h(280));var t=e.stateNode;t&&(t=Fl(t),Jo(e.stateNode,e.type,t))}}function ga(e){pn?mn?mn.push(e):mn=[e]:pn=e}function ya(){if(pn){var e=pn,t=mn;if(mn=pn=null,is(e),t)for(e=0;e>>=0,e===0?32:31-(_d(e)/xd|0)|0}var Fr=64,jr=4194304;function Gn(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ml(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,o=e.pingedLanes,i=n&268435455;if(i!==0){var u=i&~l;u!==0?r=Gn(u):(o&=i,o!==0&&(r=Gn(o)))}else i=n&~l,i!==0?r=Gn(i):o!==0&&(r=Gn(o));if(r===0)return 0;if(t!==0&&t!==r&&(t&l)===0&&(l=r&-r,o=t&-t,l>=o||l===16&&(o&4194240)!==0))return t;if((r&4)!==0&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function kr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Be(t),e[t]=n}function Pd(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Jn),vs=" ",hs=!1;function Fa(e,t){switch(e){case"keyup":return np.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ja(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var tn=!1;function lp(e,t){switch(e){case"compositionend":return ja(t);case"keypress":return t.which!==32?null:(hs=!0,vs);case"textInput":return e=t.data,e===vs&&hs?null:e;default:return null}}function op(e,t){if(tn)return e==="compositionend"||!$i&&Fa(e,t)?(e=Aa(),tl=Bi=gt=null,tn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Ss(n)}}function Wa(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Wa(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function $a(){for(var e=window,t=cl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=cl(e.document)}return t}function Qi(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function mp(e){var t=$a(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Wa(n.ownerDocument.documentElement,n)){if(r!==null&&Qi(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,o=Math.min(r.start,l);r=r.end===void 0?o:Math.min(r.end,l),!e.extend&&o>r&&(l=r,r=o,o=l),l=ws(n,o);var i=ws(n,r);l&&i&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,nn=null,ri=null,bn=null,li=!1;function ks(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;li||nn==null||nn!==cl(r)||(r=nn,"selectionStart"in r&&Qi(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),bn&&fr(bn,r)||(bn=r,r=gl(ri,"onSelect"),0on||(e.current=ci[on],ci[on]=null,on--)}function I(e,t){on++,ci[on]=e.current,e.current=t}var Pt={},ie=Ot(Pt),ve=Ot(!1),Bt=Pt;function Sn(e,t){var n=e.type.contextTypes;if(!n)return Pt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},o;for(o in n)l[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function he(e){return e=e.childContextTypes,e!=null}function Sl(){U(ve),U(ie)}function Os(e,t,n){if(ie.current!==Pt)throw Error(h(168));I(ie,t),I(ve,n)}function ba(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(h(108,ad(e)||"Unknown",l));return H({},n,r)}function wl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Pt,Bt=ie.current,I(ie,e),I(ve,ve.current),!0}function Ms(e,t,n){var r=e.stateNode;if(!r)throw Error(h(169));n?(e=ba(e,t,Bt),r.__reactInternalMemoizedMergedChildContext=e,U(ve),U(ie),I(ie,e)):U(ve),I(ve,n)}var tt=null,jl=!1,Lo=!1;function ec(e){tt===null?tt=[e]:tt.push(e)}function xp(e){jl=!0,ec(e)}function Mt(){if(!Lo&&tt!==null){Lo=!0;var e=0,t=R;try{var n=tt;for(R=1;e>=i,l-=i,nt=1<<32-Be(t)+l|n<x?(K=C,C=null):K=C.sibling;var P=v(f,C,d[x],g);if(P===null){C===null&&(C=K);break}e&&C&&P.alternate===null&&t(f,C),c=o(P,c,x),N===null?_=P:N.sibling=P,N=P,C=K}if(x===d.length)return n(f,C),j&&Dt(f,x),_;if(C===null){for(;xx?(K=C,C=null):K=C.sibling;var Qe=v(f,C,P.value,g);if(Qe===null){C===null&&(C=K);break}e&&C&&Qe.alternate===null&&t(f,C),c=o(Qe,c,x),N===null?_=Qe:N.sibling=Qe,N=Qe,C=K}if(P.done)return n(f,C),j&&Dt(f,x),_;if(C===null){for(;!P.done;x++,P=d.next())P=m(f,P.value,g),P!==null&&(c=o(P,c,x),N===null?_=P:N.sibling=P,N=P);return j&&Dt(f,x),_}for(C=r(f,C);!P.done;x++,P=d.next())P=y(C,f,x,P.value,g),P!==null&&(e&&P.alternate!==null&&C.delete(P.key===null?x:P.key),c=o(P,c,x),N===null?_=P:N.sibling=P,N=P);return e&&C.forEach(function(Nr){return t(f,Nr)}),j&&Dt(f,x),_}function z(f,c,d,g){if(typeof d=="object"&&d!==null&&d.type===en&&d.key===null&&(d=d.props.children),typeof d=="object"&&d!==null){switch(d.$$typeof){case Ir:e:{for(var _=d.key,N=c;N!==null;){if(N.key===_){if(_=d.type,_===en){if(N.tag===7){n(f,N.sibling),c=l(N,d.props.children),c.return=f,f=c;break e}}else if(N.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===pt&&Ds(_)===N.type){n(f,N.sibling),c=l(N,d.props),c.ref=Bn(f,N,d),c.return=f,f=c;break e}n(f,N);break}else t(f,N);N=N.sibling}d.type===en?(c=Vt(d.props.children,f.mode,g,d.key),c.return=f,f=c):(g=al(d.type,d.key,d.props,null,f.mode,g),g.ref=Bn(f,c,d),g.return=f,f=g)}return i(f);case bt:e:{for(N=d.key;c!==null;){if(c.key===N)if(c.tag===4&&c.stateNode.containerInfo===d.containerInfo&&c.stateNode.implementation===d.implementation){n(f,c.sibling),c=l(c,d.children||[]),c.return=f,f=c;break e}else{n(f,c);break}else t(f,c);c=c.sibling}c=Uo(d,f.mode,g),c.return=f,f=c}return i(f);case pt:return N=d._init,z(f,c,N(d._payload),g)}if(Kn(d))return w(f,c,d,g);if(Un(d))return S(f,c,d,g);Zr(f,d)}return typeof d=="string"&&d!==""||typeof d=="number"?(d=""+d,c!==null&&c.tag===6?(n(f,c.sibling),c=l(c,d),c.return=f,f=c):(n(f,c),c=Ao(d,f.mode,g),c.return=f,f=c),i(f)):n(f,c)}return z}var kn=lc(!0),oc=lc(!1),_l=Ot(null),xl=null,an=null,Yi=null;function Zi(){Yi=an=xl=null}function Ji(e){var t=_l.current;U(_l),e._currentValue=t}function pi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function hn(e,t){xl=e,Yi=an=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(me=!0),e.firstContext=null)}function Me(e){var t=e._currentValue;if(Yi!==e)if(e={context:e,memoizedValue:t,next:null},an===null){if(xl===null)throw Error(h(308));an=e,xl.dependencies={lanes:0,firstContext:e}}else an=an.next=e;return t}var Ut=null;function qi(e){Ut===null?Ut=[e]:Ut.push(e)}function ic(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,qi(t)):(n.next=l.next,l.next=n),t.interleaved=n,ut(e,r)}function ut(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var mt=!1;function bi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function uc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function lt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function _t(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(M&2)!==0){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,ut(e,n)}return l=r.interleaved,l===null?(t.next=t,qi(r)):(t.next=l.next,l.next=t),r.interleaved=t,ut(e,n)}function rl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Fi(e,n)}}function Is(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?l=o=i:o=o.next=i,n=n.next}while(n!==null);o===null?l=o=t:o=o.next=t}else l=o=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Cl(e,t,n,r){var l=e.updateQueue;mt=!1;var o=l.firstBaseUpdate,i=l.lastBaseUpdate,u=l.shared.pending;if(u!==null){l.shared.pending=null;var s=u,a=s.next;s.next=null,i===null?o=a:i.next=a,i=s;var p=e.alternate;p!==null&&(p=p.updateQueue,u=p.lastBaseUpdate,u!==i&&(u===null?p.firstBaseUpdate=a:u.next=a,p.lastBaseUpdate=s))}if(o!==null){var m=l.baseState;i=0,p=a=s=null,u=o;do{var v=u.lane,y=u.eventTime;if((r&v)===v){p!==null&&(p=p.next={eventTime:y,lane:0,tag:u.tag,payload:u.payload,callback:u.callback,next:null});e:{var w=e,S=u;switch(v=t,y=n,S.tag){case 1:if(w=S.payload,typeof w=="function"){m=w.call(y,m,v);break e}m=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=S.payload,v=typeof w=="function"?w.call(y,m,v):w,v==null)break e;m=H({},m,v);break e;case 2:mt=!0}}u.callback!==null&&u.lane!==0&&(e.flags|=64,v=l.effects,v===null?l.effects=[u]:v.push(u))}else y={eventTime:y,lane:v,tag:u.tag,payload:u.payload,callback:u.callback,next:null},p===null?(a=p=y,s=m):p=p.next=y,i|=v;if(u=u.next,u===null){if(u=l.shared.pending,u===null)break;v=u,u=v.next,v.next=null,l.lastBaseUpdate=v,l.shared.pending=null}}while(!0);if(p===null&&(s=m),l.baseState=s,l.firstBaseUpdate=a,l.lastBaseUpdate=p,t=l.shared.interleaved,t!==null){l=t;do i|=l.lane,l=l.next;while(l!==t)}else o===null&&(l.shared.lanes=0);$t|=i,e.lanes=i,e.memoizedState=m}}function As(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Mo.transition;Mo.transition={};try{e(!1),t()}finally{R=n,Mo.transition=r}}function xc(){return Re().memoizedState}function Pp(e,t,n){var r=Ct(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Cc(e))Nc(t,n);else if(n=ic(e,t,n,r),n!==null){var l=ce();He(n,e,r,l),Tc(n,t,r)}}function Lp(e,t,n){var r=Ct(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Cc(e))Nc(t,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,u=o(i,n);if(l.hasEagerState=!0,l.eagerState=u,We(u,i)){var s=t.interleaved;s===null?(l.next=l,qi(t)):(l.next=s.next,s.next=l),t.interleaved=l;return}}catch{}finally{}n=ic(e,t,l,r),n!==null&&(l=ce(),He(n,e,r,l),Tc(n,t,r))}}function Cc(e){var t=e.alternate;return e===B||t!==null&&t===B}function Nc(e,t){er=Tl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Tc(e,t,n){if((n&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Fi(e,n)}}var Pl={readContext:Me,useCallback:re,useContext:re,useEffect:re,useImperativeHandle:re,useInsertionEffect:re,useLayoutEffect:re,useMemo:re,useReducer:re,useRef:re,useState:re,useDebugValue:re,useDeferredValue:re,useTransition:re,useMutableSource:re,useSyncExternalStore:re,useId:re,unstable_isNewReconciler:!1},Op={readContext:Me,useCallback:function(e,t){return Xe().memoizedState=[e,t===void 0?null:t],e},useContext:Me,useEffect:Fs,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,ol(4194308,4,Sc.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ol(4194308,4,e,t)},useInsertionEffect:function(e,t){return ol(4,2,e,t)},useMemo:function(e,t){var n=Xe();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Xe();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Pp.bind(null,B,e),[r.memoizedState,e]},useRef:function(e){var t=Xe();return e={current:e},t.memoizedState=e},useState:Us,useDebugValue:uu,useDeferredValue:function(e){return Xe().memoizedState=e},useTransition:function(){var e=Us(!1),t=e[0];return e=Tp.bind(null,e[1]),Xe().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=B,l=Xe();if(j){if(n===void 0)throw Error(h(407));n=n()}else{if(n=t(),q===null)throw Error(h(349));(Wt&30)!==0||fc(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,Fs(pc.bind(null,r,o,e),[e]),r.flags|=2048,Sr(9,dc.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Xe(),t=q.identifierPrefix;if(j){var n=rt,r=nt;n=(r&~(1<<32-Be(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=gr++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[Xe]=t,e[mr]=r,Ic(e,t,!1,!1),t.stateNode=e;e:{switch(i=Xo(n,r),n){case"dialog":A("cancel",e),A("close",e),l=r;break;case"iframe":case"object":case"embed":A("load",e),l=r;break;case"video":case"audio":for(l=0;lxn&&(t.flags|=128,r=!0,Hn(o,!1),t.lanes=4194304)}else{if(!r)if(e=Nl(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Hn(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!j)return le(t),null}else 2*$()-o.renderingStartTime>xn&&n!==1073741824&&(t.flags|=128,r=!0,Hn(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(n=o.last,n!==null?n.sibling=i:t.child=i,o.last=i)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=$(),t.sibling=null,n=B.current,I(B,r?n&1|2:n&1),t):(le(t),null);case 22:case 23:return du(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(ye&1073741824)!==0&&(le(t),t.subtreeFlags&6&&(t.flags|=8192)):le(t),null;case 24:return null;case 25:return null}throw Error(h(156,t.tag))}function Ip(e,t){switch(Ki(t),t.tag){case 1:return ve(t.type)&&Sl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return En(),U(me),U(ie),tu(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return eu(t),null;case 13:if(U(B),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(h(340));wn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return U(B),null;case 4:return En(),null;case 10:return Zi(t.type._context),null;case 22:case 23:return du(),null;case 24:return null;default:return null}}var qr=!1,oe=!1,Ap=typeof WeakSet=="function"?WeakSet:Set,k=null;function cn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){W(e,t,r)}else n.current=null}function ki(e,t,n){try{n()}catch(r){W(e,t,r)}}var Gs=!1;function Up(e,t){if(li=vl,e=Ha(),$i(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var i=0,u=-1,s=-1,a=0,p=0,v=e,m=null;t:for(;;){for(var y;v!==n||l!==0&&v.nodeType!==3||(u=i+l),v!==o||r!==0&&v.nodeType!==3||(s=i+r),v.nodeType===3&&(i+=v.nodeValue.length),(y=v.firstChild)!==null;)m=v,v=y;for(;;){if(v===e)break t;if(m===n&&++a===l&&(u=i),m===o&&++p===r&&(s=i),(y=v.nextSibling)!==null)break;v=m,m=v.parentNode}v=y}n=u===-1||s===-1?null:{start:u,end:s}}else n=null}n=n||{start:0,end:0}}else n=null;for(oi={focusedElem:e,selectionRange:n},vl=!1,k=t;k!==null;)if(t=k,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,k=e;else for(;k!==null;){t=k;try{var w=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(w!==null){var S=w.memoizedProps,z=w.memoizedState,f=t.stateNode,c=f.getSnapshotBeforeUpdate(t.elementType===t.type?S:Ue(t.type,S),z);f.__reactInternalSnapshotBeforeUpdate=c}break;case 3:var d=t.stateNode.containerInfo;d.nodeType===1?d.textContent="":d.nodeType===9&&d.documentElement&&d.removeChild(d.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(h(163))}}catch(g){W(t,t.return,g)}if(e=t.sibling,e!==null){e.return=t.return,k=e;break}k=t.return}return w=Gs,Gs=!1,w}function tr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var o=l.destroy;l.destroy=void 0,o!==void 0&&ki(t,n,o)}l=l.next}while(l!==r)}}function Hl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Ei(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Fc(e){var t=e.alternate;t!==null&&(e.alternate=null,Fc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Xe],delete t[mr],delete t[si],delete t[Sp],delete t[wp])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function jc(e){return e.tag===5||e.tag===3||e.tag===4}function Xs(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||jc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function _i(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=yl));else if(r!==4&&(e=e.child,e!==null))for(_i(e,t,n),e=e.sibling;e!==null;)_i(e,t,n),e=e.sibling}function xi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(xi(e,t,n),e=e.sibling;e!==null;)xi(e,t,n),e=e.sibling}var b=null,Fe=!1;function ct(e,t,n){for(n=n.child;n!==null;)Bc(e,t,n),n=n.sibling}function Bc(e,t,n){if(Ye&&typeof Ye.onCommitFiberUnmount=="function")try{Ye.onCommitFiberUnmount(Dl,n)}catch{}switch(n.tag){case 5:oe||cn(n,t);case 6:var r=b,l=Fe;b=null,ct(e,t,n),b=r,Fe=l,b!==null&&(Fe?(e=b,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):b.removeChild(n.stateNode));break;case 18:b!==null&&(Fe?(e=b,n=n.stateNode,e.nodeType===8?To(e.parentNode,n):e.nodeType===1&&To(e,n),ar(e)):To(b,n.stateNode));break;case 4:r=b,l=Fe,b=n.stateNode.containerInfo,Fe=!0,ct(e,t,n),b=r,Fe=l;break;case 0:case 11:case 14:case 15:if(!oe&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var o=l,i=o.destroy;o=o.tag,i!==void 0&&((o&2)!==0||(o&4)!==0)&&ki(n,t,i),l=l.next}while(l!==r)}ct(e,t,n);break;case 1:if(!oe&&(cn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){W(n,t,u)}ct(e,t,n);break;case 21:ct(e,t,n);break;case 22:n.mode&1?(oe=(r=oe)||n.memoizedState!==null,ct(e,t,n),oe=r):ct(e,t,n);break;default:ct(e,t,n)}}function Ys(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Ap),t.forEach(function(r){var l=Kp.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Ae(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=i),r&=~o}if(r=l,r=$()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*jp(r/1960))-r,10e?16:e,ht===null)var r=!1;else{if(e=ht,ht=null,Ml=0,(O&6)!==0)throw Error(h(331));var l=O;for(O|=4,k=e.current;k!==null;){var o=k,i=o.child;if((k.flags&16)!==0){var u=o.deletions;if(u!==null){for(var s=0;s$()-cu?Ft(e,0):au|=n),he(e,t)}function Xc(e,t){t===0&&((e.mode&1)===0?t=1:(t=jr,jr<<=1,(jr&130023424)===0&&(jr=4194304)));var n=ce();e=it(e,t),e!==null&&(kr(e,t,n),he(e,n))}function Qp(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Xc(e,n)}function Kp(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(h(314))}r!==null&&r.delete(t),Xc(e,n)}var Yc;Yc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||me.current)pe=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return pe=!1,zp(e,t,n);pe=(e.flags&131072)!==0}else pe=!1,j&&(t.flags&1048576)!==0&&ba(t,El,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;il(e,t),e=t.pendingProps;var l=Sn(t,ie.current);hn(t,n),l=ru(null,t,r,e,l,n);var o=lu();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ve(r)?(o=!0,wl(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,qi(t),l.updater=Vl,t.stateNode=l,l._reactInternals=t,mi(t,r,e,n),t=gi(null,t,r,!0,o,n)):(t.tag=0,j&&o&&Qi(t),ae(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(il(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Xp(r),e=Ue(r,e),l){case 0:t=hi(null,t,r,e,n);break e;case 1:t=$s(null,t,r,e,n);break e;case 11:t=Hs(null,t,r,e,n);break e;case 14:t=Ws(null,t,r,Ue(r.type,e),n);break e}throw Error(h(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ue(r,l),hi(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ue(r,l),$s(e,t,r,l,n);case 3:e:{if(Rc(t),e===null)throw Error(h(387));r=t.pendingProps,o=t.memoizedState,l=o.element,oc(e,t),Cl(t,r,null,n);var i=t.memoizedState;if(r=i.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){l=_n(Error(h(423)),t),t=Qs(e,t,r,n,l);break e}else if(r!==l){l=_n(Error(h(424)),t),t=Qs(e,t,r,n,l);break e}else for(Se=wt(t.stateNode.containerInfo.firstChild),we=t,j=!0,je=null,n=rc(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(wn(),r===l){t=ut(e,t,n);break e}ae(e,t,r,n)}t=t.child}return t;case 5:return ic(t),e===null&&fi(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,i=l.children,ii(r,l)?i=null:o!==null&&ii(r,o)&&(t.flags|=32),Mc(e,t),ae(e,t,i,n),t.child;case 6:return e===null&&fi(t),null;case 13:return zc(e,t,n);case 4:return bi(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=kn(t,null,r,n):ae(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ue(r,l),Hs(e,t,r,l,n);case 7:return ae(e,t,t.pendingProps,n),t.child;case 8:return ae(e,t,t.pendingProps.children,n),t.child;case 12:return ae(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,o=t.memoizedProps,i=l.value,I(_l,r._currentValue),r._currentValue=i,o!==null)if(He(o.value,i)){if(o.children===l.children&&!me.current){t=ut(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var u=o.dependencies;if(u!==null){i=o.child;for(var s=u.firstContext;s!==null;){if(s.context===r){if(o.tag===1){s=rt(-1,n&-n),s.tag=2;var a=o.updateQueue;if(a!==null){a=a.shared;var p=a.pending;p===null?s.next=s:(s.next=p.next,p.next=s),a.pending=s}}o.lanes|=n,s=o.alternate,s!==null&&(s.lanes|=n),di(o.return,n,t),u.lanes|=n;break}s=s.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(h(341));i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),di(i,n,t),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===t){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}ae(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,hn(t,n),l=Oe(l),r=r(l),t.flags|=1,ae(e,t,r,n),t.child;case 14:return r=t.type,l=Ue(r,t.pendingProps),l=Ue(r.type,l),Ws(e,t,r,l,n);case 15:return Lc(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ue(r,l),il(e,t),t.tag=1,ve(r)?(e=!0,wl(t)):e=!1,hn(t,n),Nc(t,r,l),mi(t,r,l,n),gi(null,t,r,!0,e,n);case 19:return Dc(e,t,n);case 22:return Oc(e,t,n)}throw Error(h(156,t.tag))};function Zc(e,t){return _a(e,t)}function Gp(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pe(e,t,n,r){return new Gp(e,t,n,r)}function mu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Xp(e){if(typeof e=="function")return mu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===zi)return 11;if(e===Di)return 14}return 2}function xt(e,t){var n=e.alternate;return n===null?(n=Pe(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function al(e,t,n,r,l,o){var i=2;if(r=e,typeof e=="function")mu(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case en:return jt(n.children,l,o,t);case Ri:i=8,l|=8;break;case Fo:return e=Pe(12,n,t,l|2),e.elementType=Fo,e.lanes=o,e;case jo:return e=Pe(13,n,t,l),e.elementType=jo,e.lanes=o,e;case Bo:return e=Pe(19,n,t,l),e.elementType=Bo,e.lanes=o,e;case ia:return $l(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case la:i=10;break e;case oa:i=9;break e;case zi:i=11;break e;case Di:i=14;break e;case ft:i=16,r=null;break e}throw Error(h(130,e==null?e:typeof e,""))}return t=Pe(i,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function jt(e,t,n,r){return e=Pe(7,e,r,t),e.lanes=n,e}function $l(e,t,n,r){return e=Pe(22,e,r,t),e.elementType=ia,e.lanes=n,e.stateNode={isHidden:!1},e}function Io(e,t,n){return e=Pe(6,e,null,t),e.lanes=n,e}function Ao(e,t,n){return t=Pe(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Yp(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=So(0),this.expirationTimes=So(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=So(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function vu(e,t,n,r,l,o,i,u,s){return e=new Yp(e,t,n,u,s),t===1?(t=1,o===!0&&(t|=8)):t=0,o=Pe(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},qi(o),e}function Zp(e,t,n){var r=3{"use strict";function tf(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(tf)}catch(e){console.error(e)}}tf(),nf.exports=ef()});var of=qe(Su=>{"use strict";var lf=rf();Su.createRoot=lf.createRoot,Su.hydrateRoot=lf.hydrateRoot;var hm});var sf=qe(Yl=>{"use strict";var tm=ge(),nm=Symbol.for("react.element"),rm=Symbol.for("react.fragment"),lm=Object.prototype.hasOwnProperty,om=tm.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,im={key:!0,ref:!0,__self:!0,__source:!0};function uf(e,t,n){var r,l={},o=null,i=null;n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(i=t.ref);for(r in t)lm.call(t,r)&&!im.hasOwnProperty(r)&&(l[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)l[r]===void 0&&(l[r]=t[r]);return{$$typeof:nm,type:e,key:o,ref:i,props:l,_owner:om.current}}Yl.Fragment=rm;Yl.jsx=uf;Yl.jsxs=uf});var Q=qe((Sm,af)=>{"use strict";af.exports=sf()});var Of=M(of(),1);var ue=M(ge(),1);var Z=M(Q(),1);function cf({preference:e,onThemeChange:t}){let n=()=>{let o=["system","light","dark"],u=(o.indexOf(e)+1)%o.length;t(o[u])},r=()=>{switch(e){case"light":return(0,Z.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Z.jsx)("circle",{cx:"12",cy:"12",r:"5"}),(0,Z.jsx)("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),(0,Z.jsx)("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),(0,Z.jsx)("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),(0,Z.jsx)("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),(0,Z.jsx)("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),(0,Z.jsx)("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),(0,Z.jsx)("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),(0,Z.jsx)("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]});case"dark":return(0,Z.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,Z.jsx)("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})});case"system":default:return(0,Z.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Z.jsx)("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),(0,Z.jsx)("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),(0,Z.jsx)("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]})}},l=()=>{switch(e){case"light":return"Theme: Light (click for Dark)";case"dark":return"Theme: Dark (click for System)";case"system":default:return"Theme: System (click for Light)"}};return(0,Z.jsx)("button",{className:"theme-toggle-btn",onClick:n,title:l(),"aria-label":l(),children:r()})}var F=M(Q(),1);function ff({isConnected:e,projects:t,currentFilter:n,onFilterChange:r,onSettingsToggle:l,sidebarOpen:o,isProcessing:i,themePreference:u,onThemeChange:s}){return(0,F.jsxs)("div",{className:"header",children:[(0,F.jsxs)("h1",{children:[(0,F.jsx)("img",{src:"claude-mem-logomark.webp",alt:"",className:`logomark ${i?"spinning":""}`}),(0,F.jsx)("span",{className:"logo-text",children:"claude-mem"})]}),(0,F.jsxs)("div",{className:"status",children:[(0,F.jsx)("a",{href:"https://docs.claude-mem.ai",target:"_blank",rel:"noopener noreferrer",title:"Documentation",style:{display:"block",padding:"8px 4px 8px 8px",color:"#a0a0a0",transition:"color 0.2s",lineHeight:0},onMouseEnter:a=>a.currentTarget.style.color="#606060",onMouseLeave:a=>a.currentTarget.style.color="#a0a0a0",children:(0,F.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,F.jsx)("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20"}),(0,F.jsx)("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"})]})}),(0,F.jsx)("a",{href:"https://github.com/thedotmack/claude-mem/",target:"_blank",rel:"noopener noreferrer",title:"GitHub",style:{display:"block",padding:"8px 4px",color:"#a0a0a0",transition:"color 0.2s",lineHeight:0},onMouseEnter:a=>a.currentTarget.style.color="#606060",onMouseLeave:a=>a.currentTarget.style.color="#a0a0a0",children:(0,F.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:(0,F.jsx)("path",{d:"M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"})})}),(0,F.jsx)("a",{href:"https://x.com/Claude_Memory",target:"_blank",rel:"noopener noreferrer",title:"X (Twitter)",style:{display:"block",padding:"8px 8px 8px 4px",color:"#a0a0a0",transition:"color 0.2s",lineHeight:0},onMouseEnter:a=>a.currentTarget.style.color="#606060",onMouseLeave:a=>a.currentTarget.style.color="#a0a0a0",children:(0,F.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:(0,F.jsx)("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})})}),(0,F.jsxs)("select",{value:n,onChange:a=>r(a.target.value),children:[(0,F.jsx)("option",{value:"",children:"All Projects"}),t.map(a=>(0,F.jsx)("option",{value:a,children:a},a))]}),(0,F.jsx)(cf,{preference:u,onThemeChange:s}),(0,F.jsx)("button",{className:`settings-btn ${o?"active":""}`,onClick:l,title:"Settings",children:(0,F.jsxs)("svg",{className:"settings-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,F.jsx)("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),(0,F.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})})]})]})}var Ot=M(ge(),1);var wu=M(ge(),1);function Tn(e){return new Date(e).toLocaleString()}function df(e){if(!e)return"-";let t=Math.floor(e/3600),n=Math.floor(e%3600/60);return`${t}h ${n}m`}function pf(e){return e?e<1024?e+" B":e<1024*1024?(e/1024).toFixed(1)+" KB":(e/(1024*1024)).toFixed(1)+" MB":"-"}var L=M(Q(),1);function mf(e){let t=["/Scripts/","/src/","/plugin/","/docs/"];for(let l of t){let o=e.indexOf(l);if(o!==-1)return e.substring(o+1)}let n=e.indexOf("claude-mem/");if(n!==-1)return e.substring(n+11);let r=e.split("/");return r.length>3?r.slice(-3).join("/"):e}function vf({observation:e}){let[t,n]=(0,wu.useState)(!1),[r,l]=(0,wu.useState)(!1),o=Tn(e.created_at_epoch),i=e.facts?JSON.parse(e.facts):[],u=e.concepts?JSON.parse(e.concepts):[],s=e.files_read?JSON.parse(e.files_read).map(mf):[],a=e.files_modified?JSON.parse(e.files_modified).map(mf):[],p=i.length>0||u.length>0||s.length>0||a.length>0;return(0,L.jsxs)("div",{className:"card",children:[(0,L.jsxs)("div",{className:"card-header",children:[(0,L.jsxs)("div",{className:"card-header-left",children:[(0,L.jsx)("span",{className:`card-type type-${e.type}`,children:e.type}),(0,L.jsx)("span",{className:"card-project",children:e.project})]}),(0,L.jsxs)("div",{className:"view-mode-toggles",children:[p&&(0,L.jsxs)("button",{className:`view-mode-toggle ${t?"active":""}`,onClick:()=>{n(!t),t||l(!1)},children:[(0,L.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,L.jsx)("polyline",{points:"9 11 12 14 22 4"}),(0,L.jsx)("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]}),(0,L.jsx)("span",{children:"facts"})]}),e.narrative&&(0,L.jsxs)("button",{className:`view-mode-toggle ${r?"active":""}`,onClick:()=>{l(!r),r||n(!1)},children:[(0,L.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,L.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,L.jsx)("polyline",{points:"14 2 14 8 20 8"}),(0,L.jsx)("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),(0,L.jsx)("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]}),(0,L.jsx)("span",{children:"narrative"})]})]})]}),(0,L.jsx)("div",{className:"card-title",children:e.title||"Untitled"}),(0,L.jsxs)("div",{className:"view-mode-content",children:[!t&&!r&&e.subtitle&&(0,L.jsx)("div",{className:"card-subtitle",children:e.subtitle}),t&&i.length>0&&(0,L.jsx)("ul",{className:"facts-list",children:i.map((v,m)=>(0,L.jsx)("li",{children:v},m))}),r&&e.narrative&&(0,L.jsx)("div",{className:"narrative",children:e.narrative})]}),(0,L.jsxs)("div",{className:"card-meta",children:[(0,L.jsxs)("span",{className:"meta-date",children:["#",e.id," \u2022 ",o]}),t&&(u.length>0||s.length>0||a.length>0)&&(0,L.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"},children:[u.map((v,m)=>(0,L.jsx)("span",{style:{padding:"2px 8px",background:"var(--color-type-badge-bg)",color:"var(--color-type-badge-text)",borderRadius:"3px",fontWeight:"500",fontSize:"10px"},children:v},m)),s.length>0&&(0,L.jsxs)("span",{className:"meta-files",children:[(0,L.jsx)("span",{className:"file-label",children:"read:"})," ",s.join(", ")]}),a.length>0&&(0,L.jsxs)("span",{className:"meta-files",children:[(0,L.jsx)("span",{className:"file-label",children:"modified:"})," ",a.join(", ")]})]})]})]})}var xe=M(Q(),1);function hf({summary:e}){let t=Tn(e.created_at_epoch);return(0,xe.jsxs)("div",{className:"card summary-card",children:[(0,xe.jsx)("div",{className:"card-header",children:(0,xe.jsxs)("div",{className:"card-header-left",children:[(0,xe.jsx)("span",{className:"card-type",children:"SUMMARY"}),(0,xe.jsx)("span",{className:"card-project",children:e.project})]})}),e.request&&(0,xe.jsxs)("div",{className:"card-title",children:["Request: ",e.request]}),e.learned&&(0,xe.jsxs)("div",{className:"card-subtitle",children:["Learned: ",e.learned]}),e.completed&&(0,xe.jsxs)("div",{className:"card-subtitle",children:["Completed: ",e.completed]}),e.next_steps&&(0,xe.jsxs)("div",{className:"card-subtitle",children:["Next: ",e.next_steps]}),(0,xe.jsx)("div",{className:"card-meta",children:(0,xe.jsxs)("span",{className:"meta-date",children:["#",e.id," \u2022 ",t]})})]})}var Je=M(Q(),1);function gf({prompt:e}){let t=Tn(e.created_at_epoch);return(0,Je.jsxs)("div",{className:"card prompt-card",children:[(0,Je.jsx)("div",{className:"card-header",children:(0,Je.jsxs)("div",{className:"card-header-left",children:[(0,Je.jsx)("span",{className:"card-type",children:"Prompt"}),(0,Je.jsx)("span",{className:"card-project",children:e.project})]})}),(0,Je.jsx)("div",{className:"card-content",children:e.prompt_text}),(0,Je.jsx)("div",{className:"card-meta",children:(0,Je.jsxs)("span",{className:"meta-date",children:["#",e.id," \u2022 ",t]})})]})}var Cr={PAGINATION_PAGE_SIZE:50,LOAD_MORE_THRESHOLD:.1};var Re=M(Q(),1);function yf({observations:e,summaries:t,prompts:n,onLoadMore:r,isLoading:l,hasMore:o}){let i=(0,Ot.useRef)(null),u=(0,Ot.useRef)(r);(0,Ot.useEffect)(()=>{u.current=r},[r]),(0,Ot.useEffect)(()=>{let a=i.current;if(!a)return;let p=new IntersectionObserver(v=>{v[0].isIntersecting&&o&&!l&&u.current?.()},{threshold:Cr.LOAD_MORE_THRESHOLD});return p.observe(a),()=>{a&&p.unobserve(a),p.disconnect()}},[o,l]);let s=(0,Ot.useMemo)(()=>[...e.map(p=>({...p,itemType:"observation"})),...t.map(p=>({...p,itemType:"summary"})),...n.map(p=>({...p,itemType:"prompt"}))].sort((p,v)=>v.created_at_epoch-p.created_at_epoch),[e,t,n]);return(0,Re.jsx)("div",{className:"feed",children:(0,Re.jsxs)("div",{className:"feed-content",children:[s.map(a=>{let p=`${a.itemType}-${a.id}`;return a.itemType==="observation"?(0,Re.jsx)(vf,{observation:a},p):a.itemType==="summary"?(0,Re.jsx)(hf,{summary:a},p):(0,Re.jsx)(gf,{prompt:a},p)}),s.length===0&&!l&&(0,Re.jsx)("div",{style:{textAlign:"center",padding:"40px",color:"#8b949e"},children:"No items to display"}),l&&(0,Re.jsxs)("div",{style:{textAlign:"center",padding:"20px",color:"#8b949e"},children:[(0,Re.jsx)("div",{className:"spinner",style:{display:"inline-block",marginRight:"10px"}}),"Loading more..."]}),o&&!l&&s.length>0&&(0,Re.jsx)("div",{ref:i,style:{height:"20px",margin:"10px 0"}}),!o&&s.length>0&&(0,Re.jsx)("div",{style:{textAlign:"center",padding:"20px",color:"#8b949e",fontSize:"14px"},children:"No more items to load"})]})})}var Pn=M(ge(),1);var ze={CLAUDE_MEM_MODEL:"claude-haiku-4-5",CLAUDE_MEM_CONTEXT_OBSERVATIONS:"50",CLAUDE_MEM_WORKER_PORT:"37777"};var E=M(Q(),1);function Sf({isOpen:e,settings:t,stats:n,isSaving:r,saveStatus:l,isConnected:o,onSave:i,onClose:u}){let[s,a]=(0,Pn.useState)(t.CLAUDE_MEM_MODEL||ze.CLAUDE_MEM_MODEL),[p,v]=(0,Pn.useState)(t.CLAUDE_MEM_CONTEXT_OBSERVATIONS||ze.CLAUDE_MEM_CONTEXT_OBSERVATIONS),[m,y]=(0,Pn.useState)(t.CLAUDE_MEM_WORKER_PORT||ze.CLAUDE_MEM_WORKER_PORT);return(0,Pn.useEffect)(()=>{a(t.CLAUDE_MEM_MODEL||ze.CLAUDE_MEM_MODEL),v(t.CLAUDE_MEM_CONTEXT_OBSERVATIONS||ze.CLAUDE_MEM_CONTEXT_OBSERVATIONS),y(t.CLAUDE_MEM_WORKER_PORT||ze.CLAUDE_MEM_WORKER_PORT)},[t]),(0,E.jsxs)("div",{className:`sidebar ${e?"open":""}`,children:[(0,E.jsxs)("div",{className:"sidebar-header",children:[(0,E.jsx)("h1",{children:"Settings"}),(0,E.jsxs)("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[(0,E.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[(0,E.jsx)("span",{className:`status-dot ${o?"connected":""}`}),(0,E.jsx)("span",{style:{fontSize:"11px",opacity:.5,fontWeight:300},children:o?"Connected":"Disconnected"})]}),(0,E.jsx)("button",{onClick:()=>{i({CLAUDE_MEM_MODEL:s,CLAUDE_MEM_CONTEXT_OBSERVATIONS:p,CLAUDE_MEM_WORKER_PORT:m})},disabled:r,children:r?"Saving...":"Save"}),(0,E.jsx)("button",{onClick:u,title:"Close settings",style:{background:"transparent",border:"1px solid #404040",padding:"8px",width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,E.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,E.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,E.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),(0,E.jsxs)("div",{className:"stats-scroll",children:[(0,E.jsxs)("div",{className:"settings-section",children:[(0,E.jsx)("h3",{children:"Environment Variables"}),(0,E.jsxs)("div",{className:"form-group",children:[(0,E.jsx)("label",{htmlFor:"model",children:"CLAUDE_MEM_MODEL"}),(0,E.jsx)("div",{className:"setting-description",children:"Model used for AI compression of tool observations. Haiku is fast and cheap, Sonnet offers better quality, Opus is most capable but expensive."}),(0,E.jsxs)("select",{id:"model",value:s,onChange:S=>a(S.target.value),children:[(0,E.jsx)("option",{value:"claude-haiku-4-5",children:"claude-haiku-4-5"}),(0,E.jsx)("option",{value:"claude-sonnet-4-5",children:"claude-sonnet-4-5"}),(0,E.jsx)("option",{value:"claude-opus-4",children:"claude-opus-4"})]})]}),(0,E.jsxs)("div",{className:"form-group",children:[(0,E.jsx)("label",{htmlFor:"contextObs",children:"CLAUDE_MEM_CONTEXT_OBSERVATIONS"}),(0,E.jsx)("div",{className:"setting-description",children:"Number of recent observations to inject at session start. Higher values provide more context but increase token usage. Default: 50"}),(0,E.jsx)("input",{type:"number",id:"contextObs",min:"1",max:"200",value:p,onChange:S=>v(S.target.value)})]}),(0,E.jsxs)("div",{className:"form-group",children:[(0,E.jsx)("label",{htmlFor:"workerPort",children:"CLAUDE_MEM_WORKER_PORT"}),(0,E.jsx)("div",{className:"setting-description",children:"Port number for the background worker service. Change only if port 37777 conflicts with another service."}),(0,E.jsx)("input",{type:"number",id:"workerPort",min:"1024",max:"65535",value:m,onChange:S=>y(S.target.value)})]}),l&&(0,E.jsx)("div",{className:"save-status",children:l})]}),(0,E.jsxs)("div",{className:"settings-section",children:[(0,E.jsx)("h3",{children:"Worker Stats"}),(0,E.jsxs)("div",{className:"stats-grid",children:[(0,E.jsxs)("div",{className:"stat",children:[(0,E.jsx)("div",{className:"stat-label",children:"Version"}),(0,E.jsx)("div",{className:"stat-value",children:n.worker?.version||"-"})]}),(0,E.jsxs)("div",{className:"stat",children:[(0,E.jsx)("div",{className:"stat-label",children:"Uptime"}),(0,E.jsx)("div",{className:"stat-value",children:df(n.worker?.uptime)})]}),(0,E.jsxs)("div",{className:"stat",children:[(0,E.jsx)("div",{className:"stat-label",children:"Active Sessions"}),(0,E.jsx)("div",{className:"stat-value",children:n.worker?.activeSessions||"0"})]}),(0,E.jsxs)("div",{className:"stat",children:[(0,E.jsx)("div",{className:"stat-label",children:"SSE Clients"}),(0,E.jsx)("div",{className:"stat-value",children:n.worker?.sseClients||"0"})]})]})]}),(0,E.jsxs)("div",{className:"settings-section",children:[(0,E.jsx)("h3",{children:"Database Stats"}),(0,E.jsxs)("div",{className:"stats-grid",children:[(0,E.jsxs)("div",{className:"stat",children:[(0,E.jsx)("div",{className:"stat-label",children:"DB Size"}),(0,E.jsx)("div",{className:"stat-value",children:pf(n.database?.size)})]}),(0,E.jsxs)("div",{className:"stat",children:[(0,E.jsx)("div",{className:"stat-label",children:"Observations"}),(0,E.jsx)("div",{className:"stat-value",children:n.database?.observations||"0"})]}),(0,E.jsxs)("div",{className:"stat",children:[(0,E.jsx)("div",{className:"stat-label",children:"Sessions"}),(0,E.jsx)("div",{className:"stat-value",children:n.database?.sessions||"0"})]}),(0,E.jsxs)("div",{className:"stat",children:[(0,E.jsx)("div",{className:"stat-label",children:"Summaries"}),(0,E.jsx)("div",{className:"stat-value",children:n.database?.summaries||"0"})]})]})]})]})]})}var De=M(ge(),1);var We={OBSERVATIONS:"/api/observations",SUMMARIES:"/api/summaries",PROMPTS:"/api/prompts",SETTINGS:"/api/settings",STATS:"/api/stats",PROCESSING_STATUS:"/api/processing-status",STREAM:"/stream"};var Ln={SSE_RECONNECT_DELAY_MS:3e3,STATS_REFRESH_INTERVAL_MS:1e4,SAVE_STATUS_DISPLAY_DURATION_MS:3e3};function wf(){let[e,t]=(0,De.useState)([]),[n,r]=(0,De.useState)([]),[l,o]=(0,De.useState)([]),[i,u]=(0,De.useState)([]),[s,a]=(0,De.useState)(!1),[p,v]=(0,De.useState)(!1),m=(0,De.useRef)(null),y=(0,De.useRef)();return(0,De.useEffect)(()=>{let w=()=>{m.current&&m.current.close();let S=new EventSource(We.STREAM);m.current=S,S.onopen=()=>{console.log("[SSE] Connected"),a(!0),y.current&&clearTimeout(y.current)},S.onerror=z=>{console.error("[SSE] Connection error:",z),a(!1),S.close(),y.current=setTimeout(()=>{y.current=void 0,console.log("[SSE] Attempting to reconnect..."),w()},Ln.SSE_RECONNECT_DELAY_MS)},S.onmessage=z=>{try{let f=JSON.parse(z.data);switch(f.type){case"initial_load":console.log("[SSE] Initial load:",{projects:f.projects?.length||0}),u(f.projects||[]);break;case"new_observation":f.observation&&(console.log("[SSE] New observation:",f.observation.id),t(c=>[f.observation,...c]));break;case"new_summary":if(f.summary){let c=f.summary;console.log("[SSE] New summary:",c.id),r(d=>[c,...d])}break;case"new_prompt":if(f.prompt){let c=f.prompt;console.log("[SSE] New prompt:",c.id),o(d=>[c,...d])}break;case"processing_status":typeof f.isProcessing=="boolean"&&(console.log("[SSE] Processing status:",f.isProcessing),v(f.isProcessing));break}}catch(f){console.error("[SSE] Failed to parse message:",f)}}};return w(),()=>{m.current&&m.current.close(),y.current&&clearTimeout(y.current)}},[]),{observations:e,summaries:n,prompts:l,projects:i,isProcessing:p,isConnected:s}}var On=M(ge(),1);function kf(){let[e,t]=(0,On.useState)(ze),[n,r]=(0,On.useState)(!1),[l,o]=(0,On.useState)("");return(0,On.useEffect)(()=>{fetch(We.SETTINGS).then(u=>u.json()).then(u=>{t({CLAUDE_MEM_MODEL:u.CLAUDE_MEM_MODEL||ze.CLAUDE_MEM_MODEL,CLAUDE_MEM_CONTEXT_OBSERVATIONS:u.CLAUDE_MEM_CONTEXT_OBSERVATIONS||ze.CLAUDE_MEM_CONTEXT_OBSERVATIONS,CLAUDE_MEM_WORKER_PORT:u.CLAUDE_MEM_WORKER_PORT||ze.CLAUDE_MEM_WORKER_PORT})}).catch(u=>{console.error("Failed to load settings:",u)})},[]),{settings:e,saveSettings:async u=>{r(!0),o("Saving...");try{let a=await(await fetch(We.SETTINGS,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)})).json();a.success?(t(u),o("\u2713 Saved"),setTimeout(()=>o(""),Ln.SAVE_STATUS_DISPLAY_DURATION_MS)):o(`\u2717 Error: ${a.error}`)}catch(s){o(`\u2717 Error: ${s instanceof Error?s.message:"Unknown error"}`)}finally{r(!1)}},isSaving:n,saveStatus:l}}var Zl=M(ge(),1);function Ef(){let[e,t]=(0,Zl.useState)({});return(0,Zl.useEffect)(()=>{let n=async()=>{try{let o=await(await fetch(We.STATS)).json();t(o)}catch(l){console.error("Failed to load stats:",l)}};n();let r=setInterval(n,Ln.STATS_REFRESH_INTERVAL_MS);return()=>clearInterval(r)},[]),{stats:e}}var Gt=M(ge(),1);function ku(e,t,n){let[r,l]=(0,Gt.useState)({isLoading:!1,hasMore:!0}),[o,i]=(0,Gt.useState)(0);(0,Gt.useEffect)(()=>{i(0),l({isLoading:!1,hasMore:!0})},[n]);let u=(0,Gt.useCallback)(async()=>{if(r.isLoading||!r.hasMore)return[];l(s=>({...s,isLoading:!0}));try{let s=new URLSearchParams({offset:o.toString(),limit:Cr.PAGINATION_PAGE_SIZE.toString()});n&&s.append("project",n);let a=await fetch(`${e}?${s}`);if(!a.ok)throw new Error(`Failed to load ${t}: ${a.statusText}`);let p=await a.json();return l(v=>({...v,isLoading:!1,hasMore:p.hasMore})),i(v=>v+Cr.PAGINATION_PAGE_SIZE),p.items}catch(s){return console.error(`Failed to load ${t}:`,s),l(a=>({...a,isLoading:!1})),[]}},[o,r.hasMore,r.isLoading,n,e,t]);return{...r,loadMore:u}}function _f(e){let t=ku(We.OBSERVATIONS,"observations",e),n=ku(We.SUMMARIES,"summaries",e),r=ku(We.PROMPTS,"prompts",e);return{observations:t,summaries:n,prompts:r}}var Mn=M(ge(),1),Nf="claude-mem-theme";function um(){return typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function xf(){try{let e=localStorage.getItem(Nf);if(e==="system"||e==="light"||e==="dark")return e}catch(e){console.warn("Failed to read theme preference from localStorage:",e)}return"system"}function Cf(e){return e==="system"?um():e}function Tf(){let[e,t]=(0,Mn.useState)(xf),[n,r]=(0,Mn.useState)(()=>Cf(xf()));return(0,Mn.useEffect)(()=>{let o=Cf(e);r(o),document.documentElement.setAttribute("data-theme",o)},[e]),(0,Mn.useEffect)(()=>{if(e!=="system")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),i=u=>{let s=u.matches?"dark":"light";r(s),document.documentElement.setAttribute("data-theme",s)};return o.addEventListener("change",i),()=>o.removeEventListener("change",i)},[e]),{preference:e,resolvedTheme:n,setThemePreference:o=>{try{localStorage.setItem(Nf,o),t(o)}catch(i){console.warn("Failed to save theme preference to localStorage:",i),t(o)}}}}function Jl(e,t,n){let r=n?e.filter(o=>o.project===n):e,l=new Set;return[...r,...t].filter(o=>l.has(o.id)?!1:(l.add(o.id),!0))}var Xt=M(Q(),1);function Pf(){let[e,t]=(0,ue.useState)(""),[n,r]=(0,ue.useState)(!1),[l,o]=(0,ue.useState)([]),[i,u]=(0,ue.useState)([]),[s,a]=(0,ue.useState)([]),{observations:p,summaries:v,prompts:m,projects:y,isProcessing:w,isConnected:S}=wf(),{settings:z,saveSettings:f,isSaving:c,saveStatus:d}=kf(),{stats:g}=Ef(),{preference:_,resolvedTheme:N,setThemePreference:C}=Tf(),x=_f(e);(0,ue.useEffect)(()=>{o([]),u([]),a([])},[e]);let K=(0,ue.useMemo)(()=>Jl(p,l,e),[p,l,e]),P=(0,ue.useMemo)(()=>Jl(v,i,e),[v,i,e]),$e=(0,ue.useMemo)(()=>Jl(m,s,e),[m,s,e]),Nr=(0,ue.useCallback)(()=>{r(Yt=>!Yt)},[]),bl=(0,ue.useCallback)(async()=>{try{let[Yt,_u,xu]=await Promise.all([x.observations.loadMore(),x.summaries.loadMore(),x.prompts.loadMore()]);Yt.length>0&&o(Rn=>[...Rn,...Yt]),_u.length>0&&u(Rn=>[...Rn,..._u]),xu.length>0&&a(Rn=>[...Rn,...xu])}catch(Yt){console.error("Failed to load more data:",Yt)}},[x]);return(0,ue.useEffect)(()=>{bl()},[e,bl]),(0,Xt.jsxs)("div",{className:"container",children:[(0,Xt.jsxs)("div",{className:"main-col",children:[(0,Xt.jsx)(ff,{isConnected:S,projects:y,currentFilter:e,onFilterChange:t,onSettingsToggle:Nr,sidebarOpen:n,isProcessing:w,themePreference:_,onThemeChange:C}),(0,Xt.jsx)(yf,{observations:K,summaries:P,prompts:$e,onLoadMore:bl,isLoading:x.observations.isLoading||x.summaries.isLoading||x.prompts.isLoading,hasMore:x.observations.hasMore||x.summaries.hasMore||x.prompts.hasMore})]}),(0,Xt.jsx)(Sf,{isOpen:n,settings:z,stats:g,isSaving:c,saveStatus:d,isConnected:S,onSave:f,onClose:Nr})]})}var Lf=M(ge(),1),Mt=M(Q(),1),ql=class extends Lf.Component{constructor(t){super(t),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("[ErrorBoundary] Caught error:",t,n),this.setState({error:t,errorInfo:n})}render(){return this.state.hasError?(0,Mt.jsxs)("div",{style:{padding:"20px",color:"#ff6b6b",backgroundColor:"#1a1a1a",minHeight:"100vh"},children:[(0,Mt.jsx)("h1",{style:{fontSize:"24px",marginBottom:"10px"},children:"Something went wrong"}),(0,Mt.jsx)("p",{style:{marginBottom:"10px",color:"#8b949e"},children:"The application encountered an error. Please refresh the page to try again."}),this.state.error&&(0,Mt.jsxs)("details",{style:{marginTop:"20px",color:"#8b949e"},children:[(0,Mt.jsx)("summary",{style:{cursor:"pointer",marginBottom:"10px"},children:"Error details"}),(0,Mt.jsxs)("pre",{style:{backgroundColor:"#0d1117",padding:"10px",borderRadius:"6px",overflow:"auto"},children:[this.state.error.toString(),this.state.errorInfo&&` +`+o.stack}return{value:e,source:t,stack:l,digest:null}}function Do(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function hi(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var zp=typeof WeakMap=="function"?WeakMap:Map;function Lc(e,t,n){n=lt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Ol||(Ol=!0,Ni=r),hi(e,t)},n}function Oc(e,t,n){n=lt(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var l=t.value;n.payload=function(){return r(l)},n.callback=function(){hi(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){hi(e,t),typeof r!="function"&&(xt===null?xt=new Set([this]):xt.add(this));var i=t.stack;this.componentDidCatch(t.value,{componentStack:i!==null?i:""})}),n}function Bs(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new zp;var l=new Set;r.set(t,l)}else l=r.get(t),l===void 0&&(l=new Set,r.set(t,l));l.has(n)||(l.add(n),e=Gp.bind(null,e,t,n),t.then(e,e))}function Hs(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Ws(e,t,n,r,l){return(e.mode&1)===0?(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=lt(-1,1),t.tag=2,_t(n,t,1))),n.lanes|=1),e):(e.flags|=65536,e.lanes=l,e)}var Dp=at.ReactCurrentOwner,me=!1;function ae(e,t,n,r){t.child=e===null?oc(t,null,n,r):kn(t,e.child,n,r)}function $s(e,t,n,r,l){n=n.render;var o=t.ref;return hn(t,l),r=lu(e,t,n,r,o,l),n=ou(),e!==null&&!me?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,st(e,t,l)):(j&&n&&Ki(t),t.flags|=1,ae(e,t,r,l),t.child)}function Qs(e,t,n,r,l){if(e===null){var o=n.type;return typeof o=="function"&&!vu(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=o,Mc(e,t,o,r,l)):(e=al(n.type,null,r,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,(e.lanes&l)===0){var i=o.memoizedProps;if(n=n.compare,n=n!==null?n:fr,n(i,r)&&e.ref===t.ref)return st(e,t,l)}return t.flags|=1,e=Nt(o,r),e.ref=t.ref,e.return=t,t.child=e}function Mc(e,t,n,r,l){if(e!==null){var o=e.memoizedProps;if(fr(o,r)&&e.ref===t.ref)if(me=!1,t.pendingProps=r=o,(e.lanes&l)!==0)(e.flags&131072)!==0&&(me=!0);else return t.lanes=e.lanes,st(e,t,l)}return gi(e,t,n,r,l)}function Rc(e,t,n){var r=t.pendingProps,l=r.children,o=e!==null?e.memoizedState:null;if(r.mode==="hidden")if((t.mode&1)===0)t.memoizedState={baseLanes:0,cachePool:null,transitions:null},I(fn,ye),ye|=n;else{if((n&1073741824)===0)return e=o!==null?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,I(fn,ye),ye|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,I(fn,ye),ye|=r}else o!==null?(r=o.baseLanes|n,t.memoizedState=null):r=n,I(fn,ye),ye|=r;return ae(e,t,l,n),t.child}function zc(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function gi(e,t,n,r,l){var o=he(n)?Bt:ie.current;return o=Sn(t,o),hn(t,l),n=lu(e,t,n,r,o,l),r=ou(),e!==null&&!me?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,st(e,t,l)):(j&&r&&Ki(t),t.flags|=1,ae(e,t,n,l),t.child)}function Ks(e,t,n,r,l){if(he(n)){var o=!0;wl(t)}else o=!1;if(hn(t,l),t.stateNode===null)il(e,t),Pc(t,n,r),vi(t,n,r,l),r=!0;else if(e===null){var i=t.stateNode,u=t.memoizedProps;i.props=u;var s=i.context,a=n.contextType;typeof a=="object"&&a!==null?a=Me(a):(a=he(n)?Bt:ie.current,a=Sn(t,a));var p=n.getDerivedStateFromProps,m=typeof p=="function"||typeof i.getSnapshotBeforeUpdate=="function";m||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(u!==r||s!==a)&&Vs(t,i,r,a),mt=!1;var v=t.memoizedState;i.state=v,Cl(t,r,i,l),s=t.memoizedState,u!==r||v!==s||ve.current||mt?(typeof p=="function"&&(mi(t,n,p,r),s=t.memoizedState),(u=mt||js(t,n,u,r,v,s,a))?(m||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=s),i.props=r,i.state=s,i.context=a,r=u):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,uc(e,t),u=t.memoizedProps,a=t.type===t.elementType?u:Fe(t.type,u),i.props=a,m=t.pendingProps,v=i.context,s=n.contextType,typeof s=="object"&&s!==null?s=Me(s):(s=he(n)?Bt:ie.current,s=Sn(t,s));var y=n.getDerivedStateFromProps;(p=typeof y=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(u!==m||v!==s)&&Vs(t,i,r,s),mt=!1,v=t.memoizedState,i.state=v,Cl(t,r,i,l);var w=t.memoizedState;u!==m||v!==w||ve.current||mt?(typeof y=="function"&&(mi(t,n,y,r),w=t.memoizedState),(a=mt||js(t,n,a,r,v,w,s)||!1)?(p||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,w,s),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,w,s)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||u===e.memoizedProps&&v===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||u===e.memoizedProps&&v===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=w),i.props=r,i.state=w,i.context=s,r=a):(typeof i.componentDidUpdate!="function"||u===e.memoizedProps&&v===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||u===e.memoizedProps&&v===e.memoizedState||(t.flags|=1024),r=!1)}return yi(e,t,n,r,o,l)}function yi(e,t,n,r,l,o){zc(e,t);var i=(t.flags&128)!==0;if(!r&&!i)return l&&Ms(t,n,!1),st(e,t,o);r=t.stateNode,Dp.current=t;var u=i&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&i?(t.child=kn(t,e.child,null,o),t.child=kn(t,null,u,o)):ae(e,t,u,o),t.memoizedState=r.state,l&&Ms(t,n,!0),t.child}function Dc(e){var t=e.stateNode;t.pendingContext?Os(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Os(e,t.context,!1),eu(e,t.containerInfo)}function Gs(e,t,n,r,l){return wn(),Xi(l),t.flags|=256,ae(e,t,n,r),t.child}var Si={dehydrated:null,treeContext:null,retryLane:0};function wi(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ic(e,t,n){var r=t.pendingProps,l=V.current,o=!1,i=(t.flags&128)!==0,u;if((u=i)||(u=e!==null&&e.memoizedState===null?!1:(l&2)!==0),u?(o=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(l|=1),I(V,l&1),e===null)return di(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((t.mode&1)===0?t.lanes=1:e.data==="$!"?t.lanes=8:t.lanes=1073741824,null):(i=r.children,e=r.fallback,o?(r=t.mode,o=t.child,i={mode:"hidden",children:i},(r&1)===0&&o!==null?(o.childLanes=0,o.pendingProps=i):o=$l(i,r,0,null),e=Vt(e,r,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=wi(n),t.memoizedState=Si,e):su(t,i));if(l=e.memoizedState,l!==null&&(u=l.dehydrated,u!==null))return Ip(e,t,i,r,u,l,n);if(o){o=r.fallback,i=t.mode,l=e.child,u=l.sibling;var s={mode:"hidden",children:r.children};return(i&1)===0&&t.child!==l?(r=t.child,r.childLanes=0,r.pendingProps=s,t.deletions=null):(r=Nt(l,s),r.subtreeFlags=l.subtreeFlags&14680064),u!==null?o=Nt(u,o):(o=Vt(o,i,n,null),o.flags|=2),o.return=t,r.return=t,r.sibling=o,t.child=r,r=o,o=t.child,i=e.child.memoizedState,i=i===null?wi(n):{baseLanes:i.baseLanes|n,cachePool:null,transitions:i.transitions},o.memoizedState=i,o.childLanes=e.childLanes&~n,t.memoizedState=Si,r}return o=e.child,e=o.sibling,r=Nt(o,{mode:"visible",children:r.children}),(t.mode&1)===0&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function su(e,t){return t=$l({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Jr(e,t,n,r){return r!==null&&Xi(r),kn(t,e.child,null,n),e=su(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Ip(e,t,n,r,l,o,i){if(n)return t.flags&256?(t.flags&=-257,r=Do(Error(h(422))),Jr(e,t,i,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=r.fallback,l=t.mode,r=$l({mode:"visible",children:r.children},l,0,null),o=Vt(o,l,i,null),o.flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,(t.mode&1)!==0&&kn(t,e.child,null,i),t.child.memoizedState=wi(i),t.memoizedState=Si,o);if((t.mode&1)===0)return Jr(e,t,i,null);if(l.data==="$!"){if(r=l.nextSibling&&l.nextSibling.dataset,r)var u=r.dgst;return r=u,o=Error(h(419)),r=Do(o,r,void 0),Jr(e,t,i,r)}if(u=(i&e.childLanes)!==0,me||u){if(r=q,r!==null){switch(i&-i){case 4:l=2;break;case 16:l=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:l=32;break;case 536870912:l=268435456;break;default:l=0}l=(l&(r.suspendedLanes|i))!==0?0:l,l!==0&&l!==o.retryLane&&(o.retryLane=l,ut(e,l),He(r,e,l,-1))}return mu(),r=Do(Error(h(421))),Jr(e,t,i,r)}return l.data==="$?"?(t.flags|=128,t.child=e.child,t=Xp.bind(null,e),l._reactRetry=t,null):(e=o.treeContext,Se=Et(l.nextSibling),we=t,j=!0,Ve=null,e!==null&&(Te[Pe++]=nt,Te[Pe++]=rt,Te[Pe++]=Ht,nt=e.id,rt=e.overflow,Ht=t),t=su(t,r.children),t.flags|=4096,t)}function Xs(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),pi(e.return,t,n)}function Io(e,t,n,r,l){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:l}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=l)}function Ac(e,t,n){var r=t.pendingProps,l=r.revealOrder,o=r.tail;if(ae(e,t,r.children,n),r=V.current,(r&2)!==0)r=r&1|2,t.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Xs(e,n,t);else if(e.tag===19)Xs(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(I(V,r),(t.mode&1)===0)t.memoizedState=null;else switch(l){case"forwards":for(n=t.child,l=null;n!==null;)e=n.alternate,e!==null&&Nl(e)===null&&(l=n),n=n.sibling;n=l,n===null?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),Io(t,!1,l,n,o);break;case"backwards":for(n=null,l=t.child,t.child=null;l!==null;){if(e=l.alternate,e!==null&&Nl(e)===null){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}Io(t,!0,n,null,o);break;case"together":Io(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function il(e,t){(t.mode&1)===0&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function st(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),$t|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(h(153));if(t.child!==null){for(e=t.child,n=Nt(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Nt(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Ap(e,t,n){switch(t.tag){case 3:Dc(t),wn();break;case 5:sc(t);break;case 1:he(t.type)&&wl(t);break;case 4:eu(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,l=t.memoizedProps.value;I(_l,r._currentValue),r._currentValue=l;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(I(V,V.current&1),t.flags|=128,null):(n&t.child.childLanes)!==0?Ic(e,t,n):(I(V,V.current&1),e=st(e,t,n),e!==null?e.sibling:null);I(V,V.current&1);break;case 19:if(r=(n&t.childLanes)!==0,(e.flags&128)!==0){if(r)return Ac(e,t,n);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),I(V,V.current),r)break;return null;case 22:case 23:return t.lanes=0,Rc(e,t,n)}return st(e,t,n)}var Uc,ki,Fc,jc;Uc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};ki=function(){};Fc=function(e,t,n,r){var l=e.memoizedProps;if(l!==r){e=t.stateNode,Ft(Je.current);var o=null;switch(n){case"input":l=Wo(e,l),r=Wo(e,r),o=[];break;case"select":l=H({},l,{value:void 0}),r=H({},r,{value:void 0}),o=[];break;case"textarea":l=Ko(e,l),r=Ko(e,r),o=[];break;default:typeof l.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=yl)}Xo(n,r);var i;n=null;for(a in l)if(!r.hasOwnProperty(a)&&l.hasOwnProperty(a)&&l[a]!=null)if(a==="style"){var u=l[a];for(i in u)u.hasOwnProperty(i)&&(n||(n={}),n[i]="")}else a!=="dangerouslySetInnerHTML"&&a!=="children"&&a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&a!=="autoFocus"&&(lr.hasOwnProperty(a)?o||(o=[]):(o=o||[]).push(a,null));for(a in r){var s=r[a];if(u=l?.[a],r.hasOwnProperty(a)&&s!==u&&(s!=null||u!=null))if(a==="style")if(u){for(i in u)!u.hasOwnProperty(i)||s&&s.hasOwnProperty(i)||(n||(n={}),n[i]="");for(i in s)s.hasOwnProperty(i)&&u[i]!==s[i]&&(n||(n={}),n[i]=s[i])}else n||(o||(o=[]),o.push(a,n)),n=s;else a==="dangerouslySetInnerHTML"?(s=s?s.__html:void 0,u=u?u.__html:void 0,s!=null&&u!==s&&(o=o||[]).push(a,s)):a==="children"?typeof s!="string"&&typeof s!="number"||(o=o||[]).push(a,""+s):a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&(lr.hasOwnProperty(a)?(s!=null&&a==="onScroll"&&A("scroll",e),o||u===s||(o=[])):(o=o||[]).push(a,s))}n&&(o=o||[]).push("style",n);var a=o;(t.updateQueue=a)&&(t.flags|=4)}};jc=function(e,t,n,r){n!==r&&(t.flags|=4)};function Hn(e,t){if(!j)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function le(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags&14680064,r|=l.flags&14680064,l.return=e,l=l.sibling;else for(l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags,r|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Up(e,t,n){var r=t.pendingProps;switch(Gi(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return le(t),null;case 1:return he(t.type)&&Sl(),le(t),null;case 3:return r=t.stateNode,En(),U(ve),U(ie),nu(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Yr(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Ve!==null&&(Li(Ve),Ve=null))),ki(e,t),le(t),null;case 5:tu(t);var l=Ft(hr.current);if(n=t.type,e!==null&&t.stateNode!=null)Fc(e,t,n,r,l),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(h(166));return le(t),null}if(e=Ft(Je.current),Yr(t)){r=t.stateNode,n=t.type;var o=t.memoizedProps;switch(r[Ye]=t,r[mr]=o,e=(t.mode&1)!==0,n){case"dialog":A("cancel",r),A("close",r);break;case"iframe":case"object":case"embed":A("load",r);break;case"video":case"audio":for(l=0;l<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[Ye]=t,e[mr]=r,Uc(e,t,!1,!1),t.stateNode=e;e:{switch(i=Yo(n,r),n){case"dialog":A("cancel",e),A("close",e),l=r;break;case"iframe":case"object":case"embed":A("load",e),l=r;break;case"video":case"audio":for(l=0;lxn&&(t.flags|=128,r=!0,Hn(o,!1),t.lanes=4194304)}else{if(!r)if(e=Nl(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Hn(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!j)return le(t),null}else 2*Q()-o.renderingStartTime>xn&&n!==1073741824&&(t.flags|=128,r=!0,Hn(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(n=o.last,n!==null?n.sibling=i:t.child=i,o.last=i)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Q(),t.sibling=null,n=V.current,I(V,r?n&1|2:n&1),t):(le(t),null);case 22:case 23:return pu(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(ye&1073741824)!==0&&(le(t),t.subtreeFlags&6&&(t.flags|=8192)):le(t),null;case 24:return null;case 25:return null}throw Error(h(156,t.tag))}function Fp(e,t){switch(Gi(t),t.tag){case 1:return he(t.type)&&Sl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return En(),U(ve),U(ie),nu(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return tu(t),null;case 13:if(U(V),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(h(340));wn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return U(V),null;case 4:return En(),null;case 10:return Ji(t.type._context),null;case 22:case 23:return pu(),null;case 24:return null;default:return null}}var qr=!1,oe=!1,jp=typeof WeakSet=="function"?WeakSet:Set,k=null;function cn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){$(e,t,r)}else n.current=null}function Ei(e,t,n){try{n()}catch(r){$(e,t,r)}}var Ys=!1;function Vp(e,t){if(oi=vl,e=$a(),Qi(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var i=0,u=-1,s=-1,a=0,p=0,m=e,v=null;t:for(;;){for(var y;m!==n||l!==0&&m.nodeType!==3||(u=i+l),m!==o||r!==0&&m.nodeType!==3||(s=i+r),m.nodeType===3&&(i+=m.nodeValue.length),(y=m.firstChild)!==null;)v=m,m=y;for(;;){if(m===e)break t;if(v===n&&++a===l&&(u=i),v===o&&++p===r&&(s=i),(y=m.nextSibling)!==null)break;m=v,v=m.parentNode}m=y}n=u===-1||s===-1?null:{start:u,end:s}}else n=null}n=n||{start:0,end:0}}else n=null;for(ii={focusedElem:e,selectionRange:n},vl=!1,k=t;k!==null;)if(t=k,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,k=e;else for(;k!==null;){t=k;try{var w=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(w!==null){var S=w.memoizedProps,z=w.memoizedState,f=t.stateNode,c=f.getSnapshotBeforeUpdate(t.elementType===t.type?S:Fe(t.type,S),z);f.__reactInternalSnapshotBeforeUpdate=c}break;case 3:var d=t.stateNode.containerInfo;d.nodeType===1?d.textContent="":d.nodeType===9&&d.documentElement&&d.removeChild(d.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(h(163))}}catch(g){$(t,t.return,g)}if(e=t.sibling,e!==null){e.return=t.return,k=e;break}k=t.return}return w=Ys,Ys=!1,w}function tr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var o=l.destroy;l.destroy=void 0,o!==void 0&&Ei(t,n,o)}l=l.next}while(l!==r)}}function Hl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function _i(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Vc(e){var t=e.alternate;t!==null&&(e.alternate=null,Vc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ye],delete t[mr],delete t[ai],delete t[Ep],delete t[_p])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Bc(e){return e.tag===5||e.tag===3||e.tag===4}function Zs(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Bc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function xi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=yl));else if(r!==4&&(e=e.child,e!==null))for(xi(e,t,n),e=e.sibling;e!==null;)xi(e,t,n),e=e.sibling}function Ci(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Ci(e,t,n),e=e.sibling;e!==null;)Ci(e,t,n),e=e.sibling}var b=null,je=!1;function dt(e,t,n){for(n=n.child;n!==null;)Hc(e,t,n),n=n.sibling}function Hc(e,t,n){if(Ze&&typeof Ze.onCommitFiberUnmount=="function")try{Ze.onCommitFiberUnmount(Dl,n)}catch{}switch(n.tag){case 5:oe||cn(n,t);case 6:var r=b,l=je;b=null,dt(e,t,n),b=r,je=l,b!==null&&(je?(e=b,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):b.removeChild(n.stateNode));break;case 18:b!==null&&(je?(e=b,n=n.stateNode,e.nodeType===8?Po(e.parentNode,n):e.nodeType===1&&Po(e,n),ar(e)):Po(b,n.stateNode));break;case 4:r=b,l=je,b=n.stateNode.containerInfo,je=!0,dt(e,t,n),b=r,je=l;break;case 0:case 11:case 14:case 15:if(!oe&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var o=l,i=o.destroy;o=o.tag,i!==void 0&&((o&2)!==0||(o&4)!==0)&&Ei(n,t,i),l=l.next}while(l!==r)}dt(e,t,n);break;case 1:if(!oe&&(cn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){$(n,t,u)}dt(e,t,n);break;case 21:dt(e,t,n);break;case 22:n.mode&1?(oe=(r=oe)||n.memoizedState!==null,dt(e,t,n),oe=r):dt(e,t,n);break;default:dt(e,t,n)}}function Js(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new jp),t.forEach(function(r){var l=Yp.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Ue(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=i),r&=~o}if(r=l,r=Q()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Hp(r/1960))-r,10e?16:e,yt===null)var r=!1;else{if(e=yt,yt=null,Ml=0,(M&6)!==0)throw Error(h(331));var l=M;for(M|=4,k=e.current;k!==null;){var o=k,i=o.child;if((k.flags&16)!==0){var u=o.deletions;if(u!==null){for(var s=0;sQ()-fu?jt(e,0):cu|=n),ge(e,t)}function Zc(e,t){t===0&&((e.mode&1)===0?t=1:(t=jr,jr<<=1,(jr&130023424)===0&&(jr=4194304)));var n=ce();e=ut(e,t),e!==null&&(kr(e,t,n),ge(e,n))}function Xp(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Zc(e,n)}function Yp(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(h(314))}r!==null&&r.delete(t),Zc(e,n)}var Jc;Jc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ve.current)me=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return me=!1,Ap(e,t,n);me=(e.flags&131072)!==0}else me=!1,j&&(t.flags&1048576)!==0&&tc(t,El,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;il(e,t),e=t.pendingProps;var l=Sn(t,ie.current);hn(t,n),l=lu(null,t,r,e,l,n);var o=ou();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,he(r)?(o=!0,wl(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,bi(t),l.updater=Bl,t.stateNode=l,l._reactInternals=t,vi(t,r,e,n),t=yi(null,t,r,!0,o,n)):(t.tag=0,j&&o&&Ki(t),ae(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(il(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Jp(r),e=Fe(r,e),l){case 0:t=gi(null,t,r,e,n);break e;case 1:t=Ks(null,t,r,e,n);break e;case 11:t=$s(null,t,r,e,n);break e;case 14:t=Qs(null,t,r,Fe(r.type,e),n);break e}throw Error(h(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Fe(r,l),gi(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Fe(r,l),Ks(e,t,r,l,n);case 3:e:{if(Dc(t),e===null)throw Error(h(387));r=t.pendingProps,o=t.memoizedState,l=o.element,uc(e,t),Cl(t,r,null,n);var i=t.memoizedState;if(r=i.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){l=_n(Error(h(423)),t),t=Gs(e,t,r,n,l);break e}else if(r!==l){l=_n(Error(h(424)),t),t=Gs(e,t,r,n,l);break e}else for(Se=Et(t.stateNode.containerInfo.firstChild),we=t,j=!0,Ve=null,n=oc(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(wn(),r===l){t=st(e,t,n);break e}ae(e,t,r,n)}t=t.child}return t;case 5:return sc(t),e===null&&di(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,i=l.children,ui(r,l)?i=null:o!==null&&ui(r,o)&&(t.flags|=32),zc(e,t),ae(e,t,i,n),t.child;case 6:return e===null&&di(t),null;case 13:return Ic(e,t,n);case 4:return eu(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=kn(t,null,r,n):ae(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Fe(r,l),$s(e,t,r,l,n);case 7:return ae(e,t,t.pendingProps,n),t.child;case 8:return ae(e,t,t.pendingProps.children,n),t.child;case 12:return ae(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,o=t.memoizedProps,i=l.value,I(_l,r._currentValue),r._currentValue=i,o!==null)if(We(o.value,i)){if(o.children===l.children&&!ve.current){t=st(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var u=o.dependencies;if(u!==null){i=o.child;for(var s=u.firstContext;s!==null;){if(s.context===r){if(o.tag===1){s=lt(-1,n&-n),s.tag=2;var a=o.updateQueue;if(a!==null){a=a.shared;var p=a.pending;p===null?s.next=s:(s.next=p.next,p.next=s),a.pending=s}}o.lanes|=n,s=o.alternate,s!==null&&(s.lanes|=n),pi(o.return,n,t),u.lanes|=n;break}s=s.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(h(341));i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),pi(i,n,t),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===t){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}ae(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,hn(t,n),l=Me(l),r=r(l),t.flags|=1,ae(e,t,r,n),t.child;case 14:return r=t.type,l=Fe(r,t.pendingProps),l=Fe(r.type,l),Qs(e,t,r,l,n);case 15:return Mc(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Fe(r,l),il(e,t),t.tag=1,he(r)?(e=!0,wl(t)):e=!1,hn(t,n),Pc(t,r,l),vi(t,r,l,n),yi(null,t,r,!0,e,n);case 19:return Ac(e,t,n);case 22:return Rc(e,t,n)}throw Error(h(156,t.tag))};function qc(e,t){return Ca(e,t)}function Zp(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Le(e,t,n,r){return new Zp(e,t,n,r)}function vu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Jp(e){if(typeof e=="function")return vu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Di)return 11;if(e===Ii)return 14}return 2}function Nt(e,t){var n=e.alternate;return n===null?(n=Le(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function al(e,t,n,r,l,o){var i=2;if(r=e,typeof e=="function")vu(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case en:return Vt(n.children,l,o,t);case zi:i=8,l|=8;break;case jo:return e=Le(12,n,t,l|2),e.elementType=jo,e.lanes=o,e;case Vo:return e=Le(13,n,t,l),e.elementType=Vo,e.lanes=o,e;case Bo:return e=Le(19,n,t,l),e.elementType=Bo,e.lanes=o,e;case sa:return $l(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ia:i=10;break e;case ua:i=9;break e;case Di:i=11;break e;case Ii:i=14;break e;case pt:i=16,r=null;break e}throw Error(h(130,e==null?e:typeof e,""))}return t=Le(i,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function Vt(e,t,n,r){return e=Le(7,e,r,t),e.lanes=n,e}function $l(e,t,n,r){return e=Le(22,e,r,t),e.elementType=sa,e.lanes=n,e.stateNode={isHidden:!1},e}function Ao(e,t,n){return e=Le(6,e,null,t),e.lanes=n,e}function Uo(e,t,n){return t=Le(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function qp(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=wo(0),this.expirationTimes=wo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=wo(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function hu(e,t,n,r,l,o,i,u,s){return e=new qp(e,t,n,u,s),t===1?(t=1,o===!0&&(t|=8)):t=0,o=Le(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},bi(o),e}function bp(e,t,n){var r=3{"use strict";function rf(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(rf)}catch(e){console.error(e)}}rf(),lf.exports=nf()});var sf=be(wu=>{"use strict";var uf=of();wu.createRoot=uf.createRoot,wu.hydrateRoot=uf.hydrateRoot;var Sm});var cf=be(Yl=>{"use strict";var lm=de(),om=Symbol.for("react.element"),im=Symbol.for("react.fragment"),um=Object.prototype.hasOwnProperty,sm=lm.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,am={key:!0,ref:!0,__self:!0,__source:!0};function af(e,t,n){var r,l={},o=null,i=null;n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(i=t.ref);for(r in t)um.call(t,r)&&!am.hasOwnProperty(r)&&(l[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)l[r]===void 0&&(l[r]=t[r]);return{$$typeof:om,type:e,key:o,ref:i,props:l,_owner:sm.current}}Yl.Fragment=im;Yl.jsx=af;Yl.jsxs=af});var W=be((Em,ff)=>{"use strict";ff.exports=cf()});var zf=L(sf(),1);var ue=L(de(),1);var Z=L(W(),1);function df({preference:e,onThemeChange:t}){let n=()=>{let o=["system","light","dark"],u=(o.indexOf(e)+1)%o.length;t(o[u])},r=()=>{switch(e){case"light":return(0,Z.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Z.jsx)("circle",{cx:"12",cy:"12",r:"5"}),(0,Z.jsx)("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),(0,Z.jsx)("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),(0,Z.jsx)("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),(0,Z.jsx)("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),(0,Z.jsx)("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),(0,Z.jsx)("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),(0,Z.jsx)("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),(0,Z.jsx)("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]});case"dark":return(0,Z.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,Z.jsx)("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})});case"system":default:return(0,Z.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Z.jsx)("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),(0,Z.jsx)("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),(0,Z.jsx)("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]})}},l=()=>{switch(e){case"light":return"Theme: Light (click for Dark)";case"dark":return"Theme: Dark (click for System)";case"system":default:return"Theme: System (click for Light)"}};return(0,Z.jsx)("button",{className:"theme-toggle-btn",onClick:n,title:l(),"aria-label":l(),children:r()})}var F=L(W(),1);function pf({isConnected:e,projects:t,currentFilter:n,onFilterChange:r,onSettingsToggle:l,sidebarOpen:o,isProcessing:i,themePreference:u,onThemeChange:s}){return(0,F.jsxs)("div",{className:"header",children:[(0,F.jsxs)("h1",{children:[(0,F.jsx)("img",{src:"claude-mem-logomark.webp",alt:"",className:`logomark ${i?"spinning":""}`}),(0,F.jsx)("span",{className:"logo-text",children:"claude-mem"})]}),(0,F.jsxs)("div",{className:"status",children:[(0,F.jsx)("a",{href:"https://docs.claude-mem.ai",target:"_blank",rel:"noopener noreferrer",title:"Documentation",style:{display:"block",padding:"8px 4px 8px 8px",color:"#a0a0a0",transition:"color 0.2s",lineHeight:0},onMouseEnter:a=>a.currentTarget.style.color="#606060",onMouseLeave:a=>a.currentTarget.style.color="#a0a0a0",children:(0,F.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,F.jsx)("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20"}),(0,F.jsx)("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"})]})}),(0,F.jsx)("a",{href:"https://github.com/thedotmack/claude-mem/",target:"_blank",rel:"noopener noreferrer",title:"GitHub",style:{display:"block",padding:"8px 4px",color:"#a0a0a0",transition:"color 0.2s",lineHeight:0},onMouseEnter:a=>a.currentTarget.style.color="#606060",onMouseLeave:a=>a.currentTarget.style.color="#a0a0a0",children:(0,F.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:(0,F.jsx)("path",{d:"M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"})})}),(0,F.jsx)("a",{href:"https://x.com/Claude_Memory",target:"_blank",rel:"noopener noreferrer",title:"X (Twitter)",style:{display:"block",padding:"8px 8px 8px 4px",color:"#a0a0a0",transition:"color 0.2s",lineHeight:0},onMouseEnter:a=>a.currentTarget.style.color="#606060",onMouseLeave:a=>a.currentTarget.style.color="#a0a0a0",children:(0,F.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:(0,F.jsx)("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})})}),(0,F.jsxs)("select",{value:n,onChange:a=>r(a.target.value),children:[(0,F.jsx)("option",{value:"",children:"All Projects"}),t.map(a=>(0,F.jsx)("option",{value:a,children:a},a))]}),(0,F.jsx)(df,{preference:u,onThemeChange:s}),(0,F.jsx)("button",{className:`settings-btn ${o?"active":""}`,onClick:l,title:"Settings",children:(0,F.jsxs)("svg",{className:"settings-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,F.jsx)("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),(0,F.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})})]})]})}var ct=L(de(),1);var ku=L(de(),1);function Tn(e){return new Date(e).toLocaleString()}function mf(e){if(!e)return"-";let t=Math.floor(e/3600),n=Math.floor(e%3600/60);return`${t}h ${n}m`}function vf(e){return e?e<1024?e+" B":e<1024*1024?(e/1024).toFixed(1)+" KB":(e/(1024*1024)).toFixed(1)+" MB":"-"}var O=L(W(),1);function hf(e){let t=["/Scripts/","/src/","/plugin/","/docs/"];for(let l of t){let o=e.indexOf(l);if(o!==-1)return e.substring(o+1)}let n=e.indexOf("claude-mem/");if(n!==-1)return e.substring(n+11);let r=e.split("/");return r.length>3?r.slice(-3).join("/"):e}function gf({observation:e}){let[t,n]=(0,ku.useState)(!1),[r,l]=(0,ku.useState)(!1),o=Tn(e.created_at_epoch),i=e.facts?JSON.parse(e.facts):[],u=e.concepts?JSON.parse(e.concepts):[],s=e.files_read?JSON.parse(e.files_read).map(hf):[],a=e.files_modified?JSON.parse(e.files_modified).map(hf):[],p=i.length>0||u.length>0||s.length>0||a.length>0;return(0,O.jsxs)("div",{className:"card",children:[(0,O.jsxs)("div",{className:"card-header",children:[(0,O.jsxs)("div",{className:"card-header-left",children:[(0,O.jsx)("span",{className:`card-type type-${e.type}`,children:e.type}),(0,O.jsx)("span",{className:"card-project",children:e.project})]}),(0,O.jsxs)("div",{className:"view-mode-toggles",children:[p&&(0,O.jsxs)("button",{className:`view-mode-toggle ${t?"active":""}`,onClick:()=>{n(!t),t||l(!1)},children:[(0,O.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,O.jsx)("polyline",{points:"9 11 12 14 22 4"}),(0,O.jsx)("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]}),(0,O.jsx)("span",{children:"facts"})]}),e.narrative&&(0,O.jsxs)("button",{className:`view-mode-toggle ${r?"active":""}`,onClick:()=>{l(!r),r||n(!1)},children:[(0,O.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,O.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,O.jsx)("polyline",{points:"14 2 14 8 20 8"}),(0,O.jsx)("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),(0,O.jsx)("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]}),(0,O.jsx)("span",{children:"narrative"})]})]})]}),(0,O.jsx)("div",{className:"card-title",children:e.title||"Untitled"}),(0,O.jsxs)("div",{className:"view-mode-content",children:[!t&&!r&&e.subtitle&&(0,O.jsx)("div",{className:"card-subtitle",children:e.subtitle}),t&&i.length>0&&(0,O.jsx)("ul",{className:"facts-list",children:i.map((m,v)=>(0,O.jsx)("li",{children:m},v))}),r&&e.narrative&&(0,O.jsx)("div",{className:"narrative",children:e.narrative})]}),(0,O.jsxs)("div",{className:"card-meta",children:[(0,O.jsxs)("span",{className:"meta-date",children:["#",e.id," \u2022 ",o]}),t&&(u.length>0||s.length>0||a.length>0)&&(0,O.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"},children:[u.map((m,v)=>(0,O.jsx)("span",{style:{padding:"2px 8px",background:"var(--color-type-badge-bg)",color:"var(--color-type-badge-text)",borderRadius:"3px",fontWeight:"500",fontSize:"10px"},children:m},v)),s.length>0&&(0,O.jsxs)("span",{className:"meta-files",children:[(0,O.jsx)("span",{className:"file-label",children:"read:"})," ",s.join(", ")]}),a.length>0&&(0,O.jsxs)("span",{className:"meta-files",children:[(0,O.jsx)("span",{className:"file-label",children:"modified:"})," ",a.join(", ")]})]})]})]})}var xe=L(W(),1);function yf({summary:e}){let t=Tn(e.created_at_epoch);return(0,xe.jsxs)("div",{className:"card summary-card",children:[(0,xe.jsx)("div",{className:"card-header",children:(0,xe.jsxs)("div",{className:"card-header-left",children:[(0,xe.jsx)("span",{className:"card-type",children:"SUMMARY"}),(0,xe.jsx)("span",{className:"card-project",children:e.project})]})}),e.request&&(0,xe.jsxs)("div",{className:"card-title",children:["Request: ",e.request]}),e.learned&&(0,xe.jsxs)("div",{className:"card-subtitle",children:["Learned: ",e.learned]}),e.completed&&(0,xe.jsxs)("div",{className:"card-subtitle",children:["Completed: ",e.completed]}),e.next_steps&&(0,xe.jsxs)("div",{className:"card-subtitle",children:["Next: ",e.next_steps]}),(0,xe.jsx)("div",{className:"card-meta",children:(0,xe.jsxs)("span",{className:"meta-date",children:["#",e.id," \u2022 ",t]})})]})}var qe=L(W(),1);function Sf({prompt:e}){let t=Tn(e.created_at_epoch);return(0,qe.jsxs)("div",{className:"card prompt-card",children:[(0,qe.jsx)("div",{className:"card-header",children:(0,qe.jsxs)("div",{className:"card-header-left",children:[(0,qe.jsx)("span",{className:"card-type",children:"Prompt"}),(0,qe.jsx)("span",{className:"card-project",children:e.project})]})}),(0,qe.jsx)("div",{className:"card-content",children:e.prompt_text}),(0,qe.jsx)("div",{className:"card-meta",children:(0,qe.jsxs)("span",{className:"meta-date",children:["#",e.id," \u2022 ",t]})})]})}var Jl=L(de(),1),Zl=L(W(),1);function wf({targetRef:e}){let[t,n]=(0,Jl.useState)(!1);(0,Jl.useEffect)(()=>{let l=()=>{let i=e.current;i&&n(i.scrollTop>300)},o=e.current;if(o)return o.addEventListener("scroll",l),()=>o.removeEventListener("scroll",l)},[]);let r=()=>{let l=e.current;l&&l.scrollTo({top:0,behavior:"smooth"})};return t?(0,Zl.jsx)("button",{onClick:r,className:"scroll-to-top","aria-label":"Scroll to top",children:(0,Zl.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,Zl.jsx)("polyline",{points:"18 15 12 9 6 15"})})}):null}var Cr={PAGINATION_PAGE_SIZE:50,LOAD_MORE_THRESHOLD:.1};var Ce=L(W(),1);function kf({observations:e,summaries:t,prompts:n,onLoadMore:r,isLoading:l,hasMore:o}){let i=(0,ct.useRef)(null),u=(0,ct.useRef)(null),s=(0,ct.useRef)(r);(0,ct.useEffect)(()=>{s.current=r},[r]),(0,ct.useEffect)(()=>{let p=i.current;if(!p)return;let m=new IntersectionObserver(v=>{v[0].isIntersecting&&o&&!l&&s.current?.()},{threshold:Cr.LOAD_MORE_THRESHOLD});return m.observe(p),()=>{p&&m.unobserve(p),m.disconnect()}},[o,l]);let a=(0,ct.useMemo)(()=>[...e.map(m=>({...m,itemType:"observation"})),...t.map(m=>({...m,itemType:"summary"})),...n.map(m=>({...m,itemType:"prompt"}))].sort((m,v)=>v.created_at_epoch-m.created_at_epoch),[e,t,n]);return(0,Ce.jsxs)("div",{className:"feed",ref:u,children:[(0,Ce.jsx)(wf,{targetRef:u}),(0,Ce.jsxs)("div",{className:"feed-content",children:[a.map(p=>{let m=`${p.itemType}-${p.id}`;return p.itemType==="observation"?(0,Ce.jsx)(gf,{observation:p},m):p.itemType==="summary"?(0,Ce.jsx)(yf,{summary:p},m):(0,Ce.jsx)(Sf,{prompt:p},m)}),a.length===0&&!l&&(0,Ce.jsx)("div",{style:{textAlign:"center",padding:"40px",color:"#8b949e"},children:"No items to display"}),l&&(0,Ce.jsxs)("div",{style:{textAlign:"center",padding:"20px",color:"#8b949e"},children:[(0,Ce.jsx)("div",{className:"spinner",style:{display:"inline-block",marginRight:"10px"}}),"Loading more..."]}),o&&!l&&a.length>0&&(0,Ce.jsx)("div",{ref:i,style:{height:"20px",margin:"10px 0"}}),!o&&a.length>0&&(0,Ce.jsx)("div",{style:{textAlign:"center",padding:"20px",color:"#8b949e",fontSize:"14px"},children:"No more items to load"})]})]})}var Pn=L(de(),1);var ze={CLAUDE_MEM_MODEL:"claude-haiku-4-5",CLAUDE_MEM_CONTEXT_OBSERVATIONS:"50",CLAUDE_MEM_WORKER_PORT:"37777"};var E=L(W(),1);function Ef({isOpen:e,settings:t,stats:n,isSaving:r,saveStatus:l,isConnected:o,onSave:i,onClose:u}){let[s,a]=(0,Pn.useState)(t.CLAUDE_MEM_MODEL||ze.CLAUDE_MEM_MODEL),[p,m]=(0,Pn.useState)(t.CLAUDE_MEM_CONTEXT_OBSERVATIONS||ze.CLAUDE_MEM_CONTEXT_OBSERVATIONS),[v,y]=(0,Pn.useState)(t.CLAUDE_MEM_WORKER_PORT||ze.CLAUDE_MEM_WORKER_PORT);return(0,Pn.useEffect)(()=>{a(t.CLAUDE_MEM_MODEL||ze.CLAUDE_MEM_MODEL),m(t.CLAUDE_MEM_CONTEXT_OBSERVATIONS||ze.CLAUDE_MEM_CONTEXT_OBSERVATIONS),y(t.CLAUDE_MEM_WORKER_PORT||ze.CLAUDE_MEM_WORKER_PORT)},[t]),(0,E.jsxs)("div",{className:`sidebar ${e?"open":""}`,children:[(0,E.jsxs)("div",{className:"sidebar-header",children:[(0,E.jsx)("h1",{children:"Settings"}),(0,E.jsxs)("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[(0,E.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[(0,E.jsx)("span",{className:`status-dot ${o?"connected":""}`}),(0,E.jsx)("span",{style:{fontSize:"11px",opacity:.5,fontWeight:300},children:o?"Connected":"Disconnected"})]}),(0,E.jsx)("button",{onClick:()=>{i({CLAUDE_MEM_MODEL:s,CLAUDE_MEM_CONTEXT_OBSERVATIONS:p,CLAUDE_MEM_WORKER_PORT:v})},disabled:r,children:r?"Saving...":"Save"}),(0,E.jsx)("button",{onClick:u,title:"Close settings",style:{background:"transparent",border:"1px solid #404040",padding:"8px",width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,E.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,E.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,E.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),(0,E.jsxs)("div",{className:"stats-scroll",children:[(0,E.jsxs)("div",{className:"settings-section",children:[(0,E.jsx)("h3",{children:"Environment Variables"}),(0,E.jsxs)("div",{className:"form-group",children:[(0,E.jsx)("label",{htmlFor:"model",children:"CLAUDE_MEM_MODEL"}),(0,E.jsx)("div",{className:"setting-description",children:"Model used for AI compression of tool observations. Haiku is fast and cheap, Sonnet offers better quality, Opus is most capable but expensive."}),(0,E.jsxs)("select",{id:"model",value:s,onChange:S=>a(S.target.value),children:[(0,E.jsx)("option",{value:"claude-haiku-4-5",children:"claude-haiku-4-5"}),(0,E.jsx)("option",{value:"claude-sonnet-4-5",children:"claude-sonnet-4-5"}),(0,E.jsx)("option",{value:"claude-opus-4",children:"claude-opus-4"})]})]}),(0,E.jsxs)("div",{className:"form-group",children:[(0,E.jsx)("label",{htmlFor:"contextObs",children:"CLAUDE_MEM_CONTEXT_OBSERVATIONS"}),(0,E.jsx)("div",{className:"setting-description",children:"Number of recent observations to inject at session start. Higher values provide more context but increase token usage. Default: 50"}),(0,E.jsx)("input",{type:"number",id:"contextObs",min:"1",max:"200",value:p,onChange:S=>m(S.target.value)})]}),(0,E.jsxs)("div",{className:"form-group",children:[(0,E.jsx)("label",{htmlFor:"workerPort",children:"CLAUDE_MEM_WORKER_PORT"}),(0,E.jsx)("div",{className:"setting-description",children:"Port number for the background worker service. Change only if port 37777 conflicts with another service."}),(0,E.jsx)("input",{type:"number",id:"workerPort",min:"1024",max:"65535",value:v,onChange:S=>y(S.target.value)})]}),l&&(0,E.jsx)("div",{className:"save-status",children:l})]}),(0,E.jsxs)("div",{className:"settings-section",children:[(0,E.jsx)("h3",{children:"Worker Stats"}),(0,E.jsxs)("div",{className:"stats-grid",children:[(0,E.jsxs)("div",{className:"stat",children:[(0,E.jsx)("div",{className:"stat-label",children:"Version"}),(0,E.jsx)("div",{className:"stat-value",children:n.worker?.version||"-"})]}),(0,E.jsxs)("div",{className:"stat",children:[(0,E.jsx)("div",{className:"stat-label",children:"Uptime"}),(0,E.jsx)("div",{className:"stat-value",children:mf(n.worker?.uptime)})]}),(0,E.jsxs)("div",{className:"stat",children:[(0,E.jsx)("div",{className:"stat-label",children:"Active Sessions"}),(0,E.jsx)("div",{className:"stat-value",children:n.worker?.activeSessions||"0"})]}),(0,E.jsxs)("div",{className:"stat",children:[(0,E.jsx)("div",{className:"stat-label",children:"SSE Clients"}),(0,E.jsx)("div",{className:"stat-value",children:n.worker?.sseClients||"0"})]})]})]}),(0,E.jsxs)("div",{className:"settings-section",children:[(0,E.jsx)("h3",{children:"Database Stats"}),(0,E.jsxs)("div",{className:"stats-grid",children:[(0,E.jsxs)("div",{className:"stat",children:[(0,E.jsx)("div",{className:"stat-label",children:"DB Size"}),(0,E.jsx)("div",{className:"stat-value",children:vf(n.database?.size)})]}),(0,E.jsxs)("div",{className:"stat",children:[(0,E.jsx)("div",{className:"stat-label",children:"Observations"}),(0,E.jsx)("div",{className:"stat-value",children:n.database?.observations||"0"})]}),(0,E.jsxs)("div",{className:"stat",children:[(0,E.jsx)("div",{className:"stat-label",children:"Sessions"}),(0,E.jsx)("div",{className:"stat-value",children:n.database?.sessions||"0"})]}),(0,E.jsxs)("div",{className:"stat",children:[(0,E.jsx)("div",{className:"stat-label",children:"Summaries"}),(0,E.jsx)("div",{className:"stat-value",children:n.database?.summaries||"0"})]})]})]})]})]})}var De=L(de(),1);var $e={OBSERVATIONS:"/api/observations",SUMMARIES:"/api/summaries",PROMPTS:"/api/prompts",SETTINGS:"/api/settings",STATS:"/api/stats",PROCESSING_STATUS:"/api/processing-status",STREAM:"/stream"};var Ln={SSE_RECONNECT_DELAY_MS:3e3,STATS_REFRESH_INTERVAL_MS:1e4,SAVE_STATUS_DISPLAY_DURATION_MS:3e3};function _f(){let[e,t]=(0,De.useState)([]),[n,r]=(0,De.useState)([]),[l,o]=(0,De.useState)([]),[i,u]=(0,De.useState)([]),[s,a]=(0,De.useState)(!1),[p,m]=(0,De.useState)(!1),v=(0,De.useRef)(null),y=(0,De.useRef)();return(0,De.useEffect)(()=>{let w=()=>{v.current&&v.current.close();let S=new EventSource($e.STREAM);v.current=S,S.onopen=()=>{console.log("[SSE] Connected"),a(!0),y.current&&clearTimeout(y.current)},S.onerror=z=>{console.error("[SSE] Connection error:",z),a(!1),S.close(),y.current=setTimeout(()=>{y.current=void 0,console.log("[SSE] Attempting to reconnect..."),w()},Ln.SSE_RECONNECT_DELAY_MS)},S.onmessage=z=>{try{let f=JSON.parse(z.data);switch(f.type){case"initial_load":console.log("[SSE] Initial load:",{projects:f.projects?.length||0}),u(f.projects||[]);break;case"new_observation":f.observation&&(console.log("[SSE] New observation:",f.observation.id),t(c=>[f.observation,...c]));break;case"new_summary":if(f.summary){let c=f.summary;console.log("[SSE] New summary:",c.id),r(d=>[c,...d])}break;case"new_prompt":if(f.prompt){let c=f.prompt;console.log("[SSE] New prompt:",c.id),o(d=>[c,...d])}break;case"processing_status":typeof f.isProcessing=="boolean"&&(console.log("[SSE] Processing status:",f.isProcessing),m(f.isProcessing));break}}catch(f){console.error("[SSE] Failed to parse message:",f)}}};return w(),()=>{v.current&&v.current.close(),y.current&&clearTimeout(y.current)}},[]),{observations:e,summaries:n,prompts:l,projects:i,isProcessing:p,isConnected:s}}var On=L(de(),1);function xf(){let[e,t]=(0,On.useState)(ze),[n,r]=(0,On.useState)(!1),[l,o]=(0,On.useState)("");return(0,On.useEffect)(()=>{fetch($e.SETTINGS).then(u=>u.json()).then(u=>{t({CLAUDE_MEM_MODEL:u.CLAUDE_MEM_MODEL||ze.CLAUDE_MEM_MODEL,CLAUDE_MEM_CONTEXT_OBSERVATIONS:u.CLAUDE_MEM_CONTEXT_OBSERVATIONS||ze.CLAUDE_MEM_CONTEXT_OBSERVATIONS,CLAUDE_MEM_WORKER_PORT:u.CLAUDE_MEM_WORKER_PORT||ze.CLAUDE_MEM_WORKER_PORT})}).catch(u=>{console.error("Failed to load settings:",u)})},[]),{settings:e,saveSettings:async u=>{r(!0),o("Saving...");try{let a=await(await fetch($e.SETTINGS,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)})).json();a.success?(t(u),o("\u2713 Saved"),setTimeout(()=>o(""),Ln.SAVE_STATUS_DISPLAY_DURATION_MS)):o(`\u2717 Error: ${a.error}`)}catch(s){o(`\u2717 Error: ${s instanceof Error?s.message:"Unknown error"}`)}finally{r(!1)}},isSaving:n,saveStatus:l}}var ql=L(de(),1);function Cf(){let[e,t]=(0,ql.useState)({});return(0,ql.useEffect)(()=>{let n=async()=>{try{let o=await(await fetch($e.STATS)).json();t(o)}catch(l){console.error("Failed to load stats:",l)}};n();let r=setInterval(n,Ln.STATS_REFRESH_INTERVAL_MS);return()=>clearInterval(r)},[]),{stats:e}}var Ie=L(de(),1);function Eu(e,t,n){let[r,l]=(0,Ie.useState)({isLoading:!1,hasMore:!0}),[o,i]=(0,Ie.useState)(0),u=(0,Ie.useRef)(r),s=(0,Ie.useRef)(o);(0,Ie.useEffect)(()=>{u.current=r},[r]),(0,Ie.useEffect)(()=>{s.current=o},[o]),(0,Ie.useEffect)(()=>{i(0),l({isLoading:!1,hasMore:!0})},[n]);let a=(0,Ie.useCallback)(async()=>{if(u.current.isLoading||!u.current.hasMore)return[];l(p=>({...p,isLoading:!0}));try{let p=new URLSearchParams({offset:s.current.toString(),limit:Cr.PAGINATION_PAGE_SIZE.toString()});n&&p.append("project",n);let m=await fetch(`${e}?${p}`);if(!m.ok)throw new Error(`Failed to load ${t}: ${m.statusText}`);let v=await m.json();return l(y=>({...y,isLoading:!1,hasMore:v.hasMore})),i(y=>y+Cr.PAGINATION_PAGE_SIZE),v.items}catch(p){return console.error(`Failed to load ${t}:`,p),l(m=>({...m,isLoading:!1})),[]}},[n,e,t]);return{...r,loadMore:a}}function Nf(e){let t=Eu($e.OBSERVATIONS,"observations",e),n=Eu($e.SUMMARIES,"summaries",e),r=Eu($e.PROMPTS,"prompts",e);return{observations:t,summaries:n,prompts:r}}var Mn=L(de(),1),Lf="claude-mem-theme";function cm(){return typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Tf(){try{let e=localStorage.getItem(Lf);if(e==="system"||e==="light"||e==="dark")return e}catch(e){console.warn("Failed to read theme preference from localStorage:",e)}return"system"}function Pf(e){return e==="system"?cm():e}function Of(){let[e,t]=(0,Mn.useState)(Tf),[n,r]=(0,Mn.useState)(()=>Pf(Tf()));return(0,Mn.useEffect)(()=>{let o=Pf(e);r(o),document.documentElement.setAttribute("data-theme",o)},[e]),(0,Mn.useEffect)(()=>{if(e!=="system")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),i=u=>{let s=u.matches?"dark":"light";r(s),document.documentElement.setAttribute("data-theme",s)};return o.addEventListener("change",i),()=>o.removeEventListener("change",i)},[e]),{preference:e,resolvedTheme:n,setThemePreference:o=>{try{localStorage.setItem(Lf,o),t(o)}catch(i){console.warn("Failed to save theme preference to localStorage:",i),t(o)}}}}function bl(e,t,n){let r=n?e.filter(o=>o.project===n):e,l=new Set;return[...r,...t].filter(o=>l.has(o.id)?!1:(l.add(o.id),!0))}var Xt=L(W(),1);function Mf(){let[e,t]=(0,ue.useState)(""),[n,r]=(0,ue.useState)(!1),[l,o]=(0,ue.useState)([]),[i,u]=(0,ue.useState)([]),[s,a]=(0,ue.useState)([]),{observations:p,summaries:m,prompts:v,projects:y,isProcessing:w,isConnected:S}=_f(),{settings:z,saveSettings:f,isSaving:c,saveStatus:d}=xf(),{stats:g}=Cf(),{preference:_,resolvedTheme:N,setThemePreference:C}=Of(),x=Nf(e);(0,ue.useEffect)(()=>{o([]),u([]),a([])},[e]);let K=(0,ue.useMemo)(()=>bl(p,l,e),[p,l,e]),P=(0,ue.useMemo)(()=>bl(m,i,e),[m,i,e]),Qe=(0,ue.useMemo)(()=>bl(v,s,e),[v,s,e]),Nr=(0,ue.useCallback)(()=>{r(Yt=>!Yt)},[]),xu=(0,ue.useCallback)(async()=>{try{let[Yt,Cu,Nu]=await Promise.all([x.observations.loadMore(),x.summaries.loadMore(),x.prompts.loadMore()]);Yt.length>0&&o(Rn=>[...Rn,...Yt]),Cu.length>0&&u(Rn=>[...Rn,...Cu]),Nu.length>0&&a(Rn=>[...Rn,...Nu])}catch(Yt){console.error("Failed to load more data:",Yt)}},[x.observations,x.summaries,x.prompts]);return(0,ue.useEffect)(()=>{xu()},[e]),(0,Xt.jsxs)("div",{className:"container",children:[(0,Xt.jsxs)("div",{className:"main-col",children:[(0,Xt.jsx)(pf,{isConnected:S,projects:y,currentFilter:e,onFilterChange:t,onSettingsToggle:Nr,sidebarOpen:n,isProcessing:w,themePreference:_,onThemeChange:C}),(0,Xt.jsx)(kf,{observations:K,summaries:P,prompts:Qe,onLoadMore:xu,isLoading:x.observations.isLoading||x.summaries.isLoading||x.prompts.isLoading,hasMore:x.observations.hasMore||x.summaries.hasMore||x.prompts.hasMore})]}),(0,Xt.jsx)(Ef,{isOpen:n,settings:z,stats:g,isSaving:c,saveStatus:d,isConnected:S,onSave:f,onClose:Nr})]})}var Rf=L(de(),1),Rt=L(W(),1),eo=class extends Rf.Component{constructor(t){super(t),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("[ErrorBoundary] Caught error:",t,n),this.setState({error:t,errorInfo:n})}render(){return this.state.hasError?(0,Rt.jsxs)("div",{style:{padding:"20px",color:"#ff6b6b",backgroundColor:"#1a1a1a",minHeight:"100vh"},children:[(0,Rt.jsx)("h1",{style:{fontSize:"24px",marginBottom:"10px"},children:"Something went wrong"}),(0,Rt.jsx)("p",{style:{marginBottom:"10px",color:"#8b949e"},children:"The application encountered an error. Please refresh the page to try again."}),this.state.error&&(0,Rt.jsxs)("details",{style:{marginTop:"20px",color:"#8b949e"},children:[(0,Rt.jsx)("summary",{style:{cursor:"pointer",marginBottom:"10px"},children:"Error details"}),(0,Rt.jsxs)("pre",{style:{backgroundColor:"#0d1117",padding:"10px",borderRadius:"6px",overflow:"auto"},children:[this.state.error.toString(),this.state.errorInfo&&` -`+this.state.errorInfo.componentStack]})]})]}):this.props.children}};var Eu=M(Q(),1),Mf=document.getElementById("root");if(!Mf)throw new Error("Root element not found");var sm=(0,Of.createRoot)(Mf);sm.render((0,Eu.jsx)(ql,{children:(0,Eu.jsx)(Pf,{})}));})(); +`+this.state.errorInfo.componentStack]})]})]}):this.props.children}};var _u=L(W(),1),Df=document.getElementById("root");if(!Df)throw new Error("Root element not found");var fm=(0,zf.createRoot)(Df);fm.render((0,_u.jsx)(eo,{children:(0,_u.jsx)(Mf,{})}));})(); /*! Bundled license information: react/cjs/react.production.min.js: diff --git a/plugin/ui/viewer.html b/plugin/ui/viewer.html index 218175ae..81c0cf93 100644 --- a/plugin/ui/viewer.html +++ b/plugin/ui/viewer.html @@ -871,6 +871,49 @@ background-position: -200% 0; } } + + /* Scroll to top button */ + .scroll-to-top { + position: fixed; + bottom: 24px; + right: 24px; + width: 48px; + height: 48px; + background: var(--color-bg-button); + color: var(--color-text-button); + border: none; + border-radius: 24px; + cursor: pointer; + display: flex; + align-items: center; + justify-content: center; + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); + transition: all 0.2s ease; + z-index: 50; + animation: fadeInUp 0.3s ease-out; + } + + .scroll-to-top:hover { + background: var(--color-bg-button-hover); + transform: translateY(-2px); + box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2); + } + + .scroll-to-top:active { + background: var(--color-bg-button-active); + transform: translateY(0); + } + + @keyframes fadeInUp { + from { + opacity: 0; + transform: translateY(10px); + } + to { + opacity: 1; + transform: translateY(0); + } + } diff --git a/src/services/worker/SDKAgent.ts b/src/services/worker/SDKAgent.ts index 6cb0c9ae..ed39207a 100644 --- a/src/services/worker/SDKAgent.ts +++ b/src/services/worker/SDKAgent.ts @@ -198,10 +198,17 @@ export class SDKAgent { type: 'new_observation', observation: { id: obsId, + sdk_session_id: session.sdkSessionId, session_id: session.claudeSessionId, type: obs.type, title: obs.title, subtitle: obs.subtitle, + text: obs.text || null, + narrative: null, + facts: JSON.stringify(obs.facts || []), + concepts: JSON.stringify(obs.concepts || []), + files_read: JSON.stringify(obs.files || []), + files_modified: JSON.stringify([]), project: session.project, prompt_number: session.lastPromptNumber, created_at_epoch: createdAtEpoch diff --git a/src/ui/viewer-template.html b/src/ui/viewer-template.html index 218175ae..81c0cf93 100644 --- a/src/ui/viewer-template.html +++ b/src/ui/viewer-template.html @@ -871,6 +871,49 @@ background-position: -200% 0; } } + + /* Scroll to top button */ + .scroll-to-top { + position: fixed; + bottom: 24px; + right: 24px; + width: 48px; + height: 48px; + background: var(--color-bg-button); + color: var(--color-text-button); + border: none; + border-radius: 24px; + cursor: pointer; + display: flex; + align-items: center; + justify-content: center; + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); + transition: all 0.2s ease; + z-index: 50; + animation: fadeInUp 0.3s ease-out; + } + + .scroll-to-top:hover { + background: var(--color-bg-button-hover); + transform: translateY(-2px); + box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2); + } + + .scroll-to-top:active { + background: var(--color-bg-button-active); + transform: translateY(0); + } + + @keyframes fadeInUp { + from { + opacity: 0; + transform: translateY(10px); + } + to { + opacity: 1; + transform: translateY(0); + } + } diff --git a/src/ui/viewer/App.tsx b/src/ui/viewer/App.tsx index cef16096..52c37f65 100644 --- a/src/ui/viewer/App.tsx +++ b/src/ui/viewer/App.tsx @@ -72,12 +72,13 @@ export function App() { } catch (error) { console.error('Failed to load more data:', error); } - }, [pagination]); + }, [pagination.observations, pagination.summaries, pagination.prompts]); - // Load first page when filter changes or pagination handlers update + // Load first page only when filter changes useEffect(() => { handleLoadMore(); - }, [currentFilter, handleLoadMore]); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [currentFilter]); // Only re-run when filter changes, not when handleLoadMore changes return (
diff --git a/src/ui/viewer/components/Feed.tsx b/src/ui/viewer/components/Feed.tsx index 0cb81613..2595fe6e 100644 --- a/src/ui/viewer/components/Feed.tsx +++ b/src/ui/viewer/components/Feed.tsx @@ -3,6 +3,7 @@ import { Observation, Summary, UserPrompt, FeedItem } from '../types'; import { ObservationCard } from './ObservationCard'; import { SummaryCard } from './SummaryCard'; import { PromptCard } from './PromptCard'; +import { ScrollToTop } from './ScrollToTop'; import { UI } from '../constants/ui'; interface FeedProps { @@ -16,6 +17,7 @@ interface FeedProps { export function Feed({ observations, summaries, prompts, onLoadMore, isLoading, hasMore }: FeedProps) { const loadMoreRef = useRef(null); + const feedRef = useRef(null); const onLoadMoreRef = useRef(onLoadMore); // Keep the callback ref up to date @@ -59,7 +61,8 @@ export function Feed({ observations, summaries, prompts, onLoadMore, isLoading, }, [observations, summaries, prompts]); return ( -
+
+
{items.map(item => { const key = `${item.itemType}-${item.id}`; diff --git a/src/ui/viewer/components/ScrollToTop.tsx b/src/ui/viewer/components/ScrollToTop.tsx new file mode 100644 index 00000000..7caacc9c --- /dev/null +++ b/src/ui/viewer/components/ScrollToTop.tsx @@ -0,0 +1,57 @@ +import React, { useState, useEffect } from 'react'; + +interface ScrollToTopProps { + targetRef: React.RefObject; +} + +export function ScrollToTop({ targetRef }: ScrollToTopProps) { + const [isVisible, setIsVisible] = useState(false); + + useEffect(() => { + const handleScroll = () => { + const target = targetRef.current; + if (target) { + setIsVisible(target.scrollTop > 300); + } + }; + + const target = targetRef.current; + if (target) { + target.addEventListener('scroll', handleScroll); + return () => target.removeEventListener('scroll', handleScroll); + } + }, []); // Empty deps - only set up listener once on mount + + const scrollToTop = () => { + const target = targetRef.current; + if (target) { + target.scrollTo({ + top: 0, + behavior: 'smooth' + }); + } + }; + + if (!isVisible) return null; + + return ( + + ); +} diff --git a/src/ui/viewer/hooks/usePagination.ts b/src/ui/viewer/hooks/usePagination.ts index cda93407..55d63439 100644 --- a/src/ui/viewer/hooks/usePagination.ts +++ b/src/ui/viewer/hooks/usePagination.ts @@ -1,4 +1,4 @@ -import { useState, useEffect, useCallback } from 'react'; +import { useState, useEffect, useCallback, useRef } from 'react'; import { Observation, Summary, UserPrompt } from '../types'; import { UI } from '../constants/ui'; import { API_ENDPOINTS } from '../constants/api'; @@ -21,6 +21,18 @@ function usePaginationFor(endpoint: string, dataType: DataType, currentFilter: s }); const [offset, setOffset] = useState(0); + // Use refs to avoid stale closures and prevent infinite loops + const stateRef = useRef(state); + const offsetRef = useRef(offset); + + useEffect(() => { + stateRef.current = state; + }, [state]); + + useEffect(() => { + offsetRef.current = offset; + }, [offset]); + // Reset pagination when filter changes useEffect(() => { setOffset(0); @@ -34,17 +46,17 @@ function usePaginationFor(endpoint: string, dataType: DataType, currentFilter: s * Load more items from the API */ const loadMore = useCallback(async (): Promise => { - // Prevent concurrent requests using state - if (state.isLoading || !state.hasMore) { + // Prevent concurrent requests using ref (always current) + if (stateRef.current.isLoading || !stateRef.current.hasMore) { return []; } setState(prev => ({ ...prev, isLoading: true })); try { - // Build query params + // Build query params using ref (always current) const params = new URLSearchParams({ - offset: offset.toString(), + offset: offsetRef.current.toString(), limit: UI.PAGINATION_PAGE_SIZE.toString() }); @@ -74,7 +86,7 @@ function usePaginationFor(endpoint: string, dataType: DataType, currentFilter: s setState(prev => ({ ...prev, isLoading: false })); return []; } - }, [offset, state.hasMore, state.isLoading, currentFilter, endpoint, dataType]); + }, [currentFilter, endpoint, dataType]); // Only stable values - no state/offset deps return { ...state,