agestra 4.12.2 → 4.12.3
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/bundle.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as ___cr } from 'module';import { fileURLToPath as ___fu } from 'url';import { dirname as ___dn } from 'path';const __filename = ___fu(import.meta.url);const __dirname = ___dn(__filename);const require = ___cr(import.meta.url);
|
|
3
|
-
var tI=Object.create;var wd=Object.defineProperty;var rI=Object.getOwnPropertyDescriptor;var nI=Object.getOwnPropertyNames;var oI=Object.getPrototypeOf,sI=Object.prototype.hasOwnProperty;var Er=(t,e)=>()=>(t&&(e=t(t=0)),e);var $=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),lt=(t,e)=>{for(var r in e)wd(t,r,{get:e[r],enumerable:!0})},iI=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of nI(e))!sI.call(t,o)&&o!==r&&wd(t,o,{get:()=>e[o],enumerable:!(n=rI(e,o))||n.enumerable});return t};var Dy=(t,e,r)=>(r=t!=null?tI(oI(t)):{},iI(e||!t||!t.__esModule?wd(r,"default",{value:t,enumerable:!0}):r,t));var Oy,Hs,zy,Ny,jy,My,Ly,Ks,qy,So,Fy,Uy,Zy,Vy,By,Wy,xn,$d,Sd,RH,Hy,xo,xd,Ky,Jy,Ya,kn,kd,Gy,Yy,ko,Tr=Er(()=>{"use strict";Oy="4.12.
|
|
3
|
+
var tI=Object.create;var wd=Object.defineProperty;var rI=Object.getOwnPropertyDescriptor;var nI=Object.getOwnPropertyNames;var oI=Object.getPrototypeOf,sI=Object.prototype.hasOwnProperty;var Er=(t,e)=>()=>(t&&(e=t(t=0)),e);var $=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),lt=(t,e)=>{for(var r in e)wd(t,r,{get:e[r],enumerable:!0})},iI=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of nI(e))!sI.call(t,o)&&o!==r&&wd(t,o,{get:()=>e[o],enumerable:!(n=rI(e,o))||n.enumerable});return t};var Dy=(t,e,r)=>(r=t!=null?tI(oI(t)):{},iI(e||!t||!t.__esModule?wd(r,"default",{value:t,enumerable:!0}):r,t));var Oy,Hs,zy,Ny,jy,My,Ly,Ks,qy,So,Fy,Uy,Zy,Vy,By,Wy,xn,$d,Sd,RH,Hy,xo,xd,Ky,Jy,Ya,kn,kd,Gy,Yy,ko,Tr=Er(()=>{"use strict";Oy="4.12.3",Hs="http://localhost:11434",zy="llama3",Ny=".agestra/.jobs",jy=".agestra/traces",My=".agestra/worktrees",Ly=".agestra/sessions",Ks=".agestra/workspace",qy="individual",So="debates",Fy="synthesis",Uy="issue",Zy=".agestra/workers",Vy=Object.freeze(["PATH","HOME","USER","USERPROFILE","APPDATA","LOCALAPPDATA","TEMP","TMP","TMPDIR","SHELL","LANG","LC_ALL","NODE_PATH","SystemRoot","SystemDrive","COMSPEC","ComSpec","windir"]),By=2,Wy=6e4,xn=20,$d=5e4,Sd=10,RH=Object.freeze([3,5,10]),Hy=Object.freeze(["agree","disagree","abstain","revise"]),xo="votes",xd=2,Ky=1440*60*1e3,Jy=3600*1e3,Ya=Object.freeze(["ko","zh","ja","en"]),kn="ko",kd="en",Gy="[REDACTED]",Yy=["","--- REQUIRED RESPONSE FORMAT ---","Respond with JSON only, matching exactly this shape:",'{ "agrees": true | false, "feedback": "specific issues or why you agree", "suggestions": "concrete changes if you disagree (optional, may be omitted)" }',"No prose, markdown, or explanation outside the JSON object. The JSON must be the entire response or wrapped in a single ```json code fence.","-------------------------------"].join(`
|
|
4
4
|
`),ko=Object.freeze({auto:Object.freeze({name:"auto",description:"Auto-detect build profile from project structure (package.json scripts, tsconfig, vitest config, etc.).",command:"npx",args:Object.freeze([])}),tsc:Object.freeze({name:"tsc",description:"TypeScript project-references build via `npx tsc -b --noEmit`.",command:"npx",args:Object.freeze(["tsc","-b","--noEmit"])}),vitest:Object.freeze({name:"vitest",description:"Run the Vitest unit-test suite in CI mode.",command:"npx",args:Object.freeze(["vitest","run","--reporter=dot"])}),"npm-build":Object.freeze({name:"npm-build",description:"Run the project's `npm run build` script.",command:"npm",args:Object.freeze(["run","build"])}),"npm-test":Object.freeze({name:"npm-test",description:"Run the project's `npm test` script.",command:"npm",args:Object.freeze(["test","--","--run"])})})});import{execFileSync as aI}from"child_process";function Po(t){if(!Number.isFinite(t)||t<=0)return{delivered:!1};if(process.platform==="win32")try{return aI("taskkill",["/PID",String(t),"/T","/F"],{stdio:"ignore",windowsHide:!0}),{delivered:!0}}catch{try{return process.kill(t),{delivered:!0}}catch{return{delivered:!1}}}try{return process.kill(-t,"SIGTERM"),{delivered:!0}}catch{try{return process.kill(t,"SIGTERM"),{delivered:!0}}catch{return{delivered:!1}}}}function Jr(t,e=3e3){let r=t.pid;if(r)Po(r);else try{t.kill("SIGTERM")}catch{}setTimeout(()=>{try{t.kill("SIGKILL")}catch{}},e).unref?.()}var Js=Er(()=>{"use strict"});import{execFileSync as cI,spawn as uI}from"child_process";import{existsSync as lI}from"fs";function pI(t){return process.platform!=="win32"||t.includes("/")||t.includes("\\")?!1:dI.has(t.toLowerCase())}function fI(t){if(t.includes("\0"))throw new Error(`Windows shim arg contains null byte: ${JSON.stringify(t)}`);if(t.includes("%"))throw new Error(`Windows shim arg contains '%' which would trigger cmd.exe env expansion: ${JSON.stringify(t)}`);return/[\s"&^<>|()!]/.test(t)?`"${t.replace(/"/g,'""')}"`:t}function mI(t){let e=t.toLowerCase();if(Eo.has(e))return Eo.get(e)??null;try{let n=cI("where.exe",[t],{encoding:"utf-8",stdio:["ignore","pipe","ignore"],windowsHide:!0,timeout:5e3}).split(/\r?\n/).map(a=>a.trim()).filter(Boolean);if(n.length===0)return Eo.set(e,null),null;let o=n.find(a=>/\.(cmd|bat)$/i.test(a));if(o){let a={type:"cmd",path:o};return Eo.set(e,a),a}let i=`${n[0]}.ps1`;if(lI(i)){let a={type:"powershell",path:i};return Eo.set(e,a),a}}catch{}return Eo.set(e,null),null}function Pn(t,e){if(!pI(t))return{command:t,args:e};let r=mI(t);return r?r.type==="cmd"?{command:"cmd.exe",args:["/d","/s","/c",r.path,...e.map(n=>fI(n))]}:{command:"powershell.exe",args:["-NoProfile","-ExecutionPolicy","RemoteSigned","-File",r.path,...e]}:{command:t,args:e}}function vt(t){let{command:e,args:r,timeout:n=12e4,cwd:o,env:s,stdin:i,maxBuffer:a=10485760,onStderrChunk:c,signal:u}=t;return new Promise((l,d)=>{if(u?.aborted){d(new Ot(u.reason));return}let p=Pn(e,r),f=uI(p.command,p.args,{cwd:o,env:s?{...process.env,...s}:void 0,stdio:[i?"pipe":"ignore","pipe","pipe"],windowsHide:!0}),m="",h="",y=0,v=0,b=!1,_=null,k=!1,x=null,L=()=>{x&&u&&u.removeEventListener("abort",x)},P=!1,M=()=>{!P&&y+v>a&&(b=!0,P=!0,Jr(f))},q=()=>{k||(Jr(f),k=!0,L(),d(new Error(`CLI timeout after ${n}ms of inactivity: ${e} ${r.join(" ")}`)))},j=setTimeout(q,n);u&&(x=()=>{k||(k=!0,clearTimeout(j),Jr(f),L(),d(new Ot(u.reason)))},u.addEventListener("abort",x));let De=()=>{P||(clearTimeout(j),j=setTimeout(q,n))};if(f.stdout.on("data",Le=>{y+=Le.length,y<=a&&(m+=Le.toString()),M(),De()}),f.stderr.on("data",Le=>{v+=Le.length;let It=Le.toString();if(v<=a&&(h+=It),M(),!P&&c){let Kr=c(It);Kr&&(_=Kr,P=!0,Jr(f))}De()}),i&&f.stdin){f.stdin.on("error",()=>{});try{f.stdin.write(i),f.stdin.end()}catch{}}f.on("close",Le=>{if(clearTimeout(j),!k){if(_){k=!0,L(),d(_);return}k=!0,L(),l({stdout:m,stderr:h,exitCode:Le??1,truncated:b})}}),f.on("error",Le=>{clearTimeout(j),!k&&(k=!0,L(),d(new Error(`CLI spawn error: ${Le.message}`)))})})}var Ot,dI,Eo,Gs=Er(()=>{"use strict";Js();Ot=class extends Error{constructor(e){let r=e instanceof Error?`: ${e.message}`:typeof e=="string"&&e?`: ${e}`:"";super(`CLI aborted${r}`),this.name="CliAbortedError"}},dI=new Set(["codex","gemini","npm","npx"]),Eo=new Map});import{writeFileSync as jA,mkdirSync as ti,openSync as Id,writeSync as Ad,fsyncSync as yv,closeSync as Cd,renameSync as MA,unlinkSync as gv,appendFileSync as LA,copyFileSync as qA}from"fs";import{dirname as ri,join as FA}from"path";import{randomUUID as UA}from"crypto";function ye(t,e){let r=ri(t);ti(r,{recursive:!0});let n=FA(r,`.tmp-${UA().slice(0,8)}`);try{jA(n,e,"utf-8");try{MA(n,t)}catch(o){if(o.code!=="EXDEV")throw o;qA(n,t),gv(n)}}catch(o){try{gv(n)}catch{}throw o}}function Ve(t,e){ye(t,JSON.stringify(e,null,2))}function lc(t,e){let r=ri(t);ti(r,{recursive:!0});let n=Id(t,"a");try{Ad(n,e),yv(n)}finally{Cd(n)}}var uc,tn=Er(()=>{"use strict";uc=class{buffer=new Map;flushTimer=null;flushIntervalMs;maxBufferSize;auditFsync;destroyed=!1;constructor(e){this.flushIntervalMs=e?.flushIntervalMs??2e3,this.maxBufferSize=e?.maxBufferSize??100,this.auditFsync=e?.auditFsync??!0,this.flushIntervalMs>0&&(this.flushTimer=setInterval(()=>this.flush(),this.flushIntervalMs),this.flushTimer&&typeof this.flushTimer.unref=="function"&&this.flushTimer.unref())}append(e,r,n){if(this.destroyed)throw new Error("DurableAppendWriter has been destroyed");if(n==="audit"){if(this.auditFsync)lc(e,r);else{let s=ri(e);ti(s,{recursive:!0}),LA(e,r)}return}let o=this.buffer.get(e);o||(o=[],this.buffer.set(e,o)),o.push(r),o.length>=this.maxBufferSize&&this.flushFile(e),this.flushIntervalMs===0&&this.flushFile(e)}flush(){for(let e of this.buffer.keys())this.flushFile(e)}panicFlush(){for(let[e,r]of this.buffer)if(r.length!==0)try{let n=ri(e);ti(n,{recursive:!0});let o=Id(e,"a");try{Ad(o,r.join("")),yv(o)}finally{Cd(o)}}catch{}this.buffer.clear()}destroy(){this.destroyed||(this.destroyed=!0,this.flushTimer!==null&&(clearInterval(this.flushTimer),this.flushTimer=null),this.flush())}flushFile(e){let r=this.buffer.get(e);if(!r||r.length===0)return;let n=ri(e);ti(n,{recursive:!0});let o=Id(e,"a");try{Ad(o,r.join(""))}finally{Cd(o)}this.buffer.delete(e)}}});import{openSync as ZA,writeSync as VA,closeSync as BA,unlinkSync as vv,statSync as WA,mkdirSync as HA}from"fs";import{dirname as KA}from"path";function QA(t){if(t<=0)return;let e=new SharedArrayBuffer(4),r=new Int32Array(e);Atomics.wait(r,0,0,t)}function Zn(t,e,r={}){let n=r.staleMs??JA,o=r.acquireTimeoutMs??GA,s=r.pollMs??YA;HA(KA(t),{recursive:!0});let i=Date.now(),a=null;for(;a===null;)try{a=ZA(t,"wx")}catch(c){if(c.code!=="EEXIST")throw c;let l=!1;try{let p=WA(t);l=Date.now()-p.mtimeMs>n}catch{continue}if(l){try{vv(t)}catch{}continue}let d=Date.now()-i;if(d>=o)throw new Dd(t,d);QA(s)}try{try{VA(a,`${process.pid}@${Date.now()}
|
|
5
5
|
`)}catch{}return e()}finally{try{BA(a)}catch{}try{vv(t)}catch{}}}var JA,GA,YA,Dd,dc=Er(()=>{"use strict";JA=3e4,GA=5e3,YA=10,Dd=class extends Error{constructor(e,r){super(`withFileLock: timed out after ${r}ms waiting for ${e}`),this.name="FileLockTimeoutError"}}});import{existsSync as _v,realpathSync as XA}from"fs";import{basename as eC,dirname as tC,isAbsolute as zd,join as rC,normalize as wv,resolve as Nd,relative as nC}from"path";function oC(t){return t===""||!t.startsWith("..")&&!zd(t)}function Od(t){let e=[],r=Nd(t);for(;!_v(r);){let o=tC(r);if(o===r)break;e.unshift(eC(r)),r=o}let n=_v(r)?XA(r):r;return e.reduce((o,s)=>rC(o,s),n)}function $v(t,e){let r=Od(e),n=Od(t),o=nC(r,n);return oC(o)}function jd(t,e){let r=Nd(e,t);return $v(r,e)}function Mt(t,e){let r=Nd(e,t);if(!$v(r,e))throw new Error(`Path traversal blocked: ${t} escapes ${e}`);return r}function rt(t,e){if(t.length===0)throw new Error("Filename must not be empty");if(t.includes("\0"))throw new Error(`Filename contains null byte: ${JSON.stringify(t)}`);if(t.includes("/")||t.includes("\\"))throw new Error(`Filename must not contain path separators: ${JSON.stringify(t)}`);if(t.includes(".."))throw new Error(`Filename must not contain '..': ${JSON.stringify(t)}`);return Mt(t,e)}function Or(t,e){if(zd(t)){let r=wv(t);if(!jd(r,e))throw new Error(`Read path outside base directory: ${t} is not within ${e}`);return r}return Mt(t,e)}function Md(t,e){return zd(t)?Od(wv(t)):Mt(t,e)}function zr(t){return sC.test(t)}function pc(t,e){if(!t||typeof t!="string")throw new At(String(t),"command must be a non-empty string");if(t.includes("\0"))throw new At(t,"command contains null byte");if(t.includes("/")||t.includes("\\"))throw new At(t,"command must not contain path separators");if(!bv.has(t))throw new At(t,`command is not in the allowlist (${[...bv].join(", ")})`);for(let r of e){if(typeof r!="string")throw new At(t,`args contain a non-string entry: ${JSON.stringify(r)}`);if(r.includes("\0"))throw new At(t,`arg contains null byte: ${JSON.stringify(r)}`);if(iC.has(r))throw new At(t,`arg ${JSON.stringify(r)} is a code-execution flag and is not permitted`)}}var sC,bv,iC,At,No=Er(()=>{"use strict";sC=/^[a-zA-Z0-9_-]+-\d+-[a-f0-9]{6}$/;bv=new Set(["gemini","codex","claude","npx","node","npm","tsc"]),iC=new Set(["-e","--eval","-c","--command","-E","--execute","--exec"]),At=class extends Error{command;reason;constructor(e,r){super(`CLI command rejected: ${e} \u2014 ${r}`),this.command=e,this.reason=r,this.name="CliCommandRejectedError"}}});import{readFileSync as aC}from"fs";import{join as cC}from"path";function We(t,e){let r=cC(t,"status.json"),n=`${r}.lock`;Zn(n,()=>{let o=JSON.parse(aC(r,"utf-8"));Ve(r,{...o,...e})})}var ni=Er(()=>{"use strict";tn();dc()});import{spawn as uC}from"child_process";import{join as Ld}from"path";function fc(t){return new Promise(e=>{let r=Pn(t.command,t.args),n=uC(r.command,r.args,{cwd:t.cwd,stdio:["ignore","pipe","pipe"],windowsHide:!0});if(t.recordPid&&typeof n.pid=="number"&&n.pid>0)try{We(t.jobDir,{pid:n.pid})}catch{}if(!n.stdout||!n.stderr){try{n.kill()}catch{}try{ye(Ld(t.jobDir,"error.txt"),"Worker stdout/stderr streams unavailable (pipe allocation failed)"),We(t.jobDir,{state:"error",completedAt:new Date().toISOString()})}catch{}e();return}let o="",s="",i=0,a=0,c=!1,u=!1;n.stdout.on("data",p=>{i+=p.length,i<=10485760?o+=p.toString():c||(c=!0,Jr(n))}),n.stderr.on("data",p=>{a+=p.length,a<=10485760&&(s+=p.toString())});let l=(p,f)=>{if(!u){u=!0,clearTimeout(d);try{ye(Ld(t.jobDir,"output.txt"),o),ye(Ld(t.jobDir,"error.txt"),f!==void 0?f:s),We(t.jobDir,p)}catch{}e()}},d=setTimeout(()=>{Jr(n),l({state:"timed_out",completedAt:new Date().toISOString()})},t.timeoutMs);n.on("close",p=>{let f=o.trim().length>0;l({state:p===0||f?"completed":"error",exitCode:p??1,completedAt:new Date().toISOString()})}),n.on("error",p=>{let f=p.code==="ENOENT"?"missing_cli":"error";l({state:f,completedAt:new Date().toISOString()},p.message)})})}var qd=Er(()=>{"use strict";tn();Gs();Js();ni()});var Pv={};lt(Pv,{CLI_PROVIDERS:()=>xv,resolveCliConfig:()=>kv});import{readFileSync as Sv}from"fs";import{join as Vn}from"path";function kv(t){let e=lC[t.provider]??t.provider;return xv[e]??null}async function dC(){let t=process.argv[2];t||process.exit(1);let e;try{e=JSON.parse(Sv(Vn(t,"job.json"),"utf-8"))}catch{try{Ve(Vn(t,"status.json"),{id:"unknown",state:"error",provider:"unknown",completedAt:new Date().toISOString()}),ye(Vn(t,"error.txt"),"Failed to read job.json")}catch{}process.exit(1)}let r=kv(e);r||(We(t,{state:"missing_cli",completedAt:new Date().toISOString()}),ye(Vn(t,"error.txt"),`No CLI mapping for provider: ${e.provider}`),process.exit(1));let{command:n,buildArgs:o}=r;We(t,{state:"running",startedAt:new Date().toISOString()});let s=Sv(Vn(t,"prompt.txt"),"utf-8"),i=o(s);try{pc(n,i)}catch(c){let u=c instanceof At?c.message:`Argv rejected: ${c.message}`;We(t,{state:"error",completedAt:new Date().toISOString()}),ye(Vn(t,"error.txt"),u);return}let a;if(e.cwd)try{a=Mt(e.cwd,process.cwd())}catch(c){We(t,{state:"error",completedAt:new Date().toISOString()}),ye(Vn(t,"error.txt"),`Rejected descriptor.cwd: ${c.message}`);return}await fc({jobDir:t,command:n,args:i,cwd:a,timeoutMs:e.timeout,recordPid:!1})}var lC,xv,pC,Ev=Er(()=>{"use strict";tn();No();qd();ni();lC={"gemini-cli":"gemini","codex-cli":"codex","claude-cli":"claude"},xv={gemini:{command:"gemini",buildArgs:t=>["-p",t]},codex:{command:"codex",buildArgs:t=>["exec","--skip-git-repo-check","--full-auto","--ephemeral",t]},claude:{command:"claude",buildArgs:t=>["-p",t]}};pC=process.argv[1]?.endsWith("job-worker.js")||process.argv[1]?.endsWith("job-worker.ts");pC&&dC().catch(()=>process.exit(1))});var Vi=$(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.regexpCode=me.getEsmExportName=me.getProperty=me.safeStringify=me.stringify=me.strConcat=me.addCodeArg=me.str=me._=me.nil=me._Code=me.Name=me.IDENTIFIER=me._CodeOrName=void 0;var Ui=class{};me._CodeOrName=Ui;me.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Xn=class extends Ui{constructor(e){if(super(),!me.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};me.Name=Xn;var Ut=class extends Ui{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Xn&&(r[n.str]=(r[n.str]||0)+1),r),{})}};me._Code=Ut;me.nil=new Ut("");function DS(t,...e){let r=[t[0]],n=0;for(;n<e.length;)Sf(r,e[n]),r.push(t[++n]);return new Ut(r)}me._=DS;var $f=new Ut("+");function OS(t,...e){let r=[Zi(t[0])],n=0;for(;n<e.length;)r.push($f),Sf(r,e[n]),r.push($f,Zi(t[++n]));return gj(r),new Ut(r)}me.str=OS;function Sf(t,e){e instanceof Ut?t.push(...e._items):e instanceof Xn?t.push(e):t.push(_j(e))}me.addCodeArg=Sf;function gj(t){let e=1;for(;e<t.length-1;){if(t[e]===$f){let r=yj(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function yj(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Xn||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Xn))return`"${t}${e.slice(1)}`}function vj(t,e){return e.emptyStr()?t:t.emptyStr()?e:OS`${t}${e}`}me.strConcat=vj;function _j(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Zi(Array.isArray(t)?t.join(","):t)}function bj(t){return new Ut(Zi(t))}me.stringify=bj;function Zi(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}me.safeStringify=Zi;function wj(t){return typeof t=="string"&&me.IDENTIFIER.test(t)?new Ut(`.${t}`):DS`[${t}]`}me.getProperty=wj;function $j(t){if(typeof t=="string"&&me.IDENTIFIER.test(t))return new Ut(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}me.getEsmExportName=$j;function Sj(t){return new Ut(t.toString())}me.regexpCode=Sj});var Pf=$(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.ValueScope=St.ValueScopeName=St.Scope=St.varKinds=St.UsedValueState=void 0;var $t=Vi(),xf=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},wu;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(wu||(St.UsedValueState=wu={}));St.varKinds={const:new $t.Name("const"),let:new $t.Name("let"),var:new $t.Name("var")};var $u=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof $t.Name?e:this.name(e)}name(e){return new $t.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};St.Scope=$u;var Su=class extends $t.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,$t._)`.${new $t.Name(r)}[${n}]`}};St.ValueScopeName=Su;var xj=(0,$t._)`\n`,kf=class extends $u{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?xj:$t.nil}}get(){return this._scope}name(e){return new Su(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:s}=o,i=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,o);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:s,itemIndex:u}),o}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,$t._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(e,r,n={},o){let s=$t.nil;for(let i in e){let a=e[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,wu.Started);let l=r(u);if(l){let d=this.opts.es5?St.varKinds.var:St.varKinds.const;s=(0,$t._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))s=(0,$t._)`${s}${l}${this.opts._n}`;else throw new xf(u);c.set(u,wu.Completed)})}return s}};St.ValueScope=kf});var te=$(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.or=X.and=X.not=X.CodeGen=X.operators=X.varKinds=X.ValueScopeName=X.ValueScope=X.Scope=X.Name=X.regexpCode=X.stringify=X.getProperty=X.nil=X.strConcat=X.str=X._=void 0;var ce=Vi(),er=Pf(),cn=Vi();Object.defineProperty(X,"_",{enumerable:!0,get:function(){return cn._}});Object.defineProperty(X,"str",{enumerable:!0,get:function(){return cn.str}});Object.defineProperty(X,"strConcat",{enumerable:!0,get:function(){return cn.strConcat}});Object.defineProperty(X,"nil",{enumerable:!0,get:function(){return cn.nil}});Object.defineProperty(X,"getProperty",{enumerable:!0,get:function(){return cn.getProperty}});Object.defineProperty(X,"stringify",{enumerable:!0,get:function(){return cn.stringify}});Object.defineProperty(X,"regexpCode",{enumerable:!0,get:function(){return cn.regexpCode}});Object.defineProperty(X,"Name",{enumerable:!0,get:function(){return cn.Name}});var Eu=Pf();Object.defineProperty(X,"Scope",{enumerable:!0,get:function(){return Eu.Scope}});Object.defineProperty(X,"ValueScope",{enumerable:!0,get:function(){return Eu.ValueScope}});Object.defineProperty(X,"ValueScopeName",{enumerable:!0,get:function(){return Eu.ValueScopeName}});Object.defineProperty(X,"varKinds",{enumerable:!0,get:function(){return Eu.varKinds}});X.operators={GT:new ce._Code(">"),GTE:new ce._Code(">="),LT:new ce._Code("<"),LTE:new ce._Code("<="),EQ:new ce._Code("==="),NEQ:new ce._Code("!=="),NOT:new ce._Code("!"),OR:new ce._Code("||"),AND:new ce._Code("&&"),ADD:new ce._Code("+")};var Mr=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},Ef=class extends Mr{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?er.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=ss(this.rhs,e,r)),this}get names(){return this.rhs instanceof ce._CodeOrName?this.rhs.names:{}}},xu=class extends Mr{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof ce.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=ss(this.rhs,e,r),this}get names(){let e=this.lhs instanceof ce.Name?{}:{...this.lhs.names};return Pu(e,this.rhs)}},Tf=class extends xu{constructor(e,r,n,o){super(e,n,o),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Rf=class extends Mr{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},If=class extends Mr{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Af=class extends Mr{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},Cf=class extends Mr{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=ss(this.code,e,r),this}get names(){return this.code instanceof ce._CodeOrName?this.code.names:{}}},Bi=class extends Mr{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,o=n.length;for(;o--;){let s=n[o];s.optimizeNames(e,r)||(kj(e,s.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>ro(e,r.names),{})}},Lr=class extends Bi{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},Df=class extends Bi{},os=class extends Lr{};os.kind="else";var eo=class t extends Lr{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new os(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(zS(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=ss(this.condition,e,r),this}get names(){let e=super.names;return Pu(e,this.condition),this.else&&ro(e,this.else.names),e}};eo.kind="if";var to=class extends Lr{};to.kind="for";var Of=class extends to{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=ss(this.iteration,e,r),this}get names(){return ro(super.names,this.iteration.names)}},zf=class extends to{constructor(e,r,n,o){super(),this.varKind=e,this.name=r,this.from=n,this.to=o}render(e){let r=e.es5?er.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${r} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=Pu(super.names,this.from);return Pu(e,this.to)}},ku=class extends to{constructor(e,r,n,o){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=ss(this.iterable,e,r),this}get names(){return ro(super.names,this.iterable.names)}},Wi=class extends Lr{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Wi.kind="func";var Hi=class extends Bi{render(e){return"return "+super.render(e)}};Hi.kind="return";var Nf=class extends Lr{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,o;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(o=this.finally)===null||o===void 0||o.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&ro(e,this.catch.names),this.finally&&ro(e,this.finally.names),e}},Ki=class extends Lr{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Ki.kind="catch";var Ji=class extends Lr{render(e){return"finally"+super.render(e)}};Ji.kind="finally";var jf=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
6
6
|
`:""},this._extScope=e,this._scope=new er.Scope({parent:e}),this._nodes=[new Df]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,o){let s=this._scope.toName(r);return n!==void 0&&o&&(this._constants[s.str]=n),this._leafNode(new Ef(e,s,n)),s}const(e,r,n){return this._def(er.varKinds.const,e,r,n)}let(e,r,n){return this._def(er.varKinds.let,e,r,n)}var(e,r,n){return this._def(er.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new xu(e,r,n))}add(e,r){return this._leafNode(new Tf(e,X.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==ce.nil&&this._leafNode(new Cf(e)),this}object(...e){let r=["{"];for(let[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,ce.addCodeArg)(r,o));return r.push("}"),new ce._Code(r)}if(e,r,n){if(this._blockNode(new eo(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new eo(e))}else(){return this._elseNode(new os)}endIf(){return this._endBlockNode(eo,os)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new Of(e),r)}forRange(e,r,n,o,s=this.opts.es5?er.varKinds.var:er.varKinds.let){let i=this._scope.toName(e);return this._for(new zf(s,i,r,n),()=>o(i))}forOf(e,r,n,o=er.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=r instanceof ce.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,ce._)`${i}.length`,a=>{this.var(s,(0,ce._)`${i}[${a}]`),n(s)})}return this._for(new ku("of",o,s,r),()=>n(s))}forIn(e,r,n,o=this.opts.es5?er.varKinds.var:er.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,ce._)`Object.keys(${r})`,n);let s=this._scope.toName(e);return this._for(new ku("in",o,s,r),()=>n(s))}endFor(){return this._endBlockNode(to)}label(e){return this._leafNode(new Rf(e))}break(e){return this._leafNode(new If(e))}return(e){let r=new Hi;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Hi)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new Nf;if(this._blockNode(o),this.code(e),r){let s=this.name("e");this._currNode=o.catch=new Ki(s),r(s)}return n&&(this._currNode=o.finally=new Ji,this.code(n)),this._endBlockNode(Ki,Ji)}throw(e){return this._leafNode(new Af(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=ce.nil,n,o){return this._blockNode(new Wi(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Wi)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof eo))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};X.CodeGen=jf;function ro(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Pu(t,e){return e instanceof ce._CodeOrName?ro(t,e.names):t}function ss(t,e,r){if(t instanceof ce.Name)return n(t);if(!o(t))return t;return new ce._Code(t._items.reduce((s,i)=>(i instanceof ce.Name&&(i=n(i)),i instanceof ce._Code?s.push(...i._items):s.push(i),s),[]));function n(s){let i=r[s.str];return i===void 0||e[s.str]!==1?s:(delete e[s.str],i)}function o(s){return s instanceof ce._Code&&s._items.some(i=>i instanceof ce.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function kj(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function zS(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,ce._)`!${Mf(t)}`}X.not=zS;var Pj=NS(X.operators.AND);function Ej(...t){return t.reduce(Pj)}X.and=Ej;var Tj=NS(X.operators.OR);function Rj(...t){return t.reduce(Tj)}X.or=Rj;function NS(t){return(e,r)=>e===ce.nil?r:r===ce.nil?e:(0,ce._)`${Mf(e)} ${t} ${Mf(r)}`}function Mf(t){return t instanceof ce.Name?t:(0,ce._)`(${t})`}});var le=$(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.checkStrictMode=re.getErrorPath=re.Type=re.useFunc=re.setEvaluated=re.evaluatedPropsToName=re.mergeEvaluated=re.eachItem=re.unescapeJsonPointer=re.escapeJsonPointer=re.escapeFragment=re.unescapeFragment=re.schemaRefOrVal=re.schemaHasRulesButRef=re.schemaHasRules=re.checkUnknownRules=re.alwaysValidSchema=re.toHash=void 0;var we=te(),Ij=Vi();function Aj(t){let e={};for(let r of t)e[r]=!0;return e}re.toHash=Aj;function Cj(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(LS(t,e),!qS(e,t.self.RULES.all))}re.alwaysValidSchema=Cj;function LS(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let o=n.RULES.keywords;for(let s in e)o[s]||ZS(t,`unknown keyword: "${s}"`)}re.checkUnknownRules=LS;function qS(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}re.schemaHasRules=qS;function Dj(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}re.schemaHasRulesButRef=Dj;function Oj({topSchemaRef:t,schemaPath:e},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,we._)`${r}`}return(0,we._)`${t}${e}${(0,we.getProperty)(n)}`}re.schemaRefOrVal=Oj;function zj(t){return FS(decodeURIComponent(t))}re.unescapeFragment=zj;function Nj(t){return encodeURIComponent(qf(t))}re.escapeFragment=Nj;function qf(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}re.escapeJsonPointer=qf;function FS(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}re.unescapeJsonPointer=FS;function jj(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}re.eachItem=jj;function jS({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let c=i===void 0?s:i instanceof we.Name?(s instanceof we.Name?t(o,s,i):e(o,s,i),i):s instanceof we.Name?(e(o,i,s),s):r(s,i);return a===we.Name&&!(c instanceof we.Name)?n(o,c):c}}re.mergeEvaluated={props:jS({mergeNames:(t,e,r)=>t.if((0,we._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,we._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,we._)`${r} || {}`).code((0,we._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,we._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,we._)`${r} || {}`),Ff(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:US}),items:jS({mergeNames:(t,e,r)=>t.if((0,we._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,we._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,we._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,we._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function US(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,we._)`{}`);return e!==void 0&&Ff(t,r,e),r}re.evaluatedPropsToName=US;function Ff(t,e,r){Object.keys(r).forEach(n=>t.assign((0,we._)`${e}${(0,we.getProperty)(n)}`,!0))}re.setEvaluated=Ff;var MS={};function Mj(t,e){return t.scopeValue("func",{ref:e,code:MS[e.code]||(MS[e.code]=new Ij._Code(e.code))})}re.useFunc=Mj;var Lf;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Lf||(re.Type=Lf={}));function Lj(t,e,r){if(t instanceof we.Name){let n=e===Lf.Num;return r?n?(0,we._)`"[" + ${t} + "]"`:(0,we._)`"['" + ${t} + "']"`:n?(0,we._)`"/" + ${t}`:(0,we._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,we.getProperty)(t).toString():"/"+qf(t)}re.getErrorPath=Lj;function ZS(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}re.checkStrictMode=ZS});var qr=$(Uf=>{"use strict";Object.defineProperty(Uf,"__esModule",{value:!0});var ot=te(),qj={data:new ot.Name("data"),valCxt:new ot.Name("valCxt"),instancePath:new ot.Name("instancePath"),parentData:new ot.Name("parentData"),parentDataProperty:new ot.Name("parentDataProperty"),rootData:new ot.Name("rootData"),dynamicAnchors:new ot.Name("dynamicAnchors"),vErrors:new ot.Name("vErrors"),errors:new ot.Name("errors"),this:new ot.Name("this"),self:new ot.Name("self"),scope:new ot.Name("scope"),json:new ot.Name("json"),jsonPos:new ot.Name("jsonPos"),jsonLen:new ot.Name("jsonLen"),jsonPart:new ot.Name("jsonPart")};Uf.default=qj});var Gi=$(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.extendErrors=st.resetErrorsCount=st.reportExtraError=st.reportError=st.keyword$DataError=st.keywordError=void 0;var de=te(),Tu=le(),mt=qr();st.keywordError={message:({keyword:t})=>(0,de.str)`must pass "${t}" keyword validation`};st.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,de.str)`"${t}" keyword must be ${e} ($data)`:(0,de.str)`"${t}" keyword is invalid ($data)`};function Fj(t,e=st.keywordError,r,n){let{it:o}=t,{gen:s,compositeRule:i,allErrors:a}=o,c=WS(t,e,r);n??(i||a)?VS(s,c):BS(o,(0,de._)`[${c}]`)}st.reportError=Fj;function Uj(t,e=st.keywordError,r){let{it:n}=t,{gen:o,compositeRule:s,allErrors:i}=n,a=WS(t,e,r);VS(o,a),s||i||BS(n,mt.default.vErrors)}st.reportExtraError=Uj;function Zj(t,e){t.assign(mt.default.errors,e),t.if((0,de._)`${mt.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,de._)`${mt.default.vErrors}.length`,e),()=>t.assign(mt.default.vErrors,null)))}st.resetErrorsCount=Zj;function Vj({gen:t,keyword:e,schemaValue:r,data:n,errsCount:o,it:s}){if(o===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",o,mt.default.errors,a=>{t.const(i,(0,de._)`${mt.default.vErrors}[${a}]`),t.if((0,de._)`${i}.instancePath === undefined`,()=>t.assign((0,de._)`${i}.instancePath`,(0,de.strConcat)(mt.default.instancePath,s.errorPath))),t.assign((0,de._)`${i}.schemaPath`,(0,de.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,de._)`${i}.schema`,r),t.assign((0,de._)`${i}.data`,n))})}st.extendErrors=Vj;function VS(t,e){let r=t.const("err",e);t.if((0,de._)`${mt.default.vErrors} === null`,()=>t.assign(mt.default.vErrors,(0,de._)`[${r}]`),(0,de._)`${mt.default.vErrors}.push(${r})`),t.code((0,de._)`${mt.default.errors}++`)}function BS(t,e){let{gen:r,validateName:n,schemaEnv:o}=t;o.$async?r.throw((0,de._)`new ${t.ValidationError}(${e})`):(r.assign((0,de._)`${n}.errors`,e),r.return(!1))}var no={keyword:new de.Name("keyword"),schemaPath:new de.Name("schemaPath"),params:new de.Name("params"),propertyName:new de.Name("propertyName"),message:new de.Name("message"),schema:new de.Name("schema"),parentSchema:new de.Name("parentSchema")};function WS(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,de._)`{}`:Bj(t,e,r)}function Bj(t,e,r={}){let{gen:n,it:o}=t,s=[Wj(o,r),Hj(t,r)];return Kj(t,e,s),n.object(...s)}function Wj({errorPath:t},{instancePath:e}){let r=e?(0,de.str)`${t}${(0,Tu.getErrorPath)(e,Tu.Type.Str)}`:t;return[mt.default.instancePath,(0,de.strConcat)(mt.default.instancePath,r)]}function Hj({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let o=n?e:(0,de.str)`${e}/${t}`;return r&&(o=(0,de.str)`${o}${(0,Tu.getErrorPath)(r,Tu.Type.Str)}`),[no.schemaPath,o]}function Kj(t,{params:e,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([no.keyword,o],[no.params,typeof e=="function"?e(t):e||(0,de._)`{}`]),c.messages&&n.push([no.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([no.schema,i],[no.parentSchema,(0,de._)`${l}${d}`],[mt.default.data,s]),u&&n.push([no.propertyName,u])}});var KS=$(is=>{"use strict";Object.defineProperty(is,"__esModule",{value:!0});is.boolOrEmptySchema=is.topBoolOrEmptySchema=void 0;var Jj=Gi(),Gj=te(),Yj=qr(),Qj={message:"boolean schema is false"};function Xj(t){let{gen:e,schema:r,validateName:n}=t;r===!1?HS(t,!1):typeof r=="object"&&r.$async===!0?e.return(Yj.default.data):(e.assign((0,Gj._)`${n}.errors`,null),e.return(!0))}is.topBoolOrEmptySchema=Xj;function eM(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),HS(t)):r.var(e,!0)}is.boolOrEmptySchema=eM;function HS(t,e){let{gen:r,data:n}=t,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,Jj.reportError)(o,Qj,void 0,e)}});var Zf=$(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0});as.getRules=as.isJSONType=void 0;var tM=["string","number","integer","boolean","null","object","array"],rM=new Set(tM);function nM(t){return typeof t=="string"&&rM.has(t)}as.isJSONType=nM;function oM(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}as.getRules=oM});var Vf=$(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.shouldUseRule=un.shouldUseGroup=un.schemaHasRulesForType=void 0;function sM({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&JS(t,n)}un.schemaHasRulesForType=sM;function JS(t,e){return e.rules.some(r=>GS(t,r))}un.shouldUseGroup=JS;function GS(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}un.shouldUseRule=GS});var Yi=$(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.reportTypeError=it.checkDataTypes=it.checkDataType=it.coerceAndCheckDataType=it.getJSONTypes=it.getSchemaTypes=it.DataType=void 0;var iM=Zf(),aM=Vf(),cM=Gi(),K=te(),YS=le(),cs;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(cs||(it.DataType=cs={}));function uM(t){let e=QS(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}it.getSchemaTypes=uM;function QS(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(iM.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}it.getJSONTypes=QS;function lM(t,e){let{gen:r,data:n,opts:o}=t,s=dM(e,o.coerceTypes),i=e.length>0&&!(s.length===0&&e.length===1&&(0,aM.schemaHasRulesForType)(t,e[0]));if(i){let a=Wf(e,n,o.strictNumbers,cs.Wrong);r.if(a,()=>{s.length?pM(t,e,s):Hf(t)})}return i}it.coerceAndCheckDataType=lM;var XS=new Set(["string","number","integer","boolean","null"]);function dM(t,e){return e?t.filter(r=>XS.has(r)||e==="array"&&r==="array"):[]}function pM(t,e,r){let{gen:n,data:o,opts:s}=t,i=n.let("dataType",(0,K._)`typeof ${o}`),a=n.let("coerced",(0,K._)`undefined`);s.coerceTypes==="array"&&n.if((0,K._)`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,K._)`${o}[0]`).assign(i,(0,K._)`typeof ${o}`).if(Wf(e,o,s.strictNumbers),()=>n.assign(a,o))),n.if((0,K._)`${a} !== undefined`);for(let u of r)(XS.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);n.else(),Hf(t),n.endIf(),n.if((0,K._)`${a} !== undefined`,()=>{n.assign(o,a),fM(t,a)});function c(u){switch(u){case"string":n.elseIf((0,K._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,K._)`"" + ${o}`).elseIf((0,K._)`${o} === null`).assign(a,(0,K._)`""`);return;case"number":n.elseIf((0,K._)`${i} == "boolean" || ${o} === null
|