From 6dd13c00ba1c3e05462d13172ab6cd8eac022329 Mon Sep 17 00:00:00 2001 From: Alex Newman Date: Sun, 14 Dec 2025 21:05:14 -0500 Subject: [PATCH] Refactor session summary rendering to remove links - Removed link generation for session summaries in context generation and search manager. - Updated output formatting to exclude links while maintaining the session summary structure. - Adjusted related components in TimelineService to ensure consistency across the application. --- README.md | 2 +- docs/public/introduction.mdx | 2 +- docs/public/usage/search-tools.mdx | 7 ++--- plugin/scripts/context-generator.cjs | 42 +++++++++++++------------- plugin/scripts/worker-service.cjs | 32 ++++++++++---------- src/services/context-generator.ts | 7 ++--- src/services/worker/SearchManager.ts | 10 ++---- src/services/worker/TimelineService.ts | 3 +- 8 files changed, 48 insertions(+), 57 deletions(-) diff --git a/README.md b/README.md index 146c20b4..1cc285c0 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ Restart Claude Code. Context from previous sessions will automatically appear in - ๐Ÿ”’ **Privacy Control** - Use `` tags to exclude sensitive content from storage - โš™๏ธ **Context Configuration** - Fine-grained control over what context gets injected - ๐Ÿค– **Automatic Operation** - No manual intervention required -- ๐Ÿ”— **Citations** - Reference past decisions with `claude-mem://` URIs +- ๐Ÿ”— **Citations** - Reference past observations with IDs (access via http://localhost:37777/api/observation/{id} or view all in the web viewer at http://localhost:37777) - ๐Ÿงช **Beta Channel** - Try experimental features like Endless Mode via version switching --- diff --git a/docs/public/introduction.mdx b/docs/public/introduction.mdx index 5344ea3b..32164a75 100644 --- a/docs/public/introduction.mdx +++ b/docs/public/introduction.mdx @@ -29,7 +29,7 @@ Restart Claude Code. Context from previous sessions will automatically appear in - โš™๏ธ **Context Configuration** - Fine-grained control over what context gets injected - ๐Ÿค– **Automatic Operation** - No manual intervention required - ๐Ÿ“Š **FTS5 Search** - Fast full-text search across observations -- ๐Ÿ”— **Citations** - Reference past decisions with `claude-mem://` URIs +- ๐Ÿ”— **Citations** - Reference past observations with IDs (access via http://localhost:37777/api/observation/{id} or view all in the web viewer at http://localhost:37777) ## How It Works diff --git a/docs/public/usage/search-tools.mdx b/docs/public/usage/search-tools.mdx index bc00f22d..32343138 100644 --- a/docs/public/usage/search-tools.mdx +++ b/docs/public/usage/search-tools.mdx @@ -246,11 +246,10 @@ authentication for better scalability and stateless design... ## Citations -All search results include citations using the `claude-mem://` URI scheme: +All search results include observation IDs that can be accessed via the HTTP API: -- `claude-mem://observation/123` - Specific observation -- `claude-mem://session/abc-456` - Specific session -- `claude-mem://user-prompt/789` - Specific user prompt +- `http://localhost:37777/api/observation/{id}` - Get specific observation by ID +- View all observations in the web viewer at `http://localhost:37777` These citations enable referencing specific historical context in your work. diff --git a/plugin/scripts/context-generator.cjs b/plugin/scripts/context-generator.cjs index af23028d..242882ae 100644 --- a/plugin/scripts/context-generator.cjs +++ b/plugin/scripts/context-generator.cjs @@ -1,6 +1,6 @@ -"use strict";var we=Object.create;var K=Object.defineProperty;var Fe=Object.getOwnPropertyDescriptor;var Pe=Object.getOwnPropertyNames;var Xe=Object.getPrototypeOf,We=Object.prototype.hasOwnProperty;var je=(d,e)=>{for(var s in e)K(d,s,{get:e[s],enumerable:!0})},le=(d,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Pe(e))!We.call(d,n)&&n!==s&&K(d,n,{get:()=>e[n],enumerable:!(r=Fe(e,n))||r.enumerable});return d};var me=(d,e,s)=>(s=d!=null?we(Xe(d)):{},le(e||!d||!d.__esModule?K(s,"default",{value:d,enumerable:!0}):s,d)),Be=d=>le(K({},"__esModule",{value:!0}),d);var Ze={};je(Ze,{generateContext:()=>ze});module.exports=Be(Ze);var H=me(require("path"),1),Q=require("os"),j=require("fs");var Ie=require("bun:sqlite");var O=require("path"),fe=require("os"),Oe=require("fs");var Re=require("url");var W=require("fs"),Se=require("path"),be=require("os");var se=["bugfix","feature","refactor","discovery","decision","change"],te=["how-it-works","why-it-exists","what-changed","problem-solution","gotcha","pattern","trade-off"],Ee={bugfix:"\u{1F534}",feature:"\u{1F7E3}",refactor:"\u{1F504}",change:"\u2705",discovery:"\u{1F535}",decision:"\u2696\uFE0F","session-request":"\u{1F3AF}"},Te={discovery:"\u{1F50D}",change:"\u{1F6E0}\uFE0F",feature:"\u{1F6E0}\uFE0F",bugfix:"\u{1F6E0}\uFE0F",refactor:"\u{1F6E0}\uFE0F",decision:"\u2696\uFE0F"},ge=se.join(","),he=te.join(",");var re=(i=>(i[i.DEBUG=0]="DEBUG",i[i.INFO=1]="INFO",i[i.WARN=2]="WARN",i[i.ERROR=3]="ERROR",i[i.SILENT=4]="SILENT",i))(re||{}),ne=class{level=null;useColor;constructor(){this.useColor=process.stdout.isTTY??!1}getLevel(){if(this.level===null){let e=U.get("CLAUDE_MEM_LOG_LEVEL").toUpperCase();this.level=re[e]??1}return this.level}correlationId(e,s){return`obs-${e}-${s}`}sessionId(e){return`session-${e}`}formatData(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return e.toString();if(typeof e=="object"){if(e instanceof Error)return this.getLevel()===0?`${e.message} -${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let s=Object.keys(e);return s.length===0?"{}":s.length<=3?JSON.stringify(e):`{${s.length} keys: ${s.slice(0,3).join(", ")}...}`}return String(e)}formatTool(e,s){if(!s)return e;try{let r=typeof s=="string"?JSON.parse(s):s;if(e==="Bash"&&r.command){let n=r.command.length>50?r.command.substring(0,50)+"...":r.command;return`${e}(${n})`}if(e==="Read"&&r.file_path){let n=r.file_path.split("/").pop()||r.file_path;return`${e}(${n})`}if(e==="Edit"&&r.file_path){let n=r.file_path.split("/").pop()||r.file_path;return`${e}(${n})`}if(e==="Write"&&r.file_path){let n=r.file_path.split("/").pop()||r.file_path;return`${e}(${n})`}return e}catch{return e}}formatTimestamp(e){let s=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0"),i=String(e.getHours()).padStart(2,"0"),a=String(e.getMinutes()).padStart(2,"0"),c=String(e.getSeconds()).padStart(2,"0"),u=String(e.getMilliseconds()).padStart(3,"0");return`${s}-${r}-${n} ${i}:${a}:${c}.${u}`}log(e,s,r,n,i){if(e0&&(g=` {${Object.entries(t).map(([R,f])=>`${R}=${f}`).join(", ")}}`)}let b=`[${a}] [${c}] [${u}] ${m}${r}${g}${l}`;e===3?console.error(b):console.log(b)}debug(e,s,r,n){this.log(0,e,s,r,n)}info(e,s,r,n){this.log(1,e,s,r,n)}warn(e,s,r,n){this.log(2,e,s,r,n)}error(e,s,r,n){this.log(3,e,s,r,n)}dataIn(e,s,r,n){this.info(e,`\u2192 ${s}`,r,n)}dataOut(e,s,r,n){this.info(e,`\u2190 ${s}`,r,n)}success(e,s,r,n){this.info(e,`\u2713 ${s}`,r,n)}failure(e,s,r,n){this.error(e,`\u2717 ${s}`,r,n)}timing(e,s,r,n){this.info(e,`\u23F1 ${s}`,n,{duration:`${r}ms`})}},$=new ne;var U=class{static DEFAULTS={CLAUDE_MEM_MODEL:"claude-sonnet-4-5",CLAUDE_MEM_CONTEXT_OBSERVATIONS:"50",CLAUDE_MEM_WORKER_PORT:"37777",CLAUDE_MEM_WORKER_HOST:"127.0.0.1",CLAUDE_MEM_SKIP_TOOLS:"ListMcpResourcesTool,SlashCommand,Skill,TodoWrite,AskUserQuestion",CLAUDE_MEM_DATA_DIR:(0,Se.join)((0,be.homedir)(),".claude-mem"),CLAUDE_MEM_LOG_LEVEL:"INFO",CLAUDE_MEM_PYTHON_VERSION:"3.13",CLAUDE_CODE_PATH:"",CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS:"true",CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS:"true",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT:"true",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT:"true",CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES:ge,CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS:he,CLAUDE_MEM_CONTEXT_FULL_COUNT:"5",CLAUDE_MEM_CONTEXT_FULL_FIELD:"narrative",CLAUDE_MEM_CONTEXT_SESSION_COUNT:"10",CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY:"true",CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE:"false"};static getAllDefaults(){return{...this.DEFAULTS}}static get(e){return this.DEFAULTS[e]}static getInt(e){let s=this.get(e);return parseInt(s,10)}static getBool(e){return this.get(e)==="true"}static loadFromFile(e){if(!(0,W.existsSync)(e))return this.getAllDefaults();let s=(0,W.readFileSync)(e,"utf-8"),r=JSON.parse(s),n=r;if(r.env&&typeof r.env=="object"){n=r.env;try{(0,W.writeFileSync)(e,JSON.stringify(n,null,2),"utf-8"),$.info("SETTINGS","Migrated settings file from nested to flat schema",{settingsPath:e})}catch(a){$.warn("SETTINGS","Failed to auto-migrate settings file",{settingsPath:e},a)}}let i={...this.DEFAULTS};for(let a of Object.keys(this.DEFAULTS))n[a]!==void 0&&(i[a]=n[a]);return i}};var Ge={};function He(){return typeof __dirname<"u"?__dirname:(0,O.dirname)((0,Re.fileURLToPath)(Ge.url))}var _s=He(),y=U.get("CLAUDE_MEM_DATA_DIR"),oe=process.env.CLAUDE_CONFIG_DIR||(0,O.join)((0,fe.homedir)(),".claude"),ls=(0,O.join)(y,"archives"),ms=(0,O.join)(y,"logs"),Es=(0,O.join)(y,"trash"),Ts=(0,O.join)(y,"backups"),gs=(0,O.join)(y,"settings.json"),Ne=(0,O.join)(y,"claude-mem.db"),hs=(0,O.join)(y,"vector-db"),Ss=(0,O.join)(oe,"settings.json"),bs=(0,O.join)(oe,"commands"),fs=(0,O.join)(oe,"CLAUDE.md");function Ae(d){(0,Oe.mkdirSync)(d,{recursive:!0})}var q=class{db;constructor(){Ae(y),this.db=new Ie.Database(Ne),this.db.run("PRAGMA journal_mode = WAL"),this.db.run("PRAGMA synchronous = NORMAL"),this.db.run("PRAGMA foreign_keys = ON"),this.initializeSchema(),this.ensureWorkerPortColumn(),this.ensurePromptTrackingColumns(),this.removeSessionSummariesUniqueConstraint(),this.addObservationHierarchicalFields(),this.makeObservationsTextNullable(),this.createUserPromptsTable(),this.ensureDiscoveryTokensColumn()}initializeSchema(){try{this.db.run(` +"use strict";var we=Object.create;var K=Object.defineProperty;var Fe=Object.getOwnPropertyDescriptor;var Pe=Object.getOwnPropertyNames;var Xe=Object.getPrototypeOf,We=Object.prototype.hasOwnProperty;var je=(d,e)=>{for(var s in e)K(d,s,{get:e[s],enumerable:!0})},le=(d,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Pe(e))!We.call(d,n)&&n!==s&&K(d,n,{get:()=>e[n],enumerable:!(r=Fe(e,n))||r.enumerable});return d};var me=(d,e,s)=>(s=d!=null?we(Xe(d)):{},le(e||!d||!d.__esModule?K(s,"default",{value:d,enumerable:!0}):s,d)),Be=d=>le(K({},"__esModule",{value:!0}),d);var Ze={};je(Ze,{generateContext:()=>ze});module.exports=Be(Ze);var B=me(require("path"),1),Q=require("os"),W=require("fs");var Ie=require("bun:sqlite");var O=require("path"),fe=require("os"),Oe=require("fs");var Re=require("url");var X=require("fs"),Se=require("path"),be=require("os");var se=["bugfix","feature","refactor","discovery","decision","change"],te=["how-it-works","why-it-exists","what-changed","problem-solution","gotcha","pattern","trade-off"],Ee={bugfix:"\u{1F534}",feature:"\u{1F7E3}",refactor:"\u{1F504}",change:"\u2705",discovery:"\u{1F535}",decision:"\u2696\uFE0F","session-request":"\u{1F3AF}"},Te={discovery:"\u{1F50D}",change:"\u{1F6E0}\uFE0F",feature:"\u{1F6E0}\uFE0F",bugfix:"\u{1F6E0}\uFE0F",refactor:"\u{1F6E0}\uFE0F",decision:"\u2696\uFE0F"},ge=se.join(","),he=te.join(",");var re=(i=>(i[i.DEBUG=0]="DEBUG",i[i.INFO=1]="INFO",i[i.WARN=2]="WARN",i[i.ERROR=3]="ERROR",i[i.SILENT=4]="SILENT",i))(re||{}),ne=class{level=null;useColor;constructor(){this.useColor=process.stdout.isTTY??!1}getLevel(){if(this.level===null){let e=k.get("CLAUDE_MEM_LOG_LEVEL").toUpperCase();this.level=re[e]??1}return this.level}correlationId(e,s){return`obs-${e}-${s}`}sessionId(e){return`session-${e}`}formatData(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return e.toString();if(typeof e=="object"){if(e instanceof Error)return this.getLevel()===0?`${e.message} +${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let s=Object.keys(e);return s.length===0?"{}":s.length<=3?JSON.stringify(e):`{${s.length} keys: ${s.slice(0,3).join(", ")}...}`}return String(e)}formatTool(e,s){if(!s)return e;try{let r=typeof s=="string"?JSON.parse(s):s;if(e==="Bash"&&r.command){let n=r.command.length>50?r.command.substring(0,50)+"...":r.command;return`${e}(${n})`}if(e==="Read"&&r.file_path){let n=r.file_path.split("/").pop()||r.file_path;return`${e}(${n})`}if(e==="Edit"&&r.file_path){let n=r.file_path.split("/").pop()||r.file_path;return`${e}(${n})`}if(e==="Write"&&r.file_path){let n=r.file_path.split("/").pop()||r.file_path;return`${e}(${n})`}return e}catch{return e}}formatTimestamp(e){let s=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0"),i=String(e.getHours()).padStart(2,"0"),a=String(e.getMinutes()).padStart(2,"0"),c=String(e.getSeconds()).padStart(2,"0"),u=String(e.getMilliseconds()).padStart(3,"0");return`${s}-${r}-${n} ${i}:${a}:${c}.${u}`}log(e,s,r,n,i){if(e0&&(g=` {${Object.entries(t).map(([R,f])=>`${R}=${f}`).join(", ")}}`)}let b=`[${a}] [${c}] [${u}] ${m}${r}${g}${_}`;e===3?console.error(b):console.log(b)}debug(e,s,r,n){this.log(0,e,s,r,n)}info(e,s,r,n){this.log(1,e,s,r,n)}warn(e,s,r,n){this.log(2,e,s,r,n)}error(e,s,r,n){this.log(3,e,s,r,n)}dataIn(e,s,r,n){this.info(e,`\u2192 ${s}`,r,n)}dataOut(e,s,r,n){this.info(e,`\u2190 ${s}`,r,n)}success(e,s,r,n){this.info(e,`\u2713 ${s}`,r,n)}failure(e,s,r,n){this.error(e,`\u2717 ${s}`,r,n)}timing(e,s,r,n){this.info(e,`\u23F1 ${s}`,n,{duration:`${r}ms`})}},M=new ne;var k=class{static DEFAULTS={CLAUDE_MEM_MODEL:"claude-sonnet-4-5",CLAUDE_MEM_CONTEXT_OBSERVATIONS:"50",CLAUDE_MEM_WORKER_PORT:"37777",CLAUDE_MEM_WORKER_HOST:"127.0.0.1",CLAUDE_MEM_SKIP_TOOLS:"ListMcpResourcesTool,SlashCommand,Skill,TodoWrite,AskUserQuestion",CLAUDE_MEM_DATA_DIR:(0,Se.join)((0,be.homedir)(),".claude-mem"),CLAUDE_MEM_LOG_LEVEL:"INFO",CLAUDE_MEM_PYTHON_VERSION:"3.13",CLAUDE_CODE_PATH:"",CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS:"true",CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS:"true",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT:"true",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT:"true",CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES:ge,CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS:he,CLAUDE_MEM_CONTEXT_FULL_COUNT:"5",CLAUDE_MEM_CONTEXT_FULL_FIELD:"narrative",CLAUDE_MEM_CONTEXT_SESSION_COUNT:"10",CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY:"true",CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE:"false"};static getAllDefaults(){return{...this.DEFAULTS}}static get(e){return this.DEFAULTS[e]}static getInt(e){let s=this.get(e);return parseInt(s,10)}static getBool(e){return this.get(e)==="true"}static loadFromFile(e){if(!(0,X.existsSync)(e))return this.getAllDefaults();let s=(0,X.readFileSync)(e,"utf-8"),r=JSON.parse(s),n=r;if(r.env&&typeof r.env=="object"){n=r.env;try{(0,X.writeFileSync)(e,JSON.stringify(n,null,2),"utf-8"),M.info("SETTINGS","Migrated settings file from nested to flat schema",{settingsPath:e})}catch(a){M.warn("SETTINGS","Failed to auto-migrate settings file",{settingsPath:e},a)}}let i={...this.DEFAULTS};for(let a of Object.keys(this.DEFAULTS))n[a]!==void 0&&(i[a]=n[a]);return i}};var Ge={};function He(){return typeof __dirname<"u"?__dirname:(0,O.dirname)((0,Re.fileURLToPath)(Ge.url))}var _s=He(),C=k.get("CLAUDE_MEM_DATA_DIR"),oe=process.env.CLAUDE_CONFIG_DIR||(0,O.join)((0,fe.homedir)(),".claude"),ls=(0,O.join)(C,"archives"),ms=(0,O.join)(C,"logs"),Es=(0,O.join)(C,"trash"),Ts=(0,O.join)(C,"backups"),gs=(0,O.join)(C,"settings.json"),Ne=(0,O.join)(C,"claude-mem.db"),hs=(0,O.join)(C,"vector-db"),Ss=(0,O.join)(oe,"settings.json"),bs=(0,O.join)(oe,"commands"),fs=(0,O.join)(oe,"CLAUDE.md");function Ae(d){(0,Oe.mkdirSync)(d,{recursive:!0})}var q=class{db;constructor(){Ae(C),this.db=new Ie.Database(Ne),this.db.run("PRAGMA journal_mode = WAL"),this.db.run("PRAGMA synchronous = NORMAL"),this.db.run("PRAGMA foreign_keys = ON"),this.initializeSchema(),this.ensureWorkerPortColumn(),this.ensurePromptTrackingColumns(),this.removeSessionSummariesUniqueConstraint(),this.addObservationHierarchicalFields(),this.makeObservationsTextNullable(),this.createUserPromptsTable(),this.ensureDiscoveryTokensColumn()}initializeSchema(){try{this.db.run(` CREATE TABLE IF NOT EXISTS schema_versions ( id INTEGER PRIMARY KEY, version INTEGER UNIQUE NOT NULL, @@ -254,12 +254,12 @@ ${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let s=Obje SELECT * FROM observations WHERE id = ? - `).get(e)||null}getObservationsByIds(e,s={}){if(e.length===0)return[];let{orderBy:r="date_desc",limit:n,project:i,type:a,concepts:c,files:u}=s,m=r==="date_asc"?"ASC":"DESC",l=n?`LIMIT ${n}`:"",g=e.map(()=>"?").join(","),b=[...e],E=[];if(i&&(E.push("project = ?"),b.push(i)),a)if(Array.isArray(a)){let t=a.map(()=>"?").join(",");E.push(`type IN (${t})`),b.push(...a)}else E.push("type = ?"),b.push(a);if(c){let t=Array.isArray(c)?c:[c],N=t.map(()=>"EXISTS (SELECT 1 FROM json_each(concepts) WHERE value = ?)");b.push(...t),E.push(`(${N.join(" OR ")})`)}if(u){let t=Array.isArray(u)?u:[u],N=t.map(()=>"(EXISTS (SELECT 1 FROM json_each(files_read) WHERE value LIKE ?) OR EXISTS (SELECT 1 FROM json_each(files_modified) WHERE value LIKE ?))");t.forEach(R=>{b.push(`%${R}%`,`%${R}%`)}),E.push(`(${N.join(" OR ")})`)}let I=E.length>0?`WHERE id IN (${g}) AND ${E.join(" AND ")}`:`WHERE id IN (${g})`;return this.db.prepare(` + `).get(e)||null}getObservationsByIds(e,s={}){if(e.length===0)return[];let{orderBy:r="date_desc",limit:n,project:i,type:a,concepts:c,files:u}=s,m=r==="date_asc"?"ASC":"DESC",_=n?`LIMIT ${n}`:"",g=e.map(()=>"?").join(","),b=[...e],E=[];if(i&&(E.push("project = ?"),b.push(i)),a)if(Array.isArray(a)){let t=a.map(()=>"?").join(",");E.push(`type IN (${t})`),b.push(...a)}else E.push("type = ?"),b.push(a);if(c){let t=Array.isArray(c)?c:[c],N=t.map(()=>"EXISTS (SELECT 1 FROM json_each(concepts) WHERE value = ?)");b.push(...t),E.push(`(${N.join(" OR ")})`)}if(u){let t=Array.isArray(u)?u:[u],N=t.map(()=>"(EXISTS (SELECT 1 FROM json_each(files_read) WHERE value LIKE ?) OR EXISTS (SELECT 1 FROM json_each(files_modified) WHERE value LIKE ?))");t.forEach(R=>{b.push(`%${R}%`,`%${R}%`)}),E.push(`(${N.join(" OR ")})`)}let A=E.length>0?`WHERE id IN (${g}) AND ${E.join(" AND ")}`:`WHERE id IN (${g})`;return this.db.prepare(` SELECT * FROM observations - ${I} + ${A} ORDER BY created_at_epoch ${m} - ${l} + ${_} `).all(...b)}getSummaryForSession(e){return this.db.prepare(` SELECT request, investigated, learned, completed, next_steps, @@ -313,7 +313,7 @@ ${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let s=Obje UPDATE sdk_sessions SET sdk_session_id = ? WHERE id = ? AND sdk_session_id IS NULL - `).run(s,e).changes===0?($.debug("DB","sdk_session_id already set, skipping update",{sessionId:e,sdkSessionId:s}),!1):!0}setWorkerPort(e,s){this.db.prepare(` + `).run(s,e).changes===0?(M.debug("DB","sdk_session_id already set, skipping update",{sessionId:e,sdkSessionId:s}),!1):!0}setWorkerPort(e,s){this.db.prepare(` UPDATE sdk_sessions SET worker_port = ? WHERE id = ? @@ -361,19 +361,19 @@ ${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let s=Obje UPDATE sdk_sessions SET status = 'failed', completed_at = ?, completed_at_epoch = ? WHERE id = ? - `).run(s.toISOString(),r,e)}getSessionSummariesByIds(e,s={}){if(e.length===0)return[];let{orderBy:r="date_desc",limit:n,project:i}=s,a=r==="date_asc"?"ASC":"DESC",c=n?`LIMIT ${n}`:"",u=e.map(()=>"?").join(","),m=[...e],l=i?`WHERE id IN (${u}) AND project = ?`:`WHERE id IN (${u})`;return i&&m.push(i),this.db.prepare(` + `).run(s.toISOString(),r,e)}getSessionSummariesByIds(e,s={}){if(e.length===0)return[];let{orderBy:r="date_desc",limit:n,project:i}=s,a=r==="date_asc"?"ASC":"DESC",c=n?`LIMIT ${n}`:"",u=e.map(()=>"?").join(","),m=[...e],_=i?`WHERE id IN (${u}) AND project = ?`:`WHERE id IN (${u})`;return i&&m.push(i),this.db.prepare(` SELECT * FROM session_summaries - ${l} + ${_} ORDER BY created_at_epoch ${a} ${c} - `).all(...m)}getUserPromptsByIds(e,s={}){if(e.length===0)return[];let{orderBy:r="date_desc",limit:n,project:i}=s,a=r==="date_asc"?"ASC":"DESC",c=n?`LIMIT ${n}`:"",u=e.map(()=>"?").join(","),m=[...e],l=i?"AND s.project = ?":"";return i&&m.push(i),this.db.prepare(` + `).all(...m)}getUserPromptsByIds(e,s={}){if(e.length===0)return[];let{orderBy:r="date_desc",limit:n,project:i}=s,a=r==="date_asc"?"ASC":"DESC",c=n?`LIMIT ${n}`:"",u=e.map(()=>"?").join(","),m=[...e],_=i?"AND s.project = ?":"";return i&&m.push(i),this.db.prepare(` SELECT up.*, s.project, s.sdk_session_id FROM user_prompts up JOIN sdk_sessions s ON up.claude_session_id = s.claude_session_id - WHERE up.id IN (${u}) ${l} + WHERE up.id IN (${u}) ${_} ORDER BY up.created_at_epoch ${a} ${c} `).all(...m)}getTimelineAroundTimestamp(e,s=10,r=10,n){return this.getTimelineAroundObservation(null,e,s,r,n)}getTimelineAroundObservation(e,s,r=10,n=10,i){let a=i?"AND project = ?":"",c=i?[i]:[],u,m;if(e!==null){let E=` @@ -382,25 +382,25 @@ ${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let s=Obje WHERE id <= ? ${a} ORDER BY id DESC LIMIT ? - `,I=` + `,A=` SELECT id, created_at_epoch FROM observations WHERE id >= ? ${a} ORDER BY id ASC LIMIT ? - `;try{let T=this.db.prepare(E).all(e,...c,r+1),t=this.db.prepare(I).all(e,...c,n+1);if(T.length===0&&t.length===0)return{observations:[],sessions:[],prompts:[]};u=T.length>0?T[T.length-1].created_at_epoch:s,m=t.length>0?t[t.length-1].created_at_epoch:s}catch(T){return console.error("[SessionStore] Error getting boundary observations:",T.message,i?`(project: ${i})`:"(all projects)"),{observations:[],sessions:[],prompts:[]}}}else{let E=` + `;try{let T=this.db.prepare(E).all(e,...c,r+1),t=this.db.prepare(A).all(e,...c,n+1);if(T.length===0&&t.length===0)return{observations:[],sessions:[],prompts:[]};u=T.length>0?T[T.length-1].created_at_epoch:s,m=t.length>0?t[t.length-1].created_at_epoch:s}catch(T){return console.error("[SessionStore] Error getting boundary observations:",T.message,i?`(project: ${i})`:"(all projects)"),{observations:[],sessions:[],prompts:[]}}}else{let E=` SELECT created_at_epoch FROM observations WHERE created_at_epoch <= ? ${a} ORDER BY created_at_epoch DESC LIMIT ? - `,I=` + `,A=` SELECT created_at_epoch FROM observations WHERE created_at_epoch >= ? ${a} ORDER BY created_at_epoch ASC LIMIT ? - `;try{let T=this.db.prepare(E).all(s,...c,r),t=this.db.prepare(I).all(s,...c,n+1);if(T.length===0&&t.length===0)return{observations:[],sessions:[],prompts:[]};u=T.length>0?T[T.length-1].created_at_epoch:s,m=t.length>0?t[t.length-1].created_at_epoch:s}catch(T){return console.error("[SessionStore] Error getting boundary timestamps:",T.message,i?`(project: ${i})`:"(all projects)"),{observations:[],sessions:[],prompts:[]}}}let l=` + `;try{let T=this.db.prepare(E).all(s,...c,r),t=this.db.prepare(A).all(s,...c,n+1);if(T.length===0&&t.length===0)return{observations:[],sessions:[],prompts:[]};u=T.length>0?T[T.length-1].created_at_epoch:s,m=t.length>0?t[t.length-1].created_at_epoch:s}catch(T){return console.error("[SessionStore] Error getting boundary timestamps:",T.message,i?`(project: ${i})`:"(all projects)"),{observations:[],sessions:[],prompts:[]}}}let _=` SELECT * FROM observations WHERE created_at_epoch >= ? AND created_at_epoch <= ? ${a} @@ -416,7 +416,7 @@ ${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let s=Obje JOIN sdk_sessions s ON up.claude_session_id = s.claude_session_id WHERE up.created_at_epoch >= ? AND up.created_at_epoch <= ? ${a.replace("project","s.project")} ORDER BY up.created_at_epoch ASC - `;try{let E=this.db.prepare(l).all(u,m,...c),I=this.db.prepare(g).all(u,m,...c),T=this.db.prepare(b).all(u,m,...c);return{observations:E,sessions:I.map(t=>({id:t.id,sdk_session_id:t.sdk_session_id,project:t.project,request:t.request,completed:t.completed,next_steps:t.next_steps,created_at:t.created_at,created_at_epoch:t.created_at_epoch})),prompts:T.map(t=>({id:t.id,claude_session_id:t.claude_session_id,prompt_number:t.prompt_number,prompt_text:t.prompt_text,project:t.project,created_at:t.created_at,created_at_epoch:t.created_at_epoch}))}}catch(E){return console.error("[SessionStore] Error querying timeline records:",E.message,i?`(project: ${i})`:"(all projects)"),{observations:[],sessions:[],prompts:[]}}}getPromptById(e){return this.db.prepare(` + `;try{let E=this.db.prepare(_).all(u,m,...c),A=this.db.prepare(g).all(u,m,...c),T=this.db.prepare(b).all(u,m,...c);return{observations:E,sessions:A.map(t=>({id:t.id,sdk_session_id:t.sdk_session_id,project:t.project,request:t.request,completed:t.completed,next_steps:t.next_steps,created_at:t.created_at,created_at_epoch:t.created_at_epoch})),prompts:T.map(t=>({id:t.id,claude_session_id:t.claude_session_id,prompt_number:t.prompt_number,prompt_text:t.prompt_text,project:t.project,created_at:t.created_at,created_at_epoch:t.created_at_epoch}))}}catch(E){return console.error("[SessionStore] Error querying timeline records:",E.message,i?`(project: ${i})`:"(all projects)"),{observations:[],sessions:[],prompts:[]}}}getPromptById(e){return this.db.prepare(` SELECT p.id, p.claude_session_id, @@ -457,8 +457,8 @@ ${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let s=Obje FROM sdk_sessions WHERE id = ? LIMIT 1 - `).get(e)||null}close(){this.db.close()}};var ie=me(require("path"),1);function ae(d){if(!d)return[];try{let e=JSON.parse(d);return Array.isArray(e)?e:[]}catch{return[]}}function Le(d){return new Date(d).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}function Ce(d){return new Date(d).toLocaleString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}function ye(d){return new Date(d).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric"})}function Ye(d,e){return ie.default.isAbsolute(d)?ie.default.relative(e,d):d}function ve(d,e){let s=ae(d);return s.length>0?Ye(s[0],e):"General"}var Ve=H.default.join((0,Q.homedir)(),".claude","plugins","marketplaces","thedotmack","plugin",".install-version");function Ke(){let d=H.default.join((0,Q.homedir)(),".claude-mem","settings.json"),e=U.loadFromFile(d);try{return{totalObservationCount:parseInt(e.CLAUDE_MEM_CONTEXT_OBSERVATIONS,10),fullObservationCount:parseInt(e.CLAUDE_MEM_CONTEXT_FULL_COUNT,10),sessionCount:parseInt(e.CLAUDE_MEM_CONTEXT_SESSION_COUNT,10),showReadTokens:e.CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS==="true",showWorkTokens:e.CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS==="true",showSavingsAmount:e.CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT==="true",showSavingsPercent:e.CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT==="true",observationTypes:new Set(e.CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES.split(",").map(s=>s.trim()).filter(Boolean)),observationConcepts:new Set(e.CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS.split(",").map(s=>s.trim()).filter(Boolean)),fullObservationField:e.CLAUDE_MEM_CONTEXT_FULL_FIELD,showLastSummary:e.CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY==="true",showLastMessage:e.CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE==="true"}}catch(s){return $.warn("WORKER","Failed to load context settings, using defaults",{},s),{totalObservationCount:50,fullObservationCount:5,sessionCount:10,showReadTokens:!0,showWorkTokens:!0,showSavingsAmount:!0,showSavingsPercent:!0,observationTypes:new Set(se),observationConcepts:new Set(te),fullObservationField:"narrative",showLastSummary:!0,showLastMessage:!1}}}var De=4,qe=1,o={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",cyan:"\x1B[36m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",gray:"\x1B[90m",red:"\x1B[31m"};function J(d,e,s,r){return e?r?[`${s}${d}:${o.reset} ${e}`,""]:[`**${d}**: ${e}`,""]:[]}function Je(d){return d.replace(/\//g,"-")}function Qe(d){try{if(!(0,j.existsSync)(d))return{userMessage:"",assistantMessage:""};let e=(0,j.readFileSync)(d,"utf-8").trim();if(!e)return{userMessage:"",assistantMessage:""};let s=e.split(` -`).filter(n=>n.trim()),r="";for(let n=s.length-1;n>=0;n--)try{let i=s[n];if(!i.includes('"type":"assistant"'))continue;let a=JSON.parse(i);if(a.type==="assistant"&&a.message?.content&&Array.isArray(a.message.content)){let c="";for(let u of a.message.content)u.type==="text"&&(c+=u.text);if(c=c.replace(/[\s\S]*?<\/system-reminder>/g,"").trim(),c){r=c;break}}}catch{continue}return{userMessage:"",assistantMessage:r}}catch(e){return $.failure("WORKER","Failed to extract prior messages from transcript",{transcriptPath:d},e),{userMessage:"",assistantMessage:""}}}async function ze(d,e=!1){let s=Ke(),r=d?.cwd??process.cwd(),n=r?H.default.basename(r):"unknown-project",i=null;try{i=new q}catch(N){if(N.code==="ERR_DLOPEN_FAILED"){try{(0,j.unlinkSync)(Ve)}catch{}return console.error("Native module rebuild needed - restart Claude Code to auto-fix"),""}throw N}let a=Array.from(s.observationTypes),c=a.map(()=>"?").join(","),u=Array.from(s.observationConcepts),m=u.map(()=>"?").join(","),l=i.db.prepare(` + `).get(e)||null}close(){this.db.close()}};var ie=me(require("path"),1);function ae(d){if(!d)return[];try{let e=JSON.parse(d);return Array.isArray(e)?e:[]}catch{return[]}}function Le(d){return new Date(d).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}function Ce(d){return new Date(d).toLocaleString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}function ye(d){return new Date(d).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric"})}function Ye(d,e){return ie.default.isAbsolute(d)?ie.default.relative(e,d):d}function ve(d,e){let s=ae(d);return s.length>0?Ye(s[0],e):"General"}var Ve=B.default.join((0,Q.homedir)(),".claude","plugins","marketplaces","thedotmack","plugin",".install-version");function Ke(){let d=B.default.join((0,Q.homedir)(),".claude-mem","settings.json"),e=k.loadFromFile(d);try{return{totalObservationCount:parseInt(e.CLAUDE_MEM_CONTEXT_OBSERVATIONS,10),fullObservationCount:parseInt(e.CLAUDE_MEM_CONTEXT_FULL_COUNT,10),sessionCount:parseInt(e.CLAUDE_MEM_CONTEXT_SESSION_COUNT,10),showReadTokens:e.CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS==="true",showWorkTokens:e.CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS==="true",showSavingsAmount:e.CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT==="true",showSavingsPercent:e.CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT==="true",observationTypes:new Set(e.CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES.split(",").map(s=>s.trim()).filter(Boolean)),observationConcepts:new Set(e.CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS.split(",").map(s=>s.trim()).filter(Boolean)),fullObservationField:e.CLAUDE_MEM_CONTEXT_FULL_FIELD,showLastSummary:e.CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY==="true",showLastMessage:e.CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE==="true"}}catch(s){return M.warn("WORKER","Failed to load context settings, using defaults",{},s),{totalObservationCount:50,fullObservationCount:5,sessionCount:10,showReadTokens:!0,showWorkTokens:!0,showSavingsAmount:!0,showSavingsPercent:!0,observationTypes:new Set(se),observationConcepts:new Set(te),fullObservationField:"narrative",showLastSummary:!0,showLastMessage:!1}}}var De=4,qe=1,o={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",cyan:"\x1B[36m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",gray:"\x1B[90m",red:"\x1B[31m"};function J(d,e,s,r){return e?r?[`${s}${d}:${o.reset} ${e}`,""]:[`**${d}**: ${e}`,""]:[]}function Je(d){return d.replace(/\//g,"-")}function Qe(d){try{if(!(0,W.existsSync)(d))return{userMessage:"",assistantMessage:""};let e=(0,W.readFileSync)(d,"utf-8").trim();if(!e)return{userMessage:"",assistantMessage:""};let s=e.split(` +`).filter(n=>n.trim()),r="";for(let n=s.length-1;n>=0;n--)try{let i=s[n];if(!i.includes('"type":"assistant"'))continue;let a=JSON.parse(i);if(a.type==="assistant"&&a.message?.content&&Array.isArray(a.message.content)){let c="";for(let u of a.message.content)u.type==="text"&&(c+=u.text);if(c=c.replace(/[\s\S]*?<\/system-reminder>/g,"").trim(),c){r=c;break}}}catch{continue}return{userMessage:"",assistantMessage:r}}catch(e){return M.failure("WORKER","Failed to extract prior messages from transcript",{transcriptPath:d},e),{userMessage:"",assistantMessage:""}}}async function ze(d,e=!1){let s=Ke(),r=d?.cwd??process.cwd(),n=r?B.default.basename(r):"unknown-project",i=null;try{i=new q}catch(N){if(N.code==="ERR_DLOPEN_FAILED"){try{(0,W.unlinkSync)(Ve)}catch{}return console.error("Native module rebuild needed - restart Claude Code to auto-fix"),""}throw N}let a=Array.from(s.observationTypes),c=a.map(()=>"?").join(","),u=Array.from(s.observationConcepts),m=u.map(()=>"?").join(","),_=i.db.prepare(` SELECT id, sdk_session_id, type, title, subtitle, narrative, facts, concepts, files_read, files_modified, discovery_tokens, @@ -478,13 +478,13 @@ ${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let s=Obje WHERE project = ? ORDER BY created_at_epoch DESC LIMIT ? - `).all(n,s.sessionCount+qe),b="",E="";if(s.showLastMessage&&l.length>0)try{let N=d?.session_id,R=l.find(f=>f.sdk_session_id!==N);if(R){let f=R.sdk_session_id,v=Je(r),F=H.default.join((0,Q.homedir)(),".claude","projects",v,`${f}.jsonl`),B=Qe(F);b=B.userMessage,E=B.assistantMessage}}catch{}if(l.length===0&&g.length===0)return i?.close(),e?` + `).all(n,s.sessionCount+qe),b="",E="";if(s.showLastMessage&&_.length>0)try{let N=d?.session_id,R=_.find(f=>f.sdk_session_id!==N);if(R){let f=R.sdk_session_id,y=Je(r),w=B.default.join((0,Q.homedir)(),".claude","projects",y,`${f}.jsonl`),j=Qe(w);b=j.userMessage,E=j.assistantMessage}}catch{}if(_.length===0&&g.length===0)return i?.close(),e?` ${o.bright}${o.cyan}[${n}] recent context${o.reset} ${o.gray}${"\u2500".repeat(60)}${o.reset} ${o.dim}No previous sessions found for this project yet.${o.reset} `:`# [${n}] recent context -No previous sessions found for this project yet.`;let I=g.slice(0,s.sessionCount),T=l,t=[];if(e?(t.push(""),t.push(`${o.bright}${o.cyan}[${n}] recent context${o.reset}`),t.push(`${o.gray}${"\u2500".repeat(60)}${o.reset}`),t.push("")):(t.push(`# [${n}] recent context`),t.push("")),T.length>0){e?t.push(`${o.dim}Legend: \u{1F3AF} session-request | \u{1F534} bugfix | \u{1F7E3} feature | \u{1F504} refactor | \u2705 change | \u{1F535} discovery | \u2696\uFE0F decision${o.reset}`):t.push("**Legend:** \u{1F3AF} session-request | \u{1F534} bugfix | \u{1F7E3} feature | \u{1F504} refactor | \u2705 change | \u{1F535} discovery | \u2696\uFE0F decision"),t.push(""),e?(t.push(`${o.bright}\u{1F4A1} Column Key${o.reset}`),t.push(`${o.dim} Read: Tokens to read this observation (cost to learn it now)${o.reset}`),t.push(`${o.dim} Work: Tokens spent on work that produced this record (\u{1F50D} research, \u{1F6E0}\uFE0F building, \u2696\uFE0F deciding)${o.reset}`)):(t.push("\u{1F4A1} **Column Key**:"),t.push("- **Read**: Tokens to read this observation (cost to learn it now)"),t.push("- **Work**: Tokens spent on work that produced this record (\u{1F50D} research, \u{1F6E0}\uFE0F building, \u2696\uFE0F deciding)")),t.push(""),e?(t.push(`${o.dim}\u{1F4A1} Context Index: This semantic index (titles, types, files, tokens) is usually sufficient to understand past work.${o.reset}`),t.push(""),t.push(`${o.dim}When you need implementation details, rationale, or debugging context:${o.reset}`),t.push(`${o.dim} - Use the mem-search skill to fetch full observations on-demand${o.reset}`),t.push(`${o.dim} - Critical types (\u{1F534} bugfix, \u2696\uFE0F decision) often need detailed fetching${o.reset}`),t.push(`${o.dim} - Trust this index over re-reading code for past decisions and learnings${o.reset}`)):(t.push("\u{1F4A1} **Context Index:** This semantic index (titles, types, files, tokens) is usually sufficient to understand past work."),t.push(""),t.push("When you need implementation details, rationale, or debugging context:"),t.push("- Use the mem-search skill to fetch full observations on-demand"),t.push("- Critical types (\u{1F534} bugfix, \u2696\uFE0F decision) often need detailed fetching"),t.push("- Trust this index over re-reading code for past decisions and learnings")),t.push("");let N=l.length,R=l.reduce((p,h)=>{let S=(h.title?.length||0)+(h.subtitle?.length||0)+(h.narrative?.length||0)+JSON.stringify(h.facts||[]).length;return p+Math.ceil(S/De)},0),f=l.reduce((p,h)=>p+(h.discovery_tokens||0),0),v=f-R,F=f>0?Math.round(v/f*100):0,B=s.showReadTokens||s.showWorkTokens||s.showSavingsAmount||s.showSavingsPercent;if(B)if(e){if(t.push(`${o.bright}${o.cyan}\u{1F4CA} Context Economics${o.reset}`),t.push(`${o.dim} Loading: ${N} observations (${R.toLocaleString()} tokens to read)${o.reset}`),t.push(`${o.dim} Work investment: ${f.toLocaleString()} tokens spent on research, building, and decisions${o.reset}`),f>0&&(s.showSavingsAmount||s.showSavingsPercent)){let p=" Your savings: ";s.showSavingsAmount&&s.showSavingsPercent?p+=`${v.toLocaleString()} tokens (${F}% reduction from reuse)`:s.showSavingsAmount?p+=`${v.toLocaleString()} tokens`:p+=`${F}% reduction from reuse`,t.push(`${o.green}${p}${o.reset}`)}t.push("")}else{if(t.push("\u{1F4CA} **Context Economics**:"),t.push(`- Loading: ${N} observations (${R.toLocaleString()} tokens to read)`),t.push(`- Work investment: ${f.toLocaleString()} tokens spent on research, building, and decisions`),f>0&&(s.showSavingsAmount||s.showSavingsPercent)){let p="- Your savings: ";s.showSavingsAmount&&s.showSavingsPercent?p+=`${v.toLocaleString()} tokens (${F}% reduction from reuse)`:s.showSavingsAmount?p+=`${v.toLocaleString()} tokens`:p+=`${F}% reduction from reuse`,t.push(p)}t.push("")}let Me=g[0]?.id,ke=I.map((p,h)=>{let S=h===0?null:g[h+1];return{...p,displayEpoch:S?S.created_at_epoch:p.created_at_epoch,displayTime:S?S.created_at:p.created_at,shouldShowLink:p.id!==Me}}),$e=new Set(l.slice(0,s.fullObservationCount).map(p=>p.id)),de=[...T.map(p=>({type:"observation",data:p})),...ke.map(p=>({type:"summary",data:p}))];de.sort((p,h)=>{let S=p.type==="observation"?p.data.created_at_epoch:p.data.displayEpoch,D=h.type==="observation"?h.data.created_at_epoch:h.data.displayEpoch;return S-D});let G=new Map;for(let p of de){let h=p.type==="observation"?p.data.created_at:p.data.displayTime,S=ye(h);G.has(S)||G.set(S,[]),G.get(S).push(p)}let Ue=Array.from(G.entries()).sort((p,h)=>{let S=new Date(p[0]).getTime(),D=new Date(h[0]).getTime();return S-D});for(let[p,h]of Ue){e?(t.push(`${o.bright}${o.cyan}${p}${o.reset}`),t.push("")):(t.push(`### ${p}`),t.push(""));let S=null,D="",x=!1;for(let z of h)if(z.type==="summary"){x&&(t.push(""),x=!1,S=null,D="");let _=z.data,w=`${_.request||"Session started"} (${Le(_.displayTime)})`,A=_.shouldShowLink?`claude-mem://session-summary/${_.id}`:"";if(e){let M=A?`${o.dim}[${A}]${o.reset}`:"";t.push(`\u{1F3AF} ${o.yellow}#S${_.id}${o.reset} ${w} ${M}`)}else{let M=A?` [\u2192](${A})`:"";t.push(`**\u{1F3AF} #S${_.id}** ${w}${M}`)}t.push("")}else{let _=z.data,w=ve(_.files_modified,r);w!==S&&(x&&t.push(""),e?t.push(`${o.dim}${w}${o.reset}`):t.push(`**${w}**`),e||(t.push("| ID | Time | T | Title | Read | Work |"),t.push("|----|------|---|-------|------|------|")),S=w,x=!0,D="");let A=Ce(_.created_at),M=_.title||"Untitled",Y=Ee[_.type]||"\u2022",xe=(_.title?.length||0)+(_.subtitle?.length||0)+(_.narrative?.length||0)+JSON.stringify(_.facts||[]).length,P=Math.ceil(xe/De),X=_.discovery_tokens||0,Z=Te[_.type]||"\u{1F50D}",pe=X>0?`${Z} ${X.toLocaleString()}`:"-",ee=A!==D,ue=ee?A:"";if(D=A,$e.has(_.id)){let k=s.fullObservationField==="narrative"?_.narrative:_.facts?ae(_.facts).join(` -`):null;if(e){let C=ee?`${o.dim}${A}${o.reset}`:" ".repeat(A.length),V=s.showReadTokens&&P>0?`${o.dim}(~${P}t)${o.reset}`:"",_e=s.showWorkTokens&&X>0?`${o.dim}(${Z} ${X.toLocaleString()}t)${o.reset}`:"";t.push(` ${o.dim}#${_.id}${o.reset} ${C} ${Y} ${o.bright}${M}${o.reset}`),k&&t.push(` ${o.dim}${k}${o.reset}`),(V||_e)&&t.push(` ${V} ${_e}`),t.push("")}else{x&&(t.push(""),x=!1),t.push(`**#${_.id}** ${ue||"\u2033"} ${Y} **${M}**`),k&&(t.push(""),t.push(k),t.push(""));let C=[];s.showReadTokens&&C.push(`Read: ~${P}`),s.showWorkTokens&&C.push(`Work: ${pe}`),C.length>0&&t.push(C.join(", ")),t.push(""),S=null}}else if(e){let k=ee?`${o.dim}${A}${o.reset}`:" ".repeat(A.length),C=s.showReadTokens&&P>0?`${o.dim}(~${P}t)${o.reset}`:"",V=s.showWorkTokens&&X>0?`${o.dim}(${Z} ${X.toLocaleString()}t)${o.reset}`:"";t.push(` ${o.dim}#${_.id}${o.reset} ${k} ${Y} ${M} ${C} ${V}`)}else{let k=s.showReadTokens?`~${P}`:"",C=s.showWorkTokens?pe:"";t.push(`| #${_.id} | ${ue||"\u2033"} | ${Y} | ${M} | ${k} | ${C} |`)}}x&&t.push("")}let L=g[0],ce=l[0];if(s.showLastSummary&&L&&(L.investigated||L.learned||L.completed||L.next_steps)&&(!ce||L.created_at_epoch>ce.created_at_epoch)&&(t.push(...J("Investigated",L.investigated,o.blue,e)),t.push(...J("Learned",L.learned,o.yellow,e)),t.push(...J("Completed",L.completed,o.green,e)),t.push(...J("Next Steps",L.next_steps,o.magenta,e))),E&&(t.push(""),t.push("---"),t.push(""),e?(t.push(`${o.bright}${o.magenta}\u{1F4CB} Previously${o.reset}`),t.push(""),t.push(`${o.dim}A: ${E}${o.reset}`)):(t.push("**\u{1F4CB} Previously**"),t.push(""),t.push(`A: ${E}`)),t.push("")),B&&f>0&&v>0){let p=Math.round(f/1e3);t.push(""),e?t.push(`${o.dim}\u{1F4B0} Access ${p}k tokens of past research & decisions for just ${R.toLocaleString()}t. Use the mem-search skill to access memories by ID instead of re-reading files.${o.reset}`):t.push(`\u{1F4B0} Access ${p}k tokens of past research & decisions for just ${R.toLocaleString()}t. Use the mem-search skill to access memories by ID instead of re-reading files.`)}}return i?.close(),t.join(` +No previous sessions found for this project yet.`;let A=g.slice(0,s.sessionCount),T=_,t=[];if(e?(t.push(""),t.push(`${o.bright}${o.cyan}[${n}] recent context${o.reset}`),t.push(`${o.gray}${"\u2500".repeat(60)}${o.reset}`),t.push("")):(t.push(`# [${n}] recent context`),t.push("")),T.length>0){e?t.push(`${o.dim}Legend: \u{1F3AF} session-request | \u{1F534} bugfix | \u{1F7E3} feature | \u{1F504} refactor | \u2705 change | \u{1F535} discovery | \u2696\uFE0F decision${o.reset}`):t.push("**Legend:** \u{1F3AF} session-request | \u{1F534} bugfix | \u{1F7E3} feature | \u{1F504} refactor | \u2705 change | \u{1F535} discovery | \u2696\uFE0F decision"),t.push(""),e?(t.push(`${o.bright}\u{1F4A1} Column Key${o.reset}`),t.push(`${o.dim} Read: Tokens to read this observation (cost to learn it now)${o.reset}`),t.push(`${o.dim} Work: Tokens spent on work that produced this record (\u{1F50D} research, \u{1F6E0}\uFE0F building, \u2696\uFE0F deciding)${o.reset}`)):(t.push("\u{1F4A1} **Column Key**:"),t.push("- **Read**: Tokens to read this observation (cost to learn it now)"),t.push("- **Work**: Tokens spent on work that produced this record (\u{1F50D} research, \u{1F6E0}\uFE0F building, \u2696\uFE0F deciding)")),t.push(""),e?(t.push(`${o.dim}\u{1F4A1} Context Index: This semantic index (titles, types, files, tokens) is usually sufficient to understand past work.${o.reset}`),t.push(""),t.push(`${o.dim}When you need implementation details, rationale, or debugging context:${o.reset}`),t.push(`${o.dim} - Use the mem-search skill to fetch full observations on-demand${o.reset}`),t.push(`${o.dim} - Critical types (\u{1F534} bugfix, \u2696\uFE0F decision) often need detailed fetching${o.reset}`),t.push(`${o.dim} - Trust this index over re-reading code for past decisions and learnings${o.reset}`)):(t.push("\u{1F4A1} **Context Index:** This semantic index (titles, types, files, tokens) is usually sufficient to understand past work."),t.push(""),t.push("When you need implementation details, rationale, or debugging context:"),t.push("- Use the mem-search skill to fetch full observations on-demand"),t.push("- Critical types (\u{1F534} bugfix, \u2696\uFE0F decision) often need detailed fetching"),t.push("- Trust this index over re-reading code for past decisions and learnings")),t.push("");let N=_.length,R=_.reduce((p,h)=>{let S=(h.title?.length||0)+(h.subtitle?.length||0)+(h.narrative?.length||0)+JSON.stringify(h.facts||[]).length;return p+Math.ceil(S/De)},0),f=_.reduce((p,h)=>p+(h.discovery_tokens||0),0),y=f-R,w=f>0?Math.round(y/f*100):0,j=s.showReadTokens||s.showWorkTokens||s.showSavingsAmount||s.showSavingsPercent;if(j)if(e){if(t.push(`${o.bright}${o.cyan}\u{1F4CA} Context Economics${o.reset}`),t.push(`${o.dim} Loading: ${N} observations (${R.toLocaleString()} tokens to read)${o.reset}`),t.push(`${o.dim} Work investment: ${f.toLocaleString()} tokens spent on research, building, and decisions${o.reset}`),f>0&&(s.showSavingsAmount||s.showSavingsPercent)){let p=" Your savings: ";s.showSavingsAmount&&s.showSavingsPercent?p+=`${y.toLocaleString()} tokens (${w}% reduction from reuse)`:s.showSavingsAmount?p+=`${y.toLocaleString()} tokens`:p+=`${w}% reduction from reuse`,t.push(`${o.green}${p}${o.reset}`)}t.push("")}else{if(t.push("\u{1F4CA} **Context Economics**:"),t.push(`- Loading: ${N} observations (${R.toLocaleString()} tokens to read)`),t.push(`- Work investment: ${f.toLocaleString()} tokens spent on research, building, and decisions`),f>0&&(s.showSavingsAmount||s.showSavingsPercent)){let p="- Your savings: ";s.showSavingsAmount&&s.showSavingsPercent?p+=`${y.toLocaleString()} tokens (${w}% reduction from reuse)`:s.showSavingsAmount?p+=`${y.toLocaleString()} tokens`:p+=`${w}% reduction from reuse`,t.push(p)}t.push("")}let Me=g[0]?.id,ke=A.map((p,h)=>{let S=h===0?null:g[h+1];return{...p,displayEpoch:S?S.created_at_epoch:p.created_at_epoch,displayTime:S?S.created_at:p.created_at,shouldShowLink:p.id!==Me}}),$e=new Set(_.slice(0,s.fullObservationCount).map(p=>p.id)),de=[...T.map(p=>({type:"observation",data:p})),...ke.map(p=>({type:"summary",data:p}))];de.sort((p,h)=>{let S=p.type==="observation"?p.data.created_at_epoch:p.data.displayEpoch,v=h.type==="observation"?h.data.created_at_epoch:h.data.displayEpoch;return S-v});let H=new Map;for(let p of de){let h=p.type==="observation"?p.data.created_at:p.data.displayTime,S=ye(h);H.has(S)||H.set(S,[]),H.get(S).push(p)}let Ue=Array.from(H.entries()).sort((p,h)=>{let S=new Date(p[0]).getTime(),v=new Date(h[0]).getTime();return S-v});for(let[p,h]of Ue){e?(t.push(`${o.bright}${o.cyan}${p}${o.reset}`),t.push("")):(t.push(`### ${p}`),t.push(""));let S=null,v="",$=!1;for(let z of h)if(z.type==="summary"){$&&(t.push(""),$=!1,S=null,v="");let l=z.data,U=`${l.request||"Session started"} (${Le(l.displayTime)})`;e?t.push(`\u{1F3AF} ${o.yellow}#S${l.id}${o.reset} ${U}`):t.push(`**\u{1F3AF} #S${l.id}** ${U}`),t.push("")}else{let l=z.data,U=ve(l.files_modified,r);U!==S&&($&&t.push(""),e?t.push(`${o.dim}${U}${o.reset}`):t.push(`**${U}**`),e||(t.push("| ID | Time | T | Title | Read | Work |"),t.push("|----|------|---|-------|------|------|")),S=U,$=!0,v="");let x=Ce(l.created_at),G=l.title||"Untitled",Y=Ee[l.type]||"\u2022",xe=(l.title?.length||0)+(l.subtitle?.length||0)+(l.narrative?.length||0)+JSON.stringify(l.facts||[]).length,F=Math.ceil(xe/De),P=l.discovery_tokens||0,Z=Te[l.type]||"\u{1F50D}",pe=P>0?`${Z} ${P.toLocaleString()}`:"-",ee=x!==v,ue=ee?x:"";if(v=x,$e.has(l.id)){let D=s.fullObservationField==="narrative"?l.narrative:l.facts?ae(l.facts).join(` +`):null;if(e){let L=ee?`${o.dim}${x}${o.reset}`:" ".repeat(x.length),V=s.showReadTokens&&F>0?`${o.dim}(~${F}t)${o.reset}`:"",_e=s.showWorkTokens&&P>0?`${o.dim}(${Z} ${P.toLocaleString()}t)${o.reset}`:"";t.push(` ${o.dim}#${l.id}${o.reset} ${L} ${Y} ${o.bright}${G}${o.reset}`),D&&t.push(` ${o.dim}${D}${o.reset}`),(V||_e)&&t.push(` ${V} ${_e}`),t.push("")}else{$&&(t.push(""),$=!1),t.push(`**#${l.id}** ${ue||"\u2033"} ${Y} **${G}**`),D&&(t.push(""),t.push(D),t.push(""));let L=[];s.showReadTokens&&L.push(`Read: ~${F}`),s.showWorkTokens&&L.push(`Work: ${pe}`),L.length>0&&t.push(L.join(", ")),t.push(""),S=null}}else if(e){let D=ee?`${o.dim}${x}${o.reset}`:" ".repeat(x.length),L=s.showReadTokens&&F>0?`${o.dim}(~${F}t)${o.reset}`:"",V=s.showWorkTokens&&P>0?`${o.dim}(${Z} ${P.toLocaleString()}t)${o.reset}`:"";t.push(` ${o.dim}#${l.id}${o.reset} ${D} ${Y} ${G} ${L} ${V}`)}else{let D=s.showReadTokens?`~${F}`:"",L=s.showWorkTokens?pe:"";t.push(`| #${l.id} | ${ue||"\u2033"} | ${Y} | ${G} | ${D} | ${L} |`)}}$&&t.push("")}let I=g[0],ce=_[0];if(s.showLastSummary&&I&&(I.investigated||I.learned||I.completed||I.next_steps)&&(!ce||I.created_at_epoch>ce.created_at_epoch)&&(t.push(...J("Investigated",I.investigated,o.blue,e)),t.push(...J("Learned",I.learned,o.yellow,e)),t.push(...J("Completed",I.completed,o.green,e)),t.push(...J("Next Steps",I.next_steps,o.magenta,e))),E&&(t.push(""),t.push("---"),t.push(""),e?(t.push(`${o.bright}${o.magenta}\u{1F4CB} Previously${o.reset}`),t.push(""),t.push(`${o.dim}A: ${E}${o.reset}`)):(t.push("**\u{1F4CB} Previously**"),t.push(""),t.push(`A: ${E}`)),t.push("")),j&&f>0&&y>0){let p=Math.round(f/1e3);t.push(""),e?t.push(`${o.dim}\u{1F4B0} Access ${p}k tokens of past research & decisions for just ${R.toLocaleString()}t. Use the mem-search skill to access memories by ID instead of re-reading files.${o.reset}`):t.push(`\u{1F4B0} Access ${p}k tokens of past research & decisions for just ${R.toLocaleString()}t. Use the mem-search skill to access memories by ID instead of re-reading files.`)}}return i?.close(),t.join(` `).trimEnd()}0&&(module.exports={generateContext}); diff --git a/plugin/scripts/worker-service.cjs b/plugin/scripts/worker-service.cjs index df1f3306..57ad4714 100755 --- a/plugin/scripts/worker-service.cjs +++ b/plugin/scripts/worker-service.cjs @@ -49,7 +49,7 @@ Please see the 3.x to 4.x migration guide for details on how to update your app.
`+e+`
-`}function OD(){return function(){this.error(404)}}function CD(){return function(e){if(this.hasTrailingSlash()){this.error(404);return}var r=nd.original(this.req);r.path=null,r.pathname=RD(r.pathname+"/");var t=_D(wD.format(r)),s=PD("Redirecting","Redirecting to "+SD(t));e.statusCode=301,e.setHeader("Content-Type","text/html; charset=UTF-8"),e.setHeader("Content-Length",Buffer.byteLength(s)),e.setHeader("Content-Security-Policy","default-src 'none'"),e.setHeader("X-Content-Type-Options","nosniff"),e.setHeader("Location",t),e.end(s)}}});var Bx=U((Ut,Hx)=>{"use strict";var Ec=py(),kD=require("events").EventEmitter,Lx=fy(),Fx=Gb(),AD=Cp(),ID=Ap(),qx=bx(),Ux=jx();Ut=Hx.exports=DD;function DD(){var a=function(e,r,t){a.handle(e,r,t)};return Lx(a,kD.prototype,!1),Lx(a,Fx,!1),a.request=Object.create(qx,{app:{configurable:!0,enumerable:!0,writable:!0,value:a}}),a.response=Object.create(Ux,{app:{configurable:!0,enumerable:!0,writable:!0,value:a}}),a.init(),a}Ut.application=Fx;Ut.request=qx;Ut.response=Ux;Ut.Route=AD;Ut.Router=ID;Ut.json=Ec.json;Ut.query=Ip();Ut.raw=Ec.raw;Ut.static=Mx();Ut.text=Ec.text;Ut.urlencoded=Ec.urlencoded;var ND=["bodyParser","compress","cookieSession","session","logger","cookieParser","favicon","responseTime","errorHandler","timeout","methodOverride","vhost","csrf","directory","limit","multipart","staticCache"];ND.forEach(function(a){Object.defineProperty(Ut,a,{get:function(){throw new Error("Most middleware (like "+a+") is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware.")},configurable:!0})})});var od=U((e3,zx)=>{"use strict";zx.exports=Bx()});var S0=U((Lc,_0)=>{(function(a,e){typeof Lc=="object"&&typeof _0<"u"?e(Lc):typeof define=="function"&&define.amd?define(["exports"],e):e(a.URI=a.URI||{})})(Lc,(function(a){"use strict";function e(){for(var L=arguments.length,I=Array(L),_=0;_1){I[0]=I[0].slice(0,-1);for(var x=I.length-1,P=1;P= 0x80 (not a basic code point)","invalid-input":"Invalid input"},A=d-v,$=Math.floor,N=String.fromCharCode;function C(L){throw new RangeError(D[L])}function O(L,I){for(var _=[],x=L.length;x--;)_[x]=I(L[x]);return _}function j(L,I){var _=L.split("@"),x="";_.length>1&&(x=_[0]+"@",L=_[1]),L=L.replace(k,".");var P=L.split("."),F=O(P,I).join(".");return x+F}function M(L){for(var I=[],_=0,x=L.length;_=55296&&P<=56319&&_>1,I+=$(I/_);I>A*h>>1;P+=d)I=$(I/A);return $(P+(A+1)*I/(I+m))},K=function(I){var _=[],x=I.length,P=0,F=b,B=g,J=I.lastIndexOf(R);J<0&&(J=0);for(var le=0;le=128&&C("not-basic"),_.push(I.charCodeAt(le));for(var _e=J>0?J+1:0;_e=x&&C("invalid-input");var Ae=V(I.charCodeAt(_e++));(Ae>=d||Ae>$((f-P)/je))&&C("overflow"),P+=Ae*je;var Se=be<=B?v:be>=B+h?h:be-B;if(Ae$(f/Ie)&&C("overflow"),je*=Ie}var he=_.length+1;B=Z(P-me,he,me==0),$(P/he)>f-F&&C("overflow"),F+=$(P/he),P%=he,_.splice(P++,0,F)}return String.fromCodePoint.apply(String,_)},se=function(I){var _=[];I=M(I);var x=I.length,P=b,F=0,B=g,J=!0,le=!1,_e=void 0;try{for(var me=I[Symbol.iterator](),je;!(J=(je=me.next()).done);J=!0){var be=je.value;be<128&&_.push(N(be))}}catch(Mt){le=!0,_e=Mt}finally{try{!J&&me.return&&me.return()}finally{if(le)throw _e}}var Ae=_.length,Se=Ae;for(Ae&&_.push(R);Se=P&&nt$((f-F)/Ue)&&C("overflow"),F+=(Ie-P)*Ue,P=Ie;var ot=!0,ht=!1,vt=void 0;try{for(var Zt=I[Symbol.iterator](),$t;!(ot=($t=Zt.next()).done);ot=!0){var Nr=$t.value;if(Nrf&&C("overflow"),Nr==P){for(var Er=F,wr=d;;wr+=d){var Ot=wr<=B?v:wr>=B+h?h:wr-B;if(Er>6|192).toString(16).toUpperCase()+"%"+(I&63|128).toString(16).toUpperCase():_="%"+(I>>12|224).toString(16).toUpperCase()+"%"+(I>>6&63|128).toString(16).toUpperCase()+"%"+(I&63|128).toString(16).toUpperCase(),_}function Ne(L){for(var I="",_=0,x=L.length;_=194&&P<224){if(x-_>=6){var F=parseInt(L.substr(_+4,2),16);I+=String.fromCharCode((P&31)<<6|F&63)}else I+=L.substr(_,6);_+=6}else if(P>=224){if(x-_>=9){var B=parseInt(L.substr(_+4,2),16),J=parseInt(L.substr(_+7,2),16);I+=String.fromCharCode((P&15)<<12|(B&63)<<6|J&63)}else I+=L.substr(_,9);_+=9}else I+=L.substr(_,3),_+=3}return I}function H(L,I){function _(x){var P=Ne(x);return P.match(I.UNRESERVED)?P:x}return L.scheme&&(L.scheme=String(L.scheme).replace(I.PCT_ENCODED,_).toLowerCase().replace(I.NOT_SCHEME,"")),L.userinfo!==void 0&&(L.userinfo=String(L.userinfo).replace(I.PCT_ENCODED,_).replace(I.NOT_USERINFO,Ee).replace(I.PCT_ENCODED,s)),L.host!==void 0&&(L.host=String(L.host).replace(I.PCT_ENCODED,_).toLowerCase().replace(I.NOT_HOST,Ee).replace(I.PCT_ENCODED,s)),L.path!==void 0&&(L.path=String(L.path).replace(I.PCT_ENCODED,_).replace(L.scheme?I.NOT_PATH:I.NOT_PATH_NOSCHEME,Ee).replace(I.PCT_ENCODED,s)),L.query!==void 0&&(L.query=String(L.query).replace(I.PCT_ENCODED,_).replace(I.NOT_QUERY,Ee).replace(I.PCT_ENCODED,s)),L.fragment!==void 0&&(L.fragment=String(L.fragment).replace(I.PCT_ENCODED,_).replace(I.NOT_FRAGMENT,Ee).replace(I.PCT_ENCODED,s)),L}function W(L){return L.replace(/^0*(.*)/,"$1")||"0"}function re(L,I){var _=L.match(I.IPV4ADDRESS)||[],x=u(_,2),P=x[1];return P?P.split(".").map(W).join("."):L}function ue(L,I){var _=L.match(I.IPV6ADDRESS)||[],x=u(_,3),P=x[1],F=x[2];if(P){for(var B=P.toLowerCase().split("::").reverse(),J=u(B,2),le=J[0],_e=J[1],me=_e?_e.split(":").map(W):[],je=le.split(":").map(W),be=I.IPV4ADDRESS.test(je[je.length-1]),Ae=be?7:8,Se=je.length-Ae,Ie=Array(Ae),he=0;he1){var qe=Ie.slice(0,Me.index),nt=Ie.slice(Me.index+Me.length);mt=qe.join(":")+"::"+nt.join(":")}else mt=Ie.join(":");return F&&(mt+="%"+F),mt}else return L}var G=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Q="".match(/(){0}/)[1]===void 0;function ne(L){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_={},x=I.iri!==!1?c:l;I.reference==="suffix"&&(L=(I.scheme?I.scheme+":":"")+"//"+L);var P=L.match(G);if(P){Q?(_.scheme=P[1],_.userinfo=P[3],_.host=P[4],_.port=parseInt(P[5],10),_.path=P[6]||"",_.query=P[7],_.fragment=P[8],isNaN(_.port)&&(_.port=P[5])):(_.scheme=P[1]||void 0,_.userinfo=L.indexOf("@")!==-1?P[3]:void 0,_.host=L.indexOf("//")!==-1?P[4]:void 0,_.port=parseInt(P[5],10),_.path=P[6]||"",_.query=L.indexOf("?")!==-1?P[7]:void 0,_.fragment=L.indexOf("#")!==-1?P[8]:void 0,isNaN(_.port)&&(_.port=L.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?P[4]:void 0)),_.host&&(_.host=ue(re(_.host,x),x)),_.scheme===void 0&&_.userinfo===void 0&&_.host===void 0&&_.port===void 0&&!_.path&&_.query===void 0?_.reference="same-document":_.scheme===void 0?_.reference="relative":_.fragment===void 0?_.reference="absolute":_.reference="uri",I.reference&&I.reference!=="suffix"&&I.reference!==_.reference&&(_.error=_.error||"URI is not a "+I.reference+" reference.");var F=Oe[(I.scheme||_.scheme||"").toLowerCase()];if(!I.unicodeSupport&&(!F||!F.unicodeSupport)){if(_.host&&(I.domainHost||F&&F.domainHost))try{_.host=de.toASCII(_.host.replace(x.PCT_ENCODED,Ne).toLowerCase())}catch(B){_.error=_.error||"Host's domain name can not be converted to ASCII via punycode: "+B}H(_,l)}else H(_,x);F&&F.parse&&F.parse(_,I)}else _.error=_.error||"URI can not be parsed.";return _}function ge(L,I){var _=I.iri!==!1?c:l,x=[];return L.userinfo!==void 0&&(x.push(L.userinfo),x.push("@")),L.host!==void 0&&x.push(ue(re(String(L.host),_),_).replace(_.IPV6ADDRESS,function(P,F,B){return"["+F+(B?"%25"+B:"")+"]"})),(typeof L.port=="number"||typeof L.port=="string")&&(x.push(":"),x.push(String(L.port))),x.length?x.join(""):void 0}var oe=/^\.\.?\//,Be=/^\/\.(\/|$)/,Ge=/^\/\.\.(\/|$)/,Re=/^\/?(?:.|\n)*?(?=\/|$)/;function et(L){for(var I=[];L.length;)if(L.match(oe))L=L.replace(oe,"");else if(L.match(Be))L=L.replace(Be,"/");else if(L.match(Ge))L=L.replace(Ge,"/"),I.pop();else if(L==="."||L==="..")L="";else{var _=L.match(Re);if(_){var x=_[0];L=L.slice(x.length),I.push(x)}else throw new Error("Unexpected dot segment condition")}return I.join("")}function ze(L){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_=I.iri?c:l,x=[],P=Oe[(I.scheme||L.scheme||"").toLowerCase()];if(P&&P.serialize&&P.serialize(L,I),L.host&&!_.IPV6ADDRESS.test(L.host)){if(I.domainHost||P&&P.domainHost)try{L.host=I.iri?de.toUnicode(L.host):de.toASCII(L.host.replace(_.PCT_ENCODED,Ne).toLowerCase())}catch(J){L.error=L.error||"Host's domain name can not be converted to "+(I.iri?"Unicode":"ASCII")+" via punycode: "+J}}H(L,_),I.reference!=="suffix"&&L.scheme&&(x.push(L.scheme),x.push(":"));var F=ge(L,I);if(F!==void 0&&(I.reference!=="suffix"&&x.push("//"),x.push(F),L.path&&L.path.charAt(0)!=="/"&&x.push("/")),L.path!==void 0){var B=L.path;!I.absolutePath&&(!P||!P.absolutePath)&&(B=et(B)),F===void 0&&(B=B.replace(/^\/\//,"/%2F")),x.push(B)}return L.query!==void 0&&(x.push("?"),x.push(L.query)),L.fragment!==void 0&&(x.push("#"),x.push(L.fragment)),x.join("")}function Qe(L,I){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},x=arguments[3],P={};return x||(L=ne(ze(L,_),_),I=ne(ze(I,_),_)),_=_||{},!_.tolerant&&I.scheme?(P.scheme=I.scheme,P.userinfo=I.userinfo,P.host=I.host,P.port=I.port,P.path=et(I.path||""),P.query=I.query):(I.userinfo!==void 0||I.host!==void 0||I.port!==void 0?(P.userinfo=I.userinfo,P.host=I.host,P.port=I.port,P.path=et(I.path||""),P.query=I.query):(I.path?(I.path.charAt(0)==="/"?P.path=et(I.path):((L.userinfo!==void 0||L.host!==void 0||L.port!==void 0)&&!L.path?P.path="/"+I.path:L.path?P.path=L.path.slice(0,L.path.lastIndexOf("/")+1)+I.path:P.path=I.path,P.path=et(P.path)),P.query=I.query):(P.path=L.path,I.query!==void 0?P.query=I.query:P.query=L.query),P.userinfo=L.userinfo,P.host=L.host,P.port=L.port),P.scheme=L.scheme),P.fragment=I.fragment,P}function Ze(L,I,_){var x=n({scheme:"null"},_);return ze(Qe(ne(L,x),ne(I,x),x,!0),x)}function Xe(L,I){return typeof L=="string"?L=ze(ne(L,I),I):t(L)==="object"&&(L=ne(ze(L,I),I)),L}function Et(L,I,_){return typeof L=="string"?L=ze(ne(L,_),_):t(L)==="object"&&(L=ze(L,_)),typeof I=="string"?I=ze(ne(I,_),_):t(I)==="object"&&(I=ze(I,_)),L===I}function wt(L,I){return L&&L.toString().replace(!I||!I.iri?l.ESCAPE:c.ESCAPE,Ee)}function Pt(L,I){return L&&L.toString().replace(!I||!I.iri?l.PCT_ENCODED:c.PCT_ENCODED,Ne)}var Qr={scheme:"http",domainHost:!0,parse:function(I,_){return I.host||(I.error=I.error||"HTTP URIs must have a host."),I},serialize:function(I,_){var x=String(I.scheme).toLowerCase()==="https";return(I.port===(x?443:80)||I.port==="")&&(I.port=void 0),I.path||(I.path="/"),I}},jt={scheme:"https",domainHost:Qr.domainHost,parse:Qr.parse,serialize:Qr.serialize};function ma(L){return typeof L.secure=="boolean"?L.secure:String(L.scheme).toLowerCase()==="wss"}var ha={scheme:"ws",domainHost:!0,parse:function(I,_){var x=I;return x.secure=ma(x),x.resourceName=(x.path||"/")+(x.query?"?"+x.query:""),x.path=void 0,x.query=void 0,x},serialize:function(I,_){if((I.port===(ma(I)?443:80)||I.port==="")&&(I.port=void 0),typeof I.secure=="boolean"&&(I.scheme=I.secure?"wss":"ws",I.secure=void 0),I.resourceName){var x=I.resourceName.split("?"),P=u(x,2),F=P[0],B=P[1];I.path=F&&F!=="/"?F:void 0,I.query=B,I.resourceName=void 0}return I.fragment=void 0,I}},ti={scheme:"wss",domainHost:ha.domainHost,parse:ha.parse,serialize:ha.serialize},qa={},uo=!0,po="[A-Za-z0-9\\-\\.\\_\\~"+(uo?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",rr="[0-9A-Fa-f]",fo=r(r("%[EFef]"+rr+"%"+rr+rr+"%"+rr+rr)+"|"+r("%[89A-Fa-f]"+rr+"%"+rr+rr)+"|"+r("%"+rr+rr)),ar="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Ql="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Yl=e(Ql,'[\\"\\\\]'),Jl="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",eu=new RegExp(po,"g"),va=new RegExp(fo,"g"),tu=new RegExp(e("[^]",ar,"[\\.]",'[\\"]',Yl),"g"),Yr=new RegExp(e("[^]",po,Jl),"g"),ru=Yr;function Gs(L){var I=Ne(L);return I.match(eu)?I:L}var mo={scheme:"mailto",parse:function(I,_){var x=I,P=x.to=x.path?x.path.split(","):[];if(x.path=void 0,x.query){for(var F=!1,B={},J=x.query.split("&"),le=0,_e=J.length;le<_e;++le){var me=J[le].split("=");switch(me[0]){case"to":for(var je=me[1].split(","),be=0,Ae=je.length;be{"use strict";E0.exports=function a(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var t,s,i;if(Array.isArray(e)){if(t=e.length,t!=r.length)return!1;for(s=t;s--!==0;)if(!a(e[s],r[s]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(i=Object.keys(e),t=i.length,t!==Object.keys(r).length)return!1;for(s=t;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[s]))return!1;for(s=t;s--!==0;){var n=i[s];if(!a(e[n],r[n]))return!1}return!0}return e!==e&&r!==r}});var T0=U((F3,w0)=>{"use strict";w0.exports=function(e){for(var r=0,t=e.length,s=0,i;s=55296&&i<=56319&&s{"use strict";O0.exports={copy:U2,checkDataType:Td,checkDataTypes:H2,coerceToTypes:B2,toHash:Pd,getProperty:Od,escapeQuotes:Cd,equal:Fc(),ucs2length:T0(),varOccurences:W2,varReplace:G2,schemaHasRules:Z2,schemaHasRulesExcept:K2,schemaUnknownRules:X2,toQuotedString:Rd,getPathExpr:Q2,getPath:Y2,getData:tj,unescapeFragment:rj,unescapeJsonPointer:Ad,escapeFragment:aj,escapeJsonPointer:kd};function U2(a,e){e=e||{};for(var r in a)e[r]=a[r];return e}function Td(a,e,r,t){var s=t?" !== ":" === ",i=t?" || ":" && ",n=t?"!":"",o=t?"":"!";switch(a){case"null":return e+s+"null";case"array":return n+"Array.isArray("+e+")";case"object":return"("+n+e+i+"typeof "+e+s+'"object"'+i+o+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+s+'"number"'+i+o+"("+e+" % 1)"+i+e+s+e+(r?i+n+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+s+'"'+a+'"'+(r?i+n+"isFinite("+e+")":"")+")";default:return"typeof "+e+s+'"'+a+'"'}}function H2(a,e,r){switch(a.length){case 1:return Td(a[0],e,r,!0);default:var t="",s=Pd(a);s.array&&s.object&&(t=s.null?"(":"(!"+e+" || ",t+="typeof "+e+' !== "object")',delete s.null,delete s.array,delete s.object),s.number&&delete s.integer;for(var i in s)t+=(t?" && ":"")+Td(i,e,r,!0);return t}}var R0=Pd(["string","number","integer","boolean","null"]);function B2(a,e){if(Array.isArray(e)){for(var r=[],t=0;t=e)throw new Error("Cannot access property/index "+t+" levels up, current level is "+e);return r[e-t]}if(t>e)throw new Error("Cannot access data "+t+" levels up, current level is "+e);if(i="data"+(e-t||""),!s)return i}for(var o=i,l=s.split("/"),c=0;c{"use strict";var sj=Ss();C0.exports=nj;function nj(a){sj.copy(a,this)}});var A0=U((H3,k0)=>{"use strict";var Da=k0.exports=function(a,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var t=typeof r=="function"?r:r.pre||function(){},s=r.post||function(){};qc(e,t,s,a,"",a)};Da.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};Da.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Da.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Da.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function qc(a,e,r,t,s,i,n,o,l,c){if(t&&typeof t=="object"&&!Array.isArray(t)){e(t,s,i,n,o,l,c);for(var u in t){var p=t[u];if(Array.isArray(p)){if(u in Da.arrayKeywords)for(var f=0;f{"use strict";var Gi=S0(),I0=Fc(),zc=Ss(),Uc=Id(),oj=A0();j0.exports=ja;ja.normalizeId=Na;ja.fullPath=Hc;ja.url=Bc;ja.ids=dj;ja.inlineRef=Dd;ja.schema=Vc;function ja(a,e,r){var t=this._refs[r];if(typeof t=="string")if(this._refs[t])t=this._refs[t];else return ja.call(this,a,e,t);if(t=t||this._schemas[r],t instanceof Uc)return Dd(t.schema,this._opts.inlineRefs)?t.schema:t.validate||this._compile(t);var s=Vc.call(this,e,r),i,n,o;return s&&(i=s.schema,e=s.root,o=s.baseId),i instanceof Uc?n=i.validate||a.call(this,i.schema,e,void 0,o):i!==void 0&&(n=Dd(i,this._opts.inlineRefs)?i:a.call(this,i,e,void 0,o)),n}function Vc(a,e){var r=Gi.parse(e),t=N0(r),s=Hc(this._getId(a.schema));if(Object.keys(a.schema).length===0||t!==s){var i=Na(t),n=this._refs[i];if(typeof n=="string")return cj.call(this,a,n,r);if(n instanceof Uc)n.validate||this._compile(n),a=n;else if(n=this._schemas[i],n instanceof Uc){if(n.validate||this._compile(n),i==Na(e))return{schema:n,root:a,baseId:s};a=n}else return;if(!a.schema)return;s=Hc(this._getId(a.schema))}return D0.call(this,r,s,a.schema,a)}function cj(a,e,r){var t=Vc.call(this,a,e);if(t){var s=t.schema,i=t.baseId;a=t.root;var n=this._getId(s);return n&&(i=Bc(i,n)),D0.call(this,r,i,s,a)}}var lj=zc.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function D0(a,e,r,t){if(a.fragment=a.fragment||"",a.fragment.slice(0,1)=="/"){for(var s=a.fragment.split("/"),i=1;i{"use strict";var $d=Wc();M0.exports={Validation:$0(fj),MissingRef:$0(Md)};function fj(a){this.message="validation failed",this.errors=a,this.ajv=this.validation=!0}Md.message=function(a,e){return"can't resolve reference "+e+" from id "+a};function Md(a,e,r){this.message=r||Md.message(a,e),this.missingRef=$d.url(a,e),this.missingSchema=$d.normalizeId($d.fullPath(this.missingRef))}function $0(a){return a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,a}});var Ld=U((V3,L0)=>{"use strict";L0.exports=function(a,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var r=typeof e.cycles=="boolean"?e.cycles:!1,t=e.cmp&&(function(i){return function(n){return function(o,l){var c={key:o,value:n[o]},u={key:l,value:n[l]};return i(c,u)}}})(e.cmp),s=[];return(function i(n){if(n&&n.toJSON&&typeof n.toJSON=="function"&&(n=n.toJSON()),n!==void 0){if(typeof n=="number")return isFinite(n)?""+n:"null";if(typeof n!="object")return JSON.stringify(n);var o,l;if(Array.isArray(n)){for(l="[",o=0;o{"use strict";F0.exports=function(e,r,t){var s="",i=e.schema.$async===!0,n=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),o=e.self._getId(e.schema);if(e.opts.strictKeywords){var l=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(l){var c="unknown keyword: "+l;if(e.opts.strictKeywords==="log")e.logger.warn(c);else throw new Error(c)}}if(e.isTop&&(s+=" var validate = ",i&&(e.async=!0,s+="async "),s+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",o&&(e.opts.sourceCode||e.opts.processCode)&&(s+=" "+("/*# sourceURL="+o+" */")+" ")),typeof e.schema=="boolean"||!(n||e.schema.$ref)){var r="false schema",u=e.level,p=e.dataLevel,f=e.schema[r],d=e.schemaPath+e.util.getProperty(r),v=e.errSchemaPath+"/"+r,w=!e.opts.allErrors,D,h="data"+(p||""),R="valid"+u;if(e.schema===!1){e.isTop?w=!0:s+=" var "+R+" = false; ";var m=m||[];m.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '"+(D||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(v)+" , params: {} ",e.opts.messages!==!1&&(s+=" , message: 'boolean schema is false' "),e.opts.verbose&&(s+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),s+=" } "):s+=" {} ";var y=s;s=m.pop(),!e.compositeRule&&w?e.async?s+=" throw new ValidationError(["+y+"]); ":s+=" validate.errors = ["+y+"]; return false; ":s+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?i?s+=" return data; ":s+=" validate.errors = null; return true; ":s+=" var "+R+" = true; ";return e.isTop&&(s+=" }; return validate; "),s}if(e.isTop){var g=e.isTop,u=e.level=0,p=e.dataLevel=0,h="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var b="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(b);else throw new Error(b)}s+=" var vErrors = null; ",s+=" var errors = 0; ",s+=" if (rootData === undefined) rootData = data; "}else{var u=e.level,p=e.dataLevel,h="data"+(p||"");if(o&&(e.baseId=e.resolve.url(e.baseId,o)),i&&!e.async)throw new Error("async schema in sync schema");s+=" var errs_"+u+" = errors;"}var R="valid"+u,w=!e.opts.allErrors,T="",k="",D,A=e.schema.type,$=Array.isArray(A);if(A&&e.opts.nullable&&e.schema.nullable===!0&&($?A.indexOf("null")==-1&&(A=A.concat("null")):A!="null"&&(A=[A,"null"],$=!0)),$&&A.length==1&&(A=A[0],$=!1),e.schema.$ref&&n){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(n=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(s+=" "+e.RULES.all.$comment.code(e,"$comment")),A){if(e.opts.coerceTypes)var N=e.util.coerceToTypes(e.opts.coerceTypes,A);var C=e.RULES.types[A];if(N||$||C===!0||C&&!Re(C)){var d=e.schemaPath+".type",v=e.errSchemaPath+"/type",d=e.schemaPath+".type",v=e.errSchemaPath+"/type",O=$?"checkDataTypes":"checkDataType";if(s+=" if ("+e.util[O](A,h,e.opts.strictNumbers,!0)+") { ",N){var j="dataType"+u,M="coerced"+u;s+=" var "+j+" = typeof "+h+"; var "+M+" = undefined; ",e.opts.coerceTypes=="array"&&(s+=" if ("+j+" == 'object' && Array.isArray("+h+") && "+h+".length == 1) { "+h+" = "+h+"[0]; "+j+" = typeof "+h+"; if ("+e.util.checkDataType(e.schema.type,h,e.opts.strictNumbers)+") "+M+" = "+h+"; } "),s+=" if ("+M+" !== undefined) ; ";var z=N;if(z)for(var V,X=-1,Z=z.length-1;X{"use strict";var Zc=Wc(),Xc=Ss(),U0=Gc(),mj=Ld(),q0=Fd(),hj=Xc.ucs2length,vj=Fc(),gj=U0.Validation;B0.exports=qd;function qd(a,e,r,t){var s=this,i=this._opts,n=[void 0],o={},l=[],c={},u=[],p={},f=[];e=e||{schema:a,refVal:n,refs:o};var d=yj.call(this,a,e,t),v=this._compilations[d.index];if(d.compiling)return v.callValidate=b;var h=this._formats,m=this.RULES;try{var y=R(a,e,r,t);v.validate=y;var g=v.callValidate;return g&&(g.schema=y.schema,g.errors=null,g.refs=y.refs,g.refVal=y.refVal,g.root=y.root,g.$async=y.$async,i.sourceCode&&(g.source=y.source)),y}finally{bj.call(this,a,e,t)}function b(){var O=v.validate,j=O.apply(this,arguments);return b.errors=O.errors,j}function R(O,j,M,z){var V=!j||j&&j.schema==O;if(j.schema!=e.schema)return qd.call(s,O,j,M,z);var X=O.$async===!0,Z=q0({isTop:!0,schema:O,isRoot:V,baseId:z,root:j,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:U0.MissingRef,RULES:m,validate:q0,util:Xc,resolve:Zc,resolveRef:w,usePattern:$,useDefault:N,useCustomRule:C,opts:i,formats:h,logger:s.logger,self:s});Z=Kc(n,Sj)+Kc(l,xj)+Kc(u,_j)+Kc(f,Ej)+Z,i.processCode&&(Z=i.processCode(Z,O));var K;try{var se=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",Z);K=se(s,m,h,e,n,u,f,vj,hj,gj),n[0]=K}catch(Y){throw s.logger.error("Error compiling schema, function code:",Z),Y}return K.schema=O,K.errors=null,K.refs=o,K.refVal=n,K.root=V?K:j,X&&(K.$async=!0),i.sourceCode===!0&&(K.source={code:Z,patterns:l,defaults:u}),K}function w(O,j,M){j=Zc.url(O,j);var z=o[j],V,X;if(z!==void 0)return V=n[z],X="refVal["+z+"]",A(V,X);if(!M&&e.refs){var Z=e.refs[j];if(Z!==void 0)return V=e.refVal[Z],X=T(j,V),A(V,X)}X=T(j);var K=Zc.call(s,R,e,j);if(K===void 0){var se=r&&r[j];se&&(K=Zc.inlineRef(se,i.inlineRefs)?se:qd.call(s,se,e,r,O))}if(K===void 0)k(j);else return D(j,K),A(K,X)}function T(O,j){var M=n.length;return n[M]=j,o[O]=M,"refVal"+M}function k(O){delete o[O]}function D(O,j){var M=o[O];n[M]=j}function A(O,j){return typeof O=="object"||typeof O=="boolean"?{code:j,schema:O,inline:!0}:{code:j,$async:O&&!!O.$async}}function $(O){var j=c[O];return j===void 0&&(j=c[O]=l.length,l[j]=O),"pattern"+j}function N(O){switch(typeof O){case"boolean":case"number":return""+O;case"string":return Xc.toQuotedString(O);case"object":if(O===null)return"null";var j=mj(O),M=p[j];return M===void 0&&(M=p[j]=u.length,u[M]=O),"default"+M}}function C(O,j,M,z){if(s._opts.validateSchema!==!1){var V=O.definition.dependencies;if(V&&!V.every(function(Ee){return Object.prototype.hasOwnProperty.call(M,Ee)}))throw new Error("parent schema must have all required keywords: "+V.join(","));var X=O.definition.validateSchema;if(X){var Z=X(j);if(!Z){var K="keyword schema is invalid: "+s.errorsText(X.errors);if(s._opts.validateSchema=="log")s.logger.error(K);else throw new Error(K)}}}var se=O.definition.compile,Y=O.definition.inline,we=O.definition.macro,de;if(se)de=se.call(s,j,M,z);else if(we)de=we.call(s,j,M,z),i.validateSchema!==!1&&s.validateSchema(de,!0);else if(Y)de=Y.call(s,z,O.keyword,j,M);else if(de=O.definition.validate,!de)return;if(de===void 0)throw new Error('custom keyword "'+O.keyword+'"failed to compile');var Oe=f.length;return f[Oe]=de,{code:"customRule"+Oe,validate:de}}}function yj(a,e,r){var t=H0.call(this,a,e,r);return t>=0?{index:t,compiling:!0}:(t=this._compilations.length,this._compilations[t]={schema:a,root:e,baseId:r},{index:t,compiling:!1})}function bj(a,e,r){var t=H0.call(this,a,e,r);t>=0&&this._compilations.splice(t,1)}function H0(a,e,r){for(var t=0;t{"use strict";var Qc=V0.exports=function(){this._cache={}};Qc.prototype.put=function(e,r){this._cache[e]=r};Qc.prototype.get=function(e){return this._cache[e]};Qc.prototype.del=function(e){delete this._cache[e]};Qc.prototype.clear=function(){this._cache={}}});var s_=U((K3,a_)=>{"use strict";var wj=Ss(),Tj=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Rj=[0,31,28,31,30,31,30,31,31,30,31,30,31],Pj=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,G0=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,Oj=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,Cj=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,Z0=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,K0=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,X0=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Q0=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Y0=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,J0=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;a_.exports=Yc;function Yc(a){return a=a=="full"?"full":"fast",wj.copy(Yc[a])}Yc.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":Z0,url:K0,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:G0,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:r_,uuid:X0,"json-pointer":Q0,"json-pointer-uri-fragment":Y0,"relative-json-pointer":J0};Yc.full={date:e_,time:t_,"date-time":Ij,uri:Nj,"uri-reference":Cj,"uri-template":Z0,url:K0,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:G0,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:r_,uuid:X0,"json-pointer":Q0,"json-pointer-uri-fragment":Y0,"relative-json-pointer":J0};function kj(a){return a%4===0&&(a%100!==0||a%400===0)}function e_(a){var e=a.match(Tj);if(!e)return!1;var r=+e[1],t=+e[2],s=+e[3];return t>=1&&t<=12&&s>=1&&s<=(t==2&&kj(r)?29:Rj[t])}function t_(a,e){var r=a.match(Pj);if(!r)return!1;var t=r[1],s=r[2],i=r[3],n=r[5];return(t<=23&&s<=59&&i<=59||t==23&&s==59&&i==60)&&(!e||n)}var Aj=/t|\s/i;function Ij(a){var e=a.split(Aj);return e.length==2&&e_(e[0])&&t_(e[1],!0)}var Dj=/\/|:/;function Nj(a){return Dj.test(a)&&Oj.test(a)}var jj=/[^\\]\\Z/;function r_(a){if(jj.test(a))return!1;try{return new RegExp(a),!0}catch{return!1}}});var i_=U((X3,n_)=>{"use strict";n_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.errSchemaPath+"/"+r,c=!e.opts.allErrors,u="data"+(n||""),p="valid"+i,f,d;if(o=="#"||o=="#/")e.isRoot?(f=e.async,d="validate"):(f=e.root.schema.$async===!0,d="root.refVal[0]");else{var v=e.resolveRef(e.baseId,o,e.isRoot);if(v===void 0){var h=e.MissingRefError.message(e.baseId,o);if(e.opts.missingRefs=="fail"){e.logger.error(h);var m=m||[];m.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { ref: '"+e.util.escapeQuotes(o)+"' } ",e.opts.messages!==!1&&(s+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(o)+"' "),e.opts.verbose&&(s+=" , schema: "+e.util.toQuotedString(o)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ";var y=s;s=m.pop(),!e.compositeRule&&c?e.async?s+=" throw new ValidationError(["+y+"]); ":s+=" validate.errors = ["+y+"]; return false; ":s+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(s+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(h),c&&(s+=" if (true) { ");else throw new e.MissingRefError(e.baseId,o,h)}else if(v.inline){var g=e.util.copy(e);g.level++;var b="valid"+g.level;g.schema=v.schema,g.schemaPath="",g.errSchemaPath=o;var R=e.validate(g).replace(/validate\.schema/g,v.code);s+=" "+R+" ",c&&(s+=" if ("+b+") { ")}else f=v.$async===!0||e.async&&v.$async!==!1,d=v.code}if(d){var m=m||[];m.push(s),s="",e.opts.passContext?s+=" "+d+".call(this, ":s+=" "+d+"( ",s+=" "+u+", (dataPath || '')",e.errorPath!='""'&&(s+=" + "+e.errorPath);var w=n?"data"+(n-1||""):"parentData",T=n?e.dataPathArr[n]:"parentDataProperty";s+=" , "+w+" , "+T+", rootData) ";var k=s;if(s=m.pop(),f){if(!e.async)throw new Error("async schema referenced by sync schema");c&&(s+=" var "+p+"; "),s+=" try { await "+k+"; ",c&&(s+=" "+p+" = true; "),s+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",c&&(s+=" "+p+" = false; "),s+=" } ",c&&(s+=" if ("+p+") { ")}else s+=" if (!"+k+") { if (vErrors === null) vErrors = "+d+".errors; else vErrors = vErrors.concat("+d+".errors); errors = vErrors.length; } ",c&&(s+=" else { ")}return s}});var c_=U((Q3,o_)=>{"use strict";o_.exports=function(e,r,t){var s=" ",i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),o=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c=e.util.copy(e),u="";c.level++;var p="valid"+c.level,f=c.baseId,d=!0,v=i;if(v)for(var h,m=-1,y=v.length-1;m0||h===!1:e.util.schemaHasRules(h,e.RULES.all))&&(d=!1,c.schema=h,c.schemaPath=n+"["+m+"]",c.errSchemaPath=o+"/"+m,s+=" "+e.validate(c)+" ",c.baseId=f,l&&(s+=" if ("+p+") { ",u+="}"));return l&&(d?s+=" if (true) { ":s+=" "+u.slice(0,-1)+" "),s}});var u_=U((Y3,l_)=>{"use strict";l_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="valid"+i,d="errs__"+i,v=e.util.copy(e),h="";v.level++;var m="valid"+v.level,y=o.every(function(D){return e.opts.strictKeywords?typeof D=="object"&&Object.keys(D).length>0||D===!1:e.util.schemaHasRules(D,e.RULES.all)});if(y){var g=v.baseId;s+=" var "+d+" = errors; var "+f+" = false; ";var b=e.compositeRule;e.compositeRule=v.compositeRule=!0;var R=o;if(R)for(var w,T=-1,k=R.length-1;T{"use strict";p_.exports=function(e,r,t){var s=" ",i=e.schema[r],n=e.errSchemaPath+"/"+r,o=!e.opts.allErrors,l=e.util.toQuotedString(i);return e.opts.$comment===!0?s+=" console.log("+l+");":typeof e.opts.$comment=="function"&&(s+=" self._opts.$comment("+l+", "+e.util.toQuotedString(n)+", validate.root.schema);"),s}});var m_=U((eU,f_)=>{"use strict";f_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="valid"+i,d=e.opts.$data&&o&&o.$data,v;d?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",v="schema"+i):v=o,d||(s+=" var schema"+i+" = validate.schema"+l+";"),s+="var "+f+" = equal("+p+", schema"+i+"); if (!"+f+") { ";var h=h||[];h.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValue: schema"+i+" } ",e.opts.messages!==!1&&(s+=" , message: 'should be equal to constant' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var m=s;return s=h.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+m+"]); ":s+=" validate.errors = ["+m+"]; return false; ":s+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" }",u&&(s+=" else { "),s}});var v_=U((tU,h_)=>{"use strict";h_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="valid"+i,d="errs__"+i,v=e.util.copy(e),h="";v.level++;var m="valid"+v.level,y="i"+i,g=v.dataLevel=e.dataLevel+1,b="data"+g,R=e.baseId,w=e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all);if(s+="var "+d+" = errors;var "+f+";",w){var T=e.compositeRule;e.compositeRule=v.compositeRule=!0,v.schema=o,v.schemaPath=l,v.errSchemaPath=c,s+=" var "+m+" = false; for (var "+y+" = 0; "+y+" < "+p+".length; "+y+"++) { ",v.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var k=p+"["+y+"]";v.dataPathArr[g]=y;var D=e.validate(v);v.baseId=R,e.util.varOccurences(D,b)<2?s+=" "+e.util.varReplace(D,b,k)+" ":s+=" var "+b+" = "+k+"; "+D+" ",s+=" if ("+m+") break; } ",e.compositeRule=v.compositeRule=T,s+=" "+h+" if (!"+m+") {"}else s+=" if ("+p+".length == 0) {";var A=A||[];A.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(s+=" , message: 'should contain a valid item' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var $=s;return s=A.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+$+"]); ":s+=" validate.errors = ["+$+"]; return false; ":s+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } else { ",w&&(s+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } "),e.opts.allErrors&&(s+=" } "),s}});var y_=U((rU,g_)=>{"use strict";g_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="errs__"+i,d=e.util.copy(e),v="";d.level++;var h="valid"+d.level,m={},y={},g=e.opts.ownProperties;for(T in o)if(T!="__proto__"){var b=o[T],R=Array.isArray(b)?y:m;R[T]=b}s+="var "+f+" = errors;";var w=e.errorPath;s+="var missing"+i+";";for(var T in y)if(R=y[T],R.length){if(s+=" if ( "+p+e.util.getProperty(T)+" !== undefined ",g&&(s+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(T)+"') "),u){s+=" && ( ";var k=R;if(k)for(var D,A=-1,$=k.length-1;A<$;){D=k[A+=1],A&&(s+=" || ");var N=e.util.getProperty(D),C=p+N;s+=" ( ( "+C+" === undefined ",g&&(s+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(D)+"') "),s+=") && (missing"+i+" = "+e.util.toQuotedString(e.opts.jsonPointers?D:N)+") ) "}s+=")) { ";var O="missing"+i,j="' + "+O+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(w,O,!0):w+" + "+O);var M=M||[];M.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(T)+"', missingProperty: '"+j+"', depsCount: "+R.length+", deps: '"+e.util.escapeQuotes(R.length==1?R[0]:R.join(", "))+"' } ",e.opts.messages!==!1&&(s+=" , message: 'should have ",R.length==1?s+="property "+e.util.escapeQuotes(R[0]):s+="properties "+e.util.escapeQuotes(R.join(", ")),s+=" when property "+e.util.escapeQuotes(T)+" is present' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var z=s;s=M.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+z+"]); ":s+=" validate.errors = ["+z+"]; return false; ":s+=" var err = "+z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{s+=" ) { ";var V=R;if(V)for(var D,X=-1,Z=V.length-1;X0||b===!1:e.util.schemaHasRules(b,e.RULES.all))&&(s+=" "+h+" = true; if ( "+p+e.util.getProperty(T)+" !== undefined ",g&&(s+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(T)+"') "),s+=") { ",d.schema=b,d.schemaPath=l+e.util.getProperty(T),d.errSchemaPath=c+"/"+e.util.escapeFragment(T),s+=" "+e.validate(d)+" ",d.baseId=K,s+=" } ",u&&(s+=" if ("+h+") { ",v+="}"))}return u&&(s+=" "+v+" if ("+f+" == errors) {"),s}});var x_=U((aU,b_)=>{"use strict";b_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="valid"+i,d=e.opts.$data&&o&&o.$data,v;d?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",v="schema"+i):v=o;var h="i"+i,m="schema"+i;d||(s+=" var "+m+" = validate.schema"+l+";"),s+="var "+f+";",d&&(s+=" if (schema"+i+" === undefined) "+f+" = true; else if (!Array.isArray(schema"+i+")) "+f+" = false; else {"),s+=""+f+" = false;for (var "+h+"=0; "+h+"<"+m+".length; "+h+"++) if (equal("+p+", "+m+"["+h+"])) { "+f+" = true; break; }",d&&(s+=" } "),s+=" if (!"+f+") { ";var y=y||[];y.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValues: schema"+i+" } ",e.opts.messages!==!1&&(s+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var g=s;return s=y.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+g+"]); ":s+=" validate.errors = ["+g+"]; return false; ":s+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" }",u&&(s+=" else { "),s}});var S_=U((sU,__)=>{"use strict";__.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||"");if(e.opts.format===!1)return u&&(s+=" if (true) { "),s;var f=e.opts.$data&&o&&o.$data,d;f?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",d="schema"+i):d=o;var v=e.opts.unknownFormats,h=Array.isArray(v);if(f){var m="format"+i,y="isObject"+i,g="formatType"+i;s+=" var "+m+" = formats["+d+"]; var "+y+" = typeof "+m+" == 'object' && !("+m+" instanceof RegExp) && "+m+".validate; var "+g+" = "+y+" && "+m+".type || 'string'; if ("+y+") { ",e.async&&(s+=" var async"+i+" = "+m+".async; "),s+=" "+m+" = "+m+".validate; } if ( ",f&&(s+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),s+=" (",v!="ignore"&&(s+=" ("+d+" && !"+m+" ",h&&(s+=" && self._opts.unknownFormats.indexOf("+d+") == -1 "),s+=") || "),s+=" ("+m+" && "+g+" == '"+t+"' && !(typeof "+m+" == 'function' ? ",e.async?s+=" (async"+i+" ? await "+m+"("+p+") : "+m+"("+p+")) ":s+=" "+m+"("+p+") ",s+=" : "+m+".test("+p+"))))) {"}else{var m=e.formats[o];if(!m){if(v=="ignore")return e.logger.warn('unknown format "'+o+'" ignored in schema at path "'+e.errSchemaPath+'"'),u&&(s+=" if (true) { "),s;if(h&&v.indexOf(o)>=0)return u&&(s+=" if (true) { "),s;throw new Error('unknown format "'+o+'" is used in schema at path "'+e.errSchemaPath+'"')}var y=typeof m=="object"&&!(m instanceof RegExp)&&m.validate,g=y&&m.type||"string";if(y){var b=m.async===!0;m=m.validate}if(g!=t)return u&&(s+=" if (true) { "),s;if(b){if(!e.async)throw new Error("async format in sync schema");var R="formats"+e.util.getProperty(o)+".validate";s+=" if (!(await "+R+"("+p+"))) { "}else{s+=" if (! ";var R="formats"+e.util.getProperty(o);y&&(R+=".validate"),typeof m=="function"?s+=" "+R+"("+p+") ":s+=" "+R+".test("+p+") ",s+=") { "}}var w=w||[];w.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { format: ",f?s+=""+d:s+=""+e.util.toQuotedString(o),s+=" } ",e.opts.messages!==!1&&(s+=` , message: 'should match format "`,f?s+="' + "+d+" + '":s+=""+e.util.escapeQuotes(o),s+=`"' `),e.opts.verbose&&(s+=" , schema: ",f?s+="validate.schema"+l:s+=""+e.util.toQuotedString(o),s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var T=s;return s=w.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+T+"]); ":s+=" validate.errors = ["+T+"]; return false; ":s+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",u&&(s+=" else { "),s}});var w_=U((nU,E_)=>{"use strict";E_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="valid"+i,d="errs__"+i,v=e.util.copy(e);v.level++;var h="valid"+v.level,m=e.schema.then,y=e.schema.else,g=m!==void 0&&(e.opts.strictKeywords?typeof m=="object"&&Object.keys(m).length>0||m===!1:e.util.schemaHasRules(m,e.RULES.all)),b=y!==void 0&&(e.opts.strictKeywords?typeof y=="object"&&Object.keys(y).length>0||y===!1:e.util.schemaHasRules(y,e.RULES.all)),R=v.baseId;if(g||b){var w;v.createErrors=!1,v.schema=o,v.schemaPath=l,v.errSchemaPath=c,s+=" var "+d+" = errors; var "+f+" = true; ";var T=e.compositeRule;e.compositeRule=v.compositeRule=!0,s+=" "+e.validate(v)+" ",v.baseId=R,v.createErrors=!0,s+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.compositeRule=v.compositeRule=T,g?(s+=" if ("+h+") { ",v.schema=e.schema.then,v.schemaPath=e.schemaPath+".then",v.errSchemaPath=e.errSchemaPath+"/then",s+=" "+e.validate(v)+" ",v.baseId=R,s+=" "+f+" = "+h+"; ",g&&b?(w="ifClause"+i,s+=" var "+w+" = 'then'; "):w="'then'",s+=" } ",b&&(s+=" else { ")):s+=" if (!"+h+") { ",b&&(v.schema=e.schema.else,v.schemaPath=e.schemaPath+".else",v.errSchemaPath=e.errSchemaPath+"/else",s+=" "+e.validate(v)+" ",v.baseId=R,s+=" "+f+" = "+h+"; ",g&&b?(w="ifClause"+i,s+=" var "+w+" = 'else'; "):w="'else'",s+=" } "),s+=" if (!"+f+") { var err = ",e.createErrors!==!1?(s+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { failingKeyword: "+w+" } ",e.opts.messages!==!1&&(s+=` , message: 'should match "' + `+w+` + '" schema' `),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ",s+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?s+=" throw new ValidationError(vErrors); ":s+=" validate.errors = vErrors; return false; "),s+=" } ",u&&(s+=" else { ")}else u&&(s+=" if (true) { ");return s}});var R_=U((iU,T_)=>{"use strict";T_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="valid"+i,d="errs__"+i,v=e.util.copy(e),h="";v.level++;var m="valid"+v.level,y="i"+i,g=v.dataLevel=e.dataLevel+1,b="data"+g,R=e.baseId;if(s+="var "+d+" = errors;var "+f+";",Array.isArray(o)){var w=e.schema.additionalItems;if(w===!1){s+=" "+f+" = "+p+".length <= "+o.length+"; ";var T=c;c=e.errSchemaPath+"/additionalItems",s+=" if (!"+f+") { ";var k=k||[];k.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+o.length+" } ",e.opts.messages!==!1&&(s+=" , message: 'should NOT have more than "+o.length+" items' "),e.opts.verbose&&(s+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var D=s;s=k.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+D+"]); ":s+=" validate.errors = ["+D+"]; return false; ":s+=" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",c=T,u&&(h+="}",s+=" else { ")}var A=o;if(A){for(var $,N=-1,C=A.length-1;N0||$===!1:e.util.schemaHasRules($,e.RULES.all)){s+=" "+m+" = true; if ("+p+".length > "+N+") { ";var O=p+"["+N+"]";v.schema=$,v.schemaPath=l+"["+N+"]",v.errSchemaPath=c+"/"+N,v.errorPath=e.util.getPathExpr(e.errorPath,N,e.opts.jsonPointers,!0),v.dataPathArr[g]=N;var j=e.validate(v);v.baseId=R,e.util.varOccurences(j,b)<2?s+=" "+e.util.varReplace(j,b,O)+" ":s+=" var "+b+" = "+O+"; "+j+" ",s+=" } ",u&&(s+=" if ("+m+") { ",h+="}")}}if(typeof w=="object"&&(e.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:e.util.schemaHasRules(w,e.RULES.all))){v.schema=w,v.schemaPath=e.schemaPath+".additionalItems",v.errSchemaPath=e.errSchemaPath+"/additionalItems",s+=" "+m+" = true; if ("+p+".length > "+o.length+") { for (var "+y+" = "+o.length+"; "+y+" < "+p+".length; "+y+"++) { ",v.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var O=p+"["+y+"]";v.dataPathArr[g]=y;var j=e.validate(v);v.baseId=R,e.util.varOccurences(j,b)<2?s+=" "+e.util.varReplace(j,b,O)+" ":s+=" var "+b+" = "+O+"; "+j+" ",u&&(s+=" if (!"+m+") break; "),s+=" } } ",u&&(s+=" if ("+m+") { ",h+="}")}}else if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){v.schema=o,v.schemaPath=l,v.errSchemaPath=c,s+=" for (var "+y+" = 0; "+y+" < "+p+".length; "+y+"++) { ",v.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var O=p+"["+y+"]";v.dataPathArr[g]=y;var j=e.validate(v);v.baseId=R,e.util.varOccurences(j,b)<2?s+=" "+e.util.varReplace(j,b,O)+" ":s+=" var "+b+" = "+O+"; "+j+" ",u&&(s+=" if (!"+m+") break; "),s+=" }"}return u&&(s+=" "+h+" if ("+d+" == errors) {"),s}});var Ud=U((oU,P_)=>{"use strict";P_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,R,p="data"+(n||""),f=e.opts.$data&&o&&o.$data,d;f?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",d="schema"+i):d=o;var v=r=="maximum",h=v?"exclusiveMaximum":"exclusiveMinimum",m=e.schema[h],y=e.opts.$data&&m&&m.$data,g=v?"<":">",b=v?">":"<",R=void 0;if(!(f||typeof o=="number"||o===void 0))throw new Error(r+" must be number");if(!(y||m===void 0||typeof m=="number"||typeof m=="boolean"))throw new Error(h+" must be number or boolean");if(y){var w=e.util.getData(m.$data,n,e.dataPathArr),T="exclusive"+i,k="exclType"+i,D="exclIsNumber"+i,A="op"+i,$="' + "+A+" + '";s+=" var schemaExcl"+i+" = "+w+"; ",w="schemaExcl"+i,s+=" var "+T+"; var "+k+" = typeof "+w+"; if ("+k+" != 'boolean' && "+k+" != 'undefined' && "+k+" != 'number') { ";var R=h,N=N||[];N.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '"+(R||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(s+=" , message: '"+h+" should be boolean' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var C=s;s=N.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+C+"]); ":s+=" validate.errors = ["+C+"]; return false; ":s+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } else if ( ",f&&(s+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),s+=" "+k+" == 'number' ? ( ("+T+" = "+d+" === undefined || "+w+" "+g+"= "+d+") ? "+p+" "+b+"= "+w+" : "+p+" "+b+" "+d+" ) : ( ("+T+" = "+w+" === true) ? "+p+" "+b+"= "+d+" : "+p+" "+b+" "+d+" ) || "+p+" !== "+p+") { var op"+i+" = "+T+" ? '"+g+"' : '"+g+"='; ",o===void 0&&(R=h,c=e.errSchemaPath+"/"+h,d=w,f=y)}else{var D=typeof m=="number",$=g;if(D&&f){var A="'"+$+"'";s+=" if ( ",f&&(s+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),s+=" ( "+d+" === undefined || "+m+" "+g+"= "+d+" ? "+p+" "+b+"= "+m+" : "+p+" "+b+" "+d+" ) || "+p+" !== "+p+") { "}else{D&&o===void 0?(T=!0,R=h,c=e.errSchemaPath+"/"+h,d=m,b+="="):(D&&(d=Math[v?"min":"max"](m,o)),m===(D?d:!0)?(T=!0,R=h,c=e.errSchemaPath+"/"+h,b+="="):(T=!1,$+="="));var A="'"+$+"'";s+=" if ( ",f&&(s+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),s+=" "+p+" "+b+" "+d+" || "+p+" !== "+p+") { "}}R=R||r;var N=N||[];N.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '"+(R||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { comparison: "+A+", limit: "+d+", exclusive: "+T+" } ",e.opts.messages!==!1&&(s+=" , message: 'should be "+$+" ",f?s+="' + "+d:s+=""+d+"'"),e.opts.verbose&&(s+=" , schema: ",f?s+="validate.schema"+l:s+=""+o,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var C=s;return s=N.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+C+"]); ":s+=" validate.errors = ["+C+"]; return false; ":s+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",u&&(s+=" else { "),s}});var Hd=U((cU,O_)=>{"use strict";O_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h,p="data"+(n||""),f=e.opts.$data&&o&&o.$data,d;if(f?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",d="schema"+i):d=o,!(f||typeof o=="number"))throw new Error(r+" must be number");var v=r=="maxItems"?">":"<";s+="if ( ",f&&(s+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),s+=" "+p+".length "+v+" "+d+") { ";var h=r,m=m||[];m.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '"+(h||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(s+=" , message: 'should NOT have ",r=="maxItems"?s+="more":s+="fewer",s+=" than ",f?s+="' + "+d+" + '":s+=""+o,s+=" items' "),e.opts.verbose&&(s+=" , schema: ",f?s+="validate.schema"+l:s+=""+o,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var y=s;return s=m.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+y+"]); ":s+=" validate.errors = ["+y+"]; return false; ":s+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}});var Bd=U((lU,C_)=>{"use strict";C_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h,p="data"+(n||""),f=e.opts.$data&&o&&o.$data,d;if(f?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",d="schema"+i):d=o,!(f||typeof o=="number"))throw new Error(r+" must be number");var v=r=="maxLength"?">":"<";s+="if ( ",f&&(s+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),e.opts.unicode===!1?s+=" "+p+".length ":s+=" ucs2length("+p+") ",s+=" "+v+" "+d+") { ";var h=r,m=m||[];m.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '"+(h||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(s+=" , message: 'should NOT be ",r=="maxLength"?s+="longer":s+="shorter",s+=" than ",f?s+="' + "+d+" + '":s+=""+o,s+=" characters' "),e.opts.verbose&&(s+=" , schema: ",f?s+="validate.schema"+l:s+=""+o,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var y=s;return s=m.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+y+"]); ":s+=" validate.errors = ["+y+"]; return false; ":s+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}});var zd=U((uU,k_)=>{"use strict";k_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h,p="data"+(n||""),f=e.opts.$data&&o&&o.$data,d;if(f?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",d="schema"+i):d=o,!(f||typeof o=="number"))throw new Error(r+" must be number");var v=r=="maxProperties"?">":"<";s+="if ( ",f&&(s+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),s+=" Object.keys("+p+").length "+v+" "+d+") { ";var h=r,m=m||[];m.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '"+(h||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(s+=" , message: 'should NOT have ",r=="maxProperties"?s+="more":s+="fewer",s+=" than ",f?s+="' + "+d+" + '":s+=""+o,s+=" properties' "),e.opts.verbose&&(s+=" , schema: ",f?s+="validate.schema"+l:s+=""+o,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var y=s;return s=m.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+y+"]); ":s+=" validate.errors = ["+y+"]; return false; ":s+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}});var I_=U((pU,A_)=>{"use strict";A_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f=e.opts.$data&&o&&o.$data,d;if(f?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",d="schema"+i):d=o,!(f||typeof o=="number"))throw new Error(r+" must be number");s+="var division"+i+";if (",f&&(s+=" "+d+" !== undefined && ( typeof "+d+" != 'number' || "),s+=" (division"+i+" = "+p+" / "+d+", ",e.opts.multipleOfPrecision?s+=" Math.abs(Math.round(division"+i+") - division"+i+") > 1e-"+e.opts.multipleOfPrecision+" ":s+=" division"+i+" !== parseInt(division"+i+") ",s+=" ) ",f&&(s+=" ) "),s+=" ) { ";var v=v||[];v.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { multipleOf: "+d+" } ",e.opts.messages!==!1&&(s+=" , message: 'should be multiple of ",f?s+="' + "+d:s+=""+d+"'"),e.opts.verbose&&(s+=" , schema: ",f?s+="validate.schema"+l:s+=""+o,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var h=s;return s=v.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+h+"]); ":s+=" validate.errors = ["+h+"]; return false; ":s+=" var err = "+h+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}});var N_=U((dU,D_)=>{"use strict";D_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="errs__"+i,d=e.util.copy(e);d.level++;var v="valid"+d.level;if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){d.schema=o,d.schemaPath=l,d.errSchemaPath=c,s+=" var "+f+" = errors; ";var h=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.createErrors=!1;var m;d.opts.allErrors&&(m=d.opts.allErrors,d.opts.allErrors=!1),s+=" "+e.validate(d)+" ",d.createErrors=!0,m&&(d.opts.allErrors=m),e.compositeRule=d.compositeRule=h,s+=" if ("+v+") { ";var y=y||[];y.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(s+=" , message: 'should NOT be valid' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var g=s;s=y.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+g+"]); ":s+=" validate.errors = ["+g+"]; return false; ":s+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } else { errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } ",e.opts.allErrors&&(s+=" } ")}else s+=" var err = ",e.createErrors!==!1?(s+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(s+=" , message: 'should NOT be valid' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ",s+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(s+=" if (false) { ");return s}});var $_=U((fU,j_)=>{"use strict";j_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="valid"+i,d="errs__"+i,v=e.util.copy(e),h="";v.level++;var m="valid"+v.level,y=v.baseId,g="prevValid"+i,b="passingSchemas"+i;s+="var "+d+" = errors , "+g+" = false , "+f+" = false , "+b+" = null; ";var R=e.compositeRule;e.compositeRule=v.compositeRule=!0;var w=o;if(w)for(var T,k=-1,D=w.length-1;k0||T===!1:e.util.schemaHasRules(T,e.RULES.all))?(v.schema=T,v.schemaPath=l+"["+k+"]",v.errSchemaPath=c+"/"+k,s+=" "+e.validate(v)+" ",v.baseId=y):s+=" var "+m+" = true; ",k&&(s+=" if ("+m+" && "+g+") { "+f+" = false; "+b+" = ["+b+", "+k+"]; } else { ",h+="}"),s+=" if ("+m+") { "+f+" = "+g+" = true; "+b+" = "+k+"; }";return e.compositeRule=v.compositeRule=R,s+=""+h+"if (!"+f+") { var err = ",e.createErrors!==!1?(s+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { passingSchemas: "+b+" } ",e.opts.messages!==!1&&(s+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ",s+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?s+=" throw new ValidationError(vErrors); ":s+=" validate.errors = vErrors; return false; "),s+="} else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; }",e.opts.allErrors&&(s+=" } "),s}});var L_=U((mU,M_)=>{"use strict";M_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f=e.opts.$data&&o&&o.$data,d;f?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",d="schema"+i):d=o;var v=f?"(new RegExp("+d+"))":e.usePattern(o);s+="if ( ",f&&(s+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),s+=" !"+v+".test("+p+") ) { ";var h=h||[];h.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { pattern: ",f?s+=""+d:s+=""+e.util.toQuotedString(o),s+=" } ",e.opts.messages!==!1&&(s+=` , message: 'should match pattern "`,f?s+="' + "+d+" + '":s+=""+e.util.escapeQuotes(o),s+=`"' `),e.opts.verbose&&(s+=" , schema: ",f?s+="validate.schema"+l:s+=""+e.util.toQuotedString(o),s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var m=s;return s=h.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+m+"]); ":s+=" validate.errors = ["+m+"]; return false; ":s+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}});var q_=U((hU,F_)=>{"use strict";F_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="errs__"+i,d=e.util.copy(e),v="";d.level++;var h="valid"+d.level,m="key"+i,y="idx"+i,g=d.dataLevel=e.dataLevel+1,b="data"+g,R="dataProperties"+i,w=Object.keys(o||{}).filter(X),T=e.schema.patternProperties||{},k=Object.keys(T).filter(X),D=e.schema.additionalProperties,A=w.length||k.length,$=D===!1,N=typeof D=="object"&&Object.keys(D).length,C=e.opts.removeAdditional,O=$||N||C,j=e.opts.ownProperties,M=e.baseId,z=e.schema.required;if(z&&!(e.opts.$data&&z.$data)&&z.length8)s+=" || validate.schema"+l+".hasOwnProperty("+m+") ";else{var Z=w;if(Z)for(var K,se=-1,Y=Z.length-1;se0||Re===!1:e.util.schemaHasRules(Re,e.RULES.all)){var et=e.util.getProperty(K),Q=p+et,ze=ge&&Re.default!==void 0;d.schema=Re,d.schemaPath=l+et,d.errSchemaPath=c+"/"+e.util.escapeFragment(K),d.errorPath=e.util.getPath(e.errorPath,K,e.opts.jsonPointers),d.dataPathArr[g]=e.util.toQuotedString(K);var ne=e.validate(d);if(d.baseId=M,e.util.varOccurences(ne,b)<2){ne=e.util.varReplace(ne,b,Q);var Qe=Q}else{var Qe=b;s+=" var "+b+" = "+Q+"; "}if(ze)s+=" "+ne+" ";else{if(V&&V[K]){s+=" if ( "+Qe+" === undefined ",j&&(s+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(K)+"') "),s+=") { "+h+" = false; ";var Ne=e.errorPath,W=c,Ze=e.util.escapeQuotes(K);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(Ne,K,e.opts.jsonPointers)),c=e.errSchemaPath+"/required";var re=re||[];re.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+Ze+"' } ",e.opts.messages!==!1&&(s+=" , message: '",e.opts._errorDataPathProperty?s+="is a required property":s+="should have required property \\'"+Ze+"\\'",s+="' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var ue=s;s=re.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+ue+"]); ":s+=" validate.errors = ["+ue+"]; return false; ":s+=" var err = "+ue+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=W,e.errorPath=Ne,s+=" } else { "}else u?(s+=" if ( "+Qe+" === undefined ",j&&(s+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(K)+"') "),s+=") { "+h+" = true; } else { "):(s+=" if ("+Qe+" !== undefined ",j&&(s+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(K)+"') "),s+=" ) { ");s+=" "+ne+" } "}}u&&(s+=" if ("+h+") { ",v+="}")}}if(k.length){var Xe=k;if(Xe)for(var de,Et=-1,wt=Xe.length-1;Et0||Re===!1:e.util.schemaHasRules(Re,e.RULES.all)){d.schema=Re,d.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(de),d.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(de),j?s+=" "+R+" = "+R+" || Object.keys("+p+"); for (var "+y+"=0; "+y+"<"+R+".length; "+y+"++) { var "+m+" = "+R+"["+y+"]; ":s+=" for (var "+m+" in "+p+") { ",s+=" if ("+e.usePattern(de)+".test("+m+")) { ",d.errorPath=e.util.getPathExpr(e.errorPath,m,e.opts.jsonPointers);var Q=p+"["+m+"]";d.dataPathArr[g]=m;var ne=e.validate(d);d.baseId=M,e.util.varOccurences(ne,b)<2?s+=" "+e.util.varReplace(ne,b,Q)+" ":s+=" var "+b+" = "+Q+"; "+ne+" ",u&&(s+=" if (!"+h+") break; "),s+=" } ",u&&(s+=" else "+h+" = true; "),s+=" } ",u&&(s+=" if ("+h+") { ",v+="}")}}}return u&&(s+=" "+v+" if ("+f+" == errors) {"),s}});var H_=U((vU,U_)=>{"use strict";U_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="errs__"+i,d=e.util.copy(e),v="";d.level++;var h="valid"+d.level;if(s+="var "+f+" = errors;",e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){d.schema=o,d.schemaPath=l,d.errSchemaPath=c;var m="key"+i,y="idx"+i,g="i"+i,b="' + "+m+" + '",R=d.dataLevel=e.dataLevel+1,w="data"+R,T="dataProperties"+i,k=e.opts.ownProperties,D=e.baseId;k&&(s+=" var "+T+" = undefined; "),k?s+=" "+T+" = "+T+" || Object.keys("+p+"); for (var "+y+"=0; "+y+"<"+T+".length; "+y+"++) { var "+m+" = "+T+"["+y+"]; ":s+=" for (var "+m+" in "+p+") { ",s+=" var startErrs"+i+" = errors; ";var A=m,$=e.compositeRule;e.compositeRule=d.compositeRule=!0;var N=e.validate(d);d.baseId=D,e.util.varOccurences(N,w)<2?s+=" "+e.util.varReplace(N,w,A)+" ":s+=" var "+w+" = "+A+"; "+N+" ",e.compositeRule=d.compositeRule=$,s+=" if (!"+h+") { for (var "+g+"=startErrs"+i+"; "+g+"{"use strict";B_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="valid"+i,d=e.opts.$data&&o&&o.$data,v;d?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",v="schema"+i):v=o;var h="schema"+i;if(!d)if(o.length0||w===!1:e.util.schemaHasRules(w,e.RULES.all))||(m[m.length]=g)}}else var m=o;if(d||m.length){var T=e.errorPath,k=d||m.length>=e.opts.loopRequired,D=e.opts.ownProperties;if(u)if(s+=" var missing"+i+"; ",k){d||(s+=" var "+h+" = validate.schema"+l+"; ");var A="i"+i,$="schema"+i+"["+A+"]",N="' + "+$+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(T,$,e.opts.jsonPointers)),s+=" var "+f+" = true; ",d&&(s+=" if (schema"+i+" === undefined) "+f+" = true; else if (!Array.isArray(schema"+i+")) "+f+" = false; else {"),s+=" for (var "+A+" = 0; "+A+" < "+h+".length; "+A+"++) { "+f+" = "+p+"["+h+"["+A+"]] !== undefined ",D&&(s+=" && Object.prototype.hasOwnProperty.call("+p+", "+h+"["+A+"]) "),s+="; if (!"+f+") break; } ",d&&(s+=" } "),s+=" if (!"+f+") { ";var C=C||[];C.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+N+"' } ",e.opts.messages!==!1&&(s+=" , message: '",e.opts._errorDataPathProperty?s+="is a required property":s+="should have required property \\'"+N+"\\'",s+="' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var O=s;s=C.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+O+"]); ":s+=" validate.errors = ["+O+"]; return false; ":s+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } else { "}else{s+=" if ( ";var j=m;if(j)for(var M,A=-1,z=j.length-1;A{"use strict";V_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="valid"+i,d=e.opts.$data&&o&&o.$data,v;if(d?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",v="schema"+i):v=o,(o||d)&&e.opts.uniqueItems!==!1){d&&(s+=" var "+f+"; if ("+v+" === false || "+v+" === undefined) "+f+" = true; else if (typeof "+v+" != 'boolean') "+f+" = false; else { "),s+=" var i = "+p+".length , "+f+" = true , j; if (i > 1) { ";var h=e.schema.items&&e.schema.items.type,m=Array.isArray(h);if(!h||h=="object"||h=="array"||m&&(h.indexOf("object")>=0||h.indexOf("array")>=0))s+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+p+"[i], "+p+"[j])) { "+f+" = false; break outer; } } } ";else{s+=" var itemIndices = {}, item; for (;i--;) { var item = "+p+"[i]; ";var y="checkDataType"+(m?"s":"");s+=" if ("+e.util[y](h,"item",e.opts.strictNumbers,!0)+") continue; ",m&&(s+=` if (typeof item == 'string') item = '"' + item; `),s+=" if (typeof itemIndices[item] == 'number') { "+f+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}s+=" } ",d&&(s+=" } "),s+=" if (!"+f+") { ";var g=g||[];g.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(s+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(s+=" , schema: ",d?s+="validate.schema"+l:s+=""+o,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var b=s;s=g.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+b+"]); ":s+=" validate.errors = ["+b+"]; return false; ":s+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",u&&(s+=" else { ")}else u&&(s+=" if (true) { ");return s}});var Z_=U((bU,G_)=>{"use strict";G_.exports={$ref:i_(),allOf:c_(),anyOf:u_(),$comment:d_(),const:m_(),contains:v_(),dependencies:y_(),enum:x_(),format:S_(),if:w_(),items:R_(),maximum:Ud(),minimum:Ud(),maxItems:Hd(),minItems:Hd(),maxLength:Bd(),minLength:Bd(),maxProperties:zd(),minProperties:zd(),multipleOf:I_(),not:N_(),oneOf:$_(),pattern:L_(),properties:q_(),propertyNames:H_(),required:z_(),uniqueItems:W_(),validate:Fd()}});var Q_=U((xU,X_)=>{"use strict";var K_=Z_(),Vd=Ss().toHash;X_.exports=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],r=["type","$comment"],t=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],s=["number","integer","string","array","object","boolean","null"];return e.all=Vd(r),e.types=Vd(s),e.forEach(function(i){i.rules=i.rules.map(function(n){var o;if(typeof n=="object"){var l=Object.keys(n)[0];o=n[l],n=l,o.forEach(function(u){r.push(u),e.all[u]=!0})}r.push(n);var c=e.all[n]={keyword:n,code:K_[n],implements:o};return c}),e.all.$comment={keyword:"$comment",code:K_.$comment},i.type&&(e.types[i.type]=i)}),e.keywords=Vd(r.concat(t)),e.custom={},e}});var eS=U((_U,J_)=>{"use strict";var Y_=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];J_.exports=function(a,e){for(var r=0;r{"use strict";var $j=Gc().MissingRef;rS.exports=tS;function tS(a,e,r){var t=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(r=e,e=void 0);var s=i(a).then(function(){var o=t._addSchema(a,void 0,e);return o.validate||n(o)});return r&&s.then(function(o){r(null,o)},r),s;function i(o){var l=o.$schema;return l&&!t.getSchema(l)?tS.call(t,{$ref:l},!0):Promise.resolve()}function n(o){try{return t._compile(o)}catch(c){if(c instanceof $j)return l(c);throw c}function l(c){var u=c.missingSchema;if(d(u))throw new Error("Schema "+u+" is loaded but "+c.missingRef+" cannot be resolved");var p=t._loadingSchemas[u];return p||(p=t._loadingSchemas[u]=t._opts.loadSchema(u),p.then(f,f)),p.then(function(v){if(!d(u))return i(v).then(function(){d(u)||t.addSchema(v,u,void 0,e)})}).then(function(){return n(o)});function f(){delete t._loadingSchemas[u]}function d(v){return t._refs[v]||t._schemas[v]}}}}});var nS=U((EU,sS)=>{"use strict";sS.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p,f="data"+(n||""),d="valid"+i,v="errs__"+i,h=e.opts.$data&&o&&o.$data,m;h?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",m="schema"+i):m=o;var y=this,g="definition"+i,b=y.definition,R="",w,T,k,D,A;if(h&&b.$data){A="keywordValidate"+i;var $=b.validateSchema;s+=" var "+g+" = RULES.custom['"+r+"'].definition; var "+A+" = "+g+".validate;"}else{if(D=e.useCustomRule(y,o,e.schema,e),!D)return;m="validate.schema"+l,A=D.code,w=b.compile,T=b.inline,k=b.macro}var N=A+".errors",C="i"+i,O="ruleErr"+i,j=b.async;if(j&&!e.async)throw new Error("async keyword in sync schema");if(T||k||(s+=""+N+" = null;"),s+="var "+v+" = errors;var "+d+";",h&&b.$data&&(R+="}",s+=" if ("+m+" === undefined) { "+d+" = true; } else { ",$&&(R+="}",s+=" "+d+" = "+g+".validateSchema("+m+"); if ("+d+") { ")),T)b.statements?s+=" "+D.validate+" ":s+=" "+d+" = "+D.validate+"; ";else if(k){var M=e.util.copy(e),R="";M.level++;var z="valid"+M.level;M.schema=D.validate,M.schemaPath="";var V=e.compositeRule;e.compositeRule=M.compositeRule=!0;var X=e.validate(M).replace(/validate\.schema/g,A);e.compositeRule=M.compositeRule=V,s+=" "+X}else{var Z=Z||[];Z.push(s),s="",s+=" "+A+".call( ",e.opts.passContext?s+="this":s+="self",w||b.schema===!1?s+=" , "+f+" ":s+=" , "+m+" , "+f+" , validate.schema"+e.schemaPath+" ",s+=" , (dataPath || '')",e.errorPath!='""'&&(s+=" + "+e.errorPath);var K=n?"data"+(n-1||""):"parentData",se=n?e.dataPathArr[n]:"parentDataProperty";s+=" , "+K+" , "+se+" , rootData ) ";var Y=s;s=Z.pop(),b.errors===!1?(s+=" "+d+" = ",j&&(s+="await "),s+=""+Y+"; "):j?(N="customErrors"+i,s+=" var "+N+" = null; try { "+d+" = await "+Y+"; } catch (e) { "+d+" = false; if (e instanceof ValidationError) "+N+" = e.errors; else throw e; } "):s+=" "+N+" = null; "+d+" = "+Y+"; "}if(b.modifying&&(s+=" if ("+K+") "+f+" = "+K+"["+se+"];"),s+=""+R,b.valid)u&&(s+=" if (true) { ");else{s+=" if ( ",b.valid===void 0?(s+=" !",k?s+=""+z:s+=""+d):s+=" "+!b.valid+" ",s+=") { ",p=y.keyword;var Z=Z||[];Z.push(s),s="";var Z=Z||[];Z.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '"+(p||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+y.keyword+"' } ",e.opts.messages!==!1&&(s+=` , message: 'should pass "`+y.keyword+`" keyword validation' `),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),s+=" } "):s+=" {} ";var we=s;s=Z.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+we+"]); ":s+=" validate.errors = ["+we+"]; return false; ":s+=" var err = "+we+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var de=s;s=Z.pop(),T?b.errors?b.errors!="full"&&(s+=" for (var "+C+"="+v+"; "+C+"{Mj.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var cS=U((TU,oS)=>{"use strict";var iS=Wd();oS.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:iS.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:iS.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}});var uS=U((RU,lS)=>{"use strict";var Lj=/^[a-z_$][a-z0-9_$-]*$/i,Fj=nS(),qj=cS();lS.exports={add:Uj,get:Hj,remove:Bj,validate:Gd};function Uj(a,e){var r=this.RULES;if(r.keywords[a])throw new Error("Keyword "+a+" is already defined");if(!Lj.test(a))throw new Error("Keyword "+a+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var t=e.type;if(Array.isArray(t))for(var s=0;s{zj.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var _S=U((OU,xS)=>{"use strict";var fS=z0(),Es=Wc(),Vj=W0(),mS=Id(),Wj=Ld(),Gj=s_(),Zj=Q_(),hS=eS(),vS=Ss();xS.exports=dt;dt.prototype.validate=Xj;dt.prototype.compile=Qj;dt.prototype.addSchema=Yj;dt.prototype.addMetaSchema=Jj;dt.prototype.validateSchema=e$;dt.prototype.getSchema=r$;dt.prototype.removeSchema=s$;dt.prototype.addFormat=d$;dt.prototype.errorsText=p$;dt.prototype._addSchema=n$;dt.prototype._compile=i$;dt.prototype.compileAsync=aS();var tl=uS();dt.prototype.addKeyword=tl.add;dt.prototype.getKeyword=tl.get;dt.prototype.removeKeyword=tl.remove;dt.prototype.validateKeyword=tl.validate;var gS=Gc();dt.ValidationError=gS.Validation;dt.MissingRefError=gS.MissingRef;dt.$dataMetaSchema=hS;var el="http://json-schema.org/draft-07/schema",dS=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],Kj=["/properties"];function dt(a){if(!(this instanceof dt))return new dt(a);a=this._opts=vS.copy(a)||{},y$(this),this._schemas={},this._refs={},this._fragments={},this._formats=Gj(a.format),this._cache=a.cache||new Vj,this._loadingSchemas={},this._compilations=[],this.RULES=Zj(),this._getId=o$(a),a.loopRequired=a.loopRequired||1/0,a.errorDataPath=="property"&&(a._errorDataPathProperty=!0),a.serialize===void 0&&(a.serialize=Wj),this._metaOpts=g$(this),a.formats&&h$(this),a.keywords&&v$(this),f$(this),typeof a.meta=="object"&&this.addMetaSchema(a.meta),a.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),m$(this)}function Xj(a,e){var r;if(typeof a=="string"){if(r=this.getSchema(a),!r)throw new Error('no schema with key or ref "'+a+'"')}else{var t=this._addSchema(a);r=t.validate||this._compile(t)}var s=r(e);return r.$async!==!0&&(this.errors=r.errors),s}function Qj(a,e){var r=this._addSchema(a,void 0,e);return r.validate||this._compile(r)}function Yj(a,e,r,t){if(Array.isArray(a)){for(var s=0;s{RS.exports=TS;TS.sync=x$;var ES=require("fs");function b$(a,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var t=0;t{AS.exports=CS;CS.sync=_$;var OS=require("fs");function CS(a,e,r){OS.stat(a,function(t,s){r(t,t?!1:kS(s,e))})}function _$(a,e){return kS(OS.statSync(a),e)}function kS(a,e){return a.isFile()&&S$(a,e)}function S$(a,e){var r=a.mode,t=a.uid,s=a.gid,i=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),n=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),o=parseInt("100",8),l=parseInt("010",8),c=parseInt("001",8),u=o|l,p=r&c||r&l&&s===n||r&o&&t===i||r&u&&i===0;return p}});var NS=U((jU,DS)=>{var NU=require("fs"),rl;process.platform==="win32"||global.TESTING_WINDOWS?rl=PS():rl=IS();DS.exports=Kd;Kd.sync=E$;function Kd(a,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(t,s){Kd(a,e||{},function(i,n){i?s(i):t(n)})})}rl(a,e||{},function(t,s){t&&(t.code==="EACCES"||e&&e.ignoreErrors)&&(t=null,s=!1),r(t,s)})}function E$(a,e){try{return rl.sync(a,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var US=U(($U,qS)=>{var In=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",jS=require("path"),w$=In?";":":",$S=NS(),MS=a=>Object.assign(new Error(`not found: ${a}`),{code:"ENOENT"}),LS=(a,e)=>{let r=e.colon||w$,t=a.match(/\//)||In&&a.match(/\\/)?[""]:[...In?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],s=In?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=In?s.split(r):[""];return In&&a.indexOf(".")!==-1&&i[0]!==""&&i.unshift(""),{pathEnv:t,pathExt:i,pathExtExe:s}},FS=(a,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:t,pathExt:s,pathExtExe:i}=LS(a,e),n=[],o=c=>new Promise((u,p)=>{if(c===t.length)return e.all&&n.length?u(n):p(MS(a));let f=t[c],d=/^".*"$/.test(f)?f.slice(1,-1):f,v=jS.join(d,a),h=!d&&/^\.[\\\/]/.test(a)?a.slice(0,2)+v:v;u(l(h,c,0))}),l=(c,u,p)=>new Promise((f,d)=>{if(p===s.length)return f(o(u+1));let v=s[p];$S(c+v,{pathExt:i},(h,m)=>{if(!h&&m)if(e.all)n.push(c+v);else return f(c+v);return f(l(c,u,p+1))})});return r?o(0).then(c=>r(null,c),r):o(0)},T$=(a,e)=>{e=e||{};let{pathEnv:r,pathExt:t,pathExtExe:s}=LS(a,e),i=[];for(let n=0;n{"use strict";var HS=(a={})=>{let e=a.env||process.env;return(a.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(t=>t.toUpperCase()==="PATH")||"Path"};Xd.exports=HS;Xd.exports.default=HS});var GS=U((LU,WS)=>{"use strict";var zS=require("path"),R$=US(),P$=BS();function VS(a,e){let r=a.options.env||process.env,t=process.cwd(),s=a.options.cwd!=null,i=s&&process.chdir!==void 0&&!process.chdir.disabled;if(i)try{process.chdir(a.options.cwd)}catch{}let n;try{n=R$.sync(a.command,{path:r[P$({env:r})],pathExt:e?zS.delimiter:void 0})}catch{}finally{i&&process.chdir(t)}return n&&(n=zS.resolve(s?a.options.cwd:"",n)),n}function O$(a){return VS(a)||VS(a,!0)}WS.exports=O$});var ZS=U((FU,Yd)=>{"use strict";var Qd=/([()\][%!^"`<>&|;, *?])/g;function C$(a){return a=a.replace(Qd,"^$1"),a}function k$(a,e){return a=`${a}`,a=a.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),a=a.replace(/(?=(\\+?)?)\1$/,"$1$1"),a=`"${a}"`,a=a.replace(Qd,"^$1"),e&&(a=a.replace(Qd,"^$1")),a}Yd.exports.command=C$;Yd.exports.argument=k$});var XS=U((qU,KS)=>{"use strict";KS.exports=/^#!(.*)/});var YS=U((UU,QS)=>{"use strict";var A$=XS();QS.exports=(a="")=>{let e=a.match(A$);if(!e)return null;let[r,t]=e[0].replace(/#! ?/,"").split(" "),s=r.split("/").pop();return s==="env"?t:t?`${s} ${t}`:s}});var eE=U((HU,JS)=>{"use strict";var Jd=require("fs"),I$=YS();function D$(a){let r=Buffer.alloc(150),t;try{t=Jd.openSync(a,"r"),Jd.readSync(t,r,0,150,0),Jd.closeSync(t)}catch{}return I$(r.toString())}JS.exports=D$});var sE=U((BU,aE)=>{"use strict";var N$=require("path"),tE=GS(),rE=ZS(),j$=eE(),$$=process.platform==="win32",M$=/\.(?:com|exe)$/i,L$=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function F$(a){a.file=tE(a);let e=a.file&&j$(a.file);return e?(a.args.unshift(a.file),a.command=e,tE(a)):a.file}function q$(a){if(!$$)return a;let e=F$(a),r=!M$.test(e);if(a.options.forceShell||r){let t=L$.test(e);a.command=N$.normalize(a.command),a.command=rE.command(a.command),a.args=a.args.map(i=>rE.argument(i,t));let s=[a.command].concat(a.args).join(" ");a.args=["/d","/s","/c",`"${s}"`],a.command=process.env.comspec||"cmd.exe",a.options.windowsVerbatimArguments=!0}return a}function U$(a,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let t={command:a,args:e,options:r,file:void 0,original:{command:a,args:e}};return r.shell?t:q$(t)}aE.exports=U$});var oE=U((zU,iE)=>{"use strict";var ef=process.platform==="win32";function tf(a,e){return Object.assign(new Error(`${e} ${a.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${a.command}`,path:a.command,spawnargs:a.args})}function H$(a,e){if(!ef)return;let r=a.emit;a.emit=function(t,s){if(t==="exit"){let i=nE(s,e);if(i)return r.call(a,"error",i)}return r.apply(a,arguments)}}function nE(a,e){return ef&&a===1&&!e.file?tf(e.original,"spawn"):null}function B$(a,e){return ef&&a===1&&!e.file?tf(e.original,"spawnSync"):null}iE.exports={hookChildProcess:H$,verifyENOENT:nE,verifyENOENTSync:B$,notFoundError:tf}});var uE=U((VU,Dn)=>{"use strict";var cE=require("child_process"),rf=sE(),af=oE();function lE(a,e,r){let t=rf(a,e,r),s=cE.spawn(t.command,t.args,t.options);return af.hookChildProcess(s,t),s}function z$(a,e,r){let t=rf(a,e,r),s=cE.spawnSync(t.command,t.args,t.options);return s.error=s.error||af.verifyENOENTSync(s.status,t),s}Dn.exports=lE;Dn.exports.spawn=lE;Dn.exports.sync=z$;Dn.exports._parse=rf;Dn.exports._enoent=af});var jn,$n,Ki,sl,mE,hE,Xi=Ba(()=>{"use strict";jn=["bugfix","feature","refactor","discovery","decision","change"],$n=["how-it-works","why-it-exists","what-changed","problem-solution","gotcha","pattern","trade-off"],Ki={bugfix:"\u{1F534}",feature:"\u{1F7E3}",refactor:"\u{1F504}",change:"\u2705",discovery:"\u{1F535}",decision:"\u2696\uFE0F","session-request":"\u{1F3AF}"},sl={discovery:"\u{1F50D}",change:"\u{1F6E0}\uFE0F",feature:"\u{1F6E0}\uFE0F",bugfix:"\u{1F6E0}\uFE0F",refactor:"\u{1F6E0}\uFE0F",decision:"\u2696\uFE0F"},mE=jn.join(","),hE=$n.join(",")});var Mn,vE,gE,lt,oa=Ba(()=>{"use strict";Mn=require("fs"),vE=require("path"),gE=require("os");Xi();yt();lt=class{static DEFAULTS={CLAUDE_MEM_MODEL:"claude-sonnet-4-5",CLAUDE_MEM_CONTEXT_OBSERVATIONS:"50",CLAUDE_MEM_WORKER_PORT:"37777",CLAUDE_MEM_WORKER_HOST:"127.0.0.1",CLAUDE_MEM_SKIP_TOOLS:"ListMcpResourcesTool,SlashCommand,Skill,TodoWrite,AskUserQuestion",CLAUDE_MEM_DATA_DIR:(0,vE.join)((0,gE.homedir)(),".claude-mem"),CLAUDE_MEM_LOG_LEVEL:"INFO",CLAUDE_MEM_PYTHON_VERSION:"3.13",CLAUDE_CODE_PATH:"",CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS:"true",CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS:"true",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT:"true",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT:"true",CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES:mE,CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS:hE,CLAUDE_MEM_CONTEXT_FULL_COUNT:"5",CLAUDE_MEM_CONTEXT_FULL_FIELD:"narrative",CLAUDE_MEM_CONTEXT_SESSION_COUNT:"10",CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY:"true",CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE:"false"};static getAllDefaults(){return{...this.DEFAULTS}}static get(e){return this.DEFAULTS[e]}static getInt(e){let r=this.get(e);return parseInt(r,10)}static getBool(e){return this.get(e)==="true"}static loadFromFile(e){if(!(0,Mn.existsSync)(e))return this.getAllDefaults();let r=(0,Mn.readFileSync)(e,"utf-8"),t=JSON.parse(r),s=t;if(t.env&&typeof t.env=="object"){s=t.env;try{(0,Mn.writeFileSync)(e,JSON.stringify(s,null,2),"utf-8"),q.info("SETTINGS","Migrated settings file from nested to flat schema",{settingsPath:e})}catch(n){q.warn("SETTINGS","Failed to auto-migrate settings file",{settingsPath:e},n)}}let i={...this.DEFAULTS};for(let n of Object.keys(this.DEFAULTS))s[n]!==void 0&&(i[n]=s[n]);return i}}});var sf,nf,q,yt=Ba(()=>{"use strict";oa();sf=(i=>(i[i.DEBUG=0]="DEBUG",i[i.INFO=1]="INFO",i[i.WARN=2]="WARN",i[i.ERROR=3]="ERROR",i[i.SILENT=4]="SILENT",i))(sf||{}),nf=class{level=null;useColor;constructor(){this.useColor=process.stdout.isTTY??!1}getLevel(){if(this.level===null){let e=lt.get("CLAUDE_MEM_LOG_LEVEL").toUpperCase();this.level=sf[e]??1}return this.level}correlationId(e,r){return`obs-${e}-${r}`}sessionId(e){return`session-${e}`}formatData(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return e.toString();if(typeof e=="object"){if(e instanceof Error)return this.getLevel()===0?`${e.message} +`}function OD(){return function(){this.error(404)}}function CD(){return function(e){if(this.hasTrailingSlash()){this.error(404);return}var r=nd.original(this.req);r.path=null,r.pathname=RD(r.pathname+"/");var t=_D(wD.format(r)),s=PD("Redirecting","Redirecting to "+SD(t));e.statusCode=301,e.setHeader("Content-Type","text/html; charset=UTF-8"),e.setHeader("Content-Length",Buffer.byteLength(s)),e.setHeader("Content-Security-Policy","default-src 'none'"),e.setHeader("X-Content-Type-Options","nosniff"),e.setHeader("Location",t),e.end(s)}}});var Bx=U((Ut,Hx)=>{"use strict";var Ec=py(),kD=require("events").EventEmitter,Lx=fy(),Fx=Gb(),AD=Cp(),ID=Ap(),qx=bx(),Ux=jx();Ut=Hx.exports=DD;function DD(){var a=function(e,r,t){a.handle(e,r,t)};return Lx(a,kD.prototype,!1),Lx(a,Fx,!1),a.request=Object.create(qx,{app:{configurable:!0,enumerable:!0,writable:!0,value:a}}),a.response=Object.create(Ux,{app:{configurable:!0,enumerable:!0,writable:!0,value:a}}),a.init(),a}Ut.application=Fx;Ut.request=qx;Ut.response=Ux;Ut.Route=AD;Ut.Router=ID;Ut.json=Ec.json;Ut.query=Ip();Ut.raw=Ec.raw;Ut.static=Mx();Ut.text=Ec.text;Ut.urlencoded=Ec.urlencoded;var ND=["bodyParser","compress","cookieSession","session","logger","cookieParser","favicon","responseTime","errorHandler","timeout","methodOverride","vhost","csrf","directory","limit","multipart","staticCache"];ND.forEach(function(a){Object.defineProperty(Ut,a,{get:function(){throw new Error("Most middleware (like "+a+") is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware.")},configurable:!0})})});var od=U((e3,zx)=>{"use strict";zx.exports=Bx()});var S0=U((Lc,_0)=>{(function(a,e){typeof Lc=="object"&&typeof _0<"u"?e(Lc):typeof define=="function"&&define.amd?define(["exports"],e):e(a.URI=a.URI||{})})(Lc,(function(a){"use strict";function e(){for(var L=arguments.length,I=Array(L),_=0;_1){I[0]=I[0].slice(0,-1);for(var x=I.length-1,P=1;P= 0x80 (not a basic code point)","invalid-input":"Invalid input"},A=d-v,$=Math.floor,N=String.fromCharCode;function C(L){throw new RangeError(D[L])}function O(L,I){for(var _=[],x=L.length;x--;)_[x]=I(L[x]);return _}function j(L,I){var _=L.split("@"),x="";_.length>1&&(x=_[0]+"@",L=_[1]),L=L.replace(k,".");var P=L.split("."),F=O(P,I).join(".");return x+F}function M(L){for(var I=[],_=0,x=L.length;_=55296&&P<=56319&&_>1,I+=$(I/_);I>A*h>>1;P+=d)I=$(I/A);return $(P+(A+1)*I/(I+m))},K=function(I){var _=[],x=I.length,P=0,F=b,B=g,Y=I.lastIndexOf(R);Y<0&&(Y=0);for(var le=0;le=128&&C("not-basic"),_.push(I.charCodeAt(le));for(var _e=Y>0?Y+1:0;_e=x&&C("invalid-input");var ke=V(I.charCodeAt(_e++));(ke>=d||ke>$((f-P)/je))&&C("overflow"),P+=ke*je;var Se=be<=B?v:be>=B+h?h:be-B;if(ke$(f/Ae)&&C("overflow"),je*=Ae}var he=_.length+1;B=Z(P-me,he,me==0),$(P/he)>f-F&&C("overflow"),F+=$(P/he),P%=he,_.splice(P++,0,F)}return String.fromCodePoint.apply(String,_)},ae=function(I){var _=[];I=M(I);var x=I.length,P=b,F=0,B=g,Y=!0,le=!1,_e=void 0;try{for(var me=I[Symbol.iterator](),je;!(Y=(je=me.next()).done);Y=!0){var be=je.value;be<128&&_.push(N(be))}}catch(Mt){le=!0,_e=Mt}finally{try{!Y&&me.return&&me.return()}finally{if(le)throw _e}}var ke=_.length,Se=ke;for(ke&&_.push(R);Se=P&&nt$((f-F)/Ue)&&C("overflow"),F+=(Ae-P)*Ue,P=Ae;var ot=!0,ht=!1,vt=void 0;try{for(var Zt=I[Symbol.iterator](),$t;!(ot=($t=Zt.next()).done);ot=!0){var Nr=$t.value;if(Nrf&&C("overflow"),Nr==P){for(var Er=F,wr=d;;wr+=d){var Ot=wr<=B?v:wr>=B+h?h:wr-B;if(Er>6|192).toString(16).toUpperCase()+"%"+(I&63|128).toString(16).toUpperCase():_="%"+(I>>12|224).toString(16).toUpperCase()+"%"+(I>>6&63|128).toString(16).toUpperCase()+"%"+(I&63|128).toString(16).toUpperCase(),_}function Ne(L){for(var I="",_=0,x=L.length;_=194&&P<224){if(x-_>=6){var F=parseInt(L.substr(_+4,2),16);I+=String.fromCharCode((P&31)<<6|F&63)}else I+=L.substr(_,6);_+=6}else if(P>=224){if(x-_>=9){var B=parseInt(L.substr(_+4,2),16),Y=parseInt(L.substr(_+7,2),16);I+=String.fromCharCode((P&15)<<12|(B&63)<<6|Y&63)}else I+=L.substr(_,9);_+=9}else I+=L.substr(_,3),_+=3}return I}function H(L,I){function _(x){var P=Ne(x);return P.match(I.UNRESERVED)?P:x}return L.scheme&&(L.scheme=String(L.scheme).replace(I.PCT_ENCODED,_).toLowerCase().replace(I.NOT_SCHEME,"")),L.userinfo!==void 0&&(L.userinfo=String(L.userinfo).replace(I.PCT_ENCODED,_).replace(I.NOT_USERINFO,Ee).replace(I.PCT_ENCODED,s)),L.host!==void 0&&(L.host=String(L.host).replace(I.PCT_ENCODED,_).toLowerCase().replace(I.NOT_HOST,Ee).replace(I.PCT_ENCODED,s)),L.path!==void 0&&(L.path=String(L.path).replace(I.PCT_ENCODED,_).replace(L.scheme?I.NOT_PATH:I.NOT_PATH_NOSCHEME,Ee).replace(I.PCT_ENCODED,s)),L.query!==void 0&&(L.query=String(L.query).replace(I.PCT_ENCODED,_).replace(I.NOT_QUERY,Ee).replace(I.PCT_ENCODED,s)),L.fragment!==void 0&&(L.fragment=String(L.fragment).replace(I.PCT_ENCODED,_).replace(I.NOT_FRAGMENT,Ee).replace(I.PCT_ENCODED,s)),L}function W(L){return L.replace(/^0*(.*)/,"$1")||"0"}function re(L,I){var _=L.match(I.IPV4ADDRESS)||[],x=u(_,2),P=x[1];return P?P.split(".").map(W).join("."):L}function ue(L,I){var _=L.match(I.IPV6ADDRESS)||[],x=u(_,3),P=x[1],F=x[2];if(P){for(var B=P.toLowerCase().split("::").reverse(),Y=u(B,2),le=Y[0],_e=Y[1],me=_e?_e.split(":").map(W):[],je=le.split(":").map(W),be=I.IPV4ADDRESS.test(je[je.length-1]),ke=be?7:8,Se=je.length-ke,Ae=Array(ke),he=0;he1){var qe=Ae.slice(0,Me.index),nt=Ae.slice(Me.index+Me.length);mt=qe.join(":")+"::"+nt.join(":")}else mt=Ae.join(":");return F&&(mt+="%"+F),mt}else return L}var G=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Q="".match(/(){0}/)[1]===void 0;function ne(L){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_={},x=I.iri!==!1?c:l;I.reference==="suffix"&&(L=(I.scheme?I.scheme+":":"")+"//"+L);var P=L.match(G);if(P){Q?(_.scheme=P[1],_.userinfo=P[3],_.host=P[4],_.port=parseInt(P[5],10),_.path=P[6]||"",_.query=P[7],_.fragment=P[8],isNaN(_.port)&&(_.port=P[5])):(_.scheme=P[1]||void 0,_.userinfo=L.indexOf("@")!==-1?P[3]:void 0,_.host=L.indexOf("//")!==-1?P[4]:void 0,_.port=parseInt(P[5],10),_.path=P[6]||"",_.query=L.indexOf("?")!==-1?P[7]:void 0,_.fragment=L.indexOf("#")!==-1?P[8]:void 0,isNaN(_.port)&&(_.port=L.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?P[4]:void 0)),_.host&&(_.host=ue(re(_.host,x),x)),_.scheme===void 0&&_.userinfo===void 0&&_.host===void 0&&_.port===void 0&&!_.path&&_.query===void 0?_.reference="same-document":_.scheme===void 0?_.reference="relative":_.fragment===void 0?_.reference="absolute":_.reference="uri",I.reference&&I.reference!=="suffix"&&I.reference!==_.reference&&(_.error=_.error||"URI is not a "+I.reference+" reference.");var F=De[(I.scheme||_.scheme||"").toLowerCase()];if(!I.unicodeSupport&&(!F||!F.unicodeSupport)){if(_.host&&(I.domainHost||F&&F.domainHost))try{_.host=fe.toASCII(_.host.replace(x.PCT_ENCODED,Ne).toLowerCase())}catch(B){_.error=_.error||"Host's domain name can not be converted to ASCII via punycode: "+B}H(_,l)}else H(_,x);F&&F.parse&&F.parse(_,I)}else _.error=_.error||"URI can not be parsed.";return _}function ge(L,I){var _=I.iri!==!1?c:l,x=[];return L.userinfo!==void 0&&(x.push(L.userinfo),x.push("@")),L.host!==void 0&&x.push(ue(re(String(L.host),_),_).replace(_.IPV6ADDRESS,function(P,F,B){return"["+F+(B?"%25"+B:"")+"]"})),(typeof L.port=="number"||typeof L.port=="string")&&(x.push(":"),x.push(String(L.port))),x.length?x.join(""):void 0}var oe=/^\.\.?\//,Be=/^\/\.(\/|$)/,Ge=/^\/\.\.(\/|$)/,Re=/^\/?(?:.|\n)*?(?=\/|$)/;function et(L){for(var I=[];L.length;)if(L.match(oe))L=L.replace(oe,"");else if(L.match(Be))L=L.replace(Be,"/");else if(L.match(Ge))L=L.replace(Ge,"/"),I.pop();else if(L==="."||L==="..")L="";else{var _=L.match(Re);if(_){var x=_[0];L=L.slice(x.length),I.push(x)}else throw new Error("Unexpected dot segment condition")}return I.join("")}function ze(L){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_=I.iri?c:l,x=[],P=De[(I.scheme||L.scheme||"").toLowerCase()];if(P&&P.serialize&&P.serialize(L,I),L.host&&!_.IPV6ADDRESS.test(L.host)){if(I.domainHost||P&&P.domainHost)try{L.host=I.iri?fe.toUnicode(L.host):fe.toASCII(L.host.replace(_.PCT_ENCODED,Ne).toLowerCase())}catch(Y){L.error=L.error||"Host's domain name can not be converted to "+(I.iri?"Unicode":"ASCII")+" via punycode: "+Y}}H(L,_),I.reference!=="suffix"&&L.scheme&&(x.push(L.scheme),x.push(":"));var F=ge(L,I);if(F!==void 0&&(I.reference!=="suffix"&&x.push("//"),x.push(F),L.path&&L.path.charAt(0)!=="/"&&x.push("/")),L.path!==void 0){var B=L.path;!I.absolutePath&&(!P||!P.absolutePath)&&(B=et(B)),F===void 0&&(B=B.replace(/^\/\//,"/%2F")),x.push(B)}return L.query!==void 0&&(x.push("?"),x.push(L.query)),L.fragment!==void 0&&(x.push("#"),x.push(L.fragment)),x.join("")}function Qe(L,I){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},x=arguments[3],P={};return x||(L=ne(ze(L,_),_),I=ne(ze(I,_),_)),_=_||{},!_.tolerant&&I.scheme?(P.scheme=I.scheme,P.userinfo=I.userinfo,P.host=I.host,P.port=I.port,P.path=et(I.path||""),P.query=I.query):(I.userinfo!==void 0||I.host!==void 0||I.port!==void 0?(P.userinfo=I.userinfo,P.host=I.host,P.port=I.port,P.path=et(I.path||""),P.query=I.query):(I.path?(I.path.charAt(0)==="/"?P.path=et(I.path):((L.userinfo!==void 0||L.host!==void 0||L.port!==void 0)&&!L.path?P.path="/"+I.path:L.path?P.path=L.path.slice(0,L.path.lastIndexOf("/")+1)+I.path:P.path=I.path,P.path=et(P.path)),P.query=I.query):(P.path=L.path,I.query!==void 0?P.query=I.query:P.query=L.query),P.userinfo=L.userinfo,P.host=L.host,P.port=L.port),P.scheme=L.scheme),P.fragment=I.fragment,P}function Ze(L,I,_){var x=n({scheme:"null"},_);return ze(Qe(ne(L,x),ne(I,x),x,!0),x)}function Xe(L,I){return typeof L=="string"?L=ze(ne(L,I),I):t(L)==="object"&&(L=ne(ze(L,I),I)),L}function Et(L,I,_){return typeof L=="string"?L=ze(ne(L,_),_):t(L)==="object"&&(L=ze(L,_)),typeof I=="string"?I=ze(ne(I,_),_):t(I)==="object"&&(I=ze(I,_)),L===I}function wt(L,I){return L&&L.toString().replace(!I||!I.iri?l.ESCAPE:c.ESCAPE,Ee)}function Pt(L,I){return L&&L.toString().replace(!I||!I.iri?l.PCT_ENCODED:c.PCT_ENCODED,Ne)}var Qr={scheme:"http",domainHost:!0,parse:function(I,_){return I.host||(I.error=I.error||"HTTP URIs must have a host."),I},serialize:function(I,_){var x=String(I.scheme).toLowerCase()==="https";return(I.port===(x?443:80)||I.port==="")&&(I.port=void 0),I.path||(I.path="/"),I}},jt={scheme:"https",domainHost:Qr.domainHost,parse:Qr.parse,serialize:Qr.serialize};function ma(L){return typeof L.secure=="boolean"?L.secure:String(L.scheme).toLowerCase()==="wss"}var ha={scheme:"ws",domainHost:!0,parse:function(I,_){var x=I;return x.secure=ma(x),x.resourceName=(x.path||"/")+(x.query?"?"+x.query:""),x.path=void 0,x.query=void 0,x},serialize:function(I,_){if((I.port===(ma(I)?443:80)||I.port==="")&&(I.port=void 0),typeof I.secure=="boolean"&&(I.scheme=I.secure?"wss":"ws",I.secure=void 0),I.resourceName){var x=I.resourceName.split("?"),P=u(x,2),F=P[0],B=P[1];I.path=F&&F!=="/"?F:void 0,I.query=B,I.resourceName=void 0}return I.fragment=void 0,I}},ti={scheme:"wss",domainHost:ha.domainHost,parse:ha.parse,serialize:ha.serialize},qa={},uo=!0,po="[A-Za-z0-9\\-\\.\\_\\~"+(uo?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",rr="[0-9A-Fa-f]",fo=r(r("%[EFef]"+rr+"%"+rr+rr+"%"+rr+rr)+"|"+r("%[89A-Fa-f]"+rr+"%"+rr+rr)+"|"+r("%"+rr+rr)),ar="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Ql="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Yl=e(Ql,'[\\"\\\\]'),Jl="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",eu=new RegExp(po,"g"),va=new RegExp(fo,"g"),tu=new RegExp(e("[^]",ar,"[\\.]",'[\\"]',Yl),"g"),Yr=new RegExp(e("[^]",po,Jl),"g"),ru=Yr;function Gs(L){var I=Ne(L);return I.match(eu)?I:L}var mo={scheme:"mailto",parse:function(I,_){var x=I,P=x.to=x.path?x.path.split(","):[];if(x.path=void 0,x.query){for(var F=!1,B={},Y=x.query.split("&"),le=0,_e=Y.length;le<_e;++le){var me=Y[le].split("=");switch(me[0]){case"to":for(var je=me[1].split(","),be=0,ke=je.length;be{"use strict";E0.exports=function a(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var t,s,i;if(Array.isArray(e)){if(t=e.length,t!=r.length)return!1;for(s=t;s--!==0;)if(!a(e[s],r[s]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(i=Object.keys(e),t=i.length,t!==Object.keys(r).length)return!1;for(s=t;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[s]))return!1;for(s=t;s--!==0;){var n=i[s];if(!a(e[n],r[n]))return!1}return!0}return e!==e&&r!==r}});var T0=U((F3,w0)=>{"use strict";w0.exports=function(e){for(var r=0,t=e.length,s=0,i;s=55296&&i<=56319&&s{"use strict";O0.exports={copy:U2,checkDataType:Td,checkDataTypes:H2,coerceToTypes:B2,toHash:Pd,getProperty:Od,escapeQuotes:Cd,equal:Fc(),ucs2length:T0(),varOccurences:W2,varReplace:G2,schemaHasRules:Z2,schemaHasRulesExcept:K2,schemaUnknownRules:X2,toQuotedString:Rd,getPathExpr:Q2,getPath:Y2,getData:tj,unescapeFragment:rj,unescapeJsonPointer:Ad,escapeFragment:aj,escapeJsonPointer:kd};function U2(a,e){e=e||{};for(var r in a)e[r]=a[r];return e}function Td(a,e,r,t){var s=t?" !== ":" === ",i=t?" || ":" && ",n=t?"!":"",o=t?"":"!";switch(a){case"null":return e+s+"null";case"array":return n+"Array.isArray("+e+")";case"object":return"("+n+e+i+"typeof "+e+s+'"object"'+i+o+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+s+'"number"'+i+o+"("+e+" % 1)"+i+e+s+e+(r?i+n+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+s+'"'+a+'"'+(r?i+n+"isFinite("+e+")":"")+")";default:return"typeof "+e+s+'"'+a+'"'}}function H2(a,e,r){switch(a.length){case 1:return Td(a[0],e,r,!0);default:var t="",s=Pd(a);s.array&&s.object&&(t=s.null?"(":"(!"+e+" || ",t+="typeof "+e+' !== "object")',delete s.null,delete s.array,delete s.object),s.number&&delete s.integer;for(var i in s)t+=(t?" && ":"")+Td(i,e,r,!0);return t}}var R0=Pd(["string","number","integer","boolean","null"]);function B2(a,e){if(Array.isArray(e)){for(var r=[],t=0;t=e)throw new Error("Cannot access property/index "+t+" levels up, current level is "+e);return r[e-t]}if(t>e)throw new Error("Cannot access data "+t+" levels up, current level is "+e);if(i="data"+(e-t||""),!s)return i}for(var o=i,l=s.split("/"),c=0;c{"use strict";var sj=Ss();C0.exports=nj;function nj(a){sj.copy(a,this)}});var A0=U((H3,k0)=>{"use strict";var Da=k0.exports=function(a,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var t=typeof r=="function"?r:r.pre||function(){},s=r.post||function(){};qc(e,t,s,a,"",a)};Da.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};Da.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Da.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Da.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function qc(a,e,r,t,s,i,n,o,l,c){if(t&&typeof t=="object"&&!Array.isArray(t)){e(t,s,i,n,o,l,c);for(var u in t){var p=t[u];if(Array.isArray(p)){if(u in Da.arrayKeywords)for(var f=0;f{"use strict";var Gi=S0(),I0=Fc(),zc=Ss(),Uc=Id(),oj=A0();j0.exports=ja;ja.normalizeId=Na;ja.fullPath=Hc;ja.url=Bc;ja.ids=dj;ja.inlineRef=Dd;ja.schema=Vc;function ja(a,e,r){var t=this._refs[r];if(typeof t=="string")if(this._refs[t])t=this._refs[t];else return ja.call(this,a,e,t);if(t=t||this._schemas[r],t instanceof Uc)return Dd(t.schema,this._opts.inlineRefs)?t.schema:t.validate||this._compile(t);var s=Vc.call(this,e,r),i,n,o;return s&&(i=s.schema,e=s.root,o=s.baseId),i instanceof Uc?n=i.validate||a.call(this,i.schema,e,void 0,o):i!==void 0&&(n=Dd(i,this._opts.inlineRefs)?i:a.call(this,i,e,void 0,o)),n}function Vc(a,e){var r=Gi.parse(e),t=N0(r),s=Hc(this._getId(a.schema));if(Object.keys(a.schema).length===0||t!==s){var i=Na(t),n=this._refs[i];if(typeof n=="string")return cj.call(this,a,n,r);if(n instanceof Uc)n.validate||this._compile(n),a=n;else if(n=this._schemas[i],n instanceof Uc){if(n.validate||this._compile(n),i==Na(e))return{schema:n,root:a,baseId:s};a=n}else return;if(!a.schema)return;s=Hc(this._getId(a.schema))}return D0.call(this,r,s,a.schema,a)}function cj(a,e,r){var t=Vc.call(this,a,e);if(t){var s=t.schema,i=t.baseId;a=t.root;var n=this._getId(s);return n&&(i=Bc(i,n)),D0.call(this,r,i,s,a)}}var lj=zc.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function D0(a,e,r,t){if(a.fragment=a.fragment||"",a.fragment.slice(0,1)=="/"){for(var s=a.fragment.split("/"),i=1;i{"use strict";var $d=Wc();M0.exports={Validation:$0(fj),MissingRef:$0(Md)};function fj(a){this.message="validation failed",this.errors=a,this.ajv=this.validation=!0}Md.message=function(a,e){return"can't resolve reference "+e+" from id "+a};function Md(a,e,r){this.message=r||Md.message(a,e),this.missingRef=$d.url(a,e),this.missingSchema=$d.normalizeId($d.fullPath(this.missingRef))}function $0(a){return a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,a}});var Ld=U((V3,L0)=>{"use strict";L0.exports=function(a,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var r=typeof e.cycles=="boolean"?e.cycles:!1,t=e.cmp&&(function(i){return function(n){return function(o,l){var c={key:o,value:n[o]},u={key:l,value:n[l]};return i(c,u)}}})(e.cmp),s=[];return(function i(n){if(n&&n.toJSON&&typeof n.toJSON=="function"&&(n=n.toJSON()),n!==void 0){if(typeof n=="number")return isFinite(n)?""+n:"null";if(typeof n!="object")return JSON.stringify(n);var o,l;if(Array.isArray(n)){for(l="[",o=0;o{"use strict";F0.exports=function(e,r,t){var s="",i=e.schema.$async===!0,n=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),o=e.self._getId(e.schema);if(e.opts.strictKeywords){var l=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(l){var c="unknown keyword: "+l;if(e.opts.strictKeywords==="log")e.logger.warn(c);else throw new Error(c)}}if(e.isTop&&(s+=" var validate = ",i&&(e.async=!0,s+="async "),s+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",o&&(e.opts.sourceCode||e.opts.processCode)&&(s+=" "+("/*# sourceURL="+o+" */")+" ")),typeof e.schema=="boolean"||!(n||e.schema.$ref)){var r="false schema",u=e.level,p=e.dataLevel,f=e.schema[r],d=e.schemaPath+e.util.getProperty(r),v=e.errSchemaPath+"/"+r,w=!e.opts.allErrors,D,h="data"+(p||""),R="valid"+u;if(e.schema===!1){e.isTop?w=!0:s+=" var "+R+" = false; ";var m=m||[];m.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '"+(D||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(v)+" , params: {} ",e.opts.messages!==!1&&(s+=" , message: 'boolean schema is false' "),e.opts.verbose&&(s+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),s+=" } "):s+=" {} ";var y=s;s=m.pop(),!e.compositeRule&&w?e.async?s+=" throw new ValidationError(["+y+"]); ":s+=" validate.errors = ["+y+"]; return false; ":s+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?i?s+=" return data; ":s+=" validate.errors = null; return true; ":s+=" var "+R+" = true; ";return e.isTop&&(s+=" }; return validate; "),s}if(e.isTop){var g=e.isTop,u=e.level=0,p=e.dataLevel=0,h="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var b="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(b);else throw new Error(b)}s+=" var vErrors = null; ",s+=" var errors = 0; ",s+=" if (rootData === undefined) rootData = data; "}else{var u=e.level,p=e.dataLevel,h="data"+(p||"");if(o&&(e.baseId=e.resolve.url(e.baseId,o)),i&&!e.async)throw new Error("async schema in sync schema");s+=" var errs_"+u+" = errors;"}var R="valid"+u,w=!e.opts.allErrors,T="",k="",D,A=e.schema.type,$=Array.isArray(A);if(A&&e.opts.nullable&&e.schema.nullable===!0&&($?A.indexOf("null")==-1&&(A=A.concat("null")):A!="null"&&(A=[A,"null"],$=!0)),$&&A.length==1&&(A=A[0],$=!1),e.schema.$ref&&n){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(n=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(s+=" "+e.RULES.all.$comment.code(e,"$comment")),A){if(e.opts.coerceTypes)var N=e.util.coerceToTypes(e.opts.coerceTypes,A);var C=e.RULES.types[A];if(N||$||C===!0||C&&!Re(C)){var d=e.schemaPath+".type",v=e.errSchemaPath+"/type",d=e.schemaPath+".type",v=e.errSchemaPath+"/type",O=$?"checkDataTypes":"checkDataType";if(s+=" if ("+e.util[O](A,h,e.opts.strictNumbers,!0)+") { ",N){var j="dataType"+u,M="coerced"+u;s+=" var "+j+" = typeof "+h+"; var "+M+" = undefined; ",e.opts.coerceTypes=="array"&&(s+=" if ("+j+" == 'object' && Array.isArray("+h+") && "+h+".length == 1) { "+h+" = "+h+"[0]; "+j+" = typeof "+h+"; if ("+e.util.checkDataType(e.schema.type,h,e.opts.strictNumbers)+") "+M+" = "+h+"; } "),s+=" if ("+M+" !== undefined) ; ";var z=N;if(z)for(var V,X=-1,Z=z.length-1;X{"use strict";var Zc=Wc(),Xc=Ss(),U0=Gc(),mj=Ld(),q0=Fd(),hj=Xc.ucs2length,vj=Fc(),gj=U0.Validation;B0.exports=qd;function qd(a,e,r,t){var s=this,i=this._opts,n=[void 0],o={},l=[],c={},u=[],p={},f=[];e=e||{schema:a,refVal:n,refs:o};var d=yj.call(this,a,e,t),v=this._compilations[d.index];if(d.compiling)return v.callValidate=b;var h=this._formats,m=this.RULES;try{var y=R(a,e,r,t);v.validate=y;var g=v.callValidate;return g&&(g.schema=y.schema,g.errors=null,g.refs=y.refs,g.refVal=y.refVal,g.root=y.root,g.$async=y.$async,i.sourceCode&&(g.source=y.source)),y}finally{bj.call(this,a,e,t)}function b(){var O=v.validate,j=O.apply(this,arguments);return b.errors=O.errors,j}function R(O,j,M,z){var V=!j||j&&j.schema==O;if(j.schema!=e.schema)return qd.call(s,O,j,M,z);var X=O.$async===!0,Z=q0({isTop:!0,schema:O,isRoot:V,baseId:z,root:j,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:U0.MissingRef,RULES:m,validate:q0,util:Xc,resolve:Zc,resolveRef:w,usePattern:$,useDefault:N,useCustomRule:C,opts:i,formats:h,logger:s.logger,self:s});Z=Kc(n,Sj)+Kc(l,xj)+Kc(u,_j)+Kc(f,Ej)+Z,i.processCode&&(Z=i.processCode(Z,O));var K;try{var ae=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",Z);K=ae(s,m,h,e,n,u,f,vj,hj,gj),n[0]=K}catch(J){throw s.logger.error("Error compiling schema, function code:",Z),J}return K.schema=O,K.errors=null,K.refs=o,K.refVal=n,K.root=V?K:j,X&&(K.$async=!0),i.sourceCode===!0&&(K.source={code:Z,patterns:l,defaults:u}),K}function w(O,j,M){j=Zc.url(O,j);var z=o[j],V,X;if(z!==void 0)return V=n[z],X="refVal["+z+"]",A(V,X);if(!M&&e.refs){var Z=e.refs[j];if(Z!==void 0)return V=e.refVal[Z],X=T(j,V),A(V,X)}X=T(j);var K=Zc.call(s,R,e,j);if(K===void 0){var ae=r&&r[j];ae&&(K=Zc.inlineRef(ae,i.inlineRefs)?ae:qd.call(s,ae,e,r,O))}if(K===void 0)k(j);else return D(j,K),A(K,X)}function T(O,j){var M=n.length;return n[M]=j,o[O]=M,"refVal"+M}function k(O){delete o[O]}function D(O,j){var M=o[O];n[M]=j}function A(O,j){return typeof O=="object"||typeof O=="boolean"?{code:j,schema:O,inline:!0}:{code:j,$async:O&&!!O.$async}}function $(O){var j=c[O];return j===void 0&&(j=c[O]=l.length,l[j]=O),"pattern"+j}function N(O){switch(typeof O){case"boolean":case"number":return""+O;case"string":return Xc.toQuotedString(O);case"object":if(O===null)return"null";var j=mj(O),M=p[j];return M===void 0&&(M=p[j]=u.length,u[M]=O),"default"+M}}function C(O,j,M,z){if(s._opts.validateSchema!==!1){var V=O.definition.dependencies;if(V&&!V.every(function(Ee){return Object.prototype.hasOwnProperty.call(M,Ee)}))throw new Error("parent schema must have all required keywords: "+V.join(","));var X=O.definition.validateSchema;if(X){var Z=X(j);if(!Z){var K="keyword schema is invalid: "+s.errorsText(X.errors);if(s._opts.validateSchema=="log")s.logger.error(K);else throw new Error(K)}}}var ae=O.definition.compile,J=O.definition.inline,we=O.definition.macro,fe;if(ae)fe=ae.call(s,j,M,z);else if(we)fe=we.call(s,j,M,z),i.validateSchema!==!1&&s.validateSchema(fe,!0);else if(J)fe=J.call(s,z,O.keyword,j,M);else if(fe=O.definition.validate,!fe)return;if(fe===void 0)throw new Error('custom keyword "'+O.keyword+'"failed to compile');var De=f.length;return f[De]=fe,{code:"customRule"+De,validate:fe}}}function yj(a,e,r){var t=H0.call(this,a,e,r);return t>=0?{index:t,compiling:!0}:(t=this._compilations.length,this._compilations[t]={schema:a,root:e,baseId:r},{index:t,compiling:!1})}function bj(a,e,r){var t=H0.call(this,a,e,r);t>=0&&this._compilations.splice(t,1)}function H0(a,e,r){for(var t=0;t{"use strict";var Qc=V0.exports=function(){this._cache={}};Qc.prototype.put=function(e,r){this._cache[e]=r};Qc.prototype.get=function(e){return this._cache[e]};Qc.prototype.del=function(e){delete this._cache[e]};Qc.prototype.clear=function(){this._cache={}}});var s_=U((K3,a_)=>{"use strict";var wj=Ss(),Tj=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Rj=[0,31,28,31,30,31,30,31,31,30,31,30,31],Pj=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,G0=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,Oj=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,Cj=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,Z0=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,K0=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,X0=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Q0=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Y0=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,J0=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;a_.exports=Yc;function Yc(a){return a=a=="full"?"full":"fast",wj.copy(Yc[a])}Yc.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":Z0,url:K0,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:G0,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:r_,uuid:X0,"json-pointer":Q0,"json-pointer-uri-fragment":Y0,"relative-json-pointer":J0};Yc.full={date:e_,time:t_,"date-time":Ij,uri:Nj,"uri-reference":Cj,"uri-template":Z0,url:K0,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:G0,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:r_,uuid:X0,"json-pointer":Q0,"json-pointer-uri-fragment":Y0,"relative-json-pointer":J0};function kj(a){return a%4===0&&(a%100!==0||a%400===0)}function e_(a){var e=a.match(Tj);if(!e)return!1;var r=+e[1],t=+e[2],s=+e[3];return t>=1&&t<=12&&s>=1&&s<=(t==2&&kj(r)?29:Rj[t])}function t_(a,e){var r=a.match(Pj);if(!r)return!1;var t=r[1],s=r[2],i=r[3],n=r[5];return(t<=23&&s<=59&&i<=59||t==23&&s==59&&i==60)&&(!e||n)}var Aj=/t|\s/i;function Ij(a){var e=a.split(Aj);return e.length==2&&e_(e[0])&&t_(e[1],!0)}var Dj=/\/|:/;function Nj(a){return Dj.test(a)&&Oj.test(a)}var jj=/[^\\]\\Z/;function r_(a){if(jj.test(a))return!1;try{return new RegExp(a),!0}catch{return!1}}});var i_=U((X3,n_)=>{"use strict";n_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.errSchemaPath+"/"+r,c=!e.opts.allErrors,u="data"+(n||""),p="valid"+i,f,d;if(o=="#"||o=="#/")e.isRoot?(f=e.async,d="validate"):(f=e.root.schema.$async===!0,d="root.refVal[0]");else{var v=e.resolveRef(e.baseId,o,e.isRoot);if(v===void 0){var h=e.MissingRefError.message(e.baseId,o);if(e.opts.missingRefs=="fail"){e.logger.error(h);var m=m||[];m.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { ref: '"+e.util.escapeQuotes(o)+"' } ",e.opts.messages!==!1&&(s+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(o)+"' "),e.opts.verbose&&(s+=" , schema: "+e.util.toQuotedString(o)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ";var y=s;s=m.pop(),!e.compositeRule&&c?e.async?s+=" throw new ValidationError(["+y+"]); ":s+=" validate.errors = ["+y+"]; return false; ":s+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(s+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(h),c&&(s+=" if (true) { ");else throw new e.MissingRefError(e.baseId,o,h)}else if(v.inline){var g=e.util.copy(e);g.level++;var b="valid"+g.level;g.schema=v.schema,g.schemaPath="",g.errSchemaPath=o;var R=e.validate(g).replace(/validate\.schema/g,v.code);s+=" "+R+" ",c&&(s+=" if ("+b+") { ")}else f=v.$async===!0||e.async&&v.$async!==!1,d=v.code}if(d){var m=m||[];m.push(s),s="",e.opts.passContext?s+=" "+d+".call(this, ":s+=" "+d+"( ",s+=" "+u+", (dataPath || '')",e.errorPath!='""'&&(s+=" + "+e.errorPath);var w=n?"data"+(n-1||""):"parentData",T=n?e.dataPathArr[n]:"parentDataProperty";s+=" , "+w+" , "+T+", rootData) ";var k=s;if(s=m.pop(),f){if(!e.async)throw new Error("async schema referenced by sync schema");c&&(s+=" var "+p+"; "),s+=" try { await "+k+"; ",c&&(s+=" "+p+" = true; "),s+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",c&&(s+=" "+p+" = false; "),s+=" } ",c&&(s+=" if ("+p+") { ")}else s+=" if (!"+k+") { if (vErrors === null) vErrors = "+d+".errors; else vErrors = vErrors.concat("+d+".errors); errors = vErrors.length; } ",c&&(s+=" else { ")}return s}});var c_=U((Q3,o_)=>{"use strict";o_.exports=function(e,r,t){var s=" ",i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),o=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c=e.util.copy(e),u="";c.level++;var p="valid"+c.level,f=c.baseId,d=!0,v=i;if(v)for(var h,m=-1,y=v.length-1;m0||h===!1:e.util.schemaHasRules(h,e.RULES.all))&&(d=!1,c.schema=h,c.schemaPath=n+"["+m+"]",c.errSchemaPath=o+"/"+m,s+=" "+e.validate(c)+" ",c.baseId=f,l&&(s+=" if ("+p+") { ",u+="}"));return l&&(d?s+=" if (true) { ":s+=" "+u.slice(0,-1)+" "),s}});var u_=U((Y3,l_)=>{"use strict";l_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="valid"+i,d="errs__"+i,v=e.util.copy(e),h="";v.level++;var m="valid"+v.level,y=o.every(function(D){return e.opts.strictKeywords?typeof D=="object"&&Object.keys(D).length>0||D===!1:e.util.schemaHasRules(D,e.RULES.all)});if(y){var g=v.baseId;s+=" var "+d+" = errors; var "+f+" = false; ";var b=e.compositeRule;e.compositeRule=v.compositeRule=!0;var R=o;if(R)for(var w,T=-1,k=R.length-1;T{"use strict";p_.exports=function(e,r,t){var s=" ",i=e.schema[r],n=e.errSchemaPath+"/"+r,o=!e.opts.allErrors,l=e.util.toQuotedString(i);return e.opts.$comment===!0?s+=" console.log("+l+");":typeof e.opts.$comment=="function"&&(s+=" self._opts.$comment("+l+", "+e.util.toQuotedString(n)+", validate.root.schema);"),s}});var m_=U((eU,f_)=>{"use strict";f_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="valid"+i,d=e.opts.$data&&o&&o.$data,v;d?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",v="schema"+i):v=o,d||(s+=" var schema"+i+" = validate.schema"+l+";"),s+="var "+f+" = equal("+p+", schema"+i+"); if (!"+f+") { ";var h=h||[];h.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValue: schema"+i+" } ",e.opts.messages!==!1&&(s+=" , message: 'should be equal to constant' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var m=s;return s=h.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+m+"]); ":s+=" validate.errors = ["+m+"]; return false; ":s+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" }",u&&(s+=" else { "),s}});var v_=U((tU,h_)=>{"use strict";h_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="valid"+i,d="errs__"+i,v=e.util.copy(e),h="";v.level++;var m="valid"+v.level,y="i"+i,g=v.dataLevel=e.dataLevel+1,b="data"+g,R=e.baseId,w=e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all);if(s+="var "+d+" = errors;var "+f+";",w){var T=e.compositeRule;e.compositeRule=v.compositeRule=!0,v.schema=o,v.schemaPath=l,v.errSchemaPath=c,s+=" var "+m+" = false; for (var "+y+" = 0; "+y+" < "+p+".length; "+y+"++) { ",v.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var k=p+"["+y+"]";v.dataPathArr[g]=y;var D=e.validate(v);v.baseId=R,e.util.varOccurences(D,b)<2?s+=" "+e.util.varReplace(D,b,k)+" ":s+=" var "+b+" = "+k+"; "+D+" ",s+=" if ("+m+") break; } ",e.compositeRule=v.compositeRule=T,s+=" "+h+" if (!"+m+") {"}else s+=" if ("+p+".length == 0) {";var A=A||[];A.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(s+=" , message: 'should contain a valid item' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var $=s;return s=A.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+$+"]); ":s+=" validate.errors = ["+$+"]; return false; ":s+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } else { ",w&&(s+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } "),e.opts.allErrors&&(s+=" } "),s}});var y_=U((rU,g_)=>{"use strict";g_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="errs__"+i,d=e.util.copy(e),v="";d.level++;var h="valid"+d.level,m={},y={},g=e.opts.ownProperties;for(T in o)if(T!="__proto__"){var b=o[T],R=Array.isArray(b)?y:m;R[T]=b}s+="var "+f+" = errors;";var w=e.errorPath;s+="var missing"+i+";";for(var T in y)if(R=y[T],R.length){if(s+=" if ( "+p+e.util.getProperty(T)+" !== undefined ",g&&(s+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(T)+"') "),u){s+=" && ( ";var k=R;if(k)for(var D,A=-1,$=k.length-1;A<$;){D=k[A+=1],A&&(s+=" || ");var N=e.util.getProperty(D),C=p+N;s+=" ( ( "+C+" === undefined ",g&&(s+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(D)+"') "),s+=") && (missing"+i+" = "+e.util.toQuotedString(e.opts.jsonPointers?D:N)+") ) "}s+=")) { ";var O="missing"+i,j="' + "+O+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(w,O,!0):w+" + "+O);var M=M||[];M.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(T)+"', missingProperty: '"+j+"', depsCount: "+R.length+", deps: '"+e.util.escapeQuotes(R.length==1?R[0]:R.join(", "))+"' } ",e.opts.messages!==!1&&(s+=" , message: 'should have ",R.length==1?s+="property "+e.util.escapeQuotes(R[0]):s+="properties "+e.util.escapeQuotes(R.join(", ")),s+=" when property "+e.util.escapeQuotes(T)+" is present' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var z=s;s=M.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+z+"]); ":s+=" validate.errors = ["+z+"]; return false; ":s+=" var err = "+z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{s+=" ) { ";var V=R;if(V)for(var D,X=-1,Z=V.length-1;X0||b===!1:e.util.schemaHasRules(b,e.RULES.all))&&(s+=" "+h+" = true; if ( "+p+e.util.getProperty(T)+" !== undefined ",g&&(s+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(T)+"') "),s+=") { ",d.schema=b,d.schemaPath=l+e.util.getProperty(T),d.errSchemaPath=c+"/"+e.util.escapeFragment(T),s+=" "+e.validate(d)+" ",d.baseId=K,s+=" } ",u&&(s+=" if ("+h+") { ",v+="}"))}return u&&(s+=" "+v+" if ("+f+" == errors) {"),s}});var x_=U((aU,b_)=>{"use strict";b_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="valid"+i,d=e.opts.$data&&o&&o.$data,v;d?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",v="schema"+i):v=o;var h="i"+i,m="schema"+i;d||(s+=" var "+m+" = validate.schema"+l+";"),s+="var "+f+";",d&&(s+=" if (schema"+i+" === undefined) "+f+" = true; else if (!Array.isArray(schema"+i+")) "+f+" = false; else {"),s+=""+f+" = false;for (var "+h+"=0; "+h+"<"+m+".length; "+h+"++) if (equal("+p+", "+m+"["+h+"])) { "+f+" = true; break; }",d&&(s+=" } "),s+=" if (!"+f+") { ";var y=y||[];y.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValues: schema"+i+" } ",e.opts.messages!==!1&&(s+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var g=s;return s=y.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+g+"]); ":s+=" validate.errors = ["+g+"]; return false; ":s+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" }",u&&(s+=" else { "),s}});var S_=U((sU,__)=>{"use strict";__.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||"");if(e.opts.format===!1)return u&&(s+=" if (true) { "),s;var f=e.opts.$data&&o&&o.$data,d;f?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",d="schema"+i):d=o;var v=e.opts.unknownFormats,h=Array.isArray(v);if(f){var m="format"+i,y="isObject"+i,g="formatType"+i;s+=" var "+m+" = formats["+d+"]; var "+y+" = typeof "+m+" == 'object' && !("+m+" instanceof RegExp) && "+m+".validate; var "+g+" = "+y+" && "+m+".type || 'string'; if ("+y+") { ",e.async&&(s+=" var async"+i+" = "+m+".async; "),s+=" "+m+" = "+m+".validate; } if ( ",f&&(s+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),s+=" (",v!="ignore"&&(s+=" ("+d+" && !"+m+" ",h&&(s+=" && self._opts.unknownFormats.indexOf("+d+") == -1 "),s+=") || "),s+=" ("+m+" && "+g+" == '"+t+"' && !(typeof "+m+" == 'function' ? ",e.async?s+=" (async"+i+" ? await "+m+"("+p+") : "+m+"("+p+")) ":s+=" "+m+"("+p+") ",s+=" : "+m+".test("+p+"))))) {"}else{var m=e.formats[o];if(!m){if(v=="ignore")return e.logger.warn('unknown format "'+o+'" ignored in schema at path "'+e.errSchemaPath+'"'),u&&(s+=" if (true) { "),s;if(h&&v.indexOf(o)>=0)return u&&(s+=" if (true) { "),s;throw new Error('unknown format "'+o+'" is used in schema at path "'+e.errSchemaPath+'"')}var y=typeof m=="object"&&!(m instanceof RegExp)&&m.validate,g=y&&m.type||"string";if(y){var b=m.async===!0;m=m.validate}if(g!=t)return u&&(s+=" if (true) { "),s;if(b){if(!e.async)throw new Error("async format in sync schema");var R="formats"+e.util.getProperty(o)+".validate";s+=" if (!(await "+R+"("+p+"))) { "}else{s+=" if (! ";var R="formats"+e.util.getProperty(o);y&&(R+=".validate"),typeof m=="function"?s+=" "+R+"("+p+") ":s+=" "+R+".test("+p+") ",s+=") { "}}var w=w||[];w.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { format: ",f?s+=""+d:s+=""+e.util.toQuotedString(o),s+=" } ",e.opts.messages!==!1&&(s+=` , message: 'should match format "`,f?s+="' + "+d+" + '":s+=""+e.util.escapeQuotes(o),s+=`"' `),e.opts.verbose&&(s+=" , schema: ",f?s+="validate.schema"+l:s+=""+e.util.toQuotedString(o),s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var T=s;return s=w.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+T+"]); ":s+=" validate.errors = ["+T+"]; return false; ":s+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",u&&(s+=" else { "),s}});var w_=U((nU,E_)=>{"use strict";E_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="valid"+i,d="errs__"+i,v=e.util.copy(e);v.level++;var h="valid"+v.level,m=e.schema.then,y=e.schema.else,g=m!==void 0&&(e.opts.strictKeywords?typeof m=="object"&&Object.keys(m).length>0||m===!1:e.util.schemaHasRules(m,e.RULES.all)),b=y!==void 0&&(e.opts.strictKeywords?typeof y=="object"&&Object.keys(y).length>0||y===!1:e.util.schemaHasRules(y,e.RULES.all)),R=v.baseId;if(g||b){var w;v.createErrors=!1,v.schema=o,v.schemaPath=l,v.errSchemaPath=c,s+=" var "+d+" = errors; var "+f+" = true; ";var T=e.compositeRule;e.compositeRule=v.compositeRule=!0,s+=" "+e.validate(v)+" ",v.baseId=R,v.createErrors=!0,s+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.compositeRule=v.compositeRule=T,g?(s+=" if ("+h+") { ",v.schema=e.schema.then,v.schemaPath=e.schemaPath+".then",v.errSchemaPath=e.errSchemaPath+"/then",s+=" "+e.validate(v)+" ",v.baseId=R,s+=" "+f+" = "+h+"; ",g&&b?(w="ifClause"+i,s+=" var "+w+" = 'then'; "):w="'then'",s+=" } ",b&&(s+=" else { ")):s+=" if (!"+h+") { ",b&&(v.schema=e.schema.else,v.schemaPath=e.schemaPath+".else",v.errSchemaPath=e.errSchemaPath+"/else",s+=" "+e.validate(v)+" ",v.baseId=R,s+=" "+f+" = "+h+"; ",g&&b?(w="ifClause"+i,s+=" var "+w+" = 'else'; "):w="'else'",s+=" } "),s+=" if (!"+f+") { var err = ",e.createErrors!==!1?(s+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { failingKeyword: "+w+" } ",e.opts.messages!==!1&&(s+=` , message: 'should match "' + `+w+` + '" schema' `),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ",s+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?s+=" throw new ValidationError(vErrors); ":s+=" validate.errors = vErrors; return false; "),s+=" } ",u&&(s+=" else { ")}else u&&(s+=" if (true) { ");return s}});var R_=U((iU,T_)=>{"use strict";T_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="valid"+i,d="errs__"+i,v=e.util.copy(e),h="";v.level++;var m="valid"+v.level,y="i"+i,g=v.dataLevel=e.dataLevel+1,b="data"+g,R=e.baseId;if(s+="var "+d+" = errors;var "+f+";",Array.isArray(o)){var w=e.schema.additionalItems;if(w===!1){s+=" "+f+" = "+p+".length <= "+o.length+"; ";var T=c;c=e.errSchemaPath+"/additionalItems",s+=" if (!"+f+") { ";var k=k||[];k.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+o.length+" } ",e.opts.messages!==!1&&(s+=" , message: 'should NOT have more than "+o.length+" items' "),e.opts.verbose&&(s+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var D=s;s=k.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+D+"]); ":s+=" validate.errors = ["+D+"]; return false; ":s+=" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",c=T,u&&(h+="}",s+=" else { ")}var A=o;if(A){for(var $,N=-1,C=A.length-1;N0||$===!1:e.util.schemaHasRules($,e.RULES.all)){s+=" "+m+" = true; if ("+p+".length > "+N+") { ";var O=p+"["+N+"]";v.schema=$,v.schemaPath=l+"["+N+"]",v.errSchemaPath=c+"/"+N,v.errorPath=e.util.getPathExpr(e.errorPath,N,e.opts.jsonPointers,!0),v.dataPathArr[g]=N;var j=e.validate(v);v.baseId=R,e.util.varOccurences(j,b)<2?s+=" "+e.util.varReplace(j,b,O)+" ":s+=" var "+b+" = "+O+"; "+j+" ",s+=" } ",u&&(s+=" if ("+m+") { ",h+="}")}}if(typeof w=="object"&&(e.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:e.util.schemaHasRules(w,e.RULES.all))){v.schema=w,v.schemaPath=e.schemaPath+".additionalItems",v.errSchemaPath=e.errSchemaPath+"/additionalItems",s+=" "+m+" = true; if ("+p+".length > "+o.length+") { for (var "+y+" = "+o.length+"; "+y+" < "+p+".length; "+y+"++) { ",v.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var O=p+"["+y+"]";v.dataPathArr[g]=y;var j=e.validate(v);v.baseId=R,e.util.varOccurences(j,b)<2?s+=" "+e.util.varReplace(j,b,O)+" ":s+=" var "+b+" = "+O+"; "+j+" ",u&&(s+=" if (!"+m+") break; "),s+=" } } ",u&&(s+=" if ("+m+") { ",h+="}")}}else if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){v.schema=o,v.schemaPath=l,v.errSchemaPath=c,s+=" for (var "+y+" = 0; "+y+" < "+p+".length; "+y+"++) { ",v.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var O=p+"["+y+"]";v.dataPathArr[g]=y;var j=e.validate(v);v.baseId=R,e.util.varOccurences(j,b)<2?s+=" "+e.util.varReplace(j,b,O)+" ":s+=" var "+b+" = "+O+"; "+j+" ",u&&(s+=" if (!"+m+") break; "),s+=" }"}return u&&(s+=" "+h+" if ("+d+" == errors) {"),s}});var Ud=U((oU,P_)=>{"use strict";P_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,R,p="data"+(n||""),f=e.opts.$data&&o&&o.$data,d;f?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",d="schema"+i):d=o;var v=r=="maximum",h=v?"exclusiveMaximum":"exclusiveMinimum",m=e.schema[h],y=e.opts.$data&&m&&m.$data,g=v?"<":">",b=v?">":"<",R=void 0;if(!(f||typeof o=="number"||o===void 0))throw new Error(r+" must be number");if(!(y||m===void 0||typeof m=="number"||typeof m=="boolean"))throw new Error(h+" must be number or boolean");if(y){var w=e.util.getData(m.$data,n,e.dataPathArr),T="exclusive"+i,k="exclType"+i,D="exclIsNumber"+i,A="op"+i,$="' + "+A+" + '";s+=" var schemaExcl"+i+" = "+w+"; ",w="schemaExcl"+i,s+=" var "+T+"; var "+k+" = typeof "+w+"; if ("+k+" != 'boolean' && "+k+" != 'undefined' && "+k+" != 'number') { ";var R=h,N=N||[];N.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '"+(R||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(s+=" , message: '"+h+" should be boolean' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var C=s;s=N.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+C+"]); ":s+=" validate.errors = ["+C+"]; return false; ":s+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } else if ( ",f&&(s+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),s+=" "+k+" == 'number' ? ( ("+T+" = "+d+" === undefined || "+w+" "+g+"= "+d+") ? "+p+" "+b+"= "+w+" : "+p+" "+b+" "+d+" ) : ( ("+T+" = "+w+" === true) ? "+p+" "+b+"= "+d+" : "+p+" "+b+" "+d+" ) || "+p+" !== "+p+") { var op"+i+" = "+T+" ? '"+g+"' : '"+g+"='; ",o===void 0&&(R=h,c=e.errSchemaPath+"/"+h,d=w,f=y)}else{var D=typeof m=="number",$=g;if(D&&f){var A="'"+$+"'";s+=" if ( ",f&&(s+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),s+=" ( "+d+" === undefined || "+m+" "+g+"= "+d+" ? "+p+" "+b+"= "+m+" : "+p+" "+b+" "+d+" ) || "+p+" !== "+p+") { "}else{D&&o===void 0?(T=!0,R=h,c=e.errSchemaPath+"/"+h,d=m,b+="="):(D&&(d=Math[v?"min":"max"](m,o)),m===(D?d:!0)?(T=!0,R=h,c=e.errSchemaPath+"/"+h,b+="="):(T=!1,$+="="));var A="'"+$+"'";s+=" if ( ",f&&(s+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),s+=" "+p+" "+b+" "+d+" || "+p+" !== "+p+") { "}}R=R||r;var N=N||[];N.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '"+(R||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { comparison: "+A+", limit: "+d+", exclusive: "+T+" } ",e.opts.messages!==!1&&(s+=" , message: 'should be "+$+" ",f?s+="' + "+d:s+=""+d+"'"),e.opts.verbose&&(s+=" , schema: ",f?s+="validate.schema"+l:s+=""+o,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var C=s;return s=N.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+C+"]); ":s+=" validate.errors = ["+C+"]; return false; ":s+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",u&&(s+=" else { "),s}});var Hd=U((cU,O_)=>{"use strict";O_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h,p="data"+(n||""),f=e.opts.$data&&o&&o.$data,d;if(f?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",d="schema"+i):d=o,!(f||typeof o=="number"))throw new Error(r+" must be number");var v=r=="maxItems"?">":"<";s+="if ( ",f&&(s+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),s+=" "+p+".length "+v+" "+d+") { ";var h=r,m=m||[];m.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '"+(h||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(s+=" , message: 'should NOT have ",r=="maxItems"?s+="more":s+="fewer",s+=" than ",f?s+="' + "+d+" + '":s+=""+o,s+=" items' "),e.opts.verbose&&(s+=" , schema: ",f?s+="validate.schema"+l:s+=""+o,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var y=s;return s=m.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+y+"]); ":s+=" validate.errors = ["+y+"]; return false; ":s+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}});var Bd=U((lU,C_)=>{"use strict";C_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h,p="data"+(n||""),f=e.opts.$data&&o&&o.$data,d;if(f?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",d="schema"+i):d=o,!(f||typeof o=="number"))throw new Error(r+" must be number");var v=r=="maxLength"?">":"<";s+="if ( ",f&&(s+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),e.opts.unicode===!1?s+=" "+p+".length ":s+=" ucs2length("+p+") ",s+=" "+v+" "+d+") { ";var h=r,m=m||[];m.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '"+(h||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(s+=" , message: 'should NOT be ",r=="maxLength"?s+="longer":s+="shorter",s+=" than ",f?s+="' + "+d+" + '":s+=""+o,s+=" characters' "),e.opts.verbose&&(s+=" , schema: ",f?s+="validate.schema"+l:s+=""+o,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var y=s;return s=m.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+y+"]); ":s+=" validate.errors = ["+y+"]; return false; ":s+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}});var zd=U((uU,k_)=>{"use strict";k_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h,p="data"+(n||""),f=e.opts.$data&&o&&o.$data,d;if(f?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",d="schema"+i):d=o,!(f||typeof o=="number"))throw new Error(r+" must be number");var v=r=="maxProperties"?">":"<";s+="if ( ",f&&(s+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),s+=" Object.keys("+p+").length "+v+" "+d+") { ";var h=r,m=m||[];m.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '"+(h||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(s+=" , message: 'should NOT have ",r=="maxProperties"?s+="more":s+="fewer",s+=" than ",f?s+="' + "+d+" + '":s+=""+o,s+=" properties' "),e.opts.verbose&&(s+=" , schema: ",f?s+="validate.schema"+l:s+=""+o,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var y=s;return s=m.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+y+"]); ":s+=" validate.errors = ["+y+"]; return false; ":s+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}});var I_=U((pU,A_)=>{"use strict";A_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f=e.opts.$data&&o&&o.$data,d;if(f?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",d="schema"+i):d=o,!(f||typeof o=="number"))throw new Error(r+" must be number");s+="var division"+i+";if (",f&&(s+=" "+d+" !== undefined && ( typeof "+d+" != 'number' || "),s+=" (division"+i+" = "+p+" / "+d+", ",e.opts.multipleOfPrecision?s+=" Math.abs(Math.round(division"+i+") - division"+i+") > 1e-"+e.opts.multipleOfPrecision+" ":s+=" division"+i+" !== parseInt(division"+i+") ",s+=" ) ",f&&(s+=" ) "),s+=" ) { ";var v=v||[];v.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { multipleOf: "+d+" } ",e.opts.messages!==!1&&(s+=" , message: 'should be multiple of ",f?s+="' + "+d:s+=""+d+"'"),e.opts.verbose&&(s+=" , schema: ",f?s+="validate.schema"+l:s+=""+o,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var h=s;return s=v.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+h+"]); ":s+=" validate.errors = ["+h+"]; return false; ":s+=" var err = "+h+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}});var N_=U((dU,D_)=>{"use strict";D_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="errs__"+i,d=e.util.copy(e);d.level++;var v="valid"+d.level;if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){d.schema=o,d.schemaPath=l,d.errSchemaPath=c,s+=" var "+f+" = errors; ";var h=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.createErrors=!1;var m;d.opts.allErrors&&(m=d.opts.allErrors,d.opts.allErrors=!1),s+=" "+e.validate(d)+" ",d.createErrors=!0,m&&(d.opts.allErrors=m),e.compositeRule=d.compositeRule=h,s+=" if ("+v+") { ";var y=y||[];y.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(s+=" , message: 'should NOT be valid' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var g=s;s=y.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+g+"]); ":s+=" validate.errors = ["+g+"]; return false; ":s+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } else { errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } ",e.opts.allErrors&&(s+=" } ")}else s+=" var err = ",e.createErrors!==!1?(s+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(s+=" , message: 'should NOT be valid' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ",s+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(s+=" if (false) { ");return s}});var $_=U((fU,j_)=>{"use strict";j_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="valid"+i,d="errs__"+i,v=e.util.copy(e),h="";v.level++;var m="valid"+v.level,y=v.baseId,g="prevValid"+i,b="passingSchemas"+i;s+="var "+d+" = errors , "+g+" = false , "+f+" = false , "+b+" = null; ";var R=e.compositeRule;e.compositeRule=v.compositeRule=!0;var w=o;if(w)for(var T,k=-1,D=w.length-1;k0||T===!1:e.util.schemaHasRules(T,e.RULES.all))?(v.schema=T,v.schemaPath=l+"["+k+"]",v.errSchemaPath=c+"/"+k,s+=" "+e.validate(v)+" ",v.baseId=y):s+=" var "+m+" = true; ",k&&(s+=" if ("+m+" && "+g+") { "+f+" = false; "+b+" = ["+b+", "+k+"]; } else { ",h+="}"),s+=" if ("+m+") { "+f+" = "+g+" = true; "+b+" = "+k+"; }";return e.compositeRule=v.compositeRule=R,s+=""+h+"if (!"+f+") { var err = ",e.createErrors!==!1?(s+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { passingSchemas: "+b+" } ",e.opts.messages!==!1&&(s+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ",s+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?s+=" throw new ValidationError(vErrors); ":s+=" validate.errors = vErrors; return false; "),s+="} else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; }",e.opts.allErrors&&(s+=" } "),s}});var L_=U((mU,M_)=>{"use strict";M_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f=e.opts.$data&&o&&o.$data,d;f?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",d="schema"+i):d=o;var v=f?"(new RegExp("+d+"))":e.usePattern(o);s+="if ( ",f&&(s+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),s+=" !"+v+".test("+p+") ) { ";var h=h||[];h.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { pattern: ",f?s+=""+d:s+=""+e.util.toQuotedString(o),s+=" } ",e.opts.messages!==!1&&(s+=` , message: 'should match pattern "`,f?s+="' + "+d+" + '":s+=""+e.util.escapeQuotes(o),s+=`"' `),e.opts.verbose&&(s+=" , schema: ",f?s+="validate.schema"+l:s+=""+e.util.toQuotedString(o),s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var m=s;return s=h.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+m+"]); ":s+=" validate.errors = ["+m+"]; return false; ":s+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}});var q_=U((hU,F_)=>{"use strict";F_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="errs__"+i,d=e.util.copy(e),v="";d.level++;var h="valid"+d.level,m="key"+i,y="idx"+i,g=d.dataLevel=e.dataLevel+1,b="data"+g,R="dataProperties"+i,w=Object.keys(o||{}).filter(X),T=e.schema.patternProperties||{},k=Object.keys(T).filter(X),D=e.schema.additionalProperties,A=w.length||k.length,$=D===!1,N=typeof D=="object"&&Object.keys(D).length,C=e.opts.removeAdditional,O=$||N||C,j=e.opts.ownProperties,M=e.baseId,z=e.schema.required;if(z&&!(e.opts.$data&&z.$data)&&z.length8)s+=" || validate.schema"+l+".hasOwnProperty("+m+") ";else{var Z=w;if(Z)for(var K,ae=-1,J=Z.length-1;ae0||Re===!1:e.util.schemaHasRules(Re,e.RULES.all)){var et=e.util.getProperty(K),Q=p+et,ze=ge&&Re.default!==void 0;d.schema=Re,d.schemaPath=l+et,d.errSchemaPath=c+"/"+e.util.escapeFragment(K),d.errorPath=e.util.getPath(e.errorPath,K,e.opts.jsonPointers),d.dataPathArr[g]=e.util.toQuotedString(K);var ne=e.validate(d);if(d.baseId=M,e.util.varOccurences(ne,b)<2){ne=e.util.varReplace(ne,b,Q);var Qe=Q}else{var Qe=b;s+=" var "+b+" = "+Q+"; "}if(ze)s+=" "+ne+" ";else{if(V&&V[K]){s+=" if ( "+Qe+" === undefined ",j&&(s+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(K)+"') "),s+=") { "+h+" = false; ";var Ne=e.errorPath,W=c,Ze=e.util.escapeQuotes(K);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(Ne,K,e.opts.jsonPointers)),c=e.errSchemaPath+"/required";var re=re||[];re.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+Ze+"' } ",e.opts.messages!==!1&&(s+=" , message: '",e.opts._errorDataPathProperty?s+="is a required property":s+="should have required property \\'"+Ze+"\\'",s+="' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var ue=s;s=re.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+ue+"]); ":s+=" validate.errors = ["+ue+"]; return false; ":s+=" var err = "+ue+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=W,e.errorPath=Ne,s+=" } else { "}else u?(s+=" if ( "+Qe+" === undefined ",j&&(s+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(K)+"') "),s+=") { "+h+" = true; } else { "):(s+=" if ("+Qe+" !== undefined ",j&&(s+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(K)+"') "),s+=" ) { ");s+=" "+ne+" } "}}u&&(s+=" if ("+h+") { ",v+="}")}}if(k.length){var Xe=k;if(Xe)for(var fe,Et=-1,wt=Xe.length-1;Et0||Re===!1:e.util.schemaHasRules(Re,e.RULES.all)){d.schema=Re,d.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(fe),d.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(fe),j?s+=" "+R+" = "+R+" || Object.keys("+p+"); for (var "+y+"=0; "+y+"<"+R+".length; "+y+"++) { var "+m+" = "+R+"["+y+"]; ":s+=" for (var "+m+" in "+p+") { ",s+=" if ("+e.usePattern(fe)+".test("+m+")) { ",d.errorPath=e.util.getPathExpr(e.errorPath,m,e.opts.jsonPointers);var Q=p+"["+m+"]";d.dataPathArr[g]=m;var ne=e.validate(d);d.baseId=M,e.util.varOccurences(ne,b)<2?s+=" "+e.util.varReplace(ne,b,Q)+" ":s+=" var "+b+" = "+Q+"; "+ne+" ",u&&(s+=" if (!"+h+") break; "),s+=" } ",u&&(s+=" else "+h+" = true; "),s+=" } ",u&&(s+=" if ("+h+") { ",v+="}")}}}return u&&(s+=" "+v+" if ("+f+" == errors) {"),s}});var H_=U((vU,U_)=>{"use strict";U_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="errs__"+i,d=e.util.copy(e),v="";d.level++;var h="valid"+d.level;if(s+="var "+f+" = errors;",e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){d.schema=o,d.schemaPath=l,d.errSchemaPath=c;var m="key"+i,y="idx"+i,g="i"+i,b="' + "+m+" + '",R=d.dataLevel=e.dataLevel+1,w="data"+R,T="dataProperties"+i,k=e.opts.ownProperties,D=e.baseId;k&&(s+=" var "+T+" = undefined; "),k?s+=" "+T+" = "+T+" || Object.keys("+p+"); for (var "+y+"=0; "+y+"<"+T+".length; "+y+"++) { var "+m+" = "+T+"["+y+"]; ":s+=" for (var "+m+" in "+p+") { ",s+=" var startErrs"+i+" = errors; ";var A=m,$=e.compositeRule;e.compositeRule=d.compositeRule=!0;var N=e.validate(d);d.baseId=D,e.util.varOccurences(N,w)<2?s+=" "+e.util.varReplace(N,w,A)+" ":s+=" var "+w+" = "+A+"; "+N+" ",e.compositeRule=d.compositeRule=$,s+=" if (!"+h+") { for (var "+g+"=startErrs"+i+"; "+g+"{"use strict";B_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="valid"+i,d=e.opts.$data&&o&&o.$data,v;d?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",v="schema"+i):v=o;var h="schema"+i;if(!d)if(o.length0||w===!1:e.util.schemaHasRules(w,e.RULES.all))||(m[m.length]=g)}}else var m=o;if(d||m.length){var T=e.errorPath,k=d||m.length>=e.opts.loopRequired,D=e.opts.ownProperties;if(u)if(s+=" var missing"+i+"; ",k){d||(s+=" var "+h+" = validate.schema"+l+"; ");var A="i"+i,$="schema"+i+"["+A+"]",N="' + "+$+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(T,$,e.opts.jsonPointers)),s+=" var "+f+" = true; ",d&&(s+=" if (schema"+i+" === undefined) "+f+" = true; else if (!Array.isArray(schema"+i+")) "+f+" = false; else {"),s+=" for (var "+A+" = 0; "+A+" < "+h+".length; "+A+"++) { "+f+" = "+p+"["+h+"["+A+"]] !== undefined ",D&&(s+=" && Object.prototype.hasOwnProperty.call("+p+", "+h+"["+A+"]) "),s+="; if (!"+f+") break; } ",d&&(s+=" } "),s+=" if (!"+f+") { ";var C=C||[];C.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+N+"' } ",e.opts.messages!==!1&&(s+=" , message: '",e.opts._errorDataPathProperty?s+="is a required property":s+="should have required property \\'"+N+"\\'",s+="' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var O=s;s=C.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+O+"]); ":s+=" validate.errors = ["+O+"]; return false; ":s+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } else { "}else{s+=" if ( ";var j=m;if(j)for(var M,A=-1,z=j.length-1;A{"use strict";V_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="valid"+i,d=e.opts.$data&&o&&o.$data,v;if(d?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",v="schema"+i):v=o,(o||d)&&e.opts.uniqueItems!==!1){d&&(s+=" var "+f+"; if ("+v+" === false || "+v+" === undefined) "+f+" = true; else if (typeof "+v+" != 'boolean') "+f+" = false; else { "),s+=" var i = "+p+".length , "+f+" = true , j; if (i > 1) { ";var h=e.schema.items&&e.schema.items.type,m=Array.isArray(h);if(!h||h=="object"||h=="array"||m&&(h.indexOf("object")>=0||h.indexOf("array")>=0))s+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+p+"[i], "+p+"[j])) { "+f+" = false; break outer; } } } ";else{s+=" var itemIndices = {}, item; for (;i--;) { var item = "+p+"[i]; ";var y="checkDataType"+(m?"s":"");s+=" if ("+e.util[y](h,"item",e.opts.strictNumbers,!0)+") continue; ",m&&(s+=` if (typeof item == 'string') item = '"' + item; `),s+=" if (typeof itemIndices[item] == 'number') { "+f+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}s+=" } ",d&&(s+=" } "),s+=" if (!"+f+") { ";var g=g||[];g.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(s+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(s+=" , schema: ",d?s+="validate.schema"+l:s+=""+o,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var b=s;s=g.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+b+"]); ":s+=" validate.errors = ["+b+"]; return false; ":s+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",u&&(s+=" else { ")}else u&&(s+=" if (true) { ");return s}});var Z_=U((bU,G_)=>{"use strict";G_.exports={$ref:i_(),allOf:c_(),anyOf:u_(),$comment:d_(),const:m_(),contains:v_(),dependencies:y_(),enum:x_(),format:S_(),if:w_(),items:R_(),maximum:Ud(),minimum:Ud(),maxItems:Hd(),minItems:Hd(),maxLength:Bd(),minLength:Bd(),maxProperties:zd(),minProperties:zd(),multipleOf:I_(),not:N_(),oneOf:$_(),pattern:L_(),properties:q_(),propertyNames:H_(),required:z_(),uniqueItems:W_(),validate:Fd()}});var Q_=U((xU,X_)=>{"use strict";var K_=Z_(),Vd=Ss().toHash;X_.exports=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],r=["type","$comment"],t=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],s=["number","integer","string","array","object","boolean","null"];return e.all=Vd(r),e.types=Vd(s),e.forEach(function(i){i.rules=i.rules.map(function(n){var o;if(typeof n=="object"){var l=Object.keys(n)[0];o=n[l],n=l,o.forEach(function(u){r.push(u),e.all[u]=!0})}r.push(n);var c=e.all[n]={keyword:n,code:K_[n],implements:o};return c}),e.all.$comment={keyword:"$comment",code:K_.$comment},i.type&&(e.types[i.type]=i)}),e.keywords=Vd(r.concat(t)),e.custom={},e}});var eS=U((_U,J_)=>{"use strict";var Y_=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];J_.exports=function(a,e){for(var r=0;r{"use strict";var $j=Gc().MissingRef;rS.exports=tS;function tS(a,e,r){var t=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(r=e,e=void 0);var s=i(a).then(function(){var o=t._addSchema(a,void 0,e);return o.validate||n(o)});return r&&s.then(function(o){r(null,o)},r),s;function i(o){var l=o.$schema;return l&&!t.getSchema(l)?tS.call(t,{$ref:l},!0):Promise.resolve()}function n(o){try{return t._compile(o)}catch(c){if(c instanceof $j)return l(c);throw c}function l(c){var u=c.missingSchema;if(d(u))throw new Error("Schema "+u+" is loaded but "+c.missingRef+" cannot be resolved");var p=t._loadingSchemas[u];return p||(p=t._loadingSchemas[u]=t._opts.loadSchema(u),p.then(f,f)),p.then(function(v){if(!d(u))return i(v).then(function(){d(u)||t.addSchema(v,u,void 0,e)})}).then(function(){return n(o)});function f(){delete t._loadingSchemas[u]}function d(v){return t._refs[v]||t._schemas[v]}}}}});var nS=U((EU,sS)=>{"use strict";sS.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p,f="data"+(n||""),d="valid"+i,v="errs__"+i,h=e.opts.$data&&o&&o.$data,m;h?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",m="schema"+i):m=o;var y=this,g="definition"+i,b=y.definition,R="",w,T,k,D,A;if(h&&b.$data){A="keywordValidate"+i;var $=b.validateSchema;s+=" var "+g+" = RULES.custom['"+r+"'].definition; var "+A+" = "+g+".validate;"}else{if(D=e.useCustomRule(y,o,e.schema,e),!D)return;m="validate.schema"+l,A=D.code,w=b.compile,T=b.inline,k=b.macro}var N=A+".errors",C="i"+i,O="ruleErr"+i,j=b.async;if(j&&!e.async)throw new Error("async keyword in sync schema");if(T||k||(s+=""+N+" = null;"),s+="var "+v+" = errors;var "+d+";",h&&b.$data&&(R+="}",s+=" if ("+m+" === undefined) { "+d+" = true; } else { ",$&&(R+="}",s+=" "+d+" = "+g+".validateSchema("+m+"); if ("+d+") { ")),T)b.statements?s+=" "+D.validate+" ":s+=" "+d+" = "+D.validate+"; ";else if(k){var M=e.util.copy(e),R="";M.level++;var z="valid"+M.level;M.schema=D.validate,M.schemaPath="";var V=e.compositeRule;e.compositeRule=M.compositeRule=!0;var X=e.validate(M).replace(/validate\.schema/g,A);e.compositeRule=M.compositeRule=V,s+=" "+X}else{var Z=Z||[];Z.push(s),s="",s+=" "+A+".call( ",e.opts.passContext?s+="this":s+="self",w||b.schema===!1?s+=" , "+f+" ":s+=" , "+m+" , "+f+" , validate.schema"+e.schemaPath+" ",s+=" , (dataPath || '')",e.errorPath!='""'&&(s+=" + "+e.errorPath);var K=n?"data"+(n-1||""):"parentData",ae=n?e.dataPathArr[n]:"parentDataProperty";s+=" , "+K+" , "+ae+" , rootData ) ";var J=s;s=Z.pop(),b.errors===!1?(s+=" "+d+" = ",j&&(s+="await "),s+=""+J+"; "):j?(N="customErrors"+i,s+=" var "+N+" = null; try { "+d+" = await "+J+"; } catch (e) { "+d+" = false; if (e instanceof ValidationError) "+N+" = e.errors; else throw e; } "):s+=" "+N+" = null; "+d+" = "+J+"; "}if(b.modifying&&(s+=" if ("+K+") "+f+" = "+K+"["+ae+"];"),s+=""+R,b.valid)u&&(s+=" if (true) { ");else{s+=" if ( ",b.valid===void 0?(s+=" !",k?s+=""+z:s+=""+d):s+=" "+!b.valid+" ",s+=") { ",p=y.keyword;var Z=Z||[];Z.push(s),s="";var Z=Z||[];Z.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '"+(p||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+y.keyword+"' } ",e.opts.messages!==!1&&(s+=` , message: 'should pass "`+y.keyword+`" keyword validation' `),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),s+=" } "):s+=" {} ";var we=s;s=Z.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+we+"]); ":s+=" validate.errors = ["+we+"]; return false; ":s+=" var err = "+we+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var fe=s;s=Z.pop(),T?b.errors?b.errors!="full"&&(s+=" for (var "+C+"="+v+"; "+C+"{Mj.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var cS=U((TU,oS)=>{"use strict";var iS=Wd();oS.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:iS.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:iS.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}});var uS=U((RU,lS)=>{"use strict";var Lj=/^[a-z_$][a-z0-9_$-]*$/i,Fj=nS(),qj=cS();lS.exports={add:Uj,get:Hj,remove:Bj,validate:Gd};function Uj(a,e){var r=this.RULES;if(r.keywords[a])throw new Error("Keyword "+a+" is already defined");if(!Lj.test(a))throw new Error("Keyword "+a+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var t=e.type;if(Array.isArray(t))for(var s=0;s{zj.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var _S=U((OU,xS)=>{"use strict";var fS=z0(),Es=Wc(),Vj=W0(),mS=Id(),Wj=Ld(),Gj=s_(),Zj=Q_(),hS=eS(),vS=Ss();xS.exports=dt;dt.prototype.validate=Xj;dt.prototype.compile=Qj;dt.prototype.addSchema=Yj;dt.prototype.addMetaSchema=Jj;dt.prototype.validateSchema=e$;dt.prototype.getSchema=r$;dt.prototype.removeSchema=s$;dt.prototype.addFormat=d$;dt.prototype.errorsText=p$;dt.prototype._addSchema=n$;dt.prototype._compile=i$;dt.prototype.compileAsync=aS();var tl=uS();dt.prototype.addKeyword=tl.add;dt.prototype.getKeyword=tl.get;dt.prototype.removeKeyword=tl.remove;dt.prototype.validateKeyword=tl.validate;var gS=Gc();dt.ValidationError=gS.Validation;dt.MissingRefError=gS.MissingRef;dt.$dataMetaSchema=hS;var el="http://json-schema.org/draft-07/schema",dS=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],Kj=["/properties"];function dt(a){if(!(this instanceof dt))return new dt(a);a=this._opts=vS.copy(a)||{},y$(this),this._schemas={},this._refs={},this._fragments={},this._formats=Gj(a.format),this._cache=a.cache||new Vj,this._loadingSchemas={},this._compilations=[],this.RULES=Zj(),this._getId=o$(a),a.loopRequired=a.loopRequired||1/0,a.errorDataPath=="property"&&(a._errorDataPathProperty=!0),a.serialize===void 0&&(a.serialize=Wj),this._metaOpts=g$(this),a.formats&&h$(this),a.keywords&&v$(this),f$(this),typeof a.meta=="object"&&this.addMetaSchema(a.meta),a.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),m$(this)}function Xj(a,e){var r;if(typeof a=="string"){if(r=this.getSchema(a),!r)throw new Error('no schema with key or ref "'+a+'"')}else{var t=this._addSchema(a);r=t.validate||this._compile(t)}var s=r(e);return r.$async!==!0&&(this.errors=r.errors),s}function Qj(a,e){var r=this._addSchema(a,void 0,e);return r.validate||this._compile(r)}function Yj(a,e,r,t){if(Array.isArray(a)){for(var s=0;s{RS.exports=TS;TS.sync=x$;var ES=require("fs");function b$(a,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var t=0;t{AS.exports=CS;CS.sync=_$;var OS=require("fs");function CS(a,e,r){OS.stat(a,function(t,s){r(t,t?!1:kS(s,e))})}function _$(a,e){return kS(OS.statSync(a),e)}function kS(a,e){return a.isFile()&&S$(a,e)}function S$(a,e){var r=a.mode,t=a.uid,s=a.gid,i=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),n=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),o=parseInt("100",8),l=parseInt("010",8),c=parseInt("001",8),u=o|l,p=r&c||r&l&&s===n||r&o&&t===i||r&u&&i===0;return p}});var NS=U((jU,DS)=>{var NU=require("fs"),rl;process.platform==="win32"||global.TESTING_WINDOWS?rl=PS():rl=IS();DS.exports=Kd;Kd.sync=E$;function Kd(a,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(t,s){Kd(a,e||{},function(i,n){i?s(i):t(n)})})}rl(a,e||{},function(t,s){t&&(t.code==="EACCES"||e&&e.ignoreErrors)&&(t=null,s=!1),r(t,s)})}function E$(a,e){try{return rl.sync(a,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var US=U(($U,qS)=>{var In=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",jS=require("path"),w$=In?";":":",$S=NS(),MS=a=>Object.assign(new Error(`not found: ${a}`),{code:"ENOENT"}),LS=(a,e)=>{let r=e.colon||w$,t=a.match(/\//)||In&&a.match(/\\/)?[""]:[...In?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],s=In?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=In?s.split(r):[""];return In&&a.indexOf(".")!==-1&&i[0]!==""&&i.unshift(""),{pathEnv:t,pathExt:i,pathExtExe:s}},FS=(a,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:t,pathExt:s,pathExtExe:i}=LS(a,e),n=[],o=c=>new Promise((u,p)=>{if(c===t.length)return e.all&&n.length?u(n):p(MS(a));let f=t[c],d=/^".*"$/.test(f)?f.slice(1,-1):f,v=jS.join(d,a),h=!d&&/^\.[\\\/]/.test(a)?a.slice(0,2)+v:v;u(l(h,c,0))}),l=(c,u,p)=>new Promise((f,d)=>{if(p===s.length)return f(o(u+1));let v=s[p];$S(c+v,{pathExt:i},(h,m)=>{if(!h&&m)if(e.all)n.push(c+v);else return f(c+v);return f(l(c,u,p+1))})});return r?o(0).then(c=>r(null,c),r):o(0)},T$=(a,e)=>{e=e||{};let{pathEnv:r,pathExt:t,pathExtExe:s}=LS(a,e),i=[];for(let n=0;n{"use strict";var HS=(a={})=>{let e=a.env||process.env;return(a.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(t=>t.toUpperCase()==="PATH")||"Path"};Xd.exports=HS;Xd.exports.default=HS});var GS=U((LU,WS)=>{"use strict";var zS=require("path"),R$=US(),P$=BS();function VS(a,e){let r=a.options.env||process.env,t=process.cwd(),s=a.options.cwd!=null,i=s&&process.chdir!==void 0&&!process.chdir.disabled;if(i)try{process.chdir(a.options.cwd)}catch{}let n;try{n=R$.sync(a.command,{path:r[P$({env:r})],pathExt:e?zS.delimiter:void 0})}catch{}finally{i&&process.chdir(t)}return n&&(n=zS.resolve(s?a.options.cwd:"",n)),n}function O$(a){return VS(a)||VS(a,!0)}WS.exports=O$});var ZS=U((FU,Yd)=>{"use strict";var Qd=/([()\][%!^"`<>&|;, *?])/g;function C$(a){return a=a.replace(Qd,"^$1"),a}function k$(a,e){return a=`${a}`,a=a.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),a=a.replace(/(?=(\\+?)?)\1$/,"$1$1"),a=`"${a}"`,a=a.replace(Qd,"^$1"),e&&(a=a.replace(Qd,"^$1")),a}Yd.exports.command=C$;Yd.exports.argument=k$});var XS=U((qU,KS)=>{"use strict";KS.exports=/^#!(.*)/});var YS=U((UU,QS)=>{"use strict";var A$=XS();QS.exports=(a="")=>{let e=a.match(A$);if(!e)return null;let[r,t]=e[0].replace(/#! ?/,"").split(" "),s=r.split("/").pop();return s==="env"?t:t?`${s} ${t}`:s}});var eE=U((HU,JS)=>{"use strict";var Jd=require("fs"),I$=YS();function D$(a){let r=Buffer.alloc(150),t;try{t=Jd.openSync(a,"r"),Jd.readSync(t,r,0,150,0),Jd.closeSync(t)}catch{}return I$(r.toString())}JS.exports=D$});var sE=U((BU,aE)=>{"use strict";var N$=require("path"),tE=GS(),rE=ZS(),j$=eE(),$$=process.platform==="win32",M$=/\.(?:com|exe)$/i,L$=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function F$(a){a.file=tE(a);let e=a.file&&j$(a.file);return e?(a.args.unshift(a.file),a.command=e,tE(a)):a.file}function q$(a){if(!$$)return a;let e=F$(a),r=!M$.test(e);if(a.options.forceShell||r){let t=L$.test(e);a.command=N$.normalize(a.command),a.command=rE.command(a.command),a.args=a.args.map(i=>rE.argument(i,t));let s=[a.command].concat(a.args).join(" ");a.args=["/d","/s","/c",`"${s}"`],a.command=process.env.comspec||"cmd.exe",a.options.windowsVerbatimArguments=!0}return a}function U$(a,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let t={command:a,args:e,options:r,file:void 0,original:{command:a,args:e}};return r.shell?t:q$(t)}aE.exports=U$});var oE=U((zU,iE)=>{"use strict";var ef=process.platform==="win32";function tf(a,e){return Object.assign(new Error(`${e} ${a.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${a.command}`,path:a.command,spawnargs:a.args})}function H$(a,e){if(!ef)return;let r=a.emit;a.emit=function(t,s){if(t==="exit"){let i=nE(s,e);if(i)return r.call(a,"error",i)}return r.apply(a,arguments)}}function nE(a,e){return ef&&a===1&&!e.file?tf(e.original,"spawn"):null}function B$(a,e){return ef&&a===1&&!e.file?tf(e.original,"spawnSync"):null}iE.exports={hookChildProcess:H$,verifyENOENT:nE,verifyENOENTSync:B$,notFoundError:tf}});var uE=U((VU,Dn)=>{"use strict";var cE=require("child_process"),rf=sE(),af=oE();function lE(a,e,r){let t=rf(a,e,r),s=cE.spawn(t.command,t.args,t.options);return af.hookChildProcess(s,t),s}function z$(a,e,r){let t=rf(a,e,r),s=cE.spawnSync(t.command,t.args,t.options);return s.error=s.error||af.verifyENOENTSync(s.status,t),s}Dn.exports=lE;Dn.exports.spawn=lE;Dn.exports.sync=z$;Dn.exports._parse=rf;Dn.exports._enoent=af});var jn,$n,Ki,sl,mE,hE,Xi=Ba(()=>{"use strict";jn=["bugfix","feature","refactor","discovery","decision","change"],$n=["how-it-works","why-it-exists","what-changed","problem-solution","gotcha","pattern","trade-off"],Ki={bugfix:"\u{1F534}",feature:"\u{1F7E3}",refactor:"\u{1F504}",change:"\u2705",discovery:"\u{1F535}",decision:"\u2696\uFE0F","session-request":"\u{1F3AF}"},sl={discovery:"\u{1F50D}",change:"\u{1F6E0}\uFE0F",feature:"\u{1F6E0}\uFE0F",bugfix:"\u{1F6E0}\uFE0F",refactor:"\u{1F6E0}\uFE0F",decision:"\u2696\uFE0F"},mE=jn.join(","),hE=$n.join(",")});var Mn,vE,gE,lt,oa=Ba(()=>{"use strict";Mn=require("fs"),vE=require("path"),gE=require("os");Xi();yt();lt=class{static DEFAULTS={CLAUDE_MEM_MODEL:"claude-sonnet-4-5",CLAUDE_MEM_CONTEXT_OBSERVATIONS:"50",CLAUDE_MEM_WORKER_PORT:"37777",CLAUDE_MEM_WORKER_HOST:"127.0.0.1",CLAUDE_MEM_SKIP_TOOLS:"ListMcpResourcesTool,SlashCommand,Skill,TodoWrite,AskUserQuestion",CLAUDE_MEM_DATA_DIR:(0,vE.join)((0,gE.homedir)(),".claude-mem"),CLAUDE_MEM_LOG_LEVEL:"INFO",CLAUDE_MEM_PYTHON_VERSION:"3.13",CLAUDE_CODE_PATH:"",CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS:"true",CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS:"true",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT:"true",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT:"true",CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES:mE,CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS:hE,CLAUDE_MEM_CONTEXT_FULL_COUNT:"5",CLAUDE_MEM_CONTEXT_FULL_FIELD:"narrative",CLAUDE_MEM_CONTEXT_SESSION_COUNT:"10",CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY:"true",CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE:"false"};static getAllDefaults(){return{...this.DEFAULTS}}static get(e){return this.DEFAULTS[e]}static getInt(e){let r=this.get(e);return parseInt(r,10)}static getBool(e){return this.get(e)==="true"}static loadFromFile(e){if(!(0,Mn.existsSync)(e))return this.getAllDefaults();let r=(0,Mn.readFileSync)(e,"utf-8"),t=JSON.parse(r),s=t;if(t.env&&typeof t.env=="object"){s=t.env;try{(0,Mn.writeFileSync)(e,JSON.stringify(s,null,2),"utf-8"),q.info("SETTINGS","Migrated settings file from nested to flat schema",{settingsPath:e})}catch(n){q.warn("SETTINGS","Failed to auto-migrate settings file",{settingsPath:e},n)}}let i={...this.DEFAULTS};for(let n of Object.keys(this.DEFAULTS))s[n]!==void 0&&(i[n]=s[n]);return i}}});var sf,nf,q,yt=Ba(()=>{"use strict";oa();sf=(i=>(i[i.DEBUG=0]="DEBUG",i[i.INFO=1]="INFO",i[i.WARN=2]="WARN",i[i.ERROR=3]="ERROR",i[i.SILENT=4]="SILENT",i))(sf||{}),nf=class{level=null;useColor;constructor(){this.useColor=process.stdout.isTTY??!1}getLevel(){if(this.level===null){let e=lt.get("CLAUDE_MEM_LOG_LEVEL").toUpperCase();this.level=sf[e]??1}return this.level}correlationId(e,r){return`obs-${e}-${r}`}sessionId(e){return`session-${e}`}formatData(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return e.toString();if(typeof e=="object"){if(e instanceof Error)return this.getLevel()===0?`${e.message} ${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let r=Object.keys(e);return r.length===0?"{}":r.length<=3?JSON.stringify(e):`{${r.length} keys: ${r.slice(0,3).join(", ")}...}`}return String(e)}formatTool(e,r){if(!r)return e;try{let t=typeof r=="string"?JSON.parse(r):r;if(e==="Bash"&&t.command){let s=t.command.length>50?t.command.substring(0,50)+"...":t.command;return`${e}(${s})`}if(e==="Read"&&t.file_path){let s=t.file_path.split("/").pop()||t.file_path;return`${e}(${s})`}if(e==="Edit"&&t.file_path){let s=t.file_path.split("/").pop()||t.file_path;return`${e}(${s})`}if(e==="Write"&&t.file_path){let s=t.file_path.split("/").pop()||t.file_path;return`${e}(${s})`}return e}catch{return e}}formatTimestamp(e){let r=e.getFullYear(),t=String(e.getMonth()+1).padStart(2,"0"),s=String(e.getDate()).padStart(2,"0"),i=String(e.getHours()).padStart(2,"0"),n=String(e.getMinutes()).padStart(2,"0"),o=String(e.getSeconds()).padStart(2,"0"),l=String(e.getMilliseconds()).padStart(3,"0");return`${r}-${t}-${s} ${i}:${n}:${o}.${l}`}log(e,r,t,s,i){if(e0&&(p=` {${Object.entries(m).map(([g,b])=>`${g}=${b}`).join(", ")}}`)}let f=`[${n}] [${o}] [${l}] ${c}${t}${p}${u}`;e===3?console.error(f):console.log(f)}debug(e,r,t,s){this.log(0,e,r,t,s)}info(e,r,t,s){this.log(1,e,r,t,s)}warn(e,r,t,s){this.log(2,e,r,t,s)}error(e,r,t,s){this.log(3,e,r,t,s)}dataIn(e,r,t,s){this.info(e,`\u2192 ${r}`,t,s)}dataOut(e,r,t,s){this.info(e,`\u2190 ${r}`,t,s)}success(e,r,t,s){this.info(e,`\u2713 ${r}`,t,s)}failure(e,r,t,s){this.error(e,`\u2717 ${r}`,t,s)}timing(e,r,t,s){this.info(e,`\u23F1 ${r}`,s,{duration:`${t}ms`})}},q=new nf});function K$(){return typeof __dirname<"u"?__dirname:(0,kt.dirname)((0,_E.fileURLToPath)(Q$.url))}function il(a){(0,xE.mkdirSync)(a,{recursive:!0})}function ca(){return(0,kt.join)(X$,"..","..")}var kt,bE,xE,_E,Q$,X$,Vt,cf,iH,oH,cH,lH,Ln,nl,uH,pH,dH,fH,Ar=Ba(()=>{"use strict";kt=require("path"),bE=require("os"),xE=require("fs"),_E=require("url");oa();Q$={};X$=K$(),Vt=lt.get("CLAUDE_MEM_DATA_DIR"),cf=process.env.CLAUDE_CONFIG_DIR||(0,kt.join)((0,bE.homedir)(),".claude"),iH=(0,kt.join)(Vt,"archives"),oH=(0,kt.join)(Vt,"logs"),cH=(0,kt.join)(Vt,"trash"),lH=(0,kt.join)(Vt,"backups"),Ln=(0,kt.join)(Vt,"settings.json"),nl=(0,kt.join)(Vt,"claude-mem.db"),uH=(0,kt.join)(Vt,"vector-db"),pH=(0,kt.join)(cf,"settings.json"),dH=(0,kt.join)(cf,"commands"),fH=(0,kt.join)(cf,"CLAUDE.md")});var TE,$a,ll=Ba(()=>{"use strict";TE=require("bun:sqlite");Ar();yt();$a=class{db;constructor(){il(Vt),this.db=new TE.Database(nl),this.db.run("PRAGMA journal_mode = WAL"),this.db.run("PRAGMA synchronous = NORMAL"),this.db.run("PRAGMA foreign_keys = ON"),this.initializeSchema(),this.ensureWorkerPortColumn(),this.ensurePromptTrackingColumns(),this.removeSessionSummariesUniqueConstraint(),this.addObservationHierarchicalFields(),this.makeObservationsTextNullable(),this.createUserPromptsTable(),this.ensureDiscoveryTokensColumn()}initializeSchema(){try{this.db.run(` CREATE TABLE IF NOT EXISTS schema_versions ( @@ -508,7 +508,7 @@ ${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let r=Obje FROM sdk_sessions WHERE id = ? LIMIT 1 - `).get(e)||null}close(){this.db.close()}}});function Nf(a){if(!a)return[];try{let e=JSON.parse(a);return Array.isArray(e)?e:[]}catch{return[]}}function Yw(a){return new Date(a).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}function Jw(a){return new Date(a).toLocaleString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}function jf(a){return new Date(a).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric"})}function p5(a,e){return Df.default.isAbsolute(a)?Df.default.relative(e,a):a}function zs(a,e){let r=Nf(a);return r.length>0?p5(r[0],e):"General"}function e1(a,e){let r=new Map;for(let s of a){let i=e(s),n=jf(i);r.has(n)||r.set(n,[]),r.get(n).push(s)}let t=Array.from(r.entries()).sort((s,i)=>{let n=new Date(s[0]).getTime(),o=new Date(i[0]).getTime();return n-o});return new Map(t)}var Df,$f=Ba(()=>{"use strict";Df=bt(require("path"),1)});var s1=U((UB,a1)=>{"use strict";var r1=Object.getOwnPropertySymbols,f5=Object.prototype.hasOwnProperty,m5=Object.prototype.propertyIsEnumerable;function h5(a){if(a==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(a)}function v5(){try{if(!Object.assign)return!1;var a=new String("abc");if(a[5]="de",Object.getOwnPropertyNames(a)[0]==="5")return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;var t=Object.getOwnPropertyNames(e).map(function(i){return e[i]});if(t.join("")!=="0123456789")return!1;var s={};return"abcdefghijklmnopqrst".split("").forEach(function(i){s[i]=i}),Object.keys(Object.assign({},s)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}a1.exports=v5()?Object.assign:function(a,e){for(var r,t=h5(a),s,i=1;i{(function(){"use strict";var a=s1(),e=ad(),r={origin:"*",methods:"GET,HEAD,PUT,PATCH,POST,DELETE",preflightContinue:!1,optionsSuccessStatus:204};function t(v){return typeof v=="string"||v instanceof String}function s(v,h){if(Array.isArray(h)){for(var m=0;mS5});function y5(){let a=io.default.join((0,zl.homedir)(),".claude-mem","settings.json"),e=lt.loadFromFile(a);try{return{totalObservationCount:parseInt(e.CLAUDE_MEM_CONTEXT_OBSERVATIONS,10),fullObservationCount:parseInt(e.CLAUDE_MEM_CONTEXT_FULL_COUNT,10),sessionCount:parseInt(e.CLAUDE_MEM_CONTEXT_SESSION_COUNT,10),showReadTokens:e.CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS==="true",showWorkTokens:e.CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS==="true",showSavingsAmount:e.CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT==="true",showSavingsPercent:e.CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT==="true",observationTypes:new Set(e.CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES.split(",").map(r=>r.trim()).filter(Boolean)),observationConcepts:new Set(e.CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS.split(",").map(r=>r.trim()).filter(Boolean)),fullObservationField:e.CLAUDE_MEM_CONTEXT_FULL_FIELD,showLastSummary:e.CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY==="true",showLastMessage:e.CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE==="true"}}catch(r){return q.warn("WORKER","Failed to load context settings, using defaults",{},r),{totalObservationCount:50,fullObservationCount:5,sessionCount:10,showReadTokens:!0,showWorkTokens:!0,showSavingsAmount:!0,showSavingsPercent:!0,observationTypes:new Set(jn),observationConcepts:new Set($n),fullObservationField:"narrative",showLastSummary:!0,showLastMessage:!1}}}function Bl(a,e,r,t){return e?t?[`${r}${a}:${ae.reset} ${e}`,""]:[`**${a}**: ${e}`,""]:[]}function x5(a){return a.replace(/\//g,"-")}function _5(a){try{if(!(0,ei.existsSync)(a))return{userMessage:"",assistantMessage:""};let e=(0,ei.readFileSync)(a,"utf-8").trim();if(!e)return{userMessage:"",assistantMessage:""};let r=e.split(` + `).get(e)||null}close(){this.db.close()}}});function Nf(a){if(!a)return[];try{let e=JSON.parse(a);return Array.isArray(e)?e:[]}catch{return[]}}function Yw(a){return new Date(a).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}function Jw(a){return new Date(a).toLocaleString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}function jf(a){return new Date(a).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric"})}function p5(a,e){return Df.default.isAbsolute(a)?Df.default.relative(e,a):a}function zs(a,e){let r=Nf(a);return r.length>0?p5(r[0],e):"General"}function e1(a,e){let r=new Map;for(let s of a){let i=e(s),n=jf(i);r.has(n)||r.set(n,[]),r.get(n).push(s)}let t=Array.from(r.entries()).sort((s,i)=>{let n=new Date(s[0]).getTime(),o=new Date(i[0]).getTime();return n-o});return new Map(t)}var Df,$f=Ba(()=>{"use strict";Df=bt(require("path"),1)});var s1=U((UB,a1)=>{"use strict";var r1=Object.getOwnPropertySymbols,f5=Object.prototype.hasOwnProperty,m5=Object.prototype.propertyIsEnumerable;function h5(a){if(a==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(a)}function v5(){try{if(!Object.assign)return!1;var a=new String("abc");if(a[5]="de",Object.getOwnPropertyNames(a)[0]==="5")return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;var t=Object.getOwnPropertyNames(e).map(function(i){return e[i]});if(t.join("")!=="0123456789")return!1;var s={};return"abcdefghijklmnopqrst".split("").forEach(function(i){s[i]=i}),Object.keys(Object.assign({},s)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}a1.exports=v5()?Object.assign:function(a,e){for(var r,t=h5(a),s,i=1;i{(function(){"use strict";var a=s1(),e=ad(),r={origin:"*",methods:"GET,HEAD,PUT,PATCH,POST,DELETE",preflightContinue:!1,optionsSuccessStatus:204};function t(v){return typeof v=="string"||v instanceof String}function s(v,h){if(Array.isArray(h)){for(var m=0;mS5});function y5(){let a=io.default.join((0,zl.homedir)(),".claude-mem","settings.json"),e=lt.loadFromFile(a);try{return{totalObservationCount:parseInt(e.CLAUDE_MEM_CONTEXT_OBSERVATIONS,10),fullObservationCount:parseInt(e.CLAUDE_MEM_CONTEXT_FULL_COUNT,10),sessionCount:parseInt(e.CLAUDE_MEM_CONTEXT_SESSION_COUNT,10),showReadTokens:e.CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS==="true",showWorkTokens:e.CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS==="true",showSavingsAmount:e.CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT==="true",showSavingsPercent:e.CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT==="true",observationTypes:new Set(e.CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES.split(",").map(r=>r.trim()).filter(Boolean)),observationConcepts:new Set(e.CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS.split(",").map(r=>r.trim()).filter(Boolean)),fullObservationField:e.CLAUDE_MEM_CONTEXT_FULL_FIELD,showLastSummary:e.CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY==="true",showLastMessage:e.CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE==="true"}}catch(r){return q.warn("WORKER","Failed to load context settings, using defaults",{},r),{totalObservationCount:50,fullObservationCount:5,sessionCount:10,showReadTokens:!0,showWorkTokens:!0,showSavingsAmount:!0,showSavingsPercent:!0,observationTypes:new Set(jn),observationConcepts:new Set($n),fullObservationField:"narrative",showLastSummary:!0,showLastMessage:!1}}}function Bl(a,e,r,t){return e?t?[`${r}${a}:${se.reset} ${e}`,""]:[`**${a}**: ${e}`,""]:[]}function x5(a){return a.replace(/\//g,"-")}function _5(a){try{if(!(0,ei.existsSync)(a))return{userMessage:"",assistantMessage:""};let e=(0,ei.readFileSync)(a,"utf-8").trim();if(!e)return{userMessage:"",assistantMessage:""};let r=e.split(` `).filter(s=>s.trim()),t="";for(let s=r.length-1;s>=0;s--)try{let i=r[s];if(!i.includes('"type":"assistant"'))continue;let n=JSON.parse(i);if(n.type==="assistant"&&n.message?.content&&Array.isArray(n.message.content)){let o="";for(let l of n.message.content)l.type==="text"&&(o+=l.text);if(o=o.replace(/[\s\S]*?<\/system-reminder>/g,"").trim(),o){t=o;break}}}catch{continue}return{userMessage:"",assistantMessage:t}}catch(e){return q.failure("WORKER","Failed to extract prior messages from transcript",{transcriptPath:a},e),{userMessage:"",assistantMessage:""}}}async function S5(a,e=!1){let r=y5(),t=a?.cwd??process.cwd(),s=t?io.default.basename(t):"unknown-project",i=null;try{i=new $a}catch(y){if(y.code==="ERR_DLOPEN_FAILED"){try{(0,ei.unlinkSync)(g5)}catch{}return console.error("Native module rebuild needed - restart Claude Code to auto-fix"),""}throw y}let n=Array.from(r.observationTypes),o=n.map(()=>"?").join(","),l=Array.from(r.observationConcepts),c=l.map(()=>"?").join(","),u=i.db.prepare(` SELECT id, sdk_session_id, type, title, subtitle, narrative, @@ -530,15 +530,15 @@ ${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let r=Obje ORDER BY created_at_epoch DESC LIMIT ? `).all(s,r.sessionCount+b5),f="",d="";if(r.showLastMessage&&u.length>0)try{let y=a?.session_id,g=u.find(b=>b.sdk_session_id!==y);if(g){let b=g.sdk_session_id,R=x5(t),w=io.default.join((0,zl.homedir)(),".claude","projects",R,`${b}.jsonl`),T=_5(w);f=T.userMessage,d=T.assistantMessage}}catch{}if(u.length===0&&p.length===0)return i?.close(),e?` -${ae.bright}${ae.cyan}[${s}] recent context${ae.reset} -${ae.gray}${"\u2500".repeat(60)}${ae.reset} +${se.bright}${se.cyan}[${s}] recent context${se.reset} +${se.gray}${"\u2500".repeat(60)}${se.reset} -${ae.dim}No previous sessions found for this project yet.${ae.reset} +${se.dim}No previous sessions found for this project yet.${se.reset} `:`# [${s}] recent context -No previous sessions found for this project yet.`;let v=p.slice(0,r.sessionCount),h=u,m=[];if(e?(m.push(""),m.push(`${ae.bright}${ae.cyan}[${s}] recent context${ae.reset}`),m.push(`${ae.gray}${"\u2500".repeat(60)}${ae.reset}`),m.push("")):(m.push(`# [${s}] recent context`),m.push("")),h.length>0){e?m.push(`${ae.dim}Legend: \u{1F3AF} session-request | \u{1F534} bugfix | \u{1F7E3} feature | \u{1F504} refactor | \u2705 change | \u{1F535} discovery | \u2696\uFE0F decision${ae.reset}`):m.push("**Legend:** \u{1F3AF} session-request | \u{1F534} bugfix | \u{1F7E3} feature | \u{1F504} refactor | \u2705 change | \u{1F535} discovery | \u2696\uFE0F decision"),m.push(""),e?(m.push(`${ae.bright}\u{1F4A1} Column Key${ae.reset}`),m.push(`${ae.dim} Read: Tokens to read this observation (cost to learn it now)${ae.reset}`),m.push(`${ae.dim} Work: Tokens spent on work that produced this record (\u{1F50D} research, \u{1F6E0}\uFE0F building, \u2696\uFE0F deciding)${ae.reset}`)):(m.push("\u{1F4A1} **Column Key**:"),m.push("- **Read**: Tokens to read this observation (cost to learn it now)"),m.push("- **Work**: Tokens spent on work that produced this record (\u{1F50D} research, \u{1F6E0}\uFE0F building, \u2696\uFE0F deciding)")),m.push(""),e?(m.push(`${ae.dim}\u{1F4A1} Context Index: This semantic index (titles, types, files, tokens) is usually sufficient to understand past work.${ae.reset}`),m.push(""),m.push(`${ae.dim}When you need implementation details, rationale, or debugging context:${ae.reset}`),m.push(`${ae.dim} - Use the mem-search skill to fetch full observations on-demand${ae.reset}`),m.push(`${ae.dim} - Critical types (\u{1F534} bugfix, \u2696\uFE0F decision) often need detailed fetching${ae.reset}`),m.push(`${ae.dim} - Trust this index over re-reading code for past decisions and learnings${ae.reset}`)):(m.push("\u{1F4A1} **Context Index:** This semantic index (titles, types, files, tokens) is usually sufficient to understand past work."),m.push(""),m.push("When you need implementation details, rationale, or debugging context:"),m.push("- Use the mem-search skill to fetch full observations on-demand"),m.push("- Critical types (\u{1F534} bugfix, \u2696\uFE0F decision) often need detailed fetching"),m.push("- Trust this index over re-reading code for past decisions and learnings")),m.push("");let y=u.length,g=u.reduce((z,V)=>{let X=(V.title?.length||0)+(V.subtitle?.length||0)+(V.narrative?.length||0)+JSON.stringify(V.facts||[]).length;return z+Math.ceil(X/v1)},0),b=u.reduce((z,V)=>z+(V.discovery_tokens||0),0),R=b-g,w=b>0?Math.round(R/b*100):0,T=r.showReadTokens||r.showWorkTokens||r.showSavingsAmount||r.showSavingsPercent;if(T)if(e){if(m.push(`${ae.bright}${ae.cyan}\u{1F4CA} Context Economics${ae.reset}`),m.push(`${ae.dim} Loading: ${y} observations (${g.toLocaleString()} tokens to read)${ae.reset}`),m.push(`${ae.dim} Work investment: ${b.toLocaleString()} tokens spent on research, building, and decisions${ae.reset}`),b>0&&(r.showSavingsAmount||r.showSavingsPercent)){let z=" Your savings: ";r.showSavingsAmount&&r.showSavingsPercent?z+=`${R.toLocaleString()} tokens (${w}% reduction from reuse)`:r.showSavingsAmount?z+=`${R.toLocaleString()} tokens`:z+=`${w}% reduction from reuse`,m.push(`${ae.green}${z}${ae.reset}`)}m.push("")}else{if(m.push("\u{1F4CA} **Context Economics**:"),m.push(`- Loading: ${y} observations (${g.toLocaleString()} tokens to read)`),m.push(`- Work investment: ${b.toLocaleString()} tokens spent on research, building, and decisions`),b>0&&(r.showSavingsAmount||r.showSavingsPercent)){let z="- Your savings: ";r.showSavingsAmount&&r.showSavingsPercent?z+=`${R.toLocaleString()} tokens (${w}% reduction from reuse)`:r.showSavingsAmount?z+=`${R.toLocaleString()} tokens`:z+=`${w}% reduction from reuse`,m.push(z)}m.push("")}let k=p[0]?.id,D=v.map((z,V)=>{let X=V===0?null:p[V+1];return{...z,displayEpoch:X?X.created_at_epoch:z.created_at_epoch,displayTime:X?X.created_at:z.created_at,shouldShowLink:z.id!==k}}),A=new Set(u.slice(0,r.fullObservationCount).map(z=>z.id)),$=[...h.map(z=>({type:"observation",data:z})),...D.map(z=>({type:"summary",data:z}))];$.sort((z,V)=>{let X=z.type==="observation"?z.data.created_at_epoch:z.data.displayEpoch,Z=V.type==="observation"?V.data.created_at_epoch:V.data.displayEpoch;return X-Z});let N=new Map;for(let z of $){let V=z.type==="observation"?z.data.created_at:z.data.displayTime,X=jf(V);N.has(X)||N.set(X,[]),N.get(X).push(z)}let C=Array.from(N.entries()).sort((z,V)=>{let X=new Date(z[0]).getTime(),Z=new Date(V[0]).getTime();return X-Z});for(let[z,V]of C){e?(m.push(`${ae.bright}${ae.cyan}${z}${ae.reset}`),m.push("")):(m.push(`### ${z}`),m.push(""));let X=null,Z="",K=!1;for(let se of V)if(se.type==="summary"){K&&(m.push(""),K=!1,X=null,Z="");let Y=se.data,we=`${Y.request||"Session started"} (${Yw(Y.displayTime)})`,de=Y.shouldShowLink?`claude-mem://session-summary/${Y.id}`:"";if(e){let Oe=de?`${ae.dim}[${de}]${ae.reset}`:"";m.push(`\u{1F3AF} ${ae.yellow}#S${Y.id}${ae.reset} ${we} ${Oe}`)}else{let Oe=de?` [\u2192](${de})`:"";m.push(`**\u{1F3AF} #S${Y.id}** ${we}${Oe}`)}m.push("")}else{let Y=se.data,we=zs(Y.files_modified,t);we!==X&&(K&&m.push(""),e?m.push(`${ae.dim}${we}${ae.reset}`):m.push(`**${we}**`),e||(m.push("| ID | Time | T | Title | Read | Work |"),m.push("|----|------|---|-------|------|------|")),X=we,K=!0,Z="");let de=Jw(Y.created_at),Oe=Y.title||"Untitled",Ee=Ki[Y.type]||"\u2022",Ne=(Y.title?.length||0)+(Y.subtitle?.length||0)+(Y.narrative?.length||0)+JSON.stringify(Y.facts||[]).length,H=Math.ceil(Ne/v1),W=Y.discovery_tokens||0,re=sl[Y.type]||"\u{1F50D}",ue=W>0?`${re} ${W.toLocaleString()}`:"-",G=de!==Z,Q=G?de:"";if(Z=de,A.has(Y.id)){let ge=r.fullObservationField==="narrative"?Y.narrative:Y.facts?Nf(Y.facts).join(` -`):null;if(e){let oe=G?`${ae.dim}${de}${ae.reset}`:" ".repeat(de.length),Be=r.showReadTokens&&H>0?`${ae.dim}(~${H}t)${ae.reset}`:"",Ge=r.showWorkTokens&&W>0?`${ae.dim}(${re} ${W.toLocaleString()}t)${ae.reset}`:"";m.push(` ${ae.dim}#${Y.id}${ae.reset} ${oe} ${Ee} ${ae.bright}${Oe}${ae.reset}`),ge&&m.push(` ${ae.dim}${ge}${ae.reset}`),(Be||Ge)&&m.push(` ${Be} ${Ge}`),m.push("")}else{K&&(m.push(""),K=!1),m.push(`**#${Y.id}** ${Q||"\u2033"} ${Ee} **${Oe}**`),ge&&(m.push(""),m.push(ge),m.push(""));let oe=[];r.showReadTokens&&oe.push(`Read: ~${H}`),r.showWorkTokens&&oe.push(`Work: ${ue}`),oe.length>0&&m.push(oe.join(", ")),m.push(""),X=null}}else if(e){let ge=G?`${ae.dim}${de}${ae.reset}`:" ".repeat(de.length),oe=r.showReadTokens&&H>0?`${ae.dim}(~${H}t)${ae.reset}`:"",Be=r.showWorkTokens&&W>0?`${ae.dim}(${re} ${W.toLocaleString()}t)${ae.reset}`:"";m.push(` ${ae.dim}#${Y.id}${ae.reset} ${ge} ${Ee} ${Oe} ${oe} ${Be}`)}else{let ge=r.showReadTokens?`~${H}`:"",oe=r.showWorkTokens?ue:"";m.push(`| #${Y.id} | ${Q||"\u2033"} | ${Ee} | ${Oe} | ${ge} | ${oe} |`)}}K&&m.push("")}let O=p[0],j=u[0];if(r.showLastSummary&&O&&(O.investigated||O.learned||O.completed||O.next_steps)&&(!j||O.created_at_epoch>j.created_at_epoch)&&(m.push(...Bl("Investigated",O.investigated,ae.blue,e)),m.push(...Bl("Learned",O.learned,ae.yellow,e)),m.push(...Bl("Completed",O.completed,ae.green,e)),m.push(...Bl("Next Steps",O.next_steps,ae.magenta,e))),d&&(m.push(""),m.push("---"),m.push(""),e?(m.push(`${ae.bright}${ae.magenta}\u{1F4CB} Previously${ae.reset}`),m.push(""),m.push(`${ae.dim}A: ${d}${ae.reset}`)):(m.push("**\u{1F4CB} Previously**"),m.push(""),m.push(`A: ${d}`)),m.push("")),T&&b>0&&R>0){let z=Math.round(b/1e3);m.push(""),e?m.push(`${ae.dim}\u{1F4B0} Access ${z}k tokens of past research & decisions for just ${g.toLocaleString()}t. Use the mem-search skill to access memories by ID instead of re-reading files.${ae.reset}`):m.push(`\u{1F4B0} Access ${z}k tokens of past research & decisions for just ${g.toLocaleString()}t. Use the mem-search skill to access memories by ID instead of re-reading files.`)}}return i?.close(),m.join(` -`).trimEnd()}var io,zl,ei,g5,v1,b5,ae,Wl=Ba(()=>{"use strict";io=bt(require("path"),1),zl=require("os"),ei=require("fs");ll();Xi();yt();oa();$f();g5=io.default.join((0,zl.homedir)(),".claude","plugins","marketplaces","thedotmack","plugin",".install-version");v1=4,b5=1,ae={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",cyan:"\x1B[36m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",gray:"\x1B[90m",red:"\x1B[31m"}});var T5={};iu(T5,{WorkerService:()=>Xl});module.exports=M1(T5);var E1=bt(od(),1),lo=bt(require("path"),1),w1=bt(require("fs"),1);var S={};iu(S,{BRAND:()=>iN,DIRTY:()=>ns,EMPTY_PATH:()=>LD,INVALID:()=>Te,NEVER:()=>zN,OK:()=>Ct,ParseStatus:()=>Tt,Schema:()=>He,ZodAny:()=>Aa,ZodArray:()=>ia,ZodBigInt:()=>os,ZodBoolean:()=>cs,ZodBranded:()=>Hi,ZodCatch:()=>bs,ZodDate:()=>ls,ZodDefault:()=>ys,ZodDiscriminatedUnion:()=>Rc,ZodEffects:()=>pr,ZodEnum:()=>vs,ZodError:()=>Ht,ZodFirstPartyTypeKind:()=>Ce,ZodFunction:()=>Oc,ZodIntersection:()=>fs,ZodIssueCode:()=>ee,ZodLazy:()=>ms,ZodLiteral:()=>hs,ZodMap:()=>On,ZodNaN:()=>kn,ZodNativeEnum:()=>gs,ZodNever:()=>kr,ZodNull:()=>ps,ZodNullable:()=>Vr,ZodNumber:()=>is,ZodObject:()=>Bt,ZodOptional:()=>lr,ZodParsedType:()=>pe,ZodPipeline:()=>Bi,ZodPromise:()=>Ia,ZodReadonly:()=>xs,ZodRecord:()=>Pc,ZodSchema:()=>He,ZodSet:()=>Cn,ZodString:()=>ka,ZodSymbol:()=>Rn,ZodTransformer:()=>pr,ZodTuple:()=>zr,ZodType:()=>He,ZodUndefined:()=>us,ZodUnion:()=>ds,ZodUnknown:()=>na,ZodVoid:()=>Pn,addIssueToContext:()=>ie,any:()=>hN,array:()=>bN,bigint:()=>uN,boolean:()=>t0,coerce:()=>BN,custom:()=>Yx,date:()=>pN,datetimeRegex:()=>Xx,defaultErrorMap:()=>aa,discriminatedUnion:()=>EN,effect:()=>jN,enum:()=>IN,function:()=>CN,getErrorMap:()=>En,getParsedType:()=>Br,instanceof:()=>cN,intersection:()=>wN,isAborted:()=>wc,isAsync:()=>wn,isDirty:()=>Tc,isValid:()=>Ca,late:()=>oN,lazy:()=>kN,literal:()=>AN,makeIssue:()=>Ui,map:()=>PN,nan:()=>lN,nativeEnum:()=>DN,never:()=>gN,null:()=>mN,nullable:()=>MN,number:()=>e0,object:()=>xN,objectUtil:()=>cd,oboolean:()=>HN,onumber:()=>UN,optional:()=>$N,ostring:()=>qN,pipeline:()=>FN,preprocess:()=>LN,promise:()=>NN,quotelessJson:()=>jD,record:()=>RN,set:()=>ON,setErrorMap:()=>MD,strictObject:()=>_N,string:()=>Jx,symbol:()=>dN,transformer:()=>jN,tuple:()=>TN,undefined:()=>fN,union:()=>SN,unknown:()=>vN,util:()=>We,void:()=>yN});var We;(function(a){a.assertEqual=s=>{};function e(s){}a.assertIs=e;function r(s){throw new Error}a.assertNever=r,a.arrayToEnum=s=>{let i={};for(let n of s)i[n]=n;return i},a.getValidEnumValues=s=>{let i=a.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),n={};for(let o of i)n[o]=s[o];return a.objectValues(n)},a.objectValues=s=>a.objectKeys(s).map(function(i){return s[i]}),a.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},a.find=(s,i)=>{for(let n of s)if(i(n))return n},a.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)}a.joinValues=t,a.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(We||(We={}));var cd;(function(a){a.mergeShapes=(e,r)=>({...e,...r})})(cd||(cd={}));var pe=We.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Br=a=>{switch(typeof a){case"undefined":return pe.undefined;case"string":return pe.string;case"number":return Number.isNaN(a)?pe.nan:pe.number;case"boolean":return pe.boolean;case"function":return pe.function;case"bigint":return pe.bigint;case"symbol":return pe.symbol;case"object":return Array.isArray(a)?pe.array:a===null?pe.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?pe.promise:typeof Map<"u"&&a instanceof Map?pe.map:typeof Set<"u"&&a instanceof Set?pe.set:typeof Date<"u"&&a instanceof Date?pe.date:pe.object;default:return pe.unknown}};var ee=We.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"]),jD=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),Ht=class a 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 r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=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(r(n));else{let o=t,l=0;for(;lr.message){let r={},t=[];for(let s of this.issues)if(s.path.length>0){let i=s.path[0];r[i]=r[i]||[],r[i].push(e(s))}else t.push(e(s));return{formErrors:t,fieldErrors:r}}get formErrors(){return this.flatten()}};Ht.create=a=>new Ht(a);var $D=(a,e)=>{let r;switch(a.code){case ee.invalid_type:a.received===pe.undefined?r="Required":r=`Expected ${a.expected}, received ${a.received}`;break;case ee.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(a.expected,We.jsonStringifyReplacer)}`;break;case ee.unrecognized_keys:r=`Unrecognized key(s) in object: ${We.joinValues(a.keys,", ")}`;break;case ee.invalid_union:r="Invalid input";break;case ee.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${We.joinValues(a.options)}`;break;case ee.invalid_enum_value:r=`Invalid enum value. Expected ${We.joinValues(a.options)}, received '${a.received}'`;break;case ee.invalid_arguments:r="Invalid function arguments";break;case ee.invalid_return_type:r="Invalid function return type";break;case ee.invalid_date:r="Invalid date";break;case ee.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(r=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?r=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?r=`Invalid input: must end with "${a.validation.endsWith}"`:We.assertNever(a.validation):a.validation!=="regex"?r=`Invalid ${a.validation}`:r="Invalid";break;case ee.too_small:a.type==="array"?r=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?r=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?r=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?r=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?r=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:r="Invalid input";break;case ee.too_big:a.type==="array"?r=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?r=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?r=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?r=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?r=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:r="Invalid input";break;case ee.custom:r="Invalid input";break;case ee.invalid_intersection_types:r="Intersection results could not be merged";break;case ee.not_multiple_of:r=`Number must be a multiple of ${a.multipleOf}`;break;case ee.not_finite:r="Number must be finite";break;default:r=e.defaultError,We.assertNever(a)}return{message:r}},aa=$D;var Vx=aa;function MD(a){Vx=a}function En(){return Vx}var Ui=a=>{let{data:e,path:r,errorMaps:t,issueData:s}=a,i=[...r,...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}},LD=[];function ie(a,e){let r=En(),t=Ui({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,r,r===aa?void 0:aa].filter(s=>!!s)});a.common.issues.push(t)}var Tt=class a{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let t=[];for(let s of r){if(s.status==="aborted")return Te;s.status==="dirty"&&e.dirty(),t.push(s.value)}return{status:e.value,value:t}}static async mergeObjectAsync(e,r){let t=[];for(let s of r){let i=await s.key,n=await s.value;t.push({key:i,value:n})}return a.mergeObjectSync(e,t)}static mergeObjectSync(e,r){let t={};for(let s of r){let{key:i,value:n}=s;if(i.status==="aborted"||n.status==="aborted")return Te;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}}},Te=Object.freeze({status:"aborted"}),ns=a=>({status:"dirty",value:a}),Ct=a=>({status:"valid",value:a}),wc=a=>a.status==="aborted",Tc=a=>a.status==="dirty",Ca=a=>a.status==="valid",wn=a=>typeof Promise<"u"&&a instanceof Promise;var ve;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e?.message})(ve||(ve={}));var ur=class{constructor(e,r,t,s){this._cachedPath=[],this.parent=e,this.data=r,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}},Wx=(a,e)=>{if(Ca(e))return{success:!0,data:e.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Ht(a.common.issues);return this._error=r,this._error}}};function Le(a){if(!a)return{};let{errorMap:e,invalid_type_error:r,required_error:t,description:s}=a;if(e&&(r||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}=a;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??r??o.defaultError}},description:s}}var He=class{get description(){return this._def.description}_getType(e){return Br(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Br(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Tt,ctx:{common:e.parent.common,data:e.data,parsedType:Br(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(wn(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let t=this.safeParse(e,r);if(t.success)return t.data;throw t.error}safeParse(e,r){let t={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Br(e)},s=this._parseSync({data:e,path:t.path,parent:t});return Wx(t,s)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Br(e)};if(!this["~standard"].async)try{let t=this._parseSync({data:e,path:[],parent:r});return Ca(t)?{value:t.value}:{issues:r.common.issues}}catch(t){t?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(t=>Ca(t)?{value:t.value}:{issues:r.common.issues})}async parseAsync(e,r){let t=await this.safeParseAsync(e,r);if(t.success)return t.data;throw t.error}async safeParseAsync(e,r){let t={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Br(e)},s=this._parse({data:e,path:t.path,parent:t}),i=await(wn(s)?s:Promise.resolve(s));return Wx(t,i)}refine(e,r){let t=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,i)=>{let n=e(s),o=()=>i.addIssue({code:ee.custom,...t(s)});return typeof Promise<"u"&&n instanceof Promise?n.then(l=>l?!0:(o(),!1)):n?!0:(o(),!1)})}refinement(e,r){return this._refinement((t,s)=>e(t)?!0:(s.addIssue(typeof r=="function"?r(t,s):r),!1))}_refinement(e){return new pr({schema:this,typeName:Ce.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:r=>this["~validate"](r)}}optional(){return lr.create(this,this._def)}nullable(){return Vr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ia.create(this)}promise(){return Ia.create(this,this._def)}or(e){return ds.create([this,e],this._def)}and(e){return fs.create(this,e,this._def)}transform(e){return new pr({...Le(this._def),schema:this,typeName:Ce.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new ys({...Le(this._def),innerType:this,defaultValue:r,typeName:Ce.ZodDefault})}brand(){return new Hi({typeName:Ce.ZodBranded,type:this,...Le(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new bs({...Le(this._def),innerType:this,catchValue:r,typeName:Ce.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Bi.create(this,e)}readonly(){return xs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},FD=/^c[^\s-]{8,}$/i,qD=/^[0-9a-z]+$/,UD=/^[0-9A-HJKMNP-TV-Z]{26}$/i,HD=/^[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,BD=/^[a-z0-9_-]{21}$/i,zD=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,VD=/^[-+]?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)?)??$/,WD=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,GD="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ld,ZD=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,KD=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,XD=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,QD=/^(([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])$/,YD=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,JD=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Zx="((\\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])))",eN=new RegExp(`^${Zx}$`);function Kx(a){let e="[0-5]\\d";a.precision?e=`${e}\\.\\d{${a.precision}}`:a.precision==null&&(e=`${e}(\\.\\d+)?`);let r=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function tN(a){return new RegExp(`^${Kx(a)}$`)}function Xx(a){let e=`${Zx}T${Kx(a)}`,r=[];return r.push(a.local?"Z?":"Z"),a.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function rN(a,e){return!!((e==="v4"||!e)&&ZD.test(a)||(e==="v6"||!e)&&XD.test(a))}function aN(a,e){if(!zD.test(a))return!1;try{let[r]=a.split(".");if(!r)return!1;let t=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.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 sN(a,e){return!!((e==="v4"||!e)&&KD.test(a)||(e==="v6"||!e)&&QD.test(a))}var ka=class a extends He{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==pe.string){let i=this._getOrReturnCtx(e);return ie(i,{code:ee.invalid_type,expected:pe.string,received:i.parsedType}),Te}let t=new Tt,s;for(let i of this._def.checks)if(i.kind==="min")e.data.lengthi.value&&(s=this._getOrReturnCtx(e,s),ie(s,{code:ee.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:r,code:ee.invalid_string,...ve.errToObj(t)})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ve.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ve.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ve.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ve.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ve.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ve.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ve.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ve.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ve.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ve.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ve.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ve.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ve.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,...ve.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,...ve.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...ve.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...ve.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...ve.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...ve.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...ve.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...ve.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...ve.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...ve.errToObj(r)})}nonempty(e){return this.min(1,ve.errToObj(e))}trim(){return new a({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new a({...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 r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew ka({checks:[],typeName:Ce.ZodString,coerce:a?.coerce??!1,...Le(a)});function nN(a,e){let r=(a.toString().split(".")[1]||"").length,t=(e.toString().split(".")[1]||"").length,s=r>t?r:t,i=Number.parseInt(a.toFixed(s).replace(".","")),n=Number.parseInt(e.toFixed(s).replace(".",""));return i%n/10**s}var is=class a extends He{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)!==pe.number){let i=this._getOrReturnCtx(e);return ie(i,{code:ee.invalid_type,expected:pe.number,received:i.parsedType}),Te}let t,s=new Tt;for(let i of this._def.checks)i.kind==="int"?We.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),ie(t,{code:ee.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),ie(t,{code:ee.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?nN(e.data,i.value)!==0&&(t=this._getOrReturnCtx(e,t),ie(t,{code:ee.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),ie(t,{code:ee.not_finite,message:i.message}),s.dirty()):We.assertNever(i);return{status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,ve.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ve.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ve.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ve.toString(r))}setLimit(e,r,t,s){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:t,message:ve.toString(s)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ve.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ve.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ve.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ve.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ve.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ve.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:ve.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ve.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ve.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuee.kind==="int"||e.kind==="multipleOf"&&We.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let t of this._def.checks){if(t.kind==="finite"||t.kind==="int"||t.kind==="multipleOf")return!0;t.kind==="min"?(r===null||t.value>r)&&(r=t.value):t.kind==="max"&&(e===null||t.valuenew is({checks:[],typeName:Ce.ZodNumber,coerce:a?.coerce||!1,...Le(a)});var os=class a extends He{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)!==pe.bigint)return this._getInvalidInput(e);let t,s=new Tt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(t=this._getOrReturnCtx(e,t),ie(t,{code:ee.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),ie(t,{code:ee.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):We.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return ie(r,{code:ee.invalid_type,expected:pe.bigint,received:r.parsedType}),Te}gte(e,r){return this.setLimit("min",e,!0,ve.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ve.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ve.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ve.toString(r))}setLimit(e,r,t,s){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:t,message:ve.toString(s)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ve.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ve.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ve.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ve.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ve.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew os({checks:[],typeName:Ce.ZodBigInt,coerce:a?.coerce??!1,...Le(a)});var cs=class extends He{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==pe.boolean){let t=this._getOrReturnCtx(e);return ie(t,{code:ee.invalid_type,expected:pe.boolean,received:t.parsedType}),Te}return Ct(e.data)}};cs.create=a=>new cs({typeName:Ce.ZodBoolean,coerce:a?.coerce||!1,...Le(a)});var ls=class a extends He{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==pe.date){let i=this._getOrReturnCtx(e);return ie(i,{code:ee.invalid_type,expected:pe.date,received:i.parsedType}),Te}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return ie(i,{code:ee.invalid_date}),Te}let t=new Tt,s;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()i.value&&(s=this._getOrReturnCtx(e,s),ie(s,{code:ee.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),t.dirty()):We.assertNever(i);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:ve.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:ve.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew ls({checks:[],coerce:a?.coerce||!1,typeName:Ce.ZodDate,...Le(a)});var Rn=class extends He{_parse(e){if(this._getType(e)!==pe.symbol){let t=this._getOrReturnCtx(e);return ie(t,{code:ee.invalid_type,expected:pe.symbol,received:t.parsedType}),Te}return Ct(e.data)}};Rn.create=a=>new Rn({typeName:Ce.ZodSymbol,...Le(a)});var us=class extends He{_parse(e){if(this._getType(e)!==pe.undefined){let t=this._getOrReturnCtx(e);return ie(t,{code:ee.invalid_type,expected:pe.undefined,received:t.parsedType}),Te}return Ct(e.data)}};us.create=a=>new us({typeName:Ce.ZodUndefined,...Le(a)});var ps=class extends He{_parse(e){if(this._getType(e)!==pe.null){let t=this._getOrReturnCtx(e);return ie(t,{code:ee.invalid_type,expected:pe.null,received:t.parsedType}),Te}return Ct(e.data)}};ps.create=a=>new ps({typeName:Ce.ZodNull,...Le(a)});var Aa=class extends He{constructor(){super(...arguments),this._any=!0}_parse(e){return Ct(e.data)}};Aa.create=a=>new Aa({typeName:Ce.ZodAny,...Le(a)});var na=class extends He{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ct(e.data)}};na.create=a=>new na({typeName:Ce.ZodUnknown,...Le(a)});var kr=class extends He{_parse(e){let r=this._getOrReturnCtx(e);return ie(r,{code:ee.invalid_type,expected:pe.never,received:r.parsedType}),Te}};kr.create=a=>new kr({typeName:Ce.ZodNever,...Le(a)});var Pn=class extends He{_parse(e){if(this._getType(e)!==pe.undefined){let t=this._getOrReturnCtx(e);return ie(t,{code:ee.invalid_type,expected:pe.void,received:t.parsedType}),Te}return Ct(e.data)}};Pn.create=a=>new Pn({typeName:Ce.ZodVoid,...Le(a)});var ia=class a extends He{_parse(e){let{ctx:r,status:t}=this._processInputParams(e),s=this._def;if(r.parsedType!==pe.array)return ie(r,{code:ee.invalid_type,expected:pe.array,received:r.parsedType}),Te;if(s.exactLength!==null){let n=r.data.length>s.exactLength.value,o=r.data.lengths.maxLength.value&&(ie(r,{code:ee.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),t.dirty()),r.common.async)return Promise.all([...r.data].map((n,o)=>s.type._parseAsync(new ur(r,n,r.path,o)))).then(n=>Tt.mergeArray(t,n));let i=[...r.data].map((n,o)=>s.type._parseSync(new ur(r,n,r.path,o)));return Tt.mergeArray(t,i)}get element(){return this._def.type}min(e,r){return new a({...this._def,minLength:{value:e,message:ve.toString(r)}})}max(e,r){return new a({...this._def,maxLength:{value:e,message:ve.toString(r)}})}length(e,r){return new a({...this._def,exactLength:{value:e,message:ve.toString(r)}})}nonempty(e){return this.min(1,e)}};ia.create=(a,e)=>new ia({type:a,minLength:null,maxLength:null,exactLength:null,typeName:Ce.ZodArray,...Le(e)});function Tn(a){if(a instanceof Bt){let e={};for(let r in a.shape){let t=a.shape[r];e[r]=lr.create(Tn(t))}return new Bt({...a._def,shape:()=>e})}else return a instanceof ia?new ia({...a._def,type:Tn(a.element)}):a instanceof lr?lr.create(Tn(a.unwrap())):a instanceof Vr?Vr.create(Tn(a.unwrap())):a instanceof zr?zr.create(a.items.map(e=>Tn(e))):a}var Bt=class a extends He{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=We.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==pe.object){let c=this._getOrReturnCtx(e);return ie(c,{code:ee.invalid_type,expected:pe.object,received:c.parsedType}),Te}let{status:t,ctx:s}=this._processInputParams(e),{shape:i,keys:n}=this._getCached(),o=[];if(!(this._def.catchall instanceof kr&&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],p=s.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new ur(s,p,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof kr){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&&(ie(s,{code:ee.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 p=s.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new ur(s,p,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let p=await u.key,f=await u.value;c.push({key:p,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>Tt.mergeObjectSync(t,c)):Tt.mergeObjectSync(t,l)}get shape(){return this._def.shape()}strict(e){return ve.errToObj,new a({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,t)=>{let s=this._def.errorMap?.(r,t).message??t.defaultError;return r.code==="unrecognized_keys"?{message:ve.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new a({...this._def,unknownKeys:"strip"})}passthrough(){return new a({...this._def,unknownKeys:"passthrough"})}extend(e){return new a({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new a({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ce.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new a({...this._def,catchall:e})}pick(e){let r={};for(let t of We.objectKeys(e))e[t]&&this.shape[t]&&(r[t]=this.shape[t]);return new a({...this._def,shape:()=>r})}omit(e){let r={};for(let t of We.objectKeys(this.shape))e[t]||(r[t]=this.shape[t]);return new a({...this._def,shape:()=>r})}deepPartial(){return Tn(this)}partial(e){let r={};for(let t of We.objectKeys(this.shape)){let s=this.shape[t];e&&!e[t]?r[t]=s:r[t]=s.optional()}return new a({...this._def,shape:()=>r})}required(e){let r={};for(let t of We.objectKeys(this.shape))if(e&&!e[t])r[t]=this.shape[t];else{let i=this.shape[t];for(;i instanceof lr;)i=i._def.innerType;r[t]=i}return new a({...this._def,shape:()=>r})}keyof(){return Qx(We.objectKeys(this.shape))}};Bt.create=(a,e)=>new Bt({shape:()=>a,unknownKeys:"strip",catchall:kr.create(),typeName:Ce.ZodObject,...Le(e)});Bt.strictCreate=(a,e)=>new Bt({shape:()=>a,unknownKeys:"strict",catchall:kr.create(),typeName:Ce.ZodObject,...Le(e)});Bt.lazycreate=(a,e)=>new Bt({shape:a,unknownKeys:"strip",catchall:kr.create(),typeName:Ce.ZodObject,...Le(e)});var ds=class extends He{_parse(e){let{ctx:r}=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 r.common.issues.push(...o.ctx.common.issues),o.result;let n=i.map(o=>new Ht(o.ctx.common.issues));return ie(r,{code:ee.invalid_union,unionErrors:n}),Te}if(r.common.async)return Promise.all(t.map(async i=>{let n={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:n}),ctx:n}})).then(s);{let i,n=[];for(let l of t){let c={...r,common:{...r.common,issues:[]},parent:null},u=l._parseSync({data:r.data,path:r.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 r.common.issues.push(...i.ctx.common.issues),i.result;let o=n.map(l=>new Ht(l));return ie(r,{code:ee.invalid_union,unionErrors:o}),Te}}get options(){return this._def.options}};ds.create=(a,e)=>new ds({options:a,typeName:Ce.ZodUnion,...Le(e)});var sa=a=>a instanceof ms?sa(a.schema):a instanceof pr?sa(a.innerType()):a instanceof hs?[a.value]:a instanceof vs?a.options:a instanceof gs?We.objectValues(a.enum):a instanceof ys?sa(a._def.innerType):a instanceof us?[void 0]:a instanceof ps?[null]:a instanceof lr?[void 0,...sa(a.unwrap())]:a instanceof Vr?[null,...sa(a.unwrap())]:a instanceof Hi||a instanceof xs?sa(a.unwrap()):a instanceof bs?sa(a._def.innerType):[],Rc=class a extends He{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==pe.object)return ie(r,{code:ee.invalid_type,expected:pe.object,received:r.parsedType}),Te;let t=this.discriminator,s=r.data[t],i=this.optionsMap.get(s);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(ie(r,{code:ee.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[t]}),Te)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,t){let s=new Map;for(let i of r){let n=sa(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 a({typeName:Ce.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:s,...Le(t)})}};function ud(a,e){let r=Br(a),t=Br(e);if(a===e)return{valid:!0,data:a};if(r===pe.object&&t===pe.object){let s=We.objectKeys(e),i=We.objectKeys(a).filter(o=>s.indexOf(o)!==-1),n={...a,...e};for(let o of i){let l=ud(a[o],e[o]);if(!l.valid)return{valid:!1};n[o]=l.data}return{valid:!0,data:n}}else if(r===pe.array&&t===pe.array){if(a.length!==e.length)return{valid:!1};let s=[];for(let i=0;i{if(wc(i)||wc(n))return Te;let o=ud(i.value,n.value);return o.valid?((Tc(i)||Tc(n))&&r.dirty(),{status:r.value,value:o.data}):(ie(t,{code:ee.invalid_intersection_types}),Te)};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}))}};fs.create=(a,e,r)=>new fs({left:a,right:e,typeName:Ce.ZodIntersection,...Le(r)});var zr=class a extends He{_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.parsedType!==pe.array)return ie(t,{code:ee.invalid_type,expected:pe.array,received:t.parsedType}),Te;if(t.data.lengththis._def.items.length&&(ie(t,{code:ee.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...t.data].map((n,o)=>{let l=this._def.items[o]||this._def.rest;return l?l._parse(new ur(t,n,t.path,o)):null}).filter(n=>!!n);return t.common.async?Promise.all(i).then(n=>Tt.mergeArray(r,n)):Tt.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new a({...this._def,rest:e})}};zr.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new zr({items:a,typeName:Ce.ZodTuple,rest:null,...Le(e)})};var Pc=class a extends He{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.parsedType!==pe.object)return ie(t,{code:ee.invalid_type,expected:pe.object,received:t.parsedType}),Te;let s=[],i=this._def.keyType,n=this._def.valueType;for(let o in t.data)s.push({key:i._parse(new ur(t,o,t.path,o)),value:n._parse(new ur(t,t.data[o],t.path,o)),alwaysSet:o in t.data});return t.common.async?Tt.mergeObjectAsync(r,s):Tt.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(e,r,t){return r instanceof He?new a({keyType:e,valueType:r,typeName:Ce.ZodRecord,...Le(t)}):new a({keyType:ka.create(),valueType:e,typeName:Ce.ZodRecord,...Le(r)})}},On=class extends He{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.parsedType!==pe.map)return ie(t,{code:ee.invalid_type,expected:pe.map,received:t.parsedType}),Te;let s=this._def.keyType,i=this._def.valueType,n=[...t.data.entries()].map(([o,l],c)=>({key:s._parse(new ur(t,o,t.path,[c,"key"])),value:i._parse(new ur(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 Te;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),o.set(c.value,u.value)}return{status:r.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 Te;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),o.set(c.value,u.value)}return{status:r.value,value:o}}}};On.create=(a,e,r)=>new On({valueType:e,keyType:a,typeName:Ce.ZodMap,...Le(r)});var Cn=class a extends He{_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.parsedType!==pe.set)return ie(t,{code:ee.invalid_type,expected:pe.set,received:t.parsedType}),Te;let s=this._def;s.minSize!==null&&t.data.sizes.maxSize.value&&(ie(t,{code:ee.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());let i=this._def.valueType;function n(l){let c=new Set;for(let u of l){if(u.status==="aborted")return Te;u.status==="dirty"&&r.dirty(),c.add(u.value)}return{status:r.value,value:c}}let o=[...t.data.values()].map((l,c)=>i._parse(new ur(t,l,t.path,c)));return t.common.async?Promise.all(o).then(l=>n(l)):n(o)}min(e,r){return new a({...this._def,minSize:{value:e,message:ve.toString(r)}})}max(e,r){return new a({...this._def,maxSize:{value:e,message:ve.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Cn.create=(a,e)=>new Cn({valueType:a,minSize:null,maxSize:null,typeName:Ce.ZodSet,...Le(e)});var Oc=class a extends He{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==pe.function)return ie(r,{code:ee.invalid_type,expected:pe.function,received:r.parsedType}),Te;function t(o,l){return Ui({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,En(),aa].filter(c=>!!c),issueData:{code:ee.invalid_arguments,argumentsError:l}})}function s(o,l){return Ui({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,En(),aa].filter(c=>!!c),issueData:{code:ee.invalid_return_type,returnTypeError:l}})}let i={errorMap:r.common.contextualErrorMap},n=r.data;if(this._def.returns instanceof Ia){let o=this;return Ct(async function(...l){let c=new Ht([]),u=await o._def.args.parseAsync(l,i).catch(d=>{throw c.addIssue(t(l,d)),c}),p=await Reflect.apply(n,this,u);return await o._def.returns._def.type.parseAsync(p,i).catch(d=>{throw c.addIssue(s(p,d)),c})})}else{let o=this;return Ct(function(...l){let c=o._def.args.safeParse(l,i);if(!c.success)throw new Ht([t(l,c.error)]);let u=Reflect.apply(n,this,c.data),p=o._def.returns.safeParse(u,i);if(!p.success)throw new Ht([s(u,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new a({...this._def,args:zr.create(e).rest(na.create())})}returns(e){return new a({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,t){return new a({args:e||zr.create([]).rest(na.create()),returns:r||na.create(),typeName:Ce.ZodFunction,...Le(t)})}},ms=class extends He{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};ms.create=(a,e)=>new ms({getter:a,typeName:Ce.ZodLazy,...Le(e)});var hs=class extends He{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return ie(r,{received:r.data,code:ee.invalid_literal,expected:this._def.value}),Te}return{status:"valid",value:e.data}}get value(){return this._def.value}};hs.create=(a,e)=>new hs({value:a,typeName:Ce.ZodLiteral,...Le(e)});function Qx(a,e){return new vs({values:a,typeName:Ce.ZodEnum,...Le(e)})}var vs=class a extends He{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),t=this._def.values;return ie(r,{expected:We.joinValues(t),received:r.parsedType,code:ee.invalid_type}),Te}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),t=this._def.values;return ie(r,{received:r.data,code:ee.invalid_enum_value,options:t}),Te}return Ct(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return a.create(e,{...this._def,...r})}exclude(e,r=this._def){return a.create(this.options.filter(t=>!e.includes(t)),{...this._def,...r})}};vs.create=Qx;var gs=class extends He{_parse(e){let r=We.getValidEnumValues(this._def.values),t=this._getOrReturnCtx(e);if(t.parsedType!==pe.string&&t.parsedType!==pe.number){let s=We.objectValues(r);return ie(t,{expected:We.joinValues(s),received:t.parsedType,code:ee.invalid_type}),Te}if(this._cache||(this._cache=new Set(We.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=We.objectValues(r);return ie(t,{received:t.data,code:ee.invalid_enum_value,options:s}),Te}return Ct(e.data)}get enum(){return this._def.values}};gs.create=(a,e)=>new gs({values:a,typeName:Ce.ZodNativeEnum,...Le(e)});var Ia=class extends He{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==pe.promise&&r.common.async===!1)return ie(r,{code:ee.invalid_type,expected:pe.promise,received:r.parsedType}),Te;let t=r.parsedType===pe.promise?r.data:Promise.resolve(r.data);return Ct(t.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Ia.create=(a,e)=>new Ia({type:a,typeName:Ce.ZodPromise,...Le(e)});var pr=class extends He{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ce.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:t}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:n=>{ie(t,n),n.fatal?r.abort():r.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(r.value==="aborted")return Te;let l=await this._def.schema._parseAsync({data:o,path:t.path,parent:t});return l.status==="aborted"?Te:l.status==="dirty"?ns(l.value):r.value==="dirty"?ns(l.value):l});{if(r.value==="aborted")return Te;let o=this._def.schema._parseSync({data:n,path:t.path,parent:t});return o.status==="aborted"?Te:o.status==="dirty"?ns(o.value):r.value==="dirty"?ns(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"?Te:(o.status==="dirty"&&r.dirty(),n(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:t.data,path:t.path,parent:t}).then(o=>o.status==="aborted"?Te:(o.status==="dirty"&&r.dirty(),n(o.value).then(()=>({status:r.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(!Ca(n))return Te;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:r.value,value:o}}else return this._def.schema._parseAsync({data:t.data,path:t.path,parent:t}).then(n=>Ca(n)?Promise.resolve(s.transform(n.value,i)).then(o=>({status:r.value,value:o})):Te);We.assertNever(s)}};pr.create=(a,e,r)=>new pr({schema:a,typeName:Ce.ZodEffects,effect:e,...Le(r)});pr.createWithPreprocess=(a,e,r)=>new pr({schema:e,effect:{type:"preprocess",transform:a},typeName:Ce.ZodEffects,...Le(r)});var lr=class extends He{_parse(e){return this._getType(e)===pe.undefined?Ct(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};lr.create=(a,e)=>new lr({innerType:a,typeName:Ce.ZodOptional,...Le(e)});var Vr=class extends He{_parse(e){return this._getType(e)===pe.null?Ct(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Vr.create=(a,e)=>new Vr({innerType:a,typeName:Ce.ZodNullable,...Le(e)});var ys=class extends He{_parse(e){let{ctx:r}=this._processInputParams(e),t=r.data;return r.parsedType===pe.undefined&&(t=this._def.defaultValue()),this._def.innerType._parse({data:t,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};ys.create=(a,e)=>new ys({innerType:a,typeName:Ce.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Le(e)});var bs=class extends He{_parse(e){let{ctx:r}=this._processInputParams(e),t={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:t.data,path:t.path,parent:{...t}});return wn(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ht(t.common.issues)},input:t.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ht(t.common.issues)},input:t.data})}}removeCatch(){return this._def.innerType}};bs.create=(a,e)=>new bs({innerType:a,typeName:Ce.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Le(e)});var kn=class extends He{_parse(e){if(this._getType(e)!==pe.nan){let t=this._getOrReturnCtx(e);return ie(t,{code:ee.invalid_type,expected:pe.nan,received:t.parsedType}),Te}return{status:"valid",value:e.data}}};kn.create=a=>new kn({typeName:Ce.ZodNaN,...Le(a)});var iN=Symbol("zod_brand"),Hi=class extends He{_parse(e){let{ctx:r}=this._processInputParams(e),t=r.data;return this._def.type._parse({data:t,path:r.path,parent:r})}unwrap(){return this._def.type}},Bi=class a extends He{_parse(e){let{status:r,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"?Te:i.status==="dirty"?(r.dirty(),ns(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"?Te:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:t.path,parent:t})}}static create(e,r){return new a({in:e,out:r,typeName:Ce.ZodPipeline})}},xs=class extends He{_parse(e){let r=this._def.innerType._parse(e),t=s=>(Ca(s)&&(s.value=Object.freeze(s.value)),s);return wn(r)?r.then(s=>t(s)):t(r)}unwrap(){return this._def.innerType}};xs.create=(a,e)=>new xs({innerType:a,typeName:Ce.ZodReadonly,...Le(e)});function Gx(a,e){let r=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof r=="string"?{message:r}:r}function Yx(a,e={},r){return a?Aa.create().superRefine((t,s)=>{let i=a(t);if(i instanceof Promise)return i.then(n=>{if(!n){let o=Gx(e,t),l=o.fatal??r??!0;s.addIssue({code:"custom",...o,fatal:l})}});if(!i){let n=Gx(e,t),o=n.fatal??r??!0;s.addIssue({code:"custom",...n,fatal:o})}}):Aa.create()}var oN={object:Bt.lazycreate},Ce;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(Ce||(Ce={}));var cN=(a,e={message:`Input not instance of ${a.name}`})=>Yx(r=>r instanceof a,e),Jx=ka.create,e0=is.create,lN=kn.create,uN=os.create,t0=cs.create,pN=ls.create,dN=Rn.create,fN=us.create,mN=ps.create,hN=Aa.create,vN=na.create,gN=kr.create,yN=Pn.create,bN=ia.create,xN=Bt.create,_N=Bt.strictCreate,SN=ds.create,EN=Rc.create,wN=fs.create,TN=zr.create,RN=Pc.create,PN=On.create,ON=Cn.create,CN=Oc.create,kN=ms.create,AN=hs.create,IN=vs.create,DN=gs.create,NN=Ia.create,jN=pr.create,$N=lr.create,MN=Vr.create,LN=pr.createWithPreprocess,FN=Bi.create,qN=()=>Jx().optional(),UN=()=>e0().optional(),HN=()=>t0().optional(),BN={string:(a=>ka.create({...a,coerce:!0})),number:(a=>is.create({...a,coerce:!0})),boolean:(a=>cs.create({...a,coerce:!0})),bigint:(a=>os.create({...a,coerce:!0})),date:(a=>ls.create({...a,coerce:!0}))};var zN=Te;var pd="2025-06-18";var r0=[pd,"2025-03-26","2024-11-05","2024-10-07"],Cc="2.0",a0=S.union([S.string(),S.number().int()]),s0=S.string(),VN=S.object({progressToken:S.optional(a0)}).passthrough(),mr=S.object({_meta:S.optional(VN)}).passthrough(),zt=S.object({method:S.string(),params:S.optional(mr)}),zi=S.object({_meta:S.optional(S.object({}).passthrough())}).passthrough(),Wr=S.object({method:S.string(),params:S.optional(zi)}),hr=S.object({_meta:S.optional(S.object({}).passthrough())}).passthrough(),kc=S.union([S.string(),S.number().int()]),n0=S.object({jsonrpc:S.literal(Cc),id:kc}).merge(zt).strict(),i0=a=>n0.safeParse(a).success,o0=S.object({jsonrpc:S.literal(Cc)}).merge(Wr).strict(),c0=a=>o0.safeParse(a).success,l0=S.object({jsonrpc:S.literal(Cc),id:kc,result:hr}).strict(),dd=a=>l0.safeParse(a).success,dr;(function(a){a[a.ConnectionClosed=-32e3]="ConnectionClosed",a[a.RequestTimeout=-32001]="RequestTimeout",a[a.ParseError=-32700]="ParseError",a[a.InvalidRequest=-32600]="InvalidRequest",a[a.MethodNotFound=-32601]="MethodNotFound",a[a.InvalidParams=-32602]="InvalidParams",a[a.InternalError=-32603]="InternalError"})(dr||(dr={}));var u0=S.object({jsonrpc:S.literal(Cc),id:kc,error:S.object({code:S.number().int(),message:S.string(),data:S.optional(S.unknown())})}).strict(),p0=a=>u0.safeParse(a).success,d0=S.union([n0,o0,l0,u0]),_s=hr.strict(),Ac=Wr.extend({method:S.literal("notifications/cancelled"),params:zi.extend({requestId:kc,reason:S.string().optional()})}),WN=S.object({src:S.string(),mimeType:S.optional(S.string()),sizes:S.optional(S.array(S.string()))}).passthrough(),Vi=S.object({icons:S.array(WN).optional()}).passthrough(),Wi=S.object({name:S.string(),title:S.optional(S.string())}).passthrough(),f0=Wi.extend({version:S.string(),websiteUrl:S.optional(S.string())}).merge(Vi),GN=S.object({experimental:S.optional(S.object({}).passthrough()),sampling:S.optional(S.object({}).passthrough()),elicitation:S.optional(S.object({}).passthrough()),roots:S.optional(S.object({listChanged:S.optional(S.boolean())}).passthrough())}).passthrough(),ZN=zt.extend({method:S.literal("initialize"),params:mr.extend({protocolVersion:S.string(),capabilities:GN,clientInfo:f0})});var KN=S.object({experimental:S.optional(S.object({}).passthrough()),logging:S.optional(S.object({}).passthrough()),completions:S.optional(S.object({}).passthrough()),prompts:S.optional(S.object({listChanged:S.optional(S.boolean())}).passthrough()),resources:S.optional(S.object({subscribe:S.optional(S.boolean()),listChanged:S.optional(S.boolean())}).passthrough()),tools:S.optional(S.object({listChanged:S.optional(S.boolean())}).passthrough())}).passthrough(),fd=hr.extend({protocolVersion:S.string(),capabilities:KN,serverInfo:f0,instructions:S.optional(S.string())}),XN=Wr.extend({method:S.literal("notifications/initialized")});var Ic=zt.extend({method:S.literal("ping")}),QN=S.object({progress:S.number(),total:S.optional(S.number()),message:S.optional(S.string())}).passthrough(),Dc=Wr.extend({method:S.literal("notifications/progress"),params:zi.merge(QN).extend({progressToken:a0})}),Nc=zt.extend({params:mr.extend({cursor:S.optional(s0)}).optional()}),jc=hr.extend({nextCursor:S.optional(s0)}),m0=S.object({uri:S.string(),mimeType:S.optional(S.string()),_meta:S.optional(S.object({}).passthrough())}).passthrough(),h0=m0.extend({text:S.string()}),md=S.string().refine(a=>{try{return atob(a),!0}catch{return!1}},{message:"Invalid Base64 string"}),v0=m0.extend({blob:md}),g0=Wi.extend({uri:S.string(),description:S.optional(S.string()),mimeType:S.optional(S.string()),_meta:S.optional(S.object({}).passthrough())}).merge(Vi),YN=Wi.extend({uriTemplate:S.string(),description:S.optional(S.string()),mimeType:S.optional(S.string()),_meta:S.optional(S.object({}).passthrough())}).merge(Vi),JN=Nc.extend({method:S.literal("resources/list")}),hd=jc.extend({resources:S.array(g0)}),e2=Nc.extend({method:S.literal("resources/templates/list")}),vd=jc.extend({resourceTemplates:S.array(YN)}),t2=zt.extend({method:S.literal("resources/read"),params:mr.extend({uri:S.string()})}),gd=hr.extend({contents:S.array(S.union([h0,v0]))}),r2=Wr.extend({method:S.literal("notifications/resources/list_changed")}),a2=zt.extend({method:S.literal("resources/subscribe"),params:mr.extend({uri:S.string()})}),s2=zt.extend({method:S.literal("resources/unsubscribe"),params:mr.extend({uri:S.string()})}),n2=Wr.extend({method:S.literal("notifications/resources/updated"),params:zi.extend({uri:S.string()})}),i2=S.object({name:S.string(),description:S.optional(S.string()),required:S.optional(S.boolean())}).passthrough(),o2=Wi.extend({description:S.optional(S.string()),arguments:S.optional(S.array(i2)),_meta:S.optional(S.object({}).passthrough())}).merge(Vi),c2=Nc.extend({method:S.literal("prompts/list")}),yd=jc.extend({prompts:S.array(o2)}),l2=zt.extend({method:S.literal("prompts/get"),params:mr.extend({name:S.string(),arguments:S.optional(S.record(S.string()))})}),bd=S.object({type:S.literal("text"),text:S.string(),_meta:S.optional(S.object({}).passthrough())}).passthrough(),xd=S.object({type:S.literal("image"),data:md,mimeType:S.string(),_meta:S.optional(S.object({}).passthrough())}).passthrough(),_d=S.object({type:S.literal("audio"),data:md,mimeType:S.string(),_meta:S.optional(S.object({}).passthrough())}).passthrough(),u2=S.object({type:S.literal("resource"),resource:S.union([h0,v0]),_meta:S.optional(S.object({}).passthrough())}).passthrough(),p2=g0.extend({type:S.literal("resource_link")}),y0=S.union([bd,xd,_d,p2,u2]),d2=S.object({role:S.enum(["user","assistant"]),content:y0}).passthrough(),Sd=hr.extend({description:S.optional(S.string()),messages:S.array(d2)}),f2=Wr.extend({method:S.literal("notifications/prompts/list_changed")}),m2=S.object({title:S.optional(S.string()),readOnlyHint:S.optional(S.boolean()),destructiveHint:S.optional(S.boolean()),idempotentHint:S.optional(S.boolean()),openWorldHint:S.optional(S.boolean())}).passthrough(),h2=Wi.extend({description:S.optional(S.string()),inputSchema:S.object({type:S.literal("object"),properties:S.optional(S.object({}).passthrough()),required:S.optional(S.array(S.string()))}).passthrough(),outputSchema:S.optional(S.object({type:S.literal("object"),properties:S.optional(S.object({}).passthrough()),required:S.optional(S.array(S.string()))}).passthrough()),annotations:S.optional(m2),_meta:S.optional(S.object({}).passthrough())}).merge(Vi),v2=Nc.extend({method:S.literal("tools/list")}),Ed=jc.extend({tools:S.array(h2)}),$c=hr.extend({content:S.array(y0).default([]),structuredContent:S.object({}).passthrough().optional(),isError:S.optional(S.boolean())}),O3=$c.or(hr.extend({toolResult:S.unknown()})),g2=zt.extend({method:S.literal("tools/call"),params:mr.extend({name:S.string(),arguments:S.optional(S.record(S.unknown()))})}),y2=Wr.extend({method:S.literal("notifications/tools/list_changed")}),b0=S.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),b2=zt.extend({method:S.literal("logging/setLevel"),params:mr.extend({level:b0})}),x2=Wr.extend({method:S.literal("notifications/message"),params:zi.extend({level:b0,logger:S.optional(S.string()),data:S.unknown()})}),_2=S.object({name:S.string().optional()}).passthrough(),S2=S.object({hints:S.optional(S.array(_2)),costPriority:S.optional(S.number().min(0).max(1)),speedPriority:S.optional(S.number().min(0).max(1)),intelligencePriority:S.optional(S.number().min(0).max(1))}).passthrough(),E2=S.object({role:S.enum(["user","assistant"]),content:S.union([bd,xd,_d])}).passthrough(),w2=zt.extend({method:S.literal("sampling/createMessage"),params:mr.extend({messages:S.array(E2),systemPrompt:S.optional(S.string()),includeContext:S.optional(S.enum(["none","thisServer","allServers"])),temperature:S.optional(S.number()),maxTokens:S.number().int(),stopSequences:S.optional(S.array(S.string())),metadata:S.optional(S.object({}).passthrough()),modelPreferences:S.optional(S2)})}),T2=hr.extend({model:S.string(),stopReason:S.optional(S.enum(["endTurn","stopSequence","maxTokens"]).or(S.string())),role:S.enum(["user","assistant"]),content:S.discriminatedUnion("type",[bd,xd,_d])}),R2=S.object({type:S.literal("boolean"),title:S.optional(S.string()),description:S.optional(S.string()),default:S.optional(S.boolean())}).passthrough(),P2=S.object({type:S.literal("string"),title:S.optional(S.string()),description:S.optional(S.string()),minLength:S.optional(S.number()),maxLength:S.optional(S.number()),format:S.optional(S.enum(["email","uri","date","date-time"]))}).passthrough(),O2=S.object({type:S.enum(["number","integer"]),title:S.optional(S.string()),description:S.optional(S.string()),minimum:S.optional(S.number()),maximum:S.optional(S.number())}).passthrough(),C2=S.object({type:S.literal("string"),title:S.optional(S.string()),description:S.optional(S.string()),enum:S.array(S.string()),enumNames:S.optional(S.array(S.string()))}).passthrough(),k2=S.union([R2,P2,O2,C2]),A2=zt.extend({method:S.literal("elicitation/create"),params:mr.extend({message:S.string(),requestedSchema:S.object({type:S.literal("object"),properties:S.record(S.string(),k2),required:S.optional(S.array(S.string()))}).passthrough()})}),I2=hr.extend({action:S.enum(["accept","decline","cancel"]),content:S.optional(S.record(S.string(),S.unknown()))}),D2=S.object({type:S.literal("ref/resource"),uri:S.string()}).passthrough();var N2=S.object({type:S.literal("ref/prompt"),name:S.string()}).passthrough(),j2=zt.extend({method:S.literal("completion/complete"),params:mr.extend({ref:S.union([N2,D2]),argument:S.object({name:S.string(),value:S.string()}).passthrough(),context:S.optional(S.object({arguments:S.optional(S.record(S.string(),S.string()))}))})}),wd=hr.extend({completion:S.object({values:S.array(S.string()).max(100),total:S.optional(S.number().int()),hasMore:S.optional(S.boolean())}).passthrough()}),$2=S.object({uri:S.string().startsWith("file://"),name:S.optional(S.string()),_meta:S.optional(S.object({}).passthrough())}).passthrough(),M2=zt.extend({method:S.literal("roots/list")}),L2=hr.extend({roots:S.array($2)}),F2=Wr.extend({method:S.literal("notifications/roots/list_changed")}),C3=S.union([Ic,ZN,j2,b2,l2,c2,JN,e2,t2,a2,s2,g2,v2]),k3=S.union([Ac,Dc,XN,F2]),A3=S.union([_s,T2,I2,L2]),I3=S.union([Ic,w2,A2,M2]),D3=S.union([Ac,Dc,x2,n2,r2,y2,f2]),N3=S.union([_s,fd,wd,Sd,yd,hd,vd,gd,$c,Ed]),fr=class extends Error{constructor(e,r,t){super(`MCP error ${e}: ${r}`),this.code=e,this.data=t,this.name="McpError"}};var q2=6e4,Mc=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(Ac,r=>{let t=this._requestHandlerAbortControllers.get(r.params.requestId);t?.abort(r.params.reason)}),this.setNotificationHandler(Dc,r=>{this._onprogress(r)}),this.setRequestHandler(Ic,r=>({}))}_setupTimeout(e,r,t,s,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(s,r),startTime:Date.now(),timeout:r,maxTotalTimeout:t,resetTimeoutOnProgress:i,onTimeout:s})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let t=Date.now()-r.startTime;if(r.maxTotalTimeout&&t>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),new fr(dr.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:t});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,t,s;this._transport=e;let i=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{i?.(),this._onclose()};let n=(t=this.transport)===null||t===void 0?void 0:t.onerror;this._transport.onerror=l=>{n?.(l),this._onerror(l)};let o=(s=this._transport)===null||s===void 0?void 0:s.onmessage;this._transport.onmessage=(l,c)=>{o?.(l,c),dd(l)||p0(l)?this._onresponse(l):i0(l)?this._onrequest(l,c):c0(l)?this._onnotification(l):this._onerror(new Error(`Unknown message type: ${JSON.stringify(l)}`))},await this._transport.start()}_onclose(){var e;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let t=new fr(dr.ConnectionClosed,"Connection closed");for(let s of r.values())s(t)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;let t=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;t!==void 0&&Promise.resolve().then(()=>t(e)).catch(s=>this._onerror(new Error(`Uncaught error in notification handler: ${s}`)))}_onrequest(e,r){var t,s;let i=(t=this._requestHandlers.get(e.method))!==null&&t!==void 0?t:this.fallbackRequestHandler,n=this._transport;if(i===void 0){n?.send({jsonrpc:"2.0",id:e.id,error:{code:dr.MethodNotFound,message:"Method not found"}}).catch(c=>this._onerror(new Error(`Failed to send an error response: ${c}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);let l={signal:o.signal,sessionId:n?.sessionId,_meta:(s=e.params)===null||s===void 0?void 0:s._meta,sendNotification:c=>this.notification(c,{relatedRequestId:e.id}),sendRequest:(c,u,p)=>this.request(c,u,{...p,relatedRequestId:e.id}),authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo};Promise.resolve().then(()=>i(e,l)).then(c=>{if(!o.signal.aborted)return n?.send({result:c,jsonrpc:"2.0",id:e.id})},c=>{var u;if(!o.signal.aborted)return n?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(c.code)?c.code:dr.InternalError,message:(u=c.message)!==null&&u!==void 0?u:"Internal error"}})}).catch(c=>this._onerror(new Error(`Failed to send response: ${c}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...t}=e.params,s=Number(r),i=this._progressHandlers.get(s);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let n=this._responseHandlers.get(s),o=this._timeoutInfo.get(s);if(o&&n&&o.resetTimeoutOnProgress)try{this._resetTimeout(s)}catch(l){n(l);return}i(t)}_onresponse(e){let r=Number(e.id),t=this._responseHandlers.get(r);if(t===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),dd(e))t(e);else{let s=new fr(e.error.code,e.error.message,e.error.data);t(s)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,r,t){let{relatedRequestId:s,resumptionToken:i,onresumptiontoken:n}=t??{};return new Promise((o,l)=>{var c,u,p,f,d,v;if(!this._transport){l(new Error("Not connected"));return}((c=this._options)===null||c===void 0?void 0:c.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(u=t?.signal)===null||u===void 0||u.throwIfAborted();let h=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:h};t?.onprogress&&(this._progressHandlers.set(h,t.onprogress),m.params={...e.params,_meta:{...((p=e.params)===null||p===void 0?void 0:p._meta)||{},progressToken:h}});let y=R=>{var w;this._responseHandlers.delete(h),this._progressHandlers.delete(h),this._cleanupTimeout(h),(w=this._transport)===null||w===void 0||w.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:h,reason:String(R)}},{relatedRequestId:s,resumptionToken:i,onresumptiontoken:n}).catch(T=>this._onerror(new Error(`Failed to send cancellation: ${T}`))),l(R)};this._responseHandlers.set(h,R=>{var w;if(!(!((w=t?.signal)===null||w===void 0)&&w.aborted)){if(R instanceof Error)return l(R);try{let T=r.parse(R.result);o(T)}catch(T){l(T)}}}),(f=t?.signal)===null||f===void 0||f.addEventListener("abort",()=>{var R;y((R=t?.signal)===null||R===void 0?void 0:R.reason)});let g=(d=t?.timeout)!==null&&d!==void 0?d:q2,b=()=>y(new fr(dr.RequestTimeout,"Request timed out",{timeout:g}));this._setupTimeout(h,g,t?.maxTotalTimeout,b,(v=t?.resetTimeoutOnProgress)!==null&&v!==void 0?v:!1),this._transport.send(m,{relatedRequestId:s,resumptionToken:i,onresumptiontoken:n}).catch(R=>{this._cleanupTimeout(h),l(R)})})}async notification(e,r){var t,s;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((s=(t=this._options)===null||t===void 0?void 0:t.debouncedNotificationMethods)!==null&&s!==void 0?s:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var l;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let c={...e,jsonrpc:"2.0"};(l=this._transport)===null||l===void 0||l.send(c,r).catch(u=>this._onerror(u))});return}let o={...e,jsonrpc:"2.0"};await this._transport.send(o,r)}setRequestHandler(e,r){let t=e.shape.method.value;this.assertRequestHandlerCapability(t),this._requestHandlers.set(t,(s,i)=>Promise.resolve(r(e.parse(s),i)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){this._notificationHandlers.set(e.shape.method.value,t=>Promise.resolve(r(e.parse(t))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function x0(a,e){return Object.entries(e).reduce((r,[t,s])=>(s&&typeof s=="object"?r[t]=r[t]?{...r[t],...s}:s:r[t]=s,r),{...a})}var SS=bt(_S(),1),An=class extends Mc{constructor(e,r){var t;super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(t=r?.capabilities)!==null&&t!==void 0?t:{},this._ajv=new SS.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=x0(this._capabilities,e)}assertCapability(e,r){var t;if(!(!((t=this._serverCapabilities)===null||t===void 0)&&t[e]))throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{let t=await this.request({method:"initialize",params:{protocolVersion:pd,capabilities:this._capabilities,clientInfo:this._clientInfo}},fd,r);if(t===void 0)throw new Error(`Server sent invalid initialize result: ${t}`);if(!r0.includes(t.protocolVersion))throw new Error(`Server's protocol version is not supported: ${t.protocolVersion}`);this._serverCapabilities=t.capabilities,this._serverVersion=t.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(t.protocolVersion),this._instructions=t.instructions,await this.notification({method:"notifications/initialized"})}catch(t){throw this.close(),t}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var r,t,s,i,n;switch(e){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((t=this._serverCapabilities)===null||t===void 0)&&t.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var r;switch(e){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"ping":break}}async ping(e){return this.request({method:"ping"},_s,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},wd,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},_s,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},Sd,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},yd,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},hd,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},vd,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},gd,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},_s,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},_s,r)}async callTool(e,r=$c,t){let s=await this.request({method:"tools/call",params:e},r,t),i=this.getToolOutputValidator(e.name);if(i){if(!s.structuredContent&&!s.isError)throw new fr(dr.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(s.structuredContent)try{if(!i(s.structuredContent))throw new fr(dr.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(i.errors)}`)}catch(n){throw n instanceof fr?n:new fr(dr.InvalidParams,`Failed to validate structured content: ${n instanceof Error?n.message:String(n)}`)}}return s}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(let r of e)if(r.outputSchema)try{let t=this._ajv.compile(r.outputSchema);this._cachedToolOutputValidators.set(r.name,t)}catch{}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let t=await this.request({method:"tools/list",params:e},Ed,r);return this.cacheToolOutputSchemas(t.tools),t}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var dE=bt(uE(),1),Zi=bt(require("node:process"),1),fE=require("node:stream");var al=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(` +No previous sessions found for this project yet.`;let v=p.slice(0,r.sessionCount),h=u,m=[];if(e?(m.push(""),m.push(`${se.bright}${se.cyan}[${s}] recent context${se.reset}`),m.push(`${se.gray}${"\u2500".repeat(60)}${se.reset}`),m.push("")):(m.push(`# [${s}] recent context`),m.push("")),h.length>0){e?m.push(`${se.dim}Legend: \u{1F3AF} session-request | \u{1F534} bugfix | \u{1F7E3} feature | \u{1F504} refactor | \u2705 change | \u{1F535} discovery | \u2696\uFE0F decision${se.reset}`):m.push("**Legend:** \u{1F3AF} session-request | \u{1F534} bugfix | \u{1F7E3} feature | \u{1F504} refactor | \u2705 change | \u{1F535} discovery | \u2696\uFE0F decision"),m.push(""),e?(m.push(`${se.bright}\u{1F4A1} Column Key${se.reset}`),m.push(`${se.dim} Read: Tokens to read this observation (cost to learn it now)${se.reset}`),m.push(`${se.dim} Work: Tokens spent on work that produced this record (\u{1F50D} research, \u{1F6E0}\uFE0F building, \u2696\uFE0F deciding)${se.reset}`)):(m.push("\u{1F4A1} **Column Key**:"),m.push("- **Read**: Tokens to read this observation (cost to learn it now)"),m.push("- **Work**: Tokens spent on work that produced this record (\u{1F50D} research, \u{1F6E0}\uFE0F building, \u2696\uFE0F deciding)")),m.push(""),e?(m.push(`${se.dim}\u{1F4A1} Context Index: This semantic index (titles, types, files, tokens) is usually sufficient to understand past work.${se.reset}`),m.push(""),m.push(`${se.dim}When you need implementation details, rationale, or debugging context:${se.reset}`),m.push(`${se.dim} - Use the mem-search skill to fetch full observations on-demand${se.reset}`),m.push(`${se.dim} - Critical types (\u{1F534} bugfix, \u2696\uFE0F decision) often need detailed fetching${se.reset}`),m.push(`${se.dim} - Trust this index over re-reading code for past decisions and learnings${se.reset}`)):(m.push("\u{1F4A1} **Context Index:** This semantic index (titles, types, files, tokens) is usually sufficient to understand past work."),m.push(""),m.push("When you need implementation details, rationale, or debugging context:"),m.push("- Use the mem-search skill to fetch full observations on-demand"),m.push("- Critical types (\u{1F534} bugfix, \u2696\uFE0F decision) often need detailed fetching"),m.push("- Trust this index over re-reading code for past decisions and learnings")),m.push("");let y=u.length,g=u.reduce((z,V)=>{let X=(V.title?.length||0)+(V.subtitle?.length||0)+(V.narrative?.length||0)+JSON.stringify(V.facts||[]).length;return z+Math.ceil(X/v1)},0),b=u.reduce((z,V)=>z+(V.discovery_tokens||0),0),R=b-g,w=b>0?Math.round(R/b*100):0,T=r.showReadTokens||r.showWorkTokens||r.showSavingsAmount||r.showSavingsPercent;if(T)if(e){if(m.push(`${se.bright}${se.cyan}\u{1F4CA} Context Economics${se.reset}`),m.push(`${se.dim} Loading: ${y} observations (${g.toLocaleString()} tokens to read)${se.reset}`),m.push(`${se.dim} Work investment: ${b.toLocaleString()} tokens spent on research, building, and decisions${se.reset}`),b>0&&(r.showSavingsAmount||r.showSavingsPercent)){let z=" Your savings: ";r.showSavingsAmount&&r.showSavingsPercent?z+=`${R.toLocaleString()} tokens (${w}% reduction from reuse)`:r.showSavingsAmount?z+=`${R.toLocaleString()} tokens`:z+=`${w}% reduction from reuse`,m.push(`${se.green}${z}${se.reset}`)}m.push("")}else{if(m.push("\u{1F4CA} **Context Economics**:"),m.push(`- Loading: ${y} observations (${g.toLocaleString()} tokens to read)`),m.push(`- Work investment: ${b.toLocaleString()} tokens spent on research, building, and decisions`),b>0&&(r.showSavingsAmount||r.showSavingsPercent)){let z="- Your savings: ";r.showSavingsAmount&&r.showSavingsPercent?z+=`${R.toLocaleString()} tokens (${w}% reduction from reuse)`:r.showSavingsAmount?z+=`${R.toLocaleString()} tokens`:z+=`${w}% reduction from reuse`,m.push(z)}m.push("")}let k=p[0]?.id,D=v.map((z,V)=>{let X=V===0?null:p[V+1];return{...z,displayEpoch:X?X.created_at_epoch:z.created_at_epoch,displayTime:X?X.created_at:z.created_at,shouldShowLink:z.id!==k}}),A=new Set(u.slice(0,r.fullObservationCount).map(z=>z.id)),$=[...h.map(z=>({type:"observation",data:z})),...D.map(z=>({type:"summary",data:z}))];$.sort((z,V)=>{let X=z.type==="observation"?z.data.created_at_epoch:z.data.displayEpoch,Z=V.type==="observation"?V.data.created_at_epoch:V.data.displayEpoch;return X-Z});let N=new Map;for(let z of $){let V=z.type==="observation"?z.data.created_at:z.data.displayTime,X=jf(V);N.has(X)||N.set(X,[]),N.get(X).push(z)}let C=Array.from(N.entries()).sort((z,V)=>{let X=new Date(z[0]).getTime(),Z=new Date(V[0]).getTime();return X-Z});for(let[z,V]of C){e?(m.push(`${se.bright}${se.cyan}${z}${se.reset}`),m.push("")):(m.push(`### ${z}`),m.push(""));let X=null,Z="",K=!1;for(let ae of V)if(ae.type==="summary"){K&&(m.push(""),K=!1,X=null,Z="");let J=ae.data,we=`${J.request||"Session started"} (${Yw(J.displayTime)})`;e?m.push(`\u{1F3AF} ${se.yellow}#S${J.id}${se.reset} ${we}`):m.push(`**\u{1F3AF} #S${J.id}** ${we}`),m.push("")}else{let J=ae.data,we=zs(J.files_modified,t);we!==X&&(K&&m.push(""),e?m.push(`${se.dim}${we}${se.reset}`):m.push(`**${we}**`),e||(m.push("| ID | Time | T | Title | Read | Work |"),m.push("|----|------|---|-------|------|------|")),X=we,K=!0,Z="");let fe=Jw(J.created_at),De=J.title||"Untitled",Ee=Ki[J.type]||"\u2022",Ne=(J.title?.length||0)+(J.subtitle?.length||0)+(J.narrative?.length||0)+JSON.stringify(J.facts||[]).length,H=Math.ceil(Ne/v1),W=J.discovery_tokens||0,re=sl[J.type]||"\u{1F50D}",ue=W>0?`${re} ${W.toLocaleString()}`:"-",G=fe!==Z,Q=G?fe:"";if(Z=fe,A.has(J.id)){let ge=r.fullObservationField==="narrative"?J.narrative:J.facts?Nf(J.facts).join(` +`):null;if(e){let oe=G?`${se.dim}${fe}${se.reset}`:" ".repeat(fe.length),Be=r.showReadTokens&&H>0?`${se.dim}(~${H}t)${se.reset}`:"",Ge=r.showWorkTokens&&W>0?`${se.dim}(${re} ${W.toLocaleString()}t)${se.reset}`:"";m.push(` ${se.dim}#${J.id}${se.reset} ${oe} ${Ee} ${se.bright}${De}${se.reset}`),ge&&m.push(` ${se.dim}${ge}${se.reset}`),(Be||Ge)&&m.push(` ${Be} ${Ge}`),m.push("")}else{K&&(m.push(""),K=!1),m.push(`**#${J.id}** ${Q||"\u2033"} ${Ee} **${De}**`),ge&&(m.push(""),m.push(ge),m.push(""));let oe=[];r.showReadTokens&&oe.push(`Read: ~${H}`),r.showWorkTokens&&oe.push(`Work: ${ue}`),oe.length>0&&m.push(oe.join(", ")),m.push(""),X=null}}else if(e){let ge=G?`${se.dim}${fe}${se.reset}`:" ".repeat(fe.length),oe=r.showReadTokens&&H>0?`${se.dim}(~${H}t)${se.reset}`:"",Be=r.showWorkTokens&&W>0?`${se.dim}(${re} ${W.toLocaleString()}t)${se.reset}`:"";m.push(` ${se.dim}#${J.id}${se.reset} ${ge} ${Ee} ${De} ${oe} ${Be}`)}else{let ge=r.showReadTokens?`~${H}`:"",oe=r.showWorkTokens?ue:"";m.push(`| #${J.id} | ${Q||"\u2033"} | ${Ee} | ${De} | ${ge} | ${oe} |`)}}K&&m.push("")}let O=p[0],j=u[0];if(r.showLastSummary&&O&&(O.investigated||O.learned||O.completed||O.next_steps)&&(!j||O.created_at_epoch>j.created_at_epoch)&&(m.push(...Bl("Investigated",O.investigated,se.blue,e)),m.push(...Bl("Learned",O.learned,se.yellow,e)),m.push(...Bl("Completed",O.completed,se.green,e)),m.push(...Bl("Next Steps",O.next_steps,se.magenta,e))),d&&(m.push(""),m.push("---"),m.push(""),e?(m.push(`${se.bright}${se.magenta}\u{1F4CB} Previously${se.reset}`),m.push(""),m.push(`${se.dim}A: ${d}${se.reset}`)):(m.push("**\u{1F4CB} Previously**"),m.push(""),m.push(`A: ${d}`)),m.push("")),T&&b>0&&R>0){let z=Math.round(b/1e3);m.push(""),e?m.push(`${se.dim}\u{1F4B0} Access ${z}k tokens of past research & decisions for just ${g.toLocaleString()}t. Use the mem-search skill to access memories by ID instead of re-reading files.${se.reset}`):m.push(`\u{1F4B0} Access ${z}k tokens of past research & decisions for just ${g.toLocaleString()}t. Use the mem-search skill to access memories by ID instead of re-reading files.`)}}return i?.close(),m.join(` +`).trimEnd()}var io,zl,ei,g5,v1,b5,se,Wl=Ba(()=>{"use strict";io=bt(require("path"),1),zl=require("os"),ei=require("fs");ll();Xi();yt();oa();$f();g5=io.default.join((0,zl.homedir)(),".claude","plugins","marketplaces","thedotmack","plugin",".install-version");v1=4,b5=1,se={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",cyan:"\x1B[36m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",gray:"\x1B[90m",red:"\x1B[31m"}});var T5={};iu(T5,{WorkerService:()=>Xl});module.exports=M1(T5);var E1=bt(od(),1),lo=bt(require("path"),1),w1=bt(require("fs"),1);var S={};iu(S,{BRAND:()=>iN,DIRTY:()=>ns,EMPTY_PATH:()=>LD,INVALID:()=>Te,NEVER:()=>zN,OK:()=>Ct,ParseStatus:()=>Tt,Schema:()=>He,ZodAny:()=>Aa,ZodArray:()=>ia,ZodBigInt:()=>os,ZodBoolean:()=>cs,ZodBranded:()=>Hi,ZodCatch:()=>bs,ZodDate:()=>ls,ZodDefault:()=>ys,ZodDiscriminatedUnion:()=>Rc,ZodEffects:()=>pr,ZodEnum:()=>vs,ZodError:()=>Ht,ZodFirstPartyTypeKind:()=>Oe,ZodFunction:()=>Oc,ZodIntersection:()=>fs,ZodIssueCode:()=>ee,ZodLazy:()=>ms,ZodLiteral:()=>hs,ZodMap:()=>On,ZodNaN:()=>kn,ZodNativeEnum:()=>gs,ZodNever:()=>kr,ZodNull:()=>ps,ZodNullable:()=>Vr,ZodNumber:()=>is,ZodObject:()=>Bt,ZodOptional:()=>lr,ZodParsedType:()=>pe,ZodPipeline:()=>Bi,ZodPromise:()=>Ia,ZodReadonly:()=>xs,ZodRecord:()=>Pc,ZodSchema:()=>He,ZodSet:()=>Cn,ZodString:()=>ka,ZodSymbol:()=>Rn,ZodTransformer:()=>pr,ZodTuple:()=>zr,ZodType:()=>He,ZodUndefined:()=>us,ZodUnion:()=>ds,ZodUnknown:()=>na,ZodVoid:()=>Pn,addIssueToContext:()=>ie,any:()=>hN,array:()=>bN,bigint:()=>uN,boolean:()=>t0,coerce:()=>BN,custom:()=>Yx,date:()=>pN,datetimeRegex:()=>Xx,defaultErrorMap:()=>aa,discriminatedUnion:()=>EN,effect:()=>jN,enum:()=>IN,function:()=>CN,getErrorMap:()=>En,getParsedType:()=>Br,instanceof:()=>cN,intersection:()=>wN,isAborted:()=>wc,isAsync:()=>wn,isDirty:()=>Tc,isValid:()=>Ca,late:()=>oN,lazy:()=>kN,literal:()=>AN,makeIssue:()=>Ui,map:()=>PN,nan:()=>lN,nativeEnum:()=>DN,never:()=>gN,null:()=>mN,nullable:()=>MN,number:()=>e0,object:()=>xN,objectUtil:()=>cd,oboolean:()=>HN,onumber:()=>UN,optional:()=>$N,ostring:()=>qN,pipeline:()=>FN,preprocess:()=>LN,promise:()=>NN,quotelessJson:()=>jD,record:()=>RN,set:()=>ON,setErrorMap:()=>MD,strictObject:()=>_N,string:()=>Jx,symbol:()=>dN,transformer:()=>jN,tuple:()=>TN,undefined:()=>fN,union:()=>SN,unknown:()=>vN,util:()=>We,void:()=>yN});var We;(function(a){a.assertEqual=s=>{};function e(s){}a.assertIs=e;function r(s){throw new Error}a.assertNever=r,a.arrayToEnum=s=>{let i={};for(let n of s)i[n]=n;return i},a.getValidEnumValues=s=>{let i=a.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),n={};for(let o of i)n[o]=s[o];return a.objectValues(n)},a.objectValues=s=>a.objectKeys(s).map(function(i){return s[i]}),a.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},a.find=(s,i)=>{for(let n of s)if(i(n))return n},a.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)}a.joinValues=t,a.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(We||(We={}));var cd;(function(a){a.mergeShapes=(e,r)=>({...e,...r})})(cd||(cd={}));var pe=We.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Br=a=>{switch(typeof a){case"undefined":return pe.undefined;case"string":return pe.string;case"number":return Number.isNaN(a)?pe.nan:pe.number;case"boolean":return pe.boolean;case"function":return pe.function;case"bigint":return pe.bigint;case"symbol":return pe.symbol;case"object":return Array.isArray(a)?pe.array:a===null?pe.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?pe.promise:typeof Map<"u"&&a instanceof Map?pe.map:typeof Set<"u"&&a instanceof Set?pe.set:typeof Date<"u"&&a instanceof Date?pe.date:pe.object;default:return pe.unknown}};var ee=We.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"]),jD=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),Ht=class a 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 r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=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(r(n));else{let o=t,l=0;for(;lr.message){let r={},t=[];for(let s of this.issues)if(s.path.length>0){let i=s.path[0];r[i]=r[i]||[],r[i].push(e(s))}else t.push(e(s));return{formErrors:t,fieldErrors:r}}get formErrors(){return this.flatten()}};Ht.create=a=>new Ht(a);var $D=(a,e)=>{let r;switch(a.code){case ee.invalid_type:a.received===pe.undefined?r="Required":r=`Expected ${a.expected}, received ${a.received}`;break;case ee.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(a.expected,We.jsonStringifyReplacer)}`;break;case ee.unrecognized_keys:r=`Unrecognized key(s) in object: ${We.joinValues(a.keys,", ")}`;break;case ee.invalid_union:r="Invalid input";break;case ee.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${We.joinValues(a.options)}`;break;case ee.invalid_enum_value:r=`Invalid enum value. Expected ${We.joinValues(a.options)}, received '${a.received}'`;break;case ee.invalid_arguments:r="Invalid function arguments";break;case ee.invalid_return_type:r="Invalid function return type";break;case ee.invalid_date:r="Invalid date";break;case ee.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(r=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?r=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?r=`Invalid input: must end with "${a.validation.endsWith}"`:We.assertNever(a.validation):a.validation!=="regex"?r=`Invalid ${a.validation}`:r="Invalid";break;case ee.too_small:a.type==="array"?r=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?r=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?r=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?r=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?r=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:r="Invalid input";break;case ee.too_big:a.type==="array"?r=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?r=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?r=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?r=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?r=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:r="Invalid input";break;case ee.custom:r="Invalid input";break;case ee.invalid_intersection_types:r="Intersection results could not be merged";break;case ee.not_multiple_of:r=`Number must be a multiple of ${a.multipleOf}`;break;case ee.not_finite:r="Number must be finite";break;default:r=e.defaultError,We.assertNever(a)}return{message:r}},aa=$D;var Vx=aa;function MD(a){Vx=a}function En(){return Vx}var Ui=a=>{let{data:e,path:r,errorMaps:t,issueData:s}=a,i=[...r,...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}},LD=[];function ie(a,e){let r=En(),t=Ui({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,r,r===aa?void 0:aa].filter(s=>!!s)});a.common.issues.push(t)}var Tt=class a{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let t=[];for(let s of r){if(s.status==="aborted")return Te;s.status==="dirty"&&e.dirty(),t.push(s.value)}return{status:e.value,value:t}}static async mergeObjectAsync(e,r){let t=[];for(let s of r){let i=await s.key,n=await s.value;t.push({key:i,value:n})}return a.mergeObjectSync(e,t)}static mergeObjectSync(e,r){let t={};for(let s of r){let{key:i,value:n}=s;if(i.status==="aborted"||n.status==="aborted")return Te;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}}},Te=Object.freeze({status:"aborted"}),ns=a=>({status:"dirty",value:a}),Ct=a=>({status:"valid",value:a}),wc=a=>a.status==="aborted",Tc=a=>a.status==="dirty",Ca=a=>a.status==="valid",wn=a=>typeof Promise<"u"&&a instanceof Promise;var ve;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e?.message})(ve||(ve={}));var ur=class{constructor(e,r,t,s){this._cachedPath=[],this.parent=e,this.data=r,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}},Wx=(a,e)=>{if(Ca(e))return{success:!0,data:e.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Ht(a.common.issues);return this._error=r,this._error}}};function Le(a){if(!a)return{};let{errorMap:e,invalid_type_error:r,required_error:t,description:s}=a;if(e&&(r||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}=a;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??r??o.defaultError}},description:s}}var He=class{get description(){return this._def.description}_getType(e){return Br(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Br(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Tt,ctx:{common:e.parent.common,data:e.data,parsedType:Br(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(wn(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let t=this.safeParse(e,r);if(t.success)return t.data;throw t.error}safeParse(e,r){let t={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Br(e)},s=this._parseSync({data:e,path:t.path,parent:t});return Wx(t,s)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Br(e)};if(!this["~standard"].async)try{let t=this._parseSync({data:e,path:[],parent:r});return Ca(t)?{value:t.value}:{issues:r.common.issues}}catch(t){t?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(t=>Ca(t)?{value:t.value}:{issues:r.common.issues})}async parseAsync(e,r){let t=await this.safeParseAsync(e,r);if(t.success)return t.data;throw t.error}async safeParseAsync(e,r){let t={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Br(e)},s=this._parse({data:e,path:t.path,parent:t}),i=await(wn(s)?s:Promise.resolve(s));return Wx(t,i)}refine(e,r){let t=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,i)=>{let n=e(s),o=()=>i.addIssue({code:ee.custom,...t(s)});return typeof Promise<"u"&&n instanceof Promise?n.then(l=>l?!0:(o(),!1)):n?!0:(o(),!1)})}refinement(e,r){return this._refinement((t,s)=>e(t)?!0:(s.addIssue(typeof r=="function"?r(t,s):r),!1))}_refinement(e){return new pr({schema:this,typeName:Oe.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:r=>this["~validate"](r)}}optional(){return lr.create(this,this._def)}nullable(){return Vr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ia.create(this)}promise(){return Ia.create(this,this._def)}or(e){return ds.create([this,e],this._def)}and(e){return fs.create(this,e,this._def)}transform(e){return new pr({...Le(this._def),schema:this,typeName:Oe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new ys({...Le(this._def),innerType:this,defaultValue:r,typeName:Oe.ZodDefault})}brand(){return new Hi({typeName:Oe.ZodBranded,type:this,...Le(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new bs({...Le(this._def),innerType:this,catchValue:r,typeName:Oe.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Bi.create(this,e)}readonly(){return xs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},FD=/^c[^\s-]{8,}$/i,qD=/^[0-9a-z]+$/,UD=/^[0-9A-HJKMNP-TV-Z]{26}$/i,HD=/^[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,BD=/^[a-z0-9_-]{21}$/i,zD=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,VD=/^[-+]?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)?)??$/,WD=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,GD="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ld,ZD=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,KD=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,XD=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,QD=/^(([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])$/,YD=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,JD=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Zx="((\\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])))",eN=new RegExp(`^${Zx}$`);function Kx(a){let e="[0-5]\\d";a.precision?e=`${e}\\.\\d{${a.precision}}`:a.precision==null&&(e=`${e}(\\.\\d+)?`);let r=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function tN(a){return new RegExp(`^${Kx(a)}$`)}function Xx(a){let e=`${Zx}T${Kx(a)}`,r=[];return r.push(a.local?"Z?":"Z"),a.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function rN(a,e){return!!((e==="v4"||!e)&&ZD.test(a)||(e==="v6"||!e)&&XD.test(a))}function aN(a,e){if(!zD.test(a))return!1;try{let[r]=a.split(".");if(!r)return!1;let t=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.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 sN(a,e){return!!((e==="v4"||!e)&&KD.test(a)||(e==="v6"||!e)&&QD.test(a))}var ka=class a extends He{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==pe.string){let i=this._getOrReturnCtx(e);return ie(i,{code:ee.invalid_type,expected:pe.string,received:i.parsedType}),Te}let t=new Tt,s;for(let i of this._def.checks)if(i.kind==="min")e.data.lengthi.value&&(s=this._getOrReturnCtx(e,s),ie(s,{code:ee.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:r,code:ee.invalid_string,...ve.errToObj(t)})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ve.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ve.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ve.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ve.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ve.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ve.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ve.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ve.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ve.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ve.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ve.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ve.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ve.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,...ve.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,...ve.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...ve.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...ve.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...ve.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...ve.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...ve.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...ve.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...ve.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...ve.errToObj(r)})}nonempty(e){return this.min(1,ve.errToObj(e))}trim(){return new a({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new a({...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 r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew ka({checks:[],typeName:Oe.ZodString,coerce:a?.coerce??!1,...Le(a)});function nN(a,e){let r=(a.toString().split(".")[1]||"").length,t=(e.toString().split(".")[1]||"").length,s=r>t?r:t,i=Number.parseInt(a.toFixed(s).replace(".","")),n=Number.parseInt(e.toFixed(s).replace(".",""));return i%n/10**s}var is=class a extends He{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)!==pe.number){let i=this._getOrReturnCtx(e);return ie(i,{code:ee.invalid_type,expected:pe.number,received:i.parsedType}),Te}let t,s=new Tt;for(let i of this._def.checks)i.kind==="int"?We.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),ie(t,{code:ee.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),ie(t,{code:ee.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?nN(e.data,i.value)!==0&&(t=this._getOrReturnCtx(e,t),ie(t,{code:ee.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),ie(t,{code:ee.not_finite,message:i.message}),s.dirty()):We.assertNever(i);return{status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,ve.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ve.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ve.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ve.toString(r))}setLimit(e,r,t,s){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:t,message:ve.toString(s)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ve.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ve.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ve.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ve.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ve.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ve.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:ve.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ve.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ve.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuee.kind==="int"||e.kind==="multipleOf"&&We.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let t of this._def.checks){if(t.kind==="finite"||t.kind==="int"||t.kind==="multipleOf")return!0;t.kind==="min"?(r===null||t.value>r)&&(r=t.value):t.kind==="max"&&(e===null||t.valuenew is({checks:[],typeName:Oe.ZodNumber,coerce:a?.coerce||!1,...Le(a)});var os=class a extends He{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)!==pe.bigint)return this._getInvalidInput(e);let t,s=new Tt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(t=this._getOrReturnCtx(e,t),ie(t,{code:ee.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),ie(t,{code:ee.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):We.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return ie(r,{code:ee.invalid_type,expected:pe.bigint,received:r.parsedType}),Te}gte(e,r){return this.setLimit("min",e,!0,ve.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ve.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ve.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ve.toString(r))}setLimit(e,r,t,s){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:t,message:ve.toString(s)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ve.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ve.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ve.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ve.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ve.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew os({checks:[],typeName:Oe.ZodBigInt,coerce:a?.coerce??!1,...Le(a)});var cs=class extends He{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==pe.boolean){let t=this._getOrReturnCtx(e);return ie(t,{code:ee.invalid_type,expected:pe.boolean,received:t.parsedType}),Te}return Ct(e.data)}};cs.create=a=>new cs({typeName:Oe.ZodBoolean,coerce:a?.coerce||!1,...Le(a)});var ls=class a extends He{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==pe.date){let i=this._getOrReturnCtx(e);return ie(i,{code:ee.invalid_type,expected:pe.date,received:i.parsedType}),Te}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return ie(i,{code:ee.invalid_date}),Te}let t=new Tt,s;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()i.value&&(s=this._getOrReturnCtx(e,s),ie(s,{code:ee.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),t.dirty()):We.assertNever(i);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:ve.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:ve.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew ls({checks:[],coerce:a?.coerce||!1,typeName:Oe.ZodDate,...Le(a)});var Rn=class extends He{_parse(e){if(this._getType(e)!==pe.symbol){let t=this._getOrReturnCtx(e);return ie(t,{code:ee.invalid_type,expected:pe.symbol,received:t.parsedType}),Te}return Ct(e.data)}};Rn.create=a=>new Rn({typeName:Oe.ZodSymbol,...Le(a)});var us=class extends He{_parse(e){if(this._getType(e)!==pe.undefined){let t=this._getOrReturnCtx(e);return ie(t,{code:ee.invalid_type,expected:pe.undefined,received:t.parsedType}),Te}return Ct(e.data)}};us.create=a=>new us({typeName:Oe.ZodUndefined,...Le(a)});var ps=class extends He{_parse(e){if(this._getType(e)!==pe.null){let t=this._getOrReturnCtx(e);return ie(t,{code:ee.invalid_type,expected:pe.null,received:t.parsedType}),Te}return Ct(e.data)}};ps.create=a=>new ps({typeName:Oe.ZodNull,...Le(a)});var Aa=class extends He{constructor(){super(...arguments),this._any=!0}_parse(e){return Ct(e.data)}};Aa.create=a=>new Aa({typeName:Oe.ZodAny,...Le(a)});var na=class extends He{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ct(e.data)}};na.create=a=>new na({typeName:Oe.ZodUnknown,...Le(a)});var kr=class extends He{_parse(e){let r=this._getOrReturnCtx(e);return ie(r,{code:ee.invalid_type,expected:pe.never,received:r.parsedType}),Te}};kr.create=a=>new kr({typeName:Oe.ZodNever,...Le(a)});var Pn=class extends He{_parse(e){if(this._getType(e)!==pe.undefined){let t=this._getOrReturnCtx(e);return ie(t,{code:ee.invalid_type,expected:pe.void,received:t.parsedType}),Te}return Ct(e.data)}};Pn.create=a=>new Pn({typeName:Oe.ZodVoid,...Le(a)});var ia=class a extends He{_parse(e){let{ctx:r,status:t}=this._processInputParams(e),s=this._def;if(r.parsedType!==pe.array)return ie(r,{code:ee.invalid_type,expected:pe.array,received:r.parsedType}),Te;if(s.exactLength!==null){let n=r.data.length>s.exactLength.value,o=r.data.lengths.maxLength.value&&(ie(r,{code:ee.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),t.dirty()),r.common.async)return Promise.all([...r.data].map((n,o)=>s.type._parseAsync(new ur(r,n,r.path,o)))).then(n=>Tt.mergeArray(t,n));let i=[...r.data].map((n,o)=>s.type._parseSync(new ur(r,n,r.path,o)));return Tt.mergeArray(t,i)}get element(){return this._def.type}min(e,r){return new a({...this._def,minLength:{value:e,message:ve.toString(r)}})}max(e,r){return new a({...this._def,maxLength:{value:e,message:ve.toString(r)}})}length(e,r){return new a({...this._def,exactLength:{value:e,message:ve.toString(r)}})}nonempty(e){return this.min(1,e)}};ia.create=(a,e)=>new ia({type:a,minLength:null,maxLength:null,exactLength:null,typeName:Oe.ZodArray,...Le(e)});function Tn(a){if(a instanceof Bt){let e={};for(let r in a.shape){let t=a.shape[r];e[r]=lr.create(Tn(t))}return new Bt({...a._def,shape:()=>e})}else return a instanceof ia?new ia({...a._def,type:Tn(a.element)}):a instanceof lr?lr.create(Tn(a.unwrap())):a instanceof Vr?Vr.create(Tn(a.unwrap())):a instanceof zr?zr.create(a.items.map(e=>Tn(e))):a}var Bt=class a extends He{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=We.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==pe.object){let c=this._getOrReturnCtx(e);return ie(c,{code:ee.invalid_type,expected:pe.object,received:c.parsedType}),Te}let{status:t,ctx:s}=this._processInputParams(e),{shape:i,keys:n}=this._getCached(),o=[];if(!(this._def.catchall instanceof kr&&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],p=s.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new ur(s,p,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof kr){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&&(ie(s,{code:ee.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 p=s.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new ur(s,p,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let p=await u.key,f=await u.value;c.push({key:p,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>Tt.mergeObjectSync(t,c)):Tt.mergeObjectSync(t,l)}get shape(){return this._def.shape()}strict(e){return ve.errToObj,new a({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,t)=>{let s=this._def.errorMap?.(r,t).message??t.defaultError;return r.code==="unrecognized_keys"?{message:ve.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new a({...this._def,unknownKeys:"strip"})}passthrough(){return new a({...this._def,unknownKeys:"passthrough"})}extend(e){return new a({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new a({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Oe.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new a({...this._def,catchall:e})}pick(e){let r={};for(let t of We.objectKeys(e))e[t]&&this.shape[t]&&(r[t]=this.shape[t]);return new a({...this._def,shape:()=>r})}omit(e){let r={};for(let t of We.objectKeys(this.shape))e[t]||(r[t]=this.shape[t]);return new a({...this._def,shape:()=>r})}deepPartial(){return Tn(this)}partial(e){let r={};for(let t of We.objectKeys(this.shape)){let s=this.shape[t];e&&!e[t]?r[t]=s:r[t]=s.optional()}return new a({...this._def,shape:()=>r})}required(e){let r={};for(let t of We.objectKeys(this.shape))if(e&&!e[t])r[t]=this.shape[t];else{let i=this.shape[t];for(;i instanceof lr;)i=i._def.innerType;r[t]=i}return new a({...this._def,shape:()=>r})}keyof(){return Qx(We.objectKeys(this.shape))}};Bt.create=(a,e)=>new Bt({shape:()=>a,unknownKeys:"strip",catchall:kr.create(),typeName:Oe.ZodObject,...Le(e)});Bt.strictCreate=(a,e)=>new Bt({shape:()=>a,unknownKeys:"strict",catchall:kr.create(),typeName:Oe.ZodObject,...Le(e)});Bt.lazycreate=(a,e)=>new Bt({shape:a,unknownKeys:"strip",catchall:kr.create(),typeName:Oe.ZodObject,...Le(e)});var ds=class extends He{_parse(e){let{ctx:r}=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 r.common.issues.push(...o.ctx.common.issues),o.result;let n=i.map(o=>new Ht(o.ctx.common.issues));return ie(r,{code:ee.invalid_union,unionErrors:n}),Te}if(r.common.async)return Promise.all(t.map(async i=>{let n={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:n}),ctx:n}})).then(s);{let i,n=[];for(let l of t){let c={...r,common:{...r.common,issues:[]},parent:null},u=l._parseSync({data:r.data,path:r.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 r.common.issues.push(...i.ctx.common.issues),i.result;let o=n.map(l=>new Ht(l));return ie(r,{code:ee.invalid_union,unionErrors:o}),Te}}get options(){return this._def.options}};ds.create=(a,e)=>new ds({options:a,typeName:Oe.ZodUnion,...Le(e)});var sa=a=>a instanceof ms?sa(a.schema):a instanceof pr?sa(a.innerType()):a instanceof hs?[a.value]:a instanceof vs?a.options:a instanceof gs?We.objectValues(a.enum):a instanceof ys?sa(a._def.innerType):a instanceof us?[void 0]:a instanceof ps?[null]:a instanceof lr?[void 0,...sa(a.unwrap())]:a instanceof Vr?[null,...sa(a.unwrap())]:a instanceof Hi||a instanceof xs?sa(a.unwrap()):a instanceof bs?sa(a._def.innerType):[],Rc=class a extends He{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==pe.object)return ie(r,{code:ee.invalid_type,expected:pe.object,received:r.parsedType}),Te;let t=this.discriminator,s=r.data[t],i=this.optionsMap.get(s);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(ie(r,{code:ee.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[t]}),Te)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,t){let s=new Map;for(let i of r){let n=sa(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 a({typeName:Oe.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:s,...Le(t)})}};function ud(a,e){let r=Br(a),t=Br(e);if(a===e)return{valid:!0,data:a};if(r===pe.object&&t===pe.object){let s=We.objectKeys(e),i=We.objectKeys(a).filter(o=>s.indexOf(o)!==-1),n={...a,...e};for(let o of i){let l=ud(a[o],e[o]);if(!l.valid)return{valid:!1};n[o]=l.data}return{valid:!0,data:n}}else if(r===pe.array&&t===pe.array){if(a.length!==e.length)return{valid:!1};let s=[];for(let i=0;i{if(wc(i)||wc(n))return Te;let o=ud(i.value,n.value);return o.valid?((Tc(i)||Tc(n))&&r.dirty(),{status:r.value,value:o.data}):(ie(t,{code:ee.invalid_intersection_types}),Te)};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}))}};fs.create=(a,e,r)=>new fs({left:a,right:e,typeName:Oe.ZodIntersection,...Le(r)});var zr=class a extends He{_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.parsedType!==pe.array)return ie(t,{code:ee.invalid_type,expected:pe.array,received:t.parsedType}),Te;if(t.data.lengththis._def.items.length&&(ie(t,{code:ee.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...t.data].map((n,o)=>{let l=this._def.items[o]||this._def.rest;return l?l._parse(new ur(t,n,t.path,o)):null}).filter(n=>!!n);return t.common.async?Promise.all(i).then(n=>Tt.mergeArray(r,n)):Tt.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new a({...this._def,rest:e})}};zr.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new zr({items:a,typeName:Oe.ZodTuple,rest:null,...Le(e)})};var Pc=class a extends He{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.parsedType!==pe.object)return ie(t,{code:ee.invalid_type,expected:pe.object,received:t.parsedType}),Te;let s=[],i=this._def.keyType,n=this._def.valueType;for(let o in t.data)s.push({key:i._parse(new ur(t,o,t.path,o)),value:n._parse(new ur(t,t.data[o],t.path,o)),alwaysSet:o in t.data});return t.common.async?Tt.mergeObjectAsync(r,s):Tt.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(e,r,t){return r instanceof He?new a({keyType:e,valueType:r,typeName:Oe.ZodRecord,...Le(t)}):new a({keyType:ka.create(),valueType:e,typeName:Oe.ZodRecord,...Le(r)})}},On=class extends He{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.parsedType!==pe.map)return ie(t,{code:ee.invalid_type,expected:pe.map,received:t.parsedType}),Te;let s=this._def.keyType,i=this._def.valueType,n=[...t.data.entries()].map(([o,l],c)=>({key:s._parse(new ur(t,o,t.path,[c,"key"])),value:i._parse(new ur(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 Te;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),o.set(c.value,u.value)}return{status:r.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 Te;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),o.set(c.value,u.value)}return{status:r.value,value:o}}}};On.create=(a,e,r)=>new On({valueType:e,keyType:a,typeName:Oe.ZodMap,...Le(r)});var Cn=class a extends He{_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.parsedType!==pe.set)return ie(t,{code:ee.invalid_type,expected:pe.set,received:t.parsedType}),Te;let s=this._def;s.minSize!==null&&t.data.sizes.maxSize.value&&(ie(t,{code:ee.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());let i=this._def.valueType;function n(l){let c=new Set;for(let u of l){if(u.status==="aborted")return Te;u.status==="dirty"&&r.dirty(),c.add(u.value)}return{status:r.value,value:c}}let o=[...t.data.values()].map((l,c)=>i._parse(new ur(t,l,t.path,c)));return t.common.async?Promise.all(o).then(l=>n(l)):n(o)}min(e,r){return new a({...this._def,minSize:{value:e,message:ve.toString(r)}})}max(e,r){return new a({...this._def,maxSize:{value:e,message:ve.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Cn.create=(a,e)=>new Cn({valueType:a,minSize:null,maxSize:null,typeName:Oe.ZodSet,...Le(e)});var Oc=class a extends He{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==pe.function)return ie(r,{code:ee.invalid_type,expected:pe.function,received:r.parsedType}),Te;function t(o,l){return Ui({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,En(),aa].filter(c=>!!c),issueData:{code:ee.invalid_arguments,argumentsError:l}})}function s(o,l){return Ui({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,En(),aa].filter(c=>!!c),issueData:{code:ee.invalid_return_type,returnTypeError:l}})}let i={errorMap:r.common.contextualErrorMap},n=r.data;if(this._def.returns instanceof Ia){let o=this;return Ct(async function(...l){let c=new Ht([]),u=await o._def.args.parseAsync(l,i).catch(d=>{throw c.addIssue(t(l,d)),c}),p=await Reflect.apply(n,this,u);return await o._def.returns._def.type.parseAsync(p,i).catch(d=>{throw c.addIssue(s(p,d)),c})})}else{let o=this;return Ct(function(...l){let c=o._def.args.safeParse(l,i);if(!c.success)throw new Ht([t(l,c.error)]);let u=Reflect.apply(n,this,c.data),p=o._def.returns.safeParse(u,i);if(!p.success)throw new Ht([s(u,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new a({...this._def,args:zr.create(e).rest(na.create())})}returns(e){return new a({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,t){return new a({args:e||zr.create([]).rest(na.create()),returns:r||na.create(),typeName:Oe.ZodFunction,...Le(t)})}},ms=class extends He{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};ms.create=(a,e)=>new ms({getter:a,typeName:Oe.ZodLazy,...Le(e)});var hs=class extends He{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return ie(r,{received:r.data,code:ee.invalid_literal,expected:this._def.value}),Te}return{status:"valid",value:e.data}}get value(){return this._def.value}};hs.create=(a,e)=>new hs({value:a,typeName:Oe.ZodLiteral,...Le(e)});function Qx(a,e){return new vs({values:a,typeName:Oe.ZodEnum,...Le(e)})}var vs=class a extends He{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),t=this._def.values;return ie(r,{expected:We.joinValues(t),received:r.parsedType,code:ee.invalid_type}),Te}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),t=this._def.values;return ie(r,{received:r.data,code:ee.invalid_enum_value,options:t}),Te}return Ct(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return a.create(e,{...this._def,...r})}exclude(e,r=this._def){return a.create(this.options.filter(t=>!e.includes(t)),{...this._def,...r})}};vs.create=Qx;var gs=class extends He{_parse(e){let r=We.getValidEnumValues(this._def.values),t=this._getOrReturnCtx(e);if(t.parsedType!==pe.string&&t.parsedType!==pe.number){let s=We.objectValues(r);return ie(t,{expected:We.joinValues(s),received:t.parsedType,code:ee.invalid_type}),Te}if(this._cache||(this._cache=new Set(We.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=We.objectValues(r);return ie(t,{received:t.data,code:ee.invalid_enum_value,options:s}),Te}return Ct(e.data)}get enum(){return this._def.values}};gs.create=(a,e)=>new gs({values:a,typeName:Oe.ZodNativeEnum,...Le(e)});var Ia=class extends He{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==pe.promise&&r.common.async===!1)return ie(r,{code:ee.invalid_type,expected:pe.promise,received:r.parsedType}),Te;let t=r.parsedType===pe.promise?r.data:Promise.resolve(r.data);return Ct(t.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Ia.create=(a,e)=>new Ia({type:a,typeName:Oe.ZodPromise,...Le(e)});var pr=class extends He{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Oe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:t}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:n=>{ie(t,n),n.fatal?r.abort():r.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(r.value==="aborted")return Te;let l=await this._def.schema._parseAsync({data:o,path:t.path,parent:t});return l.status==="aborted"?Te:l.status==="dirty"?ns(l.value):r.value==="dirty"?ns(l.value):l});{if(r.value==="aborted")return Te;let o=this._def.schema._parseSync({data:n,path:t.path,parent:t});return o.status==="aborted"?Te:o.status==="dirty"?ns(o.value):r.value==="dirty"?ns(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"?Te:(o.status==="dirty"&&r.dirty(),n(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:t.data,path:t.path,parent:t}).then(o=>o.status==="aborted"?Te:(o.status==="dirty"&&r.dirty(),n(o.value).then(()=>({status:r.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(!Ca(n))return Te;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:r.value,value:o}}else return this._def.schema._parseAsync({data:t.data,path:t.path,parent:t}).then(n=>Ca(n)?Promise.resolve(s.transform(n.value,i)).then(o=>({status:r.value,value:o})):Te);We.assertNever(s)}};pr.create=(a,e,r)=>new pr({schema:a,typeName:Oe.ZodEffects,effect:e,...Le(r)});pr.createWithPreprocess=(a,e,r)=>new pr({schema:e,effect:{type:"preprocess",transform:a},typeName:Oe.ZodEffects,...Le(r)});var lr=class extends He{_parse(e){return this._getType(e)===pe.undefined?Ct(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};lr.create=(a,e)=>new lr({innerType:a,typeName:Oe.ZodOptional,...Le(e)});var Vr=class extends He{_parse(e){return this._getType(e)===pe.null?Ct(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Vr.create=(a,e)=>new Vr({innerType:a,typeName:Oe.ZodNullable,...Le(e)});var ys=class extends He{_parse(e){let{ctx:r}=this._processInputParams(e),t=r.data;return r.parsedType===pe.undefined&&(t=this._def.defaultValue()),this._def.innerType._parse({data:t,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};ys.create=(a,e)=>new ys({innerType:a,typeName:Oe.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Le(e)});var bs=class extends He{_parse(e){let{ctx:r}=this._processInputParams(e),t={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:t.data,path:t.path,parent:{...t}});return wn(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ht(t.common.issues)},input:t.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ht(t.common.issues)},input:t.data})}}removeCatch(){return this._def.innerType}};bs.create=(a,e)=>new bs({innerType:a,typeName:Oe.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Le(e)});var kn=class extends He{_parse(e){if(this._getType(e)!==pe.nan){let t=this._getOrReturnCtx(e);return ie(t,{code:ee.invalid_type,expected:pe.nan,received:t.parsedType}),Te}return{status:"valid",value:e.data}}};kn.create=a=>new kn({typeName:Oe.ZodNaN,...Le(a)});var iN=Symbol("zod_brand"),Hi=class extends He{_parse(e){let{ctx:r}=this._processInputParams(e),t=r.data;return this._def.type._parse({data:t,path:r.path,parent:r})}unwrap(){return this._def.type}},Bi=class a extends He{_parse(e){let{status:r,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"?Te:i.status==="dirty"?(r.dirty(),ns(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"?Te:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:t.path,parent:t})}}static create(e,r){return new a({in:e,out:r,typeName:Oe.ZodPipeline})}},xs=class extends He{_parse(e){let r=this._def.innerType._parse(e),t=s=>(Ca(s)&&(s.value=Object.freeze(s.value)),s);return wn(r)?r.then(s=>t(s)):t(r)}unwrap(){return this._def.innerType}};xs.create=(a,e)=>new xs({innerType:a,typeName:Oe.ZodReadonly,...Le(e)});function Gx(a,e){let r=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof r=="string"?{message:r}:r}function Yx(a,e={},r){return a?Aa.create().superRefine((t,s)=>{let i=a(t);if(i instanceof Promise)return i.then(n=>{if(!n){let o=Gx(e,t),l=o.fatal??r??!0;s.addIssue({code:"custom",...o,fatal:l})}});if(!i){let n=Gx(e,t),o=n.fatal??r??!0;s.addIssue({code:"custom",...n,fatal:o})}}):Aa.create()}var oN={object:Bt.lazycreate},Oe;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(Oe||(Oe={}));var cN=(a,e={message:`Input not instance of ${a.name}`})=>Yx(r=>r instanceof a,e),Jx=ka.create,e0=is.create,lN=kn.create,uN=os.create,t0=cs.create,pN=ls.create,dN=Rn.create,fN=us.create,mN=ps.create,hN=Aa.create,vN=na.create,gN=kr.create,yN=Pn.create,bN=ia.create,xN=Bt.create,_N=Bt.strictCreate,SN=ds.create,EN=Rc.create,wN=fs.create,TN=zr.create,RN=Pc.create,PN=On.create,ON=Cn.create,CN=Oc.create,kN=ms.create,AN=hs.create,IN=vs.create,DN=gs.create,NN=Ia.create,jN=pr.create,$N=lr.create,MN=Vr.create,LN=pr.createWithPreprocess,FN=Bi.create,qN=()=>Jx().optional(),UN=()=>e0().optional(),HN=()=>t0().optional(),BN={string:(a=>ka.create({...a,coerce:!0})),number:(a=>is.create({...a,coerce:!0})),boolean:(a=>cs.create({...a,coerce:!0})),bigint:(a=>os.create({...a,coerce:!0})),date:(a=>ls.create({...a,coerce:!0}))};var zN=Te;var pd="2025-06-18";var r0=[pd,"2025-03-26","2024-11-05","2024-10-07"],Cc="2.0",a0=S.union([S.string(),S.number().int()]),s0=S.string(),VN=S.object({progressToken:S.optional(a0)}).passthrough(),mr=S.object({_meta:S.optional(VN)}).passthrough(),zt=S.object({method:S.string(),params:S.optional(mr)}),zi=S.object({_meta:S.optional(S.object({}).passthrough())}).passthrough(),Wr=S.object({method:S.string(),params:S.optional(zi)}),hr=S.object({_meta:S.optional(S.object({}).passthrough())}).passthrough(),kc=S.union([S.string(),S.number().int()]),n0=S.object({jsonrpc:S.literal(Cc),id:kc}).merge(zt).strict(),i0=a=>n0.safeParse(a).success,o0=S.object({jsonrpc:S.literal(Cc)}).merge(Wr).strict(),c0=a=>o0.safeParse(a).success,l0=S.object({jsonrpc:S.literal(Cc),id:kc,result:hr}).strict(),dd=a=>l0.safeParse(a).success,dr;(function(a){a[a.ConnectionClosed=-32e3]="ConnectionClosed",a[a.RequestTimeout=-32001]="RequestTimeout",a[a.ParseError=-32700]="ParseError",a[a.InvalidRequest=-32600]="InvalidRequest",a[a.MethodNotFound=-32601]="MethodNotFound",a[a.InvalidParams=-32602]="InvalidParams",a[a.InternalError=-32603]="InternalError"})(dr||(dr={}));var u0=S.object({jsonrpc:S.literal(Cc),id:kc,error:S.object({code:S.number().int(),message:S.string(),data:S.optional(S.unknown())})}).strict(),p0=a=>u0.safeParse(a).success,d0=S.union([n0,o0,l0,u0]),_s=hr.strict(),Ac=Wr.extend({method:S.literal("notifications/cancelled"),params:zi.extend({requestId:kc,reason:S.string().optional()})}),WN=S.object({src:S.string(),mimeType:S.optional(S.string()),sizes:S.optional(S.array(S.string()))}).passthrough(),Vi=S.object({icons:S.array(WN).optional()}).passthrough(),Wi=S.object({name:S.string(),title:S.optional(S.string())}).passthrough(),f0=Wi.extend({version:S.string(),websiteUrl:S.optional(S.string())}).merge(Vi),GN=S.object({experimental:S.optional(S.object({}).passthrough()),sampling:S.optional(S.object({}).passthrough()),elicitation:S.optional(S.object({}).passthrough()),roots:S.optional(S.object({listChanged:S.optional(S.boolean())}).passthrough())}).passthrough(),ZN=zt.extend({method:S.literal("initialize"),params:mr.extend({protocolVersion:S.string(),capabilities:GN,clientInfo:f0})});var KN=S.object({experimental:S.optional(S.object({}).passthrough()),logging:S.optional(S.object({}).passthrough()),completions:S.optional(S.object({}).passthrough()),prompts:S.optional(S.object({listChanged:S.optional(S.boolean())}).passthrough()),resources:S.optional(S.object({subscribe:S.optional(S.boolean()),listChanged:S.optional(S.boolean())}).passthrough()),tools:S.optional(S.object({listChanged:S.optional(S.boolean())}).passthrough())}).passthrough(),fd=hr.extend({protocolVersion:S.string(),capabilities:KN,serverInfo:f0,instructions:S.optional(S.string())}),XN=Wr.extend({method:S.literal("notifications/initialized")});var Ic=zt.extend({method:S.literal("ping")}),QN=S.object({progress:S.number(),total:S.optional(S.number()),message:S.optional(S.string())}).passthrough(),Dc=Wr.extend({method:S.literal("notifications/progress"),params:zi.merge(QN).extend({progressToken:a0})}),Nc=zt.extend({params:mr.extend({cursor:S.optional(s0)}).optional()}),jc=hr.extend({nextCursor:S.optional(s0)}),m0=S.object({uri:S.string(),mimeType:S.optional(S.string()),_meta:S.optional(S.object({}).passthrough())}).passthrough(),h0=m0.extend({text:S.string()}),md=S.string().refine(a=>{try{return atob(a),!0}catch{return!1}},{message:"Invalid Base64 string"}),v0=m0.extend({blob:md}),g0=Wi.extend({uri:S.string(),description:S.optional(S.string()),mimeType:S.optional(S.string()),_meta:S.optional(S.object({}).passthrough())}).merge(Vi),YN=Wi.extend({uriTemplate:S.string(),description:S.optional(S.string()),mimeType:S.optional(S.string()),_meta:S.optional(S.object({}).passthrough())}).merge(Vi),JN=Nc.extend({method:S.literal("resources/list")}),hd=jc.extend({resources:S.array(g0)}),e2=Nc.extend({method:S.literal("resources/templates/list")}),vd=jc.extend({resourceTemplates:S.array(YN)}),t2=zt.extend({method:S.literal("resources/read"),params:mr.extend({uri:S.string()})}),gd=hr.extend({contents:S.array(S.union([h0,v0]))}),r2=Wr.extend({method:S.literal("notifications/resources/list_changed")}),a2=zt.extend({method:S.literal("resources/subscribe"),params:mr.extend({uri:S.string()})}),s2=zt.extend({method:S.literal("resources/unsubscribe"),params:mr.extend({uri:S.string()})}),n2=Wr.extend({method:S.literal("notifications/resources/updated"),params:zi.extend({uri:S.string()})}),i2=S.object({name:S.string(),description:S.optional(S.string()),required:S.optional(S.boolean())}).passthrough(),o2=Wi.extend({description:S.optional(S.string()),arguments:S.optional(S.array(i2)),_meta:S.optional(S.object({}).passthrough())}).merge(Vi),c2=Nc.extend({method:S.literal("prompts/list")}),yd=jc.extend({prompts:S.array(o2)}),l2=zt.extend({method:S.literal("prompts/get"),params:mr.extend({name:S.string(),arguments:S.optional(S.record(S.string()))})}),bd=S.object({type:S.literal("text"),text:S.string(),_meta:S.optional(S.object({}).passthrough())}).passthrough(),xd=S.object({type:S.literal("image"),data:md,mimeType:S.string(),_meta:S.optional(S.object({}).passthrough())}).passthrough(),_d=S.object({type:S.literal("audio"),data:md,mimeType:S.string(),_meta:S.optional(S.object({}).passthrough())}).passthrough(),u2=S.object({type:S.literal("resource"),resource:S.union([h0,v0]),_meta:S.optional(S.object({}).passthrough())}).passthrough(),p2=g0.extend({type:S.literal("resource_link")}),y0=S.union([bd,xd,_d,p2,u2]),d2=S.object({role:S.enum(["user","assistant"]),content:y0}).passthrough(),Sd=hr.extend({description:S.optional(S.string()),messages:S.array(d2)}),f2=Wr.extend({method:S.literal("notifications/prompts/list_changed")}),m2=S.object({title:S.optional(S.string()),readOnlyHint:S.optional(S.boolean()),destructiveHint:S.optional(S.boolean()),idempotentHint:S.optional(S.boolean()),openWorldHint:S.optional(S.boolean())}).passthrough(),h2=Wi.extend({description:S.optional(S.string()),inputSchema:S.object({type:S.literal("object"),properties:S.optional(S.object({}).passthrough()),required:S.optional(S.array(S.string()))}).passthrough(),outputSchema:S.optional(S.object({type:S.literal("object"),properties:S.optional(S.object({}).passthrough()),required:S.optional(S.array(S.string()))}).passthrough()),annotations:S.optional(m2),_meta:S.optional(S.object({}).passthrough())}).merge(Vi),v2=Nc.extend({method:S.literal("tools/list")}),Ed=jc.extend({tools:S.array(h2)}),$c=hr.extend({content:S.array(y0).default([]),structuredContent:S.object({}).passthrough().optional(),isError:S.optional(S.boolean())}),O3=$c.or(hr.extend({toolResult:S.unknown()})),g2=zt.extend({method:S.literal("tools/call"),params:mr.extend({name:S.string(),arguments:S.optional(S.record(S.unknown()))})}),y2=Wr.extend({method:S.literal("notifications/tools/list_changed")}),b0=S.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),b2=zt.extend({method:S.literal("logging/setLevel"),params:mr.extend({level:b0})}),x2=Wr.extend({method:S.literal("notifications/message"),params:zi.extend({level:b0,logger:S.optional(S.string()),data:S.unknown()})}),_2=S.object({name:S.string().optional()}).passthrough(),S2=S.object({hints:S.optional(S.array(_2)),costPriority:S.optional(S.number().min(0).max(1)),speedPriority:S.optional(S.number().min(0).max(1)),intelligencePriority:S.optional(S.number().min(0).max(1))}).passthrough(),E2=S.object({role:S.enum(["user","assistant"]),content:S.union([bd,xd,_d])}).passthrough(),w2=zt.extend({method:S.literal("sampling/createMessage"),params:mr.extend({messages:S.array(E2),systemPrompt:S.optional(S.string()),includeContext:S.optional(S.enum(["none","thisServer","allServers"])),temperature:S.optional(S.number()),maxTokens:S.number().int(),stopSequences:S.optional(S.array(S.string())),metadata:S.optional(S.object({}).passthrough()),modelPreferences:S.optional(S2)})}),T2=hr.extend({model:S.string(),stopReason:S.optional(S.enum(["endTurn","stopSequence","maxTokens"]).or(S.string())),role:S.enum(["user","assistant"]),content:S.discriminatedUnion("type",[bd,xd,_d])}),R2=S.object({type:S.literal("boolean"),title:S.optional(S.string()),description:S.optional(S.string()),default:S.optional(S.boolean())}).passthrough(),P2=S.object({type:S.literal("string"),title:S.optional(S.string()),description:S.optional(S.string()),minLength:S.optional(S.number()),maxLength:S.optional(S.number()),format:S.optional(S.enum(["email","uri","date","date-time"]))}).passthrough(),O2=S.object({type:S.enum(["number","integer"]),title:S.optional(S.string()),description:S.optional(S.string()),minimum:S.optional(S.number()),maximum:S.optional(S.number())}).passthrough(),C2=S.object({type:S.literal("string"),title:S.optional(S.string()),description:S.optional(S.string()),enum:S.array(S.string()),enumNames:S.optional(S.array(S.string()))}).passthrough(),k2=S.union([R2,P2,O2,C2]),A2=zt.extend({method:S.literal("elicitation/create"),params:mr.extend({message:S.string(),requestedSchema:S.object({type:S.literal("object"),properties:S.record(S.string(),k2),required:S.optional(S.array(S.string()))}).passthrough()})}),I2=hr.extend({action:S.enum(["accept","decline","cancel"]),content:S.optional(S.record(S.string(),S.unknown()))}),D2=S.object({type:S.literal("ref/resource"),uri:S.string()}).passthrough();var N2=S.object({type:S.literal("ref/prompt"),name:S.string()}).passthrough(),j2=zt.extend({method:S.literal("completion/complete"),params:mr.extend({ref:S.union([N2,D2]),argument:S.object({name:S.string(),value:S.string()}).passthrough(),context:S.optional(S.object({arguments:S.optional(S.record(S.string(),S.string()))}))})}),wd=hr.extend({completion:S.object({values:S.array(S.string()).max(100),total:S.optional(S.number().int()),hasMore:S.optional(S.boolean())}).passthrough()}),$2=S.object({uri:S.string().startsWith("file://"),name:S.optional(S.string()),_meta:S.optional(S.object({}).passthrough())}).passthrough(),M2=zt.extend({method:S.literal("roots/list")}),L2=hr.extend({roots:S.array($2)}),F2=Wr.extend({method:S.literal("notifications/roots/list_changed")}),C3=S.union([Ic,ZN,j2,b2,l2,c2,JN,e2,t2,a2,s2,g2,v2]),k3=S.union([Ac,Dc,XN,F2]),A3=S.union([_s,T2,I2,L2]),I3=S.union([Ic,w2,A2,M2]),D3=S.union([Ac,Dc,x2,n2,r2,y2,f2]),N3=S.union([_s,fd,wd,Sd,yd,hd,vd,gd,$c,Ed]),fr=class extends Error{constructor(e,r,t){super(`MCP error ${e}: ${r}`),this.code=e,this.data=t,this.name="McpError"}};var q2=6e4,Mc=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(Ac,r=>{let t=this._requestHandlerAbortControllers.get(r.params.requestId);t?.abort(r.params.reason)}),this.setNotificationHandler(Dc,r=>{this._onprogress(r)}),this.setRequestHandler(Ic,r=>({}))}_setupTimeout(e,r,t,s,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(s,r),startTime:Date.now(),timeout:r,maxTotalTimeout:t,resetTimeoutOnProgress:i,onTimeout:s})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let t=Date.now()-r.startTime;if(r.maxTotalTimeout&&t>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),new fr(dr.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:t});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,t,s;this._transport=e;let i=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{i?.(),this._onclose()};let n=(t=this.transport)===null||t===void 0?void 0:t.onerror;this._transport.onerror=l=>{n?.(l),this._onerror(l)};let o=(s=this._transport)===null||s===void 0?void 0:s.onmessage;this._transport.onmessage=(l,c)=>{o?.(l,c),dd(l)||p0(l)?this._onresponse(l):i0(l)?this._onrequest(l,c):c0(l)?this._onnotification(l):this._onerror(new Error(`Unknown message type: ${JSON.stringify(l)}`))},await this._transport.start()}_onclose(){var e;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let t=new fr(dr.ConnectionClosed,"Connection closed");for(let s of r.values())s(t)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;let t=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;t!==void 0&&Promise.resolve().then(()=>t(e)).catch(s=>this._onerror(new Error(`Uncaught error in notification handler: ${s}`)))}_onrequest(e,r){var t,s;let i=(t=this._requestHandlers.get(e.method))!==null&&t!==void 0?t:this.fallbackRequestHandler,n=this._transport;if(i===void 0){n?.send({jsonrpc:"2.0",id:e.id,error:{code:dr.MethodNotFound,message:"Method not found"}}).catch(c=>this._onerror(new Error(`Failed to send an error response: ${c}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);let l={signal:o.signal,sessionId:n?.sessionId,_meta:(s=e.params)===null||s===void 0?void 0:s._meta,sendNotification:c=>this.notification(c,{relatedRequestId:e.id}),sendRequest:(c,u,p)=>this.request(c,u,{...p,relatedRequestId:e.id}),authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo};Promise.resolve().then(()=>i(e,l)).then(c=>{if(!o.signal.aborted)return n?.send({result:c,jsonrpc:"2.0",id:e.id})},c=>{var u;if(!o.signal.aborted)return n?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(c.code)?c.code:dr.InternalError,message:(u=c.message)!==null&&u!==void 0?u:"Internal error"}})}).catch(c=>this._onerror(new Error(`Failed to send response: ${c}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...t}=e.params,s=Number(r),i=this._progressHandlers.get(s);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let n=this._responseHandlers.get(s),o=this._timeoutInfo.get(s);if(o&&n&&o.resetTimeoutOnProgress)try{this._resetTimeout(s)}catch(l){n(l);return}i(t)}_onresponse(e){let r=Number(e.id),t=this._responseHandlers.get(r);if(t===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),dd(e))t(e);else{let s=new fr(e.error.code,e.error.message,e.error.data);t(s)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,r,t){let{relatedRequestId:s,resumptionToken:i,onresumptiontoken:n}=t??{};return new Promise((o,l)=>{var c,u,p,f,d,v;if(!this._transport){l(new Error("Not connected"));return}((c=this._options)===null||c===void 0?void 0:c.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(u=t?.signal)===null||u===void 0||u.throwIfAborted();let h=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:h};t?.onprogress&&(this._progressHandlers.set(h,t.onprogress),m.params={...e.params,_meta:{...((p=e.params)===null||p===void 0?void 0:p._meta)||{},progressToken:h}});let y=R=>{var w;this._responseHandlers.delete(h),this._progressHandlers.delete(h),this._cleanupTimeout(h),(w=this._transport)===null||w===void 0||w.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:h,reason:String(R)}},{relatedRequestId:s,resumptionToken:i,onresumptiontoken:n}).catch(T=>this._onerror(new Error(`Failed to send cancellation: ${T}`))),l(R)};this._responseHandlers.set(h,R=>{var w;if(!(!((w=t?.signal)===null||w===void 0)&&w.aborted)){if(R instanceof Error)return l(R);try{let T=r.parse(R.result);o(T)}catch(T){l(T)}}}),(f=t?.signal)===null||f===void 0||f.addEventListener("abort",()=>{var R;y((R=t?.signal)===null||R===void 0?void 0:R.reason)});let g=(d=t?.timeout)!==null&&d!==void 0?d:q2,b=()=>y(new fr(dr.RequestTimeout,"Request timed out",{timeout:g}));this._setupTimeout(h,g,t?.maxTotalTimeout,b,(v=t?.resetTimeoutOnProgress)!==null&&v!==void 0?v:!1),this._transport.send(m,{relatedRequestId:s,resumptionToken:i,onresumptiontoken:n}).catch(R=>{this._cleanupTimeout(h),l(R)})})}async notification(e,r){var t,s;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((s=(t=this._options)===null||t===void 0?void 0:t.debouncedNotificationMethods)!==null&&s!==void 0?s:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var l;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let c={...e,jsonrpc:"2.0"};(l=this._transport)===null||l===void 0||l.send(c,r).catch(u=>this._onerror(u))});return}let o={...e,jsonrpc:"2.0"};await this._transport.send(o,r)}setRequestHandler(e,r){let t=e.shape.method.value;this.assertRequestHandlerCapability(t),this._requestHandlers.set(t,(s,i)=>Promise.resolve(r(e.parse(s),i)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){this._notificationHandlers.set(e.shape.method.value,t=>Promise.resolve(r(e.parse(t))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function x0(a,e){return Object.entries(e).reduce((r,[t,s])=>(s&&typeof s=="object"?r[t]=r[t]?{...r[t],...s}:s:r[t]=s,r),{...a})}var SS=bt(_S(),1),An=class extends Mc{constructor(e,r){var t;super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(t=r?.capabilities)!==null&&t!==void 0?t:{},this._ajv=new SS.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=x0(this._capabilities,e)}assertCapability(e,r){var t;if(!(!((t=this._serverCapabilities)===null||t===void 0)&&t[e]))throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{let t=await this.request({method:"initialize",params:{protocolVersion:pd,capabilities:this._capabilities,clientInfo:this._clientInfo}},fd,r);if(t===void 0)throw new Error(`Server sent invalid initialize result: ${t}`);if(!r0.includes(t.protocolVersion))throw new Error(`Server's protocol version is not supported: ${t.protocolVersion}`);this._serverCapabilities=t.capabilities,this._serverVersion=t.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(t.protocolVersion),this._instructions=t.instructions,await this.notification({method:"notifications/initialized"})}catch(t){throw this.close(),t}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var r,t,s,i,n;switch(e){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((t=this._serverCapabilities)===null||t===void 0)&&t.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var r;switch(e){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"ping":break}}async ping(e){return this.request({method:"ping"},_s,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},wd,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},_s,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},Sd,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},yd,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},hd,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},vd,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},gd,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},_s,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},_s,r)}async callTool(e,r=$c,t){let s=await this.request({method:"tools/call",params:e},r,t),i=this.getToolOutputValidator(e.name);if(i){if(!s.structuredContent&&!s.isError)throw new fr(dr.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(s.structuredContent)try{if(!i(s.structuredContent))throw new fr(dr.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(i.errors)}`)}catch(n){throw n instanceof fr?n:new fr(dr.InvalidParams,`Failed to validate structured content: ${n instanceof Error?n.message:String(n)}`)}}return s}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(let r of e)if(r.outputSchema)try{let t=this._ajv.compile(r.outputSchema);this._cachedToolOutputValidators.set(r.name,t)}catch{}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let t=await this.request({method:"tools/list",params:e},Ed,r);return this.cacheToolOutputSchemas(t.tools),t}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var dE=bt(uE(),1),Zi=bt(require("node:process"),1),fE=require("node:stream");var al=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(` `);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),V$(r)}clear(){this._buffer=void 0}};function V$(a){return d0.parse(JSON.parse(a))}function pE(a){return JSON.stringify(a)+` `}var W$=Zi.default.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];function G$(){let a={};for(let e of W$){let r=Zi.default.env[e];r!==void 0&&(r.startsWith("()")||(a[e]=r))}return a}var Nn=class{constructor(e){this._abortController=new AbortController,this._readBuffer=new al,this._stderrStream=null,this._serverParams=e,(e.stderr==="pipe"||e.stderr==="overlapped")&&(this._stderrStream=new fE.PassThrough)}async start(){if(this._process)throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,r)=>{var t,s,i,n,o;this._process=(0,dE.default)(this._serverParams.command,(t=this._serverParams.args)!==null&&t!==void 0?t:[],{env:{...G$(),...this._serverParams.env},stdio:["pipe","pipe",(s=this._serverParams.stderr)!==null&&s!==void 0?s:"inherit"],shell:!1,signal:this._abortController.signal,windowsHide:Zi.default.platform==="win32"&&Z$(),cwd:this._serverParams.cwd}),this._process.on("error",l=>{var c,u;if(l.name==="AbortError"){(c=this.onclose)===null||c===void 0||c.call(this);return}r(l),(u=this.onerror)===null||u===void 0||u.call(this,l)}),this._process.on("spawn",()=>{e()}),this._process.on("close",l=>{var c;this._process=void 0,(c=this.onclose)===null||c===void 0||c.call(this)}),(i=this._process.stdin)===null||i===void 0||i.on("error",l=>{var c;(c=this.onerror)===null||c===void 0||c.call(this,l)}),(n=this._process.stdout)===null||n===void 0||n.on("data",l=>{this._readBuffer.append(l),this.processReadBuffer()}),(o=this._process.stdout)===null||o===void 0||o.on("error",l=>{var c;(c=this.onerror)===null||c===void 0||c.call(this,l)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){var e,r;return this._stderrStream?this._stderrStream:(r=(e=this._process)===null||e===void 0?void 0:e.stderr)!==null&&r!==void 0?r:null}get pid(){var e,r;return(r=(e=this._process)===null||e===void 0?void 0:e.pid)!==null&&r!==void 0?r:null}processReadBuffer(){for(var e,r;;)try{let t=this._readBuffer.readMessage();if(t===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,t)}catch(t){(r=this.onerror)===null||r===void 0||r.call(this,t)}}async close(){this._abortController.abort(),this._process=void 0,this._readBuffer.clear()}send(e){return new Promise(r=>{var t;if(!(!((t=this._process)===null||t===void 0)&&t.stdin))throw new Error("Not connected");let s=pE(e);this._process.stdin.write(s)?r():this._process.stdin.once("drain",r)})}};function Z$(){return"type"in Zi.default}var cl=bt(require("path"),1),lf=require("os");yt();var of={DEFAULT:5e3,HEALTH_CHECK:1e3,WORKER_STARTUP_WAIT:1e3,WORKER_STARTUP_RETRIES:15,WINDOWS_MULTIPLIER:1.5};function yE(a){return process.platform==="win32"?Math.round(a*of.WINDOWS_MULTIPLIER):a}var ol=require("path");var SE=require("os");Ar();var xH=(0,ol.join)(Vt,"worker.pid"),_H=(0,ol.join)(Vt,"logs"),SH=(0,ol.join)((0,SE.homedir)(),".claude","plugins","marketplaces","thedotmack");oa();var IH=cl.default.join((0,lf.homedir)(),".claude","plugins","marketplaces","thedotmack"),DH=yE(of.HEALTH_CHECK),ws=null;function Fn(){if(ws!==null)return ws;try{let a=cl.default.join(lt.get("CLAUDE_MEM_DATA_DIR"),"settings.json"),e=lt.loadFromFile(a);return ws=parseInt(e.CLAUDE_MEM_WORKER_PORT,10),ws}catch(a){return q.debug("SYSTEM","Failed to load port from settings, using default",{error:a}),ws=parseInt(lt.get("CLAUDE_MEM_WORKER_PORT"),10),ws}}function EE(){ws=null}function wE(){let a=cl.default.join((0,lf.homedir)(),".claude-mem","settings.json");return lt.loadFromFile(a).CLAUDE_MEM_WORKER_HOST}yt();var T1=require("child_process"),R1=require("util");ll();var RE=require("bun:sqlite");Ar();var ul=class{db;constructor(e){e||(il(Vt),e=nl),this.db=new RE.Database(e),this.db.run("PRAGMA journal_mode = WAL"),this.ensureFTSTables()}ensureFTSTables(){try{if(this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name LIKE '%_fts'").all().some(t=>t.name==="observations_fts"||t.name==="session_summaries_fts"))return;console.log("[SessionSearch] Creating FTS5 tables..."),this.db.run(` CREATE VIRTUAL TABLE IF NOT EXISTS observations_fts USING fts5( @@ -928,16 +928,16 @@ Never reference yourself or your own actions. Do not output anything other than Remember that we record these observations as a way of helping us stay on track with our progress, and to help us keep important decisions and changes at the forefront of our minds! :) Thank you so much for your continued help! MEMORY PROCESSING CONTINUED -===========================`}oa();Ar();var ff=require("path"),sw=require("url"),nw=require("events"),ow=require("child_process"),cw=require("readline"),xe=bt(require("fs"),1),lw=require("fs/promises"),mw=require("path"),hw=require("os"),Ps=require("path"),gw=require("process"),yw=require("fs"),bw=require("crypto"),Ew=require("crypto"),Yn=require("fs"),mf=require("path"),ww=require("crypto");var u5={},J$=Object.create,e8=Object.getPrototypeOf,df=Object.defineProperty,t8=Object.getOwnPropertyNames,r8=Object.prototype.hasOwnProperty,a8=(a,e,r)=>{r=a!=null?J$(e8(a)):{};let t=e||!a||!a.__esModule?df(r,"default",{value:a,enumerable:!0}):r;for(let s of t8(a))r8.call(t,s)||df(t,s,{get:()=>a[s],enumerable:!0});return t},De=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),s8=(a,e)=>{for(var r in e)df(a,r,{get:e[r],enumerable:!0,configurable:!0,set:t=>e[r]=()=>t})};var n8=De((a,e)=>{(function(r,t){typeof a=="object"&&typeof e<"u"?t(a):typeof define=="function"&&define.amd?define(["exports"],t):t(r.URI=r.URI||{})})(a,function(r){function t(){for(var _=arguments.length,x=Array(_),P=0;P<_;P++)x[P]=arguments[P];if(x.length>1){x[0]=x[0].slice(0,-1);for(var F=x.length-1,B=1;B= 0x80 (not a basic code point)","invalid-input":"Invalid input"},N=h-m,C=Math.floor,O=String.fromCharCode;function j(_){throw new RangeError($[_])}function M(_,x){for(var P=[],F=_.length;F--;)P[F]=x(_[F]);return P}function z(_,x){var P=_.split("@"),F="";P.length>1&&(F=P[0]+"@",_=P[1]),_=_.replace(A,".");var B=_.split("."),J=M(B,x).join(".");return F+J}function V(_){for(var x=[],P=0,F=_.length;P=55296&&B<=56319&&P>1,x+=C(x/P);x>N*y>>1;B+=h)x=C(x/N);return C(B+(N+1)*x/(x+g))},Y=function(x){var P=[],F=x.length,B=0,J=w,le=R,_e=x.lastIndexOf(T);_e<0&&(_e=0);for(var me=0;me<_e;++me)x.charCodeAt(me)>=128&&j("not-basic"),P.push(x.charCodeAt(me));for(var je=_e>0?_e+1:0;je=F&&j("invalid-input");var Ie=Z(x.charCodeAt(je++));(Ie>=h||Ie>C((v-B)/Ae))&&j("overflow"),B+=Ie*Ae;var he=Se<=le?m:Se>=le+y?y:Se-le;if(IeC(v/Ye)&&j("overflow"),Ae*=Ye}var Me=P.length+1;le=se(B-be,Me,be==0),C(B/Me)>v-J&&j("overflow"),J+=C(B/Me),B%=Me,P.splice(B++,0,J)}return String.fromCodePoint.apply(String,P)},we=function(x){var P=[];x=V(x);var F=x.length,B=w,J=0,le=R,_e=!0,me=!1,je=void 0;try{for(var be=x[Symbol.iterator](),Ae;!(_e=(Ae=be.next()).done);_e=!0){var Se=Ae.value;Se<128&&P.push(O(Se))}}catch(Jr){me=!0,je=Jr}finally{try{!_e&&be.return&&be.return()}finally{if(me)throw je}}var Ie=P.length,he=Ie;for(Ie&&P.push(T);he=B&&otC((v-J)/ht)&&j("overflow"),J+=(Ye-B)*ht,B=Ye;var vt=!0,Zt=!1,$t=void 0;try{for(var Nr=x[Symbol.iterator](),Er;!(vt=(Er=Nr.next()).done);vt=!0){var wr=Er.value;if(wrv&&j("overflow"),wr==B){for(var Ot=J,Kt=h;;Kt+=h){var Xt=Kt<=le?m:Kt>=le+y?y:Kt-le;if(Ot>6|192).toString(16).toUpperCase()+"%"+(x&63|128).toString(16).toUpperCase():P="%"+(x>>12|224).toString(16).toUpperCase()+"%"+(x>>6&63|128).toString(16).toUpperCase()+"%"+(x&63|128).toString(16).toUpperCase(),P}function W(_){for(var x="",P=0,F=_.length;P=194&&B<224){if(F-P>=6){var J=parseInt(_.substr(P+4,2),16);x+=String.fromCharCode((B&31)<<6|J&63)}else x+=_.substr(P,6);P+=6}else if(B>=224){if(F-P>=9){var le=parseInt(_.substr(P+4,2),16),_e=parseInt(_.substr(P+7,2),16);x+=String.fromCharCode((B&15)<<12|(le&63)<<6|_e&63)}else x+=_.substr(P,9);P+=9}else x+=_.substr(P,3),P+=3}return x}function re(_,x){function P(F){var B=W(F);return B.match(x.UNRESERVED)?B:F}return _.scheme&&(_.scheme=String(_.scheme).replace(x.PCT_ENCODED,P).toLowerCase().replace(x.NOT_SCHEME,"")),_.userinfo!==void 0&&(_.userinfo=String(_.userinfo).replace(x.PCT_ENCODED,P).replace(x.NOT_USERINFO,H).replace(x.PCT_ENCODED,n)),_.host!==void 0&&(_.host=String(_.host).replace(x.PCT_ENCODED,P).toLowerCase().replace(x.NOT_HOST,H).replace(x.PCT_ENCODED,n)),_.path!==void 0&&(_.path=String(_.path).replace(x.PCT_ENCODED,P).replace(_.scheme?x.NOT_PATH:x.NOT_PATH_NOSCHEME,H).replace(x.PCT_ENCODED,n)),_.query!==void 0&&(_.query=String(_.query).replace(x.PCT_ENCODED,P).replace(x.NOT_QUERY,H).replace(x.PCT_ENCODED,n)),_.fragment!==void 0&&(_.fragment=String(_.fragment).replace(x.PCT_ENCODED,P).replace(x.NOT_FRAGMENT,H).replace(x.PCT_ENCODED,n)),_}function ue(_){return _.replace(/^0*(.*)/,"$1")||"0"}function G(_,x){var P=_.match(x.IPV4ADDRESS)||[],F=f(P,2),B=F[1];return B?B.split(".").map(ue).join("."):_}function Q(_,x){var P=_.match(x.IPV6ADDRESS)||[],F=f(P,3),B=F[1],J=F[2];if(B){for(var le=B.toLowerCase().split("::").reverse(),_e=f(le,2),me=_e[0],je=_e[1],be=je?je.split(":").map(ue):[],Ae=me.split(":").map(ue),Se=x.IPV4ADDRESS.test(Ae[Ae.length-1]),Ie=Se?7:8,he=Ae.length-Ie,Ye=Array(Ie),Me=0;Me1){var Ue=Ye.slice(0,qe.index),ot=Ye.slice(qe.index+qe.length);nt=Ue.join(":")+"::"+ot.join(":")}else nt=Ye.join(":");return J&&(nt+="%"+J),nt}else return _}var ne=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,ge="".match(/(){0}/)[1]===void 0;function oe(_){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},P={},F=x.iri!==!1?p:u;x.reference==="suffix"&&(_=(x.scheme?x.scheme+":":"")+"//"+_);var B=_.match(ne);if(B){ge?(P.scheme=B[1],P.userinfo=B[3],P.host=B[4],P.port=parseInt(B[5],10),P.path=B[6]||"",P.query=B[7],P.fragment=B[8],isNaN(P.port)&&(P.port=B[5])):(P.scheme=B[1]||void 0,P.userinfo=_.indexOf("@")!==-1?B[3]:void 0,P.host=_.indexOf("//")!==-1?B[4]:void 0,P.port=parseInt(B[5],10),P.path=B[6]||"",P.query=_.indexOf("?")!==-1?B[7]:void 0,P.fragment=_.indexOf("#")!==-1?B[8]:void 0,isNaN(P.port)&&(P.port=_.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?B[4]:void 0)),P.host&&(P.host=Q(G(P.host,F),F)),P.scheme===void 0&&P.userinfo===void 0&&P.host===void 0&&P.port===void 0&&!P.path&&P.query===void 0?P.reference="same-document":P.scheme===void 0?P.reference="relative":P.fragment===void 0?P.reference="absolute":P.reference="uri",x.reference&&x.reference!=="suffix"&&x.reference!==P.reference&&(P.error=P.error||"URI is not a "+x.reference+" reference.");var J=Ne[(x.scheme||P.scheme||"").toLowerCase()];if(!x.unicodeSupport&&(!J||!J.unicodeSupport)){if(P.host&&(x.domainHost||J&&J.domainHost))try{P.host=Ee.toASCII(P.host.replace(F.PCT_ENCODED,W).toLowerCase())}catch(le){P.error=P.error||"Host's domain name can not be converted to ASCII via punycode: "+le}re(P,u)}else re(P,F);J&&J.parse&&J.parse(P,x)}else P.error=P.error||"URI can not be parsed.";return P}function Be(_,x){var P=x.iri!==!1?p:u,F=[];return _.userinfo!==void 0&&(F.push(_.userinfo),F.push("@")),_.host!==void 0&&F.push(Q(G(String(_.host),P),P).replace(P.IPV6ADDRESS,function(B,J,le){return"["+J+(le?"%25"+le:"")+"]"})),(typeof _.port=="number"||typeof _.port=="string")&&(F.push(":"),F.push(String(_.port))),F.length?F.join(""):void 0}var Ge=/^\.\.?\//,Re=/^\/\.(\/|$)/,et=/^\/\.\.(\/|$)/,ze=/^\/?(?:.|\n)*?(?=\/|$)/;function Qe(_){for(var x=[];_.length;)if(_.match(Ge))_=_.replace(Ge,"");else if(_.match(Re))_=_.replace(Re,"/");else if(_.match(et))_=_.replace(et,"/"),x.pop();else if(_==="."||_==="..")_="";else{var P=_.match(ze);if(P){var F=P[0];_=_.slice(F.length),x.push(F)}else throw new Error("Unexpected dot segment condition")}return x.join("")}function Ze(_){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},P=x.iri?p:u,F=[],B=Ne[(x.scheme||_.scheme||"").toLowerCase()];if(B&&B.serialize&&B.serialize(_,x),_.host&&!P.IPV6ADDRESS.test(_.host)){if(x.domainHost||B&&B.domainHost)try{_.host=x.iri?Ee.toUnicode(_.host):Ee.toASCII(_.host.replace(P.PCT_ENCODED,W).toLowerCase())}catch(_e){_.error=_.error||"Host's domain name can not be converted to "+(x.iri?"Unicode":"ASCII")+" via punycode: "+_e}}re(_,P),x.reference!=="suffix"&&_.scheme&&(F.push(_.scheme),F.push(":"));var J=Be(_,x);if(J!==void 0&&(x.reference!=="suffix"&&F.push("//"),F.push(J),_.path&&_.path.charAt(0)!=="/"&&F.push("/")),_.path!==void 0){var le=_.path;!x.absolutePath&&(!B||!B.absolutePath)&&(le=Qe(le)),J===void 0&&(le=le.replace(/^\/\//,"/%2F")),F.push(le)}return _.query!==void 0&&(F.push("?"),F.push(_.query)),_.fragment!==void 0&&(F.push("#"),F.push(_.fragment)),F.join("")}function Xe(_,x){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},F=arguments[3],B={};return F||(_=oe(Ze(_,P),P),x=oe(Ze(x,P),P)),P=P||{},!P.tolerant&&x.scheme?(B.scheme=x.scheme,B.userinfo=x.userinfo,B.host=x.host,B.port=x.port,B.path=Qe(x.path||""),B.query=x.query):(x.userinfo!==void 0||x.host!==void 0||x.port!==void 0?(B.userinfo=x.userinfo,B.host=x.host,B.port=x.port,B.path=Qe(x.path||""),B.query=x.query):(x.path?(x.path.charAt(0)==="/"?B.path=Qe(x.path):((_.userinfo!==void 0||_.host!==void 0||_.port!==void 0)&&!_.path?B.path="/"+x.path:_.path?B.path=_.path.slice(0,_.path.lastIndexOf("/")+1)+x.path:B.path=x.path,B.path=Qe(B.path)),B.query=x.query):(B.path=_.path,x.query!==void 0?B.query=x.query:B.query=_.query),B.userinfo=_.userinfo,B.host=_.host,B.port=_.port),B.scheme=_.scheme),B.fragment=x.fragment,B}function Et(_,x,P){var F=l({scheme:"null"},P);return Ze(Xe(oe(_,F),oe(x,F),F,!0),F)}function wt(_,x){return typeof _=="string"?_=Ze(oe(_,x),x):i(_)==="object"&&(_=oe(Ze(_,x),x)),_}function Pt(_,x,P){return typeof _=="string"?_=Ze(oe(_,P),P):i(_)==="object"&&(_=Ze(_,P)),typeof x=="string"?x=Ze(oe(x,P),P):i(x)==="object"&&(x=Ze(x,P)),_===x}function Qr(_,x){return _&&_.toString().replace(!x||!x.iri?u.ESCAPE:p.ESCAPE,H)}function jt(_,x){return _&&_.toString().replace(!x||!x.iri?u.PCT_ENCODED:p.PCT_ENCODED,W)}var ma={scheme:"http",domainHost:!0,parse:function(x,P){return x.host||(x.error=x.error||"HTTP URIs must have a host."),x},serialize:function(x,P){var F=String(x.scheme).toLowerCase()==="https";return(x.port===(F?443:80)||x.port==="")&&(x.port=void 0),x.path||(x.path="/"),x}},ha={scheme:"https",domainHost:ma.domainHost,parse:ma.parse,serialize:ma.serialize};function ti(_){return typeof _.secure=="boolean"?_.secure:String(_.scheme).toLowerCase()==="wss"}var qa={scheme:"ws",domainHost:!0,parse:function(x,P){var F=x;return F.secure=ti(F),F.resourceName=(F.path||"/")+(F.query?"?"+F.query:""),F.path=void 0,F.query=void 0,F},serialize:function(x,P){if((x.port===(ti(x)?443:80)||x.port==="")&&(x.port=void 0),typeof x.secure=="boolean"&&(x.scheme=x.secure?"wss":"ws",x.secure=void 0),x.resourceName){var F=x.resourceName.split("?"),B=f(F,2),J=B[0],le=B[1];x.path=J&&J!=="/"?J:void 0,x.query=le,x.resourceName=void 0}return x.fragment=void 0,x}},uo={scheme:"wss",domainHost:qa.domainHost,parse:qa.parse,serialize:qa.serialize},po={},rr=!0,fo="[A-Za-z0-9\\-\\.\\_\\~"+(rr?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",ar="[0-9A-Fa-f]",Ql=s(s("%[EFef]"+ar+"%"+ar+ar+"%"+ar+ar)+"|"+s("%[89A-Fa-f]"+ar+"%"+ar+ar)+"|"+s("%"+ar+ar)),Yl="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Jl="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",eu=t(Jl,'[\\"\\\\]'),va="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",tu=new RegExp(fo,"g"),Yr=new RegExp(Ql,"g"),ru=new RegExp(t("[^]",Yl,"[\\.]",'[\\"]',eu),"g"),Gs=new RegExp(t("[^]",fo,va),"g"),mo=Gs;function ri(_){var x=W(_);return x.match(tu)?x:_}var ai={scheme:"mailto",parse:function(x,P){var F=x,B=F.to=F.path?F.path.split(","):[];if(F.path=void 0,F.query){for(var J=!1,le={},_e=F.query.split("&"),me=0,je=_e.length;me{e.exports=function r(t,s){if(t===s)return!0;if(t&&s&&typeof t=="object"&&typeof s=="object"){if(t.constructor!==s.constructor)return!1;var i,n,o;if(Array.isArray(t)){if(i=t.length,i!=s.length)return!1;for(n=i;n--!==0;)if(!r(t[n],s[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===s.source&&t.flags===s.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===s.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===s.toString();if(o=Object.keys(t),i=o.length,i!==Object.keys(s).length)return!1;for(n=i;n--!==0;)if(!Object.prototype.hasOwnProperty.call(s,o[n]))return!1;for(n=i;n--!==0;){var l=o[n];if(!r(t[l],s[l]))return!1}return!0}return t!==t&&s!==s}}),i8=De((a,e)=>{e.exports=function(t){for(var s=0,i=t.length,n=0,o;n=55296&&o<=56319&&n{e.exports={copy:r,checkDataType:t,checkDataTypes:s,coerceToTypes:n,toHash:o,getProperty:u,escapeQuotes:p,equal:wf(),ucs2length:i8(),varOccurences:f,varReplace:d,schemaHasRules:v,schemaHasRulesExcept:h,schemaUnknownRules:m,toQuotedString:y,getPathExpr:g,getPath:b,getData:T,unescapeFragment:D,unescapeJsonPointer:N,escapeFragment:A,escapeJsonPointer:$};function r(C,O){O=O||{};for(var j in C)O[j]=C[j];return O}function t(C,O,j,M){var z=M?" !== ":" === ",V=M?" || ":" && ",X=M?"!":"",Z=M?"":"!";switch(C){case"null":return O+z+"null";case"array":return X+"Array.isArray("+O+")";case"object":return"("+X+O+V+"typeof "+O+z+'"object"'+V+Z+"Array.isArray("+O+"))";case"integer":return"(typeof "+O+z+'"number"'+V+Z+"("+O+" % 1)"+V+O+z+O+(j?V+X+"isFinite("+O+")":"")+")";case"number":return"(typeof "+O+z+'"'+C+'"'+(j?V+X+"isFinite("+O+")":"")+")";default:return"typeof "+O+z+'"'+C+'"'}}function s(C,O,j){switch(C.length){case 1:return t(C[0],O,j,!0);default:var M="",z=o(C);z.array&&z.object&&(M=z.null?"(":"(!"+O+" || ",M+="typeof "+O+' !== "object")',delete z.null,delete z.array,delete z.object),z.number&&delete z.integer;for(var V in z)M+=(M?" && ":"")+t(V,O,j,!0);return M}}var i=o(["string","number","integer","boolean","null"]);function n(C,O){if(Array.isArray(O)){for(var j=[],M=0;M=O)throw new Error("Cannot access property/index "+M+" levels up, current level is "+O);return j[O-M]}if(M>O)throw new Error("Cannot access data "+M+" levels up, current level is "+O);if(V="data"+(O-M||""),!z)return V}for(var Z=V,K=z.split("/"),se=0;se{var r=Zn();e.exports=t;function t(s){r.copy(s,this)}}),o8=De((a,e)=>{var r=e.exports=function(i,n,o){typeof n=="function"&&(o=n,n={}),o=n.cb||o;var l=typeof o=="function"?o:o.pre||function(){},c=o.post||function(){};t(n,l,c,i,"",i)};r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0},r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},r.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},r.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function t(i,n,o,l,c,u,p,f,d,v){if(l&&typeof l=="object"&&!Array.isArray(l)){n(l,c,u,p,f,d,v);for(var h in l){var m=l[h];if(Array.isArray(m)){if(h in r.arrayKeywords)for(var y=0;y{var r=n8(),t=wf(),s=Zn(),i=ew(),n=o8();e.exports=o,o.normalizeId=b,o.fullPath=m,o.url=R,o.ids=w,o.inlineRef=d,o.schema=l;function o(T,k,D){var A=this._refs[D];if(typeof A=="string")if(this._refs[A])A=this._refs[A];else return o.call(this,T,k,A);if(A=A||this._schemas[D],A instanceof i)return d(A.schema,this._opts.inlineRefs)?A.schema:A.validate||this._compile(A);var $=l.call(this,k,D),N,C,O;return $&&(N=$.schema,k=$.root,O=$.baseId),N instanceof i?C=N.validate||T.call(this,N.schema,k,void 0,O):N!==void 0&&(C=d(N,this._opts.inlineRefs)?N:T.call(this,N,k,void 0,O)),C}function l(T,k){var D=r.parse(k),A=y(D),$=m(this._getId(T.schema));if(Object.keys(T.schema).length===0||A!==$){var N=b(A),C=this._refs[N];if(typeof C=="string")return c.call(this,T,C,D);if(C instanceof i)C.validate||this._compile(C),T=C;else if(C=this._schemas[N],C instanceof i){if(C.validate||this._compile(C),N==b(k))return{schema:C,root:T,baseId:$};T=C}else return;if(!T.schema)return;$=m(this._getId(T.schema))}return p.call(this,D,$,T.schema,T)}function c(T,k,D){var A=l.call(this,T,k);if(A){var $=A.schema,N=A.baseId;T=A.root;var C=this._getId($);return C&&(N=R(N,C)),p.call(this,D,N,$,T)}}var u=s.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function p(T,k,D,A){if(T.fragment=T.fragment||"",T.fragment.slice(0,1)=="/"){for(var $=T.fragment.split("/"),N=1;N<$.length;N++){var C=$[N];if(C){if(C=s.unescapeFragment(C),D=D[C],D===void 0)break;var O;if(!u[C]&&(O=this._getId(D),O&&(k=R(k,O)),D.$ref)){var j=R(k,D.$ref),M=l.call(this,A,j);M&&(D=M.schema,A=M.root,k=M.baseId)}}}if(D!==void 0&&D!==A.schema)return{schema:D,root:A,baseId:k}}}var f=s.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function d(T,k){if(k===!1)return!1;if(k===void 0||k===!0)return v(T);if(k)return h(T)<=k}function v(T){var k;if(Array.isArray(T)){for(var D=0;D{var r=Tf();e.exports={Validation:i(t),MissingRef:i(s)};function t(n){this.message="validation failed",this.errors=n,this.ajv=this.validation=!0}s.message=function(n,o){return"can't resolve reference "+o+" from id "+n};function s(n,o,l){this.message=l||s.message(n,o),this.missingRef=r.url(n,o),this.missingSchema=r.normalizeId(r.fullPath(this.missingRef))}function i(n){return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}}),tw=De((a,e)=>{e.exports=function(r,t){t||(t={}),typeof t=="function"&&(t={cmp:t});var s=typeof t.cycles=="boolean"?t.cycles:!1,i=t.cmp&&(function(o){return function(l){return function(c,u){var p={key:c,value:l[c]},f={key:u,value:l[u]};return o(p,f)}}})(t.cmp),n=[];return(function o(l){if(l&&l.toJSON&&typeof l.toJSON=="function"&&(l=l.toJSON()),l!==void 0){if(typeof l=="number")return isFinite(l)?""+l:"null";if(typeof l!="object")return JSON.stringify(l);var c,u;if(Array.isArray(l)){for(u="[",c=0;c{e.exports=function(t,s,i){var n="",o=t.schema.$async===!0,l=t.util.schemaHasRulesExcept(t.schema,t.RULES.all,"$ref"),c=t.self._getId(t.schema);if(t.opts.strictKeywords){var u=t.util.schemaUnknownRules(t.schema,t.RULES.keywords);if(u){var p="unknown keyword: "+u;if(t.opts.strictKeywords==="log")t.logger.warn(p);else throw new Error(p)}}if(t.isTop&&(n+=" var validate = ",o&&(t.async=!0,n+="async "),n+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",c&&(t.opts.sourceCode||t.opts.processCode)&&(n+=" "+("/*# sourceURL="+c+" */")+" ")),typeof t.schema=="boolean"||!(l||t.schema.$ref)){var s="false schema",f=t.level,d=t.dataLevel,v=t.schema[s],h=t.schemaPath+t.util.getProperty(s),m=t.errSchemaPath+"/"+s,k=!t.opts.allErrors,$,y="data"+(d||""),T="valid"+f;if(t.schema===!1){t.isTop?k=!0:n+=" var "+T+" = false; ";var g=g||[];g.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+($||"false schema")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(m)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: 'boolean schema is false' "),t.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+t.schemaPath+" , data: "+y+" "),n+=" } "):n+=" {} ";var b=n;n=g.pop(),!t.compositeRule&&k?t.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else t.isTop?o?n+=" return data; ":n+=" validate.errors = null; return true; ":n+=" var "+T+" = true; ";return t.isTop&&(n+=" }; return validate; "),n}if(t.isTop){var R=t.isTop,f=t.level=0,d=t.dataLevel=0,y="data";if(t.rootId=t.resolve.fullPath(t.self._getId(t.root.schema)),t.baseId=t.baseId||t.rootId,delete t.isTop,t.dataPathArr=[""],t.schema.default!==void 0&&t.opts.useDefaults&&t.opts.strictDefaults){var w="default is ignored in the schema root";if(t.opts.strictDefaults==="log")t.logger.warn(w);else throw new Error(w)}n+=" var vErrors = null; ",n+=" var errors = 0; ",n+=" if (rootData === undefined) rootData = data; "}else{var{level:f,dataLevel:d}=t,y="data"+(d||"");if(c&&(t.baseId=t.resolve.url(t.baseId,c)),o&&!t.async)throw new Error("async schema in sync schema");n+=" var errs_"+f+" = errors;"}var T="valid"+f,k=!t.opts.allErrors,D="",A="",$,N=t.schema.type,C=Array.isArray(N);if(N&&t.opts.nullable&&t.schema.nullable===!0&&(C?N.indexOf("null")==-1&&(N=N.concat("null")):N!="null"&&(N=[N,"null"],C=!0)),C&&N.length==1&&(N=N[0],C=!1),t.schema.$ref&&l){if(t.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+t.errSchemaPath+'" (see option extendRefs)');t.opts.extendRefs!==!0&&(l=!1,t.logger.warn('$ref: keywords ignored in schema at path "'+t.errSchemaPath+'"'))}if(t.schema.$comment&&t.opts.$comment&&(n+=" "+t.RULES.all.$comment.code(t,"$comment")),N){if(t.opts.coerceTypes)var O=t.util.coerceToTypes(t.opts.coerceTypes,N);var j=t.RULES.types[N];if(O||C||j===!0||j&&!ze(j)){var h=t.schemaPath+".type",m=t.errSchemaPath+"/type",h=t.schemaPath+".type",m=t.errSchemaPath+"/type",M=C?"checkDataTypes":"checkDataType";if(n+=" if ("+t.util[M](N,y,t.opts.strictNumbers,!0)+") { ",O){var z="dataType"+f,V="coerced"+f;n+=" var "+z+" = typeof "+y+"; var "+V+" = undefined; ",t.opts.coerceTypes=="array"&&(n+=" if ("+z+" == 'object' && Array.isArray("+y+") && "+y+".length == 1) { "+y+" = "+y+"[0]; "+z+" = typeof "+y+"; if ("+t.util.checkDataType(t.schema.type,y,t.opts.strictNumbers)+") "+V+" = "+y+"; } "),n+=" if ("+V+" !== undefined) ; ";var X=O;if(X)for(var Z,K=-1,se=X.length-1;K{var r=Tf(),t=Zn(),s=Rf(),i=tw(),n=rw(),o=t.ucs2length,l=wf(),c=s.Validation;e.exports=u;function u(b,R,w,T){var k=this,D=this._opts,A=[void 0],$={},N=[],C={},O=[],j={},M=[];R=R||{schema:b,refVal:A,refs:$};var z=p.call(this,b,R,T),V=this._compilations[z.index];if(z.compiling)return V.callValidate=Y;var X=this._formats,Z=this.RULES;try{var K=we(b,R,w,T);V.validate=K;var se=V.callValidate;return se&&(se.schema=K.schema,se.errors=null,se.refs=K.refs,se.refVal=K.refVal,se.root=K.root,se.$async=K.$async,D.sourceCode&&(se.source=K.source)),K}finally{f.call(this,b,R,T)}function Y(){var G=V.validate,Q=G.apply(this,arguments);return Y.errors=G.errors,Q}function we(G,Q,ne,ge){var oe=!Q||Q&&Q.schema==G;if(Q.schema!=R.schema)return u.call(k,G,Q,ne,ge);var Be=G.$async===!0,Ge=n({isTop:!0,schema:G,isRoot:oe,baseId:ge,root:Q,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:s.MissingRef,RULES:Z,validate:n,util:t,resolve:r,resolveRef:de,usePattern:W,useDefault:re,useCustomRule:ue,opts:D,formats:X,logger:k.logger,self:k});Ge=g(A,m)+g(N,v)+g(O,h)+g(M,y)+Ge,D.processCode&&(Ge=D.processCode(Ge,G));var Re;try{var et=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",Ge);Re=et(k,Z,X,R,A,O,M,l,o,c),A[0]=Re}catch(ze){throw k.logger.error("Error compiling schema, function code:",Ge),ze}return Re.schema=G,Re.errors=null,Re.refs=$,Re.refVal=A,Re.root=oe?Re:Q,Be&&(Re.$async=!0),D.sourceCode===!0&&(Re.source={code:Ge,patterns:N,defaults:O}),Re}function de(G,Q,ne){Q=r.url(G,Q);var ge=$[Q],oe,Be;if(ge!==void 0)return oe=A[ge],Be="refVal["+ge+"]",H(oe,Be);if(!ne&&R.refs){var Ge=R.refs[Q];if(Ge!==void 0)return oe=R.refVal[Ge],Be=Oe(Q,oe),H(oe,Be)}Be=Oe(Q);var Re=r.call(k,we,R,Q);if(Re===void 0){var et=w&&w[Q];et&&(Re=r.inlineRef(et,D.inlineRefs)?et:u.call(k,et,R,w,G))}if(Re===void 0)Ee(Q);else return Ne(Q,Re),H(Re,Be)}function Oe(G,Q){var ne=A.length;return A[ne]=Q,$[G]=ne,"refVal"+ne}function Ee(G){delete $[G]}function Ne(G,Q){var ne=$[G];A[ne]=Q}function H(G,Q){return typeof G=="object"||typeof G=="boolean"?{code:Q,schema:G,inline:!0}:{code:Q,$async:G&&!!G.$async}}function W(G){var Q=C[G];return Q===void 0&&(Q=C[G]=N.length,N[Q]=G),"pattern"+Q}function re(G){switch(typeof G){case"boolean":case"number":return""+G;case"string":return t.toQuotedString(G);case"object":if(G===null)return"null";var Q=i(G),ne=j[Q];return ne===void 0&&(ne=j[Q]=O.length,O[ne]=G),"default"+ne}}function ue(G,Q,ne,ge){if(k._opts.validateSchema!==!1){var oe=G.definition.dependencies;if(oe&&!oe.every(function(Et){return Object.prototype.hasOwnProperty.call(ne,Et)}))throw new Error("parent schema must have all required keywords: "+oe.join(","));var Be=G.definition.validateSchema;if(Be){var Ge=Be(Q);if(!Ge){var Re="keyword schema is invalid: "+k.errorsText(Be.errors);if(k._opts.validateSchema=="log")k.logger.error(Re);else throw new Error(Re)}}}var et=G.definition.compile,ze=G.definition.inline,Qe=G.definition.macro,Ze;if(et)Ze=et.call(k,Q,ne,ge);else if(Qe)Ze=Qe.call(k,Q,ne,ge),D.validateSchema!==!1&&k.validateSchema(Ze,!0);else if(ze)Ze=ze.call(k,ge,G.keyword,Q,ne);else if(Ze=G.definition.validate,!Ze)return;if(Ze===void 0)throw new Error('custom keyword "'+G.keyword+'"failed to compile');var Xe=M.length;return M[Xe]=Ze,{code:"customRule"+Xe,validate:Ze}}}function p(b,R,w){var T=d.call(this,b,R,w);return T>=0?{index:T,compiling:!0}:(T=this._compilations.length,this._compilations[T]={schema:b,root:R,baseId:w},{index:T,compiling:!1})}function f(b,R,w){var T=d.call(this,b,R,w);T>=0&&this._compilations.splice(T,1)}function d(b,R,w){for(var T=0;T{var r=e.exports=function(){this._cache={}};r.prototype.put=function(s,i){this._cache[s]=i},r.prototype.get=function(s){return this._cache[s]},r.prototype.del=function(s){delete this._cache[s]},r.prototype.clear=function(){this._cache={}}}),u8=De((a,e)=>{var r=Zn(),t=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,s=[0,31,28,31,30,31,30,31,31,30,31,30,31],i=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,n=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,o=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,l=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,c=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,u=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,p=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,f=/^(?:\/(?:[^~/]|~0|~1)*)*$/,d=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,v=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;e.exports=h;function h(A){return A=A=="full"?"full":"fast",r.copy(h[A])}h.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":c,url:u,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:n,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:D,uuid:p,"json-pointer":f,"json-pointer-uri-fragment":d,"relative-json-pointer":v},h.full={date:y,time:g,"date-time":R,uri:T,"uri-reference":l,"uri-template":c,url:u,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:n,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:D,uuid:p,"json-pointer":f,"json-pointer-uri-fragment":d,"relative-json-pointer":v};function m(A){return A%4===0&&(A%100!==0||A%400===0)}function y(A){var $=A.match(t);if(!$)return!1;var N=+$[1],C=+$[2],O=+$[3];return C>=1&&C<=12&&O>=1&&O<=(C==2&&m(N)?29:s[C])}function g(A,$){var N=A.match(i);if(!N)return!1;var C=N[1],O=N[2],j=N[3],M=N[5];return(C<=23&&O<=59&&j<=59||C==23&&O==59&&j==60)&&(!$||M)}var b=/t|\s/i;function R(A){var $=A.split(b);return $.length==2&&y($[0])&&g($[1],!0)}var w=/\/|:/;function T(A){return w.test(A)&&o.test(A)}var k=/[^\\]\\Z/;function D(A){if(k.test(A))return!1;try{return new RegExp(A),!0}catch{return!1}}}),p8=De((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.errSchemaPath+"/"+s,p=!t.opts.allErrors,f="data"+(l||""),d="valid"+o,v,h;if(c=="#"||c=="#/")t.isRoot?(v=t.async,h="validate"):(v=t.root.schema.$async===!0,h="root.refVal[0]");else{var m=t.resolveRef(t.baseId,c,t.isRoot);if(m===void 0){var y=t.MissingRefError.message(t.baseId,c);if(t.opts.missingRefs=="fail"){t.logger.error(y);var g=g||[];g.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { ref: '"+t.util.escapeQuotes(c)+"' } ",t.opts.messages!==!1&&(n+=" , message: 'can\\'t resolve reference "+t.util.escapeQuotes(c)+"' "),t.opts.verbose&&(n+=" , schema: "+t.util.toQuotedString(c)+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var b=n;n=g.pop(),!t.compositeRule&&p?t.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",p&&(n+=" if (false) { ")}else if(t.opts.missingRefs=="ignore")t.logger.warn(y),p&&(n+=" if (true) { ");else throw new t.MissingRefError(t.baseId,c,y)}else if(m.inline){var R=t.util.copy(t);R.level++;var w="valid"+R.level;R.schema=m.schema,R.schemaPath="",R.errSchemaPath=c;var T=t.validate(R).replace(/validate\.schema/g,m.code);n+=" "+T+" ",p&&(n+=" if ("+w+") { ")}else v=m.$async===!0||t.async&&m.$async!==!1,h=m.code}if(h){var g=g||[];g.push(n),n="",t.opts.passContext?n+=" "+h+".call(this, ":n+=" "+h+"( ",n+=" "+f+", (dataPath || '')",t.errorPath!='""'&&(n+=" + "+t.errorPath);var k=l?"data"+(l-1||""):"parentData",D=l?t.dataPathArr[l]:"parentDataProperty";n+=" , "+k+" , "+D+", rootData) ";var A=n;if(n=g.pop(),v){if(!t.async)throw new Error("async schema referenced by sync schema");p&&(n+=" var "+d+"; "),n+=" try { await "+A+"; ",p&&(n+=" "+d+" = true; "),n+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",p&&(n+=" "+d+" = false; "),n+=" } ",p&&(n+=" if ("+d+") { ")}else n+=" if (!"+A+") { if (vErrors === null) vErrors = "+h+".errors; else vErrors = vErrors.concat("+h+".errors); errors = vErrors.length; } ",p&&(n+=" else { ")}return n}}),d8=De((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.schema[s],l=t.schemaPath+t.util.getProperty(s),c=t.errSchemaPath+"/"+s,u=!t.opts.allErrors,p=t.util.copy(t),f="";p.level++;var d="valid"+p.level,v=p.baseId,h=!0,m=o;if(m)for(var y,g=-1,b=m.length-1;g0||y===!1:t.util.schemaHasRules(y,t.RULES.all))&&(h=!1,p.schema=y,p.schemaPath=l+"["+g+"]",p.errSchemaPath=c+"/"+g,n+=" "+t.validate(p)+" ",p.baseId=v,u&&(n+=" if ("+d+") { ",f+="}"));return u&&(h?n+=" if (true) { ":n+=" "+f.slice(0,-1)+" "),n}}),f8=De((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h="errs__"+o,m=t.util.copy(t),y="";m.level++;var g="valid"+m.level,b=c.every(function($){return t.opts.strictKeywords?typeof $=="object"&&Object.keys($).length>0||$===!1:t.util.schemaHasRules($,t.RULES.all)});if(b){var R=m.baseId;n+=" var "+h+" = errors; var "+v+" = false; ";var w=t.compositeRule;t.compositeRule=m.compositeRule=!0;var T=c;if(T)for(var k,D=-1,A=T.length-1;D{e.exports=function(t,s,i){var n=" ",o=t.schema[s],l=t.errSchemaPath+"/"+s,c=!t.opts.allErrors,u=t.util.toQuotedString(o);return t.opts.$comment===!0?n+=" console.log("+u+");":typeof t.opts.$comment=="function"&&(n+=" self._opts.$comment("+u+", "+t.util.toQuotedString(l)+", validate.root.schema);"),n}}),h8=De((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h=t.opts.$data&&c&&c.$data,m;h?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",m="schema"+o):m=c,h||(n+=" var schema"+o+" = validate.schema"+u+";"),n+="var "+v+" = equal("+d+", schema"+o+"); if (!"+v+") { ";var y=y||[];y.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'const' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { allowedValue: schema"+o+" } ",t.opts.messages!==!1&&(n+=" , message: 'should be equal to constant' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var g=n;return n=y.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+g+"]); ":n+=" validate.errors = ["+g+"]; return false; ":n+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",f&&(n+=" else { "),n}}),v8=De((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h="errs__"+o,m=t.util.copy(t),y="";m.level++;var g="valid"+m.level,b="i"+o,R=m.dataLevel=t.dataLevel+1,w="data"+R,T=t.baseId,k=t.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:t.util.schemaHasRules(c,t.RULES.all);if(n+="var "+h+" = errors;var "+v+";",k){var D=t.compositeRule;t.compositeRule=m.compositeRule=!0,m.schema=c,m.schemaPath=u,m.errSchemaPath=p,n+=" var "+g+" = false; for (var "+b+" = 0; "+b+" < "+d+".length; "+b+"++) { ",m.errorPath=t.util.getPathExpr(t.errorPath,b,t.opts.jsonPointers,!0);var A=d+"["+b+"]";m.dataPathArr[R]=b;var $=t.validate(m);m.baseId=T,t.util.varOccurences($,w)<2?n+=" "+t.util.varReplace($,w,A)+" ":n+=" var "+w+" = "+A+"; "+$+" ",n+=" if ("+g+") break; } ",t.compositeRule=m.compositeRule=D,n+=" "+y+" if (!"+g+") {"}else n+=" if ("+d+".length == 0) {";var N=N||[];N.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: 'should contain a valid item' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var C=n;return n=N.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+C+"]); ":n+=" validate.errors = ["+C+"]; return false; ":n+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { ",k&&(n+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } "),t.opts.allErrors&&(n+=" } "),n}}),g8=De((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="errs__"+o,h=t.util.copy(t),m="";h.level++;var y="valid"+h.level,g={},b={},R=t.opts.ownProperties;for(D in c)if(D!="__proto__"){var w=c[D],T=Array.isArray(w)?b:g;T[D]=w}n+="var "+v+" = errors;";var k=t.errorPath;n+="var missing"+o+";";for(var D in b)if(T=b[D],T.length){if(n+=" if ( "+d+t.util.getProperty(D)+" !== undefined ",R&&(n+=" && Object.prototype.hasOwnProperty.call("+d+", '"+t.util.escapeQuotes(D)+"') "),f){n+=" && ( ";var A=T;if(A)for(var $,N=-1,C=A.length-1;N0||w===!1:t.util.schemaHasRules(w,t.RULES.all))&&(n+=" "+y+" = true; if ( "+d+t.util.getProperty(D)+" !== undefined ",R&&(n+=" && Object.prototype.hasOwnProperty.call("+d+", '"+t.util.escapeQuotes(D)+"') "),n+=") { ",h.schema=w,h.schemaPath=u+t.util.getProperty(D),h.errSchemaPath=p+"/"+t.util.escapeFragment(D),n+=" "+t.validate(h)+" ",h.baseId=Y,n+=" } ",f&&(n+=" if ("+y+") { ",m+="}"))}return f&&(n+=" "+m+" if ("+v+" == errors) {"),n}}),y8=De((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h=t.opts.$data&&c&&c.$data,m;h?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",m="schema"+o):m=c;var y="i"+o,g="schema"+o;h||(n+=" var "+g+" = validate.schema"+u+";"),n+="var "+v+";",h&&(n+=" if (schema"+o+" === undefined) "+v+" = true; else if (!Array.isArray(schema"+o+")) "+v+" = false; else {"),n+=""+v+" = false;for (var "+y+"=0; "+y+"<"+g+".length; "+y+"++) if (equal("+d+", "+g+"["+y+"])) { "+v+" = true; break; }",h&&(n+=" } "),n+=" if (!"+v+") { ";var b=b||[];b.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { allowedValues: schema"+o+" } ",t.opts.messages!==!1&&(n+=" , message: 'should be equal to one of the allowed values' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var R=n;return n=b.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+R+"]); ":n+=" validate.errors = ["+R+"]; return false; ":n+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",f&&(n+=" else { "),n}}),b8=De((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||"");if(t.opts.format===!1)return f&&(n+=" if (true) { "),n;var v=t.opts.$data&&c&&c.$data,h;v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",h="schema"+o):h=c;var m=t.opts.unknownFormats,y=Array.isArray(m);if(v){var g="format"+o,b="isObject"+o,R="formatType"+o;n+=" var "+g+" = formats["+h+"]; var "+b+" = typeof "+g+" == 'object' && !("+g+" instanceof RegExp) && "+g+".validate; var "+R+" = "+b+" && "+g+".type || 'string'; if ("+b+") { ",t.async&&(n+=" var async"+o+" = "+g+".async; "),n+=" "+g+" = "+g+".validate; } if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'string') || "),n+=" (",m!="ignore"&&(n+=" ("+h+" && !"+g+" ",y&&(n+=" && self._opts.unknownFormats.indexOf("+h+") == -1 "),n+=") || "),n+=" ("+g+" && "+R+" == '"+i+"' && !(typeof "+g+" == 'function' ? ",t.async?n+=" (async"+o+" ? await "+g+"("+d+") : "+g+"("+d+")) ":n+=" "+g+"("+d+") ",n+=" : "+g+".test("+d+"))))) {"}else{var g=t.formats[c];if(!g){if(m=="ignore")return t.logger.warn('unknown format "'+c+'" ignored in schema at path "'+t.errSchemaPath+'"'),f&&(n+=" if (true) { "),n;if(y&&m.indexOf(c)>=0)return f&&(n+=" if (true) { "),n;throw new Error('unknown format "'+c+'" is used in schema at path "'+t.errSchemaPath+'"')}var b=typeof g=="object"&&!(g instanceof RegExp)&&g.validate,R=b&&g.type||"string";if(b){var w=g.async===!0;g=g.validate}if(R!=i)return f&&(n+=" if (true) { "),n;if(w){if(!t.async)throw new Error("async format in sync schema");var T="formats"+t.util.getProperty(c)+".validate";n+=" if (!(await "+T+"("+d+"))) { "}else{n+=" if (! ";var T="formats"+t.util.getProperty(c);b&&(T+=".validate"),typeof g=="function"?n+=" "+T+"("+d+") ":n+=" "+T+".test("+d+") ",n+=") { "}}var k=k||[];k.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'format' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { format: ",v?n+=""+h:n+=""+t.util.toQuotedString(c),n+=" } ",t.opts.messages!==!1&&(n+=` , message: 'should match format "`,v?n+="' + "+h+" + '":n+=""+t.util.escapeQuotes(c),n+=`"' `),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+u:n+=""+t.util.toQuotedString(c),n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var D=n;return n=k.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+D+"]); ":n+=" validate.errors = ["+D+"]; return false; ":n+=" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",f&&(n+=" else { "),n}}),x8=De((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h="errs__"+o,m=t.util.copy(t);m.level++;var y="valid"+m.level,g=t.schema.then,b=t.schema.else,R=g!==void 0&&(t.opts.strictKeywords?typeof g=="object"&&Object.keys(g).length>0||g===!1:t.util.schemaHasRules(g,t.RULES.all)),w=b!==void 0&&(t.opts.strictKeywords?typeof b=="object"&&Object.keys(b).length>0||b===!1:t.util.schemaHasRules(b,t.RULES.all)),T=m.baseId;if(R||w){var k;m.createErrors=!1,m.schema=c,m.schemaPath=u,m.errSchemaPath=p,n+=" var "+h+" = errors; var "+v+" = true; ";var D=t.compositeRule;t.compositeRule=m.compositeRule=!0,n+=" "+t.validate(m)+" ",m.baseId=T,m.createErrors=!0,n+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",t.compositeRule=m.compositeRule=D,R?(n+=" if ("+y+") { ",m.schema=t.schema.then,m.schemaPath=t.schemaPath+".then",m.errSchemaPath=t.errSchemaPath+"/then",n+=" "+t.validate(m)+" ",m.baseId=T,n+=" "+v+" = "+y+"; ",R&&w?(k="ifClause"+o,n+=" var "+k+" = 'then'; "):k="'then'",n+=" } ",w&&(n+=" else { ")):n+=" if (!"+y+") { ",w&&(m.schema=t.schema.else,m.schemaPath=t.schemaPath+".else",m.errSchemaPath=t.errSchemaPath+"/else",n+=" "+t.validate(m)+" ",m.baseId=T,n+=" "+v+" = "+y+"; ",R&&w?(k="ifClause"+o,n+=" var "+k+" = 'else'; "):k="'else'",n+=" } "),n+=" if (!"+v+") { var err = ",t.createErrors!==!1?(n+=" { keyword: 'if' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { failingKeyword: "+k+" } ",t.opts.messages!==!1&&(n+=` , message: 'should match "' + `+k+` + '" schema' `),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!t.compositeRule&&f&&(t.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+=" } ",f&&(n+=" else { ")}else f&&(n+=" if (true) { ");return n}}),_8=De((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h="errs__"+o,m=t.util.copy(t),y="";m.level++;var g="valid"+m.level,b="i"+o,R=m.dataLevel=t.dataLevel+1,w="data"+R,T=t.baseId;if(n+="var "+h+" = errors;var "+v+";",Array.isArray(c)){var k=t.schema.additionalItems;if(k===!1){n+=" "+v+" = "+d+".length <= "+c.length+"; ";var D=p;p=t.errSchemaPath+"/additionalItems",n+=" if (!"+v+") { ";var A=A||[];A.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { limit: "+c.length+" } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT have more than "+c.length+" items' "),t.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var $=n;n=A.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+$+"]); ":n+=" validate.errors = ["+$+"]; return false; ":n+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",p=D,f&&(y+="}",n+=" else { ")}var N=c;if(N){for(var C,O=-1,j=N.length-1;O0||C===!1:t.util.schemaHasRules(C,t.RULES.all)){n+=" "+g+" = true; if ("+d+".length > "+O+") { ";var M=d+"["+O+"]";m.schema=C,m.schemaPath=u+"["+O+"]",m.errSchemaPath=p+"/"+O,m.errorPath=t.util.getPathExpr(t.errorPath,O,t.opts.jsonPointers,!0),m.dataPathArr[R]=O;var z=t.validate(m);m.baseId=T,t.util.varOccurences(z,w)<2?n+=" "+t.util.varReplace(z,w,M)+" ":n+=" var "+w+" = "+M+"; "+z+" ",n+=" } ",f&&(n+=" if ("+g+") { ",y+="}")}}if(typeof k=="object"&&(t.opts.strictKeywords?typeof k=="object"&&Object.keys(k).length>0||k===!1:t.util.schemaHasRules(k,t.RULES.all))){m.schema=k,m.schemaPath=t.schemaPath+".additionalItems",m.errSchemaPath=t.errSchemaPath+"/additionalItems",n+=" "+g+" = true; if ("+d+".length > "+c.length+") { for (var "+b+" = "+c.length+"; "+b+" < "+d+".length; "+b+"++) { ",m.errorPath=t.util.getPathExpr(t.errorPath,b,t.opts.jsonPointers,!0);var M=d+"["+b+"]";m.dataPathArr[R]=b;var z=t.validate(m);m.baseId=T,t.util.varOccurences(z,w)<2?n+=" "+t.util.varReplace(z,w,M)+" ":n+=" var "+w+" = "+M+"; "+z+" ",f&&(n+=" if (!"+g+") break; "),n+=" } } ",f&&(n+=" if ("+g+") { ",y+="}")}}else if(t.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:t.util.schemaHasRules(c,t.RULES.all)){m.schema=c,m.schemaPath=u,m.errSchemaPath=p,n+=" for (var "+b+" = 0; "+b+" < "+d+".length; "+b+"++) { ",m.errorPath=t.util.getPathExpr(t.errorPath,b,t.opts.jsonPointers,!0);var M=d+"["+b+"]";m.dataPathArr[R]=b;var z=t.validate(m);m.baseId=T,t.util.varOccurences(z,w)<2?n+=" "+t.util.varReplace(z,w,M)+" ":n+=" var "+w+" = "+M+"; "+z+" ",f&&(n+=" if (!"+g+") break; "),n+=" }"}return f&&(n+=" "+y+" if ("+h+" == errors) {"),n}}),FE=De((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,T,d="data"+(l||""),v=t.opts.$data&&c&&c.$data,h;v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",h="schema"+o):h=c;var m=s=="maximum",y=m?"exclusiveMaximum":"exclusiveMinimum",g=t.schema[y],b=t.opts.$data&&g&&g.$data,R=m?"<":">",w=m?">":"<",T=void 0;if(!(v||typeof c=="number"||c===void 0))throw new Error(s+" must be number");if(!(b||g===void 0||typeof g=="number"||typeof g=="boolean"))throw new Error(y+" must be number or boolean");if(b){var k=t.util.getData(g.$data,l,t.dataPathArr),D="exclusive"+o,A="exclType"+o,$="exclIsNumber"+o,N="op"+o,C="' + "+N+" + '";n+=" var schemaExcl"+o+" = "+k+"; ",k="schemaExcl"+o,n+=" var "+D+"; var "+A+" = typeof "+k+"; if ("+A+" != 'boolean' && "+A+" != 'undefined' && "+A+" != 'number') { ";var T=y,O=O||[];O.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(T||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: '"+y+" should be boolean' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var j=n;n=O.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+j+"]); ":n+=" validate.errors = ["+j+"]; return false; ":n+=" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" "+A+" == 'number' ? ( ("+D+" = "+h+" === undefined || "+k+" "+R+"= "+h+") ? "+d+" "+w+"= "+k+" : "+d+" "+w+" "+h+" ) : ( ("+D+" = "+k+" === true) ? "+d+" "+w+"= "+h+" : "+d+" "+w+" "+h+" ) || "+d+" !== "+d+") { var op"+o+" = "+D+" ? '"+R+"' : '"+R+"='; ",c===void 0&&(T=y,p=t.errSchemaPath+"/"+y,h=k,v=b)}else{var $=typeof g=="number",C=R;if($&&v){var N="'"+C+"'";n+=" if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" ( "+h+" === undefined || "+g+" "+R+"= "+h+" ? "+d+" "+w+"= "+g+" : "+d+" "+w+" "+h+" ) || "+d+" !== "+d+") { "}else{$&&c===void 0?(D=!0,T=y,p=t.errSchemaPath+"/"+y,h=g,w+="="):($&&(h=Math[m?"min":"max"](g,c)),g===($?h:!0)?(D=!0,T=y,p=t.errSchemaPath+"/"+y,w+="="):(D=!1,C+="="));var N="'"+C+"'";n+=" if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" "+d+" "+w+" "+h+" || "+d+" !== "+d+") { "}}T=T||s;var O=O||[];O.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(T||"_limit")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { comparison: "+N+", limit: "+h+", exclusive: "+D+" } ",t.opts.messages!==!1&&(n+=" , message: 'should be "+C+" ",v?n+="' + "+h:n+=""+h+"'"),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+u:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var j=n;return n=O.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+j+"]); ":n+=" validate.errors = ["+j+"]; return false; ":n+=" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",f&&(n+=" else { "),n}}),qE=De((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,y,d="data"+(l||""),v=t.opts.$data&&c&&c.$data,h;if(v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",h="schema"+o):h=c,!(v||typeof c=="number"))throw new Error(s+" must be number");var m=s=="maxItems"?">":"<";n+="if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" "+d+".length "+m+" "+h+") { ";var y=s,g=g||[];g.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(y||"_limitItems")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { limit: "+h+" } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT have ",s=="maxItems"?n+="more":n+="fewer",n+=" than ",v?n+="' + "+h+" + '":n+=""+c,n+=" items' "),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+u:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var b=n;return n=g.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}}),UE=De((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,y,d="data"+(l||""),v=t.opts.$data&&c&&c.$data,h;if(v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",h="schema"+o):h=c,!(v||typeof c=="number"))throw new Error(s+" must be number");var m=s=="maxLength"?">":"<";n+="if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),t.opts.unicode===!1?n+=" "+d+".length ":n+=" ucs2length("+d+") ",n+=" "+m+" "+h+") { ";var y=s,g=g||[];g.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(y||"_limitLength")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { limit: "+h+" } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT be ",s=="maxLength"?n+="longer":n+="shorter",n+=" than ",v?n+="' + "+h+" + '":n+=""+c,n+=" characters' "),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+u:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var b=n;return n=g.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}}),HE=De((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,y,d="data"+(l||""),v=t.opts.$data&&c&&c.$data,h;if(v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",h="schema"+o):h=c,!(v||typeof c=="number"))throw new Error(s+" must be number");var m=s=="maxProperties"?">":"<";n+="if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" Object.keys("+d+").length "+m+" "+h+") { ";var y=s,g=g||[];g.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(y||"_limitProperties")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { limit: "+h+" } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT have ",s=="maxProperties"?n+="more":n+="fewer",n+=" than ",v?n+="' + "+h+" + '":n+=""+c,n+=" properties' "),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+u:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var b=n;return n=g.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}}),S8=De((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v=t.opts.$data&&c&&c.$data,h;if(v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",h="schema"+o):h=c,!(v||typeof c=="number"))throw new Error(s+" must be number");n+="var division"+o+";if (",v&&(n+=" "+h+" !== undefined && ( typeof "+h+" != 'number' || "),n+=" (division"+o+" = "+d+" / "+h+", ",t.opts.multipleOfPrecision?n+=" Math.abs(Math.round(division"+o+") - division"+o+") > 1e-"+t.opts.multipleOfPrecision+" ":n+=" division"+o+" !== parseInt(division"+o+") ",n+=" ) ",v&&(n+=" ) "),n+=" ) { ";var m=m||[];m.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { multipleOf: "+h+" } ",t.opts.messages!==!1&&(n+=" , message: 'should be multiple of ",v?n+="' + "+h:n+=""+h+"'"),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+u:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var y=n;return n=m.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+y+"]); ":n+=" validate.errors = ["+y+"]; return false; ":n+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}}),E8=De((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="errs__"+o,h=t.util.copy(t);h.level++;var m="valid"+h.level;if(t.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:t.util.schemaHasRules(c,t.RULES.all)){h.schema=c,h.schemaPath=u,h.errSchemaPath=p,n+=" var "+v+" = errors; ";var y=t.compositeRule;t.compositeRule=h.compositeRule=!0,h.createErrors=!1;var g;h.opts.allErrors&&(g=h.opts.allErrors,h.opts.allErrors=!1),n+=" "+t.validate(h)+" ",h.createErrors=!0,g&&(h.opts.allErrors=g),t.compositeRule=h.compositeRule=y,n+=" if ("+m+") { ";var b=b||[];b.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var R=n;n=b.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+R+"]); ":n+=" validate.errors = ["+R+"]; return false; ":n+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { errors = "+v+"; if (vErrors !== null) { if ("+v+") vErrors.length = "+v+"; else vErrors = null; } ",t.opts.allErrors&&(n+=" } ")}else n+=" var err = ",t.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f&&(n+=" if (false) { ");return n}}),w8=De((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h="errs__"+o,m=t.util.copy(t),y="";m.level++;var g="valid"+m.level,b=m.baseId,R="prevValid"+o,w="passingSchemas"+o;n+="var "+h+" = errors , "+R+" = false , "+v+" = false , "+w+" = null; ";var T=t.compositeRule;t.compositeRule=m.compositeRule=!0;var k=c;if(k)for(var D,A=-1,$=k.length-1;A<$;)D=k[A+=1],(t.opts.strictKeywords?typeof D=="object"&&Object.keys(D).length>0||D===!1:t.util.schemaHasRules(D,t.RULES.all))?(m.schema=D,m.schemaPath=u+"["+A+"]",m.errSchemaPath=p+"/"+A,n+=" "+t.validate(m)+" ",m.baseId=b):n+=" var "+g+" = true; ",A&&(n+=" if ("+g+" && "+R+") { "+v+" = false; "+w+" = ["+w+", "+A+"]; } else { ",y+="}"),n+=" if ("+g+") { "+v+" = "+R+" = true; "+w+" = "+A+"; }";return t.compositeRule=m.compositeRule=T,n+=""+y+"if (!"+v+") { var err = ",t.createErrors!==!1?(n+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { passingSchemas: "+w+" } ",t.opts.messages!==!1&&(n+=" , message: 'should match exactly one schema in oneOf' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!t.compositeRule&&f&&(t.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+="} else { errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; }",t.opts.allErrors&&(n+=" } "),n}}),T8=De((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v=t.opts.$data&&c&&c.$data,h;v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",h="schema"+o):h=c;var m=v?"(new RegExp("+h+"))":t.usePattern(c);n+="if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'string') || "),n+=" !"+m+".test("+d+") ) { ";var y=y||[];y.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { pattern: ",v?n+=""+h:n+=""+t.util.toQuotedString(c),n+=" } ",t.opts.messages!==!1&&(n+=` , message: 'should match pattern "`,v?n+="' + "+h+" + '":n+=""+t.util.escapeQuotes(c),n+=`"' `),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+u:n+=""+t.util.toQuotedString(c),n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var g=n;return n=y.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+g+"]); ":n+=" validate.errors = ["+g+"]; return false; ":n+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}}),R8=De((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="errs__"+o,h=t.util.copy(t),m="";h.level++;var y="valid"+h.level,g="key"+o,b="idx"+o,R=h.dataLevel=t.dataLevel+1,w="data"+R,T="dataProperties"+o,k=Object.keys(c||{}).filter(K),D=t.schema.patternProperties||{},A=Object.keys(D).filter(K),$=t.schema.additionalProperties,N=k.length||A.length,C=$===!1,O=typeof $=="object"&&Object.keys($).length,j=t.opts.removeAdditional,M=C||O||j,z=t.opts.ownProperties,V=t.baseId,X=t.schema.required;if(X&&!(t.opts.$data&&X.$data)&&X.length8)n+=" || validate.schema"+u+".hasOwnProperty("+g+") ";else{var se=k;if(se)for(var Y,we=-1,de=se.length-1;we0||ze===!1:t.util.schemaHasRules(ze,t.RULES.all)){var Qe=t.util.getProperty(Y),ge=d+Qe,Ze=Be&&ze.default!==void 0;h.schema=ze,h.schemaPath=u+Qe,h.errSchemaPath=p+"/"+t.util.escapeFragment(Y),h.errorPath=t.util.getPath(t.errorPath,Y,t.opts.jsonPointers),h.dataPathArr[R]=t.util.toQuotedString(Y);var oe=t.validate(h);if(h.baseId=V,t.util.varOccurences(oe,w)<2){oe=t.util.varReplace(oe,w,ge);var Xe=ge}else{var Xe=w;n+=" var "+w+" = "+ge+"; "}if(Ze)n+=" "+oe+" ";else{if(Z&&Z[Y]){n+=" if ( "+Xe+" === undefined ",z&&(n+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+t.util.escapeQuotes(Y)+"') "),n+=") { "+y+" = false; ";var W=t.errorPath,ue=p,Et=t.util.escapeQuotes(Y);t.opts._errorDataPathProperty&&(t.errorPath=t.util.getPath(W,Y,t.opts.jsonPointers)),p=t.errSchemaPath+"/required";var G=G||[];G.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { missingProperty: '"+Et+"' } ",t.opts.messages!==!1&&(n+=" , message: '",t.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+Et+"\\'",n+="' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var Q=n;n=G.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+Q+"]); ":n+=" validate.errors = ["+Q+"]; return false; ":n+=" var err = "+Q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",p=ue,t.errorPath=W,n+=" } else { "}else f?(n+=" if ( "+Xe+" === undefined ",z&&(n+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+t.util.escapeQuotes(Y)+"') "),n+=") { "+y+" = true; } else { "):(n+=" if ("+Xe+" !== undefined ",z&&(n+=" && Object.prototype.hasOwnProperty.call("+d+", '"+t.util.escapeQuotes(Y)+"') "),n+=" ) { ");n+=" "+oe+" } "}}f&&(n+=" if ("+y+") { ",m+="}")}}if(A.length){var wt=A;if(wt)for(var Ee,Pt=-1,Qr=wt.length-1;Pt0||ze===!1:t.util.schemaHasRules(ze,t.RULES.all)){h.schema=ze,h.schemaPath=t.schemaPath+".patternProperties"+t.util.getProperty(Ee),h.errSchemaPath=t.errSchemaPath+"/patternProperties/"+t.util.escapeFragment(Ee),z?n+=" "+T+" = "+T+" || Object.keys("+d+"); for (var "+b+"=0; "+b+"<"+T+".length; "+b+"++) { var "+g+" = "+T+"["+b+"]; ":n+=" for (var "+g+" in "+d+") { ",n+=" if ("+t.usePattern(Ee)+".test("+g+")) { ",h.errorPath=t.util.getPathExpr(t.errorPath,g,t.opts.jsonPointers);var ge=d+"["+g+"]";h.dataPathArr[R]=g;var oe=t.validate(h);h.baseId=V,t.util.varOccurences(oe,w)<2?n+=" "+t.util.varReplace(oe,w,ge)+" ":n+=" var "+w+" = "+ge+"; "+oe+" ",f&&(n+=" if (!"+y+") break; "),n+=" } ",f&&(n+=" else "+y+" = true; "),n+=" } ",f&&(n+=" if ("+y+") { ",m+="}")}}}return f&&(n+=" "+m+" if ("+v+" == errors) {"),n}}),P8=De((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="errs__"+o,h=t.util.copy(t),m="";h.level++;var y="valid"+h.level;if(n+="var "+v+" = errors;",t.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:t.util.schemaHasRules(c,t.RULES.all)){h.schema=c,h.schemaPath=u,h.errSchemaPath=p;var g="key"+o,b="idx"+o,R="i"+o,w="' + "+g+" + '",T=h.dataLevel=t.dataLevel+1,k="data"+T,D="dataProperties"+o,A=t.opts.ownProperties,$=t.baseId;A&&(n+=" var "+D+" = undefined; "),A?n+=" "+D+" = "+D+" || Object.keys("+d+"); for (var "+b+"=0; "+b+"<"+D+".length; "+b+"++) { var "+g+" = "+D+"["+b+"]; ":n+=" for (var "+g+" in "+d+") { ",n+=" var startErrs"+o+" = errors; ";var N=g,C=t.compositeRule;t.compositeRule=h.compositeRule=!0;var O=t.validate(h);h.baseId=$,t.util.varOccurences(O,k)<2?n+=" "+t.util.varReplace(O,k,N)+" ":n+=" var "+k+" = "+N+"; "+O+" ",t.compositeRule=h.compositeRule=C,n+=" if (!"+y+") { for (var "+R+"=startErrs"+o+"; "+R+"{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h=t.opts.$data&&c&&c.$data,m;h?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",m="schema"+o):m=c;var y="schema"+o;if(!h)if(c.length0||k===!1:t.util.schemaHasRules(k,t.RULES.all))||(g[g.length]=R)}}else var g=c;if(h||g.length){var D=t.errorPath,A=h||g.length>=t.opts.loopRequired,$=t.opts.ownProperties;if(f)if(n+=" var missing"+o+"; ",A){h||(n+=" var "+y+" = validate.schema"+u+"; ");var N="i"+o,C="schema"+o+"["+N+"]",O="' + "+C+" + '";t.opts._errorDataPathProperty&&(t.errorPath=t.util.getPathExpr(D,C,t.opts.jsonPointers)),n+=" var "+v+" = true; ",h&&(n+=" if (schema"+o+" === undefined) "+v+" = true; else if (!Array.isArray(schema"+o+")) "+v+" = false; else {"),n+=" for (var "+N+" = 0; "+N+" < "+y+".length; "+N+"++) { "+v+" = "+d+"["+y+"["+N+"]] !== undefined ",$&&(n+=" && Object.prototype.hasOwnProperty.call("+d+", "+y+"["+N+"]) "),n+="; if (!"+v+") break; } ",h&&(n+=" } "),n+=" if (!"+v+") { ";var j=j||[];j.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { missingProperty: '"+O+"' } ",t.opts.messages!==!1&&(n+=" , message: '",t.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+O+"\\'",n+="' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var M=n;n=j.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+M+"]); ":n+=" validate.errors = ["+M+"]; return false; ":n+=" var err = "+M+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { "}else{n+=" if ( ";var z=g;if(z)for(var V,N=-1,X=z.length-1;N{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h=t.opts.$data&&c&&c.$data,m;if(h?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",m="schema"+o):m=c,(c||h)&&t.opts.uniqueItems!==!1){h&&(n+=" var "+v+"; if ("+m+" === false || "+m+" === undefined) "+v+" = true; else if (typeof "+m+" != 'boolean') "+v+" = false; else { "),n+=" var i = "+d+".length , "+v+" = true , j; if (i > 1) { ";var y=t.schema.items&&t.schema.items.type,g=Array.isArray(y);if(!y||y=="object"||y=="array"||g&&(y.indexOf("object")>=0||y.indexOf("array")>=0))n+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+d+"[i], "+d+"[j])) { "+v+" = false; break outer; } } } ";else{n+=" var itemIndices = {}, item; for (;i--;) { var item = "+d+"[i]; ";var b="checkDataType"+(g?"s":"");n+=" if ("+t.util[b](y,"item",t.opts.strictNumbers,!0)+") continue; ",g&&(n+=` if (typeof item == 'string') item = '"' + item; `),n+=" if (typeof itemIndices[item] == 'number') { "+v+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}n+=" } ",h&&(n+=" } "),n+=" if (!"+v+") { ";var R=R||[];R.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { i: i, j: j } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),t.opts.verbose&&(n+=" , schema: ",h?n+="validate.schema"+u:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var w=n;n=R.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+w+"]); ":n+=" validate.errors = ["+w+"]; return false; ":n+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",f&&(n+=" else { ")}else f&&(n+=" if (true) { ");return n}}),k8=De((a,e)=>{e.exports={$ref:p8(),allOf:d8(),anyOf:f8(),$comment:m8(),const:h8(),contains:v8(),dependencies:g8(),enum:y8(),format:b8(),if:x8(),items:_8(),maximum:FE(),minimum:FE(),maxItems:qE(),minItems:qE(),maxLength:UE(),minLength:UE(),maxProperties:HE(),minProperties:HE(),multipleOf:S8(),not:E8(),oneOf:w8(),pattern:T8(),properties:R8(),propertyNames:P8(),required:O8(),uniqueItems:C8(),validate:rw()}}),A8=De((a,e)=>{var r=k8(),t=Zn().toHash;e.exports=function(){var i=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],n=["type","$comment"],o=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],l=["number","integer","string","array","object","boolean","null"];return i.all=t(n),i.types=t(l),i.forEach(function(c){c.rules=c.rules.map(function(u){var p;if(typeof u=="object"){var f=Object.keys(u)[0];p=u[f],u=f,p.forEach(function(v){n.push(v),i.all[v]=!0})}n.push(u);var d=i.all[u]={keyword:u,code:r[u],implements:p};return d}),i.all.$comment={keyword:"$comment",code:r.$comment},c.type&&(i.types[c.type]=c)}),i.keywords=t(n.concat(o)),i.custom={},i}}),I8=De((a,e)=>{var r=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];e.exports=function(t,s){for(var i=0;i{var r=Rf().MissingRef;e.exports=t;function t(s,i,n){var o=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof i=="function"&&(n=i,i=void 0);var l=c(s).then(function(){var p=o._addSchema(s,void 0,i);return p.validate||u(p)});return n&&l.then(function(p){n(null,p)},n),l;function c(p){var f=p.$schema;return f&&!o.getSchema(f)?t.call(o,{$ref:f},!0):Promise.resolve()}function u(p){try{return o._compile(p)}catch(d){if(d instanceof r)return f(d);throw d}function f(d){var v=d.missingSchema;if(y(v))throw new Error("Schema "+v+" is loaded but "+d.missingRef+" cannot be resolved");var h=o._loadingSchemas[v];return h||(h=o._loadingSchemas[v]=o._opts.loadSchema(v),h.then(m,m)),h.then(function(g){if(!y(v))return c(g).then(function(){y(v)||o.addSchema(g,v,void 0,i)})}).then(function(){return u(p)});function m(){delete o._loadingSchemas[v]}function y(g){return o._refs[g]||o._schemas[g]}}}}}),N8=De((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d,v="data"+(l||""),h="valid"+o,m="errs__"+o,y=t.opts.$data&&c&&c.$data,g;y?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",g="schema"+o):g=c;var b=this,R="definition"+o,w=b.definition,T="",k,D,A,$,N;if(y&&w.$data){N="keywordValidate"+o;var C=w.validateSchema;n+=" var "+R+" = RULES.custom['"+s+"'].definition; var "+N+" = "+R+".validate;"}else{if($=t.useCustomRule(b,c,t.schema,t),!$)return;g="validate.schema"+u,N=$.code,k=w.compile,D=w.inline,A=w.macro}var O=N+".errors",j="i"+o,M="ruleErr"+o,z=w.async;if(z&&!t.async)throw new Error("async keyword in sync schema");if(D||A||(n+=""+O+" = null;"),n+="var "+m+" = errors;var "+h+";",y&&w.$data&&(T+="}",n+=" if ("+g+" === undefined) { "+h+" = true; } else { ",C&&(T+="}",n+=" "+h+" = "+R+".validateSchema("+g+"); if ("+h+") { ")),D)w.statements?n+=" "+$.validate+" ":n+=" "+h+" = "+$.validate+"; ";else if(A){var V=t.util.copy(t),T="";V.level++;var X="valid"+V.level;V.schema=$.validate,V.schemaPath="";var Z=t.compositeRule;t.compositeRule=V.compositeRule=!0;var K=t.validate(V).replace(/validate\.schema/g,N);t.compositeRule=V.compositeRule=Z,n+=" "+K}else{var se=se||[];se.push(n),n="",n+=" "+N+".call( ",t.opts.passContext?n+="this":n+="self",k||w.schema===!1?n+=" , "+v+" ":n+=" , "+g+" , "+v+" , validate.schema"+t.schemaPath+" ",n+=" , (dataPath || '')",t.errorPath!='""'&&(n+=" + "+t.errorPath);var Y=l?"data"+(l-1||""):"parentData",we=l?t.dataPathArr[l]:"parentDataProperty";n+=" , "+Y+" , "+we+" , rootData ) ";var de=n;n=se.pop(),w.errors===!1?(n+=" "+h+" = ",z&&(n+="await "),n+=""+de+"; "):z?(O="customErrors"+o,n+=" var "+O+" = null; try { "+h+" = await "+de+"; } catch (e) { "+h+" = false; if (e instanceof ValidationError) "+O+" = e.errors; else throw e; } "):n+=" "+O+" = null; "+h+" = "+de+"; "}if(w.modifying&&(n+=" if ("+Y+") "+v+" = "+Y+"["+we+"];"),n+=""+T,w.valid)f&&(n+=" if (true) { ");else{n+=" if ( ",w.valid===void 0?(n+=" !",A?n+=""+X:n+=""+h):n+=" "+!w.valid+" ",n+=") { ",d=b.keyword;var se=se||[];se.push(n),n="";var se=se||[];se.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(d||"custom")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { keyword: '"+b.keyword+"' } ",t.opts.messages!==!1&&(n+=` , message: 'should pass "`+b.keyword+`" keyword validation' `),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+v+" "),n+=" } "):n+=" {} ";var Oe=n;n=se.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+Oe+"]); ":n+=" validate.errors = ["+Oe+"]; return false; ":n+=" var err = "+Oe+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var Ee=n;n=se.pop(),D?w.errors?w.errors!="full"&&(n+=" for (var "+j+"="+m+"; "+j+"{e.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}),j8=De((a,e)=>{var r=aw();e.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:r.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:r.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}}),$8=De((a,e)=>{var r=/^[a-z_$][a-z0-9_$-]*$/i,t=N8(),s=j8();e.exports={add:i,get:n,remove:o,validate:l};function i(c,u){var p=this.RULES;if(p.keywords[c])throw new Error("Keyword "+c+" is already defined");if(!r.test(c))throw new Error("Keyword "+c+" is not a valid identifier");if(u){this.validateKeyword(u,!0);var f=u.type;if(Array.isArray(f))for(var d=0;d{e.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),L8=De((a,e)=>{var r=c8(),t=Tf(),s=l8(),i=ew(),n=tw(),o=u8(),l=A8(),c=I8(),u=Zn();e.exports=m,m.prototype.validate=y,m.prototype.compile=g,m.prototype.addSchema=b,m.prototype.addMetaSchema=R,m.prototype.validateSchema=w,m.prototype.getSchema=k,m.prototype.removeSchema=$,m.prototype.addFormat=Z,m.prototype.errorsText=X,m.prototype._addSchema=C,m.prototype._compile=O,m.prototype.compileAsync=D8();var p=$8();m.prototype.addKeyword=p.add,m.prototype.getKeyword=p.get,m.prototype.removeKeyword=p.remove,m.prototype.validateKeyword=p.validate;var f=Rf();m.ValidationError=f.Validation,m.MissingRefError=f.MissingRef,m.$dataMetaSchema=c;var d="http://json-schema.org/draft-07/schema",v=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],h=["/properties"];function m(H){if(!(this instanceof m))return new m(H);H=this._opts=u.copy(H)||{},Ee(this),this._schemas={},this._refs={},this._fragments={},this._formats=o(H.format),this._cache=H.cache||new s,this._loadingSchemas={},this._compilations=[],this.RULES=l(),this._getId=j(H),H.loopRequired=H.loopRequired||1/0,H.errorDataPath=="property"&&(H._errorDataPathProperty=!0),H.serialize===void 0&&(H.serialize=n),this._metaOpts=Oe(this),H.formats&&Y(this),H.keywords&&we(this),K(this),typeof H.meta=="object"&&this.addMetaSchema(H.meta),H.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),se(this)}function y(H,W){var re;if(typeof H=="string"){if(re=this.getSchema(H),!re)throw new Error('no schema with key or ref "'+H+'"')}else{var ue=this._addSchema(H);re=ue.validate||this._compile(ue)}var G=re(W);return re.$async!==!0&&(this.errors=re.errors),G}function g(H,W){var re=this._addSchema(H,void 0,W);return re.validate||this._compile(re)}function b(H,W,re,ue){if(Array.isArray(H)){for(var G=0;G-1}var sM=aM;function nM(a,e){var r=this.__data__,t=Tl(r,a);return t<0?(++this.size,r.push([a,e])):r[t][1]=e,this}var iM=nM;function Xn(a){var e=-1,r=a==null?0:a.length;for(this.clear();++e{if(!a||a.trim()==="")return null;let e=a.split(",").map(i=>i.trim()).filter(Boolean);if(e.length===0)return null;let r=e.some(i=>i.startsWith("!")),t=e.some(i=>!i.startsWith("!"));if(r&&t)return null;let s=e.map(i=>i.replace(/^!/,"").toLowerCase());return{include:r?[]:s,exclude:r?s:[],isExclusive:r}});function RM(a){let e=[],r=a.match(/^MCP server ["']([^"']+)["']/);if(r&&r[1])e.push("mcp"),e.push(r[1].toLowerCase());else{let i=a.match(/^([^:[]+):/);i&&i[1]&&e.push(i[1].trim().toLowerCase())}let t=a.match(/^\[([^\]]+)]/);t&&t[1]&&e.push(t[1].trim().toLowerCase()),a.toLowerCase().includes("statsig event:")&&e.push("statsig");let s=a.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(s&&s[1]){let i=s[1].trim().toLowerCase();i.length<30&&!i.includes(" ")&&e.push(i)}return Array.from(new Set(e))}function PM(a,e){return e?a.length===0?!1:e.isExclusive?!a.some(r=>e.exclude.includes(r)):a.some(r=>e.include.includes(r)):!0}function OM(a,e){if(!e)return!0;let r=RM(a);return PM(r,e)}function vw(){return process.env.CLAUDE_CONFIG_DIR??(0,mw.join)((0,hw.homedir)(),".claude")}function GE(a){if(!a)return!1;if(typeof a=="boolean")return a;let e=a.toLowerCase().trim();return["1","true","yes","on"].includes(e)}var CM={name:"BASH_MAX_OUTPUT_LENGTH",default:3e4,validate:a=>{if(!a)return{effective:3e4,status:"valid"};let t=parseInt(a,10);return isNaN(t)||t<=0?{effective:3e4,status:"invalid",message:`Invalid value "${a}" (using default: 30000)`}:t>15e4?{effective:15e4,status:"capped",message:`Capped from ${t} to 150000`}:{effective:t,status:"valid"}}},kM={name:"CLAUDE_CODE_MAX_OUTPUT_TOKENS",default:32e3,validate:a=>{if(!a)return{effective:32e3,status:"valid"};let t=parseInt(a,10);return isNaN(t)||t<=0?{effective:32e3,status:"invalid",message:`Invalid value "${a}" (using default: 32000)`}:t>64e3?{effective:64e3,status:"capped",message:`Capped from ${t} to 64000`}:{effective:t,status:"valid"}}};function AM(){let a="";return typeof process<"u"&&typeof process.cwd=="function"&&(a=(0,yw.realpathSync)((0,gw.cwd)())),{originalCwd:a,totalCostUSD:0,totalAPIDuration:0,totalAPIDurationWithoutRetries:0,totalToolDuration:0,startTime:Date.now(),lastInteractionTime:Date.now(),totalLinesAdded:0,totalLinesRemoved:0,hasUnknownModelCost:!1,cwd:a,modelUsage:{},mainLoopModelOverride:void 0,initialMainLoopModel:null,modelStrings:null,isInteractive:!1,clientType:"cli",sessionIngressToken:void 0,oauthTokenFromFd:void 0,apiKeyFromFd:void 0,flagSettingsPath:void 0,allowedSettingSources:["userSettings","projectSettings","localSettings","flagSettings","policySettings"],meter:null,sessionCounter:null,locCounter:null,prCounter:null,commitCounter:null,costCounter:null,tokenCounter:null,codeEditToolDecisionCounter:null,activeTimeCounter:null,sessionId:(0,bw.randomUUID)(),loggerProvider:null,eventLogger:null,meterProvider:null,tracerProvider:null,agentColorMap:new Map,agentColorIndex:0,envVarValidators:[CM,kM],lastAPIRequest:null,inMemoryErrorLog:[],inlinePlugins:[],sessionBypassPermissionsMode:!1,sessionPersistenceDisabled:!1,hasExitedPlanMode:!1,needsPlanModeExitAttachment:!1,initJsonSchema:null,registeredHooks:null,planSlugCache:new Map}}var IM=AM();function DM(){return IM.sessionId}function NM({writeFn:a,flushIntervalMs:e=1e3,maxBufferSize:r=100,immediateMode:t=!1}){let s=[],i=null;function n(){i&&(clearTimeout(i),i=null)}function o(){s.length!==0&&(a(s.join("")),s=[],n())}function l(){i||(i=setTimeout(o,e))}return{write(c){if(t){a(c);return}s.push(c),l(),s.length>=r&&o()},flush:o,dispose(){o()}}}var ZE=new Set;function jM(a){return ZE.add(a),()=>ZE.delete(a)}var $M=ro(()=>GE(process.env.DEBUG)||GE(process.env.DEBUG_SDK)||process.argv.includes("--debug")||process.argv.includes("-d")||xw()||process.argv.some(a=>a.startsWith("--debug="))),MM=ro(()=>{let a=process.argv.find(r=>r.startsWith("--debug="));if(!a)return null;let e=a.substring(8);return TM(e)}),xw=ro(()=>process.argv.includes("--debug-to-stderr")||process.argv.includes("-d2e"));function LM(a){if(typeof process>"u"||typeof process.versions>"u"||typeof process.versions.node>"u")return!1;let e=MM();return OM(a,e)}var FM=!1,vl=null;function qM(){return vl||(vl=NM({writeFn:a=>{let e=_w();pa().existsSync((0,Ps.dirname)(e))||pa().mkdirSync((0,Ps.dirname)(e)),pa().appendFileSync(e,a),UM()},flushIntervalMs:1e3,maxBufferSize:100,immediateMode:$M()}),jM(async()=>vl?.dispose())),vl}function Ir(a,{level:e}={level:"debug"}){if(!LM(a))return;FM&&a.includes(` +===========================`}oa();Ar();var ff=require("path"),sw=require("url"),nw=require("events"),ow=require("child_process"),cw=require("readline"),xe=bt(require("fs"),1),lw=require("fs/promises"),mw=require("path"),hw=require("os"),Ps=require("path"),gw=require("process"),yw=require("fs"),bw=require("crypto"),Ew=require("crypto"),Yn=require("fs"),mf=require("path"),ww=require("crypto");var u5={},J$=Object.create,e8=Object.getPrototypeOf,df=Object.defineProperty,t8=Object.getOwnPropertyNames,r8=Object.prototype.hasOwnProperty,a8=(a,e,r)=>{r=a!=null?J$(e8(a)):{};let t=e||!a||!a.__esModule?df(r,"default",{value:a,enumerable:!0}):r;for(let s of t8(a))r8.call(t,s)||df(t,s,{get:()=>a[s],enumerable:!0});return t},Ie=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),s8=(a,e)=>{for(var r in e)df(a,r,{get:e[r],enumerable:!0,configurable:!0,set:t=>e[r]=()=>t})};var n8=Ie((a,e)=>{(function(r,t){typeof a=="object"&&typeof e<"u"?t(a):typeof define=="function"&&define.amd?define(["exports"],t):t(r.URI=r.URI||{})})(a,function(r){function t(){for(var _=arguments.length,x=Array(_),P=0;P<_;P++)x[P]=arguments[P];if(x.length>1){x[0]=x[0].slice(0,-1);for(var F=x.length-1,B=1;B= 0x80 (not a basic code point)","invalid-input":"Invalid input"},N=h-m,C=Math.floor,O=String.fromCharCode;function j(_){throw new RangeError($[_])}function M(_,x){for(var P=[],F=_.length;F--;)P[F]=x(_[F]);return P}function z(_,x){var P=_.split("@"),F="";P.length>1&&(F=P[0]+"@",_=P[1]),_=_.replace(A,".");var B=_.split("."),Y=M(B,x).join(".");return F+Y}function V(_){for(var x=[],P=0,F=_.length;P=55296&&B<=56319&&P>1,x+=C(x/P);x>N*y>>1;B+=h)x=C(x/N);return C(B+(N+1)*x/(x+g))},J=function(x){var P=[],F=x.length,B=0,Y=w,le=R,_e=x.lastIndexOf(T);_e<0&&(_e=0);for(var me=0;me<_e;++me)x.charCodeAt(me)>=128&&j("not-basic"),P.push(x.charCodeAt(me));for(var je=_e>0?_e+1:0;je=F&&j("invalid-input");var Ae=Z(x.charCodeAt(je++));(Ae>=h||Ae>C((v-B)/ke))&&j("overflow"),B+=Ae*ke;var he=Se<=le?m:Se>=le+y?y:Se-le;if(AeC(v/Ye)&&j("overflow"),ke*=Ye}var Me=P.length+1;le=ae(B-be,Me,be==0),C(B/Me)>v-Y&&j("overflow"),Y+=C(B/Me),B%=Me,P.splice(B++,0,Y)}return String.fromCodePoint.apply(String,P)},we=function(x){var P=[];x=V(x);var F=x.length,B=w,Y=0,le=R,_e=!0,me=!1,je=void 0;try{for(var be=x[Symbol.iterator](),ke;!(_e=(ke=be.next()).done);_e=!0){var Se=ke.value;Se<128&&P.push(O(Se))}}catch(Jr){me=!0,je=Jr}finally{try{!_e&&be.return&&be.return()}finally{if(me)throw je}}var Ae=P.length,he=Ae;for(Ae&&P.push(T);he=B&&otC((v-Y)/ht)&&j("overflow"),Y+=(Ye-B)*ht,B=Ye;var vt=!0,Zt=!1,$t=void 0;try{for(var Nr=x[Symbol.iterator](),Er;!(vt=(Er=Nr.next()).done);vt=!0){var wr=Er.value;if(wrv&&j("overflow"),wr==B){for(var Ot=Y,Kt=h;;Kt+=h){var Xt=Kt<=le?m:Kt>=le+y?y:Kt-le;if(Ot>6|192).toString(16).toUpperCase()+"%"+(x&63|128).toString(16).toUpperCase():P="%"+(x>>12|224).toString(16).toUpperCase()+"%"+(x>>6&63|128).toString(16).toUpperCase()+"%"+(x&63|128).toString(16).toUpperCase(),P}function W(_){for(var x="",P=0,F=_.length;P=194&&B<224){if(F-P>=6){var Y=parseInt(_.substr(P+4,2),16);x+=String.fromCharCode((B&31)<<6|Y&63)}else x+=_.substr(P,6);P+=6}else if(B>=224){if(F-P>=9){var le=parseInt(_.substr(P+4,2),16),_e=parseInt(_.substr(P+7,2),16);x+=String.fromCharCode((B&15)<<12|(le&63)<<6|_e&63)}else x+=_.substr(P,9);P+=9}else x+=_.substr(P,3),P+=3}return x}function re(_,x){function P(F){var B=W(F);return B.match(x.UNRESERVED)?B:F}return _.scheme&&(_.scheme=String(_.scheme).replace(x.PCT_ENCODED,P).toLowerCase().replace(x.NOT_SCHEME,"")),_.userinfo!==void 0&&(_.userinfo=String(_.userinfo).replace(x.PCT_ENCODED,P).replace(x.NOT_USERINFO,H).replace(x.PCT_ENCODED,n)),_.host!==void 0&&(_.host=String(_.host).replace(x.PCT_ENCODED,P).toLowerCase().replace(x.NOT_HOST,H).replace(x.PCT_ENCODED,n)),_.path!==void 0&&(_.path=String(_.path).replace(x.PCT_ENCODED,P).replace(_.scheme?x.NOT_PATH:x.NOT_PATH_NOSCHEME,H).replace(x.PCT_ENCODED,n)),_.query!==void 0&&(_.query=String(_.query).replace(x.PCT_ENCODED,P).replace(x.NOT_QUERY,H).replace(x.PCT_ENCODED,n)),_.fragment!==void 0&&(_.fragment=String(_.fragment).replace(x.PCT_ENCODED,P).replace(x.NOT_FRAGMENT,H).replace(x.PCT_ENCODED,n)),_}function ue(_){return _.replace(/^0*(.*)/,"$1")||"0"}function G(_,x){var P=_.match(x.IPV4ADDRESS)||[],F=f(P,2),B=F[1];return B?B.split(".").map(ue).join("."):_}function Q(_,x){var P=_.match(x.IPV6ADDRESS)||[],F=f(P,3),B=F[1],Y=F[2];if(B){for(var le=B.toLowerCase().split("::").reverse(),_e=f(le,2),me=_e[0],je=_e[1],be=je?je.split(":").map(ue):[],ke=me.split(":").map(ue),Se=x.IPV4ADDRESS.test(ke[ke.length-1]),Ae=Se?7:8,he=ke.length-Ae,Ye=Array(Ae),Me=0;Me1){var Ue=Ye.slice(0,qe.index),ot=Ye.slice(qe.index+qe.length);nt=Ue.join(":")+"::"+ot.join(":")}else nt=Ye.join(":");return Y&&(nt+="%"+Y),nt}else return _}var ne=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,ge="".match(/(){0}/)[1]===void 0;function oe(_){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},P={},F=x.iri!==!1?p:u;x.reference==="suffix"&&(_=(x.scheme?x.scheme+":":"")+"//"+_);var B=_.match(ne);if(B){ge?(P.scheme=B[1],P.userinfo=B[3],P.host=B[4],P.port=parseInt(B[5],10),P.path=B[6]||"",P.query=B[7],P.fragment=B[8],isNaN(P.port)&&(P.port=B[5])):(P.scheme=B[1]||void 0,P.userinfo=_.indexOf("@")!==-1?B[3]:void 0,P.host=_.indexOf("//")!==-1?B[4]:void 0,P.port=parseInt(B[5],10),P.path=B[6]||"",P.query=_.indexOf("?")!==-1?B[7]:void 0,P.fragment=_.indexOf("#")!==-1?B[8]:void 0,isNaN(P.port)&&(P.port=_.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?B[4]:void 0)),P.host&&(P.host=Q(G(P.host,F),F)),P.scheme===void 0&&P.userinfo===void 0&&P.host===void 0&&P.port===void 0&&!P.path&&P.query===void 0?P.reference="same-document":P.scheme===void 0?P.reference="relative":P.fragment===void 0?P.reference="absolute":P.reference="uri",x.reference&&x.reference!=="suffix"&&x.reference!==P.reference&&(P.error=P.error||"URI is not a "+x.reference+" reference.");var Y=Ne[(x.scheme||P.scheme||"").toLowerCase()];if(!x.unicodeSupport&&(!Y||!Y.unicodeSupport)){if(P.host&&(x.domainHost||Y&&Y.domainHost))try{P.host=Ee.toASCII(P.host.replace(F.PCT_ENCODED,W).toLowerCase())}catch(le){P.error=P.error||"Host's domain name can not be converted to ASCII via punycode: "+le}re(P,u)}else re(P,F);Y&&Y.parse&&Y.parse(P,x)}else P.error=P.error||"URI can not be parsed.";return P}function Be(_,x){var P=x.iri!==!1?p:u,F=[];return _.userinfo!==void 0&&(F.push(_.userinfo),F.push("@")),_.host!==void 0&&F.push(Q(G(String(_.host),P),P).replace(P.IPV6ADDRESS,function(B,Y,le){return"["+Y+(le?"%25"+le:"")+"]"})),(typeof _.port=="number"||typeof _.port=="string")&&(F.push(":"),F.push(String(_.port))),F.length?F.join(""):void 0}var Ge=/^\.\.?\//,Re=/^\/\.(\/|$)/,et=/^\/\.\.(\/|$)/,ze=/^\/?(?:.|\n)*?(?=\/|$)/;function Qe(_){for(var x=[];_.length;)if(_.match(Ge))_=_.replace(Ge,"");else if(_.match(Re))_=_.replace(Re,"/");else if(_.match(et))_=_.replace(et,"/"),x.pop();else if(_==="."||_==="..")_="";else{var P=_.match(ze);if(P){var F=P[0];_=_.slice(F.length),x.push(F)}else throw new Error("Unexpected dot segment condition")}return x.join("")}function Ze(_){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},P=x.iri?p:u,F=[],B=Ne[(x.scheme||_.scheme||"").toLowerCase()];if(B&&B.serialize&&B.serialize(_,x),_.host&&!P.IPV6ADDRESS.test(_.host)){if(x.domainHost||B&&B.domainHost)try{_.host=x.iri?Ee.toUnicode(_.host):Ee.toASCII(_.host.replace(P.PCT_ENCODED,W).toLowerCase())}catch(_e){_.error=_.error||"Host's domain name can not be converted to "+(x.iri?"Unicode":"ASCII")+" via punycode: "+_e}}re(_,P),x.reference!=="suffix"&&_.scheme&&(F.push(_.scheme),F.push(":"));var Y=Be(_,x);if(Y!==void 0&&(x.reference!=="suffix"&&F.push("//"),F.push(Y),_.path&&_.path.charAt(0)!=="/"&&F.push("/")),_.path!==void 0){var le=_.path;!x.absolutePath&&(!B||!B.absolutePath)&&(le=Qe(le)),Y===void 0&&(le=le.replace(/^\/\//,"/%2F")),F.push(le)}return _.query!==void 0&&(F.push("?"),F.push(_.query)),_.fragment!==void 0&&(F.push("#"),F.push(_.fragment)),F.join("")}function Xe(_,x){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},F=arguments[3],B={};return F||(_=oe(Ze(_,P),P),x=oe(Ze(x,P),P)),P=P||{},!P.tolerant&&x.scheme?(B.scheme=x.scheme,B.userinfo=x.userinfo,B.host=x.host,B.port=x.port,B.path=Qe(x.path||""),B.query=x.query):(x.userinfo!==void 0||x.host!==void 0||x.port!==void 0?(B.userinfo=x.userinfo,B.host=x.host,B.port=x.port,B.path=Qe(x.path||""),B.query=x.query):(x.path?(x.path.charAt(0)==="/"?B.path=Qe(x.path):((_.userinfo!==void 0||_.host!==void 0||_.port!==void 0)&&!_.path?B.path="/"+x.path:_.path?B.path=_.path.slice(0,_.path.lastIndexOf("/")+1)+x.path:B.path=x.path,B.path=Qe(B.path)),B.query=x.query):(B.path=_.path,x.query!==void 0?B.query=x.query:B.query=_.query),B.userinfo=_.userinfo,B.host=_.host,B.port=_.port),B.scheme=_.scheme),B.fragment=x.fragment,B}function Et(_,x,P){var F=l({scheme:"null"},P);return Ze(Xe(oe(_,F),oe(x,F),F,!0),F)}function wt(_,x){return typeof _=="string"?_=Ze(oe(_,x),x):i(_)==="object"&&(_=oe(Ze(_,x),x)),_}function Pt(_,x,P){return typeof _=="string"?_=Ze(oe(_,P),P):i(_)==="object"&&(_=Ze(_,P)),typeof x=="string"?x=Ze(oe(x,P),P):i(x)==="object"&&(x=Ze(x,P)),_===x}function Qr(_,x){return _&&_.toString().replace(!x||!x.iri?u.ESCAPE:p.ESCAPE,H)}function jt(_,x){return _&&_.toString().replace(!x||!x.iri?u.PCT_ENCODED:p.PCT_ENCODED,W)}var ma={scheme:"http",domainHost:!0,parse:function(x,P){return x.host||(x.error=x.error||"HTTP URIs must have a host."),x},serialize:function(x,P){var F=String(x.scheme).toLowerCase()==="https";return(x.port===(F?443:80)||x.port==="")&&(x.port=void 0),x.path||(x.path="/"),x}},ha={scheme:"https",domainHost:ma.domainHost,parse:ma.parse,serialize:ma.serialize};function ti(_){return typeof _.secure=="boolean"?_.secure:String(_.scheme).toLowerCase()==="wss"}var qa={scheme:"ws",domainHost:!0,parse:function(x,P){var F=x;return F.secure=ti(F),F.resourceName=(F.path||"/")+(F.query?"?"+F.query:""),F.path=void 0,F.query=void 0,F},serialize:function(x,P){if((x.port===(ti(x)?443:80)||x.port==="")&&(x.port=void 0),typeof x.secure=="boolean"&&(x.scheme=x.secure?"wss":"ws",x.secure=void 0),x.resourceName){var F=x.resourceName.split("?"),B=f(F,2),Y=B[0],le=B[1];x.path=Y&&Y!=="/"?Y:void 0,x.query=le,x.resourceName=void 0}return x.fragment=void 0,x}},uo={scheme:"wss",domainHost:qa.domainHost,parse:qa.parse,serialize:qa.serialize},po={},rr=!0,fo="[A-Za-z0-9\\-\\.\\_\\~"+(rr?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",ar="[0-9A-Fa-f]",Ql=s(s("%[EFef]"+ar+"%"+ar+ar+"%"+ar+ar)+"|"+s("%[89A-Fa-f]"+ar+"%"+ar+ar)+"|"+s("%"+ar+ar)),Yl="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Jl="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",eu=t(Jl,'[\\"\\\\]'),va="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",tu=new RegExp(fo,"g"),Yr=new RegExp(Ql,"g"),ru=new RegExp(t("[^]",Yl,"[\\.]",'[\\"]',eu),"g"),Gs=new RegExp(t("[^]",fo,va),"g"),mo=Gs;function ri(_){var x=W(_);return x.match(tu)?x:_}var ai={scheme:"mailto",parse:function(x,P){var F=x,B=F.to=F.path?F.path.split(","):[];if(F.path=void 0,F.query){for(var Y=!1,le={},_e=F.query.split("&"),me=0,je=_e.length;me{e.exports=function r(t,s){if(t===s)return!0;if(t&&s&&typeof t=="object"&&typeof s=="object"){if(t.constructor!==s.constructor)return!1;var i,n,o;if(Array.isArray(t)){if(i=t.length,i!=s.length)return!1;for(n=i;n--!==0;)if(!r(t[n],s[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===s.source&&t.flags===s.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===s.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===s.toString();if(o=Object.keys(t),i=o.length,i!==Object.keys(s).length)return!1;for(n=i;n--!==0;)if(!Object.prototype.hasOwnProperty.call(s,o[n]))return!1;for(n=i;n--!==0;){var l=o[n];if(!r(t[l],s[l]))return!1}return!0}return t!==t&&s!==s}}),i8=Ie((a,e)=>{e.exports=function(t){for(var s=0,i=t.length,n=0,o;n=55296&&o<=56319&&n{e.exports={copy:r,checkDataType:t,checkDataTypes:s,coerceToTypes:n,toHash:o,getProperty:u,escapeQuotes:p,equal:wf(),ucs2length:i8(),varOccurences:f,varReplace:d,schemaHasRules:v,schemaHasRulesExcept:h,schemaUnknownRules:m,toQuotedString:y,getPathExpr:g,getPath:b,getData:T,unescapeFragment:D,unescapeJsonPointer:N,escapeFragment:A,escapeJsonPointer:$};function r(C,O){O=O||{};for(var j in C)O[j]=C[j];return O}function t(C,O,j,M){var z=M?" !== ":" === ",V=M?" || ":" && ",X=M?"!":"",Z=M?"":"!";switch(C){case"null":return O+z+"null";case"array":return X+"Array.isArray("+O+")";case"object":return"("+X+O+V+"typeof "+O+z+'"object"'+V+Z+"Array.isArray("+O+"))";case"integer":return"(typeof "+O+z+'"number"'+V+Z+"("+O+" % 1)"+V+O+z+O+(j?V+X+"isFinite("+O+")":"")+")";case"number":return"(typeof "+O+z+'"'+C+'"'+(j?V+X+"isFinite("+O+")":"")+")";default:return"typeof "+O+z+'"'+C+'"'}}function s(C,O,j){switch(C.length){case 1:return t(C[0],O,j,!0);default:var M="",z=o(C);z.array&&z.object&&(M=z.null?"(":"(!"+O+" || ",M+="typeof "+O+' !== "object")',delete z.null,delete z.array,delete z.object),z.number&&delete z.integer;for(var V in z)M+=(M?" && ":"")+t(V,O,j,!0);return M}}var i=o(["string","number","integer","boolean","null"]);function n(C,O){if(Array.isArray(O)){for(var j=[],M=0;M=O)throw new Error("Cannot access property/index "+M+" levels up, current level is "+O);return j[O-M]}if(M>O)throw new Error("Cannot access data "+M+" levels up, current level is "+O);if(V="data"+(O-M||""),!z)return V}for(var Z=V,K=z.split("/"),ae=0;ae{var r=Zn();e.exports=t;function t(s){r.copy(s,this)}}),o8=Ie((a,e)=>{var r=e.exports=function(i,n,o){typeof n=="function"&&(o=n,n={}),o=n.cb||o;var l=typeof o=="function"?o:o.pre||function(){},c=o.post||function(){};t(n,l,c,i,"",i)};r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0},r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},r.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},r.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function t(i,n,o,l,c,u,p,f,d,v){if(l&&typeof l=="object"&&!Array.isArray(l)){n(l,c,u,p,f,d,v);for(var h in l){var m=l[h];if(Array.isArray(m)){if(h in r.arrayKeywords)for(var y=0;y{var r=n8(),t=wf(),s=Zn(),i=ew(),n=o8();e.exports=o,o.normalizeId=b,o.fullPath=m,o.url=R,o.ids=w,o.inlineRef=d,o.schema=l;function o(T,k,D){var A=this._refs[D];if(typeof A=="string")if(this._refs[A])A=this._refs[A];else return o.call(this,T,k,A);if(A=A||this._schemas[D],A instanceof i)return d(A.schema,this._opts.inlineRefs)?A.schema:A.validate||this._compile(A);var $=l.call(this,k,D),N,C,O;return $&&(N=$.schema,k=$.root,O=$.baseId),N instanceof i?C=N.validate||T.call(this,N.schema,k,void 0,O):N!==void 0&&(C=d(N,this._opts.inlineRefs)?N:T.call(this,N,k,void 0,O)),C}function l(T,k){var D=r.parse(k),A=y(D),$=m(this._getId(T.schema));if(Object.keys(T.schema).length===0||A!==$){var N=b(A),C=this._refs[N];if(typeof C=="string")return c.call(this,T,C,D);if(C instanceof i)C.validate||this._compile(C),T=C;else if(C=this._schemas[N],C instanceof i){if(C.validate||this._compile(C),N==b(k))return{schema:C,root:T,baseId:$};T=C}else return;if(!T.schema)return;$=m(this._getId(T.schema))}return p.call(this,D,$,T.schema,T)}function c(T,k,D){var A=l.call(this,T,k);if(A){var $=A.schema,N=A.baseId;T=A.root;var C=this._getId($);return C&&(N=R(N,C)),p.call(this,D,N,$,T)}}var u=s.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function p(T,k,D,A){if(T.fragment=T.fragment||"",T.fragment.slice(0,1)=="/"){for(var $=T.fragment.split("/"),N=1;N<$.length;N++){var C=$[N];if(C){if(C=s.unescapeFragment(C),D=D[C],D===void 0)break;var O;if(!u[C]&&(O=this._getId(D),O&&(k=R(k,O)),D.$ref)){var j=R(k,D.$ref),M=l.call(this,A,j);M&&(D=M.schema,A=M.root,k=M.baseId)}}}if(D!==void 0&&D!==A.schema)return{schema:D,root:A,baseId:k}}}var f=s.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function d(T,k){if(k===!1)return!1;if(k===void 0||k===!0)return v(T);if(k)return h(T)<=k}function v(T){var k;if(Array.isArray(T)){for(var D=0;D{var r=Tf();e.exports={Validation:i(t),MissingRef:i(s)};function t(n){this.message="validation failed",this.errors=n,this.ajv=this.validation=!0}s.message=function(n,o){return"can't resolve reference "+o+" from id "+n};function s(n,o,l){this.message=l||s.message(n,o),this.missingRef=r.url(n,o),this.missingSchema=r.normalizeId(r.fullPath(this.missingRef))}function i(n){return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}}),tw=Ie((a,e)=>{e.exports=function(r,t){t||(t={}),typeof t=="function"&&(t={cmp:t});var s=typeof t.cycles=="boolean"?t.cycles:!1,i=t.cmp&&(function(o){return function(l){return function(c,u){var p={key:c,value:l[c]},f={key:u,value:l[u]};return o(p,f)}}})(t.cmp),n=[];return(function o(l){if(l&&l.toJSON&&typeof l.toJSON=="function"&&(l=l.toJSON()),l!==void 0){if(typeof l=="number")return isFinite(l)?""+l:"null";if(typeof l!="object")return JSON.stringify(l);var c,u;if(Array.isArray(l)){for(u="[",c=0;c{e.exports=function(t,s,i){var n="",o=t.schema.$async===!0,l=t.util.schemaHasRulesExcept(t.schema,t.RULES.all,"$ref"),c=t.self._getId(t.schema);if(t.opts.strictKeywords){var u=t.util.schemaUnknownRules(t.schema,t.RULES.keywords);if(u){var p="unknown keyword: "+u;if(t.opts.strictKeywords==="log")t.logger.warn(p);else throw new Error(p)}}if(t.isTop&&(n+=" var validate = ",o&&(t.async=!0,n+="async "),n+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",c&&(t.opts.sourceCode||t.opts.processCode)&&(n+=" "+("/*# sourceURL="+c+" */")+" ")),typeof t.schema=="boolean"||!(l||t.schema.$ref)){var s="false schema",f=t.level,d=t.dataLevel,v=t.schema[s],h=t.schemaPath+t.util.getProperty(s),m=t.errSchemaPath+"/"+s,k=!t.opts.allErrors,$,y="data"+(d||""),T="valid"+f;if(t.schema===!1){t.isTop?k=!0:n+=" var "+T+" = false; ";var g=g||[];g.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+($||"false schema")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(m)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: 'boolean schema is false' "),t.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+t.schemaPath+" , data: "+y+" "),n+=" } "):n+=" {} ";var b=n;n=g.pop(),!t.compositeRule&&k?t.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else t.isTop?o?n+=" return data; ":n+=" validate.errors = null; return true; ":n+=" var "+T+" = true; ";return t.isTop&&(n+=" }; return validate; "),n}if(t.isTop){var R=t.isTop,f=t.level=0,d=t.dataLevel=0,y="data";if(t.rootId=t.resolve.fullPath(t.self._getId(t.root.schema)),t.baseId=t.baseId||t.rootId,delete t.isTop,t.dataPathArr=[""],t.schema.default!==void 0&&t.opts.useDefaults&&t.opts.strictDefaults){var w="default is ignored in the schema root";if(t.opts.strictDefaults==="log")t.logger.warn(w);else throw new Error(w)}n+=" var vErrors = null; ",n+=" var errors = 0; ",n+=" if (rootData === undefined) rootData = data; "}else{var{level:f,dataLevel:d}=t,y="data"+(d||"");if(c&&(t.baseId=t.resolve.url(t.baseId,c)),o&&!t.async)throw new Error("async schema in sync schema");n+=" var errs_"+f+" = errors;"}var T="valid"+f,k=!t.opts.allErrors,D="",A="",$,N=t.schema.type,C=Array.isArray(N);if(N&&t.opts.nullable&&t.schema.nullable===!0&&(C?N.indexOf("null")==-1&&(N=N.concat("null")):N!="null"&&(N=[N,"null"],C=!0)),C&&N.length==1&&(N=N[0],C=!1),t.schema.$ref&&l){if(t.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+t.errSchemaPath+'" (see option extendRefs)');t.opts.extendRefs!==!0&&(l=!1,t.logger.warn('$ref: keywords ignored in schema at path "'+t.errSchemaPath+'"'))}if(t.schema.$comment&&t.opts.$comment&&(n+=" "+t.RULES.all.$comment.code(t,"$comment")),N){if(t.opts.coerceTypes)var O=t.util.coerceToTypes(t.opts.coerceTypes,N);var j=t.RULES.types[N];if(O||C||j===!0||j&&!ze(j)){var h=t.schemaPath+".type",m=t.errSchemaPath+"/type",h=t.schemaPath+".type",m=t.errSchemaPath+"/type",M=C?"checkDataTypes":"checkDataType";if(n+=" if ("+t.util[M](N,y,t.opts.strictNumbers,!0)+") { ",O){var z="dataType"+f,V="coerced"+f;n+=" var "+z+" = typeof "+y+"; var "+V+" = undefined; ",t.opts.coerceTypes=="array"&&(n+=" if ("+z+" == 'object' && Array.isArray("+y+") && "+y+".length == 1) { "+y+" = "+y+"[0]; "+z+" = typeof "+y+"; if ("+t.util.checkDataType(t.schema.type,y,t.opts.strictNumbers)+") "+V+" = "+y+"; } "),n+=" if ("+V+" !== undefined) ; ";var X=O;if(X)for(var Z,K=-1,ae=X.length-1;K{var r=Tf(),t=Zn(),s=Rf(),i=tw(),n=rw(),o=t.ucs2length,l=wf(),c=s.Validation;e.exports=u;function u(b,R,w,T){var k=this,D=this._opts,A=[void 0],$={},N=[],C={},O=[],j={},M=[];R=R||{schema:b,refVal:A,refs:$};var z=p.call(this,b,R,T),V=this._compilations[z.index];if(z.compiling)return V.callValidate=J;var X=this._formats,Z=this.RULES;try{var K=we(b,R,w,T);V.validate=K;var ae=V.callValidate;return ae&&(ae.schema=K.schema,ae.errors=null,ae.refs=K.refs,ae.refVal=K.refVal,ae.root=K.root,ae.$async=K.$async,D.sourceCode&&(ae.source=K.source)),K}finally{f.call(this,b,R,T)}function J(){var G=V.validate,Q=G.apply(this,arguments);return J.errors=G.errors,Q}function we(G,Q,ne,ge){var oe=!Q||Q&&Q.schema==G;if(Q.schema!=R.schema)return u.call(k,G,Q,ne,ge);var Be=G.$async===!0,Ge=n({isTop:!0,schema:G,isRoot:oe,baseId:ge,root:Q,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:s.MissingRef,RULES:Z,validate:n,util:t,resolve:r,resolveRef:fe,usePattern:W,useDefault:re,useCustomRule:ue,opts:D,formats:X,logger:k.logger,self:k});Ge=g(A,m)+g(N,v)+g(O,h)+g(M,y)+Ge,D.processCode&&(Ge=D.processCode(Ge,G));var Re;try{var et=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",Ge);Re=et(k,Z,X,R,A,O,M,l,o,c),A[0]=Re}catch(ze){throw k.logger.error("Error compiling schema, function code:",Ge),ze}return Re.schema=G,Re.errors=null,Re.refs=$,Re.refVal=A,Re.root=oe?Re:Q,Be&&(Re.$async=!0),D.sourceCode===!0&&(Re.source={code:Ge,patterns:N,defaults:O}),Re}function fe(G,Q,ne){Q=r.url(G,Q);var ge=$[Q],oe,Be;if(ge!==void 0)return oe=A[ge],Be="refVal["+ge+"]",H(oe,Be);if(!ne&&R.refs){var Ge=R.refs[Q];if(Ge!==void 0)return oe=R.refVal[Ge],Be=De(Q,oe),H(oe,Be)}Be=De(Q);var Re=r.call(k,we,R,Q);if(Re===void 0){var et=w&&w[Q];et&&(Re=r.inlineRef(et,D.inlineRefs)?et:u.call(k,et,R,w,G))}if(Re===void 0)Ee(Q);else return Ne(Q,Re),H(Re,Be)}function De(G,Q){var ne=A.length;return A[ne]=Q,$[G]=ne,"refVal"+ne}function Ee(G){delete $[G]}function Ne(G,Q){var ne=$[G];A[ne]=Q}function H(G,Q){return typeof G=="object"||typeof G=="boolean"?{code:Q,schema:G,inline:!0}:{code:Q,$async:G&&!!G.$async}}function W(G){var Q=C[G];return Q===void 0&&(Q=C[G]=N.length,N[Q]=G),"pattern"+Q}function re(G){switch(typeof G){case"boolean":case"number":return""+G;case"string":return t.toQuotedString(G);case"object":if(G===null)return"null";var Q=i(G),ne=j[Q];return ne===void 0&&(ne=j[Q]=O.length,O[ne]=G),"default"+ne}}function ue(G,Q,ne,ge){if(k._opts.validateSchema!==!1){var oe=G.definition.dependencies;if(oe&&!oe.every(function(Et){return Object.prototype.hasOwnProperty.call(ne,Et)}))throw new Error("parent schema must have all required keywords: "+oe.join(","));var Be=G.definition.validateSchema;if(Be){var Ge=Be(Q);if(!Ge){var Re="keyword schema is invalid: "+k.errorsText(Be.errors);if(k._opts.validateSchema=="log")k.logger.error(Re);else throw new Error(Re)}}}var et=G.definition.compile,ze=G.definition.inline,Qe=G.definition.macro,Ze;if(et)Ze=et.call(k,Q,ne,ge);else if(Qe)Ze=Qe.call(k,Q,ne,ge),D.validateSchema!==!1&&k.validateSchema(Ze,!0);else if(ze)Ze=ze.call(k,ge,G.keyword,Q,ne);else if(Ze=G.definition.validate,!Ze)return;if(Ze===void 0)throw new Error('custom keyword "'+G.keyword+'"failed to compile');var Xe=M.length;return M[Xe]=Ze,{code:"customRule"+Xe,validate:Ze}}}function p(b,R,w){var T=d.call(this,b,R,w);return T>=0?{index:T,compiling:!0}:(T=this._compilations.length,this._compilations[T]={schema:b,root:R,baseId:w},{index:T,compiling:!1})}function f(b,R,w){var T=d.call(this,b,R,w);T>=0&&this._compilations.splice(T,1)}function d(b,R,w){for(var T=0;T{var r=e.exports=function(){this._cache={}};r.prototype.put=function(s,i){this._cache[s]=i},r.prototype.get=function(s){return this._cache[s]},r.prototype.del=function(s){delete this._cache[s]},r.prototype.clear=function(){this._cache={}}}),u8=Ie((a,e)=>{var r=Zn(),t=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,s=[0,31,28,31,30,31,30,31,31,30,31,30,31],i=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,n=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,o=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,l=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,c=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,u=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,p=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,f=/^(?:\/(?:[^~/]|~0|~1)*)*$/,d=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,v=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;e.exports=h;function h(A){return A=A=="full"?"full":"fast",r.copy(h[A])}h.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":c,url:u,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:n,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:D,uuid:p,"json-pointer":f,"json-pointer-uri-fragment":d,"relative-json-pointer":v},h.full={date:y,time:g,"date-time":R,uri:T,"uri-reference":l,"uri-template":c,url:u,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:n,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:D,uuid:p,"json-pointer":f,"json-pointer-uri-fragment":d,"relative-json-pointer":v};function m(A){return A%4===0&&(A%100!==0||A%400===0)}function y(A){var $=A.match(t);if(!$)return!1;var N=+$[1],C=+$[2],O=+$[3];return C>=1&&C<=12&&O>=1&&O<=(C==2&&m(N)?29:s[C])}function g(A,$){var N=A.match(i);if(!N)return!1;var C=N[1],O=N[2],j=N[3],M=N[5];return(C<=23&&O<=59&&j<=59||C==23&&O==59&&j==60)&&(!$||M)}var b=/t|\s/i;function R(A){var $=A.split(b);return $.length==2&&y($[0])&&g($[1],!0)}var w=/\/|:/;function T(A){return w.test(A)&&o.test(A)}var k=/[^\\]\\Z/;function D(A){if(k.test(A))return!1;try{return new RegExp(A),!0}catch{return!1}}}),p8=Ie((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.errSchemaPath+"/"+s,p=!t.opts.allErrors,f="data"+(l||""),d="valid"+o,v,h;if(c=="#"||c=="#/")t.isRoot?(v=t.async,h="validate"):(v=t.root.schema.$async===!0,h="root.refVal[0]");else{var m=t.resolveRef(t.baseId,c,t.isRoot);if(m===void 0){var y=t.MissingRefError.message(t.baseId,c);if(t.opts.missingRefs=="fail"){t.logger.error(y);var g=g||[];g.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { ref: '"+t.util.escapeQuotes(c)+"' } ",t.opts.messages!==!1&&(n+=" , message: 'can\\'t resolve reference "+t.util.escapeQuotes(c)+"' "),t.opts.verbose&&(n+=" , schema: "+t.util.toQuotedString(c)+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var b=n;n=g.pop(),!t.compositeRule&&p?t.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",p&&(n+=" if (false) { ")}else if(t.opts.missingRefs=="ignore")t.logger.warn(y),p&&(n+=" if (true) { ");else throw new t.MissingRefError(t.baseId,c,y)}else if(m.inline){var R=t.util.copy(t);R.level++;var w="valid"+R.level;R.schema=m.schema,R.schemaPath="",R.errSchemaPath=c;var T=t.validate(R).replace(/validate\.schema/g,m.code);n+=" "+T+" ",p&&(n+=" if ("+w+") { ")}else v=m.$async===!0||t.async&&m.$async!==!1,h=m.code}if(h){var g=g||[];g.push(n),n="",t.opts.passContext?n+=" "+h+".call(this, ":n+=" "+h+"( ",n+=" "+f+", (dataPath || '')",t.errorPath!='""'&&(n+=" + "+t.errorPath);var k=l?"data"+(l-1||""):"parentData",D=l?t.dataPathArr[l]:"parentDataProperty";n+=" , "+k+" , "+D+", rootData) ";var A=n;if(n=g.pop(),v){if(!t.async)throw new Error("async schema referenced by sync schema");p&&(n+=" var "+d+"; "),n+=" try { await "+A+"; ",p&&(n+=" "+d+" = true; "),n+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",p&&(n+=" "+d+" = false; "),n+=" } ",p&&(n+=" if ("+d+") { ")}else n+=" if (!"+A+") { if (vErrors === null) vErrors = "+h+".errors; else vErrors = vErrors.concat("+h+".errors); errors = vErrors.length; } ",p&&(n+=" else { ")}return n}}),d8=Ie((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.schema[s],l=t.schemaPath+t.util.getProperty(s),c=t.errSchemaPath+"/"+s,u=!t.opts.allErrors,p=t.util.copy(t),f="";p.level++;var d="valid"+p.level,v=p.baseId,h=!0,m=o;if(m)for(var y,g=-1,b=m.length-1;g0||y===!1:t.util.schemaHasRules(y,t.RULES.all))&&(h=!1,p.schema=y,p.schemaPath=l+"["+g+"]",p.errSchemaPath=c+"/"+g,n+=" "+t.validate(p)+" ",p.baseId=v,u&&(n+=" if ("+d+") { ",f+="}"));return u&&(h?n+=" if (true) { ":n+=" "+f.slice(0,-1)+" "),n}}),f8=Ie((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h="errs__"+o,m=t.util.copy(t),y="";m.level++;var g="valid"+m.level,b=c.every(function($){return t.opts.strictKeywords?typeof $=="object"&&Object.keys($).length>0||$===!1:t.util.schemaHasRules($,t.RULES.all)});if(b){var R=m.baseId;n+=" var "+h+" = errors; var "+v+" = false; ";var w=t.compositeRule;t.compositeRule=m.compositeRule=!0;var T=c;if(T)for(var k,D=-1,A=T.length-1;D{e.exports=function(t,s,i){var n=" ",o=t.schema[s],l=t.errSchemaPath+"/"+s,c=!t.opts.allErrors,u=t.util.toQuotedString(o);return t.opts.$comment===!0?n+=" console.log("+u+");":typeof t.opts.$comment=="function"&&(n+=" self._opts.$comment("+u+", "+t.util.toQuotedString(l)+", validate.root.schema);"),n}}),h8=Ie((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h=t.opts.$data&&c&&c.$data,m;h?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",m="schema"+o):m=c,h||(n+=" var schema"+o+" = validate.schema"+u+";"),n+="var "+v+" = equal("+d+", schema"+o+"); if (!"+v+") { ";var y=y||[];y.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'const' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { allowedValue: schema"+o+" } ",t.opts.messages!==!1&&(n+=" , message: 'should be equal to constant' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var g=n;return n=y.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+g+"]); ":n+=" validate.errors = ["+g+"]; return false; ":n+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",f&&(n+=" else { "),n}}),v8=Ie((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h="errs__"+o,m=t.util.copy(t),y="";m.level++;var g="valid"+m.level,b="i"+o,R=m.dataLevel=t.dataLevel+1,w="data"+R,T=t.baseId,k=t.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:t.util.schemaHasRules(c,t.RULES.all);if(n+="var "+h+" = errors;var "+v+";",k){var D=t.compositeRule;t.compositeRule=m.compositeRule=!0,m.schema=c,m.schemaPath=u,m.errSchemaPath=p,n+=" var "+g+" = false; for (var "+b+" = 0; "+b+" < "+d+".length; "+b+"++) { ",m.errorPath=t.util.getPathExpr(t.errorPath,b,t.opts.jsonPointers,!0);var A=d+"["+b+"]";m.dataPathArr[R]=b;var $=t.validate(m);m.baseId=T,t.util.varOccurences($,w)<2?n+=" "+t.util.varReplace($,w,A)+" ":n+=" var "+w+" = "+A+"; "+$+" ",n+=" if ("+g+") break; } ",t.compositeRule=m.compositeRule=D,n+=" "+y+" if (!"+g+") {"}else n+=" if ("+d+".length == 0) {";var N=N||[];N.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: 'should contain a valid item' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var C=n;return n=N.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+C+"]); ":n+=" validate.errors = ["+C+"]; return false; ":n+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { ",k&&(n+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } "),t.opts.allErrors&&(n+=" } "),n}}),g8=Ie((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="errs__"+o,h=t.util.copy(t),m="";h.level++;var y="valid"+h.level,g={},b={},R=t.opts.ownProperties;for(D in c)if(D!="__proto__"){var w=c[D],T=Array.isArray(w)?b:g;T[D]=w}n+="var "+v+" = errors;";var k=t.errorPath;n+="var missing"+o+";";for(var D in b)if(T=b[D],T.length){if(n+=" if ( "+d+t.util.getProperty(D)+" !== undefined ",R&&(n+=" && Object.prototype.hasOwnProperty.call("+d+", '"+t.util.escapeQuotes(D)+"') "),f){n+=" && ( ";var A=T;if(A)for(var $,N=-1,C=A.length-1;N0||w===!1:t.util.schemaHasRules(w,t.RULES.all))&&(n+=" "+y+" = true; if ( "+d+t.util.getProperty(D)+" !== undefined ",R&&(n+=" && Object.prototype.hasOwnProperty.call("+d+", '"+t.util.escapeQuotes(D)+"') "),n+=") { ",h.schema=w,h.schemaPath=u+t.util.getProperty(D),h.errSchemaPath=p+"/"+t.util.escapeFragment(D),n+=" "+t.validate(h)+" ",h.baseId=J,n+=" } ",f&&(n+=" if ("+y+") { ",m+="}"))}return f&&(n+=" "+m+" if ("+v+" == errors) {"),n}}),y8=Ie((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h=t.opts.$data&&c&&c.$data,m;h?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",m="schema"+o):m=c;var y="i"+o,g="schema"+o;h||(n+=" var "+g+" = validate.schema"+u+";"),n+="var "+v+";",h&&(n+=" if (schema"+o+" === undefined) "+v+" = true; else if (!Array.isArray(schema"+o+")) "+v+" = false; else {"),n+=""+v+" = false;for (var "+y+"=0; "+y+"<"+g+".length; "+y+"++) if (equal("+d+", "+g+"["+y+"])) { "+v+" = true; break; }",h&&(n+=" } "),n+=" if (!"+v+") { ";var b=b||[];b.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { allowedValues: schema"+o+" } ",t.opts.messages!==!1&&(n+=" , message: 'should be equal to one of the allowed values' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var R=n;return n=b.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+R+"]); ":n+=" validate.errors = ["+R+"]; return false; ":n+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",f&&(n+=" else { "),n}}),b8=Ie((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||"");if(t.opts.format===!1)return f&&(n+=" if (true) { "),n;var v=t.opts.$data&&c&&c.$data,h;v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",h="schema"+o):h=c;var m=t.opts.unknownFormats,y=Array.isArray(m);if(v){var g="format"+o,b="isObject"+o,R="formatType"+o;n+=" var "+g+" = formats["+h+"]; var "+b+" = typeof "+g+" == 'object' && !("+g+" instanceof RegExp) && "+g+".validate; var "+R+" = "+b+" && "+g+".type || 'string'; if ("+b+") { ",t.async&&(n+=" var async"+o+" = "+g+".async; "),n+=" "+g+" = "+g+".validate; } if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'string') || "),n+=" (",m!="ignore"&&(n+=" ("+h+" && !"+g+" ",y&&(n+=" && self._opts.unknownFormats.indexOf("+h+") == -1 "),n+=") || "),n+=" ("+g+" && "+R+" == '"+i+"' && !(typeof "+g+" == 'function' ? ",t.async?n+=" (async"+o+" ? await "+g+"("+d+") : "+g+"("+d+")) ":n+=" "+g+"("+d+") ",n+=" : "+g+".test("+d+"))))) {"}else{var g=t.formats[c];if(!g){if(m=="ignore")return t.logger.warn('unknown format "'+c+'" ignored in schema at path "'+t.errSchemaPath+'"'),f&&(n+=" if (true) { "),n;if(y&&m.indexOf(c)>=0)return f&&(n+=" if (true) { "),n;throw new Error('unknown format "'+c+'" is used in schema at path "'+t.errSchemaPath+'"')}var b=typeof g=="object"&&!(g instanceof RegExp)&&g.validate,R=b&&g.type||"string";if(b){var w=g.async===!0;g=g.validate}if(R!=i)return f&&(n+=" if (true) { "),n;if(w){if(!t.async)throw new Error("async format in sync schema");var T="formats"+t.util.getProperty(c)+".validate";n+=" if (!(await "+T+"("+d+"))) { "}else{n+=" if (! ";var T="formats"+t.util.getProperty(c);b&&(T+=".validate"),typeof g=="function"?n+=" "+T+"("+d+") ":n+=" "+T+".test("+d+") ",n+=") { "}}var k=k||[];k.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'format' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { format: ",v?n+=""+h:n+=""+t.util.toQuotedString(c),n+=" } ",t.opts.messages!==!1&&(n+=` , message: 'should match format "`,v?n+="' + "+h+" + '":n+=""+t.util.escapeQuotes(c),n+=`"' `),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+u:n+=""+t.util.toQuotedString(c),n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var D=n;return n=k.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+D+"]); ":n+=" validate.errors = ["+D+"]; return false; ":n+=" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",f&&(n+=" else { "),n}}),x8=Ie((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h="errs__"+o,m=t.util.copy(t);m.level++;var y="valid"+m.level,g=t.schema.then,b=t.schema.else,R=g!==void 0&&(t.opts.strictKeywords?typeof g=="object"&&Object.keys(g).length>0||g===!1:t.util.schemaHasRules(g,t.RULES.all)),w=b!==void 0&&(t.opts.strictKeywords?typeof b=="object"&&Object.keys(b).length>0||b===!1:t.util.schemaHasRules(b,t.RULES.all)),T=m.baseId;if(R||w){var k;m.createErrors=!1,m.schema=c,m.schemaPath=u,m.errSchemaPath=p,n+=" var "+h+" = errors; var "+v+" = true; ";var D=t.compositeRule;t.compositeRule=m.compositeRule=!0,n+=" "+t.validate(m)+" ",m.baseId=T,m.createErrors=!0,n+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",t.compositeRule=m.compositeRule=D,R?(n+=" if ("+y+") { ",m.schema=t.schema.then,m.schemaPath=t.schemaPath+".then",m.errSchemaPath=t.errSchemaPath+"/then",n+=" "+t.validate(m)+" ",m.baseId=T,n+=" "+v+" = "+y+"; ",R&&w?(k="ifClause"+o,n+=" var "+k+" = 'then'; "):k="'then'",n+=" } ",w&&(n+=" else { ")):n+=" if (!"+y+") { ",w&&(m.schema=t.schema.else,m.schemaPath=t.schemaPath+".else",m.errSchemaPath=t.errSchemaPath+"/else",n+=" "+t.validate(m)+" ",m.baseId=T,n+=" "+v+" = "+y+"; ",R&&w?(k="ifClause"+o,n+=" var "+k+" = 'else'; "):k="'else'",n+=" } "),n+=" if (!"+v+") { var err = ",t.createErrors!==!1?(n+=" { keyword: 'if' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { failingKeyword: "+k+" } ",t.opts.messages!==!1&&(n+=` , message: 'should match "' + `+k+` + '" schema' `),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!t.compositeRule&&f&&(t.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+=" } ",f&&(n+=" else { ")}else f&&(n+=" if (true) { ");return n}}),_8=Ie((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h="errs__"+o,m=t.util.copy(t),y="";m.level++;var g="valid"+m.level,b="i"+o,R=m.dataLevel=t.dataLevel+1,w="data"+R,T=t.baseId;if(n+="var "+h+" = errors;var "+v+";",Array.isArray(c)){var k=t.schema.additionalItems;if(k===!1){n+=" "+v+" = "+d+".length <= "+c.length+"; ";var D=p;p=t.errSchemaPath+"/additionalItems",n+=" if (!"+v+") { ";var A=A||[];A.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { limit: "+c.length+" } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT have more than "+c.length+" items' "),t.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var $=n;n=A.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+$+"]); ":n+=" validate.errors = ["+$+"]; return false; ":n+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",p=D,f&&(y+="}",n+=" else { ")}var N=c;if(N){for(var C,O=-1,j=N.length-1;O0||C===!1:t.util.schemaHasRules(C,t.RULES.all)){n+=" "+g+" = true; if ("+d+".length > "+O+") { ";var M=d+"["+O+"]";m.schema=C,m.schemaPath=u+"["+O+"]",m.errSchemaPath=p+"/"+O,m.errorPath=t.util.getPathExpr(t.errorPath,O,t.opts.jsonPointers,!0),m.dataPathArr[R]=O;var z=t.validate(m);m.baseId=T,t.util.varOccurences(z,w)<2?n+=" "+t.util.varReplace(z,w,M)+" ":n+=" var "+w+" = "+M+"; "+z+" ",n+=" } ",f&&(n+=" if ("+g+") { ",y+="}")}}if(typeof k=="object"&&(t.opts.strictKeywords?typeof k=="object"&&Object.keys(k).length>0||k===!1:t.util.schemaHasRules(k,t.RULES.all))){m.schema=k,m.schemaPath=t.schemaPath+".additionalItems",m.errSchemaPath=t.errSchemaPath+"/additionalItems",n+=" "+g+" = true; if ("+d+".length > "+c.length+") { for (var "+b+" = "+c.length+"; "+b+" < "+d+".length; "+b+"++) { ",m.errorPath=t.util.getPathExpr(t.errorPath,b,t.opts.jsonPointers,!0);var M=d+"["+b+"]";m.dataPathArr[R]=b;var z=t.validate(m);m.baseId=T,t.util.varOccurences(z,w)<2?n+=" "+t.util.varReplace(z,w,M)+" ":n+=" var "+w+" = "+M+"; "+z+" ",f&&(n+=" if (!"+g+") break; "),n+=" } } ",f&&(n+=" if ("+g+") { ",y+="}")}}else if(t.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:t.util.schemaHasRules(c,t.RULES.all)){m.schema=c,m.schemaPath=u,m.errSchemaPath=p,n+=" for (var "+b+" = 0; "+b+" < "+d+".length; "+b+"++) { ",m.errorPath=t.util.getPathExpr(t.errorPath,b,t.opts.jsonPointers,!0);var M=d+"["+b+"]";m.dataPathArr[R]=b;var z=t.validate(m);m.baseId=T,t.util.varOccurences(z,w)<2?n+=" "+t.util.varReplace(z,w,M)+" ":n+=" var "+w+" = "+M+"; "+z+" ",f&&(n+=" if (!"+g+") break; "),n+=" }"}return f&&(n+=" "+y+" if ("+h+" == errors) {"),n}}),FE=Ie((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,T,d="data"+(l||""),v=t.opts.$data&&c&&c.$data,h;v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",h="schema"+o):h=c;var m=s=="maximum",y=m?"exclusiveMaximum":"exclusiveMinimum",g=t.schema[y],b=t.opts.$data&&g&&g.$data,R=m?"<":">",w=m?">":"<",T=void 0;if(!(v||typeof c=="number"||c===void 0))throw new Error(s+" must be number");if(!(b||g===void 0||typeof g=="number"||typeof g=="boolean"))throw new Error(y+" must be number or boolean");if(b){var k=t.util.getData(g.$data,l,t.dataPathArr),D="exclusive"+o,A="exclType"+o,$="exclIsNumber"+o,N="op"+o,C="' + "+N+" + '";n+=" var schemaExcl"+o+" = "+k+"; ",k="schemaExcl"+o,n+=" var "+D+"; var "+A+" = typeof "+k+"; if ("+A+" != 'boolean' && "+A+" != 'undefined' && "+A+" != 'number') { ";var T=y,O=O||[];O.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(T||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: '"+y+" should be boolean' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var j=n;n=O.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+j+"]); ":n+=" validate.errors = ["+j+"]; return false; ":n+=" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" "+A+" == 'number' ? ( ("+D+" = "+h+" === undefined || "+k+" "+R+"= "+h+") ? "+d+" "+w+"= "+k+" : "+d+" "+w+" "+h+" ) : ( ("+D+" = "+k+" === true) ? "+d+" "+w+"= "+h+" : "+d+" "+w+" "+h+" ) || "+d+" !== "+d+") { var op"+o+" = "+D+" ? '"+R+"' : '"+R+"='; ",c===void 0&&(T=y,p=t.errSchemaPath+"/"+y,h=k,v=b)}else{var $=typeof g=="number",C=R;if($&&v){var N="'"+C+"'";n+=" if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" ( "+h+" === undefined || "+g+" "+R+"= "+h+" ? "+d+" "+w+"= "+g+" : "+d+" "+w+" "+h+" ) || "+d+" !== "+d+") { "}else{$&&c===void 0?(D=!0,T=y,p=t.errSchemaPath+"/"+y,h=g,w+="="):($&&(h=Math[m?"min":"max"](g,c)),g===($?h:!0)?(D=!0,T=y,p=t.errSchemaPath+"/"+y,w+="="):(D=!1,C+="="));var N="'"+C+"'";n+=" if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" "+d+" "+w+" "+h+" || "+d+" !== "+d+") { "}}T=T||s;var O=O||[];O.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(T||"_limit")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { comparison: "+N+", limit: "+h+", exclusive: "+D+" } ",t.opts.messages!==!1&&(n+=" , message: 'should be "+C+" ",v?n+="' + "+h:n+=""+h+"'"),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+u:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var j=n;return n=O.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+j+"]); ":n+=" validate.errors = ["+j+"]; return false; ":n+=" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",f&&(n+=" else { "),n}}),qE=Ie((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,y,d="data"+(l||""),v=t.opts.$data&&c&&c.$data,h;if(v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",h="schema"+o):h=c,!(v||typeof c=="number"))throw new Error(s+" must be number");var m=s=="maxItems"?">":"<";n+="if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" "+d+".length "+m+" "+h+") { ";var y=s,g=g||[];g.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(y||"_limitItems")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { limit: "+h+" } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT have ",s=="maxItems"?n+="more":n+="fewer",n+=" than ",v?n+="' + "+h+" + '":n+=""+c,n+=" items' "),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+u:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var b=n;return n=g.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}}),UE=Ie((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,y,d="data"+(l||""),v=t.opts.$data&&c&&c.$data,h;if(v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",h="schema"+o):h=c,!(v||typeof c=="number"))throw new Error(s+" must be number");var m=s=="maxLength"?">":"<";n+="if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),t.opts.unicode===!1?n+=" "+d+".length ":n+=" ucs2length("+d+") ",n+=" "+m+" "+h+") { ";var y=s,g=g||[];g.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(y||"_limitLength")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { limit: "+h+" } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT be ",s=="maxLength"?n+="longer":n+="shorter",n+=" than ",v?n+="' + "+h+" + '":n+=""+c,n+=" characters' "),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+u:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var b=n;return n=g.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}}),HE=Ie((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,y,d="data"+(l||""),v=t.opts.$data&&c&&c.$data,h;if(v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",h="schema"+o):h=c,!(v||typeof c=="number"))throw new Error(s+" must be number");var m=s=="maxProperties"?">":"<";n+="if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" Object.keys("+d+").length "+m+" "+h+") { ";var y=s,g=g||[];g.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(y||"_limitProperties")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { limit: "+h+" } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT have ",s=="maxProperties"?n+="more":n+="fewer",n+=" than ",v?n+="' + "+h+" + '":n+=""+c,n+=" properties' "),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+u:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var b=n;return n=g.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}}),S8=Ie((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v=t.opts.$data&&c&&c.$data,h;if(v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",h="schema"+o):h=c,!(v||typeof c=="number"))throw new Error(s+" must be number");n+="var division"+o+";if (",v&&(n+=" "+h+" !== undefined && ( typeof "+h+" != 'number' || "),n+=" (division"+o+" = "+d+" / "+h+", ",t.opts.multipleOfPrecision?n+=" Math.abs(Math.round(division"+o+") - division"+o+") > 1e-"+t.opts.multipleOfPrecision+" ":n+=" division"+o+" !== parseInt(division"+o+") ",n+=" ) ",v&&(n+=" ) "),n+=" ) { ";var m=m||[];m.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { multipleOf: "+h+" } ",t.opts.messages!==!1&&(n+=" , message: 'should be multiple of ",v?n+="' + "+h:n+=""+h+"'"),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+u:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var y=n;return n=m.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+y+"]); ":n+=" validate.errors = ["+y+"]; return false; ":n+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}}),E8=Ie((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="errs__"+o,h=t.util.copy(t);h.level++;var m="valid"+h.level;if(t.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:t.util.schemaHasRules(c,t.RULES.all)){h.schema=c,h.schemaPath=u,h.errSchemaPath=p,n+=" var "+v+" = errors; ";var y=t.compositeRule;t.compositeRule=h.compositeRule=!0,h.createErrors=!1;var g;h.opts.allErrors&&(g=h.opts.allErrors,h.opts.allErrors=!1),n+=" "+t.validate(h)+" ",h.createErrors=!0,g&&(h.opts.allErrors=g),t.compositeRule=h.compositeRule=y,n+=" if ("+m+") { ";var b=b||[];b.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var R=n;n=b.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+R+"]); ":n+=" validate.errors = ["+R+"]; return false; ":n+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { errors = "+v+"; if (vErrors !== null) { if ("+v+") vErrors.length = "+v+"; else vErrors = null; } ",t.opts.allErrors&&(n+=" } ")}else n+=" var err = ",t.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f&&(n+=" if (false) { ");return n}}),w8=Ie((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h="errs__"+o,m=t.util.copy(t),y="";m.level++;var g="valid"+m.level,b=m.baseId,R="prevValid"+o,w="passingSchemas"+o;n+="var "+h+" = errors , "+R+" = false , "+v+" = false , "+w+" = null; ";var T=t.compositeRule;t.compositeRule=m.compositeRule=!0;var k=c;if(k)for(var D,A=-1,$=k.length-1;A<$;)D=k[A+=1],(t.opts.strictKeywords?typeof D=="object"&&Object.keys(D).length>0||D===!1:t.util.schemaHasRules(D,t.RULES.all))?(m.schema=D,m.schemaPath=u+"["+A+"]",m.errSchemaPath=p+"/"+A,n+=" "+t.validate(m)+" ",m.baseId=b):n+=" var "+g+" = true; ",A&&(n+=" if ("+g+" && "+R+") { "+v+" = false; "+w+" = ["+w+", "+A+"]; } else { ",y+="}"),n+=" if ("+g+") { "+v+" = "+R+" = true; "+w+" = "+A+"; }";return t.compositeRule=m.compositeRule=T,n+=""+y+"if (!"+v+") { var err = ",t.createErrors!==!1?(n+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { passingSchemas: "+w+" } ",t.opts.messages!==!1&&(n+=" , message: 'should match exactly one schema in oneOf' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!t.compositeRule&&f&&(t.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+="} else { errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; }",t.opts.allErrors&&(n+=" } "),n}}),T8=Ie((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v=t.opts.$data&&c&&c.$data,h;v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",h="schema"+o):h=c;var m=v?"(new RegExp("+h+"))":t.usePattern(c);n+="if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'string') || "),n+=" !"+m+".test("+d+") ) { ";var y=y||[];y.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { pattern: ",v?n+=""+h:n+=""+t.util.toQuotedString(c),n+=" } ",t.opts.messages!==!1&&(n+=` , message: 'should match pattern "`,v?n+="' + "+h+" + '":n+=""+t.util.escapeQuotes(c),n+=`"' `),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+u:n+=""+t.util.toQuotedString(c),n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var g=n;return n=y.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+g+"]); ":n+=" validate.errors = ["+g+"]; return false; ":n+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}}),R8=Ie((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="errs__"+o,h=t.util.copy(t),m="";h.level++;var y="valid"+h.level,g="key"+o,b="idx"+o,R=h.dataLevel=t.dataLevel+1,w="data"+R,T="dataProperties"+o,k=Object.keys(c||{}).filter(K),D=t.schema.patternProperties||{},A=Object.keys(D).filter(K),$=t.schema.additionalProperties,N=k.length||A.length,C=$===!1,O=typeof $=="object"&&Object.keys($).length,j=t.opts.removeAdditional,M=C||O||j,z=t.opts.ownProperties,V=t.baseId,X=t.schema.required;if(X&&!(t.opts.$data&&X.$data)&&X.length8)n+=" || validate.schema"+u+".hasOwnProperty("+g+") ";else{var ae=k;if(ae)for(var J,we=-1,fe=ae.length-1;we0||ze===!1:t.util.schemaHasRules(ze,t.RULES.all)){var Qe=t.util.getProperty(J),ge=d+Qe,Ze=Be&&ze.default!==void 0;h.schema=ze,h.schemaPath=u+Qe,h.errSchemaPath=p+"/"+t.util.escapeFragment(J),h.errorPath=t.util.getPath(t.errorPath,J,t.opts.jsonPointers),h.dataPathArr[R]=t.util.toQuotedString(J);var oe=t.validate(h);if(h.baseId=V,t.util.varOccurences(oe,w)<2){oe=t.util.varReplace(oe,w,ge);var Xe=ge}else{var Xe=w;n+=" var "+w+" = "+ge+"; "}if(Ze)n+=" "+oe+" ";else{if(Z&&Z[J]){n+=" if ( "+Xe+" === undefined ",z&&(n+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+t.util.escapeQuotes(J)+"') "),n+=") { "+y+" = false; ";var W=t.errorPath,ue=p,Et=t.util.escapeQuotes(J);t.opts._errorDataPathProperty&&(t.errorPath=t.util.getPath(W,J,t.opts.jsonPointers)),p=t.errSchemaPath+"/required";var G=G||[];G.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { missingProperty: '"+Et+"' } ",t.opts.messages!==!1&&(n+=" , message: '",t.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+Et+"\\'",n+="' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var Q=n;n=G.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+Q+"]); ":n+=" validate.errors = ["+Q+"]; return false; ":n+=" var err = "+Q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",p=ue,t.errorPath=W,n+=" } else { "}else f?(n+=" if ( "+Xe+" === undefined ",z&&(n+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+t.util.escapeQuotes(J)+"') "),n+=") { "+y+" = true; } else { "):(n+=" if ("+Xe+" !== undefined ",z&&(n+=" && Object.prototype.hasOwnProperty.call("+d+", '"+t.util.escapeQuotes(J)+"') "),n+=" ) { ");n+=" "+oe+" } "}}f&&(n+=" if ("+y+") { ",m+="}")}}if(A.length){var wt=A;if(wt)for(var Ee,Pt=-1,Qr=wt.length-1;Pt0||ze===!1:t.util.schemaHasRules(ze,t.RULES.all)){h.schema=ze,h.schemaPath=t.schemaPath+".patternProperties"+t.util.getProperty(Ee),h.errSchemaPath=t.errSchemaPath+"/patternProperties/"+t.util.escapeFragment(Ee),z?n+=" "+T+" = "+T+" || Object.keys("+d+"); for (var "+b+"=0; "+b+"<"+T+".length; "+b+"++) { var "+g+" = "+T+"["+b+"]; ":n+=" for (var "+g+" in "+d+") { ",n+=" if ("+t.usePattern(Ee)+".test("+g+")) { ",h.errorPath=t.util.getPathExpr(t.errorPath,g,t.opts.jsonPointers);var ge=d+"["+g+"]";h.dataPathArr[R]=g;var oe=t.validate(h);h.baseId=V,t.util.varOccurences(oe,w)<2?n+=" "+t.util.varReplace(oe,w,ge)+" ":n+=" var "+w+" = "+ge+"; "+oe+" ",f&&(n+=" if (!"+y+") break; "),n+=" } ",f&&(n+=" else "+y+" = true; "),n+=" } ",f&&(n+=" if ("+y+") { ",m+="}")}}}return f&&(n+=" "+m+" if ("+v+" == errors) {"),n}}),P8=Ie((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="errs__"+o,h=t.util.copy(t),m="";h.level++;var y="valid"+h.level;if(n+="var "+v+" = errors;",t.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:t.util.schemaHasRules(c,t.RULES.all)){h.schema=c,h.schemaPath=u,h.errSchemaPath=p;var g="key"+o,b="idx"+o,R="i"+o,w="' + "+g+" + '",T=h.dataLevel=t.dataLevel+1,k="data"+T,D="dataProperties"+o,A=t.opts.ownProperties,$=t.baseId;A&&(n+=" var "+D+" = undefined; "),A?n+=" "+D+" = "+D+" || Object.keys("+d+"); for (var "+b+"=0; "+b+"<"+D+".length; "+b+"++) { var "+g+" = "+D+"["+b+"]; ":n+=" for (var "+g+" in "+d+") { ",n+=" var startErrs"+o+" = errors; ";var N=g,C=t.compositeRule;t.compositeRule=h.compositeRule=!0;var O=t.validate(h);h.baseId=$,t.util.varOccurences(O,k)<2?n+=" "+t.util.varReplace(O,k,N)+" ":n+=" var "+k+" = "+N+"; "+O+" ",t.compositeRule=h.compositeRule=C,n+=" if (!"+y+") { for (var "+R+"=startErrs"+o+"; "+R+"{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h=t.opts.$data&&c&&c.$data,m;h?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",m="schema"+o):m=c;var y="schema"+o;if(!h)if(c.length0||k===!1:t.util.schemaHasRules(k,t.RULES.all))||(g[g.length]=R)}}else var g=c;if(h||g.length){var D=t.errorPath,A=h||g.length>=t.opts.loopRequired,$=t.opts.ownProperties;if(f)if(n+=" var missing"+o+"; ",A){h||(n+=" var "+y+" = validate.schema"+u+"; ");var N="i"+o,C="schema"+o+"["+N+"]",O="' + "+C+" + '";t.opts._errorDataPathProperty&&(t.errorPath=t.util.getPathExpr(D,C,t.opts.jsonPointers)),n+=" var "+v+" = true; ",h&&(n+=" if (schema"+o+" === undefined) "+v+" = true; else if (!Array.isArray(schema"+o+")) "+v+" = false; else {"),n+=" for (var "+N+" = 0; "+N+" < "+y+".length; "+N+"++) { "+v+" = "+d+"["+y+"["+N+"]] !== undefined ",$&&(n+=" && Object.prototype.hasOwnProperty.call("+d+", "+y+"["+N+"]) "),n+="; if (!"+v+") break; } ",h&&(n+=" } "),n+=" if (!"+v+") { ";var j=j||[];j.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { missingProperty: '"+O+"' } ",t.opts.messages!==!1&&(n+=" , message: '",t.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+O+"\\'",n+="' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var M=n;n=j.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+M+"]); ":n+=" validate.errors = ["+M+"]; return false; ":n+=" var err = "+M+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { "}else{n+=" if ( ";var z=g;if(z)for(var V,N=-1,X=z.length-1;N{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h=t.opts.$data&&c&&c.$data,m;if(h?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",m="schema"+o):m=c,(c||h)&&t.opts.uniqueItems!==!1){h&&(n+=" var "+v+"; if ("+m+" === false || "+m+" === undefined) "+v+" = true; else if (typeof "+m+" != 'boolean') "+v+" = false; else { "),n+=" var i = "+d+".length , "+v+" = true , j; if (i > 1) { ";var y=t.schema.items&&t.schema.items.type,g=Array.isArray(y);if(!y||y=="object"||y=="array"||g&&(y.indexOf("object")>=0||y.indexOf("array")>=0))n+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+d+"[i], "+d+"[j])) { "+v+" = false; break outer; } } } ";else{n+=" var itemIndices = {}, item; for (;i--;) { var item = "+d+"[i]; ";var b="checkDataType"+(g?"s":"");n+=" if ("+t.util[b](y,"item",t.opts.strictNumbers,!0)+") continue; ",g&&(n+=` if (typeof item == 'string') item = '"' + item; `),n+=" if (typeof itemIndices[item] == 'number') { "+v+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}n+=" } ",h&&(n+=" } "),n+=" if (!"+v+") { ";var R=R||[];R.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { i: i, j: j } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),t.opts.verbose&&(n+=" , schema: ",h?n+="validate.schema"+u:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var w=n;n=R.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+w+"]); ":n+=" validate.errors = ["+w+"]; return false; ":n+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",f&&(n+=" else { ")}else f&&(n+=" if (true) { ");return n}}),k8=Ie((a,e)=>{e.exports={$ref:p8(),allOf:d8(),anyOf:f8(),$comment:m8(),const:h8(),contains:v8(),dependencies:g8(),enum:y8(),format:b8(),if:x8(),items:_8(),maximum:FE(),minimum:FE(),maxItems:qE(),minItems:qE(),maxLength:UE(),minLength:UE(),maxProperties:HE(),minProperties:HE(),multipleOf:S8(),not:E8(),oneOf:w8(),pattern:T8(),properties:R8(),propertyNames:P8(),required:O8(),uniqueItems:C8(),validate:rw()}}),A8=Ie((a,e)=>{var r=k8(),t=Zn().toHash;e.exports=function(){var i=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],n=["type","$comment"],o=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],l=["number","integer","string","array","object","boolean","null"];return i.all=t(n),i.types=t(l),i.forEach(function(c){c.rules=c.rules.map(function(u){var p;if(typeof u=="object"){var f=Object.keys(u)[0];p=u[f],u=f,p.forEach(function(v){n.push(v),i.all[v]=!0})}n.push(u);var d=i.all[u]={keyword:u,code:r[u],implements:p};return d}),i.all.$comment={keyword:"$comment",code:r.$comment},c.type&&(i.types[c.type]=c)}),i.keywords=t(n.concat(o)),i.custom={},i}}),I8=Ie((a,e)=>{var r=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];e.exports=function(t,s){for(var i=0;i{var r=Rf().MissingRef;e.exports=t;function t(s,i,n){var o=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof i=="function"&&(n=i,i=void 0);var l=c(s).then(function(){var p=o._addSchema(s,void 0,i);return p.validate||u(p)});return n&&l.then(function(p){n(null,p)},n),l;function c(p){var f=p.$schema;return f&&!o.getSchema(f)?t.call(o,{$ref:f},!0):Promise.resolve()}function u(p){try{return o._compile(p)}catch(d){if(d instanceof r)return f(d);throw d}function f(d){var v=d.missingSchema;if(y(v))throw new Error("Schema "+v+" is loaded but "+d.missingRef+" cannot be resolved");var h=o._loadingSchemas[v];return h||(h=o._loadingSchemas[v]=o._opts.loadSchema(v),h.then(m,m)),h.then(function(g){if(!y(v))return c(g).then(function(){y(v)||o.addSchema(g,v,void 0,i)})}).then(function(){return u(p)});function m(){delete o._loadingSchemas[v]}function y(g){return o._refs[g]||o._schemas[g]}}}}}),N8=Ie((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d,v="data"+(l||""),h="valid"+o,m="errs__"+o,y=t.opts.$data&&c&&c.$data,g;y?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",g="schema"+o):g=c;var b=this,R="definition"+o,w=b.definition,T="",k,D,A,$,N;if(y&&w.$data){N="keywordValidate"+o;var C=w.validateSchema;n+=" var "+R+" = RULES.custom['"+s+"'].definition; var "+N+" = "+R+".validate;"}else{if($=t.useCustomRule(b,c,t.schema,t),!$)return;g="validate.schema"+u,N=$.code,k=w.compile,D=w.inline,A=w.macro}var O=N+".errors",j="i"+o,M="ruleErr"+o,z=w.async;if(z&&!t.async)throw new Error("async keyword in sync schema");if(D||A||(n+=""+O+" = null;"),n+="var "+m+" = errors;var "+h+";",y&&w.$data&&(T+="}",n+=" if ("+g+" === undefined) { "+h+" = true; } else { ",C&&(T+="}",n+=" "+h+" = "+R+".validateSchema("+g+"); if ("+h+") { ")),D)w.statements?n+=" "+$.validate+" ":n+=" "+h+" = "+$.validate+"; ";else if(A){var V=t.util.copy(t),T="";V.level++;var X="valid"+V.level;V.schema=$.validate,V.schemaPath="";var Z=t.compositeRule;t.compositeRule=V.compositeRule=!0;var K=t.validate(V).replace(/validate\.schema/g,N);t.compositeRule=V.compositeRule=Z,n+=" "+K}else{var ae=ae||[];ae.push(n),n="",n+=" "+N+".call( ",t.opts.passContext?n+="this":n+="self",k||w.schema===!1?n+=" , "+v+" ":n+=" , "+g+" , "+v+" , validate.schema"+t.schemaPath+" ",n+=" , (dataPath || '')",t.errorPath!='""'&&(n+=" + "+t.errorPath);var J=l?"data"+(l-1||""):"parentData",we=l?t.dataPathArr[l]:"parentDataProperty";n+=" , "+J+" , "+we+" , rootData ) ";var fe=n;n=ae.pop(),w.errors===!1?(n+=" "+h+" = ",z&&(n+="await "),n+=""+fe+"; "):z?(O="customErrors"+o,n+=" var "+O+" = null; try { "+h+" = await "+fe+"; } catch (e) { "+h+" = false; if (e instanceof ValidationError) "+O+" = e.errors; else throw e; } "):n+=" "+O+" = null; "+h+" = "+fe+"; "}if(w.modifying&&(n+=" if ("+J+") "+v+" = "+J+"["+we+"];"),n+=""+T,w.valid)f&&(n+=" if (true) { ");else{n+=" if ( ",w.valid===void 0?(n+=" !",A?n+=""+X:n+=""+h):n+=" "+!w.valid+" ",n+=") { ",d=b.keyword;var ae=ae||[];ae.push(n),n="";var ae=ae||[];ae.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(d||"custom")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { keyword: '"+b.keyword+"' } ",t.opts.messages!==!1&&(n+=` , message: 'should pass "`+b.keyword+`" keyword validation' `),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+v+" "),n+=" } "):n+=" {} ";var De=n;n=ae.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+De+"]); ":n+=" validate.errors = ["+De+"]; return false; ":n+=" var err = "+De+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var Ee=n;n=ae.pop(),D?w.errors?w.errors!="full"&&(n+=" for (var "+j+"="+m+"; "+j+"{e.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}),j8=Ie((a,e)=>{var r=aw();e.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:r.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:r.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}}),$8=Ie((a,e)=>{var r=/^[a-z_$][a-z0-9_$-]*$/i,t=N8(),s=j8();e.exports={add:i,get:n,remove:o,validate:l};function i(c,u){var p=this.RULES;if(p.keywords[c])throw new Error("Keyword "+c+" is already defined");if(!r.test(c))throw new Error("Keyword "+c+" is not a valid identifier");if(u){this.validateKeyword(u,!0);var f=u.type;if(Array.isArray(f))for(var d=0;d{e.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),L8=Ie((a,e)=>{var r=c8(),t=Tf(),s=l8(),i=ew(),n=tw(),o=u8(),l=A8(),c=I8(),u=Zn();e.exports=m,m.prototype.validate=y,m.prototype.compile=g,m.prototype.addSchema=b,m.prototype.addMetaSchema=R,m.prototype.validateSchema=w,m.prototype.getSchema=k,m.prototype.removeSchema=$,m.prototype.addFormat=Z,m.prototype.errorsText=X,m.prototype._addSchema=C,m.prototype._compile=O,m.prototype.compileAsync=D8();var p=$8();m.prototype.addKeyword=p.add,m.prototype.getKeyword=p.get,m.prototype.removeKeyword=p.remove,m.prototype.validateKeyword=p.validate;var f=Rf();m.ValidationError=f.Validation,m.MissingRefError=f.MissingRef,m.$dataMetaSchema=c;var d="http://json-schema.org/draft-07/schema",v=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],h=["/properties"];function m(H){if(!(this instanceof m))return new m(H);H=this._opts=u.copy(H)||{},Ee(this),this._schemas={},this._refs={},this._fragments={},this._formats=o(H.format),this._cache=H.cache||new s,this._loadingSchemas={},this._compilations=[],this.RULES=l(),this._getId=j(H),H.loopRequired=H.loopRequired||1/0,H.errorDataPath=="property"&&(H._errorDataPathProperty=!0),H.serialize===void 0&&(H.serialize=n),this._metaOpts=De(this),H.formats&&J(this),H.keywords&&we(this),K(this),typeof H.meta=="object"&&this.addMetaSchema(H.meta),H.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),ae(this)}function y(H,W){var re;if(typeof H=="string"){if(re=this.getSchema(H),!re)throw new Error('no schema with key or ref "'+H+'"')}else{var ue=this._addSchema(H);re=ue.validate||this._compile(ue)}var G=re(W);return re.$async!==!0&&(this.errors=re.errors),G}function g(H,W){var re=this._addSchema(H,void 0,W);return re.validate||this._compile(re)}function b(H,W,re,ue){if(Array.isArray(H)){for(var G=0;G-1}var sM=aM;function nM(a,e){var r=this.__data__,t=Tl(r,a);return t<0?(++this.size,r.push([a,e])):r[t][1]=e,this}var iM=nM;function Xn(a){var e=-1,r=a==null?0:a.length;for(this.clear();++e{if(!a||a.trim()==="")return null;let e=a.split(",").map(i=>i.trim()).filter(Boolean);if(e.length===0)return null;let r=e.some(i=>i.startsWith("!")),t=e.some(i=>!i.startsWith("!"));if(r&&t)return null;let s=e.map(i=>i.replace(/^!/,"").toLowerCase());return{include:r?[]:s,exclude:r?s:[],isExclusive:r}});function RM(a){let e=[],r=a.match(/^MCP server ["']([^"']+)["']/);if(r&&r[1])e.push("mcp"),e.push(r[1].toLowerCase());else{let i=a.match(/^([^:[]+):/);i&&i[1]&&e.push(i[1].trim().toLowerCase())}let t=a.match(/^\[([^\]]+)]/);t&&t[1]&&e.push(t[1].trim().toLowerCase()),a.toLowerCase().includes("statsig event:")&&e.push("statsig");let s=a.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(s&&s[1]){let i=s[1].trim().toLowerCase();i.length<30&&!i.includes(" ")&&e.push(i)}return Array.from(new Set(e))}function PM(a,e){return e?a.length===0?!1:e.isExclusive?!a.some(r=>e.exclude.includes(r)):a.some(r=>e.include.includes(r)):!0}function OM(a,e){if(!e)return!0;let r=RM(a);return PM(r,e)}function vw(){return process.env.CLAUDE_CONFIG_DIR??(0,mw.join)((0,hw.homedir)(),".claude")}function GE(a){if(!a)return!1;if(typeof a=="boolean")return a;let e=a.toLowerCase().trim();return["1","true","yes","on"].includes(e)}var CM={name:"BASH_MAX_OUTPUT_LENGTH",default:3e4,validate:a=>{if(!a)return{effective:3e4,status:"valid"};let t=parseInt(a,10);return isNaN(t)||t<=0?{effective:3e4,status:"invalid",message:`Invalid value "${a}" (using default: 30000)`}:t>15e4?{effective:15e4,status:"capped",message:`Capped from ${t} to 150000`}:{effective:t,status:"valid"}}},kM={name:"CLAUDE_CODE_MAX_OUTPUT_TOKENS",default:32e3,validate:a=>{if(!a)return{effective:32e3,status:"valid"};let t=parseInt(a,10);return isNaN(t)||t<=0?{effective:32e3,status:"invalid",message:`Invalid value "${a}" (using default: 32000)`}:t>64e3?{effective:64e3,status:"capped",message:`Capped from ${t} to 64000`}:{effective:t,status:"valid"}}};function AM(){let a="";return typeof process<"u"&&typeof process.cwd=="function"&&(a=(0,yw.realpathSync)((0,gw.cwd)())),{originalCwd:a,totalCostUSD:0,totalAPIDuration:0,totalAPIDurationWithoutRetries:0,totalToolDuration:0,startTime:Date.now(),lastInteractionTime:Date.now(),totalLinesAdded:0,totalLinesRemoved:0,hasUnknownModelCost:!1,cwd:a,modelUsage:{},mainLoopModelOverride:void 0,initialMainLoopModel:null,modelStrings:null,isInteractive:!1,clientType:"cli",sessionIngressToken:void 0,oauthTokenFromFd:void 0,apiKeyFromFd:void 0,flagSettingsPath:void 0,allowedSettingSources:["userSettings","projectSettings","localSettings","flagSettings","policySettings"],meter:null,sessionCounter:null,locCounter:null,prCounter:null,commitCounter:null,costCounter:null,tokenCounter:null,codeEditToolDecisionCounter:null,activeTimeCounter:null,sessionId:(0,bw.randomUUID)(),loggerProvider:null,eventLogger:null,meterProvider:null,tracerProvider:null,agentColorMap:new Map,agentColorIndex:0,envVarValidators:[CM,kM],lastAPIRequest:null,inMemoryErrorLog:[],inlinePlugins:[],sessionBypassPermissionsMode:!1,sessionPersistenceDisabled:!1,hasExitedPlanMode:!1,needsPlanModeExitAttachment:!1,initJsonSchema:null,registeredHooks:null,planSlugCache:new Map}}var IM=AM();function DM(){return IM.sessionId}function NM({writeFn:a,flushIntervalMs:e=1e3,maxBufferSize:r=100,immediateMode:t=!1}){let s=[],i=null;function n(){i&&(clearTimeout(i),i=null)}function o(){s.length!==0&&(a(s.join("")),s=[],n())}function l(){i||(i=setTimeout(o,e))}return{write(c){if(t){a(c);return}s.push(c),l(),s.length>=r&&o()},flush:o,dispose(){o()}}}var ZE=new Set;function jM(a){return ZE.add(a),()=>ZE.delete(a)}var $M=ro(()=>GE(process.env.DEBUG)||GE(process.env.DEBUG_SDK)||process.argv.includes("--debug")||process.argv.includes("-d")||xw()||process.argv.some(a=>a.startsWith("--debug="))),MM=ro(()=>{let a=process.argv.find(r=>r.startsWith("--debug="));if(!a)return null;let e=a.substring(8);return TM(e)}),xw=ro(()=>process.argv.includes("--debug-to-stderr")||process.argv.includes("-d2e"));function LM(a){if(typeof process>"u"||typeof process.versions>"u"||typeof process.versions.node>"u")return!1;let e=MM();return OM(a,e)}var FM=!1,vl=null;function qM(){return vl||(vl=NM({writeFn:a=>{let e=_w();pa().existsSync((0,Ps.dirname)(e))||pa().mkdirSync((0,Ps.dirname)(e)),pa().appendFileSync(e,a),UM()},flushIntervalMs:1e3,maxBufferSize:100,immediateMode:$M()}),jM(async()=>vl?.dispose())),vl}function Ir(a,{level:e}={level:"debug"}){if(!LM(a))return;FM&&a.includes(` `)&&(a=JSON.stringify(a));let t=`${new Date().toISOString()} [${e.toUpperCase()}] ${a.trim()} `;if(xw()){wM(t);return}qM().write(t)}function _w(){return process.env.CLAUDE_CODE_DEBUG_LOGS_DIR??(0,Ps.join)(vw(),"debug",`${DM()}.txt`)}var UM=ro(()=>{if(process.argv[2]!=="--ripgrep")try{let a=_w(),e=(0,Ps.dirname)(a),r=(0,Ps.join)(e,"latest");if(pa().existsSync(e)||pa().mkdirSync(e),pa().existsSync(r))try{pa().unlinkSync(r)}catch{}pa().symlinkSync(a,r)}catch{}}),HM=5;function ft(a,e){let r=performance.now();try{return e()}finally{let t=performance.now()-r;t>HM&&Ir(`[SLOW OPERATION DETECTED] fs.${a} (${t.toFixed(1)}ms)`)}}var BM={cwd(){return process.cwd()},existsSync(a){return ft("existsSync",()=>xe.existsSync(a))},async stat(a){return(0,lw.stat)(a)},statSync(a){return ft("statSync",()=>xe.statSync(a))},lstatSync(a){return ft("lstatSync",()=>xe.lstatSync(a))},readFileSync(a,e){return ft("readFileSync",()=>xe.readFileSync(a,{encoding:e.encoding}))},readFileBytesSync(a){return ft("readFileBytesSync",()=>xe.readFileSync(a))},readSync(a,e){return ft("readSync",()=>{let r;try{r=xe.openSync(a,"r");let t=Buffer.alloc(e.length),s=xe.readSync(r,t,0,e.length,0);return{buffer:t,bytesRead:s}}finally{r&&xe.closeSync(r)}})},writeFileSync(a,e,r){return ft("writeFileSync",()=>{let t=xe.existsSync(a);if(!r.flush){let i={encoding:r.encoding};t?r.mode!==void 0&&(i.mode=r.mode):i.mode=r.mode??384,xe.writeFileSync(a,e,i);return}let s;try{let i=t?r.mode:r.mode??384;s=xe.openSync(a,"w",i),xe.writeFileSync(s,e,{encoding:r.encoding}),xe.fsyncSync(s)}finally{s&&xe.closeSync(s)}})},appendFileSync(a,e,r){return ft("appendFileSync",()=>{if(xe.existsSync(a))xe.appendFileSync(a,e);else{let t=r?.mode??384,s=xe.openSync(a,"a",t);try{xe.appendFileSync(s,e)}finally{xe.closeSync(s)}}})},copyFileSync(a,e){return ft("copyFileSync",()=>xe.copyFileSync(a,e))},unlinkSync(a){return ft("unlinkSync",()=>xe.unlinkSync(a))},renameSync(a,e){return ft("renameSync",()=>xe.renameSync(a,e))},linkSync(a,e){return ft("linkSync",()=>xe.linkSync(a,e))},symlinkSync(a,e){return ft("symlinkSync",()=>xe.symlinkSync(a,e))},readlinkSync(a){return ft("readlinkSync",()=>xe.readlinkSync(a))},realpathSync(a){return ft("realpathSync",()=>xe.realpathSync(a))},mkdirSync(a){return ft("mkdirSync",()=>{xe.existsSync(a)||xe.mkdirSync(a,{recursive:!0,mode:448})})},readdirSync(a){return ft("readdirSync",()=>xe.readdirSync(a,{withFileTypes:!0}))},readdirStringSync(a){return ft("readdirStringSync",()=>xe.readdirSync(a))},isDirEmptySync(a){return ft("isDirEmptySync",()=>this.readdirSync(a).length===0)},rmdirSync(a){return ft("rmdirSync",()=>xe.rmdirSync(a))},rmSync(a,e){return ft("rmSync",()=>xe.rmSync(a,e))},createWriteStream(a){return xe.createWriteStream(a)}},zM=BM;function pa(){return zM}var Rs=class extends Error{};function Sw(){return process.versions.bun!==void 0}var gl=null,KE=!1;function VM(){if(KE)return gl;if(KE=!0,!process.env.DEBUG_CLAUDE_AGENT_SDK)return null;let a=(0,mf.join)(vw(),"debug");return gl=(0,mf.join)(a,`sdk-${(0,Ew.randomUUID)()}.txt`),(0,Yn.existsSync)(a)||(0,Yn.mkdirSync)(a,{recursive:!0}),process.stderr.write(`SDK debug logs: ${gl} `),gl}function Ts(a){let e=VM();if(!e)return;let t=`${new Date().toISOString()} ${a} -`;(0,Yn.appendFileSync)(e,t)}function WM(a,e){let r={...a};if(e){let t={sandbox:e};if(r.settings)try{t={...JSON.parse(r.settings),sandbox:e}}catch{}r.settings=JSON.stringify(t)}return r}var hf=class{options;process;processStdin;processStdout;ready=!1;abortController;exitError;exitListeners=[];processExitHandler;abortHandler;constructor(e){this.options=e,this.abortController=e.abortController||iw(),this.initialize()}getDefaultExecutable(){return Sw()?"bun":"node"}spawnLocalProcess(e){let{command:r,args:t,cwd:s,env:i,signal:n}=e,o=i.DEBUG_CLAUDE_AGENT_SDK||this.options.stderr?"pipe":"ignore",l=(0,ow.spawn)(r,t,{cwd:s,stdio:["pipe","pipe",o],signal:n,env:i});return(i.DEBUG_CLAUDE_AGENT_SDK||this.options.stderr)&&l.stderr.on("data",u=>{let p=u.toString();Ts(p),this.options.stderr&&this.options.stderr(p)}),{stdin:l.stdin,stdout:l.stdout,get killed(){return l.killed},get exitCode(){return l.exitCode},kill:l.kill.bind(l),on:l.on.bind(l),once:l.once.bind(l),off:l.off.bind(l)}}initialize(){try{let{additionalDirectories:e=[],betas:r,cwd:t,executable:s=this.getDefaultExecutable(),executableArgs:i=[],extraArgs:n={},pathToClaudeCodeExecutable:o,env:l={...process.env},stderr:c,maxThinkingTokens:u,maxTurns:p,maxBudgetUsd:f,model:d,fallbackModel:v,jsonSchema:h,permissionMode:m,allowDangerouslySkipPermissions:y,permissionPromptToolName:g,continueConversation:b,resume:R,settingSources:w,allowedTools:T=[],disallowedTools:k=[],tools:D,mcpServers:A,strictMcpConfig:$,canUseTool:N,includePartialMessages:C,plugins:O,sandbox:j}=this.options,M=["--output-format","stream-json","--verbose","--input-format","stream-json"];if(u!==void 0&&M.push("--max-thinking-tokens",u.toString()),p&&M.push("--max-turns",p.toString()),f!==void 0&&M.push("--max-budget-usd",f.toString()),d&&M.push("--model",d),r&&r.length>0&&M.push("--betas",r.join(",")),h&&M.push("--json-schema",JSON.stringify(h)),l.DEBUG_CLAUDE_AGENT_SDK&&M.push("--debug-to-stderr"),N){if(g)throw new Error("canUseTool callback cannot be used with permissionPromptToolName. Please use one or the other.");M.push("--permission-prompt-tool","stdio")}else g&&M.push("--permission-prompt-tool",g);if(b&&M.push("--continue"),R&&M.push("--resume",R),T.length>0&&M.push("--allowedTools",T.join(",")),k.length>0&&M.push("--disallowedTools",k.join(",")),D!==void 0&&(Array.isArray(D)?D.length===0?M.push("--tools",""):M.push("--tools",D.join(",")):M.push("--tools","default")),A&&Object.keys(A).length>0&&M.push("--mcp-config",JSON.stringify({mcpServers:A})),w&&M.push("--setting-sources",w.join(",")),$&&M.push("--strict-mcp-config"),m&&M.push("--permission-mode",m),y&&M.push("--allow-dangerously-skip-permissions"),v){if(d&&v===d)throw new Error("Fallback model cannot be the same as the main model. Please specify a different model for fallbackModel option.");M.push("--fallback-model",v)}C&&M.push("--include-partial-messages");for(let Y of e)M.push("--add-dir",Y);if(O&&O.length>0)for(let Y of O)if(Y.type==="local")M.push("--plugin-dir",Y.path);else throw new Error(`Unsupported plugin type: ${Y.type}`);this.options.forkSession&&M.push("--fork-session"),this.options.resumeSessionAt&&M.push("--resume-session-at",this.options.resumeSessionAt),this.options.persistSession===!1&&M.push("--no-session-persistence");let z=WM(n??{},j);for(let[Y,we]of Object.entries(z))we===null?M.push(`--${Y}`):M.push(`--${Y}`,we);l.CLAUDE_CODE_ENTRYPOINT||(l.CLAUDE_CODE_ENTRYPOINT="sdk-ts"),delete l.NODE_OPTIONS,l.DEBUG_CLAUDE_AGENT_SDK?l.DEBUG="1":delete l.DEBUG;let V=GM(o),X=V?o:s,Z=V?[...i,...M]:[...i,o,...M],K={command:X,args:Z,cwd:t,env:l,signal:this.abortController.signal};if(this.options.spawnClaudeCodeProcess)Ts(`Spawning Claude Code (custom): ${X} ${Z.join(" ")}`),this.process=this.options.spawnClaudeCodeProcess(K);else{if(!pa().existsSync(o)){let de=V?`Claude Code native binary not found at ${o}. Please ensure Claude Code is installed via native installer or specify a valid path with options.pathToClaudeCodeExecutable.`:`Claude Code executable not found at ${o}. Is options.pathToClaudeCodeExecutable set?`;throw new ReferenceError(de)}let we=`Spawning Claude Code: ${X} ${Z.join(" ")}`;Ts(we),c&&c(we),this.process=this.spawnLocalProcess(K)}this.processStdin=this.process.stdin,this.processStdout=this.process.stdout;let se=()=>{this.process&&!this.process.killed&&this.process.kill("SIGTERM")};this.processExitHandler=se,this.abortHandler=se,process.on("exit",this.processExitHandler),this.abortController.signal.addEventListener("abort",this.abortHandler),this.process.on("error",Y=>{this.ready=!1,this.abortController.signal.aborted?this.exitError=new Rs("Claude Code process aborted by user"):(this.exitError=new Error(`Failed to spawn Claude Code process: ${Y.message}`),Ts(this.exitError.message))}),this.process.on("exit",(Y,we)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new Rs("Claude Code process aborted by user");else{let de=this.getProcessExitError(Y,we);de&&(this.exitError=de,Ts(de.message))}}),this.ready=!0}catch(e){throw this.ready=!1,e}}getProcessExitError(e,r){if(e!==0&&e!==null)return new Error(`Claude Code process exited with code ${e}`);if(r)return new Error(`Claude Code process terminated by signal ${r}`)}write(e){if(this.abortController.signal.aborted)throw new Rs("Operation aborted");if(!this.ready||!this.processStdin)throw new Error("ProcessTransport is not ready for writing");if(this.process?.killed||this.process?.exitCode!==null)throw new Error("Cannot write to terminated process");if(this.exitError)throw new Error(`Cannot write to process that exited with error: ${this.exitError.message}`);Ts(`[ProcessTransport] Writing to stdin: ${e.substring(0,100)}`);try{this.processStdin.write(e)||Ts("[ProcessTransport] Write buffer full, data queued")}catch(r){throw this.ready=!1,new Error(`Failed to write to process stdin: ${r.message}`)}}close(){this.processStdin&&(this.processStdin.end(),this.processStdin=void 0),this.abortHandler&&(this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0);for(let{handler:e}of this.exitListeners)this.process?.off("exit",e);this.exitListeners=[],this.process&&!this.process.killed&&(this.process.kill("SIGTERM"),setTimeout(()=>{this.process&&!this.process.killed&&this.process.kill("SIGKILL")},5e3)),this.ready=!1,this.processExitHandler&&(process.off("exit",this.processExitHandler),this.processExitHandler=void 0)}isReady(){return this.ready}async*readMessages(){if(!this.processStdout)throw new Error("ProcessTransport output stream not available");let e=(0,cw.createInterface)({input:this.processStdout});try{for await(let r of e)r.trim()&&(yield JSON.parse(r));await this.waitForExit()}catch(r){throw r}finally{e.close()}}endInput(){this.processStdin&&this.processStdin.end()}getInputStream(){return this.processStdin}onExit(e){if(!this.process)return()=>{};let r=(t,s)=>{let i=this.getProcessExitError(t,s);e(i)};return this.process.on("exit",r),this.exitListeners.push({callback:e,handler:r}),()=>{this.process&&this.process.off("exit",r);let t=this.exitListeners.findIndex(s=>s.handler===r);t!==-1&&this.exitListeners.splice(t,1)}}async waitForExit(){if(!this.process){if(this.exitError)throw this.exitError;return}if(this.process.exitCode!==null||this.process.killed){if(this.exitError)throw this.exitError;return}return new Promise((e,r)=>{let t=(i,n)=>{if(this.abortController.signal.aborted){r(new Rs("Operation aborted"));return}let o=this.getProcessExitError(i,n);o?r(o):e()};this.process.once("exit",t);let s=i=>{this.process.off("exit",t),r(i)};this.process.once("error",s),this.process.once("exit",()=>{this.process.off("error",s)})})}};function GM(a){return![".js",".mjs",".tsx",".ts",".jsx"].some(r=>a.endsWith(r))}var vf=class{returned;queue=[];readResolve;readReject;isDone=!1;hasError;started=!1;constructor(e){this.returned=e}[Symbol.asyncIterator](){if(this.started)throw new Error("Stream can only be iterated once");return this.started=!0,this}next(){return this.queue.length>0?Promise.resolve({done:!1,value:this.queue.shift()}):this.isDone?Promise.resolve({done:!0,value:void 0}):this.hasError?Promise.reject(this.hasError):new Promise((e,r)=>{this.readResolve=e,this.readReject=r})}enqueue(e){if(this.readResolve){let r=this.readResolve;this.readResolve=void 0,this.readReject=void 0,r({done:!1,value:e})}else this.queue.push(e)}done(){if(this.isDone=!0,this.readResolve){let e=this.readResolve;this.readResolve=void 0,this.readReject=void 0,e({done:!0,value:void 0})}}error(e){if(this.hasError=e,this.readReject){let r=this.readReject;this.readResolve=void 0,this.readReject=void 0,r(e)}}return(){return this.isDone=!0,this.returned&&this.returned(),Promise.resolve({done:!0,value:void 0})}},gf=class{sendMcpMessage;isClosed=!1;constructor(e){this.sendMcpMessage=e}onclose;onerror;onmessage;async start(){}async send(e){if(this.isClosed)throw new Error("Transport is closed");this.sendMcpMessage(e)}async close(){this.isClosed||(this.isClosed=!0,this.onclose?.())}},yf=class{transport;canUseTool;hooks;abortController;jsonSchema;initConfig;pendingControlResponses=new Map;cleanupPerformed=!1;sdkMessages;inputStream=new vf;initialization;cancelControllers=new Map;hookCallbacks=new Map;nextCallbackId=0;sdkMcpTransports=new Map;pendingMcpResponses=new Map;lastActivityTime=Date.now();userInputEndedResolve;streamCloseTimeout;resetLastActivityTime(){this.lastActivityTime=Date.now()}hasBidirectionalNeeds(){return this.sdkMcpTransports.size>0||this.hooks!==void 0&&Object.keys(this.hooks).length>0||this.canUseTool!==void 0}constructor(e,r,t,s,i,n=new Map,o,l){this.transport=e,this.canUseTool=t,this.hooks=s,this.abortController=i,this.jsonSchema=o,this.initConfig=l,this.streamCloseTimeout=5e3,typeof process<"u"&&process.env?.CLAUDE_CODE_STREAM_CLOSE_TIMEOUT&&(this.streamCloseTimeout=parseInt(process.env.CLAUDE_CODE_STREAM_CLOSE_TIMEOUT));for(let[c,u]of n){let p=new gf(f=>this.sendMcpServerMessageToCli(c,f));this.sdkMcpTransports.set(c,p),u.connect(p)}this.sdkMessages=this.readSdkMessages(),this.readMessages(),this.initialization=this.initialize(),this.initialization.catch(()=>{})}setError(e){this.inputStream.error(e)}cleanup(e){if(!this.cleanupPerformed){this.cleanupPerformed=!0;try{this.transport.close(),this.pendingControlResponses.clear(),this.pendingMcpResponses.clear(),this.cancelControllers.clear(),this.hookCallbacks.clear();for(let r of this.sdkMcpTransports.values())try{r.close()}catch{}this.sdkMcpTransports.clear(),e?this.inputStream.error(e):this.inputStream.done()}catch{}}}next(...[e]){return this.sdkMessages.next(e)}return(e){return this.sdkMessages.return(e)}throw(e){return this.sdkMessages.throw(e)}[Symbol.asyncIterator](){return this.sdkMessages}[Symbol.asyncDispose](){return this.sdkMessages[Symbol.asyncDispose]()}async readMessages(){try{for await(let e of this.transport.readMessages()){if(this.resetLastActivityTime(),e.type==="control_response"){let r=this.pendingControlResponses.get(e.response.request_id);r&&r(e.response);continue}else if(e.type==="control_request"){this.handleControlRequest(e);continue}else if(e.type==="control_cancel_request"){this.handleControlCancelRequest(e);continue}else if(e.type==="keep_alive")continue;this.inputStream.enqueue(e)}this.userInputEndedResolve&&this.userInputEndedResolve(),this.inputStream.done(),this.cleanup()}catch(e){this.userInputEndedResolve&&this.userInputEndedResolve(),this.inputStream.error(e),this.cleanup(e)}}async handleControlRequest(e){let r=new AbortController;this.cancelControllers.set(e.request_id,r);try{let t=await this.processControlRequest(e,r.signal),s={type:"control_response",response:{subtype:"success",request_id:e.request_id,response:t}};await Promise.resolve(this.transport.write(JSON.stringify(s)+` +`;(0,Yn.appendFileSync)(e,t)}function WM(a,e){let r={...a};if(e){let t={sandbox:e};if(r.settings)try{t={...JSON.parse(r.settings),sandbox:e}}catch{}r.settings=JSON.stringify(t)}return r}var hf=class{options;process;processStdin;processStdout;ready=!1;abortController;exitError;exitListeners=[];processExitHandler;abortHandler;constructor(e){this.options=e,this.abortController=e.abortController||iw(),this.initialize()}getDefaultExecutable(){return Sw()?"bun":"node"}spawnLocalProcess(e){let{command:r,args:t,cwd:s,env:i,signal:n}=e,o=i.DEBUG_CLAUDE_AGENT_SDK||this.options.stderr?"pipe":"ignore",l=(0,ow.spawn)(r,t,{cwd:s,stdio:["pipe","pipe",o],signal:n,env:i});return(i.DEBUG_CLAUDE_AGENT_SDK||this.options.stderr)&&l.stderr.on("data",u=>{let p=u.toString();Ts(p),this.options.stderr&&this.options.stderr(p)}),{stdin:l.stdin,stdout:l.stdout,get killed(){return l.killed},get exitCode(){return l.exitCode},kill:l.kill.bind(l),on:l.on.bind(l),once:l.once.bind(l),off:l.off.bind(l)}}initialize(){try{let{additionalDirectories:e=[],betas:r,cwd:t,executable:s=this.getDefaultExecutable(),executableArgs:i=[],extraArgs:n={},pathToClaudeCodeExecutable:o,env:l={...process.env},stderr:c,maxThinkingTokens:u,maxTurns:p,maxBudgetUsd:f,model:d,fallbackModel:v,jsonSchema:h,permissionMode:m,allowDangerouslySkipPermissions:y,permissionPromptToolName:g,continueConversation:b,resume:R,settingSources:w,allowedTools:T=[],disallowedTools:k=[],tools:D,mcpServers:A,strictMcpConfig:$,canUseTool:N,includePartialMessages:C,plugins:O,sandbox:j}=this.options,M=["--output-format","stream-json","--verbose","--input-format","stream-json"];if(u!==void 0&&M.push("--max-thinking-tokens",u.toString()),p&&M.push("--max-turns",p.toString()),f!==void 0&&M.push("--max-budget-usd",f.toString()),d&&M.push("--model",d),r&&r.length>0&&M.push("--betas",r.join(",")),h&&M.push("--json-schema",JSON.stringify(h)),l.DEBUG_CLAUDE_AGENT_SDK&&M.push("--debug-to-stderr"),N){if(g)throw new Error("canUseTool callback cannot be used with permissionPromptToolName. Please use one or the other.");M.push("--permission-prompt-tool","stdio")}else g&&M.push("--permission-prompt-tool",g);if(b&&M.push("--continue"),R&&M.push("--resume",R),T.length>0&&M.push("--allowedTools",T.join(",")),k.length>0&&M.push("--disallowedTools",k.join(",")),D!==void 0&&(Array.isArray(D)?D.length===0?M.push("--tools",""):M.push("--tools",D.join(",")):M.push("--tools","default")),A&&Object.keys(A).length>0&&M.push("--mcp-config",JSON.stringify({mcpServers:A})),w&&M.push("--setting-sources",w.join(",")),$&&M.push("--strict-mcp-config"),m&&M.push("--permission-mode",m),y&&M.push("--allow-dangerously-skip-permissions"),v){if(d&&v===d)throw new Error("Fallback model cannot be the same as the main model. Please specify a different model for fallbackModel option.");M.push("--fallback-model",v)}C&&M.push("--include-partial-messages");for(let J of e)M.push("--add-dir",J);if(O&&O.length>0)for(let J of O)if(J.type==="local")M.push("--plugin-dir",J.path);else throw new Error(`Unsupported plugin type: ${J.type}`);this.options.forkSession&&M.push("--fork-session"),this.options.resumeSessionAt&&M.push("--resume-session-at",this.options.resumeSessionAt),this.options.persistSession===!1&&M.push("--no-session-persistence");let z=WM(n??{},j);for(let[J,we]of Object.entries(z))we===null?M.push(`--${J}`):M.push(`--${J}`,we);l.CLAUDE_CODE_ENTRYPOINT||(l.CLAUDE_CODE_ENTRYPOINT="sdk-ts"),delete l.NODE_OPTIONS,l.DEBUG_CLAUDE_AGENT_SDK?l.DEBUG="1":delete l.DEBUG;let V=GM(o),X=V?o:s,Z=V?[...i,...M]:[...i,o,...M],K={command:X,args:Z,cwd:t,env:l,signal:this.abortController.signal};if(this.options.spawnClaudeCodeProcess)Ts(`Spawning Claude Code (custom): ${X} ${Z.join(" ")}`),this.process=this.options.spawnClaudeCodeProcess(K);else{if(!pa().existsSync(o)){let fe=V?`Claude Code native binary not found at ${o}. Please ensure Claude Code is installed via native installer or specify a valid path with options.pathToClaudeCodeExecutable.`:`Claude Code executable not found at ${o}. Is options.pathToClaudeCodeExecutable set?`;throw new ReferenceError(fe)}let we=`Spawning Claude Code: ${X} ${Z.join(" ")}`;Ts(we),c&&c(we),this.process=this.spawnLocalProcess(K)}this.processStdin=this.process.stdin,this.processStdout=this.process.stdout;let ae=()=>{this.process&&!this.process.killed&&this.process.kill("SIGTERM")};this.processExitHandler=ae,this.abortHandler=ae,process.on("exit",this.processExitHandler),this.abortController.signal.addEventListener("abort",this.abortHandler),this.process.on("error",J=>{this.ready=!1,this.abortController.signal.aborted?this.exitError=new Rs("Claude Code process aborted by user"):(this.exitError=new Error(`Failed to spawn Claude Code process: ${J.message}`),Ts(this.exitError.message))}),this.process.on("exit",(J,we)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new Rs("Claude Code process aborted by user");else{let fe=this.getProcessExitError(J,we);fe&&(this.exitError=fe,Ts(fe.message))}}),this.ready=!0}catch(e){throw this.ready=!1,e}}getProcessExitError(e,r){if(e!==0&&e!==null)return new Error(`Claude Code process exited with code ${e}`);if(r)return new Error(`Claude Code process terminated by signal ${r}`)}write(e){if(this.abortController.signal.aborted)throw new Rs("Operation aborted");if(!this.ready||!this.processStdin)throw new Error("ProcessTransport is not ready for writing");if(this.process?.killed||this.process?.exitCode!==null)throw new Error("Cannot write to terminated process");if(this.exitError)throw new Error(`Cannot write to process that exited with error: ${this.exitError.message}`);Ts(`[ProcessTransport] Writing to stdin: ${e.substring(0,100)}`);try{this.processStdin.write(e)||Ts("[ProcessTransport] Write buffer full, data queued")}catch(r){throw this.ready=!1,new Error(`Failed to write to process stdin: ${r.message}`)}}close(){this.processStdin&&(this.processStdin.end(),this.processStdin=void 0),this.abortHandler&&(this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0);for(let{handler:e}of this.exitListeners)this.process?.off("exit",e);this.exitListeners=[],this.process&&!this.process.killed&&(this.process.kill("SIGTERM"),setTimeout(()=>{this.process&&!this.process.killed&&this.process.kill("SIGKILL")},5e3)),this.ready=!1,this.processExitHandler&&(process.off("exit",this.processExitHandler),this.processExitHandler=void 0)}isReady(){return this.ready}async*readMessages(){if(!this.processStdout)throw new Error("ProcessTransport output stream not available");let e=(0,cw.createInterface)({input:this.processStdout});try{for await(let r of e)r.trim()&&(yield JSON.parse(r));await this.waitForExit()}catch(r){throw r}finally{e.close()}}endInput(){this.processStdin&&this.processStdin.end()}getInputStream(){return this.processStdin}onExit(e){if(!this.process)return()=>{};let r=(t,s)=>{let i=this.getProcessExitError(t,s);e(i)};return this.process.on("exit",r),this.exitListeners.push({callback:e,handler:r}),()=>{this.process&&this.process.off("exit",r);let t=this.exitListeners.findIndex(s=>s.handler===r);t!==-1&&this.exitListeners.splice(t,1)}}async waitForExit(){if(!this.process){if(this.exitError)throw this.exitError;return}if(this.process.exitCode!==null||this.process.killed){if(this.exitError)throw this.exitError;return}return new Promise((e,r)=>{let t=(i,n)=>{if(this.abortController.signal.aborted){r(new Rs("Operation aborted"));return}let o=this.getProcessExitError(i,n);o?r(o):e()};this.process.once("exit",t);let s=i=>{this.process.off("exit",t),r(i)};this.process.once("error",s),this.process.once("exit",()=>{this.process.off("error",s)})})}};function GM(a){return![".js",".mjs",".tsx",".ts",".jsx"].some(r=>a.endsWith(r))}var vf=class{returned;queue=[];readResolve;readReject;isDone=!1;hasError;started=!1;constructor(e){this.returned=e}[Symbol.asyncIterator](){if(this.started)throw new Error("Stream can only be iterated once");return this.started=!0,this}next(){return this.queue.length>0?Promise.resolve({done:!1,value:this.queue.shift()}):this.isDone?Promise.resolve({done:!0,value:void 0}):this.hasError?Promise.reject(this.hasError):new Promise((e,r)=>{this.readResolve=e,this.readReject=r})}enqueue(e){if(this.readResolve){let r=this.readResolve;this.readResolve=void 0,this.readReject=void 0,r({done:!1,value:e})}else this.queue.push(e)}done(){if(this.isDone=!0,this.readResolve){let e=this.readResolve;this.readResolve=void 0,this.readReject=void 0,e({done:!0,value:void 0})}}error(e){if(this.hasError=e,this.readReject){let r=this.readReject;this.readResolve=void 0,this.readReject=void 0,r(e)}}return(){return this.isDone=!0,this.returned&&this.returned(),Promise.resolve({done:!0,value:void 0})}},gf=class{sendMcpMessage;isClosed=!1;constructor(e){this.sendMcpMessage=e}onclose;onerror;onmessage;async start(){}async send(e){if(this.isClosed)throw new Error("Transport is closed");this.sendMcpMessage(e)}async close(){this.isClosed||(this.isClosed=!0,this.onclose?.())}},yf=class{transport;canUseTool;hooks;abortController;jsonSchema;initConfig;pendingControlResponses=new Map;cleanupPerformed=!1;sdkMessages;inputStream=new vf;initialization;cancelControllers=new Map;hookCallbacks=new Map;nextCallbackId=0;sdkMcpTransports=new Map;pendingMcpResponses=new Map;lastActivityTime=Date.now();userInputEndedResolve;streamCloseTimeout;resetLastActivityTime(){this.lastActivityTime=Date.now()}hasBidirectionalNeeds(){return this.sdkMcpTransports.size>0||this.hooks!==void 0&&Object.keys(this.hooks).length>0||this.canUseTool!==void 0}constructor(e,r,t,s,i,n=new Map,o,l){this.transport=e,this.canUseTool=t,this.hooks=s,this.abortController=i,this.jsonSchema=o,this.initConfig=l,this.streamCloseTimeout=5e3,typeof process<"u"&&process.env?.CLAUDE_CODE_STREAM_CLOSE_TIMEOUT&&(this.streamCloseTimeout=parseInt(process.env.CLAUDE_CODE_STREAM_CLOSE_TIMEOUT));for(let[c,u]of n){let p=new gf(f=>this.sendMcpServerMessageToCli(c,f));this.sdkMcpTransports.set(c,p),u.connect(p)}this.sdkMessages=this.readSdkMessages(),this.readMessages(),this.initialization=this.initialize(),this.initialization.catch(()=>{})}setError(e){this.inputStream.error(e)}cleanup(e){if(!this.cleanupPerformed){this.cleanupPerformed=!0;try{this.transport.close(),this.pendingControlResponses.clear(),this.pendingMcpResponses.clear(),this.cancelControllers.clear(),this.hookCallbacks.clear();for(let r of this.sdkMcpTransports.values())try{r.close()}catch{}this.sdkMcpTransports.clear(),e?this.inputStream.error(e):this.inputStream.done()}catch{}}}next(...[e]){return this.sdkMessages.next(e)}return(e){return this.sdkMessages.return(e)}throw(e){return this.sdkMessages.throw(e)}[Symbol.asyncIterator](){return this.sdkMessages}[Symbol.asyncDispose](){return this.sdkMessages[Symbol.asyncDispose]()}async readMessages(){try{for await(let e of this.transport.readMessages()){if(this.resetLastActivityTime(),e.type==="control_response"){let r=this.pendingControlResponses.get(e.response.request_id);r&&r(e.response);continue}else if(e.type==="control_request"){this.handleControlRequest(e);continue}else if(e.type==="control_cancel_request"){this.handleControlCancelRequest(e);continue}else if(e.type==="keep_alive")continue;this.inputStream.enqueue(e)}this.userInputEndedResolve&&this.userInputEndedResolve(),this.inputStream.done(),this.cleanup()}catch(e){this.userInputEndedResolve&&this.userInputEndedResolve(),this.inputStream.error(e),this.cleanup(e)}}async handleControlRequest(e){let r=new AbortController;this.cancelControllers.set(e.request_id,r);try{let t=await this.processControlRequest(e,r.signal),s={type:"control_response",response:{subtype:"success",request_id:e.request_id,response:t}};await Promise.resolve(this.transport.write(JSON.stringify(s)+` `))}catch(t){let s={type:"control_response",response:{subtype:"error",request_id:e.request_id,error:t.message||String(t)}};await Promise.resolve(this.transport.write(JSON.stringify(s)+` `))}finally{this.cancelControllers.delete(e.request_id)}}handleControlCancelRequest(e){let r=this.cancelControllers.get(e.request_id);r&&(r.abort(),this.cancelControllers.delete(e.request_id))}async processControlRequest(e,r){if(e.request.subtype==="can_use_tool"){if(!this.canUseTool)throw new Error("canUseTool callback is not provided.");return{...await this.canUseTool(e.request.tool_name,e.request.input,{signal:r,suggestions:e.request.permission_suggestions,blockedPath:e.request.blocked_path,decisionReason:e.request.decision_reason,toolUseID:e.request.tool_use_id,agentID:e.request.agent_id}),toolUseID:e.request.tool_use_id}}else{if(e.request.subtype==="hook_callback")return await this.handleHookCallbacks(e.request.callback_id,e.request.input,e.request.tool_use_id,r);if(e.request.subtype==="mcp_message"){let t=e.request,s=this.sdkMcpTransports.get(t.server_name);if(!s)throw new Error(`SDK MCP server not found: ${t.server_name}`);return"method"in t.message&&"id"in t.message&&t.message.id!==null?{mcp_response:await this.handleMcpControlRequest(t.server_name,t,s)}:(s.onmessage&&s.onmessage(t.message),{mcp_response:{jsonrpc:"2.0",result:{},id:0}})}}throw new Error("Unsupported control request subtype: "+e.request.subtype)}async*readSdkMessages(){for await(let e of this.inputStream)yield e}async initialize(){let e;if(this.hooks){e={};for(let[i,n]of Object.entries(this.hooks))n.length>0&&(e[i]=n.map(o=>{let l=[];for(let c of o.hooks){let u=`hook_${this.nextCallbackId++}`;this.hookCallbacks.set(u,c),l.push(u)}return{matcher:o.matcher,hookCallbackIds:l,timeout:o.timeout}}))}let r=this.sdkMcpTransports.size>0?Array.from(this.sdkMcpTransports.keys()):void 0,t={subtype:"initialize",hooks:e,sdkMcpServers:r,jsonSchema:this.jsonSchema,systemPrompt:this.initConfig?.systemPrompt,appendSystemPrompt:this.initConfig?.appendSystemPrompt,agents:this.initConfig?.agents};return(await this.request(t)).response}async interrupt(){await this.request({subtype:"interrupt"})}async setPermissionMode(e){await this.request({subtype:"set_permission_mode",mode:e})}async setModel(e){await this.request({subtype:"set_model",model:e})}async setMaxThinkingTokens(e){await this.request({subtype:"set_max_thinking_tokens",max_thinking_tokens:e})}async rewindFiles(e){await this.request({subtype:"rewind_files",user_message_id:e})}async processPendingPermissionRequests(e){for(let r of e)r.request.subtype==="can_use_tool"&&this.handleControlRequest(r).catch(()=>{})}request(e){let r=Math.random().toString(36).substring(2,15),t={request_id:r,type:"control_request",request:e};return new Promise((s,i)=>{this.pendingControlResponses.set(r,n=>{n.subtype==="success"?s(n):(i(new Error(n.error)),n.pending_permission_requests&&this.processPendingPermissionRequests(n.pending_permission_requests))}),Promise.resolve(this.transport.write(JSON.stringify(t)+` `))})}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){Ir("[Query.streamInput] Starting to process input stream");try{let r=0;for await(let t of e){if(r++,Ir(`[Query.streamInput] Processing message ${r}: ${t.type}`),this.abortController?.signal.aborted)break;await Promise.resolve(this.transport.write(JSON.stringify(t)+` `))}Ir(`[Query.streamInput] Finished processing ${r} messages from input stream`),this.hasBidirectionalNeeds()&&(Ir("[Query.streamInput] Has bidirectional needs, waiting for inactivity"),await this.waitForInactivity()),Ir("[Query] Calling transport.endInput() to close stdin to CLI process"),this.transport.endInput()}catch(r){if(!(r instanceof Rs))throw r}}async handleSingleTurnInputComplete(){this.hasBidirectionalNeeds()&&(Ir("[Query.handleSingleTurnInputComplete] Has bidirectional needs, waiting for inactivity"),await this.waitForInactivity()),Ir("[Query.handleSingleTurnInputComplete] Calling transport.endInput()"),this.transport.endInput()}async waitForInactivity(){return Ir(`[Query.waitForInactivity] Waiting for inactivity (timeout: ${this.streamCloseTimeout}ms)`),new Promise(e=>{if(this.userInputEndedResolve=e,this.abortController?.signal.aborted){e();return}this.abortController?.signal.addEventListener("abort",()=>e(),{once:!0});let r=()=>{if(this.abortController?.signal.aborted){e();return}let t=Date.now()-this.lastActivityTime;if(t>=this.streamCloseTimeout)Ir(`[Query.waitForInactivity] Inactivity timeout reached (${t}ms elapsed). Closing stdin. If your tools or hooks need more time, set CLAUDE_CODE_STREAM_CLOSE_TIMEOUT to a higher value (current: ${this.streamCloseTimeout}ms).`),e();else{let s=this.streamCloseTimeout-t;Ir(`[Query.waitForInactivity] Still active, checking again in ${s}ms`),setTimeout(r,s)}};r()})}handleHookCallbacks(e,r,t,s){let i=this.hookCallbacks.get(e);if(!i)throw new Error(`No hook callback found for ID: ${e}`);return i(r,t,{signal:s})}sendMcpServerMessageToCli(e,r){if("id"in r&&r.id!==null&&r.id!==void 0){let s=`${e}:${r.id}`,i=this.pendingMcpResponses.get(s);if(i){i.resolve(r),this.pendingMcpResponses.delete(s);return}}let t={type:"control_request",request_id:(0,ww.randomUUID)(),request:{subtype:"mcp_message",server_name:e,message:r}};this.transport.write(JSON.stringify(t)+` -`)}handleMcpControlRequest(e,r,t){let s="id"in r.message?r.message.id:null,i=`${e}:${s}`;return new Promise((n,o)=>{let l=()=>{this.pendingMcpResponses.delete(i)},c=p=>{l(),n(p)},u=p=>{l(),o(p)};if(this.pendingMcpResponses.set(i,{resolve:c,reject:u}),t.onmessage)t.onmessage(r.message);else{l(),o(new Error("No message handler registered"));return}})}};var E={};s8(E,{void:()=>AL,util:()=>Ke,unknown:()=>CL,union:()=>jL,undefined:()=>RL,tuple:()=>LL,transformer:()=>YE,symbol:()=>TL,string:()=>Aw,strictObject:()=>NL,setErrorMap:()=>XM,set:()=>UL,record:()=>FL,quotelessJson:()=>ZM,promise:()=>GL,preprocess:()=>XL,pipeline:()=>QL,ostring:()=>YL,optional:()=>ZL,onumber:()=>JL,oboolean:()=>e6,objectUtil:()=>bf,object:()=>DL,number:()=>Iw,nullable:()=>KL,null:()=>PL,never:()=>kL,nativeEnum:()=>WL,nan:()=>SL,map:()=>qL,makeIssue:()=>xl,literal:()=>zL,lazy:()=>BL,late:()=>xL,isValid:()=>Os,isDirty:()=>_f,isAsync:()=>Ji,isAborted:()=>xf,intersection:()=>ML,instanceof:()=>_L,getParsedType:()=>ua,getErrorMap:()=>bl,function:()=>HL,enum:()=>VL,effect:()=>YE,discriminatedUnion:()=>$L,defaultErrorMap:()=>Hn,datetimeRegex:()=>Ow,date:()=>wL,custom:()=>kw,coerce:()=>t6,boolean:()=>Dw,bigint:()=>EL,array:()=>IL,any:()=>OL,addIssueToContext:()=>ce,ZodVoid:()=>zn,ZodUnknown:()=>da,ZodUnion:()=>js,ZodUndefined:()=>Ds,ZodType:()=>$e,ZodTuple:()=>Zr,ZodTransformer:()=>tr,ZodSymbol:()=>Bn,ZodString:()=>Ma,ZodSet:()=>Wn,ZodSchema:()=>$e,ZodRecord:()=>Sl,ZodReadonly:()=>Bs,ZodPromise:()=>Fa,ZodPipeline:()=>to,ZodParsedType:()=>fe,ZodOptional:()=>gr,ZodObject:()=>Wt,ZodNumber:()=>Cs,ZodNullable:()=>Kr,ZodNull:()=>Ns,ZodNever:()=>Dr,ZodNativeEnum:()=>qs,ZodNaN:()=>Gn,ZodMap:()=>Vn,ZodLiteral:()=>Ls,ZodLazy:()=>Ms,ZodIssueCode:()=>te,ZodIntersection:()=>$s,ZodFunction:()=>El,ZodFirstPartyTypeKind:()=>ke,ZodError:()=>er,ZodEnum:()=>Fs,ZodEffects:()=>tr,ZodDiscriminatedUnion:()=>_l,ZodDefault:()=>Us,ZodDate:()=>Is,ZodCatch:()=>Hs,ZodBranded:()=>eo,ZodBoolean:()=>As,ZodBigInt:()=>ks,ZodArray:()=>fa,ZodAny:()=>La,Schema:()=>$e,ParseStatus:()=>At,OK:()=>Nt,NEVER:()=>r6,INVALID:()=>Pe,EMPTY_PATH:()=>QM,DIRTY:()=>Un,BRAND:()=>bL});var Ke;(function(a){a.assertEqual=s=>{};function e(s){}a.assertIs=e;function r(s){throw new Error}a.assertNever=r,a.arrayToEnum=s=>{let i={};for(let n of s)i[n]=n;return i},a.getValidEnumValues=s=>{let i=a.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),n={};for(let o of i)n[o]=s[o];return a.objectValues(n)},a.objectValues=s=>a.objectKeys(s).map(function(i){return s[i]}),a.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},a.find=(s,i)=>{for(let n of s)if(i(n))return n},a.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)}a.joinValues=t,a.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(Ke||(Ke={}));var bf;(function(a){a.mergeShapes=(e,r)=>({...e,...r})})(bf||(bf={}));var fe=Ke.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ua=a=>{switch(typeof a){case"undefined":return fe.undefined;case"string":return fe.string;case"number":return Number.isNaN(a)?fe.nan:fe.number;case"boolean":return fe.boolean;case"function":return fe.function;case"bigint":return fe.bigint;case"symbol":return fe.symbol;case"object":return Array.isArray(a)?fe.array:a===null?fe.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?fe.promise:typeof Map<"u"&&a instanceof Map?fe.map:typeof Set<"u"&&a instanceof Set?fe.set:typeof Date<"u"&&a instanceof Date?fe.date:fe.object;default:return fe.unknown}},te=Ke.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"]),ZM=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),er=class a 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 r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=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(r(n));else{let o=t,l=0;for(;lr.message){let r={},t=[];for(let s of this.issues)if(s.path.length>0){let i=s.path[0];r[i]=r[i]||[],r[i].push(e(s))}else t.push(e(s));return{formErrors:t,fieldErrors:r}}get formErrors(){return this.flatten()}};er.create=a=>new er(a);var KM=(a,e)=>{let r;switch(a.code){case te.invalid_type:a.received===fe.undefined?r="Required":r=`Expected ${a.expected}, received ${a.received}`;break;case te.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(a.expected,Ke.jsonStringifyReplacer)}`;break;case te.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ke.joinValues(a.keys,", ")}`;break;case te.invalid_union:r="Invalid input";break;case te.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ke.joinValues(a.options)}`;break;case te.invalid_enum_value:r=`Invalid enum value. Expected ${Ke.joinValues(a.options)}, received '${a.received}'`;break;case te.invalid_arguments:r="Invalid function arguments";break;case te.invalid_return_type:r="Invalid function return type";break;case te.invalid_date:r="Invalid date";break;case te.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(r=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?r=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?r=`Invalid input: must end with "${a.validation.endsWith}"`:Ke.assertNever(a.validation):a.validation!=="regex"?r=`Invalid ${a.validation}`:r="Invalid";break;case te.too_small:a.type==="array"?r=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?r=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?r=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?r=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?r=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:r="Invalid input";break;case te.too_big:a.type==="array"?r=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?r=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?r=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?r=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?r=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:r="Invalid input";break;case te.custom:r="Invalid input";break;case te.invalid_intersection_types:r="Intersection results could not be merged";break;case te.not_multiple_of:r=`Number must be a multiple of ${a.multipleOf}`;break;case te.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ke.assertNever(a)}return{message:r}},Hn=KM,Tw=Hn;function XM(a){Tw=a}function bl(){return Tw}var xl=a=>{let{data:e,path:r,errorMaps:t,issueData:s}=a,i=[...r,...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}},QM=[];function ce(a,e){let r=bl(),t=xl({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,r,r===Hn?void 0:Hn].filter(s=>!!s)});a.common.issues.push(t)}var At=class a{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let t=[];for(let s of r){if(s.status==="aborted")return Pe;s.status==="dirty"&&e.dirty(),t.push(s.value)}return{status:e.value,value:t}}static async mergeObjectAsync(e,r){let t=[];for(let s of r){let i=await s.key,n=await s.value;t.push({key:i,value:n})}return a.mergeObjectSync(e,t)}static mergeObjectSync(e,r){let t={};for(let s of r){let{key:i,value:n}=s;if(i.status==="aborted"||n.status==="aborted")return Pe;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}}},Pe=Object.freeze({status:"aborted"}),Un=a=>({status:"dirty",value:a}),Nt=a=>({status:"valid",value:a}),xf=a=>a.status==="aborted",_f=a=>a.status==="dirty",Os=a=>a.status==="valid",Ji=a=>typeof Promise<"u"&&a instanceof Promise,ye;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e?.message})(ye||(ye={}));var yr=class{constructor(e,r,t,s){this._cachedPath=[],this.parent=e,this.data=r,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}},XE=(a,e)=>{if(Os(e))return{success:!0,data:e.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new er(a.common.issues);return this._error=r,this._error}}};function Fe(a){if(!a)return{};let{errorMap:e,invalid_type_error:r,required_error:t,description:s}=a;if(e&&(r||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}=a;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??r??o.defaultError}},description:s}}var $e=class{get description(){return this._def.description}_getType(e){return ua(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:ua(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new At,ctx:{common:e.parent.common,data:e.data,parsedType:ua(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Ji(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let t=this.safeParse(e,r);if(t.success)return t.data;throw t.error}safeParse(e,r){let t={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ua(e)},s=this._parseSync({data:e,path:t.path,parent:t});return XE(t,s)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ua(e)};if(!this["~standard"].async)try{let t=this._parseSync({data:e,path:[],parent:r});return Os(t)?{value:t.value}:{issues:r.common.issues}}catch(t){t?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(t=>Os(t)?{value:t.value}:{issues:r.common.issues})}async parseAsync(e,r){let t=await this.safeParseAsync(e,r);if(t.success)return t.data;throw t.error}async safeParseAsync(e,r){let t={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ua(e)},s=this._parse({data:e,path:t.path,parent:t}),i=await(Ji(s)?s:Promise.resolve(s));return XE(t,i)}refine(e,r){let t=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,i)=>{let n=e(s),o=()=>i.addIssue({code:te.custom,...t(s)});return typeof Promise<"u"&&n instanceof Promise?n.then(l=>l?!0:(o(),!1)):n?!0:(o(),!1)})}refinement(e,r){return this._refinement((t,s)=>e(t)?!0:(s.addIssue(typeof r=="function"?r(t,s):r),!1))}_refinement(e){return new tr({schema:this,typeName:ke.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:r=>this["~validate"](r)}}optional(){return gr.create(this,this._def)}nullable(){return Kr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return fa.create(this)}promise(){return Fa.create(this,this._def)}or(e){return js.create([this,e],this._def)}and(e){return $s.create(this,e,this._def)}transform(e){return new tr({...Fe(this._def),schema:this,typeName:ke.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Us({...Fe(this._def),innerType:this,defaultValue:r,typeName:ke.ZodDefault})}brand(){return new eo({typeName:ke.ZodBranded,type:this,...Fe(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Hs({...Fe(this._def),innerType:this,catchValue:r,typeName:ke.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return to.create(this,e)}readonly(){return Bs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},YM=/^c[^\s-]{8,}$/i,JM=/^[0-9a-z]+$/,eL=/^[0-9A-HJKMNP-TV-Z]{26}$/i,tL=/^[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,rL=/^[a-z0-9_-]{21}$/i,aL=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,sL=/^[-+]?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)?)??$/,nL=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,iL="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",pf,oL=/^(?:(?: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])$/,cL=/^(?:(?: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])$/,lL=/^(([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]))$/,uL=/^(([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])$/,pL=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dL=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Rw="((\\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])))",fL=new RegExp(`^${Rw}$`);function Pw(a){let e="[0-5]\\d";a.precision?e=`${e}\\.\\d{${a.precision}}`:a.precision==null&&(e=`${e}(\\.\\d+)?`);let r=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function mL(a){return new RegExp(`^${Pw(a)}$`)}function Ow(a){let e=`${Rw}T${Pw(a)}`,r=[];return r.push(a.local?"Z?":"Z"),a.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function hL(a,e){return!!((e==="v4"||!e)&&oL.test(a)||(e==="v6"||!e)&&lL.test(a))}function vL(a,e){if(!aL.test(a))return!1;try{let[r]=a.split(".");if(!r)return!1;let t=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.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 gL(a,e){return!!((e==="v4"||!e)&&cL.test(a)||(e==="v6"||!e)&&uL.test(a))}var Ma=class a extends $e{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==fe.string){let i=this._getOrReturnCtx(e);return ce(i,{code:te.invalid_type,expected:fe.string,received:i.parsedType}),Pe}let t=new At,s;for(let i of this._def.checks)if(i.kind==="min")e.data.lengthi.value&&(s=this._getOrReturnCtx(e,s),ce(s,{code:te.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:r,code:te.invalid_string,...ye.errToObj(t)})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ye.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ye.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ye.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ye.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ye.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ye.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ye.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ye.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ye.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ye.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ye.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ye.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ye.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,...ye.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,...ye.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...ye.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...ye.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...ye.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...ye.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...ye.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...ye.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...ye.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...ye.errToObj(r)})}nonempty(e){return this.min(1,ye.errToObj(e))}trim(){return new a({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new a({...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 r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Ma({checks:[],typeName:ke.ZodString,coerce:a?.coerce??!1,...Fe(a)});function yL(a,e){let r=(a.toString().split(".")[1]||"").length,t=(e.toString().split(".")[1]||"").length,s=r>t?r:t,i=Number.parseInt(a.toFixed(s).replace(".","")),n=Number.parseInt(e.toFixed(s).replace(".",""));return i%n/10**s}var Cs=class a extends $e{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)!==fe.number){let i=this._getOrReturnCtx(e);return ce(i,{code:te.invalid_type,expected:fe.number,received:i.parsedType}),Pe}let t,s=new At;for(let i of this._def.checks)i.kind==="int"?Ke.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),ce(t,{code:te.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),ce(t,{code:te.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?yL(e.data,i.value)!==0&&(t=this._getOrReturnCtx(e,t),ce(t,{code:te.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),ce(t,{code:te.not_finite,message:i.message}),s.dirty()):Ke.assertNever(i);return{status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,ye.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ye.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ye.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ye.toString(r))}setLimit(e,r,t,s){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:t,message:ye.toString(s)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ye.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ye.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ye.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ye.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ye.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ye.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:ye.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ye.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ye.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuee.kind==="int"||e.kind==="multipleOf"&&Ke.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let t of this._def.checks){if(t.kind==="finite"||t.kind==="int"||t.kind==="multipleOf")return!0;t.kind==="min"?(r===null||t.value>r)&&(r=t.value):t.kind==="max"&&(e===null||t.valuenew Cs({checks:[],typeName:ke.ZodNumber,coerce:a?.coerce||!1,...Fe(a)});var ks=class a extends $e{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)!==fe.bigint)return this._getInvalidInput(e);let t,s=new At;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(t=this._getOrReturnCtx(e,t),ce(t,{code:te.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),ce(t,{code:te.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):Ke.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return ce(r,{code:te.invalid_type,expected:fe.bigint,received:r.parsedType}),Pe}gte(e,r){return this.setLimit("min",e,!0,ye.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ye.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ye.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ye.toString(r))}setLimit(e,r,t,s){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:t,message:ye.toString(s)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ye.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ye.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ye.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ye.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ye.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew ks({checks:[],typeName:ke.ZodBigInt,coerce:a?.coerce??!1,...Fe(a)});var As=class extends $e{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==fe.boolean){let t=this._getOrReturnCtx(e);return ce(t,{code:te.invalid_type,expected:fe.boolean,received:t.parsedType}),Pe}return Nt(e.data)}};As.create=a=>new As({typeName:ke.ZodBoolean,coerce:a?.coerce||!1,...Fe(a)});var Is=class a extends $e{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==fe.date){let i=this._getOrReturnCtx(e);return ce(i,{code:te.invalid_type,expected:fe.date,received:i.parsedType}),Pe}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return ce(i,{code:te.invalid_date}),Pe}let t=new At,s;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()i.value&&(s=this._getOrReturnCtx(e,s),ce(s,{code:te.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),t.dirty()):Ke.assertNever(i);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:ye.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:ye.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Is({checks:[],coerce:a?.coerce||!1,typeName:ke.ZodDate,...Fe(a)});var Bn=class extends $e{_parse(e){if(this._getType(e)!==fe.symbol){let t=this._getOrReturnCtx(e);return ce(t,{code:te.invalid_type,expected:fe.symbol,received:t.parsedType}),Pe}return Nt(e.data)}};Bn.create=a=>new Bn({typeName:ke.ZodSymbol,...Fe(a)});var Ds=class extends $e{_parse(e){if(this._getType(e)!==fe.undefined){let t=this._getOrReturnCtx(e);return ce(t,{code:te.invalid_type,expected:fe.undefined,received:t.parsedType}),Pe}return Nt(e.data)}};Ds.create=a=>new Ds({typeName:ke.ZodUndefined,...Fe(a)});var Ns=class extends $e{_parse(e){if(this._getType(e)!==fe.null){let t=this._getOrReturnCtx(e);return ce(t,{code:te.invalid_type,expected:fe.null,received:t.parsedType}),Pe}return Nt(e.data)}};Ns.create=a=>new Ns({typeName:ke.ZodNull,...Fe(a)});var La=class extends $e{constructor(){super(...arguments),this._any=!0}_parse(e){return Nt(e.data)}};La.create=a=>new La({typeName:ke.ZodAny,...Fe(a)});var da=class extends $e{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Nt(e.data)}};da.create=a=>new da({typeName:ke.ZodUnknown,...Fe(a)});var Dr=class extends $e{_parse(e){let r=this._getOrReturnCtx(e);return ce(r,{code:te.invalid_type,expected:fe.never,received:r.parsedType}),Pe}};Dr.create=a=>new Dr({typeName:ke.ZodNever,...Fe(a)});var zn=class extends $e{_parse(e){if(this._getType(e)!==fe.undefined){let t=this._getOrReturnCtx(e);return ce(t,{code:te.invalid_type,expected:fe.void,received:t.parsedType}),Pe}return Nt(e.data)}};zn.create=a=>new zn({typeName:ke.ZodVoid,...Fe(a)});var fa=class a extends $e{_parse(e){let{ctx:r,status:t}=this._processInputParams(e),s=this._def;if(r.parsedType!==fe.array)return ce(r,{code:te.invalid_type,expected:fe.array,received:r.parsedType}),Pe;if(s.exactLength!==null){let n=r.data.length>s.exactLength.value,o=r.data.lengths.maxLength.value&&(ce(r,{code:te.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),t.dirty()),r.common.async)return Promise.all([...r.data].map((n,o)=>s.type._parseAsync(new yr(r,n,r.path,o)))).then(n=>At.mergeArray(t,n));let i=[...r.data].map((n,o)=>s.type._parseSync(new yr(r,n,r.path,o)));return At.mergeArray(t,i)}get element(){return this._def.type}min(e,r){return new a({...this._def,minLength:{value:e,message:ye.toString(r)}})}max(e,r){return new a({...this._def,maxLength:{value:e,message:ye.toString(r)}})}length(e,r){return new a({...this._def,exactLength:{value:e,message:ye.toString(r)}})}nonempty(e){return this.min(1,e)}};fa.create=(a,e)=>new fa({type:a,minLength:null,maxLength:null,exactLength:null,typeName:ke.ZodArray,...Fe(e)});function qn(a){if(a instanceof Wt){let e={};for(let r in a.shape){let t=a.shape[r];e[r]=gr.create(qn(t))}return new Wt({...a._def,shape:()=>e})}else return a instanceof fa?new fa({...a._def,type:qn(a.element)}):a instanceof gr?gr.create(qn(a.unwrap())):a instanceof Kr?Kr.create(qn(a.unwrap())):a instanceof Zr?Zr.create(a.items.map(e=>qn(e))):a}var Wt=class a extends $e{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(),r=Ke.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==fe.object){let c=this._getOrReturnCtx(e);return ce(c,{code:te.invalid_type,expected:fe.object,received:c.parsedType}),Pe}let{status:t,ctx:s}=this._processInputParams(e),{shape:i,keys:n}=this._getCached(),o=[];if(!(this._def.catchall instanceof Dr&&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],p=s.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new yr(s,p,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof Dr){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&&(ce(s,{code:te.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 p=s.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new yr(s,p,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let p=await u.key,f=await u.value;c.push({key:p,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>At.mergeObjectSync(t,c)):At.mergeObjectSync(t,l)}get shape(){return this._def.shape()}strict(e){return ye.errToObj,new a({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,t)=>{let s=this._def.errorMap?.(r,t).message??t.defaultError;return r.code==="unrecognized_keys"?{message:ye.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new a({...this._def,unknownKeys:"strip"})}passthrough(){return new a({...this._def,unknownKeys:"passthrough"})}extend(e){return new a({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new a({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ke.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new a({...this._def,catchall:e})}pick(e){let r={};for(let t of Ke.objectKeys(e))e[t]&&this.shape[t]&&(r[t]=this.shape[t]);return new a({...this._def,shape:()=>r})}omit(e){let r={};for(let t of Ke.objectKeys(this.shape))e[t]||(r[t]=this.shape[t]);return new a({...this._def,shape:()=>r})}deepPartial(){return qn(this)}partial(e){let r={};for(let t of Ke.objectKeys(this.shape)){let s=this.shape[t];e&&!e[t]?r[t]=s:r[t]=s.optional()}return new a({...this._def,shape:()=>r})}required(e){let r={};for(let t of Ke.objectKeys(this.shape))if(e&&!e[t])r[t]=this.shape[t];else{let i=this.shape[t];for(;i instanceof gr;)i=i._def.innerType;r[t]=i}return new a({...this._def,shape:()=>r})}keyof(){return Cw(Ke.objectKeys(this.shape))}};Wt.create=(a,e)=>new Wt({shape:()=>a,unknownKeys:"strip",catchall:Dr.create(),typeName:ke.ZodObject,...Fe(e)});Wt.strictCreate=(a,e)=>new Wt({shape:()=>a,unknownKeys:"strict",catchall:Dr.create(),typeName:ke.ZodObject,...Fe(e)});Wt.lazycreate=(a,e)=>new Wt({shape:a,unknownKeys:"strip",catchall:Dr.create(),typeName:ke.ZodObject,...Fe(e)});var js=class extends $e{_parse(e){let{ctx:r}=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 r.common.issues.push(...o.ctx.common.issues),o.result;let n=i.map(o=>new er(o.ctx.common.issues));return ce(r,{code:te.invalid_union,unionErrors:n}),Pe}if(r.common.async)return Promise.all(t.map(async i=>{let n={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:n}),ctx:n}})).then(s);{let i,n=[];for(let l of t){let c={...r,common:{...r.common,issues:[]},parent:null},u=l._parseSync({data:r.data,path:r.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 r.common.issues.push(...i.ctx.common.issues),i.result;let o=n.map(l=>new er(l));return ce(r,{code:te.invalid_union,unionErrors:o}),Pe}}get options(){return this._def.options}};js.create=(a,e)=>new js({options:a,typeName:ke.ZodUnion,...Fe(e)});var la=a=>a instanceof Ms?la(a.schema):a instanceof tr?la(a.innerType()):a instanceof Ls?[a.value]:a instanceof Fs?a.options:a instanceof qs?Ke.objectValues(a.enum):a instanceof Us?la(a._def.innerType):a instanceof Ds?[void 0]:a instanceof Ns?[null]:a instanceof gr?[void 0,...la(a.unwrap())]:a instanceof Kr?[null,...la(a.unwrap())]:a instanceof eo||a instanceof Bs?la(a.unwrap()):a instanceof Hs?la(a._def.innerType):[],_l=class a extends $e{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==fe.object)return ce(r,{code:te.invalid_type,expected:fe.object,received:r.parsedType}),Pe;let t=this.discriminator,s=r.data[t],i=this.optionsMap.get(s);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(ce(r,{code:te.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[t]}),Pe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,t){let s=new Map;for(let i of r){let n=la(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 a({typeName:ke.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:s,...Fe(t)})}};function Sf(a,e){let r=ua(a),t=ua(e);if(a===e)return{valid:!0,data:a};if(r===fe.object&&t===fe.object){let s=Ke.objectKeys(e),i=Ke.objectKeys(a).filter(o=>s.indexOf(o)!==-1),n={...a,...e};for(let o of i){let l=Sf(a[o],e[o]);if(!l.valid)return{valid:!1};n[o]=l.data}return{valid:!0,data:n}}else if(r===fe.array&&t===fe.array){if(a.length!==e.length)return{valid:!1};let s=[];for(let i=0;i{if(xf(i)||xf(n))return Pe;let o=Sf(i.value,n.value);return o.valid?((_f(i)||_f(n))&&r.dirty(),{status:r.value,value:o.data}):(ce(t,{code:te.invalid_intersection_types}),Pe)};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}))}};$s.create=(a,e,r)=>new $s({left:a,right:e,typeName:ke.ZodIntersection,...Fe(r)});var Zr=class a extends $e{_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.parsedType!==fe.array)return ce(t,{code:te.invalid_type,expected:fe.array,received:t.parsedType}),Pe;if(t.data.lengththis._def.items.length&&(ce(t,{code:te.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...t.data].map((n,o)=>{let l=this._def.items[o]||this._def.rest;return l?l._parse(new yr(t,n,t.path,o)):null}).filter(n=>!!n);return t.common.async?Promise.all(i).then(n=>At.mergeArray(r,n)):At.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new a({...this._def,rest:e})}};Zr.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Zr({items:a,typeName:ke.ZodTuple,rest:null,...Fe(e)})};var Sl=class a extends $e{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.parsedType!==fe.object)return ce(t,{code:te.invalid_type,expected:fe.object,received:t.parsedType}),Pe;let s=[],i=this._def.keyType,n=this._def.valueType;for(let o in t.data)s.push({key:i._parse(new yr(t,o,t.path,o)),value:n._parse(new yr(t,t.data[o],t.path,o)),alwaysSet:o in t.data});return t.common.async?At.mergeObjectAsync(r,s):At.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(e,r,t){return r instanceof $e?new a({keyType:e,valueType:r,typeName:ke.ZodRecord,...Fe(t)}):new a({keyType:Ma.create(),valueType:e,typeName:ke.ZodRecord,...Fe(r)})}},Vn=class extends $e{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.parsedType!==fe.map)return ce(t,{code:te.invalid_type,expected:fe.map,received:t.parsedType}),Pe;let s=this._def.keyType,i=this._def.valueType,n=[...t.data.entries()].map(([o,l],c)=>({key:s._parse(new yr(t,o,t.path,[c,"key"])),value:i._parse(new yr(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 Pe;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),o.set(c.value,u.value)}return{status:r.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 Pe;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),o.set(c.value,u.value)}return{status:r.value,value:o}}}};Vn.create=(a,e,r)=>new Vn({valueType:e,keyType:a,typeName:ke.ZodMap,...Fe(r)});var Wn=class a extends $e{_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.parsedType!==fe.set)return ce(t,{code:te.invalid_type,expected:fe.set,received:t.parsedType}),Pe;let s=this._def;s.minSize!==null&&t.data.sizes.maxSize.value&&(ce(t,{code:te.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());let i=this._def.valueType;function n(l){let c=new Set;for(let u of l){if(u.status==="aborted")return Pe;u.status==="dirty"&&r.dirty(),c.add(u.value)}return{status:r.value,value:c}}let o=[...t.data.values()].map((l,c)=>i._parse(new yr(t,l,t.path,c)));return t.common.async?Promise.all(o).then(l=>n(l)):n(o)}min(e,r){return new a({...this._def,minSize:{value:e,message:ye.toString(r)}})}max(e,r){return new a({...this._def,maxSize:{value:e,message:ye.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Wn.create=(a,e)=>new Wn({valueType:a,minSize:null,maxSize:null,typeName:ke.ZodSet,...Fe(e)});var El=class a extends $e{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==fe.function)return ce(r,{code:te.invalid_type,expected:fe.function,received:r.parsedType}),Pe;function t(o,l){return xl({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,bl(),Hn].filter(c=>!!c),issueData:{code:te.invalid_arguments,argumentsError:l}})}function s(o,l){return xl({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,bl(),Hn].filter(c=>!!c),issueData:{code:te.invalid_return_type,returnTypeError:l}})}let i={errorMap:r.common.contextualErrorMap},n=r.data;if(this._def.returns instanceof Fa){let o=this;return Nt(async function(...l){let c=new er([]),u=await o._def.args.parseAsync(l,i).catch(d=>{throw c.addIssue(t(l,d)),c}),p=await Reflect.apply(n,this,u);return await o._def.returns._def.type.parseAsync(p,i).catch(d=>{throw c.addIssue(s(p,d)),c})})}else{let o=this;return Nt(function(...l){let c=o._def.args.safeParse(l,i);if(!c.success)throw new er([t(l,c.error)]);let u=Reflect.apply(n,this,c.data),p=o._def.returns.safeParse(u,i);if(!p.success)throw new er([s(u,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new a({...this._def,args:Zr.create(e).rest(da.create())})}returns(e){return new a({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,t){return new a({args:e||Zr.create([]).rest(da.create()),returns:r||da.create(),typeName:ke.ZodFunction,...Fe(t)})}},Ms=class extends $e{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Ms.create=(a,e)=>new Ms({getter:a,typeName:ke.ZodLazy,...Fe(e)});var Ls=class extends $e{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return ce(r,{received:r.data,code:te.invalid_literal,expected:this._def.value}),Pe}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ls.create=(a,e)=>new Ls({value:a,typeName:ke.ZodLiteral,...Fe(e)});function Cw(a,e){return new Fs({values:a,typeName:ke.ZodEnum,...Fe(e)})}var Fs=class a extends $e{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),t=this._def.values;return ce(r,{expected:Ke.joinValues(t),received:r.parsedType,code:te.invalid_type}),Pe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),t=this._def.values;return ce(r,{received:r.data,code:te.invalid_enum_value,options:t}),Pe}return Nt(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return a.create(e,{...this._def,...r})}exclude(e,r=this._def){return a.create(this.options.filter(t=>!e.includes(t)),{...this._def,...r})}};Fs.create=Cw;var qs=class extends $e{_parse(e){let r=Ke.getValidEnumValues(this._def.values),t=this._getOrReturnCtx(e);if(t.parsedType!==fe.string&&t.parsedType!==fe.number){let s=Ke.objectValues(r);return ce(t,{expected:Ke.joinValues(s),received:t.parsedType,code:te.invalid_type}),Pe}if(this._cache||(this._cache=new Set(Ke.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=Ke.objectValues(r);return ce(t,{received:t.data,code:te.invalid_enum_value,options:s}),Pe}return Nt(e.data)}get enum(){return this._def.values}};qs.create=(a,e)=>new qs({values:a,typeName:ke.ZodNativeEnum,...Fe(e)});var Fa=class extends $e{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==fe.promise&&r.common.async===!1)return ce(r,{code:te.invalid_type,expected:fe.promise,received:r.parsedType}),Pe;let t=r.parsedType===fe.promise?r.data:Promise.resolve(r.data);return Nt(t.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Fa.create=(a,e)=>new Fa({type:a,typeName:ke.ZodPromise,...Fe(e)});var tr=class extends $e{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ke.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:t}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:n=>{ce(t,n),n.fatal?r.abort():r.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(r.value==="aborted")return Pe;let l=await this._def.schema._parseAsync({data:o,path:t.path,parent:t});return l.status==="aborted"?Pe:l.status==="dirty"||r.value==="dirty"?Un(l.value):l});{if(r.value==="aborted")return Pe;let o=this._def.schema._parseSync({data:n,path:t.path,parent:t});return o.status==="aborted"?Pe:o.status==="dirty"||r.value==="dirty"?Un(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"?Pe:(o.status==="dirty"&&r.dirty(),n(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:t.data,path:t.path,parent:t}).then(o=>o.status==="aborted"?Pe:(o.status==="dirty"&&r.dirty(),n(o.value).then(()=>({status:r.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(!Os(n))return Pe;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:r.value,value:o}}else return this._def.schema._parseAsync({data:t.data,path:t.path,parent:t}).then(n=>Os(n)?Promise.resolve(s.transform(n.value,i)).then(o=>({status:r.value,value:o})):Pe);Ke.assertNever(s)}};tr.create=(a,e,r)=>new tr({schema:a,typeName:ke.ZodEffects,effect:e,...Fe(r)});tr.createWithPreprocess=(a,e,r)=>new tr({schema:e,effect:{type:"preprocess",transform:a},typeName:ke.ZodEffects,...Fe(r)});var gr=class extends $e{_parse(e){return this._getType(e)===fe.undefined?Nt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};gr.create=(a,e)=>new gr({innerType:a,typeName:ke.ZodOptional,...Fe(e)});var Kr=class extends $e{_parse(e){return this._getType(e)===fe.null?Nt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Kr.create=(a,e)=>new Kr({innerType:a,typeName:ke.ZodNullable,...Fe(e)});var Us=class extends $e{_parse(e){let{ctx:r}=this._processInputParams(e),t=r.data;return r.parsedType===fe.undefined&&(t=this._def.defaultValue()),this._def.innerType._parse({data:t,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Us.create=(a,e)=>new Us({innerType:a,typeName:ke.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Fe(e)});var Hs=class extends $e{_parse(e){let{ctx:r}=this._processInputParams(e),t={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:t.data,path:t.path,parent:{...t}});return Ji(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new er(t.common.issues)},input:t.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new er(t.common.issues)},input:t.data})}}removeCatch(){return this._def.innerType}};Hs.create=(a,e)=>new Hs({innerType:a,typeName:ke.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Fe(e)});var Gn=class extends $e{_parse(e){if(this._getType(e)!==fe.nan){let t=this._getOrReturnCtx(e);return ce(t,{code:te.invalid_type,expected:fe.nan,received:t.parsedType}),Pe}return{status:"valid",value:e.data}}};Gn.create=a=>new Gn({typeName:ke.ZodNaN,...Fe(a)});var bL=Symbol("zod_brand"),eo=class extends $e{_parse(e){let{ctx:r}=this._processInputParams(e),t=r.data;return this._def.type._parse({data:t,path:r.path,parent:r})}unwrap(){return this._def.type}},to=class a extends $e{_parse(e){let{status:r,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"?Pe:i.status==="dirty"?(r.dirty(),Un(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"?Pe:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:t.path,parent:t})}}static create(e,r){return new a({in:e,out:r,typeName:ke.ZodPipeline})}},Bs=class extends $e{_parse(e){let r=this._def.innerType._parse(e),t=s=>(Os(s)&&(s.value=Object.freeze(s.value)),s);return Ji(r)?r.then(s=>t(s)):t(r)}unwrap(){return this._def.innerType}};Bs.create=(a,e)=>new Bs({innerType:a,typeName:ke.ZodReadonly,...Fe(e)});function QE(a,e){let r=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof r=="string"?{message:r}:r}function kw(a,e={},r){return a?La.create().superRefine((t,s)=>{let i=a(t);if(i instanceof Promise)return i.then(n=>{if(!n){let o=QE(e,t),l=o.fatal??r??!0;s.addIssue({code:"custom",...o,fatal:l})}});if(!i){let n=QE(e,t),o=n.fatal??r??!0;s.addIssue({code:"custom",...n,fatal:o})}}):La.create()}var xL={object:Wt.lazycreate},ke;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(ke||(ke={}));var _L=(a,e={message:`Input not instance of ${a.name}`})=>kw(r=>r instanceof a,e),Aw=Ma.create,Iw=Cs.create,SL=Gn.create,EL=ks.create,Dw=As.create,wL=Is.create,TL=Bn.create,RL=Ds.create,PL=Ns.create,OL=La.create,CL=da.create,kL=Dr.create,AL=zn.create,IL=fa.create,DL=Wt.create,NL=Wt.strictCreate,jL=js.create,$L=_l.create,ML=$s.create,LL=Zr.create,FL=Sl.create,qL=Vn.create,UL=Wn.create,HL=El.create,BL=Ms.create,zL=Ls.create,VL=Fs.create,WL=qs.create,GL=Fa.create,YE=tr.create,ZL=gr.create,KL=Kr.create,XL=tr.createWithPreprocess,QL=to.create,YL=()=>Aw().optional(),JL=()=>Iw().optional(),e6=()=>Dw().optional(),t6={string:a=>Ma.create({...a,coerce:!0}),number:a=>Cs.create({...a,coerce:!0}),boolean:a=>As.create({...a,coerce:!0}),bigint:a=>ks.create({...a,coerce:!0}),date:a=>Is.create({...a,coerce:!0})},r6=Pe;var Pl="2.0",Nw=E.union([E.string(),E.number().int()]),jw=E.string(),a6=E.object({progressToken:E.optional(Nw)}).passthrough(),br=E.object({_meta:E.optional(a6)}).passthrough(),Gt=E.object({method:E.string(),params:E.optional(br)}),ao=E.object({_meta:E.optional(E.object({}).passthrough())}).passthrough(),Xr=E.object({method:E.string(),params:E.optional(ao)}),xr=E.object({_meta:E.optional(E.object({}).passthrough())}).passthrough(),Ol=E.union([E.string(),E.number().int()]),s6=E.object({jsonrpc:E.literal(Pl),id:Ol}).merge(Gt).strict();var n6=E.object({jsonrpc:E.literal(Pl)}).merge(Xr).strict();var i6=E.object({jsonrpc:E.literal(Pl),id:Ol,result:xr}).strict();var JE;(function(a){a[a.ConnectionClosed=-32e3]="ConnectionClosed",a[a.RequestTimeout=-32001]="RequestTimeout",a[a.ParseError=-32700]="ParseError",a[a.InvalidRequest=-32600]="InvalidRequest",a[a.MethodNotFound=-32601]="MethodNotFound",a[a.InvalidParams=-32602]="InvalidParams",a[a.InternalError=-32603]="InternalError"})(JE||(JE={}));var o6=E.object({jsonrpc:E.literal(Pl),id:Ol,error:E.object({code:E.number().int(),message:E.string(),data:E.optional(E.unknown())})}).strict();var lB=E.union([s6,n6,i6,o6]),$w=xr.strict(),Mw=Xr.extend({method:E.literal("notifications/cancelled"),params:ao.extend({requestId:Ol,reason:E.string().optional()})}),so=E.object({name:E.string(),title:E.optional(E.string())}).passthrough(),Lw=so.extend({version:E.string()}),c6=E.object({experimental:E.optional(E.object({}).passthrough()),sampling:E.optional(E.object({}).passthrough()),elicitation:E.optional(E.object({}).passthrough()),roots:E.optional(E.object({listChanged:E.optional(E.boolean())}).passthrough())}).passthrough(),l6=Gt.extend({method:E.literal("initialize"),params:br.extend({protocolVersion:E.string(),capabilities:c6,clientInfo:Lw})}),u6=E.object({experimental:E.optional(E.object({}).passthrough()),logging:E.optional(E.object({}).passthrough()),completions:E.optional(E.object({}).passthrough()),prompts:E.optional(E.object({listChanged:E.optional(E.boolean())}).passthrough()),resources:E.optional(E.object({subscribe:E.optional(E.boolean()),listChanged:E.optional(E.boolean())}).passthrough()),tools:E.optional(E.object({listChanged:E.optional(E.boolean())}).passthrough())}).passthrough(),p6=xr.extend({protocolVersion:E.string(),capabilities:u6,serverInfo:Lw,instructions:E.optional(E.string())}),d6=Xr.extend({method:E.literal("notifications/initialized")}),Fw=Gt.extend({method:E.literal("ping")}),f6=E.object({progress:E.number(),total:E.optional(E.number()),message:E.optional(E.string())}).passthrough(),qw=Xr.extend({method:E.literal("notifications/progress"),params:ao.merge(f6).extend({progressToken:Nw})}),Cl=Gt.extend({params:br.extend({cursor:E.optional(jw)}).optional()}),kl=xr.extend({nextCursor:E.optional(jw)}),Uw=E.object({uri:E.string(),mimeType:E.optional(E.string()),_meta:E.optional(E.object({}).passthrough())}).passthrough(),Hw=Uw.extend({text:E.string()}),Cf=E.string().refine(a=>{try{return atob(a),!0}catch{return!1}},{message:"Invalid Base64 string"}),Bw=Uw.extend({blob:Cf}),zw=so.extend({uri:E.string(),description:E.optional(E.string()),mimeType:E.optional(E.string()),_meta:E.optional(E.object({}).passthrough())}),m6=so.extend({uriTemplate:E.string(),description:E.optional(E.string()),mimeType:E.optional(E.string()),_meta:E.optional(E.object({}).passthrough())}),h6=Cl.extend({method:E.literal("resources/list")}),v6=kl.extend({resources:E.array(zw)}),g6=Cl.extend({method:E.literal("resources/templates/list")}),y6=kl.extend({resourceTemplates:E.array(m6)}),b6=Gt.extend({method:E.literal("resources/read"),params:br.extend({uri:E.string()})}),x6=xr.extend({contents:E.array(E.union([Hw,Bw]))}),_6=Xr.extend({method:E.literal("notifications/resources/list_changed")}),S6=Gt.extend({method:E.literal("resources/subscribe"),params:br.extend({uri:E.string()})}),E6=Gt.extend({method:E.literal("resources/unsubscribe"),params:br.extend({uri:E.string()})}),w6=Xr.extend({method:E.literal("notifications/resources/updated"),params:ao.extend({uri:E.string()})}),T6=E.object({name:E.string(),description:E.optional(E.string()),required:E.optional(E.boolean())}).passthrough(),R6=so.extend({description:E.optional(E.string()),arguments:E.optional(E.array(T6)),_meta:E.optional(E.object({}).passthrough())}),P6=Cl.extend({method:E.literal("prompts/list")}),O6=kl.extend({prompts:E.array(R6)}),C6=Gt.extend({method:E.literal("prompts/get"),params:br.extend({name:E.string(),arguments:E.optional(E.record(E.string()))})}),kf=E.object({type:E.literal("text"),text:E.string(),_meta:E.optional(E.object({}).passthrough())}).passthrough(),Af=E.object({type:E.literal("image"),data:Cf,mimeType:E.string(),_meta:E.optional(E.object({}).passthrough())}).passthrough(),If=E.object({type:E.literal("audio"),data:Cf,mimeType:E.string(),_meta:E.optional(E.object({}).passthrough())}).passthrough(),k6=E.object({type:E.literal("resource"),resource:E.union([Hw,Bw]),_meta:E.optional(E.object({}).passthrough())}).passthrough(),A6=zw.extend({type:E.literal("resource_link")}),Vw=E.union([kf,Af,If,A6,k6]),I6=E.object({role:E.enum(["user","assistant"]),content:Vw}).passthrough(),D6=xr.extend({description:E.optional(E.string()),messages:E.array(I6)}),N6=Xr.extend({method:E.literal("notifications/prompts/list_changed")}),j6=E.object({title:E.optional(E.string()),readOnlyHint:E.optional(E.boolean()),destructiveHint:E.optional(E.boolean()),idempotentHint:E.optional(E.boolean()),openWorldHint:E.optional(E.boolean())}).passthrough(),$6=so.extend({description:E.optional(E.string()),inputSchema:E.object({type:E.literal("object"),properties:E.optional(E.object({}).passthrough()),required:E.optional(E.array(E.string()))}).passthrough(),outputSchema:E.optional(E.object({type:E.literal("object"),properties:E.optional(E.object({}).passthrough()),required:E.optional(E.array(E.string()))}).passthrough()),annotations:E.optional(j6),_meta:E.optional(E.object({}).passthrough())}),M6=Cl.extend({method:E.literal("tools/list")}),L6=kl.extend({tools:E.array($6)}),Ww=xr.extend({content:E.array(Vw).default([]),structuredContent:E.object({}).passthrough().optional(),isError:E.optional(E.boolean())}),uB=Ww.or(xr.extend({toolResult:E.unknown()})),F6=Gt.extend({method:E.literal("tools/call"),params:br.extend({name:E.string(),arguments:E.optional(E.record(E.unknown()))})}),q6=Xr.extend({method:E.literal("notifications/tools/list_changed")}),Gw=E.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),U6=Gt.extend({method:E.literal("logging/setLevel"),params:br.extend({level:Gw})}),H6=Xr.extend({method:E.literal("notifications/message"),params:ao.extend({level:Gw,logger:E.optional(E.string()),data:E.unknown()})}),B6=E.object({name:E.string().optional()}).passthrough(),z6=E.object({hints:E.optional(E.array(B6)),costPriority:E.optional(E.number().min(0).max(1)),speedPriority:E.optional(E.number().min(0).max(1)),intelligencePriority:E.optional(E.number().min(0).max(1))}).passthrough(),V6=E.object({role:E.enum(["user","assistant"]),content:E.union([kf,Af,If])}).passthrough(),W6=Gt.extend({method:E.literal("sampling/createMessage"),params:br.extend({messages:E.array(V6),systemPrompt:E.optional(E.string()),includeContext:E.optional(E.enum(["none","thisServer","allServers"])),temperature:E.optional(E.number()),maxTokens:E.number().int(),stopSequences:E.optional(E.array(E.string())),metadata:E.optional(E.object({}).passthrough()),modelPreferences:E.optional(z6)})}),G6=xr.extend({model:E.string(),stopReason:E.optional(E.enum(["endTurn","stopSequence","maxTokens"]).or(E.string())),role:E.enum(["user","assistant"]),content:E.discriminatedUnion("type",[kf,Af,If])}),Z6=E.object({type:E.literal("boolean"),title:E.optional(E.string()),description:E.optional(E.string()),default:E.optional(E.boolean())}).passthrough(),K6=E.object({type:E.literal("string"),title:E.optional(E.string()),description:E.optional(E.string()),minLength:E.optional(E.number()),maxLength:E.optional(E.number()),format:E.optional(E.enum(["email","uri","date","date-time"]))}).passthrough(),X6=E.object({type:E.enum(["number","integer"]),title:E.optional(E.string()),description:E.optional(E.string()),minimum:E.optional(E.number()),maximum:E.optional(E.number())}).passthrough(),Q6=E.object({type:E.literal("string"),title:E.optional(E.string()),description:E.optional(E.string()),enum:E.array(E.string()),enumNames:E.optional(E.array(E.string()))}).passthrough(),Y6=E.union([Z6,K6,X6,Q6]),J6=Gt.extend({method:E.literal("elicitation/create"),params:br.extend({message:E.string(),requestedSchema:E.object({type:E.literal("object"),properties:E.record(E.string(),Y6),required:E.optional(E.array(E.string()))}).passthrough()})}),e5=xr.extend({action:E.enum(["accept","decline","cancel"]),content:E.optional(E.record(E.string(),E.unknown()))}),t5=E.object({type:E.literal("ref/resource"),uri:E.string()}).passthrough(),r5=E.object({type:E.literal("ref/prompt"),name:E.string()}).passthrough(),a5=Gt.extend({method:E.literal("completion/complete"),params:br.extend({ref:E.union([r5,t5]),argument:E.object({name:E.string(),value:E.string()}).passthrough(),context:E.optional(E.object({arguments:E.optional(E.record(E.string(),E.string()))}))})}),s5=xr.extend({completion:E.object({values:E.array(E.string()).max(100),total:E.optional(E.number().int()),hasMore:E.optional(E.boolean())}).passthrough()}),n5=E.object({uri:E.string().startsWith("file://"),name:E.optional(E.string()),_meta:E.optional(E.object({}).passthrough())}).passthrough(),i5=Gt.extend({method:E.literal("roots/list")}),o5=xr.extend({roots:E.array(n5)}),c5=Xr.extend({method:E.literal("notifications/roots/list_changed")}),pB=E.union([Fw,l6,a5,U6,C6,P6,h6,g6,b6,S6,E6,F6,M6]),dB=E.union([Mw,qw,d6,c5]),fB=E.union([$w,G6,e5,o5]),mB=E.union([Fw,W6,J6,i5]),hB=E.union([Mw,qw,H6,w6,_6,q6,N6]),vB=E.union([$w,p6,s5,D6,O6,v6,y6,x6,Ww,L6]);var gB=a8(L8(),1);var yB=Symbol("Let zodToJsonSchema decide on which parser to use");var bB=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var Ef;(function(a){a.Completable="McpCompletable"})(Ef||(Ef={}));var wl=class extends $e{_parse(e){let{ctx:r}=this._processInputParams(e),t=r.data;return this._def.type._parse({data:t,path:r.path,parent:r})}unwrap(){return this._def.type}};wl.create=(a,e)=>new wl({type:a,typeName:Ef.Completable,complete:e.complete,...l5(e)});function l5(a){if(!a)return{};let{errorMap:e,invalid_type_error:r,required_error:t,description:s}=a;if(e&&(r||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}=a;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??r)!==null&&c!==void 0?c:o.defaultError}},description:s}}function Zw({prompt:a,options:e}){let{systemPrompt:r,settingSources:t,sandbox:s,...i}=e??{},n,o;r===void 0?n="":typeof r=="string"?n=r:r.type==="preset"&&(o=r.append);let l=i.pathToClaudeCodeExecutable;if(!l){let ge=(0,sw.fileURLToPath)(u5.url),oe=(0,ff.join)(ge,"..");l=(0,ff.join)(oe,"cli.js")}process.env.CLAUDE_AGENT_SDK_VERSION="0.1.67";let{abortController:c=iw(),additionalDirectories:u=[],agents:p,allowedTools:f=[],betas:d,canUseTool:v,continue:h,cwd:m,disallowedTools:y=[],tools:g,env:b,executable:R=Sw()?"bun":"node",executableArgs:w=[],extraArgs:T={},fallbackModel:k,enableFileCheckpointing:D,forkSession:A,hooks:$,includePartialMessages:N,persistSession:C,maxThinkingTokens:O,maxTurns:j,maxBudgetUsd:M,mcpServers:z,model:V,outputFormat:X,permissionMode:Z="default",allowDangerouslySkipPermissions:K=!1,permissionPromptToolName:se,plugins:Y,resume:we,resumeSessionAt:de,stderr:Oe,strictMcpConfig:Ee}=i,Ne=X?.type==="json_schema"?X.schema:void 0,H=b;if(H||(H={...process.env}),H.CLAUDE_CODE_ENTRYPOINT||(H.CLAUDE_CODE_ENTRYPOINT="sdk-ts"),D&&(H.CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING="true"),!l)throw new Error("pathToClaudeCodeExecutable is required");let W={},re=new Map;if(z)for(let[ge,oe]of Object.entries(z))oe.type==="sdk"&&"instance"in oe?(re.set(ge,oe.instance),W[ge]={type:"sdk",name:ge}):W[ge]=oe;let ue=typeof a=="string",G=new hf({abortController:c,additionalDirectories:u,betas:d,cwd:m,executable:R,executableArgs:w,extraArgs:T,pathToClaudeCodeExecutable:l,env:H,forkSession:A,stderr:Oe,maxThinkingTokens:O,maxTurns:j,maxBudgetUsd:M,model:V,fallbackModel:k,jsonSchema:Ne,permissionMode:Z,allowDangerouslySkipPermissions:K,permissionPromptToolName:se,continueConversation:h,resume:we,resumeSessionAt:de,settingSources:t??[],allowedTools:f,disallowedTools:y,tools:g,mcpServers:W,strictMcpConfig:Ee,canUseTool:!!v,hooks:!!$,includePartialMessages:N,persistSession:C,plugins:Y,sandbox:s,spawnClaudeCodeProcess:i.spawnClaudeCodeProcess}),Q={systemPrompt:n,appendSystemPrompt:o,agents:p},ne=new yf(G,ue,v,$,c,re,Ne,Q);return typeof a=="string"?(G.write(JSON.stringify({type:"user",session_id:"",message:{role:"user",content:[{type:"text",text:a}]},parent_tool_use_id:null})+` +`)}handleMcpControlRequest(e,r,t){let s="id"in r.message?r.message.id:null,i=`${e}:${s}`;return new Promise((n,o)=>{let l=()=>{this.pendingMcpResponses.delete(i)},c=p=>{l(),n(p)},u=p=>{l(),o(p)};if(this.pendingMcpResponses.set(i,{resolve:c,reject:u}),t.onmessage)t.onmessage(r.message);else{l(),o(new Error("No message handler registered"));return}})}};var E={};s8(E,{void:()=>AL,util:()=>Ke,unknown:()=>CL,union:()=>jL,undefined:()=>RL,tuple:()=>LL,transformer:()=>YE,symbol:()=>TL,string:()=>Aw,strictObject:()=>NL,setErrorMap:()=>XM,set:()=>UL,record:()=>FL,quotelessJson:()=>ZM,promise:()=>GL,preprocess:()=>XL,pipeline:()=>QL,ostring:()=>YL,optional:()=>ZL,onumber:()=>JL,oboolean:()=>e6,objectUtil:()=>bf,object:()=>DL,number:()=>Iw,nullable:()=>KL,null:()=>PL,never:()=>kL,nativeEnum:()=>WL,nan:()=>SL,map:()=>qL,makeIssue:()=>xl,literal:()=>zL,lazy:()=>BL,late:()=>xL,isValid:()=>Os,isDirty:()=>_f,isAsync:()=>Ji,isAborted:()=>xf,intersection:()=>ML,instanceof:()=>_L,getParsedType:()=>ua,getErrorMap:()=>bl,function:()=>HL,enum:()=>VL,effect:()=>YE,discriminatedUnion:()=>$L,defaultErrorMap:()=>Hn,datetimeRegex:()=>Ow,date:()=>wL,custom:()=>kw,coerce:()=>t6,boolean:()=>Dw,bigint:()=>EL,array:()=>IL,any:()=>OL,addIssueToContext:()=>ce,ZodVoid:()=>zn,ZodUnknown:()=>da,ZodUnion:()=>js,ZodUndefined:()=>Ds,ZodType:()=>$e,ZodTuple:()=>Zr,ZodTransformer:()=>tr,ZodSymbol:()=>Bn,ZodString:()=>Ma,ZodSet:()=>Wn,ZodSchema:()=>$e,ZodRecord:()=>Sl,ZodReadonly:()=>Bs,ZodPromise:()=>Fa,ZodPipeline:()=>to,ZodParsedType:()=>de,ZodOptional:()=>gr,ZodObject:()=>Wt,ZodNumber:()=>Cs,ZodNullable:()=>Kr,ZodNull:()=>Ns,ZodNever:()=>Dr,ZodNativeEnum:()=>qs,ZodNaN:()=>Gn,ZodMap:()=>Vn,ZodLiteral:()=>Ls,ZodLazy:()=>Ms,ZodIssueCode:()=>te,ZodIntersection:()=>$s,ZodFunction:()=>El,ZodFirstPartyTypeKind:()=>Ce,ZodError:()=>er,ZodEnum:()=>Fs,ZodEffects:()=>tr,ZodDiscriminatedUnion:()=>_l,ZodDefault:()=>Us,ZodDate:()=>Is,ZodCatch:()=>Hs,ZodBranded:()=>eo,ZodBoolean:()=>As,ZodBigInt:()=>ks,ZodArray:()=>fa,ZodAny:()=>La,Schema:()=>$e,ParseStatus:()=>At,OK:()=>Nt,NEVER:()=>r6,INVALID:()=>Pe,EMPTY_PATH:()=>QM,DIRTY:()=>Un,BRAND:()=>bL});var Ke;(function(a){a.assertEqual=s=>{};function e(s){}a.assertIs=e;function r(s){throw new Error}a.assertNever=r,a.arrayToEnum=s=>{let i={};for(let n of s)i[n]=n;return i},a.getValidEnumValues=s=>{let i=a.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),n={};for(let o of i)n[o]=s[o];return a.objectValues(n)},a.objectValues=s=>a.objectKeys(s).map(function(i){return s[i]}),a.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},a.find=(s,i)=>{for(let n of s)if(i(n))return n},a.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)}a.joinValues=t,a.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(Ke||(Ke={}));var bf;(function(a){a.mergeShapes=(e,r)=>({...e,...r})})(bf||(bf={}));var de=Ke.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ua=a=>{switch(typeof a){case"undefined":return de.undefined;case"string":return de.string;case"number":return Number.isNaN(a)?de.nan:de.number;case"boolean":return de.boolean;case"function":return de.function;case"bigint":return de.bigint;case"symbol":return de.symbol;case"object":return Array.isArray(a)?de.array:a===null?de.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?de.promise:typeof Map<"u"&&a instanceof Map?de.map:typeof Set<"u"&&a instanceof Set?de.set:typeof Date<"u"&&a instanceof Date?de.date:de.object;default:return de.unknown}},te=Ke.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"]),ZM=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),er=class a 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 r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=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(r(n));else{let o=t,l=0;for(;lr.message){let r={},t=[];for(let s of this.issues)if(s.path.length>0){let i=s.path[0];r[i]=r[i]||[],r[i].push(e(s))}else t.push(e(s));return{formErrors:t,fieldErrors:r}}get formErrors(){return this.flatten()}};er.create=a=>new er(a);var KM=(a,e)=>{let r;switch(a.code){case te.invalid_type:a.received===de.undefined?r="Required":r=`Expected ${a.expected}, received ${a.received}`;break;case te.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(a.expected,Ke.jsonStringifyReplacer)}`;break;case te.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ke.joinValues(a.keys,", ")}`;break;case te.invalid_union:r="Invalid input";break;case te.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ke.joinValues(a.options)}`;break;case te.invalid_enum_value:r=`Invalid enum value. Expected ${Ke.joinValues(a.options)}, received '${a.received}'`;break;case te.invalid_arguments:r="Invalid function arguments";break;case te.invalid_return_type:r="Invalid function return type";break;case te.invalid_date:r="Invalid date";break;case te.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(r=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?r=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?r=`Invalid input: must end with "${a.validation.endsWith}"`:Ke.assertNever(a.validation):a.validation!=="regex"?r=`Invalid ${a.validation}`:r="Invalid";break;case te.too_small:a.type==="array"?r=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?r=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?r=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?r=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?r=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:r="Invalid input";break;case te.too_big:a.type==="array"?r=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?r=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?r=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?r=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?r=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:r="Invalid input";break;case te.custom:r="Invalid input";break;case te.invalid_intersection_types:r="Intersection results could not be merged";break;case te.not_multiple_of:r=`Number must be a multiple of ${a.multipleOf}`;break;case te.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ke.assertNever(a)}return{message:r}},Hn=KM,Tw=Hn;function XM(a){Tw=a}function bl(){return Tw}var xl=a=>{let{data:e,path:r,errorMaps:t,issueData:s}=a,i=[...r,...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}},QM=[];function ce(a,e){let r=bl(),t=xl({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,r,r===Hn?void 0:Hn].filter(s=>!!s)});a.common.issues.push(t)}var At=class a{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let t=[];for(let s of r){if(s.status==="aborted")return Pe;s.status==="dirty"&&e.dirty(),t.push(s.value)}return{status:e.value,value:t}}static async mergeObjectAsync(e,r){let t=[];for(let s of r){let i=await s.key,n=await s.value;t.push({key:i,value:n})}return a.mergeObjectSync(e,t)}static mergeObjectSync(e,r){let t={};for(let s of r){let{key:i,value:n}=s;if(i.status==="aborted"||n.status==="aborted")return Pe;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}}},Pe=Object.freeze({status:"aborted"}),Un=a=>({status:"dirty",value:a}),Nt=a=>({status:"valid",value:a}),xf=a=>a.status==="aborted",_f=a=>a.status==="dirty",Os=a=>a.status==="valid",Ji=a=>typeof Promise<"u"&&a instanceof Promise,ye;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e?.message})(ye||(ye={}));var yr=class{constructor(e,r,t,s){this._cachedPath=[],this.parent=e,this.data=r,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}},XE=(a,e)=>{if(Os(e))return{success:!0,data:e.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new er(a.common.issues);return this._error=r,this._error}}};function Fe(a){if(!a)return{};let{errorMap:e,invalid_type_error:r,required_error:t,description:s}=a;if(e&&(r||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}=a;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??r??o.defaultError}},description:s}}var $e=class{get description(){return this._def.description}_getType(e){return ua(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:ua(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new At,ctx:{common:e.parent.common,data:e.data,parsedType:ua(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Ji(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let t=this.safeParse(e,r);if(t.success)return t.data;throw t.error}safeParse(e,r){let t={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ua(e)},s=this._parseSync({data:e,path:t.path,parent:t});return XE(t,s)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ua(e)};if(!this["~standard"].async)try{let t=this._parseSync({data:e,path:[],parent:r});return Os(t)?{value:t.value}:{issues:r.common.issues}}catch(t){t?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(t=>Os(t)?{value:t.value}:{issues:r.common.issues})}async parseAsync(e,r){let t=await this.safeParseAsync(e,r);if(t.success)return t.data;throw t.error}async safeParseAsync(e,r){let t={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ua(e)},s=this._parse({data:e,path:t.path,parent:t}),i=await(Ji(s)?s:Promise.resolve(s));return XE(t,i)}refine(e,r){let t=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,i)=>{let n=e(s),o=()=>i.addIssue({code:te.custom,...t(s)});return typeof Promise<"u"&&n instanceof Promise?n.then(l=>l?!0:(o(),!1)):n?!0:(o(),!1)})}refinement(e,r){return this._refinement((t,s)=>e(t)?!0:(s.addIssue(typeof r=="function"?r(t,s):r),!1))}_refinement(e){return new tr({schema:this,typeName:Ce.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:r=>this["~validate"](r)}}optional(){return gr.create(this,this._def)}nullable(){return Kr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return fa.create(this)}promise(){return Fa.create(this,this._def)}or(e){return js.create([this,e],this._def)}and(e){return $s.create(this,e,this._def)}transform(e){return new tr({...Fe(this._def),schema:this,typeName:Ce.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Us({...Fe(this._def),innerType:this,defaultValue:r,typeName:Ce.ZodDefault})}brand(){return new eo({typeName:Ce.ZodBranded,type:this,...Fe(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Hs({...Fe(this._def),innerType:this,catchValue:r,typeName:Ce.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return to.create(this,e)}readonly(){return Bs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},YM=/^c[^\s-]{8,}$/i,JM=/^[0-9a-z]+$/,eL=/^[0-9A-HJKMNP-TV-Z]{26}$/i,tL=/^[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,rL=/^[a-z0-9_-]{21}$/i,aL=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,sL=/^[-+]?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)?)??$/,nL=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,iL="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",pf,oL=/^(?:(?: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])$/,cL=/^(?:(?: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])$/,lL=/^(([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]))$/,uL=/^(([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])$/,pL=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dL=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Rw="((\\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])))",fL=new RegExp(`^${Rw}$`);function Pw(a){let e="[0-5]\\d";a.precision?e=`${e}\\.\\d{${a.precision}}`:a.precision==null&&(e=`${e}(\\.\\d+)?`);let r=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function mL(a){return new RegExp(`^${Pw(a)}$`)}function Ow(a){let e=`${Rw}T${Pw(a)}`,r=[];return r.push(a.local?"Z?":"Z"),a.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function hL(a,e){return!!((e==="v4"||!e)&&oL.test(a)||(e==="v6"||!e)&&lL.test(a))}function vL(a,e){if(!aL.test(a))return!1;try{let[r]=a.split(".");if(!r)return!1;let t=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.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 gL(a,e){return!!((e==="v4"||!e)&&cL.test(a)||(e==="v6"||!e)&&uL.test(a))}var Ma=class a extends $e{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==de.string){let i=this._getOrReturnCtx(e);return ce(i,{code:te.invalid_type,expected:de.string,received:i.parsedType}),Pe}let t=new At,s;for(let i of this._def.checks)if(i.kind==="min")e.data.lengthi.value&&(s=this._getOrReturnCtx(e,s),ce(s,{code:te.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:r,code:te.invalid_string,...ye.errToObj(t)})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ye.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ye.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ye.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ye.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ye.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ye.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ye.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ye.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ye.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ye.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ye.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ye.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ye.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,...ye.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,...ye.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...ye.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...ye.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...ye.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...ye.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...ye.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...ye.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...ye.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...ye.errToObj(r)})}nonempty(e){return this.min(1,ye.errToObj(e))}trim(){return new a({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new a({...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 r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Ma({checks:[],typeName:Ce.ZodString,coerce:a?.coerce??!1,...Fe(a)});function yL(a,e){let r=(a.toString().split(".")[1]||"").length,t=(e.toString().split(".")[1]||"").length,s=r>t?r:t,i=Number.parseInt(a.toFixed(s).replace(".","")),n=Number.parseInt(e.toFixed(s).replace(".",""));return i%n/10**s}var Cs=class a extends $e{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)!==de.number){let i=this._getOrReturnCtx(e);return ce(i,{code:te.invalid_type,expected:de.number,received:i.parsedType}),Pe}let t,s=new At;for(let i of this._def.checks)i.kind==="int"?Ke.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),ce(t,{code:te.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),ce(t,{code:te.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?yL(e.data,i.value)!==0&&(t=this._getOrReturnCtx(e,t),ce(t,{code:te.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),ce(t,{code:te.not_finite,message:i.message}),s.dirty()):Ke.assertNever(i);return{status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,ye.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ye.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ye.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ye.toString(r))}setLimit(e,r,t,s){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:t,message:ye.toString(s)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ye.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ye.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ye.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ye.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ye.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ye.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:ye.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ye.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ye.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuee.kind==="int"||e.kind==="multipleOf"&&Ke.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let t of this._def.checks){if(t.kind==="finite"||t.kind==="int"||t.kind==="multipleOf")return!0;t.kind==="min"?(r===null||t.value>r)&&(r=t.value):t.kind==="max"&&(e===null||t.valuenew Cs({checks:[],typeName:Ce.ZodNumber,coerce:a?.coerce||!1,...Fe(a)});var ks=class a extends $e{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)!==de.bigint)return this._getInvalidInput(e);let t,s=new At;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(t=this._getOrReturnCtx(e,t),ce(t,{code:te.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),ce(t,{code:te.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):Ke.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return ce(r,{code:te.invalid_type,expected:de.bigint,received:r.parsedType}),Pe}gte(e,r){return this.setLimit("min",e,!0,ye.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ye.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ye.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ye.toString(r))}setLimit(e,r,t,s){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:t,message:ye.toString(s)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ye.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ye.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ye.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ye.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ye.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew ks({checks:[],typeName:Ce.ZodBigInt,coerce:a?.coerce??!1,...Fe(a)});var As=class extends $e{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==de.boolean){let t=this._getOrReturnCtx(e);return ce(t,{code:te.invalid_type,expected:de.boolean,received:t.parsedType}),Pe}return Nt(e.data)}};As.create=a=>new As({typeName:Ce.ZodBoolean,coerce:a?.coerce||!1,...Fe(a)});var Is=class a extends $e{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==de.date){let i=this._getOrReturnCtx(e);return ce(i,{code:te.invalid_type,expected:de.date,received:i.parsedType}),Pe}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return ce(i,{code:te.invalid_date}),Pe}let t=new At,s;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()i.value&&(s=this._getOrReturnCtx(e,s),ce(s,{code:te.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),t.dirty()):Ke.assertNever(i);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:ye.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:ye.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Is({checks:[],coerce:a?.coerce||!1,typeName:Ce.ZodDate,...Fe(a)});var Bn=class extends $e{_parse(e){if(this._getType(e)!==de.symbol){let t=this._getOrReturnCtx(e);return ce(t,{code:te.invalid_type,expected:de.symbol,received:t.parsedType}),Pe}return Nt(e.data)}};Bn.create=a=>new Bn({typeName:Ce.ZodSymbol,...Fe(a)});var Ds=class extends $e{_parse(e){if(this._getType(e)!==de.undefined){let t=this._getOrReturnCtx(e);return ce(t,{code:te.invalid_type,expected:de.undefined,received:t.parsedType}),Pe}return Nt(e.data)}};Ds.create=a=>new Ds({typeName:Ce.ZodUndefined,...Fe(a)});var Ns=class extends $e{_parse(e){if(this._getType(e)!==de.null){let t=this._getOrReturnCtx(e);return ce(t,{code:te.invalid_type,expected:de.null,received:t.parsedType}),Pe}return Nt(e.data)}};Ns.create=a=>new Ns({typeName:Ce.ZodNull,...Fe(a)});var La=class extends $e{constructor(){super(...arguments),this._any=!0}_parse(e){return Nt(e.data)}};La.create=a=>new La({typeName:Ce.ZodAny,...Fe(a)});var da=class extends $e{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Nt(e.data)}};da.create=a=>new da({typeName:Ce.ZodUnknown,...Fe(a)});var Dr=class extends $e{_parse(e){let r=this._getOrReturnCtx(e);return ce(r,{code:te.invalid_type,expected:de.never,received:r.parsedType}),Pe}};Dr.create=a=>new Dr({typeName:Ce.ZodNever,...Fe(a)});var zn=class extends $e{_parse(e){if(this._getType(e)!==de.undefined){let t=this._getOrReturnCtx(e);return ce(t,{code:te.invalid_type,expected:de.void,received:t.parsedType}),Pe}return Nt(e.data)}};zn.create=a=>new zn({typeName:Ce.ZodVoid,...Fe(a)});var fa=class a extends $e{_parse(e){let{ctx:r,status:t}=this._processInputParams(e),s=this._def;if(r.parsedType!==de.array)return ce(r,{code:te.invalid_type,expected:de.array,received:r.parsedType}),Pe;if(s.exactLength!==null){let n=r.data.length>s.exactLength.value,o=r.data.lengths.maxLength.value&&(ce(r,{code:te.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),t.dirty()),r.common.async)return Promise.all([...r.data].map((n,o)=>s.type._parseAsync(new yr(r,n,r.path,o)))).then(n=>At.mergeArray(t,n));let i=[...r.data].map((n,o)=>s.type._parseSync(new yr(r,n,r.path,o)));return At.mergeArray(t,i)}get element(){return this._def.type}min(e,r){return new a({...this._def,minLength:{value:e,message:ye.toString(r)}})}max(e,r){return new a({...this._def,maxLength:{value:e,message:ye.toString(r)}})}length(e,r){return new a({...this._def,exactLength:{value:e,message:ye.toString(r)}})}nonempty(e){return this.min(1,e)}};fa.create=(a,e)=>new fa({type:a,minLength:null,maxLength:null,exactLength:null,typeName:Ce.ZodArray,...Fe(e)});function qn(a){if(a instanceof Wt){let e={};for(let r in a.shape){let t=a.shape[r];e[r]=gr.create(qn(t))}return new Wt({...a._def,shape:()=>e})}else return a instanceof fa?new fa({...a._def,type:qn(a.element)}):a instanceof gr?gr.create(qn(a.unwrap())):a instanceof Kr?Kr.create(qn(a.unwrap())):a instanceof Zr?Zr.create(a.items.map(e=>qn(e))):a}var Wt=class a extends $e{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(),r=Ke.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==de.object){let c=this._getOrReturnCtx(e);return ce(c,{code:te.invalid_type,expected:de.object,received:c.parsedType}),Pe}let{status:t,ctx:s}=this._processInputParams(e),{shape:i,keys:n}=this._getCached(),o=[];if(!(this._def.catchall instanceof Dr&&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],p=s.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new yr(s,p,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof Dr){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&&(ce(s,{code:te.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 p=s.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new yr(s,p,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let p=await u.key,f=await u.value;c.push({key:p,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>At.mergeObjectSync(t,c)):At.mergeObjectSync(t,l)}get shape(){return this._def.shape()}strict(e){return ye.errToObj,new a({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,t)=>{let s=this._def.errorMap?.(r,t).message??t.defaultError;return r.code==="unrecognized_keys"?{message:ye.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new a({...this._def,unknownKeys:"strip"})}passthrough(){return new a({...this._def,unknownKeys:"passthrough"})}extend(e){return new a({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new a({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ce.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new a({...this._def,catchall:e})}pick(e){let r={};for(let t of Ke.objectKeys(e))e[t]&&this.shape[t]&&(r[t]=this.shape[t]);return new a({...this._def,shape:()=>r})}omit(e){let r={};for(let t of Ke.objectKeys(this.shape))e[t]||(r[t]=this.shape[t]);return new a({...this._def,shape:()=>r})}deepPartial(){return qn(this)}partial(e){let r={};for(let t of Ke.objectKeys(this.shape)){let s=this.shape[t];e&&!e[t]?r[t]=s:r[t]=s.optional()}return new a({...this._def,shape:()=>r})}required(e){let r={};for(let t of Ke.objectKeys(this.shape))if(e&&!e[t])r[t]=this.shape[t];else{let i=this.shape[t];for(;i instanceof gr;)i=i._def.innerType;r[t]=i}return new a({...this._def,shape:()=>r})}keyof(){return Cw(Ke.objectKeys(this.shape))}};Wt.create=(a,e)=>new Wt({shape:()=>a,unknownKeys:"strip",catchall:Dr.create(),typeName:Ce.ZodObject,...Fe(e)});Wt.strictCreate=(a,e)=>new Wt({shape:()=>a,unknownKeys:"strict",catchall:Dr.create(),typeName:Ce.ZodObject,...Fe(e)});Wt.lazycreate=(a,e)=>new Wt({shape:a,unknownKeys:"strip",catchall:Dr.create(),typeName:Ce.ZodObject,...Fe(e)});var js=class extends $e{_parse(e){let{ctx:r}=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 r.common.issues.push(...o.ctx.common.issues),o.result;let n=i.map(o=>new er(o.ctx.common.issues));return ce(r,{code:te.invalid_union,unionErrors:n}),Pe}if(r.common.async)return Promise.all(t.map(async i=>{let n={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:n}),ctx:n}})).then(s);{let i,n=[];for(let l of t){let c={...r,common:{...r.common,issues:[]},parent:null},u=l._parseSync({data:r.data,path:r.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 r.common.issues.push(...i.ctx.common.issues),i.result;let o=n.map(l=>new er(l));return ce(r,{code:te.invalid_union,unionErrors:o}),Pe}}get options(){return this._def.options}};js.create=(a,e)=>new js({options:a,typeName:Ce.ZodUnion,...Fe(e)});var la=a=>a instanceof Ms?la(a.schema):a instanceof tr?la(a.innerType()):a instanceof Ls?[a.value]:a instanceof Fs?a.options:a instanceof qs?Ke.objectValues(a.enum):a instanceof Us?la(a._def.innerType):a instanceof Ds?[void 0]:a instanceof Ns?[null]:a instanceof gr?[void 0,...la(a.unwrap())]:a instanceof Kr?[null,...la(a.unwrap())]:a instanceof eo||a instanceof Bs?la(a.unwrap()):a instanceof Hs?la(a._def.innerType):[],_l=class a extends $e{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==de.object)return ce(r,{code:te.invalid_type,expected:de.object,received:r.parsedType}),Pe;let t=this.discriminator,s=r.data[t],i=this.optionsMap.get(s);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(ce(r,{code:te.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[t]}),Pe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,t){let s=new Map;for(let i of r){let n=la(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 a({typeName:Ce.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:s,...Fe(t)})}};function Sf(a,e){let r=ua(a),t=ua(e);if(a===e)return{valid:!0,data:a};if(r===de.object&&t===de.object){let s=Ke.objectKeys(e),i=Ke.objectKeys(a).filter(o=>s.indexOf(o)!==-1),n={...a,...e};for(let o of i){let l=Sf(a[o],e[o]);if(!l.valid)return{valid:!1};n[o]=l.data}return{valid:!0,data:n}}else if(r===de.array&&t===de.array){if(a.length!==e.length)return{valid:!1};let s=[];for(let i=0;i{if(xf(i)||xf(n))return Pe;let o=Sf(i.value,n.value);return o.valid?((_f(i)||_f(n))&&r.dirty(),{status:r.value,value:o.data}):(ce(t,{code:te.invalid_intersection_types}),Pe)};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}))}};$s.create=(a,e,r)=>new $s({left:a,right:e,typeName:Ce.ZodIntersection,...Fe(r)});var Zr=class a extends $e{_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.parsedType!==de.array)return ce(t,{code:te.invalid_type,expected:de.array,received:t.parsedType}),Pe;if(t.data.lengththis._def.items.length&&(ce(t,{code:te.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...t.data].map((n,o)=>{let l=this._def.items[o]||this._def.rest;return l?l._parse(new yr(t,n,t.path,o)):null}).filter(n=>!!n);return t.common.async?Promise.all(i).then(n=>At.mergeArray(r,n)):At.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new a({...this._def,rest:e})}};Zr.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Zr({items:a,typeName:Ce.ZodTuple,rest:null,...Fe(e)})};var Sl=class a extends $e{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.parsedType!==de.object)return ce(t,{code:te.invalid_type,expected:de.object,received:t.parsedType}),Pe;let s=[],i=this._def.keyType,n=this._def.valueType;for(let o in t.data)s.push({key:i._parse(new yr(t,o,t.path,o)),value:n._parse(new yr(t,t.data[o],t.path,o)),alwaysSet:o in t.data});return t.common.async?At.mergeObjectAsync(r,s):At.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(e,r,t){return r instanceof $e?new a({keyType:e,valueType:r,typeName:Ce.ZodRecord,...Fe(t)}):new a({keyType:Ma.create(),valueType:e,typeName:Ce.ZodRecord,...Fe(r)})}},Vn=class extends $e{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.parsedType!==de.map)return ce(t,{code:te.invalid_type,expected:de.map,received:t.parsedType}),Pe;let s=this._def.keyType,i=this._def.valueType,n=[...t.data.entries()].map(([o,l],c)=>({key:s._parse(new yr(t,o,t.path,[c,"key"])),value:i._parse(new yr(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 Pe;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),o.set(c.value,u.value)}return{status:r.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 Pe;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),o.set(c.value,u.value)}return{status:r.value,value:o}}}};Vn.create=(a,e,r)=>new Vn({valueType:e,keyType:a,typeName:Ce.ZodMap,...Fe(r)});var Wn=class a extends $e{_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.parsedType!==de.set)return ce(t,{code:te.invalid_type,expected:de.set,received:t.parsedType}),Pe;let s=this._def;s.minSize!==null&&t.data.sizes.maxSize.value&&(ce(t,{code:te.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());let i=this._def.valueType;function n(l){let c=new Set;for(let u of l){if(u.status==="aborted")return Pe;u.status==="dirty"&&r.dirty(),c.add(u.value)}return{status:r.value,value:c}}let o=[...t.data.values()].map((l,c)=>i._parse(new yr(t,l,t.path,c)));return t.common.async?Promise.all(o).then(l=>n(l)):n(o)}min(e,r){return new a({...this._def,minSize:{value:e,message:ye.toString(r)}})}max(e,r){return new a({...this._def,maxSize:{value:e,message:ye.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Wn.create=(a,e)=>new Wn({valueType:a,minSize:null,maxSize:null,typeName:Ce.ZodSet,...Fe(e)});var El=class a extends $e{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==de.function)return ce(r,{code:te.invalid_type,expected:de.function,received:r.parsedType}),Pe;function t(o,l){return xl({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,bl(),Hn].filter(c=>!!c),issueData:{code:te.invalid_arguments,argumentsError:l}})}function s(o,l){return xl({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,bl(),Hn].filter(c=>!!c),issueData:{code:te.invalid_return_type,returnTypeError:l}})}let i={errorMap:r.common.contextualErrorMap},n=r.data;if(this._def.returns instanceof Fa){let o=this;return Nt(async function(...l){let c=new er([]),u=await o._def.args.parseAsync(l,i).catch(d=>{throw c.addIssue(t(l,d)),c}),p=await Reflect.apply(n,this,u);return await o._def.returns._def.type.parseAsync(p,i).catch(d=>{throw c.addIssue(s(p,d)),c})})}else{let o=this;return Nt(function(...l){let c=o._def.args.safeParse(l,i);if(!c.success)throw new er([t(l,c.error)]);let u=Reflect.apply(n,this,c.data),p=o._def.returns.safeParse(u,i);if(!p.success)throw new er([s(u,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new a({...this._def,args:Zr.create(e).rest(da.create())})}returns(e){return new a({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,t){return new a({args:e||Zr.create([]).rest(da.create()),returns:r||da.create(),typeName:Ce.ZodFunction,...Fe(t)})}},Ms=class extends $e{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Ms.create=(a,e)=>new Ms({getter:a,typeName:Ce.ZodLazy,...Fe(e)});var Ls=class extends $e{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return ce(r,{received:r.data,code:te.invalid_literal,expected:this._def.value}),Pe}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ls.create=(a,e)=>new Ls({value:a,typeName:Ce.ZodLiteral,...Fe(e)});function Cw(a,e){return new Fs({values:a,typeName:Ce.ZodEnum,...Fe(e)})}var Fs=class a extends $e{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),t=this._def.values;return ce(r,{expected:Ke.joinValues(t),received:r.parsedType,code:te.invalid_type}),Pe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),t=this._def.values;return ce(r,{received:r.data,code:te.invalid_enum_value,options:t}),Pe}return Nt(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return a.create(e,{...this._def,...r})}exclude(e,r=this._def){return a.create(this.options.filter(t=>!e.includes(t)),{...this._def,...r})}};Fs.create=Cw;var qs=class extends $e{_parse(e){let r=Ke.getValidEnumValues(this._def.values),t=this._getOrReturnCtx(e);if(t.parsedType!==de.string&&t.parsedType!==de.number){let s=Ke.objectValues(r);return ce(t,{expected:Ke.joinValues(s),received:t.parsedType,code:te.invalid_type}),Pe}if(this._cache||(this._cache=new Set(Ke.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=Ke.objectValues(r);return ce(t,{received:t.data,code:te.invalid_enum_value,options:s}),Pe}return Nt(e.data)}get enum(){return this._def.values}};qs.create=(a,e)=>new qs({values:a,typeName:Ce.ZodNativeEnum,...Fe(e)});var Fa=class extends $e{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==de.promise&&r.common.async===!1)return ce(r,{code:te.invalid_type,expected:de.promise,received:r.parsedType}),Pe;let t=r.parsedType===de.promise?r.data:Promise.resolve(r.data);return Nt(t.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Fa.create=(a,e)=>new Fa({type:a,typeName:Ce.ZodPromise,...Fe(e)});var tr=class extends $e{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ce.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:t}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:n=>{ce(t,n),n.fatal?r.abort():r.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(r.value==="aborted")return Pe;let l=await this._def.schema._parseAsync({data:o,path:t.path,parent:t});return l.status==="aborted"?Pe:l.status==="dirty"||r.value==="dirty"?Un(l.value):l});{if(r.value==="aborted")return Pe;let o=this._def.schema._parseSync({data:n,path:t.path,parent:t});return o.status==="aborted"?Pe:o.status==="dirty"||r.value==="dirty"?Un(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"?Pe:(o.status==="dirty"&&r.dirty(),n(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:t.data,path:t.path,parent:t}).then(o=>o.status==="aborted"?Pe:(o.status==="dirty"&&r.dirty(),n(o.value).then(()=>({status:r.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(!Os(n))return Pe;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:r.value,value:o}}else return this._def.schema._parseAsync({data:t.data,path:t.path,parent:t}).then(n=>Os(n)?Promise.resolve(s.transform(n.value,i)).then(o=>({status:r.value,value:o})):Pe);Ke.assertNever(s)}};tr.create=(a,e,r)=>new tr({schema:a,typeName:Ce.ZodEffects,effect:e,...Fe(r)});tr.createWithPreprocess=(a,e,r)=>new tr({schema:e,effect:{type:"preprocess",transform:a},typeName:Ce.ZodEffects,...Fe(r)});var gr=class extends $e{_parse(e){return this._getType(e)===de.undefined?Nt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};gr.create=(a,e)=>new gr({innerType:a,typeName:Ce.ZodOptional,...Fe(e)});var Kr=class extends $e{_parse(e){return this._getType(e)===de.null?Nt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Kr.create=(a,e)=>new Kr({innerType:a,typeName:Ce.ZodNullable,...Fe(e)});var Us=class extends $e{_parse(e){let{ctx:r}=this._processInputParams(e),t=r.data;return r.parsedType===de.undefined&&(t=this._def.defaultValue()),this._def.innerType._parse({data:t,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Us.create=(a,e)=>new Us({innerType:a,typeName:Ce.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Fe(e)});var Hs=class extends $e{_parse(e){let{ctx:r}=this._processInputParams(e),t={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:t.data,path:t.path,parent:{...t}});return Ji(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new er(t.common.issues)},input:t.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new er(t.common.issues)},input:t.data})}}removeCatch(){return this._def.innerType}};Hs.create=(a,e)=>new Hs({innerType:a,typeName:Ce.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Fe(e)});var Gn=class extends $e{_parse(e){if(this._getType(e)!==de.nan){let t=this._getOrReturnCtx(e);return ce(t,{code:te.invalid_type,expected:de.nan,received:t.parsedType}),Pe}return{status:"valid",value:e.data}}};Gn.create=a=>new Gn({typeName:Ce.ZodNaN,...Fe(a)});var bL=Symbol("zod_brand"),eo=class extends $e{_parse(e){let{ctx:r}=this._processInputParams(e),t=r.data;return this._def.type._parse({data:t,path:r.path,parent:r})}unwrap(){return this._def.type}},to=class a extends $e{_parse(e){let{status:r,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"?Pe:i.status==="dirty"?(r.dirty(),Un(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"?Pe:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:t.path,parent:t})}}static create(e,r){return new a({in:e,out:r,typeName:Ce.ZodPipeline})}},Bs=class extends $e{_parse(e){let r=this._def.innerType._parse(e),t=s=>(Os(s)&&(s.value=Object.freeze(s.value)),s);return Ji(r)?r.then(s=>t(s)):t(r)}unwrap(){return this._def.innerType}};Bs.create=(a,e)=>new Bs({innerType:a,typeName:Ce.ZodReadonly,...Fe(e)});function QE(a,e){let r=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof r=="string"?{message:r}:r}function kw(a,e={},r){return a?La.create().superRefine((t,s)=>{let i=a(t);if(i instanceof Promise)return i.then(n=>{if(!n){let o=QE(e,t),l=o.fatal??r??!0;s.addIssue({code:"custom",...o,fatal:l})}});if(!i){let n=QE(e,t),o=n.fatal??r??!0;s.addIssue({code:"custom",...n,fatal:o})}}):La.create()}var xL={object:Wt.lazycreate},Ce;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(Ce||(Ce={}));var _L=(a,e={message:`Input not instance of ${a.name}`})=>kw(r=>r instanceof a,e),Aw=Ma.create,Iw=Cs.create,SL=Gn.create,EL=ks.create,Dw=As.create,wL=Is.create,TL=Bn.create,RL=Ds.create,PL=Ns.create,OL=La.create,CL=da.create,kL=Dr.create,AL=zn.create,IL=fa.create,DL=Wt.create,NL=Wt.strictCreate,jL=js.create,$L=_l.create,ML=$s.create,LL=Zr.create,FL=Sl.create,qL=Vn.create,UL=Wn.create,HL=El.create,BL=Ms.create,zL=Ls.create,VL=Fs.create,WL=qs.create,GL=Fa.create,YE=tr.create,ZL=gr.create,KL=Kr.create,XL=tr.createWithPreprocess,QL=to.create,YL=()=>Aw().optional(),JL=()=>Iw().optional(),e6=()=>Dw().optional(),t6={string:a=>Ma.create({...a,coerce:!0}),number:a=>Cs.create({...a,coerce:!0}),boolean:a=>As.create({...a,coerce:!0}),bigint:a=>ks.create({...a,coerce:!0}),date:a=>Is.create({...a,coerce:!0})},r6=Pe;var Pl="2.0",Nw=E.union([E.string(),E.number().int()]),jw=E.string(),a6=E.object({progressToken:E.optional(Nw)}).passthrough(),br=E.object({_meta:E.optional(a6)}).passthrough(),Gt=E.object({method:E.string(),params:E.optional(br)}),ao=E.object({_meta:E.optional(E.object({}).passthrough())}).passthrough(),Xr=E.object({method:E.string(),params:E.optional(ao)}),xr=E.object({_meta:E.optional(E.object({}).passthrough())}).passthrough(),Ol=E.union([E.string(),E.number().int()]),s6=E.object({jsonrpc:E.literal(Pl),id:Ol}).merge(Gt).strict();var n6=E.object({jsonrpc:E.literal(Pl)}).merge(Xr).strict();var i6=E.object({jsonrpc:E.literal(Pl),id:Ol,result:xr}).strict();var JE;(function(a){a[a.ConnectionClosed=-32e3]="ConnectionClosed",a[a.RequestTimeout=-32001]="RequestTimeout",a[a.ParseError=-32700]="ParseError",a[a.InvalidRequest=-32600]="InvalidRequest",a[a.MethodNotFound=-32601]="MethodNotFound",a[a.InvalidParams=-32602]="InvalidParams",a[a.InternalError=-32603]="InternalError"})(JE||(JE={}));var o6=E.object({jsonrpc:E.literal(Pl),id:Ol,error:E.object({code:E.number().int(),message:E.string(),data:E.optional(E.unknown())})}).strict();var lB=E.union([s6,n6,i6,o6]),$w=xr.strict(),Mw=Xr.extend({method:E.literal("notifications/cancelled"),params:ao.extend({requestId:Ol,reason:E.string().optional()})}),so=E.object({name:E.string(),title:E.optional(E.string())}).passthrough(),Lw=so.extend({version:E.string()}),c6=E.object({experimental:E.optional(E.object({}).passthrough()),sampling:E.optional(E.object({}).passthrough()),elicitation:E.optional(E.object({}).passthrough()),roots:E.optional(E.object({listChanged:E.optional(E.boolean())}).passthrough())}).passthrough(),l6=Gt.extend({method:E.literal("initialize"),params:br.extend({protocolVersion:E.string(),capabilities:c6,clientInfo:Lw})}),u6=E.object({experimental:E.optional(E.object({}).passthrough()),logging:E.optional(E.object({}).passthrough()),completions:E.optional(E.object({}).passthrough()),prompts:E.optional(E.object({listChanged:E.optional(E.boolean())}).passthrough()),resources:E.optional(E.object({subscribe:E.optional(E.boolean()),listChanged:E.optional(E.boolean())}).passthrough()),tools:E.optional(E.object({listChanged:E.optional(E.boolean())}).passthrough())}).passthrough(),p6=xr.extend({protocolVersion:E.string(),capabilities:u6,serverInfo:Lw,instructions:E.optional(E.string())}),d6=Xr.extend({method:E.literal("notifications/initialized")}),Fw=Gt.extend({method:E.literal("ping")}),f6=E.object({progress:E.number(),total:E.optional(E.number()),message:E.optional(E.string())}).passthrough(),qw=Xr.extend({method:E.literal("notifications/progress"),params:ao.merge(f6).extend({progressToken:Nw})}),Cl=Gt.extend({params:br.extend({cursor:E.optional(jw)}).optional()}),kl=xr.extend({nextCursor:E.optional(jw)}),Uw=E.object({uri:E.string(),mimeType:E.optional(E.string()),_meta:E.optional(E.object({}).passthrough())}).passthrough(),Hw=Uw.extend({text:E.string()}),Cf=E.string().refine(a=>{try{return atob(a),!0}catch{return!1}},{message:"Invalid Base64 string"}),Bw=Uw.extend({blob:Cf}),zw=so.extend({uri:E.string(),description:E.optional(E.string()),mimeType:E.optional(E.string()),_meta:E.optional(E.object({}).passthrough())}),m6=so.extend({uriTemplate:E.string(),description:E.optional(E.string()),mimeType:E.optional(E.string()),_meta:E.optional(E.object({}).passthrough())}),h6=Cl.extend({method:E.literal("resources/list")}),v6=kl.extend({resources:E.array(zw)}),g6=Cl.extend({method:E.literal("resources/templates/list")}),y6=kl.extend({resourceTemplates:E.array(m6)}),b6=Gt.extend({method:E.literal("resources/read"),params:br.extend({uri:E.string()})}),x6=xr.extend({contents:E.array(E.union([Hw,Bw]))}),_6=Xr.extend({method:E.literal("notifications/resources/list_changed")}),S6=Gt.extend({method:E.literal("resources/subscribe"),params:br.extend({uri:E.string()})}),E6=Gt.extend({method:E.literal("resources/unsubscribe"),params:br.extend({uri:E.string()})}),w6=Xr.extend({method:E.literal("notifications/resources/updated"),params:ao.extend({uri:E.string()})}),T6=E.object({name:E.string(),description:E.optional(E.string()),required:E.optional(E.boolean())}).passthrough(),R6=so.extend({description:E.optional(E.string()),arguments:E.optional(E.array(T6)),_meta:E.optional(E.object({}).passthrough())}),P6=Cl.extend({method:E.literal("prompts/list")}),O6=kl.extend({prompts:E.array(R6)}),C6=Gt.extend({method:E.literal("prompts/get"),params:br.extend({name:E.string(),arguments:E.optional(E.record(E.string()))})}),kf=E.object({type:E.literal("text"),text:E.string(),_meta:E.optional(E.object({}).passthrough())}).passthrough(),Af=E.object({type:E.literal("image"),data:Cf,mimeType:E.string(),_meta:E.optional(E.object({}).passthrough())}).passthrough(),If=E.object({type:E.literal("audio"),data:Cf,mimeType:E.string(),_meta:E.optional(E.object({}).passthrough())}).passthrough(),k6=E.object({type:E.literal("resource"),resource:E.union([Hw,Bw]),_meta:E.optional(E.object({}).passthrough())}).passthrough(),A6=zw.extend({type:E.literal("resource_link")}),Vw=E.union([kf,Af,If,A6,k6]),I6=E.object({role:E.enum(["user","assistant"]),content:Vw}).passthrough(),D6=xr.extend({description:E.optional(E.string()),messages:E.array(I6)}),N6=Xr.extend({method:E.literal("notifications/prompts/list_changed")}),j6=E.object({title:E.optional(E.string()),readOnlyHint:E.optional(E.boolean()),destructiveHint:E.optional(E.boolean()),idempotentHint:E.optional(E.boolean()),openWorldHint:E.optional(E.boolean())}).passthrough(),$6=so.extend({description:E.optional(E.string()),inputSchema:E.object({type:E.literal("object"),properties:E.optional(E.object({}).passthrough()),required:E.optional(E.array(E.string()))}).passthrough(),outputSchema:E.optional(E.object({type:E.literal("object"),properties:E.optional(E.object({}).passthrough()),required:E.optional(E.array(E.string()))}).passthrough()),annotations:E.optional(j6),_meta:E.optional(E.object({}).passthrough())}),M6=Cl.extend({method:E.literal("tools/list")}),L6=kl.extend({tools:E.array($6)}),Ww=xr.extend({content:E.array(Vw).default([]),structuredContent:E.object({}).passthrough().optional(),isError:E.optional(E.boolean())}),uB=Ww.or(xr.extend({toolResult:E.unknown()})),F6=Gt.extend({method:E.literal("tools/call"),params:br.extend({name:E.string(),arguments:E.optional(E.record(E.unknown()))})}),q6=Xr.extend({method:E.literal("notifications/tools/list_changed")}),Gw=E.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),U6=Gt.extend({method:E.literal("logging/setLevel"),params:br.extend({level:Gw})}),H6=Xr.extend({method:E.literal("notifications/message"),params:ao.extend({level:Gw,logger:E.optional(E.string()),data:E.unknown()})}),B6=E.object({name:E.string().optional()}).passthrough(),z6=E.object({hints:E.optional(E.array(B6)),costPriority:E.optional(E.number().min(0).max(1)),speedPriority:E.optional(E.number().min(0).max(1)),intelligencePriority:E.optional(E.number().min(0).max(1))}).passthrough(),V6=E.object({role:E.enum(["user","assistant"]),content:E.union([kf,Af,If])}).passthrough(),W6=Gt.extend({method:E.literal("sampling/createMessage"),params:br.extend({messages:E.array(V6),systemPrompt:E.optional(E.string()),includeContext:E.optional(E.enum(["none","thisServer","allServers"])),temperature:E.optional(E.number()),maxTokens:E.number().int(),stopSequences:E.optional(E.array(E.string())),metadata:E.optional(E.object({}).passthrough()),modelPreferences:E.optional(z6)})}),G6=xr.extend({model:E.string(),stopReason:E.optional(E.enum(["endTurn","stopSequence","maxTokens"]).or(E.string())),role:E.enum(["user","assistant"]),content:E.discriminatedUnion("type",[kf,Af,If])}),Z6=E.object({type:E.literal("boolean"),title:E.optional(E.string()),description:E.optional(E.string()),default:E.optional(E.boolean())}).passthrough(),K6=E.object({type:E.literal("string"),title:E.optional(E.string()),description:E.optional(E.string()),minLength:E.optional(E.number()),maxLength:E.optional(E.number()),format:E.optional(E.enum(["email","uri","date","date-time"]))}).passthrough(),X6=E.object({type:E.enum(["number","integer"]),title:E.optional(E.string()),description:E.optional(E.string()),minimum:E.optional(E.number()),maximum:E.optional(E.number())}).passthrough(),Q6=E.object({type:E.literal("string"),title:E.optional(E.string()),description:E.optional(E.string()),enum:E.array(E.string()),enumNames:E.optional(E.array(E.string()))}).passthrough(),Y6=E.union([Z6,K6,X6,Q6]),J6=Gt.extend({method:E.literal("elicitation/create"),params:br.extend({message:E.string(),requestedSchema:E.object({type:E.literal("object"),properties:E.record(E.string(),Y6),required:E.optional(E.array(E.string()))}).passthrough()})}),e5=xr.extend({action:E.enum(["accept","decline","cancel"]),content:E.optional(E.record(E.string(),E.unknown()))}),t5=E.object({type:E.literal("ref/resource"),uri:E.string()}).passthrough(),r5=E.object({type:E.literal("ref/prompt"),name:E.string()}).passthrough(),a5=Gt.extend({method:E.literal("completion/complete"),params:br.extend({ref:E.union([r5,t5]),argument:E.object({name:E.string(),value:E.string()}).passthrough(),context:E.optional(E.object({arguments:E.optional(E.record(E.string(),E.string()))}))})}),s5=xr.extend({completion:E.object({values:E.array(E.string()).max(100),total:E.optional(E.number().int()),hasMore:E.optional(E.boolean())}).passthrough()}),n5=E.object({uri:E.string().startsWith("file://"),name:E.optional(E.string()),_meta:E.optional(E.object({}).passthrough())}).passthrough(),i5=Gt.extend({method:E.literal("roots/list")}),o5=xr.extend({roots:E.array(n5)}),c5=Xr.extend({method:E.literal("notifications/roots/list_changed")}),pB=E.union([Fw,l6,a5,U6,C6,P6,h6,g6,b6,S6,E6,F6,M6]),dB=E.union([Mw,qw,d6,c5]),fB=E.union([$w,G6,e5,o5]),mB=E.union([Fw,W6,J6,i5]),hB=E.union([Mw,qw,H6,w6,_6,q6,N6]),vB=E.union([$w,p6,s5,D6,O6,v6,y6,x6,Ww,L6]);var gB=a8(L8(),1);var yB=Symbol("Let zodToJsonSchema decide on which parser to use");var bB=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var Ef;(function(a){a.Completable="McpCompletable"})(Ef||(Ef={}));var wl=class extends $e{_parse(e){let{ctx:r}=this._processInputParams(e),t=r.data;return this._def.type._parse({data:t,path:r.path,parent:r})}unwrap(){return this._def.type}};wl.create=(a,e)=>new wl({type:a,typeName:Ef.Completable,complete:e.complete,...l5(e)});function l5(a){if(!a)return{};let{errorMap:e,invalid_type_error:r,required_error:t,description:s}=a;if(e&&(r||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}=a;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??r)!==null&&c!==void 0?c:o.defaultError}},description:s}}function Zw({prompt:a,options:e}){let{systemPrompt:r,settingSources:t,sandbox:s,...i}=e??{},n,o;r===void 0?n="":typeof r=="string"?n=r:r.type==="preset"&&(o=r.append);let l=i.pathToClaudeCodeExecutable;if(!l){let ge=(0,sw.fileURLToPath)(u5.url),oe=(0,ff.join)(ge,"..");l=(0,ff.join)(oe,"cli.js")}process.env.CLAUDE_AGENT_SDK_VERSION="0.1.67";let{abortController:c=iw(),additionalDirectories:u=[],agents:p,allowedTools:f=[],betas:d,canUseTool:v,continue:h,cwd:m,disallowedTools:y=[],tools:g,env:b,executable:R=Sw()?"bun":"node",executableArgs:w=[],extraArgs:T={},fallbackModel:k,enableFileCheckpointing:D,forkSession:A,hooks:$,includePartialMessages:N,persistSession:C,maxThinkingTokens:O,maxTurns:j,maxBudgetUsd:M,mcpServers:z,model:V,outputFormat:X,permissionMode:Z="default",allowDangerouslySkipPermissions:K=!1,permissionPromptToolName:ae,plugins:J,resume:we,resumeSessionAt:fe,stderr:De,strictMcpConfig:Ee}=i,Ne=X?.type==="json_schema"?X.schema:void 0,H=b;if(H||(H={...process.env}),H.CLAUDE_CODE_ENTRYPOINT||(H.CLAUDE_CODE_ENTRYPOINT="sdk-ts"),D&&(H.CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING="true"),!l)throw new Error("pathToClaudeCodeExecutable is required");let W={},re=new Map;if(z)for(let[ge,oe]of Object.entries(z))oe.type==="sdk"&&"instance"in oe?(re.set(ge,oe.instance),W[ge]={type:"sdk",name:ge}):W[ge]=oe;let ue=typeof a=="string",G=new hf({abortController:c,additionalDirectories:u,betas:d,cwd:m,executable:R,executableArgs:w,extraArgs:T,pathToClaudeCodeExecutable:l,env:H,forkSession:A,stderr:De,maxThinkingTokens:O,maxTurns:j,maxBudgetUsd:M,model:V,fallbackModel:k,jsonSchema:Ne,permissionMode:Z,allowDangerouslySkipPermissions:K,permissionPromptToolName:ae,continueConversation:h,resume:we,resumeSessionAt:fe,settingSources:t??[],allowedTools:f,disallowedTools:y,tools:g,mcpServers:W,strictMcpConfig:Ee,canUseTool:!!v,hooks:!!$,includePartialMessages:N,persistSession:C,plugins:J,sandbox:s,spawnClaudeCodeProcess:i.spawnClaudeCodeProcess}),Q={systemPrompt:n,appendSystemPrompt:o,agents:p},ne=new yf(G,ue,v,$,c,re,Ne,Q);return typeof a=="string"?(G.write(JSON.stringify({type:"user",session_id:"",message:{role:"user",content:[{type:"text",text:a}]},parent_tool_use_id:null})+` `),ne.handleSingleTurnInputComplete()):ne.streamInput(a),ne}var Al=class{dbManager;sessionManager;constructor(e,r){this.dbManager=e,this.sessionManager=r}async startSession(e,r){try{let t=this.findClaudeExecutable(),s=this.getModelId(),i=["Bash","Read","Write","Edit","Grep","Glob","WebFetch","WebSearch","Task","NotebookEdit","AskUserQuestion","TodoWrite"],n=this.createMessageGenerator(e),o=Zw({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,p=Array.isArray(u)?u.filter(m=>m.type==="text").map(m=>m.text).join(` `):typeof u=="string"?u:"",f=p.length,d=e.cumulativeInputTokens+e.cumulativeOutputTokens,v=c.message.usage;v&&(e.cumulativeInputTokens+=v.input_tokens||0,e.cumulativeOutputTokens+=v.output_tokens||0,v.cache_creation_input_tokens&&(e.cumulativeInputTokens+=v.cache_creation_input_tokens),q.debug("SDK","Token usage captured",{sessionId:e.sessionDbId,inputTokens:v.input_tokens,outputTokens:v.output_tokens,cacheCreation:v.cache_creation_input_tokens||0,cacheRead:v.cache_read_input_tokens||0,cumulativeInput:e.cumulativeInputTokens,cumulativeOutput:e.cumulativeOutputTokens}));let h=e.cumulativeInputTokens+e.cumulativeOutputTokens-d;if(f>0){let m=f>100?p.substring(0,100)+"...":p;q.dataOut("SDK",`Response received (${f} chars)`,{sessionId:e.sessionDbId,promptNumber:e.lastPromptNumber},m),await this.processSDKResponse(e,p,r,h)}}c.type==="result"&&c.subtype}let l=Date.now()-e.startTime;q.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"?q.warn("SDK","Agent aborted",{sessionId:e.sessionDbId}):q.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:e.lastPromptNumber===1?jE(e.project,e.claudeSessionId,e.userPrompt):LE(e.userPrompt,e.lastPromptNumber,e.claudeSessionId)},session_id:e.claudeSessionId,parent_tool_use_id:null,isSynthetic:!0};for await(let r of this.sessionManager.getMessageIterator(e.sessionDbId))r.type==="observation"?(r.prompt_number!==void 0&&(e.lastPromptNumber=r.prompt_number),yield{type:"user",message:{role:"user",content:$E({id:0,tool_name:r.tool_name,tool_input:JSON.stringify(r.tool_input),tool_output:JSON.stringify(r.tool_response),created_at_epoch:Date.now(),cwd:r.cwd})},session_id:e.claudeSessionId,parent_tool_use_id:null,isSynthetic:!0}):r.type==="summarize"&&(yield{type:"user",message:{role:"user",content:ME({id:e.sessionDbId,sdk_session_id:e.sdkSessionId,project:e.project,user_prompt:e.userPrompt,last_user_message:r.last_user_message||"",last_assistant_message:r.last_assistant_message||""})},session_id:e.claudeSessionId,parent_tool_use_id:null,isSynthetic:!0})}async processSDKResponse(e,r,t,s){let i=DE(r,e.claudeSessionId);for(let o of i){let{id:l,createdAtEpoch:c}=this.dbManager.getSessionStore().storeObservation(e.claudeSessionId,e.project,o,e.lastPromptNumber,s);q.info("SDK","Observation saved",{sessionId:e.sessionDbId,obsId:l,type:o.type,title:o.title||"(untitled)",filesRead:o.files_read?.length??0,filesModified:o.files_modified?.length??0,concepts:o.concepts?.length??0});let u=Date.now(),p=o.type,f=o.title||"(untitled)";this.dbManager.getChromaSync().syncObservation(l,e.claudeSessionId,e.project,o,e.lastPromptNumber,c,s).then(()=>{let d=Date.now()-u;q.debug("CHROMA","Observation synced",{obsId:l,duration:`${d}ms`,type:p,title:f})}).catch(d=>{q.error("CHROMA","Failed to sync observation",{obsId:l,sessionId:e.sessionDbId,type:p,title:f},d)}),t&&t.sseBroadcaster&&t.sseBroadcaster.broadcast({type:"new_observation",observation:{id:l,sdk_session_id:e.sdkSessionId,session_id:e.claudeSessionId,type:o.type,title:o.title,subtitle:o.subtitle,text:o.text||null,narrative:o.narrative||null,facts:JSON.stringify(o.facts||[]),concepts:JSON.stringify(o.concepts||[]),files_read:JSON.stringify(o.files||[]),files_modified:JSON.stringify([]),project:e.project,prompt_number:e.lastPromptNumber,created_at_epoch:c}})}let n=NE(r,e.sessionDbId);if(n){let{id:o,createdAtEpoch:l}=this.dbManager.getSessionStore().storeSummary(e.claudeSessionId,e.project,n,e.lastPromptNumber,s);q.info("SDK","Summary saved",{sessionId:e.sessionDbId,summaryId:o,request:n.request||"(no request)",hasCompleted:!!n.completed,hasNextSteps:!!n.next_steps});let c=Date.now(),u=n.request||"(no request)";this.dbManager.getChromaSync().syncSummary(o,e.claudeSessionId,e.project,n,e.lastPromptNumber,l,s).then(()=>{let p=Date.now()-c;q.debug("CHROMA","Summary synced",{summaryId:o,duration:`${p}ms`,request:u})}).catch(p=>{q.error("CHROMA","Failed to sync summary",{summaryId:o,sessionId:e.sessionDbId,request:u},p)}),t&&t.sseBroadcaster&&t.sseBroadcaster.broadcast({type:"new_summary",summary:{id:o,session_id:e.claudeSessionId,request:n.request,investigated:n.investigated,learned:n.learned,completed:n.completed,next_steps:n.next_steps,notes:n.notes,project:e.project,prompt_number:e.lastPromptNumber,created_at_epoch:l}})}t&&typeof t.broadcastProcessingStatus=="function"&&t.broadcastProcessingStatus()}findClaudeExecutable(){let r=lt.loadFromFile(Ln).CLAUDE_CODE_PATH||(0,Kw.execSync)(process.platform==="win32"?"where claude":"which claude",{encoding:"utf8",windowsHide:!0}).trim().split(` `)[0].trim();if(!r)throw new Error("Claude executable not found in PATH");return r}getModelId(){let e=Qw.default.join((0,Xw.homedir)(),".claude-mem","settings.json");return lt.loadFromFile(e).CLAUDE_MEM_MODEL}};var Il=class{dbManager;constructor(e){this.dbManager=e}stripProjectPath(e,r){let t=`/${r}/`,s=e.indexOf(t);return s!==-1?e.substring(s+t.length):e}stripProjectPaths(e,r){if(!e)return e;try{let s=JSON.parse(e).map(i=>this.stripProjectPath(i,r));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,r,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,r,t);return{...s,items:s.items.map(i=>this.sanitizeObservation(i))}}getSummaries(e,r,t){let s=this.dbManager.getSessionStore().db,i=` @@ -962,7 +962,7 @@ MEMORY PROCESSING CONTINUED INSERT OR REPLACE INTO viewer_settings (key, value) VALUES (?, ?) `);for(let[s,i]of Object.entries(e))t.run(s,JSON.stringify(i));return this.getSettings()}};var t1=require("path");yt();$f();var Nl=class{constructor(e,r,t,s,i){this.sessionSearch=e;this.sessionStore=r;this.chromaSync=t;this.formatter=s;this.timelineService=i}async queryChroma(e,r,t){return await this.chromaSync.queryChroma(e,r,t)}normalizeParams(e){let r={...e};return r.concepts&&typeof r.concepts=="string"&&(r.concepts=r.concepts.split(",").map(t=>t.trim()).filter(Boolean)),r.files&&typeof r.files=="string"&&(r.files=r.files.split(",").map(t=>t.trim()).filter(Boolean)),r.obs_type&&typeof r.obs_type=="string"&&(r.obs_type=r.obs_type.split(",").map(t=>t.trim()).filter(Boolean)),r.type&&typeof r.type=="string"&&r.type.includes(",")&&(r.type=r.type.split(",").map(t=>t.trim()).filter(Boolean)),(r.dateStart||r.dateEnd)&&(r.dateRange={start:r.dateStart,end:r.dateEnd},delete r.dateStart,delete r.dateEnd),r}async search(e){try{let r=this.normalizeParams(e),{query:t,type:s,obs_type:i,concepts:n,files:o,...l}=r,c=[],u=[],p=[],f=!s||s==="observations",d=!s||s==="sessions",v=!s||s==="prompts";if(t)if(this.chromaSync){let w=!1;try{q.debug("SEARCH","Using ChromaDB semantic search",{typeFilter:s||"all"});let T;s==="observations"?T={doc_type:"observation"}:s==="sessions"?T={doc_type:"session_summary"}:s==="prompts"&&(T={doc_type:"user_prompt"});let k=await this.queryChroma(t,100,T);if(w=!0,q.debug("SEARCH","ChromaDB returned semantic matches",{matchCount:k.ids.length}),k.ids.length>0){let D=Date.now()-7776e6,A=k.metadatas.map((O,j)=>({id:k.ids[j],meta:O,isRecent:O&&O.created_at_epoch>D})).filter(O=>O.isRecent);q.debug("SEARCH","Results within 90-day window",{count:A.length});let $=[],N=[],C=[];for(let O of A){let j=O.meta?.doc_type;j==="observation"&&f?$.push(O.id):j==="session_summary"&&d?N.push(O.id):j==="user_prompt"&&v&&C.push(O.id)}if(q.debug("SEARCH","Categorized results by type",{observations:$.length,sessions:N.length,prompts:C.length}),$.length>0){let O={...l,type:i,concepts:n,files:o};c=this.sessionStore.getObservationsByIds($,O)}N.length>0&&(u=this.sessionStore.getSessionSummariesByIds(N,{orderBy:"date_desc",limit:l.limit,project:l.project})),C.length>0&&(p=this.sessionStore.getUserPromptsByIds(C,{orderBy:"date_desc",limit:l.limit,project:l.project})),q.debug("SEARCH","Hydrated results from SQLite",{observations:c.length,sessions:u.length,prompts:p.length})}else q.debug("SEARCH","ChromaDB found no matches (final result, no FTS5 fallback)",{})}catch(T){q.debug("SEARCH","ChromaDB failed - returning empty results (FTS5 fallback removed)",{error:T.message}),q.debug("SEARCH","Install UVX/Python to enable vector search",{url:"https://docs.astral.sh/uv/getting-started/installation/"}),c=[],u=[],p=[]}}else q.debug("SEARCH","ChromaDB not initialized - returning empty results (FTS5 fallback removed)",{}),q.debug("SEARCH","Install UVX/Python to enable vector search",{url:"https://docs.astral.sh/uv/getting-started/installation/"}),c=[],u=[],p=[];else{q.debug("SEARCH","Filter-only query (no query text), using direct SQLite filtering",{enablesDateFilters:!0});let w={...l,type:i,concepts:n,files:o};f&&(c=this.sessionSearch.searchObservations(void 0,w)),d&&(u=this.sessionSearch.searchSessions(void 0,l)),v&&(p=this.sessionSearch.searchUserPrompts(void 0,l))}let h=c.length+u.length+p.length;if(h===0)return{content:[{type:"text",text:`No results found matching "${t}"`}]};let m=[...c.map(w=>({type:"observation",data:w,epoch:w.created_at_epoch,created_at:w.created_at})),...u.map(w=>({type:"session",data:w,epoch:w.created_at_epoch,created_at:w.created_at})),...p.map(w=>({type:"prompt",data:w,epoch:w.created_at_epoch,created_at:w.created_at}))];l.orderBy==="date_desc"?m.sort((w,T)=>T.epoch-w.epoch):l.orderBy==="date_asc"&&m.sort((w,T)=>w.epoch-T.epoch);let y=m.slice(0,l.limit||20),g=process.cwd(),b=e1(y,w=>w.created_at),R=[];R.push(`Found ${h} result(s) matching "${t}" (${c.length} obs, ${u.length} sessions, ${p.length} prompts)`),R.push("");for(let[w,T]of b){R.push(`### ${w}`),R.push("");let k=new Map;for(let D of T){let A="General";D.type==="observation"&&(A=zs(D.data.files_modified,g)),k.has(A)||k.set(A,[]),k.get(A).push(D)}for(let[D,A]of k){R.push(`**${D}**`),R.push(this.formatter.formatSearchTableHeader());let $="";for(let N of A)if(N.type==="observation"){let C=this.formatter.formatObservationSearchRow(N.data,$);R.push(C.row),$=C.time}else if(N.type==="session"){let C=this.formatter.formatSessionSearchRow(N.data,$);R.push(C.row),$=C.time}else{let C=this.formatter.formatUserPromptSearchRow(N.data,$);R.push(C.row),$=C.time}R.push("")}}return{content:[{type:"text",text:R.join(` -`)}]}}catch(r){return{content:[{type:"text",text:`Search failed: ${r.message}`}],isError:!0}}}async timeline(e){try{let{anchor:r,query:t,depth_before:s=10,depth_after:i=10,project:n}=e,o=process.cwd();if(!r&&!t)return{content:[{type:"text",text:'Error: Must provide either "anchor" or "query" parameter'}],isError:!0};if(r&&t)return{content:[{type:"text",text:'Error: Cannot provide both "anchor" and "query" parameters. Use one or the other.'}],isError:!0};let l,c,u;if(t){let R=[];if(this.chromaSync)try{q.debug("SEARCH","Using hybrid semantic search for timeline query",{});let T=await this.queryChroma(t,100);if(q.debug("SEARCH","Chroma returned semantic matches for timeline",{matchCount:T?.ids?.length??0}),T?.ids&&T.ids.length>0){let k=Date.now()-7776e6,D=T.ids.filter((A,$)=>{let N=T.metadatas[$];return N&&N.created_at_epoch>k});D.length>0&&(R=this.sessionStore.getObservationsByIds(D,{orderBy:"date_desc",limit:1}))}}catch(T){q.debug("SEARCH","Chroma query failed - no results (FTS5 fallback removed)",{error:T.message})}if(R.length===0)return{content:[{type:"text",text:`No observations found matching "${t}". Try a different search query.`}]};let w=R[0];l=w.id,c=w.created_at_epoch,q.debug("SEARCH","Query mode: Using observation as timeline anchor",{observationId:w.id}),u=this.sessionStore.getTimelineAroundObservation(w.id,w.created_at_epoch,s,i,n)}else if(typeof r=="number"){let R=this.sessionStore.getObservationById(r);if(!R)return{content:[{type:"text",text:`Observation #${r} not found`}],isError:!0};l=r,c=R.created_at_epoch,u=this.sessionStore.getTimelineAroundObservation(r,c,s,i,n)}else if(typeof r=="string")if(r.startsWith("S")||r.startsWith("#S")){let R=r.replace(/^#?S/,""),w=parseInt(R,10),T=this.sessionStore.getSessionSummariesByIds([w]);if(T.length===0)return{content:[{type:"text",text:`Session #${w} not found`}],isError:!0};c=T[0].created_at_epoch,l=`S${w}`,u=this.sessionStore.getTimelineAroundTimestamp(c,s,i,n)}else{let R=new Date(r);if(isNaN(R.getTime()))return{content:[{type:"text",text:`Invalid timestamp: ${r}`}],isError:!0};c=R.getTime(),l=r,u=this.sessionStore.getTimelineAroundTimestamp(c,s,i,n)}else return{content:[{type:"text",text:'Invalid anchor: must be observation ID (number), session ID (e.g., "S123"), or ISO timestamp'}],isError:!0};let p=[...(u.observations||[]).map(R=>({type:"observation",data:R,epoch:R.created_at_epoch})),...(u.sessions||[]).map(R=>({type:"session",data:R,epoch:R.created_at_epoch})),...(u.prompts||[]).map(R=>({type:"prompt",data:R,epoch:R.created_at_epoch}))];p.sort((R,w)=>R.epoch-w.epoch);let f=this.timelineService.filterByDepth(p,l,c,s,i);if(!f||f.length===0)return{content:[{type:"text",text:t?`Found observation matching "${t}", but no timeline context available (${s} records before, ${i} records after).`:`No context found around anchor (${s} records before, ${i} records after)`}]};let d=R=>new Date(R).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric"}),v=R=>new Date(R).toLocaleString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),h=R=>new Date(R).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",hour12:!0}),m=R=>R?Math.ceil(R.length/4):0,y=[];if(t){let R=f.find(T=>T.type==="observation"&&T.data.id===l),w=R&&R.type==="observation"?R.data.title||"Untitled":"Unknown";y.push(`# Timeline for query: "${t}"`),y.push(`**Anchor:** Observation #${l} - ${w}`)}else y.push(`# Timeline around anchor: ${l}`);y.push(`**Window:** ${s} records before \u2192 ${i} records after | **Items:** ${f?.length??0}`),y.push("");let g=new Map;for(let R of f){let w=d(R.epoch);g.has(w)||g.set(w,[]),g.get(w).push(R)}let b=Array.from(g.entries()).sort((R,w)=>{let T=new Date(R[0]).getTime(),k=new Date(w[0]).getTime();return T-k});for(let[R,w]of b){y.push(`### ${R}`),y.push("");let T=null,k="",D=!1;for(let A of w){let $=typeof l=="number"&&A.type==="observation"&&A.data.id===l||typeof l=="string"&&l.startsWith("S")&&A.type==="session"&&`S${A.data.id}`===l;if(A.type==="session"){D&&(y.push(""),D=!1,T=null,k="");let N=A.data,C=N.request||"Session summary",O=`claude-mem://session-summary/${N.id}`,j=$?" \u2190 **ANCHOR**":"";y.push(`**\u{1F3AF} #S${N.id}** ${C} (${h(A.epoch)}) [\u2192](${O})${j}`),y.push("")}else if(A.type==="prompt"){D&&(y.push(""),D=!1,T=null,k="");let N=A.data,C=N.prompt_text.length>100?N.prompt_text.substring(0,100)+"...":N.prompt_text;y.push(`**\u{1F4AC} User Prompt #${N.prompt_number}** (${h(A.epoch)})`),y.push(`> ${C}`),y.push("")}else if(A.type==="observation"){let N=A.data,C=zs(N.files_modified,o);C!==T&&(D&&y.push(""),y.push(`**${C}**`),y.push("| ID | Time | T | Title | Tokens |"),y.push("|----|------|---|-------|--------|"),T=C,D=!0,k="");let O="\u2022";switch(N.type){case"bugfix":O="\u{1F534}";break;case"feature":O="\u{1F7E3}";break;case"refactor":O="\u{1F504}";break;case"change":O="\u2705";break;case"discovery":O="\u{1F535}";break;case"decision":O="\u{1F9E0}";break}let j=v(A.epoch),M=N.title||"Untitled",z=m(N.narrative),X=j!==k?j:"\u2033";k=j;let Z=$?" \u2190 **ANCHOR**":"";y.push(`| #${N.id} | ${X} | ${O} | ${M}${Z} | ~${z} |`)}}D&&y.push("")}return{content:[{type:"text",text:y.join(` +`)}]}}catch(r){return{content:[{type:"text",text:`Search failed: ${r.message}`}],isError:!0}}}async timeline(e){try{let{anchor:r,query:t,depth_before:s=10,depth_after:i=10,project:n}=e,o=process.cwd();if(!r&&!t)return{content:[{type:"text",text:'Error: Must provide either "anchor" or "query" parameter'}],isError:!0};if(r&&t)return{content:[{type:"text",text:'Error: Cannot provide both "anchor" and "query" parameters. Use one or the other.'}],isError:!0};let l,c,u;if(t){let R=[];if(this.chromaSync)try{q.debug("SEARCH","Using hybrid semantic search for timeline query",{});let T=await this.queryChroma(t,100);if(q.debug("SEARCH","Chroma returned semantic matches for timeline",{matchCount:T?.ids?.length??0}),T?.ids&&T.ids.length>0){let k=Date.now()-7776e6,D=T.ids.filter((A,$)=>{let N=T.metadatas[$];return N&&N.created_at_epoch>k});D.length>0&&(R=this.sessionStore.getObservationsByIds(D,{orderBy:"date_desc",limit:1}))}}catch(T){q.debug("SEARCH","Chroma query failed - no results (FTS5 fallback removed)",{error:T.message})}if(R.length===0)return{content:[{type:"text",text:`No observations found matching "${t}". Try a different search query.`}]};let w=R[0];l=w.id,c=w.created_at_epoch,q.debug("SEARCH","Query mode: Using observation as timeline anchor",{observationId:w.id}),u=this.sessionStore.getTimelineAroundObservation(w.id,w.created_at_epoch,s,i,n)}else if(typeof r=="number"){let R=this.sessionStore.getObservationById(r);if(!R)return{content:[{type:"text",text:`Observation #${r} not found`}],isError:!0};l=r,c=R.created_at_epoch,u=this.sessionStore.getTimelineAroundObservation(r,c,s,i,n)}else if(typeof r=="string")if(r.startsWith("S")||r.startsWith("#S")){let R=r.replace(/^#?S/,""),w=parseInt(R,10),T=this.sessionStore.getSessionSummariesByIds([w]);if(T.length===0)return{content:[{type:"text",text:`Session #${w} not found`}],isError:!0};c=T[0].created_at_epoch,l=`S${w}`,u=this.sessionStore.getTimelineAroundTimestamp(c,s,i,n)}else{let R=new Date(r);if(isNaN(R.getTime()))return{content:[{type:"text",text:`Invalid timestamp: ${r}`}],isError:!0};c=R.getTime(),l=r,u=this.sessionStore.getTimelineAroundTimestamp(c,s,i,n)}else return{content:[{type:"text",text:'Invalid anchor: must be observation ID (number), session ID (e.g., "S123"), or ISO timestamp'}],isError:!0};let p=[...(u.observations||[]).map(R=>({type:"observation",data:R,epoch:R.created_at_epoch})),...(u.sessions||[]).map(R=>({type:"session",data:R,epoch:R.created_at_epoch})),...(u.prompts||[]).map(R=>({type:"prompt",data:R,epoch:R.created_at_epoch}))];p.sort((R,w)=>R.epoch-w.epoch);let f=this.timelineService.filterByDepth(p,l,c,s,i);if(!f||f.length===0)return{content:[{type:"text",text:t?`Found observation matching "${t}", but no timeline context available (${s} records before, ${i} records after).`:`No context found around anchor (${s} records before, ${i} records after)`}]};let d=R=>new Date(R).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric"}),v=R=>new Date(R).toLocaleString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),h=R=>new Date(R).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",hour12:!0}),m=R=>R?Math.ceil(R.length/4):0,y=[];if(t){let R=f.find(T=>T.type==="observation"&&T.data.id===l),w=R&&R.type==="observation"?R.data.title||"Untitled":"Unknown";y.push(`# Timeline for query: "${t}"`),y.push(`**Anchor:** Observation #${l} - ${w}`)}else y.push(`# Timeline around anchor: ${l}`);y.push(`**Window:** ${s} records before \u2192 ${i} records after | **Items:** ${f?.length??0}`),y.push("");let g=new Map;for(let R of f){let w=d(R.epoch);g.has(w)||g.set(w,[]),g.get(w).push(R)}let b=Array.from(g.entries()).sort((R,w)=>{let T=new Date(R[0]).getTime(),k=new Date(w[0]).getTime();return T-k});for(let[R,w]of b){y.push(`### ${R}`),y.push("");let T=null,k="",D=!1;for(let A of w){let $=typeof l=="number"&&A.type==="observation"&&A.data.id===l||typeof l=="string"&&l.startsWith("S")&&A.type==="session"&&`S${A.data.id}`===l;if(A.type==="session"){D&&(y.push(""),D=!1,T=null,k="");let N=A.data,C=N.request||"Session summary",O=$?" \u2190 **ANCHOR**":"";y.push(`**\u{1F3AF} #S${N.id}** ${C} (${h(A.epoch)})${O}`),y.push("")}else if(A.type==="prompt"){D&&(y.push(""),D=!1,T=null,k="");let N=A.data,C=N.prompt_text.length>100?N.prompt_text.substring(0,100)+"...":N.prompt_text;y.push(`**\u{1F4AC} User Prompt #${N.prompt_number}** (${h(A.epoch)})`),y.push(`> ${C}`),y.push("")}else if(A.type==="observation"){let N=A.data,C=zs(N.files_modified,o);C!==T&&(D&&y.push(""),y.push(`**${C}**`),y.push("| ID | Time | T | Title | Tokens |"),y.push("|----|------|---|-------|--------|"),T=C,D=!0,k="");let O="\u2022";switch(N.type){case"bugfix":O="\u{1F534}";break;case"feature":O="\u{1F7E3}";break;case"refactor":O="\u{1F504}";break;case"change":O="\u2705";break;case"discovery":O="\u{1F535}";break;case"decision":O="\u{1F9E0}";break}let j=v(A.epoch),M=N.title||"Untitled",z=m(N.narrative),X=j!==k?j:"\u2033";k=j;let Z=$?" \u2190 **ANCHOR**":"";y.push(`| #${N.id} | ${X} | ${O} | ${M}${Z} | ~${z} |`)}}D&&y.push("")}return{content:[{type:"text",text:y.join(` `)}]}}catch(r){return{content:[{type:"text",text:`Timeline query failed: ${r.message}`}],isError:!0}}}async decisions(e){try{let r=this.normalizeParams(e),{query:t,...s}=r,i=[];if(this.chromaSync)try{if(t){q.debug("SEARCH","Using Chroma semantic search with type=decision filter",{});let c=(await this.queryChroma(t,Math.min((s.limit||20)*2,100),{type:"decision"})).ids;c.length>0&&(i=this.sessionStore.getObservationsByIds(c,{...s,type:"decision"}),i.sort((u,p)=>c.indexOf(u.id)-c.indexOf(p.id)))}else{q.debug("SEARCH","Using metadata-first + semantic ranking for decisions",{});let l=this.sessionSearch.findByType("decision",s);if(l.length>0){let c=l.map(f=>f.id),u=await this.queryChroma("decision",Math.min(c.length,100)),p=[];for(let f of u.ids)c.includes(f)&&!p.includes(f)&&p.push(f);p.length>0&&(i=this.sessionStore.getObservationsByIds(p,{limit:s.limit||20}),i.sort((f,d)=>p.indexOf(f.id)-p.indexOf(d.id)))}}}catch(l){q.debug("SEARCH","Chroma search failed, using SQLite fallback",{error:l.message})}if(i.length===0&&(i=this.sessionSearch.findByType("decision",s)),i.length===0)return{content:[{type:"text",text:"No decision observations found"}]};let n=`Found ${i.length} decision(s) ${this.formatter.formatTableHeader()}`,o=i.map((l,c)=>this.formatter.formatObservationIndex(l,c));return{content:[{type:"text",text:n+` @@ -1002,9 +1002,9 @@ ${this.formatter.formatTableHeader()}`,l=n.map((c,u)=>this.formatter.formatObser `)}]}}catch(r){return{content:[{type:"text",text:`Search failed: ${r.message}`}],isError:!0}}}async getRecentContext(e){try{let r=e.project||(0,t1.basename)(process.cwd()),t=e.limit||3,s=this.sessionStore.getRecentSessionsWithStatus(r,t);if(s.length===0)return{content:[{type:"text",text:`# Recent Session Context No previous sessions found for project "${r}".`}]};let i=[];i.push("# Recent Session Context"),i.push(""),i.push(`Showing last ${s.length} session(s) for **${r}**:`),i.push("");for(let n of s)if(n.sdk_session_id){if(i.push("---"),i.push(""),n.has_summary){let o=this.sessionStore.getSummaryForSession(n.sdk_session_id);if(o){let l=o.prompt_number?` (Prompt #${o.prompt_number})`:"";if(i.push(`**Summary${l}**`),i.push(""),o.request&&i.push(`**Request:** ${o.request}`),o.completed&&i.push(`**Completed:** ${o.completed}`),o.learned&&i.push(`**Learned:** ${o.learned}`),o.next_steps&&i.push(`**Next Steps:** ${o.next_steps}`),o.files_read)try{let u=JSON.parse(o.files_read);Array.isArray(u)&&u.length>0&&i.push(`**Files Read:** ${u.join(", ")}`)}catch{o.files_read.trim()&&i.push(`**Files Read:** ${o.files_read}`)}if(o.files_edited)try{let u=JSON.parse(o.files_edited);Array.isArray(u)&&u.length>0&&i.push(`**Files Edited:** ${u.join(", ")}`)}catch{o.files_edited.trim()&&i.push(`**Files Edited:** ${o.files_edited}`)}let c=new Date(o.created_at).toLocaleString();i.push(`**Date:** ${c}`)}}else if(n.status==="active"){i.push("**In Progress**"),i.push(""),n.user_prompt&&i.push(`**Request:** ${n.user_prompt}`);let o=this.sessionStore.getObservationsForSession(n.sdk_session_id);if(o.length>0){i.push(""),i.push(`**Observations (${o.length}):**`);for(let c of o)i.push(`- ${c.title}`)}else i.push(""),i.push("*No observations yet*");i.push(""),i.push("**Status:** Active - summary pending");let l=new Date(n.started_at).toLocaleString();i.push(`**Date:** ${l}`)}else{i.push(`**${n.status.charAt(0).toUpperCase()+n.status.slice(1)}**`),i.push(""),n.user_prompt&&i.push(`**Request:** ${n.user_prompt}`),i.push(""),i.push(`**Status:** ${n.status} - no summary available`);let o=new Date(n.started_at).toLocaleString();i.push(`**Date:** ${o}`)}i.push("")}return{content:[{type:"text",text:i.join(` -`)}]}}catch(r){return{content:[{type:"text",text:`Failed to get recent context: ${r.message}`}],isError:!0}}}async getContextTimeline(e){try{let{anchor:r,depth_before:t=10,depth_after:s=10,project:i}=e,n=process.cwd(),o,l=r,c;if(typeof r=="number"){let b=this.sessionStore.getObservationById(r);if(!b)return{content:[{type:"text",text:`Observation #${r} not found`}],isError:!0};o=b.created_at_epoch,c=this.sessionStore.getTimelineAroundObservation(r,o,t,s,i)}else if(typeof r=="string")if(r.startsWith("S")||r.startsWith("#S")){let b=r.replace(/^#?S/,""),R=parseInt(b,10),w=this.sessionStore.getSessionSummariesByIds([R]);if(w.length===0)return{content:[{type:"text",text:`Session #${R} not found`}],isError:!0};o=w[0].created_at_epoch,l=`S${R}`,c=this.sessionStore.getTimelineAroundTimestamp(o,t,s,i)}else{let b=new Date(r);if(isNaN(b.getTime()))return{content:[{type:"text",text:`Invalid timestamp: ${r}`}],isError:!0};o=b.getTime(),c=this.sessionStore.getTimelineAroundTimestamp(o,t,s,i)}else return{content:[{type:"text",text:'Invalid anchor: must be observation ID (number), session ID (e.g., "S123"), or ISO timestamp'}],isError:!0};let u=[...c.observations.map(b=>({type:"observation",data:b,epoch:b.created_at_epoch})),...c.sessions.map(b=>({type:"session",data:b,epoch:b.created_at_epoch})),...c.prompts.map(b=>({type:"prompt",data:b,epoch:b.created_at_epoch}))];u.sort((b,R)=>b.epoch-R.epoch);let p=this.timelineService.filterByDepth(u,l,o,t,s);if(!p||p.length===0)return{content:[{type:"text",text:`No context found around ${new Date(o).toLocaleString()} (${t} records before, ${s} records after)`}]};let f=b=>new Date(b).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric"}),d=b=>new Date(b).toLocaleString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),v=b=>new Date(b).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",hour12:!0}),h=b=>b?Math.ceil(b.length/4):0,m=[];m.push(`# Timeline around anchor: ${l}`),m.push(`**Window:** ${t} records before \u2192 ${s} records after | **Items:** ${p?.length??0}`),m.push("");let y=new Map;for(let b of p){let R=f(b.epoch);y.has(R)||y.set(R,[]),y.get(R).push(b)}let g=Array.from(y.entries()).sort((b,R)=>{let w=new Date(b[0]).getTime(),T=new Date(R[0]).getTime();return w-T});for(let[b,R]of g){m.push(`### ${b}`),m.push("");let w=null,T="",k=!1;for(let D of R){let A=typeof l=="number"&&D.type==="observation"&&D.data.id===l||typeof l=="string"&&l.startsWith("S")&&D.type==="session"&&`S${D.data.id}`===l;if(D.type==="session"){k&&(m.push(""),k=!1,w=null,T="");let $=D.data,N=$.request||"Session summary",C=`claude-mem://session-summary/${$.id}`,O=A?" \u2190 **ANCHOR**":"";m.push(`**\u{1F3AF} #S${$.id}** ${N} (${v(D.epoch)}) [\u2192](${C})${O}`),m.push("")}else if(D.type==="prompt"){k&&(m.push(""),k=!1,w=null,T="");let $=D.data,N=$.prompt_text.length>100?$.prompt_text.substring(0,100)+"...":$.prompt_text;m.push(`**\u{1F4AC} User Prompt #${$.prompt_number}** (${v(D.epoch)})`),m.push(`> ${N}`),m.push("")}else if(D.type==="observation"){let $=D.data,N=zs($.files_modified,n);N!==w&&(k&&m.push(""),m.push(`**${N}**`),m.push("| ID | Time | T | Title | Tokens |"),m.push("|----|------|---|-------|--------|"),w=N,k=!0,T="");let C="\u2022";switch($.type){case"bugfix":C="\u{1F534}";break;case"feature":C="\u{1F7E3}";break;case"refactor":C="\u{1F504}";break;case"change":C="\u2705";break;case"discovery":C="\u{1F535}";break;case"decision":C="\u{1F9E0}";break}let O=d(D.epoch),j=$.title||"Untitled",M=h($.narrative),V=O!==T?O:"\u2033";T=O;let X=A?" \u2190 **ANCHOR**":"";m.push(`| #${$.id} | ${V} | ${C} | ${j}${X} | ~${M} |`)}}k&&m.push("")}return{content:[{type:"text",text:m.join(` -`)}]}}catch(r){return{content:[{type:"text",text:`Timeline query failed: ${r.message}`}],isError:!0}}}async getTimelineByQuery(e){try{let{query:r,mode:t="auto",depth_before:s=10,depth_after:i=10,limit:n=5,project:o}=e,l=process.cwd(),c=[];if(this.chromaSync)try{q.debug("SEARCH","Using hybrid semantic search for timeline query",{});let u=await this.queryChroma(r,100);if(q.debug("SEARCH","Chroma returned semantic matches for timeline",{matchCount:u.ids.length}),u.ids.length>0){let p=Date.now()-7776e6,f=u.ids.filter((d,v)=>{let h=u.metadatas[v];return h&&h.created_at_epoch>p});q.debug("SEARCH","Results within 90-day window",{count:f.length}),f.length>0&&(c=this.sessionStore.getObservationsByIds(f,{orderBy:"date_desc",limit:t==="auto"?1:n}),q.debug("SEARCH","Hydrated observations from SQLite",{count:c.length}))}}catch(u){q.debug("SEARCH","Chroma query failed - no results (FTS5 fallback removed)",{error:u.message})}if(c.length===0)return{content:[{type:"text",text:`No observations found matching "${r}". Try a different search query.`}]};if(t==="interactive"){let u=[];u.push("# Timeline Anchor Search Results"),u.push(""),u.push(`Found ${c.length} observation(s) matching "${r}"`),u.push(""),u.push("To get timeline context around any of these observations, use the `get_context_timeline` tool with the observation ID as the anchor."),u.push(""),u.push(`**Top ${c.length} matches:**`),u.push("");for(let p=0;p({type:"observation",data:w,epoch:w.created_at_epoch})),...(p.sessions||[]).map(w=>({type:"session",data:w,epoch:w.created_at_epoch})),...(p.prompts||[]).map(w=>({type:"prompt",data:w,epoch:w.created_at_epoch}))];f.sort((w,T)=>w.epoch-T.epoch);let d=this.timelineService.filterByDepth(f,u.id,0,s,i);if(!d||d.length===0)return{content:[{type:"text",text:`Found observation #${u.id} matching "${r}", but no timeline context available (${s} records before, ${i} records after).`}]};let v=w=>new Date(w).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric"}),h=w=>new Date(w).toLocaleString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),m=w=>new Date(w).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",hour12:!0}),y=w=>w?Math.ceil(w.length/4):0,g=[];g.push(`# Timeline for query: "${r}"`),g.push(`**Anchor:** Observation #${u.id} - ${u.title||"Untitled"}`),g.push(`**Window:** ${s} records before \u2192 ${i} records after | **Items:** ${d?.length??0}`),g.push("");let b=new Map;for(let w of d){let T=v(w.epoch);b.has(T)||b.set(T,[]),b.get(T).push(w)}let R=Array.from(b.entries()).sort((w,T)=>{let k=new Date(w[0]).getTime(),D=new Date(T[0]).getTime();return k-D});for(let[w,T]of R){g.push(`### ${w}`),g.push("");let k=null,D="",A=!1;for(let $ of T){let N=$.type==="observation"&&$.data.id===u.id;if($.type==="session"){A&&(g.push(""),A=!1,k=null,D="");let C=$.data,O=C.request||"Session summary",j=`claude-mem://session-summary/${C.id}`;g.push(`**\u{1F3AF} #S${C.id}** ${O} (${m($.epoch)}) [\u2192](${j})`),g.push("")}else if($.type==="prompt"){A&&(g.push(""),A=!1,k=null,D="");let C=$.data,O=C.prompt_text.length>100?C.prompt_text.substring(0,100)+"...":C.prompt_text;g.push(`**\u{1F4AC} User Prompt #${C.prompt_number}** (${m($.epoch)})`),g.push(`> ${O}`),g.push("")}else if($.type==="observation"){let C=$.data,O=zs(C.files_modified,l);O!==k&&(A&&g.push(""),g.push(`**${O}**`),g.push("| ID | Time | T | Title | Tokens |"),g.push("|----|------|---|-------|--------|"),k=O,A=!0,D="");let j="\u2022";switch(C.type){case"bugfix":j="\u{1F534}";break;case"feature":j="\u{1F7E3}";break;case"refactor":j="\u{1F504}";break;case"change":j="\u2705";break;case"discovery":j="\u{1F535}";break;case"decision":j="\u{1F9E0}";break}let M=h($.epoch),z=C.title||"Untitled",V=y(C.narrative),Z=M!==D?M:"\u2033";D=M;let K=N?" \u2190 **ANCHOR**":"";g.push(`| #${C.id} | ${Z} | ${j} | ${z}${K} | ~${V} |`)}}A&&g.push("")}return{content:[{type:"text",text:g.join(` +`)}]}}catch(r){return{content:[{type:"text",text:`Failed to get recent context: ${r.message}`}],isError:!0}}}async getContextTimeline(e){try{let{anchor:r,depth_before:t=10,depth_after:s=10,project:i}=e,n=process.cwd(),o,l=r,c;if(typeof r=="number"){let b=this.sessionStore.getObservationById(r);if(!b)return{content:[{type:"text",text:`Observation #${r} not found`}],isError:!0};o=b.created_at_epoch,c=this.sessionStore.getTimelineAroundObservation(r,o,t,s,i)}else if(typeof r=="string")if(r.startsWith("S")||r.startsWith("#S")){let b=r.replace(/^#?S/,""),R=parseInt(b,10),w=this.sessionStore.getSessionSummariesByIds([R]);if(w.length===0)return{content:[{type:"text",text:`Session #${R} not found`}],isError:!0};o=w[0].created_at_epoch,l=`S${R}`,c=this.sessionStore.getTimelineAroundTimestamp(o,t,s,i)}else{let b=new Date(r);if(isNaN(b.getTime()))return{content:[{type:"text",text:`Invalid timestamp: ${r}`}],isError:!0};o=b.getTime(),c=this.sessionStore.getTimelineAroundTimestamp(o,t,s,i)}else return{content:[{type:"text",text:'Invalid anchor: must be observation ID (number), session ID (e.g., "S123"), or ISO timestamp'}],isError:!0};let u=[...c.observations.map(b=>({type:"observation",data:b,epoch:b.created_at_epoch})),...c.sessions.map(b=>({type:"session",data:b,epoch:b.created_at_epoch})),...c.prompts.map(b=>({type:"prompt",data:b,epoch:b.created_at_epoch}))];u.sort((b,R)=>b.epoch-R.epoch);let p=this.timelineService.filterByDepth(u,l,o,t,s);if(!p||p.length===0)return{content:[{type:"text",text:`No context found around ${new Date(o).toLocaleString()} (${t} records before, ${s} records after)`}]};let f=b=>new Date(b).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric"}),d=b=>new Date(b).toLocaleString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),v=b=>new Date(b).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",hour12:!0}),h=b=>b?Math.ceil(b.length/4):0,m=[];m.push(`# Timeline around anchor: ${l}`),m.push(`**Window:** ${t} records before \u2192 ${s} records after | **Items:** ${p?.length??0}`),m.push("");let y=new Map;for(let b of p){let R=f(b.epoch);y.has(R)||y.set(R,[]),y.get(R).push(b)}let g=Array.from(y.entries()).sort((b,R)=>{let w=new Date(b[0]).getTime(),T=new Date(R[0]).getTime();return w-T});for(let[b,R]of g){m.push(`### ${b}`),m.push("");let w=null,T="",k=!1;for(let D of R){let A=typeof l=="number"&&D.type==="observation"&&D.data.id===l||typeof l=="string"&&l.startsWith("S")&&D.type==="session"&&`S${D.data.id}`===l;if(D.type==="session"){k&&(m.push(""),k=!1,w=null,T="");let $=D.data,N=$.request||"Session summary",C=A?" \u2190 **ANCHOR**":"";m.push(`**\u{1F3AF} #S${$.id}** ${N} (${v(D.epoch)})${C}`),m.push("")}else if(D.type==="prompt"){k&&(m.push(""),k=!1,w=null,T="");let $=D.data,N=$.prompt_text.length>100?$.prompt_text.substring(0,100)+"...":$.prompt_text;m.push(`**\u{1F4AC} User Prompt #${$.prompt_number}** (${v(D.epoch)})`),m.push(`> ${N}`),m.push("")}else if(D.type==="observation"){let $=D.data,N=zs($.files_modified,n);N!==w&&(k&&m.push(""),m.push(`**${N}**`),m.push("| ID | Time | T | Title | Tokens |"),m.push("|----|------|---|-------|--------|"),w=N,k=!0,T="");let C="\u2022";switch($.type){case"bugfix":C="\u{1F534}";break;case"feature":C="\u{1F7E3}";break;case"refactor":C="\u{1F504}";break;case"change":C="\u2705";break;case"discovery":C="\u{1F535}";break;case"decision":C="\u{1F9E0}";break}let O=d(D.epoch),j=$.title||"Untitled",M=h($.narrative),V=O!==T?O:"\u2033";T=O;let X=A?" \u2190 **ANCHOR**":"";m.push(`| #${$.id} | ${V} | ${C} | ${j}${X} | ~${M} |`)}}k&&m.push("")}return{content:[{type:"text",text:m.join(` +`)}]}}catch(r){return{content:[{type:"text",text:`Timeline query failed: ${r.message}`}],isError:!0}}}async getTimelineByQuery(e){try{let{query:r,mode:t="auto",depth_before:s=10,depth_after:i=10,limit:n=5,project:o}=e,l=process.cwd(),c=[];if(this.chromaSync)try{q.debug("SEARCH","Using hybrid semantic search for timeline query",{});let u=await this.queryChroma(r,100);if(q.debug("SEARCH","Chroma returned semantic matches for timeline",{matchCount:u.ids.length}),u.ids.length>0){let p=Date.now()-7776e6,f=u.ids.filter((d,v)=>{let h=u.metadatas[v];return h&&h.created_at_epoch>p});q.debug("SEARCH","Results within 90-day window",{count:f.length}),f.length>0&&(c=this.sessionStore.getObservationsByIds(f,{orderBy:"date_desc",limit:t==="auto"?1:n}),q.debug("SEARCH","Hydrated observations from SQLite",{count:c.length}))}}catch(u){q.debug("SEARCH","Chroma query failed - no results (FTS5 fallback removed)",{error:u.message})}if(c.length===0)return{content:[{type:"text",text:`No observations found matching "${r}". Try a different search query.`}]};if(t==="interactive"){let u=[];u.push("# Timeline Anchor Search Results"),u.push(""),u.push(`Found ${c.length} observation(s) matching "${r}"`),u.push(""),u.push("To get timeline context around any of these observations, use the `get_context_timeline` tool with the observation ID as the anchor."),u.push(""),u.push(`**Top ${c.length} matches:**`),u.push("");for(let p=0;p({type:"observation",data:w,epoch:w.created_at_epoch})),...(p.sessions||[]).map(w=>({type:"session",data:w,epoch:w.created_at_epoch})),...(p.prompts||[]).map(w=>({type:"prompt",data:w,epoch:w.created_at_epoch}))];f.sort((w,T)=>w.epoch-T.epoch);let d=this.timelineService.filterByDepth(f,u.id,0,s,i);if(!d||d.length===0)return{content:[{type:"text",text:`Found observation #${u.id} matching "${r}", but no timeline context available (${s} records before, ${i} records after).`}]};let v=w=>new Date(w).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric"}),h=w=>new Date(w).toLocaleString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),m=w=>new Date(w).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",hour12:!0}),y=w=>w?Math.ceil(w.length/4):0,g=[];g.push(`# Timeline for query: "${r}"`),g.push(`**Anchor:** Observation #${u.id} - ${u.title||"Untitled"}`),g.push(`**Window:** ${s} records before \u2192 ${i} records after | **Items:** ${d?.length??0}`),g.push("");let b=new Map;for(let w of d){let T=v(w.epoch);b.has(T)||b.set(T,[]),b.get(T).push(w)}let R=Array.from(b.entries()).sort((w,T)=>{let k=new Date(w[0]).getTime(),D=new Date(T[0]).getTime();return k-D});for(let[w,T]of R){g.push(`### ${w}`),g.push("");let k=null,D="",A=!1;for(let $ of T){let N=$.type==="observation"&&$.data.id===u.id;if($.type==="session"){A&&(g.push(""),A=!1,k=null,D="");let C=$.data,O=C.request||"Session summary";g.push(`**\u{1F3AF} #S${C.id}** ${O} (${m($.epoch)})`),g.push("")}else if($.type==="prompt"){A&&(g.push(""),A=!1,k=null,D="");let C=$.data,O=C.prompt_text.length>100?C.prompt_text.substring(0,100)+"...":C.prompt_text;g.push(`**\u{1F4AC} User Prompt #${C.prompt_number}** (${m($.epoch)})`),g.push(`> ${O}`),g.push("")}else if($.type==="observation"){let C=$.data,O=zs(C.files_modified,l);O!==k&&(A&&g.push(""),g.push(`**${O}**`),g.push("| ID | Time | T | Title | Tokens |"),g.push("|----|------|---|-------|--------|"),k=O,A=!0,D="");let j="\u2022";switch(C.type){case"bugfix":j="\u{1F534}";break;case"feature":j="\u{1F7E3}";break;case"refactor":j="\u{1F504}";break;case"change":j="\u2705";break;case"discovery":j="\u{1F535}";break;case"decision":j="\u{1F9E0}";break}let M=h($.epoch),z=C.title||"Untitled",V=y(C.narrative),Z=M!==D?M:"\u2033";D=M;let K=N?" \u2190 **ANCHOR**":"";g.push(`| #${C.id} | ${Z} | ${j} | ${z}${K} | ~${V} |`)}}A&&g.push("")}return{content:[{type:"text",text:g.join(` `)}]}}}catch(r){return{content:[{type:"text",text:`Timeline query failed: ${r.message}`}],isError:!0}}}};Xi();var d5=4,jl=class{formatSearchTips(){return` --- \u{1F4A1} Search Strategy: @@ -1017,7 +1017,7 @@ Tips: \u2022 Filter by date: dateStart="2025-01-01" \u2022 Sort: orderBy="date_desc" or "date_asc"`}formatTime(e){return new Date(e).toLocaleString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}estimateReadTokens(e){let r=(e.title?.length||0)+(e.subtitle?.length||0)+(e.narrative?.length||0)+(e.facts?.length||0);return Math.ceil(r/d5)}formatObservationIndex(e,r){let t=`#${e.id}`,s=this.formatTime(e.created_at_epoch),i=Ki[e.type]||"\u2022",n=e.title||"Untitled",o=this.estimateReadTokens(e),l=sl[e.type]||"\u{1F50D}",c=e.discovery_tokens||0,u=c>0?`${l} ${c}`:"-";return`| ${t} | ${s} | ${i} | ${n} | ~${o} | ${u} |`}formatSessionIndex(e,r){let t=`#S${e.id}`,s=this.formatTime(e.created_at_epoch),i="\u{1F3AF}",n=e.request||`Session ${e.sdk_session_id?.substring(0,8)||"unknown"}`;return`| ${t} | ${s} | ${i} | ${n} | - | - |`}formatUserPromptIndex(e,r){let t=`#P${e.id}`,s=this.formatTime(e.created_at_epoch),i="\u{1F4AC}",n=e.prompt_text.length>60?e.prompt_text.substring(0,57)+"...":e.prompt_text;return`| ${t} | ${s} | ${i} | ${n} | - | - |`}formatTableHeader(){return`| ID | Time | T | Title | Read | Work | |-----|------|---|-------|------|------|`}formatSearchTableHeader(){return`| ID | Time | T | Title | Read | -|----|------|---|-------|------|`}formatObservationSearchRow(e,r){let t=`#${e.id}`,s=this.formatTime(e.created_at_epoch),i=Ki[e.type]||"\u2022",n=e.title||"Untitled",o=this.estimateReadTokens(e);return{row:`| ${t} | ${s===r?"\u2033":s} | ${i} | ${n} | ~${o} |`,time:s}}formatSessionSearchRow(e,r){let t=`#S${e.id}`,s=this.formatTime(e.created_at_epoch),i="\u{1F3AF}",n=e.request||`Session ${e.sdk_session_id?.substring(0,8)||"unknown"}`;return{row:`| ${t} | ${s===r?"\u2033":s} | ${i} | ${n} | - |`,time:s}}formatUserPromptSearchRow(e,r){let t=`#P${e.id}`,s=this.formatTime(e.created_at_epoch),i="\u{1F4AC}",n=e.prompt_text.length>60?e.prompt_text.substring(0,57)+"...":e.prompt_text;return{row:`| ${t} | ${s===r?"\u2033":s} | ${i} | ${n} | - |`,time:s}}};var $l=class{buildTimeline(e){let r=[...e.observations.map(t=>({type:"observation",data:t,epoch:t.created_at_epoch})),...e.sessions.map(t=>({type:"session",data:t,epoch:t.created_at_epoch})),...e.prompts.map(t=>({type:"prompt",data:t,epoch:t.created_at_epoch}))];return r.sort((t,s)=>t.epoch-s.epoch),r}filterByDepth(e,r,t,s,i){if(e.length===0)return e;let n=-1;if(typeof r=="number")n=e.findIndex(c=>c.type==="observation"&&c.data.id===r);else if(typeof r=="string"&&r.startsWith("S")){let c=parseInt(r.slice(1),10);n=e.findIndex(u=>u.type==="session"&&u.data.id===c)}else n=e.findIndex(c=>c.epoch>=t),n===-1&&(n=e.length-1);if(n===-1)return e;let o=Math.max(0,n-s),l=Math.min(e.length,n+i+1);return e.slice(o,l)}formatTimeline(e,r,t,s,i){if(e.length===0)return t?`Found observation matching "${t}", but no timeline context available.`:"No timeline items found";let n=[];if(t&&r){let c=e.find(p=>p.type==="observation"&&p.data.id===r),u=c?c.data.title||"Untitled":"Unknown";n.push(`# Timeline for query: "${t}"`),n.push(`**Anchor:** Observation #${r} - ${u}`)}else r?n.push(`# Timeline around anchor: ${r}`):n.push("# Timeline");s!==void 0&&i!==void 0?n.push(`**Window:** ${s} records before \u2192 ${i} records after | **Items:** ${e.length}`):n.push(`**Items:** ${e.length}`),n.push(""),n.push("**Legend:** \u{1F3AF} session-request | \u{1F534} bugfix | \u{1F7E3} feature | \u{1F504} refactor | \u2705 change | \u{1F535} discovery | \u{1F9E0} decision"),n.push("");let o=new Map;for(let c of e){let u=this.formatDate(c.epoch);o.has(u)||o.set(u,[]),o.get(u).push(c)}let l=Array.from(o.entries()).sort((c,u)=>{let p=new Date(c[0]).getTime(),f=new Date(u[0]).getTime();return p-f});for(let[c,u]of l){n.push(`### ${c}`),n.push("");let p=null,f="",d=!1;for(let v of u){let h=typeof r=="number"&&v.type==="observation"&&v.data.id===r||typeof r=="string"&&r.startsWith("S")&&v.type==="session"&&`S${v.data.id}`===r;if(v.type==="session"){d&&(n.push(""),d=!1,p=null,f="");let m=v.data,y=m.request||"Session summary",g=`claude-mem://session-summary/${m.id}`,b=h?" \u2190 **ANCHOR**":"";n.push(`**\u{1F3AF} #S${m.id}** ${y} (${this.formatDateTime(v.epoch)}) [\u2192](${g})${b}`),n.push("")}else if(v.type==="prompt"){d&&(n.push(""),d=!1,p=null,f="");let m=v.data,y=m.prompt_text.length>100?m.prompt_text.substring(0,100)+"...":m.prompt_text;n.push(`**\u{1F4AC} User Prompt #${m.prompt_number}** (${this.formatDateTime(v.epoch)})`),n.push(`> ${y}`),n.push("")}else if(v.type==="observation"){let m=v.data,y="General";y!==p&&(d&&n.push(""),n.push(`**${y}**`),n.push("| ID | Time | T | Title | Tokens |"),n.push("|----|------|---|-------|--------|"),p=y,d=!0,f="");let g=this.getTypeIcon(m.type),b=this.formatTime(v.epoch),R=m.title||"Untitled",w=this.estimateTokens(m.narrative),k=b!==f?b:"\u2033";f=b;let D=h?" \u2190 **ANCHOR**":"";n.push(`| #${m.id} | ${k} | ${g} | ${R}${D} | ~${w} |`)}}d&&n.push("")}return n.join(` +|----|------|---|-------|------|`}formatObservationSearchRow(e,r){let t=`#${e.id}`,s=this.formatTime(e.created_at_epoch),i=Ki[e.type]||"\u2022",n=e.title||"Untitled",o=this.estimateReadTokens(e);return{row:`| ${t} | ${s===r?"\u2033":s} | ${i} | ${n} | ~${o} |`,time:s}}formatSessionSearchRow(e,r){let t=`#S${e.id}`,s=this.formatTime(e.created_at_epoch),i="\u{1F3AF}",n=e.request||`Session ${e.sdk_session_id?.substring(0,8)||"unknown"}`;return{row:`| ${t} | ${s===r?"\u2033":s} | ${i} | ${n} | - |`,time:s}}formatUserPromptSearchRow(e,r){let t=`#P${e.id}`,s=this.formatTime(e.created_at_epoch),i="\u{1F4AC}",n=e.prompt_text.length>60?e.prompt_text.substring(0,57)+"...":e.prompt_text;return{row:`| ${t} | ${s===r?"\u2033":s} | ${i} | ${n} | - |`,time:s}}};var $l=class{buildTimeline(e){let r=[...e.observations.map(t=>({type:"observation",data:t,epoch:t.created_at_epoch})),...e.sessions.map(t=>({type:"session",data:t,epoch:t.created_at_epoch})),...e.prompts.map(t=>({type:"prompt",data:t,epoch:t.created_at_epoch}))];return r.sort((t,s)=>t.epoch-s.epoch),r}filterByDepth(e,r,t,s,i){if(e.length===0)return e;let n=-1;if(typeof r=="number")n=e.findIndex(c=>c.type==="observation"&&c.data.id===r);else if(typeof r=="string"&&r.startsWith("S")){let c=parseInt(r.slice(1),10);n=e.findIndex(u=>u.type==="session"&&u.data.id===c)}else n=e.findIndex(c=>c.epoch>=t),n===-1&&(n=e.length-1);if(n===-1)return e;let o=Math.max(0,n-s),l=Math.min(e.length,n+i+1);return e.slice(o,l)}formatTimeline(e,r,t,s,i){if(e.length===0)return t?`Found observation matching "${t}", but no timeline context available.`:"No timeline items found";let n=[];if(t&&r){let c=e.find(p=>p.type==="observation"&&p.data.id===r),u=c?c.data.title||"Untitled":"Unknown";n.push(`# Timeline for query: "${t}"`),n.push(`**Anchor:** Observation #${r} - ${u}`)}else r?n.push(`# Timeline around anchor: ${r}`):n.push("# Timeline");s!==void 0&&i!==void 0?n.push(`**Window:** ${s} records before \u2192 ${i} records after | **Items:** ${e.length}`):n.push(`**Items:** ${e.length}`),n.push(""),n.push("**Legend:** \u{1F3AF} session-request | \u{1F534} bugfix | \u{1F7E3} feature | \u{1F504} refactor | \u2705 change | \u{1F535} discovery | \u{1F9E0} decision"),n.push("");let o=new Map;for(let c of e){let u=this.formatDate(c.epoch);o.has(u)||o.set(u,[]),o.get(u).push(c)}let l=Array.from(o.entries()).sort((c,u)=>{let p=new Date(c[0]).getTime(),f=new Date(u[0]).getTime();return p-f});for(let[c,u]of l){n.push(`### ${c}`),n.push("");let p=null,f="",d=!1;for(let v of u){let h=typeof r=="number"&&v.type==="observation"&&v.data.id===r||typeof r=="string"&&r.startsWith("S")&&v.type==="session"&&`S${v.data.id}`===r;if(v.type==="session"){d&&(n.push(""),d=!1,p=null,f="");let m=v.data,y=m.request||"Session summary",g=h?" \u2190 **ANCHOR**":"";n.push(`**\u{1F3AF} #S${m.id}** ${y} (${this.formatDateTime(v.epoch)})${g}`),n.push("")}else if(v.type==="prompt"){d&&(n.push(""),d=!1,p=null,f="");let m=v.data,y=m.prompt_text.length>100?m.prompt_text.substring(0,100)+"...":m.prompt_text;n.push(`**\u{1F4AC} User Prompt #${m.prompt_number}** (${this.formatDateTime(v.epoch)})`),n.push(`> ${y}`),n.push("")}else if(v.type==="observation"){let m=v.data,y="General";y!==p&&(d&&n.push(""),n.push(`**${y}**`),n.push("| ID | Time | T | Title | Tokens |"),n.push("|----|------|---|-------|--------|"),p=y,d=!0,f="");let g=this.getTypeIcon(m.type),b=this.formatTime(v.epoch),R=m.title||"Untitled",w=this.estimateTokens(m.narrative),k=b!==f?b:"\u2033";f=b;let D=h?" \u2190 **ANCHOR**":"";n.push(`| #${m.id} | ${k} | ${g} | ${R}${D} | ~${w} |`)}}d&&n.push("")}return n.join(` `)}getTypeIcon(e){switch(e){case"bugfix":return"\u{1F534}";case"feature":return"\u{1F7E3}";case"refactor":return"\u{1F504}";case"change":return"\u2705";case"discovery":return"\u{1F535}";case"decision":return"\u{1F9E0}";default:return"\u2022"}}formatDate(e){return new Date(e).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric"})}formatTime(e){return new Date(e).toLocaleString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}formatDateTime(e){return new Date(e).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}estimateTokens(e){return e?Math.ceil(e.length/4):0}};var Ml=class{constructor(e,r){this.sseBroadcaster=e;this.workerService=r}broadcastNewPrompt(e){this.sseBroadcaster.broadcast({type:"new_prompt",prompt:e}),this.sseBroadcaster.broadcast({type:"processing_status",isProcessing:!0}),this.workerService.broadcastProcessingStatus()}broadcastSessionStarted(e,r){this.sseBroadcaster.broadcast({type:"session_started",sessionDbId:e,project:r}),this.workerService.broadcastProcessingStatus()}broadcastObservationQueued(e){this.sseBroadcaster.broadcast({type:"observation_queued",sessionDbId:e}),this.workerService.broadcastProcessingStatus()}broadcastSessionCompleted(e){this.sseBroadcaster.broadcast({type:"session_completed",timestamp:Date.now(),sessionDbId:e}),this.workerService.broadcastProcessingStatus()}broadcastSummarizeQueued(){this.workerService.broadcastProcessingStatus()}};var Mf=bt(od(),1),o1=bt(i1(),1),c1=bt(require("path"),1);Ar();yt();function l1(a){let e=[];e.push(Mf.default.json({limit:"50mb"})),e.push((0,o1.default)()),e.push((s,i,n)=>{if(s.path.startsWith("/health")||s.path==="/"||s.path.includes("."))return n();let o=Date.now(),l=`${s.method}-${Date.now()}`,c=a(s.method,s.path,s.body);q.info("HTTP",`\u2192 ${s.method} ${s.path}`,{requestId:l},c);let u=i.send.bind(i);i.send=function(p){let f=Date.now()-o;return q.info("HTTP",`\u2190 ${i.statusCode} ${s.path}`,{requestId:l,duration:`${f}ms`}),u(p)},n()});let r=ca(),t=c1.default.join(r,"plugin","ui");return e.push(Mf.default.static(t)),e}function u1(a,e,r){if(!r||Object.keys(r).length===0||e.includes("/init"))return"";if(e.includes("/observations")){let t=r.tool_name||"?",s=r.tool_input;return`tool=${q.formatTool(t,s)}`}return e.includes("/summarize")?"requesting summary":""}var p1=bt(require("path"),1),d1=require("fs");Ar();yt();var _r=class{wrapHandler(e){return(r,t)=>{try{let s=e(r,t);s instanceof Promise&&s.catch(i=>this.handleError(t,i))}catch(s){this.handleError(t,s)}}}parseIntParam(e,r,t){let s=parseInt(e.params[t],10);return isNaN(s)?(this.badRequest(r,`Invalid ${t}`),null):s}validateRequired(e,r,t){for(let s of t)if(e.body[s]===void 0||e.body[s]===null)return this.badRequest(r,`Missing ${s}`),!1;return!0}badRequest(e,r){e.status(400).json({error:r})}notFound(e,r){e.status(404).json({error:r})}handleError(e,r,t){q.failure("WORKER",t||"Request failed",{},r),e.status(500).json({error:r.message})}};var Ll=class extends _r{constructor(r,t,s){super();this.sseBroadcaster=r;this.dbManager=t;this.sessionManager=s}setupRoutes(r){r.get("/health",this.handleHealth.bind(this)),r.get("/",this.handleViewerUI.bind(this)),r.get("/stream",this.handleSSEStream.bind(this))}handleHealth=this.wrapHandler((r,t)=>{t.json({status:"ok",timestamp:Date.now()})});handleViewerUI=this.wrapHandler((r,t)=>{let s=ca(),i=p1.default.join(s,"plugin","ui","viewer.html"),n=(0,d1.readFileSync)(i,"utf-8");t.setHeader("Content-Type","text/html"),t.send(n)});handleSSEStream=this.wrapHandler((r,t)=>{t.setHeader("Content-Type","text/event-stream"),t.setHeader("Cache-Control","no-cache"),t.setHeader("Connection","keep-alive"),this.sseBroadcaster.addClient(t);let s=this.dbManager.getSessionStore().getAllProjects();this.sseBroadcaster.broadcast({type:"initial_load",projects:s,timestamp:Date.now()});let i=this.sessionManager.isAnySessionProcessing(),n=this.sessionManager.getTotalActiveWork();this.sseBroadcaster.broadcast({type:"processing_status",isProcessing:i,queueDepth:n})})};yt();var Fl=100;function f1(a){let e=(a.match(//g)||[]).length,r=(a.match(//g)||[]).length;return e+r}function Lf(a){if(typeof a!="string")return vr("[tag-stripping] received non-string for JSON context:",{type:typeof a}),"{}";let e=f1(a);return e>Fl&&vr("[tag-stripping] tag count exceeds limit, truncating:",{tagCount:e,maxAllowed:Fl,contentLength:a.length}),a.replace(/[\s\S]*?<\/claude-mem-context>/g,"").replace(/[\s\S]*?<\/private>/g,"").trim()}function m1(a){if(typeof a!="string")return vr("[tag-stripping] received non-string for prompt context:",{type:typeof a}),"";let e=f1(a);return e>Fl&&vr("[tag-stripping] tag count exceeds limit, truncating:",{tagCount:e,maxAllowed:Fl,contentLength:a.length}),a.replace(/[\s\S]*?<\/claude-mem-context>/g,"").replace(/[\s\S]*?<\/private>/g,"").trim()}var ql=class{constructor(e,r,t){this.sessionManager=e;this.dbManager=r;this.eventBroadcaster=t}async completeByDbId(e){await this.sessionManager.deleteSession(e),this.dbManager.markSessionComplete(e),this.eventBroadcaster.broadcastSessionCompleted(e)}async completeByClaudeId(e){let t=this.dbManager.getSessionStore().findActiveSDKSession(e);if(!t)return!1;let s=t.id;return await this.completeByDbId(s),!0}};yt();var no=class{static checkUserPromptPrivacy(e,r,t,s,i,n){let o=e.getUserPrompt(r,t);return!o||o.trim()===""?(q.debug("HOOK",`Skipping ${s} - user prompt was entirely private`,{sessionId:i,promptNumber:t,...n}),null):o}};oa();Ar();var Ul=class extends _r{constructor(r,t,s,i,n){super();this.sessionManager=r;this.dbManager=t;this.sdkAgent=s;this.eventBroadcaster=i;this.workerService=n;this.completionHandler=new ql(r,t,i)}completionHandler;ensureGeneratorRunning(r,t){let s=this.sessionManager.getSession(r);s&&!s.generatorPromise&&(q.info("SESSION",`Generator auto-starting (${t})`,{sessionId:r,queueDepth:s.pendingMessages.length}),s.generatorPromise=this.sdkAgent.startSession(s,this.workerService).catch(i=>{q.failure("SDK","SDK agent error",{sessionId:r},i)}).finally(()=>{q.info("SESSION","Generator finished",{sessionId:r}),s.generatorPromise=null,this.workerService.broadcastProcessingStatus()}))}setupRoutes(r){r.post("/sessions/:sessionDbId/init",this.handleSessionInit.bind(this)),r.post("/sessions/:sessionDbId/observations",this.handleObservations.bind(this)),r.post("/sessions/:sessionDbId/summarize",this.handleSummarize.bind(this)),r.get("/sessions/:sessionDbId/status",this.handleSessionStatus.bind(this)),r.delete("/sessions/:sessionDbId",this.handleSessionDelete.bind(this)),r.post("/sessions/:sessionDbId/complete",this.handleSessionComplete.bind(this)),r.post("/api/sessions/init",this.handleSessionInitByClaudeId.bind(this)),r.post("/api/sessions/observations",this.handleObservationsByClaudeId.bind(this)),r.post("/api/sessions/summarize",this.handleSummarizeByClaudeId.bind(this)),r.post("/api/sessions/complete",this.handleSessionCompleteByClaudeId.bind(this))}handleSessionInit=this.wrapHandler((r,t)=>{let s=this.parseIntParam(r,t,"sessionDbId");if(s===null)return;let{userPrompt:i,promptNumber:n}=r.body,o=this.sessionManager.initializeSession(s,i,n),l=this.dbManager.getSessionStore().getLatestUserPrompt(o.claudeSessionId);if(l){this.eventBroadcaster.broadcastNewPrompt({id:l.id,claude_session_id:l.claude_session_id,project:l.project,prompt_number:l.prompt_number,prompt_text:l.prompt_text,created_at_epoch:l.created_at_epoch});let c=Date.now(),u=l.prompt_text;this.dbManager.getChromaSync().syncUserPrompt(l.id,l.sdk_session_id,l.project,u,l.prompt_number,l.created_at_epoch).then(()=>{let p=Date.now()-c,f=u.length>60?u.substring(0,60)+"...":u;q.debug("CHROMA","User prompt synced",{promptId:l.id,duration:`${p}ms`,prompt:f})}).catch(p=>{q.error("CHROMA","Failed to sync user_prompt",{promptId:l.id,sessionId:s},p)})}q.info("SESSION","Generator starting",{sessionId:s,project:o.project,promptNum:o.lastPromptNumber}),o.generatorPromise=this.sdkAgent.startSession(o,this.workerService).catch(c=>{q.failure("SDK","SDK agent error",{sessionId:s},c)}).finally(()=>{q.info("SESSION","Generator finished",{sessionId:s}),o.generatorPromise=null,this.workerService.broadcastProcessingStatus()}),this.eventBroadcaster.broadcastSessionStarted(s,o.project),t.json({status:"initialized",sessionDbId:s,port:Fn()})});handleObservations=this.wrapHandler((r,t)=>{let s=this.parseIntParam(r,t,"sessionDbId");if(s===null)return;let{tool_name:i,tool_input:n,tool_response:o,prompt_number:l,cwd:c}=r.body;this.sessionManager.queueObservation(s,{tool_name:i,tool_input:n,tool_response:o,prompt_number:l,cwd:c}),this.ensureGeneratorRunning(s,"observation"),this.eventBroadcaster.broadcastObservationQueued(s),t.json({status:"queued"})});handleSummarize=this.wrapHandler((r,t)=>{let s=this.parseIntParam(r,t,"sessionDbId");if(s===null)return;let{last_user_message:i,last_assistant_message:n}=r.body;this.sessionManager.queueSummarize(s,i,n),this.ensureGeneratorRunning(s,"summarize"),this.eventBroadcaster.broadcastSummarizeQueued(),t.json({status:"queued"})});handleSessionStatus=this.wrapHandler((r,t)=>{let s=this.parseIntParam(r,t,"sessionDbId");if(s===null)return;let i=this.sessionManager.getSession(s);if(!i){t.json({status:"not_found"});return}t.json({status:"active",sessionDbId:s,project:i.project,queueLength:i.pendingMessages.length,uptime:Date.now()-i.startTime})});handleSessionDelete=this.wrapHandler(async(r,t)=>{let s=this.parseIntParam(r,t,"sessionDbId");s!==null&&(await this.completionHandler.completeByDbId(s),t.json({status:"deleted"}))});handleSessionComplete=this.wrapHandler(async(r,t)=>{let s=this.parseIntParam(r,t,"sessionDbId");s!==null&&(await this.completionHandler.completeByDbId(s),t.json({success:!0}))});handleObservationsByClaudeId=this.wrapHandler((r,t)=>{let{claudeSessionId:s,tool_name:i,tool_input:n,tool_response:o,cwd:l}=r.body;if(!s)return this.badRequest(t,"Missing claudeSessionId");let c=lt.loadFromFile(Ln);if(new Set(c.CLAUDE_MEM_SKIP_TOOLS.split(",").map(g=>g.trim()).filter(Boolean)).has(i)){q.debug("SESSION","Skipping observation for tool",{tool_name:i}),t.json({status:"skipped",reason:"tool_excluded"});return}if(new Set(["Edit","Write","Read","NotebookEdit"]).has(i)&&n)try{let g=n.file_path||n.notebook_path;if(g&&g.includes("session-memory")){q.debug("SESSION","Skipping meta-observation for session-memory file",{tool_name:i,file_path:g}),t.json({status:"skipped",reason:"session_memory_meta"});return}}catch(g){q.debug("SESSION","Could not check file_path for session-memory filter",{tool_name:i},g)}let f=this.dbManager.getSessionStore(),d=f.createSDKSession(s,"",""),v=f.getPromptCounter(d);if(!no.checkUserPromptPrivacy(f,s,v,"observation",d,{tool_name:i})){t.json({status:"skipped",reason:"private"});return}let m="{}",y="{}";try{m=n!==void 0?Lf(JSON.stringify(n)):"{}"}catch(g){q.debug("SESSION","Failed to serialize tool_input",{sessionDbId:d},g),m='{"error": "Failed to serialize tool_input"}'}try{y=o!==void 0?Lf(JSON.stringify(o)):"{}"}catch(g){q.debug("SESSION","Failed to serialize tool_result",{sessionDbId:d},g),y='{"error": "Failed to serialize tool_response"}'}this.sessionManager.queueObservation(d,{tool_name:i,tool_input:m,tool_response:y,prompt_number:v,cwd:l||vr("Missing cwd when queueing observation in SessionRoutes",{sessionDbId:d,tool_name:i},"")}),this.ensureGeneratorRunning(d,"observation"),this.eventBroadcaster.broadcastObservationQueued(d),t.json({status:"queued"})});handleSummarizeByClaudeId=this.wrapHandler((r,t)=>{let{claudeSessionId:s,last_user_message:i,last_assistant_message:n}=r.body;if(!s)return this.badRequest(t,"Missing claudeSessionId");let o=this.dbManager.getSessionStore(),l=o.createSDKSession(s,"",""),c=o.getPromptCounter(l);if(!no.checkUserPromptPrivacy(o,s,c,"summarize",l)){t.json({status:"skipped",reason:"private"});return}this.sessionManager.queueSummarize(l,i||vr("Missing last_user_message when queueing summary in SessionRoutes",{sessionDbId:l},""),n),this.ensureGeneratorRunning(l,"summarize"),this.eventBroadcaster.broadcastSummarizeQueued(),t.json({status:"queued"})});handleSessionCompleteByClaudeId=this.wrapHandler(async(r,t)=>{let{claudeSessionId:s}=r.body;if(!s)return this.badRequest(t,"Missing claudeSessionId");if(!await this.completionHandler.completeByClaudeId(s)){t.json({success:!0,message:"No active session found"});return}t.json({success:!0})});handleSessionInitByClaudeId=this.wrapHandler((r,t)=>{let{claudeSessionId:s,project:i,prompt:n}=r.body;if(!this.validateRequired(r,t,["claudeSessionId","project","prompt"]))return;let o=this.dbManager.getSessionStore(),l=o.createSDKSession(s,i,n),c=o.incrementPromptCounter(l),u=m1(n);if(!u||u.trim()===""){q.debug("HOOK","Session init - prompt entirely private",{sessionId:l,promptNumber:c,originalLength:n.length}),t.json({sessionDbId:l,promptNumber:c,skipped:!0,reason:"private"});return}o.saveUserPrompt(s,c,u),q.info("SESSION","Session initialized via HTTP",{sessionId:l,promptNumber:c,project:i}),t.json({sessionDbId:l,promptNumber:c,skipped:!1})})};var Ff=bt(require("path"),1),Jn=require("fs"),h1=require("os");Ar();var Hl=class extends _r{constructor(r,t,s,i,n,o){super();this.paginationHelper=r;this.dbManager=t;this.sessionManager=s;this.sseBroadcaster=i;this.workerService=n;this.startTime=o}setupRoutes(r){r.get("/api/observations",this.handleGetObservations.bind(this)),r.get("/api/summaries",this.handleGetSummaries.bind(this)),r.get("/api/prompts",this.handleGetPrompts.bind(this)),r.get("/api/observation/:id",this.handleGetObservationById.bind(this)),r.post("/api/observations/batch",this.handleGetObservationsByIds.bind(this)),r.get("/api/session/:id",this.handleGetSessionById.bind(this)),r.get("/api/prompt/:id",this.handleGetPromptById.bind(this)),r.get("/api/stats",this.handleGetStats.bind(this)),r.get("/api/projects",this.handleGetProjects.bind(this)),r.get("/api/processing-status",this.handleGetProcessingStatus.bind(this)),r.post("/api/processing",this.handleSetProcessing.bind(this))}handleGetObservations=this.wrapHandler((r,t)=>{let{offset:s,limit:i,project:n}=this.parsePaginationParams(r),o=this.paginationHelper.getObservations(s,i,n);t.json(o)});handleGetSummaries=this.wrapHandler((r,t)=>{let{offset:s,limit:i,project:n}=this.parsePaginationParams(r),o=this.paginationHelper.getSummaries(s,i,n);t.json(o)});handleGetPrompts=this.wrapHandler((r,t)=>{let{offset:s,limit:i,project:n}=this.parsePaginationParams(r),o=this.paginationHelper.getPrompts(s,i,n);t.json(o)});handleGetObservationById=this.wrapHandler((r,t)=>{let s=this.parseIntParam(r,t,"id");if(s===null)return;let n=this.dbManager.getSessionStore().getObservationById(s);if(!n){this.notFound(t,`Observation #${s} not found`);return}t.json(n)});handleGetObservationsByIds=this.wrapHandler((r,t)=>{let{ids:s,orderBy:i,limit:n,project:o}=r.body;if(!s||!Array.isArray(s)){this.badRequest(t,"ids must be an array of numbers");return}if(s.length===0){t.json([]);return}if(!s.every(u=>typeof u=="number"&&Number.isInteger(u))){this.badRequest(t,"All ids must be integers");return}let c=this.dbManager.getSessionStore().getObservationsByIds(s,{orderBy:i,limit:n,project:o});t.json(c)});handleGetSessionById=this.wrapHandler((r,t)=>{let s=this.parseIntParam(r,t,"id");if(s===null)return;let n=this.dbManager.getSessionStore().getSessionSummariesByIds([s]);if(n.length===0){this.notFound(t,`Session #${s} not found`);return}t.json(n[0])});handleGetPromptById=this.wrapHandler((r,t)=>{let s=this.parseIntParam(r,t,"id");if(s===null)return;let n=this.dbManager.getSessionStore().getUserPromptsByIds([s]);if(n.length===0){this.notFound(t,`Prompt #${s} not found`);return}t.json(n[0])});handleGetStats=this.wrapHandler((r,t)=>{let s=this.dbManager.getSessionStore().db,i=ca(),n=Ff.default.join(i,"package.json"),l=JSON.parse((0,Jn.readFileSync)(n,"utf-8")).version,c=s.prepare("SELECT COUNT(*) as count FROM observations").get(),u=s.prepare("SELECT COUNT(*) as count FROM sdk_sessions").get(),p=s.prepare("SELECT COUNT(*) as count FROM session_summaries").get(),f=Ff.default.join((0,h1.homedir)(),".claude-mem","claude-mem.db"),d=0;(0,Jn.existsSync)(f)&&(d=(0,Jn.statSync)(f).size);let v=Math.floor((Date.now()-this.startTime)/1e3),h=this.sessionManager.getActiveSessionCount(),m=this.sseBroadcaster.getClientCount();t.json({worker:{version:l,uptime:v,activeSessions:h,sseClients:m,port:Fn()},database:{path:f,size:d,observations:c.count,sessions:u.count,summaries:p.count}})});handleGetProjects=this.wrapHandler((r,t)=>{let n=this.dbManager.getSessionStore().db.prepare(` SELECT DISTINCT project FROM observations diff --git a/src/services/context-generator.ts b/src/services/context-generator.ts index 46d98096..30486cb1 100644 --- a/src/services/context-generator.ts +++ b/src/services/context-generator.ts @@ -501,14 +501,11 @@ export async function generateContext(input?: ContextInput, useColors: boolean = const summary = item.data; const summaryTitle = `${summary.request || 'Session started'} (${formatDateTime(summary.displayTime)})`; - const link = summary.shouldShowLink ? `claude-mem://session-summary/${summary.id}` : ''; if (useColors) { - const linkPart = link ? `${colors.dim}[${link}]${colors.reset}` : ''; - output.push(`๐ŸŽฏ ${colors.yellow}#S${summary.id}${colors.reset} ${summaryTitle} ${linkPart}`); + output.push(`๐ŸŽฏ ${colors.yellow}#S${summary.id}${colors.reset} ${summaryTitle}`); } else { - const linkPart = link ? ` [โ†’](${link})` : ''; - output.push(`**๐ŸŽฏ #S${summary.id}** ${summaryTitle}${linkPart}`); + output.push(`**๐ŸŽฏ #S${summary.id}** ${summaryTitle}`); } output.push(''); } else { diff --git a/src/services/worker/SearchManager.ts b/src/services/worker/SearchManager.ts index 854a6f4c..16311378 100644 --- a/src/services/worker/SearchManager.ts +++ b/src/services/worker/SearchManager.ts @@ -565,10 +565,9 @@ export class SearchManager { const sess = item.data as SessionSummarySearchResult; const title = sess.request || 'Session summary'; - const link = `claude-mem://session-summary/${sess.id}`; const marker = isAnchor ? ' โ† **ANCHOR**' : ''; - lines.push(`**๐ŸŽฏ #S${sess.id}** ${title} (${formatDateTime(item.epoch)}) [โ†’](${link})${marker}`); + lines.push(`**๐ŸŽฏ #S${sess.id}** ${title} (${formatDateTime(item.epoch)})${marker}`); lines.push(''); } else if (item.type === 'prompt') { if (tableOpen) { @@ -1679,10 +1678,9 @@ export class SearchManager { // Render session const sess = item.data as SessionSummarySearchResult; const title = sess.request || 'Session summary'; - const link = `claude-mem://session-summary/${sess.id}`; const marker = isAnchor ? ' โ† **ANCHOR**' : ''; - lines.push(`**๐ŸŽฏ #S${sess.id}** ${title} (${formatDateTime(item.epoch)}) [โ†’](${link})${marker}`); + lines.push(`**๐ŸŽฏ #S${sess.id}** ${title} (${formatDateTime(item.epoch)})${marker}`); lines.push(''); } else if (item.type === 'prompt') { // Close any open table @@ -1841,7 +1839,6 @@ export class SearchManager { if (obs.subtitle) { lines.push(` - ${obs.subtitle}`); } - lines.push(` - Source: claude-mem://observation/${obs.id}`); lines.push(''); } @@ -1969,9 +1966,8 @@ export class SearchManager { // Render session const sess = item.data as SessionSummarySearchResult; const title = sess.request || 'Session summary'; - const link = `claude-mem://session-summary/${sess.id}`; - lines.push(`**๐ŸŽฏ #S${sess.id}** ${title} (${formatDateTime(item.epoch)}) [โ†’](${link})`); + lines.push(`**๐ŸŽฏ #S${sess.id}** ${title} (${formatDateTime(item.epoch)})`); lines.push(''); } else if (item.type === 'prompt') { // Close any open table diff --git a/src/services/worker/TimelineService.ts b/src/services/worker/TimelineService.ts index fe974138..08c062e5 100644 --- a/src/services/worker/TimelineService.ts +++ b/src/services/worker/TimelineService.ts @@ -148,10 +148,9 @@ export class TimelineService { const sess = item.data as SessionSummarySearchResult; const title = sess.request || 'Session summary'; - const link = `claude-mem://session-summary/${sess.id}`; const marker = isAnchor ? ' โ† **ANCHOR**' : ''; - lines.push(`**๐ŸŽฏ #S${sess.id}** ${title} (${this.formatDateTime(item.epoch)}) [โ†’](${link})${marker}`); + lines.push(`**๐ŸŽฏ #S${sess.id}** ${title} (${this.formatDateTime(item.epoch)})${marker}`); lines.push(''); } else if (item.type === 'prompt') { if (tableOpen) {