@herjarsa/omo-meta-governor 0.46.0 → 0.48.0

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/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import{createRequire as Fg}from"node:module";var jg=Object.defineProperty;var Ug=(e)=>e;function Lg(e,t){this[e]=Ug.bind(null,t)}var dt=(e,t)=>{for(var n in t)jg(e,n,{get:t[n],enumerable:!0,configurable:!0,set:Lg.bind(t,n)})};var We=(e,t,n)=>()=>{if(e)try{t=e(e=0)}catch(o){n=[o]}if(n)throw n[0];return t};var sx=Fg(import.meta.url);import{existsSync as No,mkdirSync as Zg,readFileSync as Gg,writeFileSync as Wg,unlinkSync as Hu,copyFileSync as Hg}from"node:fs";import{dirname as Vg,join as fe,resolve as Bg}from"node:path";import{homedir as qg}from"node:os";function Vu(){return Bg(qg(),".config","opencode")}function Qe(e){let t=e??Vu();return{log:fe(t,"meta-governor.log"),health:fe(t,"meta-governor-health.json"),selfVersionCache:fe(t,"omo-meta-governor-self-version-cache.json"),upgradeCheck:fe(t,"omo-meta-governor-upgrade-check.json"),cliAnythingUpgradeCheck:fe(t,"omo-cli-anything-upgrade-check.json")}}function ve(e){let t=e??Vu(),n=fe(t,"plugins","omo-meta-governor");return{pluginDir:n,logDir:fe(n,"log"),cacheDir:fe(n,"cache"),log:fe(n,"log","meta-governor.log"),health:fe(n,"health.json"),selfVersionCache:fe(n,"cache","self-version.json"),upgradeCheck:fe(n,"cache","upgrade-check.json"),cliAnythingUpgradeCheck:fe(n,"cache","cli-anything-upgrade-check.json"),instructions:fe(n,"instructions.md"),config:fe(n,"config.json")}}function et(e){let t=[],n=[],o=[[e.oldPaths.log,e.newPaths.log],[e.oldPaths.health,e.newPaths.health],[e.oldPaths.selfVersionCache,e.newPaths.selfVersionCache],[e.oldPaths.upgradeCheck,e.newPaths.upgradeCheck],[e.oldPaths.cliAnythingUpgradeCheck,e.newPaths.cliAnythingUpgradeCheck]];for(let[r,i]of o){if(!No(r)){n.push(r);continue}if(No(i)){try{Hu(r),t.push(r)}catch{n.push(r)}continue}try{Zg(Vg(i),{recursive:!0}),Hg(r,i),Hu(r),t.push(r)}catch{n.push(r)}}return{migrated:t,skipped:n}}function Jg(e){if(!No(e))return{exists:!1};try{let t=Gg(e,"utf8"),n=Kg(t),o=JSON.parse(n);return{exists:!0,raw:t,data:o}}catch(t){return{exists:!0,error:t instanceof Error?t.message:String(t)}}}function Kg(e){let t="",n=0,o=!1,r="",i=!1;while(n<e.length){let s=e[n],a=e[n+1];if(o){if(t+=s,i)i=!1;else if(s==="\\")i=!0;else if(s===r)o=!1;n++;continue}if(s==='"'||s==="'"){o=!0,r=s,t+=s,n++;continue}if(s==="/"&&a==="/"){while(n<e.length&&e[n]!==`
2
- `)n++;continue}if(s==="/"&&a==="*"){n+=2;while(n<e.length&&!(e[n]==="*"&&e[n+1]==="/"))n++;n+=2;continue}t+=s,n++}return t}function dx(e,t){let n=Jg(e);if(!n.exists)return{changed:!1,wrote:!1,error:"file not found"};if(n.error||!n.data)return{changed:!1,wrote:!1,error:n.error??"parse error"};let o=n.data,r=o.instructions,i;if(r===void 0)i=[t],o.instructions=i;else if(Array.isArray(r)){if(r.includes(t))return{changed:!1,wrote:!1};r.push(t),i=r}else return{changed:!1,wrote:!1,error:"instructions is not an array"};try{let s=JSON.stringify(o,null,2)+`
3
- `;return Wg(e,s,"utf8"),{changed:!0,wrote:!0}}catch(s){return{changed:!1,wrote:!1,error:s instanceof Error?s.message:String(s)}}}var Bt=()=>{};import{spawn as Xg,spawnSync as mt}from"node:child_process";function Bu(e){try{let t=mt("pgrep",["-P",String(e)],{encoding:"utf8"});for(let n of t.stdout.trim().split(/\s+/)){let o=Number(n);if(!o)continue;Bu(o);try{process.kill(o,"SIGKILL")}catch{}}}catch{}}function pt(e){if(!e||e<=0)return;try{if(process.platform==="win32")mt("taskkill",["/pid",String(e),"/T","/F"],{stdio:"ignore"});else{try{process.kill(-e,"SIGKILL")}catch{}Bu(e);try{process.kill(e,"SIGKILL")}catch{}}}catch{}}function Yg(e){if(!e||e<=0)return!1;try{return process.kill(e,0),!0}catch(t){if(t.code==="ESRCH")return!1;return!0}}function Uo(e){if(e&&e>0)Vr.add(e)}function Br(e){Vr.delete(e)}function qr(){let e=0;for(let t of Vr)if(Yg(t))pt(t),e++;return Vr.clear(),e}function Jr(e,t,n){return new Promise((o)=>{let r;try{r=Xg(e,t,{cwd:n.cwd,stdio:["ignore","pipe","pipe"],shell:process.platform==="win32",windowsHide:!0,env:{...process.env,OMO_MG_SPAWN:"1",...n.env}})}catch{o({stdout:"",stderr:"",code:null,timedOut:!1});return}Uo(r.pid);let i="",s="",a=!1,l=!1,c,u=(g)=>{if(l)return;if(l=!0,clearTimeout(f),c)clearTimeout(c);Br(r.pid),o(g)},f=setTimeout(()=>{a=!0,pt(r.pid),c=setTimeout(()=>{u({stdout:i,stderr:s,code:null,timedOut:!0})},2000)},n.timeoutMs);r.stdout?.on("data",(g)=>{i+=g.toString("utf8")}),r.stderr?.on("data",(g)=>{s+=g.toString("utf8")}),r.on("error",()=>{u({stdout:i,stderr:s,code:null,timedOut:a})}),r.on("close",(g)=>{if(r.exitCode===null)pt(r.pid);u({stdout:i,stderr:s,code:g,timedOut:a})})})}function ne(e,t,n){let o=Date.now(),r;try{r=mt(e,t,{cwd:n.cwd,stdio:["ignore","pipe","pipe"],shell:process.platform==="win32",windowsHide:!0,env:{...process.env,OMO_MG_SPAWN:"1",...n.env},timeout:n.timeoutMs})}catch{return{stdout:"",stderr:"",code:null,timedOut:!1}}let i=Date.now()-o,s=r.error!=null&&r.error.code==="ETIMEDOUT"||r.signal==="SIGTERM"||i>=n.timeoutMs-50;if(s&&r.pid)pt(r.pid);return{stdout:(r.stdout??"").toString("utf8"),stderr:(r.stderr??"").toString("utf8"),code:r.status,timedOut:s}}function It(){let e=0;try{if(process.platform==="win32"){for(let t of["graphify.exe","codegraph.exe"])try{mt("taskkill",["/IM",t,"/F"],{stdio:"ignore"})}catch{}try{if(mt("powershell",["-NoProfile","-Command","Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -match 'OMO_MG_WATCH|OMO_MG_SPAWN' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue }"],{stdio:"ignore"}).status===0)e=1}catch{}}else{for(let t of["graphify","codegraph"])try{mt("pkill",["-x",t],{stdio:"ignore"})}catch{}try{mt("pkill",["-f","OMO_MG_WATCH|OMO_MG_SPAWN"],{stdio:"ignore"})}catch{}}}catch{}return e}function Lo(){if(jo)return!1;jo=!0;let e=()=>{try{qr()}catch{}try{It()}catch{}};qt.push({event:"exit",fn:e}),process.on("exit",e);let t=(o)=>{e();let r=o==="SIGINT"?130:o==="SIGTERM"?143:o==="SIGHUP"?129:1;process.exit(r)};qt.push({event:"SIGINT",fn:t}),qt.push({event:"SIGTERM",fn:t}),qt.push({event:"SIGHUP",fn:t}),process.on("SIGINT",t),process.on("SIGTERM",t),process.on("SIGHUP",t);let n=()=>{e()};return qt.push({event:"beforeExit",fn:n}),process.on("beforeExit",n),!0}function fx(){return jo}var Vr,qt,jo=!1;var Kr=We(()=>{Vr=new Set;qt=[]});import{appendFileSync as Qg,mkdirSync as eh,statSync as th,renameSync as rh,existsSync as qu,unlinkSync as nh}from"node:fs";import{dirname as oh}from"node:path";function Ku(e){let t=e;for(let n of ih)t=t.replace(n,"[REDACTED]");return t}function Fo(e,t=new WeakSet){if(typeof e==="string")return Ku(e);if(Array.isArray(e)){if(t.has(e))return"[Circular]";return t.add(e),e.map((n)=>Fo(n,t))}if(e&&typeof e==="object"){if(t.has(e))return"[Circular]";t.add(e);let n={};for(let[o,r]of Object.entries(e))if(sh.test(o))n[o]="[REDACTED]";else try{n[o]=Fo(r,t)}catch{n[o]="[unserializable]"}return n}return e}function lh(){try{eh(oh(Ne),{recursive:!0})}catch{}}function ch(){if(!qu(Ne))return;try{if(th(Ne).size<ah)return}catch{return}for(let e=Ju;e>=1;e--){let t=e===1?Ne:`${Ne}.${e-1}`,n=`${Ne}.${e}`;if(qu(t))try{if(e===Ju)nh(t);else rh(t,n)}catch{}}}function uh(e,t,n,o,r){lh(),ch();let i=Ku(t),s=n!==void 0?Fo(n):void 0,a={timestamp:new Date().toISOString(),level:e,message:i,...o?{event:o}:{},...r?{sessionID:r}:{},...s!==void 0?{data:s}:{}},l;try{l=JSON.stringify(a)+`
1
+ import{createRequire as Zg}from"node:module";var Lg=Object.defineProperty;var Fg=(e)=>e;function Gg(e,t){this[e]=Fg.bind(null,t)}var dt=(e,t)=>{for(var n in t)Lg(e,n,{get:t[n],enumerable:!0,configurable:!0,set:Gg.bind(t,n)})};var We=(e,t,n)=>()=>{if(e)try{t=e(e=0)}catch(i){n=[i]}if(n)throw n[0];return t};var dx=Zg(import.meta.url);import{existsSync as Mi,mkdirSync as Wg,readFileSync as Hg,writeFileSync as Vg,unlinkSync as Hu,copyFileSync as Bg}from"node:fs";import{dirname as qg,join as fe,resolve as Jg}from"node:path";import{homedir as Kg}from"node:os";function Vu(){return Jg(Kg(),".config","opencode")}function Qe(e){let t=e??Vu();return{log:fe(t,"meta-governor.log"),health:fe(t,"meta-governor-health.json"),selfVersionCache:fe(t,"omo-meta-governor-self-version-cache.json"),upgradeCheck:fe(t,"omo-meta-governor-upgrade-check.json"),cliAnythingUpgradeCheck:fe(t,"omo-cli-anything-upgrade-check.json")}}function ve(e){let t=e??Vu(),n=fe(t,"plugins","omo-meta-governor");return{pluginDir:n,logDir:fe(n,"log"),cacheDir:fe(n,"cache"),log:fe(n,"log","meta-governor.log"),health:fe(n,"health.json"),selfVersionCache:fe(n,"cache","self-version.json"),upgradeCheck:fe(n,"cache","upgrade-check.json"),cliAnythingUpgradeCheck:fe(n,"cache","cli-anything-upgrade-check.json"),instructions:fe(n,"instructions.md"),config:fe(n,"config.json")}}function et(e){let t=[],n=[],i=[[e.oldPaths.log,e.newPaths.log],[e.oldPaths.health,e.newPaths.health],[e.oldPaths.selfVersionCache,e.newPaths.selfVersionCache],[e.oldPaths.upgradeCheck,e.newPaths.upgradeCheck],[e.oldPaths.cliAnythingUpgradeCheck,e.newPaths.cliAnythingUpgradeCheck]];for(let[r,o]of i){if(!Mi(r)){n.push(r);continue}if(Mi(o)){try{Hu(r),t.push(r)}catch{n.push(r)}continue}try{Wg(qg(o),{recursive:!0}),Bg(r,o),Hu(r),t.push(r)}catch{n.push(r)}}return{migrated:t,skipped:n}}function Xg(e){if(!Mi(e))return{exists:!1};try{let t=Hg(e,"utf8"),n=Yg(t),i=JSON.parse(n);return{exists:!0,raw:t,data:i}}catch(t){return{exists:!0,error:t instanceof Error?t.message:String(t)}}}function Yg(e){let t="",n=0,i=!1,r="",o=!1;while(n<e.length){let s=e[n],a=e[n+1];if(i){if(t+=s,o)o=!1;else if(s==="\\")o=!0;else if(s===r)i=!1;n++;continue}if(s==='"'||s==="'"){i=!0,r=s,t+=s,n++;continue}if(s==="/"&&a==="/"){while(n<e.length&&e[n]!==`
2
+ `)n++;continue}if(s==="/"&&a==="*"){n+=2;while(n<e.length&&!(e[n]==="*"&&e[n+1]==="/"))n++;n+=2;continue}t+=s,n++}return t}function hx(e,t){let n=Xg(e);if(!n.exists)return{changed:!1,wrote:!1,error:"file not found"};if(n.error||!n.data)return{changed:!1,wrote:!1,error:n.error??"parse error"};let i=n.data,r=i.instructions,o;if(r===void 0)o=[t],i.instructions=o;else if(Array.isArray(r)){if(r.includes(t))return{changed:!1,wrote:!1};r.push(t),o=r}else return{changed:!1,wrote:!1,error:"instructions is not an array"};try{let s=JSON.stringify(i,null,2)+`
3
+ `;return Vg(e,s,"utf8"),{changed:!0,wrote:!0}}catch(s){return{changed:!1,wrote:!1,error:s instanceof Error?s.message:String(s)}}}var Bt=()=>{};import{spawn as Qg,spawnSync as mt}from"node:child_process";function Bu(e){try{let t=mt("pgrep",["-P",String(e)],{encoding:"utf8"});for(let n of t.stdout.trim().split(/\s+/)){let i=Number(n);if(!i)continue;Bu(i);try{process.kill(i,"SIGKILL")}catch{}}}catch{}}function pt(e){if(!e||e<=0)return;try{if(process.platform==="win32")mt("taskkill",["/pid",String(e),"/T","/F"],{stdio:"ignore"});else{try{process.kill(-e,"SIGKILL")}catch{}Bu(e);try{process.kill(e,"SIGKILL")}catch{}}}catch{}}function eh(e){if(!e||e<=0)return!1;try{return process.kill(e,0),!0}catch(t){if(t.code==="ESRCH")return!1;return!0}}function ji(e){if(e&&e>0)Vr.add(e)}function Br(e){Vr.delete(e)}function qr(){let e=0;for(let t of Vr)if(eh(t))pt(t),e++;return Vr.clear(),e}function Jr(e,t,n){return new Promise((i)=>{let r;try{r=Qg(e,t,{cwd:n.cwd,stdio:["ignore","pipe","pipe"],shell:process.platform==="win32",windowsHide:!0,env:{...process.env,OMO_MG_SPAWN:"1",...n.env}})}catch{i({stdout:"",stderr:"",code:null,timedOut:!1});return}ji(r.pid);let o="",s="",a=!1,l=!1,c,u=(g)=>{if(l)return;if(l=!0,clearTimeout(f),c)clearTimeout(c);Br(r.pid),i(g)},f=setTimeout(()=>{a=!0,pt(r.pid),c=setTimeout(()=>{u({stdout:o,stderr:s,code:null,timedOut:!0})},2000)},n.timeoutMs);r.stdout?.on("data",(g)=>{o+=g.toString("utf8")}),r.stderr?.on("data",(g)=>{s+=g.toString("utf8")}),r.on("error",()=>{u({stdout:o,stderr:s,code:null,timedOut:a})}),r.on("close",(g)=>{if(r.exitCode===null)pt(r.pid);u({stdout:o,stderr:s,code:g,timedOut:a})})})}function ne(e,t,n){let i=Date.now(),r;try{r=mt(e,t,{cwd:n.cwd,stdio:["ignore","pipe","pipe"],shell:process.platform==="win32",windowsHide:!0,env:{...process.env,OMO_MG_SPAWN:"1",...n.env},timeout:n.timeoutMs})}catch{return{stdout:"",stderr:"",code:null,timedOut:!1}}let o=Date.now()-i,s=r.error!=null&&r.error.code==="ETIMEDOUT"||r.signal==="SIGTERM"||o>=n.timeoutMs-50;if(s&&r.pid)pt(r.pid);return{stdout:(r.stdout??"").toString("utf8"),stderr:(r.stderr??"").toString("utf8"),code:r.status,timedOut:s}}function It(){let e=0;try{if(process.platform==="win32"){for(let t of["graphify.exe","codegraph.exe"])try{mt("taskkill",["/IM",t,"/F"],{stdio:"ignore"})}catch{}try{if(mt("powershell",["-NoProfile","-Command","Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -match 'OMO_MG_WATCH|OMO_MG_SPAWN' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue }"],{stdio:"ignore"}).status===0)e=1}catch{}}else{for(let t of["graphify","codegraph"])try{mt("pkill",["-x",t],{stdio:"ignore"})}catch{}try{mt("pkill",["-f","OMO_MG_WATCH|OMO_MG_SPAWN"],{stdio:"ignore"})}catch{}}}catch{}return e}function Ui(){if(Ni)return!1;Ni=!0;let e=()=>{try{qr()}catch{}try{It()}catch{}};qt.push({event:"exit",fn:e}),process.on("exit",e);let t=(i)=>{e();let r=i==="SIGINT"?130:i==="SIGTERM"?143:i==="SIGHUP"?129:1;process.exit(r)};qt.push({event:"SIGINT",fn:t}),qt.push({event:"SIGTERM",fn:t}),qt.push({event:"SIGHUP",fn:t}),process.on("SIGINT",t),process.on("SIGTERM",t),process.on("SIGHUP",t);let n=()=>{e()};return qt.push({event:"beforeExit",fn:n}),process.on("beforeExit",n),!0}function bx(){return Ni}var Vr,qt,Ni=!1;var Kr=We(()=>{Vr=new Set;qt=[]});import{appendFileSync as th,mkdirSync as rh,statSync as nh,renameSync as ih,existsSync as qu,unlinkSync as oh}from"node:fs";import{dirname as sh}from"node:path";function Ku(e){let t=e;for(let n of ah)t=t.replace(n,"[REDACTED]");return t}function Li(e,t=new WeakSet){if(typeof e==="string")return Ku(e);if(Array.isArray(e)){if(t.has(e))return"[Circular]";return t.add(e),e.map((n)=>Li(n,t))}if(e&&typeof e==="object"){if(t.has(e))return"[Circular]";t.add(e);let n={};for(let[i,r]of Object.entries(e))if(lh.test(i))n[i]="[REDACTED]";else try{n[i]=Li(r,t)}catch{n[i]="[unserializable]"}return n}return e}function uh(){try{rh(sh(Ne),{recursive:!0})}catch{}}function dh(){if(!qu(Ne))return;try{if(nh(Ne).size<ch)return}catch{return}for(let e=Ju;e>=1;e--){let t=e===1?Ne:`${Ne}.${e-1}`,n=`${Ne}.${e}`;if(qu(t))try{if(e===Ju)oh(t);else ih(t,n)}catch{}}}function mh(e,t,n,i,r){uh(),dh();let o=Ku(t),s=n!==void 0?Li(n):void 0,a={timestamp:new Date().toISOString(),level:e,message:o,...i?{event:i}:{},...r?{sessionID:r}:{},...s!==void 0?{data:s}:{}},l;try{l=JSON.stringify(a)+`
4
4
  `}catch{l=JSON.stringify({timestamp:a.timestamp,level:e,message:t,data:"[unserializable]"})+`
5
- `}try{Qg(Ne,l)}catch{}if(e==="error")console.error(`[meta-governor] ${t}`)}function x(e,t,n){uh(e,t,n)}var ih,sh,Ne,ah=10485760,Ju=5;var ft=We(()=>{Bt();ih=[/eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/g,/sk-(?:proj-|svc-|)[a-zA-Z0-9]{20,}/g,/pk-[a-zA-Z0-9]{20,}/g,/ghp_[a-zA-Z0-9]{36,}/g,/ghs_[a-zA-Z0-9]{36,}/g,/github_pat_[a-zA-Z0-9]{22,}/g,/Bearer\s+[a-zA-Z0-9_\-]{20,}/gi,/(?:key|secret|token|password|credential|private_key)\s*[:=]\s*['"]?[a-zA-Z0-9_\-]{16,}/gi],sh=/^(?:key|secret|token|password|credential|private_key|api[_-]?key|access[_-]?token|auth[_-]?token)$/i;try{et({oldPaths:Qe(),newPaths:ve()})}catch{}Ne=ve().log});import{execSync as gt,spawn as Xu}from"node:child_process";import{access as wx,stat as sd}from"node:fs/promises";import{resolve as Zo,join as dh}from"node:path";async function Yu(e,t=60000,n){let o=["i","-D","@colbymchenry/codegraph"];if(n)try{return n(`npm ${o.join(" ")}`,{cwd:e,stdio:"ignore",timeout:t}),"codegraph-installed"}catch{return"codegraph-install-failed"}return ne("npm",o,{cwd:e,timeoutMs:t}).code===0?"codegraph-installed":"codegraph-install-failed"}async function Qu(e=60000,t){if(t)try{return t("pip install --upgrade graphifyy --break-system-packages --quiet",{stdio:"ignore",timeout:e}),"graphify-installed"}catch{try{return t("uv tool install --upgrade graphifyy --quiet",{stdio:"ignore",timeout:e}),"graphify-installed"}catch{return"graphify-install-failed"}}if(ne("pip",["install","--upgrade","graphifyy","--break-system-packages","--quiet"],{timeoutMs:e}).code===0)return"graphify-installed";return ne("uv",["tool","install","--upgrade","graphifyy","--quiet"],{timeoutMs:e}).code===0?"graphify-installed":"graphify-install-failed"}function Ix(){Go.clear()}async function td(e,t=gt){let n=!1,o=!1,r=await nd(Zo(e,".codegraph","codegraph.db")),i=await nd(Zo(e,"graphify-out","graph.json")),s=(a,l)=>{if(t!==gt)return t(a,{stdio:"ignore",...l});let c=a.split(" "),u=c[0],f=c.slice(1),g=ne(u,f,{cwd:l?.cwd??e,timeoutMs:l?.timeout??1e4});if(g.code!==0)throw Error(`exit ${g.code}`)};try{s("npx --yes codegraph --version",{timeout:1e4}),n=!0}catch{try{s("node node_modules/.bin/codegraph --version",{cwd:e,timeout:5000}),n=!0}catch{}}try{s("graphify --version",{timeout:5000}),o=!0}catch{try{s("graphifyy --version",{timeout:5000}),o=!0}catch{try{s('python -c "import graphifyy"',{timeout:5000}),o=!0}catch{try{s('python3 -c "import graphifyy"',{timeout:5000}),o=!0}catch{}}}}return{codegraph:n,graphify:o,codegraphIndexExists:r,graphifyIndexExists:i}}async function mh(e,t=60000,n=gt){try{if(n!==gt)n("npx --yes codegraph init",{cwd:e,stdio:"ignore",timeout:t});else{let o=ne("npx",["--yes","codegraph","init"],{cwd:e,timeoutMs:t});if(o.code!==0)throw Error(`exit ${o.code}`)}return!0}catch{return!1}}async function ph(e,t=120000,n=gt){let o=[{bin:"graphify",args:[".","--no-viz"]},{bin:"python",args:["-m","graphify",".","--no-viz"]},{bin:"python3",args:["-m","graphify",".","--no-viz"]}];for(let r of o)try{if(n!==gt)n(`${r.bin} ${r.args.join(" ")}`,{cwd:e,stdio:"ignore",timeout:t});else{let i=ne(r.bin,r.args,{cwd:e,timeoutMs:t});if(i.code!==0)throw Error(`exit ${i.code}`)}return!0}catch{}return!1}function rd(e,t){let n=`${e}:${t}`;if(Jt.has(n))return;try{let o;if(t==="codegraph")o=Xu("node",["-e",`
5
+ `}try{th(Ne,l)}catch{}if(e==="error")console.error(`[meta-governor] ${t}`)}function S(e,t,n){mh(e,t,n)}var ah,lh,Ne,ch=10485760,Ju=5;var ft=We(()=>{Bt();ah=[/eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/g,/sk-(?:proj-|svc-|)[a-zA-Z0-9]{20,}/g,/pk-[a-zA-Z0-9]{20,}/g,/ghp_[a-zA-Z0-9]{36,}/g,/ghs_[a-zA-Z0-9]{36,}/g,/github_pat_[a-zA-Z0-9]{22,}/g,/Bearer\s+[a-zA-Z0-9_\-]{20,}/gi,/(?:key|secret|token|password|credential|private_key)\s*[:=]\s*['"]?[a-zA-Z0-9_\-]{16,}/gi],lh=/^(?:key|secret|token|password|credential|private_key|api[_-]?key|access[_-]?token|auth[_-]?token)$/i;try{et({oldPaths:Qe(),newPaths:ve()})}catch{}Ne=ve().log});import{execSync as gt,spawn as Xu}from"node:child_process";import{access as Tx,stat as sd}from"node:fs/promises";import{resolve as Fi,join as ph}from"node:path";async function Yu(e,t=60000,n){let i=["i","-D","@colbymchenry/codegraph"];if(n)try{return n(`npm ${i.join(" ")}`,{cwd:e,stdio:"ignore",timeout:t}),"codegraph-installed"}catch{return"codegraph-install-failed"}return ne("npm",i,{cwd:e,timeoutMs:t}).code===0?"codegraph-installed":"codegraph-install-failed"}async function Qu(e=60000,t){if(t)try{return t("pip install --upgrade graphifyy --break-system-packages --quiet",{stdio:"ignore",timeout:e}),"graphify-installed"}catch{try{return t("uv tool install --upgrade graphifyy --quiet",{stdio:"ignore",timeout:e}),"graphify-installed"}catch{return"graphify-install-failed"}}if(ne("pip",["install","--upgrade","graphifyy","--break-system-packages","--quiet"],{timeoutMs:e}).code===0)return"graphify-installed";return ne("uv",["tool","install","--upgrade","graphifyy","--quiet"],{timeoutMs:e}).code===0?"graphify-installed":"graphify-install-failed"}function Ex(){Gi.clear()}async function td(e,t=gt){let n=!1,i=!1,r=await nd(Fi(e,".codegraph","codegraph.db")),o=await nd(Fi(e,"graphify-out","graph.json")),s=(a,l)=>{if(t!==gt)return t(a,{stdio:"ignore",...l});let c=a.split(" "),u=c[0],f=c.slice(1),g=ne(u,f,{cwd:l?.cwd??e,timeoutMs:l?.timeout??1e4});if(g.code!==0)throw Error(`exit ${g.code}`)};try{s("npx --yes codegraph --version",{timeout:1e4}),n=!0}catch{try{s("node node_modules/.bin/codegraph --version",{cwd:e,timeout:5000}),n=!0}catch{}}try{s("graphify --version",{timeout:5000}),i=!0}catch{try{s("graphifyy --version",{timeout:5000}),i=!0}catch{try{s('python -c "import graphifyy"',{timeout:5000}),i=!0}catch{try{s('python3 -c "import graphifyy"',{timeout:5000}),i=!0}catch{}}}}return{codegraph:n,graphify:i,codegraphIndexExists:r,graphifyIndexExists:o}}async function fh(e,t=60000,n=gt){try{if(n!==gt)n("npx --yes codegraph init",{cwd:e,stdio:"ignore",timeout:t});else{let i=ne("npx",["--yes","codegraph","init"],{cwd:e,timeoutMs:t});if(i.code!==0)throw Error(`exit ${i.code}`)}return!0}catch{return!1}}async function gh(e,t=120000,n=gt){let i=[{bin:"graphify",args:[".","--no-viz"]},{bin:"python",args:["-m","graphify",".","--no-viz"]},{bin:"python3",args:["-m","graphify",".","--no-viz"]}];for(let r of i)try{if(n!==gt)n(`${r.bin} ${r.args.join(" ")}`,{cwd:e,stdio:"ignore",timeout:t});else{let o=ne(r.bin,r.args,{cwd:e,timeoutMs:t});if(o.code!==0)throw Error(`exit ${o.code}`)}return!0}catch{}return!1}function rd(e,t){let n=`${e}:${t}`;if(Jt.has(n))return;try{let i;if(t==="codegraph")i=Xu("node",["-e",`
6
6
  const OMO_MG_WATCH = 1;
7
7
  const {spawn} = require("child_process");
8
8
  const run = () => {
@@ -18,25 +18,25 @@ import{createRequire as Fg}from"node:module";var jg=Object.defineProperty;var Ug
18
18
  };
19
19
  run();
20
20
  setInterval(run, 30_000);
21
- `],{stdio:"ignore",detached:!0,shell:!1,env:{...process.env,OMO_MG_SPAWN:"1"}});else o=Xu("python3",["-m","graphify",".","--no-viz","--watch"],{cwd:e,stdio:"ignore",detached:!0,shell:!1,env:{...process.env,OMO_MG_SPAWN:"1"}});o.unref(),Jt.set(n,{process:o,tool:t}),Uo(o.pid),o.on("exit",()=>{Jt.delete(n),Br(o.pid)})}catch{}}function Vo(e){for(let[t,n]of Jt)if(!e||t.startsWith(e)){let o=n.process.pid;if(o)Br(o);if(process.platform==="win32")pt(o);else{try{n.process.kill("SIGTERM")}catch{}setTimeout(()=>{pt(o)},2000).unref()}Jt.delete(t)}}async function Yr(e={enabled:!0,watch:!1,autoInstall:!0,installTimeoutMs:60000}){let t=[],n=e.projectDir??process.cwd();if(!e.enabled)return{attempted:!1,codes:["disabled"],availability:{codegraph:!1,graphify:!1,codegraphIndexExists:!1,graphifyIndexExists:!1},alreadyInitialized:!1};if(e.killOrphanedOnInit!==!1&&!ed){ed=!0;let r=It();Wo("info","orphan sweep: killed "+r+" leftover tool processes")}if(Go.has(n)){let r=await td(n,e.runner);return{attempted:!1,codes:r.codegraphIndexExists?["codegraph-already-exists"]:[],availability:r,alreadyInitialized:!0}}Go.add(n);let o;try{o=await td(n,e.runner)}catch{return{attempted:!1,codes:["error"],availability:{codegraph:!1,graphify:!1,codegraphIndexExists:!1,graphifyIndexExists:!1},alreadyInitialized:!1}}if(e.autoUpgrade!==!1)try{let r=e.upgradeCachePath??gh(),i=await hh(r),s=e.upgradeCheckTtlMs??86400000,a={codegraph:null,graphify:null},l=async(c)=>{let u=c==="codegraph"?"codegraphLatest":"graphifyLatest";if(ad(i,s)&&i?.[u])return i[u];let g=await(c==="codegraph"?yh:bh)();return a[c]=g,g};if(o.codegraph){let c=await id(e.runner),u=await l("codegraph");if(od(c,u,i,s,"codegraphLatest")){if(u&&Ho(c,u)){if(await Yu(n,e.installTimeoutMs??60000,e.runner)==="codegraph-installed"){if(t.push("codegraph-upgraded"),await id(e.runner)==null)t.push("codegraph-upgrade-broken")}}}}if(o.graphify){let c=await _h(e.runner),u=await l("graphify");if(od(c,u,i,s,"graphifyLatest")){if(u&&Ho(c,u)){if(await Qu(e.installTimeoutMs??60000,e.runner)==="graphify-installed")t.push("graphify-upgraded")}}if(e.checkGraphifyNeedsUpdate!==!1)try{if((e.runner?(()=>{try{return e.runner("graphify check-update "+n,{cwd:n,stdio:"ignore",timeout:1e4}),{code:0,stdout:"",stderr:""}}catch{return{code:1,stdout:"",stderr:"runner rejected"}}})():ne("graphify",["check-update",n],{cwd:n,timeoutMs:1e4})).code!==0){if(e.runner)try{e.runner("graphify update "+n+" --no-cluster",{cwd:n,stdio:"ignore",timeout:e.installTimeoutMs??60000})}catch{}else ne("graphify",["update",n,"--no-cluster"],{cwd:n,timeoutMs:e.installTimeoutMs??60000});t.push("graphify-reextract-triggered")}}catch{}}try{await vh(r,{checkedAtMs:Date.now(),codegraphLatest:a.codegraph??i?.codegraphLatest,graphifyLatest:a.graphify??i?.graphifyLatest}),t.push("upgrade-cache-written")}catch{}}catch{t.push("upgrade-check-skipped")}if(e.autoInstall!==!1){if(!o.codegraph){let r=await Yu(n,e.installTimeoutMs??60000,e.runner);if(t.push(r),r==="codegraph-installed")o.codegraph=!0}if(!o.graphify){let r=await Qu(e.installTimeoutMs??60000,e.runner);if(t.push(r),r==="graphify-installed")o.graphify=!0}}else{if(!o.codegraph)t.push("codegraph-install-skipped");if(!o.graphify)t.push("graphify-install-skipped")}if(o.codegraph)if(!o.codegraphIndexExists){let r=await mh(n,e.installTimeoutMs??60000);t.push(r?"codegraph-initialized":"codegraph-init-failed")}else t.push("codegraph-already-exists");else t.push("codegraph-unavailable");if(o.graphify){if(!o.graphifyIndexExists){let r=await ph(n,e.installTimeoutMs??120000);t.push(r?"graphify-initialized":"graphify-init-failed")}else t.push("graphify-already-exists");try{if(!await Jo(n)){if(ne("graphify",["hook","install"],{cwd:n,timeoutMs:1e4}).code===0)t.push("graphify-hook-installed")}}catch{}}else t.push("graphify-unavailable");if(e.watch){if(o.codegraph)rd(n,"codegraph"),t.push("watch-started-codegraph");if(o.graphify)rd(n,"graphify"),t.push("watch-started-graphify")}if(e.addToGlobalGraph===!0&&o.graphify)try{await Jr("graphify",["global","add",dh(n,"graphify-out")],{cwd:n,timeoutMs:1e4}),t.push("graphify-added-to-global")}catch{t.push("graphify-global-add-failed")}return{attempted:!0,codes:t,availability:o,alreadyInitialized:!1}}async function Xr(e){try{return(await sd(e)).isDirectory()}catch{return!1}}async function nd(e){try{return(await sd(e)).isFile()}catch{return!1}}function Bo(e){if(typeof e!=="string"||e.length===0)return!1;let t=e.replace(/\\\n/g," ").replace(/\s*\n\s*/g," ");return/(?:^|[\s;&|])git\s+commit(?:\s+-|\s|$)/.test(t)}async function qo(e,t){if(await Xr(Zo(e,".codegraph")))return await fh(e,t);return await Yr({enabled:!0,watch:!1,autoInstall:!1,installTimeoutMs:5000,projectDir:e,runner:t})}async function Jo(e){let{access:t,readFile:n}=await import("node:fs/promises"),{resolve:o}=await import("node:path"),r=o(e,".git","hooks","post-commit");try{await t(r)}catch{return!1}try{return(await n(r,"utf-8")).includes("graphify-hook-start")}catch{return!1}}async function fh(e,t){let{resolve:n}=await import("node:path"),o=[],r=await Xr(n(e,".codegraph"));if(r){try{if(t)t("npx --yes codegraph sync -q",{cwd:e,stdio:"ignore",timeout:30000});else ne("npx",["--yes","codegraph","sync","-q"],{cwd:e,timeoutMs:30000});o.push("codegraph-already-exists"),Wo("info",`codegraph sync -q completed for ${e}`)}catch(s){Wo("warn",`codegraph sync failed for ${e}: ${s}`),o.push("codegraph-install-failed")}return{attempted:!0,codes:o,availability:{codegraph:!0,graphify:!1,codegraphIndexExists:r,graphifyIndexExists:await Xr(n(e,"graphify-out"))},alreadyInitialized:!1}}let i=!1;try{if(t)t("npx --yes codegraph --version",{stdio:"ignore",timeout:5000});else if(ne("npx",["--yes","codegraph","--version"],{timeoutMs:5000}).code!==0)throw Error("codegraph probe failed");i=!0}catch{try{if(t)t("node node_modules/.bin/codegraph --version",{cwd:e,stdio:"ignore",timeout:5000});else if(ne("node",["node_modules/.bin/codegraph","--version"],{cwd:e,timeoutMs:5000}).code!==0)throw Error("local codegraph probe failed");i=!0}catch{}}if(!i)return{attempted:!0,codes:["codegraph-unavailable"],availability:{codegraph:!1,graphify:!1,codegraphIndexExists:r,graphifyIndexExists:await Xr(n(e,"graphify-out"))},alreadyInitialized:!1};return await Yr({enabled:!0,watch:!1,autoInstall:!1,installTimeoutMs:5000,projectDir:e,runner:t})}function Ho(e,t){if(e==null&&t)return!0;if(!t)return!1;let n=e,o=t;if(!n||n===o)return!1;let r=/^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$/;if(!r.test(n)||!r.test(o))return!1;let i=(b)=>{let[w="",M=""]=b.split("-",2),j=w.split(".").map((Te)=>{let Gt=Number.parseInt(Te,10);return Number.isFinite(Gt)?Gt:0}),[K=0,W=0,ae=0]=j;return[K,W,ae,M]},[s,a,l,c]=i(n),[u,f,g,d]=i(o);if(u!==s)return u>s;if(f!==a)return f>a;if(g!==l)return g>l;if(c&&!d)return!0;if(!c&&d)return!1;return d>c}function gh(){return ve().upgradeCheck}async function hh(e){try{let{readFile:t}=await import("node:fs/promises"),n=await t(e,"utf-8"),o=JSON.parse(n);if(typeof o?.checkedAtMs==="number")return o;return null}catch{return null}}async function vh(e,t){let{dirname:n}=await import("node:path"),{mkdir:o,writeFile:r}=await import("node:fs/promises"),i=n(e);try{await o(i,{recursive:!0}),await r(e,JSON.stringify(t,null,2))}catch{}}function ad(e,t){if(!e)return!1;let n=Date.now()-e.checkedAtMs;return n>=0&&n<t}function od(e,t,n,o,r="codegraphLatest"){let i=t;if(ad(n,o))i=n?.[r]??i;if(!e&&!i)return!1;if(!i)return!1;if(!e)return!0;return Ho(e,i)}async function yh(){try{let t=ne("npm",["view","@colbymchenry/codegraph","version"],{timeoutMs:1e4}).stdout.trim();return t.length>0?t:null}catch{return null}}async function bh(e=gt){for(let t of["python","python3"])try{let r=(ne(t,["-m","pip","index","versions","graphifyy"],{timeoutMs:1e4}).stdout.split(`
22
- `)[0]??"").match(/graphifyy\s*\(?([0-9]+\.[0-9]+\.[0-9]+[^\s)]*)/);if(r)return r[1]}catch{}for(let t of["python","python3"])try{let o=ne(t,["-c","import urllib.request, json; d=json.load(urllib.request.urlopen('https://pypi.org/pypi/graphifyy/json')); print(d['info']['version'])"],{timeoutMs:1e4}).stdout.trim();if(o.length>0)return o}catch{}return null}async function id(e){let t=[{bin:"npx",args:["--yes","codegraph","--version"]},{bin:"node",args:["node_modules/.bin/codegraph","--version"]}];for(let{bin:n,args:o}of t)try{let r;if(e){let s=e(`${n} ${o.join(" ")}`,{stdio:"ignore",timeout:1e4});r=typeof s==="string"?s:s.toString()}else r=ne(n,o,{timeoutMs:1e4}).stdout;let i=r.match(/([0-9]+\.[0-9]+\.[0-9]+[^\s]*)/);if(i)return i[1]}catch{}return null}async function _h(e){let t=(n,o)=>{if(e){let r=e(`${n} ${o.join(" ")}`,{stdio:"ignore",timeout:1e4});return typeof r==="string"?r:r.toString()}return ne(n,o,{timeoutMs:1e4}).stdout};try{let o=t("graphify",["--version"]).match(/([0-9]+\.[0-9]+\.[0-9]+[^\s]*)/);if(o)return o[1]}catch{}try{let o=t("python",["-m","pip","show","graphifyy"]).match(/Version:\s*([0-9]+\.[0-9]+\.[0-9]+[^\s]*)/);if(o)return o[1]}catch{}try{let o=t("python3",["-m","pip","show","graphifyy"]).match(/Version:\s*([0-9]+\.[0-9]+\.[0-9]+[^\s]*)/);if(o)return o[1]}catch{}return null}function ld(e,t,n){let o=n?(i)=>n(i,{cwd:e}).toString():void 0,r=t;try{if(!r)if(o)r=o("git rev-parse --abbrev-ref HEAD").trim();else r=ne("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:e,timeoutMs:5000}).stdout.trim();if(o)o(`git fetch origin ${r}`);else ne("git",["fetch","origin",r],{cwd:e,timeoutMs:30000});let i;if(o)i=o(`git rev-list --count HEAD..origin/${r}`);else i=ne("git",["rev-list","--count",`HEAD..origin/${r}`],{cwd:e,timeoutMs:1e4}).stdout;let s=Number.parseInt(i.trim(),10);return Number.isFinite(s)&&s>0?s:0}catch{return 0}}var Go,ed=!1,Jt,Wo;var Qr=We(()=>{Bt();Kr();ft();try{et({oldPaths:Qe(),newPaths:ve()})}catch{}Go=new Set;Jt=new Map;Wo=x});import{execSync as kh}from"node:child_process";function ge(e,t,n){try{return{ok:!0,stdout:t(e,{timeoutMs:n}),stderr:"",timedOut:!1}}catch(o){let r=o,i=typeof r.stdout==="string"?r.stdout:r.stdout instanceof Buffer?r.stdout.toString("utf8"):"",s=typeof r.stderr==="string"?r.stderr:r.stderr instanceof Buffer?r.stderr.toString("utf8"):r.message??"",a=/timed out|ETIMEDOUT|timeout/i.test(s);return{ok:!1,stdout:i,stderr:s,timedOut:a}}}function en(e=Ee){let t=ge("pip show cli-anything-hub",e,1e4);if(!t.ok)t=ge("pip3 show cli-anything-hub",e,1e4);if(!t.ok)t=ge("python -m pip show cli-anything-hub",e,1e4);if(!t.ok)return null;let n=t.stdout.match(/^Version:\s*([\d.]+[^\s]*)/m);return n?n[1].trim():null}function cd(e=Ee){let t=ge("pip index versions cli-anything-hub",e,1e4);if(!t.ok)t=ge("pip3 index versions cli-anything-hub",e,1e4);if(!t.ok)t=ge("python -m pip index versions cli-anything-hub",e,1e4);if(!t.ok)return null;let n=t.stdout.match(/^\S+\s+\(([\d.]+[^\s,)]*)/m);return n?n[1].trim():null}function ud(e,t){if(e===t)return 0;if(!e)return-1;if(!t)return 1;let n=e.split(/[.+-]/).map((r)=>Number.parseInt(r,10)||0),o=t.split(/[.+-]/).map((r)=>Number.parseInt(r,10)||0);for(let r=0;r<Math.max(n.length,o.length);r++){let i=n[r]??0,s=o[r]??0;if(i<s)return-1;if(i>s)return 1}return 0}function dd(e=Ee,t=60000){let n=Date.now(),o=["uv tool install cli-anything-hub","uv pip install --system --break-system-packages cli-anything-hub","pip install --user cli-anything-hub","pip install cli-anything-hub"],r="";for(let i of o){let s=ge(i,e,t);if(s.ok)return{ok:!0,data:null,rawOutput:s.stdout,stderr:s.stderr,durationMs:Date.now()-n,code:"cli-anything-install-succeeded"};r=s.stderr}return{ok:!1,data:null,rawOutput:null,stderr:r.slice(0,500),durationMs:Date.now()-n,code:"cli-anything-install-failed"}}function md(e=Ee,t=60000){let n=Date.now(),o=["uv tool upgrade cli-anything-hub","uv tool install --upgrade cli-anything-hub","uv pip install --system --upgrade --break-system-packages cli-anything-hub","pip install --user --upgrade cli-anything-hub","pip install --upgrade cli-anything-hub"],r="";for(let i of o){let s=ge(i,e,t);if(s.ok)return{ok:!0,data:null,rawOutput:s.stdout,stderr:s.stderr,durationMs:Date.now()-n,code:"cli-anything-upgrade-succeeded"};r=s.stderr}return{ok:!1,data:null,rawOutput:null,stderr:r.slice(0,500),durationMs:Date.now()-n,code:"cli-anything-upgrade-failed"}}function pd(e={},t=Ee,n=30000,o="cli-hub"){let r=Date.now(),i=["list","--json"];if(e.category)i.push("--category",e.category);if(e.source)i.push("--source",e.source);let s=ge(`${o} ${i.join(" ")}`,t,n);if(!s.ok)return{ok:!1,data:null,rawOutput:s.stdout,stderr:s.stderr.slice(0,500),durationMs:Date.now()-r,code:"cli-hub-list-failed"};try{return{ok:!0,data:JSON.parse(s.stdout),rawOutput:null,stderr:s.stderr,durationMs:Date.now()-r,code:"cli-hub-list-succeeded"}}catch{return{ok:!1,data:null,rawOutput:s.stdout,stderr:"Failed to parse cli-hub list JSON output",durationMs:Date.now()-r,code:"cli-hub-list-failed"}}}function fd(e,t=Ee,n=30000,o="cli-hub"){let r=Date.now();if(!e.trim())return{ok:!1,data:null,rawOutput:null,stderr:"empty query",durationMs:0,code:"cli-hub-search-failed"};let i=ge(`${o} search "${e}" --json`,t,n);if(!i.ok)return{ok:!1,data:null,rawOutput:i.stdout,stderr:i.stderr.slice(0,500),durationMs:Date.now()-r,code:"cli-hub-search-failed"};try{return{ok:!0,data:JSON.parse(i.stdout),rawOutput:null,stderr:i.stderr,durationMs:Date.now()-r,code:"cli-hub-search-succeeded"}}catch{return{ok:!1,data:null,rawOutput:i.stdout,stderr:"Failed to parse cli-hub search JSON output",durationMs:Date.now()-r,code:"cli-hub-search-failed"}}}function gd(e,t=Ee,n=1e4,o="cli-hub"){let r=Date.now(),i=ge(`${o} info "${e}"`,t,n);if(!i.ok)return{ok:!1,data:null,rawOutput:i.stdout,stderr:i.stderr.slice(0,500),durationMs:Date.now()-r,code:"cli-hub-info-failed"};return{ok:!0,data:i.stdout,rawOutput:null,stderr:i.stderr,durationMs:Date.now()-r,code:"cli-hub-info-succeeded"}}function hd(e,t=Ee,n=120000,o="cli-hub"){let r=Date.now(),i=ge(`${o} install "${e}"`,t,n);if(!i.ok)return{ok:!1,data:null,rawOutput:i.stdout,stderr:i.stderr.slice(0,500),durationMs:Date.now()-r,code:"cli-hub-install-failed"};return{ok:!0,data:null,rawOutput:i.stdout,stderr:i.stderr,durationMs:Date.now()-r,code:"cli-hub-install-succeeded"}}function vd(e="global",t=Ee,n=60000,o="npx skills"){let r=Date.now(),s=`${o} add HKUDS/CLI-Anything --skill cli-hub-meta-skill ${e==="global"?"-g":"-p"} -y`,a=ge(s,t,n);if(!a.ok)return{ok:!1,data:null,rawOutput:a.stdout,stderr:a.stderr.slice(0,500),durationMs:Date.now()-r,code:"skill-install-failed"};return{ok:!0,data:null,rawOutput:a.stdout,stderr:a.stderr,durationMs:Date.now()-r,code:"skill-install-succeeded"}}function yd(e="global",t=Ee,n=60000,o="npx skills"){let r=Date.now(),s=`${o} update cli-hub-meta-skill ${e==="global"?"-g":"-p"} -y`,a=ge(s,t,n);if(!a.ok)return{ok:!1,data:null,rawOutput:a.stdout,stderr:a.stderr.slice(0,500),durationMs:Date.now()-r,code:"skill-upgrade-failed"};return{ok:!0,data:null,rawOutput:a.stdout,stderr:a.stderr,durationMs:Date.now()-r,code:"skill-upgrade-succeeded"}}function bd(e="global",t=Ee,n=1e4,o="npx skills"){let i=ge(`${o} list ${e==="global"?"-g":"-p"}`,t,n);if(!i.ok)return!1;return/cli-hub-meta-skill/i.test(i.stdout)}var Ee=(e,t)=>kh(e,{timeout:t?.timeoutMs??1e4,encoding:"utf8",stdio:["ignore","pipe","pipe"]}).toString();var Tt=()=>{};import{AsyncLocalStorage as Y_}from"node:async_hooks";function Ep(e){if(e){let t=Date.now();if(t-Op>1000)Op=t,Promise.resolve().then(() => (ft(),{})).then(({})=>{x("info","SessionBridge: OpenCode client hydrated — session.prompt() available")}).catch((n)=>{Promise.resolve().then(() => (ft(),{})).then(({})=>x("warn",`session-bridge setSessionClient log init failed: ${String(n)}`))})}bo=e}function Ur(){return(qc.getStore()??bo)!==null}async function wt(e,t){let n=Date.now(),o=t.timeoutMs??15000,r=qc.getStore()??bo;if(!r)return{ok:!1,messageID:null,error:"SessionBridge: no OpenCode client captured (plugin not initialized?)",durationMs:0};if(!e)return{ok:!1,messageID:null,error:"SessionBridge: sessionID is required",durationMs:0};let i=JSON.stringify(t.mcpArgs,null,2),l={type:"text",text:`${t.preamble??"The user wants to record this."}
21
+ `],{stdio:"ignore",detached:!0,shell:!1,env:{...process.env,OMO_MG_SPAWN:"1"}});else i=Xu("python3",["-m","graphify",".","--no-viz","--watch"],{cwd:e,stdio:"ignore",detached:!0,shell:!1,env:{...process.env,OMO_MG_SPAWN:"1"}});i.unref(),Jt.set(n,{process:i,tool:t}),ji(i.pid),i.on("exit",()=>{Jt.delete(n),Br(i.pid)})}catch{}}function Hi(e){for(let[t,n]of Jt)if(!e||t.startsWith(e)){let i=n.process.pid;if(i)Br(i);if(process.platform==="win32")pt(i);else{try{n.process.kill("SIGTERM")}catch{}setTimeout(()=>{pt(i)},2000).unref()}Jt.delete(t)}}async function Yr(e={enabled:!0,watch:!1,autoInstall:!0,installTimeoutMs:60000}){let t=[],n=e.projectDir??process.cwd();if(!e.enabled)return{attempted:!1,codes:["disabled"],availability:{codegraph:!1,graphify:!1,codegraphIndexExists:!1,graphifyIndexExists:!1},alreadyInitialized:!1};if(e.killOrphanedOnInit!==!1&&!ed){ed=!0;let r=It();Zi("info","orphan sweep: killed "+r+" leftover tool processes")}if(Gi.has(n)){let r=await td(n,e.runner);return{attempted:!1,codes:r.codegraphIndexExists?["codegraph-already-exists"]:[],availability:r,alreadyInitialized:!0}}Gi.add(n);let i;try{i=await td(n,e.runner)}catch{return{attempted:!1,codes:["error"],availability:{codegraph:!1,graphify:!1,codegraphIndexExists:!1,graphifyIndexExists:!1},alreadyInitialized:!1}}if(e.autoUpgrade!==!1)try{let r=e.upgradeCachePath??vh(),o=await yh(r),s=e.upgradeCheckTtlMs??86400000,a={codegraph:null,graphify:null},l=async(c)=>{let u=c==="codegraph"?"codegraphLatest":"graphifyLatest";if(ad(o,s)&&o?.[u])return o[u];let g=await(c==="codegraph"?_h:kh)();return a[c]=g,g};if(i.codegraph){let c=await od(e.runner),u=await l("codegraph");if(id(c,u,o,s,"codegraphLatest")){if(u&&Wi(c,u)){if(await Yu(n,e.installTimeoutMs??60000,e.runner)==="codegraph-installed"){if(t.push("codegraph-upgraded"),await od(e.runner)==null)t.push("codegraph-upgrade-broken")}}}}if(i.graphify){let c=await wh(e.runner),u=await l("graphify");if(id(c,u,o,s,"graphifyLatest")){if(u&&Wi(c,u)){if(await Qu(e.installTimeoutMs??60000,e.runner)==="graphify-installed")t.push("graphify-upgraded")}}if(e.checkGraphifyNeedsUpdate!==!1)try{if((e.runner?(()=>{try{return e.runner("graphify check-update "+n,{cwd:n,stdio:"ignore",timeout:1e4}),{code:0,stdout:"",stderr:""}}catch{return{code:1,stdout:"",stderr:"runner rejected"}}})():ne("graphify",["check-update",n],{cwd:n,timeoutMs:1e4})).code!==0){if(e.runner)try{e.runner("graphify update "+n+" --no-cluster",{cwd:n,stdio:"ignore",timeout:e.installTimeoutMs??60000})}catch{}else ne("graphify",["update",n,"--no-cluster"],{cwd:n,timeoutMs:e.installTimeoutMs??60000});t.push("graphify-reextract-triggered")}}catch{}}try{await bh(r,{checkedAtMs:Date.now(),codegraphLatest:a.codegraph??o?.codegraphLatest,graphifyLatest:a.graphify??o?.graphifyLatest}),t.push("upgrade-cache-written")}catch{}}catch{t.push("upgrade-check-skipped")}if(e.autoInstall!==!1){if(!i.codegraph){let r=await Yu(n,e.installTimeoutMs??60000,e.runner);if(t.push(r),r==="codegraph-installed")i.codegraph=!0}if(!i.graphify){let r=await Qu(e.installTimeoutMs??60000,e.runner);if(t.push(r),r==="graphify-installed")i.graphify=!0}}else{if(!i.codegraph)t.push("codegraph-install-skipped");if(!i.graphify)t.push("graphify-install-skipped")}if(i.codegraph)if(!i.codegraphIndexExists){let r=await fh(n,e.installTimeoutMs??60000);t.push(r?"codegraph-initialized":"codegraph-init-failed")}else t.push("codegraph-already-exists");else t.push("codegraph-unavailable");if(i.graphify){if(!i.graphifyIndexExists){let r=await gh(n,e.installTimeoutMs??120000);t.push(r?"graphify-initialized":"graphify-init-failed")}else t.push("graphify-already-exists");try{if(!await qi(n)){if(ne("graphify",["hook","install"],{cwd:n,timeoutMs:1e4}).code===0)t.push("graphify-hook-installed")}}catch{}}else t.push("graphify-unavailable");if(e.watch){if(i.codegraph)rd(n,"codegraph"),t.push("watch-started-codegraph");if(i.graphify)rd(n,"graphify"),t.push("watch-started-graphify")}if(e.addToGlobalGraph===!0&&i.graphify)try{await Jr("graphify",["global","add",ph(n,"graphify-out")],{cwd:n,timeoutMs:1e4}),t.push("graphify-added-to-global")}catch{t.push("graphify-global-add-failed")}return{attempted:!0,codes:t,availability:i,alreadyInitialized:!1}}async function Xr(e){try{return(await sd(e)).isDirectory()}catch{return!1}}async function nd(e){try{return(await sd(e)).isFile()}catch{return!1}}function Vi(e){if(typeof e!=="string"||e.length===0)return!1;let t=e.replace(/\\\n/g," ").replace(/\s*\n\s*/g," ");return/(?:^|[\s;&|])git\s+commit(?:\s+-|\s|$)/.test(t)}async function Bi(e,t){if(await Xr(Fi(e,".codegraph")))return await hh(e,t);return await Yr({enabled:!0,watch:!1,autoInstall:!1,installTimeoutMs:5000,projectDir:e,runner:t})}async function qi(e){let{access:t,readFile:n}=await import("node:fs/promises"),{resolve:i}=await import("node:path"),r=i(e,".git","hooks","post-commit");try{await t(r)}catch{return!1}try{return(await n(r,"utf-8")).includes("graphify-hook-start")}catch{return!1}}async function hh(e,t){let{resolve:n}=await import("node:path"),i=[],r=await Xr(n(e,".codegraph"));if(r){try{if(t)t("npx --yes codegraph sync -q",{cwd:e,stdio:"ignore",timeout:30000});else ne("npx",["--yes","codegraph","sync","-q"],{cwd:e,timeoutMs:30000});i.push("codegraph-already-exists"),Zi("info",`codegraph sync -q completed for ${e}`)}catch(s){Zi("warn",`codegraph sync failed for ${e}: ${s}`),i.push("codegraph-install-failed")}return{attempted:!0,codes:i,availability:{codegraph:!0,graphify:!1,codegraphIndexExists:r,graphifyIndexExists:await Xr(n(e,"graphify-out"))},alreadyInitialized:!1}}let o=!1;try{if(t)t("npx --yes codegraph --version",{stdio:"ignore",timeout:5000});else if(ne("npx",["--yes","codegraph","--version"],{timeoutMs:5000}).code!==0)throw Error("codegraph probe failed");o=!0}catch{try{if(t)t("node node_modules/.bin/codegraph --version",{cwd:e,stdio:"ignore",timeout:5000});else if(ne("node",["node_modules/.bin/codegraph","--version"],{cwd:e,timeoutMs:5000}).code!==0)throw Error("local codegraph probe failed");o=!0}catch{}}if(!o)return{attempted:!0,codes:["codegraph-unavailable"],availability:{codegraph:!1,graphify:!1,codegraphIndexExists:r,graphifyIndexExists:await Xr(n(e,"graphify-out"))},alreadyInitialized:!1};return await Yr({enabled:!0,watch:!1,autoInstall:!1,installTimeoutMs:5000,projectDir:e,runner:t})}function Wi(e,t){if(e==null&&t)return!0;if(!t)return!1;let n=e,i=t;if(!n||n===i)return!1;let r=/^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$/;if(!r.test(n)||!r.test(i))return!1;let o=(b)=>{let[x="",M=""]=b.split("-",2),U=x.split(".").map((Te)=>{let Zt=Number.parseInt(Te,10);return Number.isFinite(Zt)?Zt:0}),[K=0,W=0,ae=0]=U;return[K,W,ae,M]},[s,a,l,c]=o(n),[u,f,g,d]=o(i);if(u!==s)return u>s;if(f!==a)return f>a;if(g!==l)return g>l;if(c&&!d)return!0;if(!c&&d)return!1;return d>c}function vh(){return ve().upgradeCheck}async function yh(e){try{let{readFile:t}=await import("node:fs/promises"),n=await t(e,"utf-8"),i=JSON.parse(n);if(typeof i?.checkedAtMs==="number")return i;return null}catch{return null}}async function bh(e,t){let{dirname:n}=await import("node:path"),{mkdir:i,writeFile:r}=await import("node:fs/promises"),o=n(e);try{await i(o,{recursive:!0}),await r(e,JSON.stringify(t,null,2))}catch{}}function ad(e,t){if(!e)return!1;let n=Date.now()-e.checkedAtMs;return n>=0&&n<t}function id(e,t,n,i,r="codegraphLatest"){let o=t;if(ad(n,i))o=n?.[r]??o;if(!e&&!o)return!1;if(!o)return!1;if(!e)return!0;return Wi(e,o)}async function _h(){try{let t=ne("npm",["view","@colbymchenry/codegraph","version"],{timeoutMs:1e4}).stdout.trim();return t.length>0?t:null}catch{return null}}async function kh(e=gt){for(let t of["python","python3"])try{let r=(ne(t,["-m","pip","index","versions","graphifyy"],{timeoutMs:1e4}).stdout.split(`
22
+ `)[0]??"").match(/graphifyy\s*\(?([0-9]+\.[0-9]+\.[0-9]+[^\s)]*)/);if(r)return r[1]}catch{}for(let t of["python","python3"])try{let i=ne(t,["-c","import urllib.request, json; d=json.load(urllib.request.urlopen('https://pypi.org/pypi/graphifyy/json')); print(d['info']['version'])"],{timeoutMs:1e4}).stdout.trim();if(i.length>0)return i}catch{}return null}async function od(e){let t=[{bin:"npx",args:["--yes","codegraph","--version"]},{bin:"node",args:["node_modules/.bin/codegraph","--version"]}];for(let{bin:n,args:i}of t)try{let r;if(e){let s=e(`${n} ${i.join(" ")}`,{stdio:"ignore",timeout:1e4});r=typeof s==="string"?s:s.toString()}else r=ne(n,i,{timeoutMs:1e4}).stdout;let o=r.match(/([0-9]+\.[0-9]+\.[0-9]+[^\s]*)/);if(o)return o[1]}catch{}return null}async function wh(e){let t=(n,i)=>{if(e){let r=e(`${n} ${i.join(" ")}`,{stdio:"ignore",timeout:1e4});return typeof r==="string"?r:r.toString()}return ne(n,i,{timeoutMs:1e4}).stdout};try{let i=t("graphify",["--version"]).match(/([0-9]+\.[0-9]+\.[0-9]+[^\s]*)/);if(i)return i[1]}catch{}try{let i=t("python",["-m","pip","show","graphifyy"]).match(/Version:\s*([0-9]+\.[0-9]+\.[0-9]+[^\s]*)/);if(i)return i[1]}catch{}try{let i=t("python3",["-m","pip","show","graphifyy"]).match(/Version:\s*([0-9]+\.[0-9]+\.[0-9]+[^\s]*)/);if(i)return i[1]}catch{}return null}function ld(e,t,n){let i=n?(o)=>n(o,{cwd:e}).toString():void 0,r=t;try{if(!r)if(i)r=i("git rev-parse --abbrev-ref HEAD").trim();else r=ne("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:e,timeoutMs:5000}).stdout.trim();if(i)i(`git fetch origin ${r}`);else ne("git",["fetch","origin",r],{cwd:e,timeoutMs:30000});let o;if(i)o=i(`git rev-list --count HEAD..origin/${r}`);else o=ne("git",["rev-list","--count",`HEAD..origin/${r}`],{cwd:e,timeoutMs:1e4}).stdout;let s=Number.parseInt(o.trim(),10);return Number.isFinite(s)&&s>0?s:0}catch{return 0}}var Gi,ed=!1,Jt,Zi;var Qr=We(()=>{Bt();Kr();ft();try{et({oldPaths:Qe(),newPaths:ve()})}catch{}Gi=new Set;Jt=new Map;Zi=S});import{execSync as xh}from"node:child_process";function ge(e,t,n){try{return{ok:!0,stdout:t(e,{timeoutMs:n}),stderr:"",timedOut:!1}}catch(i){let r=i,o=typeof r.stdout==="string"?r.stdout:r.stdout instanceof Buffer?r.stdout.toString("utf8"):"",s=typeof r.stderr==="string"?r.stderr:r.stderr instanceof Buffer?r.stderr.toString("utf8"):r.message??"",a=/timed out|ETIMEDOUT|timeout/i.test(s);return{ok:!1,stdout:o,stderr:s,timedOut:a}}}function en(e=Ee){let t=ge("pip show cli-anything-hub",e,1e4);if(!t.ok)t=ge("pip3 show cli-anything-hub",e,1e4);if(!t.ok)t=ge("python -m pip show cli-anything-hub",e,1e4);if(!t.ok)return null;let n=t.stdout.match(/^Version:\s*([\d.]+[^\s]*)/m);return n?n[1].trim():null}function cd(e=Ee){let t=ge("pip index versions cli-anything-hub",e,1e4);if(!t.ok)t=ge("pip3 index versions cli-anything-hub",e,1e4);if(!t.ok)t=ge("python -m pip index versions cli-anything-hub",e,1e4);if(!t.ok)return null;let n=t.stdout.match(/^\S+\s+\(([\d.]+[^\s,)]*)/m);return n?n[1].trim():null}function ud(e,t){if(e===t)return 0;if(!e)return-1;if(!t)return 1;let n=e.split(/[.+-]/).map((r)=>Number.parseInt(r,10)||0),i=t.split(/[.+-]/).map((r)=>Number.parseInt(r,10)||0);for(let r=0;r<Math.max(n.length,i.length);r++){let o=n[r]??0,s=i[r]??0;if(o<s)return-1;if(o>s)return 1}return 0}function dd(e=Ee,t=60000){let n=Date.now(),i=["uv tool install cli-anything-hub","uv pip install --system --break-system-packages cli-anything-hub","pip install --user cli-anything-hub","pip install cli-anything-hub"],r="";for(let o of i){let s=ge(o,e,t);if(s.ok)return{ok:!0,data:null,rawOutput:s.stdout,stderr:s.stderr,durationMs:Date.now()-n,code:"cli-anything-install-succeeded"};r=s.stderr}return{ok:!1,data:null,rawOutput:null,stderr:r.slice(0,500),durationMs:Date.now()-n,code:"cli-anything-install-failed"}}function md(e=Ee,t=60000){let n=Date.now(),i=["uv tool upgrade cli-anything-hub","uv tool install --upgrade cli-anything-hub","uv pip install --system --upgrade --break-system-packages cli-anything-hub","pip install --user --upgrade cli-anything-hub","pip install --upgrade cli-anything-hub"],r="";for(let o of i){let s=ge(o,e,t);if(s.ok)return{ok:!0,data:null,rawOutput:s.stdout,stderr:s.stderr,durationMs:Date.now()-n,code:"cli-anything-upgrade-succeeded"};r=s.stderr}return{ok:!1,data:null,rawOutput:null,stderr:r.slice(0,500),durationMs:Date.now()-n,code:"cli-anything-upgrade-failed"}}function pd(e={},t=Ee,n=30000,i="cli-hub"){let r=Date.now(),o=["list","--json"];if(e.category)o.push("--category",e.category);if(e.source)o.push("--source",e.source);let s=ge(`${i} ${o.join(" ")}`,t,n);if(!s.ok)return{ok:!1,data:null,rawOutput:s.stdout,stderr:s.stderr.slice(0,500),durationMs:Date.now()-r,code:"cli-hub-list-failed"};try{return{ok:!0,data:JSON.parse(s.stdout),rawOutput:null,stderr:s.stderr,durationMs:Date.now()-r,code:"cli-hub-list-succeeded"}}catch{return{ok:!1,data:null,rawOutput:s.stdout,stderr:"Failed to parse cli-hub list JSON output",durationMs:Date.now()-r,code:"cli-hub-list-failed"}}}function fd(e,t=Ee,n=30000,i="cli-hub"){let r=Date.now();if(!e.trim())return{ok:!1,data:null,rawOutput:null,stderr:"empty query",durationMs:0,code:"cli-hub-search-failed"};let o=ge(`${i} search "${e}" --json`,t,n);if(!o.ok)return{ok:!1,data:null,rawOutput:o.stdout,stderr:o.stderr.slice(0,500),durationMs:Date.now()-r,code:"cli-hub-search-failed"};try{return{ok:!0,data:JSON.parse(o.stdout),rawOutput:null,stderr:o.stderr,durationMs:Date.now()-r,code:"cli-hub-search-succeeded"}}catch{return{ok:!1,data:null,rawOutput:o.stdout,stderr:"Failed to parse cli-hub search JSON output",durationMs:Date.now()-r,code:"cli-hub-search-failed"}}}function gd(e,t=Ee,n=1e4,i="cli-hub"){let r=Date.now(),o=ge(`${i} info "${e}"`,t,n);if(!o.ok)return{ok:!1,data:null,rawOutput:o.stdout,stderr:o.stderr.slice(0,500),durationMs:Date.now()-r,code:"cli-hub-info-failed"};return{ok:!0,data:o.stdout,rawOutput:null,stderr:o.stderr,durationMs:Date.now()-r,code:"cli-hub-info-succeeded"}}function hd(e,t=Ee,n=120000,i="cli-hub"){let r=Date.now(),o=ge(`${i} install "${e}"`,t,n);if(!o.ok)return{ok:!1,data:null,rawOutput:o.stdout,stderr:o.stderr.slice(0,500),durationMs:Date.now()-r,code:"cli-hub-install-failed"};return{ok:!0,data:null,rawOutput:o.stdout,stderr:o.stderr,durationMs:Date.now()-r,code:"cli-hub-install-succeeded"}}function vd(e="global",t=Ee,n=60000,i="npx skills"){let r=Date.now(),s=`${i} add HKUDS/CLI-Anything --skill cli-hub-meta-skill ${e==="global"?"-g":"-p"} -y`,a=ge(s,t,n);if(!a.ok)return{ok:!1,data:null,rawOutput:a.stdout,stderr:a.stderr.slice(0,500),durationMs:Date.now()-r,code:"skill-install-failed"};return{ok:!0,data:null,rawOutput:a.stdout,stderr:a.stderr,durationMs:Date.now()-r,code:"skill-install-succeeded"}}function yd(e="global",t=Ee,n=60000,i="npx skills"){let r=Date.now(),s=`${i} update cli-hub-meta-skill ${e==="global"?"-g":"-p"} -y`,a=ge(s,t,n);if(!a.ok)return{ok:!1,data:null,rawOutput:a.stdout,stderr:a.stderr.slice(0,500),durationMs:Date.now()-r,code:"skill-upgrade-failed"};return{ok:!0,data:null,rawOutput:a.stdout,stderr:a.stderr,durationMs:Date.now()-r,code:"skill-upgrade-succeeded"}}function bd(e="global",t=Ee,n=1e4,i="npx skills"){let o=ge(`${i} list ${e==="global"?"-g":"-p"}`,t,n);if(!o.ok)return!1;return/cli-hub-meta-skill/i.test(o.stdout)}var Ee=(e,t)=>xh(e,{timeout:t?.timeoutMs??1e4,encoding:"utf8",stdio:["ignore","pipe","pipe"]}).toString();var Tt=()=>{};import{AsyncLocalStorage as ek}from"node:async_hooks";function Ep(e){if(e){let t=Date.now();if(t-Op>1000)Op=t,Promise.resolve().then(() => (ft(),{})).then(({})=>{S("info","SessionBridge: OpenCode client hydrated — session.prompt() available")}).catch((n)=>{Promise.resolve().then(() => (ft(),{})).then(({})=>S("warn",`session-bridge setSessionClient log init failed: ${String(n)}`))})}yi=e}function Ur(){return(qc.getStore()??yi)!==null}async function wt(e,t){let n=Date.now(),i=t.timeoutMs??15000,r=qc.getStore()??yi;if(!r)return{ok:!1,messageID:null,error:"SessionBridge: no OpenCode client captured (plugin not initialized?)",durationMs:0};if(!e)return{ok:!1,messageID:null,error:"SessionBridge: sessionID is required",durationMs:0};let o=JSON.stringify(t.mcpArgs,null,2),l={type:"text",text:`${t.preamble??"The user wants to record this."}
23
23
 
24
24
  Please call the \`${t.mcpTool}\` MCP tool with EXACTLY these args:
25
25
 
26
26
  \`\`\`json
27
- `+i+`
27
+ `+o+`
28
28
  \`\`\`
29
29
 
30
30
  Do not paraphrase, modify, or add fields. Pass the args through verbatim.
31
- After the tool call, briefly confirm what you stored and for which tool.`};try{return{ok:!0,messageID:(await zp(r.session.prompt({path:{id:e},body:{parts:[l]}}),o,`session.prompt for ${t.mcpTool}`))?.data?.info?.id??null,error:null,durationMs:Date.now()-n}}catch(c){return{ok:!1,messageID:null,error:c instanceof Error?c.message:String(c),durationMs:Date.now()-n}}}async function _o(e,t,n=1e4){let o=Date.now(),r=qc.getStore()??bo;if(!r)return{ok:!1,messageID:null,error:"SessionBridge: no OpenCode client captured (plugin not initialized?)",durationMs:0};if(!e||!t)return{ok:!1,messageID:null,error:"SessionBridge: sessionID and text are required",durationMs:0};let i={type:"text",text:t};try{return{ok:!0,messageID:(await zp(r.session.prompt({path:{id:e},body:{parts:[i]}}),n,`session.prompt persist for ${e}`))?.data?.info?.id??null,error:null,durationMs:Date.now()-o}}catch(s){return{ok:!1,messageID:null,error:s instanceof Error?s.message:String(s),durationMs:Date.now()-o}}}async function Rp(e,t){return _o(e,t)}function zp(e,t,n){return new Promise((o,r)=>{let i=setTimeout(()=>{r(Error(`${n} timed out after ${t}ms`))},t);e.then((s)=>{clearTimeout(i),o(s)},(s)=>{clearTimeout(i),r(s)})})}function Cp(e){if(e.target==="oracle")return`[MetaGovernor] Escalation triggered. Reason: ${e.reasoning}
31
+ After the tool call, briefly confirm what you stored and for which tool.`};try{return{ok:!0,messageID:(await zp(r.session.prompt({path:{id:e},body:{parts:[l]}}),i,`session.prompt for ${t.mcpTool}`))?.data?.info?.id??null,error:null,durationMs:Date.now()-n}}catch(c){return{ok:!1,messageID:null,error:c instanceof Error?c.message:String(c),durationMs:Date.now()-n}}}async function bi(e,t,n=1e4){let i=Date.now(),r=qc.getStore()??yi;if(!r)return{ok:!1,messageID:null,error:"SessionBridge: no OpenCode client captured (plugin not initialized?)",durationMs:0};if(!e||!t)return{ok:!1,messageID:null,error:"SessionBridge: sessionID and text are required",durationMs:0};let o={type:"text",text:t};try{return{ok:!0,messageID:(await zp(r.session.prompt({path:{id:e},body:{parts:[o]}}),n,`session.prompt persist for ${e}`))?.data?.info?.id??null,error:null,durationMs:Date.now()-i}}catch(s){return{ok:!1,messageID:null,error:s instanceof Error?s.message:String(s),durationMs:Date.now()-i}}}async function Rp(e,t){return bi(e,t)}function zp(e,t,n){return new Promise((i,r)=>{let o=setTimeout(()=>{r(Error(`${n} timed out after ${t}ms`))},t);e.then((s)=>{clearTimeout(o),i(s)},(s)=>{clearTimeout(o),r(s)})})}function Cp(e){if(e.target==="oracle")return`[MetaGovernor] Escalation triggered. Reason: ${e.reasoning}
32
32
 
33
33
  Please invoke the \`task\` tool with \`subagent_type=oracle\` to perform a verification pass on the current session state. Decision context: ${e.evidenceCount} evidence unit(s). After Oracle returns, you should continue with the recommended action.`;return`[MetaGovernor] Escalation to user required. Reason: ${e.reasoning}
34
34
 
35
- Present a clear summary to the user with the deviation(s) detected and your recommended next steps. Wait for explicit user input before proceeding.`}var qc,Op=0,bo=null;var ko=We(()=>{qc=new Y_});var Mp=()=>{};import{readFile as mk,access as pk}from"node:fs/promises";import{resolve as fk,join as gk}from"node:path";import{homedir as hk}from"node:os";function vk(e){let t=[],n=0;while(n<e.length){let r=e[n];if(r==='"'||r==="'"){let i=r;t.push(i),n++;while(n<e.length){let s=e[n];if(t.push(s),s==="\\"){if(n++,n<e.length)t.push(e[n])}else if(s===i){n++;break}n++}continue}if(r==="/"&&n+1<e.length&&e[n+1]==="/"){n+=2;while(n<e.length&&e[n]!==`
36
- `)n++;continue}if(r==="/"&&n+1<e.length&&e[n+1]==="*"){n+=2;while(n<e.length){if(e[n]==="*"&&n+1<e.length&&e[n+1]==="/"){n+=2;break}n++}continue}t.push(r),n++}let o=t.join("");for(let r=0;r<10;r++){let i=o;if(o=o.replace(/,(\s*[\]}])/g,"$1"),o===i)break}return o}function yk(e,t){try{let n=vk(e);return JSON.parse(n)}catch(n){Promise.resolve().then(() => (ft(),{})).then(({})=>x("warn",`JSONC parse failed for ${t??"<inline>"}: ${n instanceof Error?n.message:String(n)}`));return}}function bk(){return fk(hk(),".config","opencode",jf)}function _k(e){let t=e??process.cwd();return gk(t,".opencode",jf)}async function kk(e){try{return await pk(e),!0}catch{return!1}}async function Af(e){if(!await kk(e))return;try{let t=await mk(e,"utf-8");return yk(t,e)}catch(t){let n=t instanceof Error?t.message:String(t);x("warn","jsonc_parse_failed",{path:e,error:n,hint:"Check syntax: comments must use // or /* */, no trailing commas. Run `node -e \"JSON.parse(require('fs').readFileSync('"+e+"','utf-8').replace(/\\/\\*[\\s\\S]*?\\*\\//g,'').replace(/\\/\\/[^\\n]*/g,'').replace(/,(\\s*[}\\]])/g,'$1'))\"` to isolate the issue."});return}}function xo(e,t){let n={...e};for(let o of Object.keys(t)){let r=t[o],i=n[o];if(r===void 0)continue;if(Nf(r)&&Nf(i))n[o]=xo(i,r);else n[o]=r}return n}function Nf(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}async function $o(e={}){let t=[],n="defaults",o={},r=e.userConfigPath??bk(),i=await Af(r);if(i)o=xo(o,i),t.push(`user:${r}`),n="user";let s=_k(e.projectDir),a=await Af(s);if(a)o=xo(o,a),t.push(`project:${s}`),n="project";if(e.cliOptions&&Object.keys(e.cliOptions).length>0)o=xo(o,e.cliOptions),t.push("cli:inline"),n="cli";return{config:o,sources:t,effectiveSource:n}}var jf="omo-meta-governor.jsonc";var Yc=We(()=>{ft()});import{execFileSync as Dw}from"node:child_process";function mu(e,t=1e4){try{return Dw("gh",e,{encoding:"utf-8",timeout:t,stdio:["ignore","pipe","pipe"],windowsHide:!0}).toString().replace(/\r\n/g,`
37
- `).trim()}catch{return null}}function Pw(e){let t=mu(["run","list","--limit","1","--commit",e,"--json","databaseId,status,conclusion,displayTitle,headSha,url"],1e4);if(!t)return null;try{return JSON.parse(t)[0]??null}catch{return null}}function Ow(e,t){let n=mu(["workflow","run",e,"--ref",t],15000);return null}function Ew(e,t=4000){let n=mu(["run","view",String(e),"--log-failed"],30000);if(!n)return"";if(n.length<=t)return n;return n.slice(0,t)+`
35
+ Present a clear summary to the user with the deviation(s) detected and your recommended next steps. Wait for explicit user input before proceeding.`}var qc,Op=0,yi=null;var _i=We(()=>{qc=new ek});var Ap=()=>{};import{readFile as fk,access as gk}from"node:fs/promises";import{resolve as hk,join as vk}from"node:path";import{homedir as yk}from"node:os";function bk(e){let t=[],n=0;while(n<e.length){let r=e[n];if(r==='"'||r==="'"){let o=r;t.push(o),n++;while(n<e.length){let s=e[n];if(t.push(s),s==="\\"){if(n++,n<e.length)t.push(e[n])}else if(s===o){n++;break}n++}continue}if(r==="/"&&n+1<e.length&&e[n+1]==="/"){n+=2;while(n<e.length&&e[n]!==`
36
+ `)n++;continue}if(r==="/"&&n+1<e.length&&e[n+1]==="*"){n+=2;while(n<e.length){if(e[n]==="*"&&n+1<e.length&&e[n+1]==="/"){n+=2;break}n++}continue}t.push(r),n++}let i=t.join("");for(let r=0;r<10;r++){let o=i;if(i=i.replace(/,(\s*[\]}])/g,"$1"),i===o)break}return i}function _k(e,t){try{let n=bk(e);return JSON.parse(n)}catch(n){Promise.resolve().then(() => (ft(),{})).then(({})=>S("warn",`JSONC parse failed for ${t??"<inline>"}: ${n instanceof Error?n.message:String(n)}`));return}}function kk(){return hk(yk(),".config","opencode",jf)}function wk(e){let t=e??process.cwd();return vk(t,".opencode",jf)}async function xk(e){try{return await gk(e),!0}catch{return!1}}async function Mf(e){if(!await xk(e))return;try{let t=await fk(e,"utf-8");return _k(t,e)}catch(t){let n=t instanceof Error?t.message:String(t);S("warn","jsonc_parse_failed",{path:e,error:n,hint:"Check syntax: comments must use // or /* */, no trailing commas. Run `node -e \"JSON.parse(require('fs').readFileSync('"+e+"','utf-8').replace(/\\/\\*[\\s\\S]*?\\*\\//g,'').replace(/\\/\\/[^\\n]*/g,'').replace(/,(\\s*[}\\]])/g,'$1'))\"` to isolate the issue."});return}}function wi(e,t){let n={...e};for(let i of Object.keys(t)){let r=t[i],o=n[i];if(r===void 0)continue;if(Nf(r)&&Nf(o))n[i]=wi(o,r);else n[i]=r}return n}function Nf(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}async function xi(e={}){let t=[],n="defaults",i={},r=e.userConfigPath??kk(),o=await Mf(r);if(o)i=wi(i,o),t.push(`user:${r}`),n="user";let s=wk(e.projectDir),a=await Mf(s);if(a)i=wi(i,a),t.push(`project:${s}`),n="project";if(e.cliOptions&&Object.keys(e.cliOptions).length>0)i=wi(i,e.cliOptions),t.push("cli:inline"),n="cli";return{config:i,sources:t,effectiveSource:n}}var jf="omo-meta-governor.jsonc";var Yc=We(()=>{ft()});import{execFileSync as zw}from"node:child_process";function mu(e,t=1e4){try{return zw("gh",e,{encoding:"utf-8",timeout:t,stdio:["ignore","pipe","pipe"],windowsHide:!0}).toString().replace(/\r\n/g,`
37
+ `).trim()}catch{return null}}function Cw(e){let t=mu(["run","list","--limit","1","--commit",e,"--json","databaseId,status,conclusion,displayTitle,headSha,url"],1e4);if(!t)return null;try{return JSON.parse(t)[0]??null}catch{return null}}function Aw(e,t){let n=mu(["workflow","run",e,"--ref",t],15000);return null}function Mw(e,t=4000){let n=mu(["run","view",String(e),"--log-failed"],30000);if(!n)return"";if(n.length<=t)return n;return n.slice(0,t)+`
38
38
 
39
- … (${n.length-t} chars truncated) …`}var xg=()=>{};Qr();Kr();import{randomUUID as LT,createHash as Rw}from"node:crypto";import{fileURLToPath as zw}from"node:url";Bt();Tt();import{existsSync as wh,readFileSync as xh,writeFileSync as $h,mkdirSync as Sh}from"node:fs";import{dirname as Ih}from"node:path";import{execSync as Th}from"node:child_process";try{et({oldPaths:Qe(),newPaths:ve()})}catch{}function Dh(e){if(!wh(e))return null;try{return JSON.parse(xh(e,"utf8"))}catch{return null}}function Ph(e,t){try{Sh(Ih(e),{recursive:!0}),$h(e,JSON.stringify(t,null,2),"utf8")}catch{}}async function _d(e={}){let t={enabled:e.enabled??!0,autoInstall:e.autoInstall??!0,autoUpgrade:e.autoUpgrade??!0,cachePath:e.cachePath??ve().cliAnythingUpgradeCheck,upgradeCheckTtlMs:e.upgradeCheckTtlMs??86400000,projectDir:e.projectDir,runner:e.runner,installScope:e.installScope??"global",cliHubBin:e.cliHubBin,skillsBin:e.skillsBin,installTimeoutMs:e.installTimeoutMs??60000};if(!t.enabled)return{attempted:!1,codes:["cli-anything-upgrade-skipped"],availability:{cliHub:!1,cliHubVersion:null,metaSkill:!1},alreadyInitialized:!0};let n=[],o=t.runner??((a,l)=>Th(a,{timeout:l?.timeoutMs??1e4,encoding:"utf8",stdio:["ignore","pipe","pipe"]})),r=en(o),i=bd(t.installScope,o,1e4,t.skillsBin),s={cliHub:r!==null,cliHubVersion:r,metaSkill:i};if(r===null&&t.autoInstall){let a=dd(o,t.installTimeoutMs);if(n.push(a.code),a.ok){let l=en(o);s.cliHub=!0,s.cliHubVersion=l}}else if(r!==null)n.push("cli-anything-already-installed");if(!i&&t.autoInstall){let a=vd(t.installScope,o,t.installTimeoutMs,t.skillsBin);if(n.push(a.code),a.ok)s.metaSkill=!0}else if(i)n.push("skill-already-current");if(t.autoUpgrade){let a=Dh(t.cachePath),l=Date.now(),c=!0;if(a?.updatedAtISO){let f=Date.parse(a.updatedAtISO);if(Number.isFinite(f)&&l-f<t.upgradeCheckTtlMs)c=!1}let u=a?.cliHubLatestVersion??null;if(c)u=cd(o),Ph(t.cachePath,{cliHubLatestVersion:u,metaSkillLastCheckedISO:new Date(l).toISOString(),updatedAtISO:new Date(l).toISOString()});if(s.cliHub&&u!==null&&s.cliHubVersion!==null&&ud(u,s.cliHubVersion)>0){let f=md(o,t.installTimeoutMs);if(n.push(f.code),f.ok){let g=en(o);s.cliHubVersion=g}}else if(s.cliHub&&s.cliHubVersion);if(s.metaSkill){let f=yd(t.installScope,o,t.installTimeoutMs,t.skillsBin);if(f.ok||/no update/i.test(f.stderr)){if(!n.includes("skill-already-current"))n.push(f.ok?"skill-upgrade-succeeded":"skill-already-current")}else n.push(f.code)}}return{attempted:!0,codes:n,availability:s,alreadyInitialized:!1}}import{homedir as qh}from"node:os";import{join as Jh}from"node:path";var kd={limits:{maxLessons:10,maxSlots:20,maxTasks:10},timeouts:{agentmemoryMs:2000,boulderStateMs:1000}};async function Sd(e,t){let n=performance.now(),o={...kd.limits,...e.limits},r={...kd.timeouts,...e.timeouts},[i,s]=await Promise.allSettled([Oh(e,t.agentmemory,o,r.agentmemoryMs),Eh(e,t.boulderState,o,r.boulderStateMs)]),a=[],l={},c=i.status==="fulfilled"?i.value:(xd(a,l,"agentmemory",wd(i.reason)),$d.agentmemory),u=s.status==="fulfilled"?s.value:(xd(a,l,"boulderState",wd(s.reason)),$d.boulderState);return{query:e.query,timestampISO:new Date().toISOString(),agentmemory:c,boulderState:u,degradedSources:a,durationMs:performance.now()-n,errorMessages:l}}async function Oh(e,t,n,o){let r=await Id(t.smartSearch({query:e.query,limit:n.maxLessons}),o,"agentmemory");return{available:!0,lessons:Rh(r.lessons).slice(0,n.maxLessons).map((s)=>({id:s.id,title:s.title,advice:s.advice??"info",confidence:s.confidence,concepts:s.concepts}))}}async function Eh(e,t,n,o){let r=await Id(t.boulderRead({directory:e.directory,sessionID:e.sessionID,query:e.query}),o,"boulderState");return{available:!0,tasks:r.sort((s,a)=>s.priority-a.priority||a.updatedAtMs-s.updatedAtMs).slice(0,n.maxTasks).map((s)=>({id:s.id,status:s.status,title:s.title})),planProgress:zh(r)}}function Rh(e){return[...e].sort((t,n)=>n.confidence-t.confidence)}function zh(e){if(e.length===0)return 0;return e.filter((n)=>n.status==="done").length/e.length}function wd(e){if(e instanceof Error)return e.message;if(typeof e==="string")return e;return"unknown error"}function xd(e,t,n,o){e.push(n),t[n]=o}var $d={agentmemory:{available:!1,lessons:[]},boulderState:{available:!1,tasks:[],planProgress:0}};async function Id(e,t,n){return new Promise((o,r)=>{let i=setTimeout(()=>r(Error(`${n} timeout after ${t}ms`)),t);e.then((s)=>{clearTimeout(i),o(s)},(s)=>{clearTimeout(i),r(s)})})}function jx(){return{compactBurnRateThreshold:500,compactUsageThreshold:0.85,switchModelUsageThreshold:0.95,delegateConsecutiveHighBurn:5,windowSize:10}}function Ch(e){if(e.length===0)return 0;return e.reduce((n,o)=>n+o,0)/e.length}function Mh(e,t){let n=0;for(let o=e.length-1;o>=0;o--)if(e[o]>=t)n++;else break;return n}function Ah(e,t,n,o){let r=t-e;if(r<=0)return o;if(n<=0)return null;let i=Math.floor(r/n);if(i<=0)return o;let s=i*2;return new Date(new Date(o).getTime()+s*1000).toISOString()}function Td(e){let{currentUsage:t,modelLimit:n,recentTurnTokens:o,timestampISO:r,config:i}=e,s=o.slice(-i.windowSize),a=Ch(s),l=n-t,c=n>0?t/n:1,u=Math.min(0.95,0.3+s.length/i.windowSize*0.65),f="no-action",g=[],d="within normal parameters";if(c>=i.switchModelUsageThreshold)d=`context usage ${(c*100).toFixed(1)}% exceeds switch threshold ${(i.switchModelUsageThreshold*100).toFixed(1)}%`,g.push("switch-model");if(c>=i.compactUsageThreshold||a>=i.compactBurnRateThreshold){if(f==="no-action")f="compact-now",d=c>=i.compactUsageThreshold?`context usage ${(c*100).toFixed(1)}% exceeds compact threshold ${(i.compactUsageThreshold*100).toFixed(1)}%`:`burn rate ${a.toFixed(0)} tokens/turn exceeds threshold ${i.compactBurnRateThreshold}`}let b=Mh(s,i.compactBurnRateThreshold);if(b>=i.delegateConsecutiveHighBurn&&f==="no-action")d=`${b} consecutive high-burn turns (threshold: ${i.delegateConsecutiveHighBurn})`,g.push("delegate-to-subagent");let w=Ah(t,n,a,r);return{currentUsage:t,burnRate:a,budgetLeft:l,willOverflowAt:w,recommendation:f,recommendations:g,confidence:u,modelLimit:n,windowRemaining:Math.max(0,Math.floor(l/Math.max(a,1))),input:{...e},computedAtISO:r,turnsAnalyzed:s.length}}var je={"oracle-verified":0.25,"no-progress-detector":0.2,"deviation-detector":0.2,"iteration-budget":0.15,"lesson-recall":0.1,"token-predictor":0.1},Ko=()=>({continueThreshold:0.3,warnThreshold:0.3,escalateThreshold:0.45,stopThreshold:0.55,paralysisThreshold:3,defaultEscalationTarget:"oracle",oracleFrequency:"per-stop"});function Nh(e,t){let n=[];n.push({source:"oracle-verified",rawScore:e.oracleVerified?0.6:0,weight:je["oracle-verified"],weightedScore:e.oracleVerified?0.6*je["oracle-verified"]:0,description:e.oracleVerified?"Oracle verification passed":"No Oracle verification"}),n.push({source:"no-progress-detector",rawScore:e.noProgress?-0.8:0,weight:je["no-progress-detector"],weightedScore:e.noProgress?-0.8*je["no-progress-detector"]:0,description:e.noProgress?"No progress detected in last turn":"Progress detected"});let o=jh(e.deviations,t),r=60000,i=e.deviations.filter((l)=>l.ts===void 0||t-l.ts<=r);n.push({source:"deviation-detector",rawScore:o,weight:je["deviation-detector"],weightedScore:o*je["deviation-detector"],description:i.length>0?`${i.length} deviation(s) detected (worst: ${i[0].severity})`:"No deviations detected"});let s=Uh(e.iterationRatio);n.push({source:"iteration-budget",rawScore:s,weight:je["iteration-budget"],weightedScore:s*je["iteration-budget"],description:`Iteration ratio: ${e.iterationRatio.toFixed(2)} (${e.ambient.iteration}/${e.ambient.maxIterations})`});let a=Lh(e.lessonsRelevant);return n.push({source:"lesson-recall",rawScore:a,weight:je["lesson-recall"],weightedScore:a*je["lesson-recall"],description:e.lessonsRelevant.length>0?`${e.lessonsRelevant.length} relevant lesson(s) (avg confidence: ${Fh(e.lessonsRelevant).toFixed(2)})`:"No relevant lessons"}),n}function jh(e,t=Date.now()){let o=e.filter((a)=>a.ts===void 0||t-a.ts<=60000);if(o.length===0)return 0;let r={grave:-0.9,media:-0.5,leve:-0.2},i=0;for(let a of o){let l=r[a.severity]??-0.3;if(l<i)i=l}let s=Math.min(o.length*0.05,0.2);return Math.max(i-s,-1)}function Uh(e){if(e<=0.5)return-e*0.6;return-0.3-(e-0.5)*1}function Lh(e){if(e.length===0)return 0;let t=0;for(let n of e)t+=({continue:0.3,info:0,warn:-0.3,stop:-0.7}[n.advice]??0)*n.confidence;return Math.max(Math.min(t/e.length,1),-1)}function Fh(e){if(e.length===0)return 0;return e.reduce((t,n)=>t+n.confidence,0)/e.length}function Zh(e,t){if(e>=t.continueThreshold)return"continue";if(e<=-t.stopThreshold)return"stop";if(e<=-t.escalateThreshold)return"escalate";if(e<=-t.warnThreshold)return"warn";return"continue"}function Gh(e,t,n){if(t.oracleFrequency==="off")return null;if(t.oracleFrequency==="final-only")return null;if(n!=="stop")return null;if(!e.oracleVerified)return"oracle";if(e.deviations.some((o)=>o.severity==="grave"))return"user";return t.defaultEscalationTarget}function Dd(e,t,n,o){if(o)return`Paralysis detected: forced continue despite score ${e.toFixed(3)} (too many consecutive stops)`;let r=[...n].sort((c,u)=>c.weightedScore-u.weightedScore),i=r[0],s=r[r.length-1],a=[];if(i.weightedScore<0)a.push(`primary concern: ${i.description}`);if(s.weightedScore>0)a.push(`positive signal: ${s.description}`);return`${{continue:"Continue",warn:"Warn",escalate:"Escalate",stop:"Stop"}[t]} (score: ${e.toFixed(3)}): ${a.join("; ")||"balanced signals"}`}function Pd(e,t,n=Date.now()){let o={...Ko(),...t},r=e.deviations.map((d)=>({...d}));if(!Number.isFinite(e.iterationRatio)||!Number.isFinite(e.ambient.iteration)||!Number.isFinite(e.ambient.maxIterations))return{decision:{action:"continue",score:0,reasoning:"Score neutral: NaN detected in input(s); defaulting to continue.",evidence:[],shouldEscalateTo:null},contributions:[],rawScore:0,paralysisOverride:!1,computedAtISO:new Date().toISOString()};let i=Nh(e,n),s=i.reduce((d,b)=>d+b.weightedScore,0),a=Math.max(Math.min(s,1),-1),l=e.slotMemory.consecutiveStops>=o.paralysisThreshold&&a<=-o.warnThreshold,c=l?"continue":Zh(a,o),u=[];if(c!=="continue"||Math.abs(a)<o.continueThreshold){for(let d of i)if(Math.abs(d.weightedScore)>0.01)u.push({source:d.source,value:d.description,confidence:Math.abs(d.rawScore),weight:d.weight});if(u.length===0&&c!=="continue")u.push({source:"ambient",value:Dd(a,c,i,l),confidence:0.5,weight:0.1})}let f=Gh(e,o,c);return{decision:{action:c,score:a,reasoning:Dd(a,c,i,l),evidence:u,shouldEscalateTo:f},contributions:i,rawScore:a,paralysisOverride:l,computedAtISO:new Date().toISOString()}}var Xo=()=>({enabled:!0,maxHistoryPerSession:50,forceContinueAfterStops:3,warnMessageTemplate:"[MetaGovernor] Score {score}: {reasoning}. Evidence: {evidenceCount} signal(s).",escalateMessageTemplate:"[MetaGovernor] Escalating to {target}: {reasoning}",stopMessageTemplate:"[MetaGovernor] STOP — {reasoning}. Evidence: {evidenceCount} signal(s)."});function tn(e,t){let n=e;for(let[o,r]of Object.entries(t))n=n.replaceAll(`{${o}}`,r);return n}function Wh(e){return e.length}function Od(e,t){let n={...Xo(),...t};if(!n.enabled)return{action:"continue",message:null,historyEntry:{decision:e.scoringResult.decision,action:"continue",timestampISO:new Date().toISOString(),sessionID:e.sessionID,reasoning:"Decision handler disabled — pass-through continue"}};let o=e.scoringResult.decision,{score:r,reasoning:i}=o,s=Wh(o.evidence),a=o.shouldEscalateTo??n.defaultEscalationTarget??"oracle";if(e.scoringResult.paralysisOverride)return{action:"continue",message:tn(n.warnMessageTemplate,{score:r.toFixed(3),reasoning:`Paralysis detected — forced continue. ${i}`,evidenceCount:String(s)}),historyEntry:{decision:o,action:"continue",timestampISO:new Date().toISOString(),sessionID:e.sessionID,reasoning:`Paralysis override: ${i}`}};switch(o.action){case"continue":return{action:"continue",message:null,historyEntry:{decision:o,action:"continue",timestampISO:new Date().toISOString(),sessionID:e.sessionID,reasoning:i}};case"warn":return{action:"warn",message:tn(n.warnMessageTemplate,{score:r.toFixed(3),reasoning:i,evidenceCount:String(s)}),historyEntry:{decision:o,action:"warn",timestampISO:new Date().toISOString(),sessionID:e.sessionID,reasoning:i}};case"escalate":return{action:"escalate",message:tn(n.escalateMessageTemplate,{target:a,reasoning:i}),historyEntry:{decision:o,action:"escalate",timestampISO:new Date().toISOString(),sessionID:e.sessionID,reasoning:`Escalate to ${a}: ${i}`}};case"stop":return{action:"stop",message:tn(n.stopMessageTemplate,{reasoning:i,evidenceCount:String(s)}),historyEntry:{decision:o,action:"stop",timestampISO:new Date().toISOString(),sessionID:e.sessionID,reasoning:i}}}}function Fx(e,t){if(e.length<=t)return{trimmed:[...e],dropped:0};let n=e.length-t;return{trimmed:e.slice(-t),dropped:n}}function Ed(e){let t=0;for(let n=e.length-1;n>=0;n--)if(e[n].action==="stop")t++;else break;return t}var Rd={leve:0,media:1,grave:2};function Hh(e,t,n){let o=`${e}-${t}-${n}`.split("").reduce((r,i)=>(r<<5)-r+i.charCodeAt(0)|0,0);return`D-${Math.abs(o).toString(36)}`}function zd(e,t){let n=Rd[t]??0;return e.some((o)=>(Rd[o.severity]??0)>=n)}function Vh(e,t=[]){let n=new Set;for(let o of e)if(n.add(o.category),n.add(o.severity),o.filePath){let r=o.filePath.split("/").pop()??o.filePath;n.add(r)}for(let o of t){let r=o.split("/").pop()??o;if(r)n.add(r)}return[...n]}function Bh(e,t){let n=t.map((o)=>`[${o.severity}] ${o.category}: ${o.detail}`).join("; ");return`Action "${e.action}" (score ${e.score.toFixed(2)}) after deviations: ${n}. Reasoning: ${e.reasoning}`}async function Cd(e,t){let{decision:n,config:o,sessionID:r,directory:i,filesChanged:s}=e,a=new Date().toISOString();if(!o.enabled)return{lessonSaved:null,decisionSaved:null,reason:"closed-loop learning disabled"};if(n.evidence.length===0&&n.action==="continue")return{lessonSaved:null,decisionSaved:null,reason:"no deviations to learn from"};let l=null,c=null;if(o.saveDecisions){let b={id:Hh(r,n.action,a),timestampISO:a,action:n.action,score:n.score,reasoning:n.reasoning,sessionID:r,directory:i,deviations:n.evidence.filter((w)=>w.source==="deviation-detector").map((w)=>({severity:"media",category:w.source,detail:w.value}))};try{await t.saveMemory({content:`Decision: ${n.action} (score ${n.score.toFixed(2)}). ${n.reasoning}`,concepts:["meta-governor","decision",n.action],type:"fact",files:[...s]}),c=b}catch{}}let u=n.evidence.filter((b)=>b.source==="deviation-detector").map((b)=>({severity:"media",category:b.source,detail:b.value})),f=e.currentLessonCount??0;if(f>=o.maxLessonsPerSession)return{lessonSaved:null,decisionSaved:c,reason:`maxLessonsPerSession cap reached (${f} >= ${o.maxLessonsPerSession})`};let g=o.saveLessons!==!1;if(g&&zd(u,o.minSeverityToLearn)){let b=Vh(u,s),w=Bh(n,u);try{l={id:(await t.saveLesson({content:w,context:`session:${r} dir:${i}`,confidence:Math.max(0.3,Math.min(0.8,Math.abs(n.score))),tags:b})).id,title:`${n.action} after ${u[0]?.category??"deviation"}`,content:w,type:"pattern",concepts:b,confidence:Math.max(0.3,Math.min(0.8,Math.abs(n.score))),files:[...s],sessionID:r}}catch{}}let d=[];if(c)d.push("decision saved");if(l)d.push("lesson saved");if(!c&&!l)if(!g)d.push("saveLessons disabled");else if(!zd(u,o.minSeverityToLearn))d.push("severity below threshold");else d.push("no saveable content");return{lessonSaved:l,decisionSaved:c,reason:d.join("; ")||"no action taken"}}function rn(){return{enabled:!0,minSeverityToLearn:"media",maxLessonsPerSession:20,saveDecisions:!0,saveLessons:!0}}var Kh=()=>({enabled:!0,memory:{enabled:!0,query:"",timeoutMs:3000},tokenPredictor:{},oracle:{frequency:"per-stop"},scoring:{oracleFrequency:"per-stop"},decision:{},closedLoop:{},intervention:{mode:"silent",includeDecisionHistory:!0,maxHistoryMessages:5,minActionForMessage:"stop",maxInterventionsPerSession:3,respectDoneSignal:!0,phaseAwareDoneSignal:!1,persistToSession:!0,compactionLoopGuard:{enabled:!0,maxOverflowRecoveries:1}},protocolEnforcement:{enabled:!1,path:void 0,injectIntoSystem:!1,auditToolCalls:!1},skillPriming:{enabled:!1,trigger:"firstImplement",router:"both",enforceMode:"directive"},skillHub:{enabled:!1,syncIntervalMs:86400000,bootstrapUrl:"https://skills-library.com/api/skills.json",searchFallbackUrl:"https://skills.sh/api/search",downloadBaseUrl:"https://skills.sh/api/download",embedBaseUrl:"http://127.0.0.1:3114/v1",embedModel:"bge-m3",minInstalls:0,filterDuplicates:!0,depsCheck:!0,choreDir:Jh(qh(),".agents","skills"),autoMaterialize:!0},graphSync:{killOrphanedOnInit:!0,reindexOnFetch:!0,fetchBranch:"main",autoUpgrade:!0,upgradeCachePath:void 0,checkGraphifyNeedsUpdate:!0,addToGlobalGraph:!1},graphRetrieval:{preferredTool:"auto",preferLocalCodegraph:!1,contextRouting:!1},cliAnything:{enabled:!0,autoInstall:!0,autoUpgrade:!0,cachePath:void 0,upgradeCheckTtlMs:void 0,cliHubBin:"cli-hub",skillsBin:"npx skills",installScope:"global"}}),Yo={query:"",timestampISO:new Date().toISOString(),agentmemory:{available:!1,lessons:[]},boulderState:{available:!1,tasks:[],planProgress:0},degradedSources:["agentmemory","boulderState"]},Xh={consecutiveStops:0,consecutiveContinues:0,lastUpdatedISO:new Date().toISOString()},Yh={action:"continue",message:null,historyEntry:{decision:{action:"continue",score:0,reasoning:"no decision made",evidence:[],shouldEscalateTo:null},action:"continue",timestampISO:new Date().toISOString(),sessionID:"",reasoning:"no decision made"}};function Qh(e,t=Yo){let n=e.maxIterations>0?e.iteration/e.maxIterations:0,o={...Xh,consecutiveStops:e.consecutiveStops??0};return{oracleVerified:e.oracleVerified,noProgress:e.noProgress,deviations:e.deviations,iterationRatio:n,lessonsRelevant:t.agentmemory.lessons,slotMemory:o,ambient:{sessionID:e.sessionID,directory:".",mode:"simple",agentName:e.agentName??"unknown",iteration:e.iteration,maxIterations:e.maxIterations}}}async function Ad(e,t={}){let n={...Kh(),...t};if(!n.enabled)return{memoryRead:Yo,tokenPrediction:Md(e),scoringResult:{decision:{action:"continue",score:0,reasoning:"MetaGovernor disabled",evidence:[],shouldEscalateTo:null},contributions:[],rawScore:0,paralysisOverride:!1,computedAtISO:new Date().toISOString()},decision:Yh,lessonSaved:null,decisionHistory:[],skipped:!0,skipReason:"disabled"};let o=Yo;if(n.memory.enabled)try{let c={agentmemory:e.backends.agentmemory,boulderState:e.backends.boulderState};o=await Sd({directory:".",sessionID:e.sessionID,query:n.memory.query||e.toolName},c)}catch{}let r;try{r=Td({currentUsage:e.recentTurnTokens.reduce((c,u)=>c+u,0),modelLimit:e.modelLimit??t.modelOverride?.modelLimit??200000,recentTurnTokens:e.recentTurnTokens,timestampISO:new Date().toISOString(),providerID:e.providerID??"",modelID:e.modelID??"",config:n.tokenPredictor})}catch{r=Md(e)}let i=Pd(Qh(e,o),n.scoring),s={sessionID:e.sessionID,scoringResult:i},a=Od(s,n.decision),l=null;try{if(n.closedLoop.enabled!==!1)l=await Cd({decision:a.historyEntry.decision,memoryRead:o,config:{...rn(),...n.closedLoop},sessionID:e.sessionID,directory:".",filesChanged:e.filePaths??[],currentLessonCount:e.currentLessonCount},e.writeBackend)}catch{}return{memoryRead:o,tokenPrediction:r,scoringResult:i,decision:a,lessonSaved:l,decisionHistory:[a.historyEntry],skipped:!1}}function Md(e){let t=e.recentTurnTokens.reduce((n,o)=>n+o,0);return{burnRate:0,budgetLeft:200000,currentUsage:t,modelLimit:200000,willOverflowAt:null,recommendation:"no-action",confidence:1,windowRemaining:200000,input:{currentUsage:t,modelLimit:200000,recentTurnTokens:e.recentTurnTokens,timestampISO:new Date().toISOString(),providerID:e.providerID??"",modelID:e.modelID??"",config:{compactBurnRateThreshold:500,compactUsageThreshold:0.85,switchModelUsageThreshold:0.95,delegateConsecutiveHighBurn:5,windowSize:10}},computedAtISO:new Date().toISOString(),turnsAnalyzed:e.recentTurnTokens.length,recommendations:[]}}import{createRequire as ev}from"node:module";var Nd=ev(import.meta.url);function tv(e){if(typeof process<"u"&&process.versions?.bun){let n=Nd("bun:sqlite");if(!n.Database)throw Error("sqlite-driver: bun:sqlite loaded but Database export missing");return new n.Database(e,{create:!0})}let t;try{t=Nd("node:sqlite")}catch{throw Error("sqlite-driver: node:sqlite is unavailable. omo-meta-governor MCP mode requires Bun, or Node >= 23.4 (Node 22.5-23.3 needs --experimental-sqlite).")}if(!t.DatabaseSync)throw Error("sqlite-driver: node:sqlite loaded but DatabaseSync export missing (Node too old?). Use Bun or Node >= 23.4.");return new t.DatabaseSync(e)}class jd{raw;constructor(e){this.raw=e}run(...e){return this.raw.run(...e)}get(...e){return this.raw.get(...e)}all(...e){let t=this.raw.all(...e);return Array.isArray(t)?t:[]}}class Ud{raw;constructor(e){this.raw=e}exec(e){this.raw.exec(e)}prepare(e){return new jd(this.raw.prepare(e))}query(e){return this.prepare(e)}close(){this.raw.close()}}function Ld(e){return new Ud(tv(e))}import{existsSync as rv,mkdirSync as nv}from"node:fs";import{join as Fd}from"node:path";import{homedir as ov}from"node:os";function iv(){let e=Fd(ov(),".omo-meta-governor");if(!rv(e))nv(e,{recursive:!0});return Fd(e,"meta-governor.db")}var Qo="1",sv=`
39
+ … (${n.length-t} chars truncated) …`}var $g=()=>{};Qr();Kr();import{randomUUID as qT,createHash as Nw}from"node:crypto";import{fileURLToPath as jw}from"node:url";Bt();Tt();import{existsSync as $h,readFileSync as Sh,writeFileSync as Ih,mkdirSync as Th}from"node:fs";import{dirname as Dh}from"node:path";import{execSync as Ph}from"node:child_process";try{et({oldPaths:Qe(),newPaths:ve()})}catch{}function Oh(e){if(!$h(e))return null;try{return JSON.parse(Sh(e,"utf8"))}catch{return null}}function Eh(e,t){try{Th(Dh(e),{recursive:!0}),Ih(e,JSON.stringify(t,null,2),"utf8")}catch{}}async function _d(e={}){let t={enabled:e.enabled??!0,autoInstall:e.autoInstall??!0,autoUpgrade:e.autoUpgrade??!0,cachePath:e.cachePath??ve().cliAnythingUpgradeCheck,upgradeCheckTtlMs:e.upgradeCheckTtlMs??86400000,projectDir:e.projectDir,runner:e.runner,installScope:e.installScope??"global",cliHubBin:e.cliHubBin,skillsBin:e.skillsBin,installTimeoutMs:e.installTimeoutMs??60000};if(!t.enabled)return{attempted:!1,codes:["cli-anything-upgrade-skipped"],availability:{cliHub:!1,cliHubVersion:null,metaSkill:!1},alreadyInitialized:!0};let n=[],i=t.runner??((a,l)=>Ph(a,{timeout:l?.timeoutMs??1e4,encoding:"utf8",stdio:["ignore","pipe","pipe"]})),r=en(i),o=bd(t.installScope,i,1e4,t.skillsBin),s={cliHub:r!==null,cliHubVersion:r,metaSkill:o};if(r===null&&t.autoInstall){let a=dd(i,t.installTimeoutMs);if(n.push(a.code),a.ok){let l=en(i);s.cliHub=!0,s.cliHubVersion=l}}else if(r!==null)n.push("cli-anything-already-installed");if(!o&&t.autoInstall){let a=vd(t.installScope,i,t.installTimeoutMs,t.skillsBin);if(n.push(a.code),a.ok)s.metaSkill=!0}else if(o)n.push("skill-already-current");if(t.autoUpgrade){let a=Oh(t.cachePath),l=Date.now(),c=!0;if(a?.updatedAtISO){let f=Date.parse(a.updatedAtISO);if(Number.isFinite(f)&&l-f<t.upgradeCheckTtlMs)c=!1}let u=a?.cliHubLatestVersion??null;if(c)u=cd(i),Eh(t.cachePath,{cliHubLatestVersion:u,metaSkillLastCheckedISO:new Date(l).toISOString(),updatedAtISO:new Date(l).toISOString()});if(s.cliHub&&u!==null&&s.cliHubVersion!==null&&ud(u,s.cliHubVersion)>0){let f=md(i,t.installTimeoutMs);if(n.push(f.code),f.ok){let g=en(i);s.cliHubVersion=g}}else if(s.cliHub&&s.cliHubVersion);if(s.metaSkill){let f=yd(t.installScope,i,t.installTimeoutMs,t.skillsBin);if(f.ok||/no update/i.test(f.stderr)){if(!n.includes("skill-already-current"))n.push(f.ok?"skill-upgrade-succeeded":"skill-already-current")}else n.push(f.code)}}return{attempted:!0,codes:n,availability:s,alreadyInitialized:!1}}import{homedir as Kh}from"node:os";import{join as Xh}from"node:path";var kd={limits:{maxLessons:10,maxSlots:20,maxTasks:10},timeouts:{agentmemoryMs:2000,boulderStateMs:1000}};async function Sd(e,t){let n=performance.now(),i={...kd.limits,...e.limits},r={...kd.timeouts,...e.timeouts},[o,s]=await Promise.allSettled([Rh(e,t.agentmemory,i,r.agentmemoryMs),zh(e,t.boulderState,i,r.boulderStateMs)]),a=[],l={},c=o.status==="fulfilled"?o.value:(xd(a,l,"agentmemory",wd(o.reason)),$d.agentmemory),u=s.status==="fulfilled"?s.value:(xd(a,l,"boulderState",wd(s.reason)),$d.boulderState);return{query:e.query,timestampISO:new Date().toISOString(),agentmemory:c,boulderState:u,degradedSources:a,durationMs:performance.now()-n,errorMessages:l}}async function Rh(e,t,n,i){let r=await Id(t.smartSearch({query:e.query,limit:n.maxLessons}),i,"agentmemory");return{available:!0,lessons:Ch(r.lessons).slice(0,n.maxLessons).map((s)=>({id:s.id,title:s.title,advice:s.advice??"info",confidence:s.confidence,concepts:s.concepts}))}}async function zh(e,t,n,i){let r=await Id(t.boulderRead({directory:e.directory,sessionID:e.sessionID,query:e.query}),i,"boulderState");return{available:!0,tasks:r.sort((s,a)=>s.priority-a.priority||a.updatedAtMs-s.updatedAtMs).slice(0,n.maxTasks).map((s)=>({id:s.id,status:s.status,title:s.title})),planProgress:Ah(r)}}function Ch(e){return[...e].sort((t,n)=>n.confidence-t.confidence)}function Ah(e){if(e.length===0)return 0;return e.filter((n)=>n.status==="done").length/e.length}function wd(e){if(e instanceof Error)return e.message;if(typeof e==="string")return e;return"unknown error"}function xd(e,t,n,i){e.push(n),t[n]=i}var $d={agentmemory:{available:!1,lessons:[]},boulderState:{available:!1,tasks:[],planProgress:0}};async function Id(e,t,n){return new Promise((i,r)=>{let o=setTimeout(()=>r(Error(`${n} timeout after ${t}ms`)),t);e.then((s)=>{clearTimeout(o),i(s)},(s)=>{clearTimeout(o),r(s)})})}function Zx(){return{compactBurnRateThreshold:500,compactUsageThreshold:0.85,switchModelUsageThreshold:0.95,delegateConsecutiveHighBurn:5,windowSize:10}}function Mh(e){if(e.length===0)return 0;return e.reduce((n,i)=>n+i,0)/e.length}function Nh(e,t){let n=0;for(let i=e.length-1;i>=0;i--)if(e[i]>=t)n++;else break;return n}function jh(e,t,n,i){let r=t-e;if(r<=0)return i;if(n<=0)return null;let o=Math.floor(r/n);if(o<=0)return i;let s=o*2;return new Date(new Date(i).getTime()+s*1000).toISOString()}function Td(e){let{currentUsage:t,modelLimit:n,recentTurnTokens:i,timestampISO:r,config:o}=e,s=i.slice(-o.windowSize),a=Mh(s),l=n-t,c=n>0?t/n:1,u=Math.min(0.95,0.3+s.length/o.windowSize*0.65),f="no-action",g=[],d="within normal parameters";if(c>=o.switchModelUsageThreshold)d=`context usage ${(c*100).toFixed(1)}% exceeds switch threshold ${(o.switchModelUsageThreshold*100).toFixed(1)}%`,g.push("switch-model");if(c>=o.compactUsageThreshold||a>=o.compactBurnRateThreshold){if(f==="no-action")f="compact-now",d=c>=o.compactUsageThreshold?`context usage ${(c*100).toFixed(1)}% exceeds compact threshold ${(o.compactUsageThreshold*100).toFixed(1)}%`:`burn rate ${a.toFixed(0)} tokens/turn exceeds threshold ${o.compactBurnRateThreshold}`}let b=Nh(s,o.compactBurnRateThreshold);if(b>=o.delegateConsecutiveHighBurn&&f==="no-action")d=`${b} consecutive high-burn turns (threshold: ${o.delegateConsecutiveHighBurn})`,g.push("delegate-to-subagent");let x=jh(t,n,a,r);return{currentUsage:t,burnRate:a,budgetLeft:l,willOverflowAt:x,recommendation:f,recommendations:g,confidence:u,modelLimit:n,windowRemaining:Math.max(0,Math.floor(l/Math.max(a,1))),input:{...e},computedAtISO:r,turnsAnalyzed:s.length}}var je={"oracle-verified":0.25,"no-progress-detector":0.2,"deviation-detector":0.2,"iteration-budget":0.15,"lesson-recall":0.1,"token-predictor":0.1},Ji=()=>({continueThreshold:0.3,warnThreshold:0.3,escalateThreshold:0.45,stopThreshold:0.55,paralysisThreshold:3,defaultEscalationTarget:"oracle",oracleFrequency:"per-stop"});function Uh(e,t){let n=[];n.push({source:"oracle-verified",rawScore:e.oracleVerified?0.6:0,weight:je["oracle-verified"],weightedScore:e.oracleVerified?0.6*je["oracle-verified"]:0,description:e.oracleVerified?"Oracle verification passed":"No Oracle verification"}),n.push({source:"no-progress-detector",rawScore:e.noProgress?-0.8:0,weight:je["no-progress-detector"],weightedScore:e.noProgress?-0.8*je["no-progress-detector"]:0,description:e.noProgress?"No progress detected in last turn":"Progress detected"});let i=Lh(e.deviations,t),r=60000,o=e.deviations.filter((l)=>l.ts===void 0||t-l.ts<=r);n.push({source:"deviation-detector",rawScore:i,weight:je["deviation-detector"],weightedScore:i*je["deviation-detector"],description:o.length>0?`${o.length} deviation(s) detected (worst: ${o[0].severity})`:"No deviations detected"});let s=Fh(e.iterationRatio);n.push({source:"iteration-budget",rawScore:s,weight:je["iteration-budget"],weightedScore:s*je["iteration-budget"],description:`Iteration ratio: ${e.iterationRatio.toFixed(2)} (${e.ambient.iteration}/${e.ambient.maxIterations})`});let a=Gh(e.lessonsRelevant);return n.push({source:"lesson-recall",rawScore:a,weight:je["lesson-recall"],weightedScore:a*je["lesson-recall"],description:e.lessonsRelevant.length>0?`${e.lessonsRelevant.length} relevant lesson(s) (avg confidence: ${Zh(e.lessonsRelevant).toFixed(2)})`:"No relevant lessons"}),n}function Lh(e,t=Date.now()){let i=e.filter((a)=>a.ts===void 0||t-a.ts<=60000);if(i.length===0)return 0;let r={grave:-0.9,media:-0.5,leve:-0.2},o=0;for(let a of i){let l=r[a.severity]??-0.3;if(l<o)o=l}let s=Math.min(i.length*0.05,0.2);return Math.max(o-s,-1)}function Fh(e){if(e<=0.5)return-e*0.6;return-0.3-(e-0.5)*1}function Gh(e){if(e.length===0)return 0;let t=0;for(let n of e)t+=({continue:0.3,info:0,warn:-0.3,stop:-0.7}[n.advice]??0)*n.confidence;return Math.max(Math.min(t/e.length,1),-1)}function Zh(e){if(e.length===0)return 0;return e.reduce((t,n)=>t+n.confidence,0)/e.length}function Wh(e,t){if(e>=t.continueThreshold)return"continue";if(e<=-t.stopThreshold)return"stop";if(e<=-t.escalateThreshold)return"escalate";if(e<=-t.warnThreshold)return"warn";return"continue"}function Hh(e,t,n){if(t.oracleFrequency==="off")return null;if(t.oracleFrequency==="final-only")return null;if(n!=="stop")return null;if(!e.oracleVerified)return"oracle";if(e.deviations.some((i)=>i.severity==="grave"))return"user";return t.defaultEscalationTarget}function Dd(e,t,n,i){if(i)return`Paralysis detected: forced continue despite score ${e.toFixed(3)} (too many consecutive stops)`;let r=[...n].sort((c,u)=>c.weightedScore-u.weightedScore),o=r[0],s=r[r.length-1],a=[];if(o.weightedScore<0)a.push(`primary concern: ${o.description}`);if(s.weightedScore>0)a.push(`positive signal: ${s.description}`);return`${{continue:"Continue",warn:"Warn",escalate:"Escalate",stop:"Stop"}[t]} (score: ${e.toFixed(3)}): ${a.join("; ")||"balanced signals"}`}function Pd(e,t,n=Date.now()){let i={...Ji(),...t},r=e.deviations.map((d)=>({...d}));if(!Number.isFinite(e.iterationRatio)||!Number.isFinite(e.ambient.iteration)||!Number.isFinite(e.ambient.maxIterations))return{decision:{action:"continue",score:0,reasoning:"Score neutral: NaN detected in input(s); defaulting to continue.",evidence:[],shouldEscalateTo:null},contributions:[],rawScore:0,paralysisOverride:!1,computedAtISO:new Date().toISOString()};let o=Uh(e,n),s=o.reduce((d,b)=>d+b.weightedScore,0),a=Math.max(Math.min(s,1),-1),l=e.slotMemory.consecutiveStops>=i.paralysisThreshold&&a<=-i.warnThreshold,c=l?"continue":Wh(a,i),u=[];if(c!=="continue"||Math.abs(a)<i.continueThreshold){for(let d of o)if(Math.abs(d.weightedScore)>0.01)u.push({source:d.source,value:d.description,confidence:Math.abs(d.rawScore),weight:d.weight});if(u.length===0&&c!=="continue")u.push({source:"ambient",value:Dd(a,c,o,l),confidence:0.5,weight:0.1})}let f=Hh(e,i,c);return{decision:{action:c,score:a,reasoning:Dd(a,c,o,l),evidence:u,shouldEscalateTo:f},contributions:o,rawScore:a,paralysisOverride:l,computedAtISO:new Date().toISOString()}}var Ki=()=>({enabled:!0,maxHistoryPerSession:50,forceContinueAfterStops:3,warnMessageTemplate:"[MetaGovernor] Score {score}: {reasoning}. Evidence: {evidenceCount} signal(s).",escalateMessageTemplate:"[MetaGovernor] Escalating to {target}: {reasoning}",stopMessageTemplate:"[MetaGovernor] STOP — {reasoning}. Evidence: {evidenceCount} signal(s)."});function tn(e,t){let n=e;for(let[i,r]of Object.entries(t))n=n.replaceAll(`{${i}}`,r);return n}function Vh(e){return e.length}function Od(e,t){let n={...Ki(),...t};if(!n.enabled)return{action:"continue",message:null,historyEntry:{decision:e.scoringResult.decision,action:"continue",timestampISO:new Date().toISOString(),sessionID:e.sessionID,reasoning:"Decision handler disabled — pass-through continue"}};let i=e.scoringResult.decision,{score:r,reasoning:o}=i,s=Vh(i.evidence),a=i.shouldEscalateTo??n.defaultEscalationTarget??"oracle";if(e.scoringResult.paralysisOverride)return{action:"continue",message:tn(n.warnMessageTemplate,{score:r.toFixed(3),reasoning:`Paralysis detected — forced continue. ${o}`,evidenceCount:String(s)}),historyEntry:{decision:i,action:"continue",timestampISO:new Date().toISOString(),sessionID:e.sessionID,reasoning:`Paralysis override: ${o}`}};switch(i.action){case"continue":return{action:"continue",message:null,historyEntry:{decision:i,action:"continue",timestampISO:new Date().toISOString(),sessionID:e.sessionID,reasoning:o}};case"warn":return{action:"warn",message:tn(n.warnMessageTemplate,{score:r.toFixed(3),reasoning:o,evidenceCount:String(s)}),historyEntry:{decision:i,action:"warn",timestampISO:new Date().toISOString(),sessionID:e.sessionID,reasoning:o}};case"escalate":return{action:"escalate",message:tn(n.escalateMessageTemplate,{target:a,reasoning:o}),historyEntry:{decision:i,action:"escalate",timestampISO:new Date().toISOString(),sessionID:e.sessionID,reasoning:`Escalate to ${a}: ${o}`}};case"stop":return{action:"stop",message:tn(n.stopMessageTemplate,{reasoning:o,evidenceCount:String(s)}),historyEntry:{decision:i,action:"stop",timestampISO:new Date().toISOString(),sessionID:e.sessionID,reasoning:o}}}}function Vx(e,t){if(e.length<=t)return{trimmed:[...e],dropped:0};let n=e.length-t;return{trimmed:e.slice(-t),dropped:n}}function Ed(e){let t=0;for(let n=e.length-1;n>=0;n--)if(e[n].action==="stop")t++;else break;return t}var Rd={leve:0,media:1,grave:2};function Bh(e,t,n){let i=`${e}-${t}-${n}`.split("").reduce((r,o)=>(r<<5)-r+o.charCodeAt(0)|0,0);return`D-${Math.abs(i).toString(36)}`}function zd(e,t){let n=Rd[t]??0;return e.some((i)=>(Rd[i.severity]??0)>=n)}function qh(e,t=[]){let n=new Set;for(let i of e)if(n.add(i.category),n.add(i.severity),i.filePath){let r=i.filePath.split("/").pop()??i.filePath;n.add(r)}for(let i of t){let r=i.split("/").pop()??i;if(r)n.add(r)}return[...n]}function Jh(e,t){let n=t.map((i)=>`[${i.severity}] ${i.category}: ${i.detail}`).join("; ");return`Action "${e.action}" (score ${e.score.toFixed(2)}) after deviations: ${n}. Reasoning: ${e.reasoning}`}async function Cd(e,t){let{decision:n,config:i,sessionID:r,directory:o,filesChanged:s}=e,a=new Date().toISOString();if(!i.enabled)return{lessonSaved:null,decisionSaved:null,reason:"closed-loop learning disabled"};if(n.evidence.length===0&&n.action==="continue")return{lessonSaved:null,decisionSaved:null,reason:"no deviations to learn from"};let l=null,c=null;if(i.saveDecisions){let b={id:Bh(r,n.action,a),timestampISO:a,action:n.action,score:n.score,reasoning:n.reasoning,sessionID:r,directory:o,deviations:n.evidence.filter((x)=>x.source==="deviation-detector").map((x)=>({severity:"media",category:x.source,detail:x.value}))};try{await t.saveMemory({content:`Decision: ${n.action} (score ${n.score.toFixed(2)}). ${n.reasoning}`,concepts:["meta-governor","decision",n.action],type:"fact",files:[...s]}),c=b}catch{}}let u=n.evidence.filter((b)=>b.source==="deviation-detector").map((b)=>({severity:"media",category:b.source,detail:b.value})),f=e.currentLessonCount??0;if(f>=i.maxLessonsPerSession)return{lessonSaved:null,decisionSaved:c,reason:`maxLessonsPerSession cap reached (${f} >= ${i.maxLessonsPerSession})`};let g=i.saveLessons!==!1;if(g&&zd(u,i.minSeverityToLearn)){let b=qh(u,s),x=Jh(n,u);try{l={id:(await t.saveLesson({content:x,context:`session:${r} dir:${o}`,confidence:Math.max(0.3,Math.min(0.8,Math.abs(n.score))),tags:b})).id,title:`${n.action} after ${u[0]?.category??"deviation"}`,content:x,type:"pattern",concepts:b,confidence:Math.max(0.3,Math.min(0.8,Math.abs(n.score))),files:[...s],sessionID:r}}catch{}}let d=[];if(c)d.push("decision saved");if(l)d.push("lesson saved");if(!c&&!l)if(!g)d.push("saveLessons disabled");else if(!zd(u,i.minSeverityToLearn))d.push("severity below threshold");else d.push("no saveable content");return{lessonSaved:l,decisionSaved:c,reason:d.join("; ")||"no action taken"}}function rn(){return{enabled:!0,minSeverityToLearn:"media",maxLessonsPerSession:20,saveDecisions:!0,saveLessons:!0}}var Yh=()=>({enabled:!0,memory:{enabled:!0,query:"",timeoutMs:3000},tokenPredictor:{},oracle:{frequency:"per-stop"},scoring:{oracleFrequency:"per-stop"},decision:{},closedLoop:{},intervention:{mode:"silent",includeDecisionHistory:!0,maxHistoryMessages:5,minActionForMessage:"stop",maxInterventionsPerSession:3,respectDoneSignal:!0,phaseAwareDoneSignal:!1,persistToSession:!0,compactionLoopGuard:{enabled:!0,maxOverflowRecoveries:1}},protocolEnforcement:{enabled:!1,path:void 0,injectIntoSystem:!1,auditToolCalls:!1},skillPriming:{enabled:!1,trigger:"firstImplement",router:"both",enforceMode:"directive"},skillHub:{enabled:!1,syncIntervalMs:86400000,bootstrapUrl:"https://skills-library.com/api/skills.json",searchFallbackUrl:"https://skills.sh/api/search",downloadBaseUrl:"https://skills.sh/api/download",embedBaseUrl:"http://127.0.0.1:3114/v1",embedModel:"bge-m3",minInstalls:0,filterDuplicates:!0,depsCheck:!0,choreDir:Xh(Kh(),".agents","skills"),autoMaterialize:!0},graphSync:{killOrphanedOnInit:!0,reindexOnFetch:!0,fetchBranch:"main",autoUpgrade:!0,upgradeCachePath:void 0,checkGraphifyNeedsUpdate:!0,addToGlobalGraph:!1},graphRetrieval:{preferredTool:"auto",preferLocalCodegraph:!1,contextRouting:!1},cliAnything:{enabled:!0,autoInstall:!0,autoUpgrade:!0,cachePath:void 0,upgradeCheckTtlMs:void 0,cliHubBin:"cli-hub",skillsBin:"npx skills",installScope:"global"}}),Xi={query:"",timestampISO:new Date().toISOString(),agentmemory:{available:!1,lessons:[]},boulderState:{available:!1,tasks:[],planProgress:0},degradedSources:["agentmemory","boulderState"]},Qh={consecutiveStops:0,consecutiveContinues:0,lastUpdatedISO:new Date().toISOString()},ev={action:"continue",message:null,historyEntry:{decision:{action:"continue",score:0,reasoning:"no decision made",evidence:[],shouldEscalateTo:null},action:"continue",timestampISO:new Date().toISOString(),sessionID:"",reasoning:"no decision made"}};function tv(e,t=Xi){let n=e.maxIterations>0?e.iteration/e.maxIterations:0,i={...Qh,consecutiveStops:e.consecutiveStops??0};return{oracleVerified:e.oracleVerified,noProgress:e.noProgress,deviations:e.deviations,iterationRatio:n,lessonsRelevant:t.agentmemory.lessons,slotMemory:i,ambient:{sessionID:e.sessionID,directory:".",mode:"simple",agentName:e.agentName??"unknown",iteration:e.iteration,maxIterations:e.maxIterations}}}async function Md(e,t={}){let n={...Yh(),...t};if(!n.enabled)return{memoryRead:Xi,tokenPrediction:Ad(e),scoringResult:{decision:{action:"continue",score:0,reasoning:"MetaGovernor disabled",evidence:[],shouldEscalateTo:null},contributions:[],rawScore:0,paralysisOverride:!1,computedAtISO:new Date().toISOString()},decision:ev,lessonSaved:null,decisionHistory:[],skipped:!0,skipReason:"disabled"};let i=Xi;if(n.memory.enabled)try{let c={agentmemory:e.backends.agentmemory,boulderState:e.backends.boulderState};i=await Sd({directory:".",sessionID:e.sessionID,query:n.memory.query||e.toolName},c)}catch{}let r;try{r=Td({currentUsage:e.recentTurnTokens.reduce((c,u)=>c+u,0),modelLimit:e.modelLimit??t.modelOverride?.modelLimit??200000,recentTurnTokens:e.recentTurnTokens,timestampISO:new Date().toISOString(),providerID:e.providerID??"",modelID:e.modelID??"",config:n.tokenPredictor})}catch{r=Ad(e)}let o=Pd(tv(e,i),n.scoring),s={sessionID:e.sessionID,scoringResult:o},a=Od(s,n.decision),l=null;try{if(n.closedLoop.enabled!==!1)l=await Cd({decision:a.historyEntry.decision,memoryRead:i,config:{...rn(),...n.closedLoop},sessionID:e.sessionID,directory:".",filesChanged:e.filePaths??[],currentLessonCount:e.currentLessonCount},e.writeBackend)}catch{}return{memoryRead:i,tokenPrediction:r,scoringResult:o,decision:a,lessonSaved:l,decisionHistory:[a.historyEntry],skipped:!1}}function Ad(e){let t=e.recentTurnTokens.reduce((n,i)=>n+i,0);return{burnRate:0,budgetLeft:200000,currentUsage:t,modelLimit:200000,willOverflowAt:null,recommendation:"no-action",confidence:1,windowRemaining:200000,input:{currentUsage:t,modelLimit:200000,recentTurnTokens:e.recentTurnTokens,timestampISO:new Date().toISOString(),providerID:e.providerID??"",modelID:e.modelID??"",config:{compactBurnRateThreshold:500,compactUsageThreshold:0.85,switchModelUsageThreshold:0.95,delegateConsecutiveHighBurn:5,windowSize:10}},computedAtISO:new Date().toISOString(),turnsAnalyzed:e.recentTurnTokens.length,recommendations:[]}}import{createRequire as rv}from"node:module";var Nd=rv(import.meta.url);function nv(e){if(typeof process<"u"&&process.versions?.bun){let n=Nd("bun:sqlite");if(!n.Database)throw Error("sqlite-driver: bun:sqlite loaded but Database export missing");return new n.Database(e,{create:!0})}let t;try{t=Nd("node:sqlite")}catch{throw Error("sqlite-driver: node:sqlite is unavailable. omo-meta-governor MCP mode requires Bun, or Node >= 23.4 (Node 22.5-23.3 needs --experimental-sqlite).")}if(!t.DatabaseSync)throw Error("sqlite-driver: node:sqlite loaded but DatabaseSync export missing (Node too old?). Use Bun or Node >= 23.4.");return new t.DatabaseSync(e)}class jd{raw;constructor(e){this.raw=e}run(...e){return this.raw.run(...e)}get(...e){return this.raw.get(...e)}all(...e){let t=this.raw.all(...e);return Array.isArray(t)?t:[]}}class Ud{raw;constructor(e){this.raw=e}exec(e){this.raw.exec(e)}prepare(e){return new jd(this.raw.prepare(e))}query(e){return this.prepare(e)}close(){this.raw.close()}}function Ld(e){return new Ud(nv(e))}import{existsSync as iv,mkdirSync as ov}from"node:fs";import{join as Fd}from"node:path";import{homedir as sv}from"node:os";function av(){let e=Fd(sv(),".omo-meta-governor");if(!iv(e))ov(e,{recursive:!0});return Fd(e,"meta-governor.db")}var Yi="1",lv=`
40
40
  CREATE TABLE IF NOT EXISTS _meta (
41
41
  key TEXT PRIMARY KEY,
42
42
  value TEXT NOT NULL
@@ -132,7 +132,7 @@ CREATE INDEX IF NOT EXISTS idx_skill_deps_dep ON skill_deps(dep_type, dep_name);
132
132
  CREATE INDEX IF NOT EXISTS idx_entries_kind ON entries(kind);
133
133
  CREATE INDEX IF NOT EXISTS idx_entries_session ON entries(session_id, directory);
134
134
  CREATE INDEX IF NOT EXISTS idx_boulder_dir_session ON boulder_tasks(directory, session_id);
135
- `;function Zd(e){let t=Date.now().toString(36),n=Math.floor(Math.random()*65535).toString(36);return`${e}-${t}-${n}`}class Wd{db;stmts;constructor(e){let t=e??iv();this.db=Ld(t),this.db.exec("PRAGMA journal_mode = WAL;"),this.db.exec("PRAGMA synchronous = NORMAL;"),this.db.exec("PRAGMA foreign_keys = ON;"),this.db.exec("PRAGMA busy_timeout = 5000;"),this.db.exec(sv);let n=this.db.prepare("SELECT value FROM _meta WHERE key = 'schema_version'").get();if(!n)this.db.prepare("INSERT INTO _meta (key, value) VALUES ('schema_version', ?)").run(Qo);else if(n.value!==Qo){if(n.value==="1"){if(!this.db.prepare("PRAGMA table_info(skills)").all().some((r)=>r.name==="last_materialized_at"))this.db.exec("ALTER TABLE skills ADD COLUMN last_materialized_at TEXT");this.db.prepare("UPDATE _meta SET value = ? WHERE key = 'schema_version'").run(Qo)}}this.stmts={insertEntry:this.db.prepare(`
135
+ `;function Gd(e){let t=Date.now().toString(36),n=Math.floor(Math.random()*65535).toString(36);return`${e}-${t}-${n}`}class Wd{db;stmts;constructor(e){let t=e??av();this.db=Ld(t),this.db.exec("PRAGMA journal_mode = WAL;"),this.db.exec("PRAGMA synchronous = NORMAL;"),this.db.exec("PRAGMA foreign_keys = ON;"),this.db.exec("PRAGMA busy_timeout = 5000;"),this.db.exec(lv);let n=this.db.prepare("SELECT value FROM _meta WHERE key = 'schema_version'").get();if(!n)this.db.prepare("INSERT INTO _meta (key, value) VALUES ('schema_version', ?)").run(Yi);else if(n.value!==Yi){if(n.value==="1"){if(!this.db.prepare("PRAGMA table_info(skills)").all().some((r)=>r.name==="last_materialized_at"))this.db.exec("ALTER TABLE skills ADD COLUMN last_materialized_at TEXT");this.db.prepare("UPDATE _meta SET value = ? WHERE key = 'schema_version'").run(Yi)}}this.stmts={insertEntry:this.db.prepare(`
136
136
  INSERT INTO entries (id, kind, title, content, context, advice, confidence, tags, files, session_id, directory, created_at)
137
137
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
138
138
  `),ftsSearch:this.db.prepare(`
@@ -147,13 +147,13 @@ CREATE INDEX IF NOT EXISTS idx_boulder_dir_session ON boulder_tasks(directory, s
147
147
  FROM boulder_tasks
148
148
  WHERE directory = ? AND session_id = ?
149
149
  ORDER BY priority ASC, updated_at_ms DESC
150
- `)}}saveMemory(e){let t=Zd("M"),n=(e.concepts[0]??"memory").slice(0,80);return this.stmts.insertEntry.run(t,"memory",n,e.content,"",null,0.5,JSON.stringify(e.concepts),JSON.stringify(e.files??[]),"","",Date.now()),Promise.resolve({id:t})}saveLesson(e){let t=Zd("L"),n=e.confidence??0.5,o=(e.content.split(`
151
- `)[0]??"lesson").slice(0,80);return this.stmts.insertEntry.run(t,"lesson",o,e.content,e.context,null,n,JSON.stringify(e.tags??[]),JSON.stringify([]),"","",Date.now()),Promise.resolve({id:t})}smartSearch(e){let t=e.limit??10,n=this.toFtsQuery(e.query),r=this.stmts.ftsSearch.all(n,t).map((i)=>({id:i.id,title:i.title,content:i.content,type:i.kind,concepts:Gd(i.tags),confidence:i.confidence,files:Gd(i.files),advice:i.advice??"info"}));return Promise.resolve({lessons:r,crystals:[]})}boulderRead(e){let n=this.stmts.boulderSelect.all(e.directory,e.sessionID).map((o)=>({id:o.id,title:o.title,priority:o.priority,status:o.status,description:o.description,createdAtMs:o.created_at_ms,updatedAtMs:o.updated_at_ms}));if(e.query){let o=e.query.toLowerCase();n=n.filter((r)=>r.title.toLowerCase().includes(o)||r.description.toLowerCase().includes(o))}return Promise.resolve(n)}skillSearch(e){let t=[],n=[];if(e.query){let s=this.toFtsQuery(e.query);if(s&&s!=='""')t.push("skills_fts MATCH ?"),n.push(s)}if(e.minInstalls!==void 0)t.push("installs >= ?"),n.push(e.minInstalls);let o=t.length>0?`WHERE ${t.join(" AND ")}`:"",r=e.filterDuplicates!==!1?50:100,i=this.db.prepare(`SELECT s.id, s.name, s.description, s.installs, s.skill_id, s.repo_url, s.download_count
150
+ `)}}saveMemory(e){let t=Gd("M"),n=(e.concepts[0]??"memory").slice(0,80);return this.stmts.insertEntry.run(t,"memory",n,e.content,"",null,0.5,JSON.stringify(e.concepts),JSON.stringify(e.files??[]),"","",Date.now()),Promise.resolve({id:t})}saveLesson(e){let t=Gd("L"),n=e.confidence??0.5,i=(e.content.split(`
151
+ `)[0]??"lesson").slice(0,80);return this.stmts.insertEntry.run(t,"lesson",i,e.content,e.context,null,n,JSON.stringify(e.tags??[]),JSON.stringify([]),"","",Date.now()),Promise.resolve({id:t})}smartSearch(e){let t=e.limit??10,n=this.toFtsQuery(e.query),r=this.stmts.ftsSearch.all(n,t).map((o)=>({id:o.id,title:o.title,content:o.content,type:o.kind,concepts:Zd(o.tags),confidence:o.confidence,files:Zd(o.files),advice:o.advice??"info"}));return Promise.resolve({lessons:r,crystals:[]})}boulderRead(e){let n=this.stmts.boulderSelect.all(e.directory,e.sessionID).map((i)=>({id:i.id,title:i.title,priority:i.priority,status:i.status,description:i.description,createdAtMs:i.created_at_ms,updatedAtMs:i.updated_at_ms}));if(e.query){let i=e.query.toLowerCase();n=n.filter((r)=>r.title.toLowerCase().includes(i)||r.description.toLowerCase().includes(i))}return Promise.resolve(n)}skillSearch(e){let t=[],n=[];if(e.query){let s=this.toFtsQuery(e.query);if(s&&s!=='""')t.push("skills_fts MATCH ?"),n.push(s)}if(e.minInstalls!==void 0)t.push("installs >= ?"),n.push(e.minInstalls);let i=t.length>0?`WHERE ${t.join(" AND ")}`:"",r=e.filterDuplicates!==!1?50:100,o=this.db.prepare(`SELECT s.id, s.name, s.description, s.installs, s.skill_id, s.repo_url, s.download_count
152
152
  FROM skills s
153
153
  JOIN skills_fts f ON f.rowid = (SELECT rowid FROM skills WHERE id = s.id)
154
- ${o}
154
+ ${i}
155
155
  ORDER BY rank
156
- LIMIT ?`).all(...n,r);return Promise.resolve(i)}skillGet(e){let t=this.db.prepare(`SELECT s.id, s.name, s.description, s.repo_url, s.installs, s.skill_id, s.download_count, s.last_synced, s.content_hash
156
+ LIMIT ?`).all(...n,r);return Promise.resolve(o)}skillGet(e){let t=this.db.prepare(`SELECT s.id, s.name, s.description, s.repo_url, s.installs, s.skill_id, s.download_count, s.last_synced, s.content_hash
157
157
  FROM skills s
158
158
  WHERE s.id = ?`).get(e);return Promise.resolve(t??null)}skillAddOrUpdate(e){let t=Date.now();return this.db.prepare(`
159
159
  INSERT INTO skills (id, name, description, repo_url, installs, skill_id, download_count, last_synced, content_hash)
@@ -167,10 +167,10 @@ CREATE INDEX IF NOT EXISTS idx_boulder_dir_session ON boulder_tasks(directory, s
167
167
  download_count = excluded.download_count,
168
168
  last_synced = excluded.last_synced,
169
169
  content_hash = excluded.content_hash
170
- `).run(e.id,e.name,e.description,e.repo_url,e.installs??0,e.skill_id,e.download_count??0,e.last_synced??t,e.content_hash),Promise.resolve(e.id)}setSkillMaterializedAt(e,t){this.db.prepare("UPDATE skills SET last_materialized_at = ? WHERE id LIKE ? OR id = ?").run(t,`%/${e}`,e)}getSkillMaterializedAt(e){return this.db.prepare("SELECT last_materialized_at FROM skills WHERE id = ?").get(e)?.last_materialized_at??null}skillReplaceDeps(e,t){this.db.exec("BEGIN");try{this.db.prepare("DELETE FROM skill_deps WHERE skill_id = ?").run(e);let n=this.db.prepare("INSERT OR IGNORE INTO skill_deps (skill_id, dep_type, dep_name) VALUES (?, ?, ?)"),o=0;for(let r of t)if(typeof r.depType==="string"&&r.depType.length>0&&typeof r.depName==="string"&&r.depName.length>0)n.run(e,r.depType,r.depName),o++;return this.db.exec("COMMIT"),Promise.resolve(o)}catch(n){throw this.db.exec("ROLLBACK"),n}}skillGetDeps(e){let t=this.db.prepare("SELECT dep_type AS depType, dep_name AS depName FROM skill_deps WHERE skill_id = ? ORDER BY dep_type ASC, dep_name ASC").all(e);return Promise.resolve(t)}close(){this.db.close()}toFtsQuery(e){let t=e.trim().split(/\s+/).filter(Boolean).map((n)=>n.replace(/["()*:^]/g,"")).filter(Boolean);if(t.length===0)return'""';return t.map((n)=>`"${n}"*`).join(" ")}}function Gd(e){try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}var ei=null;function nn(){if(!ei)ei=new Wd;return ei}var go={};dt(go,{$brand:()=>ri,$input:()=>il,$output:()=>ol,NEVER:()=>ti,TimePrecision:()=>ll,ZodAny:()=>Lm,ZodArray:()=>Wm,ZodBase64:()=>Sc,ZodBase64URL:()=>Ic,ZodBigInt:()=>Nr,ZodBigIntFormat:()=>Pc,ZodBoolean:()=>Ar,ZodCIDRv4:()=>xc,ZodCIDRv6:()=>$c,ZodCUID:()=>hc,ZodCUID2:()=>vc,ZodCatch:()=>cp,ZodCodec:()=>Uc,ZodCustom:()=>fo,ZodCustomStringFormat:()=>Cr,ZodDate:()=>uo,ZodDefault:()=>np,ZodDiscriminatedUnion:()=>Hm,ZodE164:()=>Tc,ZodEmail:()=>pc,ZodEmoji:()=>fc,ZodEnum:()=>Rr,ZodError:()=>wb,ZodFile:()=>ep,ZodFirstPartyTypeKind:()=>Lc,ZodFunction:()=>yp,ZodGUID:()=>io,ZodIPv4:()=>kc,ZodIPv6:()=>wc,ZodISODate:()=>to,ZodISODateTime:()=>eo,ZodISODuration:()=>no,ZodISOTime:()=>ro,ZodIntersection:()=>Vm,ZodIssueCode:()=>z_,ZodJWT:()=>Dc,ZodKSUID:()=>_c,ZodLazy:()=>gp,ZodLiteral:()=>Qm,ZodMap:()=>Xm,ZodNaN:()=>dp,ZodNanoID:()=>gc,ZodNever:()=>Zm,ZodNonOptional:()=>Nc,ZodNull:()=>jm,ZodNullable:()=>rp,ZodNumber:()=>Mr,ZodNumberFormat:()=>Lt,ZodObject:()=>po,ZodOptional:()=>Ac,ZodPipe:()=>jc,ZodPrefault:()=>ip,ZodPromise:()=>vp,ZodReadonly:()=>mp,ZodRealError:()=>_e,ZodRecord:()=>zc,ZodSet:()=>Ym,ZodString:()=>zr,ZodStringFormat:()=>X,ZodSuccess:()=>lp,ZodSymbol:()=>Am,ZodTemplateLiteral:()=>fp,ZodTransform:()=>tp,ZodTuple:()=>qm,ZodType:()=>R,ZodULID:()=>yc,ZodURL:()=>co,ZodUUID:()=>Ke,ZodUndefined:()=>Nm,ZodUnion:()=>Ec,ZodUnknown:()=>Fm,ZodVoid:()=>Gm,ZodXID:()=>bc,_ZodString:()=>mc,_default:()=>op,_function:()=>I_,any:()=>s_,array:()=>mo,base64:()=>Gb,base64url:()=>Wb,bigint:()=>t_,boolean:()=>Mm,catch:()=>up,check:()=>T_,cidrv4:()=>Fb,cidrv6:()=>Zb,clone:()=>he,codec:()=>x_,coerce:()=>Fc,config:()=>ie,core:()=>Je,cuid:()=>Cb,cuid2:()=>Mb,custom:()=>D_,date:()=>l_,decode:()=>nc,decodeAsync:()=>ic,discriminatedUnion:()=>p_,e164:()=>Hb,email:()=>$b,emoji:()=>Rb,encode:()=>rc,encodeAsync:()=>oc,endsWith:()=>Ir,enum:()=>Cc,file:()=>b_,flattenError:()=>ir,float32:()=>Xb,float64:()=>Yb,formatError:()=>sr,function:()=>I_,getErrorMap:()=>M_,globalRegistry:()=>Fe,gt:()=>Be,gte:()=>be,guid:()=>Sb,hash:()=>Kb,hex:()=>Jb,hostname:()=>qb,httpUrl:()=>Eb,includes:()=>$r,instanceof:()=>P_,int:()=>dc,int32:()=>Qb,int64:()=>r_,intersection:()=>Bm,ipv4:()=>Ub,ipv6:()=>Lb,iso:()=>oo,json:()=>E_,jwt:()=>Vb,keyof:()=>c_,ksuid:()=>jb,lazy:()=>hp,length:()=>Nt,literal:()=>y_,locales:()=>hr,looseObject:()=>m_,lowercase:()=>wr,lt:()=>Ve,lte:()=>Pe,map:()=>g_,maxLength:()=>At,maxSize:()=>Mt,mime:()=>Tr,minLength:()=>st,minSize:()=>kt,multipleOf:()=>_t,nan:()=>w_,nanoid:()=>zb,nativeEnum:()=>v_,negative:()=>Nl,never:()=>Oc,nonnegative:()=>Ul,nonoptional:()=>ap,nonpositive:()=>jl,normalize:()=>Dr,null:()=>Um,nullable:()=>ao,nullish:()=>__,number:()=>Cm,object:()=>u_,optional:()=>so,overwrite:()=>qe,parse:()=>Yl,parseAsync:()=>Ql,partialRecord:()=>f_,pipe:()=>lo,positive:()=>Al,prefault:()=>sp,preprocess:()=>R_,prettifyError:()=>di,promise:()=>S_,property:()=>Ll,readonly:()=>pp,record:()=>Km,refine:()=>bp,regex:()=>kr,regexes:()=>He,registry:()=>Rn,safeDecode:()=>ac,safeDecodeAsync:()=>cc,safeEncode:()=>sc,safeEncodeAsync:()=>lc,safeParse:()=>ec,safeParseAsync:()=>tc,set:()=>h_,setErrorMap:()=>C_,size:()=>_r,startsWith:()=>Sr,strictObject:()=>d_,string:()=>uc,stringFormat:()=>Bb,stringbool:()=>O_,success:()=>k_,superRefine:()=>_p,symbol:()=>o_,templateLiteral:()=>$_,toJSONSchema:()=>Bl,toLowerCase:()=>Or,toUpperCase:()=>Er,transform:()=>Mc,treeifyError:()=>ui,trim:()=>Pr,tuple:()=>Jm,uint32:()=>e_,uint64:()=>n_,ulid:()=>Ab,undefined:()=>i_,union:()=>Rc,unknown:()=>Ut,uppercase:()=>xr,url:()=>Ob,util:()=>T,uuid:()=>Ib,uuidv4:()=>Tb,uuidv6:()=>Db,uuidv7:()=>Pb,void:()=>a_,xid:()=>Nb});var Je={};dt(Je,{$ZodAny:()=>js,$ZodArray:()=>Gs,$ZodAsyncError:()=>Ue,$ZodBase64:()=>Ds,$ZodBase64URL:()=>Ps,$ZodBigInt:()=>Pn,$ZodBigIntFormat:()=>Cs,$ZodBoolean:()=>cr,$ZodCIDRv4:()=>Ss,$ZodCIDRv6:()=>Is,$ZodCUID:()=>fs,$ZodCUID2:()=>gs,$ZodCatch:()=>sa,$ZodCheck:()=>Y,$ZodCheckBigIntFormat:()=>Wi,$ZodCheckEndsWith:()=>rs,$ZodCheckGreaterThan:()=>kn,$ZodCheckIncludes:()=>es,$ZodCheckLengthEquals:()=>Ki,$ZodCheckLessThan:()=>_n,$ZodCheckLowerCase:()=>Yi,$ZodCheckMaxLength:()=>qi,$ZodCheckMaxSize:()=>Hi,$ZodCheckMimeType:()=>os,$ZodCheckMinLength:()=>Ji,$ZodCheckMinSize:()=>Vi,$ZodCheckMultipleOf:()=>Zi,$ZodCheckNumberFormat:()=>Gi,$ZodCheckOverwrite:()=>is,$ZodCheckProperty:()=>ns,$ZodCheckRegex:()=>Xi,$ZodCheckSizeEquals:()=>Bi,$ZodCheckStartsWith:()=>ts,$ZodCheckStringFormat:()=>Ct,$ZodCheckUpperCase:()=>Qi,$ZodCodec:()=>ur,$ZodCustom:()=>fa,$ZodCustomStringFormat:()=>Rs,$ZodDate:()=>Zs,$ZodDefault:()=>ra,$ZodDiscriminatedUnion:()=>Hs,$ZodE164:()=>Os,$ZodEmail:()=>us,$ZodEmoji:()=>ms,$ZodEncodeError:()=>ht,$ZodEnum:()=>Ks,$ZodError:()=>or,$ZodFile:()=>Ys,$ZodFunction:()=>da,$ZodGUID:()=>ls,$ZodIPv4:()=>xs,$ZodIPv6:()=>$s,$ZodISODate:()=>_s,$ZodISODateTime:()=>bs,$ZodISODuration:()=>ws,$ZodISOTime:()=>ks,$ZodIntersection:()=>Vs,$ZodJWT:()=>Es,$ZodKSUID:()=>ys,$ZodLazy:()=>pa,$ZodLiteral:()=>Xs,$ZodMap:()=>qs,$ZodNaN:()=>aa,$ZodNanoID:()=>ps,$ZodNever:()=>Ls,$ZodNonOptional:()=>oa,$ZodNull:()=>Ns,$ZodNullable:()=>ta,$ZodNumber:()=>Dn,$ZodNumberFormat:()=>zs,$ZodObject:()=>Im,$ZodObjectJIT:()=>Ws,$ZodOptional:()=>ea,$ZodPipe:()=>la,$ZodPrefault:()=>na,$ZodPromise:()=>ma,$ZodReadonly:()=>ca,$ZodRealError:()=>ye,$ZodRecord:()=>Bs,$ZodRegistry:()=>vr,$ZodSet:()=>Js,$ZodString:()=>bt,$ZodStringFormat:()=>J,$ZodSuccess:()=>ia,$ZodSymbol:()=>Ms,$ZodTemplateLiteral:()=>ua,$ZodTransform:()=>Qs,$ZodTuple:()=>En,$ZodType:()=>P,$ZodULID:()=>hs,$ZodURL:()=>ds,$ZodUUID:()=>cs,$ZodUndefined:()=>As,$ZodUnion:()=>On,$ZodUnknown:()=>Us,$ZodVoid:()=>Fs,$ZodXID:()=>vs,$brand:()=>ri,$constructor:()=>m,$input:()=>il,$output:()=>ol,Doc:()=>wn,JSONSchema:()=>Em,JSONSchemaGenerator:()=>Qn,NEVER:()=>ti,TimePrecision:()=>ll,_any:()=>Pl,_array:()=>Fl,_base64:()=>Jn,_base64url:()=>Kn,_bigint:()=>wl,_boolean:()=>_l,_catch:()=>gb,_check:()=>Om,_cidrv4:()=>Bn,_cidrv6:()=>qn,_coercedBigint:()=>xl,_coercedBoolean:()=>kl,_coercedDate:()=>Cl,_coercedNumber:()=>fl,_coercedString:()=>al,_cuid:()=>Ln,_cuid2:()=>Fn,_custom:()=>Gl,_date:()=>zl,_decode:()=>dn,_decodeAsync:()=>pn,_default:()=>mb,_discriminatedUnion:()=>eb,_e164:()=>Xn,_email:()=>zn,_emoji:()=>jn,_encode:()=>un,_encodeAsync:()=>mn,_endsWith:()=>Ir,_enum:()=>sb,_file:()=>Zl,_float32:()=>hl,_float64:()=>vl,_gt:()=>Be,_gte:()=>be,_guid:()=>yr,_includes:()=>$r,_int:()=>gl,_int32:()=>yl,_int64:()=>$l,_intersection:()=>tb,_ipv4:()=>Hn,_ipv6:()=>Vn,_isoDate:()=>ul,_isoDateTime:()=>cl,_isoDuration:()=>ml,_isoTime:()=>dl,_jwt:()=>Yn,_ksuid:()=>Wn,_lazy:()=>bb,_length:()=>Nt,_literal:()=>lb,_lowercase:()=>wr,_lt:()=>Ve,_lte:()=>Pe,_map:()=>ob,_max:()=>Pe,_maxLength:()=>At,_maxSize:()=>Mt,_mime:()=>Tr,_min:()=>be,_minLength:()=>st,_minSize:()=>kt,_multipleOf:()=>_t,_nan:()=>Ml,_nanoid:()=>Un,_nativeEnum:()=>ab,_negative:()=>Nl,_never:()=>El,_nonnegative:()=>Ul,_nonoptional:()=>pb,_nonpositive:()=>jl,_normalize:()=>Dr,_null:()=>Dl,_nullable:()=>db,_number:()=>pl,_optional:()=>ub,_overwrite:()=>qe,_parse:()=>Ot,_parseAsync:()=>Et,_pipe:()=>hb,_positive:()=>Al,_promise:()=>_b,_property:()=>Ll,_readonly:()=>vb,_record:()=>nb,_refine:()=>Wl,_regex:()=>kr,_safeDecode:()=>gn,_safeDecodeAsync:()=>vn,_safeEncode:()=>fn,_safeEncodeAsync:()=>hn,_safeParse:()=>Rt,_safeParseAsync:()=>zt,_set:()=>ib,_size:()=>_r,_startsWith:()=>Sr,_string:()=>sl,_stringFormat:()=>jt,_stringbool:()=>Vl,_success:()=>fb,_superRefine:()=>Hl,_symbol:()=>Il,_templateLiteral:()=>yb,_toLowerCase:()=>Or,_toUpperCase:()=>Er,_transform:()=>cb,_trim:()=>Pr,_tuple:()=>rb,_uint32:()=>bl,_uint64:()=>Sl,_ulid:()=>Zn,_undefined:()=>Tl,_union:()=>Qy,_unknown:()=>Ol,_uppercase:()=>xr,_url:()=>br,_uuid:()=>Cn,_uuidv4:()=>Mn,_uuidv6:()=>An,_uuidv7:()=>Nn,_void:()=>Rl,_xid:()=>Gn,clone:()=>he,config:()=>ie,decode:()=>Iv,decodeAsync:()=>Dv,encode:()=>Sv,encodeAsync:()=>Tv,flattenError:()=>ir,formatError:()=>sr,globalConfig:()=>Kt,globalRegistry:()=>Fe,isValidBase64:()=>Ts,isValidBase64URL:()=>wm,isValidJWT:()=>xm,locales:()=>hr,parse:()=>ln,parseAsync:()=>cn,prettifyError:()=>di,regexes:()=>He,registry:()=>Rn,safeDecode:()=>Ov,safeDecodeAsync:()=>Rv,safeEncode:()=>Pv,safeEncodeAsync:()=>Ev,safeParse:()=>mi,safeParseAsync:()=>pi,toDotPath:()=>nm,toJSONSchema:()=>Bl,treeifyError:()=>ui,util:()=>T,version:()=>ss});var ti=Object.freeze({status:"aborted"});function m(e,t,n){function o(a,l){var c;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(c=a._zod).traits??(c.traits=new Set),a._zod.traits.add(e),t(a,l);for(let u in s.prototype)if(!(u in a))Object.defineProperty(a,u,{value:s.prototype[u].bind(a)});a._zod.constr=s,a._zod.def=l}let r=n?.Parent??Object;class i extends r{}Object.defineProperty(i,"name",{value:e});function s(a){var l;let c=n?.Parent?new i:this;o(c,a),(l=c._zod).deferred??(l.deferred=[]);for(let u of c._zod.deferred)u();return c}return Object.defineProperty(s,"init",{value:o}),Object.defineProperty(s,Symbol.hasInstance,{value:(a)=>{if(n?.Parent&&a instanceof n.Parent)return!0;return a?._zod?.traits?.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}var ri=Symbol("zod_brand");class Ue extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ht extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}var Kt={};function ie(e){if(e)Object.assign(Kt,e);return Kt}var T={};dt(T,{BIGINT_FORMAT_RANGES:()=>ci,Class:()=>tm,NUMBER_FORMAT_RANGES:()=>li,aborted:()=>ot,allowsEval:()=>ii,assert:()=>dv,assertEqual:()=>av,assertIs:()=>cv,assertNever:()=>uv,assertNotEqual:()=>lv,assignProp:()=>Re,base64ToUint8Array:()=>Qd,base64urlToUint8Array:()=>_v,cached:()=>Pt,captureStackTrace:()=>an,cleanEnum:()=>bv,cleanRegex:()=>Qt,clone:()=>he,cloneDef:()=>mv,createTransparentProxy:()=>yv,defineLazy:()=>C,esc:()=>sn,escapeRegex:()=>Le,extend:()=>qd,finalizeIssue:()=>Se,floatSafeRemainder:()=>oi,getElementAtPath:()=>pv,getEnumValues:()=>Yt,getLengthableOrigin:()=>nr,getParsedType:()=>vv,getSizableOrigin:()=>rr,hexToUint8Array:()=>wv,isObject:()=>vt,isPlainObject:()=>nt,issue:()=>it,joinValues:()=>h,jsonStringifyReplacer:()=>Dt,merge:()=>Kd,mergeDefs:()=>rt,normalizeParams:()=>y,nullish:()=>tt,numKeys:()=>hv,objectClone:()=>on,omit:()=>Bd,optionalKeys:()=>ai,partial:()=>Xd,pick:()=>Vd,prefixIssues:()=>$e,primitiveTypes:()=>si,promiseAllObject:()=>fv,propertyKeyTypes:()=>tr,randomString:()=>gv,required:()=>Yd,safeExtend:()=>Jd,shallowClone:()=>er,stringifyPrimitive:()=>_,uint8ArrayToBase64:()=>em,uint8ArrayToBase64url:()=>kv,uint8ArrayToHex:()=>xv,unwrapMessage:()=>Xt});function av(e){return e}function lv(e){return e}function cv(e){}function uv(e){throw Error()}function dv(e){}function Yt(e){let t=Object.values(e).filter((o)=>typeof o==="number");return Object.entries(e).filter(([o,r])=>t.indexOf(+o)===-1).map(([o,r])=>r)}function h(e,t="|"){return e.map((n)=>_(n)).join(t)}function Dt(e,t){if(typeof t==="bigint")return t.toString();return t}function Pt(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw Error("cached value already set")}}}function tt(e){return e===null||e===void 0}function Qt(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function oi(e,t){let n=(e.toString().split(".")[1]||"").length,o=t.toString(),r=(o.split(".")[1]||"").length;if(r===0&&/\d?e-\d?/.test(o)){let l=o.match(/\d?e-(\d?)/);if(l?.[1])r=Number.parseInt(l[1])}let i=n>r?n:r,s=Number.parseInt(e.toFixed(i).replace(".","")),a=Number.parseInt(t.toFixed(i).replace(".",""));return s%a/10**i}var Hd=Symbol("evaluating");function C(e,t,n){let o=void 0;Object.defineProperty(e,t,{get(){if(o===Hd)return;if(o===void 0)o=Hd,o=n();return o},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function on(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Re(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function rt(...e){let t={};for(let n of e){let o=Object.getOwnPropertyDescriptors(n);Object.assign(t,o)}return Object.defineProperties({},t)}function mv(e){return rt(e._zod.def)}function pv(e,t){if(!t)return e;return t.reduce((n,o)=>n?.[o],e)}function fv(e){let t=Object.keys(e),n=t.map((o)=>e[o]);return Promise.all(n).then((o)=>{let r={};for(let i=0;i<t.length;i++)r[t[i]]=o[i];return r})}function gv(e=10){let n="";for(let o=0;o<e;o++)n+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return n}function sn(e){return JSON.stringify(e)}var an="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function vt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var ii=Pt(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function nt(e){if(vt(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;if(vt(n)===!1)return!1;if(Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)return!1;return!0}function er(e){if(nt(e))return{...e};if(Array.isArray(e))return[...e];return e}function hv(e){let t=0;for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n))t++;return t}var vv=(e)=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(e))return"array";if(e===null)return"null";if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return"promise";if(typeof Map<"u"&&e instanceof Map)return"map";if(typeof Set<"u"&&e instanceof Set)return"set";if(typeof Date<"u"&&e instanceof Date)return"date";if(typeof File<"u"&&e instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${t}`)}},tr=new Set(["string","number","symbol"]),si=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Le(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function he(e,t,n){let o=new e._zod.constr(t??e._zod.def);if(!t||n?.parent)o._zod.parent=e;return o}function y(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function yv(e){let t;return new Proxy({},{get(n,o,r){return t??(t=e()),Reflect.get(t,o,r)},set(n,o,r,i){return t??(t=e()),Reflect.set(t,o,r,i)},has(n,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(n,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(n,o,r){return t??(t=e()),Reflect.defineProperty(t,o,r)}})}function _(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function ai(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var li={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ci={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Vd(e,t){let n=e._zod.def,o=rt(e._zod.def,{get shape(){let r={};for(let i in t){if(!(i in n.shape))throw Error(`Unrecognized key: "${i}"`);if(!t[i])continue;r[i]=n.shape[i]}return Re(this,"shape",r),r},checks:[]});return he(e,o)}function Bd(e,t){let n=e._zod.def,o=rt(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let i in t){if(!(i in n.shape))throw Error(`Unrecognized key: "${i}"`);if(!t[i])continue;delete r[i]}return Re(this,"shape",r),r},checks:[]});return he(e,o)}function qd(e,t){if(!nt(t))throw Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0)throw Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let r=rt(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return Re(this,"shape",i),i},checks:[]});return he(e,r)}function Jd(e,t){if(!nt(t))throw Error("Invalid input to safeExtend: expected a plain object");let n={...e._zod.def,get shape(){let o={...e._zod.def.shape,...t};return Re(this,"shape",o),o},checks:e._zod.def.checks};return he(e,n)}function Kd(e,t){let n=rt(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return Re(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:[]});return he(e,n)}function Xd(e,t,n){let o=rt(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let s in n){if(!(s in r))throw Error(`Unrecognized key: "${s}"`);if(!n[s])continue;i[s]=e?new e({type:"optional",innerType:r[s]}):r[s]}else for(let s in r)i[s]=e?new e({type:"optional",innerType:r[s]}):r[s];return Re(this,"shape",i),i},checks:[]});return he(t,o)}function Yd(e,t,n){let o=rt(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let s in n){if(!(s in i))throw Error(`Unrecognized key: "${s}"`);if(!n[s])continue;i[s]=new e({type:"nonoptional",innerType:r[s]})}else for(let s in r)i[s]=new e({type:"nonoptional",innerType:r[s]});return Re(this,"shape",i),i},checks:[]});return he(t,o)}function ot(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function $e(e,t){return t.map((n)=>{var o;return(o=n).path??(o.path=[]),n.path.unshift(e),n})}function Xt(e){return typeof e==="string"?e:e?.message}function Se(e,t,n){let o={...e,path:e.path??[]};if(!e.message){let r=Xt(e.inst?._zod.def?.error?.(e))??Xt(t?.error?.(e))??Xt(n.customError?.(e))??Xt(n.localeError?.(e))??"Invalid input";o.message=r}if(delete o.inst,delete o.continue,!t?.reportInput)delete o.input;return o}function rr(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}function nr(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function it(...e){let[t,n,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:n,inst:o};return{...t}}function bv(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map((t)=>t[1])}function Qd(e){let t=atob(e),n=new Uint8Array(t.length);for(let o=0;o<t.length;o++)n[o]=t.charCodeAt(o);return n}function em(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function _v(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return Qd(t+n)}function kv(e){return em(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function wv(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let o=0;o<t.length;o+=2)n[o/2]=Number.parseInt(t.slice(o,o+2),16);return n}function xv(e){return Array.from(e).map((t)=>t.toString(16).padStart(2,"0")).join("")}class tm{constructor(...e){}}var rm=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Dt,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},or=m("$ZodError",rm),ye=m("$ZodError",rm,{Parent:Error});function ir(e,t=(n)=>n.message){let n={},o=[];for(let r of e.issues)if(r.path.length>0)n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r));else o.push(t(r));return{formErrors:o,fieldErrors:n}}function sr(e,t){let n=t||function(i){return i.message},o={_errors:[]},r=(i)=>{for(let s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((a)=>r({issues:a}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)o._errors.push(n(s));else{let a=o,l=0;while(l<s.path.length){let c=s.path[l];if(l!==s.path.length-1)a[c]=a[c]||{_errors:[]};else a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(s));a=a[c],l++}}};return r(e),o}function ui(e,t){let n=t||function(i){return i.message},o={errors:[]},r=(i,s=[])=>{var a,l;for(let c of i.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map((u)=>r({issues:u},c.path));else if(c.code==="invalid_key")r({issues:c.issues},c.path);else if(c.code==="invalid_element")r({issues:c.issues},c.path);else{let u=[...s,...c.path];if(u.length===0){o.errors.push(n(c));continue}let f=o,g=0;while(g<u.length){let d=u[g],b=g===u.length-1;if(typeof d==="string")f.properties??(f.properties={}),(a=f.properties)[d]??(a[d]={errors:[]}),f=f.properties[d];else f.items??(f.items=[]),(l=f.items)[d]??(l[d]={errors:[]}),f=f.items[d];if(b)f.errors.push(n(c));g++}}};return r(e),o}function nm(e){let t=[],n=e.map((o)=>typeof o==="object"?o.key:o);for(let o of n)if(typeof o==="number")t.push(`[${o}]`);else if(typeof o==="symbol")t.push(`[${JSON.stringify(String(o))}]`);else if(/[^\w$]/.test(o))t.push(`[${JSON.stringify(o)}]`);else{if(t.length)t.push(".");t.push(o)}return t.join("")}function di(e){let t=[],n=[...e.issues].sort((o,r)=>(o.path??[]).length-(r.path??[]).length);for(let o of n)if(t.push(`✖ ${o.message}`),o.path?.length)t.push(` → at ${nm(o.path)}`);return t.join(`
171
- `)}var Ot=(e)=>(t,n,o,r)=>{let i=o?Object.assign(o,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new Ue;if(s.issues.length){let a=new(r?.Err??e)(s.issues.map((l)=>Se(l,i,ie())));throw an(a,r?.callee),a}return s.value},ln=Ot(ye),Et=(e)=>async(t,n,o,r)=>{let i=o?Object.assign(o,{async:!0}):{async:!0},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)s=await s;if(s.issues.length){let a=new(r?.Err??e)(s.issues.map((l)=>Se(l,i,ie())));throw an(a,r?.callee),a}return s.value},cn=Et(ye),Rt=(e)=>(t,n,o)=>{let r=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},r);if(i instanceof Promise)throw new Ue;return i.issues.length?{success:!1,error:new(e??or)(i.issues.map((s)=>Se(s,r,ie())))}:{success:!0,data:i.value}},mi=Rt(ye),zt=(e)=>async(t,n,o)=>{let r=o?Object.assign(o,{async:!0}):{async:!0},i=t._zod.run({value:n,issues:[]},r);if(i instanceof Promise)i=await i;return i.issues.length?{success:!1,error:new e(i.issues.map((s)=>Se(s,r,ie())))}:{success:!0,data:i.value}},pi=zt(ye),un=(e)=>(t,n,o)=>{let r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Ot(e)(t,n,r)},Sv=un(ye),dn=(e)=>(t,n,o)=>Ot(e)(t,n,o),Iv=dn(ye),mn=(e)=>async(t,n,o)=>{let r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Et(e)(t,n,r)},Tv=mn(ye),pn=(e)=>async(t,n,o)=>Et(e)(t,n,o),Dv=pn(ye),fn=(e)=>(t,n,o)=>{let r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Rt(e)(t,n,r)},Pv=fn(ye),gn=(e)=>(t,n,o)=>Rt(e)(t,n,o),Ov=gn(ye),hn=(e)=>async(t,n,o)=>{let r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return zt(e)(t,n,r)},Ev=hn(ye),vn=(e)=>async(t,n,o)=>zt(e)(t,n,o),Rv=vn(ye);var He={};dt(He,{base64:()=>Di,base64url:()=>yn,bigint:()=>Ci,boolean:()=>Ni,browserEmail:()=>Lv,cidrv4:()=>Ii,cidrv6:()=>Ti,cuid:()=>fi,cuid2:()=>gi,date:()=>Oi,datetime:()=>Ri,domain:()=>im,duration:()=>_i,e164:()=>Pi,email:()=>wi,emoji:()=>xi,extendedDuration:()=>zv,guid:()=>ki,hex:()=>lm,hostname:()=>bn,html5Email:()=>Nv,idnEmail:()=>Uv,integer:()=>Mi,ipv4:()=>$i,ipv6:()=>Si,ksuid:()=>yi,lowercase:()=>Li,md5_base64:()=>Zv,md5_base64url:()=>Gv,md5_hex:()=>Fv,nanoid:()=>bi,null:()=>ji,number:()=>Ai,rfc5322Email:()=>jv,sha1_base64:()=>Hv,sha1_base64url:()=>Vv,sha1_hex:()=>Wv,sha256_base64:()=>qv,sha256_base64url:()=>Jv,sha256_hex:()=>Bv,sha384_base64:()=>Xv,sha384_base64url:()=>Yv,sha384_hex:()=>Kv,sha512_base64:()=>ey,sha512_base64url:()=>ty,sha512_hex:()=>Qv,string:()=>zi,time:()=>Ei,ulid:()=>hi,undefined:()=>Ui,unicodeEmail:()=>om,uppercase:()=>Fi,uuid:()=>yt,uuid4:()=>Cv,uuid6:()=>Mv,uuid7:()=>Av,xid:()=>vi});var fi=/^[cC][^\s-]{8,}$/,gi=/^[0-9a-z]+$/,hi=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,vi=/^[0-9a-vA-V]{20}$/,yi=/^[A-Za-z0-9]{27}$/,bi=/^[a-zA-Z0-9_-]{21}$/,_i=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,zv=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ki=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,yt=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},Cv=yt(4),Mv=yt(6),Av=yt(7),wi=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Nv=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,jv=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,om=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Uv=om,Lv=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;function xi(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var $i=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Si=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Ii=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ti=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Di=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,yn=/^[A-Za-z0-9_-]*$/,bn=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,im=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Pi=/^\+(?:[0-9]){6,14}[0-9]$/,sm="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Oi=new RegExp(`^${sm}$`);function am(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Ei(e){return new RegExp(`^${am(e)}$`)}function Ri(e){let t=am({precision:e.precision}),n=["Z"];if(e.local)n.push("");if(e.offset)n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${t}(?:${n.join("|")})`;return new RegExp(`^${sm}T(?:${o})$`)}var zi=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Ci=/^-?\d+n?$/,Mi=/^-?\d+$/,Ai=/^-?\d+(?:\.\d+)?/,Ni=/^(?:true|false)$/i,ji=/^null$/i;var Ui=/^undefined$/i;var Li=/^[^A-Z]*$/,Fi=/^[^a-z]*$/,lm=/^[0-9a-fA-F]*$/;function ar(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function lr(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Fv=/^[0-9a-fA-F]{32}$/,Zv=ar(22,"=="),Gv=lr(22),Wv=/^[0-9a-fA-F]{40}$/,Hv=ar(27,"="),Vv=lr(27),Bv=/^[0-9a-fA-F]{64}$/,qv=ar(43,"="),Jv=lr(43),Kv=/^[0-9a-fA-F]{96}$/,Xv=ar(64,""),Yv=lr(64),Qv=/^[0-9a-fA-F]{128}$/,ey=ar(86,"=="),ty=lr(86);var Y=m("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),um={number:"number",bigint:"bigint",object:"date"},_n=m("$ZodCheckLessThan",(e,t)=>{Y.init(e,t);let n=um[typeof t.value];e._zod.onattach.push((o)=>{let r=o._zod.bag,i=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<i)if(t.inclusive)r.maximum=t.value;else r.exclusiveMaximum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value<=t.value:o.value<t.value)return;o.issues.push({origin:n,code:"too_big",maximum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),kn=m("$ZodCheckGreaterThan",(e,t)=>{Y.init(e,t);let n=um[typeof t.value];e._zod.onattach.push((o)=>{let r=o._zod.bag,i=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>i)if(t.inclusive)r.minimum=t.value;else r.exclusiveMinimum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value>=t.value:o.value>t.value)return;o.issues.push({origin:n,code:"too_small",minimum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Zi=m("$ZodCheckMultipleOf",(e,t)=>{Y.init(e,t),e._zod.onattach.push((n)=>{var o;(o=n._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=(n)=>{if(typeof n.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof n.value==="bigint"?n.value%t.value===BigInt(0):oi(n.value,t.value)===0)return;n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Gi=m("$ZodCheckNumberFormat",(e,t)=>{Y.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),o=n?"int":"number",[r,i]=li[t.format];e._zod.onattach.push((s)=>{let a=s._zod.bag;if(a.format=t.format,a.minimum=r,a.maximum=i,n)a.pattern=Mi}),e._zod.check=(s)=>{let a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort});else s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort});return}}if(a<r)s.issues.push({origin:"number",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort});if(a>i)s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inst:e})}}),Wi=m("$ZodCheckBigIntFormat",(e,t)=>{Y.init(e,t);let[n,o]=ci[t.format];e._zod.onattach.push((r)=>{let i=r._zod.bag;i.format=t.format,i.minimum=n,i.maximum=o}),e._zod.check=(r)=>{let i=r.value;if(i<n)r.issues.push({origin:"bigint",input:i,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(i>o)r.issues.push({origin:"bigint",input:i,code:"too_big",maximum:o,inst:e})}}),Hi=m("$ZodCheckMaxSize",(e,t)=>{var n;Y.init(e,t),(n=e._zod.def).when??(n.when=(o)=>{let r=o.value;return!tt(r)&&r.size!==void 0}),e._zod.onattach.push((o)=>{let r=o._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<r)o._zod.bag.maximum=t.maximum}),e._zod.check=(o)=>{let r=o.value;if(r.size<=t.maximum)return;o.issues.push({origin:rr(r),code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Vi=m("$ZodCheckMinSize",(e,t)=>{var n;Y.init(e,t),(n=e._zod.def).when??(n.when=(o)=>{let r=o.value;return!tt(r)&&r.size!==void 0}),e._zod.onattach.push((o)=>{let r=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>r)o._zod.bag.minimum=t.minimum}),e._zod.check=(o)=>{let r=o.value;if(r.size>=t.minimum)return;o.issues.push({origin:rr(r),code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Bi=m("$ZodCheckSizeEquals",(e,t)=>{var n;Y.init(e,t),(n=e._zod.def).when??(n.when=(o)=>{let r=o.value;return!tt(r)&&r.size!==void 0}),e._zod.onattach.push((o)=>{let r=o._zod.bag;r.minimum=t.size,r.maximum=t.size,r.size=t.size}),e._zod.check=(o)=>{let r=o.value,i=r.size;if(i===t.size)return;let s=i>t.size;o.issues.push({origin:rr(r),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),qi=m("$ZodCheckMaxLength",(e,t)=>{var n;Y.init(e,t),(n=e._zod.def).when??(n.when=(o)=>{let r=o.value;return!tt(r)&&r.length!==void 0}),e._zod.onattach.push((o)=>{let r=o._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<r)o._zod.bag.maximum=t.maximum}),e._zod.check=(o)=>{let r=o.value;if(r.length<=t.maximum)return;let s=nr(r);o.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ji=m("$ZodCheckMinLength",(e,t)=>{var n;Y.init(e,t),(n=e._zod.def).when??(n.when=(o)=>{let r=o.value;return!tt(r)&&r.length!==void 0}),e._zod.onattach.push((o)=>{let r=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>r)o._zod.bag.minimum=t.minimum}),e._zod.check=(o)=>{let r=o.value;if(r.length>=t.minimum)return;let s=nr(r);o.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ki=m("$ZodCheckLengthEquals",(e,t)=>{var n;Y.init(e,t),(n=e._zod.def).when??(n.when=(o)=>{let r=o.value;return!tt(r)&&r.length!==void 0}),e._zod.onattach.push((o)=>{let r=o._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=(o)=>{let r=o.value,i=r.length;if(i===t.length)return;let s=nr(r),a=i>t.length;o.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Ct=m("$ZodCheckStringFormat",(e,t)=>{var n,o;if(Y.init(e,t),e._zod.onattach.push((r)=>{let i=r._zod.bag;if(i.format=t.format,t.pattern)i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern)}),t.pattern)(n=e._zod).check??(n.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(o=e._zod).check??(o.check=()=>{})}),Xi=m("$ZodCheckRegex",(e,t)=>{Ct.init(e,t),e._zod.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Yi=m("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Li),Ct.init(e,t)}),Qi=m("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Fi),Ct.init(e,t)}),es=m("$ZodCheckIncludes",(e,t)=>{Y.init(e,t);let n=Le(t.includes),o=new RegExp(typeof t.position==="number"?`^.{${t.position}}${n}`:n);t.pattern=o,e._zod.onattach.push((r)=>{let i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(o)}),e._zod.check=(r)=>{if(r.value.includes(t.includes,t.position))return;r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),ts=m("$ZodCheckStartsWith",(e,t)=>{Y.init(e,t);let n=new RegExp(`^${Le(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push((o)=>{let r=o._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=(o)=>{if(o.value.startsWith(t.prefix))return;o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),rs=m("$ZodCheckEndsWith",(e,t)=>{Y.init(e,t);let n=new RegExp(`.*${Le(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push((o)=>{let r=o._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=(o)=>{if(o.value.endsWith(t.suffix))return;o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});function cm(e,t,n){if(e.issues.length)t.issues.push(...$e(n,e.issues))}var ns=m("$ZodCheckProperty",(e,t)=>{Y.init(e,t),e._zod.check=(n)=>{let o=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(o instanceof Promise)return o.then((r)=>cm(r,n,t.property));cm(o,n,t.property);return}}),os=m("$ZodCheckMimeType",(e,t)=>{Y.init(e,t);let n=new Set(t.mime);e._zod.onattach.push((o)=>{o._zod.bag.mime=t.mime}),e._zod.check=(o)=>{if(n.has(o.value.type))return;o.issues.push({code:"invalid_value",values:t.mime,input:o.value.type,inst:e,continue:!t.abort})}}),is=m("$ZodCheckOverwrite",(e,t)=>{Y.init(e,t),e._zod.check=(n)=>{n.value=t.tx(n.value)}});class wn{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
172
- `).filter((i)=>i),o=Math.min(...n.map((i)=>i.length-i.trimStart().length)),r=n.map((i)=>i.slice(o)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of r)this.content.push(i)}compile(){let e=Function,t=this?.args,o=[...(this?.content??[""]).map((r)=>` ${r}`)];return new e(...t,o.join(`
173
- `))}}var ss={major:4,minor:1,patch:8};var P=m("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ss;let o=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))o.unshift(e);for(let r of o)for(let i of r._zod.onattach)i(e);if(o.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let r=(s,a,l)=>{let c=ot(s),u;for(let f of a){if(f._zod.def.when){if(!f._zod.def.when(s))continue}else if(c)continue;let g=s.issues.length,d=f._zod.check(s);if(d instanceof Promise&&l?.async===!1)throw new Ue;if(u||d instanceof Promise)u=(u??Promise.resolve()).then(async()=>{if(await d,s.issues.length===g)return;if(!c)c=ot(s,g)});else{if(s.issues.length===g)continue;if(!c)c=ot(s,g)}}if(u)return u.then(()=>s);return s},i=(s,a,l)=>{if(ot(s))return s.aborted=!0,s;let c=r(a,o,l);if(c instanceof Promise){if(l.async===!1)throw new Ue;return c.then((u)=>e._zod.parse(u,l))}return e._zod.parse(c,l)};e._zod.run=(s,a)=>{if(a.skipChecks)return e._zod.parse(s,a);if(a.direction==="backward"){let c=e._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});if(c instanceof Promise)return c.then((u)=>i(u,s,a));return i(c,s,a)}let l=e._zod.parse(s,a);if(l instanceof Promise){if(a.async===!1)throw new Ue;return l.then((c)=>r(c,o,a))}return r(l,o,a)}}e["~standard"]={validate:(r)=>{try{let i=mi(e,r);return i.success?{value:i.data}:{issues:i.error?.issues}}catch(i){return pi(e,r).then((s)=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),bt=m("$ZodString",(e,t)=>{P.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??zi(e._zod.bag),e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=String(n.value)}catch(r){}if(typeof n.value==="string")return n;return n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),J=m("$ZodStringFormat",(e,t)=>{Ct.init(e,t),bt.init(e,t)}),ls=m("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ki),J.init(e,t)}),cs=m("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=yt(o))}else t.pattern??(t.pattern=yt());J.init(e,t)}),us=m("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=wi),J.init(e,t)}),ds=m("$ZodURL",(e,t)=>{J.init(e,t),e._zod.check=(n)=>{try{let o=n.value.trim(),r=new URL(o);if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(r.hostname))n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:bn.source,input:n.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol))n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})}if(t.normalize)n.value=r.href;else n.value=o;return}catch(o){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),ms=m("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=xi()),J.init(e,t)}),ps=m("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=bi),J.init(e,t)}),fs=m("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=fi),J.init(e,t)}),gs=m("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=gi),J.init(e,t)}),hs=m("$ZodULID",(e,t)=>{t.pattern??(t.pattern=hi),J.init(e,t)}),vs=m("$ZodXID",(e,t)=>{t.pattern??(t.pattern=vi),J.init(e,t)}),ys=m("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=yi),J.init(e,t)}),bs=m("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ri(t)),J.init(e,t)}),_s=m("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Oi),J.init(e,t)}),ks=m("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ei(t)),J.init(e,t)}),ws=m("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=_i),J.init(e,t)}),xs=m("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=$i),J.init(e,t),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.format="ipv4"})}),$s=m("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Si),J.init(e,t),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.format="ipv6"}),e._zod.check=(n)=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),Ss=m("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ii),J.init(e,t)}),Is=m("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ti),J.init(e,t),e._zod.check=(n)=>{let o=n.value.split("/");try{if(o.length!==2)throw Error();let[r,i]=o;if(!i)throw Error();let s=Number(i);if(`${s}`!==i)throw Error();if(s<0||s>128)throw Error();new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Ts(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Ds=m("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Di),J.init(e,t),e._zod.onattach.push((n)=>{n._zod.bag.contentEncoding="base64"}),e._zod.check=(n)=>{if(Ts(n.value))return;n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function wm(e){if(!yn.test(e))return!1;let t=e.replace(/[-_]/g,(o)=>o==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Ts(n)}var Ps=m("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=yn),J.init(e,t),e._zod.onattach.push((n)=>{n._zod.bag.contentEncoding="base64url"}),e._zod.check=(n)=>{if(wm(n.value))return;n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Os=m("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Pi),J.init(e,t)});function xm(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[o]=n;if(!o)return!1;let r=JSON.parse(atob(o));if("typ"in r&&r?.typ!=="JWT")return!1;if(!r.alg)return!1;if(t&&(!("alg"in r)||r.alg!==t))return!1;return!0}catch{return!1}}var Es=m("$ZodJWT",(e,t)=>{J.init(e,t),e._zod.check=(n)=>{if(xm(n.value,t.alg))return;n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Rs=m("$ZodCustomStringFormat",(e,t)=>{J.init(e,t),e._zod.check=(n)=>{if(t.fn(n.value))return;n.issues.push({code:"invalid_format",format:t.format,input:n.value,inst:e,continue:!t.abort})}}),Dn=m("$ZodNumber",(e,t)=>{P.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ai,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Number(n.value)}catch(s){}let r=n.value;if(typeof r==="number"&&!Number.isNaN(r)&&Number.isFinite(r))return n;let i=typeof r==="number"?Number.isNaN(r)?"NaN":!Number.isFinite(r)?"Infinity":void 0:void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...i?{received:i}:{}}),n}}),zs=m("$ZodNumber",(e,t)=>{Gi.init(e,t),Dn.init(e,t)}),cr=m("$ZodBoolean",(e,t)=>{P.init(e,t),e._zod.pattern=Ni,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(i){}let r=n.value;if(typeof r==="boolean")return n;return n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}}),Pn=m("$ZodBigInt",(e,t)=>{P.init(e,t),e._zod.pattern=Ci,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch(r){}if(typeof n.value==="bigint")return n;return n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}}),Cs=m("$ZodBigInt",(e,t)=>{Wi.init(e,t),Pn.init(e,t)}),Ms=m("$ZodSymbol",(e,t)=>{P.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;if(typeof r==="symbol")return n;return n.issues.push({expected:"symbol",code:"invalid_type",input:r,inst:e}),n}}),As=m("$ZodUndefined",(e,t)=>{P.init(e,t),e._zod.pattern=Ui,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(n,o)=>{let r=n.value;if(typeof r>"u")return n;return n.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:e}),n}}),Ns=m("$ZodNull",(e,t)=>{P.init(e,t),e._zod.pattern=ji,e._zod.values=new Set([null]),e._zod.parse=(n,o)=>{let r=n.value;if(r===null)return n;return n.issues.push({expected:"null",code:"invalid_type",input:r,inst:e}),n}}),js=m("$ZodAny",(e,t)=>{P.init(e,t),e._zod.parse=(n)=>n}),Us=m("$ZodUnknown",(e,t)=>{P.init(e,t),e._zod.parse=(n)=>n}),Ls=m("$ZodNever",(e,t)=>{P.init(e,t),e._zod.parse=(n,o)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),Fs=m("$ZodVoid",(e,t)=>{P.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;if(typeof r>"u")return n;return n.issues.push({expected:"void",code:"invalid_type",input:r,inst:e}),n}}),Zs=m("$ZodDate",(e,t)=>{P.init(e,t),e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=new Date(n.value)}catch(a){}let r=n.value,i=r instanceof Date;if(i&&!Number.isNaN(r.getTime()))return n;return n.issues.push({expected:"date",code:"invalid_type",input:r,...i?{received:"Invalid Date"}:{},inst:e}),n}});function mm(e,t,n){if(e.issues.length)t.issues.push(...$e(n,e.issues));t.value[n]=e.value}var Gs=m("$ZodArray",(e,t)=>{P.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),n;n.value=Array(r.length);let i=[];for(let s=0;s<r.length;s++){let a=r[s],l=t.element._zod.run({value:a,issues:[]},o);if(l instanceof Promise)i.push(l.then((c)=>mm(c,n,s)));else mm(l,n,s)}if(i.length)return Promise.all(i).then(()=>n);return n}});function Tn(e,t,n,o){if(e.issues.length)t.issues.push(...$e(n,e.issues));if(e.value===void 0){if(n in o)t.value[n]=void 0}else t.value[n]=e.value}function $m(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${o}": expected a Zod schema`);let n=ai(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Sm(e,t,n,o,r,i){let s=[],a=r.keySet,l=r.catchall._zod,c=l.def.type;for(let u of Object.keys(t)){if(a.has(u))continue;if(c==="never"){s.push(u);continue}let f=l.run({value:t[u],issues:[]},o);if(f instanceof Promise)e.push(f.then((g)=>Tn(g,n,u,t)));else Tn(f,n,u,t)}if(s.length)n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i});if(!e.length)return n;return Promise.all(e).then(()=>n)}var Im=m("$ZodObject",(e,t)=>{P.init(e,t);let n=Pt(()=>$m(t));C(e._zod,"propValues",()=>{let s=t.shape,a={};for(let l in s){let c=s[l]._zod;if(c.values){a[l]??(a[l]=new Set);for(let u of c.values)a[l].add(u)}}return a});let o=vt,r=t.catchall,i;e._zod.parse=(s,a)=>{i??(i=n.value);let l=s.value;if(!o(l))return s.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),s;s.value={};let c=[],u=i.shape;for(let f of i.keys){let d=u[f]._zod.run({value:l[f],issues:[]},a);if(d instanceof Promise)c.push(d.then((b)=>Tn(b,s,f,l)));else Tn(d,s,f,l)}if(!r)return c.length?Promise.all(c).then(()=>s):s;return Sm(c,l,s,a,n.value,e)}}),Ws=m("$ZodObjectJIT",(e,t)=>{Im.init(e,t);let n=e._zod.parse,o=Pt(()=>$m(t)),r=(g)=>{let d=new wn(["shape","payload","ctx"]),b=o.value,w=(W)=>{let ae=sn(W);return`shape[${ae}]._zod.run({ value: input[${ae}], issues: [] }, ctx)`};d.write("const input = payload.value;");let M=Object.create(null),j=0;for(let W of b.keys)M[W]=`key_${j++}`;d.write("const newResult = {};");for(let W of b.keys){let ae=M[W],Te=sn(W);d.write(`const ${ae} = ${w(W)};`),d.write(`
170
+ `).run(e.id,e.name,e.description,e.repo_url,e.installs??0,e.skill_id,e.download_count??0,e.last_synced??t,e.content_hash),Promise.resolve(e.id)}setSkillMaterializedAt(e,t){this.db.prepare("UPDATE skills SET last_materialized_at = ? WHERE id LIKE ? OR id = ?").run(t,`%/${e}`,e)}getSkillMaterializedAt(e){return this.db.prepare("SELECT last_materialized_at FROM skills WHERE id = ?").get(e)?.last_materialized_at??null}skillReplaceDeps(e,t){this.db.exec("BEGIN");try{this.db.prepare("DELETE FROM skill_deps WHERE skill_id = ?").run(e);let n=this.db.prepare("INSERT OR IGNORE INTO skill_deps (skill_id, dep_type, dep_name) VALUES (?, ?, ?)"),i=0;for(let r of t)if(typeof r.depType==="string"&&r.depType.length>0&&typeof r.depName==="string"&&r.depName.length>0)n.run(e,r.depType,r.depName),i++;return this.db.exec("COMMIT"),Promise.resolve(i)}catch(n){throw this.db.exec("ROLLBACK"),n}}skillGetDeps(e){let t=this.db.prepare("SELECT dep_type AS depType, dep_name AS depName FROM skill_deps WHERE skill_id = ? ORDER BY dep_type ASC, dep_name ASC").all(e);return Promise.resolve(t)}close(){this.db.close()}toFtsQuery(e){let t=e.trim().split(/\s+/).filter(Boolean).map((n)=>n.replace(/["()*:^]/g,"")).filter(Boolean);if(t.length===0)return'""';return t.map((n)=>`"${n}"*`).join(" ")}}function Zd(e){try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}var Qi=null;function nn(){if(!Qi)Qi=new Wd;return Qi}var fi={};dt(fi,{$brand:()=>to,$input:()=>ol,$output:()=>il,NEVER:()=>eo,TimePrecision:()=>ll,ZodAny:()=>Lm,ZodArray:()=>Wm,ZodBase64:()=>Sc,ZodBase64URL:()=>Ic,ZodBigInt:()=>Nr,ZodBigIntFormat:()=>Pc,ZodBoolean:()=>Mr,ZodCIDRv4:()=>xc,ZodCIDRv6:()=>$c,ZodCUID:()=>hc,ZodCUID2:()=>vc,ZodCatch:()=>cp,ZodCodec:()=>Uc,ZodCustom:()=>pi,ZodCustomStringFormat:()=>Cr,ZodDate:()=>ui,ZodDefault:()=>np,ZodDiscriminatedUnion:()=>Hm,ZodE164:()=>Tc,ZodEmail:()=>pc,ZodEmoji:()=>fc,ZodEnum:()=>Rr,ZodError:()=>$b,ZodFile:()=>ep,ZodFirstPartyTypeKind:()=>Lc,ZodFunction:()=>yp,ZodGUID:()=>oi,ZodIPv4:()=>kc,ZodIPv6:()=>wc,ZodISODate:()=>ti,ZodISODateTime:()=>ei,ZodISODuration:()=>ni,ZodISOTime:()=>ri,ZodIntersection:()=>Vm,ZodIssueCode:()=>A_,ZodJWT:()=>Dc,ZodKSUID:()=>_c,ZodLazy:()=>gp,ZodLiteral:()=>Qm,ZodMap:()=>Xm,ZodNaN:()=>dp,ZodNanoID:()=>gc,ZodNever:()=>Gm,ZodNonOptional:()=>Nc,ZodNull:()=>jm,ZodNullable:()=>rp,ZodNumber:()=>Ar,ZodNumberFormat:()=>Lt,ZodObject:()=>mi,ZodOptional:()=>Mc,ZodPipe:()=>jc,ZodPrefault:()=>op,ZodPromise:()=>vp,ZodReadonly:()=>mp,ZodRealError:()=>_e,ZodRecord:()=>zc,ZodSet:()=>Ym,ZodString:()=>zr,ZodStringFormat:()=>X,ZodSuccess:()=>lp,ZodSymbol:()=>Mm,ZodTemplateLiteral:()=>fp,ZodTransform:()=>tp,ZodTuple:()=>qm,ZodType:()=>z,ZodULID:()=>yc,ZodURL:()=>ci,ZodUUID:()=>Ke,ZodUndefined:()=>Nm,ZodUnion:()=>Ec,ZodUnknown:()=>Fm,ZodVoid:()=>Zm,ZodXID:()=>bc,_ZodString:()=>mc,_default:()=>ip,_function:()=>D_,any:()=>l_,array:()=>di,base64:()=>Hb,base64url:()=>Vb,bigint:()=>n_,boolean:()=>Am,catch:()=>up,check:()=>P_,cidrv4:()=>Zb,cidrv6:()=>Wb,clone:()=>he,codec:()=>S_,coerce:()=>Fc,config:()=>oe,core:()=>Je,cuid:()=>Mb,cuid2:()=>Nb,custom:()=>O_,date:()=>u_,decode:()=>nc,decodeAsync:()=>oc,discriminatedUnion:()=>g_,e164:()=>Bb,email:()=>Ib,emoji:()=>Cb,encode:()=>rc,encodeAsync:()=>ic,endsWith:()=>Ir,enum:()=>Cc,file:()=>k_,flattenError:()=>or,float32:()=>Qb,float64:()=>e_,formatError:()=>sr,function:()=>D_,getErrorMap:()=>N_,globalRegistry:()=>Fe,gt:()=>Be,gte:()=>be,guid:()=>Tb,hash:()=>Yb,hex:()=>Xb,hostname:()=>Kb,httpUrl:()=>zb,includes:()=>$r,instanceof:()=>E_,int:()=>dc,int32:()=>t_,int64:()=>i_,intersection:()=>Bm,ipv4:()=>Fb,ipv6:()=>Gb,iso:()=>ii,json:()=>z_,jwt:()=>qb,keyof:()=>d_,ksuid:()=>Lb,lazy:()=>hp,length:()=>Nt,literal:()=>__,locales:()=>hr,looseObject:()=>f_,lowercase:()=>wr,lt:()=>Ve,lte:()=>Pe,map:()=>v_,maxLength:()=>Mt,maxSize:()=>At,mime:()=>Tr,minLength:()=>st,minSize:()=>kt,multipleOf:()=>_t,nan:()=>$_,nanoid:()=>Ab,nativeEnum:()=>b_,negative:()=>Nl,never:()=>Oc,nonnegative:()=>Ul,nonoptional:()=>ap,nonpositive:()=>jl,normalize:()=>Dr,null:()=>Um,nullable:()=>ai,nullish:()=>w_,number:()=>Cm,object:()=>m_,optional:()=>si,overwrite:()=>qe,parse:()=>Yl,parseAsync:()=>Ql,partialRecord:()=>h_,pipe:()=>li,positive:()=>Ml,prefault:()=>sp,preprocess:()=>C_,prettifyError:()=>uo,promise:()=>T_,property:()=>Ll,readonly:()=>pp,record:()=>Km,refine:()=>bp,regex:()=>kr,regexes:()=>He,registry:()=>Rn,safeDecode:()=>ac,safeDecodeAsync:()=>cc,safeEncode:()=>sc,safeEncodeAsync:()=>lc,safeParse:()=>ec,safeParseAsync:()=>tc,set:()=>y_,setErrorMap:()=>M_,size:()=>_r,startsWith:()=>Sr,strictObject:()=>p_,string:()=>uc,stringFormat:()=>Jb,stringbool:()=>R_,success:()=>x_,superRefine:()=>_p,symbol:()=>s_,templateLiteral:()=>I_,toJSONSchema:()=>Bl,toLowerCase:()=>Or,toUpperCase:()=>Er,transform:()=>Ac,treeifyError:()=>co,trim:()=>Pr,tuple:()=>Jm,uint32:()=>r_,uint64:()=>o_,ulid:()=>jb,undefined:()=>a_,union:()=>Rc,unknown:()=>Ut,uppercase:()=>xr,url:()=>Rb,util:()=>D,uuid:()=>Db,uuidv4:()=>Pb,uuidv6:()=>Ob,uuidv7:()=>Eb,void:()=>c_,xid:()=>Ub});var Je={};dt(Je,{$ZodAny:()=>js,$ZodArray:()=>Zs,$ZodAsyncError:()=>Ue,$ZodBase64:()=>Ds,$ZodBase64URL:()=>Ps,$ZodBigInt:()=>Pn,$ZodBigIntFormat:()=>Cs,$ZodBoolean:()=>cr,$ZodCIDRv4:()=>Ss,$ZodCIDRv6:()=>Is,$ZodCUID:()=>fs,$ZodCUID2:()=>gs,$ZodCatch:()=>sa,$ZodCheck:()=>Y,$ZodCheckBigIntFormat:()=>Wo,$ZodCheckEndsWith:()=>rs,$ZodCheckGreaterThan:()=>kn,$ZodCheckIncludes:()=>es,$ZodCheckLengthEquals:()=>Ko,$ZodCheckLessThan:()=>_n,$ZodCheckLowerCase:()=>Yo,$ZodCheckMaxLength:()=>qo,$ZodCheckMaxSize:()=>Ho,$ZodCheckMimeType:()=>is,$ZodCheckMinLength:()=>Jo,$ZodCheckMinSize:()=>Vo,$ZodCheckMultipleOf:()=>Go,$ZodCheckNumberFormat:()=>Zo,$ZodCheckOverwrite:()=>os,$ZodCheckProperty:()=>ns,$ZodCheckRegex:()=>Xo,$ZodCheckSizeEquals:()=>Bo,$ZodCheckStartsWith:()=>ts,$ZodCheckStringFormat:()=>Ct,$ZodCheckUpperCase:()=>Qo,$ZodCodec:()=>ur,$ZodCustom:()=>fa,$ZodCustomStringFormat:()=>Rs,$ZodDate:()=>Gs,$ZodDefault:()=>ra,$ZodDiscriminatedUnion:()=>Hs,$ZodE164:()=>Os,$ZodEmail:()=>us,$ZodEmoji:()=>ms,$ZodEncodeError:()=>ht,$ZodEnum:()=>Ks,$ZodError:()=>ir,$ZodFile:()=>Ys,$ZodFunction:()=>da,$ZodGUID:()=>ls,$ZodIPv4:()=>xs,$ZodIPv6:()=>$s,$ZodISODate:()=>_s,$ZodISODateTime:()=>bs,$ZodISODuration:()=>ws,$ZodISOTime:()=>ks,$ZodIntersection:()=>Vs,$ZodJWT:()=>Es,$ZodKSUID:()=>ys,$ZodLazy:()=>pa,$ZodLiteral:()=>Xs,$ZodMap:()=>qs,$ZodNaN:()=>aa,$ZodNanoID:()=>ps,$ZodNever:()=>Ls,$ZodNonOptional:()=>ia,$ZodNull:()=>Ns,$ZodNullable:()=>ta,$ZodNumber:()=>Dn,$ZodNumberFormat:()=>zs,$ZodObject:()=>Im,$ZodObjectJIT:()=>Ws,$ZodOptional:()=>ea,$ZodPipe:()=>la,$ZodPrefault:()=>na,$ZodPromise:()=>ma,$ZodReadonly:()=>ca,$ZodRealError:()=>ye,$ZodRecord:()=>Bs,$ZodRegistry:()=>vr,$ZodSet:()=>Js,$ZodString:()=>bt,$ZodStringFormat:()=>J,$ZodSuccess:()=>oa,$ZodSymbol:()=>As,$ZodTemplateLiteral:()=>ua,$ZodTransform:()=>Qs,$ZodTuple:()=>En,$ZodType:()=>O,$ZodULID:()=>hs,$ZodURL:()=>ds,$ZodUUID:()=>cs,$ZodUndefined:()=>Ms,$ZodUnion:()=>On,$ZodUnknown:()=>Us,$ZodVoid:()=>Fs,$ZodXID:()=>vs,$brand:()=>to,$constructor:()=>m,$input:()=>ol,$output:()=>il,Doc:()=>wn,JSONSchema:()=>Em,JSONSchemaGenerator:()=>Qn,NEVER:()=>eo,TimePrecision:()=>ll,_any:()=>Pl,_array:()=>Fl,_base64:()=>Jn,_base64url:()=>Kn,_bigint:()=>wl,_boolean:()=>_l,_catch:()=>vb,_check:()=>Om,_cidrv4:()=>Bn,_cidrv6:()=>qn,_coercedBigint:()=>xl,_coercedBoolean:()=>kl,_coercedDate:()=>Cl,_coercedNumber:()=>fl,_coercedString:()=>al,_cuid:()=>Ln,_cuid2:()=>Fn,_custom:()=>Zl,_date:()=>zl,_decode:()=>dn,_decodeAsync:()=>pn,_default:()=>fb,_discriminatedUnion:()=>rb,_e164:()=>Xn,_email:()=>zn,_emoji:()=>jn,_encode:()=>un,_encodeAsync:()=>mn,_endsWith:()=>Ir,_enum:()=>lb,_file:()=>Gl,_float32:()=>hl,_float64:()=>vl,_gt:()=>Be,_gte:()=>be,_guid:()=>yr,_includes:()=>$r,_int:()=>gl,_int32:()=>yl,_int64:()=>$l,_intersection:()=>nb,_ipv4:()=>Hn,_ipv6:()=>Vn,_isoDate:()=>ul,_isoDateTime:()=>cl,_isoDuration:()=>ml,_isoTime:()=>dl,_jwt:()=>Yn,_ksuid:()=>Wn,_lazy:()=>kb,_length:()=>Nt,_literal:()=>ub,_lowercase:()=>wr,_lt:()=>Ve,_lte:()=>Pe,_map:()=>sb,_max:()=>Pe,_maxLength:()=>Mt,_maxSize:()=>At,_mime:()=>Tr,_min:()=>be,_minLength:()=>st,_minSize:()=>kt,_multipleOf:()=>_t,_nan:()=>Al,_nanoid:()=>Un,_nativeEnum:()=>cb,_negative:()=>Nl,_never:()=>El,_nonnegative:()=>Ul,_nonoptional:()=>gb,_nonpositive:()=>jl,_normalize:()=>Dr,_null:()=>Dl,_nullable:()=>pb,_number:()=>pl,_optional:()=>mb,_overwrite:()=>qe,_parse:()=>Ot,_parseAsync:()=>Et,_pipe:()=>yb,_positive:()=>Ml,_promise:()=>wb,_property:()=>Ll,_readonly:()=>bb,_record:()=>ob,_refine:()=>Wl,_regex:()=>kr,_safeDecode:()=>gn,_safeDecodeAsync:()=>vn,_safeEncode:()=>fn,_safeEncodeAsync:()=>hn,_safeParse:()=>Rt,_safeParseAsync:()=>zt,_set:()=>ab,_size:()=>_r,_startsWith:()=>Sr,_string:()=>sl,_stringFormat:()=>jt,_stringbool:()=>Vl,_success:()=>hb,_superRefine:()=>Hl,_symbol:()=>Il,_templateLiteral:()=>_b,_toLowerCase:()=>Or,_toUpperCase:()=>Er,_transform:()=>db,_trim:()=>Pr,_tuple:()=>ib,_uint32:()=>bl,_uint64:()=>Sl,_ulid:()=>Gn,_undefined:()=>Tl,_union:()=>tb,_unknown:()=>Ol,_uppercase:()=>xr,_url:()=>br,_uuid:()=>Cn,_uuidv4:()=>An,_uuidv6:()=>Mn,_uuidv7:()=>Nn,_void:()=>Rl,_xid:()=>Zn,clone:()=>he,config:()=>oe,decode:()=>Dv,decodeAsync:()=>Ov,encode:()=>Tv,encodeAsync:()=>Pv,flattenError:()=>or,formatError:()=>sr,globalConfig:()=>Kt,globalRegistry:()=>Fe,isValidBase64:()=>Ts,isValidBase64URL:()=>wm,isValidJWT:()=>xm,locales:()=>hr,parse:()=>ln,parseAsync:()=>cn,prettifyError:()=>uo,regexes:()=>He,registry:()=>Rn,safeDecode:()=>Rv,safeDecodeAsync:()=>Cv,safeEncode:()=>Ev,safeEncodeAsync:()=>zv,safeParse:()=>mo,safeParseAsync:()=>po,toDotPath:()=>nm,toJSONSchema:()=>Bl,treeifyError:()=>co,util:()=>D,version:()=>ss});var eo=Object.freeze({status:"aborted"});function m(e,t,n){function i(a,l){var c;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(c=a._zod).traits??(c.traits=new Set),a._zod.traits.add(e),t(a,l);for(let u in s.prototype)if(!(u in a))Object.defineProperty(a,u,{value:s.prototype[u].bind(a)});a._zod.constr=s,a._zod.def=l}let r=n?.Parent??Object;class o extends r{}Object.defineProperty(o,"name",{value:e});function s(a){var l;let c=n?.Parent?new o:this;i(c,a),(l=c._zod).deferred??(l.deferred=[]);for(let u of c._zod.deferred)u();return c}return Object.defineProperty(s,"init",{value:i}),Object.defineProperty(s,Symbol.hasInstance,{value:(a)=>{if(n?.Parent&&a instanceof n.Parent)return!0;return a?._zod?.traits?.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}var to=Symbol("zod_brand");class Ue extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ht extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}var Kt={};function oe(e){if(e)Object.assign(Kt,e);return Kt}var D={};dt(D,{BIGINT_FORMAT_RANGES:()=>lo,Class:()=>tm,NUMBER_FORMAT_RANGES:()=>ao,aborted:()=>it,allowsEval:()=>io,assert:()=>pv,assertEqual:()=>cv,assertIs:()=>dv,assertNever:()=>mv,assertNotEqual:()=>uv,assignProp:()=>Re,base64ToUint8Array:()=>Qd,base64urlToUint8Array:()=>wv,cached:()=>Pt,captureStackTrace:()=>an,cleanEnum:()=>kv,cleanRegex:()=>Qt,clone:()=>he,cloneDef:()=>fv,createTransparentProxy:()=>_v,defineLazy:()=>A,esc:()=>sn,escapeRegex:()=>Le,extend:()=>qd,finalizeIssue:()=>Se,floatSafeRemainder:()=>no,getElementAtPath:()=>gv,getEnumValues:()=>Yt,getLengthableOrigin:()=>nr,getParsedType:()=>bv,getSizableOrigin:()=>rr,hexToUint8Array:()=>$v,isObject:()=>vt,isPlainObject:()=>nt,issue:()=>ot,joinValues:()=>h,jsonStringifyReplacer:()=>Dt,merge:()=>Kd,mergeDefs:()=>rt,normalizeParams:()=>y,nullish:()=>tt,numKeys:()=>yv,objectClone:()=>on,omit:()=>Bd,optionalKeys:()=>so,partial:()=>Xd,pick:()=>Vd,prefixIssues:()=>$e,primitiveTypes:()=>oo,promiseAllObject:()=>hv,propertyKeyTypes:()=>tr,randomString:()=>vv,required:()=>Yd,safeExtend:()=>Jd,shallowClone:()=>er,stringifyPrimitive:()=>k,uint8ArrayToBase64:()=>em,uint8ArrayToBase64url:()=>xv,uint8ArrayToHex:()=>Sv,unwrapMessage:()=>Xt});function cv(e){return e}function uv(e){return e}function dv(e){}function mv(e){throw Error()}function pv(e){}function Yt(e){let t=Object.values(e).filter((i)=>typeof i==="number");return Object.entries(e).filter(([i,r])=>t.indexOf(+i)===-1).map(([i,r])=>r)}function h(e,t="|"){return e.map((n)=>k(n)).join(t)}function Dt(e,t){if(typeof t==="bigint")return t.toString();return t}function Pt(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw Error("cached value already set")}}}function tt(e){return e===null||e===void 0}function Qt(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function no(e,t){let n=(e.toString().split(".")[1]||"").length,i=t.toString(),r=(i.split(".")[1]||"").length;if(r===0&&/\d?e-\d?/.test(i)){let l=i.match(/\d?e-(\d?)/);if(l?.[1])r=Number.parseInt(l[1])}let o=n>r?n:r,s=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return s%a/10**o}var Hd=Symbol("evaluating");function A(e,t,n){let i=void 0;Object.defineProperty(e,t,{get(){if(i===Hd)return;if(i===void 0)i=Hd,i=n();return i},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function on(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Re(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function rt(...e){let t={};for(let n of e){let i=Object.getOwnPropertyDescriptors(n);Object.assign(t,i)}return Object.defineProperties({},t)}function fv(e){return rt(e._zod.def)}function gv(e,t){if(!t)return e;return t.reduce((n,i)=>n?.[i],e)}function hv(e){let t=Object.keys(e),n=t.map((i)=>e[i]);return Promise.all(n).then((i)=>{let r={};for(let o=0;o<t.length;o++)r[t[o]]=i[o];return r})}function vv(e=10){let n="";for(let i=0;i<e;i++)n+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return n}function sn(e){return JSON.stringify(e)}var an="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function vt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var io=Pt(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function nt(e){if(vt(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;if(vt(n)===!1)return!1;if(Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)return!1;return!0}function er(e){if(nt(e))return{...e};if(Array.isArray(e))return[...e];return e}function yv(e){let t=0;for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n))t++;return t}var bv=(e)=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(e))return"array";if(e===null)return"null";if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return"promise";if(typeof Map<"u"&&e instanceof Map)return"map";if(typeof Set<"u"&&e instanceof Set)return"set";if(typeof Date<"u"&&e instanceof Date)return"date";if(typeof File<"u"&&e instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${t}`)}},tr=new Set(["string","number","symbol"]),oo=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Le(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function he(e,t,n){let i=new e._zod.constr(t??e._zod.def);if(!t||n?.parent)i._zod.parent=e;return i}function y(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function _v(e){let t;return new Proxy({},{get(n,i,r){return t??(t=e()),Reflect.get(t,i,r)},set(n,i,r,o){return t??(t=e()),Reflect.set(t,i,r,o)},has(n,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(n,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(n,i,r){return t??(t=e()),Reflect.defineProperty(t,i,r)}})}function k(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function so(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var ao={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},lo={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Vd(e,t){let n=e._zod.def,i=rt(e._zod.def,{get shape(){let r={};for(let o in t){if(!(o in n.shape))throw Error(`Unrecognized key: "${o}"`);if(!t[o])continue;r[o]=n.shape[o]}return Re(this,"shape",r),r},checks:[]});return he(e,i)}function Bd(e,t){let n=e._zod.def,i=rt(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let o in t){if(!(o in n.shape))throw Error(`Unrecognized key: "${o}"`);if(!t[o])continue;delete r[o]}return Re(this,"shape",r),r},checks:[]});return he(e,i)}function qd(e,t){if(!nt(t))throw Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0)throw Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let r=rt(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return Re(this,"shape",o),o},checks:[]});return he(e,r)}function Jd(e,t){if(!nt(t))throw Error("Invalid input to safeExtend: expected a plain object");let n={...e._zod.def,get shape(){let i={...e._zod.def.shape,...t};return Re(this,"shape",i),i},checks:e._zod.def.checks};return he(e,n)}function Kd(e,t){let n=rt(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t._zod.def.shape};return Re(this,"shape",i),i},get catchall(){return t._zod.def.catchall},checks:[]});return he(e,n)}function Xd(e,t,n){let i=rt(t._zod.def,{get shape(){let r=t._zod.def.shape,o={...r};if(n)for(let s in n){if(!(s in r))throw Error(`Unrecognized key: "${s}"`);if(!n[s])continue;o[s]=e?new e({type:"optional",innerType:r[s]}):r[s]}else for(let s in r)o[s]=e?new e({type:"optional",innerType:r[s]}):r[s];return Re(this,"shape",o),o},checks:[]});return he(t,i)}function Yd(e,t,n){let i=rt(t._zod.def,{get shape(){let r=t._zod.def.shape,o={...r};if(n)for(let s in n){if(!(s in o))throw Error(`Unrecognized key: "${s}"`);if(!n[s])continue;o[s]=new e({type:"nonoptional",innerType:r[s]})}else for(let s in r)o[s]=new e({type:"nonoptional",innerType:r[s]});return Re(this,"shape",o),o},checks:[]});return he(t,i)}function it(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function $e(e,t){return t.map((n)=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(e),n})}function Xt(e){return typeof e==="string"?e:e?.message}function Se(e,t,n){let i={...e,path:e.path??[]};if(!e.message){let r=Xt(e.inst?._zod.def?.error?.(e))??Xt(t?.error?.(e))??Xt(n.customError?.(e))??Xt(n.localeError?.(e))??"Invalid input";i.message=r}if(delete i.inst,delete i.continue,!t?.reportInput)delete i.input;return i}function rr(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}function nr(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function ot(...e){let[t,n,i]=e;if(typeof t==="string")return{message:t,code:"custom",input:n,inst:i};return{...t}}function kv(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map((t)=>t[1])}function Qd(e){let t=atob(e),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n}function em(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function wv(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return Qd(t+n)}function xv(e){return em(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function $v(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let i=0;i<t.length;i+=2)n[i/2]=Number.parseInt(t.slice(i,i+2),16);return n}function Sv(e){return Array.from(e).map((t)=>t.toString(16).padStart(2,"0")).join("")}class tm{constructor(...e){}}var rm=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Dt,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ir=m("$ZodError",rm),ye=m("$ZodError",rm,{Parent:Error});function or(e,t=(n)=>n.message){let n={},i=[];for(let r of e.issues)if(r.path.length>0)n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r));else i.push(t(r));return{formErrors:i,fieldErrors:n}}function sr(e,t){let n=t||function(o){return o.message},i={_errors:[]},r=(o)=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((a)=>r({issues:a}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)i._errors.push(n(s));else{let a=i,l=0;while(l<s.path.length){let c=s.path[l];if(l!==s.path.length-1)a[c]=a[c]||{_errors:[]};else a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(s));a=a[c],l++}}};return r(e),i}function co(e,t){let n=t||function(o){return o.message},i={errors:[]},r=(o,s=[])=>{var a,l;for(let c of o.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map((u)=>r({issues:u},c.path));else if(c.code==="invalid_key")r({issues:c.issues},c.path);else if(c.code==="invalid_element")r({issues:c.issues},c.path);else{let u=[...s,...c.path];if(u.length===0){i.errors.push(n(c));continue}let f=i,g=0;while(g<u.length){let d=u[g],b=g===u.length-1;if(typeof d==="string")f.properties??(f.properties={}),(a=f.properties)[d]??(a[d]={errors:[]}),f=f.properties[d];else f.items??(f.items=[]),(l=f.items)[d]??(l[d]={errors:[]}),f=f.items[d];if(b)f.errors.push(n(c));g++}}};return r(e),i}function nm(e){let t=[],n=e.map((i)=>typeof i==="object"?i.key:i);for(let i of n)if(typeof i==="number")t.push(`[${i}]`);else if(typeof i==="symbol")t.push(`[${JSON.stringify(String(i))}]`);else if(/[^\w$]/.test(i))t.push(`[${JSON.stringify(i)}]`);else{if(t.length)t.push(".");t.push(i)}return t.join("")}function uo(e){let t=[],n=[...e.issues].sort((i,r)=>(i.path??[]).length-(r.path??[]).length);for(let i of n)if(t.push(`✖ ${i.message}`),i.path?.length)t.push(` → at ${nm(i.path)}`);return t.join(`
171
+ `)}var Ot=(e)=>(t,n,i,r)=>{let o=i?Object.assign(i,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new Ue;if(s.issues.length){let a=new(r?.Err??e)(s.issues.map((l)=>Se(l,o,oe())));throw an(a,r?.callee),a}return s.value},ln=Ot(ye),Et=(e)=>async(t,n,i,r)=>{let o=i?Object.assign(i,{async:!0}):{async:!0},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)s=await s;if(s.issues.length){let a=new(r?.Err??e)(s.issues.map((l)=>Se(l,o,oe())));throw an(a,r?.callee),a}return s.value},cn=Et(ye),Rt=(e)=>(t,n,i)=>{let r=i?{...i,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},r);if(o instanceof Promise)throw new Ue;return o.issues.length?{success:!1,error:new(e??ir)(o.issues.map((s)=>Se(s,r,oe())))}:{success:!0,data:o.value}},mo=Rt(ye),zt=(e)=>async(t,n,i)=>{let r=i?Object.assign(i,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},r);if(o instanceof Promise)o=await o;return o.issues.length?{success:!1,error:new e(o.issues.map((s)=>Se(s,r,oe())))}:{success:!0,data:o.value}},po=zt(ye),un=(e)=>(t,n,i)=>{let r=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Ot(e)(t,n,r)},Tv=un(ye),dn=(e)=>(t,n,i)=>Ot(e)(t,n,i),Dv=dn(ye),mn=(e)=>async(t,n,i)=>{let r=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Et(e)(t,n,r)},Pv=mn(ye),pn=(e)=>async(t,n,i)=>Et(e)(t,n,i),Ov=pn(ye),fn=(e)=>(t,n,i)=>{let r=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Rt(e)(t,n,r)},Ev=fn(ye),gn=(e)=>(t,n,i)=>Rt(e)(t,n,i),Rv=gn(ye),hn=(e)=>async(t,n,i)=>{let r=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return zt(e)(t,n,r)},zv=hn(ye),vn=(e)=>async(t,n,i)=>zt(e)(t,n,i),Cv=vn(ye);var He={};dt(He,{base64:()=>Do,base64url:()=>yn,bigint:()=>Co,boolean:()=>No,browserEmail:()=>Gv,cidrv4:()=>Io,cidrv6:()=>To,cuid:()=>fo,cuid2:()=>go,date:()=>Oo,datetime:()=>Ro,domain:()=>om,duration:()=>_o,e164:()=>Po,email:()=>wo,emoji:()=>xo,extendedDuration:()=>Av,guid:()=>ko,hex:()=>lm,hostname:()=>bn,html5Email:()=>Uv,idnEmail:()=>Fv,integer:()=>Ao,ipv4:()=>$o,ipv6:()=>So,ksuid:()=>yo,lowercase:()=>Lo,md5_base64:()=>Wv,md5_base64url:()=>Hv,md5_hex:()=>Zv,nanoid:()=>bo,null:()=>jo,number:()=>Mo,rfc5322Email:()=>Lv,sha1_base64:()=>Bv,sha1_base64url:()=>qv,sha1_hex:()=>Vv,sha256_base64:()=>Kv,sha256_base64url:()=>Xv,sha256_hex:()=>Jv,sha384_base64:()=>Qv,sha384_base64url:()=>ey,sha384_hex:()=>Yv,sha512_base64:()=>ry,sha512_base64url:()=>ny,sha512_hex:()=>ty,string:()=>zo,time:()=>Eo,ulid:()=>ho,undefined:()=>Uo,unicodeEmail:()=>im,uppercase:()=>Fo,uuid:()=>yt,uuid4:()=>Mv,uuid6:()=>Nv,uuid7:()=>jv,xid:()=>vo});var fo=/^[cC][^\s-]{8,}$/,go=/^[0-9a-z]+$/,ho=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,vo=/^[0-9a-vA-V]{20}$/,yo=/^[A-Za-z0-9]{27}$/,bo=/^[a-zA-Z0-9_-]{21}$/,_o=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Av=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ko=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,yt=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},Mv=yt(4),Nv=yt(6),jv=yt(7),wo=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Uv=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Lv=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,im=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Fv=im,Gv=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;function xo(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var $o=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,So=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Io=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,To=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Do=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,yn=/^[A-Za-z0-9_-]*$/,bn=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,om=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Po=/^\+(?:[0-9]){6,14}[0-9]$/,sm="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Oo=new RegExp(`^${sm}$`);function am(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Eo(e){return new RegExp(`^${am(e)}$`)}function Ro(e){let t=am({precision:e.precision}),n=["Z"];if(e.local)n.push("");if(e.offset)n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let i=`${t}(?:${n.join("|")})`;return new RegExp(`^${sm}T(?:${i})$`)}var zo=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Co=/^-?\d+n?$/,Ao=/^-?\d+$/,Mo=/^-?\d+(?:\.\d+)?/,No=/^(?:true|false)$/i,jo=/^null$/i;var Uo=/^undefined$/i;var Lo=/^[^A-Z]*$/,Fo=/^[^a-z]*$/,lm=/^[0-9a-fA-F]*$/;function ar(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function lr(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Zv=/^[0-9a-fA-F]{32}$/,Wv=ar(22,"=="),Hv=lr(22),Vv=/^[0-9a-fA-F]{40}$/,Bv=ar(27,"="),qv=lr(27),Jv=/^[0-9a-fA-F]{64}$/,Kv=ar(43,"="),Xv=lr(43),Yv=/^[0-9a-fA-F]{96}$/,Qv=ar(64,""),ey=lr(64),ty=/^[0-9a-fA-F]{128}$/,ry=ar(86,"=="),ny=lr(86);var Y=m("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),um={number:"number",bigint:"bigint",object:"date"},_n=m("$ZodCheckLessThan",(e,t)=>{Y.init(e,t);let n=um[typeof t.value];e._zod.onattach.push((i)=>{let r=i._zod.bag,o=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<o)if(t.inclusive)r.maximum=t.value;else r.exclusiveMaximum=t.value}),e._zod.check=(i)=>{if(t.inclusive?i.value<=t.value:i.value<t.value)return;i.issues.push({origin:n,code:"too_big",maximum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),kn=m("$ZodCheckGreaterThan",(e,t)=>{Y.init(e,t);let n=um[typeof t.value];e._zod.onattach.push((i)=>{let r=i._zod.bag,o=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>o)if(t.inclusive)r.minimum=t.value;else r.exclusiveMinimum=t.value}),e._zod.check=(i)=>{if(t.inclusive?i.value>=t.value:i.value>t.value)return;i.issues.push({origin:n,code:"too_small",minimum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Go=m("$ZodCheckMultipleOf",(e,t)=>{Y.init(e,t),e._zod.onattach.push((n)=>{var i;(i=n._zod.bag).multipleOf??(i.multipleOf=t.value)}),e._zod.check=(n)=>{if(typeof n.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof n.value==="bigint"?n.value%t.value===BigInt(0):no(n.value,t.value)===0)return;n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Zo=m("$ZodCheckNumberFormat",(e,t)=>{Y.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),i=n?"int":"number",[r,o]=ao[t.format];e._zod.onattach.push((s)=>{let a=s._zod.bag;if(a.format=t.format,a.minimum=r,a.maximum=o,n)a.pattern=Ao}),e._zod.check=(s)=>{let a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort});else s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort});return}}if(a<r)s.issues.push({origin:"number",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort});if(a>o)s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inst:e})}}),Wo=m("$ZodCheckBigIntFormat",(e,t)=>{Y.init(e,t);let[n,i]=lo[t.format];e._zod.onattach.push((r)=>{let o=r._zod.bag;o.format=t.format,o.minimum=n,o.maximum=i}),e._zod.check=(r)=>{let o=r.value;if(o<n)r.issues.push({origin:"bigint",input:o,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(o>i)r.issues.push({origin:"bigint",input:o,code:"too_big",maximum:i,inst:e})}}),Ho=m("$ZodCheckMaxSize",(e,t)=>{var n;Y.init(e,t),(n=e._zod.def).when??(n.when=(i)=>{let r=i.value;return!tt(r)&&r.size!==void 0}),e._zod.onattach.push((i)=>{let r=i._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<r)i._zod.bag.maximum=t.maximum}),e._zod.check=(i)=>{let r=i.value;if(r.size<=t.maximum)return;i.issues.push({origin:rr(r),code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Vo=m("$ZodCheckMinSize",(e,t)=>{var n;Y.init(e,t),(n=e._zod.def).when??(n.when=(i)=>{let r=i.value;return!tt(r)&&r.size!==void 0}),e._zod.onattach.push((i)=>{let r=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>r)i._zod.bag.minimum=t.minimum}),e._zod.check=(i)=>{let r=i.value;if(r.size>=t.minimum)return;i.issues.push({origin:rr(r),code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Bo=m("$ZodCheckSizeEquals",(e,t)=>{var n;Y.init(e,t),(n=e._zod.def).when??(n.when=(i)=>{let r=i.value;return!tt(r)&&r.size!==void 0}),e._zod.onattach.push((i)=>{let r=i._zod.bag;r.minimum=t.size,r.maximum=t.size,r.size=t.size}),e._zod.check=(i)=>{let r=i.value,o=r.size;if(o===t.size)return;let s=o>t.size;i.issues.push({origin:rr(r),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),qo=m("$ZodCheckMaxLength",(e,t)=>{var n;Y.init(e,t),(n=e._zod.def).when??(n.when=(i)=>{let r=i.value;return!tt(r)&&r.length!==void 0}),e._zod.onattach.push((i)=>{let r=i._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<r)i._zod.bag.maximum=t.maximum}),e._zod.check=(i)=>{let r=i.value;if(r.length<=t.maximum)return;let s=nr(r);i.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Jo=m("$ZodCheckMinLength",(e,t)=>{var n;Y.init(e,t),(n=e._zod.def).when??(n.when=(i)=>{let r=i.value;return!tt(r)&&r.length!==void 0}),e._zod.onattach.push((i)=>{let r=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>r)i._zod.bag.minimum=t.minimum}),e._zod.check=(i)=>{let r=i.value;if(r.length>=t.minimum)return;let s=nr(r);i.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ko=m("$ZodCheckLengthEquals",(e,t)=>{var n;Y.init(e,t),(n=e._zod.def).when??(n.when=(i)=>{let r=i.value;return!tt(r)&&r.length!==void 0}),e._zod.onattach.push((i)=>{let r=i._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=(i)=>{let r=i.value,o=r.length;if(o===t.length)return;let s=nr(r),a=o>t.length;i.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),Ct=m("$ZodCheckStringFormat",(e,t)=>{var n,i;if(Y.init(e,t),e._zod.onattach.push((r)=>{let o=r._zod.bag;if(o.format=t.format,t.pattern)o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern)}),t.pattern)(n=e._zod).check??(n.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(i=e._zod).check??(i.check=()=>{})}),Xo=m("$ZodCheckRegex",(e,t)=>{Ct.init(e,t),e._zod.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Yo=m("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Lo),Ct.init(e,t)}),Qo=m("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Fo),Ct.init(e,t)}),es=m("$ZodCheckIncludes",(e,t)=>{Y.init(e,t);let n=Le(t.includes),i=new RegExp(typeof t.position==="number"?`^.{${t.position}}${n}`:n);t.pattern=i,e._zod.onattach.push((r)=>{let o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(i)}),e._zod.check=(r)=>{if(r.value.includes(t.includes,t.position))return;r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),ts=m("$ZodCheckStartsWith",(e,t)=>{Y.init(e,t);let n=new RegExp(`^${Le(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push((i)=>{let r=i._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=(i)=>{if(i.value.startsWith(t.prefix))return;i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}}),rs=m("$ZodCheckEndsWith",(e,t)=>{Y.init(e,t);let n=new RegExp(`.*${Le(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push((i)=>{let r=i._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=(i)=>{if(i.value.endsWith(t.suffix))return;i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}});function cm(e,t,n){if(e.issues.length)t.issues.push(...$e(n,e.issues))}var ns=m("$ZodCheckProperty",(e,t)=>{Y.init(e,t),e._zod.check=(n)=>{let i=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(i instanceof Promise)return i.then((r)=>cm(r,n,t.property));cm(i,n,t.property);return}}),is=m("$ZodCheckMimeType",(e,t)=>{Y.init(e,t);let n=new Set(t.mime);e._zod.onattach.push((i)=>{i._zod.bag.mime=t.mime}),e._zod.check=(i)=>{if(n.has(i.value.type))return;i.issues.push({code:"invalid_value",values:t.mime,input:i.value.type,inst:e,continue:!t.abort})}}),os=m("$ZodCheckOverwrite",(e,t)=>{Y.init(e,t),e._zod.check=(n)=>{n.value=t.tx(n.value)}});class wn{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
172
+ `).filter((o)=>o),i=Math.min(...n.map((o)=>o.length-o.trimStart().length)),r=n.map((o)=>o.slice(i)).map((o)=>" ".repeat(this.indent*2)+o);for(let o of r)this.content.push(o)}compile(){let e=Function,t=this?.args,i=[...(this?.content??[""]).map((r)=>` ${r}`)];return new e(...t,i.join(`
173
+ `))}}var ss={major:4,minor:1,patch:8};var O=m("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ss;let i=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))i.unshift(e);for(let r of i)for(let o of r._zod.onattach)o(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let r=(s,a,l)=>{let c=it(s),u;for(let f of a){if(f._zod.def.when){if(!f._zod.def.when(s))continue}else if(c)continue;let g=s.issues.length,d=f._zod.check(s);if(d instanceof Promise&&l?.async===!1)throw new Ue;if(u||d instanceof Promise)u=(u??Promise.resolve()).then(async()=>{if(await d,s.issues.length===g)return;if(!c)c=it(s,g)});else{if(s.issues.length===g)continue;if(!c)c=it(s,g)}}if(u)return u.then(()=>s);return s},o=(s,a,l)=>{if(it(s))return s.aborted=!0,s;let c=r(a,i,l);if(c instanceof Promise){if(l.async===!1)throw new Ue;return c.then((u)=>e._zod.parse(u,l))}return e._zod.parse(c,l)};e._zod.run=(s,a)=>{if(a.skipChecks)return e._zod.parse(s,a);if(a.direction==="backward"){let c=e._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});if(c instanceof Promise)return c.then((u)=>o(u,s,a));return o(c,s,a)}let l=e._zod.parse(s,a);if(l instanceof Promise){if(a.async===!1)throw new Ue;return l.then((c)=>r(c,i,a))}return r(l,i,a)}}e["~standard"]={validate:(r)=>{try{let o=mo(e,r);return o.success?{value:o.data}:{issues:o.error?.issues}}catch(o){return po(e,r).then((s)=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),bt=m("$ZodString",(e,t)=>{O.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??zo(e._zod.bag),e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=String(n.value)}catch(r){}if(typeof n.value==="string")return n;return n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),J=m("$ZodStringFormat",(e,t)=>{Ct.init(e,t),bt.init(e,t)}),ls=m("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ko),J.init(e,t)}),cs=m("$ZodUUID",(e,t)=>{if(t.version){let i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=yt(i))}else t.pattern??(t.pattern=yt());J.init(e,t)}),us=m("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=wo),J.init(e,t)}),ds=m("$ZodURL",(e,t)=>{J.init(e,t),e._zod.check=(n)=>{try{let i=n.value.trim(),r=new URL(i);if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(r.hostname))n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:bn.source,input:n.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol))n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})}if(t.normalize)n.value=r.href;else n.value=i;return}catch(i){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),ms=m("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=xo()),J.init(e,t)}),ps=m("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=bo),J.init(e,t)}),fs=m("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=fo),J.init(e,t)}),gs=m("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=go),J.init(e,t)}),hs=m("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ho),J.init(e,t)}),vs=m("$ZodXID",(e,t)=>{t.pattern??(t.pattern=vo),J.init(e,t)}),ys=m("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=yo),J.init(e,t)}),bs=m("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ro(t)),J.init(e,t)}),_s=m("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Oo),J.init(e,t)}),ks=m("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Eo(t)),J.init(e,t)}),ws=m("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=_o),J.init(e,t)}),xs=m("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=$o),J.init(e,t),e._zod.onattach.push((n)=>{let i=n._zod.bag;i.format="ipv4"})}),$s=m("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=So),J.init(e,t),e._zod.onattach.push((n)=>{let i=n._zod.bag;i.format="ipv6"}),e._zod.check=(n)=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),Ss=m("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Io),J.init(e,t)}),Is=m("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=To),J.init(e,t),e._zod.check=(n)=>{let i=n.value.split("/");try{if(i.length!==2)throw Error();let[r,o]=i;if(!o)throw Error();let s=Number(o);if(`${s}`!==o)throw Error();if(s<0||s>128)throw Error();new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Ts(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Ds=m("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Do),J.init(e,t),e._zod.onattach.push((n)=>{n._zod.bag.contentEncoding="base64"}),e._zod.check=(n)=>{if(Ts(n.value))return;n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function wm(e){if(!yn.test(e))return!1;let t=e.replace(/[-_]/g,(i)=>i==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Ts(n)}var Ps=m("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=yn),J.init(e,t),e._zod.onattach.push((n)=>{n._zod.bag.contentEncoding="base64url"}),e._zod.check=(n)=>{if(wm(n.value))return;n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Os=m("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Po),J.init(e,t)});function xm(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[i]=n;if(!i)return!1;let r=JSON.parse(atob(i));if("typ"in r&&r?.typ!=="JWT")return!1;if(!r.alg)return!1;if(t&&(!("alg"in r)||r.alg!==t))return!1;return!0}catch{return!1}}var Es=m("$ZodJWT",(e,t)=>{J.init(e,t),e._zod.check=(n)=>{if(xm(n.value,t.alg))return;n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Rs=m("$ZodCustomStringFormat",(e,t)=>{J.init(e,t),e._zod.check=(n)=>{if(t.fn(n.value))return;n.issues.push({code:"invalid_format",format:t.format,input:n.value,inst:e,continue:!t.abort})}}),Dn=m("$ZodNumber",(e,t)=>{O.init(e,t),e._zod.pattern=e._zod.bag.pattern??Mo,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Number(n.value)}catch(s){}let r=n.value;if(typeof r==="number"&&!Number.isNaN(r)&&Number.isFinite(r))return n;let o=typeof r==="number"?Number.isNaN(r)?"NaN":!Number.isFinite(r)?"Infinity":void 0:void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...o?{received:o}:{}}),n}}),zs=m("$ZodNumber",(e,t)=>{Zo.init(e,t),Dn.init(e,t)}),cr=m("$ZodBoolean",(e,t)=>{O.init(e,t),e._zod.pattern=No,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(o){}let r=n.value;if(typeof r==="boolean")return n;return n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}}),Pn=m("$ZodBigInt",(e,t)=>{O.init(e,t),e._zod.pattern=Co,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch(r){}if(typeof n.value==="bigint")return n;return n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}}),Cs=m("$ZodBigInt",(e,t)=>{Wo.init(e,t),Pn.init(e,t)}),As=m("$ZodSymbol",(e,t)=>{O.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;if(typeof r==="symbol")return n;return n.issues.push({expected:"symbol",code:"invalid_type",input:r,inst:e}),n}}),Ms=m("$ZodUndefined",(e,t)=>{O.init(e,t),e._zod.pattern=Uo,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(n,i)=>{let r=n.value;if(typeof r>"u")return n;return n.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:e}),n}}),Ns=m("$ZodNull",(e,t)=>{O.init(e,t),e._zod.pattern=jo,e._zod.values=new Set([null]),e._zod.parse=(n,i)=>{let r=n.value;if(r===null)return n;return n.issues.push({expected:"null",code:"invalid_type",input:r,inst:e}),n}}),js=m("$ZodAny",(e,t)=>{O.init(e,t),e._zod.parse=(n)=>n}),Us=m("$ZodUnknown",(e,t)=>{O.init(e,t),e._zod.parse=(n)=>n}),Ls=m("$ZodNever",(e,t)=>{O.init(e,t),e._zod.parse=(n,i)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),Fs=m("$ZodVoid",(e,t)=>{O.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;if(typeof r>"u")return n;return n.issues.push({expected:"void",code:"invalid_type",input:r,inst:e}),n}}),Gs=m("$ZodDate",(e,t)=>{O.init(e,t),e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=new Date(n.value)}catch(a){}let r=n.value,o=r instanceof Date;if(o&&!Number.isNaN(r.getTime()))return n;return n.issues.push({expected:"date",code:"invalid_type",input:r,...o?{received:"Invalid Date"}:{},inst:e}),n}});function mm(e,t,n){if(e.issues.length)t.issues.push(...$e(n,e.issues));t.value[n]=e.value}var Zs=m("$ZodArray",(e,t)=>{O.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),n;n.value=Array(r.length);let o=[];for(let s=0;s<r.length;s++){let a=r[s],l=t.element._zod.run({value:a,issues:[]},i);if(l instanceof Promise)o.push(l.then((c)=>mm(c,n,s)));else mm(l,n,s)}if(o.length)return Promise.all(o).then(()=>n);return n}});function Tn(e,t,n,i){if(e.issues.length)t.issues.push(...$e(n,e.issues));if(e.value===void 0){if(n in i)t.value[n]=void 0}else t.value[n]=e.value}function $m(e){let t=Object.keys(e.shape);for(let i of t)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${i}": expected a Zod schema`);let n=so(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Sm(e,t,n,i,r,o){let s=[],a=r.keySet,l=r.catchall._zod,c=l.def.type;for(let u of Object.keys(t)){if(a.has(u))continue;if(c==="never"){s.push(u);continue}let f=l.run({value:t[u],issues:[]},i);if(f instanceof Promise)e.push(f.then((g)=>Tn(g,n,u,t)));else Tn(f,n,u,t)}if(s.length)n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:o});if(!e.length)return n;return Promise.all(e).then(()=>n)}var Im=m("$ZodObject",(e,t)=>{O.init(e,t);let n=Pt(()=>$m(t));A(e._zod,"propValues",()=>{let s=t.shape,a={};for(let l in s){let c=s[l]._zod;if(c.values){a[l]??(a[l]=new Set);for(let u of c.values)a[l].add(u)}}return a});let i=vt,r=t.catchall,o;e._zod.parse=(s,a)=>{o??(o=n.value);let l=s.value;if(!i(l))return s.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),s;s.value={};let c=[],u=o.shape;for(let f of o.keys){let d=u[f]._zod.run({value:l[f],issues:[]},a);if(d instanceof Promise)c.push(d.then((b)=>Tn(b,s,f,l)));else Tn(d,s,f,l)}if(!r)return c.length?Promise.all(c).then(()=>s):s;return Sm(c,l,s,a,n.value,e)}}),Ws=m("$ZodObjectJIT",(e,t)=>{Im.init(e,t);let n=e._zod.parse,i=Pt(()=>$m(t)),r=(g)=>{let d=new wn(["shape","payload","ctx"]),b=i.value,x=(W)=>{let ae=sn(W);return`shape[${ae}]._zod.run({ value: input[${ae}], issues: [] }, ctx)`};d.write("const input = payload.value;");let M=Object.create(null),U=0;for(let W of b.keys)M[W]=`key_${U++}`;d.write("const newResult = {};");for(let W of b.keys){let ae=M[W],Te=sn(W);d.write(`const ${ae} = ${x(W)};`),d.write(`
174
174
  if (${ae}.issues.length) {
175
175
  payload.issues = payload.issues.concat(${ae}.issues.map(iss => ({
176
176
  ...iss,
@@ -187,20 +187,20 @@ CREATE INDEX IF NOT EXISTS idx_boulder_dir_session ON boulder_tasks(directory, s
187
187
  newResult[${Te}] = ${ae}.value;
188
188
  }
189
189
 
190
- `)}d.write("payload.value = newResult;"),d.write("return payload;");let K=d.compile();return(W,ae)=>K(g,W,ae)},i,s=vt,a=!Kt.jitless,c=a&&ii.value,u=t.catchall,f;e._zod.parse=(g,d)=>{f??(f=o.value);let b=g.value;if(!s(b))return g.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),g;if(a&&c&&d?.async===!1&&d.jitless!==!0){if(!i)i=r(t.shape);if(g=i(g,d),!u)return g;return Sm([],b,g,d,f,e)}return n(g,d)}});function pm(e,t,n,o){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let r=e.filter((i)=>!ot(i));if(r.length===1)return t.value=r[0].value,r[0];return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((i)=>i.issues.map((s)=>Se(s,o,ie())))}),t}var On=m("$ZodUnion",(e,t)=>{P.init(e,t),C(e._zod,"optin",()=>t.options.some((r)=>r._zod.optin==="optional")?"optional":void 0),C(e._zod,"optout",()=>t.options.some((r)=>r._zod.optout==="optional")?"optional":void 0),C(e._zod,"values",()=>{if(t.options.every((r)=>r._zod.values))return new Set(t.options.flatMap((r)=>Array.from(r._zod.values)));return}),C(e._zod,"pattern",()=>{if(t.options.every((r)=>r._zod.pattern)){let r=t.options.map((i)=>i._zod.pattern);return new RegExp(`^(${r.map((i)=>Qt(i.source)).join("|")})$`)}return});let n=t.options.length===1,o=t.options[0]._zod.run;e._zod.parse=(r,i)=>{if(n)return o(r,i);let s=!1,a=[];for(let l of t.options){let c=l._zod.run({value:r.value,issues:[]},i);if(c instanceof Promise)a.push(c),s=!0;else{if(c.issues.length===0)return c;a.push(c)}}if(!s)return pm(a,r,e,i);return Promise.all(a).then((l)=>pm(l,r,e,i))}}),Hs=m("$ZodDiscriminatedUnion",(e,t)=>{On.init(e,t);let n=e._zod.parse;C(e._zod,"propValues",()=>{let r={};for(let i of t.options){let s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[a,l]of Object.entries(s)){if(!r[a])r[a]=new Set;for(let c of l)r[a].add(c)}}return r});let o=Pt(()=>{let r=t.options,i=new Map;for(let s of r){let a=s._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let l of a){if(i.has(l))throw Error(`Duplicate discriminator value "${String(l)}"`);i.set(l,s)}}return i});e._zod.parse=(r,i)=>{let s=r.value;if(!vt(s))return r.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),r;let a=o.value.get(s?.[t.discriminator]);if(a)return a._zod.run(r,i);if(t.unionFallback)return n(r,i);return r.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:s,path:[t.discriminator],inst:e}),r}}),Vs=m("$ZodIntersection",(e,t)=>{P.init(e,t),e._zod.parse=(n,o)=>{let r=n.value,i=t.left._zod.run({value:r,issues:[]},o),s=t.right._zod.run({value:r,issues:[]},o);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([l,c])=>fm(n,l,c));return fm(n,i,s)}});function as(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(nt(e)&&nt(t)){let n=Object.keys(t),o=Object.keys(e).filter((i)=>n.indexOf(i)!==-1),r={...e,...t};for(let i of o){let s=as(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};r[i]=s.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let o=0;o<e.length;o++){let r=e[o],i=t[o],s=as(r,i);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function fm(e,t,n){if(t.issues.length)e.issues.push(...t.issues);if(n.issues.length)e.issues.push(...n.issues);if(ot(e))return e;let o=as(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var En=m("$ZodTuple",(e,t)=>{P.init(e,t);let n=t.items,o=n.length-[...n].reverse().findIndex((r)=>r._zod.optin!=="optional");e._zod.parse=(r,i)=>{let s=r.value;if(!Array.isArray(s))return r.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),r;r.value=[];let a=[];if(!t.rest){let c=s.length>n.length,u=s.length<o-1;if(c||u)return r.issues.push({...c?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length},input:s,inst:e,origin:"array"}),r}let l=-1;for(let c of n){if(l++,l>=s.length){if(l>=o)continue}let u=c._zod.run({value:s[l],issues:[]},i);if(u instanceof Promise)a.push(u.then((f)=>xn(f,r,l)));else xn(u,r,l)}if(t.rest){let c=s.slice(n.length);for(let u of c){l++;let f=t.rest._zod.run({value:u,issues:[]},i);if(f instanceof Promise)a.push(f.then((g)=>xn(g,r,l)));else xn(f,r,l)}}if(a.length)return Promise.all(a).then(()=>r);return r}});function xn(e,t,n){if(e.issues.length)t.issues.push(...$e(n,e.issues));t.value[n]=e.value}var Bs=m("$ZodRecord",(e,t)=>{P.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;if(!nt(r))return n.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),n;let i=[];if(t.keyType._zod.values){let s=t.keyType._zod.values;n.value={};for(let l of s)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){let c=t.valueType._zod.run({value:r[l],issues:[]},o);if(c instanceof Promise)i.push(c.then((u)=>{if(u.issues.length)n.issues.push(...$e(l,u.issues));n.value[l]=u.value}));else{if(c.issues.length)n.issues.push(...$e(l,c.issues));n.value[l]=c.value}}let a;for(let l in r)if(!s.has(l))a=a??[],a.push(l);if(a&&a.length>0)n.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:a})}else{n.value={};for(let s of Reflect.ownKeys(r)){if(s==="__proto__")continue;let a=t.keyType._zod.run({value:s,issues:[]},o);if(a instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(a.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map((c)=>Se(c,o,ie())),input:s,path:[s],inst:e}),n.value[a.value]=a.value;continue}let l=t.valueType._zod.run({value:r[s],issues:[]},o);if(l instanceof Promise)i.push(l.then((c)=>{if(c.issues.length)n.issues.push(...$e(s,c.issues));n.value[a.value]=c.value}));else{if(l.issues.length)n.issues.push(...$e(s,l.issues));n.value[a.value]=l.value}}}if(i.length)return Promise.all(i).then(()=>n);return n}}),qs=m("$ZodMap",(e,t)=>{P.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;if(!(r instanceof Map))return n.issues.push({expected:"map",code:"invalid_type",input:r,inst:e}),n;let i=[];n.value=new Map;for(let[s,a]of r){let l=t.keyType._zod.run({value:s,issues:[]},o),c=t.valueType._zod.run({value:a,issues:[]},o);if(l instanceof Promise||c instanceof Promise)i.push(Promise.all([l,c]).then(([u,f])=>{gm(u,f,n,s,r,e,o)}));else gm(l,c,n,s,r,e,o)}if(i.length)return Promise.all(i).then(()=>n);return n}});function gm(e,t,n,o,r,i,s){if(e.issues.length)if(tr.has(typeof o))n.issues.push(...$e(o,e.issues));else n.issues.push({code:"invalid_key",origin:"map",input:r,inst:i,issues:e.issues.map((a)=>Se(a,s,ie()))});if(t.issues.length)if(tr.has(typeof o))n.issues.push(...$e(o,t.issues));else n.issues.push({origin:"map",code:"invalid_element",input:r,inst:i,key:o,issues:t.issues.map((a)=>Se(a,s,ie()))});n.value.set(e.value,t.value)}var Js=m("$ZodSet",(e,t)=>{P.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;if(!(r instanceof Set))return n.issues.push({input:r,inst:e,expected:"set",code:"invalid_type"}),n;let i=[];n.value=new Set;for(let s of r){let a=t.valueType._zod.run({value:s,issues:[]},o);if(a instanceof Promise)i.push(a.then((l)=>hm(l,n)));else hm(a,n)}if(i.length)return Promise.all(i).then(()=>n);return n}});function hm(e,t){if(e.issues.length)t.issues.push(...e.issues);t.value.add(e.value)}var Ks=m("$ZodEnum",(e,t)=>{P.init(e,t);let n=Yt(t.entries),o=new Set(n);e._zod.values=o,e._zod.pattern=new RegExp(`^(${n.filter((r)=>tr.has(typeof r)).map((r)=>typeof r==="string"?Le(r):r.toString()).join("|")})$`),e._zod.parse=(r,i)=>{let s=r.value;if(o.has(s))return r;return r.issues.push({code:"invalid_value",values:n,input:s,inst:e}),r}}),Xs=m("$ZodLiteral",(e,t)=>{if(P.init(e,t),t.values.length===0)throw Error("Cannot create literal schema with no valid values");e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map((n)=>typeof n==="string"?Le(n):n?Le(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{let r=n.value;if(e._zod.values.has(r))return n;return n.issues.push({code:"invalid_value",values:t.values,input:r,inst:e}),n}}),Ys=m("$ZodFile",(e,t)=>{P.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;if(r instanceof File)return n;return n.issues.push({expected:"file",code:"invalid_type",input:r,inst:e}),n}}),Qs=m("$ZodTransform",(e,t)=>{P.init(e,t),e._zod.parse=(n,o)=>{if(o.direction==="backward")throw new ht(e.constructor.name);let r=t.transform(n.value,n);if(o.async)return(r instanceof Promise?r:Promise.resolve(r)).then((s)=>(n.value=s,n));if(r instanceof Promise)throw new Ue;return n.value=r,n}});function vm(e,t){if(e.issues.length&&t===void 0)return{issues:[],value:void 0};return e}var ea=m("$ZodOptional",(e,t)=>{P.init(e,t),e._zod.optin="optional",e._zod.optout="optional",C(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),C(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${Qt(n.source)})?$`):void 0}),e._zod.parse=(n,o)=>{if(t.innerType._zod.optin==="optional"){let r=t.innerType._zod.run(n,o);if(r instanceof Promise)return r.then((i)=>vm(i,n.value));return vm(r,n.value)}if(n.value===void 0)return n;return t.innerType._zod.run(n,o)}}),ta=m("$ZodNullable",(e,t)=>{P.init(e,t),C(e._zod,"optin",()=>t.innerType._zod.optin),C(e._zod,"optout",()=>t.innerType._zod.optout),C(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${Qt(n.source)}|null)$`):void 0}),C(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,o)=>{if(n.value===null)return n;return t.innerType._zod.run(n,o)}}),ra=m("$ZodDefault",(e,t)=>{P.init(e,t),e._zod.optin="optional",C(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);if(n.value===void 0)return n.value=t.defaultValue,n;let r=t.innerType._zod.run(n,o);if(r instanceof Promise)return r.then((i)=>ym(i,t));return ym(r,t)}});function ym(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var na=m("$ZodPrefault",(e,t)=>{P.init(e,t),e._zod.optin="optional",C(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);if(n.value===void 0)n.value=t.defaultValue;return t.innerType._zod.run(n,o)}}),oa=m("$ZodNonOptional",(e,t)=>{P.init(e,t),C(e._zod,"values",()=>{let n=t.innerType._zod.values;return n?new Set([...n].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(n,o)=>{let r=t.innerType._zod.run(n,o);if(r instanceof Promise)return r.then((i)=>bm(i,e));return bm(r,e)}});function bm(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}var ia=m("$ZodSuccess",(e,t)=>{P.init(e,t),e._zod.parse=(n,o)=>{if(o.direction==="backward")throw new ht("ZodSuccess");let r=t.innerType._zod.run(n,o);if(r instanceof Promise)return r.then((i)=>(n.value=i.issues.length===0,n));return n.value=r.issues.length===0,n}}),sa=m("$ZodCatch",(e,t)=>{P.init(e,t),C(e._zod,"optin",()=>t.innerType._zod.optin),C(e._zod,"optout",()=>t.innerType._zod.optout),C(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);let r=t.innerType._zod.run(n,o);if(r instanceof Promise)return r.then((i)=>{if(n.value=i.value,i.issues.length)n.value=t.catchValue({...n,error:{issues:i.issues.map((s)=>Se(s,o,ie()))},input:n.value}),n.issues=[];return n});if(n.value=r.value,r.issues.length)n.value=t.catchValue({...n,error:{issues:r.issues.map((i)=>Se(i,o,ie()))},input:n.value}),n.issues=[];return n}}),aa=m("$ZodNaN",(e,t)=>{P.init(e,t),e._zod.parse=(n,o)=>{if(typeof n.value!=="number"||!Number.isNaN(n.value))return n.issues.push({input:n.value,inst:e,expected:"nan",code:"invalid_type"}),n;return n}}),la=m("$ZodPipe",(e,t)=>{P.init(e,t),C(e._zod,"values",()=>t.in._zod.values),C(e._zod,"optin",()=>t.in._zod.optin),C(e._zod,"optout",()=>t.out._zod.optout),C(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,o)=>{if(o.direction==="backward"){let i=t.out._zod.run(n,o);if(i instanceof Promise)return i.then((s)=>$n(s,t.in,o));return $n(i,t.in,o)}let r=t.in._zod.run(n,o);if(r instanceof Promise)return r.then((i)=>$n(i,t.out,o));return $n(r,t.out,o)}});function $n(e,t,n){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},n)}var ur=m("$ZodCodec",(e,t)=>{P.init(e,t),C(e._zod,"values",()=>t.in._zod.values),C(e._zod,"optin",()=>t.in._zod.optin),C(e._zod,"optout",()=>t.out._zod.optout),C(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,o)=>{if((o.direction||"forward")==="forward"){let i=t.in._zod.run(n,o);if(i instanceof Promise)return i.then((s)=>Sn(s,t,o));return Sn(i,t,o)}else{let i=t.out._zod.run(n,o);if(i instanceof Promise)return i.then((s)=>Sn(s,t,o));return Sn(i,t,o)}}});function Sn(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||"forward")==="forward"){let r=t.transform(e.value,e);if(r instanceof Promise)return r.then((i)=>In(e,i,t.out,n));return In(e,r,t.out,n)}else{let r=t.reverseTransform(e.value,e);if(r instanceof Promise)return r.then((i)=>In(e,i,t.in,n));return In(e,r,t.in,n)}}function In(e,t,n,o){if(e.issues.length)return e.aborted=!0,e;return n._zod.run({value:t,issues:e.issues},o)}var ca=m("$ZodReadonly",(e,t)=>{P.init(e,t),C(e._zod,"propValues",()=>t.innerType._zod.propValues),C(e._zod,"values",()=>t.innerType._zod.values),C(e._zod,"optin",()=>t.innerType._zod.optin),C(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);let r=t.innerType._zod.run(n,o);if(r instanceof Promise)return r.then(_m);return _m(r)}});function _m(e){return e.value=Object.freeze(e.value),e}var ua=m("$ZodTemplateLiteral",(e,t)=>{P.init(e,t);let n=[];for(let o of t.parts)if(typeof o==="object"&&o!==null){if(!o._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...o._zod.traits].shift()}`);let r=o._zod.pattern instanceof RegExp?o._zod.pattern.source:o._zod.pattern;if(!r)throw Error(`Invalid template literal part: ${o._zod.traits}`);let i=r.startsWith("^")?1:0,s=r.endsWith("$")?r.length-1:r.length;n.push(r.slice(i,s))}else if(o===null||si.has(typeof o))n.push(Le(`${o}`));else throw Error(`Invalid template literal part: ${o}`);e._zod.pattern=new RegExp(`^${n.join("")}$`),e._zod.parse=(o,r)=>{if(typeof o.value!=="string")return o.issues.push({input:o.value,inst:e,expected:"template_literal",code:"invalid_type"}),o;if(e._zod.pattern.lastIndex=0,!e._zod.pattern.test(o.value))return o.issues.push({input:o.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),o;return o}}),da=m("$ZodFunction",(e,t)=>(P.init(e,t),e._def=t,e._zod.def=t,e.implement=(n)=>{if(typeof n!=="function")throw Error("implement() must be called with a function");return function(...o){let r=e._def.input?ln(e._def.input,o):o,i=Reflect.apply(n,this,r);if(e._def.output)return ln(e._def.output,i);return i}},e.implementAsync=(n)=>{if(typeof n!=="function")throw Error("implementAsync() must be called with a function");return async function(...o){let r=e._def.input?await cn(e._def.input,o):o,i=await Reflect.apply(n,this,r);if(e._def.output)return await cn(e._def.output,i);return i}},e._zod.parse=(n,o)=>{if(typeof n.value!=="function")return n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:e}),n;if(e._def.output&&e._def.output._zod.def.type==="promise")n.value=e.implementAsync(n.value);else n.value=e.implement(n.value);return n},e.input=(...n)=>{let o=e.constructor;if(Array.isArray(n[0]))return new o({type:"function",input:new En({type:"tuple",items:n[0],rest:n[1]}),output:e._def.output});return new o({type:"function",input:n[0],output:e._def.output})},e.output=(n)=>new e.constructor({type:"function",input:e._def.input,output:n}),e)),ma=m("$ZodPromise",(e,t)=>{P.init(e,t),e._zod.parse=(n,o)=>Promise.resolve(n.value).then((r)=>t.innerType._zod.run({value:r,issues:[]},o))}),pa=m("$ZodLazy",(e,t)=>{P.init(e,t),C(e._zod,"innerType",()=>t.getter()),C(e._zod,"pattern",()=>e._zod.innerType._zod.pattern),C(e._zod,"propValues",()=>e._zod.innerType._zod.propValues),C(e._zod,"optin",()=>e._zod.innerType._zod.optin??void 0),C(e._zod,"optout",()=>e._zod.innerType._zod.optout??void 0),e._zod.parse=(n,o)=>e._zod.innerType._zod.run(n,o)}),fa=m("$ZodCustom",(e,t)=>{Y.init(e,t),P.init(e,t),e._zod.parse=(n,o)=>n,e._zod.check=(n)=>{let o=n.value,r=t.fn(o);if(r instanceof Promise)return r.then((i)=>km(i,n,o,e));km(r,n,o,e);return}});function km(e,t,n,o){if(!e){let r={code:"custom",input:n,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};if(o._zod.def.params)r.params=o._zod.def.params;t.issues.push(it(r))}}var hr={};dt(hr,{ar:()=>ga,az:()=>ha,be:()=>va,ca:()=>ya,cs:()=>ba,da:()=>_a,de:()=>ka,en:()=>dr,eo:()=>wa,es:()=>xa,fa:()=>$a,fi:()=>Sa,fr:()=>Ia,frCA:()=>Ta,he:()=>Da,hu:()=>Pa,id:()=>Oa,is:()=>Ea,it:()=>Ra,ja:()=>za,ka:()=>Ca,kh:()=>Ma,km:()=>mr,ko:()=>Aa,lt:()=>Na,mk:()=>ja,ms:()=>Ua,nl:()=>La,no:()=>Fa,ota:()=>Za,pl:()=>Wa,ps:()=>Ga,pt:()=>Ha,ru:()=>Va,sl:()=>Ba,sv:()=>qa,ta:()=>Ja,th:()=>Ka,tr:()=>Xa,ua:()=>Ya,uk:()=>gr,ur:()=>Qa,vi:()=>el,yo:()=>nl,zhCN:()=>tl,zhTW:()=>rl});var ny=()=>{let e={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"};return(r)=>{switch(r.code){case"invalid_type":return`مدخلات غير مقبولة: يفترض إدخال ${r.expected}، ولكن تم إدخال ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`مدخلات غير مقبولة: يفترض إدخال ${_(r.values[0])}`;return`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${h(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return` أكبر من اللازم: يفترض أن تكون ${r.origin??"القيمة"} ${i} ${r.maximum.toString()} ${s.unit??"عنصر"}`;return`أكبر من اللازم: يفترض أن تكون ${r.origin??"القيمة"} ${i} ${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`أصغر من اللازم: يفترض لـ ${r.origin} أن يكون ${i} ${r.minimum.toString()} ${s.unit}`;return`أصغر من اللازم: يفترض لـ ${r.origin} أن يكون ${i} ${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`نَص غير مقبول: يجب أن يبدأ بـ "${r.prefix}"`;if(i.format==="ends_with")return`نَص غير مقبول: يجب أن ينتهي بـ "${i.suffix}"`;if(i.format==="includes")return`نَص غير مقبول: يجب أن يتضمَّن "${i.includes}"`;if(i.format==="regex")return`نَص غير مقبول: يجب أن يطابق النمط ${i.pattern}`;return`${o[i.format]??r.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${r.divisor}`;case"unrecognized_keys":return`معرف${r.keys.length>1?"ات":""} غريب${r.keys.length>1?"ة":""}: ${h(r.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${r.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${r.origin}`;default:return"مدخل غير مقبول"}}};function ga(){return{localeError:ny()}}var oy=()=>{let e={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return(r)=>{switch(r.code){case"invalid_type":return`Yanlış dəyər: gözlənilən ${r.expected}, daxil olan ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Yanlış dəyər: gözlənilən ${_(r.values[0])}`;return`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${h(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Çox böyük: gözlənilən ${r.origin??"dəyər"} ${i}${r.maximum.toString()} ${s.unit??"element"}`;return`Çox böyük: gözlənilən ${r.origin??"dəyər"} ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Çox kiçik: gözlənilən ${r.origin} ${i}${r.minimum.toString()} ${s.unit}`;return`Çox kiçik: gözlənilən ${r.origin} ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Yanlış mətn: "${i.prefix}" ilə başlamalıdır`;if(i.format==="ends_with")return`Yanlış mətn: "${i.suffix}" ilə bitməlidir`;if(i.format==="includes")return`Yanlış mətn: "${i.includes}" daxil olmalıdır`;if(i.format==="regex")return`Yanlış mətn: ${i.pattern} şablonuna uyğun olmalıdır`;return`Yanlış ${o[i.format]??r.format}`}case"not_multiple_of":return`Yanlış ədəd: ${r.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${r.keys.length>1?"lar":""}: ${h(r.keys,", ")}`;case"invalid_key":return`${r.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${r.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function ha(){return{localeError:oy()}}function Tm(e,t,n,o){let r=Math.abs(e),i=r%10,s=r%100;if(s>=11&&s<=19)return o;if(i===1)return t;if(i>=2&&i<=4)return n;return o}var iy=()=>{let e={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"лік";case"object":{if(Array.isArray(r))return"масіў";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"};return(r)=>{switch(r.code){case"invalid_type":return`Няправільны ўвод: чакаўся ${r.expected}, атрымана ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Няправільны ўвод: чакалася ${_(r.values[0])}`;return`Няправільны варыянт: чакаўся адзін з ${h(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s){let a=Number(r.maximum),l=Tm(a,s.unit.one,s.unit.few,s.unit.many);return`Занадта вялікі: чакалася, што ${r.origin??"значэнне"} павінна ${s.verb} ${i}${r.maximum.toString()} ${l}`}return`Занадта вялікі: чакалася, што ${r.origin??"значэнне"} павінна быць ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s){let a=Number(r.minimum),l=Tm(a,s.unit.one,s.unit.few,s.unit.many);return`Занадта малы: чакалася, што ${r.origin} павінна ${s.verb} ${i}${r.minimum.toString()} ${l}`}return`Занадта малы: чакалася, што ${r.origin} павінна быць ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Няправільны радок: павінен пачынацца з "${i.prefix}"`;if(i.format==="ends_with")return`Няправільны радок: павінен заканчвацца на "${i.suffix}"`;if(i.format==="includes")return`Няправільны радок: павінен змяшчаць "${i.includes}"`;if(i.format==="regex")return`Няправільны радок: павінен адпавядаць шаблону ${i.pattern}`;return`Няправільны ${o[i.format]??r.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${r.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${r.keys.length>1?"ключы":"ключ"}: ${h(r.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${r.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${r.origin}`;default:return"Няправільны ўвод"}}};function va(){return{localeError:iy()}}var sy=()=>{let e={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(r)=>{switch(r.code){case"invalid_type":return`Tipus invàlid: s'esperava ${r.expected}, s'ha rebut ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Valor invàlid: s'esperava ${_(r.values[0])}`;return`Opció invàlida: s'esperava una de ${h(r.values," o ")}`;case"too_big":{let i=r.inclusive?"com a màxim":"menys de",s=t(r.origin);if(s)return`Massa gran: s'esperava que ${r.origin??"el valor"} contingués ${i} ${r.maximum.toString()} ${s.unit??"elements"}`;return`Massa gran: s'esperava que ${r.origin??"el valor"} fos ${i} ${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?"com a mínim":"més de",s=t(r.origin);if(s)return`Massa petit: s'esperava que ${r.origin} contingués ${i} ${r.minimum.toString()} ${s.unit}`;return`Massa petit: s'esperava que ${r.origin} fos ${i} ${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Format invàlid: ha de començar amb "${i.prefix}"`;if(i.format==="ends_with")return`Format invàlid: ha d'acabar amb "${i.suffix}"`;if(i.format==="includes")return`Format invàlid: ha d'incloure "${i.includes}"`;if(i.format==="regex")return`Format invàlid: ha de coincidir amb el patró ${i.pattern}`;return`Format invàlid per a ${o[i.format]??r.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${r.divisor}`;case"unrecognized_keys":return`Clau${r.keys.length>1?"s":""} no reconeguda${r.keys.length>1?"s":""}: ${h(r.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${r.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${r.origin}`;default:return"Entrada invàlida"}}};function ya(){return{localeError:sy()}}var ay=()=>{let e={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"číslo";case"string":return"řetězec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(r))return"pole";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"regulární výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"};return(r)=>{switch(r.code){case"invalid_type":return`Neplatný vstup: očekáváno ${r.expected}, obdrženo ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Neplatný vstup: očekáváno ${_(r.values[0])}`;return`Neplatná možnost: očekávána jedna z hodnot ${h(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Hodnota je příliš velká: ${r.origin??"hodnota"} musí mít ${i}${r.maximum.toString()} ${s.unit??"prvků"}`;return`Hodnota je příliš velká: ${r.origin??"hodnota"} musí být ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Hodnota je příliš malá: ${r.origin??"hodnota"} musí mít ${i}${r.minimum.toString()} ${s.unit??"prvků"}`;return`Hodnota je příliš malá: ${r.origin??"hodnota"} musí být ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Neplatný řetězec: musí začínat na "${i.prefix}"`;if(i.format==="ends_with")return`Neplatný řetězec: musí končit na "${i.suffix}"`;if(i.format==="includes")return`Neplatný řetězec: musí obsahovat "${i.includes}"`;if(i.format==="regex")return`Neplatný řetězec: musí odpovídat vzoru ${i.pattern}`;return`Neplatný formát ${o[i.format]??r.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${r.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${h(r.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${r.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${r.origin}`;default:return"Neplatný vstup"}}};function ba(){return{localeError:ay()}}var ly=()=>{let e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}},t={string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"};function n(s){return e[s]??null}function o(s){return t[s]??s}let r=(s)=>{let a=typeof s;switch(a){case"number":return Number.isNaN(s)?"NaN":"tal";case"object":{if(Array.isArray(s))return"liste";if(s===null)return"null";if(Object.getPrototypeOf(s)!==Object.prototype&&s.constructor)return s.constructor.name;return"objekt"}}return a},i={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslæt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return(s)=>{switch(s.code){case"invalid_type":return`Ugyldigt input: forventede ${o(s.expected)}, fik ${o(r(s.input))}`;case"invalid_value":if(s.values.length===1)return`Ugyldig værdi: forventede ${_(s.values[0])}`;return`Ugyldigt valg: forventede en af følgende ${h(s.values,"|")}`;case"too_big":{let a=s.inclusive?"<=":"<",l=n(s.origin),c=o(s.origin);if(l)return`For stor: forventede ${c??"value"} ${l.verb} ${a} ${s.maximum.toString()} ${l.unit??"elementer"}`;return`For stor: forventede ${c??"value"} havde ${a} ${s.maximum.toString()}`}case"too_small":{let a=s.inclusive?">=":">",l=n(s.origin),c=o(s.origin);if(l)return`For lille: forventede ${c} ${l.verb} ${a} ${s.minimum.toString()} ${l.unit}`;return`For lille: forventede ${c} havde ${a} ${s.minimum.toString()}`}case"invalid_format":{let a=s;if(a.format==="starts_with")return`Ugyldig streng: skal starte med "${a.prefix}"`;if(a.format==="ends_with")return`Ugyldig streng: skal ende med "${a.suffix}"`;if(a.format==="includes")return`Ugyldig streng: skal indeholde "${a.includes}"`;if(a.format==="regex")return`Ugyldig streng: skal matche mønsteret ${a.pattern}`;return`Ugyldig ${i[a.format]??s.format}`}case"not_multiple_of":return`Ugyldigt tal: skal være deleligt med ${s.divisor}`;case"unrecognized_keys":return`${s.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${h(s.keys,", ")}`;case"invalid_key":return`Ugyldig nøgle i ${s.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig værdi i ${s.origin}`;default:return"Ugyldigt input"}}};function _a(){return{localeError:ly()}}var cy=()=>{let e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"Zahl";case"object":{if(Array.isArray(r))return"Array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return(r)=>{switch(r.code){case"invalid_type":return`Ungültige Eingabe: erwartet ${r.expected}, erhalten ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Ungültige Eingabe: erwartet ${_(r.values[0])}`;return`Ungültige Option: erwartet eine von ${h(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Zu groß: erwartet, dass ${r.origin??"Wert"} ${i}${r.maximum.toString()} ${s.unit??"Elemente"} hat`;return`Zu groß: erwartet, dass ${r.origin??"Wert"} ${i}${r.maximum.toString()} ist`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Zu klein: erwartet, dass ${r.origin} ${i}${r.minimum.toString()} ${s.unit} hat`;return`Zu klein: erwartet, dass ${r.origin} ${i}${r.minimum.toString()} ist`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Ungültiger String: muss mit "${i.prefix}" beginnen`;if(i.format==="ends_with")return`Ungültiger String: muss mit "${i.suffix}" enden`;if(i.format==="includes")return`Ungültiger String: muss "${i.includes}" enthalten`;if(i.format==="regex")return`Ungültiger String: muss dem Muster ${i.pattern} entsprechen`;return`Ungültig: ${o[i.format]??r.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${r.divisor} sein`;case"unrecognized_keys":return`${r.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${h(r.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${r.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${r.origin}`;default:return"Ungültige Eingabe"}}};function ka(){return{localeError:cy()}}var uy=(e)=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},dy=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function t(o){return e[o]??null}let n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return(o)=>{switch(o.code){case"invalid_type":return`Invalid input: expected ${o.expected}, received ${uy(o.input)}`;case"invalid_value":if(o.values.length===1)return`Invalid input: expected ${_(o.values[0])}`;return`Invalid option: expected one of ${h(o.values,"|")}`;case"too_big":{let r=o.inclusive?"<=":"<",i=t(o.origin);if(i)return`Too big: expected ${o.origin??"value"} to have ${r}${o.maximum.toString()} ${i.unit??"elements"}`;return`Too big: expected ${o.origin??"value"} to be ${r}${o.maximum.toString()}`}case"too_small":{let r=o.inclusive?">=":">",i=t(o.origin);if(i)return`Too small: expected ${o.origin} to have ${r}${o.minimum.toString()} ${i.unit}`;return`Too small: expected ${o.origin} to be ${r}${o.minimum.toString()}`}case"invalid_format":{let r=o;if(r.format==="starts_with")return`Invalid string: must start with "${r.prefix}"`;if(r.format==="ends_with")return`Invalid string: must end with "${r.suffix}"`;if(r.format==="includes")return`Invalid string: must include "${r.includes}"`;if(r.format==="regex")return`Invalid string: must match pattern ${r.pattern}`;return`Invalid ${n[r.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${h(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function dr(){return{localeError:dy()}}var my=(e)=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"nombro";case"object":{if(Array.isArray(e))return"tabelo";if(e===null)return"senvalora";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},py=()=>{let e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function t(o){return e[o]??null}let n={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"};return(o)=>{switch(o.code){case"invalid_type":return`Nevalida enigo: atendiĝis ${o.expected}, riceviĝis ${my(o.input)}`;case"invalid_value":if(o.values.length===1)return`Nevalida enigo: atendiĝis ${_(o.values[0])}`;return`Nevalida opcio: atendiĝis unu el ${h(o.values,"|")}`;case"too_big":{let r=o.inclusive?"<=":"<",i=t(o.origin);if(i)return`Tro granda: atendiĝis ke ${o.origin??"valoro"} havu ${r}${o.maximum.toString()} ${i.unit??"elementojn"}`;return`Tro granda: atendiĝis ke ${o.origin??"valoro"} havu ${r}${o.maximum.toString()}`}case"too_small":{let r=o.inclusive?">=":">",i=t(o.origin);if(i)return`Tro malgranda: atendiĝis ke ${o.origin} havu ${r}${o.minimum.toString()} ${i.unit}`;return`Tro malgranda: atendiĝis ke ${o.origin} estu ${r}${o.minimum.toString()}`}case"invalid_format":{let r=o;if(r.format==="starts_with")return`Nevalida karaktraro: devas komenciĝi per "${r.prefix}"`;if(r.format==="ends_with")return`Nevalida karaktraro: devas finiĝi per "${r.suffix}"`;if(r.format==="includes")return`Nevalida karaktraro: devas inkluzivi "${r.includes}"`;if(r.format==="regex")return`Nevalida karaktraro: devas kongrui kun la modelo ${r.pattern}`;return`Nevalida ${n[r.format]??o.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${o.divisor}`;case"unrecognized_keys":return`Nekonata${o.keys.length>1?"j":""} ŝlosilo${o.keys.length>1?"j":""}: ${h(o.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${o.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${o.origin}`;default:return"Nevalida enigo"}}};function wa(){return{localeError:py()}}var fy=()=>{let e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}},t={string:"texto",number:"número",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"número grande",symbol:"símbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacío",never:"nunca",unknown:"desconocido",any:"cualquiera"};function n(s){return e[s]??null}function o(s){return t[s]??s}let r=(s)=>{let a=typeof s;switch(a){case"number":return Number.isNaN(s)?"NaN":"number";case"object":{if(Array.isArray(s))return"array";if(s===null)return"null";if(Object.getPrototypeOf(s)!==Object.prototype)return s.constructor.name;return"object"}}return a},i={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(s)=>{switch(s.code){case"invalid_type":return`Entrada inválida: se esperaba ${o(s.expected)}, recibido ${o(r(s.input))}`;case"invalid_value":if(s.values.length===1)return`Entrada inválida: se esperaba ${_(s.values[0])}`;return`Opción inválida: se esperaba una de ${h(s.values,"|")}`;case"too_big":{let a=s.inclusive?"<=":"<",l=n(s.origin),c=o(s.origin);if(l)return`Demasiado grande: se esperaba que ${c??"valor"} tuviera ${a}${s.maximum.toString()} ${l.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${c??"valor"} fuera ${a}${s.maximum.toString()}`}case"too_small":{let a=s.inclusive?">=":">",l=n(s.origin),c=o(s.origin);if(l)return`Demasiado pequeño: se esperaba que ${c} tuviera ${a}${s.minimum.toString()} ${l.unit}`;return`Demasiado pequeño: se esperaba que ${c} fuera ${a}${s.minimum.toString()}`}case"invalid_format":{let a=s;if(a.format==="starts_with")return`Cadena inválida: debe comenzar con "${a.prefix}"`;if(a.format==="ends_with")return`Cadena inválida: debe terminar en "${a.suffix}"`;if(a.format==="includes")return`Cadena inválida: debe incluir "${a.includes}"`;if(a.format==="regex")return`Cadena inválida: debe coincidir con el patrón ${a.pattern}`;return`Inválido ${i[a.format]??s.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${s.divisor}`;case"unrecognized_keys":return`Llave${s.keys.length>1?"s":""} desconocida${s.keys.length>1?"s":""}: ${h(s.keys,", ")}`;case"invalid_key":return`Llave inválida en ${o(s.origin)}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${o(s.origin)}`;default:return"Entrada inválida"}}};function xa(){return{localeError:fy()}}var gy=()=>{let e={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"عدد";case"object":{if(Array.isArray(r))return"آرایه";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"};return(r)=>{switch(r.code){case"invalid_type":return`ورودی نامعتبر: می‌بایست ${r.expected} می‌بود، ${n(r.input)} دریافت شد`;case"invalid_value":if(r.values.length===1)return`ورودی نامعتبر: می‌بایست ${_(r.values[0])} می‌بود`;return`گزینه نامعتبر: می‌بایست یکی از ${h(r.values,"|")} می‌بود`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`خیلی بزرگ: ${r.origin??"مقدار"} باید ${i}${r.maximum.toString()} ${s.unit??"عنصر"} باشد`;return`خیلی بزرگ: ${r.origin??"مقدار"} باید ${i}${r.maximum.toString()} باشد`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`خیلی کوچک: ${r.origin} باید ${i}${r.minimum.toString()} ${s.unit} باشد`;return`خیلی کوچک: ${r.origin} باید ${i}${r.minimum.toString()} باشد`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`رشته نامعتبر: باید با "${i.prefix}" شروع شود`;if(i.format==="ends_with")return`رشته نامعتبر: باید با "${i.suffix}" تمام شود`;if(i.format==="includes")return`رشته نامعتبر: باید شامل "${i.includes}" باشد`;if(i.format==="regex")return`رشته نامعتبر: باید با الگوی ${i.pattern} مطابقت داشته باشد`;return`${o[i.format]??r.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${r.divisor} باشد`;case"unrecognized_keys":return`کلید${r.keys.length>1?"های":""} ناشناس: ${h(r.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${r.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${r.origin}`;default:return"ورودی نامعتبر"}}};function $a(){return{localeError:gy()}}var hy=()=>{let e={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return(r)=>{switch(r.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${r.expected}, oli ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Virheellinen syöte: täytyy olla ${_(r.values[0])}`;return`Virheellinen valinta: täytyy olla yksi seuraavista: ${h(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Liian suuri: ${s.subject} täytyy olla ${i}${r.maximum.toString()} ${s.unit}`.trim();return`Liian suuri: arvon täytyy olla ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Liian pieni: ${s.subject} täytyy olla ${i}${r.minimum.toString()} ${s.unit}`.trim();return`Liian pieni: arvon täytyy olla ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Virheellinen syöte: täytyy alkaa "${i.prefix}"`;if(i.format==="ends_with")return`Virheellinen syöte: täytyy loppua "${i.suffix}"`;if(i.format==="includes")return`Virheellinen syöte: täytyy sisältää "${i.includes}"`;if(i.format==="regex")return`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${i.pattern}`;return`Virheellinen ${o[i.format]??r.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${r.divisor} monikerta`;case"unrecognized_keys":return`${r.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${h(r.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function Sa(){return{localeError:hy()}}var vy=()=>{let e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"nombre";case"object":{if(Array.isArray(r))return"tableau";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"entrée",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return(r)=>{switch(r.code){case"invalid_type":return`Entrée invalide : ${r.expected} attendu, ${n(r.input)} reçu`;case"invalid_value":if(r.values.length===1)return`Entrée invalide : ${_(r.values[0])} attendu`;return`Option invalide : une valeur parmi ${h(r.values,"|")} attendue`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Trop grand : ${r.origin??"valeur"} doit ${s.verb} ${i}${r.maximum.toString()} ${s.unit??"élément(s)"}`;return`Trop grand : ${r.origin??"valeur"} doit être ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Trop petit : ${r.origin} doit ${s.verb} ${i}${r.minimum.toString()} ${s.unit}`;return`Trop petit : ${r.origin} doit être ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Chaîne invalide : doit commencer par "${i.prefix}"`;if(i.format==="ends_with")return`Chaîne invalide : doit se terminer par "${i.suffix}"`;if(i.format==="includes")return`Chaîne invalide : doit inclure "${i.includes}"`;if(i.format==="regex")return`Chaîne invalide : doit correspondre au modèle ${i.pattern}`;return`${o[i.format]??r.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${r.divisor}`;case"unrecognized_keys":return`Clé${r.keys.length>1?"s":""} non reconnue${r.keys.length>1?"s":""} : ${h(r.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${r.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${r.origin}`;default:return"Entrée invalide"}}};function Ia(){return{localeError:vy()}}var yy=()=>{let e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return(r)=>{switch(r.code){case"invalid_type":return`Entrée invalide : attendu ${r.expected}, reçu ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Entrée invalide : attendu ${_(r.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${h(r.values,"|")}`;case"too_big":{let i=r.inclusive?"≤":"<",s=t(r.origin);if(s)return`Trop grand : attendu que ${r.origin??"la valeur"} ait ${i}${r.maximum.toString()} ${s.unit}`;return`Trop grand : attendu que ${r.origin??"la valeur"} soit ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?"≥":">",s=t(r.origin);if(s)return`Trop petit : attendu que ${r.origin} ait ${i}${r.minimum.toString()} ${s.unit}`;return`Trop petit : attendu que ${r.origin} soit ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Chaîne invalide : doit commencer par "${i.prefix}"`;if(i.format==="ends_with")return`Chaîne invalide : doit se terminer par "${i.suffix}"`;if(i.format==="includes")return`Chaîne invalide : doit inclure "${i.includes}"`;if(i.format==="regex")return`Chaîne invalide : doit correspondre au motif ${i.pattern}`;return`${o[i.format]??r.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${r.divisor}`;case"unrecognized_keys":return`Clé${r.keys.length>1?"s":""} non reconnue${r.keys.length>1?"s":""} : ${h(r.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${r.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${r.origin}`;default:return"Entrée invalide"}}};function Ta(){return{localeError:yy()}}var by=()=>{let e={string:{unit:"אותיות",verb:"לכלול"},file:{unit:"בייטים",verb:"לכלול"},array:{unit:"פריטים",verb:"לכלול"},set:{unit:"פריטים",verb:"לכלול"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"קלט",email:"כתובת אימייל",url:"כתובת רשת",emoji:"אימוג'י",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"תאריך וזמן ISO",date:"תאריך ISO",time:"זמן ISO",duration:"משך זמן ISO",ipv4:"כתובת IPv4",ipv6:"כתובת IPv6",cidrv4:"טווח IPv4",cidrv6:"טווח IPv6",base64:"מחרוזת בבסיס 64",base64url:"מחרוזת בבסיס 64 לכתובות רשת",json_string:"מחרוזת JSON",e164:"מספר E.164",jwt:"JWT",template_literal:"קלט"};return(r)=>{switch(r.code){case"invalid_type":return`קלט לא תקין: צריך ${r.expected}, התקבל ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`קלט לא תקין: צריך ${_(r.values[0])}`;return`קלט לא תקין: צריך אחת מהאפשרויות ${h(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`גדול מדי: ${r.origin??"value"} צריך להיות ${i}${r.maximum.toString()} ${s.unit??"elements"}`;return`גדול מדי: ${r.origin??"value"} צריך להיות ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`קטן מדי: ${r.origin} צריך להיות ${i}${r.minimum.toString()} ${s.unit}`;return`קטן מדי: ${r.origin} צריך להיות ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`מחרוזת לא תקינה: חייבת להתחיל ב"${i.prefix}"`;if(i.format==="ends_with")return`מחרוזת לא תקינה: חייבת להסתיים ב "${i.suffix}"`;if(i.format==="includes")return`מחרוזת לא תקינה: חייבת לכלול "${i.includes}"`;if(i.format==="regex")return`מחרוזת לא תקינה: חייבת להתאים לתבנית ${i.pattern}`;return`${o[i.format]??r.format} לא תקין`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${r.divisor}`;case"unrecognized_keys":return`מפתח${r.keys.length>1?"ות":""} לא מזוה${r.keys.length>1?"ים":"ה"}: ${h(r.keys,", ")}`;case"invalid_key":return`מפתח לא תקין ב${r.origin}`;case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${r.origin}`;default:return"קלט לא תקין"}}};function Da(){return{localeError:by()}}var _y=()=>{let e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"szám";case"object":{if(Array.isArray(r))return"tömb";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"bemenet",email:"email cím",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"};return(r)=>{switch(r.code){case"invalid_type":return`Érvénytelen bemenet: a várt érték ${r.expected}, a kapott érték ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Érvénytelen bemenet: a várt érték ${_(r.values[0])}`;return`Érvénytelen opció: valamelyik érték várt ${h(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Túl nagy: ${r.origin??"érték"} mérete túl nagy ${i}${r.maximum.toString()} ${s.unit??"elem"}`;return`Túl nagy: a bemeneti érték ${r.origin??"érték"} túl nagy: ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Túl kicsi: a bemeneti érték ${r.origin} mérete túl kicsi ${i}${r.minimum.toString()} ${s.unit}`;return`Túl kicsi: a bemeneti érték ${r.origin} túl kicsi ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Érvénytelen string: "${i.prefix}" értékkel kell kezdődnie`;if(i.format==="ends_with")return`Érvénytelen string: "${i.suffix}" értékkel kell végződnie`;if(i.format==="includes")return`Érvénytelen string: "${i.includes}" értéket kell tartalmaznia`;if(i.format==="regex")return`Érvénytelen string: ${i.pattern} mintának kell megfelelnie`;return`Érvénytelen ${o[i.format]??r.format}`}case"not_multiple_of":return`Érvénytelen szám: ${r.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${r.keys.length>1?"s":""}: ${h(r.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${r.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${r.origin}`;default:return"Érvénytelen bemenet"}}};function Pa(){return{localeError:_y()}}var ky=()=>{let e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return(r)=>{switch(r.code){case"invalid_type":return`Input tidak valid: diharapkan ${r.expected}, diterima ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Input tidak valid: diharapkan ${_(r.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${h(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Terlalu besar: diharapkan ${r.origin??"value"} memiliki ${i}${r.maximum.toString()} ${s.unit??"elemen"}`;return`Terlalu besar: diharapkan ${r.origin??"value"} menjadi ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Terlalu kecil: diharapkan ${r.origin} memiliki ${i}${r.minimum.toString()} ${s.unit}`;return`Terlalu kecil: diharapkan ${r.origin} menjadi ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`String tidak valid: harus dimulai dengan "${i.prefix}"`;if(i.format==="ends_with")return`String tidak valid: harus berakhir dengan "${i.suffix}"`;if(i.format==="includes")return`String tidak valid: harus menyertakan "${i.includes}"`;if(i.format==="regex")return`String tidak valid: harus sesuai pola ${i.pattern}`;return`${o[i.format]??r.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${r.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${r.keys.length>1?"s":""}: ${h(r.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${r.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${r.origin}`;default:return"Input tidak valid"}}};function Oa(){return{localeError:ky()}}var wy=(e)=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"númer";case"object":{if(Array.isArray(e))return"fylki";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},xy=()=>{let e={string:{unit:"stafi",verb:"að hafa"},file:{unit:"bæti",verb:"að hafa"},array:{unit:"hluti",verb:"að hafa"},set:{unit:"hluti",verb:"að hafa"}};function t(o){return e[o]??null}let n={regex:"gildi",email:"netfang",url:"vefslóð",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og tími",date:"ISO dagsetning",time:"ISO tími",duration:"ISO tímalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 tölugildi",jwt:"JWT",template_literal:"gildi"};return(o)=>{switch(o.code){case"invalid_type":return`Rangt gildi: Þú slóst inn ${wy(o.input)} þar sem á að vera ${o.expected}`;case"invalid_value":if(o.values.length===1)return`Rangt gildi: gert ráð fyrir ${_(o.values[0])}`;return`Ógilt val: má vera eitt af eftirfarandi ${h(o.values,"|")}`;case"too_big":{let r=o.inclusive?"<=":"<",i=t(o.origin);if(i)return`Of stórt: gert er ráð fyrir að ${o.origin??"gildi"} hafi ${r}${o.maximum.toString()} ${i.unit??"hluti"}`;return`Of stórt: gert er ráð fyrir að ${o.origin??"gildi"} sé ${r}${o.maximum.toString()}`}case"too_small":{let r=o.inclusive?">=":">",i=t(o.origin);if(i)return`Of lítið: gert er ráð fyrir að ${o.origin} hafi ${r}${o.minimum.toString()} ${i.unit}`;return`Of lítið: gert er ráð fyrir að ${o.origin} sé ${r}${o.minimum.toString()}`}case"invalid_format":{let r=o;if(r.format==="starts_with")return`Ógildur strengur: verður að byrja á "${r.prefix}"`;if(r.format==="ends_with")return`Ógildur strengur: verður að enda á "${r.suffix}"`;if(r.format==="includes")return`Ógildur strengur: verður að innihalda "${r.includes}"`;if(r.format==="regex")return`Ógildur strengur: verður að fylgja mynstri ${r.pattern}`;return`Rangt ${n[r.format]??o.format}`}case"not_multiple_of":return`Röng tala: verður að vera margfeldi af ${o.divisor}`;case"unrecognized_keys":return`Óþekkt ${o.keys.length>1?"ir lyklar":"ur lykill"}: ${h(o.keys,", ")}`;case"invalid_key":return`Rangur lykill í ${o.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi í ${o.origin}`;default:return"Rangt gildi"}}};function Ea(){return{localeError:xy()}}var $y=()=>{let e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"numero";case"object":{if(Array.isArray(r))return"vettore";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return(r)=>{switch(r.code){case"invalid_type":return`Input non valido: atteso ${r.expected}, ricevuto ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Input non valido: atteso ${_(r.values[0])}`;return`Opzione non valida: atteso uno tra ${h(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Troppo grande: ${r.origin??"valore"} deve avere ${i}${r.maximum.toString()} ${s.unit??"elementi"}`;return`Troppo grande: ${r.origin??"valore"} deve essere ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Troppo piccolo: ${r.origin} deve avere ${i}${r.minimum.toString()} ${s.unit}`;return`Troppo piccolo: ${r.origin} deve essere ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Stringa non valida: deve iniziare con "${i.prefix}"`;if(i.format==="ends_with")return`Stringa non valida: deve terminare con "${i.suffix}"`;if(i.format==="includes")return`Stringa non valida: deve includere "${i.includes}"`;if(i.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${i.pattern}`;return`Invalid ${o[i.format]??r.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${r.divisor}`;case"unrecognized_keys":return`Chiav${r.keys.length>1?"i":"e"} non riconosciut${r.keys.length>1?"e":"a"}: ${h(r.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${r.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${r.origin}`;default:return"Input non valido"}}};function Ra(){return{localeError:$y()}}var Sy=()=>{let e={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"数値";case"object":{if(Array.isArray(r))return"配列";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"};return(r)=>{switch(r.code){case"invalid_type":return`無効な入力: ${r.expected}が期待されましたが、${n(r.input)}が入力されました`;case"invalid_value":if(r.values.length===1)return`無効な入力: ${_(r.values[0])}が期待されました`;return`無効な選択: ${h(r.values,"、")}のいずれかである必要があります`;case"too_big":{let i=r.inclusive?"以下である":"より小さい",s=t(r.origin);if(s)return`大きすぎる値: ${r.origin??"値"}は${r.maximum.toString()}${s.unit??"要素"}${i}必要があります`;return`大きすぎる値: ${r.origin??"値"}は${r.maximum.toString()}${i}必要があります`}case"too_small":{let i=r.inclusive?"以上である":"より大きい",s=t(r.origin);if(s)return`小さすぎる値: ${r.origin}は${r.minimum.toString()}${s.unit}${i}必要があります`;return`小さすぎる値: ${r.origin}は${r.minimum.toString()}${i}必要があります`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`無効な文字列: "${i.prefix}"で始まる必要があります`;if(i.format==="ends_with")return`無効な文字列: "${i.suffix}"で終わる必要があります`;if(i.format==="includes")return`無効な文字列: "${i.includes}"を含む必要があります`;if(i.format==="regex")return`無効な文字列: パターン${i.pattern}に一致する必要があります`;return`無効な${o[i.format]??r.format}`}case"not_multiple_of":return`無効な数値: ${r.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${r.keys.length>1?"群":""}: ${h(r.keys,"、")}`;case"invalid_key":return`${r.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${r.origin}内の無効な値`;default:return"無効な入力"}}};function za(){return{localeError:Sy()}}var Iy=(e)=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"რიცხვი";case"object":{if(Array.isArray(e))return"მასივი";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return{string:"სტრინგი",boolean:"ბულეანი",undefined:"undefined",bigint:"bigint",symbol:"symbol",function:"ფუნქცია"}[t]??t},Ty=()=>{let e={string:{unit:"სიმბოლო",verb:"უნდა შეიცავდეს"},file:{unit:"ბაიტი",verb:"უნდა შეიცავდეს"},array:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},set:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"}};function t(o){return e[o]??null}let n={regex:"შეყვანა",email:"ელ-ფოსტის მისამართი",url:"URL",emoji:"ემოჯი",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"თარიღი-დრო",date:"თარიღი",time:"დრო",duration:"ხანგრძლივობა",ipv4:"IPv4 მისამართი",ipv6:"IPv6 მისამართი",cidrv4:"IPv4 დიაპაზონი",cidrv6:"IPv6 დიაპაზონი",base64:"base64-კოდირებული სტრინგი",base64url:"base64url-კოდირებული სტრინგი",json_string:"JSON სტრინგი",e164:"E.164 ნომერი",jwt:"JWT",template_literal:"შეყვანა"};return(o)=>{switch(o.code){case"invalid_type":return`არასწორი შეყვანა: მოსალოდნელი ${o.expected}, მიღებული ${Iy(o.input)}`;case"invalid_value":if(o.values.length===1)return`არასწორი შეყვანა: მოსალოდნელი ${_(o.values[0])}`;return`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${h(o.values,"|")}-დან`;case"too_big":{let r=o.inclusive?"<=":"<",i=t(o.origin);if(i)return`ზედმეტად დიდი: მოსალოდნელი ${o.origin??"მნიშვნელობა"} ${i.verb} ${r}${o.maximum.toString()} ${i.unit}`;return`ზედმეტად დიდი: მოსალოდნელი ${o.origin??"მნიშვნელობა"} იყოს ${r}${o.maximum.toString()}`}case"too_small":{let r=o.inclusive?">=":">",i=t(o.origin);if(i)return`ზედმეტად პატარა: მოსალოდნელი ${o.origin} ${i.verb} ${r}${o.minimum.toString()} ${i.unit}`;return`ზედმეტად პატარა: მოსალოდნელი ${o.origin} იყოს ${r}${o.minimum.toString()}`}case"invalid_format":{let r=o;if(r.format==="starts_with")return`არასწორი სტრინგი: უნდა იწყებოდეს "${r.prefix}"-ით`;if(r.format==="ends_with")return`არასწორი სტრინგი: უნდა მთავრდებოდეს "${r.suffix}"-ით`;if(r.format==="includes")return`არასწორი სტრინგი: უნდა შეიცავდეს "${r.includes}"-ს`;if(r.format==="regex")return`არასწორი სტრინგი: უნდა შეესაბამებოდეს შაბლონს ${r.pattern}`;return`არასწორი ${n[r.format]??o.format}`}case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${o.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${o.keys.length>1?"ები":"ი"}: ${h(o.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${o.origin}-ში`;case"invalid_union":return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${o.origin}-ში`;default:return"არასწორი შეყვანა"}}};function Ca(){return{localeError:Ty()}}var Dy=()=>{let e={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"មិនមែនជាលេខ (NaN)":"លេខ";case"object":{if(Array.isArray(r))return"អារេ (Array)";if(r===null)return"គ្មានតម្លៃ (null)";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"};return(r)=>{switch(r.code){case"invalid_type":return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${r.expected} ប៉ុន្តែទទួលបាន ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${_(r.values[0])}`;return`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${h(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`ធំពេក៖ ត្រូវការ ${r.origin??"តម្លៃ"} ${i} ${r.maximum.toString()} ${s.unit??"ធាតុ"}`;return`ធំពេក៖ ត្រូវការ ${r.origin??"តម្លៃ"} ${i} ${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`តូចពេក៖ ត្រូវការ ${r.origin} ${i} ${r.minimum.toString()} ${s.unit}`;return`តូចពេក៖ ត្រូវការ ${r.origin} ${i} ${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${i.prefix}"`;if(i.format==="ends_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${i.suffix}"`;if(i.format==="includes")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${i.includes}"`;if(i.format==="regex")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${i.pattern}`;return`មិនត្រឹមត្រូវ៖ ${o[i.format]??r.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${r.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${h(r.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${r.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${r.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function mr(){return{localeError:Dy()}}function Ma(){return mr()}var Py=()=>{let e={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"};return(r)=>{switch(r.code){case"invalid_type":return`잘못된 입력: 예상 타입은 ${r.expected}, 받은 타입은 ${n(r.input)}입니다`;case"invalid_value":if(r.values.length===1)return`잘못된 입력: 값은 ${_(r.values[0])} 이어야 합니다`;return`잘못된 옵션: ${h(r.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{let i=r.inclusive?"이하":"미만",s=i==="미만"?"이어야 합니다":"여야 합니다",a=t(r.origin),l=a?.unit??"요소";if(a)return`${r.origin??"값"}이 너무 큽니다: ${r.maximum.toString()}${l} ${i}${s}`;return`${r.origin??"값"}이 너무 큽니다: ${r.maximum.toString()} ${i}${s}`}case"too_small":{let i=r.inclusive?"이상":"초과",s=i==="이상"?"이어야 합니다":"여야 합니다",a=t(r.origin),l=a?.unit??"요소";if(a)return`${r.origin??"값"}이 너무 작습니다: ${r.minimum.toString()}${l} ${i}${s}`;return`${r.origin??"값"}이 너무 작습니다: ${r.minimum.toString()} ${i}${s}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`잘못된 문자열: "${i.prefix}"(으)로 시작해야 합니다`;if(i.format==="ends_with")return`잘못된 문자열: "${i.suffix}"(으)로 끝나야 합니다`;if(i.format==="includes")return`잘못된 문자열: "${i.includes}"을(를) 포함해야 합니다`;if(i.format==="regex")return`잘못된 문자열: 정규식 ${i.pattern} 패턴과 일치해야 합니다`;return`잘못된 ${o[i.format]??r.format}`}case"not_multiple_of":return`잘못된 숫자: ${r.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${h(r.keys,", ")}`;case"invalid_key":return`잘못된 키: ${r.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${r.origin}`;default:return"잘못된 입력"}}};function Aa(){return{localeError:Py()}}var Oy=(e)=>fr(typeof e,e),fr=(e,t=void 0)=>{switch(e){case"number":return Number.isNaN(t)?"NaN":"skaičius";case"bigint":return"sveikasis skaičius";case"string":return"eilutė";case"boolean":return"loginė reikšmė";case"undefined":case"void":return"neapibrėžta reikšmė";case"function":return"funkcija";case"symbol":return"simbolis";case"object":{if(t===void 0)return"nežinomas objektas";if(t===null)return"nulinė reikšmė";if(Array.isArray(t))return"masyvas";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name;return"objektas"}case"null":return"nulinė reikšmė"}return e},pr=(e)=>e.charAt(0).toUpperCase()+e.slice(1);function Dm(e){let t=Math.abs(e),n=t%10,o=t%100;if(o>=11&&o<=19||n===0)return"many";if(n===1)return"one";return"few"}var Ey=()=>{let e={string:{unit:{one:"simbolis",few:"simboliai",many:"simbolių"},verb:{smaller:{inclusive:"turi būti ne ilgesnė kaip",notInclusive:"turi būti trumpesnė kaip"},bigger:{inclusive:"turi būti ne trumpesnė kaip",notInclusive:"turi būti ilgesnė kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"baitų"},verb:{smaller:{inclusive:"turi būti ne didesnis kaip",notInclusive:"turi būti mažesnis kaip"},bigger:{inclusive:"turi būti ne mažesnis kaip",notInclusive:"turi būti didesnis kaip"}}},array:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}},set:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}}};function t(o,r,i,s){let a=e[o]??null;if(a===null)return a;return{unit:a.unit[r],verb:a.verb[s][i?"inclusive":"notInclusive"]}}let n={regex:"įvestis",email:"el. pašto adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukmė",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 užkoduota eilutė",base64url:"base64url užkoduota eilutė",json_string:"JSON eilutė",e164:"E.164 numeris",jwt:"JWT",template_literal:"įvestis"};return(o)=>{switch(o.code){case"invalid_type":return`Gautas tipas ${Oy(o.input)}, o tikėtasi - ${fr(o.expected)}`;case"invalid_value":if(o.values.length===1)return`Privalo būti ${_(o.values[0])}`;return`Privalo būti vienas iš ${h(o.values,"|")} pasirinkimų`;case"too_big":{let r=fr(o.origin),i=t(o.origin,Dm(Number(o.maximum)),o.inclusive??!1,"smaller");if(i?.verb)return`${pr(r??o.origin??"reikšmė")} ${i.verb} ${o.maximum.toString()} ${i.unit??"elementų"}`;let s=o.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${pr(r??o.origin??"reikšmė")} turi būti ${s} ${o.maximum.toString()} ${i?.unit}`}case"too_small":{let r=fr(o.origin),i=t(o.origin,Dm(Number(o.minimum)),o.inclusive??!1,"bigger");if(i?.verb)return`${pr(r??o.origin??"reikšmė")} ${i.verb} ${o.minimum.toString()} ${i.unit??"elementų"}`;let s=o.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${pr(r??o.origin??"reikšmė")} turi būti ${s} ${o.minimum.toString()} ${i?.unit}`}case"invalid_format":{let r=o;if(r.format==="starts_with")return`Eilutė privalo prasidėti "${r.prefix}"`;if(r.format==="ends_with")return`Eilutė privalo pasibaigti "${r.suffix}"`;if(r.format==="includes")return`Eilutė privalo įtraukti "${r.includes}"`;if(r.format==="regex")return`Eilutė privalo atitikti ${r.pattern}`;return`Neteisingas ${n[r.format]??o.format}`}case"not_multiple_of":return`Skaičius privalo būti ${o.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${o.keys.length>1?"i":"as"} rakt${o.keys.length>1?"ai":"as"}: ${h(o.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga įvestis";case"invalid_element":{let r=fr(o.origin);return`${pr(r??o.origin??"reikšmė")} turi klaidingą įvestį`}default:return"Klaidinga įvestis"}}};function Na(){return{localeError:Ey()}}var Ry=()=>{let e={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"број";case"object":{if(Array.isArray(r))return"низа";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"};return(r)=>{switch(r.code){case"invalid_type":return`Грешен внес: се очекува ${r.expected}, примено ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Invalid input: expected ${_(r.values[0])}`;return`Грешана опција: се очекува една ${h(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Премногу голем: се очекува ${r.origin??"вредноста"} да има ${i}${r.maximum.toString()} ${s.unit??"елементи"}`;return`Премногу голем: се очекува ${r.origin??"вредноста"} да биде ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Премногу мал: се очекува ${r.origin} да има ${i}${r.minimum.toString()} ${s.unit}`;return`Премногу мал: се очекува ${r.origin} да биде ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Неважечка низа: мора да започнува со "${i.prefix}"`;if(i.format==="ends_with")return`Неважечка низа: мора да завршува со "${i.suffix}"`;if(i.format==="includes")return`Неважечка низа: мора да вклучува "${i.includes}"`;if(i.format==="regex")return`Неважечка низа: мора да одгоара на патернот ${i.pattern}`;return`Invalid ${o[i.format]??r.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${h(r.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${r.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${r.origin}`;default:return"Грешен внес"}}};function ja(){return{localeError:Ry()}}var zy=()=>{let e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"nombor";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return(r)=>{switch(r.code){case"invalid_type":return`Input tidak sah: dijangka ${r.expected}, diterima ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Input tidak sah: dijangka ${_(r.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${h(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Terlalu besar: dijangka ${r.origin??"nilai"} ${s.verb} ${i}${r.maximum.toString()} ${s.unit??"elemen"}`;return`Terlalu besar: dijangka ${r.origin??"nilai"} adalah ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Terlalu kecil: dijangka ${r.origin} ${s.verb} ${i}${r.minimum.toString()} ${s.unit}`;return`Terlalu kecil: dijangka ${r.origin} adalah ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`String tidak sah: mesti bermula dengan "${i.prefix}"`;if(i.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${i.suffix}"`;if(i.format==="includes")return`String tidak sah: mesti mengandungi "${i.includes}"`;if(i.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${i.pattern}`;return`${o[i.format]??r.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${r.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${h(r.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${r.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${r.origin}`;default:return"Input tidak sah"}}};function Ua(){return{localeError:zy()}}var Cy=()=>{let e={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"getal";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return(r)=>{switch(r.code){case"invalid_type":return`Ongeldige invoer: verwacht ${r.expected}, ontving ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Ongeldige invoer: verwacht ${_(r.values[0])}`;return`Ongeldige optie: verwacht één van ${h(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Te lang: verwacht dat ${r.origin??"waarde"} ${i}${r.maximum.toString()} ${s.unit??"elementen"} bevat`;return`Te lang: verwacht dat ${r.origin??"waarde"} ${i}${r.maximum.toString()} is`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Te kort: verwacht dat ${r.origin} ${i}${r.minimum.toString()} ${s.unit} bevat`;return`Te kort: verwacht dat ${r.origin} ${i}${r.minimum.toString()} is`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Ongeldige tekst: moet met "${i.prefix}" beginnen`;if(i.format==="ends_with")return`Ongeldige tekst: moet op "${i.suffix}" eindigen`;if(i.format==="includes")return`Ongeldige tekst: moet "${i.includes}" bevatten`;if(i.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${i.pattern}`;return`Ongeldig: ${o[i.format]??r.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${r.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${r.keys.length>1?"s":""}: ${h(r.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${r.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${r.origin}`;default:return"Ongeldige invoer"}}};function La(){return{localeError:Cy()}}var My=()=>{let e={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"tall";case"object":{if(Array.isArray(r))return"liste";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return(r)=>{switch(r.code){case"invalid_type":return`Ugyldig input: forventet ${r.expected}, fikk ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Ugyldig verdi: forventet ${_(r.values[0])}`;return`Ugyldig valg: forventet en av ${h(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`For stor(t): forventet ${r.origin??"value"} til å ha ${i}${r.maximum.toString()} ${s.unit??"elementer"}`;return`For stor(t): forventet ${r.origin??"value"} til å ha ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`For lite(n): forventet ${r.origin} til å ha ${i}${r.minimum.toString()} ${s.unit}`;return`For lite(n): forventet ${r.origin} til å ha ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Ugyldig streng: må starte med "${i.prefix}"`;if(i.format==="ends_with")return`Ugyldig streng: må ende med "${i.suffix}"`;if(i.format==="includes")return`Ugyldig streng: må inneholde "${i.includes}"`;if(i.format==="regex")return`Ugyldig streng: må matche mønsteret ${i.pattern}`;return`Ugyldig ${o[i.format]??r.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${h(r.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${r.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${r.origin}`;default:return"Ugyldig input"}}};function Fa(){return{localeError:My()}}var Ay=()=>{let e={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"numara";case"object":{if(Array.isArray(r))return"saf";if(r===null)return"gayb";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"};return(r)=>{switch(r.code){case"invalid_type":return`Fâsit giren: umulan ${r.expected}, alınan ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Fâsit giren: umulan ${_(r.values[0])}`;return`Fâsit tercih: mûteberler ${h(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Fazla büyük: ${r.origin??"value"}, ${i}${r.maximum.toString()} ${s.unit??"elements"} sahip olmalıydı.`;return`Fazla büyük: ${r.origin??"value"}, ${i}${r.maximum.toString()} olmalıydı.`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Fazla küçük: ${r.origin}, ${i}${r.minimum.toString()} ${s.unit} sahip olmalıydı.`;return`Fazla küçük: ${r.origin}, ${i}${r.minimum.toString()} olmalıydı.`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Fâsit metin: "${i.prefix}" ile başlamalı.`;if(i.format==="ends_with")return`Fâsit metin: "${i.suffix}" ile bitmeli.`;if(i.format==="includes")return`Fâsit metin: "${i.includes}" ihtivâ etmeli.`;if(i.format==="regex")return`Fâsit metin: ${i.pattern} nakşına uymalı.`;return`Fâsit ${o[i.format]??r.format}`}case"not_multiple_of":return`Fâsit sayı: ${r.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${r.keys.length>1?"s":""}: ${h(r.keys,", ")}`;case"invalid_key":return`${r.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${r.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function Za(){return{localeError:Ay()}}var Ny=()=>{let e={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"عدد";case"object":{if(Array.isArray(r))return"ارې";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"};return(r)=>{switch(r.code){case"invalid_type":return`ناسم ورودي: باید ${r.expected} وای, مګر ${n(r.input)} ترلاسه شو`;case"invalid_value":if(r.values.length===1)return`ناسم ورودي: باید ${_(r.values[0])} وای`;return`ناسم انتخاب: باید یو له ${h(r.values,"|")} څخه وای`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`ډیر لوی: ${r.origin??"ارزښت"} باید ${i}${r.maximum.toString()} ${s.unit??"عنصرونه"} ولري`;return`ډیر لوی: ${r.origin??"ارزښت"} باید ${i}${r.maximum.toString()} وي`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`ډیر کوچنی: ${r.origin} باید ${i}${r.minimum.toString()} ${s.unit} ولري`;return`ډیر کوچنی: ${r.origin} باید ${i}${r.minimum.toString()} وي`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`ناسم متن: باید د "${i.prefix}" سره پیل شي`;if(i.format==="ends_with")return`ناسم متن: باید د "${i.suffix}" سره پای ته ورسيږي`;if(i.format==="includes")return`ناسم متن: باید "${i.includes}" ولري`;if(i.format==="regex")return`ناسم متن: باید د ${i.pattern} سره مطابقت ولري`;return`${o[i.format]??r.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${r.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${r.keys.length>1?"کلیډونه":"کلیډ"}: ${h(r.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${r.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${r.origin} کې`;default:return"ناسمه ورودي"}}};function Ga(){return{localeError:Ny()}}var jy=()=>{let e={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"liczba";case"object":{if(Array.isArray(r))return"tablica";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"};return(r)=>{switch(r.code){case"invalid_type":return`Nieprawidłowe dane wejściowe: oczekiwano ${r.expected}, otrzymano ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Nieprawidłowe dane wejściowe: oczekiwano ${_(r.values[0])}`;return`Nieprawidłowa opcja: oczekiwano jednej z wartości ${h(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Za duża wartość: oczekiwano, że ${r.origin??"wartość"} będzie mieć ${i}${r.maximum.toString()} ${s.unit??"elementów"}`;return`Zbyt duż(y/a/e): oczekiwano, że ${r.origin??"wartość"} będzie wynosić ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Za mała wartość: oczekiwano, że ${r.origin??"wartość"} będzie mieć ${i}${r.minimum.toString()} ${s.unit??"elementów"}`;return`Zbyt mał(y/a/e): oczekiwano, że ${r.origin??"wartość"} będzie wynosić ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Nieprawidłowy ciąg znaków: musi zaczynać się od "${i.prefix}"`;if(i.format==="ends_with")return`Nieprawidłowy ciąg znaków: musi kończyć się na "${i.suffix}"`;if(i.format==="includes")return`Nieprawidłowy ciąg znaków: musi zawierać "${i.includes}"`;if(i.format==="regex")return`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${i.pattern}`;return`Nieprawidłow(y/a/e) ${o[i.format]??r.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${r.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${r.keys.length>1?"s":""}: ${h(r.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${r.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${r.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function Wa(){return{localeError:jy()}}var Uy=()=>{let e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"número";case"object":{if(Array.isArray(r))return"array";if(r===null)return"nulo";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"padrão",email:"endereço de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(r)=>{switch(r.code){case"invalid_type":return`Tipo inválido: esperado ${r.expected}, recebido ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Entrada inválida: esperado ${_(r.values[0])}`;return`Opção inválida: esperada uma das ${h(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Muito grande: esperado que ${r.origin??"valor"} tivesse ${i}${r.maximum.toString()} ${s.unit??"elementos"}`;return`Muito grande: esperado que ${r.origin??"valor"} fosse ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Muito pequeno: esperado que ${r.origin} tivesse ${i}${r.minimum.toString()} ${s.unit}`;return`Muito pequeno: esperado que ${r.origin} fosse ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Texto inválido: deve começar com "${i.prefix}"`;if(i.format==="ends_with")return`Texto inválido: deve terminar com "${i.suffix}"`;if(i.format==="includes")return`Texto inválido: deve incluir "${i.includes}"`;if(i.format==="regex")return`Texto inválido: deve corresponder ao padrão ${i.pattern}`;return`${o[i.format]??r.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${r.divisor}`;case"unrecognized_keys":return`Chave${r.keys.length>1?"s":""} desconhecida${r.keys.length>1?"s":""}: ${h(r.keys,", ")}`;case"invalid_key":return`Chave inválida em ${r.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${r.origin}`;default:return"Campo inválido"}}};function Ha(){return{localeError:Uy()}}function Pm(e,t,n,o){let r=Math.abs(e),i=r%10,s=r%100;if(s>=11&&s<=19)return o;if(i===1)return t;if(i>=2&&i<=4)return n;return o}var Ly=()=>{let e={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"число";case"object":{if(Array.isArray(r))return"массив";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"};return(r)=>{switch(r.code){case"invalid_type":return`Неверный ввод: ожидалось ${r.expected}, получено ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Неверный ввод: ожидалось ${_(r.values[0])}`;return`Неверный вариант: ожидалось одно из ${h(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s){let a=Number(r.maximum),l=Pm(a,s.unit.one,s.unit.few,s.unit.many);return`Слишком большое значение: ожидалось, что ${r.origin??"значение"} будет иметь ${i}${r.maximum.toString()} ${l}`}return`Слишком большое значение: ожидалось, что ${r.origin??"значение"} будет ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s){let a=Number(r.minimum),l=Pm(a,s.unit.one,s.unit.few,s.unit.many);return`Слишком маленькое значение: ожидалось, что ${r.origin} будет иметь ${i}${r.minimum.toString()} ${l}`}return`Слишком маленькое значение: ожидалось, что ${r.origin} будет ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Неверная строка: должна начинаться с "${i.prefix}"`;if(i.format==="ends_with")return`Неверная строка: должна заканчиваться на "${i.suffix}"`;if(i.format==="includes")return`Неверная строка: должна содержать "${i.includes}"`;if(i.format==="regex")return`Неверная строка: должна соответствовать шаблону ${i.pattern}`;return`Неверный ${o[i.format]??r.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${r.divisor}`;case"unrecognized_keys":return`Нераспознанн${r.keys.length>1?"ые":"ый"} ключ${r.keys.length>1?"и":""}: ${h(r.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${r.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${r.origin}`;default:return"Неверные входные данные"}}};function Va(){return{localeError:Ly()}}var Fy=()=>{let e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"število";case"object":{if(Array.isArray(r))return"tabela";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"vnos",email:"e-poštni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"};return(r)=>{switch(r.code){case"invalid_type":return`Neveljaven vnos: pričakovano ${r.expected}, prejeto ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Neveljaven vnos: pričakovano ${_(r.values[0])}`;return`Neveljavna možnost: pričakovano eno izmed ${h(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Preveliko: pričakovano, da bo ${r.origin??"vrednost"} imelo ${i}${r.maximum.toString()} ${s.unit??"elementov"}`;return`Preveliko: pričakovano, da bo ${r.origin??"vrednost"} ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Premajhno: pričakovano, da bo ${r.origin} imelo ${i}${r.minimum.toString()} ${s.unit}`;return`Premajhno: pričakovano, da bo ${r.origin} ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Neveljaven niz: mora se začeti z "${i.prefix}"`;if(i.format==="ends_with")return`Neveljaven niz: mora se končati z "${i.suffix}"`;if(i.format==="includes")return`Neveljaven niz: mora vsebovati "${i.includes}"`;if(i.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${i.pattern}`;return`Neveljaven ${o[i.format]??r.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${r.divisor}`;case"unrecognized_keys":return`Neprepoznan${r.keys.length>1?"i ključi":" ključ"}: ${h(r.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${r.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${r.origin}`;default:return"Neveljaven vnos"}}};function Ba(){return{localeError:Fy()}}var Zy=()=>{let e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"antal";case"object":{if(Array.isArray(r))return"lista";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return(r)=>{switch(r.code){case"invalid_type":return`Ogiltig inmatning: förväntat ${r.expected}, fick ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Ogiltig inmatning: förväntat ${_(r.values[0])}`;return`Ogiltigt val: förväntade en av ${h(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`För stor(t): förväntade ${r.origin??"värdet"} att ha ${i}${r.maximum.toString()} ${s.unit??"element"}`;return`För stor(t): förväntat ${r.origin??"värdet"} att ha ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`För lite(t): förväntade ${r.origin??"värdet"} att ha ${i}${r.minimum.toString()} ${s.unit}`;return`För lite(t): förväntade ${r.origin??"värdet"} att ha ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Ogiltig sträng: måste börja med "${i.prefix}"`;if(i.format==="ends_with")return`Ogiltig sträng: måste sluta med "${i.suffix}"`;if(i.format==="includes")return`Ogiltig sträng: måste innehålla "${i.includes}"`;if(i.format==="regex")return`Ogiltig sträng: måste matcha mönstret "${i.pattern}"`;return`Ogiltig(t) ${o[i.format]??r.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${h(r.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${r.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${r.origin??"värdet"}`;default:return"Ogiltig input"}}};function qa(){return{localeError:Zy()}}var Gy=()=>{let e={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"எண் அல்லாதது":"எண்";case"object":{if(Array.isArray(r))return"அணி";if(r===null)return"வெறுமை";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"};return(r)=>{switch(r.code){case"invalid_type":return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${r.expected}, பெறப்பட்டது ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${_(r.values[0])}`;return`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${h(r.values,"|")} இல் ஒன்று`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${r.origin??"மதிப்பு"} ${i}${r.maximum.toString()} ${s.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`;return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${r.origin??"மதிப்பு"} ${i}${r.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${r.origin} ${i}${r.minimum.toString()} ${s.unit} ஆக இருக்க வேண்டும்`;return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${r.origin} ${i}${r.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`தவறான சரம்: "${i.prefix}" இல் தொடங்க வேண்டும்`;if(i.format==="ends_with")return`தவறான சரம்: "${i.suffix}" இல் முடிவடைய வேண்டும்`;if(i.format==="includes")return`தவறான சரம்: "${i.includes}" ஐ உள்ளடக்க வேண்டும்`;if(i.format==="regex")return`தவறான சரம்: ${i.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`;return`தவறான ${o[i.format]??r.format}`}case"not_multiple_of":return`தவறான எண்: ${r.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${r.keys.length>1?"கள்":""}: ${h(r.keys,", ")}`;case"invalid_key":return`${r.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${r.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function Ja(){return{localeError:Gy()}}var Wy=()=>{let e={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"ไม่ใช่ตัวเลข (NaN)":"ตัวเลข";case"object":{if(Array.isArray(r))return"อาร์เรย์ (Array)";if(r===null)return"ไม่มีค่า (null)";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"};return(r)=>{switch(r.code){case"invalid_type":return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${r.expected} แต่ได้รับ ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`ค่าไม่ถูกต้อง: ควรเป็น ${_(r.values[0])}`;return`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${h(r.values,"|")}`;case"too_big":{let i=r.inclusive?"ไม่เกิน":"น้อยกว่า",s=t(r.origin);if(s)return`เกินกำหนด: ${r.origin??"ค่า"} ควรมี${i} ${r.maximum.toString()} ${s.unit??"รายการ"}`;return`เกินกำหนด: ${r.origin??"ค่า"} ควรมี${i} ${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?"อย่างน้อย":"มากกว่า",s=t(r.origin);if(s)return`น้อยกว่ากำหนด: ${r.origin} ควรมี${i} ${r.minimum.toString()} ${s.unit}`;return`น้อยกว่ากำหนด: ${r.origin} ควรมี${i} ${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${i.prefix}"`;if(i.format==="ends_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${i.suffix}"`;if(i.format==="includes")return`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${i.includes}" อยู่ในข้อความ`;if(i.format==="regex")return`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${i.pattern}`;return`รูปแบบไม่ถูกต้อง: ${o[i.format]??r.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${r.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${h(r.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${r.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${r.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function Ka(){return{localeError:Wy()}}var Hy=(e)=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},Vy=()=>{let e={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function t(o){return e[o]??null}let n={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"};return(o)=>{switch(o.code){case"invalid_type":return`Geçersiz değer: beklenen ${o.expected}, alınan ${Hy(o.input)}`;case"invalid_value":if(o.values.length===1)return`Geçersiz değer: beklenen ${_(o.values[0])}`;return`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${h(o.values,"|")}`;case"too_big":{let r=o.inclusive?"<=":"<",i=t(o.origin);if(i)return`Çok büyük: beklenen ${o.origin??"değer"} ${r}${o.maximum.toString()} ${i.unit??"öğe"}`;return`Çok büyük: beklenen ${o.origin??"değer"} ${r}${o.maximum.toString()}`}case"too_small":{let r=o.inclusive?">=":">",i=t(o.origin);if(i)return`Çok küçük: beklenen ${o.origin} ${r}${o.minimum.toString()} ${i.unit}`;return`Çok küçük: beklenen ${o.origin} ${r}${o.minimum.toString()}`}case"invalid_format":{let r=o;if(r.format==="starts_with")return`Geçersiz metin: "${r.prefix}" ile başlamalı`;if(r.format==="ends_with")return`Geçersiz metin: "${r.suffix}" ile bitmeli`;if(r.format==="includes")return`Geçersiz metin: "${r.includes}" içermeli`;if(r.format==="regex")return`Geçersiz metin: ${r.pattern} desenine uymalı`;return`Geçersiz ${n[r.format]??o.format}`}case"not_multiple_of":return`Geçersiz sayı: ${o.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${o.keys.length>1?"lar":""}: ${h(o.keys,", ")}`;case"invalid_key":return`${o.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${o.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function Xa(){return{localeError:Vy()}}var By=()=>{let e={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"число";case"object":{if(Array.isArray(r))return"масив";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"};return(r)=>{switch(r.code){case"invalid_type":return`Неправильні вхідні дані: очікується ${r.expected}, отримано ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Неправильні вхідні дані: очікується ${_(r.values[0])}`;return`Неправильна опція: очікується одне з ${h(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Занадто велике: очікується, що ${r.origin??"значення"} ${s.verb} ${i}${r.maximum.toString()} ${s.unit??"елементів"}`;return`Занадто велике: очікується, що ${r.origin??"значення"} буде ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Занадто мале: очікується, що ${r.origin} ${s.verb} ${i}${r.minimum.toString()} ${s.unit}`;return`Занадто мале: очікується, що ${r.origin} буде ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Неправильний рядок: повинен починатися з "${i.prefix}"`;if(i.format==="ends_with")return`Неправильний рядок: повинен закінчуватися на "${i.suffix}"`;if(i.format==="includes")return`Неправильний рядок: повинен містити "${i.includes}"`;if(i.format==="regex")return`Неправильний рядок: повинен відповідати шаблону ${i.pattern}`;return`Неправильний ${o[i.format]??r.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${r.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${r.keys.length>1?"і":""}: ${h(r.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${r.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${r.origin}`;default:return"Неправильні вхідні дані"}}};function gr(){return{localeError:By()}}function Ya(){return gr()}var qy=()=>{let e={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"نمبر";case"object":{if(Array.isArray(r))return"آرے";if(r===null)return"نل";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"};return(r)=>{switch(r.code){case"invalid_type":return`غلط ان پٹ: ${r.expected} متوقع تھا، ${n(r.input)} موصول ہوا`;case"invalid_value":if(r.values.length===1)return`غلط ان پٹ: ${_(r.values[0])} متوقع تھا`;return`غلط آپشن: ${h(r.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`بہت بڑا: ${r.origin??"ویلیو"} کے ${i}${r.maximum.toString()} ${s.unit??"عناصر"} ہونے متوقع تھے`;return`بہت بڑا: ${r.origin??"ویلیو"} کا ${i}${r.maximum.toString()} ہونا متوقع تھا`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`بہت چھوٹا: ${r.origin} کے ${i}${r.minimum.toString()} ${s.unit} ہونے متوقع تھے`;return`بہت چھوٹا: ${r.origin} کا ${i}${r.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`غلط سٹرنگ: "${i.prefix}" سے شروع ہونا چاہیے`;if(i.format==="ends_with")return`غلط سٹرنگ: "${i.suffix}" پر ختم ہونا چاہیے`;if(i.format==="includes")return`غلط سٹرنگ: "${i.includes}" شامل ہونا چاہیے`;if(i.format==="regex")return`غلط سٹرنگ: پیٹرن ${i.pattern} سے میچ ہونا چاہیے`;return`غلط ${o[i.format]??r.format}`}case"not_multiple_of":return`غلط نمبر: ${r.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${r.keys.length>1?"ز":""}: ${h(r.keys,"، ")}`;case"invalid_key":return`${r.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${r.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function Qa(){return{localeError:qy()}}var Jy=()=>{let e={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"số";case"object":{if(Array.isArray(r))return"mảng";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"đầu vào",email:"địa chỉ email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"};return(r)=>{switch(r.code){case"invalid_type":return`Đầu vào không hợp lệ: mong đợi ${r.expected}, nhận được ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Đầu vào không hợp lệ: mong đợi ${_(r.values[0])}`;return`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${h(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Quá lớn: mong đợi ${r.origin??"giá trị"} ${s.verb} ${i}${r.maximum.toString()} ${s.unit??"phần tử"}`;return`Quá lớn: mong đợi ${r.origin??"giá trị"} ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Quá nhỏ: mong đợi ${r.origin} ${s.verb} ${i}${r.minimum.toString()} ${s.unit}`;return`Quá nhỏ: mong đợi ${r.origin} ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Chuỗi không hợp lệ: phải bắt đầu bằng "${i.prefix}"`;if(i.format==="ends_with")return`Chuỗi không hợp lệ: phải kết thúc bằng "${i.suffix}"`;if(i.format==="includes")return`Chuỗi không hợp lệ: phải bao gồm "${i.includes}"`;if(i.format==="regex")return`Chuỗi không hợp lệ: phải khớp với mẫu ${i.pattern}`;return`${o[i.format]??r.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${r.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${h(r.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${r.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${r.origin}`;default:return"Đầu vào không hợp lệ"}}};function el(){return{localeError:Jy()}}var Ky=()=>{let e={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"非数字(NaN)":"数字";case"object":{if(Array.isArray(r))return"数组";if(r===null)return"空值(null)";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"};return(r)=>{switch(r.code){case"invalid_type":return`无效输入:期望 ${r.expected},实际接收 ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`无效输入:期望 ${_(r.values[0])}`;return`无效选项:期望以下之一 ${h(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`数值过大:期望 ${r.origin??"值"} ${i}${r.maximum.toString()} ${s.unit??"个元素"}`;return`数值过大:期望 ${r.origin??"值"} ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`数值过小:期望 ${r.origin} ${i}${r.minimum.toString()} ${s.unit}`;return`数值过小:期望 ${r.origin} ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`无效字符串:必须以 "${i.prefix}" 开头`;if(i.format==="ends_with")return`无效字符串:必须以 "${i.suffix}" 结尾`;if(i.format==="includes")return`无效字符串:必须包含 "${i.includes}"`;if(i.format==="regex")return`无效字符串:必须满足正则表达式 ${i.pattern}`;return`无效${o[i.format]??r.format}`}case"not_multiple_of":return`无效数字:必须是 ${r.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${h(r.keys,", ")}`;case"invalid_key":return`${r.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${r.origin} 中包含无效值(value)`;default:return"无效输入"}}};function tl(){return{localeError:Ky()}}var Xy=()=>{let e={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"輸入",email:"郵件地址",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"};return(r)=>{switch(r.code){case"invalid_type":return`無效的輸入值:預期為 ${r.expected},但收到 ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`無效的輸入值:預期為 ${_(r.values[0])}`;return`無效的選項:預期為以下其中之一 ${h(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`數值過大:預期 ${r.origin??"值"} 應為 ${i}${r.maximum.toString()} ${s.unit??"個元素"}`;return`數值過大:預期 ${r.origin??"值"} 應為 ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`數值過小:預期 ${r.origin} 應為 ${i}${r.minimum.toString()} ${s.unit}`;return`數值過小:預期 ${r.origin} 應為 ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`無效的字串:必須以 "${i.prefix}" 開頭`;if(i.format==="ends_with")return`無效的字串:必須以 "${i.suffix}" 結尾`;if(i.format==="includes")return`無效的字串:必須包含 "${i.includes}"`;if(i.format==="regex")return`無效的字串:必須符合格式 ${i.pattern}`;return`無效的 ${o[i.format]??r.format}`}case"not_multiple_of":return`無效的數字:必須為 ${r.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${r.keys.length>1?"們":""}:${h(r.keys,"、")}`;case"invalid_key":return`${r.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${r.origin} 中有無效的值`;default:return"無效的輸入值"}}};function rl(){return{localeError:Xy()}}var Yy=()=>{let e={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"}};function t(r){return e[r]??null}let n=(r)=>{let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"nọ́mbà";case"object":{if(Array.isArray(r))return"akopọ";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},o={regex:"ẹ̀rọ ìbáwọlé",email:"àdírẹ́sì ìmẹ́lì",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"àkókò ISO",date:"ọjọ́ ISO",time:"àkókò ISO",duration:"àkókò tó pé ISO",ipv4:"àdírẹ́sì IPv4",ipv6:"àdírẹ́sì IPv6",cidrv4:"àgbègbè IPv4",cidrv6:"àgbègbè IPv6",base64:"ọ̀rọ̀ tí a kọ́ ní base64",base64url:"ọ̀rọ̀ base64url",json_string:"ọ̀rọ̀ JSON",e164:"nọ́mbà E.164",jwt:"JWT",template_literal:"ẹ̀rọ ìbáwọlé"};return(r)=>{switch(r.code){case"invalid_type":return`Ìbáwọlé aṣìṣe: a ní láti fi ${r.expected}, àmọ̀ a rí ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Ìbáwọlé aṣìṣe: a ní láti fi ${_(r.values[0])}`;return`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${h(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Tó pọ̀ jù: a ní láti jẹ́ pé ${r.origin??"iye"} ${s.verb} ${i}${r.maximum} ${s.unit}`;return`Tó pọ̀ jù: a ní láti jẹ́ ${i}${r.maximum}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s)return`Kéré ju: a ní láti jẹ́ pé ${r.origin} ${s.verb} ${i}${r.minimum} ${s.unit}`;return`Kéré ju: a ní láti jẹ́ ${i}${r.minimum}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${i.prefix}"`;if(i.format==="ends_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${i.suffix}"`;if(i.format==="includes")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${i.includes}"`;if(i.format==="regex")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${i.pattern}`;return`Aṣìṣe: ${o[i.format]??r.format}`}case"not_multiple_of":return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${r.divisor}`;case"unrecognized_keys":return`Bọtìnì àìmọ̀: ${h(r.keys,", ")}`;case"invalid_key":return`Bọtìnì aṣìṣe nínú ${r.origin}`;case"invalid_union":return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣìṣe nínú ${r.origin}`;default:return"Ìbáwọlé aṣìṣe"}}};function nl(){return{localeError:Yy()}}var ol=Symbol("ZodOutput"),il=Symbol("ZodInput");class vr{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==="object"&&"id"in n){if(this._idmap.has(n.id))throw Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let o={...n,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Rn(){return new vr}var Fe=Rn();function sl(e,t){return new e({type:"string",...y(t)})}function al(e,t){return new e({type:"string",coerce:!0,...y(t)})}function zn(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...y(t)})}function yr(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...y(t)})}function Cn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...y(t)})}function Mn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...y(t)})}function An(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...y(t)})}function Nn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...y(t)})}function br(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...y(t)})}function jn(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...y(t)})}function Un(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...y(t)})}function Ln(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...y(t)})}function Fn(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...y(t)})}function Zn(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...y(t)})}function Gn(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...y(t)})}function Wn(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...y(t)})}function Hn(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...y(t)})}function Vn(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...y(t)})}function Bn(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...y(t)})}function qn(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...y(t)})}function Jn(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...y(t)})}function Kn(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...y(t)})}function Xn(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...y(t)})}function Yn(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...y(t)})}var ll={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function cl(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...y(t)})}function ul(e,t){return new e({type:"string",format:"date",check:"string_format",...y(t)})}function dl(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...y(t)})}function ml(e,t){return new e({type:"string",format:"duration",check:"string_format",...y(t)})}function pl(e,t){return new e({type:"number",checks:[],...y(t)})}function fl(e,t){return new e({type:"number",coerce:!0,checks:[],...y(t)})}function gl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...y(t)})}function hl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...y(t)})}function vl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...y(t)})}function yl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...y(t)})}function bl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...y(t)})}function _l(e,t){return new e({type:"boolean",...y(t)})}function kl(e,t){return new e({type:"boolean",coerce:!0,...y(t)})}function wl(e,t){return new e({type:"bigint",...y(t)})}function xl(e,t){return new e({type:"bigint",coerce:!0,...y(t)})}function $l(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...y(t)})}function Sl(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...y(t)})}function Il(e,t){return new e({type:"symbol",...y(t)})}function Tl(e,t){return new e({type:"undefined",...y(t)})}function Dl(e,t){return new e({type:"null",...y(t)})}function Pl(e){return new e({type:"any"})}function Ol(e){return new e({type:"unknown"})}function El(e,t){return new e({type:"never",...y(t)})}function Rl(e,t){return new e({type:"void",...y(t)})}function zl(e,t){return new e({type:"date",...y(t)})}function Cl(e,t){return new e({type:"date",coerce:!0,...y(t)})}function Ml(e,t){return new e({type:"nan",...y(t)})}function Ve(e,t){return new _n({check:"less_than",...y(t),value:e,inclusive:!1})}function Pe(e,t){return new _n({check:"less_than",...y(t),value:e,inclusive:!0})}function Be(e,t){return new kn({check:"greater_than",...y(t),value:e,inclusive:!1})}function be(e,t){return new kn({check:"greater_than",...y(t),value:e,inclusive:!0})}function Al(e){return Be(0,e)}function Nl(e){return Ve(0,e)}function jl(e){return Pe(0,e)}function Ul(e){return be(0,e)}function _t(e,t){return new Zi({check:"multiple_of",...y(t),value:e})}function Mt(e,t){return new Hi({check:"max_size",...y(t),maximum:e})}function kt(e,t){return new Vi({check:"min_size",...y(t),minimum:e})}function _r(e,t){return new Bi({check:"size_equals",...y(t),size:e})}function At(e,t){return new qi({check:"max_length",...y(t),maximum:e})}function st(e,t){return new Ji({check:"min_length",...y(t),minimum:e})}function Nt(e,t){return new Ki({check:"length_equals",...y(t),length:e})}function kr(e,t){return new Xi({check:"string_format",format:"regex",...y(t),pattern:e})}function wr(e){return new Yi({check:"string_format",format:"lowercase",...y(e)})}function xr(e){return new Qi({check:"string_format",format:"uppercase",...y(e)})}function $r(e,t){return new es({check:"string_format",format:"includes",...y(t),includes:e})}function Sr(e,t){return new ts({check:"string_format",format:"starts_with",...y(t),prefix:e})}function Ir(e,t){return new rs({check:"string_format",format:"ends_with",...y(t),suffix:e})}function Ll(e,t,n){return new ns({check:"property",property:e,schema:t,...y(n)})}function Tr(e,t){return new os({check:"mime_type",mime:e,...y(t)})}function qe(e){return new is({check:"overwrite",tx:e})}function Dr(e){return qe((t)=>t.normalize(e))}function Pr(){return qe((e)=>e.trim())}function Or(){return qe((e)=>e.toLowerCase())}function Er(){return qe((e)=>e.toUpperCase())}function Fl(e,t,n){return new e({type:"array",element:t,...y(n)})}function Qy(e,t,n){return new e({type:"union",options:t,...y(n)})}function eb(e,t,n,o){return new e({type:"union",options:n,discriminator:t,...y(o)})}function tb(e,t,n){return new e({type:"intersection",left:t,right:n})}function rb(e,t,n,o){let r=n instanceof P;return new e({type:"tuple",items:t,rest:r?n:null,...y(r?o:n)})}function nb(e,t,n,o){return new e({type:"record",keyType:t,valueType:n,...y(o)})}function ob(e,t,n,o){return new e({type:"map",keyType:t,valueType:n,...y(o)})}function ib(e,t,n){return new e({type:"set",valueType:t,...y(n)})}function sb(e,t,n){let o=Array.isArray(t)?Object.fromEntries(t.map((r)=>[r,r])):t;return new e({type:"enum",entries:o,...y(n)})}function ab(e,t,n){return new e({type:"enum",entries:t,...y(n)})}function lb(e,t,n){return new e({type:"literal",values:Array.isArray(t)?t:[t],...y(n)})}function Zl(e,t){return new e({type:"file",...y(t)})}function cb(e,t){return new e({type:"transform",transform:t})}function ub(e,t){return new e({type:"optional",innerType:t})}function db(e,t){return new e({type:"nullable",innerType:t})}function mb(e,t,n){return new e({type:"default",innerType:t,get defaultValue(){return typeof n==="function"?n():er(n)}})}function pb(e,t,n){return new e({type:"nonoptional",innerType:t,...y(n)})}function fb(e,t){return new e({type:"success",innerType:t})}function gb(e,t,n){return new e({type:"catch",innerType:t,catchValue:typeof n==="function"?n:()=>n})}function hb(e,t,n){return new e({type:"pipe",in:t,out:n})}function vb(e,t){return new e({type:"readonly",innerType:t})}function yb(e,t,n){return new e({type:"template_literal",parts:t,...y(n)})}function bb(e,t){return new e({type:"lazy",getter:t})}function _b(e,t){return new e({type:"promise",innerType:t})}function Gl(e,t,n){let o=y(n);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function Wl(e,t,n){return new e({type:"custom",check:"custom",fn:t,...y(n)})}function Hl(e){let t=Om((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(it(o,n.value,t._zod.def));else{let r=o;if(r.fatal)r.continue=!1;r.code??(r.code="custom"),r.input??(r.input=n.value),r.inst??(r.inst=t),r.continue??(r.continue=!t._zod.def.abort),n.issues.push(it(r))}},e(n.value,n)));return t}function Om(e,t){let n=new Y({check:"custom",...y(t)});return n._zod.check=e,n}function Vl(e,t){let n=y(t),o=n.truthy??["true","1","yes","on","y","enabled"],r=n.falsy??["false","0","no","off","n","disabled"];if(n.case!=="sensitive")o=o.map((d)=>typeof d==="string"?d.toLowerCase():d),r=r.map((d)=>typeof d==="string"?d.toLowerCase():d);let i=new Set(o),s=new Set(r),a=e.Codec??ur,l=e.Boolean??cr,u=new(e.String??bt)({type:"string",error:n.error}),f=new l({type:"boolean",error:n.error}),g=new a({type:"pipe",in:u,out:f,transform:(d,b)=>{let w=d;if(n.case!=="sensitive")w=w.toLowerCase();if(i.has(w))return!0;else if(s.has(w))return!1;else return b.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:b.value,inst:g,continue:!1}),{}},reverseTransform:(d,b)=>{if(d===!0)return o[0]||"true";else return r[0]||"false"},error:n.error});return g}function jt(e,t,n,o={}){let r=y(o),i={...y(o),check:"string_format",type:"string",format:t,fn:typeof n==="function"?n:(a)=>n.test(a),...r};if(n instanceof RegExp)i.pattern=n;return new e(i)}class Qn{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Fe,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,t={path:[],schemaPath:[]}){var n;let o=e._zod.def,r={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},i=this.seen.get(e);if(i){if(i.count++,t.schemaPath.includes(e))i.cycle=t.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:t.path};this.seen.set(e,s);let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let u={...t,schemaPath:[...t.schemaPath,e],path:t.path},f=e._zod.parent;if(f)s.ref=f,this.process(f,u),this.seen.get(f).isParent=!0;else{let g=s.schema;switch(o.type){case"string":{let d=g;d.type="string";let{minimum:b,maximum:w,format:M,patterns:j,contentEncoding:K}=e._zod.bag;if(typeof b==="number")d.minLength=b;if(typeof w==="number")d.maxLength=w;if(M){if(d.format=r[M]??M,d.format==="")delete d.format}if(K)d.contentEncoding=K;if(j&&j.size>0){let W=[...j];if(W.length===1)d.pattern=W[0].source;else if(W.length>1)s.schema.allOf=[...W.map((ae)=>({...this.target==="draft-7"||this.target==="draft-4"||this.target==="openapi-3.0"?{type:"string"}:{},pattern:ae.source}))]}break}case"number":{let d=g,{minimum:b,maximum:w,format:M,multipleOf:j,exclusiveMaximum:K,exclusiveMinimum:W}=e._zod.bag;if(typeof M==="string"&&M.includes("int"))d.type="integer";else d.type="number";if(typeof W==="number")if(this.target==="draft-4"||this.target==="openapi-3.0")d.minimum=W,d.exclusiveMinimum=!0;else d.exclusiveMinimum=W;if(typeof b==="number"){if(d.minimum=b,typeof W==="number"&&this.target!=="draft-4")if(W>=b)delete d.minimum;else delete d.exclusiveMinimum}if(typeof K==="number")if(this.target==="draft-4"||this.target==="openapi-3.0")d.maximum=K,d.exclusiveMaximum=!0;else d.exclusiveMaximum=K;if(typeof w==="number"){if(d.maximum=w,typeof K==="number"&&this.target!=="draft-4")if(K<=w)delete d.maximum;else delete d.exclusiveMaximum}if(typeof j==="number")d.multipleOf=j;break}case"boolean":{let d=g;d.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema");break}case"null":{if(this.target==="openapi-3.0")g.type="string",g.nullable=!0,g.enum=[null];else g.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema");break}case"never":{g.not={};break}case"date":{if(this.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema");break}case"array":{let d=g,{minimum:b,maximum:w}=e._zod.bag;if(typeof b==="number")d.minItems=b;if(typeof w==="number")d.maxItems=w;d.type="array",d.items=this.process(o.element,{...u,path:[...u.path,"items"]});break}case"object":{let d=g;d.type="object",d.properties={};let b=o.shape;for(let j in b)d.properties[j]=this.process(b[j],{...u,path:[...u.path,"properties",j]});let w=new Set(Object.keys(b)),M=new Set([...w].filter((j)=>{let K=o.shape[j]._zod;if(this.io==="input")return K.optin===void 0;else return K.optout===void 0}));if(M.size>0)d.required=Array.from(M);if(o.catchall?._zod.def.type==="never")d.additionalProperties=!1;else if(!o.catchall){if(this.io==="output")d.additionalProperties=!1}else if(o.catchall)d.additionalProperties=this.process(o.catchall,{...u,path:[...u.path,"additionalProperties"]});break}case"union":{let d=g,b=o.options.map((w,M)=>this.process(w,{...u,path:[...u.path,"anyOf",M]}));d.anyOf=b;break}case"intersection":{let d=g,b=this.process(o.left,{...u,path:[...u.path,"allOf",0]}),w=this.process(o.right,{...u,path:[...u.path,"allOf",1]}),M=(K)=>("allOf"in K)&&Object.keys(K).length===1,j=[...M(b)?b.allOf:[b],...M(w)?w.allOf:[w]];d.allOf=j;break}case"tuple":{let d=g;d.type="array";let b=this.target==="draft-2020-12"?"prefixItems":"items",w=this.target==="draft-2020-12"?"items":this.target==="openapi-3.0"?"items":"additionalItems",M=o.items.map((ae,Te)=>this.process(ae,{...u,path:[...u.path,b,Te]})),j=o.rest?this.process(o.rest,{...u,path:[...u.path,w,...this.target==="openapi-3.0"?[o.items.length]:[]]}):null;if(this.target==="draft-2020-12"){if(d.prefixItems=M,j)d.items=j}else if(this.target==="openapi-3.0"){if(d.items={anyOf:M},j)d.items.anyOf.push(j);if(d.minItems=M.length,!j)d.maxItems=M.length}else if(d.items=M,j)d.additionalItems=j;let{minimum:K,maximum:W}=e._zod.bag;if(typeof K==="number")d.minItems=K;if(typeof W==="number")d.maxItems=W;break}case"record":{let d=g;if(d.type="object",this.target==="draft-7"||this.target==="draft-2020-12")d.propertyNames=this.process(o.keyType,{...u,path:[...u.path,"propertyNames"]});d.additionalProperties=this.process(o.valueType,{...u,path:[...u.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema");break}case"enum":{let d=g,b=Yt(o.entries);if(b.every((w)=>typeof w==="number"))d.type="number";if(b.every((w)=>typeof w==="string"))d.type="string";d.enum=b;break}case"literal":{let d=g,b=[];for(let w of o.values)if(w===void 0){if(this.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof w==="bigint")if(this.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else b.push(Number(w));else b.push(w);if(b.length===0);else if(b.length===1){let w=b[0];if(d.type=w===null?"null":typeof w,this.target==="draft-4"||this.target==="openapi-3.0")d.enum=[w];else d.const=w}else{if(b.every((w)=>typeof w==="number"))d.type="number";if(b.every((w)=>typeof w==="string"))d.type="string";if(b.every((w)=>typeof w==="boolean"))d.type="string";if(b.every((w)=>w===null))d.type="null";d.enum=b}break}case"file":{let d=g,b={type:"string",format:"binary",contentEncoding:"binary"},{minimum:w,maximum:M,mime:j}=e._zod.bag;if(w!==void 0)b.minLength=w;if(M!==void 0)b.maxLength=M;if(j)if(j.length===1)b.contentMediaType=j[0],Object.assign(d,b);else d.anyOf=j.map((K)=>({...b,contentMediaType:K}));else Object.assign(d,b);break}case"transform":{if(this.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let d=this.process(o.innerType,u);if(this.target==="openapi-3.0")s.ref=o.innerType,g.nullable=!0;else g.anyOf=[d,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,u),s.ref=o.innerType;break}case"success":{let d=g;d.type="boolean";break}case"default":{this.process(o.innerType,u),s.ref=o.innerType,g.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{if(this.process(o.innerType,u),s.ref=o.innerType,this.io==="input")g._prefault=JSON.parse(JSON.stringify(o.defaultValue));break}case"catch":{this.process(o.innerType,u),s.ref=o.innerType;let d;try{d=o.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}g.default=d;break}case"nan":{if(this.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let d=g,b=e._zod.pattern;if(!b)throw Error("Pattern not found in template literal");d.type="string",d.pattern=b.source;break}case"pipe":{let d=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(d,u),s.ref=d;break}case"readonly":{this.process(o.innerType,u),s.ref=o.innerType,g.readOnly=!0;break}case"promise":{this.process(o.innerType,u),s.ref=o.innerType;break}case"optional":{this.process(o.innerType,u),s.ref=o.innerType;break}case"lazy":{let d=e._zod.innerType;this.process(d,u),s.ref=d;break}case"custom":{if(this.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema");break}case"function":{if(this.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema");break}default:}}}let l=this.metadataRegistry.get(e);if(l)Object.assign(s.schema,l);if(this.io==="input"&&le(e))delete s.schema.examples,delete s.schema.default;if(this.io==="input"&&s.schema._prefault)(n=s.schema).default??(n.default=s.schema._prefault);return delete s.schema._prefault,this.seen.get(e).schema}emit(e,t){let n={cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0},o=this.seen.get(e);if(!o)throw Error("Unprocessed schema. This is a bug in Zod.");let r=(c)=>{let u=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let b=n.external.registry.get(c[0])?.id,w=n.external.uri??((j)=>j);if(b)return{ref:w(b)};let M=c[1].defId??c[1].schema.id??`schema${this.counter++}`;return c[1].defId=M,{defId:M,ref:`${w("__shared")}#/${u}/${M}`}}if(c[1]===o)return{ref:"#"};let g=`${"#"}/${u}/`,d=c[1].schema.id??`__schema${this.counter++}`;return{defId:d,ref:g+d}},i=(c)=>{if(c[1].schema.$ref)return;let u=c[1],{ref:f,defId:g}=r(c);if(u.def={...u.schema},g)u.defId=g;let d=u.schema;for(let b in d)delete d[b];d.$ref=f};if(n.cycles==="throw")for(let c of this.seen.entries()){let u=c[1];if(u.cycle)throw Error(`Cycle detected: #/${u.cycle?.join("/")}/<root>
190
+ `)}d.write("payload.value = newResult;"),d.write("return payload;");let K=d.compile();return(W,ae)=>K(g,W,ae)},o,s=vt,a=!Kt.jitless,c=a&&io.value,u=t.catchall,f;e._zod.parse=(g,d)=>{f??(f=i.value);let b=g.value;if(!s(b))return g.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),g;if(a&&c&&d?.async===!1&&d.jitless!==!0){if(!o)o=r(t.shape);if(g=o(g,d),!u)return g;return Sm([],b,g,d,f,e)}return n(g,d)}});function pm(e,t,n,i){for(let o of e)if(o.issues.length===0)return t.value=o.value,t;let r=e.filter((o)=>!it(o));if(r.length===1)return t.value=r[0].value,r[0];return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((o)=>o.issues.map((s)=>Se(s,i,oe())))}),t}var On=m("$ZodUnion",(e,t)=>{O.init(e,t),A(e._zod,"optin",()=>t.options.some((r)=>r._zod.optin==="optional")?"optional":void 0),A(e._zod,"optout",()=>t.options.some((r)=>r._zod.optout==="optional")?"optional":void 0),A(e._zod,"values",()=>{if(t.options.every((r)=>r._zod.values))return new Set(t.options.flatMap((r)=>Array.from(r._zod.values)));return}),A(e._zod,"pattern",()=>{if(t.options.every((r)=>r._zod.pattern)){let r=t.options.map((o)=>o._zod.pattern);return new RegExp(`^(${r.map((o)=>Qt(o.source)).join("|")})$`)}return});let n=t.options.length===1,i=t.options[0]._zod.run;e._zod.parse=(r,o)=>{if(n)return i(r,o);let s=!1,a=[];for(let l of t.options){let c=l._zod.run({value:r.value,issues:[]},o);if(c instanceof Promise)a.push(c),s=!0;else{if(c.issues.length===0)return c;a.push(c)}}if(!s)return pm(a,r,e,o);return Promise.all(a).then((l)=>pm(l,r,e,o))}}),Hs=m("$ZodDiscriminatedUnion",(e,t)=>{On.init(e,t);let n=e._zod.parse;A(e._zod,"propValues",()=>{let r={};for(let o of t.options){let s=o._zod.propValues;if(!s||Object.keys(s).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(let[a,l]of Object.entries(s)){if(!r[a])r[a]=new Set;for(let c of l)r[a].add(c)}}return r});let i=Pt(()=>{let r=t.options,o=new Map;for(let s of r){let a=s._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let l of a){if(o.has(l))throw Error(`Duplicate discriminator value "${String(l)}"`);o.set(l,s)}}return o});e._zod.parse=(r,o)=>{let s=r.value;if(!vt(s))return r.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),r;let a=i.value.get(s?.[t.discriminator]);if(a)return a._zod.run(r,o);if(t.unionFallback)return n(r,o);return r.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:s,path:[t.discriminator],inst:e}),r}}),Vs=m("$ZodIntersection",(e,t)=>{O.init(e,t),e._zod.parse=(n,i)=>{let r=n.value,o=t.left._zod.run({value:r,issues:[]},i),s=t.right._zod.run({value:r,issues:[]},i);if(o instanceof Promise||s instanceof Promise)return Promise.all([o,s]).then(([l,c])=>fm(n,l,c));return fm(n,o,s)}});function as(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(nt(e)&&nt(t)){let n=Object.keys(t),i=Object.keys(e).filter((o)=>n.indexOf(o)!==-1),r={...e,...t};for(let o of i){let s=as(e[o],t[o]);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};r[o]=s.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let i=0;i<e.length;i++){let r=e[i],o=t[i],s=as(r,o);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function fm(e,t,n){if(t.issues.length)e.issues.push(...t.issues);if(n.issues.length)e.issues.push(...n.issues);if(it(e))return e;let i=as(t.value,n.value);if(!i.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}var En=m("$ZodTuple",(e,t)=>{O.init(e,t);let n=t.items,i=n.length-[...n].reverse().findIndex((r)=>r._zod.optin!=="optional");e._zod.parse=(r,o)=>{let s=r.value;if(!Array.isArray(s))return r.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),r;r.value=[];let a=[];if(!t.rest){let c=s.length>n.length,u=s.length<i-1;if(c||u)return r.issues.push({...c?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length},input:s,inst:e,origin:"array"}),r}let l=-1;for(let c of n){if(l++,l>=s.length){if(l>=i)continue}let u=c._zod.run({value:s[l],issues:[]},o);if(u instanceof Promise)a.push(u.then((f)=>xn(f,r,l)));else xn(u,r,l)}if(t.rest){let c=s.slice(n.length);for(let u of c){l++;let f=t.rest._zod.run({value:u,issues:[]},o);if(f instanceof Promise)a.push(f.then((g)=>xn(g,r,l)));else xn(f,r,l)}}if(a.length)return Promise.all(a).then(()=>r);return r}});function xn(e,t,n){if(e.issues.length)t.issues.push(...$e(n,e.issues));t.value[n]=e.value}var Bs=m("$ZodRecord",(e,t)=>{O.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;if(!nt(r))return n.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),n;let o=[];if(t.keyType._zod.values){let s=t.keyType._zod.values;n.value={};for(let l of s)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){let c=t.valueType._zod.run({value:r[l],issues:[]},i);if(c instanceof Promise)o.push(c.then((u)=>{if(u.issues.length)n.issues.push(...$e(l,u.issues));n.value[l]=u.value}));else{if(c.issues.length)n.issues.push(...$e(l,c.issues));n.value[l]=c.value}}let a;for(let l in r)if(!s.has(l))a=a??[],a.push(l);if(a&&a.length>0)n.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:a})}else{n.value={};for(let s of Reflect.ownKeys(r)){if(s==="__proto__")continue;let a=t.keyType._zod.run({value:s,issues:[]},i);if(a instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(a.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map((c)=>Se(c,i,oe())),input:s,path:[s],inst:e}),n.value[a.value]=a.value;continue}let l=t.valueType._zod.run({value:r[s],issues:[]},i);if(l instanceof Promise)o.push(l.then((c)=>{if(c.issues.length)n.issues.push(...$e(s,c.issues));n.value[a.value]=c.value}));else{if(l.issues.length)n.issues.push(...$e(s,l.issues));n.value[a.value]=l.value}}}if(o.length)return Promise.all(o).then(()=>n);return n}}),qs=m("$ZodMap",(e,t)=>{O.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;if(!(r instanceof Map))return n.issues.push({expected:"map",code:"invalid_type",input:r,inst:e}),n;let o=[];n.value=new Map;for(let[s,a]of r){let l=t.keyType._zod.run({value:s,issues:[]},i),c=t.valueType._zod.run({value:a,issues:[]},i);if(l instanceof Promise||c instanceof Promise)o.push(Promise.all([l,c]).then(([u,f])=>{gm(u,f,n,s,r,e,i)}));else gm(l,c,n,s,r,e,i)}if(o.length)return Promise.all(o).then(()=>n);return n}});function gm(e,t,n,i,r,o,s){if(e.issues.length)if(tr.has(typeof i))n.issues.push(...$e(i,e.issues));else n.issues.push({code:"invalid_key",origin:"map",input:r,inst:o,issues:e.issues.map((a)=>Se(a,s,oe()))});if(t.issues.length)if(tr.has(typeof i))n.issues.push(...$e(i,t.issues));else n.issues.push({origin:"map",code:"invalid_element",input:r,inst:o,key:i,issues:t.issues.map((a)=>Se(a,s,oe()))});n.value.set(e.value,t.value)}var Js=m("$ZodSet",(e,t)=>{O.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;if(!(r instanceof Set))return n.issues.push({input:r,inst:e,expected:"set",code:"invalid_type"}),n;let o=[];n.value=new Set;for(let s of r){let a=t.valueType._zod.run({value:s,issues:[]},i);if(a instanceof Promise)o.push(a.then((l)=>hm(l,n)));else hm(a,n)}if(o.length)return Promise.all(o).then(()=>n);return n}});function hm(e,t){if(e.issues.length)t.issues.push(...e.issues);t.value.add(e.value)}var Ks=m("$ZodEnum",(e,t)=>{O.init(e,t);let n=Yt(t.entries),i=new Set(n);e._zod.values=i,e._zod.pattern=new RegExp(`^(${n.filter((r)=>tr.has(typeof r)).map((r)=>typeof r==="string"?Le(r):r.toString()).join("|")})$`),e._zod.parse=(r,o)=>{let s=r.value;if(i.has(s))return r;return r.issues.push({code:"invalid_value",values:n,input:s,inst:e}),r}}),Xs=m("$ZodLiteral",(e,t)=>{if(O.init(e,t),t.values.length===0)throw Error("Cannot create literal schema with no valid values");e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map((n)=>typeof n==="string"?Le(n):n?Le(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,i)=>{let r=n.value;if(e._zod.values.has(r))return n;return n.issues.push({code:"invalid_value",values:t.values,input:r,inst:e}),n}}),Ys=m("$ZodFile",(e,t)=>{O.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;if(r instanceof File)return n;return n.issues.push({expected:"file",code:"invalid_type",input:r,inst:e}),n}}),Qs=m("$ZodTransform",(e,t)=>{O.init(e,t),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new ht(e.constructor.name);let r=t.transform(n.value,n);if(i.async)return(r instanceof Promise?r:Promise.resolve(r)).then((s)=>(n.value=s,n));if(r instanceof Promise)throw new Ue;return n.value=r,n}});function vm(e,t){if(e.issues.length&&t===void 0)return{issues:[],value:void 0};return e}var ea=m("$ZodOptional",(e,t)=>{O.init(e,t),e._zod.optin="optional",e._zod.optout="optional",A(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),A(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${Qt(n.source)})?$`):void 0}),e._zod.parse=(n,i)=>{if(t.innerType._zod.optin==="optional"){let r=t.innerType._zod.run(n,i);if(r instanceof Promise)return r.then((o)=>vm(o,n.value));return vm(r,n.value)}if(n.value===void 0)return n;return t.innerType._zod.run(n,i)}}),ta=m("$ZodNullable",(e,t)=>{O.init(e,t),A(e._zod,"optin",()=>t.innerType._zod.optin),A(e._zod,"optout",()=>t.innerType._zod.optout),A(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${Qt(n.source)}|null)$`):void 0}),A(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,i)=>{if(n.value===null)return n;return t.innerType._zod.run(n,i)}}),ra=m("$ZodDefault",(e,t)=>{O.init(e,t),e._zod.optin="optional",A(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);if(n.value===void 0)return n.value=t.defaultValue,n;let r=t.innerType._zod.run(n,i);if(r instanceof Promise)return r.then((o)=>ym(o,t));return ym(r,t)}});function ym(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var na=m("$ZodPrefault",(e,t)=>{O.init(e,t),e._zod.optin="optional",A(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);if(n.value===void 0)n.value=t.defaultValue;return t.innerType._zod.run(n,i)}}),ia=m("$ZodNonOptional",(e,t)=>{O.init(e,t),A(e._zod,"values",()=>{let n=t.innerType._zod.values;return n?new Set([...n].filter((i)=>i!==void 0)):void 0}),e._zod.parse=(n,i)=>{let r=t.innerType._zod.run(n,i);if(r instanceof Promise)return r.then((o)=>bm(o,e));return bm(r,e)}});function bm(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}var oa=m("$ZodSuccess",(e,t)=>{O.init(e,t),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new ht("ZodSuccess");let r=t.innerType._zod.run(n,i);if(r instanceof Promise)return r.then((o)=>(n.value=o.issues.length===0,n));return n.value=r.issues.length===0,n}}),sa=m("$ZodCatch",(e,t)=>{O.init(e,t),A(e._zod,"optin",()=>t.innerType._zod.optin),A(e._zod,"optout",()=>t.innerType._zod.optout),A(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);let r=t.innerType._zod.run(n,i);if(r instanceof Promise)return r.then((o)=>{if(n.value=o.value,o.issues.length)n.value=t.catchValue({...n,error:{issues:o.issues.map((s)=>Se(s,i,oe()))},input:n.value}),n.issues=[];return n});if(n.value=r.value,r.issues.length)n.value=t.catchValue({...n,error:{issues:r.issues.map((o)=>Se(o,i,oe()))},input:n.value}),n.issues=[];return n}}),aa=m("$ZodNaN",(e,t)=>{O.init(e,t),e._zod.parse=(n,i)=>{if(typeof n.value!=="number"||!Number.isNaN(n.value))return n.issues.push({input:n.value,inst:e,expected:"nan",code:"invalid_type"}),n;return n}}),la=m("$ZodPipe",(e,t)=>{O.init(e,t),A(e._zod,"values",()=>t.in._zod.values),A(e._zod,"optin",()=>t.in._zod.optin),A(e._zod,"optout",()=>t.out._zod.optout),A(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,i)=>{if(i.direction==="backward"){let o=t.out._zod.run(n,i);if(o instanceof Promise)return o.then((s)=>$n(s,t.in,i));return $n(o,t.in,i)}let r=t.in._zod.run(n,i);if(r instanceof Promise)return r.then((o)=>$n(o,t.out,i));return $n(r,t.out,i)}});function $n(e,t,n){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},n)}var ur=m("$ZodCodec",(e,t)=>{O.init(e,t),A(e._zod,"values",()=>t.in._zod.values),A(e._zod,"optin",()=>t.in._zod.optin),A(e._zod,"optout",()=>t.out._zod.optout),A(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,i)=>{if((i.direction||"forward")==="forward"){let o=t.in._zod.run(n,i);if(o instanceof Promise)return o.then((s)=>Sn(s,t,i));return Sn(o,t,i)}else{let o=t.out._zod.run(n,i);if(o instanceof Promise)return o.then((s)=>Sn(s,t,i));return Sn(o,t,i)}}});function Sn(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||"forward")==="forward"){let r=t.transform(e.value,e);if(r instanceof Promise)return r.then((o)=>In(e,o,t.out,n));return In(e,r,t.out,n)}else{let r=t.reverseTransform(e.value,e);if(r instanceof Promise)return r.then((o)=>In(e,o,t.in,n));return In(e,r,t.in,n)}}function In(e,t,n,i){if(e.issues.length)return e.aborted=!0,e;return n._zod.run({value:t,issues:e.issues},i)}var ca=m("$ZodReadonly",(e,t)=>{O.init(e,t),A(e._zod,"propValues",()=>t.innerType._zod.propValues),A(e._zod,"values",()=>t.innerType._zod.values),A(e._zod,"optin",()=>t.innerType._zod.optin),A(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);let r=t.innerType._zod.run(n,i);if(r instanceof Promise)return r.then(_m);return _m(r)}});function _m(e){return e.value=Object.freeze(e.value),e}var ua=m("$ZodTemplateLiteral",(e,t)=>{O.init(e,t);let n=[];for(let i of t.parts)if(typeof i==="object"&&i!==null){if(!i._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...i._zod.traits].shift()}`);let r=i._zod.pattern instanceof RegExp?i._zod.pattern.source:i._zod.pattern;if(!r)throw Error(`Invalid template literal part: ${i._zod.traits}`);let o=r.startsWith("^")?1:0,s=r.endsWith("$")?r.length-1:r.length;n.push(r.slice(o,s))}else if(i===null||oo.has(typeof i))n.push(Le(`${i}`));else throw Error(`Invalid template literal part: ${i}`);e._zod.pattern=new RegExp(`^${n.join("")}$`),e._zod.parse=(i,r)=>{if(typeof i.value!=="string")return i.issues.push({input:i.value,inst:e,expected:"template_literal",code:"invalid_type"}),i;if(e._zod.pattern.lastIndex=0,!e._zod.pattern.test(i.value))return i.issues.push({input:i.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),i;return i}}),da=m("$ZodFunction",(e,t)=>(O.init(e,t),e._def=t,e._zod.def=t,e.implement=(n)=>{if(typeof n!=="function")throw Error("implement() must be called with a function");return function(...i){let r=e._def.input?ln(e._def.input,i):i,o=Reflect.apply(n,this,r);if(e._def.output)return ln(e._def.output,o);return o}},e.implementAsync=(n)=>{if(typeof n!=="function")throw Error("implementAsync() must be called with a function");return async function(...i){let r=e._def.input?await cn(e._def.input,i):i,o=await Reflect.apply(n,this,r);if(e._def.output)return await cn(e._def.output,o);return o}},e._zod.parse=(n,i)=>{if(typeof n.value!=="function")return n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:e}),n;if(e._def.output&&e._def.output._zod.def.type==="promise")n.value=e.implementAsync(n.value);else n.value=e.implement(n.value);return n},e.input=(...n)=>{let i=e.constructor;if(Array.isArray(n[0]))return new i({type:"function",input:new En({type:"tuple",items:n[0],rest:n[1]}),output:e._def.output});return new i({type:"function",input:n[0],output:e._def.output})},e.output=(n)=>new e.constructor({type:"function",input:e._def.input,output:n}),e)),ma=m("$ZodPromise",(e,t)=>{O.init(e,t),e._zod.parse=(n,i)=>Promise.resolve(n.value).then((r)=>t.innerType._zod.run({value:r,issues:[]},i))}),pa=m("$ZodLazy",(e,t)=>{O.init(e,t),A(e._zod,"innerType",()=>t.getter()),A(e._zod,"pattern",()=>e._zod.innerType._zod.pattern),A(e._zod,"propValues",()=>e._zod.innerType._zod.propValues),A(e._zod,"optin",()=>e._zod.innerType._zod.optin??void 0),A(e._zod,"optout",()=>e._zod.innerType._zod.optout??void 0),e._zod.parse=(n,i)=>e._zod.innerType._zod.run(n,i)}),fa=m("$ZodCustom",(e,t)=>{Y.init(e,t),O.init(e,t),e._zod.parse=(n,i)=>n,e._zod.check=(n)=>{let i=n.value,r=t.fn(i);if(r instanceof Promise)return r.then((o)=>km(o,n,i,e));km(r,n,i,e);return}});function km(e,t,n,i){if(!e){let r={code:"custom",input:n,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};if(i._zod.def.params)r.params=i._zod.def.params;t.issues.push(ot(r))}}var hr={};dt(hr,{ar:()=>ga,az:()=>ha,be:()=>va,ca:()=>ya,cs:()=>ba,da:()=>_a,de:()=>ka,en:()=>dr,eo:()=>wa,es:()=>xa,fa:()=>$a,fi:()=>Sa,fr:()=>Ia,frCA:()=>Ta,he:()=>Da,hu:()=>Pa,id:()=>Oa,is:()=>Ea,it:()=>Ra,ja:()=>za,ka:()=>Ca,kh:()=>Aa,km:()=>mr,ko:()=>Ma,lt:()=>Na,mk:()=>ja,ms:()=>Ua,nl:()=>La,no:()=>Fa,ota:()=>Ga,pl:()=>Wa,ps:()=>Za,pt:()=>Ha,ru:()=>Va,sl:()=>Ba,sv:()=>qa,ta:()=>Ja,th:()=>Ka,tr:()=>Xa,ua:()=>Ya,uk:()=>gr,ur:()=>Qa,vi:()=>el,yo:()=>nl,zhCN:()=>tl,zhTW:()=>rl});var oy=()=>{let e={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"};return(r)=>{switch(r.code){case"invalid_type":return`مدخلات غير مقبولة: يفترض إدخال ${r.expected}، ولكن تم إدخال ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`مدخلات غير مقبولة: يفترض إدخال ${k(r.values[0])}`;return`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${h(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return` أكبر من اللازم: يفترض أن تكون ${r.origin??"القيمة"} ${o} ${r.maximum.toString()} ${s.unit??"عنصر"}`;return`أكبر من اللازم: يفترض أن تكون ${r.origin??"القيمة"} ${o} ${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`أصغر من اللازم: يفترض لـ ${r.origin} أن يكون ${o} ${r.minimum.toString()} ${s.unit}`;return`أصغر من اللازم: يفترض لـ ${r.origin} أن يكون ${o} ${r.minimum.toString()}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`نَص غير مقبول: يجب أن يبدأ بـ "${r.prefix}"`;if(o.format==="ends_with")return`نَص غير مقبول: يجب أن ينتهي بـ "${o.suffix}"`;if(o.format==="includes")return`نَص غير مقبول: يجب أن يتضمَّن "${o.includes}"`;if(o.format==="regex")return`نَص غير مقبول: يجب أن يطابق النمط ${o.pattern}`;return`${i[o.format]??r.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${r.divisor}`;case"unrecognized_keys":return`معرف${r.keys.length>1?"ات":""} غريب${r.keys.length>1?"ة":""}: ${h(r.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${r.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${r.origin}`;default:return"مدخل غير مقبول"}}};function ga(){return{localeError:oy()}}var sy=()=>{let e={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return(r)=>{switch(r.code){case"invalid_type":return`Yanlış dəyər: gözlənilən ${r.expected}, daxil olan ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Yanlış dəyər: gözlənilən ${k(r.values[0])}`;return`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${h(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Çox böyük: gözlənilən ${r.origin??"dəyər"} ${o}${r.maximum.toString()} ${s.unit??"element"}`;return`Çox böyük: gözlənilən ${r.origin??"dəyər"} ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`Çox kiçik: gözlənilən ${r.origin} ${o}${r.minimum.toString()} ${s.unit}`;return`Çox kiçik: gözlənilən ${r.origin} ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`Yanlış mətn: "${o.prefix}" ilə başlamalıdır`;if(o.format==="ends_with")return`Yanlış mətn: "${o.suffix}" ilə bitməlidir`;if(o.format==="includes")return`Yanlış mətn: "${o.includes}" daxil olmalıdır`;if(o.format==="regex")return`Yanlış mətn: ${o.pattern} şablonuna uyğun olmalıdır`;return`Yanlış ${i[o.format]??r.format}`}case"not_multiple_of":return`Yanlış ədəd: ${r.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${r.keys.length>1?"lar":""}: ${h(r.keys,", ")}`;case"invalid_key":return`${r.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${r.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function ha(){return{localeError:sy()}}function Tm(e,t,n,i){let r=Math.abs(e),o=r%10,s=r%100;if(s>=11&&s<=19)return i;if(o===1)return t;if(o>=2&&o<=4)return n;return i}var ay=()=>{let e={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"лік";case"object":{if(Array.isArray(r))return"масіў";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"};return(r)=>{switch(r.code){case"invalid_type":return`Няправільны ўвод: чакаўся ${r.expected}, атрымана ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Няправільны ўвод: чакалася ${k(r.values[0])}`;return`Няправільны варыянт: чакаўся адзін з ${h(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s){let a=Number(r.maximum),l=Tm(a,s.unit.one,s.unit.few,s.unit.many);return`Занадта вялікі: чакалася, што ${r.origin??"значэнне"} павінна ${s.verb} ${o}${r.maximum.toString()} ${l}`}return`Занадта вялікі: чакалася, што ${r.origin??"значэнне"} павінна быць ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s){let a=Number(r.minimum),l=Tm(a,s.unit.one,s.unit.few,s.unit.many);return`Занадта малы: чакалася, што ${r.origin} павінна ${s.verb} ${o}${r.minimum.toString()} ${l}`}return`Занадта малы: чакалася, што ${r.origin} павінна быць ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`Няправільны радок: павінен пачынацца з "${o.prefix}"`;if(o.format==="ends_with")return`Няправільны радок: павінен заканчвацца на "${o.suffix}"`;if(o.format==="includes")return`Няправільны радок: павінен змяшчаць "${o.includes}"`;if(o.format==="regex")return`Няправільны радок: павінен адпавядаць шаблону ${o.pattern}`;return`Няправільны ${i[o.format]??r.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${r.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${r.keys.length>1?"ключы":"ключ"}: ${h(r.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${r.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${r.origin}`;default:return"Няправільны ўвод"}}};function va(){return{localeError:ay()}}var ly=()=>{let e={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(r)=>{switch(r.code){case"invalid_type":return`Tipus invàlid: s'esperava ${r.expected}, s'ha rebut ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Valor invàlid: s'esperava ${k(r.values[0])}`;return`Opció invàlida: s'esperava una de ${h(r.values," o ")}`;case"too_big":{let o=r.inclusive?"com a màxim":"menys de",s=t(r.origin);if(s)return`Massa gran: s'esperava que ${r.origin??"el valor"} contingués ${o} ${r.maximum.toString()} ${s.unit??"elements"}`;return`Massa gran: s'esperava que ${r.origin??"el valor"} fos ${o} ${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?"com a mínim":"més de",s=t(r.origin);if(s)return`Massa petit: s'esperava que ${r.origin} contingués ${o} ${r.minimum.toString()} ${s.unit}`;return`Massa petit: s'esperava que ${r.origin} fos ${o} ${r.minimum.toString()}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`Format invàlid: ha de començar amb "${o.prefix}"`;if(o.format==="ends_with")return`Format invàlid: ha d'acabar amb "${o.suffix}"`;if(o.format==="includes")return`Format invàlid: ha d'incloure "${o.includes}"`;if(o.format==="regex")return`Format invàlid: ha de coincidir amb el patró ${o.pattern}`;return`Format invàlid per a ${i[o.format]??r.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${r.divisor}`;case"unrecognized_keys":return`Clau${r.keys.length>1?"s":""} no reconeguda${r.keys.length>1?"s":""}: ${h(r.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${r.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${r.origin}`;default:return"Entrada invàlida"}}};function ya(){return{localeError:ly()}}var cy=()=>{let e={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"číslo";case"string":return"řetězec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(r))return"pole";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"regulární výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"};return(r)=>{switch(r.code){case"invalid_type":return`Neplatný vstup: očekáváno ${r.expected}, obdrženo ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Neplatný vstup: očekáváno ${k(r.values[0])}`;return`Neplatná možnost: očekávána jedna z hodnot ${h(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Hodnota je příliš velká: ${r.origin??"hodnota"} musí mít ${o}${r.maximum.toString()} ${s.unit??"prvků"}`;return`Hodnota je příliš velká: ${r.origin??"hodnota"} musí být ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`Hodnota je příliš malá: ${r.origin??"hodnota"} musí mít ${o}${r.minimum.toString()} ${s.unit??"prvků"}`;return`Hodnota je příliš malá: ${r.origin??"hodnota"} musí být ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`Neplatný řetězec: musí začínat na "${o.prefix}"`;if(o.format==="ends_with")return`Neplatný řetězec: musí končit na "${o.suffix}"`;if(o.format==="includes")return`Neplatný řetězec: musí obsahovat "${o.includes}"`;if(o.format==="regex")return`Neplatný řetězec: musí odpovídat vzoru ${o.pattern}`;return`Neplatný formát ${i[o.format]??r.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${r.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${h(r.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${r.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${r.origin}`;default:return"Neplatný vstup"}}};function ba(){return{localeError:cy()}}var uy=()=>{let e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}},t={string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"};function n(s){return e[s]??null}function i(s){return t[s]??s}let r=(s)=>{let a=typeof s;switch(a){case"number":return Number.isNaN(s)?"NaN":"tal";case"object":{if(Array.isArray(s))return"liste";if(s===null)return"null";if(Object.getPrototypeOf(s)!==Object.prototype&&s.constructor)return s.constructor.name;return"objekt"}}return a},o={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslæt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return(s)=>{switch(s.code){case"invalid_type":return`Ugyldigt input: forventede ${i(s.expected)}, fik ${i(r(s.input))}`;case"invalid_value":if(s.values.length===1)return`Ugyldig værdi: forventede ${k(s.values[0])}`;return`Ugyldigt valg: forventede en af følgende ${h(s.values,"|")}`;case"too_big":{let a=s.inclusive?"<=":"<",l=n(s.origin),c=i(s.origin);if(l)return`For stor: forventede ${c??"value"} ${l.verb} ${a} ${s.maximum.toString()} ${l.unit??"elementer"}`;return`For stor: forventede ${c??"value"} havde ${a} ${s.maximum.toString()}`}case"too_small":{let a=s.inclusive?">=":">",l=n(s.origin),c=i(s.origin);if(l)return`For lille: forventede ${c} ${l.verb} ${a} ${s.minimum.toString()} ${l.unit}`;return`For lille: forventede ${c} havde ${a} ${s.minimum.toString()}`}case"invalid_format":{let a=s;if(a.format==="starts_with")return`Ugyldig streng: skal starte med "${a.prefix}"`;if(a.format==="ends_with")return`Ugyldig streng: skal ende med "${a.suffix}"`;if(a.format==="includes")return`Ugyldig streng: skal indeholde "${a.includes}"`;if(a.format==="regex")return`Ugyldig streng: skal matche mønsteret ${a.pattern}`;return`Ugyldig ${o[a.format]??s.format}`}case"not_multiple_of":return`Ugyldigt tal: skal være deleligt med ${s.divisor}`;case"unrecognized_keys":return`${s.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${h(s.keys,", ")}`;case"invalid_key":return`Ugyldig nøgle i ${s.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig værdi i ${s.origin}`;default:return"Ugyldigt input"}}};function _a(){return{localeError:uy()}}var dy=()=>{let e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"Zahl";case"object":{if(Array.isArray(r))return"Array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return(r)=>{switch(r.code){case"invalid_type":return`Ungültige Eingabe: erwartet ${r.expected}, erhalten ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Ungültige Eingabe: erwartet ${k(r.values[0])}`;return`Ungültige Option: erwartet eine von ${h(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Zu groß: erwartet, dass ${r.origin??"Wert"} ${o}${r.maximum.toString()} ${s.unit??"Elemente"} hat`;return`Zu groß: erwartet, dass ${r.origin??"Wert"} ${o}${r.maximum.toString()} ist`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`Zu klein: erwartet, dass ${r.origin} ${o}${r.minimum.toString()} ${s.unit} hat`;return`Zu klein: erwartet, dass ${r.origin} ${o}${r.minimum.toString()} ist`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`Ungültiger String: muss mit "${o.prefix}" beginnen`;if(o.format==="ends_with")return`Ungültiger String: muss mit "${o.suffix}" enden`;if(o.format==="includes")return`Ungültiger String: muss "${o.includes}" enthalten`;if(o.format==="regex")return`Ungültiger String: muss dem Muster ${o.pattern} entsprechen`;return`Ungültig: ${i[o.format]??r.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${r.divisor} sein`;case"unrecognized_keys":return`${r.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${h(r.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${r.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${r.origin}`;default:return"Ungültige Eingabe"}}};function ka(){return{localeError:dy()}}var my=(e)=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},py=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function t(i){return e[i]??null}let n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return(i)=>{switch(i.code){case"invalid_type":return`Invalid input: expected ${i.expected}, received ${my(i.input)}`;case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${k(i.values[0])}`;return`Invalid option: expected one of ${h(i.values,"|")}`;case"too_big":{let r=i.inclusive?"<=":"<",o=t(i.origin);if(o)return`Too big: expected ${i.origin??"value"} to have ${r}${i.maximum.toString()} ${o.unit??"elements"}`;return`Too big: expected ${i.origin??"value"} to be ${r}${i.maximum.toString()}`}case"too_small":{let r=i.inclusive?">=":">",o=t(i.origin);if(o)return`Too small: expected ${i.origin} to have ${r}${i.minimum.toString()} ${o.unit}`;return`Too small: expected ${i.origin} to be ${r}${i.minimum.toString()}`}case"invalid_format":{let r=i;if(r.format==="starts_with")return`Invalid string: must start with "${r.prefix}"`;if(r.format==="ends_with")return`Invalid string: must end with "${r.suffix}"`;if(r.format==="includes")return`Invalid string: must include "${r.includes}"`;if(r.format==="regex")return`Invalid string: must match pattern ${r.pattern}`;return`Invalid ${n[r.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${h(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function dr(){return{localeError:py()}}var fy=(e)=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"nombro";case"object":{if(Array.isArray(e))return"tabelo";if(e===null)return"senvalora";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},gy=()=>{let e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function t(i){return e[i]??null}let n={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"};return(i)=>{switch(i.code){case"invalid_type":return`Nevalida enigo: atendiĝis ${i.expected}, riceviĝis ${fy(i.input)}`;case"invalid_value":if(i.values.length===1)return`Nevalida enigo: atendiĝis ${k(i.values[0])}`;return`Nevalida opcio: atendiĝis unu el ${h(i.values,"|")}`;case"too_big":{let r=i.inclusive?"<=":"<",o=t(i.origin);if(o)return`Tro granda: atendiĝis ke ${i.origin??"valoro"} havu ${r}${i.maximum.toString()} ${o.unit??"elementojn"}`;return`Tro granda: atendiĝis ke ${i.origin??"valoro"} havu ${r}${i.maximum.toString()}`}case"too_small":{let r=i.inclusive?">=":">",o=t(i.origin);if(o)return`Tro malgranda: atendiĝis ke ${i.origin} havu ${r}${i.minimum.toString()} ${o.unit}`;return`Tro malgranda: atendiĝis ke ${i.origin} estu ${r}${i.minimum.toString()}`}case"invalid_format":{let r=i;if(r.format==="starts_with")return`Nevalida karaktraro: devas komenciĝi per "${r.prefix}"`;if(r.format==="ends_with")return`Nevalida karaktraro: devas finiĝi per "${r.suffix}"`;if(r.format==="includes")return`Nevalida karaktraro: devas inkluzivi "${r.includes}"`;if(r.format==="regex")return`Nevalida karaktraro: devas kongrui kun la modelo ${r.pattern}`;return`Nevalida ${n[r.format]??i.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${i.divisor}`;case"unrecognized_keys":return`Nekonata${i.keys.length>1?"j":""} ŝlosilo${i.keys.length>1?"j":""}: ${h(i.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${i.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${i.origin}`;default:return"Nevalida enigo"}}};function wa(){return{localeError:gy()}}var hy=()=>{let e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}},t={string:"texto",number:"número",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"número grande",symbol:"símbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacío",never:"nunca",unknown:"desconocido",any:"cualquiera"};function n(s){return e[s]??null}function i(s){return t[s]??s}let r=(s)=>{let a=typeof s;switch(a){case"number":return Number.isNaN(s)?"NaN":"number";case"object":{if(Array.isArray(s))return"array";if(s===null)return"null";if(Object.getPrototypeOf(s)!==Object.prototype)return s.constructor.name;return"object"}}return a},o={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(s)=>{switch(s.code){case"invalid_type":return`Entrada inválida: se esperaba ${i(s.expected)}, recibido ${i(r(s.input))}`;case"invalid_value":if(s.values.length===1)return`Entrada inválida: se esperaba ${k(s.values[0])}`;return`Opción inválida: se esperaba una de ${h(s.values,"|")}`;case"too_big":{let a=s.inclusive?"<=":"<",l=n(s.origin),c=i(s.origin);if(l)return`Demasiado grande: se esperaba que ${c??"valor"} tuviera ${a}${s.maximum.toString()} ${l.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${c??"valor"} fuera ${a}${s.maximum.toString()}`}case"too_small":{let a=s.inclusive?">=":">",l=n(s.origin),c=i(s.origin);if(l)return`Demasiado pequeño: se esperaba que ${c} tuviera ${a}${s.minimum.toString()} ${l.unit}`;return`Demasiado pequeño: se esperaba que ${c} fuera ${a}${s.minimum.toString()}`}case"invalid_format":{let a=s;if(a.format==="starts_with")return`Cadena inválida: debe comenzar con "${a.prefix}"`;if(a.format==="ends_with")return`Cadena inválida: debe terminar en "${a.suffix}"`;if(a.format==="includes")return`Cadena inválida: debe incluir "${a.includes}"`;if(a.format==="regex")return`Cadena inválida: debe coincidir con el patrón ${a.pattern}`;return`Inválido ${o[a.format]??s.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${s.divisor}`;case"unrecognized_keys":return`Llave${s.keys.length>1?"s":""} desconocida${s.keys.length>1?"s":""}: ${h(s.keys,", ")}`;case"invalid_key":return`Llave inválida en ${i(s.origin)}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${i(s.origin)}`;default:return"Entrada inválida"}}};function xa(){return{localeError:hy()}}var vy=()=>{let e={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"عدد";case"object":{if(Array.isArray(r))return"آرایه";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"};return(r)=>{switch(r.code){case"invalid_type":return`ورودی نامعتبر: می‌بایست ${r.expected} می‌بود، ${n(r.input)} دریافت شد`;case"invalid_value":if(r.values.length===1)return`ورودی نامعتبر: می‌بایست ${k(r.values[0])} می‌بود`;return`گزینه نامعتبر: می‌بایست یکی از ${h(r.values,"|")} می‌بود`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`خیلی بزرگ: ${r.origin??"مقدار"} باید ${o}${r.maximum.toString()} ${s.unit??"عنصر"} باشد`;return`خیلی بزرگ: ${r.origin??"مقدار"} باید ${o}${r.maximum.toString()} باشد`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`خیلی کوچک: ${r.origin} باید ${o}${r.minimum.toString()} ${s.unit} باشد`;return`خیلی کوچک: ${r.origin} باید ${o}${r.minimum.toString()} باشد`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`رشته نامعتبر: باید با "${o.prefix}" شروع شود`;if(o.format==="ends_with")return`رشته نامعتبر: باید با "${o.suffix}" تمام شود`;if(o.format==="includes")return`رشته نامعتبر: باید شامل "${o.includes}" باشد`;if(o.format==="regex")return`رشته نامعتبر: باید با الگوی ${o.pattern} مطابقت داشته باشد`;return`${i[o.format]??r.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${r.divisor} باشد`;case"unrecognized_keys":return`کلید${r.keys.length>1?"های":""} ناشناس: ${h(r.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${r.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${r.origin}`;default:return"ورودی نامعتبر"}}};function $a(){return{localeError:vy()}}var yy=()=>{let e={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return(r)=>{switch(r.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${r.expected}, oli ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Virheellinen syöte: täytyy olla ${k(r.values[0])}`;return`Virheellinen valinta: täytyy olla yksi seuraavista: ${h(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Liian suuri: ${s.subject} täytyy olla ${o}${r.maximum.toString()} ${s.unit}`.trim();return`Liian suuri: arvon täytyy olla ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`Liian pieni: ${s.subject} täytyy olla ${o}${r.minimum.toString()} ${s.unit}`.trim();return`Liian pieni: arvon täytyy olla ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`Virheellinen syöte: täytyy alkaa "${o.prefix}"`;if(o.format==="ends_with")return`Virheellinen syöte: täytyy loppua "${o.suffix}"`;if(o.format==="includes")return`Virheellinen syöte: täytyy sisältää "${o.includes}"`;if(o.format==="regex")return`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${o.pattern}`;return`Virheellinen ${i[o.format]??r.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${r.divisor} monikerta`;case"unrecognized_keys":return`${r.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${h(r.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function Sa(){return{localeError:yy()}}var by=()=>{let e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"nombre";case"object":{if(Array.isArray(r))return"tableau";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"entrée",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return(r)=>{switch(r.code){case"invalid_type":return`Entrée invalide : ${r.expected} attendu, ${n(r.input)} reçu`;case"invalid_value":if(r.values.length===1)return`Entrée invalide : ${k(r.values[0])} attendu`;return`Option invalide : une valeur parmi ${h(r.values,"|")} attendue`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Trop grand : ${r.origin??"valeur"} doit ${s.verb} ${o}${r.maximum.toString()} ${s.unit??"élément(s)"}`;return`Trop grand : ${r.origin??"valeur"} doit être ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`Trop petit : ${r.origin} doit ${s.verb} ${o}${r.minimum.toString()} ${s.unit}`;return`Trop petit : ${r.origin} doit être ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`Chaîne invalide : doit commencer par "${o.prefix}"`;if(o.format==="ends_with")return`Chaîne invalide : doit se terminer par "${o.suffix}"`;if(o.format==="includes")return`Chaîne invalide : doit inclure "${o.includes}"`;if(o.format==="regex")return`Chaîne invalide : doit correspondre au modèle ${o.pattern}`;return`${i[o.format]??r.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${r.divisor}`;case"unrecognized_keys":return`Clé${r.keys.length>1?"s":""} non reconnue${r.keys.length>1?"s":""} : ${h(r.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${r.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${r.origin}`;default:return"Entrée invalide"}}};function Ia(){return{localeError:by()}}var _y=()=>{let e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return(r)=>{switch(r.code){case"invalid_type":return`Entrée invalide : attendu ${r.expected}, reçu ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Entrée invalide : attendu ${k(r.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${h(r.values,"|")}`;case"too_big":{let o=r.inclusive?"≤":"<",s=t(r.origin);if(s)return`Trop grand : attendu que ${r.origin??"la valeur"} ait ${o}${r.maximum.toString()} ${s.unit}`;return`Trop grand : attendu que ${r.origin??"la valeur"} soit ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?"≥":">",s=t(r.origin);if(s)return`Trop petit : attendu que ${r.origin} ait ${o}${r.minimum.toString()} ${s.unit}`;return`Trop petit : attendu que ${r.origin} soit ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`Chaîne invalide : doit commencer par "${o.prefix}"`;if(o.format==="ends_with")return`Chaîne invalide : doit se terminer par "${o.suffix}"`;if(o.format==="includes")return`Chaîne invalide : doit inclure "${o.includes}"`;if(o.format==="regex")return`Chaîne invalide : doit correspondre au motif ${o.pattern}`;return`${i[o.format]??r.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${r.divisor}`;case"unrecognized_keys":return`Clé${r.keys.length>1?"s":""} non reconnue${r.keys.length>1?"s":""} : ${h(r.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${r.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${r.origin}`;default:return"Entrée invalide"}}};function Ta(){return{localeError:_y()}}var ky=()=>{let e={string:{unit:"אותיות",verb:"לכלול"},file:{unit:"בייטים",verb:"לכלול"},array:{unit:"פריטים",verb:"לכלול"},set:{unit:"פריטים",verb:"לכלול"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"קלט",email:"כתובת אימייל",url:"כתובת רשת",emoji:"אימוג'י",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"תאריך וזמן ISO",date:"תאריך ISO",time:"זמן ISO",duration:"משך זמן ISO",ipv4:"כתובת IPv4",ipv6:"כתובת IPv6",cidrv4:"טווח IPv4",cidrv6:"טווח IPv6",base64:"מחרוזת בבסיס 64",base64url:"מחרוזת בבסיס 64 לכתובות רשת",json_string:"מחרוזת JSON",e164:"מספר E.164",jwt:"JWT",template_literal:"קלט"};return(r)=>{switch(r.code){case"invalid_type":return`קלט לא תקין: צריך ${r.expected}, התקבל ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`קלט לא תקין: צריך ${k(r.values[0])}`;return`קלט לא תקין: צריך אחת מהאפשרויות ${h(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`גדול מדי: ${r.origin??"value"} צריך להיות ${o}${r.maximum.toString()} ${s.unit??"elements"}`;return`גדול מדי: ${r.origin??"value"} צריך להיות ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`קטן מדי: ${r.origin} צריך להיות ${o}${r.minimum.toString()} ${s.unit}`;return`קטן מדי: ${r.origin} צריך להיות ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`מחרוזת לא תקינה: חייבת להתחיל ב"${o.prefix}"`;if(o.format==="ends_with")return`מחרוזת לא תקינה: חייבת להסתיים ב "${o.suffix}"`;if(o.format==="includes")return`מחרוזת לא תקינה: חייבת לכלול "${o.includes}"`;if(o.format==="regex")return`מחרוזת לא תקינה: חייבת להתאים לתבנית ${o.pattern}`;return`${i[o.format]??r.format} לא תקין`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${r.divisor}`;case"unrecognized_keys":return`מפתח${r.keys.length>1?"ות":""} לא מזוה${r.keys.length>1?"ים":"ה"}: ${h(r.keys,", ")}`;case"invalid_key":return`מפתח לא תקין ב${r.origin}`;case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${r.origin}`;default:return"קלט לא תקין"}}};function Da(){return{localeError:ky()}}var wy=()=>{let e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"szám";case"object":{if(Array.isArray(r))return"tömb";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"bemenet",email:"email cím",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"};return(r)=>{switch(r.code){case"invalid_type":return`Érvénytelen bemenet: a várt érték ${r.expected}, a kapott érték ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Érvénytelen bemenet: a várt érték ${k(r.values[0])}`;return`Érvénytelen opció: valamelyik érték várt ${h(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Túl nagy: ${r.origin??"érték"} mérete túl nagy ${o}${r.maximum.toString()} ${s.unit??"elem"}`;return`Túl nagy: a bemeneti érték ${r.origin??"érték"} túl nagy: ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`Túl kicsi: a bemeneti érték ${r.origin} mérete túl kicsi ${o}${r.minimum.toString()} ${s.unit}`;return`Túl kicsi: a bemeneti érték ${r.origin} túl kicsi ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`Érvénytelen string: "${o.prefix}" értékkel kell kezdődnie`;if(o.format==="ends_with")return`Érvénytelen string: "${o.suffix}" értékkel kell végződnie`;if(o.format==="includes")return`Érvénytelen string: "${o.includes}" értéket kell tartalmaznia`;if(o.format==="regex")return`Érvénytelen string: ${o.pattern} mintának kell megfelelnie`;return`Érvénytelen ${i[o.format]??r.format}`}case"not_multiple_of":return`Érvénytelen szám: ${r.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${r.keys.length>1?"s":""}: ${h(r.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${r.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${r.origin}`;default:return"Érvénytelen bemenet"}}};function Pa(){return{localeError:wy()}}var xy=()=>{let e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return(r)=>{switch(r.code){case"invalid_type":return`Input tidak valid: diharapkan ${r.expected}, diterima ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Input tidak valid: diharapkan ${k(r.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${h(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Terlalu besar: diharapkan ${r.origin??"value"} memiliki ${o}${r.maximum.toString()} ${s.unit??"elemen"}`;return`Terlalu besar: diharapkan ${r.origin??"value"} menjadi ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`Terlalu kecil: diharapkan ${r.origin} memiliki ${o}${r.minimum.toString()} ${s.unit}`;return`Terlalu kecil: diharapkan ${r.origin} menjadi ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`String tidak valid: harus dimulai dengan "${o.prefix}"`;if(o.format==="ends_with")return`String tidak valid: harus berakhir dengan "${o.suffix}"`;if(o.format==="includes")return`String tidak valid: harus menyertakan "${o.includes}"`;if(o.format==="regex")return`String tidak valid: harus sesuai pola ${o.pattern}`;return`${i[o.format]??r.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${r.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${r.keys.length>1?"s":""}: ${h(r.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${r.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${r.origin}`;default:return"Input tidak valid"}}};function Oa(){return{localeError:xy()}}var $y=(e)=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"númer";case"object":{if(Array.isArray(e))return"fylki";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},Sy=()=>{let e={string:{unit:"stafi",verb:"að hafa"},file:{unit:"bæti",verb:"að hafa"},array:{unit:"hluti",verb:"að hafa"},set:{unit:"hluti",verb:"að hafa"}};function t(i){return e[i]??null}let n={regex:"gildi",email:"netfang",url:"vefslóð",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og tími",date:"ISO dagsetning",time:"ISO tími",duration:"ISO tímalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 tölugildi",jwt:"JWT",template_literal:"gildi"};return(i)=>{switch(i.code){case"invalid_type":return`Rangt gildi: Þú slóst inn ${$y(i.input)} þar sem á að vera ${i.expected}`;case"invalid_value":if(i.values.length===1)return`Rangt gildi: gert ráð fyrir ${k(i.values[0])}`;return`Ógilt val: má vera eitt af eftirfarandi ${h(i.values,"|")}`;case"too_big":{let r=i.inclusive?"<=":"<",o=t(i.origin);if(o)return`Of stórt: gert er ráð fyrir að ${i.origin??"gildi"} hafi ${r}${i.maximum.toString()} ${o.unit??"hluti"}`;return`Of stórt: gert er ráð fyrir að ${i.origin??"gildi"} sé ${r}${i.maximum.toString()}`}case"too_small":{let r=i.inclusive?">=":">",o=t(i.origin);if(o)return`Of lítið: gert er ráð fyrir að ${i.origin} hafi ${r}${i.minimum.toString()} ${o.unit}`;return`Of lítið: gert er ráð fyrir að ${i.origin} sé ${r}${i.minimum.toString()}`}case"invalid_format":{let r=i;if(r.format==="starts_with")return`Ógildur strengur: verður að byrja á "${r.prefix}"`;if(r.format==="ends_with")return`Ógildur strengur: verður að enda á "${r.suffix}"`;if(r.format==="includes")return`Ógildur strengur: verður að innihalda "${r.includes}"`;if(r.format==="regex")return`Ógildur strengur: verður að fylgja mynstri ${r.pattern}`;return`Rangt ${n[r.format]??i.format}`}case"not_multiple_of":return`Röng tala: verður að vera margfeldi af ${i.divisor}`;case"unrecognized_keys":return`Óþekkt ${i.keys.length>1?"ir lyklar":"ur lykill"}: ${h(i.keys,", ")}`;case"invalid_key":return`Rangur lykill í ${i.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi í ${i.origin}`;default:return"Rangt gildi"}}};function Ea(){return{localeError:Sy()}}var Iy=()=>{let e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"numero";case"object":{if(Array.isArray(r))return"vettore";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return(r)=>{switch(r.code){case"invalid_type":return`Input non valido: atteso ${r.expected}, ricevuto ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Input non valido: atteso ${k(r.values[0])}`;return`Opzione non valida: atteso uno tra ${h(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Troppo grande: ${r.origin??"valore"} deve avere ${o}${r.maximum.toString()} ${s.unit??"elementi"}`;return`Troppo grande: ${r.origin??"valore"} deve essere ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`Troppo piccolo: ${r.origin} deve avere ${o}${r.minimum.toString()} ${s.unit}`;return`Troppo piccolo: ${r.origin} deve essere ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`Stringa non valida: deve iniziare con "${o.prefix}"`;if(o.format==="ends_with")return`Stringa non valida: deve terminare con "${o.suffix}"`;if(o.format==="includes")return`Stringa non valida: deve includere "${o.includes}"`;if(o.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${o.pattern}`;return`Invalid ${i[o.format]??r.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${r.divisor}`;case"unrecognized_keys":return`Chiav${r.keys.length>1?"i":"e"} non riconosciut${r.keys.length>1?"e":"a"}: ${h(r.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${r.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${r.origin}`;default:return"Input non valido"}}};function Ra(){return{localeError:Iy()}}var Ty=()=>{let e={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"数値";case"object":{if(Array.isArray(r))return"配列";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"};return(r)=>{switch(r.code){case"invalid_type":return`無効な入力: ${r.expected}が期待されましたが、${n(r.input)}が入力されました`;case"invalid_value":if(r.values.length===1)return`無効な入力: ${k(r.values[0])}が期待されました`;return`無効な選択: ${h(r.values,"、")}のいずれかである必要があります`;case"too_big":{let o=r.inclusive?"以下である":"より小さい",s=t(r.origin);if(s)return`大きすぎる値: ${r.origin??"値"}は${r.maximum.toString()}${s.unit??"要素"}${o}必要があります`;return`大きすぎる値: ${r.origin??"値"}は${r.maximum.toString()}${o}必要があります`}case"too_small":{let o=r.inclusive?"以上である":"より大きい",s=t(r.origin);if(s)return`小さすぎる値: ${r.origin}は${r.minimum.toString()}${s.unit}${o}必要があります`;return`小さすぎる値: ${r.origin}は${r.minimum.toString()}${o}必要があります`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`無効な文字列: "${o.prefix}"で始まる必要があります`;if(o.format==="ends_with")return`無効な文字列: "${o.suffix}"で終わる必要があります`;if(o.format==="includes")return`無効な文字列: "${o.includes}"を含む必要があります`;if(o.format==="regex")return`無効な文字列: パターン${o.pattern}に一致する必要があります`;return`無効な${i[o.format]??r.format}`}case"not_multiple_of":return`無効な数値: ${r.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${r.keys.length>1?"群":""}: ${h(r.keys,"、")}`;case"invalid_key":return`${r.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${r.origin}内の無効な値`;default:return"無効な入力"}}};function za(){return{localeError:Ty()}}var Dy=(e)=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"რიცხვი";case"object":{if(Array.isArray(e))return"მასივი";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return{string:"სტრინგი",boolean:"ბულეანი",undefined:"undefined",bigint:"bigint",symbol:"symbol",function:"ფუნქცია"}[t]??t},Py=()=>{let e={string:{unit:"სიმბოლო",verb:"უნდა შეიცავდეს"},file:{unit:"ბაიტი",verb:"უნდა შეიცავდეს"},array:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},set:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"}};function t(i){return e[i]??null}let n={regex:"შეყვანა",email:"ელ-ფოსტის მისამართი",url:"URL",emoji:"ემოჯი",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"თარიღი-დრო",date:"თარიღი",time:"დრო",duration:"ხანგრძლივობა",ipv4:"IPv4 მისამართი",ipv6:"IPv6 მისამართი",cidrv4:"IPv4 დიაპაზონი",cidrv6:"IPv6 დიაპაზონი",base64:"base64-კოდირებული სტრინგი",base64url:"base64url-კოდირებული სტრინგი",json_string:"JSON სტრინგი",e164:"E.164 ნომერი",jwt:"JWT",template_literal:"შეყვანა"};return(i)=>{switch(i.code){case"invalid_type":return`არასწორი შეყვანა: მოსალოდნელი ${i.expected}, მიღებული ${Dy(i.input)}`;case"invalid_value":if(i.values.length===1)return`არასწორი შეყვანა: მოსალოდნელი ${k(i.values[0])}`;return`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${h(i.values,"|")}-დან`;case"too_big":{let r=i.inclusive?"<=":"<",o=t(i.origin);if(o)return`ზედმეტად დიდი: მოსალოდნელი ${i.origin??"მნიშვნელობა"} ${o.verb} ${r}${i.maximum.toString()} ${o.unit}`;return`ზედმეტად დიდი: მოსალოდნელი ${i.origin??"მნიშვნელობა"} იყოს ${r}${i.maximum.toString()}`}case"too_small":{let r=i.inclusive?">=":">",o=t(i.origin);if(o)return`ზედმეტად პატარა: მოსალოდნელი ${i.origin} ${o.verb} ${r}${i.minimum.toString()} ${o.unit}`;return`ზედმეტად პატარა: მოსალოდნელი ${i.origin} იყოს ${r}${i.minimum.toString()}`}case"invalid_format":{let r=i;if(r.format==="starts_with")return`არასწორი სტრინგი: უნდა იწყებოდეს "${r.prefix}"-ით`;if(r.format==="ends_with")return`არასწორი სტრინგი: უნდა მთავრდებოდეს "${r.suffix}"-ით`;if(r.format==="includes")return`არასწორი სტრინგი: უნდა შეიცავდეს "${r.includes}"-ს`;if(r.format==="regex")return`არასწორი სტრინგი: უნდა შეესაბამებოდეს შაბლონს ${r.pattern}`;return`არასწორი ${n[r.format]??i.format}`}case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${i.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${i.keys.length>1?"ები":"ი"}: ${h(i.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${i.origin}-ში`;case"invalid_union":return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${i.origin}-ში`;default:return"არასწორი შეყვანა"}}};function Ca(){return{localeError:Py()}}var Oy=()=>{let e={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"មិនមែនជាលេខ (NaN)":"លេខ";case"object":{if(Array.isArray(r))return"អារេ (Array)";if(r===null)return"គ្មានតម្លៃ (null)";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"};return(r)=>{switch(r.code){case"invalid_type":return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${r.expected} ប៉ុន្តែទទួលបាន ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${k(r.values[0])}`;return`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${h(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`ធំពេក៖ ត្រូវការ ${r.origin??"តម្លៃ"} ${o} ${r.maximum.toString()} ${s.unit??"ធាតុ"}`;return`ធំពេក៖ ត្រូវការ ${r.origin??"តម្លៃ"} ${o} ${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`តូចពេក៖ ត្រូវការ ${r.origin} ${o} ${r.minimum.toString()} ${s.unit}`;return`តូចពេក៖ ត្រូវការ ${r.origin} ${o} ${r.minimum.toString()}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${o.prefix}"`;if(o.format==="ends_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${o.suffix}"`;if(o.format==="includes")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${o.includes}"`;if(o.format==="regex")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${o.pattern}`;return`មិនត្រឹមត្រូវ៖ ${i[o.format]??r.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${r.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${h(r.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${r.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${r.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function mr(){return{localeError:Oy()}}function Aa(){return mr()}var Ey=()=>{let e={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"};return(r)=>{switch(r.code){case"invalid_type":return`잘못된 입력: 예상 타입은 ${r.expected}, 받은 타입은 ${n(r.input)}입니다`;case"invalid_value":if(r.values.length===1)return`잘못된 입력: 값은 ${k(r.values[0])} 이어야 합니다`;return`잘못된 옵션: ${h(r.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{let o=r.inclusive?"이하":"미만",s=o==="미만"?"이어야 합니다":"여야 합니다",a=t(r.origin),l=a?.unit??"요소";if(a)return`${r.origin??"값"}이 너무 큽니다: ${r.maximum.toString()}${l} ${o}${s}`;return`${r.origin??"값"}이 너무 큽니다: ${r.maximum.toString()} ${o}${s}`}case"too_small":{let o=r.inclusive?"이상":"초과",s=o==="이상"?"이어야 합니다":"여야 합니다",a=t(r.origin),l=a?.unit??"요소";if(a)return`${r.origin??"값"}이 너무 작습니다: ${r.minimum.toString()}${l} ${o}${s}`;return`${r.origin??"값"}이 너무 작습니다: ${r.minimum.toString()} ${o}${s}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`잘못된 문자열: "${o.prefix}"(으)로 시작해야 합니다`;if(o.format==="ends_with")return`잘못된 문자열: "${o.suffix}"(으)로 끝나야 합니다`;if(o.format==="includes")return`잘못된 문자열: "${o.includes}"을(를) 포함해야 합니다`;if(o.format==="regex")return`잘못된 문자열: 정규식 ${o.pattern} 패턴과 일치해야 합니다`;return`잘못된 ${i[o.format]??r.format}`}case"not_multiple_of":return`잘못된 숫자: ${r.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${h(r.keys,", ")}`;case"invalid_key":return`잘못된 키: ${r.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${r.origin}`;default:return"잘못된 입력"}}};function Ma(){return{localeError:Ey()}}var Ry=(e)=>fr(typeof e,e),fr=(e,t=void 0)=>{switch(e){case"number":return Number.isNaN(t)?"NaN":"skaičius";case"bigint":return"sveikasis skaičius";case"string":return"eilutė";case"boolean":return"loginė reikšmė";case"undefined":case"void":return"neapibrėžta reikšmė";case"function":return"funkcija";case"symbol":return"simbolis";case"object":{if(t===void 0)return"nežinomas objektas";if(t===null)return"nulinė reikšmė";if(Array.isArray(t))return"masyvas";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name;return"objektas"}case"null":return"nulinė reikšmė"}return e},pr=(e)=>e.charAt(0).toUpperCase()+e.slice(1);function Dm(e){let t=Math.abs(e),n=t%10,i=t%100;if(i>=11&&i<=19||n===0)return"many";if(n===1)return"one";return"few"}var zy=()=>{let e={string:{unit:{one:"simbolis",few:"simboliai",many:"simbolių"},verb:{smaller:{inclusive:"turi būti ne ilgesnė kaip",notInclusive:"turi būti trumpesnė kaip"},bigger:{inclusive:"turi būti ne trumpesnė kaip",notInclusive:"turi būti ilgesnė kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"baitų"},verb:{smaller:{inclusive:"turi būti ne didesnis kaip",notInclusive:"turi būti mažesnis kaip"},bigger:{inclusive:"turi būti ne mažesnis kaip",notInclusive:"turi būti didesnis kaip"}}},array:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}},set:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}}};function t(i,r,o,s){let a=e[i]??null;if(a===null)return a;return{unit:a.unit[r],verb:a.verb[s][o?"inclusive":"notInclusive"]}}let n={regex:"įvestis",email:"el. pašto adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukmė",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 užkoduota eilutė",base64url:"base64url užkoduota eilutė",json_string:"JSON eilutė",e164:"E.164 numeris",jwt:"JWT",template_literal:"įvestis"};return(i)=>{switch(i.code){case"invalid_type":return`Gautas tipas ${Ry(i.input)}, o tikėtasi - ${fr(i.expected)}`;case"invalid_value":if(i.values.length===1)return`Privalo būti ${k(i.values[0])}`;return`Privalo būti vienas iš ${h(i.values,"|")} pasirinkimų`;case"too_big":{let r=fr(i.origin),o=t(i.origin,Dm(Number(i.maximum)),i.inclusive??!1,"smaller");if(o?.verb)return`${pr(r??i.origin??"reikšmė")} ${o.verb} ${i.maximum.toString()} ${o.unit??"elementų"}`;let s=i.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${pr(r??i.origin??"reikšmė")} turi būti ${s} ${i.maximum.toString()} ${o?.unit}`}case"too_small":{let r=fr(i.origin),o=t(i.origin,Dm(Number(i.minimum)),i.inclusive??!1,"bigger");if(o?.verb)return`${pr(r??i.origin??"reikšmė")} ${o.verb} ${i.minimum.toString()} ${o.unit??"elementų"}`;let s=i.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${pr(r??i.origin??"reikšmė")} turi būti ${s} ${i.minimum.toString()} ${o?.unit}`}case"invalid_format":{let r=i;if(r.format==="starts_with")return`Eilutė privalo prasidėti "${r.prefix}"`;if(r.format==="ends_with")return`Eilutė privalo pasibaigti "${r.suffix}"`;if(r.format==="includes")return`Eilutė privalo įtraukti "${r.includes}"`;if(r.format==="regex")return`Eilutė privalo atitikti ${r.pattern}`;return`Neteisingas ${n[r.format]??i.format}`}case"not_multiple_of":return`Skaičius privalo būti ${i.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${i.keys.length>1?"i":"as"} rakt${i.keys.length>1?"ai":"as"}: ${h(i.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga įvestis";case"invalid_element":{let r=fr(i.origin);return`${pr(r??i.origin??"reikšmė")} turi klaidingą įvestį`}default:return"Klaidinga įvestis"}}};function Na(){return{localeError:zy()}}var Cy=()=>{let e={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"број";case"object":{if(Array.isArray(r))return"низа";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"};return(r)=>{switch(r.code){case"invalid_type":return`Грешен внес: се очекува ${r.expected}, примено ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Invalid input: expected ${k(r.values[0])}`;return`Грешана опција: се очекува една ${h(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Премногу голем: се очекува ${r.origin??"вредноста"} да има ${o}${r.maximum.toString()} ${s.unit??"елементи"}`;return`Премногу голем: се очекува ${r.origin??"вредноста"} да биде ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`Премногу мал: се очекува ${r.origin} да има ${o}${r.minimum.toString()} ${s.unit}`;return`Премногу мал: се очекува ${r.origin} да биде ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`Неважечка низа: мора да започнува со "${o.prefix}"`;if(o.format==="ends_with")return`Неважечка низа: мора да завршува со "${o.suffix}"`;if(o.format==="includes")return`Неважечка низа: мора да вклучува "${o.includes}"`;if(o.format==="regex")return`Неважечка низа: мора да одгоара на патернот ${o.pattern}`;return`Invalid ${i[o.format]??r.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${h(r.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${r.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${r.origin}`;default:return"Грешен внес"}}};function ja(){return{localeError:Cy()}}var Ay=()=>{let e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"nombor";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return(r)=>{switch(r.code){case"invalid_type":return`Input tidak sah: dijangka ${r.expected}, diterima ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Input tidak sah: dijangka ${k(r.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${h(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Terlalu besar: dijangka ${r.origin??"nilai"} ${s.verb} ${o}${r.maximum.toString()} ${s.unit??"elemen"}`;return`Terlalu besar: dijangka ${r.origin??"nilai"} adalah ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`Terlalu kecil: dijangka ${r.origin} ${s.verb} ${o}${r.minimum.toString()} ${s.unit}`;return`Terlalu kecil: dijangka ${r.origin} adalah ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`String tidak sah: mesti bermula dengan "${o.prefix}"`;if(o.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${o.suffix}"`;if(o.format==="includes")return`String tidak sah: mesti mengandungi "${o.includes}"`;if(o.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${o.pattern}`;return`${i[o.format]??r.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${r.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${h(r.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${r.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${r.origin}`;default:return"Input tidak sah"}}};function Ua(){return{localeError:Ay()}}var My=()=>{let e={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"getal";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return(r)=>{switch(r.code){case"invalid_type":return`Ongeldige invoer: verwacht ${r.expected}, ontving ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Ongeldige invoer: verwacht ${k(r.values[0])}`;return`Ongeldige optie: verwacht één van ${h(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Te lang: verwacht dat ${r.origin??"waarde"} ${o}${r.maximum.toString()} ${s.unit??"elementen"} bevat`;return`Te lang: verwacht dat ${r.origin??"waarde"} ${o}${r.maximum.toString()} is`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`Te kort: verwacht dat ${r.origin} ${o}${r.minimum.toString()} ${s.unit} bevat`;return`Te kort: verwacht dat ${r.origin} ${o}${r.minimum.toString()} is`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`Ongeldige tekst: moet met "${o.prefix}" beginnen`;if(o.format==="ends_with")return`Ongeldige tekst: moet op "${o.suffix}" eindigen`;if(o.format==="includes")return`Ongeldige tekst: moet "${o.includes}" bevatten`;if(o.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${o.pattern}`;return`Ongeldig: ${i[o.format]??r.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${r.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${r.keys.length>1?"s":""}: ${h(r.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${r.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${r.origin}`;default:return"Ongeldige invoer"}}};function La(){return{localeError:My()}}var Ny=()=>{let e={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"tall";case"object":{if(Array.isArray(r))return"liste";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return(r)=>{switch(r.code){case"invalid_type":return`Ugyldig input: forventet ${r.expected}, fikk ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Ugyldig verdi: forventet ${k(r.values[0])}`;return`Ugyldig valg: forventet en av ${h(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`For stor(t): forventet ${r.origin??"value"} til å ha ${o}${r.maximum.toString()} ${s.unit??"elementer"}`;return`For stor(t): forventet ${r.origin??"value"} til å ha ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`For lite(n): forventet ${r.origin} til å ha ${o}${r.minimum.toString()} ${s.unit}`;return`For lite(n): forventet ${r.origin} til å ha ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`Ugyldig streng: må starte med "${o.prefix}"`;if(o.format==="ends_with")return`Ugyldig streng: må ende med "${o.suffix}"`;if(o.format==="includes")return`Ugyldig streng: må inneholde "${o.includes}"`;if(o.format==="regex")return`Ugyldig streng: må matche mønsteret ${o.pattern}`;return`Ugyldig ${i[o.format]??r.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${h(r.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${r.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${r.origin}`;default:return"Ugyldig input"}}};function Fa(){return{localeError:Ny()}}var jy=()=>{let e={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"numara";case"object":{if(Array.isArray(r))return"saf";if(r===null)return"gayb";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"};return(r)=>{switch(r.code){case"invalid_type":return`Fâsit giren: umulan ${r.expected}, alınan ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Fâsit giren: umulan ${k(r.values[0])}`;return`Fâsit tercih: mûteberler ${h(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Fazla büyük: ${r.origin??"value"}, ${o}${r.maximum.toString()} ${s.unit??"elements"} sahip olmalıydı.`;return`Fazla büyük: ${r.origin??"value"}, ${o}${r.maximum.toString()} olmalıydı.`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`Fazla küçük: ${r.origin}, ${o}${r.minimum.toString()} ${s.unit} sahip olmalıydı.`;return`Fazla küçük: ${r.origin}, ${o}${r.minimum.toString()} olmalıydı.`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`Fâsit metin: "${o.prefix}" ile başlamalı.`;if(o.format==="ends_with")return`Fâsit metin: "${o.suffix}" ile bitmeli.`;if(o.format==="includes")return`Fâsit metin: "${o.includes}" ihtivâ etmeli.`;if(o.format==="regex")return`Fâsit metin: ${o.pattern} nakşına uymalı.`;return`Fâsit ${i[o.format]??r.format}`}case"not_multiple_of":return`Fâsit sayı: ${r.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${r.keys.length>1?"s":""}: ${h(r.keys,", ")}`;case"invalid_key":return`${r.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${r.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function Ga(){return{localeError:jy()}}var Uy=()=>{let e={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"عدد";case"object":{if(Array.isArray(r))return"ارې";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"};return(r)=>{switch(r.code){case"invalid_type":return`ناسم ورودي: باید ${r.expected} وای, مګر ${n(r.input)} ترلاسه شو`;case"invalid_value":if(r.values.length===1)return`ناسم ورودي: باید ${k(r.values[0])} وای`;return`ناسم انتخاب: باید یو له ${h(r.values,"|")} څخه وای`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`ډیر لوی: ${r.origin??"ارزښت"} باید ${o}${r.maximum.toString()} ${s.unit??"عنصرونه"} ولري`;return`ډیر لوی: ${r.origin??"ارزښت"} باید ${o}${r.maximum.toString()} وي`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`ډیر کوچنی: ${r.origin} باید ${o}${r.minimum.toString()} ${s.unit} ولري`;return`ډیر کوچنی: ${r.origin} باید ${o}${r.minimum.toString()} وي`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`ناسم متن: باید د "${o.prefix}" سره پیل شي`;if(o.format==="ends_with")return`ناسم متن: باید د "${o.suffix}" سره پای ته ورسيږي`;if(o.format==="includes")return`ناسم متن: باید "${o.includes}" ولري`;if(o.format==="regex")return`ناسم متن: باید د ${o.pattern} سره مطابقت ولري`;return`${i[o.format]??r.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${r.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${r.keys.length>1?"کلیډونه":"کلیډ"}: ${h(r.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${r.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${r.origin} کې`;default:return"ناسمه ورودي"}}};function Za(){return{localeError:Uy()}}var Ly=()=>{let e={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"liczba";case"object":{if(Array.isArray(r))return"tablica";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"};return(r)=>{switch(r.code){case"invalid_type":return`Nieprawidłowe dane wejściowe: oczekiwano ${r.expected}, otrzymano ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Nieprawidłowe dane wejściowe: oczekiwano ${k(r.values[0])}`;return`Nieprawidłowa opcja: oczekiwano jednej z wartości ${h(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Za duża wartość: oczekiwano, że ${r.origin??"wartość"} będzie mieć ${o}${r.maximum.toString()} ${s.unit??"elementów"}`;return`Zbyt duż(y/a/e): oczekiwano, że ${r.origin??"wartość"} będzie wynosić ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`Za mała wartość: oczekiwano, że ${r.origin??"wartość"} będzie mieć ${o}${r.minimum.toString()} ${s.unit??"elementów"}`;return`Zbyt mał(y/a/e): oczekiwano, że ${r.origin??"wartość"} będzie wynosić ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`Nieprawidłowy ciąg znaków: musi zaczynać się od "${o.prefix}"`;if(o.format==="ends_with")return`Nieprawidłowy ciąg znaków: musi kończyć się na "${o.suffix}"`;if(o.format==="includes")return`Nieprawidłowy ciąg znaków: musi zawierać "${o.includes}"`;if(o.format==="regex")return`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${o.pattern}`;return`Nieprawidłow(y/a/e) ${i[o.format]??r.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${r.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${r.keys.length>1?"s":""}: ${h(r.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${r.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${r.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function Wa(){return{localeError:Ly()}}var Fy=()=>{let e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"número";case"object":{if(Array.isArray(r))return"array";if(r===null)return"nulo";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"padrão",email:"endereço de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(r)=>{switch(r.code){case"invalid_type":return`Tipo inválido: esperado ${r.expected}, recebido ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Entrada inválida: esperado ${k(r.values[0])}`;return`Opção inválida: esperada uma das ${h(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Muito grande: esperado que ${r.origin??"valor"} tivesse ${o}${r.maximum.toString()} ${s.unit??"elementos"}`;return`Muito grande: esperado que ${r.origin??"valor"} fosse ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`Muito pequeno: esperado que ${r.origin} tivesse ${o}${r.minimum.toString()} ${s.unit}`;return`Muito pequeno: esperado que ${r.origin} fosse ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`Texto inválido: deve começar com "${o.prefix}"`;if(o.format==="ends_with")return`Texto inválido: deve terminar com "${o.suffix}"`;if(o.format==="includes")return`Texto inválido: deve incluir "${o.includes}"`;if(o.format==="regex")return`Texto inválido: deve corresponder ao padrão ${o.pattern}`;return`${i[o.format]??r.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${r.divisor}`;case"unrecognized_keys":return`Chave${r.keys.length>1?"s":""} desconhecida${r.keys.length>1?"s":""}: ${h(r.keys,", ")}`;case"invalid_key":return`Chave inválida em ${r.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${r.origin}`;default:return"Campo inválido"}}};function Ha(){return{localeError:Fy()}}function Pm(e,t,n,i){let r=Math.abs(e),o=r%10,s=r%100;if(s>=11&&s<=19)return i;if(o===1)return t;if(o>=2&&o<=4)return n;return i}var Gy=()=>{let e={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"число";case"object":{if(Array.isArray(r))return"массив";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"};return(r)=>{switch(r.code){case"invalid_type":return`Неверный ввод: ожидалось ${r.expected}, получено ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Неверный ввод: ожидалось ${k(r.values[0])}`;return`Неверный вариант: ожидалось одно из ${h(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s){let a=Number(r.maximum),l=Pm(a,s.unit.one,s.unit.few,s.unit.many);return`Слишком большое значение: ожидалось, что ${r.origin??"значение"} будет иметь ${o}${r.maximum.toString()} ${l}`}return`Слишком большое значение: ожидалось, что ${r.origin??"значение"} будет ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s){let a=Number(r.minimum),l=Pm(a,s.unit.one,s.unit.few,s.unit.many);return`Слишком маленькое значение: ожидалось, что ${r.origin} будет иметь ${o}${r.minimum.toString()} ${l}`}return`Слишком маленькое значение: ожидалось, что ${r.origin} будет ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`Неверная строка: должна начинаться с "${o.prefix}"`;if(o.format==="ends_with")return`Неверная строка: должна заканчиваться на "${o.suffix}"`;if(o.format==="includes")return`Неверная строка: должна содержать "${o.includes}"`;if(o.format==="regex")return`Неверная строка: должна соответствовать шаблону ${o.pattern}`;return`Неверный ${i[o.format]??r.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${r.divisor}`;case"unrecognized_keys":return`Нераспознанн${r.keys.length>1?"ые":"ый"} ключ${r.keys.length>1?"и":""}: ${h(r.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${r.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${r.origin}`;default:return"Неверные входные данные"}}};function Va(){return{localeError:Gy()}}var Zy=()=>{let e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"število";case"object":{if(Array.isArray(r))return"tabela";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"vnos",email:"e-poštni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"};return(r)=>{switch(r.code){case"invalid_type":return`Neveljaven vnos: pričakovano ${r.expected}, prejeto ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Neveljaven vnos: pričakovano ${k(r.values[0])}`;return`Neveljavna možnost: pričakovano eno izmed ${h(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Preveliko: pričakovano, da bo ${r.origin??"vrednost"} imelo ${o}${r.maximum.toString()} ${s.unit??"elementov"}`;return`Preveliko: pričakovano, da bo ${r.origin??"vrednost"} ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`Premajhno: pričakovano, da bo ${r.origin} imelo ${o}${r.minimum.toString()} ${s.unit}`;return`Premajhno: pričakovano, da bo ${r.origin} ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`Neveljaven niz: mora se začeti z "${o.prefix}"`;if(o.format==="ends_with")return`Neveljaven niz: mora se končati z "${o.suffix}"`;if(o.format==="includes")return`Neveljaven niz: mora vsebovati "${o.includes}"`;if(o.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${o.pattern}`;return`Neveljaven ${i[o.format]??r.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${r.divisor}`;case"unrecognized_keys":return`Neprepoznan${r.keys.length>1?"i ključi":" ključ"}: ${h(r.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${r.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${r.origin}`;default:return"Neveljaven vnos"}}};function Ba(){return{localeError:Zy()}}var Wy=()=>{let e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"antal";case"object":{if(Array.isArray(r))return"lista";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return(r)=>{switch(r.code){case"invalid_type":return`Ogiltig inmatning: förväntat ${r.expected}, fick ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Ogiltig inmatning: förväntat ${k(r.values[0])}`;return`Ogiltigt val: förväntade en av ${h(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`För stor(t): förväntade ${r.origin??"värdet"} att ha ${o}${r.maximum.toString()} ${s.unit??"element"}`;return`För stor(t): förväntat ${r.origin??"värdet"} att ha ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`För lite(t): förväntade ${r.origin??"värdet"} att ha ${o}${r.minimum.toString()} ${s.unit}`;return`För lite(t): förväntade ${r.origin??"värdet"} att ha ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`Ogiltig sträng: måste börja med "${o.prefix}"`;if(o.format==="ends_with")return`Ogiltig sträng: måste sluta med "${o.suffix}"`;if(o.format==="includes")return`Ogiltig sträng: måste innehålla "${o.includes}"`;if(o.format==="regex")return`Ogiltig sträng: måste matcha mönstret "${o.pattern}"`;return`Ogiltig(t) ${i[o.format]??r.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${h(r.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${r.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${r.origin??"värdet"}`;default:return"Ogiltig input"}}};function qa(){return{localeError:Wy()}}var Hy=()=>{let e={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"எண் அல்லாதது":"எண்";case"object":{if(Array.isArray(r))return"அணி";if(r===null)return"வெறுமை";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"};return(r)=>{switch(r.code){case"invalid_type":return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${r.expected}, பெறப்பட்டது ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${k(r.values[0])}`;return`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${h(r.values,"|")} இல் ஒன்று`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${r.origin??"மதிப்பு"} ${o}${r.maximum.toString()} ${s.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`;return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${r.origin??"மதிப்பு"} ${o}${r.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${r.origin} ${o}${r.minimum.toString()} ${s.unit} ஆக இருக்க வேண்டும்`;return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${r.origin} ${o}${r.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`தவறான சரம்: "${o.prefix}" இல் தொடங்க வேண்டும்`;if(o.format==="ends_with")return`தவறான சரம்: "${o.suffix}" இல் முடிவடைய வேண்டும்`;if(o.format==="includes")return`தவறான சரம்: "${o.includes}" ஐ உள்ளடக்க வேண்டும்`;if(o.format==="regex")return`தவறான சரம்: ${o.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`;return`தவறான ${i[o.format]??r.format}`}case"not_multiple_of":return`தவறான எண்: ${r.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${r.keys.length>1?"கள்":""}: ${h(r.keys,", ")}`;case"invalid_key":return`${r.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${r.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function Ja(){return{localeError:Hy()}}var Vy=()=>{let e={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"ไม่ใช่ตัวเลข (NaN)":"ตัวเลข";case"object":{if(Array.isArray(r))return"อาร์เรย์ (Array)";if(r===null)return"ไม่มีค่า (null)";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"};return(r)=>{switch(r.code){case"invalid_type":return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${r.expected} แต่ได้รับ ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`ค่าไม่ถูกต้อง: ควรเป็น ${k(r.values[0])}`;return`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${h(r.values,"|")}`;case"too_big":{let o=r.inclusive?"ไม่เกิน":"น้อยกว่า",s=t(r.origin);if(s)return`เกินกำหนด: ${r.origin??"ค่า"} ควรมี${o} ${r.maximum.toString()} ${s.unit??"รายการ"}`;return`เกินกำหนด: ${r.origin??"ค่า"} ควรมี${o} ${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?"อย่างน้อย":"มากกว่า",s=t(r.origin);if(s)return`น้อยกว่ากำหนด: ${r.origin} ควรมี${o} ${r.minimum.toString()} ${s.unit}`;return`น้อยกว่ากำหนด: ${r.origin} ควรมี${o} ${r.minimum.toString()}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${o.prefix}"`;if(o.format==="ends_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${o.suffix}"`;if(o.format==="includes")return`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${o.includes}" อยู่ในข้อความ`;if(o.format==="regex")return`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${o.pattern}`;return`รูปแบบไม่ถูกต้อง: ${i[o.format]??r.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${r.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${h(r.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${r.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${r.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function Ka(){return{localeError:Vy()}}var By=(e)=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},qy=()=>{let e={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function t(i){return e[i]??null}let n={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"};return(i)=>{switch(i.code){case"invalid_type":return`Geçersiz değer: beklenen ${i.expected}, alınan ${By(i.input)}`;case"invalid_value":if(i.values.length===1)return`Geçersiz değer: beklenen ${k(i.values[0])}`;return`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${h(i.values,"|")}`;case"too_big":{let r=i.inclusive?"<=":"<",o=t(i.origin);if(o)return`Çok büyük: beklenen ${i.origin??"değer"} ${r}${i.maximum.toString()} ${o.unit??"öğe"}`;return`Çok büyük: beklenen ${i.origin??"değer"} ${r}${i.maximum.toString()}`}case"too_small":{let r=i.inclusive?">=":">",o=t(i.origin);if(o)return`Çok küçük: beklenen ${i.origin} ${r}${i.minimum.toString()} ${o.unit}`;return`Çok küçük: beklenen ${i.origin} ${r}${i.minimum.toString()}`}case"invalid_format":{let r=i;if(r.format==="starts_with")return`Geçersiz metin: "${r.prefix}" ile başlamalı`;if(r.format==="ends_with")return`Geçersiz metin: "${r.suffix}" ile bitmeli`;if(r.format==="includes")return`Geçersiz metin: "${r.includes}" içermeli`;if(r.format==="regex")return`Geçersiz metin: ${r.pattern} desenine uymalı`;return`Geçersiz ${n[r.format]??i.format}`}case"not_multiple_of":return`Geçersiz sayı: ${i.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${i.keys.length>1?"lar":""}: ${h(i.keys,", ")}`;case"invalid_key":return`${i.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${i.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function Xa(){return{localeError:qy()}}var Jy=()=>{let e={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"число";case"object":{if(Array.isArray(r))return"масив";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"};return(r)=>{switch(r.code){case"invalid_type":return`Неправильні вхідні дані: очікується ${r.expected}, отримано ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Неправильні вхідні дані: очікується ${k(r.values[0])}`;return`Неправильна опція: очікується одне з ${h(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Занадто велике: очікується, що ${r.origin??"значення"} ${s.verb} ${o}${r.maximum.toString()} ${s.unit??"елементів"}`;return`Занадто велике: очікується, що ${r.origin??"значення"} буде ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`Занадто мале: очікується, що ${r.origin} ${s.verb} ${o}${r.minimum.toString()} ${s.unit}`;return`Занадто мале: очікується, що ${r.origin} буде ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`Неправильний рядок: повинен починатися з "${o.prefix}"`;if(o.format==="ends_with")return`Неправильний рядок: повинен закінчуватися на "${o.suffix}"`;if(o.format==="includes")return`Неправильний рядок: повинен містити "${o.includes}"`;if(o.format==="regex")return`Неправильний рядок: повинен відповідати шаблону ${o.pattern}`;return`Неправильний ${i[o.format]??r.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${r.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${r.keys.length>1?"і":""}: ${h(r.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${r.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${r.origin}`;default:return"Неправильні вхідні дані"}}};function gr(){return{localeError:Jy()}}function Ya(){return gr()}var Ky=()=>{let e={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"نمبر";case"object":{if(Array.isArray(r))return"آرے";if(r===null)return"نل";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"};return(r)=>{switch(r.code){case"invalid_type":return`غلط ان پٹ: ${r.expected} متوقع تھا، ${n(r.input)} موصول ہوا`;case"invalid_value":if(r.values.length===1)return`غلط ان پٹ: ${k(r.values[0])} متوقع تھا`;return`غلط آپشن: ${h(r.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`بہت بڑا: ${r.origin??"ویلیو"} کے ${o}${r.maximum.toString()} ${s.unit??"عناصر"} ہونے متوقع تھے`;return`بہت بڑا: ${r.origin??"ویلیو"} کا ${o}${r.maximum.toString()} ہونا متوقع تھا`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`بہت چھوٹا: ${r.origin} کے ${o}${r.minimum.toString()} ${s.unit} ہونے متوقع تھے`;return`بہت چھوٹا: ${r.origin} کا ${o}${r.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`غلط سٹرنگ: "${o.prefix}" سے شروع ہونا چاہیے`;if(o.format==="ends_with")return`غلط سٹرنگ: "${o.suffix}" پر ختم ہونا چاہیے`;if(o.format==="includes")return`غلط سٹرنگ: "${o.includes}" شامل ہونا چاہیے`;if(o.format==="regex")return`غلط سٹرنگ: پیٹرن ${o.pattern} سے میچ ہونا چاہیے`;return`غلط ${i[o.format]??r.format}`}case"not_multiple_of":return`غلط نمبر: ${r.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${r.keys.length>1?"ز":""}: ${h(r.keys,"، ")}`;case"invalid_key":return`${r.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${r.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function Qa(){return{localeError:Ky()}}var Xy=()=>{let e={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"số";case"object":{if(Array.isArray(r))return"mảng";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"đầu vào",email:"địa chỉ email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"};return(r)=>{switch(r.code){case"invalid_type":return`Đầu vào không hợp lệ: mong đợi ${r.expected}, nhận được ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Đầu vào không hợp lệ: mong đợi ${k(r.values[0])}`;return`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${h(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Quá lớn: mong đợi ${r.origin??"giá trị"} ${s.verb} ${o}${r.maximum.toString()} ${s.unit??"phần tử"}`;return`Quá lớn: mong đợi ${r.origin??"giá trị"} ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`Quá nhỏ: mong đợi ${r.origin} ${s.verb} ${o}${r.minimum.toString()} ${s.unit}`;return`Quá nhỏ: mong đợi ${r.origin} ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`Chuỗi không hợp lệ: phải bắt đầu bằng "${o.prefix}"`;if(o.format==="ends_with")return`Chuỗi không hợp lệ: phải kết thúc bằng "${o.suffix}"`;if(o.format==="includes")return`Chuỗi không hợp lệ: phải bao gồm "${o.includes}"`;if(o.format==="regex")return`Chuỗi không hợp lệ: phải khớp với mẫu ${o.pattern}`;return`${i[o.format]??r.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${r.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${h(r.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${r.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${r.origin}`;default:return"Đầu vào không hợp lệ"}}};function el(){return{localeError:Xy()}}var Yy=()=>{let e={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"非数字(NaN)":"数字";case"object":{if(Array.isArray(r))return"数组";if(r===null)return"空值(null)";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"};return(r)=>{switch(r.code){case"invalid_type":return`无效输入:期望 ${r.expected},实际接收 ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`无效输入:期望 ${k(r.values[0])}`;return`无效选项:期望以下之一 ${h(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`数值过大:期望 ${r.origin??"值"} ${o}${r.maximum.toString()} ${s.unit??"个元素"}`;return`数值过大:期望 ${r.origin??"值"} ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`数值过小:期望 ${r.origin} ${o}${r.minimum.toString()} ${s.unit}`;return`数值过小:期望 ${r.origin} ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`无效字符串:必须以 "${o.prefix}" 开头`;if(o.format==="ends_with")return`无效字符串:必须以 "${o.suffix}" 结尾`;if(o.format==="includes")return`无效字符串:必须包含 "${o.includes}"`;if(o.format==="regex")return`无效字符串:必须满足正则表达式 ${o.pattern}`;return`无效${i[o.format]??r.format}`}case"not_multiple_of":return`无效数字:必须是 ${r.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${h(r.keys,", ")}`;case"invalid_key":return`${r.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${r.origin} 中包含无效值(value)`;default:return"无效输入"}}};function tl(){return{localeError:Yy()}}var Qy=()=>{let e={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"輸入",email:"郵件地址",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"};return(r)=>{switch(r.code){case"invalid_type":return`無效的輸入值:預期為 ${r.expected},但收到 ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`無效的輸入值:預期為 ${k(r.values[0])}`;return`無效的選項:預期為以下其中之一 ${h(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`數值過大:預期 ${r.origin??"值"} 應為 ${o}${r.maximum.toString()} ${s.unit??"個元素"}`;return`數值過大:預期 ${r.origin??"值"} 應為 ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`數值過小:預期 ${r.origin} 應為 ${o}${r.minimum.toString()} ${s.unit}`;return`數值過小:預期 ${r.origin} 應為 ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`無效的字串:必須以 "${o.prefix}" 開頭`;if(o.format==="ends_with")return`無效的字串:必須以 "${o.suffix}" 結尾`;if(o.format==="includes")return`無效的字串:必須包含 "${o.includes}"`;if(o.format==="regex")return`無效的字串:必須符合格式 ${o.pattern}`;return`無效的 ${i[o.format]??r.format}`}case"not_multiple_of":return`無效的數字:必須為 ${r.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${r.keys.length>1?"們":""}:${h(r.keys,"、")}`;case"invalid_key":return`${r.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${r.origin} 中有無效的值`;default:return"無效的輸入值"}}};function rl(){return{localeError:Qy()}}var eb=()=>{let e={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"}};function t(r){return e[r]??null}let n=(r)=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"nọ́mbà";case"object":{if(Array.isArray(r))return"akopọ";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"ẹ̀rọ ìbáwọlé",email:"àdírẹ́sì ìmẹ́lì",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"àkókò ISO",date:"ọjọ́ ISO",time:"àkókò ISO",duration:"àkókò tó pé ISO",ipv4:"àdírẹ́sì IPv4",ipv6:"àdírẹ́sì IPv6",cidrv4:"àgbègbè IPv4",cidrv6:"àgbègbè IPv6",base64:"ọ̀rọ̀ tí a kọ́ ní base64",base64url:"ọ̀rọ̀ base64url",json_string:"ọ̀rọ̀ JSON",e164:"nọ́mbà E.164",jwt:"JWT",template_literal:"ẹ̀rọ ìbáwọlé"};return(r)=>{switch(r.code){case"invalid_type":return`Ìbáwọlé aṣìṣe: a ní láti fi ${r.expected}, àmọ̀ a rí ${n(r.input)}`;case"invalid_value":if(r.values.length===1)return`Ìbáwọlé aṣìṣe: a ní láti fi ${k(r.values[0])}`;return`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${h(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Tó pọ̀ jù: a ní láti jẹ́ pé ${r.origin??"iye"} ${s.verb} ${o}${r.maximum} ${s.unit}`;return`Tó pọ̀ jù: a ní láti jẹ́ ${o}${r.maximum}`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`Kéré ju: a ní láti jẹ́ pé ${r.origin} ${s.verb} ${o}${r.minimum} ${s.unit}`;return`Kéré ju: a ní láti jẹ́ ${o}${r.minimum}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${o.prefix}"`;if(o.format==="ends_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${o.suffix}"`;if(o.format==="includes")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${o.includes}"`;if(o.format==="regex")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${o.pattern}`;return`Aṣìṣe: ${i[o.format]??r.format}`}case"not_multiple_of":return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${r.divisor}`;case"unrecognized_keys":return`Bọtìnì àìmọ̀: ${h(r.keys,", ")}`;case"invalid_key":return`Bọtìnì aṣìṣe nínú ${r.origin}`;case"invalid_union":return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣìṣe nínú ${r.origin}`;default:return"Ìbáwọlé aṣìṣe"}}};function nl(){return{localeError:eb()}}var il=Symbol("ZodOutput"),ol=Symbol("ZodInput");class vr{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==="object"&&"id"in n){if(this._idmap.has(n.id))throw Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let i={...n,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Rn(){return new vr}var Fe=Rn();function sl(e,t){return new e({type:"string",...y(t)})}function al(e,t){return new e({type:"string",coerce:!0,...y(t)})}function zn(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...y(t)})}function yr(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...y(t)})}function Cn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...y(t)})}function An(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...y(t)})}function Mn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...y(t)})}function Nn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...y(t)})}function br(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...y(t)})}function jn(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...y(t)})}function Un(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...y(t)})}function Ln(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...y(t)})}function Fn(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...y(t)})}function Gn(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...y(t)})}function Zn(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...y(t)})}function Wn(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...y(t)})}function Hn(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...y(t)})}function Vn(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...y(t)})}function Bn(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...y(t)})}function qn(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...y(t)})}function Jn(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...y(t)})}function Kn(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...y(t)})}function Xn(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...y(t)})}function Yn(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...y(t)})}var ll={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function cl(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...y(t)})}function ul(e,t){return new e({type:"string",format:"date",check:"string_format",...y(t)})}function dl(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...y(t)})}function ml(e,t){return new e({type:"string",format:"duration",check:"string_format",...y(t)})}function pl(e,t){return new e({type:"number",checks:[],...y(t)})}function fl(e,t){return new e({type:"number",coerce:!0,checks:[],...y(t)})}function gl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...y(t)})}function hl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...y(t)})}function vl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...y(t)})}function yl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...y(t)})}function bl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...y(t)})}function _l(e,t){return new e({type:"boolean",...y(t)})}function kl(e,t){return new e({type:"boolean",coerce:!0,...y(t)})}function wl(e,t){return new e({type:"bigint",...y(t)})}function xl(e,t){return new e({type:"bigint",coerce:!0,...y(t)})}function $l(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...y(t)})}function Sl(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...y(t)})}function Il(e,t){return new e({type:"symbol",...y(t)})}function Tl(e,t){return new e({type:"undefined",...y(t)})}function Dl(e,t){return new e({type:"null",...y(t)})}function Pl(e){return new e({type:"any"})}function Ol(e){return new e({type:"unknown"})}function El(e,t){return new e({type:"never",...y(t)})}function Rl(e,t){return new e({type:"void",...y(t)})}function zl(e,t){return new e({type:"date",...y(t)})}function Cl(e,t){return new e({type:"date",coerce:!0,...y(t)})}function Al(e,t){return new e({type:"nan",...y(t)})}function Ve(e,t){return new _n({check:"less_than",...y(t),value:e,inclusive:!1})}function Pe(e,t){return new _n({check:"less_than",...y(t),value:e,inclusive:!0})}function Be(e,t){return new kn({check:"greater_than",...y(t),value:e,inclusive:!1})}function be(e,t){return new kn({check:"greater_than",...y(t),value:e,inclusive:!0})}function Ml(e){return Be(0,e)}function Nl(e){return Ve(0,e)}function jl(e){return Pe(0,e)}function Ul(e){return be(0,e)}function _t(e,t){return new Go({check:"multiple_of",...y(t),value:e})}function At(e,t){return new Ho({check:"max_size",...y(t),maximum:e})}function kt(e,t){return new Vo({check:"min_size",...y(t),minimum:e})}function _r(e,t){return new Bo({check:"size_equals",...y(t),size:e})}function Mt(e,t){return new qo({check:"max_length",...y(t),maximum:e})}function st(e,t){return new Jo({check:"min_length",...y(t),minimum:e})}function Nt(e,t){return new Ko({check:"length_equals",...y(t),length:e})}function kr(e,t){return new Xo({check:"string_format",format:"regex",...y(t),pattern:e})}function wr(e){return new Yo({check:"string_format",format:"lowercase",...y(e)})}function xr(e){return new Qo({check:"string_format",format:"uppercase",...y(e)})}function $r(e,t){return new es({check:"string_format",format:"includes",...y(t),includes:e})}function Sr(e,t){return new ts({check:"string_format",format:"starts_with",...y(t),prefix:e})}function Ir(e,t){return new rs({check:"string_format",format:"ends_with",...y(t),suffix:e})}function Ll(e,t,n){return new ns({check:"property",property:e,schema:t,...y(n)})}function Tr(e,t){return new is({check:"mime_type",mime:e,...y(t)})}function qe(e){return new os({check:"overwrite",tx:e})}function Dr(e){return qe((t)=>t.normalize(e))}function Pr(){return qe((e)=>e.trim())}function Or(){return qe((e)=>e.toLowerCase())}function Er(){return qe((e)=>e.toUpperCase())}function Fl(e,t,n){return new e({type:"array",element:t,...y(n)})}function tb(e,t,n){return new e({type:"union",options:t,...y(n)})}function rb(e,t,n,i){return new e({type:"union",options:n,discriminator:t,...y(i)})}function nb(e,t,n){return new e({type:"intersection",left:t,right:n})}function ib(e,t,n,i){let r=n instanceof O;return new e({type:"tuple",items:t,rest:r?n:null,...y(r?i:n)})}function ob(e,t,n,i){return new e({type:"record",keyType:t,valueType:n,...y(i)})}function sb(e,t,n,i){return new e({type:"map",keyType:t,valueType:n,...y(i)})}function ab(e,t,n){return new e({type:"set",valueType:t,...y(n)})}function lb(e,t,n){let i=Array.isArray(t)?Object.fromEntries(t.map((r)=>[r,r])):t;return new e({type:"enum",entries:i,...y(n)})}function cb(e,t,n){return new e({type:"enum",entries:t,...y(n)})}function ub(e,t,n){return new e({type:"literal",values:Array.isArray(t)?t:[t],...y(n)})}function Gl(e,t){return new e({type:"file",...y(t)})}function db(e,t){return new e({type:"transform",transform:t})}function mb(e,t){return new e({type:"optional",innerType:t})}function pb(e,t){return new e({type:"nullable",innerType:t})}function fb(e,t,n){return new e({type:"default",innerType:t,get defaultValue(){return typeof n==="function"?n():er(n)}})}function gb(e,t,n){return new e({type:"nonoptional",innerType:t,...y(n)})}function hb(e,t){return new e({type:"success",innerType:t})}function vb(e,t,n){return new e({type:"catch",innerType:t,catchValue:typeof n==="function"?n:()=>n})}function yb(e,t,n){return new e({type:"pipe",in:t,out:n})}function bb(e,t){return new e({type:"readonly",innerType:t})}function _b(e,t,n){return new e({type:"template_literal",parts:t,...y(n)})}function kb(e,t){return new e({type:"lazy",getter:t})}function wb(e,t){return new e({type:"promise",innerType:t})}function Zl(e,t,n){let i=y(n);return i.abort??(i.abort=!0),new e({type:"custom",check:"custom",fn:t,...i})}function Wl(e,t,n){return new e({type:"custom",check:"custom",fn:t,...y(n)})}function Hl(e){let t=Om((n)=>(n.addIssue=(i)=>{if(typeof i==="string")n.issues.push(ot(i,n.value,t._zod.def));else{let r=i;if(r.fatal)r.continue=!1;r.code??(r.code="custom"),r.input??(r.input=n.value),r.inst??(r.inst=t),r.continue??(r.continue=!t._zod.def.abort),n.issues.push(ot(r))}},e(n.value,n)));return t}function Om(e,t){let n=new Y({check:"custom",...y(t)});return n._zod.check=e,n}function Vl(e,t){let n=y(t),i=n.truthy??["true","1","yes","on","y","enabled"],r=n.falsy??["false","0","no","off","n","disabled"];if(n.case!=="sensitive")i=i.map((d)=>typeof d==="string"?d.toLowerCase():d),r=r.map((d)=>typeof d==="string"?d.toLowerCase():d);let o=new Set(i),s=new Set(r),a=e.Codec??ur,l=e.Boolean??cr,u=new(e.String??bt)({type:"string",error:n.error}),f=new l({type:"boolean",error:n.error}),g=new a({type:"pipe",in:u,out:f,transform:(d,b)=>{let x=d;if(n.case!=="sensitive")x=x.toLowerCase();if(o.has(x))return!0;else if(s.has(x))return!1;else return b.issues.push({code:"invalid_value",expected:"stringbool",values:[...o,...s],input:b.value,inst:g,continue:!1}),{}},reverseTransform:(d,b)=>{if(d===!0)return i[0]||"true";else return r[0]||"false"},error:n.error});return g}function jt(e,t,n,i={}){let r=y(i),o={...y(i),check:"string_format",type:"string",format:t,fn:typeof n==="function"?n:(a)=>n.test(a),...r};if(n instanceof RegExp)o.pattern=n;return new e(o)}class Qn{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Fe,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,t={path:[],schemaPath:[]}){var n;let i=e._zod.def,r={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},o=this.seen.get(e);if(o){if(o.count++,t.schemaPath.includes(e))o.cycle=t.path;return o.schema}let s={schema:{},count:1,cycle:void 0,path:t.path};this.seen.set(e,s);let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let u={...t,schemaPath:[...t.schemaPath,e],path:t.path},f=e._zod.parent;if(f)s.ref=f,this.process(f,u),this.seen.get(f).isParent=!0;else{let g=s.schema;switch(i.type){case"string":{let d=g;d.type="string";let{minimum:b,maximum:x,format:M,patterns:U,contentEncoding:K}=e._zod.bag;if(typeof b==="number")d.minLength=b;if(typeof x==="number")d.maxLength=x;if(M){if(d.format=r[M]??M,d.format==="")delete d.format}if(K)d.contentEncoding=K;if(U&&U.size>0){let W=[...U];if(W.length===1)d.pattern=W[0].source;else if(W.length>1)s.schema.allOf=[...W.map((ae)=>({...this.target==="draft-7"||this.target==="draft-4"||this.target==="openapi-3.0"?{type:"string"}:{},pattern:ae.source}))]}break}case"number":{let d=g,{minimum:b,maximum:x,format:M,multipleOf:U,exclusiveMaximum:K,exclusiveMinimum:W}=e._zod.bag;if(typeof M==="string"&&M.includes("int"))d.type="integer";else d.type="number";if(typeof W==="number")if(this.target==="draft-4"||this.target==="openapi-3.0")d.minimum=W,d.exclusiveMinimum=!0;else d.exclusiveMinimum=W;if(typeof b==="number"){if(d.minimum=b,typeof W==="number"&&this.target!=="draft-4")if(W>=b)delete d.minimum;else delete d.exclusiveMinimum}if(typeof K==="number")if(this.target==="draft-4"||this.target==="openapi-3.0")d.maximum=K,d.exclusiveMaximum=!0;else d.exclusiveMaximum=K;if(typeof x==="number"){if(d.maximum=x,typeof K==="number"&&this.target!=="draft-4")if(K<=x)delete d.maximum;else delete d.exclusiveMaximum}if(typeof U==="number")d.multipleOf=U;break}case"boolean":{let d=g;d.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema");break}case"null":{if(this.target==="openapi-3.0")g.type="string",g.nullable=!0,g.enum=[null];else g.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema");break}case"never":{g.not={};break}case"date":{if(this.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema");break}case"array":{let d=g,{minimum:b,maximum:x}=e._zod.bag;if(typeof b==="number")d.minItems=b;if(typeof x==="number")d.maxItems=x;d.type="array",d.items=this.process(i.element,{...u,path:[...u.path,"items"]});break}case"object":{let d=g;d.type="object",d.properties={};let b=i.shape;for(let U in b)d.properties[U]=this.process(b[U],{...u,path:[...u.path,"properties",U]});let x=new Set(Object.keys(b)),M=new Set([...x].filter((U)=>{let K=i.shape[U]._zod;if(this.io==="input")return K.optin===void 0;else return K.optout===void 0}));if(M.size>0)d.required=Array.from(M);if(i.catchall?._zod.def.type==="never")d.additionalProperties=!1;else if(!i.catchall){if(this.io==="output")d.additionalProperties=!1}else if(i.catchall)d.additionalProperties=this.process(i.catchall,{...u,path:[...u.path,"additionalProperties"]});break}case"union":{let d=g,b=i.options.map((x,M)=>this.process(x,{...u,path:[...u.path,"anyOf",M]}));d.anyOf=b;break}case"intersection":{let d=g,b=this.process(i.left,{...u,path:[...u.path,"allOf",0]}),x=this.process(i.right,{...u,path:[...u.path,"allOf",1]}),M=(K)=>("allOf"in K)&&Object.keys(K).length===1,U=[...M(b)?b.allOf:[b],...M(x)?x.allOf:[x]];d.allOf=U;break}case"tuple":{let d=g;d.type="array";let b=this.target==="draft-2020-12"?"prefixItems":"items",x=this.target==="draft-2020-12"?"items":this.target==="openapi-3.0"?"items":"additionalItems",M=i.items.map((ae,Te)=>this.process(ae,{...u,path:[...u.path,b,Te]})),U=i.rest?this.process(i.rest,{...u,path:[...u.path,x,...this.target==="openapi-3.0"?[i.items.length]:[]]}):null;if(this.target==="draft-2020-12"){if(d.prefixItems=M,U)d.items=U}else if(this.target==="openapi-3.0"){if(d.items={anyOf:M},U)d.items.anyOf.push(U);if(d.minItems=M.length,!U)d.maxItems=M.length}else if(d.items=M,U)d.additionalItems=U;let{minimum:K,maximum:W}=e._zod.bag;if(typeof K==="number")d.minItems=K;if(typeof W==="number")d.maxItems=W;break}case"record":{let d=g;if(d.type="object",this.target==="draft-7"||this.target==="draft-2020-12")d.propertyNames=this.process(i.keyType,{...u,path:[...u.path,"propertyNames"]});d.additionalProperties=this.process(i.valueType,{...u,path:[...u.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema");break}case"enum":{let d=g,b=Yt(i.entries);if(b.every((x)=>typeof x==="number"))d.type="number";if(b.every((x)=>typeof x==="string"))d.type="string";d.enum=b;break}case"literal":{let d=g,b=[];for(let x of i.values)if(x===void 0){if(this.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof x==="bigint")if(this.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else b.push(Number(x));else b.push(x);if(b.length===0);else if(b.length===1){let x=b[0];if(d.type=x===null?"null":typeof x,this.target==="draft-4"||this.target==="openapi-3.0")d.enum=[x];else d.const=x}else{if(b.every((x)=>typeof x==="number"))d.type="number";if(b.every((x)=>typeof x==="string"))d.type="string";if(b.every((x)=>typeof x==="boolean"))d.type="string";if(b.every((x)=>x===null))d.type="null";d.enum=b}break}case"file":{let d=g,b={type:"string",format:"binary",contentEncoding:"binary"},{minimum:x,maximum:M,mime:U}=e._zod.bag;if(x!==void 0)b.minLength=x;if(M!==void 0)b.maxLength=M;if(U)if(U.length===1)b.contentMediaType=U[0],Object.assign(d,b);else d.anyOf=U.map((K)=>({...b,contentMediaType:K}));else Object.assign(d,b);break}case"transform":{if(this.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let d=this.process(i.innerType,u);if(this.target==="openapi-3.0")s.ref=i.innerType,g.nullable=!0;else g.anyOf=[d,{type:"null"}];break}case"nonoptional":{this.process(i.innerType,u),s.ref=i.innerType;break}case"success":{let d=g;d.type="boolean";break}case"default":{this.process(i.innerType,u),s.ref=i.innerType,g.default=JSON.parse(JSON.stringify(i.defaultValue));break}case"prefault":{if(this.process(i.innerType,u),s.ref=i.innerType,this.io==="input")g._prefault=JSON.parse(JSON.stringify(i.defaultValue));break}case"catch":{this.process(i.innerType,u),s.ref=i.innerType;let d;try{d=i.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}g.default=d;break}case"nan":{if(this.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let d=g,b=e._zod.pattern;if(!b)throw Error("Pattern not found in template literal");d.type="string",d.pattern=b.source;break}case"pipe":{let d=this.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;this.process(d,u),s.ref=d;break}case"readonly":{this.process(i.innerType,u),s.ref=i.innerType,g.readOnly=!0;break}case"promise":{this.process(i.innerType,u),s.ref=i.innerType;break}case"optional":{this.process(i.innerType,u),s.ref=i.innerType;break}case"lazy":{let d=e._zod.innerType;this.process(d,u),s.ref=d;break}case"custom":{if(this.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema");break}case"function":{if(this.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema");break}default:}}}let l=this.metadataRegistry.get(e);if(l)Object.assign(s.schema,l);if(this.io==="input"&&le(e))delete s.schema.examples,delete s.schema.default;if(this.io==="input"&&s.schema._prefault)(n=s.schema).default??(n.default=s.schema._prefault);return delete s.schema._prefault,this.seen.get(e).schema}emit(e,t){let n={cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0},i=this.seen.get(e);if(!i)throw Error("Unprocessed schema. This is a bug in Zod.");let r=(c)=>{let u=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let b=n.external.registry.get(c[0])?.id,x=n.external.uri??((U)=>U);if(b)return{ref:x(b)};let M=c[1].defId??c[1].schema.id??`schema${this.counter++}`;return c[1].defId=M,{defId:M,ref:`${x("__shared")}#/${u}/${M}`}}if(c[1]===i)return{ref:"#"};let g=`${"#"}/${u}/`,d=c[1].schema.id??`__schema${this.counter++}`;return{defId:d,ref:g+d}},o=(c)=>{if(c[1].schema.$ref)return;let u=c[1],{ref:f,defId:g}=r(c);if(u.def={...u.schema},g)u.defId=g;let d=u.schema;for(let b in d)delete d[b];d.$ref=f};if(n.cycles==="throw")for(let c of this.seen.entries()){let u=c[1];if(u.cycle)throw Error(`Cycle detected: #/${u.cycle?.join("/")}/<root>
191
191
 
192
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let c of this.seen.entries()){let u=c[1];if(e===c[0]){i(c);continue}if(n.external){let g=n.external.registry.get(c[0])?.id;if(e!==c[0]&&g){i(c);continue}}if(this.metadataRegistry.get(c[0])?.id){i(c);continue}if(u.cycle){i(c);continue}if(u.count>1){if(n.reused==="ref"){i(c);continue}}}let s=(c,u)=>{let f=this.seen.get(c),g=f.def??f.schema,d={...g};if(f.ref===null)return;let b=f.ref;if(f.ref=null,b){s(b,u);let w=this.seen.get(b).schema;if(w.$ref&&(u.target==="draft-7"||u.target==="draft-4"||u.target==="openapi-3.0"))g.allOf=g.allOf??[],g.allOf.push(w);else Object.assign(g,w),Object.assign(g,d)}if(!f.isParent)this.override({zodSchema:c,jsonSchema:g,path:f.path??[]})};for(let c of[...this.seen.entries()].reverse())s(c[0],{target:this.target});let a={};if(this.target==="draft-2020-12")a.$schema="https://json-schema.org/draft/2020-12/schema";else if(this.target==="draft-7")a.$schema="http://json-schema.org/draft-07/schema#";else if(this.target==="draft-4")a.$schema="http://json-schema.org/draft-04/schema#";else if(this.target==="openapi-3.0");else console.warn(`Invalid target: ${this.target}`);if(n.external?.uri){let c=n.external.registry.get(e)?.id;if(!c)throw Error("Schema is missing an `id` property");a.$id=n.external.uri(c)}Object.assign(a,o.def);let l=n.external?.defs??{};for(let c of this.seen.entries()){let u=c[1];if(u.def&&u.defId)l[u.defId]=u.def}if(n.external);else if(Object.keys(l).length>0)if(this.target==="draft-2020-12")a.$defs=l;else a.definitions=l;try{return JSON.parse(JSON.stringify(a))}catch(c){throw Error("Error converting schema to JSON.")}}}function Bl(e,t){if(e instanceof vr){let o=new Qn(t),r={};for(let a of e._idmap.entries()){let[l,c]=a;o.process(c)}let i={},s={registry:e,uri:t?.uri,defs:r};for(let a of e._idmap.entries()){let[l,c]=a;i[l]=o.emit(c,{...t,external:s})}if(Object.keys(r).length>0){let a=o.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[a]:r}}return{schemas:i}}let n=new Qn(t);return n.process(e),n.emit(e,t)}function le(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;switch(r.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return le(r.element,n);case"object":{for(let i in r.shape)if(le(r.shape[i],n))return!0;return!1}case"union":{for(let i of r.options)if(le(i,n))return!0;return!1}case"intersection":return le(r.left,n)||le(r.right,n);case"tuple":{for(let i of r.items)if(le(i,n))return!0;if(r.rest&&le(r.rest,n))return!0;return!1}case"record":return le(r.keyType,n)||le(r.valueType,n);case"map":return le(r.keyType,n)||le(r.valueType,n);case"set":return le(r.valueType,n);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return le(r.innerType,n);case"lazy":return le(r.getter(),n);case"default":return le(r.innerType,n);case"prefault":return le(r.innerType,n);case"custom":return!1;case"transform":return!0;case"pipe":return le(r.in,n)||le(r.out,n);case"success":return!1;case"catch":return!1;case"function":return!1;default:}throw Error(`Unknown schema type: ${r.type}`)}var Em={};var oo={};dt(oo,{ZodISODate:()=>to,ZodISODateTime:()=>eo,ZodISODuration:()=>no,ZodISOTime:()=>ro,date:()=>Jl,datetime:()=>ql,duration:()=>Xl,time:()=>Kl});var eo=m("ZodISODateTime",(e,t)=>{bs.init(e,t),X.init(e,t)});function ql(e){return cl(eo,e)}var to=m("ZodISODate",(e,t)=>{_s.init(e,t),X.init(e,t)});function Jl(e){return ul(to,e)}var ro=m("ZodISOTime",(e,t)=>{ks.init(e,t),X.init(e,t)});function Kl(e){return dl(ro,e)}var no=m("ZodISODuration",(e,t)=>{ws.init(e,t),X.init(e,t)});function Xl(e){return ml(no,e)}var zm=(e,t)=>{or.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(n)=>sr(e,n)},flatten:{value:(n)=>ir(e,n)},addIssue:{value:(n)=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Dt,2)}},addIssues:{value:(n)=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Dt,2)}},isEmpty:{get(){return e.issues.length===0}}})},wb=m("ZodError",zm),_e=m("ZodError",zm,{Parent:Error});var Yl=Ot(_e),Ql=Et(_e),ec=Rt(_e),tc=zt(_e),rc=un(_e),nc=dn(_e),oc=mn(_e),ic=pn(_e),sc=fn(_e),ac=gn(_e),lc=hn(_e),cc=vn(_e);var R=m("ZodType",(e,t)=>(P.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map((o)=>typeof o==="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),e.clone=(n,o)=>he(e,n,o),e.brand=()=>e,e.register=(n,o)=>(n.add(e,o),e),e.parse=(n,o)=>Yl(e,n,o,{callee:e.parse}),e.safeParse=(n,o)=>ec(e,n,o),e.parseAsync=async(n,o)=>Ql(e,n,o,{callee:e.parseAsync}),e.safeParseAsync=async(n,o)=>tc(e,n,o),e.spa=e.safeParseAsync,e.encode=(n,o)=>rc(e,n,o),e.decode=(n,o)=>nc(e,n,o),e.encodeAsync=async(n,o)=>oc(e,n,o),e.decodeAsync=async(n,o)=>ic(e,n,o),e.safeEncode=(n,o)=>sc(e,n,o),e.safeDecode=(n,o)=>ac(e,n,o),e.safeEncodeAsync=async(n,o)=>lc(e,n,o),e.safeDecodeAsync=async(n,o)=>cc(e,n,o),e.refine=(n,o)=>e.check(bp(n,o)),e.superRefine=(n)=>e.check(_p(n)),e.overwrite=(n)=>e.check(qe(n)),e.optional=()=>so(e),e.nullable=()=>ao(e),e.nullish=()=>so(ao(e)),e.nonoptional=(n)=>ap(e,n),e.array=()=>mo(e),e.or=(n)=>Rc([e,n]),e.and=(n)=>Bm(e,n),e.transform=(n)=>lo(e,Mc(n)),e.default=(n)=>op(e,n),e.prefault=(n)=>sp(e,n),e.catch=(n)=>up(e,n),e.pipe=(n)=>lo(e,n),e.readonly=()=>pp(e),e.describe=(n)=>{let o=e.clone();return Fe.add(o,{description:n}),o},Object.defineProperty(e,"description",{get(){return Fe.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Fe.get(e);let o=e.clone();return Fe.add(o,n[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),mc=m("_ZodString",(e,t)=>{bt.init(e,t),R.init(e,t);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...o)=>e.check(kr(...o)),e.includes=(...o)=>e.check($r(...o)),e.startsWith=(...o)=>e.check(Sr(...o)),e.endsWith=(...o)=>e.check(Ir(...o)),e.min=(...o)=>e.check(st(...o)),e.max=(...o)=>e.check(At(...o)),e.length=(...o)=>e.check(Nt(...o)),e.nonempty=(...o)=>e.check(st(1,...o)),e.lowercase=(o)=>e.check(wr(o)),e.uppercase=(o)=>e.check(xr(o)),e.trim=()=>e.check(Pr()),e.normalize=(...o)=>e.check(Dr(...o)),e.toLowerCase=()=>e.check(Or()),e.toUpperCase=()=>e.check(Er())}),zr=m("ZodString",(e,t)=>{bt.init(e,t),mc.init(e,t),e.email=(n)=>e.check(zn(pc,n)),e.url=(n)=>e.check(br(co,n)),e.jwt=(n)=>e.check(Yn(Dc,n)),e.emoji=(n)=>e.check(jn(fc,n)),e.guid=(n)=>e.check(yr(io,n)),e.uuid=(n)=>e.check(Cn(Ke,n)),e.uuidv4=(n)=>e.check(Mn(Ke,n)),e.uuidv6=(n)=>e.check(An(Ke,n)),e.uuidv7=(n)=>e.check(Nn(Ke,n)),e.nanoid=(n)=>e.check(Un(gc,n)),e.guid=(n)=>e.check(yr(io,n)),e.cuid=(n)=>e.check(Ln(hc,n)),e.cuid2=(n)=>e.check(Fn(vc,n)),e.ulid=(n)=>e.check(Zn(yc,n)),e.base64=(n)=>e.check(Jn(Sc,n)),e.base64url=(n)=>e.check(Kn(Ic,n)),e.xid=(n)=>e.check(Gn(bc,n)),e.ksuid=(n)=>e.check(Wn(_c,n)),e.ipv4=(n)=>e.check(Hn(kc,n)),e.ipv6=(n)=>e.check(Vn(wc,n)),e.cidrv4=(n)=>e.check(Bn(xc,n)),e.cidrv6=(n)=>e.check(qn($c,n)),e.e164=(n)=>e.check(Xn(Tc,n)),e.datetime=(n)=>e.check(ql(n)),e.date=(n)=>e.check(Jl(n)),e.time=(n)=>e.check(Kl(n)),e.duration=(n)=>e.check(Xl(n))});function uc(e){return sl(zr,e)}var X=m("ZodStringFormat",(e,t)=>{J.init(e,t),mc.init(e,t)}),pc=m("ZodEmail",(e,t)=>{us.init(e,t),X.init(e,t)});function $b(e){return zn(pc,e)}var io=m("ZodGUID",(e,t)=>{ls.init(e,t),X.init(e,t)});function Sb(e){return yr(io,e)}var Ke=m("ZodUUID",(e,t)=>{cs.init(e,t),X.init(e,t)});function Ib(e){return Cn(Ke,e)}function Tb(e){return Mn(Ke,e)}function Db(e){return An(Ke,e)}function Pb(e){return Nn(Ke,e)}var co=m("ZodURL",(e,t)=>{ds.init(e,t),X.init(e,t)});function Ob(e){return br(co,e)}function Eb(e){return br(co,{protocol:/^https?$/,hostname:im,...y(e)})}var fc=m("ZodEmoji",(e,t)=>{ms.init(e,t),X.init(e,t)});function Rb(e){return jn(fc,e)}var gc=m("ZodNanoID",(e,t)=>{ps.init(e,t),X.init(e,t)});function zb(e){return Un(gc,e)}var hc=m("ZodCUID",(e,t)=>{fs.init(e,t),X.init(e,t)});function Cb(e){return Ln(hc,e)}var vc=m("ZodCUID2",(e,t)=>{gs.init(e,t),X.init(e,t)});function Mb(e){return Fn(vc,e)}var yc=m("ZodULID",(e,t)=>{hs.init(e,t),X.init(e,t)});function Ab(e){return Zn(yc,e)}var bc=m("ZodXID",(e,t)=>{vs.init(e,t),X.init(e,t)});function Nb(e){return Gn(bc,e)}var _c=m("ZodKSUID",(e,t)=>{ys.init(e,t),X.init(e,t)});function jb(e){return Wn(_c,e)}var kc=m("ZodIPv4",(e,t)=>{xs.init(e,t),X.init(e,t)});function Ub(e){return Hn(kc,e)}var wc=m("ZodIPv6",(e,t)=>{$s.init(e,t),X.init(e,t)});function Lb(e){return Vn(wc,e)}var xc=m("ZodCIDRv4",(e,t)=>{Ss.init(e,t),X.init(e,t)});function Fb(e){return Bn(xc,e)}var $c=m("ZodCIDRv6",(e,t)=>{Is.init(e,t),X.init(e,t)});function Zb(e){return qn($c,e)}var Sc=m("ZodBase64",(e,t)=>{Ds.init(e,t),X.init(e,t)});function Gb(e){return Jn(Sc,e)}var Ic=m("ZodBase64URL",(e,t)=>{Ps.init(e,t),X.init(e,t)});function Wb(e){return Kn(Ic,e)}var Tc=m("ZodE164",(e,t)=>{Os.init(e,t),X.init(e,t)});function Hb(e){return Xn(Tc,e)}var Dc=m("ZodJWT",(e,t)=>{Es.init(e,t),X.init(e,t)});function Vb(e){return Yn(Dc,e)}var Cr=m("ZodCustomStringFormat",(e,t)=>{Rs.init(e,t),X.init(e,t)});function Bb(e,t,n={}){return jt(Cr,e,t,n)}function qb(e){return jt(Cr,"hostname",bn,e)}function Jb(e){return jt(Cr,"hex",lm,e)}function Kb(e,t){let n=t?.enc??"hex",o=`${e}_${n}`,r=He[o];if(!r)throw Error(`Unrecognized hash format: ${o}`);return jt(Cr,o,r,t)}var Mr=m("ZodNumber",(e,t)=>{Dn.init(e,t),R.init(e,t),e.gt=(o,r)=>e.check(Be(o,r)),e.gte=(o,r)=>e.check(be(o,r)),e.min=(o,r)=>e.check(be(o,r)),e.lt=(o,r)=>e.check(Ve(o,r)),e.lte=(o,r)=>e.check(Pe(o,r)),e.max=(o,r)=>e.check(Pe(o,r)),e.int=(o)=>e.check(dc(o)),e.safe=(o)=>e.check(dc(o)),e.positive=(o)=>e.check(Be(0,o)),e.nonnegative=(o)=>e.check(be(0,o)),e.negative=(o)=>e.check(Ve(0,o)),e.nonpositive=(o)=>e.check(Pe(0,o)),e.multipleOf=(o,r)=>e.check(_t(o,r)),e.step=(o,r)=>e.check(_t(o,r)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??0.5),e.isFinite=!0,e.format=n.format??null});function Cm(e){return pl(Mr,e)}var Lt=m("ZodNumberFormat",(e,t)=>{zs.init(e,t),Mr.init(e,t)});function dc(e){return gl(Lt,e)}function Xb(e){return hl(Lt,e)}function Yb(e){return vl(Lt,e)}function Qb(e){return yl(Lt,e)}function e_(e){return bl(Lt,e)}var Ar=m("ZodBoolean",(e,t)=>{cr.init(e,t),R.init(e,t)});function Mm(e){return _l(Ar,e)}var Nr=m("ZodBigInt",(e,t)=>{Pn.init(e,t),R.init(e,t),e.gte=(o,r)=>e.check(be(o,r)),e.min=(o,r)=>e.check(be(o,r)),e.gt=(o,r)=>e.check(Be(o,r)),e.gte=(o,r)=>e.check(be(o,r)),e.min=(o,r)=>e.check(be(o,r)),e.lt=(o,r)=>e.check(Ve(o,r)),e.lte=(o,r)=>e.check(Pe(o,r)),e.max=(o,r)=>e.check(Pe(o,r)),e.positive=(o)=>e.check(Be(BigInt(0),o)),e.negative=(o)=>e.check(Ve(BigInt(0),o)),e.nonpositive=(o)=>e.check(Pe(BigInt(0),o)),e.nonnegative=(o)=>e.check(be(BigInt(0),o)),e.multipleOf=(o,r)=>e.check(_t(o,r));let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});function t_(e){return wl(Nr,e)}var Pc=m("ZodBigIntFormat",(e,t)=>{Cs.init(e,t),Nr.init(e,t)});function r_(e){return $l(Pc,e)}function n_(e){return Sl(Pc,e)}var Am=m("ZodSymbol",(e,t)=>{Ms.init(e,t),R.init(e,t)});function o_(e){return Il(Am,e)}var Nm=m("ZodUndefined",(e,t)=>{As.init(e,t),R.init(e,t)});function i_(e){return Tl(Nm,e)}var jm=m("ZodNull",(e,t)=>{Ns.init(e,t),R.init(e,t)});function Um(e){return Dl(jm,e)}var Lm=m("ZodAny",(e,t)=>{js.init(e,t),R.init(e,t)});function s_(){return Pl(Lm)}var Fm=m("ZodUnknown",(e,t)=>{Us.init(e,t),R.init(e,t)});function Ut(){return Ol(Fm)}var Zm=m("ZodNever",(e,t)=>{Ls.init(e,t),R.init(e,t)});function Oc(e){return El(Zm,e)}var Gm=m("ZodVoid",(e,t)=>{Fs.init(e,t),R.init(e,t)});function a_(e){return Rl(Gm,e)}var uo=m("ZodDate",(e,t)=>{Zs.init(e,t),R.init(e,t),e.min=(o,r)=>e.check(be(o,r)),e.max=(o,r)=>e.check(Pe(o,r));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function l_(e){return zl(uo,e)}var Wm=m("ZodArray",(e,t)=>{Gs.init(e,t),R.init(e,t),e.element=t.element,e.min=(n,o)=>e.check(st(n,o)),e.nonempty=(n)=>e.check(st(1,n)),e.max=(n,o)=>e.check(At(n,o)),e.length=(n,o)=>e.check(Nt(n,o)),e.unwrap=()=>e.element});function mo(e,t){return Fl(Wm,e,t)}function c_(e){let t=e._zod.def.shape;return Cc(Object.keys(t))}var po=m("ZodObject",(e,t)=>{Ws.init(e,t),R.init(e,t),C(e,"shape",()=>t.shape),e.keyof=()=>Cc(Object.keys(e._zod.def.shape)),e.catchall=(n)=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ut()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ut()}),e.strict=()=>e.clone({...e._zod.def,catchall:Oc()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=(n)=>qd(e,n),e.safeExtend=(n)=>Jd(e,n),e.merge=(n)=>Kd(e,n),e.pick=(n)=>Vd(e,n),e.omit=(n)=>Bd(e,n),e.partial=(...n)=>Xd(Ac,e,n[0]),e.required=(...n)=>Yd(Nc,e,n[0])});function u_(e,t){let n={type:"object",get shape(){return Re(this,"shape",e?on(e):{}),this.shape},...y(t)};return new po(n)}function d_(e,t){return new po({type:"object",get shape(){return Re(this,"shape",on(e)),this.shape},catchall:Oc(),...y(t)})}function m_(e,t){return new po({type:"object",get shape(){return Re(this,"shape",on(e)),this.shape},catchall:Ut(),...y(t)})}var Ec=m("ZodUnion",(e,t)=>{On.init(e,t),R.init(e,t),e.options=t.options});function Rc(e,t){return new Ec({type:"union",options:e,...y(t)})}var Hm=m("ZodDiscriminatedUnion",(e,t)=>{Ec.init(e,t),Hs.init(e,t)});function p_(e,t,n){return new Hm({type:"union",options:t,discriminator:e,...y(n)})}var Vm=m("ZodIntersection",(e,t)=>{Vs.init(e,t),R.init(e,t)});function Bm(e,t){return new Vm({type:"intersection",left:e,right:t})}var qm=m("ZodTuple",(e,t)=>{En.init(e,t),R.init(e,t),e.rest=(n)=>e.clone({...e._zod.def,rest:n})});function Jm(e,t,n){let o=t instanceof P,r=o?n:t;return new qm({type:"tuple",items:e,rest:o?t:null,...y(r)})}var zc=m("ZodRecord",(e,t)=>{Bs.init(e,t),R.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function Km(e,t,n){return new zc({type:"record",keyType:e,valueType:t,...y(n)})}function f_(e,t,n){let o=he(e);return o._zod.values=void 0,new zc({type:"record",keyType:o,valueType:t,...y(n)})}var Xm=m("ZodMap",(e,t)=>{qs.init(e,t),R.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function g_(e,t,n){return new Xm({type:"map",keyType:e,valueType:t,...y(n)})}var Ym=m("ZodSet",(e,t)=>{Js.init(e,t),R.init(e,t),e.min=(...n)=>e.check(kt(...n)),e.nonempty=(n)=>e.check(kt(1,n)),e.max=(...n)=>e.check(Mt(...n)),e.size=(...n)=>e.check(_r(...n))});function h_(e,t){return new Ym({type:"set",valueType:e,...y(t)})}var Rr=m("ZodEnum",(e,t)=>{Ks.init(e,t),R.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(o,r)=>{let i={};for(let s of o)if(n.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new Rr({...t,checks:[],...y(r),entries:i})},e.exclude=(o,r)=>{let i={...t.entries};for(let s of o)if(n.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new Rr({...t,checks:[],...y(r),entries:i})}});function Cc(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new Rr({type:"enum",entries:n,...y(t)})}function v_(e,t){return new Rr({type:"enum",entries:e,...y(t)})}var Qm=m("ZodLiteral",(e,t)=>{Xs.init(e,t),R.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function y_(e,t){return new Qm({type:"literal",values:Array.isArray(e)?e:[e],...y(t)})}var ep=m("ZodFile",(e,t)=>{Ys.init(e,t),R.init(e,t),e.min=(n,o)=>e.check(kt(n,o)),e.max=(n,o)=>e.check(Mt(n,o)),e.mime=(n,o)=>e.check(Tr(Array.isArray(n)?n:[n],o))});function b_(e){return Zl(ep,e)}var tp=m("ZodTransform",(e,t)=>{Qs.init(e,t),R.init(e,t),e._zod.parse=(n,o)=>{if(o.direction==="backward")throw new ht(e.constructor.name);n.addIssue=(i)=>{if(typeof i==="string")n.issues.push(it(i,n.value,t));else{let s=i;if(s.fatal)s.continue=!1;s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=e),n.issues.push(it(s))}};let r=t.transform(n.value,n);if(r instanceof Promise)return r.then((i)=>(n.value=i,n));return n.value=r,n}});function Mc(e){return new tp({type:"transform",transform:e})}var Ac=m("ZodOptional",(e,t)=>{ea.init(e,t),R.init(e,t),e.unwrap=()=>e._zod.def.innerType});function so(e){return new Ac({type:"optional",innerType:e})}var rp=m("ZodNullable",(e,t)=>{ta.init(e,t),R.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ao(e){return new rp({type:"nullable",innerType:e})}function __(e){return so(ao(e))}var np=m("ZodDefault",(e,t)=>{ra.init(e,t),R.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function op(e,t){return new np({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():er(t)}})}var ip=m("ZodPrefault",(e,t)=>{na.init(e,t),R.init(e,t),e.unwrap=()=>e._zod.def.innerType});function sp(e,t){return new ip({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():er(t)}})}var Nc=m("ZodNonOptional",(e,t)=>{oa.init(e,t),R.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ap(e,t){return new Nc({type:"nonoptional",innerType:e,...y(t)})}var lp=m("ZodSuccess",(e,t)=>{ia.init(e,t),R.init(e,t),e.unwrap=()=>e._zod.def.innerType});function k_(e){return new lp({type:"success",innerType:e})}var cp=m("ZodCatch",(e,t)=>{sa.init(e,t),R.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function up(e,t){return new cp({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var dp=m("ZodNaN",(e,t)=>{aa.init(e,t),R.init(e,t)});function w_(e){return Ml(dp,e)}var jc=m("ZodPipe",(e,t)=>{la.init(e,t),R.init(e,t),e.in=t.in,e.out=t.out});function lo(e,t){return new jc({type:"pipe",in:e,out:t})}var Uc=m("ZodCodec",(e,t)=>{jc.init(e,t),ur.init(e,t)});function x_(e,t,n){return new Uc({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}var mp=m("ZodReadonly",(e,t)=>{ca.init(e,t),R.init(e,t),e.unwrap=()=>e._zod.def.innerType});function pp(e){return new mp({type:"readonly",innerType:e})}var fp=m("ZodTemplateLiteral",(e,t)=>{ua.init(e,t),R.init(e,t)});function $_(e,t){return new fp({type:"template_literal",parts:e,...y(t)})}var gp=m("ZodLazy",(e,t)=>{pa.init(e,t),R.init(e,t),e.unwrap=()=>e._zod.def.getter()});function hp(e){return new gp({type:"lazy",getter:e})}var vp=m("ZodPromise",(e,t)=>{ma.init(e,t),R.init(e,t),e.unwrap=()=>e._zod.def.innerType});function S_(e){return new vp({type:"promise",innerType:e})}var yp=m("ZodFunction",(e,t)=>{da.init(e,t),R.init(e,t)});function I_(e){return new yp({type:"function",input:Array.isArray(e?.input)?Jm(e?.input):e?.input??mo(Ut()),output:e?.output??Ut()})}var fo=m("ZodCustom",(e,t)=>{fa.init(e,t),R.init(e,t)});function T_(e){let t=new Y({check:"custom"});return t._zod.check=e,t}function D_(e,t){return Gl(fo,e??(()=>!0),t)}function bp(e,t={}){return Wl(fo,e,t)}function _p(e){return Hl(e)}function P_(e,t={error:`Input not instance of ${e.name}`}){let n=new fo({type:"custom",check:"custom",fn:(o)=>o instanceof e,abort:!0,...y(t)});return n._zod.bag.Class=e,n}var O_=(...e)=>Vl({Codec:Uc,Boolean:Ar,String:zr},...e);function E_(e){let t=hp(()=>Rc([uc(e),Cm(),Mm(),Um(),mo(t),Km(uc(),t)]));return t}function R_(e,t){return lo(Mc(e),t)}var z_={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function C_(e){ie({customError:e})}function M_(){return ie().customError}var Lc;(function(e){})(Lc||(Lc={}));var Fc={};dt(Fc,{bigint:()=>U_,boolean:()=>j_,date:()=>L_,number:()=>N_,string:()=>A_});function A_(e){return al(zr,e)}function N_(e){return fl(Mr,e)}function j_(e){return kl(Ar,e)}function U_(e){return xl(Nr,e)}function L_(e){return Cl(uo,e)}ie(dr());function E(e){return e}E.schema=go;import{readFileSync as Q_}from"node:fs";import{dirname as ek,join as tk}from"node:path";import{fileURLToPath as rk}from"node:url";import{renameSync as F_,writeFileSync as Z_,readFileSync as AI,existsSync as Zc,statSync as G_}from"node:fs";import{dirname as W_}from"node:path";import{mkdirSync as H_}from"node:fs";function ho(e,t){let n=W_(t);if(!Zc(n))H_(n,{recursive:!0});let o=`${t}.tmp`;Z_(o,JSON.stringify(e,null,2),"utf8"),F_(o,t)}function V_(e){let t=0;if(Zc(e))try{t=G_(e).size}catch{}let n=0;for(let o=1;o<=10;o++)if(Zc(`${e}.${o}`))n=o;else break;return{path:e,sizeBytes:t,rotatedFiles:n}}function vo(e){let t=e.snapshot.counters,n=t.orchestrator_errors?.count??0,o=(t.decisions_skipped_continue?.count??0)+(t.decisions_skipped_no_decision?.count??0)+(t.decisions_skipped_no_message?.count??0)+(t.decisions_skipped_below_threshold?.count??0);return{version:e.version,status:n?"degraded":"healthy",enabled:e.enabled,startedAtISO:e.snapshot.startedAtISO,uptimeMs:e.snapshot.uptimeMs,metrics:{decisionsTaken:t.decisions_taken?.count??0,decisionsStored:t.decisions_stored?.count??0,interventionsDelivered:t.interventions_delivered?.count??0,orchestratorRuns:t.orchestrator_runs?.count??0,orchestratorErrors:n,materializationFailures:t.materialization_failures?.count??0,tier3RemindersSent:t.tier3_reminders_sent?.count??0,tier3SkillsCreated:t.tier3_skills_created?.count??0,lastDecisionISO:t.decisions_taken?.lastOccurrenceISO??null,lastInterventionISO:t.interventions_delivered?.lastOccurrenceISO??null},logFile:V_(e.logFilePath),session:{id:e.sessionID,toolCallsObserved:t.tool_calls_observed?.count??0,violationsDetected:t.protocol_violations_detected?.count??0,interventionsSkipped:o,firstSeenISO:e.snapshot.startedAtISO,lastSeenISO:new Date().toISOString()},graphSync:{lastUpgradeAtISO:null,lastUpgradeResult:"unknown",lastUpgradeTarget:null,lastUpgradeMs:null},graphToolsUsed:{omo_search:0,omo_recall:0,omo_health:0,omo_find:0,omo_impact:0,omo_remember:0,omo_recall_mcp:0,omo_path:0,omo_explain:0,omo_files:0,omo_callers:0,omo_node:0,omo_context:0,omo_affected_cg:0,omo_status:0,omo_unlock:0,omo_mark_dirty:0,omo_sync_if_dirty:0,omo_index:0,omo_visualize:0,omo_serve:0,omo_uninit:0,omo_diagnose:0,omo_merge_graphs:0,omo_save_result:0,omo_extract:0,omo_cluster_only:0,omo_label:0,omo_tree:0,omo_clone:0,omo_add:0,omo_check_update:0,omo_hook_status:0,omo_cli_anything_install:0,omo_cli_anything_list:0,omo_cli_anything_search:0,omo_cli_anything_info:0}}}function kp(e,t,n=Date.now){let o=-1/0;return{write(r){let i=n();if(i-o<t)return;o=i,e(r)}}}Kr();import{statSync as xp,existsSync as GI}from"node:fs";import{join as Wc}from"node:path";class wp{client=null;defaultTimeoutMs;toolCache=null;constructor(e={}){this.defaultTimeoutMs=e.defaultTimeoutMs??5000}setClient(e){this.client=e,this.toolCache=null}isReady(){return this.client!==null}async callTool(e,t={},n){let o=Date.now(),r=n??this.defaultTimeoutMs;if(!this.client)return{data:null,timedOut:!1,durationMs:Date.now()-o,error:"MCP client not initialized"};try{let s=(await this.raceWithTimeout(this.client.tool.invoke({toolID:e,input:t}),r,e)).data;return{data:s&&typeof s==="object"&&!Array.isArray(s)?s:null,timedOut:!1,durationMs:Date.now()-o,error:null}}catch(i){return{data:null,timedOut:i instanceof Error&&/timed out/i.test(i.message),durationMs:Date.now()-o,error:i instanceof Error?i.message:String(i)}}}async isAvailable(e){if(!this.client)return!1;if(this.toolCache===null)try{let t=await this.client.tool.list();this.toolCache=new Set((t.data??[]).map((n)=>n.id))}catch{this.toolCache=new Set}return this.toolCache.has(e)}async availableTools(){if(!this.client)return[];if(this.toolCache===null)await this.isAvailable("__bootstrap__");return Array.from(this.toolCache??new Set)}invalidateCache(){this.toolCache=null}raceWithTimeout(e,t,n){return new Promise((o,r)=>{let i=setTimeout(()=>{r(Error(`${n} timed out after ${t}ms`))},t);e.then((s)=>{clearTimeout(i),o(s)},(s)=>{clearTimeout(i),r(s)})})}}var Gc=null;function jr(){if(!Gc)Gc=new wp;return Gc}function B_(e,t,n,o){let r=t&&n;if(e==="codegraph")return t?{kind:"codegraph",cmd:"codegraph",args:[]}:null;if(e==="graphify")return n?{kind:"graphify",cmd:"graphify",args:[]}:null;if(e==="alternate"&&r)return(o??"").trim().toLowerCase().split("").reduce((a,l)=>a+l.charCodeAt(0),0)%2===0?{kind:"codegraph",cmd:"codegraph",args:[]}:{kind:"graphify",cmd:"graphify",args:[]};if(t)return{kind:"codegraph",cmd:"codegraph",args:[]};if(n)return{kind:"graphify",cmd:"graphify",args:[]};return null}function $p(e){let t=e.trim().toLowerCase(),n=2166136261;for(let o=0;o<t.length;o++)n^=t.charCodeAt(o),n=n*16777619>>>0;return n.toString(16)}class Sp{timeoutMs;cacheTtlMs;maxEntriesPerSession;cache=new Map;preferredTool;mcpTimeoutMs;preferredMcpServer;constructor(e={}){this.timeoutMs=e.timeoutMs??5000,this.cacheTtlMs=e.cacheTtlMs??300000,this.maxEntriesPerSession=e.maxEntriesPerSession??10,this.preferredTool=e.preferredTool??"auto",this.mcpTimeoutMs=e.mcpTimeoutMs??5000,this.preferredMcpServer=e.preferredMcpServer??"auto"}setPreferredTool(e){this.preferredTool=e}hasCodegraphDir(e){try{return xp(Wc(e,".codegraph")).isDirectory()}catch{return!1}}hasGraphifyDir(e){try{return xp(Wc(e,"graphify-out")).isDirectory()}catch{return!1}}cacheContext(e,t,n){let o=this.cache.get(e);if(!o)o={entries:new Map},this.cache.set(e,o);let r=$p(t);o.entries.set(r,{query:t,content:n,insertedAtMs:Date.now()});while(o.entries.size>this.maxEntriesPerSession){let i=o.entries.keys().next().value;if(!i)break;o.entries.delete(i)}}getCachedContext(e,t){let n=this.cache.get(e);if(!n)return null;if(t){let r=$p(t),i=n.entries.get(r);if(!i)return null;if(Date.now()-i.insertedAtMs>this.cacheTtlMs)return n.entries.delete(r),null;return i.content}let o=null;for(let r of n.entries.values())if(Date.now()-r.insertedAtMs<=this.cacheTtlMs)o=r.content;return o}clear(){this.cache.clear()}clearSession(e){this.cache.delete(e)}kindForServer(e){if(e==="codegraph")return"codegraph";if(e==="graphify")return"graphify";return null}async isMcpServerAvailable(e,t){try{let n=jr();if(!n.isReady())return!1;return t?await n.isAvailable(t):!0}catch{return!1}}async detectMcpServers(){let[e,t]=await Promise.all([this.isMcpServerAvailable("codegraph","codegraph_search"),this.isMcpServerAvailable("graphify","query_graph")]);return{codegraph:e,graphify:t}}async invokeMCP(e,t,n,o){let r=Date.now();try{let s=await jr().callTool(t,n,o.timeoutMs);if(s.error||s.data===null)return{kind:this.kindForServer(e),query:o.queryLabel,result:null,timedOut:s.timedOut,durationMs:Date.now()-r};let l=s.data.content,c=null;if(Array.isArray(l)&&l.length>0){let u=l[0];if(typeof u.text==="string")c=u.text}return{kind:this.kindForServer(e),query:o.queryLabel,result:c||null,timedOut:!1,durationMs:Date.now()-r}}catch{return{kind:this.kindForServer(e),query:o?.queryLabel??t,result:null,timedOut:!1,durationMs:Date.now()-r}}}async invoke(e,t,n={}){let o=Date.now(),r=n.timeoutMs??this.timeoutMs,i=this.hasCodegraphDir(e),s=this.hasGraphifyDir(e),a=n.preferredTool??this.preferredTool,l=B_(a,i,s,t);if(n.forceSubprocess!==!0&&l){let g=(n.preferredMcpServer??"auto")==="auto"?l.kind==="codegraph"?"codegraph":"graphify":n.preferredMcpServer;if(g!==null&&await this.isMcpServerAvailable(g)){let d=l.kind==="codegraph"?"codegraph_search":"query_graph",b=l.kind==="codegraph"?{query:t,projectPath:e}:{question:t,project_path:e};return{...await this.invokeMCP(g,d,b,{timeoutMs:r,queryLabel:t}),kind:l.kind}}}let c=null,u=null,f=[];if(l)if(c=l.kind,c==="codegraph")u=n.codegraphBin??"codegraph",f=["explore",t,"--project-path",e];else u=n.graphifyBin??"graphify",f=["query",t,"--graph",Wc(e,"graphify-out")];if(!u||!c)return{kind:null,query:t,result:null,timedOut:!1,durationMs:Date.now()-o};try{let g=await this.spawnWithTimeout(u,f,r,e);return{kind:c,query:t,result:g.trim()||null,timedOut:!1,durationMs:Date.now()-o}}catch(g){let d=g instanceof Error&&g.message.includes("timed out");return{kind:c,query:t,result:null,timedOut:d,durationMs:Date.now()-o}}}spawnWithTimeout(e,t,n,o){return Jr(e,t,{cwd:o,timeoutMs:n}).then((r)=>{if(r.timedOut)throw Error(`graph retrieval subprocess timed out after ${n}ms`);if(r.code===null)throw Error(`graph retrieval subprocess failed to spawn: ${e}`);if(r.code!==0)throw Error(`graph retrieval subprocess exited ${r.code}: ${r.stderr.slice(0,200)}`);return r.stdout})}async invokeNode(e,t,n={}){return this.invokeCodegraphSubcommand("node",e,t,n)}async invokeCallers(e,t,n={}){return this.invokeCodegraphSubcommand("callers",e,t,n)}async invokeImpact(e,t,n={}){return this.invokeCodegraphSubcommand("impact",e,t,n)}async invokeFiles(e,t={}){return this.invokeCodegraphSubcommand("files",void 0,e,t)}async invokeContext(e,t,n={}){return this.invokeCodegraphSubcommand("context",e,t,n)}async invokeAffected(e,t,n={}){return this.invokeCodegraphSubcommand("affected",e,t,n)}async invokeStatus(e,t={}){return this.invokeCodegraphSubcommand("status",void 0,e,t)}async invokeUnlock(e,t={}){return this.invokeCodegraphSubcommand("unlock",void 0,e,t)}async invokeMarkDirty(e,t={}){return this.invokeCodegraphSubcommand("mark-dirty",void 0,e,t)}async invokeSyncIfDirty(e,t={}){return this.invokeCodegraphSubcommand("sync-if-dirty",void 0,e,t)}async invokeIndex(e,t={}){return this.invokeCodegraphSubcommand("index",void 0,e,t)}async invokeVisualize(e,t={}){return this.invokeCodegraphSubcommand("visualize",void 0,e,t)}async invokeServe(e,t,n={}){return this.invokeCodegraphSubcommand("serve",String(e),t,n)}async invokeUninit(e,t={}){return this.invokeCodegraphSubcommand("uninit",void 0,e,t)}async invokeCodegraphSubcommand(e,t,n,o){let r=Date.now(),i=o.timeoutMs??this.timeoutMs;if(!this.hasCodegraphDir(n))return{kind:null,query:t===void 0?e:Array.isArray(t)?t.join(","):t,result:null,timedOut:!1,durationMs:Date.now()-r};let s=o.codegraphBin??"codegraph",a=t===void 0?[]:Array.isArray(t)?t:[t],l=[e,...a,"--project-path",n],c=t===void 0?e:Array.isArray(t)?t.join(","):t;try{let u=await this.spawnWithTimeout(s,l,i,n);return{kind:"codegraph",query:c,result:u.trim()||null,timedOut:!1,durationMs:Date.now()-r}}catch(u){let f=u instanceof Error&&/timed out/i.test(u.message);return{kind:"codegraph",query:c,result:null,timedOut:f,durationMs:Date.now()-r}}}async invokePath(e,t,n,o={}){let r=Date.now(),i=o.timeoutMs??this.timeoutMs;if(!this.hasGraphifyDir(n))return{kind:null,query:`${e} ${t}`,result:null,timedOut:!1,durationMs:Date.now()-r};let s=o.graphifyBin??"graphify",a=["path",e,t];try{let l=await this.spawnWithTimeout(s,a,i,n);return{kind:"graphify",query:`${e} ${t}`,result:l.trim()||null,timedOut:!1,durationMs:Date.now()-r}}catch(l){return{kind:"graphify",query:`${e} ${t}`,result:null,timedOut:l instanceof Error&&/timed out/i.test(l.message),durationMs:Date.now()-r}}}async invokeExplain(e,t,n={}){return this.invokeGraphifySubcommand("explain",e,t,n)}async invokeGraphifySubcommand(e,t,n,o){let r=Date.now(),i=o.timeoutMs??this.timeoutMs;if(!this.hasGraphifyDir(n))return{kind:null,query:t??e,result:null,timedOut:!1,durationMs:Date.now()-r};let s=o.graphifyBin??"graphify",a=t===void 0?[e]:[e,t];try{let l=await this.spawnWithTimeout(s,a,i,n);return{kind:"graphify",query:t??e,result:l.trim()||null,timedOut:!1,durationMs:Date.now()-r}}catch(l){return{kind:"graphify",query:t??e,result:null,timedOut:l instanceof Error&&/timed out/i.test(l.message),durationMs:Date.now()-r}}}async invokeDiagnose(e,t={}){return this.invokeGraphifySubcommand("diagnose",void 0,e,t)}async invokeMergeDriver(e,t={}){return this.invokeGraphifySubcommand("merge-driver",void 0,e,t)}async invokeSaveResult(e,t={}){return this.invokeGraphifySubcommand("save-result",void 0,e,t)}async invokeExtract(e,t={}){return this.invokeGraphifySubcommand("extract",void 0,e,t)}async invokeClusterOnly(e,t={}){return this.invokeGraphifySubcommand("cluster-only",void 0,e,t)}async invokeLabel(e,t,n={}){return this.invokeGraphifySubcommand("label",e,t,n)}async invokeTree(e,t={}){return this.invokeGraphifySubcommand("tree",void 0,e,t)}async invokeClone(e,t={}){return this.invokeGraphifySubcommand("clone",void 0,e,t)}async invokeAdd(e,t,n={}){return this.invokeGraphifySubcommand("add",e,t,n)}async invokeCheckUpdate(e,t={}){return this.invokeGraphifySubcommand("check-update",void 0,e,t)}}var Hc=null;function Z(){if(!Hc)Hc=new Sp;return Hc}function Ip(e){let t=Z();if(e.preferredTool)t.setPreferredTool(e.preferredTool)}var q_=Z();class Pp{retrieval;constructor(e=q_){this.retrieval=e}async find(e,t,n=5000){let o=Date.now(),r=await this.retrieval.invokeNode(e,t,{timeoutMs:n});if(r.kind==="codegraph"&&r.result)return J_(e,r.result,o,"codegraph");let i=await this.retrieval.invoke(t,e,{timeoutMs:n});if(i.kind==="graphify"&&i.result)return K_(e,i.result,o,"graphify");return{symbol:e,source:null,callers:[],found:!1,kind:r.kind??i.kind,durationMs:Date.now()-o}}async impact(e,t,n=5000){let o=Date.now(),r=await this.retrieval.invokeImpact(e,t,{timeoutMs:n});if(r.kind==="codegraph"&&r.result)return X_(e,r.result,o,"codegraph",r.timedOut);let i=await this.retrieval.invokeCallers(e,t,{timeoutMs:n});if(i.kind==="codegraph"&&i.result)return{symbol:e,directCallers:yo(i.result),transitiveCallers:[],testFiles:[],docFiles:[],totalAffectedFiles:new Set(yo(i.result).map((s)=>s.file)).size,kind:"codegraph",durationMs:Date.now()-o,timedOut:i.timedOut};return{symbol:e,directCallers:[],transitiveCallers:[],testFiles:[],docFiles:[],totalAffectedFiles:0,kind:r.kind??i.kind,durationMs:Date.now()-o,timedOut:r.timedOut||i.timedOut}}async listFiles(e,t=5000){let n=Date.now(),o=await this.retrieval.invokeFiles(e,{timeoutMs:t});if(o.kind==="codegraph"&&o.result){let r=o.result.split(`
193
- `).map((i)=>i.trim()).filter(Boolean);return{files:r,count:r.length,kind:"codegraph",durationMs:Date.now()-n}}return{files:[],count:0,kind:o.kind,durationMs:Date.now()-n}}}function J_(e,t,n,o){let r=yo(t),i=t.search(/callers?:|## callers?/i),s=i>0?t.slice(0,i).trim():t.trim();return{symbol:e,source:s||null,callers:r,found:r.length>0||s.length>0,kind:o,durationMs:Date.now()-n}}function K_(e,t,n,o){return{symbol:e,source:t.trim()||null,callers:[],found:t.trim().length>0,kind:o,durationMs:Date.now()-n}}function X_(e,t,n,o,r){let i=Tp(t,/direct\s*callers?:|## direct/i),s=Tp(t,/transitive\s*callers?:|## transitive/i),a=Dp(t,/tests?:|## tests?/i),l=Dp(t,/docs?:|## docs?/i),c=new Set;for(let u of i)c.add(u.file);for(let u of s)c.add(u.file);for(let u of a)c.add(u);for(let u of l)c.add(u);return{symbol:e,directCallers:i,transitiveCallers:s,testFiles:a,docFiles:l,totalAffectedFiles:c.size,kind:o,durationMs:Date.now()-n,timedOut:r}}function yo(e){let t=[],n=e.split(`
194
- `);for(let o of n){let r=o.match(/^\s*[-*]?\s*([^\s:]+\.[a-z]+):(\d+)(?:[:\s—–-]+(.+))?/i);if(r){let i=r[1]??"",s=r[2]?parseInt(r[2],10):0,a=(r[3]??"").trim();if(i&&s>0)t.push({file:i,line:s,context:a})}}return t}function Tp(e,t){let n=e.split(`
195
- `),o=!1,r=[];for(let i of n){if(t.test(i)){o=!0;continue}if(o){if(/^#\s/.test(i)&&!t.test(i))break;if(i.trim()===""&&r.length>0)break;r.push(i)}}return yo(r.join(`
192
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let c of this.seen.entries()){let u=c[1];if(e===c[0]){o(c);continue}if(n.external){let g=n.external.registry.get(c[0])?.id;if(e!==c[0]&&g){o(c);continue}}if(this.metadataRegistry.get(c[0])?.id){o(c);continue}if(u.cycle){o(c);continue}if(u.count>1){if(n.reused==="ref"){o(c);continue}}}let s=(c,u)=>{let f=this.seen.get(c),g=f.def??f.schema,d={...g};if(f.ref===null)return;let b=f.ref;if(f.ref=null,b){s(b,u);let x=this.seen.get(b).schema;if(x.$ref&&(u.target==="draft-7"||u.target==="draft-4"||u.target==="openapi-3.0"))g.allOf=g.allOf??[],g.allOf.push(x);else Object.assign(g,x),Object.assign(g,d)}if(!f.isParent)this.override({zodSchema:c,jsonSchema:g,path:f.path??[]})};for(let c of[...this.seen.entries()].reverse())s(c[0],{target:this.target});let a={};if(this.target==="draft-2020-12")a.$schema="https://json-schema.org/draft/2020-12/schema";else if(this.target==="draft-7")a.$schema="http://json-schema.org/draft-07/schema#";else if(this.target==="draft-4")a.$schema="http://json-schema.org/draft-04/schema#";else if(this.target==="openapi-3.0");else console.warn(`Invalid target: ${this.target}`);if(n.external?.uri){let c=n.external.registry.get(e)?.id;if(!c)throw Error("Schema is missing an `id` property");a.$id=n.external.uri(c)}Object.assign(a,i.def);let l=n.external?.defs??{};for(let c of this.seen.entries()){let u=c[1];if(u.def&&u.defId)l[u.defId]=u.def}if(n.external);else if(Object.keys(l).length>0)if(this.target==="draft-2020-12")a.$defs=l;else a.definitions=l;try{return JSON.parse(JSON.stringify(a))}catch(c){throw Error("Error converting schema to JSON.")}}}function Bl(e,t){if(e instanceof vr){let i=new Qn(t),r={};for(let a of e._idmap.entries()){let[l,c]=a;i.process(c)}let o={},s={registry:e,uri:t?.uri,defs:r};for(let a of e._idmap.entries()){let[l,c]=a;o[l]=i.emit(c,{...t,external:s})}if(Object.keys(r).length>0){let a=i.target==="draft-2020-12"?"$defs":"definitions";o.__shared={[a]:r}}return{schemas:o}}let n=new Qn(t);return n.process(e),n.emit(e,t)}function le(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;switch(r.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return le(r.element,n);case"object":{for(let o in r.shape)if(le(r.shape[o],n))return!0;return!1}case"union":{for(let o of r.options)if(le(o,n))return!0;return!1}case"intersection":return le(r.left,n)||le(r.right,n);case"tuple":{for(let o of r.items)if(le(o,n))return!0;if(r.rest&&le(r.rest,n))return!0;return!1}case"record":return le(r.keyType,n)||le(r.valueType,n);case"map":return le(r.keyType,n)||le(r.valueType,n);case"set":return le(r.valueType,n);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return le(r.innerType,n);case"lazy":return le(r.getter(),n);case"default":return le(r.innerType,n);case"prefault":return le(r.innerType,n);case"custom":return!1;case"transform":return!0;case"pipe":return le(r.in,n)||le(r.out,n);case"success":return!1;case"catch":return!1;case"function":return!1;default:}throw Error(`Unknown schema type: ${r.type}`)}var Em={};var ii={};dt(ii,{ZodISODate:()=>ti,ZodISODateTime:()=>ei,ZodISODuration:()=>ni,ZodISOTime:()=>ri,date:()=>Jl,datetime:()=>ql,duration:()=>Xl,time:()=>Kl});var ei=m("ZodISODateTime",(e,t)=>{bs.init(e,t),X.init(e,t)});function ql(e){return cl(ei,e)}var ti=m("ZodISODate",(e,t)=>{_s.init(e,t),X.init(e,t)});function Jl(e){return ul(ti,e)}var ri=m("ZodISOTime",(e,t)=>{ks.init(e,t),X.init(e,t)});function Kl(e){return dl(ri,e)}var ni=m("ZodISODuration",(e,t)=>{ws.init(e,t),X.init(e,t)});function Xl(e){return ml(ni,e)}var zm=(e,t)=>{ir.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(n)=>sr(e,n)},flatten:{value:(n)=>or(e,n)},addIssue:{value:(n)=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Dt,2)}},addIssues:{value:(n)=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Dt,2)}},isEmpty:{get(){return e.issues.length===0}}})},$b=m("ZodError",zm),_e=m("ZodError",zm,{Parent:Error});var Yl=Ot(_e),Ql=Et(_e),ec=Rt(_e),tc=zt(_e),rc=un(_e),nc=dn(_e),ic=mn(_e),oc=pn(_e),sc=fn(_e),ac=gn(_e),lc=hn(_e),cc=vn(_e);var z=m("ZodType",(e,t)=>(O.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map((i)=>typeof i==="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),e.clone=(n,i)=>he(e,n,i),e.brand=()=>e,e.register=(n,i)=>(n.add(e,i),e),e.parse=(n,i)=>Yl(e,n,i,{callee:e.parse}),e.safeParse=(n,i)=>ec(e,n,i),e.parseAsync=async(n,i)=>Ql(e,n,i,{callee:e.parseAsync}),e.safeParseAsync=async(n,i)=>tc(e,n,i),e.spa=e.safeParseAsync,e.encode=(n,i)=>rc(e,n,i),e.decode=(n,i)=>nc(e,n,i),e.encodeAsync=async(n,i)=>ic(e,n,i),e.decodeAsync=async(n,i)=>oc(e,n,i),e.safeEncode=(n,i)=>sc(e,n,i),e.safeDecode=(n,i)=>ac(e,n,i),e.safeEncodeAsync=async(n,i)=>lc(e,n,i),e.safeDecodeAsync=async(n,i)=>cc(e,n,i),e.refine=(n,i)=>e.check(bp(n,i)),e.superRefine=(n)=>e.check(_p(n)),e.overwrite=(n)=>e.check(qe(n)),e.optional=()=>si(e),e.nullable=()=>ai(e),e.nullish=()=>si(ai(e)),e.nonoptional=(n)=>ap(e,n),e.array=()=>di(e),e.or=(n)=>Rc([e,n]),e.and=(n)=>Bm(e,n),e.transform=(n)=>li(e,Ac(n)),e.default=(n)=>ip(e,n),e.prefault=(n)=>sp(e,n),e.catch=(n)=>up(e,n),e.pipe=(n)=>li(e,n),e.readonly=()=>pp(e),e.describe=(n)=>{let i=e.clone();return Fe.add(i,{description:n}),i},Object.defineProperty(e,"description",{get(){return Fe.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Fe.get(e);let i=e.clone();return Fe.add(i,n[0]),i},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),mc=m("_ZodString",(e,t)=>{bt.init(e,t),z.init(e,t);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...i)=>e.check(kr(...i)),e.includes=(...i)=>e.check($r(...i)),e.startsWith=(...i)=>e.check(Sr(...i)),e.endsWith=(...i)=>e.check(Ir(...i)),e.min=(...i)=>e.check(st(...i)),e.max=(...i)=>e.check(Mt(...i)),e.length=(...i)=>e.check(Nt(...i)),e.nonempty=(...i)=>e.check(st(1,...i)),e.lowercase=(i)=>e.check(wr(i)),e.uppercase=(i)=>e.check(xr(i)),e.trim=()=>e.check(Pr()),e.normalize=(...i)=>e.check(Dr(...i)),e.toLowerCase=()=>e.check(Or()),e.toUpperCase=()=>e.check(Er())}),zr=m("ZodString",(e,t)=>{bt.init(e,t),mc.init(e,t),e.email=(n)=>e.check(zn(pc,n)),e.url=(n)=>e.check(br(ci,n)),e.jwt=(n)=>e.check(Yn(Dc,n)),e.emoji=(n)=>e.check(jn(fc,n)),e.guid=(n)=>e.check(yr(oi,n)),e.uuid=(n)=>e.check(Cn(Ke,n)),e.uuidv4=(n)=>e.check(An(Ke,n)),e.uuidv6=(n)=>e.check(Mn(Ke,n)),e.uuidv7=(n)=>e.check(Nn(Ke,n)),e.nanoid=(n)=>e.check(Un(gc,n)),e.guid=(n)=>e.check(yr(oi,n)),e.cuid=(n)=>e.check(Ln(hc,n)),e.cuid2=(n)=>e.check(Fn(vc,n)),e.ulid=(n)=>e.check(Gn(yc,n)),e.base64=(n)=>e.check(Jn(Sc,n)),e.base64url=(n)=>e.check(Kn(Ic,n)),e.xid=(n)=>e.check(Zn(bc,n)),e.ksuid=(n)=>e.check(Wn(_c,n)),e.ipv4=(n)=>e.check(Hn(kc,n)),e.ipv6=(n)=>e.check(Vn(wc,n)),e.cidrv4=(n)=>e.check(Bn(xc,n)),e.cidrv6=(n)=>e.check(qn($c,n)),e.e164=(n)=>e.check(Xn(Tc,n)),e.datetime=(n)=>e.check(ql(n)),e.date=(n)=>e.check(Jl(n)),e.time=(n)=>e.check(Kl(n)),e.duration=(n)=>e.check(Xl(n))});function uc(e){return sl(zr,e)}var X=m("ZodStringFormat",(e,t)=>{J.init(e,t),mc.init(e,t)}),pc=m("ZodEmail",(e,t)=>{us.init(e,t),X.init(e,t)});function Ib(e){return zn(pc,e)}var oi=m("ZodGUID",(e,t)=>{ls.init(e,t),X.init(e,t)});function Tb(e){return yr(oi,e)}var Ke=m("ZodUUID",(e,t)=>{cs.init(e,t),X.init(e,t)});function Db(e){return Cn(Ke,e)}function Pb(e){return An(Ke,e)}function Ob(e){return Mn(Ke,e)}function Eb(e){return Nn(Ke,e)}var ci=m("ZodURL",(e,t)=>{ds.init(e,t),X.init(e,t)});function Rb(e){return br(ci,e)}function zb(e){return br(ci,{protocol:/^https?$/,hostname:om,...y(e)})}var fc=m("ZodEmoji",(e,t)=>{ms.init(e,t),X.init(e,t)});function Cb(e){return jn(fc,e)}var gc=m("ZodNanoID",(e,t)=>{ps.init(e,t),X.init(e,t)});function Ab(e){return Un(gc,e)}var hc=m("ZodCUID",(e,t)=>{fs.init(e,t),X.init(e,t)});function Mb(e){return Ln(hc,e)}var vc=m("ZodCUID2",(e,t)=>{gs.init(e,t),X.init(e,t)});function Nb(e){return Fn(vc,e)}var yc=m("ZodULID",(e,t)=>{hs.init(e,t),X.init(e,t)});function jb(e){return Gn(yc,e)}var bc=m("ZodXID",(e,t)=>{vs.init(e,t),X.init(e,t)});function Ub(e){return Zn(bc,e)}var _c=m("ZodKSUID",(e,t)=>{ys.init(e,t),X.init(e,t)});function Lb(e){return Wn(_c,e)}var kc=m("ZodIPv4",(e,t)=>{xs.init(e,t),X.init(e,t)});function Fb(e){return Hn(kc,e)}var wc=m("ZodIPv6",(e,t)=>{$s.init(e,t),X.init(e,t)});function Gb(e){return Vn(wc,e)}var xc=m("ZodCIDRv4",(e,t)=>{Ss.init(e,t),X.init(e,t)});function Zb(e){return Bn(xc,e)}var $c=m("ZodCIDRv6",(e,t)=>{Is.init(e,t),X.init(e,t)});function Wb(e){return qn($c,e)}var Sc=m("ZodBase64",(e,t)=>{Ds.init(e,t),X.init(e,t)});function Hb(e){return Jn(Sc,e)}var Ic=m("ZodBase64URL",(e,t)=>{Ps.init(e,t),X.init(e,t)});function Vb(e){return Kn(Ic,e)}var Tc=m("ZodE164",(e,t)=>{Os.init(e,t),X.init(e,t)});function Bb(e){return Xn(Tc,e)}var Dc=m("ZodJWT",(e,t)=>{Es.init(e,t),X.init(e,t)});function qb(e){return Yn(Dc,e)}var Cr=m("ZodCustomStringFormat",(e,t)=>{Rs.init(e,t),X.init(e,t)});function Jb(e,t,n={}){return jt(Cr,e,t,n)}function Kb(e){return jt(Cr,"hostname",bn,e)}function Xb(e){return jt(Cr,"hex",lm,e)}function Yb(e,t){let n=t?.enc??"hex",i=`${e}_${n}`,r=He[i];if(!r)throw Error(`Unrecognized hash format: ${i}`);return jt(Cr,i,r,t)}var Ar=m("ZodNumber",(e,t)=>{Dn.init(e,t),z.init(e,t),e.gt=(i,r)=>e.check(Be(i,r)),e.gte=(i,r)=>e.check(be(i,r)),e.min=(i,r)=>e.check(be(i,r)),e.lt=(i,r)=>e.check(Ve(i,r)),e.lte=(i,r)=>e.check(Pe(i,r)),e.max=(i,r)=>e.check(Pe(i,r)),e.int=(i)=>e.check(dc(i)),e.safe=(i)=>e.check(dc(i)),e.positive=(i)=>e.check(Be(0,i)),e.nonnegative=(i)=>e.check(be(0,i)),e.negative=(i)=>e.check(Ve(0,i)),e.nonpositive=(i)=>e.check(Pe(0,i)),e.multipleOf=(i,r)=>e.check(_t(i,r)),e.step=(i,r)=>e.check(_t(i,r)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??0.5),e.isFinite=!0,e.format=n.format??null});function Cm(e){return pl(Ar,e)}var Lt=m("ZodNumberFormat",(e,t)=>{zs.init(e,t),Ar.init(e,t)});function dc(e){return gl(Lt,e)}function Qb(e){return hl(Lt,e)}function e_(e){return vl(Lt,e)}function t_(e){return yl(Lt,e)}function r_(e){return bl(Lt,e)}var Mr=m("ZodBoolean",(e,t)=>{cr.init(e,t),z.init(e,t)});function Am(e){return _l(Mr,e)}var Nr=m("ZodBigInt",(e,t)=>{Pn.init(e,t),z.init(e,t),e.gte=(i,r)=>e.check(be(i,r)),e.min=(i,r)=>e.check(be(i,r)),e.gt=(i,r)=>e.check(Be(i,r)),e.gte=(i,r)=>e.check(be(i,r)),e.min=(i,r)=>e.check(be(i,r)),e.lt=(i,r)=>e.check(Ve(i,r)),e.lte=(i,r)=>e.check(Pe(i,r)),e.max=(i,r)=>e.check(Pe(i,r)),e.positive=(i)=>e.check(Be(BigInt(0),i)),e.negative=(i)=>e.check(Ve(BigInt(0),i)),e.nonpositive=(i)=>e.check(Pe(BigInt(0),i)),e.nonnegative=(i)=>e.check(be(BigInt(0),i)),e.multipleOf=(i,r)=>e.check(_t(i,r));let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});function n_(e){return wl(Nr,e)}var Pc=m("ZodBigIntFormat",(e,t)=>{Cs.init(e,t),Nr.init(e,t)});function i_(e){return $l(Pc,e)}function o_(e){return Sl(Pc,e)}var Mm=m("ZodSymbol",(e,t)=>{As.init(e,t),z.init(e,t)});function s_(e){return Il(Mm,e)}var Nm=m("ZodUndefined",(e,t)=>{Ms.init(e,t),z.init(e,t)});function a_(e){return Tl(Nm,e)}var jm=m("ZodNull",(e,t)=>{Ns.init(e,t),z.init(e,t)});function Um(e){return Dl(jm,e)}var Lm=m("ZodAny",(e,t)=>{js.init(e,t),z.init(e,t)});function l_(){return Pl(Lm)}var Fm=m("ZodUnknown",(e,t)=>{Us.init(e,t),z.init(e,t)});function Ut(){return Ol(Fm)}var Gm=m("ZodNever",(e,t)=>{Ls.init(e,t),z.init(e,t)});function Oc(e){return El(Gm,e)}var Zm=m("ZodVoid",(e,t)=>{Fs.init(e,t),z.init(e,t)});function c_(e){return Rl(Zm,e)}var ui=m("ZodDate",(e,t)=>{Gs.init(e,t),z.init(e,t),e.min=(i,r)=>e.check(be(i,r)),e.max=(i,r)=>e.check(Pe(i,r));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function u_(e){return zl(ui,e)}var Wm=m("ZodArray",(e,t)=>{Zs.init(e,t),z.init(e,t),e.element=t.element,e.min=(n,i)=>e.check(st(n,i)),e.nonempty=(n)=>e.check(st(1,n)),e.max=(n,i)=>e.check(Mt(n,i)),e.length=(n,i)=>e.check(Nt(n,i)),e.unwrap=()=>e.element});function di(e,t){return Fl(Wm,e,t)}function d_(e){let t=e._zod.def.shape;return Cc(Object.keys(t))}var mi=m("ZodObject",(e,t)=>{Ws.init(e,t),z.init(e,t),A(e,"shape",()=>t.shape),e.keyof=()=>Cc(Object.keys(e._zod.def.shape)),e.catchall=(n)=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ut()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ut()}),e.strict=()=>e.clone({...e._zod.def,catchall:Oc()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=(n)=>qd(e,n),e.safeExtend=(n)=>Jd(e,n),e.merge=(n)=>Kd(e,n),e.pick=(n)=>Vd(e,n),e.omit=(n)=>Bd(e,n),e.partial=(...n)=>Xd(Mc,e,n[0]),e.required=(...n)=>Yd(Nc,e,n[0])});function m_(e,t){let n={type:"object",get shape(){return Re(this,"shape",e?on(e):{}),this.shape},...y(t)};return new mi(n)}function p_(e,t){return new mi({type:"object",get shape(){return Re(this,"shape",on(e)),this.shape},catchall:Oc(),...y(t)})}function f_(e,t){return new mi({type:"object",get shape(){return Re(this,"shape",on(e)),this.shape},catchall:Ut(),...y(t)})}var Ec=m("ZodUnion",(e,t)=>{On.init(e,t),z.init(e,t),e.options=t.options});function Rc(e,t){return new Ec({type:"union",options:e,...y(t)})}var Hm=m("ZodDiscriminatedUnion",(e,t)=>{Ec.init(e,t),Hs.init(e,t)});function g_(e,t,n){return new Hm({type:"union",options:t,discriminator:e,...y(n)})}var Vm=m("ZodIntersection",(e,t)=>{Vs.init(e,t),z.init(e,t)});function Bm(e,t){return new Vm({type:"intersection",left:e,right:t})}var qm=m("ZodTuple",(e,t)=>{En.init(e,t),z.init(e,t),e.rest=(n)=>e.clone({...e._zod.def,rest:n})});function Jm(e,t,n){let i=t instanceof O,r=i?n:t;return new qm({type:"tuple",items:e,rest:i?t:null,...y(r)})}var zc=m("ZodRecord",(e,t)=>{Bs.init(e,t),z.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function Km(e,t,n){return new zc({type:"record",keyType:e,valueType:t,...y(n)})}function h_(e,t,n){let i=he(e);return i._zod.values=void 0,new zc({type:"record",keyType:i,valueType:t,...y(n)})}var Xm=m("ZodMap",(e,t)=>{qs.init(e,t),z.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function v_(e,t,n){return new Xm({type:"map",keyType:e,valueType:t,...y(n)})}var Ym=m("ZodSet",(e,t)=>{Js.init(e,t),z.init(e,t),e.min=(...n)=>e.check(kt(...n)),e.nonempty=(n)=>e.check(kt(1,n)),e.max=(...n)=>e.check(At(...n)),e.size=(...n)=>e.check(_r(...n))});function y_(e,t){return new Ym({type:"set",valueType:e,...y(t)})}var Rr=m("ZodEnum",(e,t)=>{Ks.init(e,t),z.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(i,r)=>{let o={};for(let s of i)if(n.has(s))o[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new Rr({...t,checks:[],...y(r),entries:o})},e.exclude=(i,r)=>{let o={...t.entries};for(let s of i)if(n.has(s))delete o[s];else throw Error(`Key ${s} not found in enum`);return new Rr({...t,checks:[],...y(r),entries:o})}});function Cc(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map((i)=>[i,i])):e;return new Rr({type:"enum",entries:n,...y(t)})}function b_(e,t){return new Rr({type:"enum",entries:e,...y(t)})}var Qm=m("ZodLiteral",(e,t)=>{Xs.init(e,t),z.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function __(e,t){return new Qm({type:"literal",values:Array.isArray(e)?e:[e],...y(t)})}var ep=m("ZodFile",(e,t)=>{Ys.init(e,t),z.init(e,t),e.min=(n,i)=>e.check(kt(n,i)),e.max=(n,i)=>e.check(At(n,i)),e.mime=(n,i)=>e.check(Tr(Array.isArray(n)?n:[n],i))});function k_(e){return Gl(ep,e)}var tp=m("ZodTransform",(e,t)=>{Qs.init(e,t),z.init(e,t),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new ht(e.constructor.name);n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(ot(o,n.value,t));else{let s=o;if(s.fatal)s.continue=!1;s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=e),n.issues.push(ot(s))}};let r=t.transform(n.value,n);if(r instanceof Promise)return r.then((o)=>(n.value=o,n));return n.value=r,n}});function Ac(e){return new tp({type:"transform",transform:e})}var Mc=m("ZodOptional",(e,t)=>{ea.init(e,t),z.init(e,t),e.unwrap=()=>e._zod.def.innerType});function si(e){return new Mc({type:"optional",innerType:e})}var rp=m("ZodNullable",(e,t)=>{ta.init(e,t),z.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ai(e){return new rp({type:"nullable",innerType:e})}function w_(e){return si(ai(e))}var np=m("ZodDefault",(e,t)=>{ra.init(e,t),z.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ip(e,t){return new np({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():er(t)}})}var op=m("ZodPrefault",(e,t)=>{na.init(e,t),z.init(e,t),e.unwrap=()=>e._zod.def.innerType});function sp(e,t){return new op({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():er(t)}})}var Nc=m("ZodNonOptional",(e,t)=>{ia.init(e,t),z.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ap(e,t){return new Nc({type:"nonoptional",innerType:e,...y(t)})}var lp=m("ZodSuccess",(e,t)=>{oa.init(e,t),z.init(e,t),e.unwrap=()=>e._zod.def.innerType});function x_(e){return new lp({type:"success",innerType:e})}var cp=m("ZodCatch",(e,t)=>{sa.init(e,t),z.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function up(e,t){return new cp({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var dp=m("ZodNaN",(e,t)=>{aa.init(e,t),z.init(e,t)});function $_(e){return Al(dp,e)}var jc=m("ZodPipe",(e,t)=>{la.init(e,t),z.init(e,t),e.in=t.in,e.out=t.out});function li(e,t){return new jc({type:"pipe",in:e,out:t})}var Uc=m("ZodCodec",(e,t)=>{jc.init(e,t),ur.init(e,t)});function S_(e,t,n){return new Uc({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}var mp=m("ZodReadonly",(e,t)=>{ca.init(e,t),z.init(e,t),e.unwrap=()=>e._zod.def.innerType});function pp(e){return new mp({type:"readonly",innerType:e})}var fp=m("ZodTemplateLiteral",(e,t)=>{ua.init(e,t),z.init(e,t)});function I_(e,t){return new fp({type:"template_literal",parts:e,...y(t)})}var gp=m("ZodLazy",(e,t)=>{pa.init(e,t),z.init(e,t),e.unwrap=()=>e._zod.def.getter()});function hp(e){return new gp({type:"lazy",getter:e})}var vp=m("ZodPromise",(e,t)=>{ma.init(e,t),z.init(e,t),e.unwrap=()=>e._zod.def.innerType});function T_(e){return new vp({type:"promise",innerType:e})}var yp=m("ZodFunction",(e,t)=>{da.init(e,t),z.init(e,t)});function D_(e){return new yp({type:"function",input:Array.isArray(e?.input)?Jm(e?.input):e?.input??di(Ut()),output:e?.output??Ut()})}var pi=m("ZodCustom",(e,t)=>{fa.init(e,t),z.init(e,t)});function P_(e){let t=new Y({check:"custom"});return t._zod.check=e,t}function O_(e,t){return Zl(pi,e??(()=>!0),t)}function bp(e,t={}){return Wl(pi,e,t)}function _p(e){return Hl(e)}function E_(e,t={error:`Input not instance of ${e.name}`}){let n=new pi({type:"custom",check:"custom",fn:(i)=>i instanceof e,abort:!0,...y(t)});return n._zod.bag.Class=e,n}var R_=(...e)=>Vl({Codec:Uc,Boolean:Mr,String:zr},...e);function z_(e){let t=hp(()=>Rc([uc(e),Cm(),Am(),Um(),di(t),Km(uc(),t)]));return t}function C_(e,t){return li(Ac(e),t)}var A_={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function M_(e){oe({customError:e})}function N_(){return oe().customError}var Lc;(function(e){})(Lc||(Lc={}));var Fc={};dt(Fc,{bigint:()=>F_,boolean:()=>L_,date:()=>G_,number:()=>U_,string:()=>j_});function j_(e){return al(zr,e)}function U_(e){return fl(Ar,e)}function L_(e){return kl(Mr,e)}function F_(e){return xl(Nr,e)}function G_(e){return Cl(ui,e)}oe(dr());function R(e){return e}R.schema=fi;import{readFileSync as tk}from"node:fs";import{dirname as rk,join as nk}from"node:path";import{fileURLToPath as ik}from"node:url";import{renameSync as Z_,writeFileSync as W_,readFileSync as FI,existsSync as Gc,statSync as H_}from"node:fs";import{dirname as V_}from"node:path";import{mkdirSync as B_}from"node:fs";function gi(e,t){let n=V_(t);if(!Gc(n))B_(n,{recursive:!0});let i=`${t}.tmp`;W_(i,JSON.stringify(e,null,2),"utf8"),Z_(i,t)}function q_(e){let t=0;if(Gc(e))try{t=H_(e).size}catch{}let n=0;for(let i=1;i<=10;i++)if(Gc(`${e}.${i}`))n=i;else break;return{path:e,sizeBytes:t,rotatedFiles:n}}function hi(e){let t=e.snapshot.counters,n=t.orchestrator_errors?.count??0,i=(t.decisions_skipped_continue?.count??0)+(t.decisions_skipped_no_decision?.count??0)+(t.decisions_skipped_no_message?.count??0)+(t.decisions_skipped_below_threshold?.count??0);return{version:e.version,status:n?"degraded":"healthy",enabled:e.enabled,startedAtISO:e.snapshot.startedAtISO,uptimeMs:e.snapshot.uptimeMs,metrics:{decisionsTaken:t.decisions_taken?.count??0,decisionsStored:t.decisions_stored?.count??0,interventionsDelivered:t.interventions_delivered?.count??0,orchestratorRuns:t.orchestrator_runs?.count??0,orchestratorErrors:n,materializationFailures:t.materialization_failures?.count??0,tier3RemindersSent:t.tier3_reminders_sent?.count??0,tier3SkillsCreated:t.tier3_skills_created?.count??0,lastDecisionISO:t.decisions_taken?.lastOccurrenceISO??null,lastInterventionISO:t.interventions_delivered?.lastOccurrenceISO??null},logFile:q_(e.logFilePath),session:{id:e.sessionID,toolCallsObserved:t.tool_calls_observed?.count??0,violationsDetected:t.protocol_violations_detected?.count??0,interventionsSkipped:i,firstSeenISO:e.snapshot.startedAtISO,lastSeenISO:new Date().toISOString()},graphSync:{lastUpgradeAtISO:null,lastUpgradeResult:"unknown",lastUpgradeTarget:null,lastUpgradeMs:null},graphToolsUsed:{omo_search:0,omo_recall:0,omo_health:0,omo_find:0,omo_impact:0,omo_remember:0,omo_recall_mcp:0,omo_path:0,omo_explain:0,omo_files:0,omo_callers:0,omo_node:0,omo_context:0,omo_affected_cg:0,omo_status:0,omo_unlock:0,omo_mark_dirty:0,omo_sync_if_dirty:0,omo_index:0,omo_visualize:0,omo_serve:0,omo_uninit:0,omo_diagnose:0,omo_merge_graphs:0,omo_save_result:0,omo_extract:0,omo_cluster_only:0,omo_label:0,omo_tree:0,omo_clone:0,omo_add:0,omo_check_update:0,omo_hook_status:0,omo_cli_anything_install:0,omo_cli_anything_list:0,omo_cli_anything_search:0,omo_cli_anything_info:0}}}function kp(e,t,n=Date.now){let i=-1/0;return{write(r){let o=n();if(o-i<t)return;i=o,e(r)}}}Kr();import{statSync as xp,existsSync as qI}from"node:fs";import{join as Wc}from"node:path";class wp{client=null;defaultTimeoutMs;toolCache=null;constructor(e={}){this.defaultTimeoutMs=e.defaultTimeoutMs??5000}setClient(e){this.client=e,this.toolCache=null}isReady(){return this.client!==null}async callTool(e,t={},n){let i=Date.now(),r=n??this.defaultTimeoutMs;if(!this.client)return{data:null,timedOut:!1,durationMs:Date.now()-i,error:"MCP client not initialized"};try{let s=(await this.raceWithTimeout(this.client.tool.invoke({toolID:e,input:t}),r,e)).data;return{data:s&&typeof s==="object"&&!Array.isArray(s)?s:null,timedOut:!1,durationMs:Date.now()-i,error:null}}catch(o){return{data:null,timedOut:o instanceof Error&&/timed out/i.test(o.message),durationMs:Date.now()-i,error:o instanceof Error?o.message:String(o)}}}async isAvailable(e){if(!this.client)return!1;if(this.toolCache===null)try{let t=await this.client.tool.list();this.toolCache=new Set((t.data??[]).map((n)=>n.id))}catch{this.toolCache=new Set}return this.toolCache.has(e)}async availableTools(){if(!this.client)return[];if(this.toolCache===null)await this.isAvailable("__bootstrap__");return Array.from(this.toolCache??new Set)}invalidateCache(){this.toolCache=null}raceWithTimeout(e,t,n){return new Promise((i,r)=>{let o=setTimeout(()=>{r(Error(`${n} timed out after ${t}ms`))},t);e.then((s)=>{clearTimeout(o),i(s)},(s)=>{clearTimeout(o),r(s)})})}}var Zc=null;function jr(){if(!Zc)Zc=new wp;return Zc}function J_(e,t,n,i){let r=t&&n;if(e==="codegraph")return t?{kind:"codegraph",cmd:"codegraph",args:[]}:null;if(e==="graphify")return n?{kind:"graphify",cmd:"graphify",args:[]}:null;if(e==="alternate"&&r)return(i??"").trim().toLowerCase().split("").reduce((a,l)=>a+l.charCodeAt(0),0)%2===0?{kind:"codegraph",cmd:"codegraph",args:[]}:{kind:"graphify",cmd:"graphify",args:[]};if(t)return{kind:"codegraph",cmd:"codegraph",args:[]};if(n)return{kind:"graphify",cmd:"graphify",args:[]};return null}function $p(e){let t=e.trim().toLowerCase(),n=2166136261;for(let i=0;i<t.length;i++)n^=t.charCodeAt(i),n=n*16777619>>>0;return n.toString(16)}class Sp{timeoutMs;cacheTtlMs;maxEntriesPerSession;cache=new Map;preferredTool;mcpTimeoutMs;preferredMcpServer;constructor(e={}){this.timeoutMs=e.timeoutMs??5000,this.cacheTtlMs=e.cacheTtlMs??300000,this.maxEntriesPerSession=e.maxEntriesPerSession??10,this.preferredTool=e.preferredTool??"auto",this.mcpTimeoutMs=e.mcpTimeoutMs??5000,this.preferredMcpServer=e.preferredMcpServer??"auto"}setPreferredTool(e){this.preferredTool=e}hasCodegraphDir(e){try{return xp(Wc(e,".codegraph")).isDirectory()}catch{return!1}}hasGraphifyDir(e){try{return xp(Wc(e,"graphify-out")).isDirectory()}catch{return!1}}cacheContext(e,t,n){let i=this.cache.get(e);if(!i)i={entries:new Map},this.cache.set(e,i);let r=$p(t);i.entries.set(r,{query:t,content:n,insertedAtMs:Date.now()});while(i.entries.size>this.maxEntriesPerSession){let o=i.entries.keys().next().value;if(!o)break;i.entries.delete(o)}}getCachedContext(e,t){let n=this.cache.get(e);if(!n)return null;if(t){let r=$p(t),o=n.entries.get(r);if(!o)return null;if(Date.now()-o.insertedAtMs>this.cacheTtlMs)return n.entries.delete(r),null;return o.content}let i=null;for(let r of n.entries.values())if(Date.now()-r.insertedAtMs<=this.cacheTtlMs)i=r.content;return i}clear(){this.cache.clear()}clearSession(e){this.cache.delete(e)}kindForServer(e){if(e==="codegraph")return"codegraph";if(e==="graphify")return"graphify";return null}async isMcpServerAvailable(e,t){try{let n=jr();if(!n.isReady())return!1;return t?await n.isAvailable(t):!0}catch{return!1}}async detectMcpServers(){let[e,t]=await Promise.all([this.isMcpServerAvailable("codegraph","codegraph_search"),this.isMcpServerAvailable("graphify","query_graph")]);return{codegraph:e,graphify:t}}async invokeMCP(e,t,n,i){let r=Date.now();try{let s=await jr().callTool(t,n,i.timeoutMs);if(s.error||s.data===null)return{kind:this.kindForServer(e),query:i.queryLabel,result:null,timedOut:s.timedOut,durationMs:Date.now()-r};let l=s.data.content,c=null;if(Array.isArray(l)&&l.length>0){let u=l[0];if(typeof u.text==="string")c=u.text}return{kind:this.kindForServer(e),query:i.queryLabel,result:c||null,timedOut:!1,durationMs:Date.now()-r}}catch{return{kind:this.kindForServer(e),query:i?.queryLabel??t,result:null,timedOut:!1,durationMs:Date.now()-r}}}async invoke(e,t,n={}){let i=Date.now(),r=n.timeoutMs??this.timeoutMs,o=this.hasCodegraphDir(e),s=this.hasGraphifyDir(e),a=n.preferredTool??this.preferredTool,l=J_(a,o,s,t);if(n.forceSubprocess!==!0&&l){let g=(n.preferredMcpServer??"auto")==="auto"?l.kind==="codegraph"?"codegraph":"graphify":n.preferredMcpServer;if(g!==null&&await this.isMcpServerAvailable(g)){let d=l.kind==="codegraph"?"codegraph_search":"query_graph",b=l.kind==="codegraph"?{query:t,projectPath:e}:{question:t,project_path:e};return{...await this.invokeMCP(g,d,b,{timeoutMs:r,queryLabel:t}),kind:l.kind}}}let c=null,u=null,f=[];if(l)if(c=l.kind,c==="codegraph")u=n.codegraphBin??"codegraph",f=["explore",t,"--project-path",e];else u=n.graphifyBin??"graphify",f=["query",t,"--graph",Wc(e,"graphify-out")];if(!u||!c)return{kind:null,query:t,result:null,timedOut:!1,durationMs:Date.now()-i};try{let g=await this.spawnWithTimeout(u,f,r,e);return{kind:c,query:t,result:g.trim()||null,timedOut:!1,durationMs:Date.now()-i}}catch(g){let d=g instanceof Error&&g.message.includes("timed out");return{kind:c,query:t,result:null,timedOut:d,durationMs:Date.now()-i}}}spawnWithTimeout(e,t,n,i){return Jr(e,t,{cwd:i,timeoutMs:n}).then((r)=>{if(r.timedOut)throw Error(`graph retrieval subprocess timed out after ${n}ms`);if(r.code===null)throw Error(`graph retrieval subprocess failed to spawn: ${e}`);if(r.code!==0)throw Error(`graph retrieval subprocess exited ${r.code}: ${r.stderr.slice(0,200)}`);return r.stdout})}async invokeNode(e,t,n={}){return this.invokeCodegraphSubcommand("node",e,t,n)}async invokeCallers(e,t,n={}){return this.invokeCodegraphSubcommand("callers",e,t,n)}async invokeImpact(e,t,n={}){return this.invokeCodegraphSubcommand("impact",e,t,n)}async invokeFiles(e,t={}){return this.invokeCodegraphSubcommand("files",void 0,e,t)}async invokeContext(e,t,n={}){return this.invokeCodegraphSubcommand("context",e,t,n)}async invokeAffected(e,t,n={}){return this.invokeCodegraphSubcommand("affected",e,t,n)}async invokeStatus(e,t={}){return this.invokeCodegraphSubcommand("status",void 0,e,t)}async invokeUnlock(e,t={}){return this.invokeCodegraphSubcommand("unlock",void 0,e,t)}async invokeMarkDirty(e,t={}){return this.invokeCodegraphSubcommand("mark-dirty",void 0,e,t)}async invokeSyncIfDirty(e,t={}){return this.invokeCodegraphSubcommand("sync-if-dirty",void 0,e,t)}async invokeIndex(e,t={}){return this.invokeCodegraphSubcommand("index",void 0,e,t)}async invokeVisualize(e,t={}){return this.invokeCodegraphSubcommand("visualize",void 0,e,t)}async invokeServe(e,t,n={}){return this.invokeCodegraphSubcommand("serve",String(e),t,n)}async invokeUninit(e,t={}){return this.invokeCodegraphSubcommand("uninit",void 0,e,t)}async invokeCodegraphSubcommand(e,t,n,i){let r=Date.now(),o=i.timeoutMs??this.timeoutMs;if(!this.hasCodegraphDir(n))return{kind:null,query:t===void 0?e:Array.isArray(t)?t.join(","):t,result:null,timedOut:!1,durationMs:Date.now()-r};let s=i.codegraphBin??"codegraph",a=t===void 0?[]:Array.isArray(t)?t:[t],l=[e,...a,"--project-path",n],c=t===void 0?e:Array.isArray(t)?t.join(","):t;try{let u=await this.spawnWithTimeout(s,l,o,n);return{kind:"codegraph",query:c,result:u.trim()||null,timedOut:!1,durationMs:Date.now()-r}}catch(u){let f=u instanceof Error&&/timed out/i.test(u.message);return{kind:"codegraph",query:c,result:null,timedOut:f,durationMs:Date.now()-r}}}async invokePath(e,t,n,i={}){let r=Date.now(),o=i.timeoutMs??this.timeoutMs;if(!this.hasGraphifyDir(n))return{kind:null,query:`${e} ${t}`,result:null,timedOut:!1,durationMs:Date.now()-r};let s=i.graphifyBin??"graphify",a=["path",e,t];try{let l=await this.spawnWithTimeout(s,a,o,n);return{kind:"graphify",query:`${e} ${t}`,result:l.trim()||null,timedOut:!1,durationMs:Date.now()-r}}catch(l){return{kind:"graphify",query:`${e} ${t}`,result:null,timedOut:l instanceof Error&&/timed out/i.test(l.message),durationMs:Date.now()-r}}}async invokeExplain(e,t,n={}){return this.invokeGraphifySubcommand("explain",e,t,n)}async invokeGraphifySubcommand(e,t,n,i){let r=Date.now(),o=i.timeoutMs??this.timeoutMs;if(!this.hasGraphifyDir(n))return{kind:null,query:t??e,result:null,timedOut:!1,durationMs:Date.now()-r};let s=i.graphifyBin??"graphify",a=t===void 0?[e]:[e,t];try{let l=await this.spawnWithTimeout(s,a,o,n);return{kind:"graphify",query:t??e,result:l.trim()||null,timedOut:!1,durationMs:Date.now()-r}}catch(l){return{kind:"graphify",query:t??e,result:null,timedOut:l instanceof Error&&/timed out/i.test(l.message),durationMs:Date.now()-r}}}async invokeDiagnose(e,t={}){return this.invokeGraphifySubcommand("diagnose",void 0,e,t)}async invokeMergeDriver(e,t={}){return this.invokeGraphifySubcommand("merge-driver",void 0,e,t)}async invokeSaveResult(e,t={}){return this.invokeGraphifySubcommand("save-result",void 0,e,t)}async invokeExtract(e,t={}){return this.invokeGraphifySubcommand("extract",void 0,e,t)}async invokeClusterOnly(e,t={}){return this.invokeGraphifySubcommand("cluster-only",void 0,e,t)}async invokeLabel(e,t,n={}){return this.invokeGraphifySubcommand("label",e,t,n)}async invokeTree(e,t={}){return this.invokeGraphifySubcommand("tree",void 0,e,t)}async invokeClone(e,t={}){return this.invokeGraphifySubcommand("clone",void 0,e,t)}async invokeAdd(e,t,n={}){return this.invokeGraphifySubcommand("add",e,t,n)}async invokeCheckUpdate(e,t={}){return this.invokeGraphifySubcommand("check-update",void 0,e,t)}}var Hc=null;function G(){if(!Hc)Hc=new Sp;return Hc}function Ip(e){let t=G();if(e.preferredTool)t.setPreferredTool(e.preferredTool)}var K_=G();class Pp{retrieval;constructor(e=K_){this.retrieval=e}async find(e,t,n=5000){let i=Date.now(),r=await this.retrieval.invokeNode(e,t,{timeoutMs:n});if(r.kind==="codegraph"&&r.result)return X_(e,r.result,i,"codegraph");let o=await this.retrieval.invoke(t,e,{timeoutMs:n});if(o.kind==="graphify"&&o.result)return Y_(e,o.result,i,"graphify");return{symbol:e,source:null,callers:[],found:!1,kind:r.kind??o.kind,durationMs:Date.now()-i}}async impact(e,t,n=5000){let i=Date.now(),r=await this.retrieval.invokeImpact(e,t,{timeoutMs:n});if(r.kind==="codegraph"&&r.result)return Q_(e,r.result,i,"codegraph",r.timedOut);let o=await this.retrieval.invokeCallers(e,t,{timeoutMs:n});if(o.kind==="codegraph"&&o.result)return{symbol:e,directCallers:vi(o.result),transitiveCallers:[],testFiles:[],docFiles:[],totalAffectedFiles:new Set(vi(o.result).map((s)=>s.file)).size,kind:"codegraph",durationMs:Date.now()-i,timedOut:o.timedOut};return{symbol:e,directCallers:[],transitiveCallers:[],testFiles:[],docFiles:[],totalAffectedFiles:0,kind:r.kind??o.kind,durationMs:Date.now()-i,timedOut:r.timedOut||o.timedOut}}async listFiles(e,t=5000){let n=Date.now(),i=await this.retrieval.invokeFiles(e,{timeoutMs:t});if(i.kind==="codegraph"&&i.result){let r=i.result.split(`
193
+ `).map((o)=>o.trim()).filter(Boolean);return{files:r,count:r.length,kind:"codegraph",durationMs:Date.now()-n}}return{files:[],count:0,kind:i.kind,durationMs:Date.now()-n}}}function X_(e,t,n,i){let r=vi(t),o=t.search(/callers?:|## callers?/i),s=o>0?t.slice(0,o).trim():t.trim();return{symbol:e,source:s||null,callers:r,found:r.length>0||s.length>0,kind:i,durationMs:Date.now()-n}}function Y_(e,t,n,i){return{symbol:e,source:t.trim()||null,callers:[],found:t.trim().length>0,kind:i,durationMs:Date.now()-n}}function Q_(e,t,n,i,r){let o=Tp(t,/direct\s*callers?:|## direct/i),s=Tp(t,/transitive\s*callers?:|## transitive/i),a=Dp(t,/tests?:|## tests?/i),l=Dp(t,/docs?:|## docs?/i),c=new Set;for(let u of o)c.add(u.file);for(let u of s)c.add(u.file);for(let u of a)c.add(u);for(let u of l)c.add(u);return{symbol:e,directCallers:o,transitiveCallers:s,testFiles:a,docFiles:l,totalAffectedFiles:c.size,kind:i,durationMs:Date.now()-n,timedOut:r}}function vi(e){let t=[],n=e.split(`
194
+ `);for(let i of n){let r=i.match(/^\s*[-*]?\s*([^\s:]+\.[a-z]+):(\d+)(?:[:\s—–-]+(.+))?/i);if(r){let o=r[1]??"",s=r[2]?parseInt(r[2],10):0,a=(r[3]??"").trim();if(o&&s>0)t.push({file:o,line:s,context:a})}}return t}function Tp(e,t){let n=e.split(`
195
+ `),i=!1,r=[];for(let o of n){if(t.test(o)){i=!0;continue}if(i){if(/^#\s/.test(o)&&!t.test(o))break;if(o.trim()===""&&r.length>0)break;r.push(o)}}return vi(r.join(`
196
196
  `))}function Dp(e,t){let n=e.split(`
197
- `),o=!1,r=[];for(let i of n){if(t.test(i)){o=!0;continue}if(o){if(/^#\s/.test(i)&&!t.test(i))break;if(i.trim()===""&&r.length>0)break;let s=i.trim().replace(/^[-*]\s*/,"");if(s.match(/[^\s:]+\.[a-z]+/i))r.push(s)}}return r}var Vc=null;function Bc(){if(!Vc)Vc=new Pp;return Vc}ko();Mp();var q=E.schema,Jc="0.0.0";try{Jc=(()=>{try{let e=ek(rk(import.meta.url)),t=Q_(tk(e,"..","package.json"),"utf-8"),n=JSON.parse(t);return typeof n.version==="string"?n.version:"0.0.0"}catch{return"0.0.0"}})()}catch{}async function at(e,t,n,o){try{let r=Z();if(!await r.isMcpServerAvailable(e,t))return null;return(await r.invokeMCP(e,t,n,{timeoutMs:o,queryLabel:t})).result}catch{return null}}async function nk(e,t,n=1500){if(!Kc)return"pending";return await Kc.awaitDelivery({sessionID:e,mcpTool:t,timeoutMs:n})}var Kc=null;function Ap(e){Kc=e}async function Np(e,t){return await nk(e,t)}function jp(e){return E({description:"Semantic code search over the project graph. ROUTING (v0.25.0): with both indexes present, codegraph handles code-structure queries (symbols, call sites, module layout) and graphify "+"handles concept/architecture queries — the plugin alternates deterministically per query, "+"or you can force one via config graphRetrieval.preferredTool. USE THIS for architecture questions, finding call sites, understanding module structure. "+"Prefer over grep/glob for high-level understanding — grep is still better for literal text matches.",args:{query:q.string().min(3).describe("Natural language query describing what you're looking for"),maxResults:q.number().int().min(1).max(20).optional().describe("Max results to return (default 10)")},async execute(t,n){let o=Date.now(),r=await e.graphRetrieval.invoke(e.cwd,t.query,{timeoutMs:8000}),i={tool:"omo_search",query:t.query,kind:r.kind,timedOut:r.timedOut,durationMs:r.durationMs,resultSize:r.result?.length??0,sessionID:n.sessionID};if(r.timedOut)return{title:"omo_search: timeout",output:`Graph search timed out after ${r.durationMs}ms. No graph tools available at ${e.cwd}, or the query is too expensive. Fall back to grep/glob for direct text matching.`,metadata:i};if(!r.result)return{title:"omo_search: no graph backend",output:`No codegraph or graphify directory found at ${e.cwd}. Run \`npx codegraph init\` or \`graphify . --no-viz\` to build the index, then call omo_search again. Until then, use grep/glob for direct text matching.`,metadata:i};return{title:`omo_search: ${r.kind}`,output:r.result,metadata:i}}})}function Up(e){return E({description:"Search lessons learned in past sessions of this project. Returns ranked lessons (highest confidence first) matching the query. "+"Use before making non-trivial decisions — the answer may already be in memory.",args:{query:q.string().min(2).describe("What kind of lesson you're looking for"),limit:q.number().int().min(1).max(20).optional().describe("Max lessons to return (default 5)")},async execute(t,n){let o=Date.now(),i=(await e.sqlite.smartSearch({query:t.query,limit:t.limit??5})).lessons;if(i.length===0)return{title:"omo_recall: no matches",output:`No past lessons found matching "${t.query}". This is the first time the agent is encountering this question.`,metadata:{tool:"omo_recall",query:t.query,durationMs:Date.now()-o,lessonsFound:0}};let s=i.map((a,l)=>`${l+1}. [${a.id}] confidence=${a.confidence.toFixed(2)}
197
+ `),i=!1,r=[];for(let o of n){if(t.test(o)){i=!0;continue}if(i){if(/^#\s/.test(o)&&!t.test(o))break;if(o.trim()===""&&r.length>0)break;let s=o.trim().replace(/^[-*]\s*/,"");if(s.match(/[^\s:]+\.[a-z]+/i))r.push(s)}}return r}var Vc=null;function Bc(){if(!Vc)Vc=new Pp;return Vc}_i();Ap();var q=R.schema,Jc="0.0.0";try{Jc=(()=>{try{let e=rk(ik(import.meta.url)),t=tk(nk(e,"..","package.json"),"utf-8"),n=JSON.parse(t);return typeof n.version==="string"?n.version:"0.0.0"}catch{return"0.0.0"}})()}catch{}async function at(e,t,n,i){try{let r=G();if(!await r.isMcpServerAvailable(e,t))return null;return(await r.invokeMCP(e,t,n,{timeoutMs:i,queryLabel:t})).result}catch{return null}}async function ok(e,t,n=1500){if(!Kc)return"pending";return await Kc.awaitDelivery({sessionID:e,mcpTool:t,timeoutMs:n})}var Kc=null;function Mp(e){Kc=e}async function Np(e,t){return await ok(e,t)}function jp(e){return R({description:"Semantic code search over the project graph. ROUTING (v0.25.0): with both indexes present, codegraph handles code-structure queries (symbols, call sites, module layout) and graphify "+"handles concept/architecture queries — the plugin alternates deterministically per query, "+"or you can force one via config graphRetrieval.preferredTool. USE THIS for architecture questions, finding call sites, understanding module structure. "+"Prefer over grep/glob for high-level understanding — grep is still better for literal text matches.",args:{query:q.string().min(3).describe("Natural language query describing what you're looking for"),maxResults:q.number().int().min(1).max(20).optional().describe("Max results to return (default 10)")},async execute(t,n){let i=Date.now(),r=await e.graphRetrieval.invoke(e.cwd,t.query,{timeoutMs:8000}),o={tool:"omo_search",query:t.query,kind:r.kind,timedOut:r.timedOut,durationMs:r.durationMs,resultSize:r.result?.length??0,sessionID:n.sessionID};if(r.timedOut)return{title:"omo_search: timeout",output:`Graph search timed out after ${r.durationMs}ms. No graph tools available at ${e.cwd}, or the query is too expensive. Fall back to grep/glob for direct text matching.`,metadata:o};if(!r.result)return{title:"omo_search: no graph backend",output:`No codegraph or graphify directory found at ${e.cwd}. Run \`npx codegraph init\` or \`graphify . --no-viz\` to build the index, then call omo_search again. Until then, use grep/glob for direct text matching.`,metadata:o};return{title:`omo_search: ${r.kind}`,output:r.result,metadata:o}}})}function Up(e){return R({description:"Search lessons learned in past sessions of this project. Returns ranked lessons (highest confidence first) matching the query. "+"Use before making non-trivial decisions — the answer may already be in memory.",args:{query:q.string().min(2).describe("What kind of lesson you're looking for"),limit:q.number().int().min(1).max(20).optional().describe("Max lessons to return (default 5)")},async execute(t,n){let i=Date.now(),o=(await e.sqlite.smartSearch({query:t.query,limit:t.limit??5})).lessons;if(o.length===0)return{title:"omo_recall: no matches",output:`No past lessons found matching "${t.query}". This is the first time the agent is encountering this question.`,metadata:{tool:"omo_recall",query:t.query,durationMs:Date.now()-i,lessonsFound:0}};let s=o.map((a,l)=>`${l+1}. [${a.id}] confidence=${a.confidence.toFixed(2)}
198
198
  ${a.title}
199
199
  ${a.content.slice(0,500)}${a.content.length>500?"...":""}`).join(`
200
200
 
201
- `);return{title:`omo_recall: ${i.length} lesson${i.length===1?"":"s"}`,output:`Found ${i.length} past lesson${i.length===1?"":"s"} matching "${t.query}":
201
+ `);return{title:`omo_recall: ${o.length} lesson${o.length===1?"":"s"}`,output:`Found ${o.length} past lesson${o.length===1?"":"s"} matching "${t.query}":
202
202
 
203
- ${s}`,metadata:{tool:"omo_recall",query:t.query,durationMs:Date.now()-o,lessonsFound:i.length}}}})}function Lp(e){return E({description:"Show omo-meta-governor plugin status: enabled, metrics, recent decisions, and current config. Use when the user asks 'is the plugin working?' or to verify that lessons are being persisted.",args:{},async execute(t,n){let o=e.metrics.getMetrics(),r=vo({version:Jc,enabled:!0,sessionID:n.sessionID??"__unknown__",snapshot:o,logFilePath:e.logFilePath});try{ho(r,e.healthFilePath)}catch{}return{title:"omo_health",output:`# omo-meta-governor v${Jc} — Health Report
203
+ ${s}`,metadata:{tool:"omo_recall",query:t.query,durationMs:Date.now()-i,lessonsFound:o.length}}}})}function Lp(e){return R({description:"Show omo-meta-governor plugin status: enabled, metrics, recent decisions, and current config. Use when the user asks 'is the plugin working?' or to verify that lessons are being persisted.",args:{},async execute(t,n){let i=e.metrics.getMetrics(),r=hi({version:Jc,enabled:!0,sessionID:n.sessionID??"__unknown__",snapshot:i,logFilePath:e.logFilePath});try{gi(r,e.healthFilePath)}catch{}return{title:"omo_health",output:`# omo-meta-governor v${Jc} — Health Report
204
204
 
205
205
  `+`**Status**: ${r.status}
206
206
  **Enabled**: ${r.enabled}
@@ -222,62 +222,63 @@ ${s}`,metadata:{tool:"omo_recall",query:t.query,durationMs:Date.now()-o,lessonsF
222
222
  - Health JSON: \`${e.healthFilePath}\`
223
223
  - Log file: \`${e.logFilePath}\`
224
224
 
225
- The health JSON file is updated on every invocation. Run \`cat ${e.healthFilePath}\` to see the full snapshot.`,metadata:{tool:"omo_health",sessionID:n.sessionID,uptimeMs:r.uptimeMs}}}})}function Fp(e){return E({description:"Find the exact source location and direct callers of a symbol (function, class, method, variable). "+"CODEGRAPH TOOL (v0.25.0): symbol precision lives in codegraph — use this for exact definitions "+"and call sites. USE THIS when you know the exact symbol name and need its source code. Example: omo_find with symbol='UserService.create' returns the file:line of the definition and every call site.",args:{symbol:q.string().min(1).describe("The exact symbol name to find (e.g. 'UserService.create', 'validateToken')")},async execute(t,n){let o=Date.now(),i=await(e.codeGraph??Bc()).find(t.symbol,e.cwd,5000),s={tool:"omo_find",symbol:t.symbol,kind:i.kind,found:i.found,callerCount:i.callers.length,durationMs:i.durationMs,sessionID:n.sessionID};if(!i.found)return{title:`omo_find: ${t.symbol} not found`,output:`Symbol "${t.symbol}" was not found in the codebase graph. If .codegraph/ doesn't exist, run \`npx codegraph init\` first. Otherwise, try omo_search with a natural-language description.`,metadata:s};let a=i.source?`
225
+ The health JSON file is updated on every invocation. Run \`cat ${e.healthFilePath}\` to see the full snapshot.`,metadata:{tool:"omo_health",sessionID:n.sessionID,uptimeMs:r.uptimeMs}}}})}function Fp(e){return R({description:"Find the exact source location and direct callers of a symbol (function, class, method, variable). "+"CODEGRAPH TOOL (v0.25.0): symbol precision lives in codegraph — use this for exact definitions "+"and call sites. USE THIS when you know the exact symbol name and need its source code. Example: omo_find with symbol='UserService.create' returns the file:line of the definition and every call site.",args:{symbol:q.string().min(1).describe("The exact symbol name to find (e.g. 'UserService.create', 'validateToken')")},async execute(t,n){let i=Date.now(),o=await(e.codeGraph??Bc()).find(t.symbol,e.cwd,5000),s={tool:"omo_find",symbol:t.symbol,kind:o.kind,found:o.found,callerCount:o.callers.length,durationMs:o.durationMs,sessionID:n.sessionID};if(!o.found)return{title:`omo_find: ${t.symbol} not found`,output:`Symbol "${t.symbol}" was not found in the codebase graph. If .codegraph/ doesn't exist, run \`npx codegraph init\` first. Otherwise, try omo_search with a natural-language description.`,metadata:s};let a=o.source?`
226
226
  ## Definition
227
227
 
228
228
  \`\`\`
229
- ${i.source.slice(0,2000)}
229
+ ${o.source.slice(0,2000)}
230
230
  \`\`\`
231
- `:"",l=i.callers.length>0?`
232
- ## Direct Callers (${i.callers.length})
231
+ `:"",l=o.callers.length>0?`
232
+ ## Direct Callers (${o.callers.length})
233
233
 
234
- `+i.callers.slice(0,30).map((c)=>`- ${c.file}:${c.line}${c.context?` — ${c.context}`:""}`).join(`
235
- `)+(i.callers.length>30?`
236
- ... and ${i.callers.length-30} more`:""):`
234
+ `+o.callers.slice(0,30).map((c)=>`- ${c.file}:${c.line}${c.context?` — ${c.context}`:""}`).join(`
235
+ `)+(o.callers.length>30?`
236
+ ... and ${o.callers.length-30} more`:""):`
237
237
  ## Direct Callers
238
238
 
239
- None found in the indexed graph.`;return{title:`omo_find: ${t.symbol}${i.callers.length>0?` (${i.callers.length} callers)`:""}`,output:`Found definition for "${t.symbol}" (via ${i.kind??"fallback"}).
240
- `+a+l,metadata:s}}})}function Zp(e){return E({description:"Analyze the impact of changing a symbol. Lists direct callers, transitive callers, and affected test/doc files. CODEGRAPH TOOL (v0.25.0): call-graph analysis is codegraph-only. "+"ALWAYS run this BEFORE modifying a function or class — "+"knows what will break. Example: omo_impact with symbol='validateToken' lists every file that calls validateToken and every test that exercises it.",args:{symbol:q.string().min(1).describe("The symbol to analyze (function, class, method)")},async execute(t,n){let o=Date.now(),r=await at("codegraph","codegraph_impact",{symbol:t.symbol,depth:2,projectPath:e.cwd},5000);if(r!==null)return{title:`omo_impact: ${t.symbol}`,output:r,metadata:{tool:"omo_impact",symbol:t.symbol,kind:"codegraph",transport:"mcp",durationMs:Date.now()-o,sessionID:n.sessionID}};let s=await(e.codeGraph??Bc()).impact(t.symbol,e.cwd,5000),a={tool:"omo_impact",symbol:t.symbol,kind:s.kind,directCallers:s.directCallers.length,transitiveCallers:s.transitiveCallers.length,testFiles:s.testFiles.length,docFiles:s.docFiles.length,totalAffectedFiles:s.totalAffectedFiles,timedOut:s.timedOut,durationMs:s.durationMs,sessionID:n.sessionID};if(s.totalAffectedFiles===0&&s.directCallers.length===0)return{title:`omo_impact: no callers found for ${t.symbol}`,output:`No call sites found for "${t.symbol}". Either the symbol is unused, or the codegraph index is stale. Run \`npx codegraph sync\` to refresh the index and try again.`,metadata:a};let l=[];if(l.push(`Impact analysis for "${t.symbol}" (via ${s.kind??"fallback"}).
239
+ None found in the indexed graph.`;return{title:`omo_find: ${t.symbol}${o.callers.length>0?` (${o.callers.length} callers)`:""}`,output:`Found definition for "${t.symbol}" (via ${o.kind??"fallback"}).
240
+ `+a+l,metadata:s}}})}function Gp(e){return R({description:"Analyze the impact of changing a symbol. Lists direct callers, transitive callers, and affected test/doc files. CODEGRAPH TOOL (v0.25.0): call-graph analysis is codegraph-only. "+"ALWAYS run this BEFORE modifying a function or class — "+"knows what will break. Example: omo_impact with symbol='validateToken' lists every file that calls validateToken and every test that exercises it.",args:{symbol:q.string().min(1).describe("The symbol to analyze (function, class, method)")},async execute(t,n){let i=Date.now(),r=await at("codegraph","codegraph_impact",{symbol:t.symbol,depth:2,projectPath:e.cwd},5000);if(r!==null)return{title:`omo_impact: ${t.symbol}`,output:r,metadata:{tool:"omo_impact",symbol:t.symbol,kind:"codegraph",transport:"mcp",durationMs:Date.now()-i,sessionID:n.sessionID}};let s=await(e.codeGraph??Bc()).impact(t.symbol,e.cwd,5000),a={tool:"omo_impact",symbol:t.symbol,kind:s.kind,directCallers:s.directCallers.length,transitiveCallers:s.transitiveCallers.length,testFiles:s.testFiles.length,docFiles:s.docFiles.length,totalAffectedFiles:s.totalAffectedFiles,timedOut:s.timedOut,durationMs:s.durationMs,sessionID:n.sessionID};if(s.totalAffectedFiles===0&&s.directCallers.length===0)return{title:`omo_impact: no callers found for ${t.symbol}`,output:`No call sites found for "${t.symbol}". Either the symbol is unused, or the codegraph index is stale. Run \`npx codegraph sync\` to refresh the index and try again.`,metadata:a};let l=[];if(l.push(`Impact analysis for "${t.symbol}" (via ${s.kind??"fallback"}).
241
241
  `),l.push("## Summary"),l.push(`- Direct callers: **${s.directCallers.length}**`),l.push(`- Transitive callers: **${s.transitiveCallers.length}**`),l.push(`- Test files affected: **${s.testFiles.length}**`),l.push(`- Doc files affected: **${s.docFiles.length}**`),l.push(`- Total affected files: **${s.totalAffectedFiles}**
242
242
  `),s.directCallers.length>0){l.push("## Direct Callers");for(let c of s.directCallers.slice(0,30))l.push(`- ${c.file}:${c.line}${c.context?` — ${c.context}`:""}`);if(s.directCallers.length>30)l.push(`- ... and ${s.directCallers.length-30} more`);l.push("")}if(s.testFiles.length>0){l.push("## Test Files Affected");for(let c of s.testFiles.slice(0,20))l.push(`- ${c}`);l.push("")}if(s.docFiles.length>0){l.push("## Doc Files Affected");for(let c of s.docFiles.slice(0,20))l.push(`- ${c}`);l.push("")}if(s.timedOut)l.push("⚠️ Analysis timed out — results may be incomplete. Try with a more specific symbol.");return{title:`omo_impact: ${t.symbol} (${s.totalAffectedFiles} files)`,output:l.join(`
243
- `),metadata:a}}})}function Gp(e){return E({description:"Save a fact, observation, or insight to AgentMemory so it persists across sessions. USE THIS when you learn something worth remembering: a bug pattern, a config quirk, a user preference, a project rule. The system will route the save to AgentMemory's MCP server. Example: omo_remember with content='Always use bun:sqlite, not better-sqlite3' "+"concepts=['storage', 'bun'] — the system will save this to AgentMemory.",args:{content:q.string().min(1).describe("The fact/observation/lesson to remember"),concepts:q.array(q.string()).optional().describe("Tags to categorize this memory (e.g. ['security', 'auth'])"),type:q.enum(["fact","pattern","observation"]).optional().describe("Type of memory: fact, pattern, or observation")},async execute(t,n){let o=n.sessionID;if(!Ur())return{title:"omo_remember: session not initialized",output:"Could not save to AgentMemory: the plugin has not captured the OpenCode session client. Try restarting the plugin or check that the OpenCode session is running.",metadata:{tool:"omo_remember",ok:!1}};let r={content:t.content,concepts:t.concepts??[],type:t.type??"observation"},i=await wt(o,{toolName:"omo_remember",mcpTool:"agentmemory_memory_save",mcpArgs:r,preamble:"Save this to AgentMemory (cross-session persistent memory)."});if(!i.ok)return{title:"omo_remember: failed",output:`Failed to dispatch save to AgentMemory: ${i.error??"unknown error"}`,metadata:{tool:"omo_remember",ok:!1,durationMs:i.durationMs}};e.onDispatch?.({sessionID:o,mcpTool:"agentmemory_memory_save",mcpArgs:r});let s=await Np(o,"agentmemory_memory_save");return{title:`omo_remember: ${s}`,output:`Save to AgentMemory ${s==="delivered"?"verified":s==="expired"?"not delivered within TTL":"dispatched"} (messageID: ${i.messageID??"pending"}). LLM call to agentmemory_memory_save ${s==="delivered"?"was observed":"not yet observed (will happen on next turn)"} with args: ${JSON.stringify(r)}. It will be available in future sessions via agentmemory_memory_recall.`,metadata:{tool:"omo_remember",ok:!0,messageID:i.messageID,durationMs:i.durationMs,contentLength:t.content.length,deliveryStatus:s}}}})}function Wp(e){return E({description:"Search AgentMemory's cross-session memory (via agentmemory_memory_smart_search). USE THIS for questions that need context from PREVIOUS sessions: 'how did we set up X', 'what was the last approach to Y', 'recall the config for Z'. For current-session recall, prefer omo_recall (local SQLite) instead.",args:{query:q.string().min(2).describe("The search query"),limit:q.number().int().min(1).max(20).optional().describe("Max results (default 5)")},async execute(t,n){let o=n.sessionID;if(!Ur())return{title:"omo_recall_mcp: session not initialized",output:"Could not search AgentMemory: session client not captured. Use omo_recall for local session memory instead.",metadata:{tool:"omo_recall_mcp",ok:!1}};let r={query:t.query,limit:t.limit??5},i=await wt(o,{toolName:"omo_recall_mcp",mcpTool:"agentmemory_memory_smart_search",mcpArgs:r,preamble:"Search AgentMemory for this query and report the results."});if(!i.ok)return{title:"omo_recall_mcp: failed",output:`Failed to dispatch search to AgentMemory: ${i.error??"unknown error"}`,metadata:{tool:"omo_recall_mcp",ok:!1,durationMs:i.durationMs}};e.onDispatch?.({sessionID:o,mcpTool:"agentmemory_memory_smart_search",mcpArgs:r});let s=await Np(o,"agentmemory_memory_smart_search");return{title:`omo_recall_mcp: ${s}`,output:`Search to AgentMemory ${s==="delivered"?"verified":"dispatched"} (messageID: ${i.messageID??"pending"}). LLM call to agentmemory_memory_smart_search ${s==="delivered"?"was observed":"not yet observed (will happen on next turn)"} with args: ${JSON.stringify(r)}. Results will appear in the next assistant message.`,metadata:{tool:"omo_recall_mcp",ok:!0,messageID:i.messageID,durationMs:i.durationMs,query:t.query,deliveryStatus:s}}}})}function Hp(e){return E({description:"Find the shortest conceptual path between two concepts in the codebase "+"using the graphify knowledge graph. GRAPHIFY TOOL (v0.25.0): concept-level relations live in graphify — "+"codegraph cannot answer these. USE THIS to understand how two apparently unrelated parts of the codebase connect. Example: omo_path with from='auth' to='database' traces the chain from authentication handlers to DB queries.",args:{from:q.string().min(1).describe("Start concept"),to:q.string().min(1).describe("End concept")},async execute(t,n){let o=Date.now(),r=await at("graphify","shortest_path",{source:t.from,target:t.to,project_path:e.cwd},8000);if(r!==null)return{title:"omo_path: path found",output:r,metadata:{tool:"omo_path",from:t.from,to:t.to,kind:"graphify",transport:"mcp",durationMs:Date.now()-o,sessionID:n?n.sessionID:"unknown"}};let s=await Z().invokePath(t.from,t.to,e.cwd,{timeoutMs:8000});return{title:s.kind==="graphify"?"omo_path: path found":"omo_path: unavailable",output:s.result??`No path found between "${t.from}" and "${t.to}". Check if graphify-out/ exists and is up to date.`,metadata:{tool:"omo_path",from:t.from,to:t.to,kind:s.kind,durationMs:Date.now()-o,sessionID:n?n.sessionID:"unknown"}}}})}function Vp(e){return E({description:"Get a plain-language explanation of a concept from the graphify knowledge graph. "+"GRAPHIFY TOOL (v0.25.0): conceptual overviews live in graphify — codegraph cannot produce them. "+"USE THIS when you encounter an unfamiliar term or module and need a quick overview of what it is and how it fits into the codebase. Example: 'omo_explain SwinTransformer'.",args:{concept:q.string().min(1).describe("The concept to explain")},async execute(t,n){let o=Date.now(),r=await at("graphify","get_node",{label:t.concept,project_path:e.cwd},8000);if(r!==null)return{title:"omo_explain: done",output:r,metadata:{tool:"omo_explain",concept:t.concept,kind:"graphify",transport:"mcp",durationMs:Date.now()-o,sessionID:n?n.sessionID:"unknown"}};let s=await Z().invokeExplain(t.concept,e.cwd,{timeoutMs:8000});return{title:s.kind==="graphify"?"omo_explain: done":"omo_explain: unavailable",output:s.result??`Concept "${t.concept}" not found in the knowledge graph. Run \`graphify . --no-viz\` first.`,metadata:{tool:"omo_explain",concept:t.concept,kind:s.kind,durationMs:Date.now()-o,sessionID:n?n.sessionID:"unknown"}}}})}function Bp(e){return E({description:"List files indexed by the codebase graph (codegraph or graphify). USAGE: returns a list of indexed file paths. Use this when you need to discover which files are in the graph before drilling into a specific one.",args:{},async execute(t,n){let o=Date.now(),r=await at("codegraph","codegraph_files",{projectPath:e.cwd},5000);if(r!==null)return{title:"omo_files: codegraph backend",output:r,metadata:{tool:"omo_files",kind:"codegraph",transport:"mcp",durationMs:Date.now()-o,sessionID:n.sessionID}};let s=await(e.graphRetrieval??Z()).invokeFiles(e.cwd,{timeoutMs:5000});if(!s.result)return{title:"omo_files: no index",output:"No indexed files found. If `.codegraph/` doesn't exist, run `npx codegraph init` first. If `graphify-out/` doesn't exist, run `graphify . --no-viz` first.",metadata:{tool:"omo_files",kind:s.kind,durationMs:Date.now()-o,sessionID:n.sessionID}};return{title:`omo_files: ${s.kind??"unknown"} backend`,output:s.result,metadata:{tool:"omo_files",kind:s.kind,durationMs:Date.now()-o,sessionID:n.sessionID}}}})}function qp(e){return E({description:"List all call sites of a symbol in the codebase graph. USAGE: omo_callers with symbol='UserService.create' returns every file:line "+"where that symbol is called. Codegraph-only — returns null if .codegraph/ is missing.",args:{symbol:q.string().min(1).describe("The symbol to find callers for (function, class, method, variable)")},async execute(t,n){let o=Date.now(),r=await at("codegraph","codegraph_callers",{symbol:t.symbol,projectPath:e.cwd},5000);if(r!==null)return{title:`omo_callers: ${t.symbol}`,output:r,metadata:{tool:"omo_callers",symbol:t.symbol,kind:"codegraph",transport:"mcp",durationMs:Date.now()-o,sessionID:n.sessionID}};let s=await(e.graphRetrieval??Z()).invokeCallers(t.symbol,e.cwd,{timeoutMs:5000});if(!s.result)return{title:`omo_callers: ${t.symbol} (no callers or no codegraph)`,output:`No call sites found for "${t.symbol}". Either the symbol is unused, or codegraph is not installed / has no index. Run \`npx codegraph init\` to create the index.`,metadata:{tool:"omo_callers",symbol:t.symbol,kind:s.kind,durationMs:Date.now()-o,sessionID:n.sessionID}};return{title:`omo_callers: ${t.symbol}`,output:s.result,metadata:{tool:"omo_callers",symbol:t.symbol,kind:s.kind,durationMs:Date.now()-o,sessionID:n.sessionID}}}})}function Jp(e){return E({description:"Get the source code of a symbol (function/class/method/variable) and its direct callers. USAGE: omo_node with symbol='UserService.create' returns the symbol's definition and "+"every direct call site. Distinct from omo_find (which only returns a definition summary) — "+"this tool returns the full source body. Codegraph-only.",args:{symbol:q.string().min(1).describe("The symbol to resolve (function, class, method, variable)")},async execute(t,n){let o=Date.now(),r=await at("codegraph","codegraph_node",{symbol:t.symbol,projectPath:e.cwd},5000);if(r!==null)return{title:`omo_node: ${t.symbol}`,output:r,metadata:{tool:"omo_node",symbol:t.symbol,kind:"codegraph",transport:"mcp",durationMs:Date.now()-o,sessionID:n.sessionID}};let s=await(e.graphRetrieval??Z()).invokeNode(t.symbol,e.cwd,{timeoutMs:5000});if(!s.result)return{title:`omo_node: ${t.symbol} not found`,output:`Symbol "${t.symbol}" was not found in the codegraph index. Run \`npx codegraph init\` if the index doesn't exist, or \`npx codegraph sync\` to refresh.`,metadata:{tool:"omo_node",symbol:t.symbol,kind:s.kind,durationMs:Date.now()-o,sessionID:n.sessionID}};return{title:`omo_node: ${t.symbol}`,output:s.result,metadata:{tool:"omo_node",symbol:t.symbol,kind:s.kind,durationMs:Date.now()-o,sessionID:n.sessionID}}}})}function se(e,t,n,o,r,i){let s=Date.now()-o;if(!n.result)return{title:`${e}: no result`,output:i,metadata:{tool:e,kind:n.kind,durationMs:s,sessionID:r.sessionID,...t}};return{title:e,output:n.result,metadata:{tool:e,kind:n.kind,durationMs:s,sessionID:r.sessionID,...t}}}function Kp(e){return E({description:"Get a focused code context window for a given task. USAGE: omo_context with task='validate JWT tokens' returns relevant code blocks (file paths + line ranges). "+"Codegraph-only — returns null if .codegraph/ is missing.",args:{task:q.string().min(1).describe("The task to extract context for")},async execute(t,n){let o=Date.now(),r=await at("codegraph","codegraph_context",{task:t.task,maxNodes:20,projectPath:e.cwd},5000);if(r!==null)return{title:"omo_context",output:r,metadata:{tool:"omo_context",task:t.task,kind:"codegraph",transport:"mcp",durationMs:Date.now()-o,sessionID:n.sessionID}};let s=await(e.graphRetrieval??Z()).invokeContext(t.task,e.cwd,{timeoutMs:5000});return se("omo_context",{task:t.task},{...s,durationMs:Date.now()-o},o,n,`No context for task "${t.task}". Run \`npx codegraph init\` if the index doesn't exist.`)}})}function Xp(e){return E({description:"List files affected by changes in the given source files. USAGE: omo_affected_cg with files=['src/auth.ts'] returns the set of test files, callers, and dependent modules. Codegraph-only.",args:{files:q.array(q.string().min(1)).min(1).describe("Source file paths to analyze (relative to cwd)")},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??Z()).invokeAffected(t.files,e.cwd,{timeoutMs:5000});return se("omo_affected_cg",{files:t.files.join(",")},{...i,durationMs:Date.now()-o},o,n,`Could not compute affected files for [${t.files.join(", ")}]. Run \`npx codegraph init\` if needed.`)}})}function Yp(e){return E({description:"Show codegraph health: node count, version, last update timestamp. USAGE: omo_status returns a multi-line report. Codegraph-only.",args:{},async execute(t,n){let o=Date.now(),r=await at("codegraph","codegraph_status",{projectPath:e.cwd},5000);if(r!==null)return{title:"omo_status",output:r,metadata:{tool:"omo_status",kind:"codegraph",transport:"mcp",durationMs:Date.now()-o,sessionID:n.sessionID}};let s=await(e.graphRetrieval??Z()).invokeStatus(e.cwd,{timeoutMs:5000});return se("omo_status",{},{...s,durationMs:Date.now()-o},o,n,"codegraph is not installed or has no index. Run `npx codegraph init` to create one.")}})}function Qp(e){return E({description:"Remove a stale codegraph lock file (left behind after a crash). USAGE: omo_unlock clears the lock so the next sync can run. Codegraph-only.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??Z()).invokeUnlock(e.cwd,{timeoutMs:5000});return se("omo_unlock",{},{...i,durationMs:Date.now()-o},o,n,"codegraph is not installed.")}})}function ef(e){return E({description:"Mark the codegraph index as dirty so the next sync re-extracts. USAGE: omo_mark_dirty when you know source files changed without git hooks firing.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??Z()).invokeMarkDirty(e.cwd,{timeoutMs:5000});return se("omo_mark_dirty",{},{...i,durationMs:Date.now()-o},o,n,"codegraph is not installed.")}})}function tf(e){return E({description:"Trigger a codegraph sync ONLY if the graph was previously marked dirty. USAGE: omo_sync_if_dirty is a cheap daily check; omo_status shows the dirty flag.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??Z()).invokeSyncIfDirty(e.cwd,{timeoutMs:30000});return se("omo_sync_if_dirty",{},{...i,durationMs:Date.now()-o},o,n,"codegraph is not installed or no index exists.")}})}function rf(e){return E({description:"Manually trigger a full codegraph reindex. USAGE: omo_index when you want a guaranteed-fresh graph (bypasses the dirty-flag check).",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??Z()).invokeIndex(e.cwd,{timeoutMs:60000});return se("omo_index",{},{...i,durationMs:Date.now()-o},o,n,"codegraph is not installed. Run `npm i -D @colbymchenry/codegraph` first.")}})}function nf(e){return E({description:"Generate an HTML visualization of the codegraph. USAGE: omo_visualize returns the path to the generated HTML file.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??Z()).invokeVisualize(e.cwd,{timeoutMs:30000});return se("omo_visualize",{},{...i,durationMs:Date.now()-o},o,n,"codegraph is not installed.")}})}function of(e){return E({description:"Start the codegraph HTTP server on the given port. USAGE: omo_serve with port=3030 starts the server in the background. Returns the port + status.",args:{port:q.number().int().min(1).max(65535).describe("TCP port to bind the codegraph server to")},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??Z()).invokeServe(t.port,e.cwd,{timeoutMs:5000});return se("omo_serve",{port:t.port},{...i,durationMs:Date.now()-o},o,n,"codegraph is not installed. Run `npm i -D @colbymchenry/codegraph` first.")}})}function sf(e){return E({description:"Remove the codegraph index (.codegraph/) from disk. "+"USAGE: omo_uninit when you want a clean slate — next sync will rebuild from scratch.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??Z()).invokeUninit(e.cwd,{timeoutMs:5000});return se("omo_uninit",{},{...i,durationMs:Date.now()-o},o,n,"codegraph is not installed.")}})}function af(e){return E({description:"Diagnose the graphify graph for inconsistencies, multigraph warnings, and stale nodes. USAGE: omo_diagnose returns a JSON-like report. Graphify-only.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??Z()).invokeDiagnose(e.cwd,{timeoutMs:1e4});return se("omo_diagnose",{},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed. Run `pip install graphifyy` first.")}})}function lf(e){return E({description:"Run graphify's 3-way merge driver to resolve conflicting graph segments. USAGE: omo_merge_graphs when git reports a conflict in graphify-out/. Graphify-only.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??Z()).invokeMergeDriver(e.cwd,{timeoutMs:30000});return se("omo_merge_graphs",{},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed.")}})}function cf(e){return E({description:"Persist the result of the last graphify query to disk for later inspection. USAGE: omo_save_result after omo_explain or omo_path returns a useful output.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??Z()).invokeSaveResult(e.cwd,{timeoutMs:5000});return se("omo_save_result",{},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed.")}})}function uf(e){return E({description:"Re-run graphify's semantic extraction over the entire source tree. USAGE: omo_extract when the graph schema changed and you want a fresh semantic layer.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??Z()).invokeExtract(e.cwd,{timeoutMs:60000});return se("omo_extract",{},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed.")}})}function df(e){return E({description:"Re-run graphify's clustering step (skip semantic extraction). USAGE: omo_cluster_only after minor node additions to refresh the topic map.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??Z()).invokeClusterOnly(e.cwd,{timeoutMs:30000});return se("omo_cluster_only",{},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed.")}})}function mf(e){return E({description:"Apply a label to a graphify node (e.g. for categorization or human notes). USAGE: omo_label with node='validateToken' applies a label.",args:{node:q.string().min(1).describe("The graph node to label")},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??Z()).invokeLabel(t.node,e.cwd,{timeoutMs:5000});return se("omo_label",{node:t.node},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed.")}})}function pf(e){return E({description:"Emit a tree visualization of the graphify graph (hierarchical topic layout). USAGE: omo_tree for a structural overview of the topic map. Graphify-only.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??Z()).invokeTree(e.cwd,{timeoutMs:1e4});return se("omo_tree",{},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed.")}})}function ff(e){return E({description:"Clone the graphify graph to a new location. USAGE: omo_clone when forking a project or creating a backup.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??Z()).invokeClone(e.cwd,{timeoutMs:30000});return se("omo_clone",{},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed.")}})}function gf(e){return E({description:"Add specific files to the graphify graph (instead of re-extracting the whole tree). USAGE: omo_add with files='src/auth.ts src/login.ts' after writing new files.",args:{files:q.string().min(1).describe("Space-separated list of file paths to add (relative to cwd)")},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??Z()).invokeAdd(t.files,e.cwd,{timeoutMs:30000});return se("omo_add",{files:t.files},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed.")}})}function hf(e){return E({description:"Check if the graphify schema or extractors changed since the last extraction. USAGE: omo_check_update to decide if re-extraction is needed. Graphify-only.",args:{},async execute(t,n){let o=Date.now(),i=await(e.graphRetrieval??Z()).invokeCheckUpdate(e.cwd,{timeoutMs:1e4});return se("omo_check_update",{},{...i,durationMs:Date.now()-o},o,n,"graphify is not installed.")}})}function vf(e){return E({description:"Check whether the graphify post-commit git hook is installed in this project. USAGE: omo_hook_status returns 'installed' or 'missing' along with the hook path. Run after `git init` to confirm the hook is wired.",args:{},async execute(t,n){let o=Date.now();await Promise.resolve().then(() => Qr());let i=await Jo(e.cwd),s=`${e.cwd}/.git/hooks/post-commit`,a=i?`graphify post-commit hook is INSTALLED at ${s}.`:"graphify post-commit hook is NOT installed. Run `graphify hook install` or enable graphSync in plugin config to install automatically.";return{title:`omo_hook_status: ${i?"installed":"missing"}`,output:a,metadata:{tool:"omo_hook_status",installed:i,hookPath:s,durationMs:Date.now()-o,sessionID:n.sessionID}}}})}function wo(e,t,n,o,r,i){let s=Date.now()-o;if(!n.ok)return{title:`${e}: ${n.code}`,output:`${i}
243
+ `),metadata:a}}})}function Zp(e){return R({description:"Save a fact, observation, or insight to AgentMemory so it persists across sessions. USE THIS when you learn something worth remembering: a bug pattern, a config quirk, a user preference, a project rule. The system will route the save to AgentMemory's MCP server. Example: omo_remember with content='Always use bun:sqlite, not better-sqlite3' "+"concepts=['storage', 'bun'] — the system will save this to AgentMemory.",args:{content:q.string().min(1).describe("The fact/observation/lesson to remember"),concepts:q.array(q.string()).optional().describe("Tags to categorize this memory (e.g. ['security', 'auth'])"),type:q.enum(["fact","pattern","observation"]).optional().describe("Type of memory: fact, pattern, or observation")},async execute(t,n){let i=n.sessionID;if(!Ur())return{title:"omo_remember: session not initialized",output:"Could not save to AgentMemory: the plugin has not captured the OpenCode session client. Try restarting the plugin or check that the OpenCode session is running.",metadata:{tool:"omo_remember",ok:!1}};let r={content:t.content,concepts:t.concepts??[],type:t.type??"observation"},o=await wt(i,{toolName:"omo_remember",mcpTool:"agentmemory_memory_save",mcpArgs:r,preamble:"Save this to AgentMemory (cross-session persistent memory)."});if(!o.ok)return{title:"omo_remember: failed",output:`Failed to dispatch save to AgentMemory: ${o.error??"unknown error"}`,metadata:{tool:"omo_remember",ok:!1,durationMs:o.durationMs}};e.onDispatch?.({sessionID:i,mcpTool:"agentmemory_memory_save",mcpArgs:r});let s=await Np(i,"agentmemory_memory_save");return{title:`omo_remember: ${s}`,output:`Save to AgentMemory ${s==="delivered"?"verified":s==="expired"?"not delivered within TTL":"dispatched"} (messageID: ${o.messageID??"pending"}). LLM call to agentmemory_memory_save ${s==="delivered"?"was observed":"not yet observed (will happen on next turn)"} with args: ${JSON.stringify(r)}. It will be available in future sessions via agentmemory_memory_recall.`,metadata:{tool:"omo_remember",ok:!0,messageID:o.messageID,durationMs:o.durationMs,contentLength:t.content.length,deliveryStatus:s}}}})}function Wp(e){return R({description:"Search AgentMemory's cross-session memory (via agentmemory_memory_smart_search). USE THIS for questions that need context from PREVIOUS sessions: 'how did we set up X', 'what was the last approach to Y', 'recall the config for Z'. For current-session recall, prefer omo_recall (local SQLite) instead.",args:{query:q.string().min(2).describe("The search query"),limit:q.number().int().min(1).max(20).optional().describe("Max results (default 5)")},async execute(t,n){let i=n.sessionID;if(!Ur())return{title:"omo_recall_mcp: session not initialized",output:"Could not search AgentMemory: session client not captured. Use omo_recall for local session memory instead.",metadata:{tool:"omo_recall_mcp",ok:!1}};let r={query:t.query,limit:t.limit??5},o=await wt(i,{toolName:"omo_recall_mcp",mcpTool:"agentmemory_memory_smart_search",mcpArgs:r,preamble:"Search AgentMemory for this query and report the results."});if(!o.ok)return{title:"omo_recall_mcp: failed",output:`Failed to dispatch search to AgentMemory: ${o.error??"unknown error"}`,metadata:{tool:"omo_recall_mcp",ok:!1,durationMs:o.durationMs}};e.onDispatch?.({sessionID:i,mcpTool:"agentmemory_memory_smart_search",mcpArgs:r});let s=await Np(i,"agentmemory_memory_smart_search");return{title:`omo_recall_mcp: ${s}`,output:`Search to AgentMemory ${s==="delivered"?"verified":"dispatched"} (messageID: ${o.messageID??"pending"}). LLM call to agentmemory_memory_smart_search ${s==="delivered"?"was observed":"not yet observed (will happen on next turn)"} with args: ${JSON.stringify(r)}. Results will appear in the next assistant message.`,metadata:{tool:"omo_recall_mcp",ok:!0,messageID:o.messageID,durationMs:o.durationMs,query:t.query,deliveryStatus:s}}}})}function Hp(e){return R({description:"Find the shortest conceptual path between two concepts in the codebase "+"using the graphify knowledge graph. GRAPHIFY TOOL (v0.25.0): concept-level relations live in graphify — "+"codegraph cannot answer these. USE THIS to understand how two apparently unrelated parts of the codebase connect. Example: omo_path with from='auth' to='database' traces the chain from authentication handlers to DB queries.",args:{from:q.string().min(1).describe("Start concept"),to:q.string().min(1).describe("End concept")},async execute(t,n){let i=Date.now(),r=await at("graphify","shortest_path",{source:t.from,target:t.to,project_path:e.cwd},8000);if(r!==null)return{title:"omo_path: path found",output:r,metadata:{tool:"omo_path",from:t.from,to:t.to,kind:"graphify",transport:"mcp",durationMs:Date.now()-i,sessionID:n?n.sessionID:"unknown"}};let s=await G().invokePath(t.from,t.to,e.cwd,{timeoutMs:8000});return{title:s.kind==="graphify"?"omo_path: path found":"omo_path: unavailable",output:s.result??`No path found between "${t.from}" and "${t.to}". Check if graphify-out/ exists and is up to date.`,metadata:{tool:"omo_path",from:t.from,to:t.to,kind:s.kind,durationMs:Date.now()-i,sessionID:n?n.sessionID:"unknown"}}}})}function Vp(e){return R({description:"Get a plain-language explanation of a concept from the graphify knowledge graph. "+"GRAPHIFY TOOL (v0.25.0): conceptual overviews live in graphify — codegraph cannot produce them. "+"USE THIS when you encounter an unfamiliar term or module and need a quick overview of what it is and how it fits into the codebase. Example: 'omo_explain SwinTransformer'.",args:{concept:q.string().min(1).describe("The concept to explain")},async execute(t,n){let i=Date.now(),r=await at("graphify","get_node",{label:t.concept,project_path:e.cwd},8000);if(r!==null)return{title:"omo_explain: done",output:r,metadata:{tool:"omo_explain",concept:t.concept,kind:"graphify",transport:"mcp",durationMs:Date.now()-i,sessionID:n?n.sessionID:"unknown"}};let s=await G().invokeExplain(t.concept,e.cwd,{timeoutMs:8000});return{title:s.kind==="graphify"?"omo_explain: done":"omo_explain: unavailable",output:s.result??`Concept "${t.concept}" not found in the knowledge graph. Run \`graphify . --no-viz\` first.`,metadata:{tool:"omo_explain",concept:t.concept,kind:s.kind,durationMs:Date.now()-i,sessionID:n?n.sessionID:"unknown"}}}})}function Bp(e){return R({description:"List files indexed by the codebase graph (codegraph or graphify). USAGE: returns a list of indexed file paths. Use this when you need to discover which files are in the graph before drilling into a specific one.",args:{},async execute(t,n){let i=Date.now(),r=await at("codegraph","codegraph_files",{projectPath:e.cwd},5000);if(r!==null)return{title:"omo_files: codegraph backend",output:r,metadata:{tool:"omo_files",kind:"codegraph",transport:"mcp",durationMs:Date.now()-i,sessionID:n.sessionID}};let s=await(e.graphRetrieval??G()).invokeFiles(e.cwd,{timeoutMs:5000});if(!s.result)return{title:"omo_files: no index",output:"No indexed files found. If `.codegraph/` doesn't exist, run `npx codegraph init` first. If `graphify-out/` doesn't exist, run `graphify . --no-viz` first.",metadata:{tool:"omo_files",kind:s.kind,durationMs:Date.now()-i,sessionID:n.sessionID}};return{title:`omo_files: ${s.kind??"unknown"} backend`,output:s.result,metadata:{tool:"omo_files",kind:s.kind,durationMs:Date.now()-i,sessionID:n.sessionID}}}})}function qp(e){return R({description:"List all call sites of a symbol in the codebase graph. USAGE: omo_callers with symbol='UserService.create' returns every file:line "+"where that symbol is called. Codegraph-only — returns null if .codegraph/ is missing.",args:{symbol:q.string().min(1).describe("The symbol to find callers for (function, class, method, variable)")},async execute(t,n){let i=Date.now(),r=await at("codegraph","codegraph_callers",{symbol:t.symbol,projectPath:e.cwd},5000);if(r!==null)return{title:`omo_callers: ${t.symbol}`,output:r,metadata:{tool:"omo_callers",symbol:t.symbol,kind:"codegraph",transport:"mcp",durationMs:Date.now()-i,sessionID:n.sessionID}};let s=await(e.graphRetrieval??G()).invokeCallers(t.symbol,e.cwd,{timeoutMs:5000});if(!s.result)return{title:`omo_callers: ${t.symbol} (no callers or no codegraph)`,output:`No call sites found for "${t.symbol}". Either the symbol is unused, or codegraph is not installed / has no index. Run \`npx codegraph init\` to create the index.`,metadata:{tool:"omo_callers",symbol:t.symbol,kind:s.kind,durationMs:Date.now()-i,sessionID:n.sessionID}};return{title:`omo_callers: ${t.symbol}`,output:s.result,metadata:{tool:"omo_callers",symbol:t.symbol,kind:s.kind,durationMs:Date.now()-i,sessionID:n.sessionID}}}})}function Jp(e){return R({description:"Get the source code of a symbol (function/class/method/variable) and its direct callers. USAGE: omo_node with symbol='UserService.create' returns the symbol's definition and "+"every direct call site. Distinct from omo_find (which only returns a definition summary) — "+"this tool returns the full source body. Codegraph-only.",args:{symbol:q.string().min(1).describe("The symbol to resolve (function, class, method, variable)")},async execute(t,n){let i=Date.now(),r=await at("codegraph","codegraph_node",{symbol:t.symbol,projectPath:e.cwd},5000);if(r!==null)return{title:`omo_node: ${t.symbol}`,output:r,metadata:{tool:"omo_node",symbol:t.symbol,kind:"codegraph",transport:"mcp",durationMs:Date.now()-i,sessionID:n.sessionID}};let s=await(e.graphRetrieval??G()).invokeNode(t.symbol,e.cwd,{timeoutMs:5000});if(!s.result)return{title:`omo_node: ${t.symbol} not found`,output:`Symbol "${t.symbol}" was not found in the codegraph index. Run \`npx codegraph init\` if the index doesn't exist, or \`npx codegraph sync\` to refresh.`,metadata:{tool:"omo_node",symbol:t.symbol,kind:s.kind,durationMs:Date.now()-i,sessionID:n.sessionID}};return{title:`omo_node: ${t.symbol}`,output:s.result,metadata:{tool:"omo_node",symbol:t.symbol,kind:s.kind,durationMs:Date.now()-i,sessionID:n.sessionID}}}})}function se(e,t,n,i,r,o){let s=Date.now()-i;if(!n.result)return{title:`${e}: no result`,output:o,metadata:{tool:e,kind:n.kind,durationMs:s,sessionID:r.sessionID,...t}};return{title:e,output:n.result,metadata:{tool:e,kind:n.kind,durationMs:s,sessionID:r.sessionID,...t}}}function Kp(e){return R({description:"Get a focused code context window for a given task. USAGE: omo_context with task='validate JWT tokens' returns relevant code blocks (file paths + line ranges). "+"Codegraph-only — returns null if .codegraph/ is missing.",args:{task:q.string().min(1).describe("The task to extract context for")},async execute(t,n){let i=Date.now(),r=await at("codegraph","codegraph_context",{task:t.task,maxNodes:20,projectPath:e.cwd},5000);if(r!==null)return{title:"omo_context",output:r,metadata:{tool:"omo_context",task:t.task,kind:"codegraph",transport:"mcp",durationMs:Date.now()-i,sessionID:n.sessionID}};let s=await(e.graphRetrieval??G()).invokeContext(t.task,e.cwd,{timeoutMs:5000});return se("omo_context",{task:t.task},{...s,durationMs:Date.now()-i},i,n,`No context for task "${t.task}". Run \`npx codegraph init\` if the index doesn't exist.`)}})}function Xp(e){return R({description:"List files affected by changes in the given source files. USAGE: omo_affected_cg with files=['src/auth.ts'] returns the set of test files, callers, and dependent modules. Codegraph-only.",args:{files:q.array(q.string().min(1)).min(1).describe("Source file paths to analyze (relative to cwd)")},async execute(t,n){let i=Date.now(),o=await(e.graphRetrieval??G()).invokeAffected(t.files,e.cwd,{timeoutMs:5000});return se("omo_affected_cg",{files:t.files.join(",")},{...o,durationMs:Date.now()-i},i,n,`Could not compute affected files for [${t.files.join(", ")}]. Run \`npx codegraph init\` if needed.`)}})}function Yp(e){return R({description:"Show codegraph health: node count, version, last update timestamp. USAGE: omo_status returns a multi-line report. Codegraph-only.",args:{},async execute(t,n){let i=Date.now(),r=await at("codegraph","codegraph_status",{projectPath:e.cwd},5000);if(r!==null)return{title:"omo_status",output:r,metadata:{tool:"omo_status",kind:"codegraph",transport:"mcp",durationMs:Date.now()-i,sessionID:n.sessionID}};let s=await(e.graphRetrieval??G()).invokeStatus(e.cwd,{timeoutMs:5000});return se("omo_status",{},{...s,durationMs:Date.now()-i},i,n,"codegraph is not installed or has no index. Run `npx codegraph init` to create one.")}})}function Qp(e){return R({description:"Remove a stale codegraph lock file (left behind after a crash). USAGE: omo_unlock clears the lock so the next sync can run. Codegraph-only.",args:{},async execute(t,n){let i=Date.now(),o=await(e.graphRetrieval??G()).invokeUnlock(e.cwd,{timeoutMs:5000});return se("omo_unlock",{},{...o,durationMs:Date.now()-i},i,n,"codegraph is not installed.")}})}function ef(e){return R({description:"Mark the codegraph index as dirty so the next sync re-extracts. USAGE: omo_mark_dirty when you know source files changed without git hooks firing.",args:{},async execute(t,n){let i=Date.now(),o=await(e.graphRetrieval??G()).invokeMarkDirty(e.cwd,{timeoutMs:5000});return se("omo_mark_dirty",{},{...o,durationMs:Date.now()-i},i,n,"codegraph is not installed.")}})}function tf(e){return R({description:"Trigger a codegraph sync ONLY if the graph was previously marked dirty. USAGE: omo_sync_if_dirty is a cheap daily check; omo_status shows the dirty flag.",args:{},async execute(t,n){let i=Date.now(),o=await(e.graphRetrieval??G()).invokeSyncIfDirty(e.cwd,{timeoutMs:30000});return se("omo_sync_if_dirty",{},{...o,durationMs:Date.now()-i},i,n,"codegraph is not installed or no index exists.")}})}function rf(e){return R({description:"Manually trigger a full codegraph reindex. USAGE: omo_index when you want a guaranteed-fresh graph (bypasses the dirty-flag check).",args:{},async execute(t,n){let i=Date.now(),o=await(e.graphRetrieval??G()).invokeIndex(e.cwd,{timeoutMs:60000});return se("omo_index",{},{...o,durationMs:Date.now()-i},i,n,"codegraph is not installed. Run `npm i -D @colbymchenry/codegraph` first.")}})}function nf(e){return R({description:"Generate an HTML visualization of the codegraph. USAGE: omo_visualize returns the path to the generated HTML file.",args:{},async execute(t,n){let i=Date.now(),o=await(e.graphRetrieval??G()).invokeVisualize(e.cwd,{timeoutMs:30000});return se("omo_visualize",{},{...o,durationMs:Date.now()-i},i,n,"codegraph is not installed.")}})}function of(e){return R({description:"Start the codegraph HTTP server on the given port. USAGE: omo_serve with port=3030 starts the server in the background. Returns the port + status.",args:{port:q.number().int().min(1).max(65535).describe("TCP port to bind the codegraph server to")},async execute(t,n){let i=Date.now(),o=await(e.graphRetrieval??G()).invokeServe(t.port,e.cwd,{timeoutMs:5000});return se("omo_serve",{port:t.port},{...o,durationMs:Date.now()-i},i,n,"codegraph is not installed. Run `npm i -D @colbymchenry/codegraph` first.")}})}function sf(e){return R({description:"Remove the codegraph index (.codegraph/) from disk. "+"USAGE: omo_uninit when you want a clean slate — next sync will rebuild from scratch.",args:{},async execute(t,n){let i=Date.now(),o=await(e.graphRetrieval??G()).invokeUninit(e.cwd,{timeoutMs:5000});return se("omo_uninit",{},{...o,durationMs:Date.now()-i},i,n,"codegraph is not installed.")}})}function af(e){return R({description:"Diagnose the graphify graph for inconsistencies, multigraph warnings, and stale nodes. USAGE: omo_diagnose returns a JSON-like report. Graphify-only.",args:{},async execute(t,n){let i=Date.now(),o=await(e.graphRetrieval??G()).invokeDiagnose(e.cwd,{timeoutMs:1e4});return se("omo_diagnose",{},{...o,durationMs:Date.now()-i},i,n,"graphify is not installed. Run `pip install graphifyy` first.")}})}function lf(e){return R({description:"Run graphify's 3-way merge driver to resolve conflicting graph segments. USAGE: omo_merge_graphs when git reports a conflict in graphify-out/. Graphify-only.",args:{},async execute(t,n){let i=Date.now(),o=await(e.graphRetrieval??G()).invokeMergeDriver(e.cwd,{timeoutMs:30000});return se("omo_merge_graphs",{},{...o,durationMs:Date.now()-i},i,n,"graphify is not installed.")}})}function cf(e){return R({description:"Persist the result of the last graphify query to disk for later inspection. USAGE: omo_save_result after omo_explain or omo_path returns a useful output.",args:{},async execute(t,n){let i=Date.now(),o=await(e.graphRetrieval??G()).invokeSaveResult(e.cwd,{timeoutMs:5000});return se("omo_save_result",{},{...o,durationMs:Date.now()-i},i,n,"graphify is not installed.")}})}function uf(e){return R({description:"Re-run graphify's semantic extraction over the entire source tree. USAGE: omo_extract when the graph schema changed and you want a fresh semantic layer.",args:{},async execute(t,n){let i=Date.now(),o=await(e.graphRetrieval??G()).invokeExtract(e.cwd,{timeoutMs:60000});return se("omo_extract",{},{...o,durationMs:Date.now()-i},i,n,"graphify is not installed.")}})}function df(e){return R({description:"Re-run graphify's clustering step (skip semantic extraction). USAGE: omo_cluster_only after minor node additions to refresh the topic map.",args:{},async execute(t,n){let i=Date.now(),o=await(e.graphRetrieval??G()).invokeClusterOnly(e.cwd,{timeoutMs:30000});return se("omo_cluster_only",{},{...o,durationMs:Date.now()-i},i,n,"graphify is not installed.")}})}function mf(e){return R({description:"Apply a label to a graphify node (e.g. for categorization or human notes). USAGE: omo_label with node='validateToken' applies a label.",args:{node:q.string().min(1).describe("The graph node to label")},async execute(t,n){let i=Date.now(),o=await(e.graphRetrieval??G()).invokeLabel(t.node,e.cwd,{timeoutMs:5000});return se("omo_label",{node:t.node},{...o,durationMs:Date.now()-i},i,n,"graphify is not installed.")}})}function pf(e){return R({description:"Emit a tree visualization of the graphify graph (hierarchical topic layout). USAGE: omo_tree for a structural overview of the topic map. Graphify-only.",args:{},async execute(t,n){let i=Date.now(),o=await(e.graphRetrieval??G()).invokeTree(e.cwd,{timeoutMs:1e4});return se("omo_tree",{},{...o,durationMs:Date.now()-i},i,n,"graphify is not installed.")}})}function ff(e){return R({description:"Clone the graphify graph to a new location. USAGE: omo_clone when forking a project or creating a backup.",args:{},async execute(t,n){let i=Date.now(),o=await(e.graphRetrieval??G()).invokeClone(e.cwd,{timeoutMs:30000});return se("omo_clone",{},{...o,durationMs:Date.now()-i},i,n,"graphify is not installed.")}})}function gf(e){return R({description:"Add specific files to the graphify graph (instead of re-extracting the whole tree). USAGE: omo_add with files='src/auth.ts src/login.ts' after writing new files.",args:{files:q.string().min(1).describe("Space-separated list of file paths to add (relative to cwd)")},async execute(t,n){let i=Date.now(),o=await(e.graphRetrieval??G()).invokeAdd(t.files,e.cwd,{timeoutMs:30000});return se("omo_add",{files:t.files},{...o,durationMs:Date.now()-i},i,n,"graphify is not installed.")}})}function hf(e){return R({description:"Check if the graphify schema or extractors changed since the last extraction. USAGE: omo_check_update to decide if re-extraction is needed. Graphify-only.",args:{},async execute(t,n){let i=Date.now(),o=await(e.graphRetrieval??G()).invokeCheckUpdate(e.cwd,{timeoutMs:1e4});return se("omo_check_update",{},{...o,durationMs:Date.now()-i},i,n,"graphify is not installed.")}})}function vf(e){return R({description:"Check whether the graphify post-commit git hook is installed in this project. USAGE: omo_hook_status returns 'installed' or 'missing' along with the hook path. Run after `git init` to confirm the hook is wired.",args:{},async execute(t,n){let i=Date.now();await Promise.resolve().then(() => Qr());let o=await qi(e.cwd),s=`${e.cwd}/.git/hooks/post-commit`,a=o?`graphify post-commit hook is INSTALLED at ${s}.`:"graphify post-commit hook is NOT installed. Run `graphify hook install` or enable graphSync in plugin config to install automatically.";return{title:`omo_hook_status: ${o?"installed":"missing"}`,output:a,metadata:{tool:"omo_hook_status",installed:o,hookPath:s,durationMs:Date.now()-i,sessionID:n.sessionID}}}})}function ki(e,t,n,i,r,o){let s=Date.now()-i;if(!n.ok)return{title:`${e}: ${n.code}`,output:`${o}
244
244
 
245
245
  Diagnostic: ${n.code}
246
- stderr: ${n.stderr||"(empty)"}`,metadata:{tool:e,code:n.code,durationMs:s,sessionID:r.sessionID,...t}};let a=n.data!==null&&n.data!==void 0?typeof n.data==="string"?n.data:JSON.stringify(n.data,null,2):n.rawOutput??"";return{title:e,output:a,metadata:{tool:e,code:n.code,durationMs:s,sessionID:r.sessionID,...t}}}function yf(e){return E({description:"Install a CLI from the CLI-Anything hub so the agent can drive that software. USAGE: omo_cli_anything_install with name='gimp' installs `cli-anything-gimp`, which exposes a `cli-anything-gimp` command. Browse the catalog with omo_cli_anything_list. See https://github.com/HKUDS/CLI-Anything for the full registry.",args:{name:q.string().min(1).describe("The CLI name to install (e.g. 'gimp', 'blender', 'drawio')")},async execute(t,n){let o=Date.now();await Promise.resolve().then(() => Tt());let i=hd(t.name,e.runner,120000,"cli-hub");return wo("omo_cli_anything_install",{name:t.name},{...i,durationMs:Date.now()-o},o,n,`Could not install '${t.name}'. Check that cli-anything-hub is installed (omo_health) and the name is correct.`)}})}function bf(e){return E({description:"List all CLIs available in the CLI-Anything hub (40+ GUI software harnesses). USAGE: omo_cli_anything_list with category='image' returns only image-related CLIs. Returns JSON with name, version, description, category, install_cmd, entry_point. See https://github.com/HKUDS/CLI-Anything.",args:{category:q.string().optional().describe("Optional category filter (e.g. 'image', 'devops', '3d', 'audio')"),source:q.enum(["harness","public","npm","all"]).optional().describe("Optional source filter. 'all' includes harness + public + npm.")},async execute(t,n){let o=Date.now();await Promise.resolve().then(() => Tt());let i=pd({category:t.category,source:t.source},e.runner,30000,"cli-hub");return wo("omo_cli_anything_list",{category:t.category,source:t.source},{...i,durationMs:Date.now()-o},o,n,"Could not list CLIs from the hub. Make sure cli-anything-hub is installed: `pip install cli-anything-hub`.")}})}function _f(e){return E({description:"Search the CLI-Anything hub for CLIs matching a query (name, description, or category). USAGE: omo_cli_anything_search with query='cad' returns CAD-related CLIs. Returns JSON array. See https://github.com/HKUDS/CLI-Anything.",args:{query:q.string().min(1).describe("Search query (matches name, description, or category)")},async execute(t,n){let o=Date.now();await Promise.resolve().then(() => Tt());let i=fd(t.query,e.runner,30000,"cli-hub");return wo("omo_cli_anything_search",{query:t.query},{...i,durationMs:Date.now()-o},o,n,"Search failed. Make sure cli-anything-hub is installed: `pip install cli-anything-hub`.")}})}function kf(e){return E({description:"Show details for a specific CLI in the CLI-Anything hub. USAGE: omo_cli_anything_info with name='blender' returns display name, version, description, requirements (e.g. 'blender (apt install blender)'), entry point, install command. See https://github.com/HKUDS/CLI-Anything.",args:{name:q.string().min(1).describe("The CLI name to look up")},async execute(t,n){let o=Date.now();await Promise.resolve().then(() => Tt());let i=gd(t.name,e.runner,1e4,"cli-hub");return wo("omo_cli_anything_info",{name:t.name},{...i,durationMs:Date.now()-o},o,n,`Could not find '${t.name}' in the hub. Try omo_cli_anything_search to find similar names.`)}})}ko();class Xc{entries=new Map;deliveredCount=0;expiredCount=0;register(e){this.cleanup();let t=`deliv-${Date.now()}-${Math.random().toString(36).slice(2,10)}`,n=wf(e.mcpArgs);return this.entries.set(t,{id:t,sessionID:e.sessionID,mcpTool:e.mcpTool,mcpArgsHash:n,registeredAt:Date.now(),ttlMs:e.ttlMs??1e4}),t}markDelivered(e){this.cleanup();let t=e.mcpArgs?wf(e.mcpArgs):null;for(let[n,o]of this.entries){if(o.sessionID!==e.sessionID)continue;if(o.mcpTool!==e.mcpTool)continue;if(t!==null&&o.mcpArgsHash!==t)continue;return this.entries.delete(n),this.deliveredCount++,n}return null}async awaitDelivery(e){let t=e.timeoutMs??2000,n=Date.now();while(Date.now()-n<t){if(this.cleanup(),![...this.entries.values()].find((r)=>r.sessionID===e.sessionID&&r.mcpTool===e.mcpTool))return"delivered";await ok(50)}return"expired"}getStats(){return{pending:this.entries.size,delivered:this.deliveredCount,expired:this.expiredCount}}clearSession(e){for(let[t,n]of this.entries)if(n.sessionID===e)this.entries.delete(t)}cleanup(){let e=Date.now();for(let[t,n]of this.entries)if(e-n.registeredAt>n.ttlMs)this.entries.delete(t),this.expiredCount++}}function wf(e){return JSON.stringify(e,Object.keys(e).sort())}function ok(e){return new Promise((t)=>setTimeout(t,e))}ft();Bt();import{resolve as Cw}from"node:path";import{readFileSync as ik}from"node:fs";import{dirname as sk,resolve as ak}from"node:path";import{fileURLToPath as lk}from"node:url";var xf="0.0.0";try{let e=sk(lk(import.meta.url)),t=ak(e,"..","package.json"),n=JSON.parse(ik(t,"utf8"));if(typeof n.version==="string"&&n.version.length>0)xf=n.version}catch{}var me=xf,$f=["decisions_taken","decisions_skipped_continue","decisions_skipped_no_decision","decisions_skipped_no_message","decisions_skipped_below_threshold","interventions_delivered","interventions_disabled_done","interventions_disabled_cap","decisions_stored","plan_reminders_injected","bot_feedback_injected","violations_injected","protocol_audits_passed","protocol_violations_detected","git_commit_reindex","orchestrator_runs","orchestrator_errors","materialization_failures","tier3_reminders_sent","tier3_skills_created","tool_calls_observed","governance_blocks","governance_asks","governance_tools_hidden","governance_tools_rewritten","governance_commands_blocked"];function Sf(){let e={};for(let t of $f)e[t]={count:0,lastOccurrenceISO:null};return e}var ck=Sf(),N0=new Date().toISOString();function If(e){let t=e??{},n=Sf(),o=new Date().toISOString(),r=t.version??me,i=t.global===!0;return{inc(s){let a=n[s];if(!a)return;if(a.count++,a.lastOccurrenceISO=new Date().toISOString(),i){let l=ck[s];if(l)l.count++,l.lastOccurrenceISO=a.lastOccurrenceISO}},getMetrics(){return{version:r,sessionID:t.sessionID??"",startedAtISO:o,uptimeMs:Date.now()-new Date(o).getTime(),counters:{...n}}},reset(){for(let s of $f)n[s]={count:0,lastOccurrenceISO:null}}}}function Tf(e,t){for(let n of t)try{if(new RegExp(n).test(e))return n}catch{}return null}function uk(e){let n=e.replace(/^\*\*\//,"").replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,".*").replace(/\*/g,"[^/]*");return new RegExp(n)}function Df(e,t){for(let n of t)try{if(uk(n).test(e))return n}catch{}return null}function dk(e,t){let n;try{n=new URL(e).host}catch{return null}for(let o of t)if(n===o||n.endsWith("."+o)||n.includes(o))return o;return null}function Pf(e,t){let n=Tf(e,t.bashDenyPatterns??[]);if(n!==null)return{decision:"deny",reason:'bash command matches deny pattern "'+n+'"'};let o=Tf(e,t.bashAskPatterns??[]);if(o!==null)return{decision:"ask",reason:'bash command matches ask pattern "'+o+'"'};return null}function Of(e,t){let n=Df(e,t.editDenyPaths??[]);if(n!==null)return{decision:"deny",reason:'edit path matches deny pattern "'+n+'"'};let o=Df(e,t.editAskPaths??[]);if(o!==null)return{decision:"ask",reason:'edit path matches ask pattern "'+o+'"'};return null}function Ef(e,t){let n=dk(e,t.webfetchDenyHosts??[]);if(n!==null)return{decision:"deny",reason:'webfetch host matches deny pattern "'+n+'"'};return null}async function Rf(e,t,n,o){if(!n||n.mode===void 0)return;if(!n.mode)return;let r;switch(e.type){case"bash":r=Pf(e.command,n);break;case"edit":r=Of(e.pattern,n);break;case"webfetch":r=Ef(e.url,n);break;default:return}if(r===null)return;if(t.status=r.decision,r.decision==="deny")o.inc("governance_blocks");else o.inc("governance_asks")}async function zf(e,t,n,o){if(!n.enabled)return;if(n.hideToolIDs?.includes(e.toolID)){t.description="",o.inc("governance_tools_hidden");return}if(n.descriptionSuffix)t.description=(t.description??"")+n.descriptionSuffix,o.inc("governance_tools_rewritten");let r=n.parameterOverrides?.[e.toolID];if(!r||!t.parameters?.properties)return;for(let[i,s]of Object.entries(r))if(t.parameters.properties[i])t.parameters.properties[i].description=s}async function Cf(e,t,n,o){if(!n.enabled)return;if(n.denyPatterns?.length)for(let r of n.denyPatterns)try{if(new RegExp(r).test(e.command))throw o.inc("governance_commands_blocked"),Error('[meta-governor] blocked command matching pattern "'+r+'"')}catch(i){if((i instanceof Error?i.message:String(i)).includes("blocked command matching"))throw i}if(n.replacementPrefix)t.parts.push({type:"text",text:n.replacementPrefix+" executing: "+e.command,synthetic:!0})}async function Mf(e,t,n){if(!n.enabled)return;if(!n.modelID||!n.providerID)return;let o=e.provider.models??{},r=Object.values(o).find((i)=>typeof i==="object"&&i!==null&&i.id===n.modelID);if(r)t.model=r}import{homedir as wk}from"node:os";import{join as xk}from"node:path";function Qc(e){let t={enabled:!1,...e},n=Ko(),o=Xo(),r=rn();return{enabled:t.enabled===!0,memory:{enabled:!0,query:t.memory?.query??"meta_governor_context",timeoutMs:t.memory?.timeoutMs??t.memory?.agentmemoryTimeoutMs??2000},tokenPredictor:{compactBurnRateThreshold:t.tokenPredictor?.compactBurnRateThreshold??500,compactUsageThreshold:t.tokenPredictor?.compactUsageThreshold??0.85,switchModelUsageThreshold:t.tokenPredictor?.switchModelUsageThreshold??0.95,delegateConsecutiveHighBurn:t.tokenPredictor?.delegateConsecutiveHighBurn??5},scoring:{...n,...t.scoring?.continueThreshold!==void 0?{continueThreshold:t.scoring.continueThreshold}:{},...t.scoring?.warnThreshold!==void 0?{warnThreshold:t.scoring.warnThreshold}:{},...t.scoring?.escalateThreshold!==void 0?{escalateThreshold:t.scoring.escalateThreshold}:{},...t.scoring?.stopThreshold!==void 0?{stopThreshold:t.scoring.stopThreshold}:{},...t.scoring?.paralysisThreshold!==void 0?{paralysisThreshold:t.scoring.paralysisThreshold}:{},...t.scoring?.defaultEscalationTarget!==void 0?{defaultEscalationTarget:t.scoring.defaultEscalationTarget}:{},oracleFrequency:t.oracle?.frequency??t.scoring?.oracleFrequency??"per-stop"},closedLoop:{...r,...t.closedLoop?.enabled!==void 0?{enabled:t.closedLoop.enabled}:{},...t.closedLoop?.minSeverityToLearn!==void 0?{minSeverityToLearn:t.closedLoop.minSeverityToLearn}:{},...t.closedLoop?.maxLessonsPerSession!==void 0?{maxLessonsPerSession:t.closedLoop.maxLessonsPerSession}:{},...t.closedLoop?.saveDecisions!==void 0?{saveDecisions:t.closedLoop.saveDecisions}:{},...t.closedLoop?.saveLessons!==void 0?{saveLessons:t.closedLoop.saveLessons}:{}},decision:{...o,...t.decision?.maxHistoryPerSession!==void 0?{maxHistoryPerSession:t.decision.maxHistoryPerSession}:{},...t.decision?.forceContinueAfterStops!==void 0?{forceContinueAfterStops:t.decision.forceContinueAfterStops}:{},...t.decision?.warnMessageTemplate!==void 0?{warnMessageTemplate:t.decision.warnMessageTemplate}:{},...t.decision?.escalateMessageTemplate!==void 0?{escalateMessageTemplate:t.decision.escalateMessageTemplate}:{},...t.decision?.stopMessageTemplate!==void 0?{stopMessageTemplate:t.decision.stopMessageTemplate}:{}},modelOverride:t.modelOverride?{providerID:t.modelOverride.providerID,modelID:t.modelOverride.modelID,modelLimit:t.modelOverride.modelLimit,temperature:t.modelOverride.temperature??0.2,topP:t.modelOverride.topP??1,maxTokens:t.modelOverride.maxTokens??2048,reasoning:t.modelOverride.reasoning??!1,verbosity:t.modelOverride.verbosity??"minimal"}:void 0,intervention:{mode:t.intervention?.mode??"silent",includeDecisionHistory:t.intervention?.includeDecisionHistory??!0,maxHistoryMessages:t.intervention?.maxHistoryMessages??5,minActionForMessage:t.intervention?.minActionForMessage??"stop",maxInterventionsPerSession:t.intervention?.maxInterventionsPerSession??3,respectDoneSignal:t.intervention?.respectDoneSignal??!0,phaseAwareDoneSignal:t.intervention?.phaseAwareDoneSignal??!1,persistToSession:t.intervention?.persistToSession??!0,compactionLoopGuard:{enabled:t.intervention?.compactionLoopGuard?.enabled??!0,maxOverflowRecoveries:Math.max(1,t.intervention?.compactionLoopGuard?.maxOverflowRecoveries??1)}},postWave:{enabled:t.postWave?.enabled??t.intervention?.phaseAwareDoneSignal===!0,repoMode:t.postWave?.repoMode??"auto",aasToolPrefix:t.postWave?.aasToolPrefix??"aas",ciTimeoutMs:t.postWave?.ciTimeoutMs??600000,maxRetriesPerWave:t.postWave?.maxRetriesPerWave??1,reinjectCooldownMs:t.postWave?.reinjectCooldownMs??60000,respectSilentMode:t.postWave?.respectSilentMode??!1,...t.postWave?.ownRepoDirective!==void 0?{ownRepoDirective:t.postWave.ownRepoDirective}:{},...t.postWave?.thirdPartyDirective!==void 0?{thirdPartyDirective:t.postWave.thirdPartyDirective}:{}},protocolEnforcement:{enabled:t.protocolEnforcement?.enabled??!1,path:t.protocolEnforcement?.path,injectIntoSystem:t.protocolEnforcement?.injectIntoSystem??!1,auditToolCalls:t.protocolEnforcement?.auditToolCalls??!1},skillPriming:{enabled:t.skillPriming?.enabled??!0,trigger:t.skillPriming?.trigger??"firstImplement",router:t.skillPriming?.router??"registry",enforceMode:t.skillPriming?.enforceMode??"directive"},skillHub:{enabled:t.skillHub?.enabled??!1,syncIntervalMs:t.skillHub?.syncIntervalMs??86400000,bootstrapUrl:t.skillHub?.bootstrapUrl??"https://skills-library.com/api/skills.json",searchFallbackUrl:t.skillHub?.searchFallbackUrl??"https://skills.sh/api/search",downloadBaseUrl:t.skillHub?.downloadBaseUrl??"https://skills.sh/api/download",embedBaseUrl:t.skillHub?.embedBaseUrl??"http://127.0.0.1:3114/v1",embedModel:t.skillHub?.embedModel??"bge-m3",minInstalls:t.skillHub?.minInstalls??0,filterDuplicates:t.skillHub?.filterDuplicates!==!1,depsCheck:t.skillHub?.depsCheck!==!1,choreDir:t.skillHub?.choreDir??xk(wk(),".agents","skills"),autoMaterialize:t.skillHub?.autoMaterialize??!0},graphSync:{killOrphanedOnInit:t.graphSync?.killOrphanedOnInit??!0,reindexOnFetch:t.graphSync?.reindexOnFetch!==!1,fetchBranch:t.graphSync?.fetchBranch??"main",autoUpgrade:t.graphSync?.autoUpgrade!==!1,upgradeCachePath:t.graphSync?.upgradeCachePath,checkGraphifyNeedsUpdate:t.graphSync?.checkGraphifyNeedsUpdate!==!1,addToGlobalGraph:t.graphSync?.addToGlobalGraph===!0},graphRetrieval:{preferredTool:t.graphRetrieval?.preferredTool??"auto",preferLocalCodegraph:t.graphRetrieval?.preferLocalCodegraph===!0,contextRouting:t.graphRetrieval?.contextRouting===!0},cliAnything:{enabled:t.cliAnything?.enabled!==!1,autoInstall:t.cliAnything?.autoInstall!==!1,autoUpgrade:t.cliAnything?.autoUpgrade!==!1,cachePath:t.cliAnything?.cachePath,upgradeCheckTtlMs:t.cliAnything?.upgradeCheckTtlMs,cliHubBin:t.cliAnything?.cliHubBin??"cli-hub",skillsBin:t.cliAnything?.skillsBin??"npx skills",installScope:t.cliAnything?.installScope??"global"},governance:{permissionPolicy:t.governance?.permissionPolicy?{mode:t.governance.permissionPolicy.mode,bashDenyPatterns:t.governance.permissionPolicy.bashDenyPatterns,bashAskPatterns:t.governance.permissionPolicy.bashAskPatterns,editDenyPaths:t.governance.permissionPolicy.editDenyPaths,editAskPaths:t.governance.permissionPolicy.editAskPaths,webfetchDenyHosts:t.governance.permissionPolicy.webfetchDenyHosts}:void 0,toolRewrite:{enabled:t.governance?.toolRewrite?.enabled??!0,descriptionSuffix:t.governance?.toolRewrite?.descriptionSuffix,hideToolIDs:t.governance?.toolRewrite?.hideToolIDs,parameterOverrides:t.governance?.toolRewrite?.parameterOverrides},commandFilter:{enabled:t.governance?.commandFilter?.enabled??!0,denyPatterns:t.governance?.commandFilter?.denyPatterns,replacementPrefix:t.governance?.commandFilter?.replacementPrefix},smallModelOverride:t.governance?.smallModelOverride?{enabled:t.governance.smallModelOverride.enabled,modelID:t.governance.smallModelOverride.modelID,providerID:t.governance.smallModelOverride.providerID}:void 0}}}function tT(e){if(!e)return!1;if(e.enabled===!0)return!0;return e.meta_governor?.enabled===!0}async function rT(e={}){await Promise.resolve().then(() => Yc());let n=await $o(e);return Qc(n.config)}Yc();var lt=new Map,So=new Map;function eu(e,t){lt.set(e,t);let n=So.get(e)??[];if(n.push(t.historyEntry),n.length>20)n.splice(0,n.length-20);So.set(e,n)}function Ft(e){let t=lt.get(e);if(t!==void 0)lt.delete(e);return t}function Uf(e){return lt.get(e)}function oT(e){return lt.has(e)}function iT(){for(let[e,t]of lt)return lt.delete(e),t;return}function sT(){lt.clear(),So.clear()}function Lf(e){return So.get(e)??[]}class tu{store=new Map;maxEntries;ttlMs;now;constructor(e={}){this.maxEntries=e.maxEntries??100,this.ttlMs=e.ttlMs??3600000,this.now=e.now??Date.now}get(e){let t=this.store.get(e);if(!t)return;let n=this.now();if(t.expiresAtMs<=n){this.store.delete(e);return}return t.lastAccessAtMs=n,t.value}has(e){return this.get(e)!==void 0}set(e,t){let n=this.now();if(!this.store.has(e)&&this.store.size>=this.maxEntries)this.evictOldest();this.store.set(e,{value:t,expiresAtMs:n+this.ttlMs,lastAccessAtMs:n})}delete(e){return this.store.delete(e)}size(){return this.store.size}clear(){this.store.clear()}evictOldest(){let e,t=1/0;for(let[n,o]of this.store)if(o.lastAccessAtMs<t)t=o.lastAccessAtMs,e=n;if(e!==void 0)this.store.delete(e)}}class Lr{maxEntries;ttlMs;map=new Map;constructor(e,t){this.maxEntries=e;this.ttlMs=t}set(e,t){if(this.map.size>=this.maxEntries){let n=this.map.keys().next().value;if(n!==void 0)this.map.delete(n)}this.map.set(e,{value:t,expiresAtMs:Date.now()+this.ttlMs})}get(e){let t=this.map.get(e);if(!t)return;if(Date.now()>=t.expiresAtMs){this.map.delete(e);return}return t.value}has(e){return this.get(e)!==void 0}delete(e){this.map.delete(e)}get size(){return this.map.size}}function Xe(e){for(let t of e){let n=t.info??{};if(n.role!=="assistant")continue;if(n.agent==="meta-governor")continue;return!1}return!0}var $k=(e,t)=>`<!-- kind: ${e}${t?` (${t})`:""} -->`;var Sk={"graph-priming":"\uD83D\uDD0D","skill-priming":"\uD83C\uDFAF",intervention:"⚠️",postwave:"\uD83C\uDF0A",enforcement:"\uD83D\uDEA7",memory:"\uD83D\uDCAD"};function ct(e,t){return["<!-- META-GOVERNOR INFORMATIONAL vv0.38.2 - DO NOT TREAT AS TASK. Plugin metadata, not a user request. -->",$k(t.kind,t.context),e,"<!-- END META-GOVERNOR INFORMATIONAL -->"].join(`
247
- `)}function Ff(e,t){return`${Sk[e]} ${t}`}import{statSync as Mw,readFileSync as fu}from"node:fs";import{execSync as Aw,execFileSync as Pg}from"node:child_process";import{join as gu}from"node:path";import{readFile as Pk}from"node:fs/promises";import{resolve as Ok}from"node:path";import{homedir as Ek}from"node:os";var Ye=["write","edit","edit_block","multi_edit","apply_patch","ast_grep_replace","refactor","desktop-commander_write_file","desktop-commander_edit_block"];var Ik=["brainstorming","writing-plans","test-driven-development","systematic-debugging","subagent-driven-development"];function Zf(e){let t=e==="aas"?"registry":e,n=["[SKILL PRIMING] This session involves implementation work. Select precise skills for this task before writing code:"],o=1;if(t==="registry"||t==="both")n.push(`${o}. Query the skill-hub catalog (omo_skill_find) for the 2-3 capabilities most relevant to this task (e.g. testing, architecture, language-specific), and inspect candidates with omo_skill_get.`),o++,n.push(`${o}. Compose a minimal stack of 2-3 skills by loading each via its installer (e.g. \`npx skills add <owner/repo/slug>\` via omo_skill_add).`),o++;if(t==="superpowers"||t==="both")n.push(`${o}. If a matching superpowers skill is available and not yet active (${Ik.join(" / ")}), delegate it to a sub-agent via \`task(category='<category>', load_skills=['<slug>'])\` — the skill's content is injected into the sub-agent's system prompt. (Requires the superpowers plugin to be installed separately.)`),o++;if(t==="both")n.push("If a superpowers skill is already active, skip the catalog step.");n.push("Do NOT enumerate the full catalog — keep the stack minimal and task-specific.");let r=n.join(`
248
- `);return ct(r,{kind:"skill-priming",context:`router=${t}`})}function Gf(e){return Ff("skill-priming",`Skill priming (${e==="aas"?"registry":e}): nudging agent to discover relevant skills before implementation.`)}function Wf(e){if(e.trigger==="sessionStart")return!0;if(e.implementationToolSeen)return!0;return e.recentToolCalls.some((t)=>Ye.includes(t))}var Tk=[/[\\/](\.tmp|\.scratch|scratch|tmp|trash|throwaway)[\\/]/i,/[\\/]tests?[\\/]|^tests?[\\/]/,/[\\/]__tests__[\\/]/,/[\\/]fixtures?[\\/]/,/[\\/]examples?[\\/]/,/\.test\.[a-z]+$/,/\.spec\.[a-z]+$/],Dk=50;function Hf(e,t){if(e==="edit"||e==="edit_block"||e==="multi_edit"||e==="apply_patch"||e==="ast_grep_replace"||e==="refactor"||e==="desktop-commander_edit_block")return!0;if(e!=="write"&&e!=="desktop-commander_write_file")return!1;let n=t,o=typeof n?.filePath==="string"?n.filePath:typeof n?.path==="string"?n.path:"";if(o&&Tk.some((i)=>i.test(o)))return!0;let r=n?.content;if(typeof r==="string"&&r.split(`
249
- `).length<=Dk)return!0;return!1}function Vf(e,t){let n=t,o=typeof n?.filePath==="string"?n.filePath:typeof n?.path==="string"?n.path:"",r=/\.([a-z]+)$/i.exec(o),i=r?r[1].toLowerCase():"";return`omo_skill_find "${{ts:"typescript",tsx:"typescript-react",js:"javascript",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",cs:"csharp",cpp:"cpp",c:"c",sh:"bash",bash:"bash",md:"markdown",json:"json",yaml:"yaml",yml:"yaml",toml:"config",sql:"sql",html:"html",css:"css",scss:"css",vue:"vue",svelte:"svelte"}[i]??"code"} ${e}" --limit 5`}var ru=Ok(Ek(),".config","opencode","sisyphus-mandatory","sisyphus-mandatory.md");async function Bf(e){return await Pk(e??ru,"utf-8")}function qf(e,t){let n=t?.oracleVerified===!0,o=t?.filesChanged??0,r=["","## Sisyphus Protocol Enforcement","","You MUST follow these Sisyphus protocol rules:","","1. **Pre-response Memory Check**: Before any action, read `<project-memory>` and `<session-history-since>` blocks in context. Cite `<memory id>` for any fact used from memory. Do not ask questions whose answers are in those blocks.","","2. **Codebase Graph First**: Before using grep/glob/read for architecture or symbol queries, check whether `.codegraph/` or `graphify-out/` exists. If so, use codegraph/graphify tools first, then grep/read only as last resort.","","3. **Tool Routing Table**: Match common intents to the correct tool:",' - "we did this before" / "you should know" → `agentmemory_memory_recall`'," - Starting a task that resembles a previous one → `agentmemory_memory_smart_search`"," - Before asking the user a clarifying question → `agentmemory_memory_recall` first"," - Save durable insight/decision/rule → `agentmemory_memory_save`",""];if(/\boracle\b/i.test(e)&&!(n&&o>0))r.push("4. **Post-task Oracle Verification**: If files touched >= 3 OR any INVOKE trigger matches, invoke Oracle with the exact format:",' `task(subagent_type="oracle", run_in_background=false, prompt="Verify: ...")`'," - INVOKE triggers: created 1+ new file, modified abstraction, touched security/auth paths, modified DB/persistence, modified CI/CD, added/removed dependency, modified perf-critical path, todo had 2+ completed items."," - SKIP only when: files touched <= 2, no new file, no dependency change, single-step task, change is typo/comment/rename only."," - Verdict: PASS → done. FAIL/CONDITIONAL → fix and re-invoke. Max 3 invocations."," - Cost: Max 3 oracle invocations per task. Skip rate: Must NOT skip Oracle on 2+ file change.","");return r.push("5. **Parallel Query Rule**: Fire independent tool queries in the same turn. Do NOT serialize independent memory/context queries.","","6. **Empty-Result Escalation**: On empty `agentmemory_memory_recall`, fire `agentmemory_memory_smart_search` + `agentmemory_memory_export` before asking the user.","","7. **Hard Rules (No Exceptions)**:"," - Do NOT ask 'where is X?' if memory or session record already contains it."," - Do NOT claim 'I don't know' before firing at least 2 different recall tools."," - Do NOT re-issue clarifying questions whose answer is in `<project-memory>` or `<session-history-since>`."," - Do NOT suppress type errors with `as any`, `@ts-ignore`, or `@ts-expect-error`."," - Do NOT leave empty catch blocks `catch(e) {}`.",' - Do NOT start a fresh agent via `task()` when `task(task_id="ses_...")` (continuation) exists — use continuation IDs.'," - Do NOT batch-complete todos — mark each one `completed` immediately after finishing."," - Do NOT skip creating todos for multi-step tasks.","","8. **Self-Check Before Responding**:"," - Verify you read `<project-memory>` and `<session-history-since>` blocks."," - Verify you cited `<memory id>` for any fact used from memory."," - Verify you did not ask a question whose answer is in those blocks."," - For multi-file changes, verify Oracle was invoked."," - For codebase exploration, verify codegraph/graphify was tried before grep/read."," - After discovering something non-obvious, save it with `agentmemory_memory_save` so future sessions benefit."," - Do NOT save routine operations (file reads, greps, list commands), trivial decisions, or facts already covered by existing memory. Save only novel insights, non-obvious patterns, or corrections to previous assumptions.","","9. **CI Verification Loop (NON-NEGOTIABLE)**: After EVERY step of an implementation plan that produces a code change you intend to keep, you MUST execute the full CI loop BEFORE moving to the next step:"," a. Commit the changes atomically (one commit per verified increment, never omnibus)."," b. Push to the remote that has CI configured (own repo: `git push origin <branch>`. Fork upstream: `git push fork <branch>` + open/update PR)."," c. Wait for the CI run triggered by the push to reach a terminal state (`gh run watch <run-id> --exit-status`).",' d. Assert `conclusion == "success"` on EVERY job. If any job fails, fix the regression, re-push, and re-verify until all jobs are green.'," e. Capture the green run-id so the final plan-completion message can cite it as evidence."," - Anti-pattern this rule kills: running local tests, seeing 0 failures, declaring done, then shipping the next step on top of an unverified CI. Local green is NOT CI green. Pushed-not-watched is NOT CI green."," - At the END of the plan (when the last step is done), run a final guarantee: `gh run list --branch <branch> --limit 5` and assert EVERY recent run on this branch has `conclusion=success`. If any run shows `failure`, surface it explicitly to the user with the run-id, the failing job, and the log excerpt - do NOT claim plan success."," - For fork -> upstream PR workflow: verify the workflow_run on the upstream repo (the PR's head ref), not just the fork. Both must be green."," - This rule applies whenever the repo has a `.github/workflows/*.yml` file (or equivalent CI config). For repos without CI, document the absence explicitly."," - If the user explicitly says 'skip CI' or 'local only', this rule is suppressed for that turn ONLY - re-engage on next step.",""),r.join(`
250
- `)}function Jf(e,t,n){let o=[],r=n.recentToolCalls??[],i=n.recentWriteContents??[],s=n.memorySaved??!1,a=n.batchCompletions??0;if((e==="grep"||e==="glob")&&(n.hasCodegraphDir||n.hasGraphifyDir)){let f=n.hasCodegraphDir?".codegraph":"graphify-out";o.push({rule:"codebase-graph-first",tool:e,severity:"media",detail:`Used ${e} when ${f} exists — should use codegraph/graphify first for architecture and symbol queries.`})}if(e==="task"&&t&&typeof t==="object"){let f=t;if(!f.task_id&&typeof f.prompt==="string"&&r.length>3)o.push({rule:"continuation-discipline",tool:e,severity:"leve",detail:`Started a new task() without task(task_id="ses_...") continuation ID. Use task_id to preserve the subagent's full context and save tokens.`})}if(Ye.includes(e)){let f=typeof t==="object"&&t!==null?JSON.stringify(t):String(t??""),g=/@ts-ignore|@ts-expect-error/.test(f),d=/\bas any\b/.test(f);if(g&&d)o.push({rule:"no-type-suppression",tool:e,severity:"grave",detail:"File write contains both @ts-ignore/@ts-expect-error AND 'as any' — double type suppression. "+"Both are forbidden by the Sisyphus protocol."});else if(g)o.push({rule:"no-type-suppression",tool:e,severity:"media",detail:"File write contains @ts-ignore or @ts-expect-error — both are forbidden. "+"Fix the underlying type error instead."});else if(d)o.push({rule:"no-type-suppression",tool:e,severity:"media",detail:"File write contains 'as any' — type suppression forbidden. "+"Use proper type narrowing instead."})}if(Ye.includes(e)){let f=typeof t==="object"&&t!==null?JSON.stringify(t):String(t??"");if(/catch\s*\(\s*\w+\s*\)\s*\{\s*\}/.test(f))o.push({rule:"no-empty-catch",tool:e,severity:"media",detail:"Empty catch block detected — `catch(e) {}` is forbidden. "+"Log the error or handle it gracefully."})}if(["codegraph_explore","graphify query"].includes(e)&&r.length>=2){if(!s)o.push({rule:"save-discovery-to-memory",tool:e,severity:"leve",detail:`Used ${e} to discover code but no memory save was made afterwards. Save non-obvious findings with agentmemory_memory_save so future sessions benefit.`})}if(a>0&&e!=="todowrite")o.push({rule:"no-batch-todo-completion",tool:e,severity:"leve",detail:"Batch todo completion detected. Each todo must be marked `completed` immediately "+"after finishing — do not batch-complete multiple items."});if(n.emptyRecall&&!n.escalationAttempted){if(e.startsWith("question")||e==="ask")o.push({rule:"empty-result-escalation",tool:e,severity:"grave",detail:"Memory recall returned empty but agent did not fire smart_search + export before asking the user. Steps 1-3 of empty-result escalation protocol are mandatory."})}let c=["agentmemory_memory_recall","agentmemory_memory_smart_search","agentmemory_memory_save"];if(!n.memoryToolsUsed.some((f)=>c.some((g)=>f.startsWith(g)))&&(e.startsWith("question")||e==="ask"))o.push({rule:"memory-first",tool:e,severity:"grave",detail:"Asked a question without first querying memory. Must fire agentmemory_memory_recall or agentmemory_memory_smart_search before asking the user."});if(n.filesChanged>=3&&!n.oracleInvoked&&Ye.includes(e))o.push({rule:"oracle-verification",tool:e,severity:"media",detail:`Files changed (${n.filesChanged}) >= 3 but Oracle was not invoked. The POST-TASK ORACLE VERIFICATION protocol requires Oracle invocation on multi-file changes.`});return o}import{stat as aw}from"fs";import{stat as lw,readdir as cw}from"fs/promises";import{EventEmitter as uw}from"events";import*as N from"path";import{stat as Rk,lstat as Kf,readdir as zk,realpath as Ck}from"node:fs/promises";import{Readable as Mk}from"node:stream";import{resolve as Xf,relative as Ak,join as Nk,sep as jk}from"node:path";var Ie={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},nu={root:".",fileFilter:(e)=>!0,directoryFilter:(e)=>!0,type:Ie.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(nu);var tg="READDIRP_RECURSIVE_ERROR",Uk=new Set(["ENOENT","EPERM","EACCES","ELOOP",tg]),Yf=[Ie.DIR_TYPE,Ie.EVERYTHING_TYPE,Ie.FILE_DIR_TYPE,Ie.FILE_TYPE],Lk=new Set([Ie.DIR_TYPE,Ie.EVERYTHING_TYPE,Ie.FILE_DIR_TYPE]),Fk=new Set([Ie.EVERYTHING_TYPE,Ie.FILE_DIR_TYPE,Ie.FILE_TYPE]),Zk=(e)=>Uk.has(e.code),Gk=process.platform==="win32",Qf=(e)=>!0,eg=(e)=>{if(e===void 0)return Qf;if(typeof e==="function")return e;if(typeof e==="string"){let t=e.trim();return(n)=>n.basename===t}if(Array.isArray(e)){let t=e.map((n)=>n.trim());return(n)=>t.some((o)=>n.basename===o)}return Qf};class rg extends Mk{constructor(e={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:e.highWaterMark});let t={...nu,...e},{root:n,type:o}=t;this._fileFilter=eg(t.fileFilter),this._directoryFilter=eg(t.directoryFilter);let r=t.lstat?Kf:Rk;if(Gk)this._stat=(i)=>r(i,{bigint:!0});else this._stat=r;this._maxDepth=t.depth??nu.depth,this._wantsDir=o?Lk.has(o):!1,this._wantsFile=o?Fk.has(o):!1,this._wantsEverything=o===Ie.EVERYTHING_TYPE,this._root=Xf(n),this._isDirent=!t.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(n,1)],this.reading=!1,this.parent=void 0}async _read(e){if(this.reading)return;this.reading=!0;try{while(!this.destroyed&&e>0){let t=this.parent,n=t&&t.files;if(n&&n.length>0){let{path:o,depth:r}=t,i=n.splice(0,e).map((a)=>this._formatEntry(a,o)),s=await Promise.all(i);for(let a of s){if(!a)continue;if(this.destroyed)return;let l=await this._getEntryType(a);if(l==="directory"&&this._directoryFilter(a)){if(r<=this._maxDepth)this.parents.push(this._exploreDir(a.fullPath,r+1));if(this._wantsDir)this.push(a),e--}else if((l==="file"||this._includeAsFile(a))&&this._fileFilter(a)){if(this._wantsFile)this.push(a),e--}}}else{let o=this.parents.pop();if(!o){this.push(null);break}if(this.parent=await o,this.destroyed)return}}}catch(t){this.destroy(t)}finally{this.reading=!1}}async _exploreDir(e,t){let n;try{n=await zk(e,this._rdOptions)}catch(o){this._onError(o)}return{files:n,depth:t,path:e}}async _formatEntry(e,t){let n,o=this._isDirent?e.name:e;try{let r=Xf(Nk(t,o));n={path:Ak(this._root,r),fullPath:r,basename:o},n[this._statsProp]=this._isDirent?e:await this._stat(r)}catch(r){this._onError(r);return}return n}_onError(e){if(Zk(e)&&!this.destroyed)this.emit("warn",e);else this.destroy(e)}async _getEntryType(e){if(!e&&this._statsProp in e)return"";let t=e[this._statsProp];if(t.isFile())return"file";if(t.isDirectory())return"directory";if(t&&t.isSymbolicLink()){let n=e.fullPath;try{let o=await Ck(n),r=await Kf(o);if(r.isFile())return"file";if(r.isDirectory()){let i=o.length;if(n.startsWith(o)&&n.substr(i,1)===jk){let s=Error(`Circular symlink detected: "${n}" points to "${o}"`);return s.code=tg,this._onError(s)}return"directory"}}catch(o){return this._onError(o),""}}}_includeAsFile(e){let t=e&&e[this._statsProp];return t&&this._wantsEverything&&!t.isDirectory()}}function ng(e,t={}){let n=t.entryType||t.type;if(n==="both")n=Ie.FILE_DIR_TYPE;if(n)t.type=n;if(!e)throw Error("readdirp: root argument is required. Usage: readdirp(root, options)");else if(typeof e!=="string")throw TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");else if(n&&!Yf.includes(n))throw Error(`readdirp: Invalid type passed. Use one of ${Yf.join(", ")}`);return t.root=e,new rg(t)}import{watchFile as Wk,unwatchFile as og,watch as Hk}from"fs";import{open as Vk,stat as sg,lstat as Bk,realpath as ou}from"fs/promises";import*as Q from"path";import{type as qk}from"os";var Jk="data",au="end",ag="close",Po=()=>{};var Oo=process.platform,lu=Oo==="win32",Kk=Oo==="darwin",Xk=Oo==="linux",Yk=Oo==="freebsd",lg=qk()==="OS400",ee={ALL:"all",READY:"ready",ADD:"add",CHANGE:"change",ADD_DIR:"addDir",UNLINK:"unlink",UNLINK_DIR:"unlinkDir",RAW:"raw",ERROR:"error"},ze=ee,Qk="watch",ew={lstat:Bk,stat:sg},xt="listeners",Io="errHandlers",Zt="rawEmitters",tw=[xt,Io,Zt],rw=new Set(["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),nw=(e)=>rw.has(Q.extname(e).slice(1).toLowerCase()),su=(e,t)=>{if(e instanceof Set)e.forEach(t);else t(e)},Fr=(e,t,n)=>{let o=e[t];if(!(o instanceof Set))e[t]=o=new Set([o]);o.add(n)},ow=(e)=>(t)=>{let n=e[t];if(n instanceof Set)n.clear();else delete e[t]},Zr=(e,t,n)=>{let o=e[t];if(o instanceof Set)o.delete(n);else if(o===n)delete e[t]},cg=(e)=>e instanceof Set?e.size===0:!e,To=new Map;function ig(e,t,n,o,r){let i=(s,a)=>{if(n(e),r(s,a,{watchedPath:e}),a&&e!==a)Do(Q.resolve(e,a),xt,Q.join(e,a))};try{return Hk(e,{persistent:t.persistent},i)}catch(s){o(s);return}}var Do=(e,t,n,o,r)=>{let i=To.get(e);if(!i)return;su(i[t],(s)=>{s(n,o,r)})},iw=(e,t,n,o)=>{let{listener:r,errHandler:i,rawEmitter:s}=o,a=To.get(t),l;if(!n.persistent){if(l=ig(e,n,r,i,s),!l)return;return l.close.bind(l)}if(a)Fr(a,xt,r),Fr(a,Io,i),Fr(a,Zt,s);else{if(l=ig(e,n,Do.bind(null,t,xt),i,Do.bind(null,t,Zt)),!l)return;l.on(ze.ERROR,async(c)=>{let u=Do.bind(null,t,Io);if(a)a.watcherUnusable=!0;if(lu&&c.code==="EPERM")try{await(await Vk(e,"r")).close(),u(c)}catch(f){}else u(c)}),a={listeners:r,errHandlers:i,rawEmitters:s,watcher:l},To.set(t,a)}return()=>{if(Zr(a,xt,r),Zr(a,Io,i),Zr(a,Zt,s),cg(a.listeners))a.watcher.close(),To.delete(t),tw.forEach(ow(a)),a.watcher=void 0,Object.freeze(a)}},iu=new Map,sw=(e,t,n,o)=>{let{listener:r,rawEmitter:i}=o,s=iu.get(t),a=s&&s.options;if(a&&(a.persistent<n.persistent||a.interval>n.interval))og(t),s=void 0;if(s)Fr(s,xt,r),Fr(s,Zt,i);else s={listeners:r,rawEmitters:i,options:n,watcher:Wk(t,n,(l,c)=>{su(s.rawEmitters,(f)=>{f(ze.CHANGE,t,{curr:l,prev:c})});let u=l.mtimeMs;if(l.size!==c.size||u>c.mtimeMs||u===0)su(s.listeners,(f)=>f(e,l))})},iu.set(t,s);return()=>{if(Zr(s,xt,r),Zr(s,Zt,i),cg(s.listeners))iu.delete(t),og(t),s.options=s.watcher=void 0,Object.freeze(s)}};class cu{constructor(e){this.fsw=e,this._boundHandleError=(t)=>e._handleError(t)}_watchWithNodeFs(e,t){let n=this.fsw.options,o=Q.dirname(e),r=Q.basename(e);this.fsw._getWatchedDir(o).add(r);let s=Q.resolve(e),a={persistent:n.persistent};if(!t)t=Po;let l;if(n.usePolling){let c=n.interval!==n.binaryInterval;a.interval=c&&nw(r)?n.binaryInterval:n.interval,l=sw(e,s,a,{listener:t,rawEmitter:this.fsw._emitRaw})}else l=iw(e,s,a,{listener:t,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return l}_handleFile(e,t,n){if(this.fsw.closed)return;let o=Q.dirname(e),r=Q.basename(e),i=this.fsw._getWatchedDir(o),s=t;if(i.has(r))return;let a=async(c,u)=>{if(!this.fsw._throttle(Qk,e,5))return;if(!u||u.mtimeMs===0)try{let f=await sg(e);if(this.fsw.closed)return;let{atimeMs:g,mtimeMs:d}=f;if(!g||g<=d||d!==s.mtimeMs)this.fsw._emit(ze.CHANGE,e,f);if((Kk||Xk||Yk)&&s.ino!==f.ino){this.fsw._closeFile(c),s=f;let b=this._watchWithNodeFs(e,a);if(b)this.fsw._addPathCloser(c,b)}else s=f}catch(f){this.fsw._remove(o,r)}else if(i.has(r)){let{atimeMs:f,mtimeMs:g}=u;if(!f||f<=g||g!==s.mtimeMs)this.fsw._emit(ze.CHANGE,e,u);s=u}},l=this._watchWithNodeFs(e,a);if(!(n&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(e)){if(!this.fsw._throttle(ze.ADD,e,0))return;this.fsw._emit(ze.ADD,e,t)}return l}async _handleSymlink(e,t,n,o){if(this.fsw.closed)return;let r=e.fullPath,i=this.fsw._getWatchedDir(t);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let s;try{s=await ou(n)}catch(a){return this.fsw._emitReady(),!0}if(this.fsw.closed)return;if(i.has(o)){if(this.fsw._symlinkPaths.get(r)!==s)this.fsw._symlinkPaths.set(r,s),this.fsw._emit(ze.CHANGE,n,e.stats)}else i.add(o),this.fsw._symlinkPaths.set(r,s),this.fsw._emit(ze.ADD,n,e.stats);return this.fsw._emitReady(),!0}if(this.fsw._symlinkPaths.has(r))return!0;this.fsw._symlinkPaths.set(r,!0)}_handleRead(e,t,n,o,r,i,s){if(e=Q.join(e,""),s=this.fsw._throttle("readdir",e,1000),!s)return;let a=this.fsw._getWatchedDir(n.path),l=new Set,c=this.fsw._readdirp(e,{fileFilter:(u)=>n.filterPath(u),directoryFilter:(u)=>n.filterDir(u)});if(!c)return;return c.on(Jk,async(u)=>{if(this.fsw.closed){c=void 0;return}let f=u.path,g=Q.join(e,f);if(l.add(f),u.stats.isSymbolicLink()&&await this._handleSymlink(u,e,g,f))return;if(this.fsw.closed){c=void 0;return}if(f===o||!o&&!a.has(f))this.fsw._incrReadyCount(),g=Q.join(r,Q.relative(r,g)),this._addToNodeFs(g,t,n,i+1)}).on(ze.ERROR,this._boundHandleError),new Promise((u,f)=>{if(!c)return f();c.once(au,()=>{if(this.fsw.closed){c=void 0;return}let g=s?s.clear():!1;if(u(void 0),a.getChildren().filter((d)=>d!==e&&!l.has(d)).forEach((d)=>{this.fsw._remove(e,d)}),c=void 0,g)this._handleRead(e,!1,n,o,r,i,s)})})}async _handleDir(e,t,n,o,r,i,s){let a=this.fsw._getWatchedDir(Q.dirname(e)),l=a.has(Q.basename(e));if(!(n&&this.fsw.options.ignoreInitial)&&!r&&!l)this.fsw._emit(ze.ADD_DIR,e,t);a.add(Q.basename(e)),this.fsw._getWatchedDir(e);let c,u,f=this.fsw.options.depth;if((f==null||o<=f)&&!this.fsw._symlinkPaths.has(s)){if(!r){if(await this._handleRead(e,n,i,r,e,o,c),this.fsw.closed)return}u=this._watchWithNodeFs(e,(g,d)=>{if(d&&d.mtimeMs===0)return;this._handleRead(g,!1,i,r,e,o,c)})}return u}async _addToNodeFs(e,t,n,o,r){let i=this.fsw._emitReady;if(this.fsw._isIgnored(e)||this.fsw.closed)return i(),!1;let s=this.fsw._getWatchHelpers(e);if(n)s.filterPath=(a)=>n.filterPath(a),s.filterDir=(a)=>n.filterDir(a);try{let a=await ew[s.statMethod](s.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(s.watchPath,a))return i(),!1;let l=this.fsw.options.followSymlinks,c;if(a.isDirectory()){let u=Q.resolve(e),f=l?await ou(e):e;if(this.fsw.closed)return;if(c=await this._handleDir(s.watchPath,a,t,o,r,s,f),this.fsw.closed)return;if(u!==f&&f!==void 0)this.fsw._symlinkPaths.set(u,f)}else if(a.isSymbolicLink()){let u=l?await ou(e):e;if(this.fsw.closed)return;let f=Q.dirname(s.watchPath);if(this.fsw._getWatchedDir(f).add(s.watchPath),this.fsw._emit(ze.ADD,s.watchPath,a),c=await this._handleDir(f,a,t,o,e,s,u),this.fsw.closed)return;if(u!==void 0)this.fsw._symlinkPaths.set(Q.resolve(e),u)}else c=this._handleFile(s.watchPath,a,t);if(i(),c)this.fsw._addPathCloser(e,c);return!1}catch(a){if(this.fsw._handleError(a))return i(),e}}}/*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) */var uu="/",dw="//",gg=".",mw="..",pw="string",fw=/\\/g,ug=/\/\//,gw=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,hw=/^\.[/\\]/;function Eo(e){return Array.isArray(e)?e:[e]}var du=(e)=>typeof e==="object"&&e!==null&&!(e instanceof RegExp);function vw(e){if(typeof e==="function")return e;if(typeof e==="string")return(t)=>e===t;if(e instanceof RegExp)return(t)=>e.test(t);if(typeof e==="object"&&e!==null)return(t)=>{if(e.path===t)return!0;if(e.recursive){let n=N.relative(e.path,t);if(!n)return!1;return!n.startsWith("..")&&!N.isAbsolute(n)}return!1};return()=>!1}function yw(e){if(typeof e!=="string")throw Error("string expected");e=N.normalize(e),e=e.replace(/\\/g,"/");let t=!1;if(e.startsWith("//"))t=!0;let n=/\/\//;while(e.match(n))e=e.replace(n,"/");if(t)e="/"+e;return e}function dg(e,t,n){let o=yw(t);for(let r=0;r<e.length;r++){let i=e[r];if(i(o,n))return!0}return!1}function bw(e,t){if(e==null)throw TypeError("anymatch: specify first argument");let o=Eo(e).map((r)=>vw(r));if(t==null)return(r,i)=>dg(o,r,i);return dg(o,t)}var mg=(e)=>{let t=Eo(e).flat();if(!t.every((n)=>typeof n===pw))throw TypeError(`Non-string provided as watch path: ${t}`);return t.map(hg)},pg=(e)=>{let t=e.replace(fw,uu),n=!1;if(t.startsWith(dw))n=!0;while(t.match(ug))t=t.replace(ug,uu);if(n)t=uu+t;return t},hg=(e)=>pg(N.normalize(pg(e))),fg=(e="")=>(t)=>{if(typeof t==="string")return hg(N.isAbsolute(t)?t:N.join(e,t));else return t},_w=(e,t)=>{if(N.isAbsolute(e))return e;return N.join(t,e)},kw=Object.freeze(new Set);class vg{constructor(e,t){this.path=e,this._removeWatcher=t,this.items=new Set}add(e){let{items:t}=this;if(!t)return;if(e!==gg&&e!==mw)t.add(e)}async remove(e){let{items:t}=this;if(!t)return;if(t.delete(e),t.size>0)return;let n=this.path;try{await cw(n)}catch(o){if(this._removeWatcher)this._removeWatcher(N.dirname(n),N.basename(n))}}has(e){let{items:t}=this;if(!t)return;return t.has(e)}getChildren(){let{items:e}=this;if(!e)return[];return[...e.values()]}dispose(){this.items.clear(),this.path="",this._removeWatcher=Po,this.items=kw,Object.freeze(this)}}var ww="stat",xw="lstat";class yg{constructor(e,t,n){this.fsw=n;let o=e;this.path=e=e.replace(hw,""),this.watchPath=o,this.fullWatchPath=N.resolve(o),this.dirParts=[],this.dirParts.forEach((r)=>{if(r.length>1)r.pop()}),this.followSymlinks=t,this.statMethod=t?ww:xw}entryPath(e){return N.join(this.watchPath,N.relative(this.watchPath,e.fullPath))}filterPath(e){let{stats:t}=e;if(t&&t.isSymbolicLink())return this.filterDir(e);let n=this.entryPath(e);return this.fsw._isntIgnored(n,t)&&this.fsw._hasReadPermissions(t)}filterDir(e){return this.fsw._isntIgnored(this.entryPath(e),e.stats)}}class bg extends uw{constructor(e={}){super();this.closed=!1,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=!1;let t=e.awaitWriteFinish,n={stabilityThreshold:2000,pollInterval:100},o={persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0,...e,ignored:e.ignored?Eo(e.ignored):Eo([]),awaitWriteFinish:t===!0?n:typeof t==="object"?{...n,...t}:!1};if(lg)o.usePolling=!0;if(o.atomic===void 0)o.atomic=!o.usePolling;let r=process.env.CHOKIDAR_USEPOLLING;if(r!==void 0){let a=r.toLowerCase();if(a==="false"||a==="0")o.usePolling=!1;else if(a==="true"||a==="1")o.usePolling=!0;else o.usePolling=!!a}let i=process.env.CHOKIDAR_INTERVAL;if(i)o.interval=Number.parseInt(i,10);let s=0;this._emitReady=()=>{if(s++,s>=this._readyCount)this._emitReady=Po,this._readyEmitted=!0,process.nextTick(()=>this.emit(ee.READY))},this._emitRaw=(...a)=>this.emit(ee.RAW,...a),this._boundRemove=this._remove.bind(this),this.options=o,this._nodeFsHandler=new cu(this),Object.freeze(o)}_addIgnoredPath(e){if(du(e)){for(let t of this._ignoredPaths)if(du(t)&&t.path===e.path&&t.recursive===e.recursive)return}this._ignoredPaths.add(e)}_removeIgnoredPath(e){if(this._ignoredPaths.delete(e),typeof e==="string"){for(let t of this._ignoredPaths)if(du(t)&&t.path===e)this._ignoredPaths.delete(t)}}add(e,t,n){let{cwd:o}=this.options;this.closed=!1,this._closePromise=void 0;let r=mg(e);if(o)r=r.map((i)=>_w(i,o));if(r.forEach((i)=>{this._removeIgnoredPath(i)}),this._userIgnored=void 0,!this._readyCount)this._readyCount=0;return this._readyCount+=r.length,Promise.all(r.map(async(i)=>{let s=await this._nodeFsHandler._addToNodeFs(i,!n,void 0,0,t);if(s)this._emitReady();return s})).then((i)=>{if(this.closed)return;i.forEach((s)=>{if(s)this.add(N.dirname(s),N.basename(t||s))})}),this}unwatch(e){if(this.closed)return this;let t=mg(e),{cwd:n}=this.options;return t.forEach((o)=>{if(!N.isAbsolute(o)&&!this._closers.has(o)){if(n)o=N.join(n,o);o=N.resolve(o)}if(this._closePath(o),this._addIgnoredPath(o),this._watched.has(o))this._addIgnoredPath({path:o,recursive:!0});this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();let e=[];return this._closers.forEach((t)=>t.forEach((n)=>{let o=n();if(o instanceof Promise)e.push(o)})),this._streams.forEach((t)=>t.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach((t)=>t.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=e.length?Promise.all(e).then(()=>{return}):Promise.resolve(),this._closePromise}getWatched(){let e={};return this._watched.forEach((t,n)=>{let r=(this.options.cwd?N.relative(this.options.cwd,n):n)||gg;e[r]=t.getChildren().sort()}),e}emitWithAll(e,t){if(this.emit(e,...t),e!==ee.ERROR)this.emit(ee.ALL,e,...t)}async _emit(e,t,n){if(this.closed)return;let o=this.options;if(lu)t=N.normalize(t);if(o.cwd)t=N.relative(o.cwd,t);let r=[t];if(n!=null)r.push(n);let i=o.awaitWriteFinish,s;if(i&&(s=this._pendingWrites.get(t)))return s.lastChange=new Date,this;if(o.atomic){if(e===ee.UNLINK)return this._pendingUnlinks.set(t,[e,...r]),setTimeout(()=>{this._pendingUnlinks.forEach((a,l)=>{this.emit(...a),this.emit(ee.ALL,...a),this._pendingUnlinks.delete(l)})},typeof o.atomic==="number"?o.atomic:100),this;if(e===ee.ADD&&this._pendingUnlinks.has(t))e=ee.CHANGE,this._pendingUnlinks.delete(t)}if(i&&(e===ee.ADD||e===ee.CHANGE)&&this._readyEmitted){let a=(l,c)=>{if(l)e=ee.ERROR,r[0]=l,this.emitWithAll(e,r);else if(c){if(r.length>1)r[1]=c;else r.push(c);this.emitWithAll(e,r)}};return this._awaitWriteFinish(t,i.stabilityThreshold,e,a),this}if(e===ee.CHANGE){if(!this._throttle(ee.CHANGE,t,50))return this}if(o.alwaysStat&&n===void 0&&(e===ee.ADD||e===ee.ADD_DIR||e===ee.CHANGE)){let a=o.cwd?N.join(o.cwd,t):t,l;try{l=await lw(a)}catch(c){}if(!l||this.closed)return;r.push(l)}return this.emitWithAll(e,r),this}_handleError(e){let t=e&&e.code;if(e&&t!=="ENOENT"&&t!=="ENOTDIR"&&(!this.options.ignorePermissionErrors||t!=="EPERM"&&t!=="EACCES"))this.emit(ee.ERROR,e);return e||this.closed}_throttle(e,t,n){if(!this._throttled.has(e))this._throttled.set(e,new Map);let o=this._throttled.get(e);if(!o)throw Error("invalid throttle");let r=o.get(t);if(r)return r.count++,!1;let i,s=()=>{let l=o.get(t),c=l?l.count:0;if(o.delete(t),clearTimeout(i),l)clearTimeout(l.timeoutObject);return c};i=setTimeout(s,n);let a={timeoutObject:i,clear:s,count:0};return o.set(t,a),a}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(e,t,n,o){let r=this.options.awaitWriteFinish;if(typeof r!=="object")return;let i=r.pollInterval,s,a=e;if(this.options.cwd&&!N.isAbsolute(e))a=N.join(this.options.cwd,e);let l=new Date,c=this._pendingWrites;function u(f){aw(a,(g,d)=>{if(g||!c.has(e)){if(g&&g.code!=="ENOENT")o(g);return}let b=Number(new Date);if(f&&d.size!==f.size)c.get(e).lastChange=b;let w=c.get(e);if(b-w.lastChange>=t)c.delete(e),o(void 0,d);else s=setTimeout(u,i,d)})}if(!c.has(e))c.set(e,{lastChange:l,cancelWait:()=>(c.delete(e),clearTimeout(s),n)}),s=setTimeout(u,i)}_isIgnored(e,t){if(this.options.atomic&&gw.test(e))return!0;if(!this._userIgnored){let{cwd:n}=this.options,r=(this.options.ignored||[]).map(fg(n)),s=[...[...this._ignoredPaths].map(fg(n)),...r];this._userIgnored=bw(s,void 0)}return this._userIgnored(e,t)}_isntIgnored(e,t){return!this._isIgnored(e,t)}_getWatchHelpers(e){return new yg(e,this.options.followSymlinks,this)}_getWatchedDir(e){let t=N.resolve(e);if(!this._watched.has(t))this._watched.set(t,new vg(t,this._boundRemove));return this._watched.get(t)}_hasReadPermissions(e){if(this.options.ignorePermissionErrors)return!0;return Boolean(Number(e.mode)&256)}_remove(e,t,n){let o=N.join(e,t),r=N.resolve(o);if(n=n!=null?n:this._watched.has(o)||this._watched.has(r),!this._throttle("remove",o,100))return;if(!n&&this._watched.size===1)this.add(e,t,!0);this._getWatchedDir(o).getChildren().forEach((f)=>this._remove(o,f));let a=this._getWatchedDir(e),l=a.has(t);if(a.remove(t),this._symlinkPaths.has(r))this._symlinkPaths.delete(r);let c=o;if(this.options.cwd)c=N.relative(this.options.cwd,o);if(this.options.awaitWriteFinish&&this._pendingWrites.has(c)){if(this._pendingWrites.get(c).cancelWait()===ee.ADD)return}this._watched.delete(o),this._watched.delete(r);let u=n?ee.UNLINK_DIR:ee.UNLINK;if(l&&!this._isIgnored(o))this._emit(u,o);this._closePath(o)}_closePath(e){this._closeFile(e);let t=N.dirname(e);this._getWatchedDir(t).remove(N.basename(e))}_closeFile(e){let t=this._closers.get(e);if(!t)return;t.forEach((n)=>n()),this._closers.delete(e)}_addPathCloser(e,t){if(!t)return;let n=this._closers.get(e);if(!n)n=[],this._closers.set(e,n);n.push(t)}_readdirp(e,t){if(this.closed)return;let n={type:ee.ALL,alwaysStat:!0,lstat:!0,...t,depth:0},o=ng(e,n);return this._streams.add(o),o.once(ag,()=>{o=void 0}),o.once(au,()=>{if(o)this._streams.delete(o),o=void 0}),o}}function _g(e,t={}){let n=new bg(t);return n.add(e),n}import{existsSync as $w}from"node:fs";var Sw=/^[A-Z]:[\\/](pagefile\.sys|DumpStack\.log\.tmp|hiberfil\.sys|swapfile\.sys)/i;async function kg(e){if(!e.projectDir||!$w(e.projectDir))return{stop:async()=>{}};let t=(i)=>i.endsWith("SKILL.md"),n=_g(e.projectDir,{ignoreInitial:!0,usePolling:!0,interval:100,binaryInterval:100,ignored:(i)=>Sw.test(i)}),o=!1,r=new Promise((i)=>{n.once("ready",()=>{if(!o)i()})});return n.on("add",(i)=>{if(!o&&t(i))e.onChange(i,"add")}),n.on("change",(i)=>{if(!o&&t(i))e.onChange(i,"change")}),await r,await new Promise((i)=>setTimeout(i,100)),{async stop(){o=!0,await n.close()}}}var Iw=[/^[A-Z]:[\\/](pagefile\.sys|DumpStack\.log\.tmp)/i,/^[A-Z]:[\\/](Users|home)[\\/][^\\/]+[\\/]AppData[\\/]Local[\\/]Temp[\\/]/i,/^\/(var|private\/var)\/folders\//,/^\/snap\//],Tw=new Set(["EINVAL","ENOENT","EACCES","EBADF","EPERM"]),Ro=null;function wg(e={}){let t=Object.keys(e).length===0;if(t&&Ro)return Ro;let n=e.paths??Iw,o=e.errorCodes??Tw,r=e.logger??console,i=(u)=>{let f=u&&typeof u==="object"&&"code"in u&&u.code?o.has(u.code):!1,g=!!(u?.path&&n.some((d)=>d.test(u.path)));if(f&&g){r.warn?.("watcher_scan_blocked",{path:u.path,code:u.code,message:u.message});return}};process.on("uncaughtException",i);let s=()=>process.off("uncaughtException",i),a=(u)=>{if(u&&typeof u==="object"&&"code"in u)i(u)};process.on("unhandledRejection",a);let l=()=>process.off("unhandledRejection",a),c=()=>{if(s(),l(),t)Ro=null};if(t)Ro=c;return c}Qr();wg();var $g={continue:0,warn:1,escalate:2,stop:3};function Sg(e,t){return $g[e]>=$g[t]}function Ig(e){if(e.tool!=="bash")return!1;let t=e.args?.command;if(typeof t!=="string")return!1;return/(?:>>?|[<>]\s*&?\s*[''"]?\s*\S+|\btee\s+[^|;&]+)/.test(t)}function Nw(e){let t=e.args;if(!t||typeof t!=="object")return null;let n=["pattern","query","path","glob","regex","include_pattern"];for(let o of n){let r=t[o];if(typeof r==="string"&&r.trim().length>0)return r.trim()}return null}var Oe=If({sessionID:"__global__",global:!0,version:me});var Tg=ve().health;try{et({oldPaths:Qe(),newPaths:ve()})}catch{}function Og(e={},t={}){let n=Z(),o=new Xc;Ap(o);let r=process.cwd(),i=nn(),s=jp({graphRetrieval:n,cwd:r}),a=Up({sqlite:i}),l=Lp({metrics:Oe,logFilePath:Ne,healthFilePath:Tg}),c=Fp({cwd:r}),u=Zp({cwd:r}),f=Gp({onDispatch:({sessionID:ce,mcpTool:Ce,mcpArgs:ke})=>{o.register({sessionID:ce,mcpTool:Ce,mcpArgs:ke})}}),g=Wp({onDispatch:({sessionID:ce,mcpTool:Ce,mcpArgs:ke})=>{o.register({sessionID:ce,mcpTool:Ce,mcpArgs:ke})}}),d=Hp({cwd:r}),b=Vp({cwd:r}),w=Bp({graphRetrieval:n,cwd:r}),M=qp({graphRetrieval:n,cwd:r}),j=Jp({graphRetrieval:n,cwd:r}),K=Kp({graphRetrieval:n,cwd:r}),W=Xp({graphRetrieval:n,cwd:r}),ae=Yp({graphRetrieval:n,cwd:r}),Te=Qp({graphRetrieval:n,cwd:r}),Gt=ef({graphRetrieval:n,cwd:r}),hu=tf({graphRetrieval:n,cwd:r}),vu=rf({graphRetrieval:n,cwd:r}),yu=nf({graphRetrieval:n,cwd:r}),bu=of({graphRetrieval:n,cwd:r}),_u=sf({graphRetrieval:n,cwd:r}),ku=af({graphRetrieval:n,cwd:r}),wu=lf({graphRetrieval:n,cwd:r}),xu=cf({graphRetrieval:n,cwd:r}),$u=uf({graphRetrieval:n,cwd:r}),Su=df({graphRetrieval:n,cwd:r}),Iu=mf({graphRetrieval:n,cwd:r}),Tu=pf({graphRetrieval:n,cwd:r}),Du=ff({graphRetrieval:n,cwd:r}),Pu=gf({graphRetrieval:n,cwd:r}),Ou=hf({graphRetrieval:n,cwd:r}),Eu=vf({cwd:r}),Ru=yf({cwd:r}),zu=bf({cwd:r}),Cu=_f({cwd:r}),Mu=kf({cwd:r});x("info",`v${me} MetaGovernor plugin loaded`,{version:me,build:me,cwd:r,projectHasCodegraph:n.hasCodegraphDir(r),projectHasGraphify:n.hasGraphifyDir(r)});let Au="?";try{let Ce=zw(import.meta.url),ke=fu(Ce);Au=Rw("sha256").update(ke).digest("hex").slice(0,8)}catch{}return console.log(`[meta-governor] v${me} loaded (bundle: ${Au})`),(async()=>{let ce=ve().selfVersionCache,Ce=86400000,ke=null;try{let we=fu(ce,"utf-8"),Ze=JSON.parse(we);if(typeof Ze.latest==="string"&&typeof Ze.checkedAtMs==="number"&&Date.now()-Ze.checkedAtMs<86400000)ke={latest:Ze.latest,checkedAtMs:Ze.checkedAtMs}}catch{}let Me=ke?.latest??null;if(!Me)try{let{execSync:we}=await import("node:child_process");if(Me=we("npm view @herjarsa/omo-meta-governor version",{timeout:5000,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()||null,Me)try{let Ze=ce.replace(/[\\/][^\\/]+$/,""),{mkdirSync:I,writeFileSync:Gr}=await import("node:fs");I(Ze,{recursive:!0}),Gr(ce,JSON.stringify({latest:Me,checkedAtMs:Date.now()}))}catch{}}catch{}if(Me&&Me!==me)x("warn",`STALE_CACHE: loaded v${me} but npm has v${Me}. Run: npm cache clean --force && rm -rf ~/.cache/opencode/packages/@herjarsa/omo-meta-governor*`)})(),async(ce,Ce)=>{x("info",`v${me} factory_invoked`,{version:me,hasInput:ce!=null,inputDir:ce?.directory??null,inputKeys:ce?Object.keys(ce):[]});let ke=ce.client,Me=ke!=null&&typeof ke==="object"&&"tool"in ke?ke:null;jr().setClient(Me),Ep(Me);let we;try{we=await $o({projectDir:ce.directory??r})}catch(p){throw x("error","factory_config_load_failed",{message:p instanceof Error?p.message:String(p),stack:p instanceof Error?p.stack?.slice(0,800):void 0}),p}let Ze={...e,...we.config,...Ce?.meta_governor??{}},I;try{I=Qc(Ze)}catch(p){throw x("error","factory_orchestrator_config_failed",{message:p instanceof Error?p.message:String(p)}),p}if(Ip({preferredTool:I.graphRetrieval.preferredTool}),we.sources.length>0)x("info",`v${me} config_loaded`,{version:me,sources:we.sources,effectiveSource:we.effectiveSource,enabled:I.enabled});if(I.postWave?.enabled===!0&&I.intervention.respectDoneSignal===!1)x("info","post_wave_warning",{message:"postWave.enabled=true but intervention.respectDoneSignal=false: post-wave directives still fire on Oracle-verified PHASE-N-COMPLETE, but the done-signal latch is off (intervention is not auto-disabled at plan end)."});let Gr=new Set,Nu=new Set,Eg=new Set,xe=ce.directory?Cw(ce.directory):r,Wt=Ce?.meta_governor?.graphSync??we.config?.graphSync??e.graphSync;if(Wt?.enabled!==!1){if(t.__test_onGraphSyncInit?.({projectDir:xe}),(t.__test_runGraphSync??Yr)({enabled:!0,watch:Wt?.watch??!1,autoInstall:Wt?.autoInstall??!0,installTimeoutMs:Wt?.installTimeoutMs??60000,killOrphanedOnInit:Wt?.killOrphanedOnInit??!0,projectDir:xe}).then((k)=>{if(k?.attempted&&k.availability.codegraph&&k.availability.graphify)Gr.add(xe)}).catch((k)=>{x("warn",`graphSync init failed: ${String(k)}`)}),I.cliAnything?.enabled!==!1){let k=Ce?.meta_governor?.cliAnything??we.config?.cliAnything;(t.__test_runCliAnythingSync??_d)({enabled:!0,autoInstall:k?.autoInstall??!0,autoUpgrade:k?.autoUpgrade??!0,cachePath:k?.cachePath??ve().cliAnythingUpgradeCheck,upgradeCheckTtlMs:k?.upgradeCheckTtlMs??86400000,projectDir:xe,installScope:k?.installScope??"global",cliHubBin:k?.cliHubBin??"cli-hub",skillsBin:k?.skillsBin??"npx skills"}).then((S)=>{if(S?.attempted&&S.availability.cliHub)Eg.add(xe)}).catch((S)=>{x("warn",`cli-anything sync failed: ${String(S)}`)})}queueMicrotask(()=>{try{let k=I.graphSync.fetchBranch,v=ld(xe,k);if(v>0)x("info",`reindexOnFetch: ${v} new commits on origin/${k}, reindexing`),qo(xe).catch((S)=>{x("warn",`reindexOnFetch failed: ${String(S)}`)})}catch{}})}let Ht=null;if(!I.enabled){if(we.sources.length>0)x("warn","config_loaded_but_disabled",{version:me,sources:we.sources,hint:"Set meta_governor.enabled=true (or top-level enabled:true) in your omo-meta-governor.jsonc to activate governance."});return{tool:{omo_search:s,omo_recall:a,omo_health:l,omo_find:c,omo_impact:u,omo_remember:f,omo_recall_mcp:g,omo_path:d,omo_explain:b,omo_files:w,omo_callers:M,omo_node:j,omo_context:K,omo_affected_cg:W,omo_status:ae,omo_unlock:Te,omo_mark_dirty:Gt,omo_sync_if_dirty:hu,omo_index:vu,omo_visualize:yu,omo_serve:bu,omo_uninit:_u,omo_diagnose:ku,omo_merge_graphs:wu,omo_save_result:xu,omo_extract:$u,omo_cluster_only:Su,omo_label:Iu,omo_tree:Tu,omo_clone:Du,omo_add:Pu,omo_check_update:Ou,omo_hook_status:Eu,omo_cli_anything_install:Ru,omo_cli_anything_list:zu,omo_cli_anything_search:Cu,omo_cli_anything_info:Mu},dispose:async()=>{try{Lo()}catch{}try{Vo()}catch{}try{qr()}catch{}try{It()}catch{}try{if(Ht)await Ht.stop()}catch{}}}}let Co=()=>I.modelOverride?.providerID??t.providerID?.(),Mo=()=>I.modelOverride?.modelID??t.modelID?.(),Rg=()=>I.modelOverride?.modelLimit??200000,rx=Co()??"unknown",nx=Mo()??"unknown",ju,Uu;if(I.protocolEnforcement.enabled||I.protocolEnforcement.injectIntoSystem){let p=I.protocolEnforcement.path??ru;try{ju=await Bf(p),Uu=qf(ju)}catch(k){if(I.modelOverride?.verbosity!=="silent")x("warn",`could not load protocol: ${k instanceof Error?k.message:String(k)}`)}}let pe=new tu({maxEntries:100,ttlMs:3600000}),Wr=new Lr(1000,300000),$t=new Lr(1000,300000),Lu=new Set,Fu=new Set,zg=new Map,Zu=new Set,Cg=new Set,Mg=new Set,ox=new Set,Gu=new Set,Ag=()=>({currentWaveN:null,lastInjectedWaveN:null,lastInjectedAtMs:null,postWaveInjectionsThisWave:0,rulesReadForWave:{},oracleAfterPhaseAtMs:{},repoModeResolved:null}),Wu=new Lr(1000,86400000),Ao=(p)=>{if(typeof t.__test_isMainSession==="function")try{return t.__test_isMainSession(p)}catch{return!0}return!0},St=(p,k)=>{if(!p||!k)return;if(!Ao(p)){x("info",`persist skipped (subagent) for ${p}`);return}if(!I.intervention.persistToSession)return;let v=pe.get(p);if(v?.backgroundTaskInFlight||v?.oracleInFlight){x("info",`persist skipped (background task in flight) for ${p}`);return}let S=()=>(t.__test_persistSessionMessage??_o)(p,k),D=(L)=>{if(!L.ok)x("warn",`persist intervention failed for ${p}`,{error:L.error});else x("info",`persisted intervention for ${p}`)};if(t.__test_persistSessionMessage){S().then((L)=>{if(!L.ok&&L.error&&/timed out/i.test(L.error)){let V=pe.get(p);if(V?.backgroundTaskInFlight||V?.oracleInFlight){x("info",`persist retry skipped (background task in flight) for ${p}`);return}setTimeout(()=>{S().then(D)},t.__test_persistRetryDelayMs??1500);return}D(L)});return}x("info",`persist intervention (superficial, not queued) for ${p}: ${k.slice(0,200)}`),Oe.inc("interventions_delivered")},Ng=kp((p)=>{try{ho(p,Tg)}catch(k){x("warn","health snapshot write failed",{error:String(k)})}},5000);try{let p=gu(xe,".agents","skills");Ht=await(t.__test_startSkillsFsWatcher??kg)({projectDir:p,onChange:async(v,S)=>{if(S!=="add")return;try{Oe.inc("tier3_skills_created"),x("info",`tier3_skills_created: ${v}`)}catch(D){x("warn",`tier3 watcher onChange failed: ${String(D)}`)}}})}catch(p){x("warn",`tier3 fs watcher failed to start: ${String(p)}`)}return{dispose:async()=>{try{Lo()}catch{}try{Vo()}catch{}try{qr()}catch{}try{It()}catch{}try{if(Ht)await Ht.stop()}catch{}},"tool.execute.before":async(p,k)=>{if(!I.enabled)return;if(!p.sessionID)return;if(I.skillPriming.enabled&&I.skillPriming.enforceMode==="block"&&p.tool!=="omo_skill_find"&&!Zu.has(p.sessionID)&&(Ye.includes(p.tool)||Ig(p))&&!Hf(p.tool,k?.args)){let D=Vf(p.tool,k?.args);throw Error(`[meta-governor] skill-priming required: run \`${D}\` to discover relevant skills before using "${p.tool}". Pass the candidates to a sub-agent via \`task(category='<category>', load_skills=[...])\` to load 2-3 capabilities. Set skillPriming.enforceMode='directive' in your config to bypass this gate, or write to a tmp/test/scratch path for trivial edits.`)}if(!I.protocolEnforcement.auditToolCalls)return;let v=pe.get(p.sessionID);if(!v)v={memoryToolsUsed:[],hasCodegraphDir:n.hasCodegraphDir(r),hasGraphifyDir:n.hasGraphifyDir(r),oracleInvoked:!1,filesChanged:0,emptyRecall:!1,escalationAttempted:!1,recentToolCalls:[],recentWriteContents:[],recentWriteFilePaths:[],memorySaved:!1,accumulatedDeviations:[],recentInterventionTexts:[],batchCompletions:0,taskDoneSignal:!1,phaseCompleteSignal:!1,planCompleteSignal:!1,interventionCount:0,interventionDisabled:!1,lessonCount:0,lastViolationInjectionAtMs:0,iteration:0,oracleInFlight:!1,oracleInFlightSinceMs:null,signalAtMs:0,backgroundTaskInFlight:!1,backgroundTaskInFlightSinceMs:null,backgroundTaskType:null,lastWarnAtMs:0,lastWarnHash:"",recentPwArgsHashes:[],overflowCompactionCount:0,overflowLoopGuardTripped:!1},pe.set(p.sessionID,v);if(v?.oracleInFlight)return;if(Uu)x("info","protocol loaded, system injection ready");let S=Jf(p.tool,k.args,{memoryToolsUsed:v.memoryToolsUsed,hasCodegraphDir:v.hasCodegraphDir,hasGraphifyDir:v.hasGraphifyDir,oracleInvoked:v.oracleInvoked,filesChanged:v.filesChanged,emptyRecall:v.emptyRecall,escalationAttempted:v.escalationAttempted,recentToolCalls:v.recentToolCalls,recentWriteContents:v.recentWriteContents,memorySaved:v.memorySaved,batchCompletions:v.batchCompletions});if(S.length>0){let L=v.lastViolationInjectionAtMs??0;if(L>0&&Date.now()-L<30000){x("info",`violation during cooldown (${Math.round((30000-(Date.now()-L))/1000)}s remaining), skipping queue`);let V=S.map((oe)=>({severity:oe.severity,category:oe.rule,detail:oe.detail,ts:Date.now()}));v.accumulatedDeviations=[...v.accumulatedDeviations,...V].slice(-5)}else{x("warn",`protocol violations on tool ${p.tool}`,S);let V=Wr.get(p.sessionID)?.items??[],oe=new Set;for(let F of S){let ue=`${F.severity}::${F.rule}::${F.detail}`;if(oe.has(ue))continue;oe.add(ue);let z=`[${F.severity.toUpperCase()}] ${F.rule}: ${F.detail}`;if(!V.includes(z))V.push(z)}Wr.set(p.sessionID,{items:V});let O=S.map((F)=>({severity:F.severity,category:F.rule,detail:F.detail,ts:Date.now()}));v.accumulatedDeviations=[...v.accumulatedDeviations,...O].slice(-5)}}else x("info",`audit OK on tool ${p.tool}`);if((p.tool==="grep"||p.tool==="glob")&&(n.hasCodegraphDir(r)||n.hasGraphifyDir(r))){let D=Nw(p);if(D)n.invoke(r,D,{timeoutMs:5000}).then((L)=>{if(L.result)n.cacheContext(p.sessionID,D,L.result)}).catch((L)=>{x("warn",`graphRetrieval.invoke failed for session ${p.sessionID}: ${String(L)}`)})}},"tool.execute.after":async(p,k)=>{if(!I.enabled)return;if(Oe.inc("tool_calls_observed"),p.sessionID&&(p.tool==="omo_skill_find"||p.tool==="omo_skill_add"||p.tool==="omo_skill_get"||p.tool==="omo_skill_local_link"||p.tool==="omo_skill_semantic_find"||p.tool==="omo_skill_create"))Zu.add(p.sessionID);if(p.sessionID){let z=p.sessionID;if(p.tool==="omo_search"||p.tool==="omo_find"||p.tool==="omo_impact"||p.tool==="omo_path"||p.tool==="omo_explain")Cg.add(z);if(p.tool==="omo_recall"||p.tool==="omo_recall_mcp")Mg.add(z)}Ng.write(vo({version:me,enabled:!0,sessionID:p.sessionID||"__unknown__",snapshot:Oe.getMetrics(),logFilePath:Ne}));try{o.markDelivered({sessionID:p.sessionID,mcpTool:p.tool,mcpArgs:p.args})}catch{}if(Ye.includes(p.tool))Gu.add(p.sessionID);let v=pe.get(p.sessionID);if(v){if(v.iteration++,v.recentToolCalls=[p.tool].concat(v.recentToolCalls).slice(0,20),Ye.includes(p.tool)||Ig(p)){v.filesChanged++;let G=(k.output??"").slice(0,500);v.recentWriteContents=[G].concat(v.recentWriteContents).slice(0,3);let A=p.args,re=A?.filePath??A?.path;if(p.tool==="bash"&&(typeof re!=="string"||re.length===0)){let Vt=(p.args?.command??"").match(/(?:>>?)\s*[''"]?([^''"&\s;]+)/);if(Vt)re=Vt[1]}if(typeof re==="string"&&re.length>0)v.recentWriteFilePaths=[re].concat(v.recentWriteFilePaths).slice(0,10)}if(["agentmemory_memory_recall","agentmemory_memory_smart_search","agentmemory_memory_save"].some((G)=>p.tool.startsWith(G))&&!v.memoryToolsUsed.includes(p.tool))v.memoryToolsUsed.push(p.tool);if(p.tool.startsWith("agentmemory_memory_save")){let G=k.output??"";if(G.includes("saved")||G.includes("written"))v.memorySaved=!0}if(p.tool==="task"){let G=k.output??"",A=p.args,re=A?.subagent_type;if(re==="oracle"||/"subagent_type"\s*:\s*"oracle"/.test(G)){if(v.oracleInvoked=!0,A?.run_in_background===!0)v.oracleInFlight=!0,v.oracleInFlightSinceMs=Date.now()}if(A?.run_in_background===!0&&typeof re==="string")v.backgroundTaskInFlight=!0,v.backgroundTaskInFlightSinceMs=Date.now(),v.backgroundTaskType=re,x("info",`background_task_in_flight: subagent_type=${re} for session ${p.sessionID}`)}let U=(k.output??"").toLowerCase();if(p.tool.includes("recall")&&(U.includes("returned empty")||U.includes("no results")))v.emptyRecall=!0;if(p.tool==="todowrite"&&(k.output??"").includes("completed")){if(((k.output??"").match(/"status":"completed"/g)??[]).length>=3)v.batchCompletions++}let B=[typeof k.output==="string"?k.output:"",typeof p.args==="string"?p.args:""].join(`
251
- `);if(!v.taskDoneSignal&&Hw(B))v.taskDoneSignal=!0,v.signalAtMs=Date.now(),x("info",`task_done_signal detected (legacy) for session ${p.sessionID}`);if(!v.phaseCompleteSignal&&Vw(B))v.phaseCompleteSignal=!0,v.signalAtMs=Date.now(),x("info",`phase_complete_signal detected for session ${p.sessionID}`);if(!v.planCompleteSignal&&Bw(B))v.planCompleteSignal=!0,v.signalAtMs=Date.now(),x("info",`plan_complete_signal detected for session ${p.sessionID}`);if(v.oracleInFlight){let A=v.oracleInFlightSinceMs!==null&&Date.now()-v.oracleInFlightSinceMs>300000;if(v.oracleInFlightSinceMs!==null&&v.signalAtMs>v.oracleInFlightSinceMs||A)v.oracleInFlight=!1,v.oracleInFlightSinceMs=null,x("info",`oracle_completed: re-enabling intervention for session ${p.sessionID}${A?" (timeout)":""}`);if(p.tool==="task"&&p.args?.subagent_type==="oracle"&&p.args?.run_in_background===!1)v.oracleInFlight=!1,v.oracleInFlightSinceMs=null,x("info",`oracle_completed (foreground call): re-enabling intervention for session ${p.sessionID}`)}if(v.backgroundTaskInFlight){if(v.backgroundTaskInFlightSinceMs!==null&&Date.now()-v.backgroundTaskInFlightSinceMs>300000)v.backgroundTaskInFlight=!1,v.backgroundTaskInFlightSinceMs=null,v.backgroundTaskType=null,x("info",`background_task_timed_out: re-enabling intervention for session ${p.sessionID}`)}}if(I.postWave?.enabled){let z=I.postWave,H=[typeof k.output==="string"?k.output:"",typeof p.args==="string"?p.args:""].join(`
252
- `),U=qw(H),B=p.tool==="task"&&/"subagent_type"\s*:\s*"oracle"/.test(H);if(U!==null||B){let G=pe.get(p.sessionID);if(G){let Ge=Dg(H);if(G.recentPwArgsHashes.includes(Ge)){if(U===null&&B)x("info",`post_wave_dedupe: skipping re-detection of identical Oracle-call text for session ${p.sessionID}`)}else G.recentPwArgsHashes=[Ge,...G.recentPwArgsHashes].slice(0,8)}let A=Wu.get(p.sessionID);if(!A)A=Ag(),Wu.set(p.sessionID,A);if(U!==null&&U!==A.currentWaveN)A.currentWaveN=U,A.postWaveInjectionsThisWave=0;if(B&&A.currentWaveN!==null){if(!(G!==void 0&&G.recentPwArgsHashes.slice(1).includes(Dg(H))))A.oracleAfterPhaseAtMs[A.currentWaveN]=Date.now()}let re=Date.now();if(Jw({postWave:A},z,re)){let Ge=A.repoModeResolved??Yw(z.repoMode??"auto",xe);A.repoModeResolved=Ge;let Vt=Ge==="third-party"?Xw(z.thirdPartyDirective,A.currentWaveN,z.aasToolPrefix):Kw(z.ownRepoDirective,A.currentWaveN);A.lastInjectedWaveN=A.currentWaveN,A.lastInjectedAtMs=re,A.postWaveInjectionsThisWave++,Rp(p.sessionID,Vt).then((Hr)=>{if(!Hr.ok)x("info",`post-wave directive delivery failed for ${p.sessionID}: ${Hr.error??"unknown"}`)})}}}if(v?.interventionDisabled)return;let D=(v?.recentToolCalls??[]).slice(0,5).filter((z)=>["write","edit","edit_block","desktop-commander_write_file","desktop-commander_edit_block","task"].includes(z)),L=v?!(v.oracleInFlight||v.backgroundTaskInFlight)&&D.length===0:!1,V=v?.accumulatedDeviations??[],oe=Lf(p.sessionID),O=Ed(oe),F={sessionID:p.sessionID,toolName:p.tool,toolOutput:k.output,consecutiveStops:O,iteration:v?.iteration??0,maxIterations:I.closedLoop.maxLessonsPerSession??10,oracleVerified:v?.oracleInvoked??!1,noProgress:L,filesChanged:v?.filesChanged??0,recentTurnTokens:[],deviations:V,filePaths:v?.recentWriteFilePaths??[],...(()=>{let{backends:z,writeBackend:H}=t;if(z&&H)return{backends:z,writeBackend:H};try{let U=nn();return{backends:z??{agentmemory:U,boulderState:U},writeBackend:H??U}}catch{return{backends:z??{agentmemory:{smartSearch:async()=>({lessons:[],crystals:[]})},boulderState:{boulderRead:async()=>[]}},writeBackend:H??{saveMemory:async()=>({id:""}),saveLesson:async()=>({id:""})}}}})(),config:I,...Co()?{providerID:Co()}:{},...Mo()?{modelID:Mo()}:{},modelLimit:Rg(),currentLessonCount:v?.lessonCount??0},ue;try{if(ue=await Ad(F),ue.lessonSaved?.lessonSaved&&v)v.lessonCount++;if(ue.decision.action!=="continue")Oe.inc("decisions_taken");if(ue.decision.action==="escalate"&&p.sessionID&&Ur()){let z=pe.get(p.sessionID)??v;if(z?.backgroundTaskInFlight||z?.oracleInFlight)x("info",`escalation prompt skipped (background task in flight) for ${p.sessionID}`);else{let H=ue.decision.historyEntry.decision,U=H.evidence.length,B=H.shouldEscalateTo;if(!B){x("info",`escalation suppressed by oracle.frequency for ${p.sessionID} (action=${H.action})`);return}let G=Cp({reasoning:H.reasoning,target:B,evidenceCount:U,sessionID:p.sessionID});setTimeout(()=>{wt(p.sessionID,{toolName:"meta_governor_escalate",mcpTool:"task",mcpArgs:{subagent_type:B},preamble:G}).catch((A)=>{x("warn",`escalation prompt failed: ${String(A)}`)})},250)}}if(I.intervention.mode!=="silent"&&v){let z=ue.decision;if(v.oracleInFlight||v.backgroundTaskInFlight){let U=v.oracleInFlight?"oracle_in_flight":"background_task_in_flight";x("info",`${U}: skipping intervention for session ${p.sessionID} (score ${ue.scoringResult.rawScore.toFixed(2)})`);return}let H=I.intervention.phaseAwareDoneSignal===!0;if(I.intervention.respectDoneSignal&&v.oracleInvoked&&(v.planCompleteSignal||!H&&(v.taskDoneSignal||v.phaseCompleteSignal))){v.interventionDisabled=!0;let U=v.planCompleteSignal?"PLAN-COMPLETE":v.taskDoneSignal?"DONE":"PHASE-N-COMPLETE";x("info",`task verified (${U} + Oracle): disabling intervention for session ${p.sessionID}`),Ft(p.sessionID);return}if(z.action!=="continue"&&Sg(z.action,I.intervention.minActionForMessage)){let U=Math.max(0,I.intervention.maxInterventionsPerSession??0);if(U>0&&v.interventionCount>=U){v.interventionDisabled=!0,x("warn",`intervention cap (${U}) reached for session ${p.sessionID}; disabling further intervention`),Ft(p.sessionID);return}let B=60000,G=Date.now(),A=z.historyEntry?.reasoning??z.message??"",re=`${z.action}::${A.slice(0,80)}`;if((z.action==="warn"||z.action==="escalate")&&v.lastWarnHash===re&&v.lastWarnAtMs>0&&G-v.lastWarnAtMs<B){x("info",`warn_cooldown: suppressing duplicate ${z.action} (${Math.round((B-(G-v.lastWarnAtMs))/1000)}s remaining) for session ${p.sessionID}`),Ft(p.sessionID);return}if(v.interventionCount++,z.action==="warn"||z.action==="escalate")v.lastWarnAtMs=G,v.lastWarnHash=re}}}catch{}if(ue&&ue.decision&&ue.decision.action!=="continue")eu(p.sessionID,ue.decision);try{if(p.tool==="bash"){let H=p.args?.command;if(Bo(H))x("info","git_commit_reindex_triggered",{sessionID:p.sessionID,command:H}),t.__test_onCommitTrigger?.({projectDir:xe,command:H??"",sessionID:p.sessionID}),qo(xe).catch((U)=>{x("warn",`codegraph sync failed: ${String(U)}`)})}}catch{}try{if(p.tool==="bash"){let H=p.args?.command;if(Uw(H)){let U=jw(k.output,p.sessionID);if(U.length>0){let B=$t.get(p.sessionID)?.items??[];$t.set(p.sessionID,{items:B.concat(U)}),x("info",`captured ${U.length} bot feedback line(s) for session ${p.sessionID}`)}}}}catch{}try{let z=p.args?.command;if(p.tool==="bash"&&Lw(z)){let H=I.ciMonitor;if(H?.enabled){let U=Fw(r),B=Zw(r);if(U&&B)x("info",`ci_monitor: git push detected on ${B}@${U.slice(0,7)} — starting background poll`),Gw(U,B,H,p.sessionID).catch((G)=>{x("warn",`ci_monitor: background poll failed: ${G instanceof Error?G.message:String(G)}`)})}}}catch{}},"experimental.chat.messages.transform":async(p,k)=>{if(!I.enabled)return;let S=k.messages[k.messages.length-1]?.info?.sessionID;if(!S)return;let D=pe.get(S);if(I.skillPriming.enabled&&!Fu.has(S)&&Wf({trigger:I.skillPriming.trigger,recentToolCalls:D?.recentToolCalls??[],implementationToolSeen:Gu.has(S)})){Fu.add(S);let te=Zf(I.skillPriming.router);if(zg.set(S,te),!Xe(k.messages))k.messages.push({info:{role:"assistant",agent:"meta-governor",synthetic:!0},parts:[{type:"text",text:te,synthetic:!0}]});x("info",`skill_priming_injected for session ${S}`),St(S,Gf(I.skillPriming.router))}if(Gr.has(xe)&&!Nu.has(S)){let te=["[META-GOVERNOR] codegraph y graphify ya están inicializados en este repo. ","ROUTING EXPLÍCITO (v0.25.0): ","• Símbolos/definiciones/callers/impacto (código) → CODEGRAPH: omo_find, omo_impact, omo_search. ","• Conceptos/arquitectura/conexiones/explicaciones → GRAPHIFY: omo_path, omo_explain (y omo_search en modo alternate). ","• Vista general del repo → lee graphify-out/GRAPH_REPORT.md. ","Actualizan tras cada commit."].join(" ");if(!Xe(k.messages)){Nu.add(S);let de=ct(te,{kind:"graph-priming"});k.messages.push({info:{role:"assistant",agent:"meta-governor",synthetic:!0},parts:[{type:"text",text:de,synthetic:!0}]})}x("info",`graph_tools_ready_injected for session ${S}`),St(S,te)}let L=$t.get(S);if(L){let te=L.items;if(te.length>0){let de=`[MetaGovernor PR Reviewer Feedback]
253
-
254
- ${te.map((De,Ae)=>`${Ae+1}. ${De}`).join(`
246
+ stderr: ${n.stderr||"(empty)"}`,metadata:{tool:e,code:n.code,durationMs:s,sessionID:r.sessionID,...t}};let a=n.data!==null&&n.data!==void 0?typeof n.data==="string"?n.data:JSON.stringify(n.data,null,2):n.rawOutput??"";return{title:e,output:a,metadata:{tool:e,code:n.code,durationMs:s,sessionID:r.sessionID,...t}}}function yf(e){return R({description:"Install a CLI from the CLI-Anything hub so the agent can drive that software. USAGE: omo_cli_anything_install with name='gimp' installs `cli-anything-gimp`, which exposes a `cli-anything-gimp` command. Browse the catalog with omo_cli_anything_list. See https://github.com/HKUDS/CLI-Anything for the full registry.",args:{name:q.string().min(1).describe("The CLI name to install (e.g. 'gimp', 'blender', 'drawio')")},async execute(t,n){let i=Date.now();await Promise.resolve().then(() => Tt());let o=hd(t.name,e.runner,120000,"cli-hub");return ki("omo_cli_anything_install",{name:t.name},{...o,durationMs:Date.now()-i},i,n,`Could not install '${t.name}'. Check that cli-anything-hub is installed (omo_health) and the name is correct.`)}})}function bf(e){return R({description:"List all CLIs available in the CLI-Anything hub (40+ GUI software harnesses). USAGE: omo_cli_anything_list with category='image' returns only image-related CLIs. Returns JSON with name, version, description, category, install_cmd, entry_point. See https://github.com/HKUDS/CLI-Anything.",args:{category:q.string().optional().describe("Optional category filter (e.g. 'image', 'devops', '3d', 'audio')"),source:q.enum(["harness","public","npm","all"]).optional().describe("Optional source filter. 'all' includes harness + public + npm.")},async execute(t,n){let i=Date.now();await Promise.resolve().then(() => Tt());let o=pd({category:t.category,source:t.source},e.runner,30000,"cli-hub");return ki("omo_cli_anything_list",{category:t.category,source:t.source},{...o,durationMs:Date.now()-i},i,n,"Could not list CLIs from the hub. Make sure cli-anything-hub is installed: `pip install cli-anything-hub`.")}})}function _f(e){return R({description:"Search the CLI-Anything hub for CLIs matching a query (name, description, or category). USAGE: omo_cli_anything_search with query='cad' returns CAD-related CLIs. Returns JSON array. See https://github.com/HKUDS/CLI-Anything.",args:{query:q.string().min(1).describe("Search query (matches name, description, or category)")},async execute(t,n){let i=Date.now();await Promise.resolve().then(() => Tt());let o=fd(t.query,e.runner,30000,"cli-hub");return ki("omo_cli_anything_search",{query:t.query},{...o,durationMs:Date.now()-i},i,n,"Search failed. Make sure cli-anything-hub is installed: `pip install cli-anything-hub`.")}})}function kf(e){return R({description:"Show details for a specific CLI in the CLI-Anything hub. USAGE: omo_cli_anything_info with name='blender' returns display name, version, description, requirements (e.g. 'blender (apt install blender)'), entry point, install command. See https://github.com/HKUDS/CLI-Anything.",args:{name:q.string().min(1).describe("The CLI name to look up")},async execute(t,n){let i=Date.now();await Promise.resolve().then(() => Tt());let o=gd(t.name,e.runner,1e4,"cli-hub");return ki("omo_cli_anything_info",{name:t.name},{...o,durationMs:Date.now()-i},i,n,`Could not find '${t.name}' in the hub. Try omo_cli_anything_search to find similar names.`)}})}_i();class Xc{entries=new Map;deliveredCount=0;expiredCount=0;register(e){this.cleanup();let t=`deliv-${Date.now()}-${Math.random().toString(36).slice(2,10)}`,n=wf(e.mcpArgs);return this.entries.set(t,{id:t,sessionID:e.sessionID,mcpTool:e.mcpTool,mcpArgsHash:n,registeredAt:Date.now(),ttlMs:e.ttlMs??1e4}),t}markDelivered(e){this.cleanup();let t=e.mcpArgs?wf(e.mcpArgs):null;for(let[n,i]of this.entries){if(i.sessionID!==e.sessionID)continue;if(i.mcpTool!==e.mcpTool)continue;if(t!==null&&i.mcpArgsHash!==t)continue;return this.entries.delete(n),this.deliveredCount++,n}return null}async awaitDelivery(e){let t=e.timeoutMs??2000,n=Date.now();while(Date.now()-n<t){if(this.cleanup(),![...this.entries.values()].find((r)=>r.sessionID===e.sessionID&&r.mcpTool===e.mcpTool))return"delivered";await sk(50)}return"expired"}getStats(){return{pending:this.entries.size,delivered:this.deliveredCount,expired:this.expiredCount}}clearSession(e){for(let[t,n]of this.entries)if(n.sessionID===e)this.entries.delete(t)}cleanup(){let e=Date.now();for(let[t,n]of this.entries)if(e-n.registeredAt>n.ttlMs)this.entries.delete(t),this.expiredCount++}}function wf(e){return JSON.stringify(e,Object.keys(e).sort())}function sk(e){return new Promise((t)=>setTimeout(t,e))}ft();Bt();import{resolve as Uw}from"node:path";import{readFileSync as ak}from"node:fs";import{dirname as lk,resolve as ck}from"node:path";import{fileURLToPath as uk}from"node:url";var xf="0.0.0";try{let e=lk(uk(import.meta.url)),t=ck(e,"..","package.json"),n=JSON.parse(ak(t,"utf8"));if(typeof n.version==="string"&&n.version.length>0)xf=n.version}catch{}var me=xf,$f=["decisions_taken","decisions_skipped_continue","decisions_skipped_no_decision","decisions_skipped_no_message","decisions_skipped_below_threshold","interventions_delivered","interventions_disabled_done","interventions_disabled_cap","decisions_stored","plan_reminders_injected","bot_feedback_injected","violations_injected","protocol_audits_passed","protocol_violations_detected","git_commit_reindex","orchestrator_runs","orchestrator_errors","materialization_failures","tier3_reminders_sent","tier3_skills_created","tool_calls_observed","governance_blocks","governance_asks","governance_tools_hidden","governance_tools_rewritten","governance_commands_blocked"];function Sf(){let e={};for(let t of $f)e[t]={count:0,lastOccurrenceISO:null};return e}var dk=Sf(),G0=new Date().toISOString();function If(e){let t=e??{},n=Sf(),i=new Date().toISOString(),r=t.version??me,o=t.global===!0;return{inc(s){let a=n[s];if(!a)return;if(a.count++,a.lastOccurrenceISO=new Date().toISOString(),o){let l=dk[s];if(l)l.count++,l.lastOccurrenceISO=a.lastOccurrenceISO}},getMetrics(){return{version:r,sessionID:t.sessionID??"",startedAtISO:i,uptimeMs:Date.now()-new Date(i).getTime(),counters:{...n}}},reset(){for(let s of $f)n[s]={count:0,lastOccurrenceISO:null}}}}function Tf(e,t){for(let n of t)try{if(new RegExp(n).test(e))return n}catch{}return null}function mk(e){let n=e.replace(/^\*\*\//,"").replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,".*").replace(/\*/g,"[^/]*");return new RegExp(n)}function Df(e,t){for(let n of t)try{if(mk(n).test(e))return n}catch{}return null}function pk(e,t){let n;try{n=new URL(e).host}catch{return null}for(let i of t)if(n===i||n.endsWith("."+i)||n.includes(i))return i;return null}function Pf(e,t){let n=Tf(e,t.bashDenyPatterns??[]);if(n!==null)return{decision:"deny",reason:'bash command matches deny pattern "'+n+'"'};let i=Tf(e,t.bashAskPatterns??[]);if(i!==null)return{decision:"ask",reason:'bash command matches ask pattern "'+i+'"'};return null}function Of(e,t){let n=Df(e,t.editDenyPaths??[]);if(n!==null)return{decision:"deny",reason:'edit path matches deny pattern "'+n+'"'};let i=Df(e,t.editAskPaths??[]);if(i!==null)return{decision:"ask",reason:'edit path matches ask pattern "'+i+'"'};return null}function Ef(e,t){let n=pk(e,t.webfetchDenyHosts??[]);if(n!==null)return{decision:"deny",reason:'webfetch host matches deny pattern "'+n+'"'};return null}async function Rf(e,t,n,i){if(!n||n.mode===void 0)return;if(!n.mode)return;let r;switch(e.type){case"bash":r=Pf(e.command,n);break;case"edit":r=Of(e.pattern,n);break;case"webfetch":r=Ef(e.url,n);break;default:return}if(r===null)return;if(t.status=r.decision,r.decision==="deny")i.inc("governance_blocks");else i.inc("governance_asks")}async function zf(e,t,n,i){if(!n.enabled)return;if(n.hideToolIDs?.includes(e.toolID)){t.description="",i.inc("governance_tools_hidden");return}if(n.descriptionSuffix)t.description=(t.description??"")+n.descriptionSuffix,i.inc("governance_tools_rewritten");let r=n.parameterOverrides?.[e.toolID];if(!r||!t.parameters?.properties)return;for(let[o,s]of Object.entries(r))if(t.parameters.properties[o])t.parameters.properties[o].description=s}async function Cf(e,t,n,i){if(!n.enabled)return;if(n.denyPatterns?.length)for(let r of n.denyPatterns)try{if(new RegExp(r).test(e.command))throw i.inc("governance_commands_blocked"),Error('[meta-governor] blocked command matching pattern "'+r+'"')}catch(o){if((o instanceof Error?o.message:String(o)).includes("blocked command matching"))throw o}if(n.replacementPrefix)t.parts.push({type:"text",text:n.replacementPrefix+" executing: "+e.command,synthetic:!0})}async function Af(e,t,n){if(!n.enabled)return;if(!n.modelID||!n.providerID)return;let i=e.provider.models??{},r=Object.values(i).find((o)=>typeof o==="object"&&o!==null&&o.id===n.modelID);if(r)t.model=r}import{homedir as $k}from"node:os";import{join as Sk}from"node:path";function Qc(e){let t={enabled:!1,...e},n=Ji(),i=Ki(),r=rn();return{enabled:t.enabled===!0,memory:{enabled:!0,query:t.memory?.query??"meta_governor_context",timeoutMs:t.memory?.timeoutMs??t.memory?.agentmemoryTimeoutMs??2000},tokenPredictor:{compactBurnRateThreshold:t.tokenPredictor?.compactBurnRateThreshold??500,compactUsageThreshold:t.tokenPredictor?.compactUsageThreshold??0.85,switchModelUsageThreshold:t.tokenPredictor?.switchModelUsageThreshold??0.95,delegateConsecutiveHighBurn:t.tokenPredictor?.delegateConsecutiveHighBurn??5},scoring:{...n,...t.scoring?.continueThreshold!==void 0?{continueThreshold:t.scoring.continueThreshold}:{},...t.scoring?.warnThreshold!==void 0?{warnThreshold:t.scoring.warnThreshold}:{},...t.scoring?.escalateThreshold!==void 0?{escalateThreshold:t.scoring.escalateThreshold}:{},...t.scoring?.stopThreshold!==void 0?{stopThreshold:t.scoring.stopThreshold}:{},...t.scoring?.paralysisThreshold!==void 0?{paralysisThreshold:t.scoring.paralysisThreshold}:{},...t.scoring?.defaultEscalationTarget!==void 0?{defaultEscalationTarget:t.scoring.defaultEscalationTarget}:{},oracleFrequency:t.oracle?.frequency??t.scoring?.oracleFrequency??"per-stop"},closedLoop:{...r,...t.closedLoop?.enabled!==void 0?{enabled:t.closedLoop.enabled}:{},...t.closedLoop?.minSeverityToLearn!==void 0?{minSeverityToLearn:t.closedLoop.minSeverityToLearn}:{},...t.closedLoop?.maxLessonsPerSession!==void 0?{maxLessonsPerSession:t.closedLoop.maxLessonsPerSession}:{},...t.closedLoop?.saveDecisions!==void 0?{saveDecisions:t.closedLoop.saveDecisions}:{},...t.closedLoop?.saveLessons!==void 0?{saveLessons:t.closedLoop.saveLessons}:{}},decision:{...i,...t.decision?.maxHistoryPerSession!==void 0?{maxHistoryPerSession:t.decision.maxHistoryPerSession}:{},...t.decision?.forceContinueAfterStops!==void 0?{forceContinueAfterStops:t.decision.forceContinueAfterStops}:{},...t.decision?.warnMessageTemplate!==void 0?{warnMessageTemplate:t.decision.warnMessageTemplate}:{},...t.decision?.escalateMessageTemplate!==void 0?{escalateMessageTemplate:t.decision.escalateMessageTemplate}:{},...t.decision?.stopMessageTemplate!==void 0?{stopMessageTemplate:t.decision.stopMessageTemplate}:{}},modelOverride:t.modelOverride?{providerID:t.modelOverride.providerID,modelID:t.modelOverride.modelID,modelLimit:t.modelOverride.modelLimit,temperature:t.modelOverride.temperature??0.2,topP:t.modelOverride.topP??1,maxTokens:t.modelOverride.maxTokens??2048,reasoning:t.modelOverride.reasoning??!1,verbosity:t.modelOverride.verbosity??"minimal"}:void 0,intervention:{mode:t.intervention?.mode??"silent",includeDecisionHistory:t.intervention?.includeDecisionHistory??!0,maxHistoryMessages:t.intervention?.maxHistoryMessages??5,minActionForMessage:t.intervention?.minActionForMessage??"stop",maxInterventionsPerSession:t.intervention?.maxInterventionsPerSession??3,respectDoneSignal:t.intervention?.respectDoneSignal??!0,phaseAwareDoneSignal:t.intervention?.phaseAwareDoneSignal??!1,persistToSession:t.intervention?.persistToSession??!0,compactionLoopGuard:{enabled:t.intervention?.compactionLoopGuard?.enabled??!0,maxOverflowRecoveries:Math.max(1,t.intervention?.compactionLoopGuard?.maxOverflowRecoveries??1)}},postWave:{enabled:t.postWave?.enabled??t.intervention?.phaseAwareDoneSignal===!0,repoMode:t.postWave?.repoMode??"auto",aasToolPrefix:t.postWave?.aasToolPrefix??"aas",ciTimeoutMs:t.postWave?.ciTimeoutMs??600000,maxRetriesPerWave:t.postWave?.maxRetriesPerWave??1,reinjectCooldownMs:t.postWave?.reinjectCooldownMs??60000,respectSilentMode:t.postWave?.respectSilentMode??!1,...t.postWave?.ownRepoDirective!==void 0?{ownRepoDirective:t.postWave.ownRepoDirective}:{},...t.postWave?.thirdPartyDirective!==void 0?{thirdPartyDirective:t.postWave.thirdPartyDirective}:{}},protocolEnforcement:{enabled:t.protocolEnforcement?.enabled??!1,path:t.protocolEnforcement?.path,injectIntoSystem:t.protocolEnforcement?.injectIntoSystem??!1,auditToolCalls:t.protocolEnforcement?.auditToolCalls??!1},skillPriming:{enabled:t.skillPriming?.enabled??!0,trigger:t.skillPriming?.trigger??"firstImplement",router:t.skillPriming?.router??"registry",enforceMode:t.skillPriming?.enforceMode??"directive"},skillHub:{enabled:t.skillHub?.enabled??!1,syncIntervalMs:t.skillHub?.syncIntervalMs??86400000,bootstrapUrl:t.skillHub?.bootstrapUrl??"https://skills-library.com/api/skills.json",searchFallbackUrl:t.skillHub?.searchFallbackUrl??"https://skills.sh/api/search",downloadBaseUrl:t.skillHub?.downloadBaseUrl??"https://skills.sh/api/download",embedBaseUrl:t.skillHub?.embedBaseUrl??"http://127.0.0.1:3114/v1",embedModel:t.skillHub?.embedModel??"bge-m3",minInstalls:t.skillHub?.minInstalls??0,filterDuplicates:t.skillHub?.filterDuplicates!==!1,depsCheck:t.skillHub?.depsCheck!==!1,choreDir:t.skillHub?.choreDir??Sk($k(),".agents","skills"),autoMaterialize:t.skillHub?.autoMaterialize??!0},graphSync:{killOrphanedOnInit:t.graphSync?.killOrphanedOnInit??!0,reindexOnFetch:t.graphSync?.reindexOnFetch!==!1,fetchBranch:t.graphSync?.fetchBranch??"main",autoUpgrade:t.graphSync?.autoUpgrade!==!1,upgradeCachePath:t.graphSync?.upgradeCachePath,checkGraphifyNeedsUpdate:t.graphSync?.checkGraphifyNeedsUpdate!==!1,addToGlobalGraph:t.graphSync?.addToGlobalGraph===!0},graphRetrieval:{preferredTool:t.graphRetrieval?.preferredTool??"auto",preferLocalCodegraph:t.graphRetrieval?.preferLocalCodegraph===!0,contextRouting:t.graphRetrieval?.contextRouting===!0},cliAnything:{enabled:t.cliAnything?.enabled!==!1,autoInstall:t.cliAnything?.autoInstall!==!1,autoUpgrade:t.cliAnything?.autoUpgrade!==!1,cachePath:t.cliAnything?.cachePath,upgradeCheckTtlMs:t.cliAnything?.upgradeCheckTtlMs,cliHubBin:t.cliAnything?.cliHubBin??"cli-hub",skillsBin:t.cliAnything?.skillsBin??"npx skills",installScope:t.cliAnything?.installScope??"global"},governance:{permissionPolicy:t.governance?.permissionPolicy?{mode:t.governance.permissionPolicy.mode,bashDenyPatterns:t.governance.permissionPolicy.bashDenyPatterns,bashAskPatterns:t.governance.permissionPolicy.bashAskPatterns,editDenyPaths:t.governance.permissionPolicy.editDenyPaths,editAskPaths:t.governance.permissionPolicy.editAskPaths,webfetchDenyHosts:t.governance.permissionPolicy.webfetchDenyHosts}:void 0,toolRewrite:{enabled:t.governance?.toolRewrite?.enabled??!0,descriptionSuffix:t.governance?.toolRewrite?.descriptionSuffix,hideToolIDs:t.governance?.toolRewrite?.hideToolIDs,parameterOverrides:t.governance?.toolRewrite?.parameterOverrides},commandFilter:{enabled:t.governance?.commandFilter?.enabled??!0,denyPatterns:t.governance?.commandFilter?.denyPatterns,replacementPrefix:t.governance?.commandFilter?.replacementPrefix},smallModelOverride:t.governance?.smallModelOverride?{enabled:t.governance.smallModelOverride.enabled,modelID:t.governance.smallModelOverride.modelID,providerID:t.governance.smallModelOverride.providerID}:void 0}}}function sT(e){if(!e)return!1;if(e.enabled===!0)return!0;return e.meta_governor?.enabled===!0}async function aT(e={}){await Promise.resolve().then(() => Yc());let n=await xi(e);return Qc(n.config)}Yc();var lt=new Map,$i=new Map;function eu(e,t){lt.set(e,t);let n=$i.get(e)??[];if(n.push(t.historyEntry),n.length>20)n.splice(0,n.length-20);$i.set(e,n)}function Ft(e){let t=lt.get(e);if(t!==void 0)lt.delete(e);return t}function Uf(e){return lt.get(e)}function cT(e){return lt.has(e)}function uT(){for(let[e,t]of lt)return lt.delete(e),t;return}function dT(){lt.clear(),$i.clear()}function Lf(e){return $i.get(e)??[]}class tu{store=new Map;maxEntries;ttlMs;now;constructor(e={}){this.maxEntries=e.maxEntries??100,this.ttlMs=e.ttlMs??3600000,this.now=e.now??Date.now}get(e){let t=this.store.get(e);if(!t)return;let n=this.now();if(t.expiresAtMs<=n){this.store.delete(e);return}return t.lastAccessAtMs=n,t.value}has(e){return this.get(e)!==void 0}set(e,t){let n=this.now();if(!this.store.has(e)&&this.store.size>=this.maxEntries)this.evictOldest();this.store.set(e,{value:t,expiresAtMs:n+this.ttlMs,lastAccessAtMs:n})}delete(e){return this.store.delete(e)}size(){return this.store.size}clear(){this.store.clear()}evictOldest(){let e,t=1/0;for(let[n,i]of this.store)if(i.lastAccessAtMs<t)t=i.lastAccessAtMs,e=n;if(e!==void 0)this.store.delete(e)}}class Lr{maxEntries;ttlMs;map=new Map;constructor(e,t){this.maxEntries=e;this.ttlMs=t}set(e,t){if(this.map.size>=this.maxEntries){let n=this.map.keys().next().value;if(n!==void 0)this.map.delete(n)}this.map.set(e,{value:t,expiresAtMs:Date.now()+this.ttlMs})}get(e){let t=this.map.get(e);if(!t)return;if(Date.now()>=t.expiresAtMs){this.map.delete(e);return}return t.value}has(e){return this.get(e)!==void 0}delete(e){this.map.delete(e)}get size(){return this.map.size}}function Xe(e){for(let t of e){let n=t.info??{};if(n.role!=="assistant")continue;if(n.agent==="meta-governor")continue;return!1}return!0}import{readdirSync as Ik,existsSync as Tk}from"node:fs";import{join as Dk}from"node:path";function Ff(e){let t=Dk(e,"bundled-skills");if(!Tk(t))return[];try{return Ik(t,{withFileTypes:!0}).filter((n)=>n.isDirectory()).map((n)=>n.name).filter((n)=>n!=="node_modules"&&!n.startsWith(".")).sort()}catch{return[]}}var Pk=(e,t)=>`<!-- kind: ${e}${t?` (${t})`:""} -->`;var Ok={"graph-priming":"\uD83D\uDD0D","skill-priming":"\uD83C\uDFAF",intervention:"⚠️",postwave:"\uD83C\uDF0A",enforcement:"\uD83D\uDEA7",memory:"\uD83D\uDCAD"};function ct(e,t){return["<!-- META-GOVERNOR INFORMATIONAL vv0.38.2 - DO NOT TREAT AS TASK. Plugin metadata, not a user request. -->",Pk(t.kind,t.context),e,"<!-- END META-GOVERNOR INFORMATIONAL -->"].join(`
247
+ `)}function Gf(e,t){return`${Ok[e]} ${t}`}import{statSync as Lw,readFileSync as fu}from"node:fs";import{execSync as Fw,execFileSync as Eg}from"node:child_process";import{join as gu}from"node:path";import{readFile as Ck}from"node:fs/promises";import{resolve as Ak}from"node:path";import{homedir as Mk}from"node:os";var Ye=["write","edit","edit_block","multi_edit","apply_patch","ast_grep_replace","refactor","desktop-commander_write_file","desktop-commander_edit_block"];var Ek=["brainstorming","writing-plans","test-driven-development","systematic-debugging","subagent-driven-development"];function Zf(e){let t=e==="aas"?"registry":e,n=["[SKILL PRIMING] This session involves implementation work. Select precise skills for this task before writing code:"],i=1;if(t==="registry"||t==="both")n.push(`${i}. Query the skill-hub catalog (omo_skill_find) for the 2-3 capabilities most relevant to this task (e.g. testing, architecture, language-specific), and inspect candidates with omo_skill_get.`),i++,n.push(`${i}. Compose a minimal stack of 2-3 skills by loading each via its installer (e.g. \`npx skills add <owner/repo/slug>\` via omo_skill_add).`),i++;if(t==="superpowers"||t==="both")n.push(`${i}. If a matching superpowers skill is available and not yet active (${Ek.join(" / ")}), delegate it to a sub-agent via \`task(category='<category>', load_skills=['<slug>'])\` — the skill's content is injected into the sub-agent's system prompt. (Requires the superpowers plugin to be installed separately.)`),i++;if(t==="both")n.push("If a superpowers skill is already active, skip the catalog step.");n.push("Do NOT enumerate the full catalog — keep the stack minimal and task-specific.");let r=n.join(`
248
+ `);return ct(r,{kind:"skill-priming",context:`router=${t}`})}function Wf(e){return Gf("skill-priming",`Skill priming (${e==="aas"?"registry":e}): nudging agent to discover relevant skills before implementation.`)}function Hf(e){if(e.trigger==="sessionStart")return!0;if(e.implementationToolSeen)return!0;return e.recentToolCalls.some((t)=>Ye.includes(t))}var Rk=[/[\\/](\.tmp|\.scratch|scratch|tmp|trash|throwaway)[\\/]/i,/[\\/]tests?[\\/]|^tests?[\\/]/,/[\\/]__tests__[\\/]/,/[\\/]fixtures?[\\/]/,/[\\/]examples?[\\/]/,/\.test\.[a-z]+$/,/\.spec\.[a-z]+$/],zk=50;function Vf(e,t){if(e==="edit"||e==="edit_block"||e==="multi_edit"||e==="apply_patch"||e==="ast_grep_replace"||e==="refactor"||e==="desktop-commander_edit_block")return!0;if(e!=="write"&&e!=="desktop-commander_write_file")return!1;let n=t,i=typeof n?.filePath==="string"?n.filePath:typeof n?.path==="string"?n.path:"";if(i&&Rk.some((o)=>o.test(i)))return!0;let r=n?.content;if(typeof r==="string"&&r.split(`
249
+ `).length<=zk)return!0;return!1}function Bf(e,t){let n=t,i=typeof n?.filePath==="string"?n.filePath:typeof n?.path==="string"?n.path:"",r=/\.([a-z]+)$/i.exec(i),o=r?r[1].toLowerCase():"";return`omo_skill_find "${{ts:"typescript",tsx:"typescript-react",js:"javascript",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",cs:"csharp",cpp:"cpp",c:"c",sh:"bash",bash:"bash",md:"markdown",json:"json",yaml:"yaml",yml:"yaml",toml:"config",sql:"sql",html:"html",css:"css",scss:"css",vue:"vue",svelte:"svelte"}[o]??"code"} ${e}" --limit 5`}var ru=Ak(Mk(),".config","opencode","sisyphus-mandatory","sisyphus-mandatory.md");async function qf(e){return await Ck(e??ru,"utf-8")}function Jf(e,t){let n=t?.oracleVerified===!0,i=t?.filesChanged??0,r=["","## Sisyphus Protocol Enforcement","","You MUST follow these Sisyphus protocol rules:","","1. **Pre-response Memory Check**: Before any action, read `<project-memory>` and `<session-history-since>` blocks in context. Cite `<memory id>` for any fact used from memory. Do not ask questions whose answers are in those blocks.","","2. **Codebase Graph First**: Before using grep/glob/read for architecture or symbol queries, check whether `.codegraph/` or `graphify-out/` exists. If so, use codegraph/graphify tools first, then grep/read only as last resort.","","3. **Tool Routing Table**: Match common intents to the correct tool:",' - "we did this before" / "you should know" → `agentmemory_memory_recall`'," - Starting a task that resembles a previous one → `agentmemory_memory_smart_search`"," - Before asking the user a clarifying question → `agentmemory_memory_recall` first"," - Save durable insight/decision/rule → `agentmemory_memory_save`",""];if(/\boracle\b/i.test(e)&&!(n&&i>0))r.push("4. **Post-task Oracle Verification**: If files touched >= 3 OR any INVOKE trigger matches, invoke Oracle with the exact format:",' `task(subagent_type="oracle", run_in_background=false, prompt="Verify: ...")`'," - INVOKE triggers: created 1+ new file, modified abstraction, touched security/auth paths, modified DB/persistence, modified CI/CD, added/removed dependency, modified perf-critical path, todo had 2+ completed items."," - SKIP only when: files touched <= 2, no new file, no dependency change, single-step task, change is typo/comment/rename only."," - Verdict: PASS → done. FAIL/CONDITIONAL → fix and re-invoke. Max 3 invocations."," - Cost: Max 3 oracle invocations per task. Skip rate: Must NOT skip Oracle on 2+ file change.","");return r.push("5. **Parallel Query Rule**: Fire independent tool queries in the same turn. Do NOT serialize independent memory/context queries.","","6. **Empty-Result Escalation**: On empty `agentmemory_memory_recall`, fire `agentmemory_memory_smart_search` + `agentmemory_memory_export` before asking the user.","","7. **Hard Rules (No Exceptions)**:"," - Do NOT ask 'where is X?' if memory or session record already contains it."," - Do NOT claim 'I don't know' before firing at least 2 different recall tools."," - Do NOT re-issue clarifying questions whose answer is in `<project-memory>` or `<session-history-since>`."," - Do NOT suppress type errors with `as any`, `@ts-ignore`, or `@ts-expect-error`."," - Do NOT leave empty catch blocks `catch(e) {}`.",' - Do NOT start a fresh agent via `task()` when `task(task_id="ses_...")` (continuation) exists — use continuation IDs.'," - Do NOT batch-complete todos — mark each one `completed` immediately after finishing."," - Do NOT skip creating todos for multi-step tasks.","","8. **Self-Check Before Responding**:"," - Verify you read `<project-memory>` and `<session-history-since>` blocks."," - Verify you cited `<memory id>` for any fact used from memory."," - Verify you did not ask a question whose answer is in those blocks."," - For multi-file changes, verify Oracle was invoked."," - For codebase exploration, verify codegraph/graphify was tried before grep/read."," - After discovering something non-obvious, save it with `agentmemory_memory_save` so future sessions benefit."," - Do NOT save routine operations (file reads, greps, list commands), trivial decisions, or facts already covered by existing memory. Save only novel insights, non-obvious patterns, or corrections to previous assumptions.","","9. **CI Verification Loop (NON-NEGOTIABLE)**: After EVERY step of an implementation plan that produces a code change you intend to keep, you MUST execute the full CI loop BEFORE moving to the next step:"," a. Commit the changes atomically (one commit per verified increment, never omnibus)."," b. Push to the remote that has CI configured (own repo: `git push origin <branch>`. Fork upstream: `git push fork <branch>` + open/update PR)."," c. Wait for the CI run triggered by the push to reach a terminal state (`gh run watch <run-id> --exit-status`).",' d. Assert `conclusion == "success"` on EVERY job. If any job fails, fix the regression, re-push, and re-verify until all jobs are green.'," e. Capture the green run-id so the final plan-completion message can cite it as evidence."," - Anti-pattern this rule kills: running local tests, seeing 0 failures, declaring done, then shipping the next step on top of an unverified CI. Local green is NOT CI green. Pushed-not-watched is NOT CI green."," - At the END of the plan (when the last step is done), run a final guarantee: `gh run list --branch <branch> --limit 5` and assert EVERY recent run on this branch has `conclusion=success`. If any run shows `failure`, surface it explicitly to the user with the run-id, the failing job, and the log excerpt - do NOT claim plan success."," - For fork -> upstream PR workflow: verify the workflow_run on the upstream repo (the PR's head ref), not just the fork. Both must be green."," - This rule applies whenever the repo has a `.github/workflows/*.yml` file (or equivalent CI config). For repos without CI, document the absence explicitly."," - If the user explicitly says 'skip CI' or 'local only', this rule is suppressed for that turn ONLY - re-engage on next step.",""),r.join(`
250
+ `)}function Kf(e,t,n){let i=[],r=n.recentToolCalls??[],o=n.recentWriteContents??[],s=n.memorySaved??!1,a=n.batchCompletions??0;if((e==="grep"||e==="glob")&&(n.hasCodegraphDir||n.hasGraphifyDir)){let f=n.hasCodegraphDir?".codegraph":"graphify-out";i.push({rule:"codebase-graph-first",tool:e,severity:"media",detail:`Used ${e} when ${f} exists — should use codegraph/graphify first for architecture and symbol queries.`})}if(e==="task"&&t&&typeof t==="object"){let f=t;if(!f.task_id&&typeof f.prompt==="string"&&r.length>3)i.push({rule:"continuation-discipline",tool:e,severity:"leve",detail:`Started a new task() without task(task_id="ses_...") continuation ID. Use task_id to preserve the subagent's full context and save tokens.`})}if(Ye.includes(e)){let f=typeof t==="object"&&t!==null?JSON.stringify(t):String(t??""),g=/@ts-ignore|@ts-expect-error/.test(f),d=/\bas any\b/.test(f);if(g&&d)i.push({rule:"no-type-suppression",tool:e,severity:"grave",detail:"File write contains both @ts-ignore/@ts-expect-error AND 'as any' — double type suppression. "+"Both are forbidden by the Sisyphus protocol."});else if(g)i.push({rule:"no-type-suppression",tool:e,severity:"media",detail:"File write contains @ts-ignore or @ts-expect-error — both are forbidden. "+"Fix the underlying type error instead."});else if(d)i.push({rule:"no-type-suppression",tool:e,severity:"media",detail:"File write contains 'as any' — type suppression forbidden. "+"Use proper type narrowing instead."})}if(Ye.includes(e)){let f=typeof t==="object"&&t!==null?JSON.stringify(t):String(t??"");if(/catch\s*\(\s*\w+\s*\)\s*\{\s*\}/.test(f))i.push({rule:"no-empty-catch",tool:e,severity:"media",detail:"Empty catch block detected — `catch(e) {}` is forbidden. "+"Log the error or handle it gracefully."})}if(["codegraph_explore","graphify query"].includes(e)&&r.length>=2){if(!s)i.push({rule:"save-discovery-to-memory",tool:e,severity:"leve",detail:`Used ${e} to discover code but no memory save was made afterwards. Save non-obvious findings with agentmemory_memory_save so future sessions benefit.`})}if(a>0&&e!=="todowrite")i.push({rule:"no-batch-todo-completion",tool:e,severity:"leve",detail:"Batch todo completion detected. Each todo must be marked `completed` immediately "+"after finishing — do not batch-complete multiple items."});if(n.emptyRecall&&!n.escalationAttempted){if(e.startsWith("question")||e==="ask")i.push({rule:"empty-result-escalation",tool:e,severity:"grave",detail:"Memory recall returned empty but agent did not fire smart_search + export before asking the user. Steps 1-3 of empty-result escalation protocol are mandatory."})}let c=["agentmemory_memory_recall","agentmemory_memory_smart_search","agentmemory_memory_save"];if(!n.memoryToolsUsed.some((f)=>c.some((g)=>f.startsWith(g)))&&(e.startsWith("question")||e==="ask"))i.push({rule:"memory-first",tool:e,severity:"grave",detail:"Asked a question without first querying memory. Must fire agentmemory_memory_recall or agentmemory_memory_smart_search before asking the user."});if(n.filesChanged>=3&&!n.oracleInvoked&&Ye.includes(e))i.push({rule:"oracle-verification",tool:e,severity:"media",detail:`Files changed (${n.filesChanged}) >= 3 but Oracle was not invoked. The POST-TASK ORACLE VERIFICATION protocol requires Oracle invocation on multi-file changes.`});return i}import{stat as mw}from"fs";import{stat as pw,readdir as fw}from"fs/promises";import{EventEmitter as gw}from"events";import*as j from"path";import{stat as Nk,lstat as Xf,readdir as jk,realpath as Uk}from"node:fs/promises";import{Readable as Lk}from"node:stream";import{resolve as Yf,relative as Fk,join as Gk,sep as Zk}from"node:path";var Ie={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},nu={root:".",fileFilter:(e)=>!0,directoryFilter:(e)=>!0,type:Ie.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(nu);var rg="READDIRP_RECURSIVE_ERROR",Wk=new Set(["ENOENT","EPERM","EACCES","ELOOP",rg]),Qf=[Ie.DIR_TYPE,Ie.EVERYTHING_TYPE,Ie.FILE_DIR_TYPE,Ie.FILE_TYPE],Hk=new Set([Ie.DIR_TYPE,Ie.EVERYTHING_TYPE,Ie.FILE_DIR_TYPE]),Vk=new Set([Ie.EVERYTHING_TYPE,Ie.FILE_DIR_TYPE,Ie.FILE_TYPE]),Bk=(e)=>Wk.has(e.code),qk=process.platform==="win32",eg=(e)=>!0,tg=(e)=>{if(e===void 0)return eg;if(typeof e==="function")return e;if(typeof e==="string"){let t=e.trim();return(n)=>n.basename===t}if(Array.isArray(e)){let t=e.map((n)=>n.trim());return(n)=>t.some((i)=>n.basename===i)}return eg};class ng extends Lk{constructor(e={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:e.highWaterMark});let t={...nu,...e},{root:n,type:i}=t;this._fileFilter=tg(t.fileFilter),this._directoryFilter=tg(t.directoryFilter);let r=t.lstat?Xf:Nk;if(qk)this._stat=(o)=>r(o,{bigint:!0});else this._stat=r;this._maxDepth=t.depth??nu.depth,this._wantsDir=i?Hk.has(i):!1,this._wantsFile=i?Vk.has(i):!1,this._wantsEverything=i===Ie.EVERYTHING_TYPE,this._root=Yf(n),this._isDirent=!t.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(n,1)],this.reading=!1,this.parent=void 0}async _read(e){if(this.reading)return;this.reading=!0;try{while(!this.destroyed&&e>0){let t=this.parent,n=t&&t.files;if(n&&n.length>0){let{path:i,depth:r}=t,o=n.splice(0,e).map((a)=>this._formatEntry(a,i)),s=await Promise.all(o);for(let a of s){if(!a)continue;if(this.destroyed)return;let l=await this._getEntryType(a);if(l==="directory"&&this._directoryFilter(a)){if(r<=this._maxDepth)this.parents.push(this._exploreDir(a.fullPath,r+1));if(this._wantsDir)this.push(a),e--}else if((l==="file"||this._includeAsFile(a))&&this._fileFilter(a)){if(this._wantsFile)this.push(a),e--}}}else{let i=this.parents.pop();if(!i){this.push(null);break}if(this.parent=await i,this.destroyed)return}}}catch(t){this.destroy(t)}finally{this.reading=!1}}async _exploreDir(e,t){let n;try{n=await jk(e,this._rdOptions)}catch(i){this._onError(i)}return{files:n,depth:t,path:e}}async _formatEntry(e,t){let n,i=this._isDirent?e.name:e;try{let r=Yf(Gk(t,i));n={path:Fk(this._root,r),fullPath:r,basename:i},n[this._statsProp]=this._isDirent?e:await this._stat(r)}catch(r){this._onError(r);return}return n}_onError(e){if(Bk(e)&&!this.destroyed)this.emit("warn",e);else this.destroy(e)}async _getEntryType(e){if(!e&&this._statsProp in e)return"";let t=e[this._statsProp];if(t.isFile())return"file";if(t.isDirectory())return"directory";if(t&&t.isSymbolicLink()){let n=e.fullPath;try{let i=await Uk(n),r=await Xf(i);if(r.isFile())return"file";if(r.isDirectory()){let o=i.length;if(n.startsWith(i)&&n.substr(o,1)===Zk){let s=Error(`Circular symlink detected: "${n}" points to "${i}"`);return s.code=rg,this._onError(s)}return"directory"}}catch(i){return this._onError(i),""}}}_includeAsFile(e){let t=e&&e[this._statsProp];return t&&this._wantsEverything&&!t.isDirectory()}}function ig(e,t={}){let n=t.entryType||t.type;if(n==="both")n=Ie.FILE_DIR_TYPE;if(n)t.type=n;if(!e)throw Error("readdirp: root argument is required. Usage: readdirp(root, options)");else if(typeof e!=="string")throw TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");else if(n&&!Qf.includes(n))throw Error(`readdirp: Invalid type passed. Use one of ${Qf.join(", ")}`);return t.root=e,new ng(t)}import{watchFile as Jk,unwatchFile as og,watch as Kk}from"fs";import{open as Xk,stat as ag,lstat as Yk,realpath as iu}from"fs/promises";import*as Q from"path";import{type as Qk}from"os";var ew="data",au="end",lg="close",Di=()=>{};var Pi=process.platform,lu=Pi==="win32",tw=Pi==="darwin",rw=Pi==="linux",nw=Pi==="freebsd",cg=Qk()==="OS400",ee={ALL:"all",READY:"ready",ADD:"add",CHANGE:"change",ADD_DIR:"addDir",UNLINK:"unlink",UNLINK_DIR:"unlinkDir",RAW:"raw",ERROR:"error"},ze=ee,iw="watch",ow={lstat:Yk,stat:ag},xt="listeners",Si="errHandlers",Gt="rawEmitters",sw=[xt,Si,Gt],aw=new Set(["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),lw=(e)=>aw.has(Q.extname(e).slice(1).toLowerCase()),su=(e,t)=>{if(e instanceof Set)e.forEach(t);else t(e)},Fr=(e,t,n)=>{let i=e[t];if(!(i instanceof Set))e[t]=i=new Set([i]);i.add(n)},cw=(e)=>(t)=>{let n=e[t];if(n instanceof Set)n.clear();else delete e[t]},Gr=(e,t,n)=>{let i=e[t];if(i instanceof Set)i.delete(n);else if(i===n)delete e[t]},ug=(e)=>e instanceof Set?e.size===0:!e,Ii=new Map;function sg(e,t,n,i,r){let o=(s,a)=>{if(n(e),r(s,a,{watchedPath:e}),a&&e!==a)Ti(Q.resolve(e,a),xt,Q.join(e,a))};try{return Kk(e,{persistent:t.persistent},o)}catch(s){i(s);return}}var Ti=(e,t,n,i,r)=>{let o=Ii.get(e);if(!o)return;su(o[t],(s)=>{s(n,i,r)})},uw=(e,t,n,i)=>{let{listener:r,errHandler:o,rawEmitter:s}=i,a=Ii.get(t),l;if(!n.persistent){if(l=sg(e,n,r,o,s),!l)return;return l.close.bind(l)}if(a)Fr(a,xt,r),Fr(a,Si,o),Fr(a,Gt,s);else{if(l=sg(e,n,Ti.bind(null,t,xt),o,Ti.bind(null,t,Gt)),!l)return;l.on(ze.ERROR,async(c)=>{let u=Ti.bind(null,t,Si);if(a)a.watcherUnusable=!0;if(lu&&c.code==="EPERM")try{await(await Xk(e,"r")).close(),u(c)}catch(f){}else u(c)}),a={listeners:r,errHandlers:o,rawEmitters:s,watcher:l},Ii.set(t,a)}return()=>{if(Gr(a,xt,r),Gr(a,Si,o),Gr(a,Gt,s),ug(a.listeners))a.watcher.close(),Ii.delete(t),sw.forEach(cw(a)),a.watcher=void 0,Object.freeze(a)}},ou=new Map,dw=(e,t,n,i)=>{let{listener:r,rawEmitter:o}=i,s=ou.get(t),a=s&&s.options;if(a&&(a.persistent<n.persistent||a.interval>n.interval))og(t),s=void 0;if(s)Fr(s,xt,r),Fr(s,Gt,o);else s={listeners:r,rawEmitters:o,options:n,watcher:Jk(t,n,(l,c)=>{su(s.rawEmitters,(f)=>{f(ze.CHANGE,t,{curr:l,prev:c})});let u=l.mtimeMs;if(l.size!==c.size||u>c.mtimeMs||u===0)su(s.listeners,(f)=>f(e,l))})},ou.set(t,s);return()=>{if(Gr(s,xt,r),Gr(s,Gt,o),ug(s.listeners))ou.delete(t),og(t),s.options=s.watcher=void 0,Object.freeze(s)}};class cu{constructor(e){this.fsw=e,this._boundHandleError=(t)=>e._handleError(t)}_watchWithNodeFs(e,t){let n=this.fsw.options,i=Q.dirname(e),r=Q.basename(e);this.fsw._getWatchedDir(i).add(r);let s=Q.resolve(e),a={persistent:n.persistent};if(!t)t=Di;let l;if(n.usePolling){let c=n.interval!==n.binaryInterval;a.interval=c&&lw(r)?n.binaryInterval:n.interval,l=dw(e,s,a,{listener:t,rawEmitter:this.fsw._emitRaw})}else l=uw(e,s,a,{listener:t,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return l}_handleFile(e,t,n){if(this.fsw.closed)return;let i=Q.dirname(e),r=Q.basename(e),o=this.fsw._getWatchedDir(i),s=t;if(o.has(r))return;let a=async(c,u)=>{if(!this.fsw._throttle(iw,e,5))return;if(!u||u.mtimeMs===0)try{let f=await ag(e);if(this.fsw.closed)return;let{atimeMs:g,mtimeMs:d}=f;if(!g||g<=d||d!==s.mtimeMs)this.fsw._emit(ze.CHANGE,e,f);if((tw||rw||nw)&&s.ino!==f.ino){this.fsw._closeFile(c),s=f;let b=this._watchWithNodeFs(e,a);if(b)this.fsw._addPathCloser(c,b)}else s=f}catch(f){this.fsw._remove(i,r)}else if(o.has(r)){let{atimeMs:f,mtimeMs:g}=u;if(!f||f<=g||g!==s.mtimeMs)this.fsw._emit(ze.CHANGE,e,u);s=u}},l=this._watchWithNodeFs(e,a);if(!(n&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(e)){if(!this.fsw._throttle(ze.ADD,e,0))return;this.fsw._emit(ze.ADD,e,t)}return l}async _handleSymlink(e,t,n,i){if(this.fsw.closed)return;let r=e.fullPath,o=this.fsw._getWatchedDir(t);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let s;try{s=await iu(n)}catch(a){return this.fsw._emitReady(),!0}if(this.fsw.closed)return;if(o.has(i)){if(this.fsw._symlinkPaths.get(r)!==s)this.fsw._symlinkPaths.set(r,s),this.fsw._emit(ze.CHANGE,n,e.stats)}else o.add(i),this.fsw._symlinkPaths.set(r,s),this.fsw._emit(ze.ADD,n,e.stats);return this.fsw._emitReady(),!0}if(this.fsw._symlinkPaths.has(r))return!0;this.fsw._symlinkPaths.set(r,!0)}_handleRead(e,t,n,i,r,o,s){if(e=Q.join(e,""),s=this.fsw._throttle("readdir",e,1000),!s)return;let a=this.fsw._getWatchedDir(n.path),l=new Set,c=this.fsw._readdirp(e,{fileFilter:(u)=>n.filterPath(u),directoryFilter:(u)=>n.filterDir(u)});if(!c)return;return c.on(ew,async(u)=>{if(this.fsw.closed){c=void 0;return}let f=u.path,g=Q.join(e,f);if(l.add(f),u.stats.isSymbolicLink()&&await this._handleSymlink(u,e,g,f))return;if(this.fsw.closed){c=void 0;return}if(f===i||!i&&!a.has(f))this.fsw._incrReadyCount(),g=Q.join(r,Q.relative(r,g)),this._addToNodeFs(g,t,n,o+1)}).on(ze.ERROR,this._boundHandleError),new Promise((u,f)=>{if(!c)return f();c.once(au,()=>{if(this.fsw.closed){c=void 0;return}let g=s?s.clear():!1;if(u(void 0),a.getChildren().filter((d)=>d!==e&&!l.has(d)).forEach((d)=>{this.fsw._remove(e,d)}),c=void 0,g)this._handleRead(e,!1,n,i,r,o,s)})})}async _handleDir(e,t,n,i,r,o,s){let a=this.fsw._getWatchedDir(Q.dirname(e)),l=a.has(Q.basename(e));if(!(n&&this.fsw.options.ignoreInitial)&&!r&&!l)this.fsw._emit(ze.ADD_DIR,e,t);a.add(Q.basename(e)),this.fsw._getWatchedDir(e);let c,u,f=this.fsw.options.depth;if((f==null||i<=f)&&!this.fsw._symlinkPaths.has(s)){if(!r){if(await this._handleRead(e,n,o,r,e,i,c),this.fsw.closed)return}u=this._watchWithNodeFs(e,(g,d)=>{if(d&&d.mtimeMs===0)return;this._handleRead(g,!1,o,r,e,i,c)})}return u}async _addToNodeFs(e,t,n,i,r){let o=this.fsw._emitReady;if(this.fsw._isIgnored(e)||this.fsw.closed)return o(),!1;let s=this.fsw._getWatchHelpers(e);if(n)s.filterPath=(a)=>n.filterPath(a),s.filterDir=(a)=>n.filterDir(a);try{let a=await ow[s.statMethod](s.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(s.watchPath,a))return o(),!1;let l=this.fsw.options.followSymlinks,c;if(a.isDirectory()){let u=Q.resolve(e),f=l?await iu(e):e;if(this.fsw.closed)return;if(c=await this._handleDir(s.watchPath,a,t,i,r,s,f),this.fsw.closed)return;if(u!==f&&f!==void 0)this.fsw._symlinkPaths.set(u,f)}else if(a.isSymbolicLink()){let u=l?await iu(e):e;if(this.fsw.closed)return;let f=Q.dirname(s.watchPath);if(this.fsw._getWatchedDir(f).add(s.watchPath),this.fsw._emit(ze.ADD,s.watchPath,a),c=await this._handleDir(f,a,t,i,e,s,u),this.fsw.closed)return;if(u!==void 0)this.fsw._symlinkPaths.set(Q.resolve(e),u)}else c=this._handleFile(s.watchPath,a,t);if(o(),c)this.fsw._addPathCloser(e,c);return!1}catch(a){if(this.fsw._handleError(a))return o(),e}}}/*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) */var uu="/",hw="//",hg=".",vw="..",yw="string",bw=/\\/g,dg=/\/\//,_w=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,kw=/^\.[/\\]/;function Oi(e){return Array.isArray(e)?e:[e]}var du=(e)=>typeof e==="object"&&e!==null&&!(e instanceof RegExp);function ww(e){if(typeof e==="function")return e;if(typeof e==="string")return(t)=>e===t;if(e instanceof RegExp)return(t)=>e.test(t);if(typeof e==="object"&&e!==null)return(t)=>{if(e.path===t)return!0;if(e.recursive){let n=j.relative(e.path,t);if(!n)return!1;return!n.startsWith("..")&&!j.isAbsolute(n)}return!1};return()=>!1}function xw(e){if(typeof e!=="string")throw Error("string expected");e=j.normalize(e),e=e.replace(/\\/g,"/");let t=!1;if(e.startsWith("//"))t=!0;let n=/\/\//;while(e.match(n))e=e.replace(n,"/");if(t)e="/"+e;return e}function mg(e,t,n){let i=xw(t);for(let r=0;r<e.length;r++){let o=e[r];if(o(i,n))return!0}return!1}function $w(e,t){if(e==null)throw TypeError("anymatch: specify first argument");let i=Oi(e).map((r)=>ww(r));if(t==null)return(r,o)=>mg(i,r,o);return mg(i,t)}var pg=(e)=>{let t=Oi(e).flat();if(!t.every((n)=>typeof n===yw))throw TypeError(`Non-string provided as watch path: ${t}`);return t.map(vg)},fg=(e)=>{let t=e.replace(bw,uu),n=!1;if(t.startsWith(hw))n=!0;while(t.match(dg))t=t.replace(dg,uu);if(n)t=uu+t;return t},vg=(e)=>fg(j.normalize(fg(e))),gg=(e="")=>(t)=>{if(typeof t==="string")return vg(j.isAbsolute(t)?t:j.join(e,t));else return t},Sw=(e,t)=>{if(j.isAbsolute(e))return e;return j.join(t,e)},Iw=Object.freeze(new Set);class yg{constructor(e,t){this.path=e,this._removeWatcher=t,this.items=new Set}add(e){let{items:t}=this;if(!t)return;if(e!==hg&&e!==vw)t.add(e)}async remove(e){let{items:t}=this;if(!t)return;if(t.delete(e),t.size>0)return;let n=this.path;try{await fw(n)}catch(i){if(this._removeWatcher)this._removeWatcher(j.dirname(n),j.basename(n))}}has(e){let{items:t}=this;if(!t)return;return t.has(e)}getChildren(){let{items:e}=this;if(!e)return[];return[...e.values()]}dispose(){this.items.clear(),this.path="",this._removeWatcher=Di,this.items=Iw,Object.freeze(this)}}var Tw="stat",Dw="lstat";class bg{constructor(e,t,n){this.fsw=n;let i=e;this.path=e=e.replace(kw,""),this.watchPath=i,this.fullWatchPath=j.resolve(i),this.dirParts=[],this.dirParts.forEach((r)=>{if(r.length>1)r.pop()}),this.followSymlinks=t,this.statMethod=t?Tw:Dw}entryPath(e){return j.join(this.watchPath,j.relative(this.watchPath,e.fullPath))}filterPath(e){let{stats:t}=e;if(t&&t.isSymbolicLink())return this.filterDir(e);let n=this.entryPath(e);return this.fsw._isntIgnored(n,t)&&this.fsw._hasReadPermissions(t)}filterDir(e){return this.fsw._isntIgnored(this.entryPath(e),e.stats)}}class _g extends gw{constructor(e={}){super();this.closed=!1,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=!1;let t=e.awaitWriteFinish,n={stabilityThreshold:2000,pollInterval:100},i={persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0,...e,ignored:e.ignored?Oi(e.ignored):Oi([]),awaitWriteFinish:t===!0?n:typeof t==="object"?{...n,...t}:!1};if(cg)i.usePolling=!0;if(i.atomic===void 0)i.atomic=!i.usePolling;let r=process.env.CHOKIDAR_USEPOLLING;if(r!==void 0){let a=r.toLowerCase();if(a==="false"||a==="0")i.usePolling=!1;else if(a==="true"||a==="1")i.usePolling=!0;else i.usePolling=!!a}let o=process.env.CHOKIDAR_INTERVAL;if(o)i.interval=Number.parseInt(o,10);let s=0;this._emitReady=()=>{if(s++,s>=this._readyCount)this._emitReady=Di,this._readyEmitted=!0,process.nextTick(()=>this.emit(ee.READY))},this._emitRaw=(...a)=>this.emit(ee.RAW,...a),this._boundRemove=this._remove.bind(this),this.options=i,this._nodeFsHandler=new cu(this),Object.freeze(i)}_addIgnoredPath(e){if(du(e)){for(let t of this._ignoredPaths)if(du(t)&&t.path===e.path&&t.recursive===e.recursive)return}this._ignoredPaths.add(e)}_removeIgnoredPath(e){if(this._ignoredPaths.delete(e),typeof e==="string"){for(let t of this._ignoredPaths)if(du(t)&&t.path===e)this._ignoredPaths.delete(t)}}add(e,t,n){let{cwd:i}=this.options;this.closed=!1,this._closePromise=void 0;let r=pg(e);if(i)r=r.map((o)=>Sw(o,i));if(r.forEach((o)=>{this._removeIgnoredPath(o)}),this._userIgnored=void 0,!this._readyCount)this._readyCount=0;return this._readyCount+=r.length,Promise.all(r.map(async(o)=>{let s=await this._nodeFsHandler._addToNodeFs(o,!n,void 0,0,t);if(s)this._emitReady();return s})).then((o)=>{if(this.closed)return;o.forEach((s)=>{if(s)this.add(j.dirname(s),j.basename(t||s))})}),this}unwatch(e){if(this.closed)return this;let t=pg(e),{cwd:n}=this.options;return t.forEach((i)=>{if(!j.isAbsolute(i)&&!this._closers.has(i)){if(n)i=j.join(n,i);i=j.resolve(i)}if(this._closePath(i),this._addIgnoredPath(i),this._watched.has(i))this._addIgnoredPath({path:i,recursive:!0});this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();let e=[];return this._closers.forEach((t)=>t.forEach((n)=>{let i=n();if(i instanceof Promise)e.push(i)})),this._streams.forEach((t)=>t.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach((t)=>t.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=e.length?Promise.all(e).then(()=>{return}):Promise.resolve(),this._closePromise}getWatched(){let e={};return this._watched.forEach((t,n)=>{let r=(this.options.cwd?j.relative(this.options.cwd,n):n)||hg;e[r]=t.getChildren().sort()}),e}emitWithAll(e,t){if(this.emit(e,...t),e!==ee.ERROR)this.emit(ee.ALL,e,...t)}async _emit(e,t,n){if(this.closed)return;let i=this.options;if(lu)t=j.normalize(t);if(i.cwd)t=j.relative(i.cwd,t);let r=[t];if(n!=null)r.push(n);let o=i.awaitWriteFinish,s;if(o&&(s=this._pendingWrites.get(t)))return s.lastChange=new Date,this;if(i.atomic){if(e===ee.UNLINK)return this._pendingUnlinks.set(t,[e,...r]),setTimeout(()=>{this._pendingUnlinks.forEach((a,l)=>{this.emit(...a),this.emit(ee.ALL,...a),this._pendingUnlinks.delete(l)})},typeof i.atomic==="number"?i.atomic:100),this;if(e===ee.ADD&&this._pendingUnlinks.has(t))e=ee.CHANGE,this._pendingUnlinks.delete(t)}if(o&&(e===ee.ADD||e===ee.CHANGE)&&this._readyEmitted){let a=(l,c)=>{if(l)e=ee.ERROR,r[0]=l,this.emitWithAll(e,r);else if(c){if(r.length>1)r[1]=c;else r.push(c);this.emitWithAll(e,r)}};return this._awaitWriteFinish(t,o.stabilityThreshold,e,a),this}if(e===ee.CHANGE){if(!this._throttle(ee.CHANGE,t,50))return this}if(i.alwaysStat&&n===void 0&&(e===ee.ADD||e===ee.ADD_DIR||e===ee.CHANGE)){let a=i.cwd?j.join(i.cwd,t):t,l;try{l=await pw(a)}catch(c){}if(!l||this.closed)return;r.push(l)}return this.emitWithAll(e,r),this}_handleError(e){let t=e&&e.code;if(e&&t!=="ENOENT"&&t!=="ENOTDIR"&&(!this.options.ignorePermissionErrors||t!=="EPERM"&&t!=="EACCES"))this.emit(ee.ERROR,e);return e||this.closed}_throttle(e,t,n){if(!this._throttled.has(e))this._throttled.set(e,new Map);let i=this._throttled.get(e);if(!i)throw Error("invalid throttle");let r=i.get(t);if(r)return r.count++,!1;let o,s=()=>{let l=i.get(t),c=l?l.count:0;if(i.delete(t),clearTimeout(o),l)clearTimeout(l.timeoutObject);return c};o=setTimeout(s,n);let a={timeoutObject:o,clear:s,count:0};return i.set(t,a),a}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(e,t,n,i){let r=this.options.awaitWriteFinish;if(typeof r!=="object")return;let o=r.pollInterval,s,a=e;if(this.options.cwd&&!j.isAbsolute(e))a=j.join(this.options.cwd,e);let l=new Date,c=this._pendingWrites;function u(f){mw(a,(g,d)=>{if(g||!c.has(e)){if(g&&g.code!=="ENOENT")i(g);return}let b=Number(new Date);if(f&&d.size!==f.size)c.get(e).lastChange=b;let x=c.get(e);if(b-x.lastChange>=t)c.delete(e),i(void 0,d);else s=setTimeout(u,o,d)})}if(!c.has(e))c.set(e,{lastChange:l,cancelWait:()=>(c.delete(e),clearTimeout(s),n)}),s=setTimeout(u,o)}_isIgnored(e,t){if(this.options.atomic&&_w.test(e))return!0;if(!this._userIgnored){let{cwd:n}=this.options,r=(this.options.ignored||[]).map(gg(n)),s=[...[...this._ignoredPaths].map(gg(n)),...r];this._userIgnored=$w(s,void 0)}return this._userIgnored(e,t)}_isntIgnored(e,t){return!this._isIgnored(e,t)}_getWatchHelpers(e){return new bg(e,this.options.followSymlinks,this)}_getWatchedDir(e){let t=j.resolve(e);if(!this._watched.has(t))this._watched.set(t,new yg(t,this._boundRemove));return this._watched.get(t)}_hasReadPermissions(e){if(this.options.ignorePermissionErrors)return!0;return Boolean(Number(e.mode)&256)}_remove(e,t,n){let i=j.join(e,t),r=j.resolve(i);if(n=n!=null?n:this._watched.has(i)||this._watched.has(r),!this._throttle("remove",i,100))return;if(!n&&this._watched.size===1)this.add(e,t,!0);this._getWatchedDir(i).getChildren().forEach((f)=>this._remove(i,f));let a=this._getWatchedDir(e),l=a.has(t);if(a.remove(t),this._symlinkPaths.has(r))this._symlinkPaths.delete(r);let c=i;if(this.options.cwd)c=j.relative(this.options.cwd,i);if(this.options.awaitWriteFinish&&this._pendingWrites.has(c)){if(this._pendingWrites.get(c).cancelWait()===ee.ADD)return}this._watched.delete(i),this._watched.delete(r);let u=n?ee.UNLINK_DIR:ee.UNLINK;if(l&&!this._isIgnored(i))this._emit(u,i);this._closePath(i)}_closePath(e){this._closeFile(e);let t=j.dirname(e);this._getWatchedDir(t).remove(j.basename(e))}_closeFile(e){let t=this._closers.get(e);if(!t)return;t.forEach((n)=>n()),this._closers.delete(e)}_addPathCloser(e,t){if(!t)return;let n=this._closers.get(e);if(!n)n=[],this._closers.set(e,n);n.push(t)}_readdirp(e,t){if(this.closed)return;let n={type:ee.ALL,alwaysStat:!0,lstat:!0,...t,depth:0},i=ig(e,n);return this._streams.add(i),i.once(lg,()=>{i=void 0}),i.once(au,()=>{if(i)this._streams.delete(i),i=void 0}),i}}function kg(e,t={}){let n=new _g(t);return n.add(e),n}import{existsSync as Pw}from"node:fs";var Ow=/^[A-Z]:[\\/](pagefile\.sys|DumpStack\.log\.tmp|hiberfil\.sys|swapfile\.sys)/i;async function wg(e){if(!e.projectDir||!Pw(e.projectDir))return{stop:async()=>{}};let t=(o)=>o.endsWith("SKILL.md"),n=kg(e.projectDir,{ignoreInitial:!0,usePolling:!0,interval:100,binaryInterval:100,ignored:(o)=>Ow.test(o)}),i=!1,r=new Promise((o)=>{n.once("ready",()=>{if(!i)o()})});return n.on("add",(o)=>{if(!i&&t(o))e.onChange(o,"add")}),n.on("change",(o)=>{if(!i&&t(o))e.onChange(o,"change")}),await r,await new Promise((o)=>setTimeout(o,100)),{async stop(){i=!0,await n.close()}}}var Ew=[/^[A-Z]:[\\/](pagefile\.sys|DumpStack\.log\.tmp)/i,/^[A-Z]:[\\/](Users|home)[\\/][^\\/]+[\\/]AppData[\\/]Local[\\/]Temp[\\/]/i,/^\/(var|private\/var)\/folders\//,/^\/snap\//],Rw=new Set(["EINVAL","ENOENT","EACCES","EBADF","EPERM"]),Ei=null;function xg(e={}){let t=Object.keys(e).length===0;if(t&&Ei)return Ei;let n=e.paths??Ew,i=e.errorCodes??Rw,r=e.logger??console,o=(u)=>{let f=u&&typeof u==="object"&&"code"in u&&u.code?i.has(u.code):!1,g=!!(u?.path&&n.some((d)=>d.test(u.path)));if(f&&g){r.warn?.("watcher_scan_blocked",{path:u.path,code:u.code,message:u.message});return}};process.on("uncaughtException",o);let s=()=>process.off("uncaughtException",o),a=(u)=>{if(u&&typeof u==="object"&&"code"in u)o(u)};process.on("unhandledRejection",a);let l=()=>process.off("unhandledRejection",a),c=()=>{if(s(),l(),t)Ei=null};if(t)Ei=c;return c}Qr();xg();var Sg=new Set,Ig={continue:0,warn:1,escalate:2,stop:3};function Tg(e,t){return Ig[e]>=Ig[t]}function Dg(e){if(e.tool!=="bash")return!1;let t=e.args?.command;if(typeof t!=="string")return!1;return/(?:>>?|[<>]\s*&?\s*[''"]?\s*\S+|\btee\s+[^|;&]+)/.test(t)}function Gw(e){let t=e.args;if(!t||typeof t!=="object")return null;let n=["pattern","query","path","glob","regex","include_pattern"];for(let i of n){let r=t[i];if(typeof r==="string"&&r.trim().length>0)return r.trim()}return null}var Oe=If({sessionID:"__global__",global:!0,version:me});var Pg=ve().health;try{et({oldPaths:Qe(),newPaths:ve()})}catch{}function Rg(e={},t={}){let n=G(),i=new Xc;Mp(i);let r=process.cwd(),o=nn(),s=jp({graphRetrieval:n,cwd:r}),a=Up({sqlite:o}),l=Lp({metrics:Oe,logFilePath:Ne,healthFilePath:Pg}),c=Fp({cwd:r}),u=Gp({cwd:r}),f=Zp({onDispatch:({sessionID:ce,mcpTool:Ce,mcpArgs:ke})=>{i.register({sessionID:ce,mcpTool:Ce,mcpArgs:ke})}}),g=Wp({onDispatch:({sessionID:ce,mcpTool:Ce,mcpArgs:ke})=>{i.register({sessionID:ce,mcpTool:Ce,mcpArgs:ke})}}),d=Hp({cwd:r}),b=Vp({cwd:r}),x=Bp({graphRetrieval:n,cwd:r}),M=qp({graphRetrieval:n,cwd:r}),U=Jp({graphRetrieval:n,cwd:r}),K=Kp({graphRetrieval:n,cwd:r}),W=Xp({graphRetrieval:n,cwd:r}),ae=Yp({graphRetrieval:n,cwd:r}),Te=Qp({graphRetrieval:n,cwd:r}),Zt=ef({graphRetrieval:n,cwd:r}),hu=tf({graphRetrieval:n,cwd:r}),vu=rf({graphRetrieval:n,cwd:r}),yu=nf({graphRetrieval:n,cwd:r}),bu=of({graphRetrieval:n,cwd:r}),_u=sf({graphRetrieval:n,cwd:r}),ku=af({graphRetrieval:n,cwd:r}),wu=lf({graphRetrieval:n,cwd:r}),xu=cf({graphRetrieval:n,cwd:r}),$u=uf({graphRetrieval:n,cwd:r}),Su=df({graphRetrieval:n,cwd:r}),Iu=mf({graphRetrieval:n,cwd:r}),Tu=pf({graphRetrieval:n,cwd:r}),Du=ff({graphRetrieval:n,cwd:r}),Pu=gf({graphRetrieval:n,cwd:r}),Ou=hf({graphRetrieval:n,cwd:r}),Eu=vf({cwd:r}),Ru=yf({cwd:r}),zu=bf({cwd:r}),Cu=_f({cwd:r}),Au=kf({cwd:r});S("info",`v${me} MetaGovernor plugin loaded`,{version:me,build:me,cwd:r,projectHasCodegraph:n.hasCodegraphDir(r),projectHasGraphify:n.hasGraphifyDir(r)});let Mu="?";try{let Ce=jw(import.meta.url),ke=fu(Ce);Mu=Nw("sha256").update(ke).digest("hex").slice(0,8)}catch{}return console.log(`[meta-governor] v${me} loaded (bundle: ${Mu})`),(async()=>{let ce=ve().selfVersionCache,Ce=86400000,ke=null;try{let we=fu(ce,"utf-8"),Ge=JSON.parse(we);if(typeof Ge.latest==="string"&&typeof Ge.checkedAtMs==="number"&&Date.now()-Ge.checkedAtMs<86400000)ke={latest:Ge.latest,checkedAtMs:Ge.checkedAtMs}}catch{}let Ae=ke?.latest??null;if(!Ae)try{let{execSync:we}=await import("node:child_process");if(Ae=we("npm view @herjarsa/omo-meta-governor version",{timeout:5000,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()||null,Ae)try{let Ge=ce.replace(/[\\/][^\\/]+$/,""),{mkdirSync:T,writeFileSync:Zr}=await import("node:fs");T(Ge,{recursive:!0}),Zr(ce,JSON.stringify({latest:Ae,checkedAtMs:Date.now()}))}catch{}}catch{}if(Ae&&Ae!==me)S("warn",`STALE_CACHE: loaded v${me} but npm has v${Ae}. Run: npm cache clean --force && rm -rf ~/.cache/opencode/packages/@herjarsa/omo-meta-governor*`)})(),async(ce,Ce)=>{S("info",`v${me} factory_invoked`,{version:me,hasInput:ce!=null,inputDir:ce?.directory??null,inputKeys:ce?Object.keys(ce):[]});let ke=ce.client,Ae=ke!=null&&typeof ke==="object"&&"tool"in ke?ke:null;jr().setClient(Ae),Ep(Ae);let we;try{we=await xi({projectDir:ce.directory??r})}catch(p){throw S("error","factory_config_load_failed",{message:p instanceof Error?p.message:String(p),stack:p instanceof Error?p.stack?.slice(0,800):void 0}),p}let Ge={...e,...we.config,...Ce?.meta_governor??{}},T;try{T=Qc(Ge)}catch(p){throw S("error","factory_orchestrator_config_failed",{message:p instanceof Error?p.message:String(p)}),p}if(Ip({preferredTool:T.graphRetrieval.preferredTool}),we.sources.length>0)S("info",`v${me} config_loaded`,{version:me,sources:we.sources,effectiveSource:we.effectiveSource,enabled:T.enabled});if(T.postWave?.enabled===!0&&T.intervention.respectDoneSignal===!1)S("info","post_wave_warning",{message:"postWave.enabled=true but intervention.respectDoneSignal=false: post-wave directives still fire on Oracle-verified PHASE-N-COMPLETE, but the done-signal latch is off (intervention is not auto-disabled at plan end)."});let Zr=new Set,Nu=new Set,zg=new Set,xe=ce.directory?Uw(ce.directory):r,Wt=Ce?.meta_governor?.graphSync??we.config?.graphSync??e.graphSync;if(Wt?.enabled!==!1){if(t.__test_onGraphSyncInit?.({projectDir:xe}),(t.__test_runGraphSync??Yr)({enabled:!0,watch:Wt?.watch??!1,autoInstall:Wt?.autoInstall??!0,installTimeoutMs:Wt?.installTimeoutMs??60000,killOrphanedOnInit:Wt?.killOrphanedOnInit??!0,projectDir:xe}).then((w)=>{if(w?.attempted&&w.availability.codegraph&&w.availability.graphify)Zr.add(xe)}).catch((w)=>{S("warn",`graphSync init failed: ${String(w)}`)}),T.cliAnything?.enabled!==!1){let w=Ce?.meta_governor?.cliAnything??we.config?.cliAnything;(t.__test_runCliAnythingSync??_d)({enabled:!0,autoInstall:w?.autoInstall??!0,autoUpgrade:w?.autoUpgrade??!0,cachePath:w?.cachePath??ve().cliAnythingUpgradeCheck,upgradeCheckTtlMs:w?.upgradeCheckTtlMs??86400000,projectDir:xe,installScope:w?.installScope??"global",cliHubBin:w?.cliHubBin??"cli-hub",skillsBin:w?.skillsBin??"npx skills"}).then((I)=>{if(I?.attempted&&I.availability.cliHub)zg.add(xe)}).catch((I)=>{S("warn",`cli-anything sync failed: ${String(I)}`)})}queueMicrotask(()=>{try{let w=T.graphSync.fetchBranch,v=ld(xe,w);if(v>0)S("info",`reindexOnFetch: ${v} new commits on origin/${w}, reindexing`),Bi(xe).catch((I)=>{S("warn",`reindexOnFetch failed: ${String(I)}`)})}catch{}})}let Ht=null;if(!T.enabled){if(we.sources.length>0)S("warn","config_loaded_but_disabled",{version:me,sources:we.sources,hint:"Set meta_governor.enabled=true (or top-level enabled:true) in your omo-meta-governor.jsonc to activate governance."});return{tool:{omo_search:s,omo_recall:a,omo_health:l,omo_find:c,omo_impact:u,omo_remember:f,omo_recall_mcp:g,omo_path:d,omo_explain:b,omo_files:x,omo_callers:M,omo_node:U,omo_context:K,omo_affected_cg:W,omo_status:ae,omo_unlock:Te,omo_mark_dirty:Zt,omo_sync_if_dirty:hu,omo_index:vu,omo_visualize:yu,omo_serve:bu,omo_uninit:_u,omo_diagnose:ku,omo_merge_graphs:wu,omo_save_result:xu,omo_extract:$u,omo_cluster_only:Su,omo_label:Iu,omo_tree:Tu,omo_clone:Du,omo_add:Pu,omo_check_update:Ou,omo_hook_status:Eu,omo_cli_anything_install:Ru,omo_cli_anything_list:zu,omo_cli_anything_search:Cu,omo_cli_anything_info:Au},dispose:async()=>{try{Ui()}catch{}try{Hi()}catch{}try{qr()}catch{}try{It()}catch{}try{if(Ht)await Ht.stop()}catch{}}}}let zi=()=>T.modelOverride?.providerID??t.providerID?.(),Ci=()=>T.modelOverride?.modelID??t.modelID?.(),Cg=()=>T.modelOverride?.modelLimit??200000,ax=zi()??"unknown",lx=Ci()??"unknown",ju,Uu;if(T.protocolEnforcement.enabled||T.protocolEnforcement.injectIntoSystem){let p=T.protocolEnforcement.path??ru;try{ju=await qf(p),Uu=Jf(ju)}catch(w){if(T.modelOverride?.verbosity!=="silent")S("warn",`could not load protocol: ${w instanceof Error?w.message:String(w)}`)}}let pe=new tu({maxEntries:100,ttlMs:3600000}),Wr=new Lr(1000,300000),$t=new Lr(1000,300000),Lu=new Set,Fu=new Set,Ag=new Map,Gu=new Set,Mg=new Set,Ng=new Set,cx=new Set,Zu=new Set,jg=()=>({currentWaveN:null,lastInjectedWaveN:null,lastInjectedAtMs:null,postWaveInjectionsThisWave:0,rulesReadForWave:{},oracleAfterPhaseAtMs:{},repoModeResolved:null}),Wu=new Lr(1000,86400000),Ai=(p)=>{if(typeof t.__test_isMainSession==="function")try{return t.__test_isMainSession(p)}catch{return!0}return!0},St=(p,w)=>{if(!p||!w)return;if(!Ai(p)){S("info",`persist skipped (subagent) for ${p}`);return}if(!T.intervention.persistToSession)return;let v=pe.get(p);if(v?.backgroundTaskInFlight||v?.oracleInFlight){S("info",`persist skipped (background task in flight) for ${p}`);return}let I=()=>(t.__test_persistSessionMessage??bi)(p,w),P=(F)=>{if(!F.ok)S("warn",`persist intervention failed for ${p}`,{error:F.error});else S("info",`persisted intervention for ${p}`)};if(t.__test_persistSessionMessage){I().then((F)=>{if(!F.ok&&F.error&&/timed out/i.test(F.error)){let V=pe.get(p);if(V?.backgroundTaskInFlight||V?.oracleInFlight){S("info",`persist retry skipped (background task in flight) for ${p}`);return}setTimeout(()=>{I().then(P)},t.__test_persistRetryDelayMs??1500);return}P(F)});return}S("info",`persist intervention (superficial, not queued) for ${p}: ${w.slice(0,200)}`),Oe.inc("interventions_delivered")},Ug=kp((p)=>{try{gi(p,Pg)}catch(w){S("warn","health snapshot write failed",{error:String(w)})}},5000);try{let p=gu(xe,".agents","skills");Ht=await(t.__test_startSkillsFsWatcher??wg)({projectDir:p,onChange:async(v,I)=>{if(I!=="add")return;try{Oe.inc("tier3_skills_created"),S("info",`tier3_skills_created: ${v}`)}catch(P){S("warn",`tier3 watcher onChange failed: ${String(P)}`)}}})}catch(p){S("warn",`tier3 fs watcher failed to start: ${String(p)}`)}return{dispose:async()=>{try{Ui()}catch{}try{Hi()}catch{}try{qr()}catch{}try{It()}catch{}try{if(Ht)await Ht.stop()}catch{}},"tool.execute.before":async(p,w)=>{if(!T.enabled)return;if(!p.sessionID)return;if(T.skillPriming.enabled&&T.skillPriming.enforceMode==="block"&&p.tool!=="omo_skill_find"&&!Gu.has(p.sessionID)&&(Ye.includes(p.tool)||Dg(p))&&!Vf(p.tool,w?.args)){let P=Bf(p.tool,w?.args);throw Error(`[meta-governor] skill-priming required: run \`${P}\` to discover relevant skills before using "${p.tool}". Pass the candidates to a sub-agent via \`task(category='<category>', load_skills=[...])\` to load 2-3 capabilities. Set skillPriming.enforceMode='directive' in your config to bypass this gate, or write to a tmp/test/scratch path for trivial edits.`)}if(!T.protocolEnforcement.auditToolCalls)return;let v=pe.get(p.sessionID);if(!v)v={memoryToolsUsed:[],hasCodegraphDir:n.hasCodegraphDir(r),hasGraphifyDir:n.hasGraphifyDir(r),oracleInvoked:!1,filesChanged:0,emptyRecall:!1,escalationAttempted:!1,recentToolCalls:[],recentWriteContents:[],recentWriteFilePaths:[],memorySaved:!1,accumulatedDeviations:[],recentInterventionTexts:[],batchCompletions:0,taskDoneSignal:!1,phaseCompleteSignal:!1,planCompleteSignal:!1,interventionCount:0,interventionDisabled:!1,lessonCount:0,lastViolationInjectionAtMs:0,iteration:0,oracleInFlight:!1,oracleInFlightSinceMs:null,signalAtMs:0,backgroundTaskInFlight:!1,backgroundTaskInFlightSinceMs:null,backgroundTaskType:null,lastWarnAtMs:0,lastWarnHash:"",recentPwArgsHashes:[],overflowCompactionCount:0,overflowLoopGuardTripped:!1},pe.set(p.sessionID,v);if(v?.oracleInFlight)return;if(Uu)S("info","protocol loaded, system injection ready");let I=Kf(p.tool,w.args,{memoryToolsUsed:v.memoryToolsUsed,hasCodegraphDir:v.hasCodegraphDir,hasGraphifyDir:v.hasGraphifyDir,oracleInvoked:v.oracleInvoked,filesChanged:v.filesChanged,emptyRecall:v.emptyRecall,escalationAttempted:v.escalationAttempted,recentToolCalls:v.recentToolCalls,recentWriteContents:v.recentWriteContents,memorySaved:v.memorySaved,batchCompletions:v.batchCompletions});if(I.length>0){let F=v.lastViolationInjectionAtMs??0;if(F>0&&Date.now()-F<30000){S("info",`violation during cooldown (${Math.round((30000-(Date.now()-F))/1000)}s remaining), skipping queue`);let V=I.map((ie)=>({severity:ie.severity,category:ie.rule,detail:ie.detail,ts:Date.now()}));v.accumulatedDeviations=[...v.accumulatedDeviations,...V].slice(-5)}else{S("warn",`protocol violations on tool ${p.tool}`,I);let V=Wr.get(p.sessionID)?.items??[],ie=new Set;for(let _ of I){let ue=`${_.severity}::${_.rule}::${_.detail}`;if(ie.has(ue))continue;ie.add(ue);let C=`[${_.severity.toUpperCase()}] ${_.rule}: ${_.detail}`;if(!V.includes(C))V.push(C)}Wr.set(p.sessionID,{items:V});let E=I.map((_)=>({severity:_.severity,category:_.rule,detail:_.detail,ts:Date.now()}));v.accumulatedDeviations=[...v.accumulatedDeviations,...E].slice(-5)}}else S("info",`audit OK on tool ${p.tool}`);if((p.tool==="grep"||p.tool==="glob")&&(n.hasCodegraphDir(r)||n.hasGraphifyDir(r))){let P=Gw(p);if(P)n.invoke(r,P,{timeoutMs:5000}).then((F)=>{if(F.result)n.cacheContext(p.sessionID,P,F.result)}).catch((F)=>{S("warn",`graphRetrieval.invoke failed for session ${p.sessionID}: ${String(F)}`)})}},"tool.execute.after":async(p,w)=>{if(!T.enabled)return;if(Oe.inc("tool_calls_observed"),p.sessionID&&(p.tool==="omo_skill_find"||p.tool==="omo_skill_add"||p.tool==="omo_skill_get"||p.tool==="omo_skill_local_link"||p.tool==="omo_skill_semantic_find"||p.tool==="omo_skill_create"))Gu.add(p.sessionID);if(p.sessionID){let C=p.sessionID;if(p.tool==="omo_search"||p.tool==="omo_find"||p.tool==="omo_impact"||p.tool==="omo_path"||p.tool==="omo_explain")Mg.add(C);if(p.tool==="omo_recall"||p.tool==="omo_recall_mcp")Ng.add(C)}Ug.write(hi({version:me,enabled:!0,sessionID:p.sessionID||"__unknown__",snapshot:Oe.getMetrics(),logFilePath:Ne}));try{i.markDelivered({sessionID:p.sessionID,mcpTool:p.tool,mcpArgs:p.args})}catch{}if(Ye.includes(p.tool))Zu.add(p.sessionID);let v=pe.get(p.sessionID);if(v){if(v.iteration++,v.recentToolCalls=[p.tool].concat(v.recentToolCalls).slice(0,20),Ye.includes(p.tool)||Dg(p)){v.filesChanged++;let Z=(w.output??"").slice(0,500);v.recentWriteContents=[Z].concat(v.recentWriteContents).slice(0,3);let N=p.args,re=N?.filePath??N?.path;if(p.tool==="bash"&&(typeof re!=="string"||re.length===0)){let Vt=(p.args?.command??"").match(/(?:>>?)\s*[''"]?([^''"&\s;]+)/);if(Vt)re=Vt[1]}if(typeof re==="string"&&re.length>0)v.recentWriteFilePaths=[re].concat(v.recentWriteFilePaths).slice(0,10)}if(["agentmemory_memory_recall","agentmemory_memory_smart_search","agentmemory_memory_save"].some((Z)=>p.tool.startsWith(Z))&&!v.memoryToolsUsed.includes(p.tool))v.memoryToolsUsed.push(p.tool);if(p.tool.startsWith("agentmemory_memory_save")){let Z=w.output??"";if(Z.includes("saved")||Z.includes("written"))v.memorySaved=!0}if(p.tool==="task"){let Z=w.output??"",N=p.args,re=N?.subagent_type;if(re==="oracle"||/"subagent_type"\s*:\s*"oracle"/.test(Z)){if(v.oracleInvoked=!0,N?.run_in_background===!0)v.oracleInFlight=!0,v.oracleInFlightSinceMs=Date.now()}if(N?.run_in_background===!0&&typeof re==="string")v.backgroundTaskInFlight=!0,v.backgroundTaskInFlightSinceMs=Date.now(),v.backgroundTaskType=re,S("info",`background_task_in_flight: subagent_type=${re} for session ${p.sessionID}`)}let L=(w.output??"").toLowerCase();if(p.tool.includes("recall")&&(L.includes("returned empty")||L.includes("no results")))v.emptyRecall=!0;if(p.tool==="todowrite"&&(w.output??"").includes("completed")){if(((w.output??"").match(/"status":"completed"/g)??[]).length>=3)v.batchCompletions++}let B=[typeof w.output==="string"?w.output:"",typeof p.args==="string"?p.args:""].join(`
251
+ `);if(!v.taskDoneSignal&&Kw(B))v.taskDoneSignal=!0,v.signalAtMs=Date.now(),S("info",`task_done_signal detected (legacy) for session ${p.sessionID}`);if(!v.phaseCompleteSignal&&Xw(B))v.phaseCompleteSignal=!0,v.signalAtMs=Date.now(),S("info",`phase_complete_signal detected for session ${p.sessionID}`);if(!v.planCompleteSignal&&Yw(B))v.planCompleteSignal=!0,v.signalAtMs=Date.now(),S("info",`plan_complete_signal detected for session ${p.sessionID}`);if(v.oracleInFlight){let N=v.oracleInFlightSinceMs!==null&&Date.now()-v.oracleInFlightSinceMs>300000;if(v.oracleInFlightSinceMs!==null&&v.signalAtMs>v.oracleInFlightSinceMs||N)v.oracleInFlight=!1,v.oracleInFlightSinceMs=null,S("info",`oracle_completed: re-enabling intervention for session ${p.sessionID}${N?" (timeout)":""}`);if(p.tool==="task"&&p.args?.subagent_type==="oracle"&&p.args?.run_in_background===!1)v.oracleInFlight=!1,v.oracleInFlightSinceMs=null,S("info",`oracle_completed (foreground call): re-enabling intervention for session ${p.sessionID}`)}if(v.backgroundTaskInFlight){if(v.backgroundTaskInFlightSinceMs!==null&&Date.now()-v.backgroundTaskInFlightSinceMs>300000)v.backgroundTaskInFlight=!1,v.backgroundTaskInFlightSinceMs=null,v.backgroundTaskType=null,S("info",`background_task_timed_out: re-enabling intervention for session ${p.sessionID}`)}}if(T.postWave?.enabled){let C=T.postWave,H=[typeof w.output==="string"?w.output:"",typeof p.args==="string"?p.args:""].join(`
252
+ `),L=Qw(H),B=p.tool==="task"&&/"subagent_type"\s*:\s*"oracle"/.test(H);if(L!==null||B){let Z=pe.get(p.sessionID);if(Z){let Ze=Og(H);if(Z.recentPwArgsHashes.includes(Ze)){if(L===null&&B)S("info",`post_wave_dedupe: skipping re-detection of identical Oracle-call text for session ${p.sessionID}`)}else Z.recentPwArgsHashes=[Ze,...Z.recentPwArgsHashes].slice(0,8)}let N=Wu.get(p.sessionID);if(!N)N=jg(),Wu.set(p.sessionID,N);if(L!==null&&L!==N.currentWaveN)N.currentWaveN=L,N.postWaveInjectionsThisWave=0;if(B&&N.currentWaveN!==null){if(!(Z!==void 0&&Z.recentPwArgsHashes.slice(1).includes(Og(H))))N.oracleAfterPhaseAtMs[N.currentWaveN]=Date.now()}let re=Date.now();if(ex({postWave:N},C,re)){let Ze=N.repoModeResolved??nx(C.repoMode??"auto",xe);N.repoModeResolved=Ze;let Vt=Ze==="third-party"?rx(C.thirdPartyDirective,N.currentWaveN,C.aasToolPrefix):tx(C.ownRepoDirective,N.currentWaveN);N.lastInjectedWaveN=N.currentWaveN,N.lastInjectedAtMs=re,N.postWaveInjectionsThisWave++,Rp(p.sessionID,Vt).then((Hr)=>{if(!Hr.ok)S("info",`post-wave directive delivery failed for ${p.sessionID}: ${Hr.error??"unknown"}`)})}}}if(v?.interventionDisabled)return;let P=(v?.recentToolCalls??[]).slice(0,5).filter((C)=>["write","edit","edit_block","desktop-commander_write_file","desktop-commander_edit_block","task"].includes(C)),F=v?!(v.oracleInFlight||v.backgroundTaskInFlight)&&P.length===0:!1,V=v?.accumulatedDeviations??[],ie=Lf(p.sessionID),E=Ed(ie),_={sessionID:p.sessionID,toolName:p.tool,toolOutput:w.output,consecutiveStops:E,iteration:v?.iteration??0,maxIterations:T.closedLoop.maxLessonsPerSession??10,oracleVerified:v?.oracleInvoked??!1,noProgress:F,filesChanged:v?.filesChanged??0,recentTurnTokens:[],deviations:V,filePaths:v?.recentWriteFilePaths??[],...(()=>{let{backends:C,writeBackend:H}=t;if(C&&H)return{backends:C,writeBackend:H};try{let L=nn();return{backends:C??{agentmemory:L,boulderState:L},writeBackend:H??L}}catch{return{backends:C??{agentmemory:{smartSearch:async()=>({lessons:[],crystals:[]})},boulderState:{boulderRead:async()=>[]}},writeBackend:H??{saveMemory:async()=>({id:""}),saveLesson:async()=>({id:""})}}}})(),config:T,...zi()?{providerID:zi()}:{},...Ci()?{modelID:Ci()}:{},modelLimit:Cg(),currentLessonCount:v?.lessonCount??0},ue;try{if(ue=await Md(_),ue.lessonSaved?.lessonSaved&&v)v.lessonCount++;if(ue.decision.action!=="continue")Oe.inc("decisions_taken");if(ue.decision.action==="escalate"&&p.sessionID&&Ur()){let C=pe.get(p.sessionID)??v;if(C?.backgroundTaskInFlight||C?.oracleInFlight)S("info",`escalation prompt skipped (background task in flight) for ${p.sessionID}`);else{let H=ue.decision.historyEntry.decision,L=H.evidence.length,B=H.shouldEscalateTo;if(!B){S("info",`escalation suppressed by oracle.frequency for ${p.sessionID} (action=${H.action})`);return}let Z=Cp({reasoning:H.reasoning,target:B,evidenceCount:L,sessionID:p.sessionID});setTimeout(()=>{wt(p.sessionID,{toolName:"meta_governor_escalate",mcpTool:"task",mcpArgs:{subagent_type:B},preamble:Z}).catch((N)=>{S("warn",`escalation prompt failed: ${String(N)}`)})},250)}}if(T.intervention.mode!=="silent"&&v){let C=ue.decision;if(v.oracleInFlight||v.backgroundTaskInFlight){let L=v.oracleInFlight?"oracle_in_flight":"background_task_in_flight";S("info",`${L}: skipping intervention for session ${p.sessionID} (score ${ue.scoringResult.rawScore.toFixed(2)})`);return}let H=T.intervention.phaseAwareDoneSignal===!0;if(T.intervention.respectDoneSignal&&v.oracleInvoked&&(v.planCompleteSignal||!H&&(v.taskDoneSignal||v.phaseCompleteSignal))){v.interventionDisabled=!0;let L=v.planCompleteSignal?"PLAN-COMPLETE":v.taskDoneSignal?"DONE":"PHASE-N-COMPLETE";S("info",`task verified (${L} + Oracle): disabling intervention for session ${p.sessionID}`),Ft(p.sessionID);return}if(C.action!=="continue"&&Tg(C.action,T.intervention.minActionForMessage)){let L=Math.max(0,T.intervention.maxInterventionsPerSession??0);if(L>0&&v.interventionCount>=L){v.interventionDisabled=!0,S("warn",`intervention cap (${L}) reached for session ${p.sessionID}; disabling further intervention`),Ft(p.sessionID);return}let B=60000,Z=Date.now(),N=C.historyEntry?.reasoning??C.message??"",re=`${C.action}::${N.slice(0,80)}`;if((C.action==="warn"||C.action==="escalate")&&v.lastWarnHash===re&&v.lastWarnAtMs>0&&Z-v.lastWarnAtMs<B){S("info",`warn_cooldown: suppressing duplicate ${C.action} (${Math.round((B-(Z-v.lastWarnAtMs))/1000)}s remaining) for session ${p.sessionID}`),Ft(p.sessionID);return}if(v.interventionCount++,C.action==="warn"||C.action==="escalate")v.lastWarnAtMs=Z,v.lastWarnHash=re}}}catch{}if(ue&&ue.decision&&ue.decision.action!=="continue")eu(p.sessionID,ue.decision);try{if(p.tool==="bash"){let H=p.args?.command;if(Vi(H))S("info","git_commit_reindex_triggered",{sessionID:p.sessionID,command:H}),t.__test_onCommitTrigger?.({projectDir:xe,command:H??"",sessionID:p.sessionID}),Bi(xe).catch((L)=>{S("warn",`codegraph sync failed: ${String(L)}`)})}}catch{}try{if(p.tool==="bash"){let H=p.args?.command;if(Ww(H)){let L=Zw(w.output,p.sessionID);if(L.length>0){let B=$t.get(p.sessionID)?.items??[];$t.set(p.sessionID,{items:B.concat(L)}),S("info",`captured ${L.length} bot feedback line(s) for session ${p.sessionID}`)}}}}catch{}try{let C=p.args?.command;if(p.tool==="bash"&&Hw(C)){let H=T.ciMonitor;if(H?.enabled){let L=Vw(r),B=Bw(r);if(L&&B)S("info",`ci_monitor: git push detected on ${B}@${L.slice(0,7)} — starting background poll`),qw(L,B,H,p.sessionID).catch((Z)=>{S("warn",`ci_monitor: background poll failed: ${Z instanceof Error?Z.message:String(Z)}`)})}}}catch{}},"experimental.chat.messages.transform":async(p,w)=>{if(!T.enabled)return;let I=w.messages[w.messages.length-1]?.info?.sessionID;if(!I)return;let P=pe.get(I);if(T.skillPriming.enabled&&!Fu.has(I)&&Hf({trigger:T.skillPriming.trigger,recentToolCalls:P?.recentToolCalls??[],implementationToolSeen:Zu.has(I)})){Fu.add(I);let te=Zf(T.skillPriming.router);if(Ag.set(I,te),!Xe(w.messages))w.messages.push({info:{role:"assistant",agent:"meta-governor",synthetic:!0},parts:[{type:"text",text:te,synthetic:!0}]});S("info",`skill_priming_injected for session ${I}`),St(I,Wf(T.skillPriming.router))}if(Zr.has(xe)&&!Nu.has(I)){let te=["[META-GOVERNOR] codegraph y graphify ya están inicializados en este repo. ","ROUTING EXPLÍCITO (v0.25.0): ","• Símbolos/definiciones/callers/impacto (código) → CODEGRAPH: omo_find, omo_impact, omo_search. ","• Conceptos/arquitectura/conexiones/explicaciones → GRAPHIFY: omo_path, omo_explain (y omo_search en modo alternate). ","• Vista general del repo → lee graphify-out/GRAPH_REPORT.md. ","Actualizan tras cada commit."].join(" ");if(!Xe(w.messages)){Nu.add(I);let de=ct(te,{kind:"graph-priming"});w.messages.push({info:{role:"assistant",agent:"meta-governor",synthetic:!0},parts:[{type:"text",text:de,synthetic:!0}]})}S("info",`graph_tools_ready_injected for session ${I}`),St(I,te)}let F=$t.get(I);if(F){let te=F.items;if(te.length>0){let de=`[MetaGovernor PR Reviewer Feedback]
253
+
254
+ ${te.map((De,Me)=>`${Me+1}. ${De}`).join(`
255
255
  `)}
256
256
 
257
- Apply these fixes to keep the PR mergeable.`;if(!Xe(k.messages)){let De=ct(de,{kind:"postwave"});k.messages.push({info:{role:"assistant",agent:"meta-governor",synthetic:!0},parts:[{type:"text",text:De,synthetic:!0}]}),$t.delete(S)}x("info",`injected ${te.length} bot feedback line(s) to model for session ${S}`),St(S,de)}}if(I.intervention.mode!=="message")return;if(D?.interventionDisabled){Ft(S);return}if(D&&!Lu.has(S)&&!D.backgroundTaskInFlight&&!D.oracleInFlight&&Ww(xe,D.interventionCount)){if(!Xe(k.messages)){Lu.add(S);let de=ct("[MetaGovernor] Before any code change, create PLAN.md or a `## Plan` section in AGENTS.md that enumerates the phases. After each phase, commit (local + fork + upstream). Each commit triggers automatic reindex via the graphify post-commit hook + `codegraph sync`.",{kind:"postwave"});k.messages.push({info:{role:"assistant",agent:"meta-governor",synthetic:!0},parts:[{type:"text",text:de,synthetic:!0}]})}x("info",`plan_reminder_injected for session ${S}`),St(S,"[MetaGovernor] Before any code change, create PLAN.md or a `## Plan` section in AGENTS.md that enumerates the phases. After each phase, commit (local + fork + upstream). Each commit triggers automatic reindex via the graphify post-commit hook + `codegraph sync`.")}let V=Wr.get(S);if(!Boolean(D?.backgroundTaskInFlight||D?.oracleInFlight)&&V){let te=V.items;if(te.length>0){let de=`[META-GOVERNOR PROTOCOL VIOLATIONS - YOU MUST COMPLY]
257
+ Apply these fixes to keep the PR mergeable.`;if(!Xe(w.messages)){let De=ct(de,{kind:"postwave"});w.messages.push({info:{role:"assistant",agent:"meta-governor",synthetic:!0},parts:[{type:"text",text:De,synthetic:!0}]}),$t.delete(I)}S("info",`injected ${te.length} bot feedback line(s) to model for session ${I}`),St(I,de)}}if(T.intervention.mode!=="message")return;if(P?.interventionDisabled){Ft(I);return}if(P&&!Lu.has(I)&&!P.backgroundTaskInFlight&&!P.oracleInFlight&&Jw(xe,P.interventionCount)){if(!Xe(w.messages)){Lu.add(I);let de=ct("[MetaGovernor] Before any code change, create PLAN.md or a `## Plan` section in AGENTS.md that enumerates the phases. After each phase, commit (local + fork + upstream). Each commit triggers automatic reindex via the graphify post-commit hook + `codegraph sync`.",{kind:"postwave"});w.messages.push({info:{role:"assistant",agent:"meta-governor",synthetic:!0},parts:[{type:"text",text:de,synthetic:!0}]})}S("info",`plan_reminder_injected for session ${I}`),St(I,"[MetaGovernor] Before any code change, create PLAN.md or a `## Plan` section in AGENTS.md that enumerates the phases. After each phase, commit (local + fork + upstream). Each commit triggers automatic reindex via the graphify post-commit hook + `codegraph sync`.")}let V=Wr.get(I);if(!Boolean(P?.backgroundTaskInFlight||P?.oracleInFlight)&&V){let te=V.items;if(te.length>0){let de=`[META-GOVERNOR PROTOCOL VIOLATIONS - YOU MUST COMPLY]
258
258
 
259
- ${te.map((Ae,ut)=>`${ut+1}. ${Ae}`).join(`
259
+ ${te.map((Me,ut)=>`${ut+1}. ${Me}`).join(`
260
260
  `)}
261
261
 
262
- Remember: use codegraph/graphify for architecture queries, do not grep without trying codegraph/graphify first, no @ts-ignore/as-any, no empty catch, check memory before asking.`;if(!Xe(k.messages)){Wr.delete(S);let Ae=ct(de,{kind:"enforcement"});k.messages.push({info:{role:"assistant",agent:"meta-governor",synthetic:!0},parts:[{type:"text",text:Ae,synthetic:!0}]}),x("info",`violations injected for ${S}: ${te.length} item(s)`,te)}St(S,de);let De=pe.get(S);if(De)De.lastViolationInjectionAtMs=Date.now()}}let O=Uf(S);if(!O)return;if(O.action==="continue")return;if(!O.message)return;if(!Sg(O.action,I.intervention.minActionForMessage))return;let F=D??pe.get(S);if(!F)F={memoryToolsUsed:[],hasCodegraphDir:n.hasCodegraphDir(r),hasGraphifyDir:n.hasGraphifyDir(r),oracleInvoked:!1,filesChanged:0,emptyRecall:!1,escalationAttempted:!1,recentToolCalls:[],recentWriteContents:[],recentWriteFilePaths:[],memorySaved:!1,accumulatedDeviations:[],recentInterventionTexts:[],batchCompletions:0,taskDoneSignal:!1,phaseCompleteSignal:!1,planCompleteSignal:!1,interventionCount:0,interventionDisabled:!1,lessonCount:0,iteration:0,oracleInFlight:!1,oracleInFlightSinceMs:null,signalAtMs:0,lastViolationInjectionAtMs:0,backgroundTaskInFlight:!1,backgroundTaskInFlightSinceMs:null,backgroundTaskType:null,lastWarnAtMs:0,lastWarnHash:"",recentPwArgsHashes:[],overflowCompactionCount:0,overflowLoopGuardTripped:!1},pe.set(S,F);let ue=Math.max(0,I.intervention.maxInterventionsPerSession??0);if(ue>0&&F.interventionCount>=ue){F.interventionDisabled=!0;return}if(F.backgroundTaskInFlight||F.oracleInFlight){x("info",`decision injection suppressed (background task in flight) for ${S}`);try{eu(S,O)}catch{}return}let z=I.intervention.includeDecisionHistory!==!1,H=I.intervention.maxHistoryMessages??5,U=(F.recentInterventionTexts??[]).slice(-H),B=[];for(let te of U)if(B.length===0||B[B.length-1]!==te)B.push(te);let G=Math.max(H,B.length),A=`[MetaGovernor] ${O.message}`;if(z&&B.length>0)A=`[MetaGovernor] Recent decisions in this session:
262
+ Remember: use codegraph/graphify for architecture queries, do not grep without trying codegraph/graphify first, no @ts-ignore/as-any, no empty catch, check memory before asking.`;if(!Xe(w.messages)){Wr.delete(I);let Me=ct(de,{kind:"enforcement"});w.messages.push({info:{role:"assistant",agent:"meta-governor",synthetic:!0},parts:[{type:"text",text:Me,synthetic:!0}]}),S("info",`violations injected for ${I}: ${te.length} item(s)`,te)}St(I,de);let De=pe.get(I);if(De)De.lastViolationInjectionAtMs=Date.now()}}let E=Uf(I);if(!E)return;if(E.action==="continue")return;if(!E.message)return;if(!Tg(E.action,T.intervention.minActionForMessage))return;let _=P??pe.get(I);if(!_)_={memoryToolsUsed:[],hasCodegraphDir:n.hasCodegraphDir(r),hasGraphifyDir:n.hasGraphifyDir(r),oracleInvoked:!1,filesChanged:0,emptyRecall:!1,escalationAttempted:!1,recentToolCalls:[],recentWriteContents:[],recentWriteFilePaths:[],memorySaved:!1,accumulatedDeviations:[],recentInterventionTexts:[],batchCompletions:0,taskDoneSignal:!1,phaseCompleteSignal:!1,planCompleteSignal:!1,interventionCount:0,interventionDisabled:!1,lessonCount:0,iteration:0,oracleInFlight:!1,oracleInFlightSinceMs:null,signalAtMs:0,lastViolationInjectionAtMs:0,backgroundTaskInFlight:!1,backgroundTaskInFlightSinceMs:null,backgroundTaskType:null,lastWarnAtMs:0,lastWarnHash:"",recentPwArgsHashes:[],overflowCompactionCount:0,overflowLoopGuardTripped:!1},pe.set(I,_);let ue=Math.max(0,T.intervention.maxInterventionsPerSession??0);if(ue>0&&_.interventionCount>=ue){_.interventionDisabled=!0;return}if(_.backgroundTaskInFlight||_.oracleInFlight){S("info",`decision injection suppressed (background task in flight) for ${I}`);try{eu(I,E)}catch{}return}let C=T.intervention.includeDecisionHistory!==!1,H=T.intervention.maxHistoryMessages??5,L=(_.recentInterventionTexts??[]).slice(-H),B=[];for(let te of L)if(B.length===0||B[B.length-1]!==te)B.push(te);let Z=Math.max(H,B.length),N=`[MetaGovernor] ${E.message}`;if(C&&B.length>0)N=`[MetaGovernor] Recent decisions in this session:
263
263
  ${B.map((de,De)=>`${De+1}. ${de}`).join(`
264
264
  `)}
265
265
 
266
266
  ---
267
267
 
268
- Current decision: ${O.message}`;let re=`[${O.action}] ${O.message}`;if(F.recentInterventionTexts?.slice(-1)[0]!==re)F.recentInterventionTexts=[...F.recentInterventionTexts??[],re].slice(-G);let Hr={type:"text",text:ct(A,{kind:"intervention"}),synthetic:!0};if(!Xe(k.messages))Ft(S),F.interventionCount++,k.messages.push({info:{role:"assistant",agent:"meta-governor",synthetic:!0},parts:[Hr]});St(S,A);try{if((O.action==="warn"||O.action==="escalate"||O.action==="stop")&&Ao(S)&&!Xe(k.messages)){let de=`MetaGovernor ${O.action}: ${O.message} (reasoning: ${O.historyEntry?.reasoning??O.message})`,De="Please call the `agentmemory_memory_save` MCP tool with EXACTLY these args:\n\n```json\n"+JSON.stringify({content:de,concepts:["metagovernor",O.action]},null,2)+"\n```\n\nDo not paraphrase, modify, or add fields. Pass the args through verbatim.";if(typeof t.__test_autoRemember==="function")try{t.__test_autoRemember({sessionID:S,decision:O,promptText:De})}catch{}else setTimeout(()=>{wt(S,{toolName:"omo_remember",mcpTool:"agentmemory_memory_save",mcpArgs:{content:de,concepts:["metagovernor",O.action]},preamble:"MetaGovernor auto-remember: notable decision — remember WHY this intervention fired."}).catch((Ae)=>{x("warn","auto-remember promptAgent failed: "+String(Ae))})},0);x("info",`auto-remember queued for ${S}: ${O.action}`)}}catch{}if(I.enabled&&F&&Ao(S)&&!Xe(k.messages)&&(O.action==="escalate"||O.action==="stop")&&!F.backgroundTaskInFlight&&!F.oracleInFlight&&(F.lastReflectionAtMs===void 0||Date.now()-F.lastReflectionAtMs>300000)){F.lastReflectionAtMs=Date.now(),Oe.inc("reflections_triggered");let te=O.historyEntry?.reasoning??O.message,de=F.accumulatedDeviations.slice(-3),De=de.length>0?de.map((ut)=>` - [${ut.severity}] ${ut.category}: ${ut.detail.slice(0,200)}`).join(`
269
- `):" (none recorded)",Ae=["[omo-meta-governor audit - self-reflection required]","",`Recent decision: ${O.action} (score ${(O.historyEntry?.decision?.score??0).toFixed(2)})`,`Reasoning: ${te.slice(0,400)}`,`Message: ${O.message.slice(0,400)}`,`Tool calls so far: ${F.iteration}`,"","Recent protocol violations (if any):",De,"","You are being audited by omo-meta-governor v"+me+". As a senior engineer,","review what you have just done and answer these questions honestly:"," 1. What is going wrong or inefficiently?"," 2. Are you stuck in a loop? Cite specific evidence."," 3. What is the correct path forward to complete the user's task?","","Be specific and actionable. If you should stop or pivot, say so clearly."].join(`
270
- `);if(typeof t.__test_reflectionPrompt==="function")try{t.__test_reflectionPrompt({sessionID:S,text:Ae})}catch{}else setTimeout(()=>{wt(S,{toolName:"omo_reflection",mcpTool:"session.prompt",mcpArgs:{parts:[{type:"text",text:Ae}]},preamble:"omo-meta-governor audit: senior-engineer self-reflection required."}).catch((ut)=>{x("warn","reflection promptAgent failed: "+String(ut))})},0)}},event:async(p)=>{if(!I.enabled)return;let k=p.event,v=k?.type??"";if(v==="tool.execute.before"||v==="tool.execute.after"){Oe.inc("tool_calls_observed");let S=k?.properties??{},D=String(S.tool??""),L=String(S.sessionID??S.sessionId??"");if(L&&D){let V=pe.get(L)??null;if(V){let oe=V.recentToolCalls.indexOf(D);if(oe>=0)V.recentToolCalls.splice(oe,1);if(V.recentToolCalls.push(D),V.recentToolCalls.length>20)V.recentToolCalls.splice(0,V.recentToolCalls.length-20)}if(v==="tool.execute.after")Oe.inc("orchestrator_runs")}}},"permission.ask":async(p,k)=>{if(!I.enabled)return;await Rf(p,k,I.governance?.permissionPolicy??{},Oe)},"tool.definition":async(p,k)=>{if(!I.enabled)return;await zf(p,k,I.governance?.toolRewrite??{},Oe)},"command.execute.before":async(p,k)=>{if(!I.enabled)return;await Cf(p,k,I.governance?.commandFilter??{},Oe)},"experimental.provider.small_model":async(p,k)=>{if(!I.enabled)return;await Mf(p,k,I.governance?.smallModelOverride??{})},tool:{omo_search:s,omo_recall:a,omo_health:l,omo_find:c,omo_impact:u,omo_remember:f,omo_recall_mcp:g,omo_path:d,omo_explain:b,omo_files:w,omo_callers:M,omo_node:j,omo_context:K,omo_affected_cg:W,omo_status:ae,omo_unlock:Te,omo_mark_dirty:Gt,omo_sync_if_dirty:hu,omo_index:vu,omo_visualize:yu,omo_serve:bu,omo_uninit:_u,omo_diagnose:ku,omo_merge_graphs:wu,omo_save_result:xu,omo_extract:$u,omo_cluster_only:Su,omo_label:Iu,omo_tree:Tu,omo_clone:Du,omo_add:Pu,omo_check_update:Ou,omo_hook_status:Eu,omo_cli_anything_install:Ru,omo_cli_anything_list:zu,omo_cli_anything_search:Cu,omo_cli_anything_info:Mu},"experimental.session.compacting":async(p,k)=>{if(!I.enabled||!I.closedLoop.enabled)return;let v=nn(),S=`session:${p.sessionID}`,D=await v.smartSearch({query:S,limit:3});if(D.lessons.length>0){let L=D.lessons.map((V,oe)=>`${oe+1}. [${V.id}] confidence=${V.confidence.toFixed(2)}
268
+ Current decision: ${E.message}`;let re=`[${E.action}] ${E.message}`;if(_.recentInterventionTexts?.slice(-1)[0]!==re)_.recentInterventionTexts=[..._.recentInterventionTexts??[],re].slice(-Z);let Hr={type:"text",text:ct(N,{kind:"intervention"}),synthetic:!0};if(!Xe(w.messages))Ft(I),_.interventionCount++,w.messages.push({info:{role:"assistant",agent:"meta-governor",synthetic:!0},parts:[Hr]});St(I,N);try{if((E.action==="warn"||E.action==="escalate"||E.action==="stop")&&Ai(I)&&!Xe(w.messages)){let de=`MetaGovernor ${E.action}: ${E.message} (reasoning: ${E.historyEntry?.reasoning??E.message})`,De="Please call the `agentmemory_memory_save` MCP tool with EXACTLY these args:\n\n```json\n"+JSON.stringify({content:de,concepts:["metagovernor",E.action]},null,2)+"\n```\n\nDo not paraphrase, modify, or add fields. Pass the args through verbatim.";if(typeof t.__test_autoRemember==="function")try{t.__test_autoRemember({sessionID:I,decision:E,promptText:De})}catch{}else setTimeout(()=>{wt(I,{toolName:"omo_remember",mcpTool:"agentmemory_memory_save",mcpArgs:{content:de,concepts:["metagovernor",E.action]},preamble:"MetaGovernor auto-remember: notable decision — remember WHY this intervention fired."}).catch((Me)=>{S("warn","auto-remember promptAgent failed: "+String(Me))})},0);S("info",`auto-remember queued for ${I}: ${E.action}`)}}catch{}if(T.enabled&&_&&Ai(I)&&!Xe(w.messages)&&(E.action==="escalate"||E.action==="stop")&&!_.backgroundTaskInFlight&&!_.oracleInFlight&&(_.lastReflectionAtMs===void 0||Date.now()-_.lastReflectionAtMs>300000)){_.lastReflectionAtMs=Date.now(),Oe.inc("reflections_triggered");let te=E.historyEntry?.reasoning??E.message,de=_.accumulatedDeviations.slice(-3),De=de.length>0?de.map((ut)=>` - [${ut.severity}] ${ut.category}: ${ut.detail.slice(0,200)}`).join(`
269
+ `):" (none recorded)",Me=["[omo-meta-governor audit - self-reflection required]","",`Recent decision: ${E.action} (score ${(E.historyEntry?.decision?.score??0).toFixed(2)})`,`Reasoning: ${te.slice(0,400)}`,`Message: ${E.message.slice(0,400)}`,`Tool calls so far: ${_.iteration}`,"","Recent protocol violations (if any):",De,"","You are being audited by omo-meta-governor v"+me+". As a senior engineer,","review what you have just done and answer these questions honestly:"," 1. What is going wrong or inefficiently?"," 2. Are you stuck in a loop? Cite specific evidence."," 3. What is the correct path forward to complete the user's task?","","Be specific and actionable. If you should stop or pivot, say so clearly."].join(`
270
+ `);if(typeof t.__test_reflectionPrompt==="function")try{t.__test_reflectionPrompt({sessionID:I,text:Me})}catch{}else setTimeout(()=>{wt(I,{toolName:"omo_reflection",mcpTool:"session.prompt",mcpArgs:{parts:[{type:"text",text:Me}]},preamble:"omo-meta-governor audit: senior-engineer self-reflection required."}).catch((ut)=>{S("warn","reflection promptAgent failed: "+String(ut))})},0)}},event:async(p)=>{if(!T.enabled)return;let w=p.event,v=w?.type??"";if(v==="tool.execute.before"||v==="tool.execute.after"){Oe.inc("tool_calls_observed");let I=w?.properties??{},P=String(I.tool??""),F=String(I.sessionID??I.sessionId??"");if(F&&P){let V=pe.get(F)??null;if(V){let ie=V.recentToolCalls.indexOf(P);if(ie>=0)V.recentToolCalls.splice(ie,1);if(V.recentToolCalls.push(P),V.recentToolCalls.length>20)V.recentToolCalls.splice(0,V.recentToolCalls.length-20)}if(v==="tool.execute.after")Oe.inc("orchestrator_runs")}}},"permission.ask":async(p,w)=>{if(!T.enabled)return;await Rf(p,w,T.governance?.permissionPolicy??{},Oe)},"tool.definition":async(p,w)=>{if(!T.enabled)return;await zf(p,w,T.governance?.toolRewrite??{},Oe)},"command.execute.before":async(p,w)=>{if(!T.enabled)return;await Cf(p,w,T.governance?.commandFilter??{},Oe)},"experimental.provider.small_model":async(p,w)=>{if(!T.enabled)return;await Af(p,w,T.governance?.smallModelOverride??{})},tool:{omo_search:s,omo_recall:a,omo_health:l,omo_find:c,omo_impact:u,omo_remember:f,omo_recall_mcp:g,omo_path:d,omo_explain:b,omo_files:x,omo_callers:M,omo_node:U,omo_context:K,omo_affected_cg:W,omo_status:ae,omo_unlock:Te,omo_mark_dirty:Zt,omo_sync_if_dirty:hu,omo_index:vu,omo_visualize:yu,omo_serve:bu,omo_uninit:_u,omo_diagnose:ku,omo_merge_graphs:wu,omo_save_result:xu,omo_extract:$u,omo_cluster_only:Su,omo_label:Iu,omo_tree:Tu,omo_clone:Du,omo_add:Pu,omo_check_update:Ou,omo_hook_status:Eu,omo_cli_anything_install:Ru,omo_cli_anything_list:zu,omo_cli_anything_search:Cu,omo_cli_anything_info:Au},"experimental.session.compacting":async(p,w)=>{if(!T.enabled||!T.closedLoop.enabled)return;let v=nn(),I=`session:${p.sessionID}`,P=await v.smartSearch({query:I,limit:3});if(P.lessons.length>0){let F=P.lessons.map((V,ie)=>`${ie+1}. [${V.id}] confidence=${V.confidence.toFixed(2)}
271
271
  ${V.content.slice(0,300)}`).join(`
272
272
 
273
- `);k.context.push(`
274
- ### Past Lessons (auto-retrieved)`,L,"---")}},"experimental.chat.system.transform":async(p,k)=>{if(!I.enabled)return;let v=p.sessionID;if(!v)return;let S=pe.get(v);if(!S)return;let D=[];D.push("[omo-meta-governor audit] v"+me+" runtime governance active"),D.push("");let L=S.accumulatedDeviations.slice(-5);if(L.length>0){D.push("RECENT PROTOCOL VIOLATIONS (most recent first):");for(let O of L.slice().reverse())D.push(` - [${O.severity}] ${O.category}: ${O.detail.slice(0,200)}`);D.push("")}let oe=(S.recentDecisions??[]).filter((O)=>O.action!=="continue").slice(-3);if(oe.length>0){D.push("RECENT DECISIONS (non-continue):");for(let O of oe.slice().reverse())D.push(` - [${O.action}] score=${O.score.toFixed(2)} reasoning=${(O.reasoning??"").slice(0,200)}`);D.push("")}if(L.length===0&&oe.length===0)D.push("No violations or non-continue decisions in this session yet."),D.push("Continue to use tools; the auditor will surface issues here.");k.system.push(D.join(`
275
- `))},"experimental.compaction.autocontinue":async(p,k)=>{if(!I.enabled)return;let{sessionID:v,overflow:S}=p,D=pe.get(v);if(!D)D={memoryToolsUsed:[],hasCodegraphDir:!1,hasGraphifyDir:!1,oracleInvoked:!1,filesChanged:0,emptyRecall:!1,escalationAttempted:!1,recentToolCalls:[],recentWriteContents:[],recentWriteFilePaths:[],memorySaved:!1,accumulatedDeviations:[],recentInterventionTexts:[],batchCompletions:0,taskDoneSignal:!1,phaseCompleteSignal:!1,planCompleteSignal:!1,interventionCount:0,interventionDisabled:!1,lessonCount:0,iteration:0,oracleInFlight:!1,oracleInFlightSinceMs:null,signalAtMs:0,lastViolationInjectionAtMs:0,backgroundTaskInFlight:!1,backgroundTaskInFlightSinceMs:null,backgroundTaskType:null,lastWarnAtMs:0,lastWarnHash:"",recentPwArgsHashes:[],overflowCompactionCount:0,overflowLoopGuardTripped:!1},pe.set(v,D);if(D.interventionDisabled){k.enabled=!1;return}let L=I.intervention.compactionLoopGuard;if(L.enabled)if(S){if(D.overflowCompactionCount++,!D.overflowLoopGuardTripped&&D.overflowCompactionCount>L.maxOverflowRecoveries){D.overflowLoopGuardTripped=!0,D.interventionDisabled=!0,k.enabled=!1,x("warn",`compaction_loop_guard_tripped for session ${v}: ${D.overflowCompactionCount} consecutive overflow compactions; autocontinue disabled and guidance queued`);let V=$t.get(v),oe=`[META-GOVERNOR] Overflow compaction loop detected (${D.overflowCompactionCount} consecutive overflow compactions). opencode issue #27924 is in play. Auto-continue is now disabled for this session. Resume your pending tasks using the existing context do NOT regenerate context you have already produced.`;$t.set(v,{items:(V?.items??[]).concat(oe)})}}else D.overflowCompactionCount=0}}}}function jw(e,t){if(typeof e!=="string"||e.length===0)return[];let n=e.split(`
276
- `),o=[];for(let r of n){let i=r.match(/^\s*(\S+)\s+(fail)\s+(.*)$/);if(i){let s=i[1].trim(),a=i[3].trim();o.push(`${t} · ${s}: ${a}`)}}return o}function Uw(e){if(typeof e!=="string"||e.length===0)return!1;let t=e.replace(/\\\n/g," ").replace(/\s*\n\s*/g," ");return/(?:^|[\s;&|])gh\s+pr(?:\s|$)/.test(t)}function Lw(e){if(typeof e!=="string"||e.length===0)return!1;let t=e.replace(/\\\n/g," ").replace(/\s*\n\s*/g," ");return/(?:^|[\s;&|])git\s+push(?:\s|$)/.test(t)}function Fw(e){try{return Pg("git",["rev-parse","HEAD"],{cwd:e,encoding:"utf-8",timeout:5000,stdio:["ignore","pipe","pipe"],windowsHide:!0}).toString().trim()||null}catch{return null}}function Zw(e){try{let n=Pg("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:e,encoding:"utf-8",timeout:5000,stdio:["ignore","pipe","pipe"],windowsHide:!0}).toString().trim();return n&&n!=="HEAD"?n:null}catch{return null}}var pu=new Map;async function Gw(e,t,n,o){let r=await Promise.resolve().then(() => (xg(),{})),i=pu.get(o)??{lastPolledSha:null,lastFailureInjectionAtMs:0,pending:new Set};i.pending.add(e),pu.set(o,i);try{Ow(n.workflow,t);let s=Date.now(),a=null;while(Date.now()-s<n.maxWaitMs){if(a=Pw(e),!a){await new Promise((l)=>setTimeout(l,n.pollIntervalMs));continue}if(a.status==="completed")break;await new Promise((l)=>setTimeout(l,n.pollIntervalMs))}if(!a||a.status!=="completed"){x("warn",`ci_monitor: timeout waiting for run on ${e.slice(0,7)} (${n.maxWaitMs}ms)`);return}if(i.lastPolledSha=e,a.conclusion==="failure"){let l=Date.now();if(l-i.lastFailureInjectionAtMs<60000)return;i.lastFailureInjectionAtMs=l;let c=Ew(a.databaseId,4000),u=[`[CI Monitor] GitHub Actions run #${a.databaseId} FAILED on ${t}@${e.slice(0,7)}.`,"",`Title: ${a.displayTitle}`,`URL: ${a.url}`,`Conclusion: ${a.conclusion}`,"","── FAILED-STEP LOGS (truncated) ──",c||"(no failed-log output available — run `gh run view "+a.databaseId+" --log-failed` for full output)","","── ACTION ──",n.failOnly?"Read the failed logs above, identify which tests broke, run them locally to reproduce, fix, and re-push. Use `bun run typecheck` first (fastest signal), then run only the failing test files.":"Review the run and take action."].join(`
277
- `);x("warn",`ci_monitor: CI failed for ${e.slice(0,7)} — ${a.url}`);let f=await Promise.resolve().then(() => (ko(),{})),g=await _o(o,u,1e4);if(!g.ok)x("warn",`ci_monitor: failed to inject failure message: ${g.error??"unknown"}`)}else if(a.conclusion==="success")x("info",`ci_monitor: run #${a.databaseId} passed for ${e.slice(0,7)}`);else x("info",`ci_monitor: run #${a.databaseId} conclusion=${a.conclusion} for ${e.slice(0,7)}`)}finally{i.pending.delete(e),pu.set(o,i)}}function Ww(e,t){if(t>=1)return!1;try{return Mw(gu(e,"PLAN.md")),!1}catch{}try{let n=fu(gu(e,"AGENTS.md"),"utf-8");if(/^##\s+Plan\b/im.test(n))return!1}catch{}return!0}function Hw(e){if(typeof e!=="string"||e.length===0)return!1;return/<promise>\s*DONE!?\s*<\/promise>/i.test(e)}function Vw(e){if(typeof e!=="string"||e.length===0)return!1;return/<promise>\s*DONE!?\s*<\/promise>/i.test(e)||/<promise>\s*PHASE-\d+-COMPLETE\s*<\/promise>/i.test(e)}function Bw(e){if(typeof e!=="string"||e.length===0)return!1;return/<promise>\s*PLAN-COMPLETE\s*<\/promise>/i.test(e)}function qw(e){let t=/(?:<promise>\s*)?PHASE-(\d+)-COMPLETE\s*(?:<\/promise>)?/i.exec(e);return t?Number.parseInt(t[1],10):null}function Dg(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function Jw(e,t,n){if(t.enabled===!1)return!1;let o=e.postWave.currentWaveN;if(o===null)return!1;if(!(o in e.postWave.oracleAfterPhaseAtMs))return!1;let r=t.maxRetriesPerWave??1,i=t.reinjectCooldownMs??60000,s=e.postWave.lastInjectedWaveN===o;if(s&&e.postWave.postWaveInjectionsThisWave>=r)return!1;if(s&&e.postWave.lastInjectedAtMs!==null&&n-e.postWave.lastInjectedAtMs<i)return!1;return!0}function Kw(e,t){if(e)return e;return[`Wave ${t===null||t===void 0?"?":String(t)} is Oracle-verified. Land it now:`,"1. Use a CLEAN dedicated branch for this PR: `git checkout -b <branch>` (each PR gets its own independent branch; never mix PRs on one branch unless they fix the same problem).","2. `git push -u origin HEAD` (sets upstream on first push).","3. If no PR exists yet: `gh pr create --fill`.","4. Monitor CI: `timeout 600 gh pr checks --watch` (auto-stops after 10 min).","5. Only start the next wave after checks are green."].join(`
278
- `)}function Xw(e,t,n=""){if(e)return e;let o=t===null||t===void 0?"?":String(t),r=n?`3. Invoke the \`${n}\` MCP GitHub skills to create the PR/issue, then `:"3. ";return[`Wave ${o} is Oracle-verified. This is a THIRD-PARTY repo land it as a contribution:`,"1. READ FIRST the repo's contribution rules (read CONTRIBUTING.md, PR/issue templates and guides) and follow them exactly.","2. Create a CLEAN dedicated branch for THIS PR: `git checkout -b <branch>` each PR gets its own independent branch; never mix PRs on one branch unless they fix the same problem (then commit onto that same branch).",`${r}push the branch to your FORK (\`git push -u origin HEAD\`) and open the PR against the UPSTREAM repo following the repo's template. Use \`gh pr create\` for GitHub.`,"4. Request review on the PR (add reviewers) and wait for CI to pass before starting the next wave."].join(`
279
- `)}function Yw(e,t,n=Aw){if(e==="own"||e==="third-party")return e;try{let o=n("gh repo view --json isFork,parent",{cwd:t,stdio:"pipe",timeout:1e4}),r=JSON.parse(String(o));if(r.isFork===!0&&r.parent!==null&&r.parent!==void 0)return"third-party";return"own"}catch{try{let o=n("git remote -v",{cwd:t,stdio:"pipe",timeout:1e4});if(String(o).split(`
280
- `).some((i)=>/^\s*upstream\s+/.test(i)))return"third-party"}catch{}return"own"}}var Qw=Og();function zo(e,t){return Qw(e,t)}zo.id="omo-meta-governor";zo.server=zo;var CD=zo;export{CD as default};
281
-
282
- //# debugId=C8615B351907D0D264756E2164756E21
273
+ `);w.context.push(`
274
+ ### Past Lessons (auto-retrieved)`,F,"---")}},"experimental.chat.system.transform":async(p,w)=>{if(!T.enabled)return;let v=p.sessionID;if(!v)return;if(!Sg.has(v)){Sg.add(v);let E=Ff(r),_=[];_.push(""),_.push("[omo-meta-governor session-start protocol v0.47.0 - superpowers workflow]"),_.push(""),_.push("THE RULE. Invoke relevant or requested skills BEFORE any response or"),_.push("action - including clarifying questions, exploring the codebase, or"),_.push("checking files. If you think there is even a 1% chance a skill might apply,"),_.push("you ABSOLUTELY MUST invoke it. IF A SKILL APPLIES TO YOUR TASK,"),_.push("YOU DO NOT HAVE A CHOICE. YOU MUST USE IT. This is not negotiable."),_.push("You cannot rationalize your way out of this."),_.push(""),_.push("ANNOUNCEMENT. Before any response, announce:"),_.push(" Using [skill] to [purpose]"),_.push("and follow the skill exactly. If it has a checklist, create a todo per"),_.push("item."),_.push(""),_.push("SKILL PRIORITY. When multiple skills apply, PROCESS skills come first."),_.push(" Let us build X -> brainstorming first, then implementation skills"),_.push(" Fix this bug -> systematic-debugging first, then domain skills"),_.push(""),_.push("BRAINSTORMING-FIRST RULE. Before entering plan mode: if you have not"),_.push("already brainstormed, invoke the brainstorming skill first."),_.push(""),_.push("RED FLAGS - these thoughts mean STOP, you are rationalizing:"),_.push(" This is just a simple question -> Questions are tasks. Check for skills."),_.push(" I need more context first -> Skill check comes BEFORE clarifying questions."),_.push(" Let me explore the codebase first -> Skills tell you HOW to explore. Check first."),_.push(" I can check git/files quickly -> Files lack conversation context. Check for skills."),_.push(" This doesnt need a formal skill -> If a skill exists, use it."),_.push(" I remember this skill -> Skills evolve. Read current version."),_.push(" This feels productive -> Undisciplined action wastes time. Skills prevent this."),_.push(" Ill just do this one thing first -> Check BEFORE doing anything."),_.push(" I know what that means -> Knowing the concept is not using the skill."),_.push(""),_.push("FAILURE MODES - what to do when something goes wrong:"),_.push(" - Skill not found? -> Run ls ~/.agents/skills/ or npx skills find [query]"),_.push(" - Skill errors? -> Check SKILL.md for prerequisites; reread the skill."),_.push(" - Skill is overkill? -> Simple things become complex. Use it anyway."),_.push(" - Tests failing? -> Invoke systematic-debugging. Do not rationalize."),_.push(" - User overrides? -> User instructions take precedence over skills."),_.push(""),_.push("AVAILABLE CHORE SKILLS (from bundled-skills/):"),_.push(" - brainstorming - ideation before building"),_.push(" - using-superpowers - THIS meta-skill (read first!)"),_.push(" - find-skills - discover new skills"),_.push(" - test-driven-development - RED-GREEN-REFACTOR for implementing"),_.push(" - systematic-debugging - root cause analysis for bugs"),_.push(" - writing-plans - multi-step work breakdown"),_.push(" - executing-plans - TDD through a plan"),_.push(" - subagent-driven-development - parallel implementation"),_.push(" - dispatching-parallel-agents - fan-out to subagents"),_.push(" - receiving-code-review - apply review feedback"),_.push(" - requesting-code-review - prepare work for review"),_.push(" - using-git-worktrees - parallel branches"),_.push(" - finishing-a-development-branch - merge and ship"),_.push(" - verification-before-completion - pre-ship checks"),_.push(" - writing-skills - capture new patterns"),_.push(""),_.push("START PROTOCOL:"),_.push(" 1. Call omo_recall with relevant context from prior sessions."),_.push(" 2. Read SKILL.md of the skill you intend to use (skills evolve)."),_.push(" 3. If entering plan mode: invoke brainstorming FIRST."),_.push(" 4. Announce the skill, follow it exactly, complete its checklist."),_.push(""),w.system.push(_.join(`
275
+ `))}let I=pe.get(v);if(!I)return;let P=[];P.push("[omo-meta-governor audit] v"+me+" — runtime governance active"),P.push("");let F=I.accumulatedDeviations.slice(-5);if(F.length>0){P.push("RECENT PROTOCOL VIOLATIONS (most recent first):");for(let E of F.slice().reverse())P.push(` - [${E.severity}] ${E.category}: ${E.detail.slice(0,200)}`);P.push("")}let ie=(I.recentDecisions??[]).filter((E)=>E.action!=="continue").slice(-3);if(ie.length>0){P.push("RECENT DECISIONS (non-continue):");for(let E of ie.slice().reverse())P.push(` - [${E.action}] score=${E.score.toFixed(2)} reasoning=${(E.reasoning??"").slice(0,200)}`);P.push("")}if(F.length===0&&ie.length===0)P.push("No violations or non-continue decisions in this session yet."),P.push("Continue to use tools; the auditor will surface issues here.");w.system.push(P.join(`
276
+ `))},"experimental.compaction.autocontinue":async(p,w)=>{if(!T.enabled)return;let{sessionID:v,overflow:I}=p,P=pe.get(v);if(!P)P={memoryToolsUsed:[],hasCodegraphDir:!1,hasGraphifyDir:!1,oracleInvoked:!1,filesChanged:0,emptyRecall:!1,escalationAttempted:!1,recentToolCalls:[],recentWriteContents:[],recentWriteFilePaths:[],memorySaved:!1,accumulatedDeviations:[],recentInterventionTexts:[],batchCompletions:0,taskDoneSignal:!1,phaseCompleteSignal:!1,planCompleteSignal:!1,interventionCount:0,interventionDisabled:!1,lessonCount:0,iteration:0,oracleInFlight:!1,oracleInFlightSinceMs:null,signalAtMs:0,lastViolationInjectionAtMs:0,backgroundTaskInFlight:!1,backgroundTaskInFlightSinceMs:null,backgroundTaskType:null,lastWarnAtMs:0,lastWarnHash:"",recentPwArgsHashes:[],overflowCompactionCount:0,overflowLoopGuardTripped:!1},pe.set(v,P);if(P.interventionDisabled){w.enabled=!1;return}let F=T.intervention.compactionLoopGuard;if(F.enabled)if(I){if(P.overflowCompactionCount++,!P.overflowLoopGuardTripped&&P.overflowCompactionCount>F.maxOverflowRecoveries){P.overflowLoopGuardTripped=!0,P.interventionDisabled=!0,w.enabled=!1,S("warn",`compaction_loop_guard_tripped for session ${v}: ${P.overflowCompactionCount} consecutive overflow compactions; autocontinue disabled and guidance queued`);let V=$t.get(v),ie=`[META-GOVERNOR] Overflow compaction loop detected (${P.overflowCompactionCount} consecutive overflow compactions). opencode issue #27924 is in play. Auto-continue is now disabled for this session. Resume your pending tasks using the existing context do NOT regenerate context you have already produced.`;$t.set(v,{items:(V?.items??[]).concat(ie)})}}else P.overflowCompactionCount=0}}}}function Zw(e,t){if(typeof e!=="string"||e.length===0)return[];let n=e.split(`
277
+ `),i=[];for(let r of n){let o=r.match(/^\s*(\S+)\s+(fail)\s+(.*)$/);if(o){let s=o[1].trim(),a=o[3].trim();i.push(`${t} · ${s}: ${a}`)}}return i}function Ww(e){if(typeof e!=="string"||e.length===0)return!1;let t=e.replace(/\\\n/g," ").replace(/\s*\n\s*/g," ");return/(?:^|[\s;&|])gh\s+pr(?:\s|$)/.test(t)}function Hw(e){if(typeof e!=="string"||e.length===0)return!1;let t=e.replace(/\\\n/g," ").replace(/\s*\n\s*/g," ");return/(?:^|[\s;&|])git\s+push(?:\s|$)/.test(t)}function Vw(e){try{return Eg("git",["rev-parse","HEAD"],{cwd:e,encoding:"utf-8",timeout:5000,stdio:["ignore","pipe","pipe"],windowsHide:!0}).toString().trim()||null}catch{return null}}function Bw(e){try{let n=Eg("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:e,encoding:"utf-8",timeout:5000,stdio:["ignore","pipe","pipe"],windowsHide:!0}).toString().trim();return n&&n!=="HEAD"?n:null}catch{return null}}var pu=new Map;async function qw(e,t,n,i){let r=await Promise.resolve().then(() => ($g(),{})),o=pu.get(i)??{lastPolledSha:null,lastFailureInjectionAtMs:0,pending:new Set};o.pending.add(e),pu.set(i,o);try{Aw(n.workflow,t);let s=Date.now(),a=null;while(Date.now()-s<n.maxWaitMs){if(a=Cw(e),!a){await new Promise((l)=>setTimeout(l,n.pollIntervalMs));continue}if(a.status==="completed")break;await new Promise((l)=>setTimeout(l,n.pollIntervalMs))}if(!a||a.status!=="completed"){S("warn",`ci_monitor: timeout waiting for run on ${e.slice(0,7)} (${n.maxWaitMs}ms)`);return}if(o.lastPolledSha=e,a.conclusion==="failure"){let l=Date.now();if(l-o.lastFailureInjectionAtMs<60000)return;o.lastFailureInjectionAtMs=l;let c=Mw(a.databaseId,4000),u=[`[CI Monitor] GitHub Actions run #${a.databaseId} FAILED on ${t}@${e.slice(0,7)}.`,"",`Title: ${a.displayTitle}`,`URL: ${a.url}`,`Conclusion: ${a.conclusion}`,"","── FAILED-STEP LOGS (truncated) ──",c||"(no failed-log output available — run `gh run view "+a.databaseId+" --log-failed` for full output)","","── ACTION ──",n.failOnly?"Read the failed logs above, identify which tests broke, run them locally to reproduce, fix, and re-push. Use `bun run typecheck` first (fastest signal), then run only the failing test files.":"Review the run and take action."].join(`
278
+ `);S("warn",`ci_monitor: CI failed for ${e.slice(0,7)} — ${a.url}`);let f=await Promise.resolve().then(() => (_i(),{})),g=await bi(i,u,1e4);if(!g.ok)S("warn",`ci_monitor: failed to inject failure message: ${g.error??"unknown"}`)}else if(a.conclusion==="success")S("info",`ci_monitor: run #${a.databaseId} passed for ${e.slice(0,7)}`);else S("info",`ci_monitor: run #${a.databaseId} conclusion=${a.conclusion} for ${e.slice(0,7)}`)}finally{o.pending.delete(e),pu.set(i,o)}}function Jw(e,t){if(t>=1)return!1;try{return Lw(gu(e,"PLAN.md")),!1}catch{}try{let n=fu(gu(e,"AGENTS.md"),"utf-8");if(/^##\s+Plan\b/im.test(n))return!1}catch{}return!0}function Kw(e){if(typeof e!=="string"||e.length===0)return!1;return/<promise>\s*DONE!?\s*<\/promise>/i.test(e)}function Xw(e){if(typeof e!=="string"||e.length===0)return!1;return/<promise>\s*DONE!?\s*<\/promise>/i.test(e)||/<promise>\s*PHASE-\d+-COMPLETE\s*<\/promise>/i.test(e)}function Yw(e){if(typeof e!=="string"||e.length===0)return!1;return/<promise>\s*PLAN-COMPLETE\s*<\/promise>/i.test(e)}function Qw(e){let t=/(?:<promise>\s*)?PHASE-(\d+)-COMPLETE\s*(?:<\/promise>)?/i.exec(e);return t?Number.parseInt(t[1],10):null}function Og(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function ex(e,t,n){if(t.enabled===!1)return!1;let i=e.postWave.currentWaveN;if(i===null)return!1;if(!(i in e.postWave.oracleAfterPhaseAtMs))return!1;let r=t.maxRetriesPerWave??1,o=t.reinjectCooldownMs??60000,s=e.postWave.lastInjectedWaveN===i;if(s&&e.postWave.postWaveInjectionsThisWave>=r)return!1;if(s&&e.postWave.lastInjectedAtMs!==null&&n-e.postWave.lastInjectedAtMs<o)return!1;return!0}function tx(e,t){if(e)return e;return[`Wave ${t===null||t===void 0?"?":String(t)} is Oracle-verified. Land it now:`,"1. Use a CLEAN dedicated branch for this PR: `git checkout -b <branch>` (each PR gets its own independent branch; never mix PRs on one branch unless they fix the same problem).","2. `git push -u origin HEAD` (sets upstream on first push).","3. If no PR exists yet: `gh pr create --fill`.","4. Monitor CI: `timeout 600 gh pr checks --watch` (auto-stops after 10 min).","5. Only start the next wave after checks are green."].join(`
279
+ `)}function rx(e,t,n=""){if(e)return e;let i=t===null||t===void 0?"?":String(t),r=n?`3. Invoke the \`${n}\` MCP GitHub skills to create the PR/issue, then `:"3. ";return[`Wave ${i} is Oracle-verified. This is a THIRD-PARTY repo — land it as a contribution:`,"1. READ FIRST the repo's contribution rules (read CONTRIBUTING.md, PR/issue templates and guides) and follow them exactly.","2. Create a CLEAN dedicated branch for THIS PR: `git checkout -b <branch>` — each PR gets its own independent branch; never mix PRs on one branch unless they fix the same problem (then commit onto that same branch).",`${r}push the branch to your FORK (\`git push -u origin HEAD\`) and open the PR against the UPSTREAM repo following the repo's template. Use \`gh pr create\` for GitHub.`,"4. Request review on the PR (add reviewers) and wait for CI to pass before starting the next wave."].join(`
280
+ `)}function nx(e,t,n=Fw){if(e==="own"||e==="third-party")return e;try{let i=n("gh repo view --json isFork,parent",{cwd:t,stdio:"pipe",timeout:1e4}),r=JSON.parse(String(i));if(r.isFork===!0&&r.parent!==null&&r.parent!==void 0)return"third-party";return"own"}catch{try{let i=n("git remote -v",{cwd:t,stdio:"pipe",timeout:1e4});if(String(i).split(`
281
+ `).some((o)=>/^\s*upstream\s+/.test(o)))return"third-party"}catch{}return"own"}}var ix=Rg();function Ri(e,t){return ix(e,t)}Ri.id="omo-meta-governor";Ri.server=Ri;var ZD=Ri;export{ZD as default};
282
+
283
+ //# debugId=60313EA15BDA814664756E2164756E21
283
284
  //# sourceMappingURL=index.js.map