howtocode 0.7.66 → 0.7.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-CCISJKGS.js → chunk-3H2ECHBB.js} +1 -1
- package/dist/chunk-465RG5I6.js +10 -0
- package/dist/{chunk-BZ6PO2P5.js → chunk-7NGP36QA.js} +1 -1
- package/dist/{chunk-VGY6AHOB.js → chunk-7OR4XA5B.js} +1 -1
- package/dist/{chunk-BAB55K5H.js → chunk-ED624AEE.js} +1 -1
- package/dist/{chunk-XB6IDZUM.js → chunk-EMU362DM.js} +1 -1
- package/dist/{chunk-TN22ZVV4.js → chunk-GEAWXEQG.js} +1 -1
- package/dist/{chunk-JREL7M6J.js → chunk-IYKHXISM.js} +1 -1
- package/dist/{chunk-4EQD3OPC.js → chunk-K4ONXZQE.js} +1 -1
- package/dist/{chunk-BZJSYOTO.js → chunk-L4XKIPIG.js} +1 -1
- package/dist/{chunk-YVRSL6ZX.js → chunk-NFVGCV56.js} +1 -1
- package/dist/{chunk-ELM3OMOE.js → chunk-NPD6557W.js} +1 -1
- package/dist/{chunk-JY72ELJM.js → chunk-OFKOOEKB.js} +2 -2
- package/dist/{chunk-DG7OCYNY.js → chunk-R5LA6DL2.js} +1 -1
- package/dist/{chunk-RU6VPYMJ.js → chunk-VDUY46W2.js} +1 -1
- package/dist/{chunk-AS4FUFAN.js → chunk-W2U7D5UF.js} +1 -1
- package/dist/{chunk-IYR7VCH4.js → chunk-XAIUZHIW.js} +1 -1
- package/dist/{chunk-OHCWPWJW.js → chunk-XSUEEWKS.js} +1 -1
- package/dist/{chunk-3YSNDQVR.js → chunk-YFJKKWIX.js} +1 -1
- package/dist/main-app.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-ABDZXFNM.js +0 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n}from"./chunk-465RG5I6.js";import"./chunk-UTYFLLSM.js";import"./chunk-WOT6VMZA.js";export{e as RETIRED_ROBLOX_BRIDGE,c as addMcpServers,g as describeMcpServer,a as mcpConfigPath,j as mcpHubCategories,l as mcpHubFind,k as mcpHubIn,h as mcpHubPath,n as missingEnvFor,i as readMcpHub,d as removeMcpServers,f as retireRobloxBridge,m as serverSpecFromEntry,b as validateMcpBlock};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{a as A}from"./chunk-UTYFLLSM.js";import{existsSync as E,readFileSync as D}from"node:fs";import{dirname as Le,join as de}from"node:path";import{fileURLToPath as Fe}from"node:url";import{cpSync as J,existsSync as T,readdirSync as je,readFileSync as ce,renameSync as He,statSync as N,writeFileSync as Ne}from"node:fs";import{homedir as ue}from"node:os";import{dirname as Te,join as p,resolve as De}from"node:path";import{cpSync as he,existsSync as S,mkdirSync as P,mkdtempSync as L,readdirSync as R,readFileSync as j,renameSync as be,rmSync as b,statSync as x,writeFileSync as M}from"node:fs";import{tmpdir as V}from"node:os";import{dirname as Q,isAbsolute as Se,join as u,relative as ke,resolve as C}from"node:path";import{fileURLToPath as ve}from"node:url";import{execFileSync as xe}from"node:child_process";import{createHash as Z}from"node:crypto";import{gunzipSync as me}from"node:zlib";var k=512;function O(e,t,r){let n=e.subarray(t,t+r),s=n.indexOf(0);return n.subarray(0,s===-1?n.length:s).toString("utf8").trim()}function W(e,t,r){let n=O(e,t,r);if(!n)return 0;let s=Number.parseInt(n,8);return Number.isFinite(s)?s:0}function ye(e){let t={},r=0;for(;r<e.length;){let n=e.indexOf(32,r);if(n===-1)break;let s=Number.parseInt(e.toString("utf8",r,n),10);if(!Number.isFinite(s)||s<=0)break;let i=e.toString("utf8",n+1,r+s-1),o=i.indexOf("=");o>0&&(t[i.slice(0,o)]=i.slice(o+1)),r+=s}return t}function K(e){let t=me(e),r=[],n=0,s,i={};for(;n+k<=t.length;){let o=t.subarray(n,n+k);if(o.every(ge=>ge===0))break;let a=O(o,0,100),c=O(o,345,155),l=W(o,124,12),f=W(o,100,8),m=String.fromCharCode(o[156]??48),w=O(o,157,100),v=l>0?t.subarray(n+k,n+k+l):Buffer.alloc(0);if(n+=k+Math.ceil(l/k)*k,m==="x"||m==="g"){i=ye(v);continue}if(m==="L"){s=v.toString("utf8").replace(/\0.*$/s,"").trim();continue}let y=i.path??s??(c?`${c}/${a}`:a);s=void 0,i={};let d=y.indexOf("/");if(d===-1||(y=y.slice(d+1),y=y.replace(/\/+$/,""),!y))continue;let h=m==="5"?"directory":m==="2"?"symlink":m==="0"||m==="\0"||m===""?"file":"other";r.push({path:y,kind:h,size:l,mode:f&511,...h==="file"?{data:Buffer.from(v)}:{},...h==="symlink"?{link:w}:{}})}return r}function U(e){if(!e||e.startsWith("/")||e.startsWith("\\")||/^[a-zA-Z]:/.test(e))return!1;let t=e.replace(/\/+$/,"");return t?t.split("/").every(n=>n!==""&&n!=="."&&n!==".."):!1}function X(e,t){let r=`${t.replace(/\/+$/,"")}/`,n=[];for(let s of e){if(!s.path.startsWith(r))continue;let i=s.path.slice(r.length);i&&n.push({...s,path:i})}return n}function we(){return u(g,"presets")}function Y(e){return u(e,".howtocode","presets")}function ee(e){return S(u(e,".disabled"))}function te(){return u(Q(ve(import.meta.url)),"presets")}function H(e){return[Y(e),we()]}var re=/^[a-z0-9][a-z0-9-]*$/,$e=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;function _(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function $(e,t){let r=ke(C(e),C(t));return r!==""&&!r.startsWith("..")&&!Se(r)}function ne(e,t){let r=[];if(!_(t))return["preset.json must be a JSON object"];let n=l=>{let f=t[l];return typeof f!="string"||f.trim()===""?(r.push(`${l} must be a non-empty string`),""):f.trim()},s=n("name");n("title"),n("description"),n("category");let i=n("version");s&&!re.test(s)&&r.push(`name "${s}" must be lowercase letters, digits and dashes`),i&&!$e.test(i)&&r.push(`version "${i}" is not a version like 1.0.0`);let o=t.skills;if(!Array.isArray(o)||o.length===0)r.push("skills must be a non-empty array of directory names");else for(let l of o){if(typeof l!="string"||l.trim()===""){r.push("every skills entry must be a non-empty string");continue}let f=u(e,"skills",l.trim());if(!$(u(e,"skills"),f)){r.push(`skill "${l}" escapes the preset directory`);continue}S(u(f,"SKILL.md"))||r.push(`skill "${l}" has no SKILL.md at ${u("skills",l)}`)}let a=t.prompt;if(a!==void 0)if(typeof a!="string"||a.trim()==="")r.push("prompt must be a non-empty string when present");else{let l=u(e,a.trim());$(e,l)?S(l)||r.push(`prompt file "${a}" does not exist`):r.push(`prompt "${a}" escapes the preset directory`)}let c=t.tags;return c!==void 0&&!Array.isArray(c)&&r.push("tags must be an array when present"),r.push(...q(t.mcp)),r}function se(e){let t=u(e,"preset.json");if(!S(t))return{problems:[`no preset.json in ${e}`]};let r;try{r=JSON.parse(j(t,"utf8"))}catch(o){return{problems:[`preset.json is not valid JSON: ${o instanceof Error?o.message:String(o)}`]}}let n=ne(e,r);if(n.length>0)return{problems:n};let s=r,i=Array.isArray(s.tags)?s.tags.filter(o=>typeof o=="string"):[];return{problems:[],manifest:{name:String(s.name),title:String(s.title),description:String(s.description),category:String(s.category),tags:i,version:String(s.version),skills:s.skills.map(o=>String(o)),prompt:typeof s.prompt=="string"?s.prompt:void 0,mcp:s.mcp&&typeof s.mcp=="object"&&!Array.isArray(s.mcp)?s.mcp:void 0,integrates:typeof s.integrates=="string"&&s.integrates.trim()!==""?s.integrates.trim():void 0}}}function F(e){return e.filter(t=>{try{return x(t).isDirectory()}catch{return!1}})}function I(e,t){let r=[],n=[],s=(o,a)=>{if(!S(u(o,"preset.json")))return;let{manifest:c,problems:l}=se(o);c?r.push({manifest:c,dir:o,source:t}):n.push(`${a}: ${l.join("; ")}`)},i;try{i=R(e).sort()}catch{return{entries:r,problems:n}}for(let o of i){if(o.startsWith("."))continue;let a=u(e,o);try{if(!x(a).isDirectory())continue}catch{continue}if(S(u(a,"preset.json"))){s(a,o);continue}let c;try{c=R(a).sort()}catch{continue}for(let l of c){if(l.startsWith("."))continue;let f=u(a,l);try{if(!x(f).isDirectory())continue}catch{continue}s(f,u(o,l))}}return{entries:r,problems:n}}function Ye(e){let t=I(te(),"bundled"),r=[...t.entries],n=[...t.problems],s=new Map(r.map(i=>[i.manifest.name,i]));for(let i of F(H(e))){let o=I(i,"installed");n.push(...o.problems);for(let a of o.entries){let c=s.get(a.manifest.name);if(c){let l=r.indexOf(c);l>=0&&(r[l]=a),s.set(a.manifest.name,a)}else r.push(a),s.set(a.manifest.name,a)}}return{entries:r,problems:n}}function et(e){return[...new Set(e.map(t=>t.manifest.category))].sort()}function tt(e,t){return e.filter(r=>r.manifest.category===t).sort((r,n)=>r.manifest.title.localeCompare(n.manifest.title))}function ie(e){let t=[];for(let r of F(H(e))){let{entries:n}=I(r,"installed");for(let s of n)ee(s.dir)||t.push(u(s.dir,"skills"))}return t}function rt(e){let t=[];for(let r of F(H(e))){let{entries:n}=I(r,"installed");for(let s of n){if(ee(s.dir))continue;let i=s.manifest.prompt;if(!i)continue;let o=u(s.dir,i);if($(s.dir,o))try{let a=j(o,"utf8").trim();a&&t.push({name:s.manifest.name,title:s.manifest.title,text:a})}catch{}}}return t}function nt(e,t){let r=0;for(let n of t.skills)try{r+=x(u(e,"skills",n,"SKILL.md")).size}catch{}return r}function Ee(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)}var Ae=".install.lock";function Oe(e,t){P(e,{recursive:!0});let r=u(e,Ae),n=Date.now()+6e4;for(;;)try{M(r,`${process.pid}
|
|
2
|
+
`,{flag:"wx"});break}catch(s){if(s.code!=="EEXIST")throw s;let i=!1;try{i=Date.now()-x(r).mtimeMs>12e4}catch{continue}if(i){b(r,{force:!0});continue}if(Date.now()>n)throw new Error(`another install is holding ${r}; remove it if no install is running`);Ee(100)}try{for(let s of R(e))s.startsWith(".staging-")&&b(u(e,s),{recursive:!0,force:!0});return t()}finally{b(r,{force:!0})}}function oe(e,t,r){let n=u(t,r.name);return Oe(t,()=>{P(t,{recursive:!0});let s=L(u(t,".staging-"));try{he(e,s,{recursive:!0}),b(n,{recursive:!0,force:!0}),be(s,n)}catch(i){throw b(s,{recursive:!0,force:!0}),i}return n})}function ae(e,t){if(!S(e))return{ok:!1,problems:[`no such directory: ${e}`]};let{manifest:r,problems:n}=se(e);if(!r)return{ok:!1,problems:n};let s=oe(e,t,r);return{ok:!0,name:r.name,target:s,problems:[]}}function Pe(e,t){let r=L(u(V(),"howtocode-preset-"));try{return xe("git",["clone","--depth","1","--quiet",e,r],{stdio:"pipe"}),ae(r,t)}catch(n){return{ok:!1,problems:[`git clone failed: ${(n instanceof Error?n.message:String(n)).split(`
|
|
3
|
+
`)[0]}`]}}finally{b(r,{recursive:!0,force:!0})}}function st(e,t){return/^(https?:\/\/|git@|git:\/\/)/.test(e)?Pe(e,t):ae(C(e),t)}function it(e,t){let r=[],n=[];if(!re.test(e))return{removed:r,problems:[`"${e}" is not a preset name`]};for(let s of H(t)){let i=u(s,e);if(S(i)){if(!$(s,i)){n.push(`refusing to remove ${i}: outside ${s}`);continue}b(i,{recursive:!0,force:!0}),r.push(i)}}return r.length===0&&n.push(`"${e}" is not installed`),{removed:r,problems:n}}function ot(e){return Y(e)}function Re(e){let t=[],r=(i,o)=>{for(let a of R(i,{withFileTypes:!0}).sort((c,l)=>c.name.localeCompare(l.name))){let c=u(i,a.name),l=o?`${o}/${a.name}`:a.name;a.isSymbolicLink()||(a.isDirectory()?r(c,l):a.isFile()&&t.push([l,Z("sha256").update(j(c)).digest("hex")]))}};r(e,"");let n=0;for(let[i]of t)n+=x(u(e,i)).size;let s=t.map(([i,o])=>`${o} ${i}`).join(`
|
|
4
|
+
`);return{digest:Z("sha256").update(s).digest("hex").slice(0,16),fileCount:t.length,bytes:n}}function at(){let e=u(te(),"hub.json");try{let t=j(e,"utf8"),r=JSON.parse(t),n=_(r)&&Array.isArray(r.entries)?r.entries:[],s=[];for(let i of n)_(i)&&(typeof i.name!="string"||typeof i.repo!="string"||typeof i.sha!="string"||typeof i.path!="string"||typeof i.category!="string"||s.push({name:i.name,title:typeof i.title=="string"?i.title:i.name,description:typeof i.description=="string"?i.description:"",category:i.category,skill:typeof i.skill=="string"?i.skill:i.name,path:i.path,repo:i.repo,sha:i.sha,license:typeof i.license=="string"?i.license:"unknown",stars:typeof i.stars=="number"?i.stars:0,sizeKb:typeof i.sizeKb=="number"?i.sizeKb:0,...typeof i.digest=="string"?{digest:i.digest}:{},...typeof i.fileCount=="number"?{fileCount:i.fileCount}:{},...typeof i.modelInvocable=="boolean"?{modelInvocable:i.modelInvocable}:{}}));return{entries:s,problems:[]}}catch(t){return t?.code==="ENOENT"?{entries:[],problems:[]}:{entries:[],problems:[`registry unreadable: ${t instanceof Error?t.message:String(t)}`]}}}function ct(e){return[...new Set(e.map(t=>t.category))].sort()}function lt(e,t){return e.filter(r=>r.category===t).sort((r,n)=>n.stars-r.stars||r.name.localeCompare(n.name))}function ut(e,t){return e.find(r=>r.name===t)}function Ie(e){return`https://codeload.github.com/${e.repo}/tar.gz/${e.sha}`}async function ft(e,t,r=12e4){let n=L(u(V(),"howtocode-hub-"));try{let s=await fetch(Ie(e),{signal:AbortSignal.timeout(r),redirect:"follow"});if(!s.ok)return{ok:!1,problems:[`${e.repo}: HTTP ${s.status} from codeload`]};let i=Buffer.from(await s.arrayBuffer()),o=K(i),a=X(o,e.path).filter(d=>d.kind==="file"||d.kind==="directory");if(!a.some(d=>d.path==="SKILL.md"))return{ok:!1,problems:[`${e.repo}@${e.sha.slice(0,7)} has no ${e.path}/SKILL.md`]};let c=u(n,"preset",e.name),l=u(c,"skills",e.skill),f=0;for(let d of a){if(!U(d.path))return{ok:!1,problems:[`refusing unsafe path in archive: ${d.path}`]};let h=u(l,d.path);if(!$(l,h))return{ok:!1,problems:[`refusing path outside the skill: ${d.path}`]};if(d.kind==="directory"){P(h,{recursive:!0});continue}P(Q(h),{recursive:!0}),M(h,d.data??Buffer.alloc(0)),f+=1}let m={name:e.name,title:e.title,description:e.description,category:e.category,version:"1.0.0",skills:[e.skill],source:`${e.repo}@${e.sha}`,license:e.license};if(M(u(c,"preset.json"),`${JSON.stringify(m,null,2)}
|
|
5
|
+
`),!e.digest)return{ok:!1,problems:[`${e.repo}@${e.sha.slice(0,7)}: registry entry has no digest`,"refusing to install; content cannot be verified against what was reviewed"]};let w=Re(l);if(w.digest!==e.digest)return{ok:!1,problems:[`${e.repo}@${e.sha.slice(0,7)}: content changed under a pinned commit`,`expected ${e.digest} (${e.fileCount??"?"} files), got ${w.digest} (${w.fileCount} files)`,"refusing to install; the registry needs regenerating"]};let v=ne(c,m);if(v.length>0)return{ok:!1,problems:v};let y=oe(c,t,m);return{ok:!0,name:e.name,target:y,problems:[],skill:e.skill,modelInvocable:e.modelInvocable}}catch(s){return{ok:!1,problems:[`download failed: ${(s instanceof Error?s.message:String(s)).split(`
|
|
6
|
+
`)[0]}`]}}finally{b(n,{recursive:!0,force:!0})}}function Me(){let e=(process.env.HOWTOCODE_HOME??process.env.HOWTOFIX_HOME??process.env.HOME??"").trim();return De(e||ue())}function fe(e,t){for(let r of je(e)){let n=p(e,r),s=p(t,r);if(!T(s)){try{J(n,s,{recursive:!0,force:!1})}catch{}continue}let i=!1;try{i=N(n).isDirectory()}catch{continue}if(i&&N(s).isDirectory()){fe(n,s);continue}try{let o=N(s).size,a=N(n).size;!i&&o<=2&&a>o&&J(n,s,{force:!0})}catch{}}}function Ce(e){let t=p(ue(),".howtofix");if(T(t)){if(!T(e))try{He(t,e),z(e);return}catch{try{J(t,e,{recursive:!0}),z(e);return}catch{return}}fe(t,e),z(e)}}function z(e){le(p(e,"agent","models.json"),"providers"),le(p(e,"agent","auth.json"),void 0)}function le(e,t){if(!T(e))return;let r;try{r=JSON.parse(ce(e,"utf8"))}catch{return}let n=t?r[t]:r;if(!n||typeof n!="object")return;let s=!1;for(let[i,o]of Object.entries(n)){let a=o,c=typeof a?.baseUrl=="string"?a.baseUrl:"";c&&!/^https?:\/\/(api\.)?howtofix\.id(?:\/|$)/i.test(c)&&(delete n[i],s=!0)}if(t===void 0){let i=new Set(Object.keys(JSON.parse(ce(p(Te(e),"models.json"),"utf8")).providers??{}));for(let o of Object.keys(n))i.has(o)||i.has(o.replace(/^howtofix/,"howtocode"))||(delete n[o],s=!0)}for(let[i,o]of Object.entries(n)){let a=i==="howtofix"?"howtocode":i==="howtofix-free"?"howtocode-free":i;a===i||n[a]!==void 0||(n[a]=o,delete n[i],s=!0)}if(s)try{Ne(e,`${JSON.stringify(r,null,2)}
|
|
7
|
+
`)}catch{}}var g=process.env.HOWTOCODE_CODING_AGENT_DIR?.trim()||process.env.HOWTOFIX_CODING_AGENT_DIR?.trim()||(()=>{let e=p(Me(),".howtocode");return Ce(e),p(e,"agent")})(),ht=p(g,"skills");function _e(e){return p(e,".howtocode","skills")}function bt(e){let t=[_e(e)];return t.push(...ie(e)),t}var St=p(g,"agents"),kt=p(g,"usage-cache.json"),vt=p(g,"reachable-models.json"),xt=p(g,"workflows");function wt(){process.env.HXF_CODING_AGENT_DIR=g}var $t=p(g,"images");function B(e=g){return de(e,"mcp.json")}function q(e){let t=[];if(e===void 0)return t;if(typeof e!="object"||e===null||Array.isArray(e))return["mcp must be an object of server names"];for(let[r,n]of Object.entries(e)){if(!/^[A-Za-z0-9_-]+$/.test(r)){t.push(`mcp server "${r}" must use only letters, digits, _ and -`);continue}if(typeof n!="object"||n===null||Array.isArray(n)){t.push(`mcp server "${r}" must be an object`);continue}let s=n,i=typeof s.command=="string"&&s.command.trim()!=="",o=typeof s.url=="string"&&s.url.trim()!=="";!i&&!o&&t.push(`mcp server "${r}" needs either a command or a url`),s.args!==void 0&&!Array.isArray(s.args)&&t.push(`mcp server "${r}": args must be an array`);for(let a of["env","headers"]){let c=s[a];if(c!==void 0){if(typeof c!="object"||c===null||Array.isArray(c)){t.push(`mcp server "${r}": ${a} must be an object of strings`);continue}for(let[l,f]of Object.entries(c))typeof f!="string"&&t.push(`mcp server "${r}": ${a}.${l} must be a string`)}}}return t}function G(e){if(!E(e))return{mcpServers:{}};try{let t=JSON.parse(D(e,"utf8"));if(!t||typeof t!="object"||Array.isArray(t))return{mcpServers:{}};let r=t.mcpServers;return!r||typeof r!="object"||Array.isArray(r)?{mcpServers:{}}:{mcpServers:r}}catch{return{mcpServers:{}}}}function jt(e,t=g){let r=Object.keys(e);if(r.length===0)return{added:[],skipped:[],problems:[]};let n=B(t),s=[];if(E(n))try{JSON.parse(D(n,"utf8"))}catch{return{added:[],skipped:[],problems:[`${n} is not valid JSON; leaving it alone`]}}let i=G(n),o=[],a=[];for(let c of r){if(i.mcpServers[c]!==void 0){a.push(c);continue}i.mcpServers[c]=e[c],o.push(c)}if(o.length>0)try{A(n,`${JSON.stringify(i,null,2)}
|
|
8
|
+
`)}catch(c){return{added:[],skipped:a,problems:[`could not write ${n}: ${c instanceof Error?c.message:String(c)}`]}}return{added:o,skipped:a,problems:s}}function Ht(e,t=new Set,r=g){let n=B(r),s=[];if(e.length===0||!E(n))return{removed:[],kept:[],problems:s};let i=G(n),o=[],a=[];for(let c of e)if(i.mcpServers[c]!==void 0){if(t.has(c)){a.push(c);continue}delete i.mcpServers[c],o.push(c)}if(o.length>0)try{A(n,`${JSON.stringify(i,null,2)}
|
|
9
|
+
`)}catch(c){return{removed:[],kept:a,problems:[`could not write ${n}: ${c instanceof Error?c.message:String(c)}`]}}return{removed:o,kept:a,problems:s}}var pe="@netrodev/howtocode-roblox-bridge";function Nt(e=g){let t=B(e);if(!E(t))return[];try{JSON.parse(D(t,"utf8"))}catch{return[]}let r=G(t),n=Object.keys(r.mcpServers).filter(s=>{let i=r.mcpServers[s];return[i.command,...Array.isArray(i.args)?i.args:[]].map(a=>String(a??"")).some(a=>a===pe||a.startsWith(`${pe}@`))});if(n.length===0)return[];for(let s of n)delete r.mcpServers[s];try{A(t,`${JSON.stringify(r,null,2)}
|
|
10
|
+
`)}catch{return[]}return n}function Tt(e){if(typeof e.url=="string"&&e.url)return`http: ${e.url}`;let t=typeof e.command=="string"?e.command:"",r=Array.isArray(e.args)?e.args.filter(n=>typeof n=="string"):[];return`stdio: ${[t,...r].join(" ")}`.trim()}function ze(){return de(Le(Fe(import.meta.url)),"presets","mcp-hub.json")}function Dt(e=ze()){let t=[];if(!E(e))return{entries:[],problems:[`no MCP catalogue at ${e}`]};let r;try{r=JSON.parse(D(e,"utf8"))}catch(i){return{entries:[],problems:[`${e} is not valid JSON: ${i instanceof Error?i.message:String(i)}`]}}let n=r?.entries;if(!Array.isArray(n))return{entries:[],problems:[`${e} has no entries array`]};let s=[];for(let i of n){if(typeof i!="object"||i===null||Array.isArray(i))continue;let o=i,a=typeof o.name=="string"?o.name.trim():"";if(!a){t.push("an entry has no name");continue}if(!/^[A-Za-z0-9_-]+$/.test(a)){t.push(`"${a}" is not a usable server name`);continue}let c=typeof o.command=="string"&&o.command.trim()!=="",l=typeof o.url=="string"&&o.url.trim()!=="";if(!c&&!l){t.push(`"${a}" has neither a command nor a url`);continue}s.push({name:a,title:typeof o.title=="string"?o.title:a,description:typeof o.description=="string"?o.description:"",category:typeof o.category=="string"?o.category:"other",preset:typeof o.preset=="string"?o.preset:void 0,command:typeof o.command=="string"?o.command:void 0,url:typeof o.url=="string"?o.url:void 0,args:Array.isArray(o.args)?o.args.filter(f=>typeof f=="string"):void 0,env:o.env&&typeof o.env=="object"&&!Array.isArray(o.env)?o.env:void 0,needs:Array.isArray(o.needs)?o.needs.filter(f=>typeof f=="string"):void 0,docs:typeof o.docs=="string"?o.docs:void 0})}return{entries:s,problems:t}}function Mt(e){return[...new Set(e.map(t=>t.category))].sort()}function Ct(e,t){return e.filter(r=>r.category===t).sort((r,n)=>r.title.localeCompare(n.title))}function _t(e,t){return e.find(r=>r.name===t)}function Lt(e){let t={};return e.command&&(t.command=e.command),e.url&&(t.url=e.url),e.args&&e.args.length>0&&(t.args=[...e.args]),e.env&&Object.keys(e.env).length>0&&(t.env={...e.env}),e.description&&(t.description=e.description),t}function Ft(e,t=process.env){return(e.needs??[]).filter(r=>!t[r])}export{B as a,q as b,jt as c,Ht as d,pe as e,Nt as f,Tt as g,ze as h,Dt as i,Mt as j,Ct as k,_t as l,Lt as m,Ft as n,ee as o,te as p,ne as q,se as r,Ye as s,et as t,tt as u,ie as v,rt as w,nt as x,ae as y,st as z,it as A,ot as B,at as C,ct as D,lt as E,ut as F,ft as G,g as H,ht as I,_e as J,bt as K,St as L,kt as M,vt as N,xt as O,wt as P,$t as Q};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as We,B as De,C as Ce,E as R,F as H,Fa as ot,H as B,I as Pe,Q as je,R as Ne,Ra as st,S as Me,T as Fe,U as Le,Ua as Q,V as Be,W as Ue,Wa as rt,Y as Ge,_ as Y,a as N,b as M,ba as He,c as ge,ca as qe,d as he,da as ze,e as we,ea as V,f as be,fa as Ze,g as A,ga as Ke,i as ye,j as ke,ja as Xe,k as Se,l as _e,la as Ye,m as X,ma as q,na as Ve,o as Te,oa as Je,p as Ee,q as $e,qa as J,r as ve,s as Ae,t as x,u as Re,ua as Qe,va as et,w as Oe,x as W,xa as tt,y as Ie,ya as nt}from"./chunk-
|
|
1
|
+
import{$ as We,B as De,C as Ce,E as R,F as H,Fa as ot,H as B,I as Pe,Q as je,R as Ne,Ra as st,S as Me,T as Fe,U as Le,Ua as Q,V as Be,W as Ue,Wa as rt,Y as Ge,_ as Y,a as N,b as M,ba as He,c as ge,ca as qe,d as he,da as ze,e as we,ea as V,f as be,fa as Ze,g as A,ga as Ke,i as ye,j as ke,ja as Xe,k as Se,l as _e,la as Ye,m as X,ma as q,na as Ve,o as Te,oa as Je,p as Ee,q as $e,qa as J,r as ve,s as Ae,t as x,u as Re,ua as Qe,va as et,w as Oe,x as W,xa as tt,y as Ie,ya as nt}from"./chunk-VDUY46W2.js";import{b as xe}from"./chunk-27TRKD65.js";import{c as ue}from"./chunk-GEAWXEQG.js";import{h as pe,l as fe}from"./chunk-K4ONXZQE.js";import{t as me}from"./chunk-SVONBXW3.js";import"./chunk-7LA2AMZB.js";import{H as S,K as de,v as ce,w as le}from"./chunk-465RG5I6.js";import"./chunk-UTYFLLSM.js";import"./chunk-MVVEYKN6.js";import"./chunk-NFVGCV56.js";import{b as G,c as ie,d as ae}from"./chunk-XSUEEWKS.js";import"./chunk-WOT6VMZA.js";import{join as Nt}from"node:path";import{hostname as io}from"node:os";import{createAgentSession as ao,createCodemodeExtension as co,createMcpExtension as lo,createToolSearchExtension as uo,DefaultResourceLoader as po,ProjectTrustStore as fo,SessionManager as Z,SettingsManager as mo}from"@netrodev/hxf-coding-agent";import{existsSync as Ft,readFileSync as Lt}from"node:fs";import{join as Bt}from"node:path";var it=Bt(S,"APPEND_SYSTEM.md"),Ut=["<non-interactive>","This run has no user attached: it was started with --print, and there is nobody to answer a question. Anything that stops and waits for a reply \u2014 `ask`, a confirmation, a skill that resolves a mode by asking which mode to use \u2014 will simply end the run with the task unfinished.","So do not ask. Where an instruction tells you to ask the user and wait, take the default it describes and continue, and say which default you took and why in your final answer. The user reads that answer; they cannot answer mid-run.","Where a skill offers a choice of modes, prefer the one that applies the rules while you work over the one that audits afterwards: this is the mode for building something now, and the audit mode can still be run later by the same person who reads your answer.","</non-interactive>"].join(`
|
|
2
2
|
`),Gt=16*1024;function Wt(e){try{if(!Ft(e))return;let t=Lt(e,"utf8").trim();return!t||Buffer.byteLength(t,"utf8")>Gt?void 0:t}catch{return}}function at(e,t){let s=[t?e:`${e}
|
|
3
3
|
|
|
4
4
|
${Ut}`],n=Wt(it);return n&&s.push(`# Standing instructions from ${it}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as a,e as b,f as c,g as d,h as e,i as f,j as g,k as h,l as i}from"./chunk-
|
|
1
|
+
import{d as a,e as b,f as c,g as d,h as e,i as f,j as g,k as h,l as i}from"./chunk-K4ONXZQE.js";import"./chunk-UTYFLLSM.js";import"./chunk-NFVGCV56.js";import"./chunk-XSUEEWKS.js";import"./chunk-WOT6VMZA.js";export{b as CLI_REFRESH_SKEW_MS,c as accessTokenIsFresh,g as clearCliCredential,a as cliCredentialsPath,e as readCliCredential,h as refreshCliCredential,d as refreshTokenIsUsable,i as renewCliCredentialIfNeeded,f as writeCliCredential};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as j}from"./chunk-MCAAX33K.js";import{H as m,N as A}from"./chunk-
|
|
1
|
+
import{b as j}from"./chunk-MCAAX33K.js";import{H as m,N as A}from"./chunk-465RG5I6.js";import"./chunk-UTYFLLSM.js";import{j as R}from"./chunk-MVVEYKN6.js";import{b as M,d as T,f as D}from"./chunk-TUXY64DT.js";import{a as I}from"./chunk-U3GZBLTM.js";import{a as b}from"./chunk-XSUEEWKS.js";import"./chunk-WOT6VMZA.js";import{spawnSync as J}from"node:child_process";import{existsSync as S,readdirSync as E,readFileSync as x,realpathSync as B,statSync as C,writeFileSync as F,unlinkSync as z}from"node:fs";import{dirname as N,join as p}from"node:path";var k=[22,19];async function W(t="https://api.howtofix.id/api/status"){let n=[],[s,e]=process.versions.node.split(".").map(Number),r=s>k[0]||s===k[0]&&e>=k[1];n.push({name:"node",ok:r,detail:`${process.versions.node} (needs >= ${k[0]}.${k[1]})`});let i=J("git",["--version"],{encoding:"utf8"});n.push({name:"git",ok:i.status===0,detail:i.status===0?i.stdout.trim():"not found on PATH"});let o=I();n.push({name:"sandbox",ok:!!o,detail:o??"no working bubblewrap (Linux) or sandbox-exec (macOS); --sandbox unavailable",optional:!0});let l=!1,c=m;try{let d=p(m,`.doctor-${process.pid}`);F(d,"ok"),z(d),l=!0}catch(d){c=`${m} is not writable: ${d instanceof Error?d.message:String(d)}`}n.push({name:"state dir",ok:l,detail:c});let a=p(m,"auth.json"),u="no auth.json \u2014 run `howtocode` and sign in",h=!1;try{let d=JSON.parse(x(a,"utf8")),f=Object.keys(d).length;h=f>0,u=h?`${f} provider credential${f===1?"":"s"}`:u}catch{}n.push({name:"auth",ok:h,detail:u,optional:!0});try{let d=Date.now(),f=await fetch(t,{signal:AbortSignal.timeout(5e3)});n.push({name:"gateway",ok:f.ok,detail:`${t} \u2192 ${f.status} in ${Date.now()-d}ms`,optional:!0})}catch(d){n.push({name:"gateway",ok:!1,detail:`${t} unreachable: ${d instanceof Error?d.message:String(d)}`,optional:!0})}return n.push(G()),n}function G(t=q()){if(t===void 0)return{name:"install",ok:!0,detail:"not an npm install; skipped",optional:!0};if(!S(t))return{name:"install",ok:!0,detail:"no bundled dependencies to check",optional:!0};let n=[],s=0;for(let e of["@netrodev"]){let r=p(t,e);if(S(r))for(let i of E(r)){let o=p(r,i,"dist");if(S(o))for(let l of _(o)){s+=1;let c=x(l,"utf8");for(let a of c.matchAll(/import\("(\.[^"]+)"\)/g)){let u=p(N(l),a[1]);S(u)||n.push(`${e}/${i}: ${u.slice(o.length+1)}`)}}}}return n.length>0?{name:"install",ok:!1,detail:`${n.length} module${n.length===1?"":"s"} missing (${n[0]}); reinstall with \`npm install -g howtocode@latest\``}:{name:"install",ok:!0,detail:`${s} lazy module${s===1?"":"s"} present`}}function q(){try{return p(N(N(B(process.argv[1]??""))),"node_modules")}catch{return}}function _(t,n=[]){let s;try{s=E(t)}catch{return n}for(let e of s){let r=p(t,e);if(e.endsWith(".lazy.js"))n.push(r);else if(!e.includes("."))try{C(r).isDirectory()&&_(r,n)}catch{}}return n}async function ie(){let t=await W(),n=Math.max(...t.map(e=>e.name.length));for(let e of t){let r=e.ok?"ok ":e.optional?"warn":"FAIL";console.log(` ${r} ${e.name.padEnd(n)} ${e.detail}`)}let s=t.filter(e=>!e.ok&&!e.optional);return s.length>0?(console.log(`
|
|
2
2
|
${s.length} problem${s.length===1?"":"s"} must be fixed before a session will work.`),1):0}function ce(t=m){let n=p(t,"models.json"),s;try{s=x(n,"utf8")}catch(a){return a.code==="ENOENT"?console.log(` no models.json at ${n} \u2014 run \`howtocode /connect\` to pull the catalogue`):j(b,"models",a),1}let e;try{e=JSON.parse(s)}catch(a){return console.error(`${b}: models: ${n} is not valid JSON (${a instanceof Error?a.message:String(a)})`),console.error(" fix the file, or delete it and run `howtocode /connect` to write a new one"),1}let r=e.providers??{},i=D(A),o=i?new Set(i.ids):void 0,l=new Set,c=0;for(let[a,u]of Object.entries(r)){let h=u.models??[],d=h.map(f=>f.id).filter(Boolean);for(let f of d)l.add(f);c+=d.length,console.log(` ${a} (${d.length})`);for(let f of h){if(!f.id)continue;let O=T(m).get(f.id),$=M(O??[]),g=$?` ${$}`:"",w=o&&!o.has(f.id)?" \u2014 not on this account":"";console.log(` ${f.id}${g}${w}`)}}if(o){let a=[...l].filter(u=>!o.has(u)).length;console.log(`
|
|
3
3
|
${[...o].filter(u=>l.has(u)).length} of ${c} listed model(s) this account can call${a>0?`; ${a} cannot (kept for other plans)`:""}`)}else console.log("\n which of these this account can call is unknown: run `howtocode` once to record it");return c===0?(console.log(" no models configured"),1):0}function v(t=15,n=m){let s=p(n,"sessions"),e;try{e=E(s)}catch{return[]}let r=[];for(let i of e){let o=p(s,i),l;try{l=E(o)}catch{continue}for(let c of l){if(!c.endsWith(".jsonl"))continue;let a=p(o,c);try{let u=C(a);r.push({file:a,project:i,modified:u.mtimeMs,bytes:u.size})}catch{}}}return r.sort((i,o)=>o.modified-i.modified).slice(0,t)}function le(t){let n=t.indexOf("--search");if(n>=0){let o=t[n+1]?.trim();if(!o)return console.error(`${b}: sessions: --search needs a word or phrase`),2;let l=K(o);if(l.length===0)return console.log(` no session mentions "${o}"`),0;for(let c of l){let a=new Date(c.row.modified).toISOString().replace("T"," ").slice(0,16),u=`${c.matches} hit${c.matches===1?"":"s"}`;console.log(` ${a} ${c.row.project} (${u})`),console.log(` ${c.row.file}`),console.log(` ${c.snippet}`)}return 0}let s=t.indexOf("--limit"),e=s>=0&&Number(t[s+1])||15,r=v(e);if(r.length===0)return console.log(` no saved sessions under ${p(m,"sessions")}`),t.includes("--export")?1:0;let i=t.indexOf("--export");if(i>=0){let o=Number(t[i+1]);if(!Number.isInteger(o)||o<1||o>r.length)return console.error(`${b}: sessions: --export needs a number from the list (1-${r.length})`),2;let l=r[o-1];try{console.log(Q(l.file))}catch(c){return j(b,"sessions",c),1}return 0}return r.forEach((o,l)=>{let c=new Date(o.modified).toISOString().replace("T"," ").slice(0,16),a=Math.round(o.bytes/1024);console.log(` ${String(l+1).padStart(2)} ${c} ${String(a).padStart(6)}k ${o.project}`),console.log(` ${o.file}`)}),0}function H(t){let n=t;try{let s=JSON.parse(t),e=s.message?.content??s.content;if(typeof e=="string"&&e.trim())n=e;else if(Array.isArray(e)){let r=e.map(i=>i&&typeof i=="object"&&"text"in i?String(i.text):"").join(" ");r.trim()&&(n=r)}}catch{}return R(X(n).replace(/\s+/g," ").trim())}function X(t){return t.replace(/\u001b\[[0-9;?]*[ -/]*[@-~]|\u001b\][^\u0007]*\u0007|\u001b[@-Z\\-_]/g,"")}function Z(t,n,s=80){let e=t.toLowerCase().indexOf(n);if(e<0)return t.slice(0,s*2).trim();let r=Math.max(0,e-s),i=Math.min(t.length,e+n.length+s);return`${r>0?"\u2026":""}${t.slice(r,i).trim()}${i<t.length?"\u2026":""}`}function K(t,n=10,s=m){let e=t.toLowerCase(),r=new RegExp(`\\b${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`,"i"),i=[];for(let o of v(Number.MAX_SAFE_INTEGER,s)){let l;try{l=x(o.file,"utf8")}catch{continue}let c=0,a=0,u=0,h=0,d=!1,f="";for(let $ of l.split(`
|
|
4
4
|
`)){let g=$.toLowerCase(),w=g.indexOf(e);if(w<0)continue;let y=0;for(;w>=0;)y++,w=g.indexOf(e,w+e.length);c+=y;let L=g.includes('"role":"user"'),P=g.includes('"role":"toolresult"')||g.includes('"role":"tool"');L?a+=y:P?h+=y:u+=y,r.test($)&&(d=!0),f||(f=Z(H($),e))}if(c===0)continue;let O=(a>0?100:0)+(u>0?10:0)+Math.min(h,5)+(d?5:0)+Math.min(c,10)/100;i.push({row:o,matches:c,score:O,snippet:f})}return i.sort((o,l)=>l.score-o.score||l.row.modified-o.row.modified).slice(0,n)}function Q(t){let n=[`# Session ${t.split(/[\\/]/).pop()??t}`,""];for(let s of x(t,"utf8").split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A,B,C,D,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-
|
|
1
|
+
import{A,B,C,D,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-GEAWXEQG.js";import"./chunk-7LA2AMZB.js";import"./chunk-UTYFLLSM.js";import"./chunk-NFVGCV56.js";import"./chunk-XSUEEWKS.js";import"./chunk-WOT6VMZA.js";export{g as CATALOG_CACHE_TTL_MS,m as DEFAULT_CONTEXT_WINDOW,a as HOWTOCODE_BASE_URL,b as HOWTOCODE_CONSOLE_URL,l as HOWTOCODE_MODEL_COMPAT,c as HOWTOCODE_PROVIDERS,j as HTTP_IDLE_TIMEOUT_MS,r as UNLIMITED_SENTINEL,w as applyCatalog,x as applyCompat,B as checkAccount,s as checkCreditPools,t as checkUsage,d as configuredProviderIds,y as countNewModels,k as ensureGatewaySettings,C as fetchGatewayPrices,A as findLiveModels,q as isHowtoCodeProvider,h as loadCatalog,o as looksLikeToken,n as maskToken,v as mergeModels,e as newProviderEntry,p as parseModelIds,z as probeModel,D as readProviderKey,f as repairGatewayModels,i as repairModelFacts,u as syncGatewayModelsOnStart};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as v}from"./chunk-7LA2AMZB.js";import{a as w}from"./chunk-UTYFLLSM.js";import{h as M,i as T}from"./chunk-
|
|
1
|
+
import{a as v}from"./chunk-7LA2AMZB.js";import{a as w}from"./chunk-UTYFLLSM.js";import{h as M,i as T}from"./chunk-NFVGCV56.js";import{existsSync as H,mkdirSync as I,readFileSync as b}from"node:fs";import{join as k}from"node:path";var J="https://models.dev/api.json";var N=["anthropic","openai","google","deepseek","zai","xai","moonshotai","minimax","alibaba","xiaomi","meta","tencent","nvidia","venice","openrouter"];function _(n){return n.toLowerCase().replace(/[^a-z0-9]+/g,"")}function S(n){let e=n.split("/");return _(e[e.length-1]??n)}function q(n){let e=new Map,s=new Map;if(!n||typeof n!="object")return e;let t=n,r=c=>{let o=N.indexOf(c);return o===-1?N.length:o};for(let c of Object.keys(t).sort()){let o=t[c]?.models;if(!(!o||typeof o!="object"))for(let a of Object.keys(o)){let i=o[a],u=Number(i?.limit?.context);if(!Number.isFinite(u)||u<=0)continue;let l=_(a),f=r(c),d=s.get(l);if(d!==void 0&&d<=f)continue;let m=Number(i?.limit?.output);e.set(l,{contextWindow:Math.floor(u),maxTokens:Number.isFinite(m)&&m>0?Math.floor(m):void 0,reasoning:i?.reasoning===!0,vision:Array.isArray(i?.modalities?.input)&&i.modalities.input.includes("image")}),s.set(l,f)}}return e}function A(n,e){let s=_(e);if(!s)return;let t=n.get(s);if(t)return t;let r=S(e);for(let[c,o]of n)if(S(c)===r)return o;for(let[c,o]of n)if(c.endsWith(s)||s.endsWith(c))return o}function R(n){return`${n}/models-dev-cache.json`}function $(n){let e={};for(let[s,t]of n)e[s]=[t.contextWindow,t.maxTokens??0,t.reasoning?1:0,t.vision?1:0];return JSON.stringify(e)}function P(n){let e=new Map,s;try{s=JSON.parse(n)}catch{return e}if(!s||typeof s!="object")return e;for(let[t,r]of Object.entries(s)){if(!Array.isArray(r)||r.length<3)continue;let c=Number(r[0]),o=Number(r[1]);!Number.isFinite(c)||c<=0||e.set(t,{contextWindow:Math.floor(c),maxTokens:Number.isFinite(o)&&o>0?Math.floor(o):void 0,reasoning:r[2]===1||r[2]===!0,vision:r[3]===1||r[3]===!0})}return e}async function U(n){let e=n?.url??J,s=n?.fetchImpl??fetch,t=n?.timeoutMs??2e4,r=new AbortController,c=setTimeout(()=>r.abort(),t);try{let o=await s(e,{signal:r.signal,headers:{Accept:"application/json"}});if(!o.ok)return{ok:!1,message:`the model catalogue answered ${o.status}`};let a=q(await o.json());return a.size===0?{ok:!1,message:"the model catalogue was empty or in an unexpected shape"}:{ok:!0,index:a}}catch(o){return{ok:!1,message:o instanceof Error&&o.name==="AbortError"?`the model catalogue did not answer within ${Math.round(t/1e3)}s`:"could not reach the model catalogue"}}finally{clearTimeout(c)}}var x="https://api.howtofix.id/v1",ce=v,C=["howtocode","howtocode-free"];function ue(n){try{let s=JSON.parse(b(k(n,"models.json"),"utf8")).providers;return!s||typeof s!="object"?new Set:new Set(Object.keys(s))}catch{return new Set}}function le(){return{baseUrl:x,api:"openai-completions",headers:{[M]:T()}}}function de(n){let e=k(n,"models.json"),s;try{s=JSON.parse(b(e,"utf8"))}catch{return 0}let t=s.providers;if(!t||typeof t!="object")return 0;let r=0;for(let c of C){let o=t[c];if(!o||!Array.isArray(o.models))continue;let a=Y(o.models),i={...o.headers??{},[M]:T()},u=o.headers?.[M]!==i[M];a.changed===0&&!u||(o.models=a.models,o.headers=i,r+=a.changed===0?1:a.changed)}if(r===0)return 0;try{w(e,`${JSON.stringify(s,null,2)}
|
|
2
2
|
`)}catch{return 0}return r}var G=10080*60*1e3;async function F(n,e){let s=R(n),t=e?.now??Date.now(),r,c=0;try{let i=JSON.parse(b(s,"utf8"));typeof i?.entries=="string"&&(r=P(i.entries),c=Number(i.at)||0)}catch{r=void 0}if(r&&r.size>0&&t-c<G&&!e?.force)return{index:r};let a=await U({fetchImpl:e?.fetchImpl});if(!a.ok)return r&&r.size>0?{index:r,message:a.message}:{index:new Map,message:a.message};try{I(n,{recursive:!0}),w(s,`${JSON.stringify({at:t,entries:$(a.index)})}
|
|
3
3
|
`)}catch{}return{index:a.index}}async function fe(n,e){let s=k(n,"models.json"),t;try{t=JSON.parse(b(s,"utf8"))}catch{return{changed:0}}let r=t.providers;if(!r||typeof r!="object")return{changed:0};let{index:c,message:o}=await F(n,e);if(c.size===0&&!e?.prices&&!e?.tiers)return{changed:0,message:o};let a=0;for(let i of C){let u=r[i];if(!u||!Array.isArray(u.models))continue;let l=Z(u.models,c,e?.prices,e?.tiers);l.changed!==0&&(u.models=l.models,a+=l.changed)}if(a>0)try{w(s,`${JSON.stringify(t,null,2)}
|
|
4
4
|
`)}catch{return{changed:0,message:"the models file could not be written"}}return{changed:a,message:o}}var B=3e5;function me(n){let e=k(n,"settings.json"),s={};try{let t=b(e,"utf8"),r=JSON.parse(t);r&&typeof r=="object"&&!Array.isArray(r)&&(s=r)}catch{if(H(e))return!1}if("httpIdleTimeoutMs"in s)return!1;s.httpIdleTimeoutMs=B;try{I(n,{recursive:!0}),w(e,`${JSON.stringify(s,null,2)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j}from"./chunk-NFVGCV56.js";import"./chunk-XSUEEWKS.js";import"./chunk-WOT6VMZA.js";export{h as CLI_CLIENT_HEADER,a as CLI_SIGNING_KEY_ID,i as cliClientHeader,c as cliSignaturePayload,f as cliSigningKeyFingerprint,e as cliSigningKeyMatchesPanel,b as cliSigningPublicKey,d as createNonce,g as describeClient,j as signLoginRequest};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as T}from"./chunk-UTYFLLSM.js";import{g as R,j as P}from"./chunk-YVRSL6ZX.js";import{existsSync as z,readFileSync as ye,rmSync as xe}from"node:fs";import{join as ve}from"node:path";import{createHash as q,randomBytes as J}from"node:crypto";import{createServer as ne}from"node:http";import{execFileSync as X}from"node:child_process";import{createHmac as Q}from"node:crypto";import{readFileSync as ee}from"node:fs";import{arch as F,cpus as M,hostname as N,platform as v,userInfo as O}from"node:os";var te="howtocode-cli-hwid-v1";function x(e){try{let t=ee(e,"utf8").trim();return t.length>0?t:void 0}catch{return}}function $(e,t){try{let r=X(e,t,{encoding:"utf8",timeout:3e3,stdio:["ignore","pipe","ignore"]});return r.trim().length>0?r.trim():void 0}catch{return}}function re(){let e=v();if(e==="linux"){let t=x("/etc/machine-id");if(t)return{value:t,source:"machine-id",strong:!0};let r=x("/var/lib/dbus/machine-id");if(r)return{value:r,source:"dbus-machine-id",strong:!0};let o=x("/sys/class/dmi/id/product_uuid");return o?{value:o,source:"dmi-product-uuid",strong:!0}:void 0}if(e==="win32"){let r=$("reg",["query","HKLM\\SOFTWARE\\Microsoft\\Cryptography","/v","MachineGuid"])?.match(/MachineGuid\s+REG_SZ\s+(\S+)/i);return r?.[1]?{value:r[1],source:"windows-machine-guid",strong:!0}:void 0}if(e==="darwin"){let r=$("ioreg",["-rd1","-c","IOPlatformExpertDevice"])?.match(/"IOPlatformUUID"\s*=\s*"([^"]+)"/);return r?.[1]?{value:r[1],source:"platform-uuid",strong:!0}:void 0}}function H(){let e=re(),t=e?.value??[N(),v(),F(),O().username].join("\0"),r=e?.source??"hostname";return{id:Q("sha256",te).update(t).digest("hex").slice(0,32),source:r,strong:e?.strong??!1}}function U(e){return[e.id,e.source,N(),v(),F(),O().username,String(M().length),M()[0]?.model??""]}var _="https://howtofix.id",se=300*1e3,G=3e3,K="/callback";function I(e){return e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function oe(){return I(J(32))}function ie(e){return I(q("sha256").update(e).digest())}function ae(){return I(J(16))}var ce="howtocode-cli-",ue="x-howtocode-client",le="cli";function L(e){let t=e??U(H());return ce+q("sha256").update(t.join("\0")).digest("hex").slice(0,32)}function de(){return{"content-type":"application/json",[ue]:le}}var fe=()=>new Promise((e,t)=>{let r=ne();r.once("error",t),r.listen(0,"127.0.0.1",()=>{let{port:o}=r.address();e({port:o,close:()=>r.close(),waitForCode:(n,s)=>new Promise((i,a)=>{let c=(l,f)=>{let h=new URL(l.url??"/","http://127.0.0.1");if(h.pathname!==K){f.writeHead(404).end("not found");return}let y=(V,Z)=>f.writeHead(200,{"content-type":"text/html; charset=utf-8"}).end(`<!doctype html><meta charset="utf-8"><h2>${V}</h2><p>${Z}</p>`),S=h.searchParams.get("error")??"",E=h.searchParams.get("code")??"",Y=h.searchParams.get("state")??"";if(S){y("Sign-in was refused","You can close this tab."),u(new Error(`the browser reported: ${S}`));return}if(!E||Y!==n){y("This callback did not belong to the login","You can close this tab."),u(new Error("the callback carried the wrong state"));return}y("Signed in","You can close this tab and go back to HowToCode."),u(void 0,E)},u=(l,f)=>{r.off("request",c),s?.removeEventListener("abort",g),l?a(l):i(f)},g=()=>u(new Error("cancelled"));s?.addEventListener("abort",g,{once:!0}),r.on("request",c)})})})});function k(e,t){e.onProgress?.(t)}async function p(e,t,r,o){let n=await e(t,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(r),signal:o}),s={};try{s=await n.json()}catch{}let i=Number(n.headers?.get?.("retry-after"));return{status:n.status,body:s,retryAfterSeconds:Number.isFinite(i)&&i>0?i:void 0}}function d(...e){for(let t of e)if(typeof t=="string"&&t.trim()!=="")return t.trim()}function j(...e){for(let t of e)if(typeof t=="number"&&Number.isFinite(t))return t;return 0}function me(e){try{let t=new URL(e).searchParams.get("code");return t&&t.trim()!==""?t.trim():void 0}catch{return}}async function ge(e,t,r){let o=await e(t,{headers:de(),signal:r}),n={};try{n=await o.json()}catch{}let s=Number(o.headers?.get?.("retry-after"));return{status:o.status,body:n,retryAfterSeconds:Number.isFinite(s)&&s>0?s:void 0}}function A(e){let t=e.data,r=[e.token,e.api_key,e.apiKey,e.key,t?.token,t?.api_key,t?.apiKey,t?.key];for(let o of r)if(typeof o=="string"&&o.trim().startsWith("sk-"))return o.trim()}function pe(e){let t=e.data,r=d(e.token,t?.token),o=d(e.refresh_token,t?.refresh_token),n=d(e.device_id,t?.device_id);if(!r||!o||!n)return;let s=j(e.access_expires_at,t?.access_expires_at),i=j(e.refresh_expires_at,t?.refresh_expires_at);return{accessToken:r,accessExpiresAt:s,refreshToken:o,deviceId:n,refreshExpiresAt:i}}function m(e,t){let r=e.message??e.error;return typeof r=="string"&&r.trim()?r.trim():t}async function He(e){let t=e.fetchImpl??fetch,r=(e.panelUrl??_).replace(/\/+$/,""),o=e.timeoutMs??se,n={...e,panel:r,fetchImpl:t,timeoutMs:o},s=await ke(n);if(s.ok||s.terminal)return s.result;let i=await he(n);if(i.ok||i.terminal)return i.result;let a=await we(n);return a.ok?a:{ok:!1,message:`${s.result.ok?"":s.result.message}; ${i.result.ok?"":i.result.message}; ${a.message}. howtofix.id does not offer a browser login a local client can complete yet \u2014 run /connect and paste a token from ${r}/keys instead.`}}async function he(e){let t=oe(),r=ae(),o;try{o=await(e.loopback??fe)();let n=`http://127.0.0.1:${o.port}${K}`,s=await p(e.fetchImpl,`${e.panel}/api/oauth/device/start`,{redirect_uri:n,code_challenge:ie(t),code_challenge_method:"S256",state:r},e.signal);if(s.status===404)return{ok:!1,terminal:!1,result:{ok:!1,message:"the panel has no loopback login endpoint"}};if(s.status>=400)return{ok:!1,terminal:!1,result:{ok:!1,message:m(s.body,`the panel refused the login (${s.status})`)}};let i=typeof s.body.authorize_url=="string"?s.body.authorize_url:"";if(!i)return{ok:!1,terminal:!1,result:{ok:!1,message:"the panel did not say where to send the browser"}};k(e,{kind:"browser",url:i});let a=await be(o.waitForCode(r,e.signal),e.timeoutMs),c=await p(e.fetchImpl,`${e.panel}/api/oauth/device/token`,{flow_token:s.body.flow_token,code:a,code_verifier:t},e.signal);if(c.status>=400)return{ok:!1,terminal:!0,result:{ok:!1,message:m(c.body,`the panel refused the exchange (${c.status})`)}};let u=A(c.body);return u?{ok:!0,result:{ok:!0,token:u}}:{ok:!1,terminal:!0,result:{ok:!1,message:"the panel did not return an API key"}}}catch(n){let s=n instanceof Error?n.message:String(n);return{ok:!1,terminal:s==="cancelled",result:{ok:!1,message:s}}}finally{o?.close()}}async function ke(e){let t=e.fingerprintId??L(),r=e.clientInfo??R(),o=P(t,r);try{let n=await p(e.fetchImpl,`${e.panel}/api/auth/cli/code`,{fingerprintId:t,clientInfo:r,...o},e.signal);if(n.status===404)return{ok:!1,terminal:!1,result:{ok:!1,message:"the panel has no CLI login endpoint"}};if(n.status===401)return{ok:!1,terminal:!1,result:{ok:!1,message:"the panel did not recognise this build as the HowToCode CLI \u2014 update it with `npm install -g howtocode@latest`"}};if(n.status===429)return{ok:!1,terminal:!0,result:{ok:!1,message:`too many sign-in attempts from this machine right now.${n.retryAfterSeconds?` Try again in ${Math.ceil(n.retryAfterSeconds/60)} minute(s).`:""}`}};if(n.status>=400)return{ok:!1,terminal:!1,result:{ok:!1,message:m(n.body,`the panel refused the login (${n.status})`)}};let s=n.body.data??{},i=d(n.body.login_url,s.login_url),a=d(n.body.code,s.code)??(i?me(i):void 0),c=d(n.body.secret,s.secret);return!i||!a?{ok:!1,terminal:!1,result:{ok:!1,message:"the panel did not return a login URL"}}:c?(k(e,{kind:"browser",url:i}),await D(e,a,c)):(k(e,{kind:"browser",url:i}),await D(e,a,void 0))}catch(n){let s=n instanceof Error?n.message:String(n);return{ok:!1,terminal:s==="cancelled",result:{ok:!1,message:s}}}}async function D(e,t,r){let o=e.pollIntervalMs??G,n=Date.now()+e.timeoutMs;for(;Date.now()<n;){await w(o,e.signal);let s=new URLSearchParams(r?{code:t,secret:r}:{code:t});s.set("capability","device-refresh");let i=await ge(e.fetchImpl,`${e.panel}/api/auth/cli/status?${s}`,e.signal);if(i.status===404)return{ok:!1,terminal:!1,result:{ok:!1,message:"the panel has no CLI login status endpoint"}};if(i.status===403)return{ok:!1,terminal:!0,result:{ok:!1,message:"the panel rejected this poll \u2014 run /connect again"}};if(i.status===429){let u=Math.min(Math.max(i.retryAfterSeconds??5,1)*1e3,3e4);await w(u,e.signal);continue}let a=A(i.body);if(a)return{ok:!0,result:{ok:!0,token:a,credential:pe(i.body)}};if(d(i.body.data?.status,i.body.status)==="expired")return{ok:!1,terminal:!0,result:{ok:!1,message:"the sign-in link expired before it was approved"}};if(i.status>=400)return{ok:!1,terminal:!0,result:{ok:!1,message:m(i.body,`the panel refused the poll (${i.status})`)}}}return{ok:!1,terminal:!0,result:{ok:!1,message:"the sign-in was not approved in time"}}}async function we(e){let t=e.pollIntervalMs??G;try{let r=await p(e.fetchImpl,`${e.panel}/api/oauth/device`,{},e.signal);if(r.status===404)return{ok:!1,message:"the panel has no device-code endpoint"};if(r.status>=400)return{ok:!1,message:m(r.body,`the panel refused the request (${r.status})`)};let o=typeof r.body.device_code=="string"?r.body.device_code:"",n=typeof r.body.user_code=="string"?r.body.user_code:"",s=typeof r.body.verification_uri=="string"?r.body.verification_uri:`${e.panel}/oauth/device`;if(!o||!n)return{ok:!1,message:"the panel did not return a code to show"};k(e,{kind:"code",code:n,url:s});let i=Date.now()+e.timeoutMs;for(;Date.now()<i;){await w(t,e.signal);let a=await p(e.fetchImpl,`${e.panel}/api/oauth/device/poll`,{device_code:o},e.signal);if(a.status===404)return{ok:!1,message:"the panel has no device-code poll endpoint"};let c=typeof a.body.status=="string"?a.body.status:"";if(c==="pending")continue;if(c==="slow_down"){await w(t,e.signal);continue}if(c==="denied")return{ok:!1,message:"the sign-in was refused in the browser"};if(c==="expired")return{ok:!1,message:"the code expired; run /connect again"};let u=A(a.body);if(u)return{ok:!0,token:u};if(a.status>=400)return{ok:!1,message:m(a.body,`the panel refused the poll (${a.status})`)}}return{ok:!1,message:"the code was not approved in time"}}catch(r){return{ok:!1,message:r instanceof Error?r.message:String(r)}}}function be(e,t){return new Promise((r,o)=>{let n=setTimeout(()=>o(new Error("the sign-in was not finished in time")),t);e.then(s=>{clearTimeout(n),r(s)},s=>{clearTimeout(n),o(s)})})}function w(e,t){return new Promise((r,o)=>{let n=setTimeout(r,e);t?.addEventListener("abort",()=>{clearTimeout(n),o(new Error("cancelled"))},{once:!0})})}function b(e){return ve(e,"cli-credentials.json")}var _e=300*1e3;function Ie(e,t=Date.now()){return e.accessToken?!Number.isFinite(e.accessExpiresAt)||e.accessExpiresAt<=0?!0:e.accessExpiresAt*1e3-_e>t:!1}function Le(e,t=Date.now()){return!e.refreshToken||!e.deviceId?!1:!Number.isFinite(e.refreshExpiresAt)||e.refreshExpiresAt<=0?!0:e.refreshExpiresAt*1e3>t}function Ge(e){let t=b(e);if(!z(t))return;let r;try{r=JSON.parse(ye(t,"utf8"))}catch{return}if(!r||typeof r!="object"||Array.isArray(r))return;let o=r,n=typeof o.accessToken=="string"?o.accessToken.trim():"",s=typeof o.refreshToken=="string"?o.refreshToken.trim():"",i=typeof o.deviceId=="string"?o.deviceId.trim():"";if(!(!n||!s||!i))return{accessToken:n,accessExpiresAt:W(o.accessExpiresAt),refreshToken:s,deviceId:i,refreshExpiresAt:W(o.refreshExpiresAt)}}function Ae(e,t){try{return T(b(e),`${JSON.stringify(t,null,2)}
|
|
1
|
+
import{a as T}from"./chunk-UTYFLLSM.js";import{g as R,j as P}from"./chunk-NFVGCV56.js";import{existsSync as z,readFileSync as ye,rmSync as xe}from"node:fs";import{join as ve}from"node:path";import{createHash as q,randomBytes as J}from"node:crypto";import{createServer as ne}from"node:http";import{execFileSync as X}from"node:child_process";import{createHmac as Q}from"node:crypto";import{readFileSync as ee}from"node:fs";import{arch as F,cpus as M,hostname as N,platform as v,userInfo as O}from"node:os";var te="howtocode-cli-hwid-v1";function x(e){try{let t=ee(e,"utf8").trim();return t.length>0?t:void 0}catch{return}}function $(e,t){try{let r=X(e,t,{encoding:"utf8",timeout:3e3,stdio:["ignore","pipe","ignore"]});return r.trim().length>0?r.trim():void 0}catch{return}}function re(){let e=v();if(e==="linux"){let t=x("/etc/machine-id");if(t)return{value:t,source:"machine-id",strong:!0};let r=x("/var/lib/dbus/machine-id");if(r)return{value:r,source:"dbus-machine-id",strong:!0};let o=x("/sys/class/dmi/id/product_uuid");return o?{value:o,source:"dmi-product-uuid",strong:!0}:void 0}if(e==="win32"){let r=$("reg",["query","HKLM\\SOFTWARE\\Microsoft\\Cryptography","/v","MachineGuid"])?.match(/MachineGuid\s+REG_SZ\s+(\S+)/i);return r?.[1]?{value:r[1],source:"windows-machine-guid",strong:!0}:void 0}if(e==="darwin"){let r=$("ioreg",["-rd1","-c","IOPlatformExpertDevice"])?.match(/"IOPlatformUUID"\s*=\s*"([^"]+)"/);return r?.[1]?{value:r[1],source:"platform-uuid",strong:!0}:void 0}}function H(){let e=re(),t=e?.value??[N(),v(),F(),O().username].join("\0"),r=e?.source??"hostname";return{id:Q("sha256",te).update(t).digest("hex").slice(0,32),source:r,strong:e?.strong??!1}}function U(e){return[e.id,e.source,N(),v(),F(),O().username,String(M().length),M()[0]?.model??""]}var _="https://howtofix.id",se=300*1e3,G=3e3,K="/callback";function I(e){return e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function oe(){return I(J(32))}function ie(e){return I(q("sha256").update(e).digest())}function ae(){return I(J(16))}var ce="howtocode-cli-",ue="x-howtocode-client",le="cli";function L(e){let t=e??U(H());return ce+q("sha256").update(t.join("\0")).digest("hex").slice(0,32)}function de(){return{"content-type":"application/json",[ue]:le}}var fe=()=>new Promise((e,t)=>{let r=ne();r.once("error",t),r.listen(0,"127.0.0.1",()=>{let{port:o}=r.address();e({port:o,close:()=>r.close(),waitForCode:(n,s)=>new Promise((i,a)=>{let c=(l,f)=>{let h=new URL(l.url??"/","http://127.0.0.1");if(h.pathname!==K){f.writeHead(404).end("not found");return}let y=(V,Z)=>f.writeHead(200,{"content-type":"text/html; charset=utf-8"}).end(`<!doctype html><meta charset="utf-8"><h2>${V}</h2><p>${Z}</p>`),S=h.searchParams.get("error")??"",E=h.searchParams.get("code")??"",Y=h.searchParams.get("state")??"";if(S){y("Sign-in was refused","You can close this tab."),u(new Error(`the browser reported: ${S}`));return}if(!E||Y!==n){y("This callback did not belong to the login","You can close this tab."),u(new Error("the callback carried the wrong state"));return}y("Signed in","You can close this tab and go back to HowToCode."),u(void 0,E)},u=(l,f)=>{r.off("request",c),s?.removeEventListener("abort",g),l?a(l):i(f)},g=()=>u(new Error("cancelled"));s?.addEventListener("abort",g,{once:!0}),r.on("request",c)})})})});function k(e,t){e.onProgress?.(t)}async function p(e,t,r,o){let n=await e(t,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(r),signal:o}),s={};try{s=await n.json()}catch{}let i=Number(n.headers?.get?.("retry-after"));return{status:n.status,body:s,retryAfterSeconds:Number.isFinite(i)&&i>0?i:void 0}}function d(...e){for(let t of e)if(typeof t=="string"&&t.trim()!=="")return t.trim()}function j(...e){for(let t of e)if(typeof t=="number"&&Number.isFinite(t))return t;return 0}function me(e){try{let t=new URL(e).searchParams.get("code");return t&&t.trim()!==""?t.trim():void 0}catch{return}}async function ge(e,t,r){let o=await e(t,{headers:de(),signal:r}),n={};try{n=await o.json()}catch{}let s=Number(o.headers?.get?.("retry-after"));return{status:o.status,body:n,retryAfterSeconds:Number.isFinite(s)&&s>0?s:void 0}}function A(e){let t=e.data,r=[e.token,e.api_key,e.apiKey,e.key,t?.token,t?.api_key,t?.apiKey,t?.key];for(let o of r)if(typeof o=="string"&&o.trim().startsWith("sk-"))return o.trim()}function pe(e){let t=e.data,r=d(e.token,t?.token),o=d(e.refresh_token,t?.refresh_token),n=d(e.device_id,t?.device_id);if(!r||!o||!n)return;let s=j(e.access_expires_at,t?.access_expires_at),i=j(e.refresh_expires_at,t?.refresh_expires_at);return{accessToken:r,accessExpiresAt:s,refreshToken:o,deviceId:n,refreshExpiresAt:i}}function m(e,t){let r=e.message??e.error;return typeof r=="string"&&r.trim()?r.trim():t}async function He(e){let t=e.fetchImpl??fetch,r=(e.panelUrl??_).replace(/\/+$/,""),o=e.timeoutMs??se,n={...e,panel:r,fetchImpl:t,timeoutMs:o},s=await ke(n);if(s.ok||s.terminal)return s.result;let i=await he(n);if(i.ok||i.terminal)return i.result;let a=await we(n);return a.ok?a:{ok:!1,message:`${s.result.ok?"":s.result.message}; ${i.result.ok?"":i.result.message}; ${a.message}. howtofix.id does not offer a browser login a local client can complete yet \u2014 run /connect and paste a token from ${r}/keys instead.`}}async function he(e){let t=oe(),r=ae(),o;try{o=await(e.loopback??fe)();let n=`http://127.0.0.1:${o.port}${K}`,s=await p(e.fetchImpl,`${e.panel}/api/oauth/device/start`,{redirect_uri:n,code_challenge:ie(t),code_challenge_method:"S256",state:r},e.signal);if(s.status===404)return{ok:!1,terminal:!1,result:{ok:!1,message:"the panel has no loopback login endpoint"}};if(s.status>=400)return{ok:!1,terminal:!1,result:{ok:!1,message:m(s.body,`the panel refused the login (${s.status})`)}};let i=typeof s.body.authorize_url=="string"?s.body.authorize_url:"";if(!i)return{ok:!1,terminal:!1,result:{ok:!1,message:"the panel did not say where to send the browser"}};k(e,{kind:"browser",url:i});let a=await be(o.waitForCode(r,e.signal),e.timeoutMs),c=await p(e.fetchImpl,`${e.panel}/api/oauth/device/token`,{flow_token:s.body.flow_token,code:a,code_verifier:t},e.signal);if(c.status>=400)return{ok:!1,terminal:!0,result:{ok:!1,message:m(c.body,`the panel refused the exchange (${c.status})`)}};let u=A(c.body);return u?{ok:!0,result:{ok:!0,token:u}}:{ok:!1,terminal:!0,result:{ok:!1,message:"the panel did not return an API key"}}}catch(n){let s=n instanceof Error?n.message:String(n);return{ok:!1,terminal:s==="cancelled",result:{ok:!1,message:s}}}finally{o?.close()}}async function ke(e){let t=e.fingerprintId??L(),r=e.clientInfo??R(),o=P(t,r);try{let n=await p(e.fetchImpl,`${e.panel}/api/auth/cli/code`,{fingerprintId:t,clientInfo:r,...o},e.signal);if(n.status===404)return{ok:!1,terminal:!1,result:{ok:!1,message:"the panel has no CLI login endpoint"}};if(n.status===401)return{ok:!1,terminal:!1,result:{ok:!1,message:"the panel did not recognise this build as the HowToCode CLI \u2014 update it with `npm install -g howtocode@latest`"}};if(n.status===429)return{ok:!1,terminal:!0,result:{ok:!1,message:`too many sign-in attempts from this machine right now.${n.retryAfterSeconds?` Try again in ${Math.ceil(n.retryAfterSeconds/60)} minute(s).`:""}`}};if(n.status>=400)return{ok:!1,terminal:!1,result:{ok:!1,message:m(n.body,`the panel refused the login (${n.status})`)}};let s=n.body.data??{},i=d(n.body.login_url,s.login_url),a=d(n.body.code,s.code)??(i?me(i):void 0),c=d(n.body.secret,s.secret);return!i||!a?{ok:!1,terminal:!1,result:{ok:!1,message:"the panel did not return a login URL"}}:c?(k(e,{kind:"browser",url:i}),await D(e,a,c)):(k(e,{kind:"browser",url:i}),await D(e,a,void 0))}catch(n){let s=n instanceof Error?n.message:String(n);return{ok:!1,terminal:s==="cancelled",result:{ok:!1,message:s}}}}async function D(e,t,r){let o=e.pollIntervalMs??G,n=Date.now()+e.timeoutMs;for(;Date.now()<n;){await w(o,e.signal);let s=new URLSearchParams(r?{code:t,secret:r}:{code:t});s.set("capability","device-refresh");let i=await ge(e.fetchImpl,`${e.panel}/api/auth/cli/status?${s}`,e.signal);if(i.status===404)return{ok:!1,terminal:!1,result:{ok:!1,message:"the panel has no CLI login status endpoint"}};if(i.status===403)return{ok:!1,terminal:!0,result:{ok:!1,message:"the panel rejected this poll \u2014 run /connect again"}};if(i.status===429){let u=Math.min(Math.max(i.retryAfterSeconds??5,1)*1e3,3e4);await w(u,e.signal);continue}let a=A(i.body);if(a)return{ok:!0,result:{ok:!0,token:a,credential:pe(i.body)}};if(d(i.body.data?.status,i.body.status)==="expired")return{ok:!1,terminal:!0,result:{ok:!1,message:"the sign-in link expired before it was approved"}};if(i.status>=400)return{ok:!1,terminal:!0,result:{ok:!1,message:m(i.body,`the panel refused the poll (${i.status})`)}}}return{ok:!1,terminal:!0,result:{ok:!1,message:"the sign-in was not approved in time"}}}async function we(e){let t=e.pollIntervalMs??G;try{let r=await p(e.fetchImpl,`${e.panel}/api/oauth/device`,{},e.signal);if(r.status===404)return{ok:!1,message:"the panel has no device-code endpoint"};if(r.status>=400)return{ok:!1,message:m(r.body,`the panel refused the request (${r.status})`)};let o=typeof r.body.device_code=="string"?r.body.device_code:"",n=typeof r.body.user_code=="string"?r.body.user_code:"",s=typeof r.body.verification_uri=="string"?r.body.verification_uri:`${e.panel}/oauth/device`;if(!o||!n)return{ok:!1,message:"the panel did not return a code to show"};k(e,{kind:"code",code:n,url:s});let i=Date.now()+e.timeoutMs;for(;Date.now()<i;){await w(t,e.signal);let a=await p(e.fetchImpl,`${e.panel}/api/oauth/device/poll`,{device_code:o},e.signal);if(a.status===404)return{ok:!1,message:"the panel has no device-code poll endpoint"};let c=typeof a.body.status=="string"?a.body.status:"";if(c==="pending")continue;if(c==="slow_down"){await w(t,e.signal);continue}if(c==="denied")return{ok:!1,message:"the sign-in was refused in the browser"};if(c==="expired")return{ok:!1,message:"the code expired; run /connect again"};let u=A(a.body);if(u)return{ok:!0,token:u};if(a.status>=400)return{ok:!1,message:m(a.body,`the panel refused the poll (${a.status})`)}}return{ok:!1,message:"the code was not approved in time"}}catch(r){return{ok:!1,message:r instanceof Error?r.message:String(r)}}}function be(e,t){return new Promise((r,o)=>{let n=setTimeout(()=>o(new Error("the sign-in was not finished in time")),t);e.then(s=>{clearTimeout(n),r(s)},s=>{clearTimeout(n),o(s)})})}function w(e,t){return new Promise((r,o)=>{let n=setTimeout(r,e);t?.addEventListener("abort",()=>{clearTimeout(n),o(new Error("cancelled"))},{once:!0})})}function b(e){return ve(e,"cli-credentials.json")}var _e=300*1e3;function Ie(e,t=Date.now()){return e.accessToken?!Number.isFinite(e.accessExpiresAt)||e.accessExpiresAt<=0?!0:e.accessExpiresAt*1e3-_e>t:!1}function Le(e,t=Date.now()){return!e.refreshToken||!e.deviceId?!1:!Number.isFinite(e.refreshExpiresAt)||e.refreshExpiresAt<=0?!0:e.refreshExpiresAt*1e3>t}function Ge(e){let t=b(e);if(!z(t))return;let r;try{r=JSON.parse(ye(t,"utf8"))}catch{return}if(!r||typeof r!="object"||Array.isArray(r))return;let o=r,n=typeof o.accessToken=="string"?o.accessToken.trim():"",s=typeof o.refreshToken=="string"?o.refreshToken.trim():"",i=typeof o.deviceId=="string"?o.deviceId.trim():"";if(!(!n||!s||!i))return{accessToken:n,accessExpiresAt:W(o.accessExpiresAt),refreshToken:s,deviceId:i,refreshExpiresAt:W(o.refreshExpiresAt)}}function Ae(e,t){try{return T(b(e),`${JSON.stringify(t,null,2)}
|
|
2
2
|
`,{mode:384}),!0}catch{return!1}}function Ce(e){try{let t=b(e);z(t)&&xe(t,{force:!0})}catch{}}function W(e){return typeof e=="number"&&Number.isFinite(e)?e:0}async function Se(e,t){let r=(t?.panelUrl??_).replace(/\/+$/,""),o=t?.fetchImpl??fetch,n=t?.timeoutMs??15e3,s=new AbortController,i=setTimeout(()=>s.abort(),n);try{let a=await o(`${r}/api/auth/cli/refresh`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({device_id:e.deviceId,refresh_token:e.refreshToken,fingerprint_id:L()}),signal:s.signal}),c=await a.json().catch(()=>({}));if(a.status===401||a.status===403)return{ok:!1,terminal:!0,message:"this sign-in is no longer valid; run /connect to sign in again"};if(!a.ok)return{ok:!1,terminal:!1,message:`the panel refused the renewal (${a.status})`};let u=c.data??{},g=C(c.token,u.token),l=C(c.refresh_token,u.refresh_token),f=C(c.device_id,u.device_id)??e.deviceId;return!g||!l?{ok:!1,terminal:!1,message:"the panel did not return a renewed credential"}:{ok:!0,terminal:!1,credential:{accessToken:g,accessExpiresAt:B(c.access_expires_at,u.access_expires_at),refreshToken:l,deviceId:f,refreshExpiresAt:B(c.refresh_expires_at,u.refresh_expires_at)}}}catch(a){return{ok:!1,terminal:!1,message:a instanceof Error&&a.name==="AbortError"?`the panel did not answer within ${Math.round(n/1e3)}s`:"could not reach the panel"}}finally{clearTimeout(i)}}function C(...e){for(let t of e)if(typeof t=="string"&&t.trim())return t.trim()}function B(...e){for(let t of e)if(typeof t=="number"&&Number.isFinite(t))return t;return 0}async function Ke(e,t,r){let o=r?.now??Date.now();if(Ie(t,o)||!Le(t,o))return{credential:t,renewed:!1,terminal:!1};let n=await Se(t,r);if(!n.ok||!n.credential)return n.terminal&&Ce(e),{credential:t,renewed:!1,terminal:n.terminal,message:n.message};let s=Ae(e,n.credential);return{credential:n.credential,renewed:!0,terminal:!1,message:s?void 0:`the renewed sign-in could not be saved to ${b(e)}`}}export{H as a,_ as b,He as c,b as d,_e as e,Ie as f,Le as g,Ge as h,Ae as i,Ce as j,Se as k,Ke as l};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c}from"./chunk-
|
|
1
|
+
import{a,b,c}from"./chunk-YFJKKWIX.js";import"./chunk-465RG5I6.js";import"./chunk-UTYFLLSM.js";import"./chunk-WOT6VMZA.js";export{c as formatSkillList,b as skillInvocation,a as skillSearchPaths};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as o}from"./chunk-
|
|
1
|
+
import{b as o}from"./chunk-XSUEEWKS.js";import{createPrivateKey as p,createPublicKey as f,createHash as l,randomBytes as d,sign as y}from"node:crypto";import{arch as c,cpus as m,hostname as I,platform as s}from"node:os";var a="hf-cli-1",C="MC4CAQAwBQYDK2VwBCIEIDmKoNgInS7oDpncee1d1+Mnci1R/q4aE5xxHeCKq4Dc",x="howtocode-cli-auth-v1",i;function u(){return i||(i=p({key:Buffer.from(C,"base64"),format:"der",type:"pkcs8"})),i}function g(){return f(u())}function K(t,e,n,r){return Buffer.from([x,t,e,n,r].join(`
|
|
2
2
|
`),"utf8")}function h(){return d(16).toString("hex")}var E="tQ91uspGl0sw5Y8x+soLYnFNX6a9vEzSzCuuvalzdKk=";function P(){let t=g().export({format:"der",type:"spki"});return t.subarray(t.length-32).toString("base64")===E}function N(){let t=g().export({format:"der",type:"spki"});return l("sha256").update(t).digest("hex").slice(0,16)}function $(){let e=(m()[0]?.model??"").replace(/\s+/g," ").trim(),n=I(),r=e?`${n} (${s()}/${c()}, ${e})`:`${n} (${s()}/${c()})`;return`CLI (${o}, ${r})`}var k="X-HowToCode-Client";function A(){return`CLI (${o})`}function B(t,e){let n=h(),r=y(null,K(a,t,e,n),u());return{keyId:a,nonce:n,signature:r.toString("base64")}}export{a,g as b,K as c,h as d,P as e,N as f,$ as g,k as h,A as i,B as j};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{H as a,I as b,J as c,K as d,L as e,M as f,N as g,O as h,P as i,Q as j}from"./chunk-
|
|
1
|
+
import{H as a,I as b,J as c,K as d,L as e,M as f,N as g,O as h,P as i,Q as j}from"./chunk-465RG5I6.js";import"./chunk-UTYFLLSM.js";import"./chunk-WOT6VMZA.js";export{e as AGENTS_STORE_DIR,a as AGENT_DIR,j as IMAGES_DIR,g as REACHABLE_CACHE_PATH,f as USAGE_CACHE_PATH,b as USER_SKILLS_DIR,h as WORKFLOWS_DIR,d as additionalSkillPaths,i as pinAgentDir,c as projectSkillsDir};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$a as us,A as _o,Aa as zo,Ba as Yo,Ca as Jo,D as Mt,Da as Xo,E as Lo,Ea as Zo,G as Oo,Ga as de,Ha as E,Ia as J,J as No,Ja as A,K as Fo,Ka as Qo,L as Rt,La as es,M as jo,Ma as ts,N as Do,Na as ns,O as Wo,Oa as Kn,P as Dn,Pa as rs,Qa as is,Sa as Gn,Ta as os,Va as ss,X as Wn,Xa as as,Ya as ls,Z as Un,Za as cs,_a as ds,aa as Qe,ab as fs,bb as ms,c as So,e as Co,g as Ao,h as To,ha as Uo,ia as et,ka as It,n as Mo,oa as Bo,pa as Ko,ra as Go,sa as Ho,ta as Vo,v as Ro,wa as qo,x as Io,z as jn,za as Bn}from"./chunk-
|
|
1
|
+
import{$a as us,A as _o,Aa as zo,Ba as Yo,Ca as Jo,D as Mt,Da as Xo,E as Lo,Ea as Zo,G as Oo,Ga as de,Ha as E,Ia as J,J as No,Ja as A,K as Fo,Ka as Qo,L as Rt,La as es,M as jo,Ma as ts,N as Do,Na as ns,O as Wo,Oa as Kn,P as Dn,Pa as rs,Qa as is,Sa as Gn,Ta as os,Va as ss,X as Wn,Xa as as,Ya as ls,Z as Un,Za as cs,_a as ds,aa as Qe,ab as fs,bb as ms,c as So,e as Co,g as Ao,h as To,ha as Uo,ia as et,ka as It,n as Mo,oa as Bo,pa as Ko,ra as Go,sa as Ho,ta as Vo,v as Ro,wa as qo,x as Io,z as jn,za as Bn}from"./chunk-VDUY46W2.js";import{b as ps,c as gs}from"./chunk-YFJKKWIX.js";import{b as Ee,c as Ze,e as Eo,f as Et,g as Po,h as Pt}from"./chunk-27TRKD65.js";import{A as io,B as St,C as oo,b as Rn,c as ye,d as zi,e as Yi,h as Ji,n as In,o as Xi,q as oe,s as Zi,t as Ie,v as Qi,w as eo,x as to,y as no,z as ro}from"./chunk-GEAWXEQG.js";import{a as so,b as ao,c as lo,d as co,f as uo,g as fo,h as mo,i as po,l as go}from"./chunk-K4ONXZQE.js";import{a as Ct,b as _n,c as Ln,d as ho,e as At}from"./chunk-3FYCFLNK.js";import{u as bo}from"./chunk-SDO33XPR.js";import{a as wo}from"./chunk-ORJ2QZBG.js";import{a as yo,c as Tt,d as On,j as ko,k as $o,l as vo,n as Nn,o as Fn,p as xo}from"./chunk-SVONBXW3.js";import{a as Pn,b as Mn,c as Di,d as Wi}from"./chunk-EZNNALD3.js";import{b as xt}from"./chunk-7LA2AMZB.js";import{A as Li,B as $t,C as vt,D as Oi,E as Sn,F as Cn,G as Ni,H as R,M as Xe,N as An,O as Fi,Q as ji,c as vn,d as wt,g as yt,i as xi,j as Si,k as Ci,l as Ai,m as kt,n as Ti,o as xn,p as Ei,s as se,t as Pi,u as Mi,x as Ri,y as Ii,z as _i}from"./chunk-465RG5I6.js";import{a as ie}from"./chunk-UTYFLLSM.js";import{j as Tn,k as En}from"./chunk-MVVEYKN6.js";import{b as Ui,c as Bi,d as Ki,e as Gi,f as Hi}from"./chunk-TUXY64DT.js";import{h as Vi,i as qi}from"./chunk-NFVGCV56.js";import{a as $n,b as bt,e as vi}from"./chunk-XSUEEWKS.js";import"./chunk-WOT6VMZA.js";import{execFile as ud}from"node:child_process";import{promisify as fd}from"node:util";import{appendFileSync as md,existsSync as Vt,mkdirSync as yr,readFileSync as qt,rmSync as pd,statSync as za,writeFileSync as kr}from"node:fs";import{basename as gd,dirname as hd,join as me,resolve as bd}from"node:path";function hs(e){if(e==="")return!0;let t=/^\x1b\[(\d+);(\d+)u$/.exec(e);if(t&&Number(t[1])===99&&(Number(t[2])&5)!==0)return!0;let n=/^\x1b\[27;(\d+);(\d+)~$/.exec(e);return!!(n&&Number(n[2])===99&&(Number(n[1])&5)!==0)}function bs(e){let t=!1;process.on("SIGINT",()=>{t||(t=!0,e())})}function Cl(e){if(!e||typeof e!="object")return;let t=e;if(!(typeof t.input!="number"&&typeof t.cacheRead!="number"&&typeof t.cacheWrite!="number"))return t}function Al(e){let t=e?.input??0,n=e?.cacheRead??0,i=e?.cacheWrite??0;return{input:t,cacheRead:n,cacheWrite:i,prompt:t+n+i}}function Tl(e){if(typeof e!="string")return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function El(e){if(!e||typeof e!="object")return;let t=e,i=(t.message&&typeof t.message=="object"?t.message:void 0)??t,o=Cl(i.usage);if(!o)return;let u=typeof i.provider=="string"?i.provider:"",a=typeof i.model=="string"?i.model:"";return{usage:o,model:[u,a].filter(Boolean).join("/")}}function ws(e){let t=0,n=0,i=[],o=0,u=null;for(let g of e){let b=El(g);if(!b)continue;let{input:k,cacheRead:C,cacheWrite:_,prompt:O}=Al(b.usage);if(O===0)continue;t+=C,n+=k+_;let F=Tl(g.timestamp),W=u,G=W?W.at:null;if(W!==null&&C===0&&k>=1e3){let Q=F!==null&&G!==null?Math.max(0,F-G):0;i.push({missedTokens:k,idleMs:Q,modelChanged:b.model!==""&&W.model!==""&&b.model!==W.model}),o+=k}u={prompt:O,at:F??G??null,model:b.model}}let a=t+n;return{cachedTokens:t,billedTokens:n,hitRate:a>0?t/a*100:null,misses:i,missedTokens:o}}function ys(e){return e.modelChanged?"model changed, so its cache had to be built":e.idleMs>=3e5?`cache expired after ${Math.round(e.idleMs/1e3)}s idle`:e.idleMs>0?"prompt changed too early in the prefix to hit":"reason not recorded"}import{copyToClipboard as wd,ProjectTrustStore as yd,SessionManager as kd}from"@netrodev/hxf-coding-agent";import{CombinedAutocompleteProvider as Ya,Container as $d,Editor as vd,matchesKey as q,ProcessTerminal as xd,ScrollView as Sd,KeybindingsManager as Qa,setKeybindings as el,isKeyRelease as Cd,parseColor as Yt,TUI_KEYBINDINGS as tl,SelectList as Ad,TuiAltScreen as Td,truncateToWidth as We,VStack as Ed,visibleWidth as Sr,wrapTextWithAnsi as nl}from"@netrodev/hxf-tui";import{spawn as Pl}from"node:child_process";function Ml(e,t,n=2e3){return new Promise(i=>{let o=!1,u,a=k=>{o||(o=!0,u!==void 0&&clearTimeout(u),i(k))},g;try{g=Pl(e,[...t],{stdio:["ignore","pipe","ignore"]})}catch{a({ok:!1,stdout:""});return}u=setTimeout(()=>{g.kill("SIGKILL"),a({ok:!1,stdout:""})},n);let b=[];g.stdout?.on("data",k=>b.push(k)),g.on("error",()=>a({ok:!1,stdout:""})),g.on("close",k=>{a({ok:k===0,stdout:Buffer.concat(b).toString("utf8")})})})}function Hn(){return process.env.XDG_SESSION_TYPE==="wayland"||(process.env.WAYLAND_DISPLAY?.length??0)>0}async function Rl(){let e=[];process.platform==="darwin"?e.push({command:"pbpaste",args:[]}):process.platform==="win32"?e.push({command:"powershell.exe",args:["-NoProfile","-Command","Get-Clipboard -Raw"]}):(Hn()&&(e.push({command:"wl-paste",args:["--no-newline","--type","text/plain;charset=utf-8"]}),e.push({command:"wl-paste",args:["--no-newline","--type","text/plain"]}),e.push({command:"wl-paste",args:["--no-newline"]})),((process.env.DISPLAY?.length??0)>0||!Hn())&&(e.push({command:"xclip",args:["-selection","clipboard","-o"]}),e.push({command:"xsel",args:["--clipboard","--output"]})),e.push({command:"termux-clipboard-get",args:[]}));for(let t of e){let n=await Ml(t.command,t.args);if(n.ok&&n.stdout.length>0)return n.stdout}}async function ks(){let e;try{let{getNativeClipboard:i}=await import("@netrodev/hxf-tui");e=i()}catch{e=void 0}if(e)try{let i=await e.getText();if(typeof i=="string"&&i.length>0)return{ok:!0,text:i}}catch{}let t=await Rl();return t!==void 0?{ok:!0,text:t}:{ok:!1,reason:`no clipboard tool could read it \u2014 ${Hn()?"install wl-clipboard (wl-paste)":process.platform==="darwin"?"pbpaste should be present on macOS":process.platform==="win32"?"Get-Clipboard should be present on Windows":"install xclip or xsel, or run under a display"}`}}import{spawn as Il}from"node:child_process";import{mkdirSync as _l,writeFileSync as Ll}from"node:fs";import{join as Ol}from"node:path";import{getNativeClipboard as Nl}from"@netrodev/hxf-tui";async function _e(e,t,n=4e3){let{promise:i,resolve:o}=Promise.withResolvers(),u=!1,a,g=C=>{u||(u=!0,clearTimeout(a),o(C))},b;try{b=Il(e,[...t],{stdio:["ignore","pipe","ignore"]})}catch{return g(void 0),i}a=setTimeout(()=>{b.kill("SIGKILL"),g(void 0)},n);let k=[];return b.stdout?.on("data",C=>k.push(C)),b.on("error",()=>g(void 0)),b.on("close",C=>{let _=Buffer.concat(k);g(C===0&&_.length>0?_:void 0)}),i}function $s(){return process.env.XDG_SESSION_TYPE==="wayland"||(process.env.WAYLAND_DISPLAY?.length??0)>0}function Fl(e){return e.length>8&&e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71}function jl(e){return e.length>3&&e[0]===255&&e[1]===216&&e[2]===255}async function Dl(){try{let e=await Nl()?.getImage();if(e&&e.length>0)return Buffer.from(e)}catch{}if(process.platform==="darwin"){let e=await _e("pngpaste",["-"]);return e||await _e("osascript",["-e",`set d to the clipboard as \xABclass PNGf\xBB
|
|
2
2
|
return d`])}if(process.platform==="win32"){let e=["Add-Type -AssemblyName System.Windows.Forms","$img = [System.Windows.Forms.Clipboard]::GetImage()","if ($img -ne $null) {"," $ms = New-Object System.IO.MemoryStream"," $img.Save($ms, [System.Drawing.Imaging.ImageFormat]::Png)"," [Console]::OpenStandardOutput().Write($ms.ToArray(), 0, $ms.Length)","}"].join("; ");return _e("powershell.exe",["-NoProfile","-Command",e])}if($s()){let e=await _e("wl-paste",["--type","image/png"]);if(e)return e}if((process.env.DISPLAY?.length??0)>0||!$s()){let e=await _e("xclip",["-selection","clipboard","-t","image/png","-o"]);if(e)return e;let t=await _e("xclip",["-selection","clipboard","-t","image/jpeg","-o"]);if(t)return t}}function Wl(e,t){let n=t==="image/jpeg"?"jpg":"png";return`pasted-${new Date(e).toISOString().replace(/[:.]/g,"-")}.${n}`}async function Vn(e=ji,t=Date.now()){let n=await Dl();if(!n)return{ok:!1,reason:"the clipboard holds no image"};let i=Fl(n)?"image/png":jl(n)?"image/jpeg":void 0;if(!i)return{ok:!1,reason:"the clipboard image is not PNG or JPEG"};try{_l(e,{recursive:!0});let o=Ol(e,Wl(t,i));return Ll(o,n,{mode:384}),{ok:!0,image:{path:o,data:n.toString("base64"),mimeType:i}}}catch(o){return{ok:!1,reason:`could not store the image: ${o instanceof Error?o.message:String(o)}`}}}import{TreeSelectorComponent as Pd,initTheme as Md}from"@netrodev/hxf-coding-agent";import{getKeybindings as Ja}from"@netrodev/hxf-tui";import{mixColors as Ul,parseColor as Bl,styleText as he}from"@netrodev/hxf-tui";var ue=process.env.HOWTOCODE_NO_MOTION!=="1",Kl=45,vs=5,xs=8,qn=1e4,Ss=6e4,Cs=3,As=4,zn=e=>e<0?0:e>1?1:e;function ke(e,t,n){let i=zn(n);return i>=1?t:i<=0?e:Ul(e,t,i)}var _t=class{value;velocity=0;last=Date.now();target;constructor(t,n=t){this.value=t,this.target=n}set(t){this.target=t}get moving(){return Math.abs(this.target-this.value)>.15}snap(t){this.value=t,this.target=t,this.velocity=0,this.last=Date.now()}step(t=Date.now()){let n=Math.max(0,t-this.last),i=Math.min(250,n)/1e3;if(this.last=t,!ue)return this.value=this.target,this.velocity=0,this.value;n>250&&(this.velocity=0);let o=150,u=2*Math.sqrt(o),a=Math.max(1,Math.ceil(i/.008)),g=i/a;for(let b=0;b<a;b+=1)this.velocity+=(this.target-this.value)*o*g-this.velocity*u*g,this.value+=this.velocity*g;return this.moving||(this.value=this.target,this.velocity=0),this.value}};function Yn(e,t,n,i){return!ue||e<=qn?t:e>=Ss?i:ke(n,i,(e-qn)/(Ss-qn))}function Ts(e,t){return!ue||t<=0||e<0?1:1-(1-zn(e/t))**3}var Es=260,Gl=45;function Ps(e,t,n=Gl,i=400){return!ue||n<=0||e<0||e>=i?t:Math.min(t,Math.floor(e/n)+1)}function Ms(e,t,n=Date.now(),i=1400){if(!ue||i<=0)return e;let o=n%i/i;return ke(e,t,o<.5?o*2:(1-o)*2)}function Lt(e,t,n){let i=he(e,{fg:t.rest},de);if(!ue||e.length===0)return i;let o=zn(n);if(o>=1)return i;let u=t.band??1,a=e.length+As*2,b=Math.min(a-1,Math.floor(o*a))-As,k=G=>{let Q=Math.abs(G-b);return Q>u?0:1-Q/(u+1)},C="",_=0,O=null,F=0,W=0;for(let G of e){let Q=k(W);O===null?O=Q:Q!==O&&(C+=he(e.slice(_,F),{fg:ke(t.rest,t.lit,O)},de),_=F,O=Q),F+=G.length,W+=1}return C+he(e.slice(_),{fg:ke(t.rest,t.lit,O??0)},de)}function Jn(e,t,n=Date.now(),i=90){let o=t[0]??Bl("#e6e6e6");if(t.length===0||e.length===0)return he(e,{fg:o},de);if(!ue||i<=0)return he(e,{fg:t[t.length-1]??o},de);let u=t.length*i,a=(n%u+u)%u,g="",b=0,k=null,C=0,_=0,O=F=>{let W=(a+F*i)/u%1*t.length,G=Math.floor(W)%t.length,Q=(G+1)%t.length;return ke(t[G]??o,t[Q]??o,W-Math.floor(W))};for(let F of e){let W=O(_);k===null?k=W:W!==k&&(g+=he(e.slice(b,C),{fg:k},de),b=C,k=W),C+=F.length,_+=1}return g+he(e.slice(b),{fg:k??o},de)}function Hl(e,t){let n=Math.abs(e-t);return n>=vs?0:Math.ceil((1-n/vs)*Cs)/Cs}function Rs(e,t,n=Date.now()){let i=t.charMs??Kl;if(!ue||e.length===0||i<=0)return he(e,{fg:t.base},de);let o=e.length+xs*2,u=n/i%o-xs,a=(O,F)=>he(O,{fg:ke(t.base,t.bright,F)},de),g="",b=0,k=null,C=0,_=0;for(let O of e){let F=Hl(_,u);k===null?k=F:F!==k&&(g+=a(e.slice(b,C),k),b=C,k=F),C+=O.length,_+=1}return g+a(e.slice(b),k??0)}import{readFileSync as Vl,statSync as ql}from"node:fs";import{homedir as zl}from"node:os";import{extname as Yl}from"node:path";var Xn="\x1B[200~",Zn="\x1B[201~",Jl={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp"},Is=10*1024*1024,Xl=256*1024,Zl=20;function _s(e){if(!e.startsWith(Xn)||!e.endsWith(Zn))return;let t=e.slice(Xn.length,e.length-Zn.length);if(!(t.includes(Xn)||t.includes(Zn)))return t}function Ls(e){return e.trim()===""}function Ql(e){return/^[a-zA-Z]:[\\/]/.test(e)||e.startsWith("\\\\")||e.startsWith("/")||e==="~"||e.startsWith("~/")}function ec(e,t=zl()){let n=e.trim();return n.startsWith("file://")&&(n=decodeURIComponent(n.slice(7)),/^\/[a-zA-Z]:\//.test(n)&&(n=n.slice(1))),!/^[a-zA-Z]:[\\/]/.test(n)&&!n.startsWith("\\\\")&&(n=n.replace(/\\([ ()'&])/g,"$1")),n==="~"?t:n.startsWith("~/")?t+n.slice(1):n}function Os(e,t){let n=e.trim();if(!n||n.length>8192)return;let i,o=[...n.matchAll(/"([^"]+)"|'([^']+)'/g)].map(a=>a[1]??a[2]??"");if(o.length>0&&n.replace(/"[^"]+"|'[^']+'/g,"").trim()===""?i=o:i=n.split(/\r?\n/).map(a=>a.trim()).filter(a=>a.length>0),i.length===0||i.length>Zl||!i.every(a=>Ql(a)||a.startsWith("file://")))return;let u=i.map(a=>ec(a));return u.every(t)?u:void 0}function Ns(e){return Jl[Yl(e).toLowerCase()]}function Fs(e){return`[file ${e}]`}function Qn(e){return`[image ${e}]`}function js(e,t){return e.replace(/\[file ([^\]\n]+)\]/g,(n,i)=>{let o=t(i);return o===void 0?n:`<file name="${i}">
|
|
3
3
|
${o.trimEnd()}
|
|
4
4
|
</file>`})}function Ds(e){try{let t=ql(e);if(!t.isFile()||t.size===0||t.size>Xl)return;let n=Vl(e);return n.includes(0)?void 0:n.toString("utf8")}catch{return}}import{Markdown as kc,wrapTextWithAnsi as $c}from"@netrodev/hxf-tui";import{homedir as tc}from"node:os";import{isAbsolute as nc,relative as rc,resolve as ic,sep as Ws}from"node:path";import{getImageDimensions as oc,imageFallback as Us,renderImage as sc}from"@netrodev/hxf-tui";var ac="\u25CF",nr="\u2514",Nt="\u22EF",er=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function rt(e=1e3/30){let t=Math.floor(Date.now()/e)%er.length;return er[t]??er[0]}var lc="\u25B2";var cc="\u25CB",dc=["create_object","set_properties","delete_object","clone_instance","reparent_instance","set_script_source","edit_script_lines","insert_script_lines","execute_luau","generate_mesh","generate_material","generate_procedural_model"];function rr(e){return e.includes("__")?e.slice(e.lastIndexOf("__")+2):e}function Hs(e){return dc.includes(rr(e))}function tt(e,t=process.cwd()){if(!e||!nc(e))return e;let n=ic(e),i=rc(t,n);if(i==="")return".";if(i&&!i.startsWith(`..${Ws}`)&&i!=="..")return i;let o=tc();return o&&(n===o||n.startsWith(o+Ws))?`~${n.slice(o.length)}`:n}function ae(e,t){let n=e.replace(/\s+/g," ").trim();return n.length>t?`${n.slice(0,Math.max(1,t-1))}\u2026`:n}function U(e,t){if(e&&typeof e=="object"){let n=e[t];if(typeof n=="string"&&n.length>0)return n;if(typeof n=="number")return String(n)}}function uc(e,t=160){if(!e||typeof e!="object")return"";try{let n=JSON.stringify(e);return n&&n!=="{}"?ae(n,t):""}catch{return""}}function fc(e,t){switch(e){case"read":{let n=tt(U(t,"path")??""),i=[U(t,"offset"),U(t,"limit")].filter(Boolean);return i.length>0?`${n} ${i.length===1?`offset=${i[0]}`:`offset=${i[0]}, limit=${i[1]}`}`:n}case"edit":case"write":return tt(U(t,"path")??"");case"bash":case"powershell":{let n=U(t,"command")??"";return t?.run_in_background===!0?`${n} [background]`:n}case"bash_output":{let n=U(t,"task_id"),i=U(t,"filter");return n?i?`${n} filter=${i}`:n:"all tasks"}case"kill_shell":return U(t,"task_id")??"";case"compress":{let n=U(t,"topic")??"",i=Array.isArray(t.content)?t.content.length:0;return i>1?`${n} (${i} ranges)`:n}case"grep":{let n=U(t,"pattern")??"",i=U(t,"path");return i?`${n} in ${tt(i)}`:n}case"find":case"glob":{let n=U(t,"pattern")??U(t,"glob")??"",i=U(t,"path");return i?`${n} in ${tt(i)}`:n}case"ls":return tt(U(t,"path")??".");case"task":return U(t,"agent")??"task";case"ask":return U(t,"question")??"";case"web_search":return U(t,"query")??"";case"web_fetch":return U(t,"url")??"";case"lsp":{let n=U(t,"action")??"lsp",i=U(t,"file")??"",o=U(t,"line");return o?`${n} ${i}:${o}`:`${n} ${i}`}case"quality":return U(t,"path")??"changed files";case"think":return"private";case"todo":{let n=U(t,"op")??"view",i=U(t,"task"),o=t?.items;return n==="init"&&Array.isArray(o)?`init ${o.length} task${o.length===1?"":"s"}`:i?`${n} ${i}`:n}case"context":{let n=U(t,"op")??"list",i=U(t,"key");return i?`${n} ${i}`:n}case"workflow":{let n=U(t,"path");if(n)return n;let i=U(t,"code")??"",o=/export\s+const\s+meta\s*=\s*\{[\s\S]*?name\s*:\s*["'`]([^"'`]+)/.exec(i)?.[1];if(o)return o;let u=i.trim().split(`
|
|
@@ -137,4 +137,4 @@ plan file: ${jo()??"(unknown)"}`);return}if(s==="goal"){let d=l.trim();if(!d){m(
|
|
|
137
137
|
${jn(p)}`);return}if(s==="session"){let d=$.model;m("session",d?`${d.provider}/${d.id}`:"no model");return}if(s==="skills"){m("skills",gs($.resourceLoader.getSkills().skills));return}if(s==="preset"){$i(l);return}if(s==="roblox"){let d=se(e.cwd).entries.find(x=>x.manifest.name==="rotoolbox");if(!d||d.source!=="installed"){m("roblox","RoToolbox is not installed. Run /preset and install RoToolbox first.");return}let p=xn(d.dir),w=$.getActiveToolNames().filter(x=>/roblox[-_]studio/i.test(x)),h=w.length>0;m("roblox",p?`RoToolbox: disabled
|
|
138
138
|
Enable with /preset enable rotoolbox
|
|
139
139
|
The MCP server and manager stay stopped while disabled.`:["RoToolbox: active",`MCP server: ${h?`connected \u2014 ${w.length} tool${w.length===1?"":"s"} registered`:"not connected yet"}`,"Open Roblox Studio with a place, then use a prompt to inspect it.","Disable with /preset disable rotoolbox"].join(`
|
|
140
|
-
`));return}let f=ps(r,$.resourceLoader.getSkills().skills.map(d=>d.name));if(f){oi(f);return}let y=$.extensionRunner.getCommand(s??"");if(y){try{await y.handler(l,$.extensionRunner.createCommandContext())}catch(d){H(d instanceof Error?d.message:String(d))}return}m("command",`/${s??""} is not available in this screen yet`)};Mo((r,s)=>{let{promise:c,resolve:l}=Promise.withResolvers();return j(r,s.map(f=>({value:f,label:f})),l,()=>l("cancelled")),c}),process.on("SIGTERM",He),bs(()=>{He()}),t.setTitle(`${$n} ${bt}`),Ud(),i.start(),i.requestRender(!0),pn(!0);{let{maybeShowWelcome:r}=await import("./chunk-
|
|
140
|
+
`));return}let f=ps(r,$.resourceLoader.getSkills().skills.map(d=>d.name));if(f){oi(f);return}let y=$.extensionRunner.getCommand(s??"");if(y){try{await y.handler(l,$.extensionRunner.createCommandContext())}catch(d){H(d instanceof Error?d.message:String(d))}return}m("command",`/${s??""} is not available in this screen yet`)};Mo((r,s)=>{let{promise:c,resolve:l}=Promise.withResolvers();return j(r,s.map(f=>({value:f,label:f})),l,()=>l("cancelled")),c}),process.on("SIGTERM",He),bs(()=>{He()}),t.setTitle(`${$n} ${bt}`),Ud(),i.start(),i.requestRender(!0),pn(!0);{let{maybeShowWelcome:r}=await import("./chunk-XAIUZHIW.js");await r({cwd:e.cwd,note:e.note,signedIn:be!==void 0,runSlash:s=>{Je(s)},openExternal:s=>{Fe(s)}},j,m)}e.initialPrompt&&gn(e.initialPrompt),await new Promise(()=>{})}var X,Bd=1e3/30,Kd=45e3;export{Er as Dock,Ar as Hud,Tr as PinnedBlock,jd as approvalDetail,Fd as infoPanel,It as orderModelsForDefault,Nd as pickerPanel,Sm as runWorkbench,xr as slashCommands,Dd as workflowPanel,zt as workflowPanelFromRun,Pr as workflowRunOf};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as a}from"./chunk-MVVEYKN6.js";import{b as r}from"./chunk-
|
|
1
|
+
import{j as a}from"./chunk-MVVEYKN6.js";import{b as r}from"./chunk-XSUEEWKS.js";import"./chunk-WOT6VMZA.js";function c(e){return{prompt:s=>e.session.prompt(s),abort:()=>e.session.abort(),subscribe:s=>e.session.subscribe(n=>s(n)),getLastAssistantText:()=>a(e.session.getLastAssistantText()??""),lastStopReason:()=>{let s=e.session.state.messages.at(-1);return s?.role==="assistant"?s.stopReason:void 0},dispose:()=>e.dispose()}}async function g(e,s){let{openSession:n}=await import("./chunk-7NGP36QA.js"),i=t=>n({cwd:t,model:s.model,thinking:s.thinking,continueSession:!1,noSession:!1,sessionPath:void 0,interactive:!1});if(e==="acp"){let{runAcp:t}=await import("./chunk-TOV557ET.js");await t({input:process.stdin,output:process.stdout,version:r,createAgent:async u=>c(await i(u))});return}let{runRpc:p}=await import("./chunk-QOYTPACU.js"),{createJsonEventEncoder:d}=await import("./chunk-MCDEIIEN.js"),o=await i(s.cwd),m=d();await p({input:process.stdin,output:process.stdout,agent:c(o),encodeEvent:t=>m.line(t),state:()=>({sessionId:o.session.sessionId,model:o.modelLabel,cwd:s.cwd})})}export{c as agentFromSession,g as serveProtocol};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as pf}from"./chunk-27TRKD65.js";import{t as cf}from"./chunk-SVONBXW3.js";import{H as Ye,K as uf,L as jn,a as Gi}from"./chunk-ABDZXFNM.js";import{a as sr}from"./chunk-UTYFLLSM.js";import{a as Nm,b as Dn,c as Nn,d as qm,e as Um,f as Mo,g as _m,h as Br,j as vo}from"./chunk-MVVEYKN6.js";import{a as At}from"./chunk-WOT6VMZA.js";import{spawn as k1}from"node:child_process";import{existsSync as T1,readFileSync as w1}from"node:fs";import{join as C1}from"node:path";var B={};At(B,{Match:()=>Nw});function Nw(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}var Me={};At(Me,{Get:()=>Qi,Reset:()=>FC,Set:()=>LC});var s={};At(s,{CodePointCount:()=>Zw,Counted:()=>sC,Entries:()=>uC,EntriesRegExp:()=>mC,Every:()=>rC,EveryAll:()=>nC,GraphemeCount:()=>Xw,HasPropertyKey:()=>aC,IsArray:()=>Lo,IsBigInt:()=>Fo,IsBoolean:()=>xf,IsClassInstance:()=>Qw,IsConstructor:()=>Hw,IsDeepEqual:()=>Km,IsEqual:()=>Y,IsFunction:()=>hf,IsGreaterEqualThan:()=>bf,IsGreaterThan:()=>Vw,IsInteger:()=>Bm,IsLessEqualThan:()=>If,IsLessThan:()=>Jw,IsMaxLength:()=>eC,IsMinLength:()=>tC,IsMultipleOf:()=>Yw,IsNull:()=>Wi,IsNumber:()=>Vi,IsObject:()=>jo,IsObjectNotArray:()=>zw,IsString:()=>Ji,IsSymbol:()=>Ww,IsUndefined:()=>Gm,IsUnsafePropertyKey:()=>Ef,IsValueLike:()=>$f,Keys:()=>zi,ShiftLeft:()=>Yi,Some:()=>oC,SomeAll:()=>iC,Symbols:()=>cC,Values:()=>pC});function qn(e,t,r){return e>=t&&e<=r}function qw(e){return e===8205}function ff(e){return qn(e,127462,127487)}function Uw(e){return qn(e,65024,65039)}function _w(e){return qn(e,768,879)||qn(e,6832,6911)||qn(e,7616,7679)||qn(e,65056,65071)}function Ki(e){return e>65535?2:1}function df(e,t){for(;t<e.length;){let r=e.codePointAt(t);if(_w(r)||Uw(r))t+=Ki(r);else break}return t}function Bw(e,t){let r=e.codePointAt(t),n=t+Ki(r);for(n=df(e,n);n<e.length-1&&qw(e.codePointAt(n));){let o=e.codePointAt(n+1);n+=1+Ki(o),n=df(e,n)}return ff(r)&&n<e.length&&ff(e.codePointAt(n))&&(n+=Ki(e.codePointAt(n))),n}function lf(e){let t=0,r=0;for(;r<e.length;)r=Bw(e,r),t++;return t}function Hi(e){let t=0,r=0,n=0;for(;r<e.length;){let o=e.charCodeAt(r++)>>10;t+=+((n<<8|o)!==13879),n=o}return t}function gf(e,t){return e.length<=t||e.length<=t<<1&&Hi(e)<=t}function yf(e,t){return e.length>=t<<1||e.length>=t&&Hi(e)>=t}function Lo(e){return Array.isArray(e)}function Fo(e){return Y(typeof e,"bigint")}function xf(e){return Y(typeof e,"boolean")}function Hw(e){if(Gm(e)||!hf(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function hf(e){return Y(typeof e,"function")}function Bm(e){return Number.isInteger(e)}function Wi(e){return Y(e,null)}function Vi(e){return Number.isFinite(e)}function zw(e){return jo(e)&&!Lo(e)}function jo(e){return Y(typeof e,"object")&&!Wi(e)}function Ji(e){return Y(typeof e,"string")}function Ww(e){return Y(typeof e,"symbol")}function Gm(e){return Y(e,void 0)}function Y(e,t){return e===t}function Vw(e,t){return e>t}function Jw(e,t){return e<t}function If(e,t){return e<=t}function bf(e,t){return e>=t}function Yw(e,t){if(Fo(e)||Fo(t))return BigInt(e)%BigInt(t)===0n;let r=1e-10;if(!Vi(e)||Bm(e)&&1/t%1===0)return!0;let n=e%t;return Math.min(Math.abs(n),Math.abs(n-t),Math.abs(n+t))<r}function Qw(e){if(!jo(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return Wi(t)?!1:Y(typeof t.constructor,"function")&&!(Y(t.constructor,globalThis.Object)||Y(t.constructor.name,"Object"))}function $f(e){return Fo(e)||xf(e)||Wi(e)||Vi(e)||Ji(e)||Gm(e)}function Xw(e){return lf(e)}function Zw(e){return Hi(e)}function eC(e,t){return gf(e,t)}function tC(e,t){return yf(e,t)}function rC(e,t,r){return e.every((n,o)=>o<t||r(n,o))}function nC(e,t,r){let n=!0;return e.forEach((o,i)=>{i>=t&&!r(o,i)&&(n=!1)}),n}function oC(e,t){return e.some((r,n)=>t(r,n))}function iC(e,t){let r=!1;return e.forEach((n,o)=>{t(n,o)&&(r=!0)}),r}function sC(e,t){return e.reduce((r,n,o)=>t(n,o)?++r:r,0)}function Yi(e,t,r){return Y(e.length,0)?r():t(e[0],e.slice(1))}function Ef(e){return Y(e,"__proto__")||Y(e,"constructor")||Y(e,"prototype")}function aC(e,t){return Ef(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function mC(e){return zi(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function uC(e){return Object.entries(e)}function zi(e){return Object.getOwnPropertyNames(e)}function cC(e){return Object.getOwnPropertySymbols(e)}function pC(e){return Object.values(e)}function fC(e,t){if(!jo(t))return!1;let r=zi(e);return Y(r.length,zi(t).length)&&r.every(n=>Km(e[n],t[n]))}function dC(e,t){return Lo(t)&&Y(e.length,t.length)&&e.every((r,n)=>Km(e[n],t[n]))}function Km(e,t){return Lo(e)?dC(e,t):jo(e)?fC(e,t):Y(e,t)}var De={};At(De,{IsBigInt64Array:()=>CC,IsBigUint64Array:()=>RC,IsBoolean:()=>lC,IsDate:()=>AC,IsFloat32Array:()=>TC,IsFloat64Array:()=>wC,IsInt16Array:()=>$C,IsInt32Array:()=>SC,IsInt8Array:()=>hC,IsMap:()=>MC,IsNumber:()=>gC,IsRegExp:()=>PC,IsSet:()=>OC,IsString:()=>yC,IsTypeArray:()=>xC,IsUint16Array:()=>EC,IsUint32Array:()=>kC,IsUint8Array:()=>IC,IsUint8ClampedArray:()=>bC});function lC(e){return e instanceof Boolean}function gC(e){return e instanceof Number}function yC(e){return e instanceof String}function xC(e){return globalThis.ArrayBuffer.isView(e)}function hC(e){return e instanceof globalThis.Int8Array}function IC(e){return e instanceof globalThis.Uint8Array}function bC(e){return e instanceof globalThis.Uint8ClampedArray}function $C(e){return e instanceof globalThis.Int16Array}function EC(e){return e instanceof globalThis.Uint16Array}function SC(e){return e instanceof globalThis.Int32Array}function kC(e){return e instanceof globalThis.Uint32Array}function TC(e){return e instanceof globalThis.Float32Array}function wC(e){return e instanceof globalThis.Float64Array}function CC(e){return e instanceof globalThis.BigInt64Array}function RC(e){return e instanceof globalThis.BigUint64Array}function PC(e){return e instanceof globalThis.RegExp}function AC(e){return e instanceof globalThis.Date}function OC(e){return e instanceof globalThis.Set}function MC(e){return e instanceof globalThis.Map}var Sf=s;var Vt={immutableTypes:!1,maxErrors:8,maxParseErrors:1,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function FC(){Vt.immutableTypes=!1,Vt.maxErrors=8,Vt.maxParseErrors=1,Vt.maxInstantiationCount=128,Vt.useAcceleration=!0,Vt.exactOptionalPropertyTypes=!1,Vt.enumerableKind=!1,Vt.correctiveParse=!1,Vt.unionPrioritySort=!0}function LC(e){for(let t of s.Keys(e)){let r=e[t];r!==void 0&&Object.defineProperty(Vt,t,{value:r})}}function Qi(){return Vt}function Xi(e){return s.HasPropertyKey(e,"~refine")&&s.IsArray(e["~refine"])&&s.Every(e["~refine"],0,t=>s.IsObject(t)&&s.HasPropertyKey(t,"check")&&s.HasPropertyKey(t,"error")&&s.IsFunction(t.check)&&s.IsFunction(t.error))}function gt(e){return s.IsObject(e)&&!s.IsArray(e)}function ln(e){return s.IsBoolean(e)}function L(e){return gt(e)||ln(e)}function Zi(e){return s.HasPropertyKey(e,"additionalItems")&&L(e.additionalItems)}function _t(e){return s.HasPropertyKey(e,"additionalProperties")&&L(e.additionalProperties)}function es(e){return s.HasPropertyKey(e,"allOf")&&s.IsArray(e.allOf)&&e.allOf.every(t=>L(t))}function kf(e){return s.HasPropertyKey(e,"$anchor")&&s.IsString(e.$anchor)}function ts(e){return s.HasPropertyKey(e,"anyOf")&&s.IsArray(e.anyOf)&&e.anyOf.every(t=>L(t))}function Hm(e){return s.HasPropertyKey(e,"const")}function Gr(e){return s.HasPropertyKey(e,"contains")&&L(e.contains)}function bt(e){return s.HasPropertyKey(e,"default")}function zm(e){return s.HasPropertyKey(e,"dependencies")&&s.IsObject(e.dependencies)&&Object.values(e.dependencies).every(t=>L(t)||s.IsArray(t)&&t.every(r=>s.IsString(r)))}function Wm(e){return s.HasPropertyKey(e,"dependentRequired")&&s.IsObject(e.dependentRequired)&&Object.values(e.dependentRequired).every(t=>s.IsArray(t)&&t.every(r=>s.IsString(r)))}function rs(e){return s.HasPropertyKey(e,"dependentSchemas")&&s.IsObject(e.dependentSchemas)&&Object.values(e.dependentSchemas).every(t=>L(t))}function Kr(e){return s.HasPropertyKey(e,"$dynamicAnchor")&&s.IsString(e.$dynamicAnchor)}function ns(e){return s.HasPropertyKey(e,"$dynamicRef")&&s.IsString(e.$dynamicRef)}function os(e){return s.HasPropertyKey(e,"else")&&L(e.else)}function Vm(e){return s.HasPropertyKey(e,"enum")&&s.IsArray(e.enum)}function Jm(e){return s.HasPropertyKey(e,"exclusiveMaximum")&&(s.IsNumber(e.exclusiveMaximum)||s.IsBigInt(e.exclusiveMaximum))}function wr(e){return s.HasPropertyKey(e,"exclusiveMinimum")&&(s.IsNumber(e.exclusiveMinimum)||s.IsBigInt(e.exclusiveMinimum))}function Do(e){return s.HasPropertyKey(e,"format")&&s.IsString(e.format)}function ut(e){return s.HasPropertyKey(e,"$id")&&s.IsString(e.$id)}function is(e){return s.HasPropertyKey(e,"if")&&L(e.if)}function gn(e){return s.HasPropertyKey(e,"items")&&(L(e.items)||s.IsArray(e.items)&&e.items.every(t=>L(t)))}function ss(e){return gn(e)&&s.IsArray(e.items)}function Ym(e){return s.HasPropertyKey(e,"maximum")&&(s.IsNumber(e.maximum)||s.IsBigInt(e.maximum))}function Qm(e){return s.HasPropertyKey(e,"maxContains")&&s.IsNumber(e.maxContains)}function No(e){return s.HasPropertyKey(e,"maxItems")&&s.IsNumber(e.maxItems)}function Xm(e){return s.HasPropertyKey(e,"maxLength")&&s.IsNumber(e.maxLength)}function Zm(e){return s.HasPropertyKey(e,"maxProperties")&&s.IsNumber(e.maxProperties)}function Cr(e){return s.HasPropertyKey(e,"minimum")&&(s.IsNumber(e.minimum)||s.IsBigInt(e.minimum))}function yn(e){return s.HasPropertyKey(e,"minContains")&&s.IsNumber(e.minContains)}function xn(e){return s.HasPropertyKey(e,"minItems")&&s.IsNumber(e.minItems)}function qo(e){return s.HasPropertyKey(e,"minLength")&&s.IsNumber(e.minLength)}function Uo(e){return s.HasPropertyKey(e,"minProperties")&&s.IsNumber(e.minProperties)}function eu(e){return s.HasPropertyKey(e,"multipleOf")&&(s.IsNumber(e.multipleOf)||s.IsBigInt(e.multipleOf))}function as(e){return s.HasPropertyKey(e,"not")&&L(e.not)}function ms(e){return s.HasPropertyKey(e,"oneOf")&&s.IsArray(e.oneOf)&&e.oneOf.every(t=>L(t))}function _o(e){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)}function Un(e){return s.HasPropertyKey(e,"patternProperties")&&s.IsObject(e.patternProperties)&&Object.values(e.patternProperties).every(t=>L(t))}function hn(e){return s.HasPropertyKey(e,"prefixItems")&&s.IsArray(e.prefixItems)&&e.prefixItems.every(t=>L(t))}function _n(e){return s.HasPropertyKey(e,"properties")&&s.IsObject(e.properties)&&Object.values(e.properties).every(t=>L(t))}function us(e){return s.HasPropertyKey(e,"propertyNames")&&(s.IsObject(e.propertyNames)||L(e.propertyNames))}function jC(e){return s.HasPropertyKey(e,"$recursiveAnchor")&&s.IsBoolean(e.$recursiveAnchor)}function Bo(e){return jC(e)&&s.IsEqual(e.$recursiveAnchor,!0)}function cs(e){return s.HasPropertyKey(e,"$recursiveRef")&&s.IsString(e.$recursiveRef)}function ps(e){return s.HasPropertyKey(e,"$ref")&&s.IsString(e.$ref)}function In(e){return s.HasPropertyKey(e,"required")&&s.IsArray(e.required)&&e.required.every(t=>s.IsString(t))}function fs(e){return s.HasPropertyKey(e,"then")&&L(e.then)}function tu(e){return s.HasPropertyKey(e,"type")&&(s.IsString(e.type)||s.IsArray(e.type)&&e.type.every(t=>s.IsString(t)))}function Hr(e){return s.HasPropertyKey(e,"uniqueItems")&&s.IsBoolean(e.uniqueItems)}function Go(e){return s.HasPropertyKey(e,"unevaluatedItems")&&L(e.unevaluatedItems)}function Ko(e){return s.HasPropertyKey(e,"unevaluatedProperties")&&L(e.unevaluatedProperties)}var ct=class{constructor(){let t=new Set,r=new Set;this.stack=[{indices:t,keys:r}]}Push(){let t=new Set,r=new Set;return this.stack.push({indices:t,keys:r}),!0}Pop(){return this.stack.pop(),!0}AddIndex(t){return this.GetIndices().add(t),!0}AddKey(t){return this.GetKeys().add(t),!0}GetIndices(){return this.stack[this.stack.length-1].indices}GetKeys(){return this.stack[this.stack.length-1].keys}Merge(t){for(let r of t)r.GetIndices().forEach(n=>this.GetIndices().add(n)),r.GetKeys().forEach(n=>this.GetKeys().add(n));return!0}},et=class extends ct{constructor(){super(),this.errors=[]}AtCapacity(){return this.errors.length>=Me.Get().maxErrors}AddError(t,r,n,o){return this.AddErrorObject({keyword:t,schemaPath:r,instancePath:n,params:o})}AddErrors(t){return t.forEach(r=>this.AddErrorObject(r)),!1}GetErrors(){return this.errors}AddErrorObject(t){return this.AtCapacity()||this.errors.push(t),!1}};function Tf(e,t,r,n){return s.Every(r["~refine"],0,(o,i)=>o.check(n))}function wf(e,t,r,n,o,i){return s.EveryAll(o["~refine"],0,(a,m)=>a.check(i)||t.AddError("~refine",r,n,{index:m,message:a.error(i)}))}var Ho="urn:typebox:root";function Rr(e,t){return URL.canParse(e,t)?new URL(e,t):s.IsEqual(t,Ho)?new URL(`${t}:${e}`):new URL(`${t.slice(0,t.lastIndexOf(":"))}:${e}`)}function Gn(e,t){let r=gt(t)&&ut(t)?Rr(t.$id,Ho).href:Ho;return{context:e,schema:t,lexicalSchema:t,lexicalBase:r,resourceBase:r,referenceBase:r,ids:[],useResourceBaseForReference:!0,recursiveAnchor:void 0,dynamicAnchors:[],resourceEntries:new Map,pendingResource:!0,enteredResource:!1}}function ru(e,t,r=!0){if(ln(t))return e;if(Array.isArray(t))return t.reduce((o,i)=>ru(o,i,!1),e);if(!gt(t)||!r&&ut(t))return e;let n=!r&&Kr(t)?[...e,t]:e;return Object.keys(t).reduce((o,i)=>ru(o,t[i],!1),n)}function zo(e,t){return e.resourceEntries.get(t)}function Cf(e,t){return e.enteredResource||zo(e,t)!==void 0}function DC(e){return!/^[A-Za-z][A-Za-z0-9+.-]*:/.test(e.$id)}function NC(e,t){return ut(t)?[...e.ids,t]:e.ids}function qC(e,t){return e.recursiveAnchor??(Bo(t)?t:void 0)}function UC(e,t){let r=ut(t)?ru(e.dynamicAnchors,t):e.dynamicAnchors;return Kr(t)?[...r,t]:r}function _C(e,t){return ut(t)?!1:e.pendingResource}function Rf(e,t){let r=zo(e,t);return r?r.base:ut(t)?Rr(t.$id,e.lexicalBase).href:e.lexicalBase}function Pf(e,t){let r=zo(e,t);return r?r.base:ut(t)&&e.pendingResource?Rr(t.$id,e.resourceBase).href:e.resourceBase}function Af(e,t){return ut(t)?!DC(t):e.useResourceBaseForReference}function BC(e,t){let r=Cf(e,t),n=Af(e,t);return r||n?Pf(e,t):Rf(e,t)}function GC(e,t){let r=zo(e,t);return r?r.root:ut(t)?t:e.lexicalSchema}function KC(e,t){return gt(t)&&(ut(t)||Kr(t)||s.IsUndefined(e.recursiveAnchor)&&Bo(t)||!s.IsUndefined(zo(e,t)))}function Kn(e,t){return KC(e,t)?{...e,ids:NC(e,t),dynamicAnchors:UC(e,t),recursiveAnchor:qC(e,t),pendingResource:_C(e,t),lexicalBase:Rf(e,t),resourceBase:Pf(e,t),useResourceBaseForReference:Af(e,t),referenceBase:BC(e,t),lexicalSchema:GC(e,t),enteredResource:Cf(e,t)}:e}function Of(e){return gn(e)&&s.IsArray(e.items)}function Mf(e,t,r,n){return Of(r)?s.Every(n,0,(i,a)=>s.IsLessThan(a,r.items.length)||Ot(e,t,r.additionalItems,i)&&t.AddIndex(a)):!0}function vf(e,t,r,n,o,i){return Of(o)?s.Every(i,0,(m,c)=>{let p=`${r}/additionalItems`,f=`${n}/${c}`;return s.IsLessThan(c,o.items.length)||Mt(e,t,p,f,o.additionalItems,m)&&t.AddIndex(c)}):!0}function $t(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function zr(e){return new RegExp(e,"u")}function HC(e){return`^${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`}function Ff(e){let t=[];return Un(e)&&t.push(...s.Keys(e.patternProperties)),_n(e)&&t.push(...s.Keys(e.properties).map(HC)),s.IsEqual(t.length,0)?"(?!)":`(${t.join("|")})`}function Lf(e,t,r,n){let o=zr(Ff(r));return s.Every(s.Keys(n),0,(a,m)=>o.test(a)||Ot(e,t,r.additionalProperties,n[a])&&t.AddKey(a))}function jf(e,t,r,n,o,i){let a=zr(Ff(o)),m=[];return s.EveryAll(s.Keys(i),0,(p,f)=>{let d=`${r}/additionalProperties`,g=`${n}/${$t(p)}`,y=a.test(p)||Mt(e,t,d,g,o.additionalProperties,i[p])&&t.AddKey(p);return y||m.push(p),y})||t.AddError("additionalProperties",r,n,{additionalProperties:m})}function Df(e,t,r,n){let o=r.allOf.reduce((i,a)=>{let m=new ct;return Q(e,m,a,n)?[...i,m]:i},[]);return s.IsEqual(o.length,r.allOf.length)&&t.Merge(o)}function Nf(e,t,r,n,o,i){let a=[],m=o.allOf.reduce((p,f,d)=>{let g=`${r}/allOf/${d}`,y=new et,I=ce(e,y,g,n,f,i);return I||a.push(y),I?[...p,y]:p},[]),c=s.IsEqual(m.length,o.allOf.length)&&t.Merge(m);return c||a.forEach(p=>t.AddErrors(p.GetErrors())),c}function qf(e,t,r,n){let o=r.anyOf.reduce((i,a)=>{let m=new ct;return Q(e,m,a,n)?[...i,m]:i},[]);return s.IsGreaterThan(o.length,0)&&t.Merge(o)}function Uf(e,t,r,n,o,i){let a=[],m=o.anyOf.reduce((p,f,d)=>{let g=new et,y=`${r}/anyOf/${d}`,I=ce(e,g,y,n,f,i);return I||a.push(g),I?[...p,g]:p},[]),c=s.IsGreaterThan(m.length,0)&&t.Merge(m);return c||a.forEach(p=>t.AddErrors(p.GetErrors())),c||t.AddError("anyOf",r,n,{})}function iu(e,t,r,n){return r}function _f(e,t,r,n,o,i){return iu(e,t,o,i)||t.AddError("boolean",r,n,{})}function su(e,t,r,n){return s.IsValueLike(r.const)?s.IsEqual(n,r.const):s.IsDeepEqual(n,r.const)}function Bf(e,t,r,n,o,i){return su(e,t,o,i)||t.AddError("const",r,n,{allowedValue:o.const})}function zC(e){return!(yn(e)&&s.IsEqual(e.minContains,0))}function au(e,t,r,n){return zC(r)?!s.IsEqual(n.length,0)&&s.SomeAll(n,(o,i)=>Q(e,t,r.contains,o)&&t.AddIndex(i)):!0}function Gf(e,t,r,n,o,i){return au(e,t,o,i)||t.AddError("contains",r,n,{minContains:1})}function Kf(e,t,r,n){let o=s.IsEqual(s.Keys(n).length,0),i=s.Every(s.Entries(r.dependencies),0,([a,m])=>!s.HasPropertyKey(n,a)||(s.IsArray(m)?m.every(c=>s.HasPropertyKey(n,c)):Q(e,t,m,n)));return o||i}function Hf(e,t,r,n,o,i){let a=s.IsEqual(s.Keys(i).length,0),m=s.EveryAll(s.Entries(o.dependencies),0,([c,p])=>{let f=`${r}/dependencies/${$t(c)}`;return!s.HasPropertyKey(i,c)||(s.IsArray(p)?p.every(d=>s.HasPropertyKey(i,d)||t.AddError("dependencies",r,n,{property:c,dependencies:p})):ce(e,t,f,n,p,i))});return a||m}function zf(e,t,r,n){let o=s.IsEqual(s.Keys(n).length,0),i=s.Every(s.Entries(r.dependentRequired),0,([a,m])=>!s.HasPropertyKey(n,a)||m.every(c=>s.HasPropertyKey(n,c)));return o||i}function Wf(e,t,r,n,o,i){let a=s.IsEqual(s.Keys(i).length,0),m=s.EveryAll(s.Entries(o.dependentRequired),0,([c,p])=>!s.HasPropertyKey(i,c)||s.EveryAll(p,0,f=>s.HasPropertyKey(i,f)||t.AddError("dependentRequired",r,n,{property:c,dependencies:p})));return a||m}function Vf(e,t,r,n){let o=s.IsEqual(s.Keys(n).length,0),i=s.Every(s.Entries(r.dependentSchemas),0,([a,m])=>!s.HasPropertyKey(n,a)||Q(e,t,m,n));return o||i}function Jf(e,t,r,n,o,i){let a=s.IsEqual(s.Keys(i).length,0),m=s.EveryAll(s.Entries(o.dependentSchemas),0,([c,p])=>{let f=`${r}/dependentSchemas/${$t(c)}`;return!s.HasPropertyKey(i,c)||ce(e,t,f,n,p,i)});return a||m}var Bt={};At(Bt,{DynamicRef:()=>SR,RecursiveRef:()=>bR,Ref:()=>hR});var mr={};At(mr,{Delete:()=>YC,Get:()=>VC,Has:()=>WC,Indices:()=>Vo,Set:()=>JC});function Qf(e){throw Error(e)}function Yf(){Qf("Pointer contains unsafe property key")}function mu(){Qf("Cannot set value")}function Vo(e){let t=e.split("/").map(r=>r.replace(/~1/g,"/").replace(/~0/g,"~"));return t[0]===""?t.slice(1):t}function WC(e,t){let r=e;for(let n of Vo(t)){if(!s.IsObject(r)||!s.HasPropertyKey(r,n))return!1;r=r[n]}return!0}function VC(e,t){let r=e;for(let n of Vo(t)){if(!s.IsObject(r)||s.IsUnsafePropertyKey(n))return;r=r[n]}return r}function Xf(e,t,r){let n=e;for(let o of t)s.IsUnsafePropertyKey(o)&&Yf(),n=s.IsObject(n)?n[o]:void 0;return s.IsUnsafePropertyKey(r)&&Yf(),s.IsObject(n)||mu(),n}function JC(e,t,r){let n=Vo(t),o=n.pop();return s.IsUndefined(o)&&mu(),Xf(e,n,o)[o]=r,e}function YC(e,t){let r=Vo(t),n=r.pop();s.IsUndefined(n)&&mu();let o=Xf(e,r,n);return s.IsArray(o)&&/^(0|[1-9]\d*)$/.test(n)?o.splice(Number(n),1):delete o[n],e}function pu(e,t){return gt(e)&&ut(e)?Rr(e.$id,t.href):t}function fu(e){return Rr(e,Ho)}function uu(e){return e.href.split("#")[0]}function QC(e,t,r){return cu(e,fu(t),r)}function XC(e,t){return t.$ref.startsWith("#")||e.enteredResource?e.lexicalSchema:e.schema}function ZC(e){return e.startsWith("#/")}function Zf(e,t){if(s.IsObject(e)&&Kr(e)&&s.IsEqual(e.$dynamicAnchor,t))return e;if(s.IsObject(e))for(let r of s.Keys(e)){let n=Zf(e[r],t);if(n)return n}}function cu(e,t,r){if(s.IsEqual(e,r))return t.href;let n=pu(e,t);if(s.IsArray(e))for(let o of e){let i=cu(o,n,r);if(!s.IsUndefined(i))return i}else if(s.IsObject(e))for(let o of s.Keys(e)){let i=cu(e[o],n,r);if(!s.IsUndefined(i))return i}}function ed(e,t){if(t.href.endsWith("#"))return e;if(!t.hash.startsWith("#"))return;let r=decodeURIComponent(t.hash.slice(1));if(r.startsWith("/"))return mr.Get(e,r)}function eR(e,t,r){if(!ut(e))return;if(s.IsEqual(e.$id,r.hash))return e;let n=new URL(r.href,t.href);if(s.IsEqual(t.pathname,n.pathname))return r.hash.startsWith("#")?ed(e,r):e}function tR(e,t,r){if(!kf(e))return;let n=new URL(`#${e.$anchor}`,t.href),o=new URL(r.href,t.href);return s.IsEqual(n.href,o.href)?e:void 0}function rR(e,t,r){if(!Kr(e))return;let n=new URL(`#${e.$dynamicAnchor}`,t.href),o=new URL(r.href,t.href);return s.IsEqual(n.href,o.href)?e:void 0}function nR(e,t,r){if(gt(e))return eR(e,t,r)??tR(e,t,r)??rR(e,t,r)??ed(e,r)}function oR(e,t,r){if(s.IsArray(e))return e.reduce((n,o)=>{let i=ds(o,t,r);return s.IsUndefined(i)?n:i},void 0)}function iR(e,t,r){if(s.IsObject(e))return s.Keys(e).reduce((n,o)=>{if(s.IsEqual(o,"const")||s.IsEqual(o,"enum"))return n;let i=ds(e[o],t,r);return s.IsUndefined(i)?n:i},void 0)}function ds(e,t,r){let n=pu(e,t);return nR(e,n,r)??oR(e,n,r)??iR(e,n,r)}function sR(e,t,r,n){let o=ls(e,t,r,n);return gt(o)&&ut(o)?o:void 0}function aR(e,t,r){if(!t.$ref.startsWith("#")||!gt(e.schema)||s.HasPropertyKey(e.schema,"$schema"))return;let n=QC(e.lexicalSchema,e.referenceBase,r);if(!(s.IsUndefined(n)||s.IsEqual(n,e.referenceBase)))return{target:r,base:n,root:e.lexicalSchema}}function mR(e,t,r){let n=e.context[t];if(gt(n))return{target:r,base:t,root:n}}function uR(e,t,r,n,o){let i=o?mR(e,n,r):void 0;return s.IsUndefined(i)?aR(e,t,r):i}function cR(e,t,r){if(ut(r))return;let n=sR(e.context,e.schema,e.referenceBase,t);if(!(!n||e.ids.includes(n)))return{resource:n}}function pR(e,t){return s.HasPropertyKey(e,t)?e[t]:void 0}function fR(e,t,r){return ds(e,t,r)}function dR(e,t,r){let n=uu(r);if(!s.HasPropertyKey(e,n)||s.IsEqual(n,uu(t)))return;let o=e[n],i=pu(o,new URL(n));return s.IsEqual(r.hash,"")?o:ds(o,i,r)}function ls(e,t,r,n){let o=fu(r),i=Rr(n,o.href);return pR(e,n)??fR(t,o,i)??dR(e,o,i)}function lR(e,t){if(!t)return e;let r=new Map(e.resourceEntries);return r.set(t.target,{base:t.base,root:t.root}),{...e,resourceEntries:r}}function gR(e,t){return t?Kn(e,t.resource):e}function td(e,t,r,n){let o=lR({...e,pendingResource:t},r);return gR(o,n)}function yR(e,t,r){let n=uu(Rr(t.$ref,e.referenceBase)),o=!s.IsEqual(n,e.resourceBase),i=uR(e,t,r,n,o),a=o?cR(e,n,r):void 0;return{schema:r,stack:td(e,!0,i,a)}}function xR(e,t){return{schema:t,stack:td(e,!s.IsUndefined(t))}}function hR(e,t){let r=ls(e.context,XC(e,t),e.referenceBase,t.$ref);return gt(r)?yR(e,t,r):xR(e,r)}function IR(e){return gt(e.lexicalSchema)&&Bo(e.lexicalSchema)}function bR(e,t){let r=IR(e)?e.recursiveAnchor:e.lexicalSchema;return ls(e.context,r,e.lexicalBase,t.$recursiveRef)}function rd(e,t){return Rr(t.$dynamicRef,fu(e.lexicalBase).href).hash}function nd(e,t){return e.dynamicAnchors.find(r=>s.IsEqual(r.$dynamicAnchor,t))??Zf(e.schema,t)}function $R(e,t,r){if(!gt(r)||!Kr(r))return r;let n=rd(e,t);return ZC(n)?r:nd(e,r.$dynamicAnchor)}function ER(e,t){let r=rd(e,t);return nd(e,decodeURIComponent(r.slice(1)))}function SR(e,t){let r=t.$dynamicRef.startsWith("#")?e.lexicalSchema:e.schema,n=ls(e.context,r,e.lexicalBase,t.$dynamicRef);return s.IsUndefined(n)?ER(e,t):$R(e,t,n)}function od(e,t,r,n){let o=Bt.DynamicRef(e,r)??!1,i=o?{...e,pendingResource:!0}:e;return L(o)&&Q(i,t,o,n)}function id(e,t,r,n,o,i){let a=Bt.DynamicRef(e,o)??!1,m=a?{...e,pendingResource:!0}:e;return L(a)&&ce(m,t,r,n,a,i)}function gu(e,t,r,n){return s.Some(r.enum,o=>s.IsValueLike(o)?s.IsEqual(n,o):s.IsDeepEqual(n,o))}function sd(e,t,r,n,o,i){return gu(e,t,o,i)||t.AddError("enum",r,n,{allowedValues:o.enum})}function yu(e,t,r,n){return s.IsLessThan(n,r.exclusiveMaximum)}function ad(e,t,r,n,o,i){return yu(e,t,o,i)||t.AddError("exclusiveMaximum",r,n,{comparison:"<",limit:o.exclusiveMaximum})}function xu(e,t,r,n){return s.IsGreaterThan(n,r.exclusiveMinimum)}function md(e,t,r,n,o,i){return xu(e,t,o,i)||t.AddError("exclusiveMinimum",r,n,{comparison:">",limit:o.exclusiveMinimum})}var Xo={};At(Xo,{Clear:()=>Ld,Entries:()=>f0,Get:()=>g0,Has:()=>l0,IsDate:()=>zn,IsDateTime:()=>gs,IsDuration:()=>ys,IsEmail:()=>xs,IsHostname:()=>Ts,IsIPv4:()=>Rs,IsIPv6:()=>Ps,IsIdnEmail:()=>ws,IsIdnHostname:()=>Cs,IsIri:()=>Os,IsIriReference:()=>As,IsJsonPointer:()=>vs,IsJsonPointerUriFragment:()=>Ms,IsRegex:()=>Fs,IsRelativeJsonPointer:()=>Ls,IsTime:()=>Wn,IsUri:()=>Ns,IsUriReference:()=>js,IsUriTemplate:()=>Ds,IsUrl:()=>qs,IsUuid:()=>Us,Reset:()=>jd,Set:()=>d0,Test:()=>y0});var kR=[0,31,28,31,30,31,30,31,31,30,31,30,31],TR=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;function wR(e){return e%4===0&&(e%100!==0||e%400===0)}function zn(e){let t=TR.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&wR(r)?29:kR[n])}var CR=/^(\d\d):(\d\d):(\d\d)(?:\.\d+)?(?:([Zz])|([+-])(\d\d):(\d\d))?$/;function Wn(e,t=!0){let r=CR.exec(e);if(!r||t&&!r[4]&&!r[5])return!1;let n=+r[1],o=+r[2],i=+r[3];if(n>23||o>59||i>60)return!1;if(r[5]){let f=+r[6],d=+r[7];if(f>23||d>59)return!1}if(i<60)return!0;let a=r[5]==="-"?-1:1,m=+(r[6]||0),c=+(r[7]||0);return((n*60+o-a*(m*60+c))%1440+1440)%1440===1439}var RR=/^(?:\[!?(?:(?!\.{1,2}[/\]])[A-Za-z._][A-Za-z._0-9+-]{0,13}(?:\/(?!\.{1,2}[/\]])[A-Za-z._][A-Za-z._0-9+-]{0,13})*|[+-](?:[01][0-9]|2[0-3]):[0-5][0-9])\](?:\[!?[a-z_][a-z_0-9-]*=[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*\])*|(?:\[!?[a-z_][a-z_0-9-]*=[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*\])*)$/;function gs(e){let t=e.indexOf("["),r=t===-1?e:e.slice(0,t);if(t!==-1&&!RR.test(e.slice(t)))return!1;let n=r.split(/T/i);return n.length===2&&zn(n[0])&&Wn(n[1])}var PR=/^P((\d+Y(\d+M(\d+D)?)?|\d+M(\d+D)?|\d+D)(T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S))?|T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S)|\d+W)$/;function ys(e){return PR.test(e)}var AR=/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[^"\\]|\\[\x20-\x7e])*")@(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*|\[(?:IPv6:[a-f0-9:]+|(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?:\.(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3})\])$/i;function xs(e){return AR.test(e)}var ud=/^(?!-).*(?<!-)$/,cd=/^(?!..--)/,pd=/^[a-zA-Z0-9-]*$/,uG=new RegExp("^\\p{ASCII}*$","u"),Vn=/[^\p{ASCII}]/u;var OR=/[0-9]/,fd=/[\u{0660}-\u{0669}]/u,MR=/[\u{06f0}-\u{06f9}]/u,vR=/[\u{002e}\u{002c}\u{003a}\u{002f}]/u,FR=/[\u{002d}\u{002b}]/u,hu=new RegExp("\\p{Mn}","u"),LR=new RegExp("\\p{Mc}","u"),cG=new RegExp("\\p{Me}","u"),dd=/[\p{Mn}\p{Mc}\p{Me}]/u,Iu=new RegExp("\\p{L}","u"),jR=new RegExp("\\p{Nd}","u"),ld=new RegExp("\\p{Script=Greek}","u"),hs=new RegExp("\\p{Script=Hebrew}","u"),gd=/[\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Han}]/u,yd=/[\p{Script=Arabic}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Mandaic}]/u,bu=/[\u{094d}\u{09cd}\u{0a4d}\u{0acd}\u{0b4d}\u{0bcd}\u{0c4d}\u{0ccd}\u{0d3b}\u{0d3c}\u{0d4d}\u{0dca}\u{1b44}\u{1baa}\u{1bab}\u{a9c0}\u{11046}\u{1107f}\u{110b9}\u{11133}\u{11134}\u{111c0}\u{11235}\u{1134d}\u{11442}\u{114c2}\u{115bf}\u{1163f}\u{116b6}\u{11c3f}\u{11d44}\u{11d45}]/u,xd=/[\u{0640}\u{07fa}\u{302e}\u{302f}\u{3031}\u{3032}\u{3033}\u{3034}\u{3035}\u{303b}]/u,DR=/[\u{00b7}\u{0375}\u{05f3}\u{05f4}\u{200c}\u{200d}\u{30fb}]/u,NR=/[\u{00df}\u{03c2}\u{06fd}\u{06fe}\u{0f0b}\u{3007}]/u,hd=new RegExp([OR,MR].map(e=>e.source).join("|"),"u"),Id=new RegExp([Iu,FR,vR,jR,hu,LR,DR,NR].map(e=>e.source).join("|"),"u");function bd(e){return ud.test(e)&&cd.test(e)&&pd.test(e)}var Yt=36,Yo=1,Qo=26,UR=38,_R=700,Ed=72,Sd=128;function $u(){throw null}function Is(e){return e.toLowerCase().startsWith("xn--")}function kd(e,t,r){e=r?Math.floor(e/_R):e>>1,e+=Math.floor(e/t);let n=0;for(;e>(Yt-Yo)*Qo>>1;)e=Math.floor(e/(Yt-Yo)),n+=Yt;return n+Math.floor((Yt-Yo+1)*e/(e+UR))}function bs(e){let t=[],r=Sd,n=0,o=Ed,i=e.lastIndexOf("-");if(i>0)for(let m=0;m<i;m++){let c=e.charCodeAt(m);c>=128&&$u(),t.push(c)}let a=i<0?0:i+1;for(;a<e.length;){let m=n,c=1,p=Yt;for(;;){a>=e.length&&$u();let d=e.charCodeAt(a++),g;d>=97&&d<=122?g=d-97:d>=48&&d<=57?g=d-48+26:$u(),n+=g*c;let y=p<=o?Yo:p>=o+Qo?Qo:p-o;if(g<y)break;c*=Yt-y,p+=Yt}let f=t.length+1;o=kd(n-m,f,m===0),r+=Math.floor(n/f),n%=f,t.splice(n,0,r),n++}return String.fromCodePoint(...t)}function $d(e){return e<26?String.fromCharCode(e+97):String.fromCharCode(e-26+48)}var BR=new RegExp(Vn.source,"gu");function Td(e){let t=e.replace(BR,""),r=t.length,n=r>0?[t,"-"]:[],o=Array.from(e,p=>p.codePointAt(0)),i=Sd,a=0,m=Ed,c=r;for(;c<o.length;){let p=1/0;for(let f of o)f>=i&&f<p&&(p=f);a+=(p-i)*(c+1),i=p;for(let f of o)if(f<i&&a++,f===i){let d=a;for(let g=Yt;;g+=Yt){let y=g<=m?Yo:g>=m+Qo?Qo:g-m;if(d<y)break;let I=y+(d-y)%(Yt-y);n.push($d(I)),d=Math.floor((d-y)/(Yt-y))}n.push($d(d)),m=kd(a,c+1,c===r),a=0,c++}a++,i++}return n.join("")}var GR=/^(?:R|AL|AN|EN|ES|CS|ET|ON|BN|NSM)$/,wd=/^(?:L|EN|ES|CS|ET|ON|BN|NSM)$/,KR=/^(?:R|AL|AN)$/;function Cd(e){if(Is(e))try{return $s(bs(e.slice(4).toLowerCase()))}catch{return!1}return $s(e)}function Rd(e){let t=String.fromCodePoint(e);return hd.test(t)?"EN":fd.test(t)?"AN":hu.test(t)?"NSM":hs.test(t)?"R":yd.test(t)?"AL":Iu.test(t)?"L":"ON"}function $s(e){for(let t of e)if(KR.test(Rd(t.codePointAt(0))))return!0;return!1}function Es(e){let t=!1,r=wd,n=!1,o=!1,i=!0;for(let a of e){let m=Rd(a.codePointAt(0));if(i){if(m!=="L"&&m!=="R"&&m!=="AL")return!1;t=m==="R"||m==="AL",r=t?GR:wd,i=!1}if(!r.test(m))return!1;m==="EN"?n=!0:m==="AN"&&(o=!0)}return!(t&&n&&o)}function HR(e){return Vn.test(e)&&Td(e).length+4>63}function zR(e){return e[0]==="-"||e[e.length-1]==="-"?!0:e.slice(2).join("").startsWith("--")}function Ss(e){if(HR(e)||$s(e)&&!Es(e))return!1;let t=[...e],r=t.map(i=>i.codePointAt(0)),n=r.length;if(zR(t)||dd.test(t[0]))return!1;let o=!1;for(let i=0;i<n;i++){let a=r[i],m=t[i];if(xd.test(m)||!Id.test(m))return!1;gd.test(m)&&(o=!0);let c=r[i-1],p=r[i+1];switch(a){case 183:if(c!==108||p!==108)return!1;break;case 885:if(!p||!ld.test(t[i+1]))return!1;break;case 1523:case 1524:if(!c||!hs.test(t[i-1]))return!1;break;case 8204:if(!c||c<128&&!bu.test(t[i-1]))return!1;break;case 8205:if(!c||!bu.test(t[i-1]))return!1;break;case 12539:break}}return!(e.includes("\u30FB")&&!o)}function ks(e){if(!Is(e))return!1;try{let t=e.slice(4).toLowerCase();if(t.lastIndexOf("-")===0)return!1;let r=bs(t);return Vn.test(r)?Ss(r):!1}catch{return!1}}function WR(e){return e.length>0&&e.length<=63}function VR(e){return WR(e)&&(ks(e)||bd(e))}function Md(e){return e.length===0||e.length>253||e.charCodeAt(e.length-1)===46?!1:e.split(".").every(t=>VR(t))}function JR(e){return e.length>0&&e.length<=63}function YR(e){return JR(e)&&(ks(e)||Ss(e))}function QR(e){return e.replace(/[\uff01-\uff5e]/g,t=>String.fromCharCode(t.charCodeAt(0)-65248)).normalize("NFC").replace(/[\u00ad\u034f\u180b-\u180d\u200b\ufe00-\ufe0f\u{e0100}-\u{e01ef}]/gu,"").replace(/[\u002E\u3002\uFF0E\uFF61]/g,".")}function vd(e){if(e.length===0||e.includes(" "))return!1;let t=QR(e);if(t.length>253)return!1;let r=t.split("."),n=r.some(o=>Cd(o));return r.every(o=>YR(o)&&(!n||Es(o)))}function Ts(e){return Md(e)}var XR=/^(?:[A-Za-z0-9!#$%&'*+\/=?^_`{|}~\u{0080}-\u{10FFFF}-]+(?:\.[A-Za-z0-9!#$%&'*+\/=?^_`{|}~\u{0080}-\u{10FFFF}-]+)*|"(?:[^"\\]|\\.)*")@[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,62})(?<!-)(?:\.[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,62})(?<!-))*$/iu;function ws(e){return XR.test(e.normalize("NFC"))}function Cs(e){return vd(e)}var ZR=/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/;function Rs(e){return ZR.test(e)}var e0=/^(?:(?:(?:[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-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|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\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})?::)$/i;function Ps(e){return e0.test(e)}var t0=/[\x00-\x20\x7F\\]|%(?![0-9a-fA-F]{2})/,r0=/^[a-zA-Z][a-zA-Z0-9+\-.]*\/\//;function As(e){return!t0.test(e)&&!r0.test(e)&&URL.canParse(e,"http://example.com")}var n0=/[\x00-\x20<>\^`{|}\\]/,o0=/%(?![0-9a-fA-F]{2})/;function Os(e){return n0.test(e)||o0.test(e)?!1:URL.canParse(e)}var i0=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;function Ms(e){return i0.test(e)}var s0=/^(?:\/(?:[^~/]|~0|~1)*)*$/;function vs(e){return s0.test(e)}function Fs(e){try{return new RegExp(e,"u"),!0}catch{return!1}}var a0=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function Ls(e){return a0.test(e)}var m0=/^(?:[a-z][a-z0-9+\-.]*:(?:\/\/(?:(?:[-a-z0-9._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:[\da-f]{1,4}:){6}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|::(?:[\da-f]{1,4}:){5}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:[\da-f]{1,4})?::(?:[\da-f]{1,4}:){4}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,1}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){3}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,2}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){2}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,3}[\da-f]{1,4})?::[\da-f]{1,4}:(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,4}[\da-f]{1,4})?::(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,5}[\da-f]{1,4})?::[\da-f]{1,4}|(?:(?:[\da-f]{1,4}:){0,6}[\da-f]{1,4})?::)|v[0-9a-f]+\.[-a-z0-9._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\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})*@)?(?:\[(?:(?:(?:[\da-f]{1,4}:){6}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|::(?:[\da-f]{1,4}:){5}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:[\da-f]{1,4})?::(?:[\da-f]{1,4}:){4}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,1}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){3}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,2}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){2}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,3}[\da-f]{1,4})?::[\da-f]{1,4}:(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,4}[\da-f]{1,4})?::(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,5}[\da-f]{1,4})?::[\da-f]{1,4}|(?:(?:[\da-f]{1,4}:){0,6}[\da-f]{1,4})?::)|v[0-9a-f]+\.[-a-z0-9._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\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;function js(e){return m0.test(e)}var u0=/^(?:(?:[^\x00-\x20"<>%\\^`{|}\x7f]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?:\.(?:[a-z0-9_]|%[0-9a-f]{2})+)*(?::[1-9]\d{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?:\.(?:[a-z0-9_]|%[0-9a-f]{2})+)*(?::[1-9]\d{0,3}|\*)?)*\})*$/i;function Ds(e){return u0.test(e)}var c0=/^[a-z][a-z0-9+\-.]*:(?:\/\/(?:(?:[-a-z0-9._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:[\da-f]{1,4}:){6}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|::(?:[\da-f]{1,4}:){5}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:[\da-f]{1,4})?::(?:[\da-f]{1,4}:){4}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,1}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){3}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,2}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){2}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,3}[\da-f]{1,4})?::[\da-f]{1,4}:(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,4}[\da-f]{1,4})?::(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,5}[\da-f]{1,4})?::[\da-f]{1,4}|(?:(?:[\da-f]{1,4}:){0,6}[\da-f]{1,4})?::)|v[0-9a-f]+\.[-a-z0-9._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\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;function Ns(e){return c0.test(e)}function qs(e){return URL.canParse(e)}var p0=/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function Us(e){return p0.test(e)}var le=new Map;function Ld(){le.clear()}function f0(){return[...le.entries()]}function d0(e,t){le.set(e,t)}function l0(e){return le.has(e)}function g0(e){return le.get(e)}function y0(e,t){return le.get(e)?.(t)??!0}function jd(){Ld(),le.set("date-time",gs),le.set("date",zn),le.set("duration",ys),le.set("email",xs),le.set("hostname",Ts),le.set("idn-email",ws),le.set("idn-hostname",Cs),le.set("ipv4",Rs),le.set("ipv6",Ps),le.set("iri-reference",As),le.set("iri",Os),le.set("json-pointer-uri-fragment",Ms),le.set("json-pointer",vs),le.set("regex",Fs),le.set("relative-json-pointer",Ls),le.set("time",Wn),le.set("uri-reference",js),le.set("uri-template",Ds),le.set("uri",Ns),le.set("url",qs),le.set("uuid",Us)}jd();function Su(e,t,r,n){return Xo.Test(r.format,n)}function Dd(e,t,r,n,o,i){return Su(e,t,o,i)||t.AddError("format",r,n,{format:o.format})}function Nd(e,t,r,n){let o=fs(r)?r.then:!0,i=os(r)?r.else:!0;return Q(e,t,r.if,n)?Q(e,t,o,n):Q(e,t,i,n)}function qd(e,t,r,n,o,i){let a=fs(o)?o.then:!0,m=os(o)?o.else:!0,c=new et,p=ce(e,c,`${r}/if`,n,o.if,i)?ce(e,c,`${r}/then`,n,a,i)||t.AddError("if",r,n,{failingKeyword:"then"}):ce(e,t,`${r}/else`,n,m,i)||t.AddError("if",r,n,{failingKeyword:"else"});return p&&t.Merge([c]),p}function x0(e,t,r,n){return s.Every(r.items,0,(o,i)=>s.IsLessEqualThan(n.length,i)||Ot(e,t,o,n[i])&&t.AddIndex(i))}function h0(e,t,r,n,o,i){return s.EveryAll(o.items,0,(a,m)=>{let c=`${r}/items/${m}`,p=`${n}/${m}`;return s.IsLessEqualThan(i.length,m)||Mt(e,t,c,p,a,i[m])&&t.AddIndex(m)})}function I0(e,t,r,n){let o=hn(r)?r.prefixItems.length:0;return s.Every(n,o,(i,a)=>Ot(e,t,r.items,i)&&t.AddIndex(a))}function b0(e,t,r,n,o,i){let a=hn(o)?o.prefixItems.length:0;return s.EveryAll(i,a,(m,c)=>{let p=`${r}/items`,f=`${n}/${c}`;return Mt(e,t,p,f,o.items,m)&&t.AddIndex(c)})}function Ud(e,t,r,n){return ss(r)?x0(e,t,r,n):I0(e,t,r,n)}function _d(e,t,r,n,o,i){return ss(o)?h0(e,t,r,n,o,i):b0(e,t,r,n,o,i)}function $0(e){return Gr(e)}function ku(e,t,r,n){if(!$0(r))return!0;let o=s.Counted(n,i=>Q(e,t,r.contains,i));return s.IsLessEqualThan(o,r.maxContains)}function Bd(e,t,r,n,o,i){let a=yn(o)?o.minContains:1;return ku(e,t,o,i)||t.AddError("contains",r,n,{minContains:a,maxContains:o.maxContains})}function Tu(e,t,r,n){return s.IsLessEqualThan(n,r.maximum)}function Gd(e,t,r,n,o,i){return Tu(e,t,o,i)||t.AddError("maximum",r,n,{comparison:"<=",limit:o.maximum})}function wu(e,t,r,n){return s.IsLessEqualThan(n.length,r.maxItems)}function Kd(e,t,r,n,o,i){return wu(e,t,o,i)||t.AddError("maxItems",r,n,{limit:o.maxItems})}function Cu(e,t,r,n){return s.IsMaxLength(n,r.maxLength)}function Hd(e,t,r,n,o,i){return Cu(e,t,o,i)||t.AddError("maxLength",r,n,{limit:o.maxLength})}function Ru(e,t,r,n){return s.IsLessEqualThan(s.Keys(n).length,r.maxProperties)}function zd(e,t,r,n,o,i){return Ru(e,t,o,i)||t.AddError("maxProperties",r,n,{limit:o.maxProperties})}function E0(e){return Gr(e)}function Pu(e,t,r,n){if(!E0(r))return!0;let o=s.Counted(n,(i,a)=>Q(e,t,r.contains,i)&&t.AddIndex(a));return s.IsGreaterEqualThan(o,r.minContains)}function Wd(e,t,r,n,o,i){return Pu(e,t,o,i)||t.AddError("contains",r,n,{minContains:o.minContains})}function Au(e,t,r,n){return s.IsGreaterEqualThan(n,r.minimum)}function Vd(e,t,r,n,o,i){return Au(e,t,o,i)||t.AddError("minimum",r,n,{comparison:">=",limit:o.minimum})}function Ou(e,t,r,n){return s.IsGreaterEqualThan(n.length,r.minItems)}function Jd(e,t,r,n,o,i){return Ou(e,t,o,i)||t.AddError("minItems",r,n,{limit:o.minItems})}function Mu(e,t,r,n){return s.IsMinLength(n,r.minLength)}function Yd(e,t,r,n,o,i){return Mu(e,t,o,i)||t.AddError("minLength",r,n,{limit:o.minLength})}function vu(e,t,r,n){return s.IsGreaterEqualThan(s.Keys(n).length,r.minProperties)}function Qd(e,t,r,n,o,i){return vu(e,t,o,i)||t.AddError("minProperties",r,n,{limit:o.minProperties})}function Fu(e,t,r,n){return s.IsMultipleOf(n,r.multipleOf)}function Xd(e,t,r,n,o,i){return Fu(e,t,o,i)||t.AddError("multipleOf",r,n,{multipleOf:o.multipleOf})}function Lu(e,t,r,n){let o=new ct;return!Q(e,o,r.not,n)&&t.Merge([o])}function Zd(e,t,r,n,o,i){return Lu(e,t,o,i)||t.AddError("not",r,n,{})}function el(e,t,r,n){let o=r.oneOf.reduce((i,a)=>{let m=new ct;return Q(e,m,a,n)?[...i,m]:i},[]);return s.IsEqual(o.length,1)&&t.Merge(o)}function tl(e,t,r,n,o,i){let a=[],m=[],c=o.oneOf.reduce((f,d,g)=>{let y=new et,I=`${r}/oneOf/${g}`,h=ce(e,y,I,n,d,i);return h&&m.push(g),h||a.push(y),h?[...f,y]:f},[]),p=s.IsEqual(c.length,1)&&t.Merge(c);return!p&&s.IsEqual(m.length,0)&&a.forEach(f=>t.AddErrors(f.GetErrors())),p||t.AddError("oneOf",r,n,{passingSchemas:m})}function ju(e,t,r,n){return(s.IsString(r.pattern)?zr(r.pattern):r.pattern).test(n)}function rl(e,t,r,n,o,i){return ju(e,t,o,i)||t.AddError("pattern",r,n,{pattern:o.pattern})}function nl(e,t,r,n){return s.Every(s.Entries(r.patternProperties),0,([o,i])=>{let a=zr(o);return s.Every(s.Entries(n),0,([m,c])=>!a.test(m)||Ot(e,t,i,c)&&t.AddKey(m))})}function ol(e,t,r,n,o,i){return s.EveryAll(s.Entries(o.patternProperties),0,([a,m])=>{let c=`${r}/patternProperties/${$t(a)}`,p=zr(a);return s.EveryAll(s.Entries(i),0,([f,d])=>{let g=`${n}/${$t(f)}`;return!p.test(f)||Mt(e,t,c,g,m,d)&&t.AddKey(f)})})}function il(e,t,r,n){return s.IsEqual(n.length,0)||s.Every(r.prefixItems,0,(o,i)=>s.IsLessEqualThan(n.length,i)||Ot(e,t,o,n[i])&&t.AddIndex(i))}function sl(e,t,r,n,o,i){return s.IsEqual(i.length,0)||s.EveryAll(o.prefixItems,0,(a,m)=>{let c=`${r}/prefixItems/${m}`,p=`${n}/${m}`;return s.IsLessEqualThan(i.length,m)||Mt(e,t,c,p,a,i[m])&&t.AddIndex(m)})}function Du(e,t){return e.includes(t)||Me.Get().exactOptionalPropertyTypes}function Nu(e,t){return s.IsUndefined(e[t])}function al(e,t,r,n){let o=In(r)?r.required:[];return s.Every(s.Entries(r.properties),0,([a,m])=>{let c=!s.HasPropertyKey(n,a)||Ot(e,t,m,n[a])&&t.AddKey(a);return Du(o,a)?c:Nu(n,a)||c})}function ml(e,t,r,n,o,i){let a=In(o)?o.required:[];return s.EveryAll(s.Entries(o.properties),0,([c,p])=>{let f=`${r}/properties/${$t(c)}`,d=`${n}/${$t(c)}`,g=()=>!s.HasPropertyKey(i,c)||Mt(e,t,f,d,p,i[c])&&t.AddKey(c);return Du(a,c)?g():Nu(i,c)||g()})}function ul(e,t,r,n){return s.Every(s.Keys(n),0,(o,i)=>Q(e,t,r.propertyNames,o))}function cl(e,t,r,n,o,i){let a=[];return s.EveryAll(s.Keys(i),0,(c,p)=>{let f=`${n}/${$t(c)}`,d=`${r}/propertyNames`,g=ce(e,t,d,f,o.propertyNames,c);return g||a.push(c),g})||t.AddError("propertyNames",r,n,{propertyNames:a})}function pl(e,t,r,n){let o=Bt.RecursiveRef(e,r)??!1,i=o?{...e,pendingResource:!0}:e;return L(o)&&Q(i,t,o,n)}function fl(e,t,r,n,o,i){let a=Bt.RecursiveRef(e,o)??!1,m=a?{...e,pendingResource:!0}:e;return L(a)&&ce(m,t,r,n,a,i)}function dl(e,t,r,n){let o=Bt.Ref(e,r),i=o.schema??!1,a=new ct,m=L(i)&&Q(o.stack,a,i,n);return m&&t.Merge([a]),m}function ll(e,t,r,n,o,i){let a=Bt.Ref(e,o),m=a.schema??!1,c=new et,p=L(m)&&ce(a.stack,c,r,n,m,i);return p&&t.Merge([c]),p||t.AddErrors(c.GetErrors()),p}function gl(e,t,r,n){return s.Every(r.required,0,o=>s.HasPropertyKey(n,o))}function yl(e,t,r,n,o,i){let a=[];return s.EveryAll(o.required,0,c=>{let p=s.HasPropertyKey(i,c);return p||a.push(c),p})||t.AddError("required",r,n,{requiredProperties:a})}function qu(e,t,r,n,o){return s.IsEqual(r,"object")?s.IsObjectNotArray(o):s.IsEqual(r,"array")?s.IsArray(o):s.IsEqual(r,"boolean")?s.IsBoolean(o):s.IsEqual(r,"integer")?s.IsInteger(o):s.IsEqual(r,"number")?s.IsNumber(o):s.IsEqual(r,"null")?s.IsNull(o):s.IsEqual(r,"string")?s.IsString(o):s.IsEqual(r,"bigint")?s.IsBigInt(o):s.IsEqual(r,"constructor")?s.IsConstructor(o):s.IsEqual(r,"function")?s.IsFunction(o):s.IsEqual(r,"symbol")?s.IsSymbol(o):s.IsEqual(r,"undefined")?s.IsUndefined(o):s.IsEqual(r,"void")?s.IsUndefined(o):!0}function xl(e,t,r,n,o){return s.Some(r,i=>qu(e,t,i,n,o))}function hl(e,t,r,n){return s.IsArray(r.type)?xl(e,t,r.type,r,n):qu(e,t,r.type,r,n)}function Il(e,t,r,n,o,i){return(s.IsArray(o.type)?xl(e,t,o.type,o,i):qu(e,t,o.type,o,i))||t.AddError("type",r,n,{type:o.type})}function bl(e,t,r,n){let o=t.GetIndices();return s.Every(n,0,(i,a)=>(o.has(a)||Q(e,t,r.unevaluatedItems,i))&&t.AddIndex(a))}function $l(e,t,r,n,o,i){let a=t.GetIndices(),m=[];return s.EveryAll(i,0,(p,f)=>{let d=new et,g=(a.has(f)||ce(e,d,r,n,o.unevaluatedItems,p))&&t.AddIndex(f);return g||m.push(f),g})||t.AddError("unevaluatedItems",r,n,{unevaluatedItems:m})}function El(e,t,r,n){let o=t.GetKeys();return s.Every(s.Entries(n),0,([i,a])=>o.has(i)||Q(e,t,r.unevaluatedProperties,a)&&t.AddKey(i))}function Sl(e,t,r,n,o,i){let a=t.GetKeys(),m=[];return s.EveryAll(s.Entries(i),0,([p,f])=>{let d=new et,g=a.has(p)||ce(e,d,r,n,o.unevaluatedProperties,f)&&t.AddKey(p);return g||m.push(p),g})||t.AddError("unevaluatedProperties",r,n,{unevaluatedProperties:m})}var Pr={};At(Pr,{Hash:()=>Pl,HashCode:()=>D0});function $e(){throw new Error("Unreachable")}function S0(e){let t=new Set,r=e;for(;r&&r!==Object.prototype;){for(let n of Reflect.ownKeys(r))n!=="constructor"&&typeof n!="symbol"&&t.add(n);r=Object.getPrototypeOf(r)}return[...t]}function k0(e){return typeof e=="number"}var St={Array:0,BigInt:1,Boolean:2,Date:3,Constructor:4,Function:5,Null:6,Number:7,Object:8,RegExp:9,String:10,Symbol:11,TypeArray:12,Undefined:13},Bs=8997,Zo=33826,Gs=40164,Ks=52210,wl=new Float64Array(1),Cl=new DataView(wl.buffer),Rl=new Uint8Array(wl.buffer);function Ge(e){let t=Bs^e,r=t*435,n=Zo*435+(r>>>16),o=Gs*435+(n>>>16)+(t<<8),i=Ks*435+(o>>>16)+(Zo<<8);Bs=r&65535,Zo=n&65535,Gs=o&65535,Ks=i&65535}function T0(e){Ge(St.Array);for(let t of e)Wr(t)}function w0(e){Ge(St.BigInt),Cl.setBigInt64(0,e);for(let t of Rl)Ge(t)}function kl(e){Ge(St.Boolean),Ge(e?1:0)}function C0(e){Ge(St.Constructor),Wr(e.toString())}function R0(e){Ge(St.Date),Wr(e.getTime())}function P0(e){Ge(St.Function),Wr(e.toString())}function A0(e){Ge(St.Null)}function Tl(e){Ge(St.Number),Cl.setFloat64(0,e,!0);for(let t of Rl)Ge(t)}function O0(e){Ge(St.Object);for(let t of S0(e).sort())Wr(t),Wr(e[t])}function M0(e){Ge(St.RegExp),Uu(e.toString())}var v0=new TextEncoder;function Uu(e){Ge(St.String);for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r>127){for(let n of v0.encode(e.slice(t)))Ge(n);return}Ge(r)}}function F0(e){Ge(St.Symbol),Wr(e.toString())}function L0(e){Ge(St.TypeArray);let t=new Uint8Array(e.buffer);for(let r=0;r<t.length;r++)Ge(t[r])}function j0(e){return Ge(St.Undefined)}function Wr(e){return De.IsTypeArray(e)?L0(e):De.IsDate(e)?R0(e):De.IsRegExp(e)?M0(e):De.IsBoolean(e)?kl(e.valueOf()):De.IsString(e)?Uu(e.valueOf()):De.IsNumber(e)?Tl(e.valueOf()):k0(e)?Tl(e):s.IsArray(e)?T0(e):s.IsBoolean(e)?kl(e):s.IsBigInt(e)?w0(e):s.IsConstructor(e)?C0(e):s.IsNull(e)?A0(e):s.IsObject(e)?O0(e):s.IsString(e)?Uu(e):s.IsSymbol(e)?F0(e):s.IsUndefined(e)?j0(e):s.IsFunction(e)?P0(e):$e()}function _s(e){return e.toString(16).padStart(4,"0")}function D0(e){return BigInt(`0x${Pl(e)}`)}function Pl(e){return Bs=8997,Zo=33826,Gs=40164,Ks=52210,Wr(e),`${_s(Ks)}${_s(Gs)}${_s(Zo)}${_s(Bs)}`}function Al(e){return!s.IsEqual(e.uniqueItems,!1)}function Ol(e,t,r,n){if(!Al(r))return!0;let o=new Set(n.map(Pr.Hash)).size,i=n.length;return s.IsEqual(o,i)}function Ml(e,t,r,n,o,i){if(!Al(o))return!0;let a=new Set,m=i.reduce((p,f,d)=>{let g=Pr.Hash(f);return a.has(g)?[...p,d]:(a.add(g),p)},[]);return s.IsEqual(m.length,0)||t.AddError("uniqueItems",r,n,{duplicateItems:m})}function Ot(e,t,r,n){return t.Push()&&Q(e,t,r,n)&&t.Pop()}function Q(e,t,r,n){let o=Kn(e,r);return ln(r)?iu(o,t,r,n):(!tu(r)||hl(o,t,r,n))&&(!(s.IsObject(n)&&!s.IsArray(n))||(!In(r)||gl(o,t,r,n))&&(!_t(r)||Lf(o,t,r,n))&&(!zm(r)||Kf(o,t,r,n))&&(!Wm(r)||zf(o,t,r,n))&&(!rs(r)||Vf(o,t,r,n))&&(!Un(r)||nl(o,t,r,n))&&(!_n(r)||al(o,t,r,n))&&(!us(r)||ul(o,t,r,n))&&(!Uo(r)||vu(o,t,r,n))&&(!Zm(r)||Ru(o,t,r,n)))&&(!s.IsArray(n)||(!Zi(r)||Mf(o,t,r,n))&&(!Gr(r)||au(o,t,r,n))&&(!gn(r)||Ud(o,t,r,n))&&(!yn(r)||Pu(o,t,r,n))&&(!Qm(r)||ku(o,t,r,n))&&(!xn(r)||Ou(o,t,r,n))&&(!No(r)||wu(o,t,r,n))&&(!hn(r)||il(o,t,r,n))&&(!Hr(r)||Ol(o,t,r,n)))&&(!s.IsString(n)||(!qo(r)||Mu(o,t,r,n))&&(!Xm(r)||Cu(o,t,r,n))&&(!Do(r)||Su(o,t,r,n))&&(!_o(r)||ju(o,t,r,n)))&&(!(s.IsNumber(n)||s.IsBigInt(n))||(!wr(r)||xu(o,t,r,n))&&(!Jm(r)||yu(o,t,r,n))&&(!Cr(r)||Au(o,t,r,n))&&(!Ym(r)||Tu(o,t,r,n))&&(!eu(r)||Fu(o,t,r,n)))&&(!ps(r)||dl(o,t,r,n))&&(!cs(r)||pl(o,t,r,n))&&(!ns(r)||od(o,t,r,n))&&(!Hm(r)||su(o,t,r,n))&&(!Vm(r)||gu(o,t,r,n))&&(!is(r)||Nd(o,t,r,n))&&(!as(r)||Lu(o,t,r,n))&&(!es(r)||Df(o,t,r,n))&&(!ts(r)||qf(o,t,r,n))&&(!ms(r)||el(o,t,r,n))&&(!Go(r)||!s.IsArray(n)||bl(o,t,r,n))&&(!Ko(r)||!s.IsObject(n)||El(o,t,r,n))&&(!Xi(r)||Tf(o,t,r,n))}function Mt(e,t,r,n,o,i){return t.Push()&&ce(e,t,r,n,o,i)&&t.Pop()}function ce(e,t,r,n,o,i){if(t.AtCapacity())return!1;let a=Kn(e,o);return ln(o)?_f(a,t,r,n,o,i):!!(+(!tu(o)||Il(a,t,r,n,o,i))&+(!(s.IsObject(i)&&!s.IsArray(i))||!!(+(!In(o)||yl(a,t,r,n,o,i))&+(!_t(o)||jf(a,t,r,n,o,i))&+(!zm(o)||Hf(a,t,r,n,o,i))&+(!Wm(o)||Wf(a,t,r,n,o,i))&+(!rs(o)||Jf(a,t,r,n,o,i))&+(!Un(o)||ol(a,t,r,n,o,i))&+(!_n(o)||ml(a,t,r,n,o,i))&+(!us(o)||cl(a,t,r,n,o,i))&+(!Uo(o)||Qd(a,t,r,n,o,i))&+(!Zm(o)||zd(a,t,r,n,o,i))))&+(!s.IsArray(i)||!!(+(!Zi(o)||vf(a,t,r,n,o,i))&+(!Gr(o)||Gf(a,t,r,n,o,i))&+(!gn(o)||_d(a,t,r,n,o,i))&+(!yn(o)||Wd(a,t,r,n,o,i))&+(!Qm(o)||Bd(a,t,r,n,o,i))&+(!xn(o)||Jd(a,t,r,n,o,i))&+(!No(o)||Kd(a,t,r,n,o,i))&+(!hn(o)||sl(a,t,r,n,o,i))&+(!Hr(o)||Ml(a,t,r,n,o,i))))&+(!s.IsString(i)||!!(+(!qo(o)||Yd(a,t,r,n,o,i))&+(!Xm(o)||Hd(a,t,r,n,o,i))&+(!Do(o)||Dd(a,t,r,n,o,i))&+(!_o(o)||rl(a,t,r,n,o,i))))&+(!(s.IsNumber(i)||s.IsBigInt(i))||!!(+(!wr(o)||md(a,t,r,n,o,i))&+(!Jm(o)||ad(a,t,r,n,o,i))&+(!Cr(o)||Vd(a,t,r,n,o,i))&+(!Ym(o)||Gd(a,t,r,n,o,i))&+(!eu(o)||Xd(a,t,r,n,o,i))))&+(!ps(o)||ll(a,t,r,n,o,i))&+(!cs(o)||fl(a,t,r,n,o,i))&+(!ns(o)||id(a,t,r,n,o,i))&+(!Hm(o)||Bf(a,t,r,n,o,i))&+(!Vm(o)||sd(a,t,r,n,o,i))&+(!is(o)||qd(a,t,r,n,o,i))&+(!as(o)||Zd(a,t,r,n,o,i))&+(!es(o)||Nf(a,t,r,n,o,i))&+(!ts(o)||Uf(a,t,r,n,o,i))&+(!ms(o)||tl(a,t,r,n,o,i))&+(!Go(o)||!s.IsArray(i)||$l(a,t,r,n,o,i))&+(!Ko(o)||!s.IsObject(i)||Sl(a,t,r,n,o,i)))&&(!Xi(o)||wf(a,t,r,n,o,i))}function Fl(e){switch(e.keyword){case"additionalProperties":return"must not have additional properties";case"anyOf":return"must match a schema in anyOf";case"boolean":return"schema is false";case"const":return"must be equal to constant";case"contains":return"must contain at least 1 valid item";case"dependencies":return`must have properties ${e.params.dependencies.join(", ")} when property ${e.params.property} is present`;case"dependentRequired":return`must have properties ${e.params.dependencies.join(", ")} when property ${e.params.property} is present`;case"enum":return"must be equal to one of the allowed values";case"exclusiveMaximum":return`must be ${e.params.comparison} ${e.params.limit}`;case"exclusiveMinimum":return`must be ${e.params.comparison} ${e.params.limit}`;case"format":return`must match format "${e.params.format}"`;case"if":return`must match "${e.params.failingKeyword}" schema`;case"maxItems":return`must not have more than ${e.params.limit} items`;case"maxLength":return`must not have more than ${e.params.limit} characters`;case"maxProperties":return`must not have more than ${e.params.limit} properties`;case"maximum":return`must be ${e.params.comparison} ${e.params.limit}`;case"minItems":return`must not have fewer than ${e.params.limit} items`;case"minLength":return`must not have fewer than ${e.params.limit} characters`;case"minProperties":return`must not have fewer than ${e.params.limit} properties`;case"minimum":return`must be ${e.params.comparison} ${e.params.limit}`;case"multipleOf":return`must be multiple of ${e.params.multipleOf}`;case"not":return"must not be valid";case"oneOf":return"must match exactly one schema in oneOf";case"pattern":return`must match pattern "${e.params.pattern}"`;case"propertyNames":return`property names ${e.params.propertyNames.join(", ")} are invalid`;case"required":return`must have required properties ${e.params.requiredProperties.join(", ")}`;case"type":return typeof e.params.type=="string"?`must be ${e.params.type}`:`must be either ${e.params.type.join(" or ")}`;case"unevaluatedItems":return"must not have unevaluated items";case"unevaluatedProperties":return"must not have unevaluated properties";case"uniqueItems":return"must not have duplicate items";case"~refine":return e.params.message;default:return"an unknown validation error occurred"}}var N0=Fl;function Ll(){return N0}var l={};At(l,{Assign:()=>U0,Clone:()=>_0,Create:()=>G0,Discard:()=>K0,Metrics:()=>Qt,Update:()=>V0});var Qt={assign:0,create:0,clone:0,discard:0,update:0};function vt(e){return[...s.Keys(e),...s.Symbols(e)]}function jl(e,t){if(!t.has(e)){t.add(e);for(let r of vt(e)){let n=Object.getOwnPropertyDescriptor(e,r);!n||!("value"in n)||s.IsObject(n.value)&&jl(n.value,t)}Object.freeze(e)}}function Vr(e){return Me.Get().immutableTypes&&jl(e,new WeakSet),e}function U0(e,t){Qt.assign+=1;let r={},n=vt(t),o=vt(e);for(let i of o)n.includes(i)||Object.defineProperty(r,i,Object.getOwnPropertyDescriptor(e,i));for(let i of n)Object.defineProperty(r,i,Object.getOwnPropertyDescriptor(t,i));return Vr(r)}function _0(e){Qt.clone+=1;let t={};for(let r of vt(e)){if(s.IsUnsafePropertyKey(r))continue;let n=Object.getOwnPropertyDescriptor(e,r);s.IsEqual(n.enumerable,!0)?t[r]=n.value:Object.defineProperty(t,r,n)}return t}function Dl(e,t){return{...e,...t}}function B0(e,t){for(let r of Object.keys(t))Object.defineProperty(e,r,{configurable:!0,writable:!0,enumerable:!1,value:t[r]});return e}function G0(e,t,r={}){Qt.create+=1;let n=Dl(t,r),o=Me.Get().enumerableKind?Dl(n,e):B0(n,e);return Vr(o)}function K0(e,t){Qt.discard+=1;let r={};for(let n of vt(e)){if(t.includes(n))continue;let o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,o)}return Vr(r)}function H0(e,t,r,n){for(let o of vt(e)){if(s.IsUnsafePropertyKey(o)||t.includes(o)||r.includes(o))continue;let i=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(n,o,i)}}function z0(e,t,r){let n=Me.Get().enumerableKind;for(let o of t)s.IsUnsafePropertyKey(o)||Object.defineProperty(r,o,{configurable:!0,writable:!0,enumerable:n,value:e[o]})}function W0(e,t,r){for(let n of t)s.IsUnsafePropertyKey(n)||Object.defineProperty(r,n,{configurable:!0,enumerable:!0,writable:!0,value:e[n]})}function V0(e,t,r){Qt.update+=1;let n={},o=vt(t),i=vt(r);return H0(e,o,i,n),z0(t,o,n),W0(r,i,n),Vr(n)}function Hs(...e){let[t,r,n]=B.Match(e,{3:(f,d,g)=>[f,d,g],2:(f,d)=>[{},f,d]}),o=Gn(t,r),i=new et,a=ce(o,i,"#","",r,n),m=i.GetErrors(),c=Ll(),p=m.map(f=>({...f,message:c(f)}));return[a,p]}var ql=0;function zs(){let e=Qi();ql=e.maxErrors,e.maxErrors=e.maxParseErrors}function Ws(){let e=Qi();e.maxErrors=ql}function Bu(...e){let[t,r,n]=B.Match(e,{3:(a,m,c)=>[a,m,c],2:(a,m)=>[{},a,m]}),o=Gn(t,r),i=new ct;return Q(o,i,r,n)}function K(...e){let[t,r,n]=B.Match(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[{},o,i]});return Bu(t,r,n)}function Xt(...e){let[t,r,n]=B.Match(e,{3:(a,m,c)=>[a,m,c],2:(a,m)=>[{},a,m]}),[o,i]=Hs(t,r,n);return i}var Ar=class extends Error{constructor(t,r,n){super(t),Object.defineProperty(this,"cause",{value:{source:t,errors:n,value:r},writable:!1,configurable:!1,enumerable:!1})}};function Vs(...e){let[t,r,n]=B.Match(e,{3:(i,a,m)=>[i,a,m],2:(i,a)=>[{},i,a]});if(!K(t,r,n))throw new Ar("Assert",n,Xt(t,r,n))}function w(e,t){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],t)}function ye(e){return s.IsObject(e)}function R(e,t,r){return l.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:r},{})}function Jr(e){return w(e,"Deferred")}function ur(e,t){return l.Update(e,{"~readonly":!0},t)}function Ul(e,t,r,n){let o=$(e,t,r);return ur(o,n)}function cr(e,t){return l.Update(e,{"~optional":!0},t)}function _l(e,t,r,n){let o=$(e,t,r);return cr(o,n)}function yt(e,t){return l.Create({"~kind":"Array"},{type:"array",items:e},t)}function W(e){return w(e,"Array")}function Jn(e){return l.Discard(e,["~kind","type","items"])}function pr(e,t,r={}){return l.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},r)}function Ee(e){return w(e,"Constructor")}function Bl(e){return l.Discard(e,["~kind","type","parameters","instanceType"])}function fr(e,t,r={}){return l.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},r)}function Se(e){return w(e,"Function")}function Gl(e){return l.Discard(e,["~kind","type","parameters","returnType"])}function Be(e,t){return l.Create({"~kind":"Ref"},{$ref:e},t)}function te(e){return w(e,"Ref")}function Yr(e,t){return l.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function Yn(e){return w(e,"Generic")}function Qn(e){return l.Create({"~kind":"Any"},{},e)}function Ie(e){return w(e,"Any")}var Kl="(?!)";function ie(e){return l.Create({"~kind":"Never"},{not:{}},e)}function xt(e){return w(e,"Never")}function dr(e,t={}){return R("AddOptional",[e],t)}function Js(e,t={}){return cr(e,t)}function Hl(e){return Js(e)}function ve(e){return ye(e)&&s.HasPropertyKey(e,"~optional")}function zl(e){return s.Keys(e).filter(t=>!ve(e[t]))}function Ys(e){return s.Keys(e)}function Qs(e){return s.Values(e)}function M(e,t={}){let r=zl(e),n=r.length>0?{required:r}:{};return l.Create({"~kind":"Object"},{type:"object",...n,properties:e},t)}function A(e){return w(e,"Object")}function Wl(e){return l.Discard(e,["~kind","type","properties","required"])}function Ne(e){return l.Create({"~kind":"Unknown"},{},e)}function Fe(e){return w(e,"Unknown")}function lr(e,t,r){let n=s.Keys(e).reduce((o,i)=>({...o,[i]:l.Update(e[i],{},{$id:i})}),{});return l.Create({"~kind":"Cyclic"},{$defs:n,$ref:t},r)}function me(e){return w(e,"Cyclic")}function Vl(e){return l.Update(e,{"~unsafe":null},{})}function Xs(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"~unsafe")&&s.IsNull(e["~unsafe"])}function ei(...e){let[t,r]=B.Match(e,{2:(n,o)=>[n,o,o],1:n=>[n,Ne(),Ne()]});return l.Create({"~kind":"Infer"},{type:"infer",name:t,extends:r},{})}function Le(e){return w(e,"Infer")}function $n(e,t,r,n={}){return l.Create({"~kind":"Dependent"},{if:e,then:t,else:r},n)}function ke(e){return w(e,"Dependent")}function Jl(e){return l.Discard(e,["~kind","if","then","else"])}function Yl(e){return s.IsObjectNotArray(e)}function Ql(e){return s.Keys(e).filter(r=>isNaN(r)).reduce((r,n)=>[...r,e[n]],[])}function Xl(e){return s.IsString(e)||s.IsNumber(e)}function Zl(e,t){let r=Yl(e)?Ql(e):e;return l.Create({"~kind":"Enum"},{enum:r},t)}function Te(e){return w(e,"Enum")}function ot(e,t={}){return l.Create({"~kind":"Intersect"},{allOf:e},t)}function O(e){return w(e,"Intersect")}function eg(e){return l.Discard(e,["~kind","allOf"])}var ti=class{constructor(t,r){this.type=t,this.decode=r}Encode(t){let r=this.type,n=pt(r)?a=>this.decode(r["~codec"].decode(a)):this.decode,o=pt(r)?a=>r["~codec"].encode(t(a)):t,i={decode:n,encode:o};return l.Update(this.type,{"~codec":i},{})}},ri=class{constructor(t){this.type=t}Decode(t){return new ti(this.type,t)}};function Zs(e){return new ri(e)}function tg(e,t){return Zs(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function rg(e,t){return Zs(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function pt(e){return ye(e)&&s.HasPropertyKey(e,"~codec")&&s.IsObject(e["~codec"])&&s.HasPropertyKey(e["~codec"],"encode")&&s.HasPropertyKey(e["~codec"],"decode")}function ng(e){return Xn(e)}function En(e){return ye(e)&&s.HasPropertyKey(e,"~immutable")}function gr(e,t={}){return R("AddReadonly",[e],t)}function ea(e,t={}){return ur(e,t)}function og(e){return ea(e)}function Or(e){return ye(e)&&s.HasPropertyKey(e,"~readonly")}function Q0(e,t){let r=ni(e)?[...e["~refine"],t]:[t];return l.Update(e,{"~refine":r},{})}function ig(...e){let[t,r,n]=B.Match(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[o,i,()=>"Refine Error"]});return Q0(t,{check:r,error:n})}function X0(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"check")&&s.HasPropertyKey(e,"error")&&s.IsFunction(e.check)&&s.IsFunction(e.error)}function ni(e){return ye(e)&&s.HasPropertyKey(e,"~refine")&&s.IsArray(e["~refine"])&&s.Every(e["~refine"],0,t=>X0(t))}var sg="-?(?:0|[1-9][0-9]*)n";function oi(e){return l.Create({"~kind":"BigInt"},{type:"bigint"},e)}function kt(e){return w(e,"BigInt")}function ta(e){return l.Create({"~kind":"Boolean"},{type:"boolean"},e)}function ft(e){return w(e,"Boolean")}function ii(e){return l.Create({"~kind":"Identifier"},{name:e})}function ag(e){return w(e,"Identifier")}var ra="-?(?:0|[1-9][0-9]*)";function Sn(e){return l.Create({"~kind":"Integer"},{type:"integer"},e)}function Ke(e){return w(e,"Integer")}var Gu=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function Z0(e){return s.IsBigInt(e)?"bigint":s.IsBoolean(e)?"boolean":s.IsNumber(e)?"number":s.IsString(e)?"string":(()=>{throw new Gu(e)})()}function G(e,t){return l.Create({"~kind":"Literal"},{type:Z0(e),const:e},t)}function na(e){return s.IsBigInt(e)||s.IsBoolean(e)||s.IsNumber(e)||s.IsString(e)}function mg(e){return H(e)&&s.IsBigInt(e.const)}function ug(e){return H(e)&&s.IsBoolean(e.const)}function oa(e){return H(e)&&s.IsNumber(e.const)}function ia(e){return H(e)&&s.IsString(e.const)}function H(e){return w(e,"Literal")}function Zn(e){return l.Create({"~kind":"Null"},{type:"null"},e)}function yr(e){return w(e,"Null")}var sa="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function Tt(e){return l.Create({"~kind":"Number"},{type:"number"},e)}function xe(e){return w(e,"Number")}function eo(e){return l.Create({"~kind":"Symbol"},{type:"symbol"},e)}function xr(e){return w(e,"Symbol")}function kn(...e){let[t,r,n]=B.Match(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[o,i,i],1:o=>[o,Ne(),Ne()]});return l.Create({"~kind":"Parameter"},{name:t,extends:r,equals:n},{})}function cg(e){return w(e,"Parameter")}var aa=".*";function tt(e){return l.Create({"~kind":"String"},{type:"string"},e)}function qe(e){return w(e,"String")}function j(e,t={}){return l.Create({"~kind":"Union"},{anyOf:e},t)}function S(e){return w(e,"Union")}function pg(e){return l.Discard(e,["~kind","anyOf"])}function si(e){let t=fg(e);return s.IsEqual(t.length,2)?t[0]:[]}function eP(e){return!0}function dg(e){return s.ShiftLeft(e,(t,r)=>tP(t)?dg(r):!1,()=>!0)}function lg(e){return s.IsEqual(e.length,0)?!1:dg(e)}function tP(e){return S(e)?lg(e.anyOf):H(e)?eP(e.const):!1}function ma(e){return lg(e)}function ua(e){return l.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function gg(e,t,r=[]){return s.ShiftLeft(e,(n,o)=>gg(o,t,[...r,`${n}${t}`]),()=>r)}function rP(e,t){return s.IsEqual(e.length,0)?[`${t}`]:gg(e,t)}function yg(e,t,r=[]){return s.ShiftLeft(t,(n,o)=>yg(e,o,[...r,...xg(e,n)]),()=>r)}function xg(e,t){return S(t)?yg(e,t.anyOf):H(t)?rP(e,t.const):$e()}function hg(e,t){return s.ShiftLeft(t,(r,n)=>hg(xg(e,r),n),()=>e)}function nP(e){return e.map(t=>G(t))}function oP(e){let t=hg([],e),r=nP(t);return j(r)}function iP(e){return s.IsEqual(e.length,0)?$e():s.IsEqual(e.length,1)&&H(e[0])?e[0]:oP(e)}function Ku(e){let t=si(e);return s.IsEqual(t.length,0)?tt():ma(t)?iP(t):ua(e)}function to(e){let t=Ku(e);return ue(t)?tt():t}function ht(e,t){let r="object",n={[e]:t};return l.Create({"~kind":"Record"},{type:r,patternProperties:n})}function Ig(e){return ht(Zt,e)}function bg(e){return M({true:e,false:e})}function we(e,t={}){let[r,n,o]=[e,e.length,!1];return l.Create({"~kind":"Tuple"},{type:"array",additionalItems:o,items:r,minItems:n},t)}function q(e){return w(e,"Tuple")}function $g(e){return l.Discard(e,["~kind","type","items","minItems","additionalItems"])}function Hu(e){return e.reduceRight((r,n,o)=>({[o]:n,...r}),{})}function Eg(e){let t=Hu(e.items);return M(t)}function sP(e){return l.Discard(e,["~optional"])}function Tn(e,t){return l.Update(sP(e),{},t)}function Sg(e,t,r,n){let o=$(e,t,r);return Tn(o,n)}function aP(e){return l.Discard(e,["~readonly"])}function ro(e,t){return l.Update(aP(e),{},t)}function kg(e,t,r,n){let o=$(e,t,r);return ro(o,n)}function ca(e,t){let r=Or(e)&&Or(t),n=ve(e)&&ve(t),o=Ce([e,t]),i=ro(Tn(o,{}),{});return r&&n?ur(cr(i,{}),{}):r?ur(i,{}):n?cr(i,{}):i}function Tg(e,t){let r=Or(e)||Or(t),n=ve(e)||ve(t),o=ro(Tn(e,{}),{}),i=ro(Tn(t,{}),{}),a=It([o,i]);return r&&n?ur(cr(a,{}),{}):r?ur(a,{}):n?cr(a,{}):a}function mP(e,t,r){return r in e?r in t?ca(e[r],t[r]):e[r]:r in t?t[r]:ie()}function uP(e,t){return[...new Set([...s.Keys(e),...s.Keys(t)])].reduce((o,i)=>({...o,[i]:mP(e,t,i)}),{})}function wg(e){return A(e)?e.properties:q(e)?Hu(e.items):{}}function Cg(e,t){let r=wg(e),n=wg(t),o=uP(r,n);return M(o)}function cP(e,t){let r=no(e,t);return s.IsEqual(r,mi)?e:s.IsEqual(r,ui)||s.IsEqual(r,ai)?t:ie()}function Rg(e){return A(e)||q(e)}function pP(e,t){let r=Rg(e),n=Rg(t);return r&&n?Cg(e,t):r&&!n?e:!r&&n?t:cP(e,t)}function Pg(e,t){return xt(e)||Ie(e)?e:Fe(e)||xt(t)||Ie(t)?t:Fe(t)?e:pP(e,t)}function fP(e,t){return S(e)||S(t)}function dP(e,t){let r=Gt(e),n=Gt(t);return fP(r,n)?Ce([r,n]):Pg(r,n)}function Ag(e,t,r=[]){return s.ShiftLeft(t,(n,o)=>Ag(e,o,[...r,dP(n,e)]),()=>s.IsEqual(r.length,0)?[e]:r)}function Og(e,t,r=[]){return s.ShiftLeft(e,(n,o)=>Og(o,t,[...r,...ci([n],t)]),()=>r)}function ci(e,t=[]){return s.ShiftLeft(e,(r,n)=>S(r)?ci(n,Og(r.anyOf,t)):ci(n,Ag(r,t)),()=>t)}function lP(e,t){let r=rt({},e,t);return F.IsExtendsTrueLike(r)?[]:[e]}function Mg(e,t,r=[]){return s.ShiftLeft(e,(n,o)=>Mg(o,t,[...r,...lP(n,t)]),()=>r)}function pa(e,t){let r=Gt(e),n=S(r)?r.anyOf:[r],o=Mg(n,t);return It(o)}function er(e,t,r){let n=Ce([e,t]),o=pa(r,e);return It([n,o])}function dt(e,t=[]){return s.ShiftLeft(e,(r,n)=>dt(n,[...t,G(r)]),()=>It(t))}function Ce(e){let t=ci(e),r=zu(t);return It(r)}function it(e){let t=to(e);return Gt(t)}function It(e){let t=zu(e);return Qr(t)}function Gt(e){return ke(e)?er(e.if,e.then,e.else):Te(e)?dt(e.enum):O(e)?Ce(e.allOf):ue(e)?it(e.pattern):S(e)?It(e.anyOf):e}function Qr(e){return s.IsEqual(e.length,1)?e[0]:s.IsEqual(e.length,0)?ie():j(e)}function vg(e,t){let r=dt(e);return Xr(r,t)}function Fg(e,t){return ht(Zr,t)}function Lg(e,t){let r=Ce(e);return Xr(r,t)}function jg(e,t){return s.IsString(e)||s.IsNumber(e)?M({[e]:t}):s.IsEqual(e,!1)?M({false:t}):s.IsEqual(e,!0)?M({true:t}):M({})}function Dg(e,t){return ht(oo,t)}function Ng(e,t){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)?ht(e.pattern.toString(),t):ht(Zt,t)}function qg(e,t){let r=si(e);return ma(r)?Xr(it(e),t):ht(e,t)}function gP(e){return S(e)?en(e.anyOf):[e]}function en(e,t=[]){return s.ShiftLeft(e,(r,n)=>en(n,[...t,...gP(r)]),()=>t)}function yP(e){return e.some(t=>qe(t)||xe(t)||Ke(t))}function xP(e,t){return s.IsEqual(yP(e),!0)?ht(Zt,t):void 0}function hP(e,t){return e.reduce((r,n)=>H(n)&&(s.IsString(n.const)||s.IsNumber(n.const))?{...r,[n.const]:t}:r,{})}function IP(e,t){let r=hP(e,t);return M(r)}function Ug(e,t){let r=en(e),n=xP(r,t);return ye(n)?n:IP(r,t)}function Xr(e,t){return Ie(e)?Ig(t):ft(e)?bg(t):Te(e)?vg(e.enum,t):Ke(e)?Fg(e,t):O(e)?Lg(e.allOf,t):H(e)?jg(e.const,t):xe(e)?Dg(e,t):S(e)?Ug(e.anyOf,t):qe(e)?Ng(e,t):ue(e)?qg(e.pattern,t):M({})}function Wu(e,t,r){return U([e])?l.Update(Xr(e,t),{},r):fa(e,t,r)}function _g(e,t,r,n,o){let i=$(e,t,r),a=$(e,t,n);return Wu(i,a,o)}var Zr=`^${ra}$`,oo=`^${sa}$`,Zt=`^${aa}$`;function fa(e,t,r={}){return R("Record",[e,t],r)}function io(e,t,r={}){return Wu(e,t,r)}function Bg(e,t){return ht(e,t)}function da(e){return s.IsEqual(e,Zt)?tt():s.IsEqual(e,Zr)?Sn():s.IsEqual(e,oo)?Tt():Ku(e)}function je(e){return s.Keys(e.patternProperties)[0]}function so(e){let t=je(e);return da(t)}function pe(e){return e.patternProperties[je(e)]}function ne(e){return w(e,"Record")}function wn(e){return l.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function tn(e){return w(e,"Rest")}function la(e){return l.Create({"~kind":"This"},{$ref:"#"},e)}function ga(e){return w(e,"This")}function ao(e){return l.Create({"~kind":"Undefined"},{type:"undefined"},e)}function Kt(e){return w(e,"Undefined")}function ya(e){return l.Create({"~kind":"Void"},{type:"void"},e)}function wt(e){return w(e,"Void")}function $P(e,t){return s.IsEqual(e,"Array")?yt(t[0]):s.IsEqual(e,"Capitalize")?ha(t[0]):s.IsEqual(e,"ConstructorParameters")?Sa(t[0]):s.IsEqual(e,"Evaluate")?Hx(t[0]):s.IsEqual(e,"Exclude")?ka(t[0],t[1]):s.IsEqual(e,"Extract")?Ta(t[0],t[1]):s.IsEqual(e,"Index")?li(t[0],t[1]):s.IsEqual(e,"InstanceType")?wa(t[0]):s.IsEqual(e,"Lowercase")?Ia(t[0]):s.IsEqual(e,"NonNullable")?Ca(t[0]):s.IsEqual(e,"Omit")?Ra(t[0],t[1]):s.IsEqual(e,"Parameters")?Pa(t[0]):s.IsEqual(e,"Partial")?Aa(t[0]):s.IsEqual(e,"Pick")?Oa(t[0],t[1]):s.IsEqual(e,"Readonly")?Ma(t[0]):s.IsEqual(e,"KeyOf")?gi(t[0]):s.IsEqual(e,"Record")?fa(t[0],t[1]):s.IsEqual(e,"Required")?va(t[0]):s.IsEqual(e,"ReturnType")?Fa(t[0]):s.IsEqual(e,"Uncapitalize")?ba(t[0]):s.IsEqual(e,"Uppercase")?$a(t[0]):di(Be(e),t)}function Cn(){throw Error("Unreachable")}function Wg(e,t=[]){return s.ShiftLeft(e,(r,n)=>Wg(n,[...t,r[1]]),()=>t)}function Mr(e){return s.IsEqual(e.length,3)?[e[0],...Wg(e[1])]:[]}function Vg(e){return kn(e[0],e[2],e[4])}function Jg(e){return kn(e[0],e[2],e[2])}function Yg(e){return kn(e[0],Ne(),e[2])}function Qg(e){return kn(e,Ne(),Ne())}function Xg(e){return Mr(e)}function Zg(e){return e[1]}function ey(e){return Mr(e)}function ty(e){return e[1]}function ry(e){return $P(e[0],e[1])}function ny(e){return null}function oy(e){return tt()}function iy(e){return Tt()}function sy(e){return ta()}function ay(e){return ao()}function my(e){return Zn()}function uy(e){return Sn()}function cy(e){return oi()}function py(e){return Ne()}function fy(e){return Qn()}function dy(e){return M({})}function ly(e){return ie()}function gy(e){return eo()}function yy(e){return ya()}function xy(e){return la()}function hy(e){return G(BigInt(e))}function Iy(e){return G(s.IsEqual(e,"true"))}function by(e){return G(parseFloat(e))}function $y(e){return G(e)}function Ey(e){return e[1]}function Sy(e){return G(e)}function ky(e){return s.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function Ty(e){return e[1]}function wy(e){return xa(e)}function Cy(e){return s.IsEqual(e.length,6)?$n(e[1],e[3],e[5]):$n(e[1],e[3],Ne())}function Ry(e){return e.length>0}function Py(e){return e.reduce((t,r)=>s.IsEqual(r.length,3)?[...t,[r[1]]]:[...t,[]],[])}function Ay(e){return s.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function Oy(e){return s.IsArray(e)&&s.IsEqual(e.length,3)?e[1]:e}function My(e){return s.IsEqual(e.length,2)?e[1]:[]}function Gg(e,t){return t.reduce((r,n)=>{let o=n;return s.IsEqual(o.length,1)?li(r,o[0]):s.IsEqual(o.length,0)?yt(r):Cn()},e)}function Kg(e,t){return s.IsEqual(t.length,3)?Ea(e,t[0],t[1],t[2]):e}function EP(e,t){return s.IsArray(t)&&s.IsEqual(t.length,0)?e:La(e,t)}function vy(e){let[t,r,n,o,i]=e;return EP(Kg(t?gi(Gg(r,n)):Gg(r,n),o),i)}function Vu(e,t){return s.IsEqual(t.length,3)?(()=>{let[r,n,o]=t,i=Vu(n,o);if(s.IsEqual(r,"&"))return O(i)?ot([e,...i.allOf]):ot([e,i]);if(s.IsEqual(r,"|"))return S(i)?j([e,...i.anyOf]):j([e,i]);Cn()})():e}function Fy(e){let[t,r]=e;return Vu(t,r)}function Ly(e){let[t,r]=e;return Vu(t,r)}function jy(e){return Gx(e[1])}function Dy(e){return e[1]}function Ny(e){return Yr(e[0],e[2])}function qy(e){return s.IsEqual(e.length,4)?ei(e[1],e[3]):s.IsEqual(e.length,2)?ei(e[1],Ne()):Cn()}function Uy(e){return`${e}`}function _y(e){return Ke(e[3])?Zr:xe(e[3])?oo:xr(e[3])?Zt:qe(e[3])?Zt:Cn()}function By(e){return e.length>0}function Gy(e){return e.length>0}function Ky(e){let[t,r,n,o,i]=e;return{[r]:t&&n?gr(dr(i)):t&&!n?gr(i):!t&&n?dr(i):i}}function Hy(e){return Mr(e)}function zy(e){return e.reduce((t,r)=>s.HasPropertyKey(r,Zr)||s.HasPropertyKey(r,oo)||s.HasPropertyKey(r,Zt)?[t[0],l.Assign(t[1],r)]:[l.Assign(t[0],r),t[1]],[{},{}])}function Wy(e){return zy(e[1])}function Vy(e){let[t,r]=e,n=s.IsEqual(s.Keys(r).length,0)?{}:{patternProperties:r};return M(t,n)}function Jy(e){return s.IsEqual(e.length,5)?gr(dr(e[4])):s.IsEqual(e.length,3)?e[2]:s.IsEqual(e.length,4)?s.IsEqual(e[2],"readonly")?gr(e[3]):dr(e[3]):Cn()}function Yy(e){if(!s.IsArray(e)||!s.IsEqual(e.length,3))return e;let[t,r,n]=e;return t&&n?gr(dr(r)):t&&!n?gr(r):!t&&n?dr(r):r}function Qy(e){return s.IsEqual(e.length,2)?wn(e[1]):s.IsEqual(e.length,1)?e[0]:Cn()}function Xy(e){return Mr(e)}function Zy(e){return we(e[1])}function ex(e){return gr(dr(e[4]))}function tx(e){return gr(e[3])}function rx(e){return dr(e[3])}function nx(e){return e[2]}function ox(e){return s.IsEqual(e.length,2)?wn(e[1]):s.IsEqual(e.length,1)?e[0]:Cn()}function ix(e){return Mr(e)}function sx(e){return fr(e[1],e[4])}function ax(e){return pr(e[2],e[5])}function Hg(e,t){return s.IsEqual(e,"remove")?Kx(t):s.IsEqual(e,"add")?gr(t):t}function mx(e){return s.IsEqual(e.length,2)&&s.IsEqual(e[0],"-")?"remove":s.IsEqual(e.length,2)&&s.IsEqual(e[0],"+")||s.IsEqual(e.length,1)?"add":"none"}function zg(e,t){return s.IsEqual(e,"remove")?Bx(t):s.IsEqual(e,"add")?dr(t):t}function ux(e){return s.IsEqual(e.length,2)&&s.IsEqual(e[0],"-")?"remove":s.IsEqual(e.length,2)&&s.IsEqual(e[0],"+")||s.IsEqual(e.length,1)?"add":"none"}function cx(e){return s.IsEqual(e.length,2)?[e[1]]:[]}function px(e){return s.IsArray(e[6])&&s.IsEqual(e[6].length,1)?pi(ii(e[3]),e[5],e[6][0],Hg(e[1],zg(e[8],e[10]))):pi(ii(e[3]),e[5],Be(e[3]),Hg(e[1],zg(e[8],e[10])))}function fx(e){return Be(e)}function dx(e){return BigInt(e)}function lx(e){return parseFloat(e)}function gx(e){return s.IsEqual(e,"true")}function yx(e){return null}function xx(e){return{[e[0]]:e[2]}}function hx(e){return Mr(e)}function SP(e){return e.reduce((t,r)=>l.Assign(t,r),{})}function Ix(e){return SP(e[1])}function bx(e){return Mr(e)}function $x(e){return e[1]}function Ex(e){return oi()}function Sx(e){return tt()}function kx(e){return Tt()}function Tx(e){return Sn()}function wx(e){return ie()}function Cx(e){return G(e)}function Rx(e){return j(e[1])}function Px(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function Ax(e){return[e[0],...e[1]]}function Ox(e){return e[1]}function Mx(e){return Mr(e)}function vx(e){return s.IsEqual(e.length,2)?e[1]:[]}function Fx(e){let t=e[2],r=e[3],[n,o]=e[4],i=s.IsEqual(s.Keys(o).length,0)?{}:{patternProperties:o};return{[e[1]]:Yr(t,fi(r,n,i))}}function Lx(e){let t=e[2],[r,n]=e[3],o=s.IsEqual(s.Keys(n).length,0)?{}:{patternProperties:n};return{[e[1]]:fi(t,r,o)}}function jx(e){return{[e[1]]:Yr(e[2],e[4])}}function Dx(e){return{[e[1]]:e[3]}}function Nx(e){return null}function qx(e){return Mr(e)}function Ux(e){return e[1]}function _x(e){let[t,r]=[e[0],e[1]];return zx(l.Assign(t,zy(r)[0]))}function yi(e){return Y(e.length,2)}function V(e,t,r){return yi(e)?t(e[0],e[1]):r()}function wP(e,t){return Y(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function be(e,t){for(let r=0;r<e.length;r++){let n=wP(e[r],t);if(yi(n))return n}return[]}function Ju(e,t){return Array.from({length:t-e+1},(r,n)=>String.fromCharCode(e+n))}var Wx=[...Ju(97,122),...Ju(65,90)],Yu="0",Qu=Ju(49,57),mo=[Yu,...Qu],Vx=" ",uo=`
|
|
1
|
+
import{b as pf}from"./chunk-27TRKD65.js";import{t as cf}from"./chunk-SVONBXW3.js";import{H as Ye,K as uf,L as jn,a as Gi}from"./chunk-465RG5I6.js";import{a as sr}from"./chunk-UTYFLLSM.js";import{a as Nm,b as Dn,c as Nn,d as qm,e as Um,f as Mo,g as _m,h as Br,j as vo}from"./chunk-MVVEYKN6.js";import{a as At}from"./chunk-WOT6VMZA.js";import{spawn as k1}from"node:child_process";import{existsSync as T1,readFileSync as w1}from"node:fs";import{join as C1}from"node:path";var B={};At(B,{Match:()=>Nw});function Nw(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}var Me={};At(Me,{Get:()=>Qi,Reset:()=>FC,Set:()=>LC});var s={};At(s,{CodePointCount:()=>Zw,Counted:()=>sC,Entries:()=>uC,EntriesRegExp:()=>mC,Every:()=>rC,EveryAll:()=>nC,GraphemeCount:()=>Xw,HasPropertyKey:()=>aC,IsArray:()=>Lo,IsBigInt:()=>Fo,IsBoolean:()=>xf,IsClassInstance:()=>Qw,IsConstructor:()=>Hw,IsDeepEqual:()=>Km,IsEqual:()=>Y,IsFunction:()=>hf,IsGreaterEqualThan:()=>bf,IsGreaterThan:()=>Vw,IsInteger:()=>Bm,IsLessEqualThan:()=>If,IsLessThan:()=>Jw,IsMaxLength:()=>eC,IsMinLength:()=>tC,IsMultipleOf:()=>Yw,IsNull:()=>Wi,IsNumber:()=>Vi,IsObject:()=>jo,IsObjectNotArray:()=>zw,IsString:()=>Ji,IsSymbol:()=>Ww,IsUndefined:()=>Gm,IsUnsafePropertyKey:()=>Ef,IsValueLike:()=>$f,Keys:()=>zi,ShiftLeft:()=>Yi,Some:()=>oC,SomeAll:()=>iC,Symbols:()=>cC,Values:()=>pC});function qn(e,t,r){return e>=t&&e<=r}function qw(e){return e===8205}function ff(e){return qn(e,127462,127487)}function Uw(e){return qn(e,65024,65039)}function _w(e){return qn(e,768,879)||qn(e,6832,6911)||qn(e,7616,7679)||qn(e,65056,65071)}function Ki(e){return e>65535?2:1}function df(e,t){for(;t<e.length;){let r=e.codePointAt(t);if(_w(r)||Uw(r))t+=Ki(r);else break}return t}function Bw(e,t){let r=e.codePointAt(t),n=t+Ki(r);for(n=df(e,n);n<e.length-1&&qw(e.codePointAt(n));){let o=e.codePointAt(n+1);n+=1+Ki(o),n=df(e,n)}return ff(r)&&n<e.length&&ff(e.codePointAt(n))&&(n+=Ki(e.codePointAt(n))),n}function lf(e){let t=0,r=0;for(;r<e.length;)r=Bw(e,r),t++;return t}function Hi(e){let t=0,r=0,n=0;for(;r<e.length;){let o=e.charCodeAt(r++)>>10;t+=+((n<<8|o)!==13879),n=o}return t}function gf(e,t){return e.length<=t||e.length<=t<<1&&Hi(e)<=t}function yf(e,t){return e.length>=t<<1||e.length>=t&&Hi(e)>=t}function Lo(e){return Array.isArray(e)}function Fo(e){return Y(typeof e,"bigint")}function xf(e){return Y(typeof e,"boolean")}function Hw(e){if(Gm(e)||!hf(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function hf(e){return Y(typeof e,"function")}function Bm(e){return Number.isInteger(e)}function Wi(e){return Y(e,null)}function Vi(e){return Number.isFinite(e)}function zw(e){return jo(e)&&!Lo(e)}function jo(e){return Y(typeof e,"object")&&!Wi(e)}function Ji(e){return Y(typeof e,"string")}function Ww(e){return Y(typeof e,"symbol")}function Gm(e){return Y(e,void 0)}function Y(e,t){return e===t}function Vw(e,t){return e>t}function Jw(e,t){return e<t}function If(e,t){return e<=t}function bf(e,t){return e>=t}function Yw(e,t){if(Fo(e)||Fo(t))return BigInt(e)%BigInt(t)===0n;let r=1e-10;if(!Vi(e)||Bm(e)&&1/t%1===0)return!0;let n=e%t;return Math.min(Math.abs(n),Math.abs(n-t),Math.abs(n+t))<r}function Qw(e){if(!jo(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return Wi(t)?!1:Y(typeof t.constructor,"function")&&!(Y(t.constructor,globalThis.Object)||Y(t.constructor.name,"Object"))}function $f(e){return Fo(e)||xf(e)||Wi(e)||Vi(e)||Ji(e)||Gm(e)}function Xw(e){return lf(e)}function Zw(e){return Hi(e)}function eC(e,t){return gf(e,t)}function tC(e,t){return yf(e,t)}function rC(e,t,r){return e.every((n,o)=>o<t||r(n,o))}function nC(e,t,r){let n=!0;return e.forEach((o,i)=>{i>=t&&!r(o,i)&&(n=!1)}),n}function oC(e,t){return e.some((r,n)=>t(r,n))}function iC(e,t){let r=!1;return e.forEach((n,o)=>{t(n,o)&&(r=!0)}),r}function sC(e,t){return e.reduce((r,n,o)=>t(n,o)?++r:r,0)}function Yi(e,t,r){return Y(e.length,0)?r():t(e[0],e.slice(1))}function Ef(e){return Y(e,"__proto__")||Y(e,"constructor")||Y(e,"prototype")}function aC(e,t){return Ef(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function mC(e){return zi(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function uC(e){return Object.entries(e)}function zi(e){return Object.getOwnPropertyNames(e)}function cC(e){return Object.getOwnPropertySymbols(e)}function pC(e){return Object.values(e)}function fC(e,t){if(!jo(t))return!1;let r=zi(e);return Y(r.length,zi(t).length)&&r.every(n=>Km(e[n],t[n]))}function dC(e,t){return Lo(t)&&Y(e.length,t.length)&&e.every((r,n)=>Km(e[n],t[n]))}function Km(e,t){return Lo(e)?dC(e,t):jo(e)?fC(e,t):Y(e,t)}var De={};At(De,{IsBigInt64Array:()=>CC,IsBigUint64Array:()=>RC,IsBoolean:()=>lC,IsDate:()=>AC,IsFloat32Array:()=>TC,IsFloat64Array:()=>wC,IsInt16Array:()=>$C,IsInt32Array:()=>SC,IsInt8Array:()=>hC,IsMap:()=>MC,IsNumber:()=>gC,IsRegExp:()=>PC,IsSet:()=>OC,IsString:()=>yC,IsTypeArray:()=>xC,IsUint16Array:()=>EC,IsUint32Array:()=>kC,IsUint8Array:()=>IC,IsUint8ClampedArray:()=>bC});function lC(e){return e instanceof Boolean}function gC(e){return e instanceof Number}function yC(e){return e instanceof String}function xC(e){return globalThis.ArrayBuffer.isView(e)}function hC(e){return e instanceof globalThis.Int8Array}function IC(e){return e instanceof globalThis.Uint8Array}function bC(e){return e instanceof globalThis.Uint8ClampedArray}function $C(e){return e instanceof globalThis.Int16Array}function EC(e){return e instanceof globalThis.Uint16Array}function SC(e){return e instanceof globalThis.Int32Array}function kC(e){return e instanceof globalThis.Uint32Array}function TC(e){return e instanceof globalThis.Float32Array}function wC(e){return e instanceof globalThis.Float64Array}function CC(e){return e instanceof globalThis.BigInt64Array}function RC(e){return e instanceof globalThis.BigUint64Array}function PC(e){return e instanceof globalThis.RegExp}function AC(e){return e instanceof globalThis.Date}function OC(e){return e instanceof globalThis.Set}function MC(e){return e instanceof globalThis.Map}var Sf=s;var Vt={immutableTypes:!1,maxErrors:8,maxParseErrors:1,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function FC(){Vt.immutableTypes=!1,Vt.maxErrors=8,Vt.maxParseErrors=1,Vt.maxInstantiationCount=128,Vt.useAcceleration=!0,Vt.exactOptionalPropertyTypes=!1,Vt.enumerableKind=!1,Vt.correctiveParse=!1,Vt.unionPrioritySort=!0}function LC(e){for(let t of s.Keys(e)){let r=e[t];r!==void 0&&Object.defineProperty(Vt,t,{value:r})}}function Qi(){return Vt}function Xi(e){return s.HasPropertyKey(e,"~refine")&&s.IsArray(e["~refine"])&&s.Every(e["~refine"],0,t=>s.IsObject(t)&&s.HasPropertyKey(t,"check")&&s.HasPropertyKey(t,"error")&&s.IsFunction(t.check)&&s.IsFunction(t.error))}function gt(e){return s.IsObject(e)&&!s.IsArray(e)}function ln(e){return s.IsBoolean(e)}function L(e){return gt(e)||ln(e)}function Zi(e){return s.HasPropertyKey(e,"additionalItems")&&L(e.additionalItems)}function _t(e){return s.HasPropertyKey(e,"additionalProperties")&&L(e.additionalProperties)}function es(e){return s.HasPropertyKey(e,"allOf")&&s.IsArray(e.allOf)&&e.allOf.every(t=>L(t))}function kf(e){return s.HasPropertyKey(e,"$anchor")&&s.IsString(e.$anchor)}function ts(e){return s.HasPropertyKey(e,"anyOf")&&s.IsArray(e.anyOf)&&e.anyOf.every(t=>L(t))}function Hm(e){return s.HasPropertyKey(e,"const")}function Gr(e){return s.HasPropertyKey(e,"contains")&&L(e.contains)}function bt(e){return s.HasPropertyKey(e,"default")}function zm(e){return s.HasPropertyKey(e,"dependencies")&&s.IsObject(e.dependencies)&&Object.values(e.dependencies).every(t=>L(t)||s.IsArray(t)&&t.every(r=>s.IsString(r)))}function Wm(e){return s.HasPropertyKey(e,"dependentRequired")&&s.IsObject(e.dependentRequired)&&Object.values(e.dependentRequired).every(t=>s.IsArray(t)&&t.every(r=>s.IsString(r)))}function rs(e){return s.HasPropertyKey(e,"dependentSchemas")&&s.IsObject(e.dependentSchemas)&&Object.values(e.dependentSchemas).every(t=>L(t))}function Kr(e){return s.HasPropertyKey(e,"$dynamicAnchor")&&s.IsString(e.$dynamicAnchor)}function ns(e){return s.HasPropertyKey(e,"$dynamicRef")&&s.IsString(e.$dynamicRef)}function os(e){return s.HasPropertyKey(e,"else")&&L(e.else)}function Vm(e){return s.HasPropertyKey(e,"enum")&&s.IsArray(e.enum)}function Jm(e){return s.HasPropertyKey(e,"exclusiveMaximum")&&(s.IsNumber(e.exclusiveMaximum)||s.IsBigInt(e.exclusiveMaximum))}function wr(e){return s.HasPropertyKey(e,"exclusiveMinimum")&&(s.IsNumber(e.exclusiveMinimum)||s.IsBigInt(e.exclusiveMinimum))}function Do(e){return s.HasPropertyKey(e,"format")&&s.IsString(e.format)}function ut(e){return s.HasPropertyKey(e,"$id")&&s.IsString(e.$id)}function is(e){return s.HasPropertyKey(e,"if")&&L(e.if)}function gn(e){return s.HasPropertyKey(e,"items")&&(L(e.items)||s.IsArray(e.items)&&e.items.every(t=>L(t)))}function ss(e){return gn(e)&&s.IsArray(e.items)}function Ym(e){return s.HasPropertyKey(e,"maximum")&&(s.IsNumber(e.maximum)||s.IsBigInt(e.maximum))}function Qm(e){return s.HasPropertyKey(e,"maxContains")&&s.IsNumber(e.maxContains)}function No(e){return s.HasPropertyKey(e,"maxItems")&&s.IsNumber(e.maxItems)}function Xm(e){return s.HasPropertyKey(e,"maxLength")&&s.IsNumber(e.maxLength)}function Zm(e){return s.HasPropertyKey(e,"maxProperties")&&s.IsNumber(e.maxProperties)}function Cr(e){return s.HasPropertyKey(e,"minimum")&&(s.IsNumber(e.minimum)||s.IsBigInt(e.minimum))}function yn(e){return s.HasPropertyKey(e,"minContains")&&s.IsNumber(e.minContains)}function xn(e){return s.HasPropertyKey(e,"minItems")&&s.IsNumber(e.minItems)}function qo(e){return s.HasPropertyKey(e,"minLength")&&s.IsNumber(e.minLength)}function Uo(e){return s.HasPropertyKey(e,"minProperties")&&s.IsNumber(e.minProperties)}function eu(e){return s.HasPropertyKey(e,"multipleOf")&&(s.IsNumber(e.multipleOf)||s.IsBigInt(e.multipleOf))}function as(e){return s.HasPropertyKey(e,"not")&&L(e.not)}function ms(e){return s.HasPropertyKey(e,"oneOf")&&s.IsArray(e.oneOf)&&e.oneOf.every(t=>L(t))}function _o(e){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)}function Un(e){return s.HasPropertyKey(e,"patternProperties")&&s.IsObject(e.patternProperties)&&Object.values(e.patternProperties).every(t=>L(t))}function hn(e){return s.HasPropertyKey(e,"prefixItems")&&s.IsArray(e.prefixItems)&&e.prefixItems.every(t=>L(t))}function _n(e){return s.HasPropertyKey(e,"properties")&&s.IsObject(e.properties)&&Object.values(e.properties).every(t=>L(t))}function us(e){return s.HasPropertyKey(e,"propertyNames")&&(s.IsObject(e.propertyNames)||L(e.propertyNames))}function jC(e){return s.HasPropertyKey(e,"$recursiveAnchor")&&s.IsBoolean(e.$recursiveAnchor)}function Bo(e){return jC(e)&&s.IsEqual(e.$recursiveAnchor,!0)}function cs(e){return s.HasPropertyKey(e,"$recursiveRef")&&s.IsString(e.$recursiveRef)}function ps(e){return s.HasPropertyKey(e,"$ref")&&s.IsString(e.$ref)}function In(e){return s.HasPropertyKey(e,"required")&&s.IsArray(e.required)&&e.required.every(t=>s.IsString(t))}function fs(e){return s.HasPropertyKey(e,"then")&&L(e.then)}function tu(e){return s.HasPropertyKey(e,"type")&&(s.IsString(e.type)||s.IsArray(e.type)&&e.type.every(t=>s.IsString(t)))}function Hr(e){return s.HasPropertyKey(e,"uniqueItems")&&s.IsBoolean(e.uniqueItems)}function Go(e){return s.HasPropertyKey(e,"unevaluatedItems")&&L(e.unevaluatedItems)}function Ko(e){return s.HasPropertyKey(e,"unevaluatedProperties")&&L(e.unevaluatedProperties)}var ct=class{constructor(){let t=new Set,r=new Set;this.stack=[{indices:t,keys:r}]}Push(){let t=new Set,r=new Set;return this.stack.push({indices:t,keys:r}),!0}Pop(){return this.stack.pop(),!0}AddIndex(t){return this.GetIndices().add(t),!0}AddKey(t){return this.GetKeys().add(t),!0}GetIndices(){return this.stack[this.stack.length-1].indices}GetKeys(){return this.stack[this.stack.length-1].keys}Merge(t){for(let r of t)r.GetIndices().forEach(n=>this.GetIndices().add(n)),r.GetKeys().forEach(n=>this.GetKeys().add(n));return!0}},et=class extends ct{constructor(){super(),this.errors=[]}AtCapacity(){return this.errors.length>=Me.Get().maxErrors}AddError(t,r,n,o){return this.AddErrorObject({keyword:t,schemaPath:r,instancePath:n,params:o})}AddErrors(t){return t.forEach(r=>this.AddErrorObject(r)),!1}GetErrors(){return this.errors}AddErrorObject(t){return this.AtCapacity()||this.errors.push(t),!1}};function Tf(e,t,r,n){return s.Every(r["~refine"],0,(o,i)=>o.check(n))}function wf(e,t,r,n,o,i){return s.EveryAll(o["~refine"],0,(a,m)=>a.check(i)||t.AddError("~refine",r,n,{index:m,message:a.error(i)}))}var Ho="urn:typebox:root";function Rr(e,t){return URL.canParse(e,t)?new URL(e,t):s.IsEqual(t,Ho)?new URL(`${t}:${e}`):new URL(`${t.slice(0,t.lastIndexOf(":"))}:${e}`)}function Gn(e,t){let r=gt(t)&&ut(t)?Rr(t.$id,Ho).href:Ho;return{context:e,schema:t,lexicalSchema:t,lexicalBase:r,resourceBase:r,referenceBase:r,ids:[],useResourceBaseForReference:!0,recursiveAnchor:void 0,dynamicAnchors:[],resourceEntries:new Map,pendingResource:!0,enteredResource:!1}}function ru(e,t,r=!0){if(ln(t))return e;if(Array.isArray(t))return t.reduce((o,i)=>ru(o,i,!1),e);if(!gt(t)||!r&&ut(t))return e;let n=!r&&Kr(t)?[...e,t]:e;return Object.keys(t).reduce((o,i)=>ru(o,t[i],!1),n)}function zo(e,t){return e.resourceEntries.get(t)}function Cf(e,t){return e.enteredResource||zo(e,t)!==void 0}function DC(e){return!/^[A-Za-z][A-Za-z0-9+.-]*:/.test(e.$id)}function NC(e,t){return ut(t)?[...e.ids,t]:e.ids}function qC(e,t){return e.recursiveAnchor??(Bo(t)?t:void 0)}function UC(e,t){let r=ut(t)?ru(e.dynamicAnchors,t):e.dynamicAnchors;return Kr(t)?[...r,t]:r}function _C(e,t){return ut(t)?!1:e.pendingResource}function Rf(e,t){let r=zo(e,t);return r?r.base:ut(t)?Rr(t.$id,e.lexicalBase).href:e.lexicalBase}function Pf(e,t){let r=zo(e,t);return r?r.base:ut(t)&&e.pendingResource?Rr(t.$id,e.resourceBase).href:e.resourceBase}function Af(e,t){return ut(t)?!DC(t):e.useResourceBaseForReference}function BC(e,t){let r=Cf(e,t),n=Af(e,t);return r||n?Pf(e,t):Rf(e,t)}function GC(e,t){let r=zo(e,t);return r?r.root:ut(t)?t:e.lexicalSchema}function KC(e,t){return gt(t)&&(ut(t)||Kr(t)||s.IsUndefined(e.recursiveAnchor)&&Bo(t)||!s.IsUndefined(zo(e,t)))}function Kn(e,t){return KC(e,t)?{...e,ids:NC(e,t),dynamicAnchors:UC(e,t),recursiveAnchor:qC(e,t),pendingResource:_C(e,t),lexicalBase:Rf(e,t),resourceBase:Pf(e,t),useResourceBaseForReference:Af(e,t),referenceBase:BC(e,t),lexicalSchema:GC(e,t),enteredResource:Cf(e,t)}:e}function Of(e){return gn(e)&&s.IsArray(e.items)}function Mf(e,t,r,n){return Of(r)?s.Every(n,0,(i,a)=>s.IsLessThan(a,r.items.length)||Ot(e,t,r.additionalItems,i)&&t.AddIndex(a)):!0}function vf(e,t,r,n,o,i){return Of(o)?s.Every(i,0,(m,c)=>{let p=`${r}/additionalItems`,f=`${n}/${c}`;return s.IsLessThan(c,o.items.length)||Mt(e,t,p,f,o.additionalItems,m)&&t.AddIndex(c)}):!0}function $t(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function zr(e){return new RegExp(e,"u")}function HC(e){return`^${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`}function Ff(e){let t=[];return Un(e)&&t.push(...s.Keys(e.patternProperties)),_n(e)&&t.push(...s.Keys(e.properties).map(HC)),s.IsEqual(t.length,0)?"(?!)":`(${t.join("|")})`}function Lf(e,t,r,n){let o=zr(Ff(r));return s.Every(s.Keys(n),0,(a,m)=>o.test(a)||Ot(e,t,r.additionalProperties,n[a])&&t.AddKey(a))}function jf(e,t,r,n,o,i){let a=zr(Ff(o)),m=[];return s.EveryAll(s.Keys(i),0,(p,f)=>{let d=`${r}/additionalProperties`,g=`${n}/${$t(p)}`,y=a.test(p)||Mt(e,t,d,g,o.additionalProperties,i[p])&&t.AddKey(p);return y||m.push(p),y})||t.AddError("additionalProperties",r,n,{additionalProperties:m})}function Df(e,t,r,n){let o=r.allOf.reduce((i,a)=>{let m=new ct;return Q(e,m,a,n)?[...i,m]:i},[]);return s.IsEqual(o.length,r.allOf.length)&&t.Merge(o)}function Nf(e,t,r,n,o,i){let a=[],m=o.allOf.reduce((p,f,d)=>{let g=`${r}/allOf/${d}`,y=new et,I=ce(e,y,g,n,f,i);return I||a.push(y),I?[...p,y]:p},[]),c=s.IsEqual(m.length,o.allOf.length)&&t.Merge(m);return c||a.forEach(p=>t.AddErrors(p.GetErrors())),c}function qf(e,t,r,n){let o=r.anyOf.reduce((i,a)=>{let m=new ct;return Q(e,m,a,n)?[...i,m]:i},[]);return s.IsGreaterThan(o.length,0)&&t.Merge(o)}function Uf(e,t,r,n,o,i){let a=[],m=o.anyOf.reduce((p,f,d)=>{let g=new et,y=`${r}/anyOf/${d}`,I=ce(e,g,y,n,f,i);return I||a.push(g),I?[...p,g]:p},[]),c=s.IsGreaterThan(m.length,0)&&t.Merge(m);return c||a.forEach(p=>t.AddErrors(p.GetErrors())),c||t.AddError("anyOf",r,n,{})}function iu(e,t,r,n){return r}function _f(e,t,r,n,o,i){return iu(e,t,o,i)||t.AddError("boolean",r,n,{})}function su(e,t,r,n){return s.IsValueLike(r.const)?s.IsEqual(n,r.const):s.IsDeepEqual(n,r.const)}function Bf(e,t,r,n,o,i){return su(e,t,o,i)||t.AddError("const",r,n,{allowedValue:o.const})}function zC(e){return!(yn(e)&&s.IsEqual(e.minContains,0))}function au(e,t,r,n){return zC(r)?!s.IsEqual(n.length,0)&&s.SomeAll(n,(o,i)=>Q(e,t,r.contains,o)&&t.AddIndex(i)):!0}function Gf(e,t,r,n,o,i){return au(e,t,o,i)||t.AddError("contains",r,n,{minContains:1})}function Kf(e,t,r,n){let o=s.IsEqual(s.Keys(n).length,0),i=s.Every(s.Entries(r.dependencies),0,([a,m])=>!s.HasPropertyKey(n,a)||(s.IsArray(m)?m.every(c=>s.HasPropertyKey(n,c)):Q(e,t,m,n)));return o||i}function Hf(e,t,r,n,o,i){let a=s.IsEqual(s.Keys(i).length,0),m=s.EveryAll(s.Entries(o.dependencies),0,([c,p])=>{let f=`${r}/dependencies/${$t(c)}`;return!s.HasPropertyKey(i,c)||(s.IsArray(p)?p.every(d=>s.HasPropertyKey(i,d)||t.AddError("dependencies",r,n,{property:c,dependencies:p})):ce(e,t,f,n,p,i))});return a||m}function zf(e,t,r,n){let o=s.IsEqual(s.Keys(n).length,0),i=s.Every(s.Entries(r.dependentRequired),0,([a,m])=>!s.HasPropertyKey(n,a)||m.every(c=>s.HasPropertyKey(n,c)));return o||i}function Wf(e,t,r,n,o,i){let a=s.IsEqual(s.Keys(i).length,0),m=s.EveryAll(s.Entries(o.dependentRequired),0,([c,p])=>!s.HasPropertyKey(i,c)||s.EveryAll(p,0,f=>s.HasPropertyKey(i,f)||t.AddError("dependentRequired",r,n,{property:c,dependencies:p})));return a||m}function Vf(e,t,r,n){let o=s.IsEqual(s.Keys(n).length,0),i=s.Every(s.Entries(r.dependentSchemas),0,([a,m])=>!s.HasPropertyKey(n,a)||Q(e,t,m,n));return o||i}function Jf(e,t,r,n,o,i){let a=s.IsEqual(s.Keys(i).length,0),m=s.EveryAll(s.Entries(o.dependentSchemas),0,([c,p])=>{let f=`${r}/dependentSchemas/${$t(c)}`;return!s.HasPropertyKey(i,c)||ce(e,t,f,n,p,i)});return a||m}var Bt={};At(Bt,{DynamicRef:()=>SR,RecursiveRef:()=>bR,Ref:()=>hR});var mr={};At(mr,{Delete:()=>YC,Get:()=>VC,Has:()=>WC,Indices:()=>Vo,Set:()=>JC});function Qf(e){throw Error(e)}function Yf(){Qf("Pointer contains unsafe property key")}function mu(){Qf("Cannot set value")}function Vo(e){let t=e.split("/").map(r=>r.replace(/~1/g,"/").replace(/~0/g,"~"));return t[0]===""?t.slice(1):t}function WC(e,t){let r=e;for(let n of Vo(t)){if(!s.IsObject(r)||!s.HasPropertyKey(r,n))return!1;r=r[n]}return!0}function VC(e,t){let r=e;for(let n of Vo(t)){if(!s.IsObject(r)||s.IsUnsafePropertyKey(n))return;r=r[n]}return r}function Xf(e,t,r){let n=e;for(let o of t)s.IsUnsafePropertyKey(o)&&Yf(),n=s.IsObject(n)?n[o]:void 0;return s.IsUnsafePropertyKey(r)&&Yf(),s.IsObject(n)||mu(),n}function JC(e,t,r){let n=Vo(t),o=n.pop();return s.IsUndefined(o)&&mu(),Xf(e,n,o)[o]=r,e}function YC(e,t){let r=Vo(t),n=r.pop();s.IsUndefined(n)&&mu();let o=Xf(e,r,n);return s.IsArray(o)&&/^(0|[1-9]\d*)$/.test(n)?o.splice(Number(n),1):delete o[n],e}function pu(e,t){return gt(e)&&ut(e)?Rr(e.$id,t.href):t}function fu(e){return Rr(e,Ho)}function uu(e){return e.href.split("#")[0]}function QC(e,t,r){return cu(e,fu(t),r)}function XC(e,t){return t.$ref.startsWith("#")||e.enteredResource?e.lexicalSchema:e.schema}function ZC(e){return e.startsWith("#/")}function Zf(e,t){if(s.IsObject(e)&&Kr(e)&&s.IsEqual(e.$dynamicAnchor,t))return e;if(s.IsObject(e))for(let r of s.Keys(e)){let n=Zf(e[r],t);if(n)return n}}function cu(e,t,r){if(s.IsEqual(e,r))return t.href;let n=pu(e,t);if(s.IsArray(e))for(let o of e){let i=cu(o,n,r);if(!s.IsUndefined(i))return i}else if(s.IsObject(e))for(let o of s.Keys(e)){let i=cu(e[o],n,r);if(!s.IsUndefined(i))return i}}function ed(e,t){if(t.href.endsWith("#"))return e;if(!t.hash.startsWith("#"))return;let r=decodeURIComponent(t.hash.slice(1));if(r.startsWith("/"))return mr.Get(e,r)}function eR(e,t,r){if(!ut(e))return;if(s.IsEqual(e.$id,r.hash))return e;let n=new URL(r.href,t.href);if(s.IsEqual(t.pathname,n.pathname))return r.hash.startsWith("#")?ed(e,r):e}function tR(e,t,r){if(!kf(e))return;let n=new URL(`#${e.$anchor}`,t.href),o=new URL(r.href,t.href);return s.IsEqual(n.href,o.href)?e:void 0}function rR(e,t,r){if(!Kr(e))return;let n=new URL(`#${e.$dynamicAnchor}`,t.href),o=new URL(r.href,t.href);return s.IsEqual(n.href,o.href)?e:void 0}function nR(e,t,r){if(gt(e))return eR(e,t,r)??tR(e,t,r)??rR(e,t,r)??ed(e,r)}function oR(e,t,r){if(s.IsArray(e))return e.reduce((n,o)=>{let i=ds(o,t,r);return s.IsUndefined(i)?n:i},void 0)}function iR(e,t,r){if(s.IsObject(e))return s.Keys(e).reduce((n,o)=>{if(s.IsEqual(o,"const")||s.IsEqual(o,"enum"))return n;let i=ds(e[o],t,r);return s.IsUndefined(i)?n:i},void 0)}function ds(e,t,r){let n=pu(e,t);return nR(e,n,r)??oR(e,n,r)??iR(e,n,r)}function sR(e,t,r,n){let o=ls(e,t,r,n);return gt(o)&&ut(o)?o:void 0}function aR(e,t,r){if(!t.$ref.startsWith("#")||!gt(e.schema)||s.HasPropertyKey(e.schema,"$schema"))return;let n=QC(e.lexicalSchema,e.referenceBase,r);if(!(s.IsUndefined(n)||s.IsEqual(n,e.referenceBase)))return{target:r,base:n,root:e.lexicalSchema}}function mR(e,t,r){let n=e.context[t];if(gt(n))return{target:r,base:t,root:n}}function uR(e,t,r,n,o){let i=o?mR(e,n,r):void 0;return s.IsUndefined(i)?aR(e,t,r):i}function cR(e,t,r){if(ut(r))return;let n=sR(e.context,e.schema,e.referenceBase,t);if(!(!n||e.ids.includes(n)))return{resource:n}}function pR(e,t){return s.HasPropertyKey(e,t)?e[t]:void 0}function fR(e,t,r){return ds(e,t,r)}function dR(e,t,r){let n=uu(r);if(!s.HasPropertyKey(e,n)||s.IsEqual(n,uu(t)))return;let o=e[n],i=pu(o,new URL(n));return s.IsEqual(r.hash,"")?o:ds(o,i,r)}function ls(e,t,r,n){let o=fu(r),i=Rr(n,o.href);return pR(e,n)??fR(t,o,i)??dR(e,o,i)}function lR(e,t){if(!t)return e;let r=new Map(e.resourceEntries);return r.set(t.target,{base:t.base,root:t.root}),{...e,resourceEntries:r}}function gR(e,t){return t?Kn(e,t.resource):e}function td(e,t,r,n){let o=lR({...e,pendingResource:t},r);return gR(o,n)}function yR(e,t,r){let n=uu(Rr(t.$ref,e.referenceBase)),o=!s.IsEqual(n,e.resourceBase),i=uR(e,t,r,n,o),a=o?cR(e,n,r):void 0;return{schema:r,stack:td(e,!0,i,a)}}function xR(e,t){return{schema:t,stack:td(e,!s.IsUndefined(t))}}function hR(e,t){let r=ls(e.context,XC(e,t),e.referenceBase,t.$ref);return gt(r)?yR(e,t,r):xR(e,r)}function IR(e){return gt(e.lexicalSchema)&&Bo(e.lexicalSchema)}function bR(e,t){let r=IR(e)?e.recursiveAnchor:e.lexicalSchema;return ls(e.context,r,e.lexicalBase,t.$recursiveRef)}function rd(e,t){return Rr(t.$dynamicRef,fu(e.lexicalBase).href).hash}function nd(e,t){return e.dynamicAnchors.find(r=>s.IsEqual(r.$dynamicAnchor,t))??Zf(e.schema,t)}function $R(e,t,r){if(!gt(r)||!Kr(r))return r;let n=rd(e,t);return ZC(n)?r:nd(e,r.$dynamicAnchor)}function ER(e,t){let r=rd(e,t);return nd(e,decodeURIComponent(r.slice(1)))}function SR(e,t){let r=t.$dynamicRef.startsWith("#")?e.lexicalSchema:e.schema,n=ls(e.context,r,e.lexicalBase,t.$dynamicRef);return s.IsUndefined(n)?ER(e,t):$R(e,t,n)}function od(e,t,r,n){let o=Bt.DynamicRef(e,r)??!1,i=o?{...e,pendingResource:!0}:e;return L(o)&&Q(i,t,o,n)}function id(e,t,r,n,o,i){let a=Bt.DynamicRef(e,o)??!1,m=a?{...e,pendingResource:!0}:e;return L(a)&&ce(m,t,r,n,a,i)}function gu(e,t,r,n){return s.Some(r.enum,o=>s.IsValueLike(o)?s.IsEqual(n,o):s.IsDeepEqual(n,o))}function sd(e,t,r,n,o,i){return gu(e,t,o,i)||t.AddError("enum",r,n,{allowedValues:o.enum})}function yu(e,t,r,n){return s.IsLessThan(n,r.exclusiveMaximum)}function ad(e,t,r,n,o,i){return yu(e,t,o,i)||t.AddError("exclusiveMaximum",r,n,{comparison:"<",limit:o.exclusiveMaximum})}function xu(e,t,r,n){return s.IsGreaterThan(n,r.exclusiveMinimum)}function md(e,t,r,n,o,i){return xu(e,t,o,i)||t.AddError("exclusiveMinimum",r,n,{comparison:">",limit:o.exclusiveMinimum})}var Xo={};At(Xo,{Clear:()=>Ld,Entries:()=>f0,Get:()=>g0,Has:()=>l0,IsDate:()=>zn,IsDateTime:()=>gs,IsDuration:()=>ys,IsEmail:()=>xs,IsHostname:()=>Ts,IsIPv4:()=>Rs,IsIPv6:()=>Ps,IsIdnEmail:()=>ws,IsIdnHostname:()=>Cs,IsIri:()=>Os,IsIriReference:()=>As,IsJsonPointer:()=>vs,IsJsonPointerUriFragment:()=>Ms,IsRegex:()=>Fs,IsRelativeJsonPointer:()=>Ls,IsTime:()=>Wn,IsUri:()=>Ns,IsUriReference:()=>js,IsUriTemplate:()=>Ds,IsUrl:()=>qs,IsUuid:()=>Us,Reset:()=>jd,Set:()=>d0,Test:()=>y0});var kR=[0,31,28,31,30,31,30,31,31,30,31,30,31],TR=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;function wR(e){return e%4===0&&(e%100!==0||e%400===0)}function zn(e){let t=TR.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&wR(r)?29:kR[n])}var CR=/^(\d\d):(\d\d):(\d\d)(?:\.\d+)?(?:([Zz])|([+-])(\d\d):(\d\d))?$/;function Wn(e,t=!0){let r=CR.exec(e);if(!r||t&&!r[4]&&!r[5])return!1;let n=+r[1],o=+r[2],i=+r[3];if(n>23||o>59||i>60)return!1;if(r[5]){let f=+r[6],d=+r[7];if(f>23||d>59)return!1}if(i<60)return!0;let a=r[5]==="-"?-1:1,m=+(r[6]||0),c=+(r[7]||0);return((n*60+o-a*(m*60+c))%1440+1440)%1440===1439}var RR=/^(?:\[!?(?:(?!\.{1,2}[/\]])[A-Za-z._][A-Za-z._0-9+-]{0,13}(?:\/(?!\.{1,2}[/\]])[A-Za-z._][A-Za-z._0-9+-]{0,13})*|[+-](?:[01][0-9]|2[0-3]):[0-5][0-9])\](?:\[!?[a-z_][a-z_0-9-]*=[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*\])*|(?:\[!?[a-z_][a-z_0-9-]*=[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*\])*)$/;function gs(e){let t=e.indexOf("["),r=t===-1?e:e.slice(0,t);if(t!==-1&&!RR.test(e.slice(t)))return!1;let n=r.split(/T/i);return n.length===2&&zn(n[0])&&Wn(n[1])}var PR=/^P((\d+Y(\d+M(\d+D)?)?|\d+M(\d+D)?|\d+D)(T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S))?|T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S)|\d+W)$/;function ys(e){return PR.test(e)}var AR=/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[^"\\]|\\[\x20-\x7e])*")@(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*|\[(?:IPv6:[a-f0-9:]+|(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?:\.(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3})\])$/i;function xs(e){return AR.test(e)}var ud=/^(?!-).*(?<!-)$/,cd=/^(?!..--)/,pd=/^[a-zA-Z0-9-]*$/,uG=new RegExp("^\\p{ASCII}*$","u"),Vn=/[^\p{ASCII}]/u;var OR=/[0-9]/,fd=/[\u{0660}-\u{0669}]/u,MR=/[\u{06f0}-\u{06f9}]/u,vR=/[\u{002e}\u{002c}\u{003a}\u{002f}]/u,FR=/[\u{002d}\u{002b}]/u,hu=new RegExp("\\p{Mn}","u"),LR=new RegExp("\\p{Mc}","u"),cG=new RegExp("\\p{Me}","u"),dd=/[\p{Mn}\p{Mc}\p{Me}]/u,Iu=new RegExp("\\p{L}","u"),jR=new RegExp("\\p{Nd}","u"),ld=new RegExp("\\p{Script=Greek}","u"),hs=new RegExp("\\p{Script=Hebrew}","u"),gd=/[\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Han}]/u,yd=/[\p{Script=Arabic}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Mandaic}]/u,bu=/[\u{094d}\u{09cd}\u{0a4d}\u{0acd}\u{0b4d}\u{0bcd}\u{0c4d}\u{0ccd}\u{0d3b}\u{0d3c}\u{0d4d}\u{0dca}\u{1b44}\u{1baa}\u{1bab}\u{a9c0}\u{11046}\u{1107f}\u{110b9}\u{11133}\u{11134}\u{111c0}\u{11235}\u{1134d}\u{11442}\u{114c2}\u{115bf}\u{1163f}\u{116b6}\u{11c3f}\u{11d44}\u{11d45}]/u,xd=/[\u{0640}\u{07fa}\u{302e}\u{302f}\u{3031}\u{3032}\u{3033}\u{3034}\u{3035}\u{303b}]/u,DR=/[\u{00b7}\u{0375}\u{05f3}\u{05f4}\u{200c}\u{200d}\u{30fb}]/u,NR=/[\u{00df}\u{03c2}\u{06fd}\u{06fe}\u{0f0b}\u{3007}]/u,hd=new RegExp([OR,MR].map(e=>e.source).join("|"),"u"),Id=new RegExp([Iu,FR,vR,jR,hu,LR,DR,NR].map(e=>e.source).join("|"),"u");function bd(e){return ud.test(e)&&cd.test(e)&&pd.test(e)}var Yt=36,Yo=1,Qo=26,UR=38,_R=700,Ed=72,Sd=128;function $u(){throw null}function Is(e){return e.toLowerCase().startsWith("xn--")}function kd(e,t,r){e=r?Math.floor(e/_R):e>>1,e+=Math.floor(e/t);let n=0;for(;e>(Yt-Yo)*Qo>>1;)e=Math.floor(e/(Yt-Yo)),n+=Yt;return n+Math.floor((Yt-Yo+1)*e/(e+UR))}function bs(e){let t=[],r=Sd,n=0,o=Ed,i=e.lastIndexOf("-");if(i>0)for(let m=0;m<i;m++){let c=e.charCodeAt(m);c>=128&&$u(),t.push(c)}let a=i<0?0:i+1;for(;a<e.length;){let m=n,c=1,p=Yt;for(;;){a>=e.length&&$u();let d=e.charCodeAt(a++),g;d>=97&&d<=122?g=d-97:d>=48&&d<=57?g=d-48+26:$u(),n+=g*c;let y=p<=o?Yo:p>=o+Qo?Qo:p-o;if(g<y)break;c*=Yt-y,p+=Yt}let f=t.length+1;o=kd(n-m,f,m===0),r+=Math.floor(n/f),n%=f,t.splice(n,0,r),n++}return String.fromCodePoint(...t)}function $d(e){return e<26?String.fromCharCode(e+97):String.fromCharCode(e-26+48)}var BR=new RegExp(Vn.source,"gu");function Td(e){let t=e.replace(BR,""),r=t.length,n=r>0?[t,"-"]:[],o=Array.from(e,p=>p.codePointAt(0)),i=Sd,a=0,m=Ed,c=r;for(;c<o.length;){let p=1/0;for(let f of o)f>=i&&f<p&&(p=f);a+=(p-i)*(c+1),i=p;for(let f of o)if(f<i&&a++,f===i){let d=a;for(let g=Yt;;g+=Yt){let y=g<=m?Yo:g>=m+Qo?Qo:g-m;if(d<y)break;let I=y+(d-y)%(Yt-y);n.push($d(I)),d=Math.floor((d-y)/(Yt-y))}n.push($d(d)),m=kd(a,c+1,c===r),a=0,c++}a++,i++}return n.join("")}var GR=/^(?:R|AL|AN|EN|ES|CS|ET|ON|BN|NSM)$/,wd=/^(?:L|EN|ES|CS|ET|ON|BN|NSM)$/,KR=/^(?:R|AL|AN)$/;function Cd(e){if(Is(e))try{return $s(bs(e.slice(4).toLowerCase()))}catch{return!1}return $s(e)}function Rd(e){let t=String.fromCodePoint(e);return hd.test(t)?"EN":fd.test(t)?"AN":hu.test(t)?"NSM":hs.test(t)?"R":yd.test(t)?"AL":Iu.test(t)?"L":"ON"}function $s(e){for(let t of e)if(KR.test(Rd(t.codePointAt(0))))return!0;return!1}function Es(e){let t=!1,r=wd,n=!1,o=!1,i=!0;for(let a of e){let m=Rd(a.codePointAt(0));if(i){if(m!=="L"&&m!=="R"&&m!=="AL")return!1;t=m==="R"||m==="AL",r=t?GR:wd,i=!1}if(!r.test(m))return!1;m==="EN"?n=!0:m==="AN"&&(o=!0)}return!(t&&n&&o)}function HR(e){return Vn.test(e)&&Td(e).length+4>63}function zR(e){return e[0]==="-"||e[e.length-1]==="-"?!0:e.slice(2).join("").startsWith("--")}function Ss(e){if(HR(e)||$s(e)&&!Es(e))return!1;let t=[...e],r=t.map(i=>i.codePointAt(0)),n=r.length;if(zR(t)||dd.test(t[0]))return!1;let o=!1;for(let i=0;i<n;i++){let a=r[i],m=t[i];if(xd.test(m)||!Id.test(m))return!1;gd.test(m)&&(o=!0);let c=r[i-1],p=r[i+1];switch(a){case 183:if(c!==108||p!==108)return!1;break;case 885:if(!p||!ld.test(t[i+1]))return!1;break;case 1523:case 1524:if(!c||!hs.test(t[i-1]))return!1;break;case 8204:if(!c||c<128&&!bu.test(t[i-1]))return!1;break;case 8205:if(!c||!bu.test(t[i-1]))return!1;break;case 12539:break}}return!(e.includes("\u30FB")&&!o)}function ks(e){if(!Is(e))return!1;try{let t=e.slice(4).toLowerCase();if(t.lastIndexOf("-")===0)return!1;let r=bs(t);return Vn.test(r)?Ss(r):!1}catch{return!1}}function WR(e){return e.length>0&&e.length<=63}function VR(e){return WR(e)&&(ks(e)||bd(e))}function Md(e){return e.length===0||e.length>253||e.charCodeAt(e.length-1)===46?!1:e.split(".").every(t=>VR(t))}function JR(e){return e.length>0&&e.length<=63}function YR(e){return JR(e)&&(ks(e)||Ss(e))}function QR(e){return e.replace(/[\uff01-\uff5e]/g,t=>String.fromCharCode(t.charCodeAt(0)-65248)).normalize("NFC").replace(/[\u00ad\u034f\u180b-\u180d\u200b\ufe00-\ufe0f\u{e0100}-\u{e01ef}]/gu,"").replace(/[\u002E\u3002\uFF0E\uFF61]/g,".")}function vd(e){if(e.length===0||e.includes(" "))return!1;let t=QR(e);if(t.length>253)return!1;let r=t.split("."),n=r.some(o=>Cd(o));return r.every(o=>YR(o)&&(!n||Es(o)))}function Ts(e){return Md(e)}var XR=/^(?:[A-Za-z0-9!#$%&'*+\/=?^_`{|}~\u{0080}-\u{10FFFF}-]+(?:\.[A-Za-z0-9!#$%&'*+\/=?^_`{|}~\u{0080}-\u{10FFFF}-]+)*|"(?:[^"\\]|\\.)*")@[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,62})(?<!-)(?:\.[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,62})(?<!-))*$/iu;function ws(e){return XR.test(e.normalize("NFC"))}function Cs(e){return vd(e)}var ZR=/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/;function Rs(e){return ZR.test(e)}var e0=/^(?:(?:(?:[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-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|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\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})?::)$/i;function Ps(e){return e0.test(e)}var t0=/[\x00-\x20\x7F\\]|%(?![0-9a-fA-F]{2})/,r0=/^[a-zA-Z][a-zA-Z0-9+\-.]*\/\//;function As(e){return!t0.test(e)&&!r0.test(e)&&URL.canParse(e,"http://example.com")}var n0=/[\x00-\x20<>\^`{|}\\]/,o0=/%(?![0-9a-fA-F]{2})/;function Os(e){return n0.test(e)||o0.test(e)?!1:URL.canParse(e)}var i0=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;function Ms(e){return i0.test(e)}var s0=/^(?:\/(?:[^~/]|~0|~1)*)*$/;function vs(e){return s0.test(e)}function Fs(e){try{return new RegExp(e,"u"),!0}catch{return!1}}var a0=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function Ls(e){return a0.test(e)}var m0=/^(?:[a-z][a-z0-9+\-.]*:(?:\/\/(?:(?:[-a-z0-9._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:[\da-f]{1,4}:){6}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|::(?:[\da-f]{1,4}:){5}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:[\da-f]{1,4})?::(?:[\da-f]{1,4}:){4}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,1}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){3}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,2}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){2}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,3}[\da-f]{1,4})?::[\da-f]{1,4}:(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,4}[\da-f]{1,4})?::(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,5}[\da-f]{1,4})?::[\da-f]{1,4}|(?:(?:[\da-f]{1,4}:){0,6}[\da-f]{1,4})?::)|v[0-9a-f]+\.[-a-z0-9._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\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})*@)?(?:\[(?:(?:(?:[\da-f]{1,4}:){6}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|::(?:[\da-f]{1,4}:){5}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:[\da-f]{1,4})?::(?:[\da-f]{1,4}:){4}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,1}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){3}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,2}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){2}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,3}[\da-f]{1,4})?::[\da-f]{1,4}:(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,4}[\da-f]{1,4})?::(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,5}[\da-f]{1,4})?::[\da-f]{1,4}|(?:(?:[\da-f]{1,4}:){0,6}[\da-f]{1,4})?::)|v[0-9a-f]+\.[-a-z0-9._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\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;function js(e){return m0.test(e)}var u0=/^(?:(?:[^\x00-\x20"<>%\\^`{|}\x7f]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?:\.(?:[a-z0-9_]|%[0-9a-f]{2})+)*(?::[1-9]\d{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?:\.(?:[a-z0-9_]|%[0-9a-f]{2})+)*(?::[1-9]\d{0,3}|\*)?)*\})*$/i;function Ds(e){return u0.test(e)}var c0=/^[a-z][a-z0-9+\-.]*:(?:\/\/(?:(?:[-a-z0-9._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:[\da-f]{1,4}:){6}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|::(?:[\da-f]{1,4}:){5}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:[\da-f]{1,4})?::(?:[\da-f]{1,4}:){4}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,1}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){3}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,2}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){2}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,3}[\da-f]{1,4})?::[\da-f]{1,4}:(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,4}[\da-f]{1,4})?::(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,5}[\da-f]{1,4})?::[\da-f]{1,4}|(?:(?:[\da-f]{1,4}:){0,6}[\da-f]{1,4})?::)|v[0-9a-f]+\.[-a-z0-9._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\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;function Ns(e){return c0.test(e)}function qs(e){return URL.canParse(e)}var p0=/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function Us(e){return p0.test(e)}var le=new Map;function Ld(){le.clear()}function f0(){return[...le.entries()]}function d0(e,t){le.set(e,t)}function l0(e){return le.has(e)}function g0(e){return le.get(e)}function y0(e,t){return le.get(e)?.(t)??!0}function jd(){Ld(),le.set("date-time",gs),le.set("date",zn),le.set("duration",ys),le.set("email",xs),le.set("hostname",Ts),le.set("idn-email",ws),le.set("idn-hostname",Cs),le.set("ipv4",Rs),le.set("ipv6",Ps),le.set("iri-reference",As),le.set("iri",Os),le.set("json-pointer-uri-fragment",Ms),le.set("json-pointer",vs),le.set("regex",Fs),le.set("relative-json-pointer",Ls),le.set("time",Wn),le.set("uri-reference",js),le.set("uri-template",Ds),le.set("uri",Ns),le.set("url",qs),le.set("uuid",Us)}jd();function Su(e,t,r,n){return Xo.Test(r.format,n)}function Dd(e,t,r,n,o,i){return Su(e,t,o,i)||t.AddError("format",r,n,{format:o.format})}function Nd(e,t,r,n){let o=fs(r)?r.then:!0,i=os(r)?r.else:!0;return Q(e,t,r.if,n)?Q(e,t,o,n):Q(e,t,i,n)}function qd(e,t,r,n,o,i){let a=fs(o)?o.then:!0,m=os(o)?o.else:!0,c=new et,p=ce(e,c,`${r}/if`,n,o.if,i)?ce(e,c,`${r}/then`,n,a,i)||t.AddError("if",r,n,{failingKeyword:"then"}):ce(e,t,`${r}/else`,n,m,i)||t.AddError("if",r,n,{failingKeyword:"else"});return p&&t.Merge([c]),p}function x0(e,t,r,n){return s.Every(r.items,0,(o,i)=>s.IsLessEqualThan(n.length,i)||Ot(e,t,o,n[i])&&t.AddIndex(i))}function h0(e,t,r,n,o,i){return s.EveryAll(o.items,0,(a,m)=>{let c=`${r}/items/${m}`,p=`${n}/${m}`;return s.IsLessEqualThan(i.length,m)||Mt(e,t,c,p,a,i[m])&&t.AddIndex(m)})}function I0(e,t,r,n){let o=hn(r)?r.prefixItems.length:0;return s.Every(n,o,(i,a)=>Ot(e,t,r.items,i)&&t.AddIndex(a))}function b0(e,t,r,n,o,i){let a=hn(o)?o.prefixItems.length:0;return s.EveryAll(i,a,(m,c)=>{let p=`${r}/items`,f=`${n}/${c}`;return Mt(e,t,p,f,o.items,m)&&t.AddIndex(c)})}function Ud(e,t,r,n){return ss(r)?x0(e,t,r,n):I0(e,t,r,n)}function _d(e,t,r,n,o,i){return ss(o)?h0(e,t,r,n,o,i):b0(e,t,r,n,o,i)}function $0(e){return Gr(e)}function ku(e,t,r,n){if(!$0(r))return!0;let o=s.Counted(n,i=>Q(e,t,r.contains,i));return s.IsLessEqualThan(o,r.maxContains)}function Bd(e,t,r,n,o,i){let a=yn(o)?o.minContains:1;return ku(e,t,o,i)||t.AddError("contains",r,n,{minContains:a,maxContains:o.maxContains})}function Tu(e,t,r,n){return s.IsLessEqualThan(n,r.maximum)}function Gd(e,t,r,n,o,i){return Tu(e,t,o,i)||t.AddError("maximum",r,n,{comparison:"<=",limit:o.maximum})}function wu(e,t,r,n){return s.IsLessEqualThan(n.length,r.maxItems)}function Kd(e,t,r,n,o,i){return wu(e,t,o,i)||t.AddError("maxItems",r,n,{limit:o.maxItems})}function Cu(e,t,r,n){return s.IsMaxLength(n,r.maxLength)}function Hd(e,t,r,n,o,i){return Cu(e,t,o,i)||t.AddError("maxLength",r,n,{limit:o.maxLength})}function Ru(e,t,r,n){return s.IsLessEqualThan(s.Keys(n).length,r.maxProperties)}function zd(e,t,r,n,o,i){return Ru(e,t,o,i)||t.AddError("maxProperties",r,n,{limit:o.maxProperties})}function E0(e){return Gr(e)}function Pu(e,t,r,n){if(!E0(r))return!0;let o=s.Counted(n,(i,a)=>Q(e,t,r.contains,i)&&t.AddIndex(a));return s.IsGreaterEqualThan(o,r.minContains)}function Wd(e,t,r,n,o,i){return Pu(e,t,o,i)||t.AddError("contains",r,n,{minContains:o.minContains})}function Au(e,t,r,n){return s.IsGreaterEqualThan(n,r.minimum)}function Vd(e,t,r,n,o,i){return Au(e,t,o,i)||t.AddError("minimum",r,n,{comparison:">=",limit:o.minimum})}function Ou(e,t,r,n){return s.IsGreaterEqualThan(n.length,r.minItems)}function Jd(e,t,r,n,o,i){return Ou(e,t,o,i)||t.AddError("minItems",r,n,{limit:o.minItems})}function Mu(e,t,r,n){return s.IsMinLength(n,r.minLength)}function Yd(e,t,r,n,o,i){return Mu(e,t,o,i)||t.AddError("minLength",r,n,{limit:o.minLength})}function vu(e,t,r,n){return s.IsGreaterEqualThan(s.Keys(n).length,r.minProperties)}function Qd(e,t,r,n,o,i){return vu(e,t,o,i)||t.AddError("minProperties",r,n,{limit:o.minProperties})}function Fu(e,t,r,n){return s.IsMultipleOf(n,r.multipleOf)}function Xd(e,t,r,n,o,i){return Fu(e,t,o,i)||t.AddError("multipleOf",r,n,{multipleOf:o.multipleOf})}function Lu(e,t,r,n){let o=new ct;return!Q(e,o,r.not,n)&&t.Merge([o])}function Zd(e,t,r,n,o,i){return Lu(e,t,o,i)||t.AddError("not",r,n,{})}function el(e,t,r,n){let o=r.oneOf.reduce((i,a)=>{let m=new ct;return Q(e,m,a,n)?[...i,m]:i},[]);return s.IsEqual(o.length,1)&&t.Merge(o)}function tl(e,t,r,n,o,i){let a=[],m=[],c=o.oneOf.reduce((f,d,g)=>{let y=new et,I=`${r}/oneOf/${g}`,h=ce(e,y,I,n,d,i);return h&&m.push(g),h||a.push(y),h?[...f,y]:f},[]),p=s.IsEqual(c.length,1)&&t.Merge(c);return!p&&s.IsEqual(m.length,0)&&a.forEach(f=>t.AddErrors(f.GetErrors())),p||t.AddError("oneOf",r,n,{passingSchemas:m})}function ju(e,t,r,n){return(s.IsString(r.pattern)?zr(r.pattern):r.pattern).test(n)}function rl(e,t,r,n,o,i){return ju(e,t,o,i)||t.AddError("pattern",r,n,{pattern:o.pattern})}function nl(e,t,r,n){return s.Every(s.Entries(r.patternProperties),0,([o,i])=>{let a=zr(o);return s.Every(s.Entries(n),0,([m,c])=>!a.test(m)||Ot(e,t,i,c)&&t.AddKey(m))})}function ol(e,t,r,n,o,i){return s.EveryAll(s.Entries(o.patternProperties),0,([a,m])=>{let c=`${r}/patternProperties/${$t(a)}`,p=zr(a);return s.EveryAll(s.Entries(i),0,([f,d])=>{let g=`${n}/${$t(f)}`;return!p.test(f)||Mt(e,t,c,g,m,d)&&t.AddKey(f)})})}function il(e,t,r,n){return s.IsEqual(n.length,0)||s.Every(r.prefixItems,0,(o,i)=>s.IsLessEqualThan(n.length,i)||Ot(e,t,o,n[i])&&t.AddIndex(i))}function sl(e,t,r,n,o,i){return s.IsEqual(i.length,0)||s.EveryAll(o.prefixItems,0,(a,m)=>{let c=`${r}/prefixItems/${m}`,p=`${n}/${m}`;return s.IsLessEqualThan(i.length,m)||Mt(e,t,c,p,a,i[m])&&t.AddIndex(m)})}function Du(e,t){return e.includes(t)||Me.Get().exactOptionalPropertyTypes}function Nu(e,t){return s.IsUndefined(e[t])}function al(e,t,r,n){let o=In(r)?r.required:[];return s.Every(s.Entries(r.properties),0,([a,m])=>{let c=!s.HasPropertyKey(n,a)||Ot(e,t,m,n[a])&&t.AddKey(a);return Du(o,a)?c:Nu(n,a)||c})}function ml(e,t,r,n,o,i){let a=In(o)?o.required:[];return s.EveryAll(s.Entries(o.properties),0,([c,p])=>{let f=`${r}/properties/${$t(c)}`,d=`${n}/${$t(c)}`,g=()=>!s.HasPropertyKey(i,c)||Mt(e,t,f,d,p,i[c])&&t.AddKey(c);return Du(a,c)?g():Nu(i,c)||g()})}function ul(e,t,r,n){return s.Every(s.Keys(n),0,(o,i)=>Q(e,t,r.propertyNames,o))}function cl(e,t,r,n,o,i){let a=[];return s.EveryAll(s.Keys(i),0,(c,p)=>{let f=`${n}/${$t(c)}`,d=`${r}/propertyNames`,g=ce(e,t,d,f,o.propertyNames,c);return g||a.push(c),g})||t.AddError("propertyNames",r,n,{propertyNames:a})}function pl(e,t,r,n){let o=Bt.RecursiveRef(e,r)??!1,i=o?{...e,pendingResource:!0}:e;return L(o)&&Q(i,t,o,n)}function fl(e,t,r,n,o,i){let a=Bt.RecursiveRef(e,o)??!1,m=a?{...e,pendingResource:!0}:e;return L(a)&&ce(m,t,r,n,a,i)}function dl(e,t,r,n){let o=Bt.Ref(e,r),i=o.schema??!1,a=new ct,m=L(i)&&Q(o.stack,a,i,n);return m&&t.Merge([a]),m}function ll(e,t,r,n,o,i){let a=Bt.Ref(e,o),m=a.schema??!1,c=new et,p=L(m)&&ce(a.stack,c,r,n,m,i);return p&&t.Merge([c]),p||t.AddErrors(c.GetErrors()),p}function gl(e,t,r,n){return s.Every(r.required,0,o=>s.HasPropertyKey(n,o))}function yl(e,t,r,n,o,i){let a=[];return s.EveryAll(o.required,0,c=>{let p=s.HasPropertyKey(i,c);return p||a.push(c),p})||t.AddError("required",r,n,{requiredProperties:a})}function qu(e,t,r,n,o){return s.IsEqual(r,"object")?s.IsObjectNotArray(o):s.IsEqual(r,"array")?s.IsArray(o):s.IsEqual(r,"boolean")?s.IsBoolean(o):s.IsEqual(r,"integer")?s.IsInteger(o):s.IsEqual(r,"number")?s.IsNumber(o):s.IsEqual(r,"null")?s.IsNull(o):s.IsEqual(r,"string")?s.IsString(o):s.IsEqual(r,"bigint")?s.IsBigInt(o):s.IsEqual(r,"constructor")?s.IsConstructor(o):s.IsEqual(r,"function")?s.IsFunction(o):s.IsEqual(r,"symbol")?s.IsSymbol(o):s.IsEqual(r,"undefined")?s.IsUndefined(o):s.IsEqual(r,"void")?s.IsUndefined(o):!0}function xl(e,t,r,n,o){return s.Some(r,i=>qu(e,t,i,n,o))}function hl(e,t,r,n){return s.IsArray(r.type)?xl(e,t,r.type,r,n):qu(e,t,r.type,r,n)}function Il(e,t,r,n,o,i){return(s.IsArray(o.type)?xl(e,t,o.type,o,i):qu(e,t,o.type,o,i))||t.AddError("type",r,n,{type:o.type})}function bl(e,t,r,n){let o=t.GetIndices();return s.Every(n,0,(i,a)=>(o.has(a)||Q(e,t,r.unevaluatedItems,i))&&t.AddIndex(a))}function $l(e,t,r,n,o,i){let a=t.GetIndices(),m=[];return s.EveryAll(i,0,(p,f)=>{let d=new et,g=(a.has(f)||ce(e,d,r,n,o.unevaluatedItems,p))&&t.AddIndex(f);return g||m.push(f),g})||t.AddError("unevaluatedItems",r,n,{unevaluatedItems:m})}function El(e,t,r,n){let o=t.GetKeys();return s.Every(s.Entries(n),0,([i,a])=>o.has(i)||Q(e,t,r.unevaluatedProperties,a)&&t.AddKey(i))}function Sl(e,t,r,n,o,i){let a=t.GetKeys(),m=[];return s.EveryAll(s.Entries(i),0,([p,f])=>{let d=new et,g=a.has(p)||ce(e,d,r,n,o.unevaluatedProperties,f)&&t.AddKey(p);return g||m.push(p),g})||t.AddError("unevaluatedProperties",r,n,{unevaluatedProperties:m})}var Pr={};At(Pr,{Hash:()=>Pl,HashCode:()=>D0});function $e(){throw new Error("Unreachable")}function S0(e){let t=new Set,r=e;for(;r&&r!==Object.prototype;){for(let n of Reflect.ownKeys(r))n!=="constructor"&&typeof n!="symbol"&&t.add(n);r=Object.getPrototypeOf(r)}return[...t]}function k0(e){return typeof e=="number"}var St={Array:0,BigInt:1,Boolean:2,Date:3,Constructor:4,Function:5,Null:6,Number:7,Object:8,RegExp:9,String:10,Symbol:11,TypeArray:12,Undefined:13},Bs=8997,Zo=33826,Gs=40164,Ks=52210,wl=new Float64Array(1),Cl=new DataView(wl.buffer),Rl=new Uint8Array(wl.buffer);function Ge(e){let t=Bs^e,r=t*435,n=Zo*435+(r>>>16),o=Gs*435+(n>>>16)+(t<<8),i=Ks*435+(o>>>16)+(Zo<<8);Bs=r&65535,Zo=n&65535,Gs=o&65535,Ks=i&65535}function T0(e){Ge(St.Array);for(let t of e)Wr(t)}function w0(e){Ge(St.BigInt),Cl.setBigInt64(0,e);for(let t of Rl)Ge(t)}function kl(e){Ge(St.Boolean),Ge(e?1:0)}function C0(e){Ge(St.Constructor),Wr(e.toString())}function R0(e){Ge(St.Date),Wr(e.getTime())}function P0(e){Ge(St.Function),Wr(e.toString())}function A0(e){Ge(St.Null)}function Tl(e){Ge(St.Number),Cl.setFloat64(0,e,!0);for(let t of Rl)Ge(t)}function O0(e){Ge(St.Object);for(let t of S0(e).sort())Wr(t),Wr(e[t])}function M0(e){Ge(St.RegExp),Uu(e.toString())}var v0=new TextEncoder;function Uu(e){Ge(St.String);for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r>127){for(let n of v0.encode(e.slice(t)))Ge(n);return}Ge(r)}}function F0(e){Ge(St.Symbol),Wr(e.toString())}function L0(e){Ge(St.TypeArray);let t=new Uint8Array(e.buffer);for(let r=0;r<t.length;r++)Ge(t[r])}function j0(e){return Ge(St.Undefined)}function Wr(e){return De.IsTypeArray(e)?L0(e):De.IsDate(e)?R0(e):De.IsRegExp(e)?M0(e):De.IsBoolean(e)?kl(e.valueOf()):De.IsString(e)?Uu(e.valueOf()):De.IsNumber(e)?Tl(e.valueOf()):k0(e)?Tl(e):s.IsArray(e)?T0(e):s.IsBoolean(e)?kl(e):s.IsBigInt(e)?w0(e):s.IsConstructor(e)?C0(e):s.IsNull(e)?A0(e):s.IsObject(e)?O0(e):s.IsString(e)?Uu(e):s.IsSymbol(e)?F0(e):s.IsUndefined(e)?j0(e):s.IsFunction(e)?P0(e):$e()}function _s(e){return e.toString(16).padStart(4,"0")}function D0(e){return BigInt(`0x${Pl(e)}`)}function Pl(e){return Bs=8997,Zo=33826,Gs=40164,Ks=52210,Wr(e),`${_s(Ks)}${_s(Gs)}${_s(Zo)}${_s(Bs)}`}function Al(e){return!s.IsEqual(e.uniqueItems,!1)}function Ol(e,t,r,n){if(!Al(r))return!0;let o=new Set(n.map(Pr.Hash)).size,i=n.length;return s.IsEqual(o,i)}function Ml(e,t,r,n,o,i){if(!Al(o))return!0;let a=new Set,m=i.reduce((p,f,d)=>{let g=Pr.Hash(f);return a.has(g)?[...p,d]:(a.add(g),p)},[]);return s.IsEqual(m.length,0)||t.AddError("uniqueItems",r,n,{duplicateItems:m})}function Ot(e,t,r,n){return t.Push()&&Q(e,t,r,n)&&t.Pop()}function Q(e,t,r,n){let o=Kn(e,r);return ln(r)?iu(o,t,r,n):(!tu(r)||hl(o,t,r,n))&&(!(s.IsObject(n)&&!s.IsArray(n))||(!In(r)||gl(o,t,r,n))&&(!_t(r)||Lf(o,t,r,n))&&(!zm(r)||Kf(o,t,r,n))&&(!Wm(r)||zf(o,t,r,n))&&(!rs(r)||Vf(o,t,r,n))&&(!Un(r)||nl(o,t,r,n))&&(!_n(r)||al(o,t,r,n))&&(!us(r)||ul(o,t,r,n))&&(!Uo(r)||vu(o,t,r,n))&&(!Zm(r)||Ru(o,t,r,n)))&&(!s.IsArray(n)||(!Zi(r)||Mf(o,t,r,n))&&(!Gr(r)||au(o,t,r,n))&&(!gn(r)||Ud(o,t,r,n))&&(!yn(r)||Pu(o,t,r,n))&&(!Qm(r)||ku(o,t,r,n))&&(!xn(r)||Ou(o,t,r,n))&&(!No(r)||wu(o,t,r,n))&&(!hn(r)||il(o,t,r,n))&&(!Hr(r)||Ol(o,t,r,n)))&&(!s.IsString(n)||(!qo(r)||Mu(o,t,r,n))&&(!Xm(r)||Cu(o,t,r,n))&&(!Do(r)||Su(o,t,r,n))&&(!_o(r)||ju(o,t,r,n)))&&(!(s.IsNumber(n)||s.IsBigInt(n))||(!wr(r)||xu(o,t,r,n))&&(!Jm(r)||yu(o,t,r,n))&&(!Cr(r)||Au(o,t,r,n))&&(!Ym(r)||Tu(o,t,r,n))&&(!eu(r)||Fu(o,t,r,n)))&&(!ps(r)||dl(o,t,r,n))&&(!cs(r)||pl(o,t,r,n))&&(!ns(r)||od(o,t,r,n))&&(!Hm(r)||su(o,t,r,n))&&(!Vm(r)||gu(o,t,r,n))&&(!is(r)||Nd(o,t,r,n))&&(!as(r)||Lu(o,t,r,n))&&(!es(r)||Df(o,t,r,n))&&(!ts(r)||qf(o,t,r,n))&&(!ms(r)||el(o,t,r,n))&&(!Go(r)||!s.IsArray(n)||bl(o,t,r,n))&&(!Ko(r)||!s.IsObject(n)||El(o,t,r,n))&&(!Xi(r)||Tf(o,t,r,n))}function Mt(e,t,r,n,o,i){return t.Push()&&ce(e,t,r,n,o,i)&&t.Pop()}function ce(e,t,r,n,o,i){if(t.AtCapacity())return!1;let a=Kn(e,o);return ln(o)?_f(a,t,r,n,o,i):!!(+(!tu(o)||Il(a,t,r,n,o,i))&+(!(s.IsObject(i)&&!s.IsArray(i))||!!(+(!In(o)||yl(a,t,r,n,o,i))&+(!_t(o)||jf(a,t,r,n,o,i))&+(!zm(o)||Hf(a,t,r,n,o,i))&+(!Wm(o)||Wf(a,t,r,n,o,i))&+(!rs(o)||Jf(a,t,r,n,o,i))&+(!Un(o)||ol(a,t,r,n,o,i))&+(!_n(o)||ml(a,t,r,n,o,i))&+(!us(o)||cl(a,t,r,n,o,i))&+(!Uo(o)||Qd(a,t,r,n,o,i))&+(!Zm(o)||zd(a,t,r,n,o,i))))&+(!s.IsArray(i)||!!(+(!Zi(o)||vf(a,t,r,n,o,i))&+(!Gr(o)||Gf(a,t,r,n,o,i))&+(!gn(o)||_d(a,t,r,n,o,i))&+(!yn(o)||Wd(a,t,r,n,o,i))&+(!Qm(o)||Bd(a,t,r,n,o,i))&+(!xn(o)||Jd(a,t,r,n,o,i))&+(!No(o)||Kd(a,t,r,n,o,i))&+(!hn(o)||sl(a,t,r,n,o,i))&+(!Hr(o)||Ml(a,t,r,n,o,i))))&+(!s.IsString(i)||!!(+(!qo(o)||Yd(a,t,r,n,o,i))&+(!Xm(o)||Hd(a,t,r,n,o,i))&+(!Do(o)||Dd(a,t,r,n,o,i))&+(!_o(o)||rl(a,t,r,n,o,i))))&+(!(s.IsNumber(i)||s.IsBigInt(i))||!!(+(!wr(o)||md(a,t,r,n,o,i))&+(!Jm(o)||ad(a,t,r,n,o,i))&+(!Cr(o)||Vd(a,t,r,n,o,i))&+(!Ym(o)||Gd(a,t,r,n,o,i))&+(!eu(o)||Xd(a,t,r,n,o,i))))&+(!ps(o)||ll(a,t,r,n,o,i))&+(!cs(o)||fl(a,t,r,n,o,i))&+(!ns(o)||id(a,t,r,n,o,i))&+(!Hm(o)||Bf(a,t,r,n,o,i))&+(!Vm(o)||sd(a,t,r,n,o,i))&+(!is(o)||qd(a,t,r,n,o,i))&+(!as(o)||Zd(a,t,r,n,o,i))&+(!es(o)||Nf(a,t,r,n,o,i))&+(!ts(o)||Uf(a,t,r,n,o,i))&+(!ms(o)||tl(a,t,r,n,o,i))&+(!Go(o)||!s.IsArray(i)||$l(a,t,r,n,o,i))&+(!Ko(o)||!s.IsObject(i)||Sl(a,t,r,n,o,i)))&&(!Xi(o)||wf(a,t,r,n,o,i))}function Fl(e){switch(e.keyword){case"additionalProperties":return"must not have additional properties";case"anyOf":return"must match a schema in anyOf";case"boolean":return"schema is false";case"const":return"must be equal to constant";case"contains":return"must contain at least 1 valid item";case"dependencies":return`must have properties ${e.params.dependencies.join(", ")} when property ${e.params.property} is present`;case"dependentRequired":return`must have properties ${e.params.dependencies.join(", ")} when property ${e.params.property} is present`;case"enum":return"must be equal to one of the allowed values";case"exclusiveMaximum":return`must be ${e.params.comparison} ${e.params.limit}`;case"exclusiveMinimum":return`must be ${e.params.comparison} ${e.params.limit}`;case"format":return`must match format "${e.params.format}"`;case"if":return`must match "${e.params.failingKeyword}" schema`;case"maxItems":return`must not have more than ${e.params.limit} items`;case"maxLength":return`must not have more than ${e.params.limit} characters`;case"maxProperties":return`must not have more than ${e.params.limit} properties`;case"maximum":return`must be ${e.params.comparison} ${e.params.limit}`;case"minItems":return`must not have fewer than ${e.params.limit} items`;case"minLength":return`must not have fewer than ${e.params.limit} characters`;case"minProperties":return`must not have fewer than ${e.params.limit} properties`;case"minimum":return`must be ${e.params.comparison} ${e.params.limit}`;case"multipleOf":return`must be multiple of ${e.params.multipleOf}`;case"not":return"must not be valid";case"oneOf":return"must match exactly one schema in oneOf";case"pattern":return`must match pattern "${e.params.pattern}"`;case"propertyNames":return`property names ${e.params.propertyNames.join(", ")} are invalid`;case"required":return`must have required properties ${e.params.requiredProperties.join(", ")}`;case"type":return typeof e.params.type=="string"?`must be ${e.params.type}`:`must be either ${e.params.type.join(" or ")}`;case"unevaluatedItems":return"must not have unevaluated items";case"unevaluatedProperties":return"must not have unevaluated properties";case"uniqueItems":return"must not have duplicate items";case"~refine":return e.params.message;default:return"an unknown validation error occurred"}}var N0=Fl;function Ll(){return N0}var l={};At(l,{Assign:()=>U0,Clone:()=>_0,Create:()=>G0,Discard:()=>K0,Metrics:()=>Qt,Update:()=>V0});var Qt={assign:0,create:0,clone:0,discard:0,update:0};function vt(e){return[...s.Keys(e),...s.Symbols(e)]}function jl(e,t){if(!t.has(e)){t.add(e);for(let r of vt(e)){let n=Object.getOwnPropertyDescriptor(e,r);!n||!("value"in n)||s.IsObject(n.value)&&jl(n.value,t)}Object.freeze(e)}}function Vr(e){return Me.Get().immutableTypes&&jl(e,new WeakSet),e}function U0(e,t){Qt.assign+=1;let r={},n=vt(t),o=vt(e);for(let i of o)n.includes(i)||Object.defineProperty(r,i,Object.getOwnPropertyDescriptor(e,i));for(let i of n)Object.defineProperty(r,i,Object.getOwnPropertyDescriptor(t,i));return Vr(r)}function _0(e){Qt.clone+=1;let t={};for(let r of vt(e)){if(s.IsUnsafePropertyKey(r))continue;let n=Object.getOwnPropertyDescriptor(e,r);s.IsEqual(n.enumerable,!0)?t[r]=n.value:Object.defineProperty(t,r,n)}return t}function Dl(e,t){return{...e,...t}}function B0(e,t){for(let r of Object.keys(t))Object.defineProperty(e,r,{configurable:!0,writable:!0,enumerable:!1,value:t[r]});return e}function G0(e,t,r={}){Qt.create+=1;let n=Dl(t,r),o=Me.Get().enumerableKind?Dl(n,e):B0(n,e);return Vr(o)}function K0(e,t){Qt.discard+=1;let r={};for(let n of vt(e)){if(t.includes(n))continue;let o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,o)}return Vr(r)}function H0(e,t,r,n){for(let o of vt(e)){if(s.IsUnsafePropertyKey(o)||t.includes(o)||r.includes(o))continue;let i=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(n,o,i)}}function z0(e,t,r){let n=Me.Get().enumerableKind;for(let o of t)s.IsUnsafePropertyKey(o)||Object.defineProperty(r,o,{configurable:!0,writable:!0,enumerable:n,value:e[o]})}function W0(e,t,r){for(let n of t)s.IsUnsafePropertyKey(n)||Object.defineProperty(r,n,{configurable:!0,enumerable:!0,writable:!0,value:e[n]})}function V0(e,t,r){Qt.update+=1;let n={},o=vt(t),i=vt(r);return H0(e,o,i,n),z0(t,o,n),W0(r,i,n),Vr(n)}function Hs(...e){let[t,r,n]=B.Match(e,{3:(f,d,g)=>[f,d,g],2:(f,d)=>[{},f,d]}),o=Gn(t,r),i=new et,a=ce(o,i,"#","",r,n),m=i.GetErrors(),c=Ll(),p=m.map(f=>({...f,message:c(f)}));return[a,p]}var ql=0;function zs(){let e=Qi();ql=e.maxErrors,e.maxErrors=e.maxParseErrors}function Ws(){let e=Qi();e.maxErrors=ql}function Bu(...e){let[t,r,n]=B.Match(e,{3:(a,m,c)=>[a,m,c],2:(a,m)=>[{},a,m]}),o=Gn(t,r),i=new ct;return Q(o,i,r,n)}function K(...e){let[t,r,n]=B.Match(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[{},o,i]});return Bu(t,r,n)}function Xt(...e){let[t,r,n]=B.Match(e,{3:(a,m,c)=>[a,m,c],2:(a,m)=>[{},a,m]}),[o,i]=Hs(t,r,n);return i}var Ar=class extends Error{constructor(t,r,n){super(t),Object.defineProperty(this,"cause",{value:{source:t,errors:n,value:r},writable:!1,configurable:!1,enumerable:!1})}};function Vs(...e){let[t,r,n]=B.Match(e,{3:(i,a,m)=>[i,a,m],2:(i,a)=>[{},i,a]});if(!K(t,r,n))throw new Ar("Assert",n,Xt(t,r,n))}function w(e,t){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],t)}function ye(e){return s.IsObject(e)}function R(e,t,r){return l.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:r},{})}function Jr(e){return w(e,"Deferred")}function ur(e,t){return l.Update(e,{"~readonly":!0},t)}function Ul(e,t,r,n){let o=$(e,t,r);return ur(o,n)}function cr(e,t){return l.Update(e,{"~optional":!0},t)}function _l(e,t,r,n){let o=$(e,t,r);return cr(o,n)}function yt(e,t){return l.Create({"~kind":"Array"},{type:"array",items:e},t)}function W(e){return w(e,"Array")}function Jn(e){return l.Discard(e,["~kind","type","items"])}function pr(e,t,r={}){return l.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},r)}function Ee(e){return w(e,"Constructor")}function Bl(e){return l.Discard(e,["~kind","type","parameters","instanceType"])}function fr(e,t,r={}){return l.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},r)}function Se(e){return w(e,"Function")}function Gl(e){return l.Discard(e,["~kind","type","parameters","returnType"])}function Be(e,t){return l.Create({"~kind":"Ref"},{$ref:e},t)}function te(e){return w(e,"Ref")}function Yr(e,t){return l.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function Yn(e){return w(e,"Generic")}function Qn(e){return l.Create({"~kind":"Any"},{},e)}function Ie(e){return w(e,"Any")}var Kl="(?!)";function ie(e){return l.Create({"~kind":"Never"},{not:{}},e)}function xt(e){return w(e,"Never")}function dr(e,t={}){return R("AddOptional",[e],t)}function Js(e,t={}){return cr(e,t)}function Hl(e){return Js(e)}function ve(e){return ye(e)&&s.HasPropertyKey(e,"~optional")}function zl(e){return s.Keys(e).filter(t=>!ve(e[t]))}function Ys(e){return s.Keys(e)}function Qs(e){return s.Values(e)}function M(e,t={}){let r=zl(e),n=r.length>0?{required:r}:{};return l.Create({"~kind":"Object"},{type:"object",...n,properties:e},t)}function A(e){return w(e,"Object")}function Wl(e){return l.Discard(e,["~kind","type","properties","required"])}function Ne(e){return l.Create({"~kind":"Unknown"},{},e)}function Fe(e){return w(e,"Unknown")}function lr(e,t,r){let n=s.Keys(e).reduce((o,i)=>({...o,[i]:l.Update(e[i],{},{$id:i})}),{});return l.Create({"~kind":"Cyclic"},{$defs:n,$ref:t},r)}function me(e){return w(e,"Cyclic")}function Vl(e){return l.Update(e,{"~unsafe":null},{})}function Xs(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"~unsafe")&&s.IsNull(e["~unsafe"])}function ei(...e){let[t,r]=B.Match(e,{2:(n,o)=>[n,o,o],1:n=>[n,Ne(),Ne()]});return l.Create({"~kind":"Infer"},{type:"infer",name:t,extends:r},{})}function Le(e){return w(e,"Infer")}function $n(e,t,r,n={}){return l.Create({"~kind":"Dependent"},{if:e,then:t,else:r},n)}function ke(e){return w(e,"Dependent")}function Jl(e){return l.Discard(e,["~kind","if","then","else"])}function Yl(e){return s.IsObjectNotArray(e)}function Ql(e){return s.Keys(e).filter(r=>isNaN(r)).reduce((r,n)=>[...r,e[n]],[])}function Xl(e){return s.IsString(e)||s.IsNumber(e)}function Zl(e,t){let r=Yl(e)?Ql(e):e;return l.Create({"~kind":"Enum"},{enum:r},t)}function Te(e){return w(e,"Enum")}function ot(e,t={}){return l.Create({"~kind":"Intersect"},{allOf:e},t)}function O(e){return w(e,"Intersect")}function eg(e){return l.Discard(e,["~kind","allOf"])}var ti=class{constructor(t,r){this.type=t,this.decode=r}Encode(t){let r=this.type,n=pt(r)?a=>this.decode(r["~codec"].decode(a)):this.decode,o=pt(r)?a=>r["~codec"].encode(t(a)):t,i={decode:n,encode:o};return l.Update(this.type,{"~codec":i},{})}},ri=class{constructor(t){this.type=t}Decode(t){return new ti(this.type,t)}};function Zs(e){return new ri(e)}function tg(e,t){return Zs(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function rg(e,t){return Zs(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function pt(e){return ye(e)&&s.HasPropertyKey(e,"~codec")&&s.IsObject(e["~codec"])&&s.HasPropertyKey(e["~codec"],"encode")&&s.HasPropertyKey(e["~codec"],"decode")}function ng(e){return Xn(e)}function En(e){return ye(e)&&s.HasPropertyKey(e,"~immutable")}function gr(e,t={}){return R("AddReadonly",[e],t)}function ea(e,t={}){return ur(e,t)}function og(e){return ea(e)}function Or(e){return ye(e)&&s.HasPropertyKey(e,"~readonly")}function Q0(e,t){let r=ni(e)?[...e["~refine"],t]:[t];return l.Update(e,{"~refine":r},{})}function ig(...e){let[t,r,n]=B.Match(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[o,i,()=>"Refine Error"]});return Q0(t,{check:r,error:n})}function X0(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"check")&&s.HasPropertyKey(e,"error")&&s.IsFunction(e.check)&&s.IsFunction(e.error)}function ni(e){return ye(e)&&s.HasPropertyKey(e,"~refine")&&s.IsArray(e["~refine"])&&s.Every(e["~refine"],0,t=>X0(t))}var sg="-?(?:0|[1-9][0-9]*)n";function oi(e){return l.Create({"~kind":"BigInt"},{type:"bigint"},e)}function kt(e){return w(e,"BigInt")}function ta(e){return l.Create({"~kind":"Boolean"},{type:"boolean"},e)}function ft(e){return w(e,"Boolean")}function ii(e){return l.Create({"~kind":"Identifier"},{name:e})}function ag(e){return w(e,"Identifier")}var ra="-?(?:0|[1-9][0-9]*)";function Sn(e){return l.Create({"~kind":"Integer"},{type:"integer"},e)}function Ke(e){return w(e,"Integer")}var Gu=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function Z0(e){return s.IsBigInt(e)?"bigint":s.IsBoolean(e)?"boolean":s.IsNumber(e)?"number":s.IsString(e)?"string":(()=>{throw new Gu(e)})()}function G(e,t){return l.Create({"~kind":"Literal"},{type:Z0(e),const:e},t)}function na(e){return s.IsBigInt(e)||s.IsBoolean(e)||s.IsNumber(e)||s.IsString(e)}function mg(e){return H(e)&&s.IsBigInt(e.const)}function ug(e){return H(e)&&s.IsBoolean(e.const)}function oa(e){return H(e)&&s.IsNumber(e.const)}function ia(e){return H(e)&&s.IsString(e.const)}function H(e){return w(e,"Literal")}function Zn(e){return l.Create({"~kind":"Null"},{type:"null"},e)}function yr(e){return w(e,"Null")}var sa="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function Tt(e){return l.Create({"~kind":"Number"},{type:"number"},e)}function xe(e){return w(e,"Number")}function eo(e){return l.Create({"~kind":"Symbol"},{type:"symbol"},e)}function xr(e){return w(e,"Symbol")}function kn(...e){let[t,r,n]=B.Match(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[o,i,i],1:o=>[o,Ne(),Ne()]});return l.Create({"~kind":"Parameter"},{name:t,extends:r,equals:n},{})}function cg(e){return w(e,"Parameter")}var aa=".*";function tt(e){return l.Create({"~kind":"String"},{type:"string"},e)}function qe(e){return w(e,"String")}function j(e,t={}){return l.Create({"~kind":"Union"},{anyOf:e},t)}function S(e){return w(e,"Union")}function pg(e){return l.Discard(e,["~kind","anyOf"])}function si(e){let t=fg(e);return s.IsEqual(t.length,2)?t[0]:[]}function eP(e){return!0}function dg(e){return s.ShiftLeft(e,(t,r)=>tP(t)?dg(r):!1,()=>!0)}function lg(e){return s.IsEqual(e.length,0)?!1:dg(e)}function tP(e){return S(e)?lg(e.anyOf):H(e)?eP(e.const):!1}function ma(e){return lg(e)}function ua(e){return l.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function gg(e,t,r=[]){return s.ShiftLeft(e,(n,o)=>gg(o,t,[...r,`${n}${t}`]),()=>r)}function rP(e,t){return s.IsEqual(e.length,0)?[`${t}`]:gg(e,t)}function yg(e,t,r=[]){return s.ShiftLeft(t,(n,o)=>yg(e,o,[...r,...xg(e,n)]),()=>r)}function xg(e,t){return S(t)?yg(e,t.anyOf):H(t)?rP(e,t.const):$e()}function hg(e,t){return s.ShiftLeft(t,(r,n)=>hg(xg(e,r),n),()=>e)}function nP(e){return e.map(t=>G(t))}function oP(e){let t=hg([],e),r=nP(t);return j(r)}function iP(e){return s.IsEqual(e.length,0)?$e():s.IsEqual(e.length,1)&&H(e[0])?e[0]:oP(e)}function Ku(e){let t=si(e);return s.IsEqual(t.length,0)?tt():ma(t)?iP(t):ua(e)}function to(e){let t=Ku(e);return ue(t)?tt():t}function ht(e,t){let r="object",n={[e]:t};return l.Create({"~kind":"Record"},{type:r,patternProperties:n})}function Ig(e){return ht(Zt,e)}function bg(e){return M({true:e,false:e})}function we(e,t={}){let[r,n,o]=[e,e.length,!1];return l.Create({"~kind":"Tuple"},{type:"array",additionalItems:o,items:r,minItems:n},t)}function q(e){return w(e,"Tuple")}function $g(e){return l.Discard(e,["~kind","type","items","minItems","additionalItems"])}function Hu(e){return e.reduceRight((r,n,o)=>({[o]:n,...r}),{})}function Eg(e){let t=Hu(e.items);return M(t)}function sP(e){return l.Discard(e,["~optional"])}function Tn(e,t){return l.Update(sP(e),{},t)}function Sg(e,t,r,n){let o=$(e,t,r);return Tn(o,n)}function aP(e){return l.Discard(e,["~readonly"])}function ro(e,t){return l.Update(aP(e),{},t)}function kg(e,t,r,n){let o=$(e,t,r);return ro(o,n)}function ca(e,t){let r=Or(e)&&Or(t),n=ve(e)&&ve(t),o=Ce([e,t]),i=ro(Tn(o,{}),{});return r&&n?ur(cr(i,{}),{}):r?ur(i,{}):n?cr(i,{}):i}function Tg(e,t){let r=Or(e)||Or(t),n=ve(e)||ve(t),o=ro(Tn(e,{}),{}),i=ro(Tn(t,{}),{}),a=It([o,i]);return r&&n?ur(cr(a,{}),{}):r?ur(a,{}):n?cr(a,{}):a}function mP(e,t,r){return r in e?r in t?ca(e[r],t[r]):e[r]:r in t?t[r]:ie()}function uP(e,t){return[...new Set([...s.Keys(e),...s.Keys(t)])].reduce((o,i)=>({...o,[i]:mP(e,t,i)}),{})}function wg(e){return A(e)?e.properties:q(e)?Hu(e.items):{}}function Cg(e,t){let r=wg(e),n=wg(t),o=uP(r,n);return M(o)}function cP(e,t){let r=no(e,t);return s.IsEqual(r,mi)?e:s.IsEqual(r,ui)||s.IsEqual(r,ai)?t:ie()}function Rg(e){return A(e)||q(e)}function pP(e,t){let r=Rg(e),n=Rg(t);return r&&n?Cg(e,t):r&&!n?e:!r&&n?t:cP(e,t)}function Pg(e,t){return xt(e)||Ie(e)?e:Fe(e)||xt(t)||Ie(t)?t:Fe(t)?e:pP(e,t)}function fP(e,t){return S(e)||S(t)}function dP(e,t){let r=Gt(e),n=Gt(t);return fP(r,n)?Ce([r,n]):Pg(r,n)}function Ag(e,t,r=[]){return s.ShiftLeft(t,(n,o)=>Ag(e,o,[...r,dP(n,e)]),()=>s.IsEqual(r.length,0)?[e]:r)}function Og(e,t,r=[]){return s.ShiftLeft(e,(n,o)=>Og(o,t,[...r,...ci([n],t)]),()=>r)}function ci(e,t=[]){return s.ShiftLeft(e,(r,n)=>S(r)?ci(n,Og(r.anyOf,t)):ci(n,Ag(r,t)),()=>t)}function lP(e,t){let r=rt({},e,t);return F.IsExtendsTrueLike(r)?[]:[e]}function Mg(e,t,r=[]){return s.ShiftLeft(e,(n,o)=>Mg(o,t,[...r,...lP(n,t)]),()=>r)}function pa(e,t){let r=Gt(e),n=S(r)?r.anyOf:[r],o=Mg(n,t);return It(o)}function er(e,t,r){let n=Ce([e,t]),o=pa(r,e);return It([n,o])}function dt(e,t=[]){return s.ShiftLeft(e,(r,n)=>dt(n,[...t,G(r)]),()=>It(t))}function Ce(e){let t=ci(e),r=zu(t);return It(r)}function it(e){let t=to(e);return Gt(t)}function It(e){let t=zu(e);return Qr(t)}function Gt(e){return ke(e)?er(e.if,e.then,e.else):Te(e)?dt(e.enum):O(e)?Ce(e.allOf):ue(e)?it(e.pattern):S(e)?It(e.anyOf):e}function Qr(e){return s.IsEqual(e.length,1)?e[0]:s.IsEqual(e.length,0)?ie():j(e)}function vg(e,t){let r=dt(e);return Xr(r,t)}function Fg(e,t){return ht(Zr,t)}function Lg(e,t){let r=Ce(e);return Xr(r,t)}function jg(e,t){return s.IsString(e)||s.IsNumber(e)?M({[e]:t}):s.IsEqual(e,!1)?M({false:t}):s.IsEqual(e,!0)?M({true:t}):M({})}function Dg(e,t){return ht(oo,t)}function Ng(e,t){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)?ht(e.pattern.toString(),t):ht(Zt,t)}function qg(e,t){let r=si(e);return ma(r)?Xr(it(e),t):ht(e,t)}function gP(e){return S(e)?en(e.anyOf):[e]}function en(e,t=[]){return s.ShiftLeft(e,(r,n)=>en(n,[...t,...gP(r)]),()=>t)}function yP(e){return e.some(t=>qe(t)||xe(t)||Ke(t))}function xP(e,t){return s.IsEqual(yP(e),!0)?ht(Zt,t):void 0}function hP(e,t){return e.reduce((r,n)=>H(n)&&(s.IsString(n.const)||s.IsNumber(n.const))?{...r,[n.const]:t}:r,{})}function IP(e,t){let r=hP(e,t);return M(r)}function Ug(e,t){let r=en(e),n=xP(r,t);return ye(n)?n:IP(r,t)}function Xr(e,t){return Ie(e)?Ig(t):ft(e)?bg(t):Te(e)?vg(e.enum,t):Ke(e)?Fg(e,t):O(e)?Lg(e.allOf,t):H(e)?jg(e.const,t):xe(e)?Dg(e,t):S(e)?Ug(e.anyOf,t):qe(e)?Ng(e,t):ue(e)?qg(e.pattern,t):M({})}function Wu(e,t,r){return U([e])?l.Update(Xr(e,t),{},r):fa(e,t,r)}function _g(e,t,r,n,o){let i=$(e,t,r),a=$(e,t,n);return Wu(i,a,o)}var Zr=`^${ra}$`,oo=`^${sa}$`,Zt=`^${aa}$`;function fa(e,t,r={}){return R("Record",[e,t],r)}function io(e,t,r={}){return Wu(e,t,r)}function Bg(e,t){return ht(e,t)}function da(e){return s.IsEqual(e,Zt)?tt():s.IsEqual(e,Zr)?Sn():s.IsEqual(e,oo)?Tt():Ku(e)}function je(e){return s.Keys(e.patternProperties)[0]}function so(e){let t=je(e);return da(t)}function pe(e){return e.patternProperties[je(e)]}function ne(e){return w(e,"Record")}function wn(e){return l.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function tn(e){return w(e,"Rest")}function la(e){return l.Create({"~kind":"This"},{$ref:"#"},e)}function ga(e){return w(e,"This")}function ao(e){return l.Create({"~kind":"Undefined"},{type:"undefined"},e)}function Kt(e){return w(e,"Undefined")}function ya(e){return l.Create({"~kind":"Void"},{type:"void"},e)}function wt(e){return w(e,"Void")}function $P(e,t){return s.IsEqual(e,"Array")?yt(t[0]):s.IsEqual(e,"Capitalize")?ha(t[0]):s.IsEqual(e,"ConstructorParameters")?Sa(t[0]):s.IsEqual(e,"Evaluate")?Hx(t[0]):s.IsEqual(e,"Exclude")?ka(t[0],t[1]):s.IsEqual(e,"Extract")?Ta(t[0],t[1]):s.IsEqual(e,"Index")?li(t[0],t[1]):s.IsEqual(e,"InstanceType")?wa(t[0]):s.IsEqual(e,"Lowercase")?Ia(t[0]):s.IsEqual(e,"NonNullable")?Ca(t[0]):s.IsEqual(e,"Omit")?Ra(t[0],t[1]):s.IsEqual(e,"Parameters")?Pa(t[0]):s.IsEqual(e,"Partial")?Aa(t[0]):s.IsEqual(e,"Pick")?Oa(t[0],t[1]):s.IsEqual(e,"Readonly")?Ma(t[0]):s.IsEqual(e,"KeyOf")?gi(t[0]):s.IsEqual(e,"Record")?fa(t[0],t[1]):s.IsEqual(e,"Required")?va(t[0]):s.IsEqual(e,"ReturnType")?Fa(t[0]):s.IsEqual(e,"Uncapitalize")?ba(t[0]):s.IsEqual(e,"Uppercase")?$a(t[0]):di(Be(e),t)}function Cn(){throw Error("Unreachable")}function Wg(e,t=[]){return s.ShiftLeft(e,(r,n)=>Wg(n,[...t,r[1]]),()=>t)}function Mr(e){return s.IsEqual(e.length,3)?[e[0],...Wg(e[1])]:[]}function Vg(e){return kn(e[0],e[2],e[4])}function Jg(e){return kn(e[0],e[2],e[2])}function Yg(e){return kn(e[0],Ne(),e[2])}function Qg(e){return kn(e,Ne(),Ne())}function Xg(e){return Mr(e)}function Zg(e){return e[1]}function ey(e){return Mr(e)}function ty(e){return e[1]}function ry(e){return $P(e[0],e[1])}function ny(e){return null}function oy(e){return tt()}function iy(e){return Tt()}function sy(e){return ta()}function ay(e){return ao()}function my(e){return Zn()}function uy(e){return Sn()}function cy(e){return oi()}function py(e){return Ne()}function fy(e){return Qn()}function dy(e){return M({})}function ly(e){return ie()}function gy(e){return eo()}function yy(e){return ya()}function xy(e){return la()}function hy(e){return G(BigInt(e))}function Iy(e){return G(s.IsEqual(e,"true"))}function by(e){return G(parseFloat(e))}function $y(e){return G(e)}function Ey(e){return e[1]}function Sy(e){return G(e)}function ky(e){return s.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function Ty(e){return e[1]}function wy(e){return xa(e)}function Cy(e){return s.IsEqual(e.length,6)?$n(e[1],e[3],e[5]):$n(e[1],e[3],Ne())}function Ry(e){return e.length>0}function Py(e){return e.reduce((t,r)=>s.IsEqual(r.length,3)?[...t,[r[1]]]:[...t,[]],[])}function Ay(e){return s.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function Oy(e){return s.IsArray(e)&&s.IsEqual(e.length,3)?e[1]:e}function My(e){return s.IsEqual(e.length,2)?e[1]:[]}function Gg(e,t){return t.reduce((r,n)=>{let o=n;return s.IsEqual(o.length,1)?li(r,o[0]):s.IsEqual(o.length,0)?yt(r):Cn()},e)}function Kg(e,t){return s.IsEqual(t.length,3)?Ea(e,t[0],t[1],t[2]):e}function EP(e,t){return s.IsArray(t)&&s.IsEqual(t.length,0)?e:La(e,t)}function vy(e){let[t,r,n,o,i]=e;return EP(Kg(t?gi(Gg(r,n)):Gg(r,n),o),i)}function Vu(e,t){return s.IsEqual(t.length,3)?(()=>{let[r,n,o]=t,i=Vu(n,o);if(s.IsEqual(r,"&"))return O(i)?ot([e,...i.allOf]):ot([e,i]);if(s.IsEqual(r,"|"))return S(i)?j([e,...i.anyOf]):j([e,i]);Cn()})():e}function Fy(e){let[t,r]=e;return Vu(t,r)}function Ly(e){let[t,r]=e;return Vu(t,r)}function jy(e){return Gx(e[1])}function Dy(e){return e[1]}function Ny(e){return Yr(e[0],e[2])}function qy(e){return s.IsEqual(e.length,4)?ei(e[1],e[3]):s.IsEqual(e.length,2)?ei(e[1],Ne()):Cn()}function Uy(e){return`${e}`}function _y(e){return Ke(e[3])?Zr:xe(e[3])?oo:xr(e[3])?Zt:qe(e[3])?Zt:Cn()}function By(e){return e.length>0}function Gy(e){return e.length>0}function Ky(e){let[t,r,n,o,i]=e;return{[r]:t&&n?gr(dr(i)):t&&!n?gr(i):!t&&n?dr(i):i}}function Hy(e){return Mr(e)}function zy(e){return e.reduce((t,r)=>s.HasPropertyKey(r,Zr)||s.HasPropertyKey(r,oo)||s.HasPropertyKey(r,Zt)?[t[0],l.Assign(t[1],r)]:[l.Assign(t[0],r),t[1]],[{},{}])}function Wy(e){return zy(e[1])}function Vy(e){let[t,r]=e,n=s.IsEqual(s.Keys(r).length,0)?{}:{patternProperties:r};return M(t,n)}function Jy(e){return s.IsEqual(e.length,5)?gr(dr(e[4])):s.IsEqual(e.length,3)?e[2]:s.IsEqual(e.length,4)?s.IsEqual(e[2],"readonly")?gr(e[3]):dr(e[3]):Cn()}function Yy(e){if(!s.IsArray(e)||!s.IsEqual(e.length,3))return e;let[t,r,n]=e;return t&&n?gr(dr(r)):t&&!n?gr(r):!t&&n?dr(r):r}function Qy(e){return s.IsEqual(e.length,2)?wn(e[1]):s.IsEqual(e.length,1)?e[0]:Cn()}function Xy(e){return Mr(e)}function Zy(e){return we(e[1])}function ex(e){return gr(dr(e[4]))}function tx(e){return gr(e[3])}function rx(e){return dr(e[3])}function nx(e){return e[2]}function ox(e){return s.IsEqual(e.length,2)?wn(e[1]):s.IsEqual(e.length,1)?e[0]:Cn()}function ix(e){return Mr(e)}function sx(e){return fr(e[1],e[4])}function ax(e){return pr(e[2],e[5])}function Hg(e,t){return s.IsEqual(e,"remove")?Kx(t):s.IsEqual(e,"add")?gr(t):t}function mx(e){return s.IsEqual(e.length,2)&&s.IsEqual(e[0],"-")?"remove":s.IsEqual(e.length,2)&&s.IsEqual(e[0],"+")||s.IsEqual(e.length,1)?"add":"none"}function zg(e,t){return s.IsEqual(e,"remove")?Bx(t):s.IsEqual(e,"add")?dr(t):t}function ux(e){return s.IsEqual(e.length,2)&&s.IsEqual(e[0],"-")?"remove":s.IsEqual(e.length,2)&&s.IsEqual(e[0],"+")||s.IsEqual(e.length,1)?"add":"none"}function cx(e){return s.IsEqual(e.length,2)?[e[1]]:[]}function px(e){return s.IsArray(e[6])&&s.IsEqual(e[6].length,1)?pi(ii(e[3]),e[5],e[6][0],Hg(e[1],zg(e[8],e[10]))):pi(ii(e[3]),e[5],Be(e[3]),Hg(e[1],zg(e[8],e[10])))}function fx(e){return Be(e)}function dx(e){return BigInt(e)}function lx(e){return parseFloat(e)}function gx(e){return s.IsEqual(e,"true")}function yx(e){return null}function xx(e){return{[e[0]]:e[2]}}function hx(e){return Mr(e)}function SP(e){return e.reduce((t,r)=>l.Assign(t,r),{})}function Ix(e){return SP(e[1])}function bx(e){return Mr(e)}function $x(e){return e[1]}function Ex(e){return oi()}function Sx(e){return tt()}function kx(e){return Tt()}function Tx(e){return Sn()}function wx(e){return ie()}function Cx(e){return G(e)}function Rx(e){return j(e[1])}function Px(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function Ax(e){return[e[0],...e[1]]}function Ox(e){return e[1]}function Mx(e){return Mr(e)}function vx(e){return s.IsEqual(e.length,2)?e[1]:[]}function Fx(e){let t=e[2],r=e[3],[n,o]=e[4],i=s.IsEqual(s.Keys(o).length,0)?{}:{patternProperties:o};return{[e[1]]:Yr(t,fi(r,n,i))}}function Lx(e){let t=e[2],[r,n]=e[3],o=s.IsEqual(s.Keys(n).length,0)?{}:{patternProperties:n};return{[e[1]]:fi(t,r,o)}}function jx(e){return{[e[1]]:Yr(e[2],e[4])}}function Dx(e){return{[e[1]]:e[3]}}function Nx(e){return null}function qx(e){return Mr(e)}function Ux(e){return e[1]}function _x(e){let[t,r]=[e[0],e[1]];return zx(l.Assign(t,zy(r)[0]))}function yi(e){return Y(e.length,2)}function V(e,t,r){return yi(e)?t(e[0],e[1]):r()}function wP(e,t){return Y(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function be(e,t){for(let r=0;r<e.length;r++){let n=wP(e[r],t);if(yi(n))return n}return[]}function Ju(e,t){return Array.from({length:t-e+1},(r,n)=>String.fromCharCode(e+n))}var Wx=[...Ju(97,122),...Ju(65,90)],Yu="0",Qu=Ju(49,57),mo=[Yu,...Qu],Vx=" ",uo=`
|
|
2
2
|
`;var rn="_",ja=".",Jx="$",Da="-";var Yx="//",Qx="/*",RP="*/";function Xx(e){let t=e.indexOf(RP);return Y(t,-1)?"":e.slice(t+2)}function Zx(e){let t=e.indexOf(uo);return Y(t,-1)?"":e.slice(t)}function PP(e){return e.replace(/^[ \t\r\f\v]+/,"")}function Na(e){let t=PP(e);return t.startsWith(Qx)?Na(Xx(t.slice(2))):t.startsWith(Yx)?Na(Zx(t.slice(2))):t}function Qe(e){let t=e.trimStart();return t.startsWith(Qx)?Qe(Xx(t.slice(2))):t.startsWith(Yx)?Qe(Zx(t.slice(2))):t}function qa(e,t){return V(be([e],t),(r,n)=>[r,n],()=>["",t])}function AP(e,t){return e.includes(t)}function co(e,t,r,n=""){return V(be(e,r),(o,i)=>AP(t,o)?co(e,t,i,n):co(e,t,i,`${n}${o}`),()=>[n,r])}function OP(e){return be(Qu,e)}var MP=[...mo,rn];function vP(e){return co(MP,[rn],e)}function FP(e){return V(be([Yu],e),(t,r)=>[t,r],()=>V(OP(e),(t,r)=>V(vP(r),(n,o)=>[`${t}${n}`,o],()=>[]),()=>[]))}function Ua(e){return FP(Qe(e))}function LP(e){return qa(Da,e)}function jP(e){return V(LP(e),(t,r)=>V(Ua(r),(n,o)=>[`${t}${n}`,o],()=>[]),()=>[])}function eh(e){return jP(Qe(e))}function DP(e){return V(eh(e),(t,r)=>V(be(["n"],r),(n,o)=>[`${t}`,o],()=>[]),()=>[])}function Xu(e){return DP(e)}function Zu(e,t){return be([e],t)}function x(e,t){return Y(e,"")?["",t]:e.startsWith(uo)?Zu(e,Na(t)):e.startsWith(Vx)?Zu(e,t):Zu(e,Qe(t))}var th=[...Wx,rn,Jx];function NP(e){return be(th,e)}var qP=[...th,...mo];function rh(e,t=""){return V(be(qP,e),(r,n)=>rh(n,`${t}${r}`),()=>[t,e])}function UP(e){return V(NP(e),(t,r)=>V(rh(r),(n,o)=>[`${t}${n}`,o],()=>[]),()=>[])}function Re(e){return UP(Qe(e))}var _P=[...mo,rn];function BP(e){return yi(be([ja],e))}function nh(e){return V(co(_P,[rn],e),(t,r)=>Y(t,"")?[]:[t,r],()=>[])}function GP(e){return V(be([ja],e),(t,r)=>V(nh(r),(n,o)=>[`0${t}${n}`,o],()=>[]),()=>[])}function KP(e){return V(Ua(e),(t,r)=>V(be([ja],r),(n,o)=>V(nh(o),(i,a)=>[`${t}${n}${i}`,a],()=>[`${t}`,o]),()=>[`${t}`,r]),()=>[])}function HP(e){return BP(e)?GP(e):KP(e)}function oh(e){return HP(Qe(e))}function zP(e){return qa(Da,e)}function WP(e){return V(zP(e),(t,r)=>V(oh(r),(n,o)=>[`${t}${n}`,o],()=>[]),()=>[])}function _a(e){return WP(Qe(e))}function VP(e){return Y(e,"")?[]:[e.slice(0,1),e.slice(1)]}function ih(e,t){return Yi(e,(r,n)=>t.startsWith(r)?!0:ih(n,t),()=>!1)}function nn(e,t,r=""){return V(VP(t),(n,o)=>ih(e,t)?[r,t]:nn(e,o,`${r}${n}`),()=>[])}function JP(e,t,r){return V(be([e],r),(n,o)=>V(nn([t],o),(i,a)=>V(be([t],a),(m,c)=>[`${i}`,c],()=>[]),()=>[]),()=>[])}function YP(e,t,r){return V(be([e],r),(n,o)=>V(nn([uo,t],o),(i,a)=>V(be([t],a),(m,c)=>[`${i}`,c],()=>[]),()=>[]),()=>[])}function sh(e,t,r,n){return r?JP(e,t,Qe(n)):YP(e,t,Qe(n))}function QP(e,t){return be(e,t)}function XP(e,t){return sh(e,e,!1,t)}function ZP(e,t){return V(QP(e,t),(r,n)=>XP(r,`${r}${n}`),()=>[])}function Ba(e,t){return ZP(e,Qe(t))}function ah(e,t){return V(nn(e,t),(r,n)=>Y(r,"")?[]:[r,n],()=>[])}var u=(e,t,r=()=>[])=>e.length===2?t(e):r(),tA=e=>u(u(Re(e),([t,r])=>u(x("extends",r),([n,o])=>u(X(o),([i,a])=>u(x("=",a),([m,c])=>u(X(c),([p,f])=>[[t,n,i,m,p],f]))))),([t,r])=>[Vg(t),r]),rA=e=>u(u(Re(e),([t,r])=>u(x("extends",r),([n,o])=>u(X(o),([i,a])=>[[t,n,i],a]))),([t,r])=>[Jg(t),r]),nA=e=>u(u(Re(e),([t,r])=>u(x("=",r),([n,o])=>u(X(o),([i,a])=>[[t,n,i],a]))),([t,r])=>[Yg(t),r]),oA=e=>u(Re(e),([t,r])=>[Qg(t),r]),ch=e=>u(u(tA(e),([t,r])=>[t,r],()=>u(rA(e),([t,r])=>[t,r],()=>u(nA(e),([t,r])=>[t,r],()=>u(oA(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),ph=(e,t=[])=>u(u(x(",",e),([r,n])=>u(ch(n),([o,i])=>[[r,o],i])),([r,n])=>ph(n,[...t,r]),()=>[t,e]),iA=e=>u(u(u(ch(e),([t,r])=>u(ph(r),([n,o])=>u(u(x(",",o),([i,a])=>[[i],a],()=>[[],o]),([i,a])=>[[t,n,i],a]))),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Xg(t),r]),rc=e=>u(u(x("<",e),([t,r])=>u(iA(r),([n,o])=>u(x(">",o),([i,a])=>[[t,n,i],a]))),([t,r])=>[Zg(t),r]),fh=(e,t=[])=>u(u(x(",",e),([r,n])=>u(X(n),([o,i])=>[[r,o],i])),([r,n])=>fh(n,[...t,r]),()=>[t,e]),sA=e=>u(u(u(X(e),([t,r])=>u(fh(r),([n,o])=>u(u(x(",",o),([i,a])=>[[i],a],()=>[[],o]),([i,a])=>[[t,n,i],a]))),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[ey(t),r]),aA=e=>u(u(x("<",e),([t,r])=>u(sA(r),([n,o])=>u(x(">",o),([i,a])=>[[t,n,i],a]))),([t,r])=>[ty(t),r]),mA=e=>u(u(Re(e),([t,r])=>u(aA(r),([n,o])=>[[t,n],o])),([t,r])=>[ry(t),r]),dh=e=>u(u(u(x(";",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[ny(t),r]),lh=e=>u(x("string",e),([t,r])=>[oy(t),r]),gh=e=>u(x("number",e),([t,r])=>[iy(t),r]),uA=e=>u(x("boolean",e),([t,r])=>[sy(t),r]),cA=e=>u(x("undefined",e),([t,r])=>[ay(t),r]),pA=e=>u(x("null",e),([t,r])=>[my(t),r]),yh=e=>u(x("integer",e),([t,r])=>[uy(t),r]),fA=e=>u(x("bigint",e),([t,r])=>[cy(t),r]),dA=e=>u(x("unknown",e),([t,r])=>[py(t),r]),lA=e=>u(x("any",e),([t,r])=>[fy(t),r]),gA=e=>u(x("object",e),([t,r])=>[dy(t),r]),yA=e=>u(x("never",e),([t,r])=>[ly(t),r]),xh=e=>u(x("symbol",e),([t,r])=>[gy(t),r]),xA=e=>u(x("void",e),([t,r])=>[yy(t),r]),hA=e=>u(x("this",e),([t,r])=>[xy(t),r]),IA=e=>u(u(x("${",e),([t,r])=>u(X(r),([n,o])=>u(x("}",o),([i,a])=>[[t,n,i],a]))),([t,r])=>[Ey(t),r]),ec=e=>u(nn(["${","`"],e),([t,r])=>[Sy(t),r]),hh=e=>u(u(u(ec(e),([t,r])=>u(IA(r),([n,o])=>u(hh(o),([i,a])=>[[t,n,i],a]))),([t,r])=>[t,r],()=>u(u(ec(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>u(u(ec(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[]))),([t,r])=>[ky(t),r]),nc=e=>u(u(x("`",e),([t,r])=>u(hh(r),([n,o])=>u(x("`",o),([i,a])=>[[t,n,i],a]))),([t,r])=>[Ty(t),r]),bA=e=>u(nc(e),([t,r])=>[wy(t),r]),$A=e=>u(u(u(x("if",e),([t,r])=>u(X(r),([n,o])=>u(x("then",o),([i,a])=>u(X(a),([m,c])=>u(x("else",c),([p,f])=>u(X(f),([d,g])=>[[t,n,i,m,p,d],g])))))),([t,r])=>[t,r],()=>u(u(x("if",e),([t,r])=>u(X(r),([n,o])=>u(x("then",o),([i,a])=>u(X(a),([m,c])=>[[t,n,i,m],c])))),([t,r])=>[t,r],()=>[])),([t,r])=>[Cy(t),r]),EA=e=>u(Xu(e),([t,r])=>[hy(t),r]),SA=e=>u(u(x("true",e),([t,r])=>[t,r],()=>u(x("false",e),([t,r])=>[t,r],()=>[])),([t,r])=>[Iy(t),r]),kA=e=>u(_a(e),([t,r])=>[by(t),r]),TA=e=>u(Ba(["'",'"'],e),([t,r])=>[$y(t),r]),wA=e=>u(u(u(x("keyof",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Ry(t),r]),Ih=(e,t=[])=>u(u(u(x("[",e),([r,n])=>u(X(n),([o,i])=>u(x("]",i),([a,m])=>[[r,o,a],m]))),([r,n])=>[r,n],()=>u(u(x("[",e),([r,n])=>u(x("]",n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>[])),([r,n])=>Ih(n,[...t,r]),()=>[t,e]),CA=e=>u(Ih(e),([t,r])=>[Py(t),r]),RA=e=>u(u(u(x("extends",e),([t,r])=>u(X(r),([n,o])=>u(x("?",o),([i,a])=>u(X(a),([m,c])=>u(x(":",c),([p,f])=>u(X(f),([d,g])=>[[t,n,i,m,p,d],g])))))),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Ay(t),r]),PA=e=>u(u(u(x("(",e),([t,r])=>u(X(r),([n,o])=>u(x(")",o),([i,a])=>[[t,n,i],a]))),([t,r])=>[t,r],()=>u(lh(e),([t,r])=>[t,r],()=>u(gh(e),([t,r])=>[t,r],()=>u(uA(e),([t,r])=>[t,r],()=>u(cA(e),([t,r])=>[t,r],()=>u(pA(e),([t,r])=>[t,r],()=>u(yh(e),([t,r])=>[t,r],()=>u(fA(e),([t,r])=>[t,r],()=>u(dA(e),([t,r])=>[t,r],()=>u(lA(e),([t,r])=>[t,r],()=>u(gA(e),([t,r])=>[t,r],()=>u(yA(e),([t,r])=>[t,r],()=>u(xh(e),([t,r])=>[t,r],()=>u(xA(e),([t,r])=>[t,r],()=>u(hA(e),([t,r])=>[t,r],()=>u(EA(e),([t,r])=>[t,r],()=>u(SA(e),([t,r])=>[t,r],()=>u(kA(e),([t,r])=>[t,r],()=>u(TA(e),([t,r])=>[t,r],()=>u(bA(e),([t,r])=>[t,r],()=>u($A(e),([t,r])=>[t,r],()=>u(UA(e),([t,r])=>[t,r],()=>u(GA(e),([t,r])=>[t,r],()=>u(JA(e),([t,r])=>[t,r],()=>u(VA(e),([t,r])=>[t,r],()=>u(ZA(e),([t,r])=>[t,r],()=>u(mA(e),([t,r])=>[t,r],()=>u(eO(e),([t,r])=>[t,r],()=>[])))))))))))))))))))))))))))),([t,r])=>[Oy(t),r]),AA=e=>u(u(u(x("with",e),([t,r])=>u(jh(r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[My(t),r]),bh=e=>u(u(wA(e),([t,r])=>u(PA(r),([n,o])=>u(CA(o),([i,a])=>u(RA(a),([m,c])=>u(AA(c),([p,f])=>[[t,n,i,m,p],f]))))),([t,r])=>[vy(t),r]),$h=e=>u(u(u(x("&",e),([t,r])=>u(bh(r),([n,o])=>u($h(o),([i,a])=>[[t,n,i],a]))),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[t,r]),Eh=e=>u(u(bh(e),([t,r])=>u($h(r),([n,o])=>[[t,n],o])),([t,r])=>[Fy(t),r]),Sh=e=>u(u(u(x("|",e),([t,r])=>u(Eh(r),([n,o])=>u(Sh(o),([i,a])=>[[t,n,i],a]))),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[t,r]),Ga=e=>u(u(Eh(e),([t,r])=>u(Sh(r),([n,o])=>[[t,n],o])),([t,r])=>[Ly(t),r]),OA=e=>u(u(x("readonly",e),([t,r])=>u(Ga(r),([n,o])=>[[t,n],o])),([t,r])=>[jy(t),r]),MA=e=>u(u(x("|",e),([t,r])=>u(Ga(r),([n,o])=>[[t,n],o])),([t,r])=>[Dy(t),r]),vA=e=>u(u(rc(e),([t,r])=>u(x("=",r),([n,o])=>u(X(o),([i,a])=>[[t,n,i],a]))),([t,r])=>[Ny(t),r]),FA=e=>u(u(u(x("infer",e),([t,r])=>u(Re(r),([n,o])=>u(x("extends",o),([i,a])=>u(Ga(a),([m,c])=>[[t,n,i,m],c])))),([t,r])=>[t,r],()=>u(u(x("infer",e),([t,r])=>u(Re(r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>[])),([t,r])=>[qy(t),r]),X=e=>u(u(FA(e),([t,r])=>[t,r],()=>u(MA(e),([t,r])=>[t,r],()=>u(OA(e),([t,r])=>[t,r],()=>u(Ga(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),LA=e=>u(_a(e),([t,r])=>[Uy(t),r]),jA=e=>u(Re(e),([t,r])=>[t,r]),DA=e=>u(Ba(["'",'"'],e),([t,r])=>[t,r]),NA=e=>u(u(x("[",e),([t,r])=>u(Re(r),([n,o])=>u(x(":",o),([i,a])=>u(u(yh(a),([m,c])=>[m,c],()=>u(gh(a),([m,c])=>[m,c],()=>u(lh(a),([m,c])=>[m,c],()=>u(xh(a),([m,c])=>[m,c],()=>[])))),([m,c])=>u(x("]",c),([p,f])=>[[t,n,i,m,p],f]))))),([t,r])=>[_y(t),r]),kh=e=>u(u(LA(e),([t,r])=>[t,r],()=>u(jA(e),([t,r])=>[t,r],()=>u(DA(e),([t,r])=>[t,r],()=>u(NA(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),Th=e=>u(u(u(x("readonly",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[By(t),r]),wh=e=>u(u(u(x("?",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>u([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Gy(t),r]),Ch=e=>u(u(Th(e),([t,r])=>u(kh(r),([n,o])=>u(wh(o),([i,a])=>u(x(":",a),([m,c])=>u(X(c),([p,f])=>[[t,n,i,m,p],f]))))),([t,r])=>[Ky(t),r]),Ka=e=>u(u(u(x(",",e),([t,r])=>u(x(`
|
|
3
3
|
`,r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>u(u(x(";",e),([t,r])=>u(x(`
|
|
4
4
|
`,r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>u(u(x(",",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>u(u(x(";",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>u(u(x(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{q as f,r as p}from"./chunk-
|
|
1
|
+
import{q as f,r as p}from"./chunk-465RG5I6.js";import"./chunk-UTYFLLSM.js";import"./chunk-WOT6VMZA.js";import{execFileSync as v}from"node:child_process";import{existsSync as m,mkdirSync as x,readFileSync as S,readdirSync as j,statSync as $,writeFileSync as z}from"node:fs";import{join as i,relative as b,resolve as d}from"node:path";function F(o){let e=o.replace(/-/g," ").replace(/\b\w/g,t=>t.toUpperCase());return[{path:"preset.json",body:`${JSON.stringify({name:o,title:e,description:"One line saying what this preset is for.",category:"engineering",version:"1.0.0",skills:[`${o}-skill`]},null,2)}
|
|
2
2
|
`},{path:"prompt.md",body:["Rules the model should follow while this preset is active.","","This text is appended to the system prompt, never substituted for it, so it","adds to the agent's own rules rather than replacing them. Delete this file if","the preset only needs skills.",""].join(`
|
|
3
3
|
`)},{path:i("skills",`${o}-skill`,"SKILL.md"),body:["---",`name: ${o}-skill`,"description: When the model should reach for this skill. This line is what"," the model reads when deciding, so say when to use it, not what it contains.","---","",`# ${e}`,"","What the model should do, as instructions. A skill is read on demand: only the","frontmatter above is in every request, so the body costs nothing until used.","","Do not add `disable-model-invocation: true` unless the skill must only ever run","from `/skill:<name>` \u2014 it keeps the skill out of the model's catalogue entirely.",""].join(`
|
|
4
4
|
`)}]}function g(){return["usage:"," howtocode preset new <name> [dir] write a preset skeleton"," howtocode preset check [dir] validate a preset with the installer's rules"," howtocode preset pack [dir] build <name>-<version>.tar.gz for publishing","","A preset is a directory holding preset.json, an optional prompt.md, and a","skills/ tree. `check` runs the same validation the installer runs, so a preset","that passes here will not be refused at install."].join(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as c,d as l}from"./chunk-27TRKD65.js";import{H as s}from"./chunk-
|
|
1
|
+
import{b as c,d as l}from"./chunk-27TRKD65.js";import{H as s}from"./chunk-465RG5I6.js";import"./chunk-UTYFLLSM.js";import{a as i,b as r}from"./chunk-XSUEEWKS.js";import"./chunk-WOT6VMZA.js";var d=[["/connect","sign in to howtofix.id: approve it in your browser"],["/model","choose which model answers"],["/help","list every command"],["/quit","leave"]],u=[" \u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557"," \u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2554\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D"," \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2588\u2588\u2588\u2557 "," \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551 \u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2554\u2550\u2550\u255D "," \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u255D \u2588\u2588\u2557\u2588\u2588\u2551 "," \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D "],g=[" _ _ _____ ","| | | | __ __ | ___|","| |_| | \\ \\/ / | |_ ","| _ | > < | _| ","|_| |_| /_/\\_\\ |_| "];function m(){if(process.platform==="win32")return!1;let e=(process.env.LC_ALL||process.env.LC_CTYPE||process.env.LANG||"").toLowerCase();return e===""||e==="c"||e==="posix"||!e.includes("utf-8")&&!e.includes("utf8")?!1:!/ja|ko|zh|_kr|_jp|_cn|_tw|_hk/.test(e)}function h(){return m()?u:g}var _="https://howtofix.id/cli";function p(e){let n=process.env.HOME??"",t=n!==""&&e.startsWith(n)?`~${e.slice(n.length)}`:e,o=t.split("/").filter(Boolean);return o.length>3?`\u2026/${o.slice(-2).join("/")}`:t}function f(e){let n=e.signedIn?d.filter(([t])=>t!=="/connect"):d;return[...h(),"",`${i} ${r} \u2014 a terminal coding agent. Describe the change you want and it reads, edits and runs the code in front of you.`,"",` working in ${p(e.cwd)}`,...e.note?[` session ${e.note}`]:[],"",...e.signedIn?[" already signed in to howtofix.id",""]:[],...n.map(([t,o])=>` ${t.padEnd(11)}${o}`),"",' Or just start typing. Every message goes to the model; anything beginning with "/" stays local.'].join(`
|
|
2
2
|
`)}function v(){return[{value:"connect",label:"Sign in to howtofix.id",description:"approve the sign-in in your browser"},{value:"ready",label:"I have a key \u2014 just give me the prompt",description:"drops you at the prompt; run /connect whenever you like"},{value:"release",label:"What's in this release",description:`opens the ${r} notes in your browser`}]}async function E(e,n,t){c(s).welcomeSeen||(l(s),t(`welcome to ${i}`,f(e)),!e.signedIn&&await new Promise(o=>{n("First run \u2014 how do you want to begin?",v(),a=>{a==="connect"&&e.runSlash("/connect"),a==="release"&&e.openExternal(_),o()},()=>o())}))}export{E as maybeShowWelcome};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var a="HowToCode",o="0.7.
|
|
1
|
+
var a="HowToCode",o="0.7.67",n=["You are HowToCode, a coding agent. The user wants the fix, not a tour of the problem.",'NEVER report a check you did not run. NEVER state a version, path, result or capability you have not verified \u2014 if you did not check it, say you are unsure. "Not found" is not "impossible": a tool missing from PATH is often installed anyway, and one that is truly absent can usually be installed. Exhaust the real options before calling anything unavailable; when you do report a limit, say plainly what you tried and what you could not do. Unexercised behaviour is not evidence.',"NEVER mention the underlying harness, its vendor or its project name to the user.","Every tool is `read`, `write` or `exec`, and each approval mode auto-approves every tier up to its own: `suggest` runs `read` only, `auto-edit` adds `write`, `full-auto` adds `exec`. A read-only shell command runs in every mode, so inspecting the tree asks nothing.","NEVER aim a command at the filesystem root, a block device or a system account file, and NEVER shut down the host: those are refused in EVERY mode, `full-auto` included, so proposing one wastes the turn. This is not a list of things to avoid \u2014 it is a list of things that will not run.","Lead with the diagnosis in one or two sentences, then change the code. SHOULD prefer the smallest correct change over a rewrite. Name the file and the reason in a short line; do not narrate tool calls.","Fix the problem that was asked for. NEVER add features, refactors, validation, error handling or dependencies nobody requested.","Something reported broken: reproduce it first, confirm the fix after. Cannot reproduce it? Say so \u2014 NEVER edit code and call it fixed.","Tests describe intended behaviour. A failing test means fix the code, not the test: NEVER delete, skip or loosen an assertion to get green, and NEVER re-pin an expected value to whatever the code happens to print.","Anything you cannot settle by reading \u2014 a page, a layout, a screenshot, a CLI, a service, a failure \u2014 run it and look at the result. For a visual task, find a browser the way a real one does: `$PUPPETEER_EXECUTABLE_PATH`, `$CHROME_PATH`, then `which` for google-chrome, chromium and chromium-browser, then /usr/bin, /snap/bin and /var/lib/flatpak, then the puppeteer and playwright caches under the home directory. Still empty? `npx -y puppeteer browsers install chrome`, or `npm i puppeteer-core` against a chrome the image already ships outside PATH. Then drive the real artifact \u2014 open it, read the DOM, click the controls, measure at the widths that matter \u2014 instead of describing what you assume it does.","Done means the requested behaviour works end to end and every stated requirement is met \u2014 not a scaffold, a narrowed test or a plausible subset. Genuinely out of reach? Finish everything else, then say exactly what is missing and what you tried.","SHOULD plan multi-step work with `todo` before starting it, and mark each step done as you finish. A plan the user can see is worth more than a narration of what you are about to do.","Genuinely ambiguous design: enter plan mode, write the plan to the plan file, then present it with `exit_plan_mode`. Use it when several reasonable approaches exist or when a restructuring would be hard to undo. In plan mode `edit` and `write` are refused for every path except the plan file itself \u2014 that limit is enforced, not advisory, so plan the work rather than starting it. Plan mode needs an interactive session in which the user can approve it; when there is no UI it is unavailable, so design the approach yourself instead of calling it.","Work that is independent and would flood this conversation belongs in `task` subagents. Give each a self-contained assignment, then verify the file it wrote rather than trusting its summary. When that work has a shape you can script \u2014 many items through the same stages, or fan-out whose results must be combined \u2014 `workflow` states the orchestration in one place and runs it deterministically; `task` is for the one-off you cannot describe in advance.","MUST give each subagent a self-contained assignment: a child starts with none of this conversation, so a brief that says 'the file we discussed' reaches it as nothing. Choose the agent by what the work is \u2014 scout looks something up, architect returns a plan, reviewer reports issues with file evidence, task changes files \u2014 and NEVER send work that needs an edit to scout or reviewer, because neither can make one.","SHOULD delegate only work that is genuinely parallel: a subagent costs its own session and its own requests on the same quota as this conversation. A single lookup, a file you can read yourself, or a step whose result decides the next step stays here. MUST keep one call to at most six agents and the session to twelve live or parked ones \u2014 a larger fan-out is refused, and the refusal is a limit rather than a failure to work around.","Record a decision, a file's role, or a fact you would otherwise re-derive with `context`: notes survive compaction and are visible to the other agents on the task.","Look it up instead of recalling it: `web_search` and `web_fetch` for anything outside this repo, `lsp` for a definition, reference or diagnostic. Name the source you checked.","Before calling changed code done, run `quality` and `slop` over it and act on what they report. A metric you did not measure is a claim you cannot make.","A command runs under a two-minute default timeout. MUST pass a longer timeout for anything that legitimately takes more than that \u2014 a recursive directory walk, a package install, a build, a network fetch \u2014 and SHOULD prefer a bounded command to an unbounded one: 'du -sh' with an explicit path beats the whole profile, and on Windows/MSYS a recursive 'du' over a profile directory takes minutes rather than seconds.","When a choice blocks the task, use `ask` instead of guessing; when you need to work something out, use `think`, whose text stays out of the transcript.","Above all: NEVER claim a check you did not run, and NEVER call done on a subset."].join(`
|
|
2
2
|
`);function s(e){return e===void 0?void 0:e.replace(/Use \/login to log into a provider[^\n]*/gi,"Connect a provider with /connect or /login:").replace(/^[ \t]*\S*hxf-coding-agent[\\/]docs[\\/][^\n]*$/gim,"").replace(/\bhxf-coding-agent\b/gi,"the harness").replace(/\n{3,}/g,`
|
|
3
3
|
|
|
4
4
|
`).trim()}var i=["# Project notes","","## What this is","","## Commands","- build:","- test:","","## Conventions","-",""].join(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{I as s,J as l}from"./chunk-
|
|
1
|
+
import{I as s,J as l}from"./chunk-465RG5I6.js";function c(i){return[s,l(i)]}function d(i,n){let t=i.trim(),r=/^\/skill:([^\s]+)(?:\s+([\s\S]*))?$/.exec(t)??/^\/skill\s+([^\s]+)(?:\s+([\s\S]*))?$/.exec(t);if(!r)return;let e=r[1]??"";if(!n.includes(e))return;let o=(r[2]??"").trim();return o?`/skill:${e} ${o}`:`/skill:${e}`}function u(i){if(i.length===0){let[n,t]=c(process.cwd());return["no skills loaded.",`put a SKILL.md in ${n}`,`or in ${t}`,"invoke with /skill:<name>"].join(`
|
|
2
2
|
`)}return i.map(n=>{let t=n.disableModelInvocation?" (invoke only)":"";return`${n.name}${t}
|
|
3
3
|
${n.description}
|
|
4
4
|
${n.filePath}`}).join(`
|
package/dist/main-app.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{b as G,d as J,e as K}from"./chunk-EZNNALD3.js";import"./chunk-7LA2AMZB.js";import{c as H}from"./chunk-PH72JBBL.js";import{a as B,b as F}from"./chunk-MCAAX33K.js";import{H as $,P as D}from"./chunk-
|
|
2
|
+
import{b as G,d as J,e as K}from"./chunk-EZNNALD3.js";import"./chunk-7LA2AMZB.js";import{c as H}from"./chunk-PH72JBBL.js";import{a as B,b as F}from"./chunk-MCAAX33K.js";import{H as $,P as D}from"./chunk-465RG5I6.js";import"./chunk-UTYFLLSM.js";import{j as L}from"./chunk-MVVEYKN6.js";import{a as r,b as k}from"./chunk-XSUEEWKS.js";import"./chunk-WOT6VMZA.js";import{existsSync as Oe,mkdirSync as Te,readdirSync as Z,statSync as Ae,writeFileSync as je}from"node:fs";import{join as j}from"node:path";var V={rpc:!0,acp:!0},q={off:!0,minimal:!0,low:!0,medium:!0,high:!0,xhigh:!0,max:!0},z={suggest:!0,"auto-edit":!0,"full-auto":!0},X={text:!0,json:!0,"stream-json":!0};function Re(l){let e=Number(l);if(!Number.isFinite(e)||e<=0)throw new Error(`--max-budget-usd needs a positive number of dollars, got '${l}'`);return e}function P(l,e,p){let i=l[e];if(i?.includes("="))return i.slice(i.indexOf("=")+1);let c=l[e+1];if(!c||c.startsWith("-"))throw new Error(`${p} needs a value`);return l.splice(e+1,1),c}function Y(l){let e={print:!1,continueSession:!1,noSession:!1,help:!1,version:!1,update:!1,checkUpdate:!1,outputFormat:"text",dangerouslySkipPermissions:!1,sandbox:!1,prompt:""},p=[],i=[...l];i[0]==="resume"&&i[1]&&!i[1].startsWith("-")&&(e.resumeId=i[1],i.splice(0,2));for(let c=0;c<i.length;c++){let o=i[c]??"";if(o==="--"){p.push(...i.slice(c+1));break}if(o==="-h"||o==="--help")e.help=!0;else if(o==="-v"||o==="--version")e.version=!0;else if(o==="-p"||o==="--print")e.print=!0;else if(o==="-c"||o==="--continue")e.continueSession=!0;else if(o==="--no-session")e.noSession=!0;else if(o==="--sandbox")e.sandbox=!0;else if(o==="--update")e.update=!0;else if(o==="--check-update")e.checkUpdate=!0;else if(o==="-r"||o==="--resume")e.continueSession=!0;else if(o==="--session"||o.startsWith("--session="))e.sessionPath=P(i,c,"--session");else if(o==="-m"||o==="--model"||o.startsWith("--model="))e.model=P(i,c,"--model");else if(o==="--thinking"||o.startsWith("--thinking="))e.thinking=P(i,c,"--thinking");else if(o==="--approval"||o.startsWith("--approval="))e.approval=P(i,c,"--approval");else if(o==="--output-format"||o.startsWith("--output-format="))e.outputFormat=P(i,c,"--output-format");else if(o==="--max-budget-usd"||o.startsWith("--max-budget-usd="))e.maxBudgetUsd=Re(P(i,c,"--max-budget-usd"));else if(o==="--mode"||o.startsWith("--mode=")){let h=P(i,c,"--mode");if(!V[h])throw new Error(`--mode must be one of: ${Object.keys(V).join(", ")}`);e.mode=h}else if(o==="--acp")e.mode="acp";else if(o==="--dangerously-skip-permissions")e.dangerouslySkipPermissions=!0;else{if(o.startsWith("-"))throw new Error(`unknown option ${o}`);p.push(o)}}if(e.thinking&&!q[e.thinking])throw new Error(`thinking must be one of: ${Object.keys(q).join(", ")}`);if(e.approval&&!z[e.approval])throw new Error(`approval must be one of: ${Object.keys(z).join(", ")}`);if(!X[e.outputFormat])throw new Error(`output-format must be one of: ${Object.keys(X).join(", ")}`);if(e.outputFormat!=="text"&&!e.print)throw new Error(`--output-format ${e.outputFormat} is a machine contract; it needs --print`);if(e.dangerouslySkipPermissions&&!e.print)throw new Error("--dangerously-skip-permissions is for unattended runs; it needs --print. interactively, pick an approval mode instead (/approval, or --approval)");if(e.prompt=p.join(" ").trim(),e.update&&e.checkUpdate)throw new Error("--update installs; --check-update only looks. pick one");if((e.update||e.checkUpdate)&&(e.print||e.continueSession||e.sessionPath||e.prompt))throw new Error("--update and --check-update act on the installation, not a session; they take no prompt");if(e.continueSession&&e.noSession)throw new Error("--continue and --no-session cannot be combined");if(e.sessionPath&&e.noSession)throw new Error("--session and --no-session cannot be combined");if(e.sessionPath&&e.continueSession)throw new Error("--session and --continue cannot be combined");if(e.resumeId&&e.sessionPath)throw new Error("resume <id> and --session cannot be combined");if(e.resumeId&&e.continueSession)throw new Error("resume <id> and --continue cannot be combined");if(e.print&&(e.continueSession||e.sessionPath||e.resumeId))throw new Error("--print runs one prompt in a throwaway session; it cannot be combined with --continue, --session, or resume <id>");if(e.mode&&(e.print||e.prompt))throw new Error(`--mode ${e.mode} is a protocol server: prompts arrive over the protocol, not the command line`);if(e.mode&&(e.continueSession||e.sessionPath))throw new Error(`--mode ${e.mode} opens its own sessions; it cannot be combined with --continue or --session`);if(e.sessionPath&&!e.sessionPath.endsWith(".jsonl"))throw new Error(`--session expects a session file, got '${e.sessionPath}'`);return e}function E(){return`${r} ${k}
|
|
3
3
|
coding agent. layout is a workbench, not a chat log.
|
|
4
4
|
|
|
5
5
|
usage:
|
|
@@ -93,10 +93,10 @@ token; /login takes another provider's key.
|
|
|
93
93
|
`}function Me(l,e=!1){let{message:p,hint:i}=B(l),c=i?`${p}
|
|
94
94
|
${i}`:p;if(!e)return c;let o=l instanceof Error?l.stack:void 0;return o&&o.includes(`
|
|
95
95
|
`)?`${c}
|
|
96
|
-
${o}`:c}function Q(l,e){let p=e?.debug??process.env.HOWTOCODE_DEBUG==="1",i=e?.exit??(o=>process.exit(o)),c=o=>{console.error(`${l}: ${Me(o,p)}`),i(1)};process.on("uncaughtException",c),process.on("unhandledRejection",c)}function Fe(){try{return{cwd:process.cwd()}}catch{return{error:"the current directory no longer exists (it was deleted while the shell stayed in it). cd to a directory that exists, or pass one on the command line."}}}function Ie(){process.stdout.on("error",l=>{throw l.code==="EPIPE"&&process.exit(0),l})}function Ne(){let l=j($,".welcomed");if(!Oe(l)){try{Te($,{recursive:!0}),je(l,k)}catch{return}console.error(`${r} ${k} installed. Docs: https://howtofix.id/code`),console.error("Continue the last session here with: howtocode -c")}}async function Ue(){Ie(),D();let l=performance.now(),e=Fe();if("error"in e){console.error(`${r}: ${e.error}`),process.exitCode=1;return}let p=e.cwd,i=process.env.HXF_FAKE_NODE??process.versions.node,[c,o]=i.split(".").map(s=>Number.parseInt(s,10));if(!Number.isFinite(c)||c<22||c===22&&Number.isFinite(o)&&o<19){console.error(`${r}: Node ${i} is too old. Node 22.19 or newer is required (run "node --version" to check yours), because undici needs zstd, which Node added in 22.19. Upgrade Node and run this again.`),process.exitCode=1;let s=process.argv.slice(2);if(s.some(n=>n==="-h"||n==="--help")){console.log(E());return}if(s.some(n=>n==="-v"||n==="--version")){console.log(`${r} ${k}`);return}return}let h=process.argv.slice(2);if(h[0]==="doctor"||h[0]==="models"||h[0]==="sessions"){let s=h[0];try{let n=await import("./chunk-
|
|
97
|
-
${E()}`),process.exitCode=2;return}if(R.print&&!R.prompt){console.error(`${r}: --print needs a prompt`),process.exitCode=2;return}let{repairGatewayModels:se,ensureGatewaySettings:oe,repairModelFacts:te,syncGatewayModelsOnStart:ne,checkAccount:re,fetchGatewayPrices:ie,readProviderKey:ae}=await import("./chunk-
|
|
96
|
+
${o}`:c}function Q(l,e){let p=e?.debug??process.env.HOWTOCODE_DEBUG==="1",i=e?.exit??(o=>process.exit(o)),c=o=>{console.error(`${l}: ${Me(o,p)}`),i(1)};process.on("uncaughtException",c),process.on("unhandledRejection",c)}function Fe(){try{return{cwd:process.cwd()}}catch{return{error:"the current directory no longer exists (it was deleted while the shell stayed in it). cd to a directory that exists, or pass one on the command line."}}}function Ie(){process.stdout.on("error",l=>{throw l.code==="EPIPE"&&process.exit(0),l})}function Ne(){let l=j($,".welcomed");if(!Oe(l)){try{Te($,{recursive:!0}),je(l,k)}catch{return}console.error(`${r} ${k} installed. Docs: https://howtofix.id/code`),console.error("Continue the last session here with: howtocode -c")}}async function Ue(){Ie(),D();let l=performance.now(),e=Fe();if("error"in e){console.error(`${r}: ${e.error}`),process.exitCode=1;return}let p=e.cwd,i=process.env.HXF_FAKE_NODE??process.versions.node,[c,o]=i.split(".").map(s=>Number.parseInt(s,10));if(!Number.isFinite(c)||c<22||c===22&&Number.isFinite(o)&&o<19){console.error(`${r}: Node ${i} is too old. Node 22.19 or newer is required (run "node --version" to check yours), because undici needs zstd, which Node added in 22.19. Upgrade Node and run this again.`),process.exitCode=1;let s=process.argv.slice(2);if(s.some(n=>n==="-h"||n==="--help")){console.log(E());return}if(s.some(n=>n==="-v"||n==="--version")){console.log(`${r} ${k}`);return}return}let h=process.argv.slice(2);if(h[0]==="doctor"||h[0]==="models"||h[0]==="sessions"){let s=h[0];try{let n=await import("./chunk-ED624AEE.js");s==="doctor"?process.exitCode=await n.runDoctor():s==="models"?process.exitCode=n.runModels():process.exitCode=n.runSessions(h.slice(1))}catch(n){F(r,s,n),process.exitCode=1}return}if(h.some(s=>s==="-v"||s==="--version")){console.log(`${r} ${k}`);return}if(h.some(s=>s==="-h"||s==="--help")){console.log(E());return}let ee=h[0]==="acp"?["--acp",...h.slice(1)]:h,R;try{R=Y(ee)}catch(s){let n=s instanceof Error?s.message:String(s);console.error(`${r}: ${n}
|
|
97
|
+
${E()}`),process.exitCode=2;return}if(R.print&&!R.prompt){console.error(`${r}: --print needs a prompt`),process.exitCode=2;return}let{repairGatewayModels:se,ensureGatewaySettings:oe,repairModelFacts:te,syncGatewayModelsOnStart:ne,checkAccount:re,fetchGatewayPrices:ie,readProviderKey:ae}=await import("./chunk-EMU362DM.js"),{tiersFrom:ce,writeReachable:de}=await import("./chunk-XBVWQC7P.js"),{readCliCredential:le,renewCliCredentialIfNeeded:pe}=await import("./chunk-7OR4XA5B.js"),{AGENT_DIR:f,REACHABLE_CACHE_PATH:ue}=await import("./chunk-NPD6557W.js"),{readCachedPrices:me,writeCachedPrices:he}=await import("./chunk-A3LZMZ3C.js"),I=se(f);I>0&&console.error(`${r}: repaired ${I} howtocode model(s) that the gateway would have rejected`);let _,M,O=new Map,C=me(f);if(C){_=C.prices;for(let[s,n]of C.groups)O.set(s,n)}try{let s=le(f),n=s?(await pe(f,s)).credential.accessToken:ae(f,"howtocode");if(n){let[m,u]=await Promise.all([C?Promise.resolve(_??new Map):ie(n,{groups:O}),re(n)]);!C&&m.size>0&&(_=m,he(f,m,O)),u.ok&&(M=u.models)}}catch{}let N=ce(O),T=await te(f,{..._?{prices:_}:{},...N.size>0?{tiers:N}:{}});if(T.changed>0?console.error(`${r}: filled in the context window, reasoning flag and price for ${T.changed} model(s)`):T.message&&console.error(`${r}: model catalogue unavailable (${T.message}); context windows stay at their conservative defaults`),oe(f)&&console.error(`${r}: set httpIdleTimeoutMs in settings.json so a stalled provider recovers instead of hanging`),M){de(ue,M);try{let s=await ne(f,M,_);s.added>0&&console.error(`${r}: added ${s.added} model(s) this account can now reach`)}catch{}}let t=R;if(t.help){console.log(E());return}if(t.version){console.log(`${r} ${k}`);let{cliSigningKeyMatchesPanel:s,cliSigningKeyFingerprint:n}=await import("./chunk-IYKHXISM.js");s()||(console.error(`${r}: this build's CLI signing key (${n()}) does not match the key the panel verifies against, so sign-in will be refused.`),process.exitCode=1);return}if(t.sandbox&&!process.env.HOWTOCODE_SANDBOXED){let{detectSandbox:s,enterSandbox:n,describeSandbox:m}=await import("./chunk-YX2QDCVK.js"),u=s();if(!u){console.error(`${r}: --sandbox needs a working bubblewrap (Linux) or sandbox-exec (macOS). Neither could be used here \u2014 on Linux this usually means unprivileged user namespaces are disabled.`),process.exitCode=1;return}console.error(m(u)),process.exitCode=n(u,{cwd:p,agentDir:$,argv:[process.execPath,...process.argv.slice(1)]});return}let{installProxy:fe}=await import("./chunk-WKUJ7CFO.js");fe($);let{retireRobloxBridge:ge}=await import("./chunk-3H2ECHBB.js");if(ge($),t.update||t.checkUpdate){let{PACKAGE_NAME:s,checkForUpdate:n,installUpdate:m,isInstalledCopy:u}=await import("./chunk-LYLJZVZ7.js"),w=await n(k);if(!w.latest){console.error(`${r}: ${w.message}`),process.exitCode=t.update?1:0;return}if(console.log(w.message),t.checkUpdate||!w.available)return;if(!u()){console.error(`${r}: this copy was not installed by npm, so npm cannot replace it. install it with: npm install -g ${s}`),process.exitCode=1;return}let v=await m({version:w.latest});console.log(v.message),v.ok||(process.exitCode=1);return}let U=process.argv.slice(2);if(U[0]==="preset"){let{runPresetCommand:s}=await import("./chunk-W2U7D5UF.js");process.exitCode=s(U.slice(1));return}let{expandFileReferences:we}=await import("./chunk-TSEKPGK4.js"),{isApprovalMode:be,setApprovalMode:ke,setDangerousBypass:xe,isDangerousBypass:ye}=await import("./chunk-7LAMZWB5.js"),{openSession:ve}=await import("./chunk-7NGP36QA.js");ke(t.approval&&be(t.approval)?t.approval:"full-auto");let{readWorkbenchSettings:Se}=await import("./chunk-V3R4FYTJ.js");if((t.dangerouslySkipPermissions||Se(f).skipPermissions)&&xe(!0),ye()&&console.error(`${r}: permission checks are OFF \u2014 critical commands (filesystem wipes, fork bombs, host shutdown) and the repeated-call guard are NOT enforced for this run. Turn it off with /settings, or by removing skipPermissions from settings.json.`),t.mode){let{serveProtocol:s}=await import("./chunk-R5LA6DL2.js");await s(t.mode,{cwd:p,model:t.model,thinking:t.thinking});return}let W=s=>ve({cwd:p,model:t.model,thinking:t.thinking,continueSession:s.continueSession??!1,noSession:s.noSession??!1,sessionPath:s.sessionPath,interactive:!t.print});if(t.resumeId&&!t.sessionPath){let s=j($,"sessions"),n=[];try{for(let m of Z(s))for(let u of Z(j(s,m))){if(!u.endsWith(".jsonl")||!u.includes(t.resumeId))continue;let w=j(s,m,u);try{n.push({path:w,mtime:Ae(w).mtimeMs})}catch{}}}catch{}if(n=n.sort((m,u)=>u.mtime-m.mtime),n.length===0){console.error(`${r}: no stored session matches '${t.resumeId}'. Run 'howtocode -c' to continue the latest one in this folder.`),process.exitCode=1;return}n.length>1&&console.error(`${r}: '${t.resumeId}' matches ${n.length} sessions; using the newest (${n[0].path}).`),t.sessionPath=n[0].path}let a=await W({continueSession:t.continueSession,sessionPath:t.sessionPath,noSession:t.noSession||t.print});if(t.print&&a.note&&console.error(a.note),t.maxBudgetUsd!==void 0&&!a.priced){console.error(`${r}: ${K(a.modelLabel,f)}`),await a.dispose(),process.exitCode=2;return}if(t.print){let s=t.prompt.trimStart();if(s.startsWith("/")){let b=s.slice(1).split(/\s+/)[0]??"",{skillInvocation:A}=await import("./chunk-L4XKIPIG.js"),S=a.session.resourceLoader.getSkills().skills.map(g=>g.name);if(!(A(s,S)!==void 0)){let{slashCommands:g}=await import("./chunk-OFKOOEKB.js");if(g(a.session).some(d=>d.name===b)){console.error(`${r}: /${b} runs in the TUI only \u2014 --print sends prompts straight to the model. Run \`howtocode\` without --print for interactive commands.`),await a.dispose(),process.exitCode=2;return}}}let n=t.outputFormat==="stream-json",m=t.outputFormat==="json",u=n||m;if(n){let b={type:"system",subtype:"init",cwd:p,session_id:a.session.sessionId,model:a.modelLabel,output_format:t.outputFormat,max_budget_usd:t.maxBudgetUsd??null,dangerously_skip_permissions:t.dangerouslySkipPermissions,cli_version:k};process.stdout.write(`${JSON.stringify(b)}
|
|
98
98
|
`)}let w,v,Ee=()=>{if(t.maxBudgetUsd===void 0||v!==void 0)return;let b=a.session.getSessionStats().cost;b>t.maxBudgetUsd&&(v={spent:b},a.session.abort())};try{let b,A=H();if(w=a.session.subscribe(d=>{if(n){let y=A.line(d);y!==void 0&&process.stdout.write(y)}if(d.type==="turn_end"&&d.message?.role==="assistant"){let y=d.message;y.stopReason==="error"||y.stopReason==="aborted"||y.errorMessage?b={stopReason:y.stopReason??"error",errorMessage:y.errorMessage}:b=void 0}Ee()}),await a.session.prompt(we(t.prompt,p)),n){let d=A.finish();d!==void 0&&process.stdout.write(d)}let S=L(a.session.getLastAssistantText()??"");if(v){if(console.error(`${r}: ${J(v.spent,t.maxBudgetUsd)}`),u){let d=a.session.getSessionStats();process.stdout.write(`${JSON.stringify({type:"result",subtype:"error_max_budget_usd",is_error:!0,result:S,session_id:a.session.sessionId,duration_ms:Math.round(performance.now()-l),num_turns:d.assistantMessages,total_cost_usd:d.cost,usage:{input_tokens:d.tokens.input,output_tokens:d.tokens.output,cache_read_input_tokens:d.tokens.cacheRead,cache_creation_input_tokens:d.tokens.cacheWrite}})}
|
|
99
99
|
`)}process.exitCode=1;return}let x=a.session.state.messages.at(-1),g=b??(x?.role==="assistant"&&(x.stopReason==="error"||x.stopReason==="aborted"||x.errorMessage)?{stopReason:x.stopReason??"error",errorMessage:x.errorMessage}:void 0);if(u){let d=a.session.getSessionStats();process.stdout.write(`${JSON.stringify({type:"result",subtype:g?g.stopReason==="aborted"?"error_aborted":"error_during_execution":"success",is_error:g!==void 0,result:S,session_id:a.session.sessionId,duration_ms:Math.round(performance.now()-l),num_turns:d.assistantMessages,total_cost_usd:d.cost,usage:{input_tokens:d.tokens.input,output_tokens:d.tokens.output,cache_read_input_tokens:d.tokens.cacheRead,cache_creation_input_tokens:d.tokens.cacheWrite},stop_reason:g?.stopReason??(x?.role==="assistant"?x.stopReason:void 0)})}
|
|
100
100
|
`)}else process.stdout.write(S.endsWith(`
|
|
101
101
|
`)?S:`${S}
|
|
102
|
-
`);if(g&&(process.exitCode=1,g.errorMessage)){console.error(`${r}: ${g.errorMessage}`);let d=G(g.errorMessage);d!==void 0&&console.error(`${r}: ${d}`)}}finally{w?.(),await a.dispose()}return}if(!process.stdin.isTTY||!process.stdout.isTTY){console.error(`${r}: interactive mode needs a terminal. use --print for pipes.`),await a.dispose(),process.exitCode=2;return}Ne();let{runWorkbench:$e}=await import("./chunk-
|
|
102
|
+
`);if(g&&(process.exitCode=1,g.errorMessage)){console.error(`${r}: ${g.errorMessage}`);let d=G(g.errorMessage);d!==void 0&&console.error(`${r}: ${d}`)}}finally{w?.(),await a.dispose()}return}if(!process.stdin.isTTY||!process.stdout.isTTY){console.error(`${r}: interactive mode needs a terminal. use --print for pipes.`),await a.dispose(),process.exitCode=2;return}Ne();let{runWorkbench:$e}=await import("./chunk-OFKOOEKB.js"),{autoUpdateEnabled:Pe,isInstalledCopy:_e}=await import("./chunk-LYLJZVZ7.js"),Ce=_e()&&Pe(`${f}/settings.json`);await $e({cwd:p,modelLabel:a.modelLabel,session:a.session,dispose:()=>a.dispose(),setCompressToolOutput:a.setCompressToolOutput,initialPrompt:t.prompt||void 0,note:a.note,maxBudgetUsd:t.maxBudgetUsd,update:Ce?{current:k,install:!0}:void 0,reopen:W})}Q(r);Ue().catch(l=>{F(r,void 0,l),process.exitCode=1});
|
package/package.json
CHANGED
package/dist/chunk-ABDZXFNM.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{a as A}from"./chunk-UTYFLLSM.js";import{existsSync as E,readFileSync as D}from"node:fs";import{dirname as _e,join as fe}from"node:path";import{fileURLToPath as Le}from"node:url";import{cpSync as z,existsSync as T,readdirSync as Ie,readFileSync as Re,renameSync as He,statSync as N,writeFileSync as je}from"node:fs";import{homedir as ce}from"node:os";import{join as g,resolve as Ne}from"node:path";import{cpSync as me,existsSync as S,mkdirSync as O,mkdtempSync as L,readdirSync as I,readFileSync as H,renameSync as ye,rmSync as b,statSync as x,writeFileSync as M}from"node:fs";import{tmpdir as q}from"node:os";import{dirname as V,isAbsolute as he,join as u,relative as be,resolve as C}from"node:path";import{fileURLToPath as Se}from"node:url";import{execFileSync as ke}from"node:child_process";import{createHash as X}from"node:crypto";import{gunzipSync as de}from"node:zlib";var k=512;function P(e,r,t){let s=e.subarray(r,r+t),n=s.indexOf(0);return s.subarray(0,n===-1?s.length:n).toString("utf8").trim()}function G(e,r,t){let s=P(e,r,t);if(!s)return 0;let n=Number.parseInt(s,8);return Number.isFinite(n)?n:0}function ge(e){let r={},t=0;for(;t<e.length;){let s=e.indexOf(32,t);if(s===-1)break;let n=Number.parseInt(e.toString("utf8",t,s),10);if(!Number.isFinite(n)||n<=0)break;let i=e.toString("utf8",s+1,t+n-1),o=i.indexOf("=");o>0&&(r[i.slice(0,o)]=i.slice(o+1)),t+=n}return r}function W(e){let r=de(e),t=[],s=0,n,i={};for(;s+k<=r.length;){let o=r.subarray(s,s+k);if(o.every(pe=>pe===0))break;let a=P(o,0,100),c=P(o,345,155),l=G(o,124,12),f=G(o,100,8),m=String.fromCharCode(o[156]??48),w=P(o,157,100),v=l>0?r.subarray(s+k,s+k+l):Buffer.alloc(0);if(s+=k+Math.ceil(l/k)*k,m==="x"||m==="g"){i=ge(v);continue}if(m==="L"){n=v.toString("utf8").replace(/\0.*$/s,"").trim();continue}let y=i.path??n??(c?`${c}/${a}`:a);n=void 0,i={};let p=y.indexOf("/");if(p===-1||(y=y.slice(p+1),y=y.replace(/\/+$/,""),!y))continue;let h=m==="5"?"directory":m==="2"?"symlink":m==="0"||m==="\0"||m===""?"file":"other";t.push({path:y,kind:h,size:l,mode:f&511,...h==="file"?{data:Buffer.from(v)}:{},...h==="symlink"?{link:w}:{}})}return t}function K(e){if(!e||e.startsWith("/")||e.startsWith("\\")||/^[a-zA-Z]:/.test(e))return!1;let r=e.replace(/\/+$/,"");return r?r.split("/").every(s=>s!==""&&s!=="."&&s!==".."):!1}function U(e,r){let t=`${r.replace(/\/+$/,"")}/`,s=[];for(let n of e){if(!n.path.startsWith(t))continue;let i=n.path.slice(t.length);i&&s.push({...n,path:i})}return s}function ve(){return u(d,"presets")}function Q(e){return u(e,".howtocode","presets")}function Y(e){return S(u(e,".disabled"))}function ee(){return u(V(Se(import.meta.url)),"presets")}function j(e){return[Q(e),ve()]}var re=/^[a-z0-9][a-z0-9-]*$/,xe=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;function _(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function $(e,r){let t=be(C(e),C(r));return t!==""&&!t.startsWith("..")&&!he(t)}function te(e,r){let t=[];if(!_(r))return["preset.json must be a JSON object"];let s=l=>{let f=r[l];return typeof f!="string"||f.trim()===""?(t.push(`${l} must be a non-empty string`),""):f.trim()},n=s("name");s("title"),s("description"),s("category");let i=s("version");n&&!re.test(n)&&t.push(`name "${n}" must be lowercase letters, digits and dashes`),i&&!xe.test(i)&&t.push(`version "${i}" is not a version like 1.0.0`);let o=r.skills;if(!Array.isArray(o)||o.length===0)t.push("skills must be a non-empty array of directory names");else for(let l of o){if(typeof l!="string"||l.trim()===""){t.push("every skills entry must be a non-empty string");continue}let f=u(e,"skills",l.trim());if(!$(u(e,"skills"),f)){t.push(`skill "${l}" escapes the preset directory`);continue}S(u(f,"SKILL.md"))||t.push(`skill "${l}" has no SKILL.md at ${u("skills",l)}`)}let a=r.prompt;if(a!==void 0)if(typeof a!="string"||a.trim()==="")t.push("prompt must be a non-empty string when present");else{let l=u(e,a.trim());$(e,l)?S(l)||t.push(`prompt file "${a}" does not exist`):t.push(`prompt "${a}" escapes the preset directory`)}let c=r.tags;return c!==void 0&&!Array.isArray(c)&&t.push("tags must be an array when present"),t.push(...Z(r.mcp)),t}function ne(e){let r=u(e,"preset.json");if(!S(r))return{problems:[`no preset.json in ${e}`]};let t;try{t=JSON.parse(H(r,"utf8"))}catch(o){return{problems:[`preset.json is not valid JSON: ${o instanceof Error?o.message:String(o)}`]}}let s=te(e,t);if(s.length>0)return{problems:s};let n=t,i=Array.isArray(n.tags)?n.tags.filter(o=>typeof o=="string"):[];return{problems:[],manifest:{name:String(n.name),title:String(n.title),description:String(n.description),category:String(n.category),tags:i,version:String(n.version),skills:n.skills.map(o=>String(o)),prompt:typeof n.prompt=="string"?n.prompt:void 0,mcp:n.mcp&&typeof n.mcp=="object"&&!Array.isArray(n.mcp)?n.mcp:void 0,integrates:typeof n.integrates=="string"&&n.integrates.trim()!==""?n.integrates.trim():void 0}}}function F(e){return e.filter(r=>{try{return x(r).isDirectory()}catch{return!1}})}function R(e,r){let t=[],s=[],n=(o,a)=>{if(!S(u(o,"preset.json")))return;let{manifest:c,problems:l}=ne(o);c?t.push({manifest:c,dir:o,source:r}):s.push(`${a}: ${l.join("; ")}`)},i;try{i=I(e).sort()}catch{return{entries:t,problems:s}}for(let o of i){if(o.startsWith("."))continue;let a=u(e,o);try{if(!x(a).isDirectory())continue}catch{continue}if(S(u(a,"preset.json"))){n(a,o);continue}let c;try{c=I(a).sort()}catch{continue}for(let l of c){if(l.startsWith("."))continue;let f=u(a,l);try{if(!x(f).isDirectory())continue}catch{continue}n(f,u(o,l))}}return{entries:t,problems:s}}function Qe(e){let r=R(ee(),"bundled"),t=[...r.entries],s=[...r.problems],n=new Map(t.map(i=>[i.manifest.name,i]));for(let i of F(j(e))){let o=R(i,"installed");s.push(...o.problems);for(let a of o.entries){let c=n.get(a.manifest.name);if(c){let l=t.indexOf(c);l>=0&&(t[l]=a),n.set(a.manifest.name,a)}else t.push(a),n.set(a.manifest.name,a)}}return{entries:t,problems:s}}function Ye(e){return[...new Set(e.map(r=>r.manifest.category))].sort()}function er(e,r){return e.filter(t=>t.manifest.category===r).sort((t,s)=>t.manifest.title.localeCompare(s.manifest.title))}function se(e){let r=[];for(let t of F(j(e))){let{entries:s}=R(t,"installed");for(let n of s)Y(n.dir)||r.push(u(n.dir,"skills"))}return r}function rr(e){let r=[];for(let t of F(j(e))){let{entries:s}=R(t,"installed");for(let n of s){if(Y(n.dir))continue;let i=n.manifest.prompt;if(!i)continue;let o=u(n.dir,i);if($(n.dir,o))try{let a=H(o,"utf8").trim();a&&r.push({name:n.manifest.name,title:n.manifest.title,text:a})}catch{}}}return r}function tr(e,r){let t=0;for(let s of r.skills)try{t+=x(u(e,"skills",s,"SKILL.md")).size}catch{}return t}function we(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)}var $e=".install.lock";function Ee(e,r){O(e,{recursive:!0});let t=u(e,$e),s=Date.now()+6e4;for(;;)try{M(t,`${process.pid}
|
|
2
|
-
`,{flag:"wx"});break}catch(n){if(n.code!=="EEXIST")throw n;let i=!1;try{i=Date.now()-x(t).mtimeMs>12e4}catch{continue}if(i){b(t,{force:!0});continue}if(Date.now()>s)throw new Error(`another install is holding ${t}; remove it if no install is running`);we(100)}try{for(let n of I(e))n.startsWith(".staging-")&&b(u(e,n),{recursive:!0,force:!0});return r()}finally{b(t,{force:!0})}}function ie(e,r,t){let s=u(r,t.name);return Ee(r,()=>{O(r,{recursive:!0});let n=L(u(r,".staging-"));try{me(e,n,{recursive:!0}),b(s,{recursive:!0,force:!0}),ye(n,s)}catch(i){throw b(n,{recursive:!0,force:!0}),i}return s})}function oe(e,r){if(!S(e))return{ok:!1,problems:[`no such directory: ${e}`]};let{manifest:t,problems:s}=ne(e);if(!t)return{ok:!1,problems:s};let n=ie(e,r,t);return{ok:!0,name:t.name,target:n,problems:[]}}function Ae(e,r){let t=L(u(q(),"howtocode-preset-"));try{return ke("git",["clone","--depth","1","--quiet",e,t],{stdio:"pipe"}),oe(t,r)}catch(s){return{ok:!1,problems:[`git clone failed: ${(s instanceof Error?s.message:String(s)).split(`
|
|
3
|
-
`)[0]}`]}}finally{b(t,{recursive:!0,force:!0})}}function nr(e,r){return/^(https?:\/\/|git@|git:\/\/)/.test(e)?Ae(e,r):oe(C(e),r)}function sr(e,r){let t=[],s=[];if(!re.test(e))return{removed:t,problems:[`"${e}" is not a preset name`]};for(let n of j(r)){let i=u(n,e);if(S(i)){if(!$(n,i)){s.push(`refusing to remove ${i}: outside ${n}`);continue}b(i,{recursive:!0,force:!0}),t.push(i)}}return t.length===0&&s.push(`"${e}" is not installed`),{removed:t,problems:s}}function ir(e){return Q(e)}function Pe(e){let r=[],t=(i,o)=>{for(let a of I(i,{withFileTypes:!0}).sort((c,l)=>c.name.localeCompare(l.name))){let c=u(i,a.name),l=o?`${o}/${a.name}`:a.name;a.isSymbolicLink()||(a.isDirectory()?t(c,l):a.isFile()&&r.push([l,X("sha256").update(H(c)).digest("hex")]))}};t(e,"");let s=0;for(let[i]of r)s+=x(u(e,i)).size;let n=r.map(([i,o])=>`${o} ${i}`).join(`
|
|
4
|
-
`);return{digest:X("sha256").update(n).digest("hex").slice(0,16),fileCount:r.length,bytes:s}}function or(){let e=u(ee(),"hub.json");try{let r=H(e,"utf8"),t=JSON.parse(r),s=_(t)&&Array.isArray(t.entries)?t.entries:[],n=[];for(let i of s)_(i)&&(typeof i.name!="string"||typeof i.repo!="string"||typeof i.sha!="string"||typeof i.path!="string"||typeof i.category!="string"||n.push({name:i.name,title:typeof i.title=="string"?i.title:i.name,description:typeof i.description=="string"?i.description:"",category:i.category,skill:typeof i.skill=="string"?i.skill:i.name,path:i.path,repo:i.repo,sha:i.sha,license:typeof i.license=="string"?i.license:"unknown",stars:typeof i.stars=="number"?i.stars:0,sizeKb:typeof i.sizeKb=="number"?i.sizeKb:0,...typeof i.digest=="string"?{digest:i.digest}:{},...typeof i.fileCount=="number"?{fileCount:i.fileCount}:{},...typeof i.modelInvocable=="boolean"?{modelInvocable:i.modelInvocable}:{}}));return{entries:n,problems:[]}}catch(r){return r?.code==="ENOENT"?{entries:[],problems:[]}:{entries:[],problems:[`registry unreadable: ${r instanceof Error?r.message:String(r)}`]}}}function ar(e){return[...new Set(e.map(r=>r.category))].sort()}function cr(e,r){return e.filter(t=>t.category===r).sort((t,s)=>s.stars-t.stars||t.name.localeCompare(s.name))}function lr(e,r){return e.find(t=>t.name===r)}function Oe(e){return`https://codeload.github.com/${e.repo}/tar.gz/${e.sha}`}async function ur(e,r,t=12e4){let s=L(u(q(),"howtocode-hub-"));try{let n=await fetch(Oe(e),{signal:AbortSignal.timeout(t),redirect:"follow"});if(!n.ok)return{ok:!1,problems:[`${e.repo}: HTTP ${n.status} from codeload`]};let i=Buffer.from(await n.arrayBuffer()),o=W(i),a=U(o,e.path).filter(p=>p.kind==="file"||p.kind==="directory");if(!a.some(p=>p.path==="SKILL.md"))return{ok:!1,problems:[`${e.repo}@${e.sha.slice(0,7)} has no ${e.path}/SKILL.md`]};let c=u(s,"preset",e.name),l=u(c,"skills",e.skill),f=0;for(let p of a){if(!K(p.path))return{ok:!1,problems:[`refusing unsafe path in archive: ${p.path}`]};let h=u(l,p.path);if(!$(l,h))return{ok:!1,problems:[`refusing path outside the skill: ${p.path}`]};if(p.kind==="directory"){O(h,{recursive:!0});continue}O(V(h),{recursive:!0}),M(h,p.data??Buffer.alloc(0)),f+=1}let m={name:e.name,title:e.title,description:e.description,category:e.category,version:"1.0.0",skills:[e.skill],source:`${e.repo}@${e.sha}`,license:e.license};if(M(u(c,"preset.json"),`${JSON.stringify(m,null,2)}
|
|
5
|
-
`),!e.digest)return{ok:!1,problems:[`${e.repo}@${e.sha.slice(0,7)}: registry entry has no digest`,"refusing to install; content cannot be verified against what was reviewed"]};let w=Pe(l);if(w.digest!==e.digest)return{ok:!1,problems:[`${e.repo}@${e.sha.slice(0,7)}: content changed under a pinned commit`,`expected ${e.digest} (${e.fileCount??"?"} files), got ${w.digest} (${w.fileCount} files)`,"refusing to install; the registry needs regenerating"]};let v=te(c,m);if(v.length>0)return{ok:!1,problems:v};let y=ie(c,r,m);return{ok:!0,name:e.name,target:y,problems:[],skill:e.skill,modelInvocable:e.modelInvocable}}catch(n){return{ok:!1,problems:[`download failed: ${(n instanceof Error?n.message:String(n)).split(`
|
|
6
|
-
`)[0]}`]}}finally{b(s,{recursive:!0,force:!0})}}function Te(){let e=(process.env.HOWTOCODE_HOME??process.env.HOWTOFIX_HOME??process.env.HOME??"").trim();return Ne(e||ce())}function le(e,r){for(let t of Ie(e)){let s=g(e,t),n=g(r,t);if(!T(n)){try{z(s,n,{recursive:!0,force:!1})}catch{}continue}let i=!1;try{i=N(s).isDirectory()}catch{continue}if(i&&N(n).isDirectory()){le(s,n);continue}try{let o=N(n).size,a=N(s).size;!i&&o<=2&&a>o&&z(s,n,{force:!0})}catch{}}}function De(e){let r=g(ce(),".howtofix");if(T(r)){if(!T(e))try{He(r,e);return}catch{try{z(r,e,{recursive:!0});return}catch{return}}le(r,e),Me(e)}}function Me(e){ae(g(e,"agent","models.json"),"providers"),ae(g(e,"agent","auth.json"),void 0)}function ae(e,r){if(!T(e))return;let t;try{t=JSON.parse(Re(e,"utf8"))}catch{return}let s=r?t[r]:t;if(!s||typeof s!="object")return;let n=!1;for(let[i,o]of Object.entries(s)){let a=i==="howtofix"?"howtocode":i==="howtofix-free"?"howtocode-free":i;a===i||s[a]!==void 0||(s[a]=o,delete s[i],n=!0)}if(n)try{je(e,`${JSON.stringify(t,null,2)}
|
|
7
|
-
`)}catch{}}var d=process.env.HOWTOCODE_CODING_AGENT_DIR?.trim()||process.env.HOWTOFIX_CODING_AGENT_DIR?.trim()||(()=>{let e=g(Te(),".howtocode");return De(e),g(e,"agent")})(),yr=g(d,"skills");function Ce(e){return g(e,".howtocode","skills")}function hr(e){let r=[Ce(e)];return r.push(...se(e)),r}var br=g(d,"agents"),Sr=g(d,"usage-cache.json"),kr=g(d,"reachable-models.json"),vr=g(d,"workflows");function xr(){process.env.HXF_CODING_AGENT_DIR=d}var wr=g(d,"images");function J(e=d){return fe(e,"mcp.json")}function Z(e){let r=[];if(e===void 0)return r;if(typeof e!="object"||e===null||Array.isArray(e))return["mcp must be an object of server names"];for(let[t,s]of Object.entries(e)){if(!/^[A-Za-z0-9_-]+$/.test(t)){r.push(`mcp server "${t}" must use only letters, digits, _ and -`);continue}if(typeof s!="object"||s===null||Array.isArray(s)){r.push(`mcp server "${t}" must be an object`);continue}let n=s,i=typeof n.command=="string"&&n.command.trim()!=="",o=typeof n.url=="string"&&n.url.trim()!=="";!i&&!o&&r.push(`mcp server "${t}" needs either a command or a url`),n.args!==void 0&&!Array.isArray(n.args)&&r.push(`mcp server "${t}": args must be an array`);for(let a of["env","headers"]){let c=n[a];if(c!==void 0){if(typeof c!="object"||c===null||Array.isArray(c)){r.push(`mcp server "${t}": ${a} must be an object of strings`);continue}for(let[l,f]of Object.entries(c))typeof f!="string"&&r.push(`mcp server "${t}": ${a}.${l} must be a string`)}}}return r}function B(e){if(!E(e))return{mcpServers:{}};try{let r=JSON.parse(D(e,"utf8"));if(!r||typeof r!="object"||Array.isArray(r))return{mcpServers:{}};let t=r.mcpServers;return!t||typeof t!="object"||Array.isArray(t)?{mcpServers:{}}:{mcpServers:t}}catch{return{mcpServers:{}}}}function Rr(e,r=d){let t=Object.keys(e);if(t.length===0)return{added:[],skipped:[],problems:[]};let s=J(r),n=[];if(E(s))try{JSON.parse(D(s,"utf8"))}catch{return{added:[],skipped:[],problems:[`${s} is not valid JSON; leaving it alone`]}}let i=B(s),o=[],a=[];for(let c of t){if(i.mcpServers[c]!==void 0){a.push(c);continue}i.mcpServers[c]=e[c],o.push(c)}if(o.length>0)try{A(s,`${JSON.stringify(i,null,2)}
|
|
8
|
-
`)}catch(c){return{added:[],skipped:a,problems:[`could not write ${s}: ${c instanceof Error?c.message:String(c)}`]}}return{added:o,skipped:a,problems:n}}function Hr(e,r=new Set,t=d){let s=J(t),n=[];if(e.length===0||!E(s))return{removed:[],kept:[],problems:n};let i=B(s),o=[],a=[];for(let c of e)if(i.mcpServers[c]!==void 0){if(r.has(c)){a.push(c);continue}delete i.mcpServers[c],o.push(c)}if(o.length>0)try{A(s,`${JSON.stringify(i,null,2)}
|
|
9
|
-
`)}catch(c){return{removed:[],kept:a,problems:[`could not write ${s}: ${c instanceof Error?c.message:String(c)}`]}}return{removed:o,kept:a,problems:n}}var ue="@netrodev/howtocode-roblox-bridge";function jr(e=d){let r=J(e);if(!E(r))return[];try{JSON.parse(D(r,"utf8"))}catch{return[]}let t=B(r),s=Object.keys(t.mcpServers).filter(n=>{let i=t.mcpServers[n];return[i.command,...Array.isArray(i.args)?i.args:[]].map(a=>String(a??"")).some(a=>a===ue||a.startsWith(`${ue}@`))});if(s.length===0)return[];for(let n of s)delete t.mcpServers[n];try{A(r,`${JSON.stringify(t,null,2)}
|
|
10
|
-
`)}catch{return[]}return s}function Nr(e){if(typeof e.url=="string"&&e.url)return`http: ${e.url}`;let r=typeof e.command=="string"?e.command:"",t=Array.isArray(e.args)?e.args.filter(s=>typeof s=="string"):[];return`stdio: ${[r,...t].join(" ")}`.trim()}function Fe(){return fe(_e(Le(import.meta.url)),"presets","mcp-hub.json")}function Tr(e=Fe()){let r=[];if(!E(e))return{entries:[],problems:[`no MCP catalogue at ${e}`]};let t;try{t=JSON.parse(D(e,"utf8"))}catch(i){return{entries:[],problems:[`${e} is not valid JSON: ${i instanceof Error?i.message:String(i)}`]}}let s=t?.entries;if(!Array.isArray(s))return{entries:[],problems:[`${e} has no entries array`]};let n=[];for(let i of s){if(typeof i!="object"||i===null||Array.isArray(i))continue;let o=i,a=typeof o.name=="string"?o.name.trim():"";if(!a){r.push("an entry has no name");continue}if(!/^[A-Za-z0-9_-]+$/.test(a)){r.push(`"${a}" is not a usable server name`);continue}let c=typeof o.command=="string"&&o.command.trim()!=="",l=typeof o.url=="string"&&o.url.trim()!=="";if(!c&&!l){r.push(`"${a}" has neither a command nor a url`);continue}n.push({name:a,title:typeof o.title=="string"?o.title:a,description:typeof o.description=="string"?o.description:"",category:typeof o.category=="string"?o.category:"other",preset:typeof o.preset=="string"?o.preset:void 0,command:typeof o.command=="string"?o.command:void 0,url:typeof o.url=="string"?o.url:void 0,args:Array.isArray(o.args)?o.args.filter(f=>typeof f=="string"):void 0,env:o.env&&typeof o.env=="object"&&!Array.isArray(o.env)?o.env:void 0,needs:Array.isArray(o.needs)?o.needs.filter(f=>typeof f=="string"):void 0,docs:typeof o.docs=="string"?o.docs:void 0})}return{entries:n,problems:r}}function Dr(e){return[...new Set(e.map(r=>r.category))].sort()}function Mr(e,r){return e.filter(t=>t.category===r).sort((t,s)=>t.title.localeCompare(s.title))}function Cr(e,r){return e.find(t=>t.name===r)}function _r(e){let r={};return e.command&&(r.command=e.command),e.url&&(r.url=e.url),e.args&&e.args.length>0&&(r.args=[...e.args]),e.env&&Object.keys(e.env).length>0&&(r.env={...e.env}),e.description&&(r.description=e.description),r}function Lr(e,r=process.env){return(e.needs??[]).filter(t=>!r[t])}export{J as a,Z as b,Rr as c,Hr as d,ue as e,jr as f,Nr as g,Fe as h,Tr as i,Dr as j,Mr as k,Cr as l,_r as m,Lr as n,Y as o,ee as p,te as q,ne as r,Qe as s,Ye as t,er as u,se as v,rr as w,tr as x,oe as y,nr as z,sr as A,ir as B,or as C,ar as D,cr as E,lr as F,ur as G,d as H,yr as I,Ce as J,hr as K,br as L,Sr as M,kr as N,vr as O,xr as P,wr as Q};
|