@augmentcode/onison 1.2.0-prerelease.202611090911 → 1.2.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.
Files changed (2) hide show
  1. package/auggie-v2.mjs +4 -4
  2. package/package.json +1 -1
package/auggie-v2.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="2f54ca2d-0c31-5f68-ade1-211569f6e457")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="49a97f22-a90f-589d-a9ba-31f3844d1a8c")}catch(e){}}();
4
4
  import { createRequire as __createRequire } from "node:module"; import { dirname as __pathDirname } from "node:path"; import { fileURLToPath as __fileURLToPath } from "node:url"; const require = __createRequire(import.meta.url); const __dirname = __pathDirname(__fileURLToPath(import.meta.url));
5
5
  var u4i=Object.create;var X1e=Object.defineProperty;var d4i=Object.getOwnPropertyDescriptor;var p4i=Object.getOwnPropertyNames;var m4i=Object.getPrototypeOf,f4i=Object.prototype.hasOwnProperty;var Ke=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var C=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var G=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},ui=(e,t)=>{for(var n in t)X1e(e,n,{get:t[n],enumerable:!0})},Wsn=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of p4i(t))!f4i.call(e,i)&&i!==n&&X1e(e,i,{get:()=>t[i],enumerable:!(r=d4i(t,i))||r.enumerable});return e};var _n=(e,t,n)=>(n=e!=null?u4i(m4i(e)):{},Wsn(t||!e||!e.__esModule?X1e(n,"default",{value:e,enumerable:!0}):n,e)),Ui=e=>Wsn(X1e({},"__esModule",{value:!0}),e);import*as h4i from"node:tls";function g4i(e){let t=[],n="",r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(s==='"')r=!r;else if(s==="\\"&&r){if(i++,i===e.length)return;n+=e[i]}else s===" "&&!r?n&&(t.push(n),n=""):n+=s}if(!r)return n&&t.push(n),t}function b4i(){let e=g4i(process.env.NODE_OPTIONS??"");return e===void 0||[...e,...process.execArgv].some(t=>t.split("=",1)[0]?.replaceAll("_","-")==="--use-openssl-ca")}function q1e(){if(fA!==void 0)return fA;if(process.env.AUGGIE_USE_SYSTEM_CA==="0")return fA="opted-out",fA;if(b4i())return fA="explicit-policy",fA;let{getCACertificates:e,setDefaultCACertificates:t}=h4i;if(typeof e!="function"||typeof t!="function")return fA="unsupported",fA;try{let n=e("default"),r=e("system");if(r.length===0)return fA="empty-store",fA;t([...n,...r]),fA="enabled"}catch{fA="failed"}return fA}var fA,set=C(()=>{"use strict"});function CU(e,t){let n=e.toLowerCase(),r=t.toLowerCase(),i=c=>{if(c.length===0)return{matches:!0,score:0};if(c.length>r.length)return{matches:!1,score:0};let d=0,p=0,m=-1,f=0;for(let h=0;h<r.length&&d<c.length;h++)if(r[h]===c[d]){let g=h===0||/[\s\-_./:]/.test(r[h-1]);m===h-1?(f++,p-=f*5):(f=0,m>=0&&(p+=(h-m-1)*2)),g&&(p-=10),p+=h*.1,m=h,d++}return d<c.length?{matches:!1,score:0}:(c===r&&(p-=100),{matches:!0,score:p})},s=i(n);if(s.matches)return s;let o=n.match(/^(?<letters>[a-z]+)(?<digits>[0-9]+)$/),a=n.match(/^(?<digits>[0-9]+)(?<letters>[a-z]+)$/),l=o?`${o.groups?.digits??""}${o.groups?.letters??""}`:a?`${a.groups?.letters??""}${a.groups?.digits??""}`:"";if(!l)return s;let u=i(l);return u.matches?{matches:!0,score:u.score+5}:s}function pc(e,t,n){if(!t.trim())return e;let r=t.trim().split(/\s+/).filter(s=>s.length>0);if(r.length===0)return e;let i=[];for(let s of e){let o=n(s),a=0,l=!0;for(let u of r){let c=CU(u,o);if(c.matches)a+=c.score;else{l=!1;break}}l&&i.push({item:s,totalScore:a})}return i.sort((s,o)=>s.totalScore-o.totalScore),i.map(s=>s.item)}var K1e=C(()=>{"use strict"});import{spawn as y4i}from"child_process";import{readdirSync as A4i,statSync as $sn}from"fs";import{homedir as Qsn}from"os";import{basename as oet,dirname as J1e,join as HM}from"path";function TU(e){return e.replace(/\\/g,"/")}function E4i(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _4i(e){let t=TU(e);if(!t.includes("/"))return t;let n=t.endsWith("/"),r=t.replace(/^\/+|\/+$/g,"");if(!r)return t;let i="[\\\\/]",s=r.split("/").filter(Boolean).map(a=>E4i(a));if(s.length===0)return t;let o=s.join(i);return n&&(o+=i),o}function Hsn(e){for(let t=e.length-1;t>=0;t-=1)if(Xsn.has(e[t]??""))return t;return-1}function S4i(e){let t=!1,n=-1;for(let r=0;r<e.length;r+=1)e[r]==='"'&&(t=!t,t&&(n=r));return t?n:null}function Ysn(e,t){return t===0||Xsn.has(e[t-1]??"")}function Zsn(e){let t=S4i(e);return t===null?null:t>0&&e[t-1]==="@"?Ysn(e,t-1)?e.slice(t-1):null:Ysn(e,t)?e.slice(t):null}function jsn(e){return e.startsWith('@"')?{rawPrefix:e.slice(2),isAtPrefix:!0,isQuotedPrefix:!0}:e.startsWith('"')?{rawPrefix:e.slice(1),isAtPrefix:!1,isQuotedPrefix:!0}:e.startsWith("@")?{rawPrefix:e.slice(1),isAtPrefix:!0,isQuotedPrefix:!1}:{rawPrefix:e,isAtPrefix:!1,isQuotedPrefix:!1}}function zsn(e,t){let n=t.isQuotedPrefix||e.includes(" "),r=t.isAtPrefix?"@":"";return n?`${`${r}"`}${e}"`:`${r}${e}`}async function v4i(e,t,n,r,i){let s=["--base-directory",e,"--max-results",String(r),"--type","f","--type","d","--follow","--hidden","--exclude",".git","--exclude",".git/*","--exclude",".git/**"];return TU(n).includes("/")&&s.push("--full-path"),n&&s.push(_4i(n)),await new Promise(o=>{if(i.aborted){o([]);return}let a=y4i(t,s,{stdio:["ignore","pipe","pipe"]}),l="",u=!1,c=p=>{u||(u=!0,i.removeEventListener("abort",d),o(p))},d=()=>{a.exitCode===null&&a.kill("SIGKILL")};i.addEventListener("abort",d,{once:!0}),a.stdout.setEncoding("utf-8"),a.stdout.on("data",p=>{l+=p}),a.on("error",()=>{c([])}),a.on("close",p=>{if(i.aborted||p!==0||!l){c([]);return}let m=l.trim().split(`
6
6
  `).filter(Boolean),f=[];for(let h of m){let g=TU(h),b=g.endsWith("/"),A=b?g.slice(0,-1):g;A===".git"||A.startsWith(".git/")||A.includes("/.git/")||f.push({path:g,isDirectory:b})}c(f)})})}var Xsn,YM,qsn=C(()=>{"use strict";K1e();Xsn=new Set([" "," ",'"',"'","="]);YM=class{commands;basePath;fdPath;dollarItems;constructor(t=[],n,r=null,i=[]){this.commands=t,this.basePath=n,this.fdPath=r,this.dollarItems=i}getArgumentHint(t,n,r){if(t.length!==1||n!==0||r!==t[0]?.length)return;let i=/^\/(\S+)\s*$/u.exec(t[0]);if(!i)return;let s=this.commands.find(o=>("name"in o?o.name:o.value)===i[1]);if(!(!s||!("name"in s)||s.isAvailable?.()===!1))return s.argumentHint}async getSuggestions(t,n,r,i){let o=(t[n]||"").slice(0,r),a=this.extractAtPrefix(o);if(a){let{rawPrefix:d,isQuotedPrefix:p}=jsn(a),m=await this.getFuzzyFileSuggestions(d,{isQuotedPrefix:p,signal:i.signal});return m.length===0?null:{items:m,prefix:a}}let l=this.extractDollarPrefix(o);if(l!==null&&this.dollarItems.length>0){let d=l.slice(1),p=pc(this.dollarItems,d,m=>m.value);return p.length===0?null:{items:p,prefix:l}}if(!i.force&&o.startsWith("/")){let d=o.indexOf(" "),p=this.commands.filter(b=>!("isAvailable"in b)||b.isAvailable?.()!==!1);if(d===-1){let b=o.slice(1),A=p.map(S=>{let _="name"in S?S.name:S.value,x="argumentHint"in S&&S.argumentHint?S.argumentHint:void 0,v=S.description??"",w=x?v?`${x} \u2014 ${v}`:x:v;return{name:_,label:_,description:w||void 0}}),y=pc(A,b,S=>S.name).map(S=>({value:S.name,label:S.label,...S.description&&{description:S.description}}));return y.length===0?null:{items:y,prefix:o}}let m=o.slice(1,d),f=o.slice(d+1),h=p.find(b=>("name"in b?b.name:b.value)===m);if(!h||!("getArgumentCompletions"in h)||!h.getArgumentCompletions)return null;let g=await h.getArgumentCompletions(f);return!Array.isArray(g)||g.length===0?null:{items:g,prefix:f}}let u=this.extractPathPrefix(o,i.force??!1);if(u===null)return null;let c=this.getFileSuggestions(u);return c.length===0?null:{items:c,prefix:u}}applyCompletion(t,n,r,i,s){let o=t[n]||"",a=o.slice(0,r-s.length),l=o.slice(r),u=s.startsWith('"')||s.startsWith('@"'),c=l.startsWith('"'),d=i.value.endsWith('"'),p=u&&d&&c?l.slice(1):l;if(s.startsWith("/")&&a.trim()===""&&!s.slice(1).includes("/")){let S=`${a}/${i.value} ${p}`,_=[...t];return _[n]=S,{lines:_,cursorLine:n,cursorCol:a.length+i.value.length+2}}if(s.startsWith("$")){let _=/^[\w-]+(?:[./][\w-]+)*$/.test(i.value)?`$${i.value}`:`$"${i.value}"`,x=`${a}${_} ${p}`,v=[...t];return v[n]=x,{lines:v,cursorLine:n,cursorCol:a.length+_.length+1}}if(s.startsWith("@")){let S=i.label.endsWith("/"),_=S?"":" ",x=`${a+i.value}${_}${p}`,v=[...t];v[n]=x;let w=i.value.endsWith('"'),T=S&&w?i.value.length-1:i.value.length;return{lines:v,cursorLine:n,cursorCol:a.length+T+_.length}}let f=o.slice(0,r);if(f.includes("/")&&f.includes(" ")){let S=a+i.value+p,_=[...t];_[n]=S;let x=i.label.endsWith("/"),v=i.value.endsWith('"'),w=x&&v?i.value.length-1:i.value.length;return{lines:_,cursorLine:n,cursorCol:a.length+w}}let h=a+i.value+p,g=[...t];g[n]=h;let b=i.label.endsWith("/"),A=i.value.endsWith('"'),y=b&&A?i.value.length-1:i.value.length;return{lines:g,cursorLine:n,cursorCol:a.length+y}}extractAtPrefix(t){let n=Zsn(t);if(n?.startsWith('@"'))return n;let r=Hsn(t),i=r===-1?0:r+1;return t[i]==="@"?t.slice(i):null}extractDollarPrefix(t){let n=t.match(/(?:^|\s)(\$\S*)$/);return n?n[1]:null}extractPathPrefix(t,n=!1){let r=Zsn(t);if(r)return r;let i=Hsn(t),s=i===-1?t:t.slice(i+1);return n||s.includes("/")||s.startsWith(".")||s.startsWith("~/")||s===""&&t.endsWith(" ")?s:null}expandHomePath(t){if(t.startsWith("~/")){let n=HM(Qsn(),t.slice(2));return t.endsWith("/")&&!n.endsWith("/")?`${n}/`:n}else if(t==="~")return Qsn();return t}resolveScopedFuzzyQuery(t){let n=TU(t),r=n.lastIndexOf("/");if(r===-1)return null;let i=n.slice(0,r+1),s=n.slice(r+1),o;i.startsWith("~/")?o=this.expandHomePath(i):i.startsWith("/")?o=i:o=HM(this.basePath,i);try{if(!$sn(o).isDirectory())return null}catch{return null}return{baseDir:o,query:s,displayBase:i}}scopedPathForDisplay(t,n){let r=TU(n);return t==="/"?`/${r}`:`${TU(t)}${r}`}getFileSuggestions(t){try{let n,r,{rawPrefix:i,isAtPrefix:s,isQuotedPrefix:o}=jsn(t),a=i;if(a.startsWith("~")&&(a=this.expandHomePath(a)),i===""||i==="./"||i==="../"||i==="~"||i==="~/"||i==="/"||s&&i==="")i.startsWith("~")||a.startsWith("/")?n=a:n=HM(this.basePath,a),r="";else if(i.endsWith("/"))i.startsWith("~")||a.startsWith("/")?n=a:n=HM(this.basePath,a),r="";else{let d=J1e(a),p=oet(a);i.startsWith("~")||a.startsWith("/")?n=d:n=HM(this.basePath,d),r=p}let u=A4i(n,{withFileTypes:!0}),c=[];for(let d of u){if(!d.name.toLowerCase().startsWith(r.toLowerCase()))continue;let p=d.isDirectory();if(!p&&d.isSymbolicLink())try{let A=HM(n,d.name);p=$sn(A).isDirectory()}catch{}let m,f=d.name,h=i;if(h.endsWith("/"))m=h+f;else if(h.includes("/")||h.includes("\\"))if(h.startsWith("~/")){let A=h.slice(2),y=J1e(A);m=`~/${y==="."?f:HM(y,f)}`}else if(h.startsWith("/")){let A=J1e(h);A==="/"?m=`/${f}`:m=`${A}/${f}`}else m=HM(J1e(h),f),h.startsWith("./")&&!m.startsWith("./")&&(m=`./${m}`);else h.startsWith("~")?m=`~/${f}`:m=f;m=TU(m);let g=p?`${m}/`:m,b=zsn(g,{isDirectory:p,isAtPrefix:s,isQuotedPrefix:o});c.push({value:b,label:f+(p?"/":"")})}return c.sort((d,p)=>{let m=d.value.endsWith("/"),f=p.value.endsWith("/");return m&&!f?-1:!m&&f?1:d.label.localeCompare(p.label)}),c}catch{return[]}}scoreEntry(t,n,r){let s=oet(t).toLowerCase(),o=n.toLowerCase(),a=0;return s===o?a=100:s.startsWith(o)?a=80:s.includes(o)?a=50:t.toLowerCase().includes(o)&&(a=30),r&&a>0&&(a+=10),a}async getFuzzyFileSuggestions(t,n){if(!this.fdPath||n.signal.aborted)return[];try{let r=this.resolveScopedFuzzyQuery(t),i=r?.baseDir??this.basePath,s=r?.query??t,o=await v4i(i,this.fdPath,s,100,n.signal);if(n.signal.aborted)return[];let a=o.map(c=>({...c,score:s?this.scoreEntry(c.path,s,c.isDirectory):1})).filter(c=>c.score>0);a.sort((c,d)=>d.score-c.score);let l=a.slice(0,20),u=[];for(let{path:c,isDirectory:d}of l){let p=d?c.slice(0,-1):c,m=r?this.scopedPathForDisplay(r.displayBase,p):p,f=oet(p),h=d?`${m}/`:m,g=zsn(h,{isDirectory:d,isAtPrefix:!0,isQuotedPrefix:n.isQuotedPrefix});u.push({value:g,label:f+(d?"/":""),description:m})}return u}catch{return[]}}shouldTriggerFileCompletion(t,n,r){let s=(t[n]||"").slice(0,r);return!(s.trim().startsWith("/")&&!s.trim().includes(" "))}}});var Ksn,Jsn,eon,ton,non,ron,aet,ion=C(()=>{Ksn=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],Jsn=12288,eon=65510,ton=[12288,12288,65281,65376,65504,65510],non=4352,ron=262141,aet=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141]});var eve,son=C(()=>{eve=(e,t)=>{let n=0,r=Math.floor(e.length/2)-1;for(;n<=r;){let i=Math.floor((n+r)/2),s=i*2;if(t<e[s])r=i-1;else if(t>e[s+1])n=i+1;else return!0}return!1}});function w4i(e){let t=e[0],n=e[1];for(let r=0;r<e.length;r+=2){let i=e[r],s=e[r+1];if(oon>=i&&oon<=s)return[i,s];s-i>n-t&&(t=i,n=s)}return[t,n]}var oon,T4i,I4i,aon,lon,con,uon=C(()=>{ion();son();oon=19968,[T4i,I4i]=w4i(aet);aon=e=>e<161||e>1114109?!1:eve(Ksn,e),lon=e=>e<Jsn||e>eon?!1:eve(ton,e),con=e=>e>=T4i&&e<=I4i?!0:e<non||e>ron?!1:eve(aet,e)});function R4i(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function cet(e,{ambiguousAsWide:t=!1}={}){return R4i(e),lon(e)||con(e)||t&&aon(e)?2:1}var don=C(()=>{uon()});function tve(){return xN}function N4i(e){let t=e.codePointAt(0);return t>=126976&&t<=130047||t>=8960&&t<=9215||t>=9728&&t<=10175||t>=11088&&t<=11093||e.includes("\uFE0F")||e.length>2}function pet(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n>126)return!1}return!0}function D4i(e,t){if(t<=0||e.length===0)return{text:"",width:0};if(pet(e)){let l=e.slice(0,t);return{text:l,width:l.length}}let n=e.includes("\x1B"),r=e.includes(" ");if(!n&&!r){let l="",u=0;for(let{segment:c}of xN.segment(e)){let d=IU(c);if(u+d>t)break;l+=c,u+=d}return{text:l,width:u}}let i="",s=0,o=0,a="";for(;o<e.length;){let l=hA(e,o);if(l){a+=l.code,o+=l.length;continue}if(e[o]===" "){if(s+3>t)break;a&&(i+=a,a=""),i+=" ",s+=3,o++;continue}let u=o;for(;u<e.length&&e[u]!==" "&&!hA(e,u);)u++;for(let{segment:c}of xN.segment(e.slice(o,u))){let d=IU(c);if(s+d>t)return{text:i,width:s};a&&(i+=a,a=""),i+=c,s+=d}o=u}return{text:i,width:s}}function uet(e,t,n,r,i,s){let o="\x1B[0m",a=t+r,l;return n.length>0?l=`${e}${o}${n}${o}`:l=`${e}${o}`,s?l+" ".repeat(Math.max(0,i-a)):l}function IU(e){if(k4i.test(e))return 0;if(N4i(e)&&M4i.test(e))return 2;let n=e.replace(O4i,"").codePointAt(0);if(n===void 0)return 0;if(n>=127462&&n<=127487)return 2;let r=cet(n);if(e.length>1)for(let i of e.slice(1)){let s=i.codePointAt(0);s>=65280&&s<=65519?r+=cet(s):(s===3635||s===3763)&&(r+=1)}return r}function Wt(e){if(e.length===0)return 0;if(pet(e))return e.length;let t=oie.get(e);if(t!==void 0)return t;let n=e;if(e.includes(" ")&&(n=n.replace(/\t/g," ")),n.includes("\x1B")){let i="",s=0;for(;s<n.length;){let o=hA(n,s);if(o){s+=o.length;continue}i+=n[s],s++}n=i}let r=0;for(let{segment:i}of xN.segment(n))r+=IU(i);if(oie.size>=P4i){let i=oie.keys().next().value;i!==void 0&&oie.delete(i)}return oie.set(e,r),r}function mon(e){return B4i.test(e)?e.replace(L4i,t=>t==="\u0E33"?"\u0E4D\u0E32":"\u0ECD\u0EB2"):e}function hA(e,t){if(t>=e.length||e[t]!=="\x1B")return null;let n=e[t+1];if(n==="["){let r=t+2;for(;r<e.length&&!/[mGKHJ]/.test(e[r]);)r++;return r<e.length?{code:e.substring(t,r+1),length:r+1-t}:null}if(n==="]"){let r=t+2;for(;r<e.length;){if(e[r]==="\x07")return{code:e.substring(t,r+1),length:r+1-t};if(e[r]==="\x1B"&&e[r+1]==="\\")return{code:e.substring(t,r+2),length:r+2-t};r++}return null}if(n==="_"){let r=t+2;for(;r<e.length;){if(e[r]==="\x07")return{code:e.substring(t,r+1),length:r+1-t};if(e[r]==="\x1B"&&e[r+1]==="\\")return{code:e.substring(t,r+2),length:r+2-t};r++}return null}return null}function F4i(e){if(!e.startsWith("\x1B]8;"))return;let t=e.endsWith("\x07")?"\x07":"\x1B\\",n=e.slice(4,t==="\x07"?-1:-2),r=n.indexOf(";");if(r===-1)return;let i=n.slice(0,r),s=n.slice(r+1);return s?{params:i,url:s,terminator:t}:null}function U4i(e){return`\x1B]8;${e.params};${e.url}${e.terminator}`}function V4i(e){return`\x1B]8;;${e}`}function fon(e,t){let n=0;for(;n<e.length;){let r=hA(e,n);r?(t.process(r.code),n+=r.length):n++}}function G4i(e){let t=[],n="",r="",i=!1,s=0;for(;s<e.length;){let o=hA(e,s);if(o){r+=o.code,s+=o.length;continue}let a=e[s],l=a===" ";l!==i&&n&&(t.push(n),n=""),r&&(n+=r,r=""),i=l,n+=a,s++}return r&&(n+=r),n&&t.push(n),t}function fr(e,t){return wU(e,t).map(n=>n.text)}function wU(e,t,{continuationIndent:n=0}={}){let r=" ".repeat(Math.max(0,Math.min(Math.floor(n),t-1))),i=t-r.length,s=e.split(`
@@ -292,7 +292,7 @@ ${s}${a}`;throw new Error(l)}function dfs(e){let t=e.instancePath?e.instancePath
292
292
 
293
293
  Re-emit the call with a corrected arguments object.`:`
294
294
 
295
- Offending fields: ${e.join(", ")}. Re-emit the call with corrected values for those fields only.`}function mfs(e,t){if(t.params?.missingProperty!==void 0||t.params?.additionalProperty!==void 0||!t.instancePath)return"";let n=ffs(e,t.instancePath);if(n===void 0)return"";if(typeof n=="string")return` (current value: ${n.length>hNe?JSON.stringify(`${n.slice(0,hNe)}\u2026`):JSON.stringify(n)})`;let r;try{r=JSON.stringify(n)}catch{return""}return r===void 0?"":` (current value: ${r.length>hNe?`${r.slice(0,hNe)}\u2026`:r})`}function ffs(e,t){if(t===""||t==="/")return e;let n=t.split("/").slice(1),r=e;for(let i of n){let s=i.replace(/~1/g,"/").replace(/~0/g,"~");if(r==null)return;if(Array.isArray(r)){let o=Number(s);if(!Number.isInteger(o)||o<0)return;r=r[o];continue}if(typeof r!="object")return;r=r[s]}return r}var Tht,Iht,wht,ifs,sfs,Wkn,ofs,$kn,afs,lfs,gNe,Rht,hNe,Ykn=C(()=>{"use strict";Tht=_n(EZ(),1),Iht=_n(Rkn(),1),wht=_n(Cht(),1),ifs=Tht.default.default||Tht.default,sfs=Iht.default.default||Iht.default,Wkn=wht.default.default||wht.default,ofs=typeof globalThis<"u"&&globalThis.chrome?.runtime?.id!==void 0;$kn={allErrors:!0,strict:!1,coerceTypes:!0},afs=/^https?:\/\/json-schema\.org\/draft-07\/schema#?$/,lfs=/^https?:\/\/json-schema\.org\/draft\/2020-12\/schema#?$/;gNe=null,Rht=null;if(Hkn())try{let e=new ifs($kn);Wkn(e);let t=new sfs($kn);Wkn(t),Qkn(e,"http://json-schema.org/draft-07/schema#","https://json-schema.org/draft-07/schema"),Qkn(t,"https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"),gNe=e,Rht=t}catch{console.warn("AJV validation disabled due to CSP restrictions")}hNe=200});var E4={};ui(E4,{AssistantMessageEventStream:()=>rk,EventStream:()=>hD,LEGACY_THINKING_LEVELS:()=>_Re,StringEnum:()=>ORe,Type:()=>te,appendAssistantMessageDiagnostic:()=>Gpt,calculateCost:()=>Oss,calculateDetailedContextUsedTokens:()=>JT,cleanupSessionResources:()=>Nos,clearApiProviders:()=>Ppt,complete:()=>imt,completeSimple:()=>cb,createAssistantMessageDiagnostic:()=>Vss,createAssistantMessageEventStream:()=>Hss,createAugmentTransportErrorDiagnostic:()=>$pt,discoverAugmentModels:()=>a4,extractDiagnosticError:()=>QIn,findAugmentTransportErrorContext:()=>Lv,findEnvKeys:()=>LIn,formatThrownValue:()=>$In,formatUnsupportedReasoningEffort:()=>lm,getApiProvider:()=>s4,getApiProviders:()=>Sss,getEnvApiKey:()=>KT,getModel:()=>kss,getModels:()=>Nae,getOrCreateAugmentClient:()=>il,getOverflowPatterns:()=>Uos,getProviders:()=>Rae,isContextOverflow:()=>sk,isContextOverflowErrorText:()=>uS,isDetailedContextUsage:()=>kA,isLegacyThinkingLevel:()=>lb,isModelUnavailableErrorText:()=>Mae,modelsAreEqual:()=>uo,normalizeReasoningEfforts:()=>xRe,parseAugmentTransportErrorDiagnostic:()=>YIn,parseJsonWithRepair:()=>wwn,parseStreamingJson:()=>lmt,reasoningSelectionLabel:()=>OA,reasoningSelections:()=>eh,registerApiProvider:()=>i4,registerBuiltInApiProviders:()=>tmt,registerSessionResourceCleanup:()=>Ros,repairJson:()=>amt,resetApiProviders:()=>ik,resolveReasoningCapabilities:()=>Ju,resolveReasoningSelection:()=>os,sanitizeAugmentTransportErrorContext:()=>kae,stream:()=>xwn,streamAugment:()=>nZ,streamSimple:()=>eI,streamSimpleAugment:()=>_wn,supportsXhigh:()=>VIn,toProviderStopReason:()=>Upt,unregisterApiProviders:()=>vss,validateToolArguments:()=>bNe,validateToolCall:()=>ufs});var Bi=C(()=>{"use strict";ds();yRe();Fpt();Vpt();emt();nmt();Swn();Cwn();SRe();Qpt();IRe();Rwn();kwn();Own();Ykn()});var TD,Nht=C(()=>{TD={name:"@augmentcode/auggie-v2",version:"1.2.0",description:"Auggie CLI Client by Augment Code",type:"module",piConfig:{name:"auggie",configDir:".augment"},bin:{auggie:"dist/cli.js","auggie-v2":"dist/cli.js",pi:"dist/cli.js"},main:"./dist/index.js",types:"./dist/index.d.ts",exports:{".":{source:"./src/index.ts",types:"./dist/index.d.ts",import:"./dist/index.js"},"./hooks":{types:"./dist/core/hooks/index.d.ts",import:"./dist/core/hooks/index.js"}},files:["dist","docs","examples","CHANGELOG.md"],scripts:{"check-types":"pnpm run bake:export-html && tsgo -p tsconfig.build.json",clean:"shx rm -rf dist",banners:"tsx --conditions=source scripts/print-banners.ts","cli:source":"tsx --conditions=source src/cli.ts",dev:"pnpm run bake:export-html && pnpm run cli:source","dev:debug":"pnpm run bake:export-html && node --conditions=source --inspect-wait=ws://localhost:6499/57uz7t2uyri --import tsx src/cli.ts","bake:export-html":"node scripts/bake-export-html.mjs",build:"pnpm run bake:export-html && tsgo -p tsconfig.build.json --noCheck && shx chmod +x dist/cli.js && shx cp src/runtime/register-extensions.js dist/runtime/register-extensions.js && shx cp src/runtime/cloud-bridge.js dist/runtime/cloud-bridge.js && shx cp src/runtime/cloud-tracer-bridge.js dist/runtime/cloud-tracer-bridge.js && shx cp src/runtime/cloud-error-bridge.js dist/runtime/cloud-error-bridge.js && shx cp src/runtime/mcp-error-bridge.js dist/runtime/mcp-error-bridge.js && pnpm run copy-assets","build:npm:release":"node scripts/build-npm-release.mjs","build:migration-engine":"node scripts/build-migration-engine.mjs","build:release:sea":"node scripts/build-sea-release.mjs","build:release:sea:from-onison":"node scripts/build-sea-from-onison.mjs","build:release-js":"pnpm run bake:export-html && tsgo -p tsconfig.release.json --noCheck && shx chmod +x dist/cli.js && shx cp src/runtime/register-extensions.js dist/runtime/register-extensions.js && shx cp src/runtime/cloud-bridge.js dist/runtime/cloud-bridge.js && shx cp src/runtime/cloud-tracer-bridge.js dist/runtime/cloud-tracer-bridge.js && shx cp src/runtime/cloud-error-bridge.js dist/runtime/cloud-error-bridge.js && shx cp src/runtime/mcp-error-bridge.js dist/runtime/mcp-error-bridge.js && pnpm run copy-assets","build:npm":"pnpm run build:npm:release","clean:npm-artifacts":"find dist -name '*.js' -not -path 'dist/cli.js' -not -path 'dist/index.js' -not -path 'dist/release/*' -not -path 'dist/core/export-html/*' -delete && find dist -name '*.js.map' -delete","copy-assets":"shx mkdir -p dist/modes/interactive/theme && shx cp src/modes/interactive/theme/*.json dist/modes/interactive/theme/",test:"pnpm run bake:export-html && vitest --run","test:acp:e2e":"pnpm run bake:export-html && vitest --run --config vitest.e2e.config.ts e2e-test/acp/","test:e2e:sanity":"pnpm run bake:export-html && vitest --run --config vitest.e2e.config.ts e2e-test/tui/sanity.test.ts","test:e2e:tui":"pnpm run bake:export-html && vitest --run --no-file-parallelism --config vitest.e2e.config.ts e2e-test/tui/","test:e2e:cli":"pnpm run bake:export-html && vitest --run --no-file-parallelism --config vitest.e2e.config.ts e2e-test/cli/",prepublishOnly:"pnpm run clean && pnpm run build"},dependencies:{"@agentclientprotocol/sdk":"1.4.0","@augmentcode/api-client":"workspace:*","@earendil-works/pi-agent-core":"workspace:*","@earendil-works/pi-ai":"workspace:*","@earendil-works/pi-indexing":"workspace:*","@earendil-works/pi-tui":"workspace:*","@hermes/ask-user":"workspace:*","@hermes/augment-legacy-tools":"workspace:*","@hermes/btw":"workspace:*","@hermes/cloud":"workspace:*","@hermes/context-usage":"workspace:*","@hermes/cosmos":"workspace:*","@hermes/daemon":"workspace:*","@hermes/git-credentials":"workspace:*","@hermes/hashline-edit":"workspace:*","@hermes/hooks":"workspace:*","@hermes/import-sessions":"workspace:*","@hermes/logger":"workspace:*","@hermes/lsp":"workspace:*","@hermes/mcp":"workspace:*","@hermes/migration":"workspace:*","@hermes/open-browser":"workspace:*","@hermes/otel":"workspace:*","@hermes/path-utils":"workspace:*","@hermes/plugins":"workspace:*","@hermes/prompt-enhancer":"workspace:*","@hermes/segment-analytics":"workspace:*","@hermes/sentry":"workspace:*","@hermes/settings":"workspace:*","@hermes/shared-types":"workspace:*","@hermes/subagents":"workspace:*","@hermes/tool-permissions":"workspace:*","@mariozechner/jiti":"^2.6.2","@sentry/node":"^10.53.1","@silvia-odwyer/photon-node":"^0.3.4","@sinclair/typebox":"^0.34.41",ajv:"^8.17.1",chalk:"^5.5.0","cli-highlight":"^2.1.11",diff:"^8.0.2","extract-zip":"^2.0.1",fdir:"^6.5.0","file-type":"^21.1.1",glob:"^13.0.1","hosted-git-info":"^9.0.2",ignore:"^7.0.5",jimp:"^1.6.1","jsonc-parser":"3.3.1",marked:"^15.0.12",minimatch:"^10.2.3","proper-lockfile":"^4.1.2","strip-ansi":"^7.1.0",turndown:"^7.2.4",undici:"^7.19.1",yaml:"^2.8.2",zod:"^4.4.3"},overrides:{rimraf:"6.1.2",gaxios:{rimraf:"6.1.2"}},optionalDependencies:{"@mariozechner/clipboard":"^0.3.2"},devDependencies:{"@tintinweb/pi-subagents":"workspace:*","@types/diff":"^7.0.2","@types/hosted-git-info":"^3.0.5","@types/ms":"^2.1.0","@types/node":"^24.3.0","@types/proper-lockfile":"^4.1.4","@types/turndown":"^5.0.5",level:"^10.0.0",shx:"^0.4.0",tsx:"^4.21.0",typescript:"^5.7.3",vitest:"^3.2.4"},keywords:["coding-agent","ai","llm","cli","tui","agent"],author:"Mario Zechner",license:"MIT",repository:{type:"git",url:"git+https://github.com/badlogic/pi-mono.git",directory:"packages/coding-agent"},engines:{node:">=20.6.0"}}});import{existsSync as gfs}from"node:fs";import{homedir as dle}from"node:os";import{dirname as kht,join as $v,resolve as jkn}from"node:path";import{fileURLToPath as bfs}from"node:url";function zkn(){let e=process.env.PI_PACKAGE_DIR;if(e)return e==="~"?dle():e.startsWith("~/")?dle()+e.slice(1):e;let t=Zkn;for(;t!==kht(t);){if(gfs($v(t,"package.json")))return t;t=kht(t)}return Zkn}function yNe(){return jkn($v(zkn(),"docs"))}function ANe(){return jkn($v(zkn(),"CHANGELOG.md"))}function Jkn(e){return e==="~"?dle():e.startsWith("~/")?dle()+e.slice(1):e}function oI(){let e=process.env.AUGMENT_CACHE_DIR;return e?Jkn(e):$v(dle(),".augment")}function Br(){let e=process.env[Oht];return e?Jkn(e):oI()}function fle(){return $v(Br(),"themes")}function e2n(){return $v(Br(),"models.json")}function t2n(){return $v(Br(),"auth.json")}function n2n(){return $v(Br(),"settings.json")}function MA(){return oI()}function CZ(){return $v(Br(),"bin")}function r2n(){return $v(Br(),ple)}function i2n(){return $v(Br(),`${ei}-debug.log`)}var yfs,Zkn,ei,Ps,ple,mle,Xkn,Afs,ys,qkn,Kkn,Oht,Vs=C(()=>{"use strict";Nht();yfs=bfs(import.meta.url),Zkn=kht(yfs);ei=TD.piConfig?.name||"auggie",Ps=TD.piConfig?.configDir||".augment",ple="sessions-v2",mle=ei,Xkn="Auggie Coding Agent",Afs="1.2.0-prerelease.202611090911",ys=Afs??TD.version,qkn="2afeeb74cb9a958e51870161bd3f4c7d8b6efcab",Kkn="2026-11-09T17:11:48Z",Oht=`${ei.toUpperCase()}_CODING_AGENT_DIR`});function Mht(...e){return new globalThis.Function(...e)}var s2n=C(()=>{});var ENe,_Ne,Pht,o2n=C(()=>{bP();MH();Ur();Wc();ENe=class extends xi{constructor(t){super(`Duplicate type kind '${t}' detected`)}},_Ne=class extends xi{constructor(t){super(`Duplicate string format '${t}' detected`)}};(function(e){function t(r,i){if(kp.Has(r))throw new ENe(r);return kp.Set(r,i),(s={})=>PP({...s,[on]:r})}e.Type=t;function n(r,i){if(Jh.Has(r))throw new _Ne(r);return Jh.Set(r,i),r}e.Format=n})(Pht||(Pht={}))});var _4={};ui(_4,{Evaluate:()=>Mht,TypeSystem:()=>Pht,TypeSystemDuplicateFormat:()=>_Ne,TypeSystemDuplicateTypeKind:()=>ENe,TypeSystemPolicy:()=>hc});var TZ=C(()=>{s2n();Zie();o2n()});function a2n(e){switch(e.errorType){case an.ArrayContains:return"Expected array to contain at least one matching value";case an.ArrayMaxContains:return`Expected array to contain no more than ${e.schema.maxContains} matching values`;case an.ArrayMinContains:return`Expected array to contain at least ${e.schema.minContains} matching values`;case an.ArrayMaxItems:return`Expected array length to be less or equal to ${e.schema.maxItems}`;case an.ArrayMinItems:return`Expected array length to be greater or equal to ${e.schema.minItems}`;case an.ArrayUniqueItems:return"Expected array elements to be unique";case an.Array:return"Expected array";case an.AsyncIterator:return"Expected AsyncIterator";case an.BigIntExclusiveMaximum:return`Expected bigint to be less than ${e.schema.exclusiveMaximum}`;case an.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${e.schema.exclusiveMinimum}`;case an.BigIntMaximum:return`Expected bigint to be less or equal to ${e.schema.maximum}`;case an.BigIntMinimum:return`Expected bigint to be greater or equal to ${e.schema.minimum}`;case an.BigIntMultipleOf:return`Expected bigint to be a multiple of ${e.schema.multipleOf}`;case an.BigInt:return"Expected bigint";case an.Boolean:return"Expected boolean";case an.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${e.schema.exclusiveMinimumTimestamp}`;case an.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${e.schema.exclusiveMaximumTimestamp}`;case an.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${e.schema.minimumTimestamp}`;case an.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${e.schema.maximumTimestamp}`;case an.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${e.schema.multipleOfTimestamp}`;case an.Date:return"Expected Date";case an.Function:return"Expected function";case an.IntegerExclusiveMaximum:return`Expected integer to be less than ${e.schema.exclusiveMaximum}`;case an.IntegerExclusiveMinimum:return`Expected integer to be greater than ${e.schema.exclusiveMinimum}`;case an.IntegerMaximum:return`Expected integer to be less or equal to ${e.schema.maximum}`;case an.IntegerMinimum:return`Expected integer to be greater or equal to ${e.schema.minimum}`;case an.IntegerMultipleOf:return`Expected integer to be a multiple of ${e.schema.multipleOf}`;case an.Integer:return"Expected integer";case an.IntersectUnevaluatedProperties:return"Unexpected property";case an.Intersect:return"Expected all values to match";case an.Iterator:return"Expected Iterator";case an.Literal:return`Expected ${typeof e.schema.const=="string"?`'${e.schema.const}'`:e.schema.const}`;case an.Never:return"Never";case an.Not:return"Value should not match";case an.Null:return"Expected null";case an.NumberExclusiveMaximum:return`Expected number to be less than ${e.schema.exclusiveMaximum}`;case an.NumberExclusiveMinimum:return`Expected number to be greater than ${e.schema.exclusiveMinimum}`;case an.NumberMaximum:return`Expected number to be less or equal to ${e.schema.maximum}`;case an.NumberMinimum:return`Expected number to be greater or equal to ${e.schema.minimum}`;case an.NumberMultipleOf:return`Expected number to be a multiple of ${e.schema.multipleOf}`;case an.Number:return"Expected number";case an.Object:return"Expected object";case an.ObjectAdditionalProperties:return"Unexpected property";case an.ObjectMaxProperties:return`Expected object to have no more than ${e.schema.maxProperties} properties`;case an.ObjectMinProperties:return`Expected object to have at least ${e.schema.minProperties} properties`;case an.ObjectRequiredProperty:return"Expected required property";case an.Promise:return"Expected Promise";case an.RegExp:return"Expected string to match regular expression";case an.StringFormatUnknown:return`Unknown format '${e.schema.format}'`;case an.StringFormat:return`Expected string to match '${e.schema.format}' format`;case an.StringMaxLength:return`Expected string length less or equal to ${e.schema.maxLength}`;case an.StringMinLength:return`Expected string length greater or equal to ${e.schema.minLength}`;case an.StringPattern:return`Expected string to match '${e.schema.pattern}'`;case an.String:return"Expected string";case an.Symbol:return"Expected symbol";case an.TupleLength:return`Expected tuple to have ${e.schema.maxItems||0} elements`;case an.Tuple:return"Expected tuple";case an.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${e.schema.maxByteLength}`;case an.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${e.schema.minByteLength}`;case an.Uint8Array:return"Expected Uint8Array";case an.Undefined:return"Expected undefined";case an.Union:return"Expected union value";case an.Void:return"Expected void";case an.Kind:return`Expected kind '${e.schema[on]}'`;default:return"Unknown error type"}}function Efs(e){l2n=e}function Dht(){return l2n}var l2n,Bht=C(()=>{Ur();Lht();l2n=a2n});function _fs(e,t){let n=t.find(r=>r.$id===e.$ref);if(n===void 0)throw new Fht(e);return la(n,t)}function zm(e,t){return!Vo(e.$id)||t.some(n=>n.$id===e.$id)||t.push(e),t}function la(e,t){return e[on]==="This"||e[on]==="Ref"?_fs(e,t):e}var Fht,c2n=C(()=>{Wc();Ur();Dxe();Fht=class extends xi{constructor(t){super(`Unable to dereference schema with $id '${t.$ref}'`),this.schema=t}}});var gS=C(()=>{c2n()});function*Cfs(e){let t=e===0?1:Math.ceil(Math.floor(Math.log2(e)+1)/8);for(let n=0;n<t;n++)yield e>>8*(t-1-n)&255}function Tfs(e){ug(PA.Array);for(let t of e)wZ(t)}function Ifs(e){ug(PA.Boolean),ug(e?1:0)}function wfs(e){ug(PA.BigInt),d2n.setBigInt64(0,e);for(let t of p2n)ug(t)}function Rfs(e){ug(PA.Date),wZ(e.getTime())}function Nfs(e){ug(PA.Null)}function kfs(e){ug(PA.Number),d2n.setFloat64(0,e);for(let t of p2n)ug(t)}function Ofs(e){ug(PA.Object);for(let t of globalThis.Object.getOwnPropertyNames(e).sort())wZ(t),wZ(e[t])}function Mfs(e){ug(PA.String);for(let t=0;t<e.length;t++)for(let n of Cfs(e.charCodeAt(t)))ug(n)}function Pfs(e){ug(PA.Symbol),wZ(e.description)}function Dfs(e){ug(PA.Uint8Array);for(let t=0;t<e.length;t++)ug(e[t])}function Bfs(e){return ug(PA.Undefined)}function wZ(e){if(wi(e))return Tfs(e);if(Cv(e))return Ifs(e);if(Qm(e))return wfs(e);if(Xh(e))return Rfs(e);if(AT(e))return Nfs(e);if(fi(e))return kfs(e);if(hs(e))return Ofs(e);if(Vo(e))return Mfs(e);if(_T(e))return Pfs(e);if(e3(e))return Dfs(e);if(Oc(e))return Bfs(e);throw new SNe(e)}function ug(e){IZ=IZ^xfs[e],IZ=IZ*Sfs%vfs}function ck(e){return IZ=BigInt("14695981039346656037"),wZ(e),IZ}var SNe,PA,IZ,Sfs,vfs,xfs,u2n,d2n,p2n,m2n=C(()=>{Np();Wc();SNe=class extends xi{constructor(t){super("Unable to hash value"),this.value=t}};(function(e){e[e.Undefined=0]="Undefined",e[e.Null=1]="Null",e[e.Boolean=2]="Boolean",e[e.Number=3]="Number",e[e.String=4]="String",e[e.Object=5]="Object",e[e.Array=6]="Array",e[e.Date=7]="Date",e[e.Uint8Array=8]="Uint8Array",e[e.Symbol=9]="Symbol",e[e.BigInt=10]="BigInt"})(PA||(PA={}));IZ=BigInt("14695981039346656037"),[Sfs,vfs]=[BigInt("1099511628211"),BigInt("18446744073709551616")],xfs=Array.from({length:256}).map((e,t)=>BigInt(t)),u2n=new Float64Array(1),d2n=new DataView(u2n.buffer),p2n=new Uint8Array(u2n.buffer)});var RZ=C(()=>{m2n()});function Lfs(e){return e[on]==="Any"||e[on]==="Unknown"}function Go(e){return e!==void 0}function Ffs(e,t,n){return!0}function Ufs(e,t,n){return!0}function Vfs(e,t,n){if(!wi(n)||Go(e.minItems)&&!(n.length>=e.minItems)||Go(e.maxItems)&&!(n.length<=e.maxItems))return!1;for(let s of n)if(!Xm(e.items,t,s))return!1;if(e.uniqueItems===!0&&!(function(){let s=new Set;for(let o of n){let a=ck(o);if(s.has(a))return!1;s.add(a)}return!0})())return!1;if(!(Go(e.contains)||fi(e.minContains)||fi(e.maxContains)))return!0;let r=Go(e.contains)?e.contains:Gi(),i=n.reduce((s,o)=>Xm(r,t,o)?s+1:s,0);return!(i===0||fi(e.minContains)&&i<e.minContains||fi(e.maxContains)&&i>e.maxContains)}function Gfs(e,t,n){return $ie(n)}function Wfs(e,t,n){return!(!Qm(n)||Go(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)||Go(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)||Go(e.maximum)&&!(n<=e.maximum)||Go(e.minimum)&&!(n>=e.minimum)||Go(e.multipleOf)&&n%e.multipleOf!==BigInt(0))}function $fs(e,t,n){return Cv(n)}function Qfs(e,t,n){return Xm(e.returns,t,n.prototype)}function Hfs(e,t,n){return!(!Xh(n)||Go(e.exclusiveMaximumTimestamp)&&!(n.getTime()<e.exclusiveMaximumTimestamp)||Go(e.exclusiveMinimumTimestamp)&&!(n.getTime()>e.exclusiveMinimumTimestamp)||Go(e.maximumTimestamp)&&!(n.getTime()<=e.maximumTimestamp)||Go(e.minimumTimestamp)&&!(n.getTime()>=e.minimumTimestamp)||Go(e.multipleOfTimestamp)&&n.getTime()%e.multipleOfTimestamp!==0)}function Yfs(e,t,n){return ET(n)}function Zfs(e,t,n){let r=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];return Xm(i,[...t,...r],n)}function jfs(e,t,n){return!(!Yie(n)||Go(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)||Go(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)||Go(e.maximum)&&!(n<=e.maximum)||Go(e.minimum)&&!(n>=e.minimum)||Go(e.multipleOf)&&n%e.multipleOf!==0)}function zfs(e,t,n){let r=e.allOf.every(i=>Xm(i,t,n));if(e.unevaluatedProperties===!1){let i=new RegExp(Iv(e)),s=Object.getOwnPropertyNames(n).every(o=>i.test(o));return r&&s}else if($c(e.unevaluatedProperties)){let i=new RegExp(Iv(e)),s=Object.getOwnPropertyNames(n).every(o=>i.test(o)||Xm(e.unevaluatedProperties,t,n[o]));return r&&s}else return r}function Xfs(e,t,n){return Qie(n)}function qfs(e,t,n){return n===e.const}function Kfs(e,t,n){return!1}function Jfs(e,t,n){return!Xm(e.not,t,n)}function ehs(e,t,n){return AT(n)}function ths(e,t,n){return!(!hc.IsNumberLike(n)||Go(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)||Go(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)||Go(e.minimum)&&!(n>=e.minimum)||Go(e.maximum)&&!(n<=e.maximum)||Go(e.multipleOf)&&n%e.multipleOf!==0)}function nhs(e,t,n){if(!hc.IsObjectLike(n)||Go(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)||Go(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties))return!1;let r=Object.getOwnPropertyNames(e.properties);for(let i of r){let s=e.properties[i];if(e.required&&e.required.includes(i)){if(!Xm(s,t,n[i])||(wv(s)||Lfs(s))&&!(i in n))return!1}else if(hc.IsExactOptionalProperty(n,i)&&!Xm(s,t,n[i]))return!1}if(e.additionalProperties===!1){let i=Object.getOwnPropertyNames(n);return e.required&&e.required.length===r.length&&i.length===r.length?!0:i.every(s=>r.includes(s))}else return typeof e.additionalProperties=="object"?Object.getOwnPropertyNames(n).every(s=>r.includes(s)||Xm(e.additionalProperties,t,n[s])):!0}function rhs(e,t,n){return Hie(n)}function ihs(e,t,n){if(!hc.IsRecordLike(n)||Go(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)||Go(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties))return!1;let[r,i]=Object.entries(e.patternProperties)[0],s=new RegExp(r),o=Object.entries(n).every(([u,c])=>s.test(u)?Xm(i,t,c):!0),a=typeof e.additionalProperties=="object"?Object.entries(n).every(([u,c])=>s.test(u)?!0:Xm(e.additionalProperties,t,c)):!0,l=e.additionalProperties===!1?Object.getOwnPropertyNames(n).every(u=>s.test(u)):!0;return o&&a&&l}function shs(e,t,n){return Xm(la(e,t),t,n)}function ohs(e,t,n){let r=new RegExp(e.source,e.flags);return Go(e.minLength)&&!(n.length>=e.minLength)||Go(e.maxLength)&&!(n.length<=e.maxLength)?!1:r.test(n)}function ahs(e,t,n){return!Vo(n)||Go(e.minLength)&&!(n.length>=e.minLength)||Go(e.maxLength)&&!(n.length<=e.maxLength)||Go(e.pattern)&&!new RegExp(e.pattern).test(n)?!1:Go(e.format)?Jh.Has(e.format)?Jh.Get(e.format)(n):!1:!0}function lhs(e,t,n){return _T(n)}function chs(e,t,n){return Vo(n)&&new RegExp(e.pattern).test(n)}function uhs(e,t,n){return Xm(la(e,t),t,n)}function dhs(e,t,n){if(!wi(n)||e.items===void 0&&n.length!==0||n.length!==e.maxItems)return!1;if(!e.items)return!0;for(let r=0;r<e.items.length;r++)if(!Xm(e.items[r],t,n[r]))return!1;return!0}function phs(e,t,n){return Oc(n)}function mhs(e,t,n){return e.anyOf.some(r=>Xm(r,t,n))}function fhs(e,t,n){return!(!e3(n)||Go(e.maxByteLength)&&!(n.length<=e.maxByteLength)||Go(e.minByteLength)&&!(n.length>=e.minByteLength))}function hhs(e,t,n){return!0}function ghs(e,t,n){return hc.IsVoidLike(n)}function bhs(e,t,n){return kp.Has(e[on])?kp.Get(e[on])(e,n):!1}function Xm(e,t,n){let r=Go(e.$id)?zm(e,t):t,i=e;switch(i[on]){case"Any":return Ffs(i,r,n);case"Argument":return Ufs(i,r,n);case"Array":return Vfs(i,r,n);case"AsyncIterator":return Gfs(i,r,n);case"BigInt":return Wfs(i,r,n);case"Boolean":return $fs(i,r,n);case"Constructor":return Qfs(i,r,n);case"Date":return Hfs(i,r,n);case"Function":return Yfs(i,r,n);case"Import":return Zfs(i,r,n);case"Integer":return jfs(i,r,n);case"Intersect":return zfs(i,r,n);case"Iterator":return Xfs(i,r,n);case"Literal":return qfs(i,r,n);case"Never":return Kfs(i,r,n);case"Not":return Jfs(i,r,n);case"Null":return ehs(i,r,n);case"Number":return ths(i,r,n);case"Object":return nhs(i,r,n);case"Promise":return rhs(i,r,n);case"Record":return ihs(i,r,n);case"Ref":return shs(i,r,n);case"RegExp":return ohs(i,r,n);case"String":return ahs(i,r,n);case"Symbol":return lhs(i,r,n);case"TemplateLiteral":return chs(i,r,n);case"This":return uhs(i,r,n);case"Tuple":return dhs(i,r,n);case"Undefined":return phs(i,r,n);case"Union":return mhs(i,r,n);case"Uint8Array":return fhs(i,r,n);case"Unknown":return hhs(i,r,n);case"Void":return ghs(i,r,n);default:if(!kp.Has(i[on]))throw new vNe(i);return bhs(i,r,n)}}function Gs(...e){return e.length===3?Xm(e[0],e[1],e[2]):Xm(e[0],[],e[1])}var vNe,Uht=C(()=>{TZ();gS();RZ();Ur();EA();xP();bP();Wc();bd();Np();Js();vNe=class extends xi{constructor(t){super("Unknown type"),this.schema=t}}});var DA=C(()=>{Uht()});function uk(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Wo(e){return e!==void 0}function yr(e,t,n,r,i=[]){return{type:e,schema:t,path:n,value:r,message:Dht()({errorType:e,path:n,schema:t,value:r,errors:i}),errors:i}}function*yhs(e,t,n,r){}function*Ahs(e,t,n,r){}function*Ehs(e,t,n,r){if(!wi(r))return yield yr(an.Array,e,n,r);Wo(e.minItems)&&!(r.length>=e.minItems)&&(yield yr(an.ArrayMinItems,e,n,r)),Wo(e.maxItems)&&!(r.length<=e.maxItems)&&(yield yr(an.ArrayMaxItems,e,n,r));for(let o=0;o<r.length;o++)yield*qm(e.items,t,`${n}/${o}`,r[o]);if(e.uniqueItems===!0&&!(function(){let o=new Set;for(let a of r){let l=ck(a);if(o.has(l))return!1;o.add(l)}return!0})()&&(yield yr(an.ArrayUniqueItems,e,n,r)),!(Wo(e.contains)||Wo(e.minContains)||Wo(e.maxContains)))return;let i=Wo(e.contains)?e.contains:Gi(),s=r.reduce((o,a,l)=>qm(i,t,`${n}${l}`,a).next().done===!0?o+1:o,0);s===0&&(yield yr(an.ArrayContains,e,n,r)),fi(e.minContains)&&s<e.minContains&&(yield yr(an.ArrayMinContains,e,n,r)),fi(e.maxContains)&&s>e.maxContains&&(yield yr(an.ArrayMaxContains,e,n,r))}function*_hs(e,t,n,r){$ie(r)||(yield yr(an.AsyncIterator,e,n,r))}function*Shs(e,t,n,r){if(!Qm(r))return yield yr(an.BigInt,e,n,r);Wo(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)&&(yield yr(an.BigIntExclusiveMaximum,e,n,r)),Wo(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)&&(yield yr(an.BigIntExclusiveMinimum,e,n,r)),Wo(e.maximum)&&!(r<=e.maximum)&&(yield yr(an.BigIntMaximum,e,n,r)),Wo(e.minimum)&&!(r>=e.minimum)&&(yield yr(an.BigIntMinimum,e,n,r)),Wo(e.multipleOf)&&r%e.multipleOf!==BigInt(0)&&(yield yr(an.BigIntMultipleOf,e,n,r))}function*vhs(e,t,n,r){Cv(r)||(yield yr(an.Boolean,e,n,r))}function*xhs(e,t,n,r){yield*qm(e.returns,t,n,r.prototype)}function*Chs(e,t,n,r){if(!Xh(r))return yield yr(an.Date,e,n,r);Wo(e.exclusiveMaximumTimestamp)&&!(r.getTime()<e.exclusiveMaximumTimestamp)&&(yield yr(an.DateExclusiveMaximumTimestamp,e,n,r)),Wo(e.exclusiveMinimumTimestamp)&&!(r.getTime()>e.exclusiveMinimumTimestamp)&&(yield yr(an.DateExclusiveMinimumTimestamp,e,n,r)),Wo(e.maximumTimestamp)&&!(r.getTime()<=e.maximumTimestamp)&&(yield yr(an.DateMaximumTimestamp,e,n,r)),Wo(e.minimumTimestamp)&&!(r.getTime()>=e.minimumTimestamp)&&(yield yr(an.DateMinimumTimestamp,e,n,r)),Wo(e.multipleOfTimestamp)&&r.getTime()%e.multipleOfTimestamp!==0&&(yield yr(an.DateMultipleOfTimestamp,e,n,r))}function*Ths(e,t,n,r){ET(r)||(yield yr(an.Function,e,n,r))}function*Ihs(e,t,n,r){let i=globalThis.Object.values(e.$defs),s=e.$defs[e.$ref];yield*qm(s,[...t,...i],n,r)}function*whs(e,t,n,r){if(!Yie(r))return yield yr(an.Integer,e,n,r);Wo(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)&&(yield yr(an.IntegerExclusiveMaximum,e,n,r)),Wo(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)&&(yield yr(an.IntegerExclusiveMinimum,e,n,r)),Wo(e.maximum)&&!(r<=e.maximum)&&(yield yr(an.IntegerMaximum,e,n,r)),Wo(e.minimum)&&!(r>=e.minimum)&&(yield yr(an.IntegerMinimum,e,n,r)),Wo(e.multipleOf)&&r%e.multipleOf!==0&&(yield yr(an.IntegerMultipleOf,e,n,r))}function*Rhs(e,t,n,r){let i=!1;for(let s of e.allOf)for(let o of qm(s,t,n,r))i=!0,yield o;if(i)return yield yr(an.Intersect,e,n,r);if(e.unevaluatedProperties===!1){let s=new RegExp(Iv(e));for(let o of Object.getOwnPropertyNames(r))s.test(o)||(yield yr(an.IntersectUnevaluatedProperties,e,`${n}/${o}`,r))}if(typeof e.unevaluatedProperties=="object"){let s=new RegExp(Iv(e));for(let o of Object.getOwnPropertyNames(r))if(!s.test(o)){let a=qm(e.unevaluatedProperties,t,`${n}/${o}`,r[o]).next();a.done||(yield a.value)}}}function*Nhs(e,t,n,r){Qie(r)||(yield yr(an.Iterator,e,n,r))}function*khs(e,t,n,r){r!==e.const&&(yield yr(an.Literal,e,n,r))}function*Ohs(e,t,n,r){yield yr(an.Never,e,n,r)}function*Mhs(e,t,n,r){qm(e.not,t,n,r).next().done===!0&&(yield yr(an.Not,e,n,r))}function*Phs(e,t,n,r){AT(r)||(yield yr(an.Null,e,n,r))}function*Dhs(e,t,n,r){if(!hc.IsNumberLike(r))return yield yr(an.Number,e,n,r);Wo(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)&&(yield yr(an.NumberExclusiveMaximum,e,n,r)),Wo(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)&&(yield yr(an.NumberExclusiveMinimum,e,n,r)),Wo(e.maximum)&&!(r<=e.maximum)&&(yield yr(an.NumberMaximum,e,n,r)),Wo(e.minimum)&&!(r>=e.minimum)&&(yield yr(an.NumberMinimum,e,n,r)),Wo(e.multipleOf)&&r%e.multipleOf!==0&&(yield yr(an.NumberMultipleOf,e,n,r))}function*Bhs(e,t,n,r){if(!hc.IsObjectLike(r))return yield yr(an.Object,e,n,r);Wo(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)&&(yield yr(an.ObjectMinProperties,e,n,r)),Wo(e.maxProperties)&&!(Object.getOwnPropertyNames(r).length<=e.maxProperties)&&(yield yr(an.ObjectMaxProperties,e,n,r));let i=Array.isArray(e.required)?e.required:[],s=Object.getOwnPropertyNames(e.properties),o=Object.getOwnPropertyNames(r);for(let a of i)o.includes(a)||(yield yr(an.ObjectRequiredProperty,e.properties[a],`${n}/${uk(a)}`,void 0));if(e.additionalProperties===!1)for(let a of o)s.includes(a)||(yield yr(an.ObjectAdditionalProperties,e,`${n}/${uk(a)}`,r[a]));if(typeof e.additionalProperties=="object")for(let a of o)s.includes(a)||(yield*qm(e.additionalProperties,t,`${n}/${uk(a)}`,r[a]));for(let a of s){let l=e.properties[a];e.required&&e.required.includes(a)?(yield*qm(l,t,`${n}/${uk(a)}`,r[a]),wv(e)&&!(a in r)&&(yield yr(an.ObjectRequiredProperty,l,`${n}/${uk(a)}`,void 0))):hc.IsExactOptionalProperty(r,a)&&(yield*qm(l,t,`${n}/${uk(a)}`,r[a]))}}function*Lhs(e,t,n,r){Hie(r)||(yield yr(an.Promise,e,n,r))}function*Fhs(e,t,n,r){if(!hc.IsRecordLike(r))return yield yr(an.Object,e,n,r);Wo(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)&&(yield yr(an.ObjectMinProperties,e,n,r)),Wo(e.maxProperties)&&!(Object.getOwnPropertyNames(r).length<=e.maxProperties)&&(yield yr(an.ObjectMaxProperties,e,n,r));let[i,s]=Object.entries(e.patternProperties)[0],o=new RegExp(i);for(let[a,l]of Object.entries(r))o.test(a)&&(yield*qm(s,t,`${n}/${uk(a)}`,l));if(typeof e.additionalProperties=="object")for(let[a,l]of Object.entries(r))o.test(a)||(yield*qm(e.additionalProperties,t,`${n}/${uk(a)}`,l));if(e.additionalProperties===!1){for(let[a,l]of Object.entries(r))if(!o.test(a))return yield yr(an.ObjectAdditionalProperties,e,`${n}/${uk(a)}`,l)}}function*Uhs(e,t,n,r){yield*qm(la(e,t),t,n,r)}function*Vhs(e,t,n,r){if(!Vo(r))return yield yr(an.String,e,n,r);if(Wo(e.minLength)&&!(r.length>=e.minLength)&&(yield yr(an.StringMinLength,e,n,r)),Wo(e.maxLength)&&!(r.length<=e.maxLength)&&(yield yr(an.StringMaxLength,e,n,r)),!new RegExp(e.source,e.flags).test(r))return yield yr(an.RegExp,e,n,r)}function*Ghs(e,t,n,r){if(!Vo(r))return yield yr(an.String,e,n,r);Wo(e.minLength)&&!(r.length>=e.minLength)&&(yield yr(an.StringMinLength,e,n,r)),Wo(e.maxLength)&&!(r.length<=e.maxLength)&&(yield yr(an.StringMaxLength,e,n,r)),Vo(e.pattern)&&(new RegExp(e.pattern).test(r)||(yield yr(an.StringPattern,e,n,r))),Vo(e.format)&&(Jh.Has(e.format)?Jh.Get(e.format)(r)||(yield yr(an.StringFormat,e,n,r)):yield yr(an.StringFormatUnknown,e,n,r))}function*Whs(e,t,n,r){_T(r)||(yield yr(an.Symbol,e,n,r))}function*$hs(e,t,n,r){if(!Vo(r))return yield yr(an.String,e,n,r);new RegExp(e.pattern).test(r)||(yield yr(an.StringPattern,e,n,r))}function*Qhs(e,t,n,r){yield*qm(la(e,t),t,n,r)}function*Hhs(e,t,n,r){if(!wi(r))return yield yr(an.Tuple,e,n,r);if(e.items===void 0&&r.length!==0)return yield yr(an.TupleLength,e,n,r);if(r.length!==e.maxItems)return yield yr(an.TupleLength,e,n,r);if(e.items)for(let i=0;i<e.items.length;i++)yield*qm(e.items[i],t,`${n}/${i}`,r[i])}function*Yhs(e,t,n,r){Oc(r)||(yield yr(an.Undefined,e,n,r))}function*Zhs(e,t,n,r){if(Gs(e,t,r))return;let i=e.anyOf.map(s=>new BA(qm(s,t,n,r)));yield yr(an.Union,e,n,r,i)}function*jhs(e,t,n,r){if(!e3(r))return yield yr(an.Uint8Array,e,n,r);Wo(e.maxByteLength)&&!(r.length<=e.maxByteLength)&&(yield yr(an.Uint8ArrayMaxByteLength,e,n,r)),Wo(e.minByteLength)&&!(r.length>=e.minByteLength)&&(yield yr(an.Uint8ArrayMinByteLength,e,n,r))}function*zhs(e,t,n,r){}function*Xhs(e,t,n,r){hc.IsVoidLike(r)||(yield yr(an.Void,e,n,r))}function*qhs(e,t,n,r){kp.Get(e[on])(e,r)||(yield yr(an.Kind,e,n,r))}function*qm(e,t,n,r){let i=Wo(e.$id)?[...t,e]:t,s=e;switch(s[on]){case"Any":return yield*yhs(s,i,n,r);case"Argument":return yield*Ahs(s,i,n,r);case"Array":return yield*Ehs(s,i,n,r);case"AsyncIterator":return yield*_hs(s,i,n,r);case"BigInt":return yield*Shs(s,i,n,r);case"Boolean":return yield*vhs(s,i,n,r);case"Constructor":return yield*xhs(s,i,n,r);case"Date":return yield*Chs(s,i,n,r);case"Function":return yield*Ths(s,i,n,r);case"Import":return yield*Ihs(s,i,n,r);case"Integer":return yield*whs(s,i,n,r);case"Intersect":return yield*Rhs(s,i,n,r);case"Iterator":return yield*Nhs(s,i,n,r);case"Literal":return yield*khs(s,i,n,r);case"Never":return yield*Ohs(s,i,n,r);case"Not":return yield*Mhs(s,i,n,r);case"Null":return yield*Phs(s,i,n,r);case"Number":return yield*Dhs(s,i,n,r);case"Object":return yield*Bhs(s,i,n,r);case"Promise":return yield*Lhs(s,i,n,r);case"Record":return yield*Fhs(s,i,n,r);case"Ref":return yield*Uhs(s,i,n,r);case"RegExp":return yield*Vhs(s,i,n,r);case"String":return yield*Ghs(s,i,n,r);case"Symbol":return yield*Whs(s,i,n,r);case"TemplateLiteral":return yield*$hs(s,i,n,r);case"This":return yield*Qhs(s,i,n,r);case"Tuple":return yield*Hhs(s,i,n,r);case"Undefined":return yield*Yhs(s,i,n,r);case"Union":return yield*Zhs(s,i,n,r);case"Uint8Array":return yield*jhs(s,i,n,r);case"Unknown":return yield*zhs(s,i,n,r);case"Void":return yield*Xhs(s,i,n,r);default:if(!kp.Has(s[on]))throw new xNe(e);return yield*qhs(s,i,n,r)}}function Qv(...e){let t=e.length===3?qm(e[0],e[1],"",e[2]):qm(e[0],[],"",e[1]);return new BA(t)}var an,xNe,BA,Lht=C(()=>{TZ();EA();bP();cCe();Bht();Wc();gS();RZ();DA();Ur();bd();Np();(function(e){e[e.ArrayContains=0]="ArrayContains",e[e.ArrayMaxContains=1]="ArrayMaxContains",e[e.ArrayMaxItems=2]="ArrayMaxItems",e[e.ArrayMinContains=3]="ArrayMinContains",e[e.ArrayMinItems=4]="ArrayMinItems",e[e.ArrayUniqueItems=5]="ArrayUniqueItems",e[e.Array=6]="Array",e[e.AsyncIterator=7]="AsyncIterator",e[e.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",e[e.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",e[e.BigIntMaximum=10]="BigIntMaximum",e[e.BigIntMinimum=11]="BigIntMinimum",e[e.BigIntMultipleOf=12]="BigIntMultipleOf",e[e.BigInt=13]="BigInt",e[e.Boolean=14]="Boolean",e[e.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",e[e.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",e[e.DateMaximumTimestamp=17]="DateMaximumTimestamp",e[e.DateMinimumTimestamp=18]="DateMinimumTimestamp",e[e.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",e[e.Date=20]="Date",e[e.Function=21]="Function",e[e.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",e[e.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",e[e.IntegerMaximum=24]="IntegerMaximum",e[e.IntegerMinimum=25]="IntegerMinimum",e[e.IntegerMultipleOf=26]="IntegerMultipleOf",e[e.Integer=27]="Integer",e[e.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",e[e.Intersect=29]="Intersect",e[e.Iterator=30]="Iterator",e[e.Kind=31]="Kind",e[e.Literal=32]="Literal",e[e.Never=33]="Never",e[e.Not=34]="Not",e[e.Null=35]="Null",e[e.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",e[e.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",e[e.NumberMaximum=38]="NumberMaximum",e[e.NumberMinimum=39]="NumberMinimum",e[e.NumberMultipleOf=40]="NumberMultipleOf",e[e.Number=41]="Number",e[e.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",e[e.ObjectMaxProperties=43]="ObjectMaxProperties",e[e.ObjectMinProperties=44]="ObjectMinProperties",e[e.ObjectRequiredProperty=45]="ObjectRequiredProperty",e[e.Object=46]="Object",e[e.Promise=47]="Promise",e[e.RegExp=48]="RegExp",e[e.StringFormatUnknown=49]="StringFormatUnknown",e[e.StringFormat=50]="StringFormat",e[e.StringMaxLength=51]="StringMaxLength",e[e.StringMinLength=52]="StringMinLength",e[e.StringPattern=53]="StringPattern",e[e.String=54]="String",e[e.Symbol=55]="Symbol",e[e.TupleLength=56]="TupleLength",e[e.Tuple=57]="Tuple",e[e.Uint8ArrayMaxByteLength=58]="Uint8ArrayMaxByteLength",e[e.Uint8ArrayMinByteLength=59]="Uint8ArrayMinByteLength",e[e.Uint8Array=60]="Uint8Array",e[e.Undefined=61]="Undefined",e[e.Union=62]="Union",e[e.Void=63]="Void"})(an||(an={}));xNe=class extends xi{constructor(t){super("Unknown type"),this.schema=t}};BA=class{constructor(t){this.iterator=t}[Symbol.iterator](){return this.iterator}First(){let t=this.iterator.next();return t.done?void 0:t.value}}});var S4={};ui(S4,{DefaultErrorFunction:()=>a2n,Errors:()=>Qv,GetErrorFunction:()=>Dht,SetErrorFunction:()=>Efs,ValueErrorIterator:()=>BA,ValueErrorType:()=>an,ValueErrorsUnknownTypeError:()=>xNe});var aI=C(()=>{Lht();Bht()});function vu(e,t,n){try{return ha(e)?e[Mc].Decode(n):n}catch(r){throw new CNe(e,t,n,r)}}function Khs(e,t,n,r){return wi(r)?vu(e,n,r.map((i,s)=>Hv(e.items,t,`${n}/${s}`,i))):vu(e,n,r)}function Jhs(e,t,n,r){if(!hs(r)||Ly(r))return vu(e,n,r);let i=uH(e),s=i.map(c=>c[0]),o={...r};for(let[c,d]of i)c in o&&(o[c]=Hv(d,t,`${n}/${c}`,o[c]));if(!ha(e.unevaluatedProperties))return vu(e,n,o);let a=Object.getOwnPropertyNames(o),l=e.unevaluatedProperties,u={...o};for(let c of a)s.includes(c)||(u[c]=vu(l,`${n}/${c}`,u[c]));return vu(e,n,u)}function egs(e,t,n,r){let i=globalThis.Object.values(e.$defs),s=e.$defs[e.$ref],o=Hv(s,[...t,...i],n,r);return vu(e,n,o)}function tgs(e,t,n,r){return vu(e,n,Hv(e.not,t,n,r))}function ngs(e,t,n,r){if(!hs(r))return vu(e,n,r);let i=rg(e),s={...r};for(let u of i)Vi(s,u)&&(Oc(s[u])&&(!xT(e.properties[u])||hc.IsExactOptionalProperty(s,u))||(s[u]=Hv(e.properties[u],t,`${n}/${u}`,s[u])));if(!$c(e.additionalProperties))return vu(e,n,s);let o=Object.getOwnPropertyNames(s),a=e.additionalProperties,l={...s};for(let u of o)i.includes(u)||(l[u]=vu(a,`${n}/${u}`,l[u]));return vu(e,n,l)}function rgs(e,t,n,r){if(!hs(r))return vu(e,n,r);let i=Object.getOwnPropertyNames(e.patternProperties)[0],s=new RegExp(i),o={...r};for(let c of Object.getOwnPropertyNames(r))s.test(c)&&(o[c]=Hv(e.patternProperties[i],t,`${n}/${c}`,o[c]));if(!$c(e.additionalProperties))return vu(e,n,o);let a=Object.getOwnPropertyNames(o),l=e.additionalProperties,u={...o};for(let c of a)s.test(c)||(u[c]=vu(l,`${n}/${c}`,u[c]));return vu(e,n,u)}function igs(e,t,n,r){let i=la(e,t);return vu(e,n,Hv(i,t,n,r))}function sgs(e,t,n,r){let i=la(e,t);return vu(e,n,Hv(i,t,n,r))}function ogs(e,t,n,r){return wi(r)&&wi(e.items)?vu(e,n,e.items.map((i,s)=>Hv(i,t,`${n}/${s}`,r[s]))):vu(e,n,r)}function ags(e,t,n,r){for(let i of e.anyOf){if(!Gs(i,t,r))continue;let s=Hv(i,t,n,r);return vu(e,n,s)}return vu(e,n,r)}function Hv(e,t,n,r){let i=zm(e,t),s=e;switch(e[on]){case"Array":return Khs(s,i,n,r);case"Import":return egs(s,i,n,r);case"Intersect":return Jhs(s,i,n,r);case"Not":return tgs(s,i,n,r);case"Object":return ngs(s,i,n,r);case"Record":return rgs(s,i,n,r);case"Ref":return igs(s,i,n,r);case"Symbol":return vu(s,n,r);case"This":return sgs(s,i,n,r);case"Tuple":return ogs(s,i,n,r);case"Union":return ags(s,i,n,r);default:return vu(s,n,r)}}function x4(e,t,n){return Hv(e,t,"",n)}var v4,CNe,f2n=C(()=>{Zie();Ur();Wc();EA();gS();DA();Np();Js();v4=class extends xi{constructor(t,n,r){super("Unable to decode value as it does not match the expected schema"),this.schema=t,this.value=n,this.error=r}},CNe=class extends xi{constructor(t,n,r,i){super(i instanceof Error?i.message:"Unknown error"),this.schema=t,this.path=n,this.value=r,this.error=i}}});function ih(e,t,n){try{return ha(e)?e[Mc].Encode(n):n}catch(r){throw new TNe(e,t,n,r)}}function lgs(e,t,n,r){let i=ih(e,n,r);return wi(i)?i.map((s,o)=>Yv(e.items,t,`${n}/${o}`,s)):i}function cgs(e,t,n,r){let i=globalThis.Object.values(e.$defs),s=e.$defs[e.$ref],o=ih(e,n,r);return Yv(s,[...t,...i],n,o)}function ugs(e,t,n,r){let i=ih(e,n,r);if(!hs(r)||Ly(r))return i;let s=uH(e),o=s.map(d=>d[0]),a={...i};for(let[d,p]of s)d in a&&(a[d]=Yv(p,t,`${n}/${d}`,a[d]));if(!ha(e.unevaluatedProperties))return a;let l=Object.getOwnPropertyNames(a),u=e.unevaluatedProperties,c={...a};for(let d of l)o.includes(d)||(c[d]=ih(u,`${n}/${d}`,c[d]));return c}function dgs(e,t,n,r){return ih(e.not,n,ih(e,n,r))}function pgs(e,t,n,r){let i=ih(e,n,r);if(!hs(i))return i;let s=rg(e),o={...i};for(let c of s)Vi(o,c)&&(Oc(o[c])&&(!xT(e.properties[c])||hc.IsExactOptionalProperty(o,c))||(o[c]=Yv(e.properties[c],t,`${n}/${c}`,o[c])));if(!$c(e.additionalProperties))return o;let a=Object.getOwnPropertyNames(o),l=e.additionalProperties,u={...o};for(let c of a)s.includes(c)||(u[c]=ih(l,`${n}/${c}`,u[c]));return u}function mgs(e,t,n,r){let i=ih(e,n,r);if(!hs(r))return i;let s=Object.getOwnPropertyNames(e.patternProperties)[0],o=new RegExp(s),a={...i};for(let d of Object.getOwnPropertyNames(r))o.test(d)&&(a[d]=Yv(e.patternProperties[s],t,`${n}/${d}`,a[d]));if(!$c(e.additionalProperties))return a;let l=Object.getOwnPropertyNames(a),u=e.additionalProperties,c={...a};for(let d of l)o.test(d)||(c[d]=ih(u,`${n}/${d}`,c[d]));return c}function fgs(e,t,n,r){let i=la(e,t),s=Yv(i,t,n,r);return ih(e,n,s)}function hgs(e,t,n,r){let i=la(e,t),s=Yv(i,t,n,r);return ih(e,n,s)}function ggs(e,t,n,r){let i=ih(e,n,r);return wi(e.items)?e.items.map((s,o)=>Yv(s,t,`${n}/${o}`,i[o])):[]}function bgs(e,t,n,r){for(let i of e.anyOf){if(!Gs(i,t,r))continue;let s=Yv(i,t,n,r);return ih(e,n,s)}for(let i of e.anyOf){let s=Yv(i,t,n,r);if(Gs(e,t,s))return ih(e,n,s)}return ih(e,n,r)}function Yv(e,t,n,r){let i=zm(e,t),s=e;switch(e[on]){case"Array":return lgs(s,i,n,r);case"Import":return cgs(s,i,n,r);case"Intersect":return ugs(s,i,n,r);case"Not":return dgs(s,i,n,r);case"Object":return pgs(s,i,n,r);case"Record":return mgs(s,i,n,r);case"Ref":return fgs(s,i,n,r);case"This":return hgs(s,i,n,r);case"Tuple":return ggs(s,i,n,r);case"Union":return bgs(s,i,n,r);default:return ih(s,n,r)}}function T4(e,t,n){return Yv(e,t,"",n)}var C4,TNe,h2n=C(()=>{Zie();Ur();Wc();EA();gS();DA();Np();Js();C4=class extends xi{constructor(t,n,r){super("The encoded value does not match the expected schema"),this.schema=t,this.value=n,this.error=r}},TNe=class extends xi{constructor(t,n,r,i){super(`${i instanceof Error?i.message:"Unknown error"}`),this.schema=t,this.path=n,this.value=r,this.error=i}}});function ygs(e,t){return ha(e)||cm(e.items,t)}function Ags(e,t){return ha(e)||cm(e.items,t)}function Egs(e,t){return ha(e)||cm(e.returns,t)||e.parameters.some(n=>cm(n,t))}function _gs(e,t){return ha(e)||cm(e.returns,t)||e.parameters.some(n=>cm(n,t))}function Sgs(e,t){return ha(e)||ha(e.unevaluatedProperties)||e.allOf.some(n=>cm(n,t))}function vgs(e,t){let n=globalThis.Object.getOwnPropertyNames(e.$defs).reduce((i,s)=>[...i,e.$defs[s]],[]),r=e.$defs[e.$ref];return ha(e)||cm(r,[...n,...t])}function xgs(e,t){return ha(e)||cm(e.items,t)}function Cgs(e,t){return ha(e)||cm(e.not,t)}function Tgs(e,t){return ha(e)||Object.values(e.properties).some(n=>cm(n,t))||$c(e.additionalProperties)&&cm(e.additionalProperties,t)}function Igs(e,t){return ha(e)||cm(e.item,t)}function wgs(e,t){let n=Object.getOwnPropertyNames(e.patternProperties)[0],r=e.patternProperties[n];return ha(e)||cm(r,t)||$c(e.additionalProperties)&&ha(e.additionalProperties)}function Rgs(e,t){return ha(e)?!0:cm(la(e,t),t)}function Ngs(e,t){return ha(e)?!0:cm(la(e,t),t)}function kgs(e,t){return ha(e)||!Oc(e.items)&&e.items.some(n=>cm(n,t))}function Ogs(e,t){return ha(e)||e.anyOf.some(n=>cm(n,t))}function cm(e,t){let n=zm(e,t),r=e;if(e.$id&&Vht.has(e.$id))return!1;switch(e.$id&&Vht.add(e.$id),e[on]){case"Array":return ygs(r,n);case"AsyncIterator":return Ags(r,n);case"Constructor":return Egs(r,n);case"Function":return _gs(r,n);case"Import":return vgs(r,n);case"Intersect":return Sgs(r,n);case"Iterator":return xgs(r,n);case"Not":return Cgs(r,n);case"Object":return Tgs(r,n);case"Promise":return Igs(r,n);case"Record":return wgs(r,n);case"Ref":return Rgs(r,n);case"This":return Ngs(r,n);case"Tuple":return kgs(r,n);case"Union":return Ogs(r,n);default:return ha(e)}}function lI(e,t){return Vht.clear(),cm(e,t)}var Vht,g2n=C(()=>{gS();Ur();Js();Np();Vht=new Set});var NZ=C(()=>{f2n();h2n();g2n()});function ID(e){if(!Vo(e))throw Error("ConstantString: Not a String");return`'${JSON.stringify(e).slice(1,-1).replace(/'/g,"\\'")}'`}function b2n(e,t){return`${e}[${ID(t)}]`}var INe,wNe,Ght,RNe,hle,wD,I4,y2n=C(()=>{NZ();aI();TZ();Wc();gS();RZ();Ur();bP();EA();cCe();bd();kT();Np();nrt();INe=class{constructor(t,n,r,i){this.schema=t,this.references=n,this.checkFunc=r,this.code=i,this.hasTransform=lI(t,n)}Code(){return this.code}Schema(){return this.schema}References(){return this.references}Errors(t){return Qv(this.schema,this.references,t)}Check(t){return this.checkFunc(t)}Decode(t){if(!this.checkFunc(t))throw new v4(this.schema,t,this.Errors(t).First());return this.hasTransform?x4(this.schema,this.references,t):t}Encode(t){let n=this.hasTransform?T4(this.schema,this.references,t):t;if(!this.checkFunc(n))throw new C4(this.schema,t,this.Errors(t).First());return n}};(function(e){function t(s){return s===36}e.DollarSign=t;function n(s){return s===95}e.IsUnderscore=n;function r(s){return s>=65&&s<=90||s>=97&&s<=122}e.IsAlpha=r;function i(s){return s>=48&&s<=57}e.IsNumeric=i})(wNe||(wNe={}));(function(e){function t(n){let r=[];for(let i=0;i<n.length;i++){let s=n.charCodeAt(i);wNe.IsNumeric(s)||wNe.IsAlpha(s)?r.push(n.charAt(i)):r.push(`_${s}_`)}return r.join("").replace(/__/g,"_")}e.Encode=t})(Ght||(Ght={}));RNe=class extends xi{constructor(t){super("Unknown type"),this.schema=t}},hle=class extends xi{constructor(t){super("Preflight validation check failed to guard for the given schema"),this.schema=t}};(function(e){function t(o,a,l){return hc.ExactOptionalPropertyTypes?`(${ID(a)} in ${o} ? ${l} : true)`:`(${b2n(o,a)} !== undefined ? ${l} : true)`}e.IsExactOptionalProperty=t;function n(o){return hc.AllowArrayObject?`(typeof ${o} === 'object' && ${o} !== null)`:`(typeof ${o} === 'object' && ${o} !== null && !Array.isArray(${o}))`}e.IsObjectLike=n;function r(o){return hc.AllowArrayObject?`(typeof ${o} === 'object' && ${o} !== null && !(${o} instanceof Date) && !(${o} instanceof Uint8Array))`:`(typeof ${o} === 'object' && ${o} !== null && !Array.isArray(${o}) && !(${o} instanceof Date) && !(${o} instanceof Uint8Array))`}e.IsRecordLike=r;function i(o){return hc.AllowNaN?`typeof ${o} === 'number'`:`Number.isFinite(${o})`}e.IsNumberLike=i;function s(o){return hc.AllowNullVoid?`(${o} === undefined || ${o} === null)`:`${o} === undefined`}e.IsVoidLike=s})(wD||(wD={}));(function(e){function t(ee){return ee[on]==="Any"||ee[on]==="Unknown"}function*n(ee,X,$){yield"true"}function*r(ee,X,$){yield"true"}function*i(ee,X,$){yield`Array.isArray(${$})`;let[se,oe]=[j("value","any"),j("acc","number")];fi(ee.maxItems)&&(yield`${$}.length <= ${ee.maxItems}`),fi(ee.minItems)&&(yield`${$}.length >= ${ee.minItems}`);let we=ue(ee.items,X,"value");if(yield`((array) => { for(const ${se} of array) if(!(${we})) { return false }; return true; })(${$})`,Qc(ee.contains)||fi(ee.minContains)||fi(ee.maxContains)){let Re=Qc(ee.contains)?ee.contains:Gi(),xe=ue(Re,X,"value"),re=fi(ee.minContains)?[`(count >= ${ee.minContains})`]:[],Me=fi(ee.maxContains)?[`(count <= ${ee.maxContains})`]:[],Ze=`const count = value.reduce((${oe}, ${se}) => ${xe} ? acc + 1 : acc, 0)`,He=["(count > 0)",...re,...Me].join(" && ");yield`((${se}) => { ${Ze}; return ${He}})(${$})`}ee.uniqueItems===!0&&(yield`((${se}) => { const set = new Set(); for(const element of value) { const hashed = hash(element); if(set.has(hashed)) { return false } else { set.add(hashed) } } return true } )(${$})`)}function*s(ee,X,$){yield`(typeof value === 'object' && Symbol.asyncIterator in ${$})`}function*o(ee,X,$){yield`(typeof ${$} === 'bigint')`,Qm(ee.exclusiveMaximum)&&(yield`${$} < BigInt(${ee.exclusiveMaximum})`),Qm(ee.exclusiveMinimum)&&(yield`${$} > BigInt(${ee.exclusiveMinimum})`),Qm(ee.maximum)&&(yield`${$} <= BigInt(${ee.maximum})`),Qm(ee.minimum)&&(yield`${$} >= BigInt(${ee.minimum})`),Qm(ee.multipleOf)&&(yield`(${$} % BigInt(${ee.multipleOf})) === 0`)}function*a(ee,X,$){yield`(typeof ${$} === 'boolean')`}function*l(ee,X,$){yield*ie(ee.returns,X,`${$}.prototype`)}function*u(ee,X,$){yield`(${$} instanceof Date) && Number.isFinite(${$}.getTime())`,fi(ee.exclusiveMaximumTimestamp)&&(yield`${$}.getTime() < ${ee.exclusiveMaximumTimestamp}`),fi(ee.exclusiveMinimumTimestamp)&&(yield`${$}.getTime() > ${ee.exclusiveMinimumTimestamp}`),fi(ee.maximumTimestamp)&&(yield`${$}.getTime() <= ${ee.maximumTimestamp}`),fi(ee.minimumTimestamp)&&(yield`${$}.getTime() >= ${ee.minimumTimestamp}`),fi(ee.multipleOfTimestamp)&&(yield`(${$}.getTime() % ${ee.multipleOfTimestamp}) === 0`)}function*c(ee,X,$){yield`(typeof ${$} === 'function')`}function*d(ee,X,$){let se=globalThis.Object.getOwnPropertyNames(ee.$defs).reduce((oe,we)=>[...oe,ee.$defs[we]],[]);yield*ie(Zm(ee.$ref),[...X,...se],$)}function*p(ee,X,$){yield`Number.isInteger(${$})`,fi(ee.exclusiveMaximum)&&(yield`${$} < ${ee.exclusiveMaximum}`),fi(ee.exclusiveMinimum)&&(yield`${$} > ${ee.exclusiveMinimum}`),fi(ee.maximum)&&(yield`${$} <= ${ee.maximum}`),fi(ee.minimum)&&(yield`${$} >= ${ee.minimum}`),fi(ee.multipleOf)&&(yield`(${$} % ${ee.multipleOf}) === 0`)}function*m(ee,X,$){let se=ee.allOf.map(oe=>ue(oe,X,$)).join(" && ");if(ee.unevaluatedProperties===!1){let oe=W(`${new RegExp(Iv(ee))};`),we=`Object.getOwnPropertyNames(${$}).every(key => ${oe}.test(key))`;yield`(${se} && ${we})`}else if(Qc(ee.unevaluatedProperties)){let oe=W(`${new RegExp(Iv(ee))};`),we=`Object.getOwnPropertyNames(${$}).every(key => ${oe}.test(key) || ${ue(ee.unevaluatedProperties,X,`${$}[key]`)})`;yield`(${se} && ${we})`}else yield`(${se})`}function*f(ee,X,$){yield`(typeof value === 'object' && Symbol.iterator in ${$})`}function*h(ee,X,$){if(typeof ee.const=="number"||typeof ee.const=="boolean")yield`(${$} === ${ee.const})`;else if(typeof ee.const=="string")yield`(${$} === ${ID(ee.const)})`;else throw Error("Invalid Literal Value")}function*g(ee,X,$){yield"false"}function*b(ee,X,$){yield`(!${ue(ee.not,X,$)})`}function*A(ee,X,$){yield`(${$} === null)`}function*y(ee,X,$){yield wD.IsNumberLike($),fi(ee.exclusiveMaximum)&&(yield`${$} < ${ee.exclusiveMaximum}`),fi(ee.exclusiveMinimum)&&(yield`${$} > ${ee.exclusiveMinimum}`),fi(ee.maximum)&&(yield`${$} <= ${ee.maximum}`),fi(ee.minimum)&&(yield`${$} >= ${ee.minimum}`),fi(ee.multipleOf)&&(yield`(${$} % ${ee.multipleOf}) === 0`)}function*S(ee,X,$){yield wD.IsObjectLike($),fi(ee.minProperties)&&(yield`Object.getOwnPropertyNames(${$}).length >= ${ee.minProperties}`),fi(ee.maxProperties)&&(yield`Object.getOwnPropertyNames(${$}).length <= ${ee.maxProperties}`);let se=Object.getOwnPropertyNames(ee.properties);for(let oe of se){let we=b2n($,oe),Re=ee.properties[oe];if(ee.required&&ee.required.includes(oe))yield*ie(Re,X,we),(wv(Re)||t(Re))&&(yield`(${ID(oe)} in ${$})`);else{let xe=ue(Re,X,we);yield wD.IsExactOptionalProperty($,oe,xe)}}if(ee.additionalProperties===!1)if(ee.required&&ee.required.length===se.length)yield`Object.getOwnPropertyNames(${$}).length === ${se.length}`;else{let oe=`[${se.map(we=>`${ID(we)}`).join(", ")}]`;yield`Object.getOwnPropertyNames(${$}).every(key => ${oe}.includes(key))`}if(typeof ee.additionalProperties=="object"){let oe=ue(ee.additionalProperties,X,`${$}[key]`),we=`[${se.map(Re=>`${ID(Re)}`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${$}).every(key => ${we}.includes(key) || ${oe}))`}}function*_(ee,X,$){yield`${$} instanceof Promise`}function*x(ee,X,$){yield wD.IsRecordLike($),fi(ee.minProperties)&&(yield`Object.getOwnPropertyNames(${$}).length >= ${ee.minProperties}`),fi(ee.maxProperties)&&(yield`Object.getOwnPropertyNames(${$}).length <= ${ee.maxProperties}`);let[se,oe]=Object.entries(ee.patternProperties)[0],we=W(`${new RegExp(se)}`),Re=ue(oe,X,"value"),xe=Qc(ee.additionalProperties)?ue(ee.additionalProperties,X,$):ee.additionalProperties===!1?"false":"true",re=`(${we}.test(key) ? ${Re} : ${xe})`;yield`(Object.entries(${$}).every(([key, value]) => ${re}))`}function*v(ee,X,$){let se=la(ee,X);if(ne.functions.has(ee.$ref))return yield`${le(ee.$ref)}(${$})`;yield*ie(se,X,$)}function*w(ee,X,$){let se=W(`${new RegExp(ee.source,ee.flags)};`);yield`(typeof ${$} === 'string')`,fi(ee.maxLength)&&(yield`${$}.length <= ${ee.maxLength}`),fi(ee.minLength)&&(yield`${$}.length >= ${ee.minLength}`),yield`${se}.test(${$})`}function*T(ee,X,$){yield`(typeof ${$} === 'string')`,fi(ee.maxLength)&&(yield`${$}.length <= ${ee.maxLength}`),fi(ee.minLength)&&(yield`${$}.length >= ${ee.minLength}`),ee.pattern!==void 0&&(yield`${W(`${new RegExp(ee.pattern)};`)}.test(${$})`),ee.format!==void 0&&(yield`format(${ID(ee.format)}, ${$})`)}function*D(ee,X,$){yield`(typeof ${$} === 'symbol')`}function*O(ee,X,$){yield`(typeof ${$} === 'string')`,yield`${W(`${new RegExp(ee.pattern)};`)}.test(${$})`}function*P(ee,X,$){yield`${le(ee.$ref)}(${$})`}function*k(ee,X,$){if(yield`Array.isArray(${$})`,ee.items===void 0)return yield`${$}.length === 0`;yield`(${$}.length === ${ee.maxItems})`;for(let se=0;se<ee.items.length;se++)yield`${ue(ee.items[se],X,`${$}[${se}]`)}`}function*M(ee,X,$){yield`${$} === undefined`}function*L(ee,X,$){yield`(${ee.anyOf.map(oe=>ue(oe,X,$)).join(" || ")})`}function*F(ee,X,$){yield`${$} instanceof Uint8Array`,fi(ee.maxByteLength)&&(yield`(${$}.length <= ${ee.maxByteLength})`),fi(ee.minByteLength)&&(yield`(${$}.length >= ${ee.minByteLength})`)}function*H(ee,X,$){yield"true"}function*U(ee,X,$){yield wD.IsVoidLike($)}function*J(ee,X,$){let se=ne.instances.size;ne.instances.set(se,ee),yield`kind(${ID(ee[on])}, ${se}, ${$})`}function*ie(ee,X,$,se=!0){let oe=Vo(ee.$id)?[...X,ee]:X,we=ee;if(se&&Vo(ee.$id)){let Re=le(ee.$id);if(ne.functions.has(Re))return yield`${Re}(${$})`;{ne.functions.set(Re,"<deferred>");let xe=Q(Re,ee,X,"value",!1);return ne.functions.set(Re,xe),yield`${Re}(${$})`}}switch(we[on]){case"Any":return yield*n(we,oe,$);case"Argument":return yield*r(we,oe,$);case"Array":return yield*i(we,oe,$);case"AsyncIterator":return yield*s(we,oe,$);case"BigInt":return yield*o(we,oe,$);case"Boolean":return yield*a(we,oe,$);case"Constructor":return yield*l(we,oe,$);case"Date":return yield*u(we,oe,$);case"Function":return yield*c(we,oe,$);case"Import":return yield*d(we,oe,$);case"Integer":return yield*p(we,oe,$);case"Intersect":return yield*m(we,oe,$);case"Iterator":return yield*f(we,oe,$);case"Literal":return yield*h(we,oe,$);case"Never":return yield*g(we,oe,$);case"Not":return yield*b(we,oe,$);case"Null":return yield*A(we,oe,$);case"Number":return yield*y(we,oe,$);case"Object":return yield*S(we,oe,$);case"Promise":return yield*_(we,oe,$);case"Record":return yield*x(we,oe,$);case"Ref":return yield*v(we,oe,$);case"RegExp":return yield*w(we,oe,$);case"String":return yield*T(we,oe,$);case"Symbol":return yield*D(we,oe,$);case"TemplateLiteral":return yield*O(we,oe,$);case"This":return yield*P(we,oe,$);case"Tuple":return yield*k(we,oe,$);case"Undefined":return yield*M(we,oe,$);case"Union":return yield*L(we,oe,$);case"Uint8Array":return yield*F(we,oe,$);case"Unknown":return yield*H(we,oe,$);case"Void":return yield*U(we,oe,$);default:if(!kp.Has(we[on]))throw new RNe(ee);return yield*J(we,oe,$)}}let ne={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function ue(ee,X,$,se=!0){return`(${[...ie(ee,X,$,se)].join(" && ")})`}function le(ee){return`check_${Ght.Encode(ee)}`}function W(ee){let X=`local_${ne.variables.size}`;return ne.variables.set(X,`const ${X} = ${ee}`),X}function Q(ee,X,$,se,oe=!0){let[we,Re]=[`
295
+ Offending fields: ${e.join(", ")}. Re-emit the call with corrected values for those fields only.`}function mfs(e,t){if(t.params?.missingProperty!==void 0||t.params?.additionalProperty!==void 0||!t.instancePath)return"";let n=ffs(e,t.instancePath);if(n===void 0)return"";if(typeof n=="string")return` (current value: ${n.length>hNe?JSON.stringify(`${n.slice(0,hNe)}\u2026`):JSON.stringify(n)})`;let r;try{r=JSON.stringify(n)}catch{return""}return r===void 0?"":` (current value: ${r.length>hNe?`${r.slice(0,hNe)}\u2026`:r})`}function ffs(e,t){if(t===""||t==="/")return e;let n=t.split("/").slice(1),r=e;for(let i of n){let s=i.replace(/~1/g,"/").replace(/~0/g,"~");if(r==null)return;if(Array.isArray(r)){let o=Number(s);if(!Number.isInteger(o)||o<0)return;r=r[o];continue}if(typeof r!="object")return;r=r[s]}return r}var Tht,Iht,wht,ifs,sfs,Wkn,ofs,$kn,afs,lfs,gNe,Rht,hNe,Ykn=C(()=>{"use strict";Tht=_n(EZ(),1),Iht=_n(Rkn(),1),wht=_n(Cht(),1),ifs=Tht.default.default||Tht.default,sfs=Iht.default.default||Iht.default,Wkn=wht.default.default||wht.default,ofs=typeof globalThis<"u"&&globalThis.chrome?.runtime?.id!==void 0;$kn={allErrors:!0,strict:!1,coerceTypes:!0},afs=/^https?:\/\/json-schema\.org\/draft-07\/schema#?$/,lfs=/^https?:\/\/json-schema\.org\/draft\/2020-12\/schema#?$/;gNe=null,Rht=null;if(Hkn())try{let e=new ifs($kn);Wkn(e);let t=new sfs($kn);Wkn(t),Qkn(e,"http://json-schema.org/draft-07/schema#","https://json-schema.org/draft-07/schema"),Qkn(t,"https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"),gNe=e,Rht=t}catch{console.warn("AJV validation disabled due to CSP restrictions")}hNe=200});var E4={};ui(E4,{AssistantMessageEventStream:()=>rk,EventStream:()=>hD,LEGACY_THINKING_LEVELS:()=>_Re,StringEnum:()=>ORe,Type:()=>te,appendAssistantMessageDiagnostic:()=>Gpt,calculateCost:()=>Oss,calculateDetailedContextUsedTokens:()=>JT,cleanupSessionResources:()=>Nos,clearApiProviders:()=>Ppt,complete:()=>imt,completeSimple:()=>cb,createAssistantMessageDiagnostic:()=>Vss,createAssistantMessageEventStream:()=>Hss,createAugmentTransportErrorDiagnostic:()=>$pt,discoverAugmentModels:()=>a4,extractDiagnosticError:()=>QIn,findAugmentTransportErrorContext:()=>Lv,findEnvKeys:()=>LIn,formatThrownValue:()=>$In,formatUnsupportedReasoningEffort:()=>lm,getApiProvider:()=>s4,getApiProviders:()=>Sss,getEnvApiKey:()=>KT,getModel:()=>kss,getModels:()=>Nae,getOrCreateAugmentClient:()=>il,getOverflowPatterns:()=>Uos,getProviders:()=>Rae,isContextOverflow:()=>sk,isContextOverflowErrorText:()=>uS,isDetailedContextUsage:()=>kA,isLegacyThinkingLevel:()=>lb,isModelUnavailableErrorText:()=>Mae,modelsAreEqual:()=>uo,normalizeReasoningEfforts:()=>xRe,parseAugmentTransportErrorDiagnostic:()=>YIn,parseJsonWithRepair:()=>wwn,parseStreamingJson:()=>lmt,reasoningSelectionLabel:()=>OA,reasoningSelections:()=>eh,registerApiProvider:()=>i4,registerBuiltInApiProviders:()=>tmt,registerSessionResourceCleanup:()=>Ros,repairJson:()=>amt,resetApiProviders:()=>ik,resolveReasoningCapabilities:()=>Ju,resolveReasoningSelection:()=>os,sanitizeAugmentTransportErrorContext:()=>kae,stream:()=>xwn,streamAugment:()=>nZ,streamSimple:()=>eI,streamSimpleAugment:()=>_wn,supportsXhigh:()=>VIn,toProviderStopReason:()=>Upt,unregisterApiProviders:()=>vss,validateToolArguments:()=>bNe,validateToolCall:()=>ufs});var Bi=C(()=>{"use strict";ds();yRe();Fpt();Vpt();emt();nmt();Swn();Cwn();SRe();Qpt();IRe();Rwn();kwn();Own();Ykn()});var TD,Nht=C(()=>{TD={name:"@augmentcode/auggie-v2",version:"1.2.0",description:"Auggie CLI Client by Augment Code",type:"module",piConfig:{name:"auggie",configDir:".augment"},bin:{auggie:"dist/cli.js","auggie-v2":"dist/cli.js",pi:"dist/cli.js"},main:"./dist/index.js",types:"./dist/index.d.ts",exports:{".":{source:"./src/index.ts",types:"./dist/index.d.ts",import:"./dist/index.js"},"./hooks":{types:"./dist/core/hooks/index.d.ts",import:"./dist/core/hooks/index.js"}},files:["dist","docs","examples","CHANGELOG.md"],scripts:{"check-types":"pnpm run bake:export-html && tsgo -p tsconfig.build.json",clean:"shx rm -rf dist",banners:"tsx --conditions=source scripts/print-banners.ts","cli:source":"tsx --conditions=source src/cli.ts",dev:"pnpm run bake:export-html && pnpm run cli:source","dev:debug":"pnpm run bake:export-html && node --conditions=source --inspect-wait=ws://localhost:6499/57uz7t2uyri --import tsx src/cli.ts","bake:export-html":"node scripts/bake-export-html.mjs",build:"pnpm run bake:export-html && tsgo -p tsconfig.build.json --noCheck && shx chmod +x dist/cli.js && shx cp src/runtime/register-extensions.js dist/runtime/register-extensions.js && shx cp src/runtime/cloud-bridge.js dist/runtime/cloud-bridge.js && shx cp src/runtime/cloud-tracer-bridge.js dist/runtime/cloud-tracer-bridge.js && shx cp src/runtime/cloud-error-bridge.js dist/runtime/cloud-error-bridge.js && shx cp src/runtime/mcp-error-bridge.js dist/runtime/mcp-error-bridge.js && pnpm run copy-assets","build:npm:release":"node scripts/build-npm-release.mjs","build:migration-engine":"node scripts/build-migration-engine.mjs","build:release:sea":"node scripts/build-sea-release.mjs","build:release:sea:from-onison":"node scripts/build-sea-from-onison.mjs","build:release-js":"pnpm run bake:export-html && tsgo -p tsconfig.release.json --noCheck && shx chmod +x dist/cli.js && shx cp src/runtime/register-extensions.js dist/runtime/register-extensions.js && shx cp src/runtime/cloud-bridge.js dist/runtime/cloud-bridge.js && shx cp src/runtime/cloud-tracer-bridge.js dist/runtime/cloud-tracer-bridge.js && shx cp src/runtime/cloud-error-bridge.js dist/runtime/cloud-error-bridge.js && shx cp src/runtime/mcp-error-bridge.js dist/runtime/mcp-error-bridge.js && pnpm run copy-assets","build:npm":"pnpm run build:npm:release","clean:npm-artifacts":"find dist -name '*.js' -not -path 'dist/cli.js' -not -path 'dist/index.js' -not -path 'dist/release/*' -not -path 'dist/core/export-html/*' -delete && find dist -name '*.js.map' -delete","copy-assets":"shx mkdir -p dist/modes/interactive/theme && shx cp src/modes/interactive/theme/*.json dist/modes/interactive/theme/",test:"pnpm run bake:export-html && vitest --run","test:acp:e2e":"pnpm run bake:export-html && vitest --run --config vitest.e2e.config.ts e2e-test/acp/","test:e2e:sanity":"pnpm run bake:export-html && vitest --run --config vitest.e2e.config.ts e2e-test/tui/sanity.test.ts","test:e2e:tui":"pnpm run bake:export-html && vitest --run --no-file-parallelism --config vitest.e2e.config.ts e2e-test/tui/","test:e2e:cli":"pnpm run bake:export-html && vitest --run --no-file-parallelism --config vitest.e2e.config.ts e2e-test/cli/",prepublishOnly:"pnpm run clean && pnpm run build"},dependencies:{"@agentclientprotocol/sdk":"1.4.0","@augmentcode/api-client":"workspace:*","@earendil-works/pi-agent-core":"workspace:*","@earendil-works/pi-ai":"workspace:*","@earendil-works/pi-indexing":"workspace:*","@earendil-works/pi-tui":"workspace:*","@hermes/ask-user":"workspace:*","@hermes/augment-legacy-tools":"workspace:*","@hermes/btw":"workspace:*","@hermes/cloud":"workspace:*","@hermes/context-usage":"workspace:*","@hermes/cosmos":"workspace:*","@hermes/daemon":"workspace:*","@hermes/git-credentials":"workspace:*","@hermes/hashline-edit":"workspace:*","@hermes/hooks":"workspace:*","@hermes/import-sessions":"workspace:*","@hermes/logger":"workspace:*","@hermes/lsp":"workspace:*","@hermes/mcp":"workspace:*","@hermes/migration":"workspace:*","@hermes/open-browser":"workspace:*","@hermes/otel":"workspace:*","@hermes/path-utils":"workspace:*","@hermes/plugins":"workspace:*","@hermes/prompt-enhancer":"workspace:*","@hermes/segment-analytics":"workspace:*","@hermes/sentry":"workspace:*","@hermes/settings":"workspace:*","@hermes/shared-types":"workspace:*","@hermes/subagents":"workspace:*","@hermes/tool-permissions":"workspace:*","@mariozechner/jiti":"^2.6.2","@sentry/node":"^10.53.1","@silvia-odwyer/photon-node":"^0.3.4","@sinclair/typebox":"^0.34.41",ajv:"^8.17.1",chalk:"^5.5.0","cli-highlight":"^2.1.11",diff:"^8.0.2","extract-zip":"^2.0.1",fdir:"^6.5.0","file-type":"^21.1.1",glob:"^13.0.1","hosted-git-info":"^9.0.2",ignore:"^7.0.5",jimp:"^1.6.1","jsonc-parser":"3.3.1",marked:"^15.0.12",minimatch:"^10.2.3","proper-lockfile":"^4.1.2","strip-ansi":"^7.1.0",turndown:"^7.2.4",undici:"^7.19.1",yaml:"^2.8.2",zod:"^4.4.3"},overrides:{rimraf:"6.1.2",gaxios:{rimraf:"6.1.2"}},optionalDependencies:{"@mariozechner/clipboard":"^0.3.2"},devDependencies:{"@tintinweb/pi-subagents":"workspace:*","@types/diff":"^7.0.2","@types/hosted-git-info":"^3.0.5","@types/ms":"^2.1.0","@types/node":"^24.3.0","@types/proper-lockfile":"^4.1.4","@types/turndown":"^5.0.5",level:"^10.0.0",shx:"^0.4.0",tsx:"^4.21.0",typescript:"^5.7.3",vitest:"^3.2.4"},keywords:["coding-agent","ai","llm","cli","tui","agent"],author:"Mario Zechner",license:"MIT",repository:{type:"git",url:"git+https://github.com/badlogic/pi-mono.git",directory:"packages/coding-agent"},engines:{node:">=20.6.0"}}});import{existsSync as gfs}from"node:fs";import{homedir as dle}from"node:os";import{dirname as kht,join as $v,resolve as jkn}from"node:path";import{fileURLToPath as bfs}from"node:url";function zkn(){let e=process.env.PI_PACKAGE_DIR;if(e)return e==="~"?dle():e.startsWith("~/")?dle()+e.slice(1):e;let t=Zkn;for(;t!==kht(t);){if(gfs($v(t,"package.json")))return t;t=kht(t)}return Zkn}function yNe(){return jkn($v(zkn(),"docs"))}function ANe(){return jkn($v(zkn(),"CHANGELOG.md"))}function Jkn(e){return e==="~"?dle():e.startsWith("~/")?dle()+e.slice(1):e}function oI(){let e=process.env.AUGMENT_CACHE_DIR;return e?Jkn(e):$v(dle(),".augment")}function Br(){let e=process.env[Oht];return e?Jkn(e):oI()}function fle(){return $v(Br(),"themes")}function e2n(){return $v(Br(),"models.json")}function t2n(){return $v(Br(),"auth.json")}function n2n(){return $v(Br(),"settings.json")}function MA(){return oI()}function CZ(){return $v(Br(),"bin")}function r2n(){return $v(Br(),ple)}function i2n(){return $v(Br(),`${ei}-debug.log`)}var yfs,Zkn,ei,Ps,ple,mle,Xkn,Afs,ys,qkn,Kkn,Oht,Vs=C(()=>{"use strict";Nht();yfs=bfs(import.meta.url),Zkn=kht(yfs);ei=TD.piConfig?.name||"auggie",Ps=TD.piConfig?.configDir||".augment",ple="sessions-v2",mle=ei,Xkn="Auggie Coding Agent",Afs="1.2.0",ys=Afs??TD.version,qkn="2afeeb74cb9a958e51870161bd3f4c7d8b6efcab",Kkn="2026-11-09T18:30:16Z",Oht=`${ei.toUpperCase()}_CODING_AGENT_DIR`});function Mht(...e){return new globalThis.Function(...e)}var s2n=C(()=>{});var ENe,_Ne,Pht,o2n=C(()=>{bP();MH();Ur();Wc();ENe=class extends xi{constructor(t){super(`Duplicate type kind '${t}' detected`)}},_Ne=class extends xi{constructor(t){super(`Duplicate string format '${t}' detected`)}};(function(e){function t(r,i){if(kp.Has(r))throw new ENe(r);return kp.Set(r,i),(s={})=>PP({...s,[on]:r})}e.Type=t;function n(r,i){if(Jh.Has(r))throw new _Ne(r);return Jh.Set(r,i),r}e.Format=n})(Pht||(Pht={}))});var _4={};ui(_4,{Evaluate:()=>Mht,TypeSystem:()=>Pht,TypeSystemDuplicateFormat:()=>_Ne,TypeSystemDuplicateTypeKind:()=>ENe,TypeSystemPolicy:()=>hc});var TZ=C(()=>{s2n();Zie();o2n()});function a2n(e){switch(e.errorType){case an.ArrayContains:return"Expected array to contain at least one matching value";case an.ArrayMaxContains:return`Expected array to contain no more than ${e.schema.maxContains} matching values`;case an.ArrayMinContains:return`Expected array to contain at least ${e.schema.minContains} matching values`;case an.ArrayMaxItems:return`Expected array length to be less or equal to ${e.schema.maxItems}`;case an.ArrayMinItems:return`Expected array length to be greater or equal to ${e.schema.minItems}`;case an.ArrayUniqueItems:return"Expected array elements to be unique";case an.Array:return"Expected array";case an.AsyncIterator:return"Expected AsyncIterator";case an.BigIntExclusiveMaximum:return`Expected bigint to be less than ${e.schema.exclusiveMaximum}`;case an.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${e.schema.exclusiveMinimum}`;case an.BigIntMaximum:return`Expected bigint to be less or equal to ${e.schema.maximum}`;case an.BigIntMinimum:return`Expected bigint to be greater or equal to ${e.schema.minimum}`;case an.BigIntMultipleOf:return`Expected bigint to be a multiple of ${e.schema.multipleOf}`;case an.BigInt:return"Expected bigint";case an.Boolean:return"Expected boolean";case an.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${e.schema.exclusiveMinimumTimestamp}`;case an.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${e.schema.exclusiveMaximumTimestamp}`;case an.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${e.schema.minimumTimestamp}`;case an.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${e.schema.maximumTimestamp}`;case an.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${e.schema.multipleOfTimestamp}`;case an.Date:return"Expected Date";case an.Function:return"Expected function";case an.IntegerExclusiveMaximum:return`Expected integer to be less than ${e.schema.exclusiveMaximum}`;case an.IntegerExclusiveMinimum:return`Expected integer to be greater than ${e.schema.exclusiveMinimum}`;case an.IntegerMaximum:return`Expected integer to be less or equal to ${e.schema.maximum}`;case an.IntegerMinimum:return`Expected integer to be greater or equal to ${e.schema.minimum}`;case an.IntegerMultipleOf:return`Expected integer to be a multiple of ${e.schema.multipleOf}`;case an.Integer:return"Expected integer";case an.IntersectUnevaluatedProperties:return"Unexpected property";case an.Intersect:return"Expected all values to match";case an.Iterator:return"Expected Iterator";case an.Literal:return`Expected ${typeof e.schema.const=="string"?`'${e.schema.const}'`:e.schema.const}`;case an.Never:return"Never";case an.Not:return"Value should not match";case an.Null:return"Expected null";case an.NumberExclusiveMaximum:return`Expected number to be less than ${e.schema.exclusiveMaximum}`;case an.NumberExclusiveMinimum:return`Expected number to be greater than ${e.schema.exclusiveMinimum}`;case an.NumberMaximum:return`Expected number to be less or equal to ${e.schema.maximum}`;case an.NumberMinimum:return`Expected number to be greater or equal to ${e.schema.minimum}`;case an.NumberMultipleOf:return`Expected number to be a multiple of ${e.schema.multipleOf}`;case an.Number:return"Expected number";case an.Object:return"Expected object";case an.ObjectAdditionalProperties:return"Unexpected property";case an.ObjectMaxProperties:return`Expected object to have no more than ${e.schema.maxProperties} properties`;case an.ObjectMinProperties:return`Expected object to have at least ${e.schema.minProperties} properties`;case an.ObjectRequiredProperty:return"Expected required property";case an.Promise:return"Expected Promise";case an.RegExp:return"Expected string to match regular expression";case an.StringFormatUnknown:return`Unknown format '${e.schema.format}'`;case an.StringFormat:return`Expected string to match '${e.schema.format}' format`;case an.StringMaxLength:return`Expected string length less or equal to ${e.schema.maxLength}`;case an.StringMinLength:return`Expected string length greater or equal to ${e.schema.minLength}`;case an.StringPattern:return`Expected string to match '${e.schema.pattern}'`;case an.String:return"Expected string";case an.Symbol:return"Expected symbol";case an.TupleLength:return`Expected tuple to have ${e.schema.maxItems||0} elements`;case an.Tuple:return"Expected tuple";case an.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${e.schema.maxByteLength}`;case an.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${e.schema.minByteLength}`;case an.Uint8Array:return"Expected Uint8Array";case an.Undefined:return"Expected undefined";case an.Union:return"Expected union value";case an.Void:return"Expected void";case an.Kind:return`Expected kind '${e.schema[on]}'`;default:return"Unknown error type"}}function Efs(e){l2n=e}function Dht(){return l2n}var l2n,Bht=C(()=>{Ur();Lht();l2n=a2n});function _fs(e,t){let n=t.find(r=>r.$id===e.$ref);if(n===void 0)throw new Fht(e);return la(n,t)}function zm(e,t){return!Vo(e.$id)||t.some(n=>n.$id===e.$id)||t.push(e),t}function la(e,t){return e[on]==="This"||e[on]==="Ref"?_fs(e,t):e}var Fht,c2n=C(()=>{Wc();Ur();Dxe();Fht=class extends xi{constructor(t){super(`Unable to dereference schema with $id '${t.$ref}'`),this.schema=t}}});var gS=C(()=>{c2n()});function*Cfs(e){let t=e===0?1:Math.ceil(Math.floor(Math.log2(e)+1)/8);for(let n=0;n<t;n++)yield e>>8*(t-1-n)&255}function Tfs(e){ug(PA.Array);for(let t of e)wZ(t)}function Ifs(e){ug(PA.Boolean),ug(e?1:0)}function wfs(e){ug(PA.BigInt),d2n.setBigInt64(0,e);for(let t of p2n)ug(t)}function Rfs(e){ug(PA.Date),wZ(e.getTime())}function Nfs(e){ug(PA.Null)}function kfs(e){ug(PA.Number),d2n.setFloat64(0,e);for(let t of p2n)ug(t)}function Ofs(e){ug(PA.Object);for(let t of globalThis.Object.getOwnPropertyNames(e).sort())wZ(t),wZ(e[t])}function Mfs(e){ug(PA.String);for(let t=0;t<e.length;t++)for(let n of Cfs(e.charCodeAt(t)))ug(n)}function Pfs(e){ug(PA.Symbol),wZ(e.description)}function Dfs(e){ug(PA.Uint8Array);for(let t=0;t<e.length;t++)ug(e[t])}function Bfs(e){return ug(PA.Undefined)}function wZ(e){if(wi(e))return Tfs(e);if(Cv(e))return Ifs(e);if(Qm(e))return wfs(e);if(Xh(e))return Rfs(e);if(AT(e))return Nfs(e);if(fi(e))return kfs(e);if(hs(e))return Ofs(e);if(Vo(e))return Mfs(e);if(_T(e))return Pfs(e);if(e3(e))return Dfs(e);if(Oc(e))return Bfs(e);throw new SNe(e)}function ug(e){IZ=IZ^xfs[e],IZ=IZ*Sfs%vfs}function ck(e){return IZ=BigInt("14695981039346656037"),wZ(e),IZ}var SNe,PA,IZ,Sfs,vfs,xfs,u2n,d2n,p2n,m2n=C(()=>{Np();Wc();SNe=class extends xi{constructor(t){super("Unable to hash value"),this.value=t}};(function(e){e[e.Undefined=0]="Undefined",e[e.Null=1]="Null",e[e.Boolean=2]="Boolean",e[e.Number=3]="Number",e[e.String=4]="String",e[e.Object=5]="Object",e[e.Array=6]="Array",e[e.Date=7]="Date",e[e.Uint8Array=8]="Uint8Array",e[e.Symbol=9]="Symbol",e[e.BigInt=10]="BigInt"})(PA||(PA={}));IZ=BigInt("14695981039346656037"),[Sfs,vfs]=[BigInt("1099511628211"),BigInt("18446744073709551616")],xfs=Array.from({length:256}).map((e,t)=>BigInt(t)),u2n=new Float64Array(1),d2n=new DataView(u2n.buffer),p2n=new Uint8Array(u2n.buffer)});var RZ=C(()=>{m2n()});function Lfs(e){return e[on]==="Any"||e[on]==="Unknown"}function Go(e){return e!==void 0}function Ffs(e,t,n){return!0}function Ufs(e,t,n){return!0}function Vfs(e,t,n){if(!wi(n)||Go(e.minItems)&&!(n.length>=e.minItems)||Go(e.maxItems)&&!(n.length<=e.maxItems))return!1;for(let s of n)if(!Xm(e.items,t,s))return!1;if(e.uniqueItems===!0&&!(function(){let s=new Set;for(let o of n){let a=ck(o);if(s.has(a))return!1;s.add(a)}return!0})())return!1;if(!(Go(e.contains)||fi(e.minContains)||fi(e.maxContains)))return!0;let r=Go(e.contains)?e.contains:Gi(),i=n.reduce((s,o)=>Xm(r,t,o)?s+1:s,0);return!(i===0||fi(e.minContains)&&i<e.minContains||fi(e.maxContains)&&i>e.maxContains)}function Gfs(e,t,n){return $ie(n)}function Wfs(e,t,n){return!(!Qm(n)||Go(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)||Go(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)||Go(e.maximum)&&!(n<=e.maximum)||Go(e.minimum)&&!(n>=e.minimum)||Go(e.multipleOf)&&n%e.multipleOf!==BigInt(0))}function $fs(e,t,n){return Cv(n)}function Qfs(e,t,n){return Xm(e.returns,t,n.prototype)}function Hfs(e,t,n){return!(!Xh(n)||Go(e.exclusiveMaximumTimestamp)&&!(n.getTime()<e.exclusiveMaximumTimestamp)||Go(e.exclusiveMinimumTimestamp)&&!(n.getTime()>e.exclusiveMinimumTimestamp)||Go(e.maximumTimestamp)&&!(n.getTime()<=e.maximumTimestamp)||Go(e.minimumTimestamp)&&!(n.getTime()>=e.minimumTimestamp)||Go(e.multipleOfTimestamp)&&n.getTime()%e.multipleOfTimestamp!==0)}function Yfs(e,t,n){return ET(n)}function Zfs(e,t,n){let r=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];return Xm(i,[...t,...r],n)}function jfs(e,t,n){return!(!Yie(n)||Go(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)||Go(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)||Go(e.maximum)&&!(n<=e.maximum)||Go(e.minimum)&&!(n>=e.minimum)||Go(e.multipleOf)&&n%e.multipleOf!==0)}function zfs(e,t,n){let r=e.allOf.every(i=>Xm(i,t,n));if(e.unevaluatedProperties===!1){let i=new RegExp(Iv(e)),s=Object.getOwnPropertyNames(n).every(o=>i.test(o));return r&&s}else if($c(e.unevaluatedProperties)){let i=new RegExp(Iv(e)),s=Object.getOwnPropertyNames(n).every(o=>i.test(o)||Xm(e.unevaluatedProperties,t,n[o]));return r&&s}else return r}function Xfs(e,t,n){return Qie(n)}function qfs(e,t,n){return n===e.const}function Kfs(e,t,n){return!1}function Jfs(e,t,n){return!Xm(e.not,t,n)}function ehs(e,t,n){return AT(n)}function ths(e,t,n){return!(!hc.IsNumberLike(n)||Go(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)||Go(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)||Go(e.minimum)&&!(n>=e.minimum)||Go(e.maximum)&&!(n<=e.maximum)||Go(e.multipleOf)&&n%e.multipleOf!==0)}function nhs(e,t,n){if(!hc.IsObjectLike(n)||Go(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)||Go(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties))return!1;let r=Object.getOwnPropertyNames(e.properties);for(let i of r){let s=e.properties[i];if(e.required&&e.required.includes(i)){if(!Xm(s,t,n[i])||(wv(s)||Lfs(s))&&!(i in n))return!1}else if(hc.IsExactOptionalProperty(n,i)&&!Xm(s,t,n[i]))return!1}if(e.additionalProperties===!1){let i=Object.getOwnPropertyNames(n);return e.required&&e.required.length===r.length&&i.length===r.length?!0:i.every(s=>r.includes(s))}else return typeof e.additionalProperties=="object"?Object.getOwnPropertyNames(n).every(s=>r.includes(s)||Xm(e.additionalProperties,t,n[s])):!0}function rhs(e,t,n){return Hie(n)}function ihs(e,t,n){if(!hc.IsRecordLike(n)||Go(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)||Go(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties))return!1;let[r,i]=Object.entries(e.patternProperties)[0],s=new RegExp(r),o=Object.entries(n).every(([u,c])=>s.test(u)?Xm(i,t,c):!0),a=typeof e.additionalProperties=="object"?Object.entries(n).every(([u,c])=>s.test(u)?!0:Xm(e.additionalProperties,t,c)):!0,l=e.additionalProperties===!1?Object.getOwnPropertyNames(n).every(u=>s.test(u)):!0;return o&&a&&l}function shs(e,t,n){return Xm(la(e,t),t,n)}function ohs(e,t,n){let r=new RegExp(e.source,e.flags);return Go(e.minLength)&&!(n.length>=e.minLength)||Go(e.maxLength)&&!(n.length<=e.maxLength)?!1:r.test(n)}function ahs(e,t,n){return!Vo(n)||Go(e.minLength)&&!(n.length>=e.minLength)||Go(e.maxLength)&&!(n.length<=e.maxLength)||Go(e.pattern)&&!new RegExp(e.pattern).test(n)?!1:Go(e.format)?Jh.Has(e.format)?Jh.Get(e.format)(n):!1:!0}function lhs(e,t,n){return _T(n)}function chs(e,t,n){return Vo(n)&&new RegExp(e.pattern).test(n)}function uhs(e,t,n){return Xm(la(e,t),t,n)}function dhs(e,t,n){if(!wi(n)||e.items===void 0&&n.length!==0||n.length!==e.maxItems)return!1;if(!e.items)return!0;for(let r=0;r<e.items.length;r++)if(!Xm(e.items[r],t,n[r]))return!1;return!0}function phs(e,t,n){return Oc(n)}function mhs(e,t,n){return e.anyOf.some(r=>Xm(r,t,n))}function fhs(e,t,n){return!(!e3(n)||Go(e.maxByteLength)&&!(n.length<=e.maxByteLength)||Go(e.minByteLength)&&!(n.length>=e.minByteLength))}function hhs(e,t,n){return!0}function ghs(e,t,n){return hc.IsVoidLike(n)}function bhs(e,t,n){return kp.Has(e[on])?kp.Get(e[on])(e,n):!1}function Xm(e,t,n){let r=Go(e.$id)?zm(e,t):t,i=e;switch(i[on]){case"Any":return Ffs(i,r,n);case"Argument":return Ufs(i,r,n);case"Array":return Vfs(i,r,n);case"AsyncIterator":return Gfs(i,r,n);case"BigInt":return Wfs(i,r,n);case"Boolean":return $fs(i,r,n);case"Constructor":return Qfs(i,r,n);case"Date":return Hfs(i,r,n);case"Function":return Yfs(i,r,n);case"Import":return Zfs(i,r,n);case"Integer":return jfs(i,r,n);case"Intersect":return zfs(i,r,n);case"Iterator":return Xfs(i,r,n);case"Literal":return qfs(i,r,n);case"Never":return Kfs(i,r,n);case"Not":return Jfs(i,r,n);case"Null":return ehs(i,r,n);case"Number":return ths(i,r,n);case"Object":return nhs(i,r,n);case"Promise":return rhs(i,r,n);case"Record":return ihs(i,r,n);case"Ref":return shs(i,r,n);case"RegExp":return ohs(i,r,n);case"String":return ahs(i,r,n);case"Symbol":return lhs(i,r,n);case"TemplateLiteral":return chs(i,r,n);case"This":return uhs(i,r,n);case"Tuple":return dhs(i,r,n);case"Undefined":return phs(i,r,n);case"Union":return mhs(i,r,n);case"Uint8Array":return fhs(i,r,n);case"Unknown":return hhs(i,r,n);case"Void":return ghs(i,r,n);default:if(!kp.Has(i[on]))throw new vNe(i);return bhs(i,r,n)}}function Gs(...e){return e.length===3?Xm(e[0],e[1],e[2]):Xm(e[0],[],e[1])}var vNe,Uht=C(()=>{TZ();gS();RZ();Ur();EA();xP();bP();Wc();bd();Np();Js();vNe=class extends xi{constructor(t){super("Unknown type"),this.schema=t}}});var DA=C(()=>{Uht()});function uk(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Wo(e){return e!==void 0}function yr(e,t,n,r,i=[]){return{type:e,schema:t,path:n,value:r,message:Dht()({errorType:e,path:n,schema:t,value:r,errors:i}),errors:i}}function*yhs(e,t,n,r){}function*Ahs(e,t,n,r){}function*Ehs(e,t,n,r){if(!wi(r))return yield yr(an.Array,e,n,r);Wo(e.minItems)&&!(r.length>=e.minItems)&&(yield yr(an.ArrayMinItems,e,n,r)),Wo(e.maxItems)&&!(r.length<=e.maxItems)&&(yield yr(an.ArrayMaxItems,e,n,r));for(let o=0;o<r.length;o++)yield*qm(e.items,t,`${n}/${o}`,r[o]);if(e.uniqueItems===!0&&!(function(){let o=new Set;for(let a of r){let l=ck(a);if(o.has(l))return!1;o.add(l)}return!0})()&&(yield yr(an.ArrayUniqueItems,e,n,r)),!(Wo(e.contains)||Wo(e.minContains)||Wo(e.maxContains)))return;let i=Wo(e.contains)?e.contains:Gi(),s=r.reduce((o,a,l)=>qm(i,t,`${n}${l}`,a).next().done===!0?o+1:o,0);s===0&&(yield yr(an.ArrayContains,e,n,r)),fi(e.minContains)&&s<e.minContains&&(yield yr(an.ArrayMinContains,e,n,r)),fi(e.maxContains)&&s>e.maxContains&&(yield yr(an.ArrayMaxContains,e,n,r))}function*_hs(e,t,n,r){$ie(r)||(yield yr(an.AsyncIterator,e,n,r))}function*Shs(e,t,n,r){if(!Qm(r))return yield yr(an.BigInt,e,n,r);Wo(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)&&(yield yr(an.BigIntExclusiveMaximum,e,n,r)),Wo(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)&&(yield yr(an.BigIntExclusiveMinimum,e,n,r)),Wo(e.maximum)&&!(r<=e.maximum)&&(yield yr(an.BigIntMaximum,e,n,r)),Wo(e.minimum)&&!(r>=e.minimum)&&(yield yr(an.BigIntMinimum,e,n,r)),Wo(e.multipleOf)&&r%e.multipleOf!==BigInt(0)&&(yield yr(an.BigIntMultipleOf,e,n,r))}function*vhs(e,t,n,r){Cv(r)||(yield yr(an.Boolean,e,n,r))}function*xhs(e,t,n,r){yield*qm(e.returns,t,n,r.prototype)}function*Chs(e,t,n,r){if(!Xh(r))return yield yr(an.Date,e,n,r);Wo(e.exclusiveMaximumTimestamp)&&!(r.getTime()<e.exclusiveMaximumTimestamp)&&(yield yr(an.DateExclusiveMaximumTimestamp,e,n,r)),Wo(e.exclusiveMinimumTimestamp)&&!(r.getTime()>e.exclusiveMinimumTimestamp)&&(yield yr(an.DateExclusiveMinimumTimestamp,e,n,r)),Wo(e.maximumTimestamp)&&!(r.getTime()<=e.maximumTimestamp)&&(yield yr(an.DateMaximumTimestamp,e,n,r)),Wo(e.minimumTimestamp)&&!(r.getTime()>=e.minimumTimestamp)&&(yield yr(an.DateMinimumTimestamp,e,n,r)),Wo(e.multipleOfTimestamp)&&r.getTime()%e.multipleOfTimestamp!==0&&(yield yr(an.DateMultipleOfTimestamp,e,n,r))}function*Ths(e,t,n,r){ET(r)||(yield yr(an.Function,e,n,r))}function*Ihs(e,t,n,r){let i=globalThis.Object.values(e.$defs),s=e.$defs[e.$ref];yield*qm(s,[...t,...i],n,r)}function*whs(e,t,n,r){if(!Yie(r))return yield yr(an.Integer,e,n,r);Wo(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)&&(yield yr(an.IntegerExclusiveMaximum,e,n,r)),Wo(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)&&(yield yr(an.IntegerExclusiveMinimum,e,n,r)),Wo(e.maximum)&&!(r<=e.maximum)&&(yield yr(an.IntegerMaximum,e,n,r)),Wo(e.minimum)&&!(r>=e.minimum)&&(yield yr(an.IntegerMinimum,e,n,r)),Wo(e.multipleOf)&&r%e.multipleOf!==0&&(yield yr(an.IntegerMultipleOf,e,n,r))}function*Rhs(e,t,n,r){let i=!1;for(let s of e.allOf)for(let o of qm(s,t,n,r))i=!0,yield o;if(i)return yield yr(an.Intersect,e,n,r);if(e.unevaluatedProperties===!1){let s=new RegExp(Iv(e));for(let o of Object.getOwnPropertyNames(r))s.test(o)||(yield yr(an.IntersectUnevaluatedProperties,e,`${n}/${o}`,r))}if(typeof e.unevaluatedProperties=="object"){let s=new RegExp(Iv(e));for(let o of Object.getOwnPropertyNames(r))if(!s.test(o)){let a=qm(e.unevaluatedProperties,t,`${n}/${o}`,r[o]).next();a.done||(yield a.value)}}}function*Nhs(e,t,n,r){Qie(r)||(yield yr(an.Iterator,e,n,r))}function*khs(e,t,n,r){r!==e.const&&(yield yr(an.Literal,e,n,r))}function*Ohs(e,t,n,r){yield yr(an.Never,e,n,r)}function*Mhs(e,t,n,r){qm(e.not,t,n,r).next().done===!0&&(yield yr(an.Not,e,n,r))}function*Phs(e,t,n,r){AT(r)||(yield yr(an.Null,e,n,r))}function*Dhs(e,t,n,r){if(!hc.IsNumberLike(r))return yield yr(an.Number,e,n,r);Wo(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)&&(yield yr(an.NumberExclusiveMaximum,e,n,r)),Wo(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)&&(yield yr(an.NumberExclusiveMinimum,e,n,r)),Wo(e.maximum)&&!(r<=e.maximum)&&(yield yr(an.NumberMaximum,e,n,r)),Wo(e.minimum)&&!(r>=e.minimum)&&(yield yr(an.NumberMinimum,e,n,r)),Wo(e.multipleOf)&&r%e.multipleOf!==0&&(yield yr(an.NumberMultipleOf,e,n,r))}function*Bhs(e,t,n,r){if(!hc.IsObjectLike(r))return yield yr(an.Object,e,n,r);Wo(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)&&(yield yr(an.ObjectMinProperties,e,n,r)),Wo(e.maxProperties)&&!(Object.getOwnPropertyNames(r).length<=e.maxProperties)&&(yield yr(an.ObjectMaxProperties,e,n,r));let i=Array.isArray(e.required)?e.required:[],s=Object.getOwnPropertyNames(e.properties),o=Object.getOwnPropertyNames(r);for(let a of i)o.includes(a)||(yield yr(an.ObjectRequiredProperty,e.properties[a],`${n}/${uk(a)}`,void 0));if(e.additionalProperties===!1)for(let a of o)s.includes(a)||(yield yr(an.ObjectAdditionalProperties,e,`${n}/${uk(a)}`,r[a]));if(typeof e.additionalProperties=="object")for(let a of o)s.includes(a)||(yield*qm(e.additionalProperties,t,`${n}/${uk(a)}`,r[a]));for(let a of s){let l=e.properties[a];e.required&&e.required.includes(a)?(yield*qm(l,t,`${n}/${uk(a)}`,r[a]),wv(e)&&!(a in r)&&(yield yr(an.ObjectRequiredProperty,l,`${n}/${uk(a)}`,void 0))):hc.IsExactOptionalProperty(r,a)&&(yield*qm(l,t,`${n}/${uk(a)}`,r[a]))}}function*Lhs(e,t,n,r){Hie(r)||(yield yr(an.Promise,e,n,r))}function*Fhs(e,t,n,r){if(!hc.IsRecordLike(r))return yield yr(an.Object,e,n,r);Wo(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)&&(yield yr(an.ObjectMinProperties,e,n,r)),Wo(e.maxProperties)&&!(Object.getOwnPropertyNames(r).length<=e.maxProperties)&&(yield yr(an.ObjectMaxProperties,e,n,r));let[i,s]=Object.entries(e.patternProperties)[0],o=new RegExp(i);for(let[a,l]of Object.entries(r))o.test(a)&&(yield*qm(s,t,`${n}/${uk(a)}`,l));if(typeof e.additionalProperties=="object")for(let[a,l]of Object.entries(r))o.test(a)||(yield*qm(e.additionalProperties,t,`${n}/${uk(a)}`,l));if(e.additionalProperties===!1){for(let[a,l]of Object.entries(r))if(!o.test(a))return yield yr(an.ObjectAdditionalProperties,e,`${n}/${uk(a)}`,l)}}function*Uhs(e,t,n,r){yield*qm(la(e,t),t,n,r)}function*Vhs(e,t,n,r){if(!Vo(r))return yield yr(an.String,e,n,r);if(Wo(e.minLength)&&!(r.length>=e.minLength)&&(yield yr(an.StringMinLength,e,n,r)),Wo(e.maxLength)&&!(r.length<=e.maxLength)&&(yield yr(an.StringMaxLength,e,n,r)),!new RegExp(e.source,e.flags).test(r))return yield yr(an.RegExp,e,n,r)}function*Ghs(e,t,n,r){if(!Vo(r))return yield yr(an.String,e,n,r);Wo(e.minLength)&&!(r.length>=e.minLength)&&(yield yr(an.StringMinLength,e,n,r)),Wo(e.maxLength)&&!(r.length<=e.maxLength)&&(yield yr(an.StringMaxLength,e,n,r)),Vo(e.pattern)&&(new RegExp(e.pattern).test(r)||(yield yr(an.StringPattern,e,n,r))),Vo(e.format)&&(Jh.Has(e.format)?Jh.Get(e.format)(r)||(yield yr(an.StringFormat,e,n,r)):yield yr(an.StringFormatUnknown,e,n,r))}function*Whs(e,t,n,r){_T(r)||(yield yr(an.Symbol,e,n,r))}function*$hs(e,t,n,r){if(!Vo(r))return yield yr(an.String,e,n,r);new RegExp(e.pattern).test(r)||(yield yr(an.StringPattern,e,n,r))}function*Qhs(e,t,n,r){yield*qm(la(e,t),t,n,r)}function*Hhs(e,t,n,r){if(!wi(r))return yield yr(an.Tuple,e,n,r);if(e.items===void 0&&r.length!==0)return yield yr(an.TupleLength,e,n,r);if(r.length!==e.maxItems)return yield yr(an.TupleLength,e,n,r);if(e.items)for(let i=0;i<e.items.length;i++)yield*qm(e.items[i],t,`${n}/${i}`,r[i])}function*Yhs(e,t,n,r){Oc(r)||(yield yr(an.Undefined,e,n,r))}function*Zhs(e,t,n,r){if(Gs(e,t,r))return;let i=e.anyOf.map(s=>new BA(qm(s,t,n,r)));yield yr(an.Union,e,n,r,i)}function*jhs(e,t,n,r){if(!e3(r))return yield yr(an.Uint8Array,e,n,r);Wo(e.maxByteLength)&&!(r.length<=e.maxByteLength)&&(yield yr(an.Uint8ArrayMaxByteLength,e,n,r)),Wo(e.minByteLength)&&!(r.length>=e.minByteLength)&&(yield yr(an.Uint8ArrayMinByteLength,e,n,r))}function*zhs(e,t,n,r){}function*Xhs(e,t,n,r){hc.IsVoidLike(r)||(yield yr(an.Void,e,n,r))}function*qhs(e,t,n,r){kp.Get(e[on])(e,r)||(yield yr(an.Kind,e,n,r))}function*qm(e,t,n,r){let i=Wo(e.$id)?[...t,e]:t,s=e;switch(s[on]){case"Any":return yield*yhs(s,i,n,r);case"Argument":return yield*Ahs(s,i,n,r);case"Array":return yield*Ehs(s,i,n,r);case"AsyncIterator":return yield*_hs(s,i,n,r);case"BigInt":return yield*Shs(s,i,n,r);case"Boolean":return yield*vhs(s,i,n,r);case"Constructor":return yield*xhs(s,i,n,r);case"Date":return yield*Chs(s,i,n,r);case"Function":return yield*Ths(s,i,n,r);case"Import":return yield*Ihs(s,i,n,r);case"Integer":return yield*whs(s,i,n,r);case"Intersect":return yield*Rhs(s,i,n,r);case"Iterator":return yield*Nhs(s,i,n,r);case"Literal":return yield*khs(s,i,n,r);case"Never":return yield*Ohs(s,i,n,r);case"Not":return yield*Mhs(s,i,n,r);case"Null":return yield*Phs(s,i,n,r);case"Number":return yield*Dhs(s,i,n,r);case"Object":return yield*Bhs(s,i,n,r);case"Promise":return yield*Lhs(s,i,n,r);case"Record":return yield*Fhs(s,i,n,r);case"Ref":return yield*Uhs(s,i,n,r);case"RegExp":return yield*Vhs(s,i,n,r);case"String":return yield*Ghs(s,i,n,r);case"Symbol":return yield*Whs(s,i,n,r);case"TemplateLiteral":return yield*$hs(s,i,n,r);case"This":return yield*Qhs(s,i,n,r);case"Tuple":return yield*Hhs(s,i,n,r);case"Undefined":return yield*Yhs(s,i,n,r);case"Union":return yield*Zhs(s,i,n,r);case"Uint8Array":return yield*jhs(s,i,n,r);case"Unknown":return yield*zhs(s,i,n,r);case"Void":return yield*Xhs(s,i,n,r);default:if(!kp.Has(s[on]))throw new xNe(e);return yield*qhs(s,i,n,r)}}function Qv(...e){let t=e.length===3?qm(e[0],e[1],"",e[2]):qm(e[0],[],"",e[1]);return new BA(t)}var an,xNe,BA,Lht=C(()=>{TZ();EA();bP();cCe();Bht();Wc();gS();RZ();DA();Ur();bd();Np();(function(e){e[e.ArrayContains=0]="ArrayContains",e[e.ArrayMaxContains=1]="ArrayMaxContains",e[e.ArrayMaxItems=2]="ArrayMaxItems",e[e.ArrayMinContains=3]="ArrayMinContains",e[e.ArrayMinItems=4]="ArrayMinItems",e[e.ArrayUniqueItems=5]="ArrayUniqueItems",e[e.Array=6]="Array",e[e.AsyncIterator=7]="AsyncIterator",e[e.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",e[e.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",e[e.BigIntMaximum=10]="BigIntMaximum",e[e.BigIntMinimum=11]="BigIntMinimum",e[e.BigIntMultipleOf=12]="BigIntMultipleOf",e[e.BigInt=13]="BigInt",e[e.Boolean=14]="Boolean",e[e.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",e[e.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",e[e.DateMaximumTimestamp=17]="DateMaximumTimestamp",e[e.DateMinimumTimestamp=18]="DateMinimumTimestamp",e[e.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",e[e.Date=20]="Date",e[e.Function=21]="Function",e[e.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",e[e.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",e[e.IntegerMaximum=24]="IntegerMaximum",e[e.IntegerMinimum=25]="IntegerMinimum",e[e.IntegerMultipleOf=26]="IntegerMultipleOf",e[e.Integer=27]="Integer",e[e.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",e[e.Intersect=29]="Intersect",e[e.Iterator=30]="Iterator",e[e.Kind=31]="Kind",e[e.Literal=32]="Literal",e[e.Never=33]="Never",e[e.Not=34]="Not",e[e.Null=35]="Null",e[e.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",e[e.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",e[e.NumberMaximum=38]="NumberMaximum",e[e.NumberMinimum=39]="NumberMinimum",e[e.NumberMultipleOf=40]="NumberMultipleOf",e[e.Number=41]="Number",e[e.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",e[e.ObjectMaxProperties=43]="ObjectMaxProperties",e[e.ObjectMinProperties=44]="ObjectMinProperties",e[e.ObjectRequiredProperty=45]="ObjectRequiredProperty",e[e.Object=46]="Object",e[e.Promise=47]="Promise",e[e.RegExp=48]="RegExp",e[e.StringFormatUnknown=49]="StringFormatUnknown",e[e.StringFormat=50]="StringFormat",e[e.StringMaxLength=51]="StringMaxLength",e[e.StringMinLength=52]="StringMinLength",e[e.StringPattern=53]="StringPattern",e[e.String=54]="String",e[e.Symbol=55]="Symbol",e[e.TupleLength=56]="TupleLength",e[e.Tuple=57]="Tuple",e[e.Uint8ArrayMaxByteLength=58]="Uint8ArrayMaxByteLength",e[e.Uint8ArrayMinByteLength=59]="Uint8ArrayMinByteLength",e[e.Uint8Array=60]="Uint8Array",e[e.Undefined=61]="Undefined",e[e.Union=62]="Union",e[e.Void=63]="Void"})(an||(an={}));xNe=class extends xi{constructor(t){super("Unknown type"),this.schema=t}};BA=class{constructor(t){this.iterator=t}[Symbol.iterator](){return this.iterator}First(){let t=this.iterator.next();return t.done?void 0:t.value}}});var S4={};ui(S4,{DefaultErrorFunction:()=>a2n,Errors:()=>Qv,GetErrorFunction:()=>Dht,SetErrorFunction:()=>Efs,ValueErrorIterator:()=>BA,ValueErrorType:()=>an,ValueErrorsUnknownTypeError:()=>xNe});var aI=C(()=>{Lht();Bht()});function vu(e,t,n){try{return ha(e)?e[Mc].Decode(n):n}catch(r){throw new CNe(e,t,n,r)}}function Khs(e,t,n,r){return wi(r)?vu(e,n,r.map((i,s)=>Hv(e.items,t,`${n}/${s}`,i))):vu(e,n,r)}function Jhs(e,t,n,r){if(!hs(r)||Ly(r))return vu(e,n,r);let i=uH(e),s=i.map(c=>c[0]),o={...r};for(let[c,d]of i)c in o&&(o[c]=Hv(d,t,`${n}/${c}`,o[c]));if(!ha(e.unevaluatedProperties))return vu(e,n,o);let a=Object.getOwnPropertyNames(o),l=e.unevaluatedProperties,u={...o};for(let c of a)s.includes(c)||(u[c]=vu(l,`${n}/${c}`,u[c]));return vu(e,n,u)}function egs(e,t,n,r){let i=globalThis.Object.values(e.$defs),s=e.$defs[e.$ref],o=Hv(s,[...t,...i],n,r);return vu(e,n,o)}function tgs(e,t,n,r){return vu(e,n,Hv(e.not,t,n,r))}function ngs(e,t,n,r){if(!hs(r))return vu(e,n,r);let i=rg(e),s={...r};for(let u of i)Vi(s,u)&&(Oc(s[u])&&(!xT(e.properties[u])||hc.IsExactOptionalProperty(s,u))||(s[u]=Hv(e.properties[u],t,`${n}/${u}`,s[u])));if(!$c(e.additionalProperties))return vu(e,n,s);let o=Object.getOwnPropertyNames(s),a=e.additionalProperties,l={...s};for(let u of o)i.includes(u)||(l[u]=vu(a,`${n}/${u}`,l[u]));return vu(e,n,l)}function rgs(e,t,n,r){if(!hs(r))return vu(e,n,r);let i=Object.getOwnPropertyNames(e.patternProperties)[0],s=new RegExp(i),o={...r};for(let c of Object.getOwnPropertyNames(r))s.test(c)&&(o[c]=Hv(e.patternProperties[i],t,`${n}/${c}`,o[c]));if(!$c(e.additionalProperties))return vu(e,n,o);let a=Object.getOwnPropertyNames(o),l=e.additionalProperties,u={...o};for(let c of a)s.test(c)||(u[c]=vu(l,`${n}/${c}`,u[c]));return vu(e,n,u)}function igs(e,t,n,r){let i=la(e,t);return vu(e,n,Hv(i,t,n,r))}function sgs(e,t,n,r){let i=la(e,t);return vu(e,n,Hv(i,t,n,r))}function ogs(e,t,n,r){return wi(r)&&wi(e.items)?vu(e,n,e.items.map((i,s)=>Hv(i,t,`${n}/${s}`,r[s]))):vu(e,n,r)}function ags(e,t,n,r){for(let i of e.anyOf){if(!Gs(i,t,r))continue;let s=Hv(i,t,n,r);return vu(e,n,s)}return vu(e,n,r)}function Hv(e,t,n,r){let i=zm(e,t),s=e;switch(e[on]){case"Array":return Khs(s,i,n,r);case"Import":return egs(s,i,n,r);case"Intersect":return Jhs(s,i,n,r);case"Not":return tgs(s,i,n,r);case"Object":return ngs(s,i,n,r);case"Record":return rgs(s,i,n,r);case"Ref":return igs(s,i,n,r);case"Symbol":return vu(s,n,r);case"This":return sgs(s,i,n,r);case"Tuple":return ogs(s,i,n,r);case"Union":return ags(s,i,n,r);default:return vu(s,n,r)}}function x4(e,t,n){return Hv(e,t,"",n)}var v4,CNe,f2n=C(()=>{Zie();Ur();Wc();EA();gS();DA();Np();Js();v4=class extends xi{constructor(t,n,r){super("Unable to decode value as it does not match the expected schema"),this.schema=t,this.value=n,this.error=r}},CNe=class extends xi{constructor(t,n,r,i){super(i instanceof Error?i.message:"Unknown error"),this.schema=t,this.path=n,this.value=r,this.error=i}}});function ih(e,t,n){try{return ha(e)?e[Mc].Encode(n):n}catch(r){throw new TNe(e,t,n,r)}}function lgs(e,t,n,r){let i=ih(e,n,r);return wi(i)?i.map((s,o)=>Yv(e.items,t,`${n}/${o}`,s)):i}function cgs(e,t,n,r){let i=globalThis.Object.values(e.$defs),s=e.$defs[e.$ref],o=ih(e,n,r);return Yv(s,[...t,...i],n,o)}function ugs(e,t,n,r){let i=ih(e,n,r);if(!hs(r)||Ly(r))return i;let s=uH(e),o=s.map(d=>d[0]),a={...i};for(let[d,p]of s)d in a&&(a[d]=Yv(p,t,`${n}/${d}`,a[d]));if(!ha(e.unevaluatedProperties))return a;let l=Object.getOwnPropertyNames(a),u=e.unevaluatedProperties,c={...a};for(let d of l)o.includes(d)||(c[d]=ih(u,`${n}/${d}`,c[d]));return c}function dgs(e,t,n,r){return ih(e.not,n,ih(e,n,r))}function pgs(e,t,n,r){let i=ih(e,n,r);if(!hs(i))return i;let s=rg(e),o={...i};for(let c of s)Vi(o,c)&&(Oc(o[c])&&(!xT(e.properties[c])||hc.IsExactOptionalProperty(o,c))||(o[c]=Yv(e.properties[c],t,`${n}/${c}`,o[c])));if(!$c(e.additionalProperties))return o;let a=Object.getOwnPropertyNames(o),l=e.additionalProperties,u={...o};for(let c of a)s.includes(c)||(u[c]=ih(l,`${n}/${c}`,u[c]));return u}function mgs(e,t,n,r){let i=ih(e,n,r);if(!hs(r))return i;let s=Object.getOwnPropertyNames(e.patternProperties)[0],o=new RegExp(s),a={...i};for(let d of Object.getOwnPropertyNames(r))o.test(d)&&(a[d]=Yv(e.patternProperties[s],t,`${n}/${d}`,a[d]));if(!$c(e.additionalProperties))return a;let l=Object.getOwnPropertyNames(a),u=e.additionalProperties,c={...a};for(let d of l)o.test(d)||(c[d]=ih(u,`${n}/${d}`,c[d]));return c}function fgs(e,t,n,r){let i=la(e,t),s=Yv(i,t,n,r);return ih(e,n,s)}function hgs(e,t,n,r){let i=la(e,t),s=Yv(i,t,n,r);return ih(e,n,s)}function ggs(e,t,n,r){let i=ih(e,n,r);return wi(e.items)?e.items.map((s,o)=>Yv(s,t,`${n}/${o}`,i[o])):[]}function bgs(e,t,n,r){for(let i of e.anyOf){if(!Gs(i,t,r))continue;let s=Yv(i,t,n,r);return ih(e,n,s)}for(let i of e.anyOf){let s=Yv(i,t,n,r);if(Gs(e,t,s))return ih(e,n,s)}return ih(e,n,r)}function Yv(e,t,n,r){let i=zm(e,t),s=e;switch(e[on]){case"Array":return lgs(s,i,n,r);case"Import":return cgs(s,i,n,r);case"Intersect":return ugs(s,i,n,r);case"Not":return dgs(s,i,n,r);case"Object":return pgs(s,i,n,r);case"Record":return mgs(s,i,n,r);case"Ref":return fgs(s,i,n,r);case"This":return hgs(s,i,n,r);case"Tuple":return ggs(s,i,n,r);case"Union":return bgs(s,i,n,r);default:return ih(s,n,r)}}function T4(e,t,n){return Yv(e,t,"",n)}var C4,TNe,h2n=C(()=>{Zie();Ur();Wc();EA();gS();DA();Np();Js();C4=class extends xi{constructor(t,n,r){super("The encoded value does not match the expected schema"),this.schema=t,this.value=n,this.error=r}},TNe=class extends xi{constructor(t,n,r,i){super(`${i instanceof Error?i.message:"Unknown error"}`),this.schema=t,this.path=n,this.value=r,this.error=i}}});function ygs(e,t){return ha(e)||cm(e.items,t)}function Ags(e,t){return ha(e)||cm(e.items,t)}function Egs(e,t){return ha(e)||cm(e.returns,t)||e.parameters.some(n=>cm(n,t))}function _gs(e,t){return ha(e)||cm(e.returns,t)||e.parameters.some(n=>cm(n,t))}function Sgs(e,t){return ha(e)||ha(e.unevaluatedProperties)||e.allOf.some(n=>cm(n,t))}function vgs(e,t){let n=globalThis.Object.getOwnPropertyNames(e.$defs).reduce((i,s)=>[...i,e.$defs[s]],[]),r=e.$defs[e.$ref];return ha(e)||cm(r,[...n,...t])}function xgs(e,t){return ha(e)||cm(e.items,t)}function Cgs(e,t){return ha(e)||cm(e.not,t)}function Tgs(e,t){return ha(e)||Object.values(e.properties).some(n=>cm(n,t))||$c(e.additionalProperties)&&cm(e.additionalProperties,t)}function Igs(e,t){return ha(e)||cm(e.item,t)}function wgs(e,t){let n=Object.getOwnPropertyNames(e.patternProperties)[0],r=e.patternProperties[n];return ha(e)||cm(r,t)||$c(e.additionalProperties)&&ha(e.additionalProperties)}function Rgs(e,t){return ha(e)?!0:cm(la(e,t),t)}function Ngs(e,t){return ha(e)?!0:cm(la(e,t),t)}function kgs(e,t){return ha(e)||!Oc(e.items)&&e.items.some(n=>cm(n,t))}function Ogs(e,t){return ha(e)||e.anyOf.some(n=>cm(n,t))}function cm(e,t){let n=zm(e,t),r=e;if(e.$id&&Vht.has(e.$id))return!1;switch(e.$id&&Vht.add(e.$id),e[on]){case"Array":return ygs(r,n);case"AsyncIterator":return Ags(r,n);case"Constructor":return Egs(r,n);case"Function":return _gs(r,n);case"Import":return vgs(r,n);case"Intersect":return Sgs(r,n);case"Iterator":return xgs(r,n);case"Not":return Cgs(r,n);case"Object":return Tgs(r,n);case"Promise":return Igs(r,n);case"Record":return wgs(r,n);case"Ref":return Rgs(r,n);case"This":return Ngs(r,n);case"Tuple":return kgs(r,n);case"Union":return Ogs(r,n);default:return ha(e)}}function lI(e,t){return Vht.clear(),cm(e,t)}var Vht,g2n=C(()=>{gS();Ur();Js();Np();Vht=new Set});var NZ=C(()=>{f2n();h2n();g2n()});function ID(e){if(!Vo(e))throw Error("ConstantString: Not a String");return`'${JSON.stringify(e).slice(1,-1).replace(/'/g,"\\'")}'`}function b2n(e,t){return`${e}[${ID(t)}]`}var INe,wNe,Ght,RNe,hle,wD,I4,y2n=C(()=>{NZ();aI();TZ();Wc();gS();RZ();Ur();bP();EA();cCe();bd();kT();Np();nrt();INe=class{constructor(t,n,r,i){this.schema=t,this.references=n,this.checkFunc=r,this.code=i,this.hasTransform=lI(t,n)}Code(){return this.code}Schema(){return this.schema}References(){return this.references}Errors(t){return Qv(this.schema,this.references,t)}Check(t){return this.checkFunc(t)}Decode(t){if(!this.checkFunc(t))throw new v4(this.schema,t,this.Errors(t).First());return this.hasTransform?x4(this.schema,this.references,t):t}Encode(t){let n=this.hasTransform?T4(this.schema,this.references,t):t;if(!this.checkFunc(n))throw new C4(this.schema,t,this.Errors(t).First());return n}};(function(e){function t(s){return s===36}e.DollarSign=t;function n(s){return s===95}e.IsUnderscore=n;function r(s){return s>=65&&s<=90||s>=97&&s<=122}e.IsAlpha=r;function i(s){return s>=48&&s<=57}e.IsNumeric=i})(wNe||(wNe={}));(function(e){function t(n){let r=[];for(let i=0;i<n.length;i++){let s=n.charCodeAt(i);wNe.IsNumeric(s)||wNe.IsAlpha(s)?r.push(n.charAt(i)):r.push(`_${s}_`)}return r.join("").replace(/__/g,"_")}e.Encode=t})(Ght||(Ght={}));RNe=class extends xi{constructor(t){super("Unknown type"),this.schema=t}},hle=class extends xi{constructor(t){super("Preflight validation check failed to guard for the given schema"),this.schema=t}};(function(e){function t(o,a,l){return hc.ExactOptionalPropertyTypes?`(${ID(a)} in ${o} ? ${l} : true)`:`(${b2n(o,a)} !== undefined ? ${l} : true)`}e.IsExactOptionalProperty=t;function n(o){return hc.AllowArrayObject?`(typeof ${o} === 'object' && ${o} !== null)`:`(typeof ${o} === 'object' && ${o} !== null && !Array.isArray(${o}))`}e.IsObjectLike=n;function r(o){return hc.AllowArrayObject?`(typeof ${o} === 'object' && ${o} !== null && !(${o} instanceof Date) && !(${o} instanceof Uint8Array))`:`(typeof ${o} === 'object' && ${o} !== null && !Array.isArray(${o}) && !(${o} instanceof Date) && !(${o} instanceof Uint8Array))`}e.IsRecordLike=r;function i(o){return hc.AllowNaN?`typeof ${o} === 'number'`:`Number.isFinite(${o})`}e.IsNumberLike=i;function s(o){return hc.AllowNullVoid?`(${o} === undefined || ${o} === null)`:`${o} === undefined`}e.IsVoidLike=s})(wD||(wD={}));(function(e){function t(ee){return ee[on]==="Any"||ee[on]==="Unknown"}function*n(ee,X,$){yield"true"}function*r(ee,X,$){yield"true"}function*i(ee,X,$){yield`Array.isArray(${$})`;let[se,oe]=[j("value","any"),j("acc","number")];fi(ee.maxItems)&&(yield`${$}.length <= ${ee.maxItems}`),fi(ee.minItems)&&(yield`${$}.length >= ${ee.minItems}`);let we=ue(ee.items,X,"value");if(yield`((array) => { for(const ${se} of array) if(!(${we})) { return false }; return true; })(${$})`,Qc(ee.contains)||fi(ee.minContains)||fi(ee.maxContains)){let Re=Qc(ee.contains)?ee.contains:Gi(),xe=ue(Re,X,"value"),re=fi(ee.minContains)?[`(count >= ${ee.minContains})`]:[],Me=fi(ee.maxContains)?[`(count <= ${ee.maxContains})`]:[],Ze=`const count = value.reduce((${oe}, ${se}) => ${xe} ? acc + 1 : acc, 0)`,He=["(count > 0)",...re,...Me].join(" && ");yield`((${se}) => { ${Ze}; return ${He}})(${$})`}ee.uniqueItems===!0&&(yield`((${se}) => { const set = new Set(); for(const element of value) { const hashed = hash(element); if(set.has(hashed)) { return false } else { set.add(hashed) } } return true } )(${$})`)}function*s(ee,X,$){yield`(typeof value === 'object' && Symbol.asyncIterator in ${$})`}function*o(ee,X,$){yield`(typeof ${$} === 'bigint')`,Qm(ee.exclusiveMaximum)&&(yield`${$} < BigInt(${ee.exclusiveMaximum})`),Qm(ee.exclusiveMinimum)&&(yield`${$} > BigInt(${ee.exclusiveMinimum})`),Qm(ee.maximum)&&(yield`${$} <= BigInt(${ee.maximum})`),Qm(ee.minimum)&&(yield`${$} >= BigInt(${ee.minimum})`),Qm(ee.multipleOf)&&(yield`(${$} % BigInt(${ee.multipleOf})) === 0`)}function*a(ee,X,$){yield`(typeof ${$} === 'boolean')`}function*l(ee,X,$){yield*ie(ee.returns,X,`${$}.prototype`)}function*u(ee,X,$){yield`(${$} instanceof Date) && Number.isFinite(${$}.getTime())`,fi(ee.exclusiveMaximumTimestamp)&&(yield`${$}.getTime() < ${ee.exclusiveMaximumTimestamp}`),fi(ee.exclusiveMinimumTimestamp)&&(yield`${$}.getTime() > ${ee.exclusiveMinimumTimestamp}`),fi(ee.maximumTimestamp)&&(yield`${$}.getTime() <= ${ee.maximumTimestamp}`),fi(ee.minimumTimestamp)&&(yield`${$}.getTime() >= ${ee.minimumTimestamp}`),fi(ee.multipleOfTimestamp)&&(yield`(${$}.getTime() % ${ee.multipleOfTimestamp}) === 0`)}function*c(ee,X,$){yield`(typeof ${$} === 'function')`}function*d(ee,X,$){let se=globalThis.Object.getOwnPropertyNames(ee.$defs).reduce((oe,we)=>[...oe,ee.$defs[we]],[]);yield*ie(Zm(ee.$ref),[...X,...se],$)}function*p(ee,X,$){yield`Number.isInteger(${$})`,fi(ee.exclusiveMaximum)&&(yield`${$} < ${ee.exclusiveMaximum}`),fi(ee.exclusiveMinimum)&&(yield`${$} > ${ee.exclusiveMinimum}`),fi(ee.maximum)&&(yield`${$} <= ${ee.maximum}`),fi(ee.minimum)&&(yield`${$} >= ${ee.minimum}`),fi(ee.multipleOf)&&(yield`(${$} % ${ee.multipleOf}) === 0`)}function*m(ee,X,$){let se=ee.allOf.map(oe=>ue(oe,X,$)).join(" && ");if(ee.unevaluatedProperties===!1){let oe=W(`${new RegExp(Iv(ee))};`),we=`Object.getOwnPropertyNames(${$}).every(key => ${oe}.test(key))`;yield`(${se} && ${we})`}else if(Qc(ee.unevaluatedProperties)){let oe=W(`${new RegExp(Iv(ee))};`),we=`Object.getOwnPropertyNames(${$}).every(key => ${oe}.test(key) || ${ue(ee.unevaluatedProperties,X,`${$}[key]`)})`;yield`(${se} && ${we})`}else yield`(${se})`}function*f(ee,X,$){yield`(typeof value === 'object' && Symbol.iterator in ${$})`}function*h(ee,X,$){if(typeof ee.const=="number"||typeof ee.const=="boolean")yield`(${$} === ${ee.const})`;else if(typeof ee.const=="string")yield`(${$} === ${ID(ee.const)})`;else throw Error("Invalid Literal Value")}function*g(ee,X,$){yield"false"}function*b(ee,X,$){yield`(!${ue(ee.not,X,$)})`}function*A(ee,X,$){yield`(${$} === null)`}function*y(ee,X,$){yield wD.IsNumberLike($),fi(ee.exclusiveMaximum)&&(yield`${$} < ${ee.exclusiveMaximum}`),fi(ee.exclusiveMinimum)&&(yield`${$} > ${ee.exclusiveMinimum}`),fi(ee.maximum)&&(yield`${$} <= ${ee.maximum}`),fi(ee.minimum)&&(yield`${$} >= ${ee.minimum}`),fi(ee.multipleOf)&&(yield`(${$} % ${ee.multipleOf}) === 0`)}function*S(ee,X,$){yield wD.IsObjectLike($),fi(ee.minProperties)&&(yield`Object.getOwnPropertyNames(${$}).length >= ${ee.minProperties}`),fi(ee.maxProperties)&&(yield`Object.getOwnPropertyNames(${$}).length <= ${ee.maxProperties}`);let se=Object.getOwnPropertyNames(ee.properties);for(let oe of se){let we=b2n($,oe),Re=ee.properties[oe];if(ee.required&&ee.required.includes(oe))yield*ie(Re,X,we),(wv(Re)||t(Re))&&(yield`(${ID(oe)} in ${$})`);else{let xe=ue(Re,X,we);yield wD.IsExactOptionalProperty($,oe,xe)}}if(ee.additionalProperties===!1)if(ee.required&&ee.required.length===se.length)yield`Object.getOwnPropertyNames(${$}).length === ${se.length}`;else{let oe=`[${se.map(we=>`${ID(we)}`).join(", ")}]`;yield`Object.getOwnPropertyNames(${$}).every(key => ${oe}.includes(key))`}if(typeof ee.additionalProperties=="object"){let oe=ue(ee.additionalProperties,X,`${$}[key]`),we=`[${se.map(Re=>`${ID(Re)}`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${$}).every(key => ${we}.includes(key) || ${oe}))`}}function*_(ee,X,$){yield`${$} instanceof Promise`}function*x(ee,X,$){yield wD.IsRecordLike($),fi(ee.minProperties)&&(yield`Object.getOwnPropertyNames(${$}).length >= ${ee.minProperties}`),fi(ee.maxProperties)&&(yield`Object.getOwnPropertyNames(${$}).length <= ${ee.maxProperties}`);let[se,oe]=Object.entries(ee.patternProperties)[0],we=W(`${new RegExp(se)}`),Re=ue(oe,X,"value"),xe=Qc(ee.additionalProperties)?ue(ee.additionalProperties,X,$):ee.additionalProperties===!1?"false":"true",re=`(${we}.test(key) ? ${Re} : ${xe})`;yield`(Object.entries(${$}).every(([key, value]) => ${re}))`}function*v(ee,X,$){let se=la(ee,X);if(ne.functions.has(ee.$ref))return yield`${le(ee.$ref)}(${$})`;yield*ie(se,X,$)}function*w(ee,X,$){let se=W(`${new RegExp(ee.source,ee.flags)};`);yield`(typeof ${$} === 'string')`,fi(ee.maxLength)&&(yield`${$}.length <= ${ee.maxLength}`),fi(ee.minLength)&&(yield`${$}.length >= ${ee.minLength}`),yield`${se}.test(${$})`}function*T(ee,X,$){yield`(typeof ${$} === 'string')`,fi(ee.maxLength)&&(yield`${$}.length <= ${ee.maxLength}`),fi(ee.minLength)&&(yield`${$}.length >= ${ee.minLength}`),ee.pattern!==void 0&&(yield`${W(`${new RegExp(ee.pattern)};`)}.test(${$})`),ee.format!==void 0&&(yield`format(${ID(ee.format)}, ${$})`)}function*D(ee,X,$){yield`(typeof ${$} === 'symbol')`}function*O(ee,X,$){yield`(typeof ${$} === 'string')`,yield`${W(`${new RegExp(ee.pattern)};`)}.test(${$})`}function*P(ee,X,$){yield`${le(ee.$ref)}(${$})`}function*k(ee,X,$){if(yield`Array.isArray(${$})`,ee.items===void 0)return yield`${$}.length === 0`;yield`(${$}.length === ${ee.maxItems})`;for(let se=0;se<ee.items.length;se++)yield`${ue(ee.items[se],X,`${$}[${se}]`)}`}function*M(ee,X,$){yield`${$} === undefined`}function*L(ee,X,$){yield`(${ee.anyOf.map(oe=>ue(oe,X,$)).join(" || ")})`}function*F(ee,X,$){yield`${$} instanceof Uint8Array`,fi(ee.maxByteLength)&&(yield`(${$}.length <= ${ee.maxByteLength})`),fi(ee.minByteLength)&&(yield`(${$}.length >= ${ee.minByteLength})`)}function*H(ee,X,$){yield"true"}function*U(ee,X,$){yield wD.IsVoidLike($)}function*J(ee,X,$){let se=ne.instances.size;ne.instances.set(se,ee),yield`kind(${ID(ee[on])}, ${se}, ${$})`}function*ie(ee,X,$,se=!0){let oe=Vo(ee.$id)?[...X,ee]:X,we=ee;if(se&&Vo(ee.$id)){let Re=le(ee.$id);if(ne.functions.has(Re))return yield`${Re}(${$})`;{ne.functions.set(Re,"<deferred>");let xe=Q(Re,ee,X,"value",!1);return ne.functions.set(Re,xe),yield`${Re}(${$})`}}switch(we[on]){case"Any":return yield*n(we,oe,$);case"Argument":return yield*r(we,oe,$);case"Array":return yield*i(we,oe,$);case"AsyncIterator":return yield*s(we,oe,$);case"BigInt":return yield*o(we,oe,$);case"Boolean":return yield*a(we,oe,$);case"Constructor":return yield*l(we,oe,$);case"Date":return yield*u(we,oe,$);case"Function":return yield*c(we,oe,$);case"Import":return yield*d(we,oe,$);case"Integer":return yield*p(we,oe,$);case"Intersect":return yield*m(we,oe,$);case"Iterator":return yield*f(we,oe,$);case"Literal":return yield*h(we,oe,$);case"Never":return yield*g(we,oe,$);case"Not":return yield*b(we,oe,$);case"Null":return yield*A(we,oe,$);case"Number":return yield*y(we,oe,$);case"Object":return yield*S(we,oe,$);case"Promise":return yield*_(we,oe,$);case"Record":return yield*x(we,oe,$);case"Ref":return yield*v(we,oe,$);case"RegExp":return yield*w(we,oe,$);case"String":return yield*T(we,oe,$);case"Symbol":return yield*D(we,oe,$);case"TemplateLiteral":return yield*O(we,oe,$);case"This":return yield*P(we,oe,$);case"Tuple":return yield*k(we,oe,$);case"Undefined":return yield*M(we,oe,$);case"Union":return yield*L(we,oe,$);case"Uint8Array":return yield*F(we,oe,$);case"Unknown":return yield*H(we,oe,$);case"Void":return yield*U(we,oe,$);default:if(!kp.Has(we[on]))throw new RNe(ee);return yield*J(we,oe,$)}}let ne={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function ue(ee,X,$,se=!0){return`(${[...ie(ee,X,$,se)].join(" && ")})`}function le(ee){return`check_${Ght.Encode(ee)}`}function W(ee){let X=`local_${ne.variables.size}`;return ne.variables.set(X,`const ${X} = ${ee}`),X}function Q(ee,X,$,se,oe=!0){let[we,Re]=[`
296
296
  `,Ze=>"".padStart(Ze," ")],xe=j("value","any"),re=Z("boolean"),Me=[...ie(X,$,se,oe)].map(Ze=>`${Re(4)}${Ze}`).join(` &&${we}`);return`function ${ee}(${xe})${re} {${we}${Re(2)}return (${we}${Me}${we}${Re(2)})
297
297
  }`}function j(ee,X){let $=ne.language==="typescript"?`: ${X}`:"";return`${ee}${$}`}function Z(ee){return ne.language==="typescript"?`: ${ee}`:""}function z(ee,X,$){let se=Q("check",ee,X,"value"),oe=j("value","any"),we=Z("boolean"),Re=[...ne.functions.values()],xe=[...ne.variables.values()],re=Vo(ee.$id)?`return function check(${oe})${we} {
298
298
  return ${le(ee.$id)}(value)
@@ -6384,7 +6384,7 @@ not revoke server-side tokens; use \`auggie token revoke\` for revocation.
6384
6384
  Interactive /login and /logout manage the platform session in session.json.`,cLr=`Usage: auggie auth status
6385
6385
 
6386
6386
  Show whether the CLI has an active Augment authentication session.`,X3o="Note: Injected credentials remain active and may override the saved session.",q3o="Note: Injected credentials remain active.",K3o="AUGGIE_V2_SEGMENT_WRITE_KEY"});import{readFile as g4o}from"node:fs/promises";import{resolve as b4o}from"node:path";function E4o(e){let t=[],n;for(let r=0;r<e.length;r+=1){let i=e[r];if(i==="--"){t.push(...e.slice(r));break}if(i===_9t){let s=e[r+1];if(s===void 0||s.startsWith("-")||!s.trim())return{type:"fatal"};n=s,r+=1;continue}if(i.startsWith(`${_9t}=`)){let s=i.slice(_9t.length+1);if(!s.trim())return{type:"fatal"};n=s;continue}t.push(i)}return{type:"success",args:t,candidate:n}}async function ALr(e,t=A4o){let n=E4o(e);if(n.type==="fatal")return{type:"fatal",message:y4o};if(n.candidate===void 0)return{type:"success",args:n.args};let r=n.candidate.trim(),i;if(r.startsWith("{"))i=r;else try{i=await t.readPath(b4o(process.cwd(),r))}catch{return{type:"fatal",message:S9t}}let s;try{s=JSON.parse(i)}catch{return{type:"fatal",message:S9t}}let o=rpe(s);return o?{type:"success",args:n.args,credentials:o}:{type:"fatal",message:S9t}}var _9t,y4o,S9t,A4o,ELr=C(()=>{"use strict";ipe();_9t="--augment-session-json",y4o="--augment-session-json requires a value",S9t="--augment-session-json value is unusable",A4o={readPath:e=>g4o(e,"utf8")}});import{execFile as _4o}from"node:child_process";import{existsSync as S4o,rmSync as v4o}from"node:fs";import{promisify as x4o}from"node:util";function x9t(e){let t=e.match(/^git@github\.com:(.+?)(?:\.git)?$/);if(t){let r=t[1];return{sshUrl:`git@github.com:${r}.git`,httpsUrl:`https://github.com/${r}.git`}}let n=e.match(/^https?:\/\/github\.com\/(.+?)(?:\.git)?$/);if(n){let r=n[1];return{sshUrl:`git@github.com:${r}.git`,httpsUrl:`https://github.com/${r}.git`}}return{sshUrl:e,httpsUrl:e}}function xLr(e){return e instanceof Error?e.message:String(e)}async function C9t({sshUrl:e,httpsUrl:t,targetDir:n,extraArgs:r=[]}){let i,s=e===t?[{url:e,env:e.startsWith("http")?v9t:_Lr}]:[{url:e,env:_Lr},{url:t,env:v9t}];for(let o of s)try{return await vLr("git",["clone","--depth","1",...r,o.url,n],{env:o.env}),{success:!0}}catch(a){i=a,S4o(n)&&v4o(n,{recursive:!0,force:!0})}return{success:!1,error:xLr(i)}}function SLr(e,t){return vLr("git",e,{cwd:t,env:v9t})}async function CLr(e,t){try{return await SLr(["fetch","--depth","1","origin",t],e),await SLr(["checkout","FETCH_HEAD"],e),{success:!0}}catch(n){return{success:!1,error:xLr(n)}}}var vLr,_Lr,v9t,TLr=C(()=>{"use strict";vLr=x4o(_4o),_Lr={...process.env,GIT_TERMINAL_PROMPT:"0",GIT_SSH_COMMAND:"ssh -o BatchMode=yes"},v9t={...process.env,GIT_TERMINAL_PROMPT:"0"}});import{readFileSync as C4o}from"node:fs";import{join as T9t}from"node:path";function I9(e){let t=T4o(e,ILr);return t.manifest||t.diagnostics.length>0?t:{diagnostics:[`no marketplace manifest found (looked for ${ILr.join(", ")})`]}}function T4o(e,t){let n=[];for(let r of t){let i=T9t(e,r),s;try{s=C4o(i,"utf-8")}catch{continue}try{let o=JSON.parse(s);if(o&&typeof o=="object"&&!Array.isArray(o))return{manifest:o,manifestPath:i,diagnostics:n};n.push(`manifest at ${r} is not a JSON object; ignoring`)}catch(o){n.push(`failed to parse manifest at ${r}: ${o.message}`)}}return{diagnostics:n}}var ILr,GGe=C(()=>{"use strict";ILr=[T9t(".augment-plugin","marketplace.json"),T9t(".claude-plugin","marketplace.json")]});import{execFile as I4o}from"node:child_process";import{existsSync as $w,mkdirSync as RLr,readdirSync as w4o,renameSync as R4o,rmSync as N4o,statSync as k4o}from"node:fs";import{dirname as O4o,isAbsolute as NLr,join as Qw,relative as kLr,resolve as I9t}from"node:path";import{promisify as M4o}from"node:util";function PLr(e){let t=e.replace(/\.\./g,"").replace(/[/\\]/g,"").replace(/^\.+/,"").trim();return!t||!/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(t)?null:t}function wLr(e){let t=e.replace(/\.\./g,"").replace(/[/\\]/g,"").replace(/^\.+/,"").trim();return!t||!/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(t)?null:t}function P4o(e){let t=e.trim();if(!t)return null;let n=t.match(/^([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_.-]+?)(?:@(.+))?$/);if(n?.[1]&&n[2]){let r=n[1],i=n[2].replace(/\.git$/,"");return{repo:i,cloneUrl:`https://github.com/${r}/${i}`,...n[3]?{ref:n[3]}:{}}}if(/^(https?|ssh|file):\/\/|^git@/.test(t)){let[r,i]=t.split("#");if(!r)return null;let s=r.replace(/\/+$/,""),o=s.split(/[/:]/).pop()?.replace(/\.git$/,"");if(o)return{repo:o,cloneUrl:s,...i?{ref:i}:{}}}return null}function Hw(e){return typeof e=="string"&&e.length>0?e:void 0}function D4o(e,t){let n=Hw(e.repo);return n?{kind:"github",url:`https://github.com/${n.replace(/\.git$/,"")}.git`,...t?{ref:t}:{},...Hw(e.path)?{subdir:Hw(e.path)}:{}}:null}function B4o(e,t){let n=Hw(e.url);return n?{kind:"url",url:n,...t?{ref:t}:{},...Hw(e.path)?{subdir:Hw(e.path)}:{}}:null}function L4o(e,t){let n=Hw(e.url),r=Hw(e.path);return n&&r?{kind:"git-subdir",url:n,subdir:r,...t?{ref:t}:{}}:null}function w9t(e){if(!e||typeof e!="object")return null;let t=e,n=Hw(t.sha)??Hw(t.ref);switch(t.source){case"github":return D4o(t,n);case"url":return B4o(t,n);case"git-subdir":return L4o(t,n);default:return null}}function DLr(e,t,n){let r=PLr(t);if(!r)return;let i=Qw(e,MLr,r);if(!$w(Qw(i,".git")))return;if(!n)return i;let s=I9t(i,n),o=kLr(i,s);if(!(o.startsWith("..")||NLr(o)))return $w(s)?s:void 0}async function F4o(e,t){let n=typeof t.name=="string"?t.name:"",r=w9t(t.source);if(!r)return;let i=PLr(n);if(!i)return{name:n,status:"failed",error:"invalid plugin cache name"};let s=Qw(e,MLr,i);if($w(Qw(s,".git")))return{name:n,status:"skipped"};let o=O4o(s);$w(o)||RLr(o,{recursive:!0});let{sshUrl:a,httpsUrl:l}=x9t(r.url),u=r.kind==="git-subdir",c=await C9t({sshUrl:a,httpsUrl:l,targetDir:s,extraArgs:u?["--filter=blob:none","--sparse"]:[]});if(!c.success)return{name:n,status:"failed",error:c.error};if(r.ref){let d=await CLr(s,r.ref);if(!d.success)return{name:n,status:"failed",error:d.error}}if(u&&r.kind==="git-subdir")try{await OLr("git",["sparse-checkout","set",r.subdir],{cwd:s,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}})}catch(d){return{name:n,status:"failed",error:d instanceof Error?d.message:String(d)}}return{name:n,status:"cloned"}}async function R9t(e){let{manifest:t}=I9(e),n=t?.plugins;if(!n||n.length===0)return[];let r=[];for(let i of n){let s=await F4o(e,i);s&&r.push(s)}return r}function U4o(e){try{return k4o(e).isDirectory()}catch{return!1}}function V4o(e,t){let n=kLr(I9t(e),I9t(t));return n!==""&&!n.startsWith("..")&&!NLr(n)}async function HK(e,t){let n=P4o(t);if(!n)return{success:!1,error:`Invalid repository: ${t}. Expected owner/repo, a Git URL (HTTPS/SSH/file), or a github.com URL.`};let{repo:r,ref:i,cloneUrl:s}=n;$w(e)||RLr(e,{recursive:!0});let o=wLr(r);if(!o)return{success:!1,error:`Invalid repository name for marketplace directory: "${r}".`};let a=Qw(e,o);if($w(a))return{success:!1,alreadyInstalled:!0,marketplaceId:o,error:`Marketplace '${o}' is already installed.`};let{sshUrl:l,httpsUrl:u}=x9t(s),c=await C9t({sshUrl:l,httpsUrl:u,targetDir:a,extraArgs:i?["--branch",i]:[]});if(!c.success)return{success:!1,error:`Failed to clone '${s}': ${c.error}`};let{manifest:d}=I9(a),p=o,m=typeof d?.name=="string"?wLr(d.name):null;if(m&&m!==o){let f=Qw(e,m);if(!$w(f))try{R4o(a,f),p=m}catch{}}return await R9t(Qw(e,p)),{success:!0,marketplaceId:p}}function YK(e,t){let n=Qw(e,t);if(!V4o(e,n))return{success:!1,error:`Refusing to remove '${t}': path is outside the marketplaces directory.`};if(!$w(n))return{success:!1,error:`Marketplace '${t}' not found.`};try{return N4o(n,{recursive:!0,force:!0}),{success:!0}}catch(r){return{success:!1,error:`Failed to remove '${t}': ${r instanceof Error?r.message:String(r)}`}}}async function BLr(e){if(!$w(Qw(e,".git")))return{success:!1,notGitRepo:!0,error:"Not a git repository"};try{return await OLr("git",["pull"],{cwd:e,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}}),await R9t(e),{success:!0}}catch(t){return{success:!1,error:t instanceof Error?t.message:String(t)}}}async function LLr(e){let t=!1;for(let n of e){if(!$w(n))continue;let r;try{r=w4o(n)}catch{continue}for(let i of r){let s=Qw(n,i);if(!U4o(s))continue;(await R9t(s)).some(a=>a.status==="cloned")&&(t=!0)}}return t}var OLr,MLr,WGe=C(()=>{"use strict";TLr();GGe();OLr=M4o(I4o),MLr=".plugin-cache"});import{readFileSync as G4o}from"node:fs";import{join as W4o}from"node:path";function $Ge(e){let t=W4o(e,"hooks","hooks.json"),n;try{n=G4o(t,"utf-8")}catch{return{diagnostics:[]}}let r;try{r=JSON.parse(n)}catch(s){return{diagnostics:[`failed to parse hooks/hooks.json: ${s.message}`]}}return!r||typeof r!="object"||Array.isArray(r)?{diagnostics:["hooks/hooks.json must be a JSON object"]}:{config:pw(r),diagnostics:[]}}var N9t=C(()=>{"use strict";g2()});import{existsSync as $4o,lstatSync as Q4o,readdirSync as GLr,realpathSync as FLr,statSync as H4o}from"node:fs";import{basename as ULr,isAbsolute as k9t,join as cge,relative as WLr,resolve as O9t}from"node:path";function M9t(e,t){let n=[],r=[],i=[],s=new Map;for(let o of new Set(e))for(let a of Y4o(o,t,r)){let l=s.get(a.id);if(l!==void 0){i.push({id:a.id,shadowedRoot:o,winnerRoot:l});continue}s.set(a.id,o),n.push(a)}for(let[o,a]of Object.entries(t))a&&!s.has(o)&&r.push(`enabledPlugins["${o}"] = true but no plugin with that id was found in any marketplace root`);return{plugins:n,globalDiagnostics:r,shadowedPlugins:i}}function Y4o(e,t,n){let r=[];if(!$4o(e))return r;let i=I9(e);if(!i.manifest)for(let o of i.diagnostics)o.startsWith("no marketplace manifest found")||n.push(`[${ULr(e)}] ${o}`);if(i.manifest)return VLr(e,ULr(e),t,r,n),r;let s;try{s=GLr(e)}catch(o){return n.push(`failed to read marketplaces directory ${e}: ${o.message}`),r}for(let o of s){let a=cge(e,o);uge(a)&&VLr(a,o,t,r,n)}return r}function VLr(e,t,n,r,i){let s=I9(e);if(!s.manifest){for(let u of s.diagnostics)i.push(`[${t}] ${u}`);return}let o=J4o(s.manifest.name,t),a=K4o(e,s.manifest.metadata?.pluginRoot),l=Array.isArray(s.manifest.plugins)?s.manifest.plugins:[];l.length===0&&i.push(`[${o}] marketplace.json has no plugins[] entries`);for(let u of l){let c=Z4o(u,e,a,o,n);c&&r.push(c)}for(let u of s.diagnostics)i.push(`[${o}] ${u}`)}function Z4o(e,t,n,r,i){let s=typeof e.name=="string"?w9(e.name):void 0;if(!s)return;let o=`${s}@${r}`,a=i[o]===!0,l=[],u=q4o(e.source,s,t,n,l);return u?z4o(o,r,s,u,a,l,t):{id:o,marketplace:r,name:s,enabled:a,commandsDir:void 0,skillsDir:void 0,hooksConfig:void 0,agentsDirPresent:!1,diagnostics:l}}function j4o(e,t){let n=[],r;try{r=GLr(e).sort()}catch(s){return t.push(`failed to read agents directory: ${s.message}`),n}let i=[];for(let s of r){if(!s.endsWith(".md"))continue;let o=cge(e,s);try{if(!Q4o(o).isFile()){i.push(s);continue}}catch(a){t.push(`failed to stat agent file ${s}: ${a.message}`);continue}n.push(o)}return i.length>0&&t.push(`ignoring non-regular agent file(s) under agents/ (symlinks / dirs / devices are not followed): ${i.join(", ")}`),n}function z4o(e,t,n,r,i,s,o){let a=cge(r,"commands"),l=cge(r,"skills"),u=cge(r,"agents"),c=eVo(a,r,s),d=uge(l)?l:void 0,p=uge(u),m=p&&i?j4o(u,s):void 0,f=$Ge(r);for(let h of f.diagnostics)s.push(h);return{id:e,marketplace:t,name:n,root:r,marketplacePath:O9t(o),enabled:i,commandsDir:c,skillsDir:d,hooksConfig:f.config,agentsDirPresent:p,agentFiles:m,diagnostics:s}}function X4o(e,t,n,r){let i=w9t(e);if(!i){let o=e.source;r.push(`source kind "${typeof o=="string"?o:"object"}" is not supported; install the plugin manually as a relative directory`);return}let s=DLr(n,t,i.subdir);if(s)return s;r.push(`source kind "${i.kind}" not fetched yet; run /plugins to clone it (or marketplace update)`)}function q4o(e,t,n,r,i){if(typeof e!="string"){if(e&&typeof e=="object")return X4o(e,t,n,i);i.push("plugin entry has no source field; skipping");return}if(k9t(e)){i.push(`absolute source "${e}" is not allowed; skipping`);return}let s=e.startsWith("./")?n:r,o=O9t(s,e),a=WLr(n,o);if(a.startsWith("..")||k9t(a)){i.push(`source "${e}" resolves outside the marketplace root; skipping`);return}if(!uge(o)){i.push(`source "${e}" does not point to an existing directory (looked at ${o})`);return}return o}function K4o(e,t){return typeof t!="string"||t.length===0?e:O9t(e,t)}function J4o(e,t){if(typeof e=="string"&&e.length>0){let n=w9(e);if(n.length>0)return n}return t}function w9(e){let t="";for(let n of e){let r=n.codePointAt(0);if(r===void 0)continue;let i=r<=31,s=r>=127&&r<=159;i||s||(t+=n)}return t}function eVo(e,t,n){if(uge(e))try{let r=WLr(FLr(t),FLr(e));if(r===".."||r.startsWith("../")||r.startsWith("..\\")||k9t(r)){n.push("commands/ directory resolves outside the plugin root");return}return e}catch{n.push("commands/ directory could not be resolved");return}}function uge(e){try{return H4o(e).isDirectory()}catch{return!1}}var dge=C(()=>{"use strict";WGe();N9t();GGe()});import{readFileSync as tVo}from"node:fs";import{basename as nVo}from"node:path";function jx(e,t,n=!0){if(e!==void 0){if(typeof e!="string")throw new zx(`Invalid ${t}: expected a string.`);return n?e.trim():e}}function K2(e,t){if(e!==void 0){if(typeof e!="boolean")throw new zx(`Invalid ${t}: expected a boolean.`);return e}}function $Lr(e){return w9(e.trim().replace(/\s+/g,"-").replace(/[^a-zA-Z0-9_-]/g,"-").replace(/-+/g,"-"))}function QGe(e,t){if(typeof e=="string")return e.trim()==="none"?[]:[...new Set(e.split(",").map(n=>n.trim()).filter(Boolean))];if(!Array.isArray(e)||e.some(n=>typeof n!="string"||!n.trim()))throw new zx(`Invalid ${t}: expected named strings as a list or CSV.`);return[...new Set(e.map(n=>n.trim()))]}function sVo(e){if(e===void 0)return!0;if(typeof e=="boolean")throw new zx("Boolean skills is unsupported. Use disable_skills: true for opt-out; omit skills for defaults.");let t=QGe(e,"skills");return t.length?t:!1}function oVo(e){switch(e){case"red":case"blue":case"green":case"yellow":case"orange":case"purple":case"pink":case"cyan":return e;default:return}}function P9t(e,t,n){return{name:e,pluginId:t,source:"plugin",description:e,enabled:!1,invalidDefinition:!0,diagnostics:[n],builtinToolNames:[],disallowedTools:[],extensions:!1,skills:!1,systemPrompt:"",promptMode:"append"}}function aVo(e){if(typeof e=="string")return iVo.includes(e)?e:void 0}function lVo(e){return typeof e=="number"&&e>=0?e:void 0}function cVo(e){if(e==="user"||e==="project"||e==="local")return e}function uVo(e){if(e==null||e===!0)return!0;if(e===!1||e==="none")return!1;let t=QGe(e,"extensions");return t.length>0?t:!1}function dVo(e,t){let n=nVo(e,".md"),r=$Lr(n),i;try{i=tVo(e,"utf-8")}catch{return P9t(r,t,"Custom-agent file could not be read.")}try{let{frontmatter:s,body:o}=Sx(i);if(!s||typeof s!="object"||Array.isArray(s))throw new zx("Invalid frontmatter mapping.");if(r=$Lr(jx(s.name,"name")||n),!r)throw new zx("Invalid name: a non-empty identity is required.");for(let[a,l]of Object.entries({disallowed_tools:"Use disabled_tools instead.",prompt_mode:"Use replace_system_prompt: false for append or true for replace.",inherit_skills:"Use disable_skills for opt-out or skills for named selection."}))if(Object.hasOwn(s,a))throw new zx(`Removed frontmatter field ${a}. ${l}`);return mVo({fm:s,body:o,name:r,pluginId:t})}catch(s){return P9t(r,t,s instanceof zx?s.message:"Invalid custom-agent definition.")}}function pVo(e){let t=jx(e.thinking,"thinking"),n=aVo(t),r=oVo(e.color),i=[];return e.color!==void 0&&!r&&i.push("Invalid color: expected a supported terminal label color."),t!==void 0&&n===void 0&&i.push("Invalid thinking: expected a supported thinking level. Model default retained."),{color:r,thinking:n,diagnostics:i.length?i:void 0}}function mVo({fm:e,body:t,name:n,pluginId:r}){let i=K2(e.replace_system_prompt,"replace_system_prompt")??!1;if(i&&!t.trim())throw new zx("replace_system_prompt requires a non-empty Markdown body.");let s=K2(e.disable_skills,"disable_skills")??!1,o=sVo(e.skills);return{name:n,displayName:jx(e.display_name,"display_name")||n,description:jx(e.description,"description")||n,...pVo(e),toolDescription:jx(e.tool_description,"tool_description")||void 0,instructionDescription:jx(e.instruction_description,"instruction_description")||void 0,providerModel:jx(e.provider_model,"provider_model",!1),providerApiKey:jx(e.provider_api_key,"provider_api_key",!1),providerBaseUrl:jx(e.provider_base_url,"provider_base_url",!1),builtinToolNames:e.tools===void 0?[...rVo]:QGe(e.tools,"tools"),disallowedTools:e.disabled_tools===void 0?void 0:QGe(e.disabled_tools,"disabled_tools"),extensions:uVo(e.extensions??e.inherit_extensions),skills:s?!1:o,disableSkills:s,disableRules:K2(e.disable_rules,"disable_rules")??!1,disableWorkspaceGuidelines:K2(e.disable_workspace_guidelines,"disable_workspace_guidelines")??!1,model:jx(e.model,"model"),maxTurns:lVo(e.max_turns),systemPrompt:t.trim(),replaceSystemPrompt:i,promptMode:i?"replace":"append",inheritContext:K2(e.inherit_context,"inherit_context"),runInBackground:K2(e.run_in_background,"run_in_background"),isolated:K2(e.isolated,"isolated"),memory:cVo(e.memory),isolation:e.isolation==="worktree"?"worktree":void 0,enabled:K2(e.enabled,"enabled")??!0,hidden:K2(e.hidden,"hidden")??!1,finishTool:jx(e.finish_tool,"finish_tool"),source:"plugin",pluginId:r}}function HLr(e){let t=new Map,n=[];if(!e.agentFiles||e.agentFiles.length===0)return{agents:t,diagnostics:n};let r=new Map;for(let i of e.agentFiles){let s=dVo(i,e.id);n.push(...s.diagnostics??[]);let o=s.name.toLowerCase();if(r.has(o)){let a=r.get(o)??s.name,l="Duplicate agent identity in the same directory.";n.push(l),t.set(a,P9t(a,e.id,l));continue}t.set(s.name,s),r.set(o,s.name)}return{agents:t,diagnostics:n}}var rVo,iVo,QLr,zx,YLr=C(()=>{"use strict";ts();dge();rVo=["read","bash","edit","write","grep","find","ls"],iVo=["off","minimal","low","medium","high","xhigh"],QLr=["general-purpose","explore","plan"],zx=class extends Error{}});import{lstatSync as fVo,readFileSync as hVo,realpathSync as ZLr}from"node:fs";import{isAbsolute as gVo,join as bVo,relative as yVo}from"node:path";function ZK(e,t){let n=e;for(let r of AVo){let i=`\${${r}}`;n.includes(i)&&(n=n.split(i).join(t))}return n}function D9t(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function jLr(e){if(!e)return;let t={};for(let[n,r]of Object.entries(e))r!=null&&(t[n]=String(r));return Object.keys(t).length>0?t:void 0}function EVo(e){if(e.type==="stdio"||e.type==="http"||e.type==="sse")return e.type;if(e.url)return"http";if(e.command)return"stdio"}function _Vo(e,t){let n=EVo(t);if(!n)throw new Error(`MCP server "${e}" must declare a 'command' (stdio) or 'url' (http/sse) property`);if(n==="http"||n==="sse"){if(!t.url)throw new Error(`MCP server "${e}" has type "${n}" but no 'url' property`);let a=typeof t.clientId=="string"?t.clientId.trim():void 0;return{type:n,name:e,disabled:t.disabled,url:t.url,headers:jLr(t.headers),auth:t.auth==="oauth"?"oauth":void 0,...a?{clientId:a}:{},cwd:t.cwd,timeoutMs:t.timeoutMs}}let r=t.command;if(!r)throw new Error(`MCP server "${e}" has type "stdio" but no 'command' property`);let i=Array.isArray(t.args)?t.args.map(a=>String(a)):[],s=t.useShellInterpolation??!0,o=s&&i.length>0?`${r} ${i.join(" ")}`:r;return{type:"stdio",name:e,disabled:t.disabled,command:o,args:s?[]:i,env:jLr(t.env),cwd:t.cwd,timeoutMs:t.timeoutMs,useShellInterpolation:s}}function zLr(e,t){if(!e)return;let n={};for(let[r,i]of Object.entries(e))n[r]=ZK(i,t);return n}function SVo(e,t){return e.type==="stdio"?{...e,command:ZK(e.command,t),args:e.args.map(n=>ZK(n,t)),env:zLr(e.env,t),cwd:e.cwd?ZK(e.cwd,t):void 0}:{...e,url:ZK(e.url,t),headers:zLr(e.headers,t),cwd:e.cwd?ZK(e.cwd,t):void 0}}function vVo(e,t){let n=bVo(e,".mcp.json"),r;try{r=fVo(n)}catch(i){if(i?.code==="ENOENT")return;t.push(`failed to stat .mcp.json: ${i.message}`);return}if(r.isSymbolicLink()){t.push(".mcp.json is a symlink; refusing to follow it out of the plugin root");return}if(!r.isFile()){t.push(".mcp.json is not a regular file; skipping");return}try{let i=ZLr(e),s=ZLr(n),o=yVo(i,s);if(o.startsWith("..")||gVo(o)){t.push(".mcp.json resolves outside the plugin root; skipping");return}}catch(i){t.push(`failed to resolve .mcp.json real path: ${i.message}`);return}try{return hVo(n,"utf-8")}catch(i){t.push(`failed to read .mcp.json: ${i.message}`);return}}function HGe(e){let t=[];if(!e.root)return{servers:[],diagnostics:t};let n=vVo(e.root,t);if(n===void 0)return{servers:[],diagnostics:t};let r;try{r=JSON.parse(n)}catch(o){return t.push(`failed to parse .mcp.json: ${o.message}`),{servers:[],diagnostics:t}}if(!D9t(r))return t.push(".mcp.json must be a JSON object"),{servers:[],diagnostics:t};let i=r.mcpServers;if(!D9t(i))return t.push('.mcp.json must contain an "mcpServers" object'),{servers:[],diagnostics:t};let s=[];for(let[o,a]of Object.entries(i)){let l=`${e.id}/${w9(o)}`;if(!D9t(a)){t.push(`MCP server "${l}" must be a JSON object`);continue}try{let u=_Vo(l,a);s.push(SVo(u,e.root))}catch(u){t.push(u instanceof Error?u.message:String(u))}}return{servers:s,diagnostics:t}}var AVo,XLr,B9t=C(()=>{"use strict";dge();AVo=["CLAUDE_PLUGIN_ROOT","AUGMENT_PLUGIN_ROOT","AUGGIE_PLUGIN_ROOT"];XLr="hermes:mcp:register-server-source"});function qLr(e,t,n){let r=yi.create(e,t,n),i={};for(let o of[r.getVfsOrgSettings(),r.getVfsSpaceSettings(),r.getVfsUserSettings(),r.getSettings()])for(let[a,l]of Object.entries(o.enabledPlugins??{}))typeof l=="boolean"&&(i[a]=l);let s=r.drainErrors().map(({scope:o,error:a})=>`failed to load ${o} settings: ${a.message}; enabledPlugins entries from this scope will be ignored`);return{enabled:i,diagnostics:s}}var KLr=C(()=>{"use strict";ts()});var JLr,e9r=C(()=>{"use strict";JLr="hermes:subagents:register-agent-source"});import{lstatSync as xVo,readdirSync as CVo,readFileSync as L9t}from"node:fs";import{basename as TVo,dirname as IVo,extname as wVo,isAbsolute as RVo,join as Xx,parse as NVo,relative as jK,resolve as pge,sep as F9t}from"node:path";function YGe(e){return typeof e=="string"&&ZGe(e)||void 0}function t9r(e,t){let n=jK(e,t);return!RVo(n)&&n!==".."&&!n.startsWith(`..${F9t}`)}function kVo(e,t,n){let r=n?pge(n):NVo(e).root;if(!t9r(r,e)||!t9r(e,t))throw new Error("Plugin metadata path is outside the plugin root");let i=r,s;for(let o of["",...jK(r,t).split(F9t).filter(Boolean)]){i=Xx(i,o);try{s=xVo(i)}catch(a){if(a.code==="ENOENT")return;throw a}if(s.isSymbolicLink())throw new Error("Plugin metadata path contains a symbolic link")}return s}function zK(e){let t={agents:[],commands:[],rules:[],mcpServers:[],hooks:[],skills:[],diagnostics:[]};if(!e.root)return t.diagnostics.push("Plugin source is unavailable"),t;let n=pge(e.root),r=d=>kVo(n,d,e.marketplacePath),i=AX(),s=d=>{let p=`Could not read plugin ${d} metadata`;t.diagnostics.includes(p)||t.diagnostics.push(p)};try{if(!r(n)?.isDirectory())throw new Error("Plugin root is unavailable")}catch{return s("contents"),t}let o=(d,p,m,f)=>{let h={name:ZGe(p)};try{if(!r(d)?.isFile())throw new Error("Plugin metadata file is unavailable");let{frontmatter:g}=Sx(L9t(d,"utf8"));if(!g||typeof g!="object"||Array.isArray(g))throw new Error("Invalid plugin frontmatter");f&&(h.name=YGe(g.name)??h.name),h.description=YGe(g.description)}catch{s(m)}return h},a=(d,p,m)=>{let f=wVo(p);if(!(f===".md"||(d==="commands"||d==="rules")&&f===".txt")||d==="skills"&&IVo(p)!==m)return;let g=jK(m,p),b=d==="rules"?g:g.slice(0,-f.length).split(F9t).join(":");t[d].push(o(p,b,d,d==="agents"||d==="skills"))},l=(d,p,m)=>{try{let f=r(p);if(d==="skills"&&fL(i,jK(m,p),f?.isDirectory()))return;f?.isDirectory()?d!=="agents"&&c(d,p,m):f?.isFile()&&a(d,p,m)}catch{s(d)}},u=(d,p)=>{for(let m of yX){let f=Xx(d,m);try{let h=r(f);if(!h)continue;if(!h.isFile())throw new Error("Invalid skill ignore file");EX(i,L9t(f,"utf8"),jK(p,d))}catch{s("skills")}}},c=(d,p,m=p)=>{try{let f=r(p);if(!f)return;if(!f.isDirectory())throw new Error("Plugin metadata directory is invalid");if(d==="skills"){u(p,m);let h=Xx(p,"SKILL.md");if(!fL(i,jK(m,h))&&r(h)?.isFile()){t.skills.push(o(h,TVo(p),d,!0));return}}for(let h of CVo(p).sort())(d==="commands"||d==="skills")&&mL(h)||l(d,Xx(p,h),m)}catch{s(d)}};return c("agents",Xx(n,"agents")),c("commands",pge(e.commandsDir??Xx(n,"commands"))),c("rules",Xx(n,"rules")),c("skills",pge(e.skillsDir??Xx(n,"skills"))),t.hooks=PVo(n,r,s),t.mcpServers=DVo(e,r,s),Object.assign(t,MVo(n,r,s)),t}function OVo(e){let t={};for(let s of["description","version","homepage"]){let o=YGe(e[s]);o&&(t[s]=o)}let n=e.author,r=n&&typeof n=="object"&&!Array.isArray(n)?n.name:n,i=YGe(r);return i&&(t.author=i),t}function MVo(e,t,n){for(let r of[".augment-plugin",".claude-plugin"])try{let i=Xx(e,r,"plugin.json"),s=t(i);if(!s)continue;if(!s.isFile())throw new Error("Invalid plugin manifest file");let o=JSON.parse(L9t(i,"utf8"));if(!o||typeof o!="object"||Array.isArray(o))throw new Error("Invalid plugin manifest");return OVo(o)}catch{n("manifest")}return{}}function PVo(e,t,n){let r=[];try{let i=t(Xx(e,"hooks","hooks.json"));if(i){if(!i.isFile())throw new Error("Invalid plugin hooks file");let{config:s,diagnostics:o}=$Ge(e);(!s||o.length)&&n("hook");for(let[a,l]of Object.entries(s??{}).sort(([u],[c])=>u.localeCompare(c)))for(let u of l??[])r.push({name:ZGe(`${a}[${u.matcher??".*"}]`),description:"Command hook"})}}catch{n("hook")}return r}function DVo(e,t,n){if(!e.root)return[];let r=pge(e.root);try{let i=t(Xx(r,".mcp.json"));if(i){if(!i.isFile())throw new Error("Invalid plugin MCP file");let{servers:s,diagnostics:o}=HGe(e);return o.length&&n("MCP server"),s.map(a=>({name:ZGe(a.name.slice(e.id.length+1)),description:`${a.type==="stdio"?"stdio":a.type.toUpperCase()} server`})).sort((a,l)=>a.name.localeCompare(l.name))}}catch{n("MCP server")}return[]}var ZGe,n9r=C(()=>{"use strict";ts();dge();N9t();B9t();ZGe=e=>w9(e.replace(/\s+/g," ")).trim()});var fge={};ui(fge,{addMarketplace:()=>HK,default:()=>XGe,getDiscoveredMarketplaces:()=>mge,getDiscoveredPlugins:()=>qx,getInteractivePluginDiagnostics:()=>YVo,getPluginDetails:()=>zK,getPluginDiagnostics:()=>Kx,getV2MarketplacesRoot:()=>qK,removeMarketplace:()=>YK,updateMarketplace:()=>BLr});import{join as h6,resolve as BVo}from"node:path";import{existsSync as LVo,readdirSync as FVo,statSync as UVo}from"node:fs";function GVo(){return globalThis[r9r]??{}}function WVo(e){globalThis[r9r]=e}function XGe(e){S1=[],zGe=[],jGe=[],U9t=[],XK=[];let t=!1,n,r=new Map,i,s,o=new Map,a;e.events.on(OFe,w=>{n=w.register}),e.events.on(JLr,w=>{i=w.register}),e.events.on(XLr,w=>{a=w.registerServerSource}),e.events.on(VVo,w=>{WVo(w?.scopes??{})});function l(w,T,D=[]){let O=GVo(),{enabled:P,diagnostics:k}=qLr(w,T,O),M=[...new Set(D.map(ne=>BVo(w,ne)))],L=M9t(M,{}),F={...P};for(let ne of L.plugins)F[ne.id]=!0;let H=h6(MA(),"plugins","marketplaces"),U=h6(T,"plugins","marketplaces"),J=[O.user,O.space,O.org].flatMap(ne=>ne?[h6(ne,".augment","plugins","marketplaces")]:[]),ie=M9t([...M,H,U,...J],F);for(let ne of ie.shadowedPlugins)vE.debug(`plugin "${ne.id}" from ${ne.shadowedRoot} is shadowed by the higher-precedence root ${ne.winnerRoot}`);return ie.globalDiagnostics=[...k,...ie.globalDiagnostics],S1=ie.plugins,zGe=ie.globalDiagnostics,t=!0,ie}function u(w,T,D=[]){t||l(w,T,D)}function c(){let w=new Map,T=new Map;jGe=[];let D=[...S1.filter(O=>O.enabled)].sort((O,P)=>O.id.localeCompare(P.id));for(let O of D){let{agents:P,diagnostics:k}=HLr(O);for(let M of k)vE.warn(`[${O.id}] ${M}`),jGe.push({type:"warning",message:`[${O.id}] ${M}`,path:O.root});for(let[M,L]of P)d(O.id,M,L,w,T)}o=w}function d(w,T,D,O,P){let k=T.toLowerCase(),M=P.get(k);if(M){let L=M.name===T?`"${T}"`:`"${T}" (case-insensitive collision with "${M.name}")`;vE.warn(`[${w}] plugin-contributed agent ${L} shadowed by earlier plugin ${M.pluginId}; ignoring`);return}QLr.includes(k)&&vE.warn(`[${w}] plugin-contributed agent "${T}" shadows the built-in default agent of the same name; the plugin's definition will be used for every Agent-tool invocation across this session`),O.set(T,D),P.set(k,{pluginId:w,name:T})}function p(){if(!i)return;s?.(),s=i({getAgents:()=>o,getDiagnostics:()=>jGe})}function m(){let w=[];XK=[];let T=[...S1.filter(D=>D.enabled)].sort((D,O)=>D.id.localeCompare(O.id));for(let D of T){let{servers:O,diagnostics:P}=HGe(D);for(let k of P)vE.warn(`[${D.id}] ${k}`),XK.push({type:"warning",message:`[${D.id}] ${k}`,path:D.root});for(let k of O)w.push(k)}U9t=w}function f(){if(!a)return;a({source:"plugin",getServers:()=>U9t,getDiagnostics:()=>XK})}function h(){if(n){for(let w of r.values())w();r.clear();for(let w of S1){if(!w.enabled)continue;let T=$Vo(w);T&&r.set(w.id,n(T))}}}function g(){for(let w of r.values())w();r.clear()}function b(){let w=[],T=[];for(let D of S1){if(!D.enabled){for(let O of D.diagnostics)vE.debug(`[${D.id}] ${O}`);continue}D.root&&D.commandsDir&&T.push({path:D.commandsDir,commandNamespace:`${D.name}--${D.marketplace}`}),D.root&&D.skillsDir&&w.push(D.skillsDir);for(let O of D.diagnostics)vE.warn(`[${D.id}] ${O}`)}return{skillPaths:w,promptPaths:T}}e.on("resources_discover",(w,T)=>{t=!1;let D=l(w.cwd,w.agentDir,T.pluginDirs),{skillPaths:O,promptPaths:P}=b();for(let M of D.globalDiagnostics)vE.warn(M);let k=S1.filter(M=>M.enabled).length;return S1.length>0&&vE.info(`Discovered ${S1.length} plugin(s); ${k} enabled`),h(),c(),p(),x(),m(),f(),v(),{skillPaths:O,promptPaths:P}}),e.on("session_start",(w,T)=>{u(T.cwd,T.agentDir,T.pluginDirs),h(),c(),p(),_(),m(),f();let D=h6(MA(),"plugins","marketplaces"),O=h6(T.agentDir,"plugins","marketplaces");LLr([D,O]).then(P=>{P&&(t=!1,l(T.cwd,T.agentDir,T.pluginDirs),h(),c(),p(),m(),f())}).catch(P=>{vE.debug(`background plugin source fetch failed: ${P instanceof Error?P.message:String(P)}`)})}),e.on("session_shutdown",()=>{g(),s?.(),s=void 0,o=new Map});let A=!1,y=!1,S=!1;function _(){!n&&!A&&(A=!0,vE.warn("@hermes/hooks did not register a hook listener; plugin hooks will not run. This usually means @hermes/hooks was removed from the built-in extension list."))}function x(){!i&&!y&&(y=!0,vE.debug("@hermes/subagents did not register an agent source; plugin-contributed subagents will not be available (expected when --disable-subagents is set)."))}function v(){!a&&!S&&(S=!0,vE.debug("@hermes/mcp did not register a server source; plugin-contributed MCP servers will not be loaded."))}}function $Vo(e){if(e.root)return{source:e.id,isEnabled:()=>e.enabled,getConfig:()=>e.hooksConfig,env:QVo(e.root),postToolUsePrefix:`Plugin ${e.id} hook`,hookLabel:t=>`[${e.id}] ${t} hook`,blockedFallbackReason:"Blocked by plugin hook"}}function QVo(e){return{PLUGIN_ROOT:e,CLAUDE_PLUGIN_ROOT:e,AUGMENT_PLUGIN_ROOT:e,AUGGIE_PLUGIN_ROOT:e}}function qx(){return S1}function qK(e){return h6(e,"plugins","marketplaces")}function mge(e){let t=qK(e);if(!LVo(t))return[];let n;try{n=FVo(t)}catch{return[]}let r=[];for(let i of n){let s=h6(t,i);try{if(!UVo(s).isDirectory())continue}catch{continue}let{manifest:o}=I9(s);if(!o)continue;let a=typeof o.name=="string"&&o.name.length>0?o.name:i;r.push({dir:i,name:a,path:s})}return r}function Kx(){let e=[];for(let t of S1)for(let n of t.diagnostics)e.push({type:"warning",message:`[${t.id}] ${n}`,path:t.root});for(let t of zGe)e.push({type:"warning",message:t});for(let t of XK)e.push(t);return e}function YVo(){let e=[],t=new Set,n=0;for(let r of S1){let i=!1;for(let s of r.diagnostics){let o=r.enabled?null:HVo.exec(s);if(o?.[1]){t.add(o[1]),i=!0;continue}e.push({type:"warning",message:`[${r.id}] ${s}`,path:r.root})}i&&n++}if(n>0){let r=[...t].sort().join(", "),i=n===1?"plugin":"plugins";e.push({type:"warning",message:`${n} disabled ${i} use unsupported source kinds (${r}); enable one to see details, or re-run with --check-startup`})}for(let r of zGe)e.push({type:"warning",message:r});for(let r of XK)e.push(r);return e}var vE,VVo,r9r,S1,zGe,jGe,U9t,XK,HVo,Yw=C(()=>{"use strict";ts();g2();qt();YLr();dge();WGe();GGe();B9t();KLr();e9r();n9r();WGe();vE=tt.child({prefix:"pi-plugins"}),VVo="augment:vfs-scopes",r9r=Symbol.for("__pi_plugins_vfs_scopes__");S1=[],zGe=[],jGe=[],U9t=[],XK=[];HVo=/^source kind "([^"]+)" (?:is not supported; install the plugin manually as a relative directory|not fetched yet; run \/plugins to clone it \(or marketplace update\))$/});function Mu(e){try{return e.sessionManager.getSessionFile()===void 0}catch{return!1}}var KK=C(()=>{"use strict"});var ZVo,qGe,i9r,jVo,hge,JK,zVo,s9r,KGe=C(()=>{"use strict";ZVo={toolUse:"tool_call"},qGe=e=>ZVo[e]??e,i9r=e=>(e?.input??0)+(e?.cacheRead??0)+(e?.cacheWrite??0),jVo={provider_name:"gen_ai.provider.name",request_model:"gen_ai.request.model",response_model:"gen_ai.response.model",response_id:"gen_ai.response.id",finish_reasons:"gen_ai.response.finish_reasons",conversation_id:"gen_ai.conversation.id",input_tokens:"gen_ai.usage.input_tokens",output_tokens:"gen_ai.usage.output_tokens",cache_read_tokens:"gen_ai.usage.cache_read_tokens",cache_write_tokens:"gen_ai.usage.cache_write_tokens",time_to_first_token_ms:"gen_ai.server.time_to_first_token_ms",inter_token_latency_ms:"gen_ai.client.inter_token_latency_ms"},hge=e=>typeof e=="string"?e:void 0,JK=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,zVo=e=>Array.isArray(e)&&e.every(t=>typeof t=="string")?[...e]:void 0,s9r=e=>{let t=jVo,n={},r=(i,s)=>{s!==void 0&&(n[i]=s)};return r("provider_name",hge(e[t.provider_name])),r("request_model",hge(e[t.request_model])),r("response_model",hge(e[t.response_model])),r("response_id",hge(e[t.response_id])),r("finish_reasons",zVo(e[t.finish_reasons])),r("conversation_id",hge(e[t.conversation_id])),r("input_tokens",JK(e[t.input_tokens])),r("output_tokens",JK(e[t.output_tokens])),r("cache_read_tokens",JK(e[t.cache_read_tokens])),r("cache_write_tokens",JK(e[t.cache_write_tokens])),r("time_to_first_token_ms",JK(e[t.time_to_first_token_ms])),r("inter_token_latency_ms",JK(e[t.inter_token_latency_ms])),Object.keys(n).length>0?n:void 0}});function a9r(e){if(e?.stopReason!=="error")return;let t=(e.errorMessage??"").slice(0,qVo);if(t&&uS(t))return"context_length_exceeded";if(GX({retryAfterMs:e.retryAfterMs,errorMessage:t}))return"rate_limited";if(t){for(let[n,r]of KVo)if(r.test(t))return n}}var JGe,XVo,o9r,qVo,KVo,V9t=C(()=>{"use strict";ts();JGe="cloud.gen_ai.error_type",XVo=["rate_limited","context_length_exceeded","provider_overloaded","provider_unavailable","auth_error","timeout","invalid_request","content_filtered","network_error"],o9r=e=>typeof e=="string"&&XVo.includes(e),qVo=4096,KVo=[["auth_error",/\b40[13]\b|unauthori[sz]ed|unauthenticated|forbidden|invalid api key|authentication|permission denied/i],["content_filtered",/content[ _-]?filter|content[ _-]?policy|safety (?:filter|system|policy)|blocked by (?:the )?(?:safety|content)|\brefusal\b/i],["rate_limited",/^throttling error:|\bthrottl(?:ed|ing)\b/i],["provider_overloaded",/overloaded|\b529\b/i],["timeout",/timed? out|timeout|deadline exceeded|\b504\b/i],["network_error",/network.?error|connection.?error|connection.?refused|connection reset|econnreset|econnrefused|enotfound|other side closed|fetch failed|socket hang up|reset before headers|ended without|terminated/i],["provider_unavailable",/\b50[0-3]\b|service.?unavailable|bad gateway|upstream.?connect|server.?error|internal.?error|provider.?returned.?error|\b499\b|client.?closed/i],["invalid_request",/\b4(?:00|04|13|22)\b|bad request|invalid.?argument|invalid.?request|unprocessable/i]]});function eWe(e){let t="";for(let n of e??[])if(!(n.type!=="text"||typeof n.text!="string")&&(t+=`${n.text}
6387
- `,t.length>=4096))break;if(t=t.slice(0,4096),!!t){for(let[n,r]of eGo)if(r.test(t))return n}}var eJ,JVo,l9r,eGo,tWe=C(()=>{"use strict";eJ="cloud.tool.error_class",JVo=["auth","permission","rate_limited","timeout","not_found","unavailable"],l9r=e=>typeof e=="string"&&JVo.includes(e),eGo=[["auth",/\b401\b|unauthori[sz]ed|unauthenticated|invalid[_ ]token|token (?:has )?expired|expired token|invalid_grant|re-?auth(?:enticate|orize)?\b|authentication (?:failed|required)|\b(?:oauth|authentication) refresh is (?:temporarily unavailable|pending)|status: auth_required\b/i],["permission",/\b403\b|forbidden|permission denied|access denied/i],["rate_limited",/\b429\b|rate[- ]limit|too many requests|quota exceeded/i],["timeout",/timed out|timeout|deadline exceeded/i],["not_found",/\b404\b|not found/i],["unavailable",/\b50[234]\b|service unavailable|bad gateway|econnrefused|connection refused|econnreset|enotfound|mcp server "[^"]*" is not (?:connected|available \(status:)/i]]});import{randomUUID as tGo}from"node:crypto";function c9r(e,t){switch(e.op){case dl.turn:case dl.modelRequest:return{op:e.op,toolName:void 0,toolSource:void 0,persona:void 0};case dl.tool:{let n=nWe(e.attributes,W9t),r=n===void 0?void 0:t.getToolSource(n),i=n!==void 0&&r==="mcp"?t.getToolMcpServer?.(n):void 0;return{op:e.op,toolName:n,toolSource:r,...i?{toolMcpServer:i}:{},persona:void 0}}case dl.subagent:return{op:e.op,toolName:void 0,toolSource:void 0,persona:nWe(e.attributes,$9t)};default:return}}function u9r(e,t,n){for(let r of e)try{r(t,n)}catch(i){nGo.warn(`agent trace sink failed: ${G9t(i)}`)}}function oGo(e){let t=e.queueDispatcher;return t.getCompletionRequestIds()[0]??t.getActiveRequestId()}function lGo(e,t,n){if(e.op!==dl.tool||t===void 0)return e;let r=n.takeToolCallMcpServer?.(t),i=n.takeToolCallFacts?.(t);return{...e,...r&&e.toolSource==="mcp"?{toolMcpServer:r}:{},...i?{toolFacts:i}:{}}}function cGo(e,t){if(t)for(let[n,r]of Object.entries(t))n.startsWith(p9r)&&r!==void 0&&(e[n]=r)}function uGo(e){let t=s9r(e),n=e[rGo];return typeof n!="string"||t?.finish_reasons?t:{...t,finish_reasons:[qGe(n)]}}function d9r(e,t,n,r){let{state:i,sinks:s}=n,o=n.now??Date.now,a=n.newId??tGo,l=i.currentTurnSpan?.spanContext?.(),u={span_id:`ms-${a()}`,started_at_ms:o()},c=nWe(e.attributes,rWe);c!==void 0&&(u.parent_tool_use_id=c);let d=nWe(e.attributes,Q9t);if(d!==void 0&&t.op===dl.tool&&(u.subagent_parent_tool_use_id=d),i.currentTurnRequestId!==void 0&&(u.turn_request_id=i.currentTurnRequestId),t.op===dl.turn){let y=oGo(i);y!==void 0&&(u.run_request_id=y),r.spanId=u.span_id}else i.currentTurnSpan&&r.spanId!==void 0&&(u.turn_span_id=r.spanId);if(l?.traceId!==void 0&&(u.trace_id=l.traceId),l?.spanId!==void 0&&(u.parent_otel_span_id=l.spanId),t.op===dl.modelRequest){let y=e.attributes?.[H9t];typeof y=="number"&&Number.isSafeInteger(y)&&(u.attempt=Math.max(1,y))}u9r(s,{...u,phase:"start"},t);let p={};cGo(p,e.attributes);let m,f,h,g,b=!1,A=!1;return{setAttribute(y,S){y.startsWith(p9r)&&S!==void 0?p[y]=S:y===yFe?b=S===!0&&t.op===dl.turn:y===eJ&&l9r(S)?m=S:y===JGe&&o9r(S)&&(f=S)},setStatus(y,S){h=y,g=S},end(){if(A)return;A=!0,r.spanId===u.span_id&&(r.spanId=void 0);let y={...u,phase:"end",ended_at_ms:o(),status:h??"ok",...aGo(b,h)};if(y.status!=="ok"&&g!==void 0&&(y.error_message=g.slice(0,iGo)),t.op===dl.modelRequest){let S=uGo(p);S&&(y.gen_ai=S)}y.status==="error"&&m!==void 0&&(y.tool_error_class=m),y.status==="error"&&f!==void 0&&(y.model_error_type=f),u9r(s,y,lGo(t,c,n))}}}function dGo(e,t){try{let n=t();return sGo(n)?n.then(r=>(e.end(),r),r=>{throw e.setStatus("error",G9t(r)),e.end(),r}):(e.end(),n)}catch(n){throw e.setStatus("error",G9t(n)),e.end(),n}}function m9r(e){let t={spanId:void 0};return{startSpan(n,r,i){let s=c9r(r,e);if(s===void 0)return qpe.startSpan(n,r,i);let o=d9r(r,s,e,t);return dGo(o,()=>i(o))},startSpanManual(n,r){let i=c9r(r,e);return i===void 0?qpe.startSpanManual(n,r):d9r(r,i,e,t)}}}var nGo,dl,W9t,rWe,$9t,Q9t,p9r,rGo,H9t,iGo,sGo,G9t,nWe,aGo,gge=C(()=>{"use strict";qt();KGe();V9t();tWe();sE();nGo=tt.child({prefix:"pi-cloud"}),dl={turn:"cloud.turn",modelRequest:"gen_ai",tool:"cloud.tool",subagent:"cloud.subagent"},W9t="cloud.tool.name",rWe="cloud.tool.use_id",$9t="cloud.subagent.persona",Q9t="cloud.subagent.parent_tool_use_id",p9r="gen_ai.",rGo="gen_ai.response.stop_reason",H9t="cloud.gen_ai.attempt",iGo=2e3,sGo=e=>typeof e?.then=="function",G9t=e=>e instanceof Error?e.message:String(e),nWe=(e,t)=>{let n=e?.[t];return typeof n=="string"?n:void 0};aGo=(e,t)=>e&&(t??"ok")==="ok"?{interrupted:!0}:{}});function iWe(e){if(Mu(e))try{return ade(e.sessionManager)}catch{return}}function Y9t(e,t,n){try{t?e.setStatus("error",n):e.setStatus("ok"),e.end()}catch(r){pGo.debug(`subagent span end failed: ${r instanceof Error?r.message:String(r)}`)}}function fGo(e){for(let t=(e?.length??0)-1;t>=0;t--){let n=e?.[t];if(n?.role==="assistant")return n.stopReason==="error"||n.stopReason==="aborted"}return!1}function f9r(e){let t=new WeakMap,n=new Map;e.on("agent_start",(r,i)=>{let s=iWe(i);s&&(t.get(i.sessionManager)?.end(),t.set(i.sessionManager,xx("cloud.subagent",{op:"cloud.subagent",attributes:{[rWe]:s.parentToolCallId,...s.persona?{[$9t]:s.persona}:{}}})))}),e.on("agent_end",(r,i)=>{if(!iWe(i))return;let s=t.get(i.sessionManager);if(!s)return;t.delete(i.sessionManager);let o=r.messages;Y9t(s,fGo(o),"subagent ended in error")}),e.on("tool_call",(r,i)=>{let s=iWe(i);if(!(!s||!r.toolCallId)){if(n.size>=mGo){let[o,a]=n.entries().next().value??[];o!==void 0&&a&&(n.delete(o),Y9t(a,!0,"subagent tool span never closed"))}n.set(r.toolCallId,xx("cloud.tool",{op:"cloud.tool",attributes:{[rWe]:r.toolCallId,[Q9t]:s.parentToolCallId,...r.toolName?{[W9t]:r.toolName}:{}}}))}}),e.on("tool_result",(r,i)=>{if(!iWe(i)||!r.toolCallId)return;let s=n.get(r.toolCallId);if(s){if(n.delete(r.toolCallId),r.isError){let o=eWe(r.content);o&&s.setAttribute(eJ,o)}Y9t(s,r.isError===!0,"tool reported error result")}})}var pGo,mGo,h9r=C(()=>{"use strict";ts();qt();KK();gge();tWe();sE();pGo=tt.child({prefix:"pi-cloud:subagent-trace"}),mGo=256});function hGo(e){return{...e,execute:(t,n,r,i,s)=>{let o=hRe(e.name);if(!o)throw new Error(`Cloud tool "${e.name}" is unavailable`);return o.execute(t,n,r,i,s)}}}function Z9t(e){for(let t of EIn())e.registerTool(hGo(t));f9r(e)}var g9r=C(()=>{"use strict";h9r();JY()});function oWe(){let e=globalThis;return e[b9r]??=new Map,e[b9r]}function sWe(){let e=globalThis;return e[y9r]??=new Map,e[y9r]}function aWe(){return[...oWe().values()]}function lWe(e){return oWe().get(e)}function E9r(e){return sWe().get(e)}function R9(e,t){oWe().set(e.name,e),t===void 0?sWe().delete(e.name):sWe().set(e.name,t)}function tJ(e,t){let n=oWe();(t===void 0||n.get(e)===t)&&(n.delete(e),sWe().delete(e))}function _9r(e){Reflect.set(e,A9r,!0)}function cWe(e){return Reflect.get(e,A9r)===!0}var b9r,y9r,A9r,J2=C(()=>{"use strict";b9r=Symbol.for("__hermes_mcp_tool_registry__"),y9r=Symbol.for("__hermes_mcp_tool_server_registry__"),A9r=Symbol.for("__hermes_mcp_extension_factory__")});function gGo(e){return{...e,execute:(t,n,r,i,s)=>{let o=lWe(e.name);if(!o)throw new Error(`MCP tool "${e.name}" is unavailable`);return o.execute(t,n,r,i,s)}}}function uWe(e){for(let t of aWe())e.registerTool(gGo(t))}var S9r=C(()=>{"use strict";J2()});import{existsSync as bGo}from"node:fs";import{homedir as bge}from"node:os";import{dirname as j9t,join as Jx,resolve as x9r}from"node:path";import{fileURLToPath as yGo}from"node:url";function C9r(){let e=process.env.PI_PACKAGE_DIR;if(e)return e==="~"?bge():e.startsWith("~/")?bge()+e.slice(1):e;let t=v9r;for(;t!==j9t(t);){if(bGo(Jx(t,"package.json")))return t;t=j9t(t)}return v9r}function dWe(){return x9r(Jx(C9r(),"docs"))}function pWe(){return x9r(Jx(C9r(),"CHANGELOG.md"))}function R9r(e){return e==="~"?bge():e.startsWith("~/")?bge()+e.slice(1):e}function Zw(){let e=process.env.AUGMENT_CACHE_DIR;return e?R9r(e):Jx(bge(),".augment")}function nr(){let e=process.env[z9t];return e?R9r(e):Zw()}function Ege(){return Jx(nr(),"themes")}function N9r(){return Jx(nr(),"models.json")}function k9r(){return Jx(nr(),"auth.json")}function O9r(){return Jx(nr(),"settings.json")}function N9(){return Zw()}function nJ(){return Jx(nr(),"bin")}function M9r(){return Jx(nr(),yge)}function P9r(){return Jx(nr(),`${ti}-debug.log`)}var AGo,v9r,ti,Ls,yge,Age,T9r,EGo,$s,I9r,w9r,z9t,Qs=C(()=>{"use strict";Nht();AGo=yGo(import.meta.url),v9r=j9t(AGo);ti=TD.piConfig?.name||"auggie",Ls=TD.piConfig?.configDir||".augment",yge="sessions-v2",Age=ti,T9r="Auggie Coding Agent",EGo="1.2.0-prerelease.202611090911",$s=EGo??TD.version,I9r="2afeeb74cb9a958e51870161bd3f4c7d8b6efcab",w9r="2026-11-09T17:11:48Z",z9t=`${ti.toUpperCase()}_CODING_AGENT_DIR`});var B9r,D9r=C(()=>{B9r={$schema:"https://raw.githubusercontent.com/badlogic/pi-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",name:"ansi",vars:{red:1,green:2,yellow:3,blue:4,magenta:5,cyan:6,gray:8,brightMagenta:13},colors:{accent:"magenta",border:"gray",borderAccent:"magenta",borderMuted:"gray",success:"green",error:"red",warning:"yellow",muted:"gray",dim:"gray",text:"",thinkingText:"gray",selectedBg:"gray",userMessageBg:"",userMessageText:"",customMessageBg:"",customMessageText:"",customMessageLabel:"magenta",toolPendingBg:"",toolSuccessBg:"",toolErrorBg:"",toolTitle:"magenta",toolOutput:"gray",mdHeading:"magenta",mdLink:"magenta",mdLinkUrl:"gray",mdCode:"magenta",mdCodeBlock:"green",mdCodeBlockBorder:"gray",mdQuote:"gray",mdQuoteBorder:"gray",mdHr:"gray",mdListBullet:"magenta",toolDiffAdded:"green",toolDiffRemoved:"red",toolDiffContext:"gray",syntaxComment:"gray",syntaxKeyword:"blue",syntaxFunction:"yellow",syntaxVariable:"cyan",syntaxString:"green",syntaxNumber:"magenta",syntaxType:"cyan",syntaxOperator:"",syntaxPunctuation:"",thinkingOff:"gray",thinkingMinimal:"gray",thinkingLow:"blue",thinkingMedium:"cyan",thinkingHigh:"magenta",thinkingXhigh:"brightMagenta",bashMode:"green"},export:{pageBg:"#18181e",cardBg:"#1e1e24",infoBg:"#3c3728"}}});var jw,L9r=C(()=>{jw={$schema:"https://raw.githubusercontent.com/badlogic/pi-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",name:"dark",vars:{cyan:"#00d7ff",blue:"#5f87ff",green:"#b5bd68",red:"#cc6666",yellow:"#ffff00",gray:"#808080",dimGray:"#666666",darkGray:"#505050",accent:"#8abeb7",selectedBg:"#3a3a4a",userMsgBg:"#343541",toolPendingBg:"#282832",toolSuccessBg:"#283228",toolErrorBg:"#3c2828",customMsgBg:"#2d2838"},colors:{accent:"accent",border:"blue",borderAccent:"cyan",borderMuted:"darkGray",success:"green",error:"red",warning:"yellow",muted:"gray",dim:"dimGray",text:"",thinkingText:"gray",agentRed:"#CC6666",agentBlue:"#81A2BE",agentGreen:"#B5BD68",agentYellow:"#F0C674",agentOrange:"#CE9178",agentPurple:"#B294BB",agentPink:"#D183E8",agentCyan:"#8ABEB7",selectedBg:"selectedBg",userMessageBg:"userMsgBg",userMessageText:"",customMessageBg:"customMsgBg",customMessageText:"",customMessageLabel:"#9575cd",toolPendingBg:"toolPendingBg",toolSuccessBg:"toolSuccessBg",toolErrorBg:"toolErrorBg",toolTitle:"#b294bb",toolOutput:"gray",mdHeading:"#f0c674",mdLink:"#81a2be",mdLinkUrl:"dimGray",mdCode:"accent",mdCodeBlock:"green",mdCodeBlockBorder:"gray",mdQuote:"gray",mdQuoteBorder:"gray",mdHr:"gray",mdListBullet:"accent",toolDiffAdded:"green",toolDiffRemoved:"red",toolDiffContext:"gray",syntaxComment:"#6A9955",syntaxKeyword:"#569CD6",syntaxFunction:"#DCDCAA",syntaxVariable:"#9CDCFE",syntaxString:"#CE9178",syntaxNumber:"#B5CEA8",syntaxType:"#4EC9B0",syntaxOperator:"#D4D4D4",syntaxPunctuation:"#D4D4D4",thinkingOff:"darkGray",thinkingMinimal:"#6e6e6e",thinkingLow:"#5f87af",thinkingMedium:"#81a2be",thinkingHigh:"#b294bb",thinkingXhigh:"#d183e8",bashMode:"green"},export:{pageBg:"#18181e",cardBg:"#1e1e24",infoBg:"#3c3728"}}});var U9r,F9r=C(()=>{U9r={$schema:"https://raw.githubusercontent.com/badlogic/pi-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",name:"light",vars:{teal:"#5a8080",blue:"#547da7",green:"#588458",red:"#aa5555",yellow:"#9a7326",mediumGray:"#6c6c6c",dimGray:"#767676",lightGray:"#b0b0b0",selectedBg:"#d0d0e0",userMsgBg:"#e8e8e8",toolPendingBg:"#e8e8f0",toolSuccessBg:"#e8f0e8",toolErrorBg:"#f0e8e8",customMsgBg:"#ede7f6"},colors:{accent:"teal",border:"blue",borderAccent:"teal",borderMuted:"lightGray",success:"green",error:"red",warning:"yellow",muted:"mediumGray",dim:"dimGray",text:"",thinkingText:"mediumGray",agentRed:"#AA5555",agentBlue:"#476D94",agentGreen:"#477047",agentYellow:"#8A6822",agentOrange:"#795E26",agentPurple:"#875F87",agentPink:"#8B008B",agentCyan:"#4D7070",selectedBg:"selectedBg",userMessageBg:"userMsgBg",userMessageText:"",customMessageBg:"customMsgBg",customMessageText:"",customMessageLabel:"#7e57c2",toolPendingBg:"toolPendingBg",toolSuccessBg:"toolSuccessBg",toolErrorBg:"toolErrorBg",toolTitle:"",toolOutput:"mediumGray",mdHeading:"yellow",mdLink:"blue",mdLinkUrl:"dimGray",mdCode:"teal",mdCodeBlock:"green",mdCodeBlockBorder:"mediumGray",mdQuote:"mediumGray",mdQuoteBorder:"mediumGray",mdHr:"mediumGray",mdListBullet:"green",toolDiffAdded:"green",toolDiffRemoved:"red",toolDiffContext:"mediumGray",syntaxComment:"#008000",syntaxKeyword:"#0000FF",syntaxFunction:"#795E26",syntaxVariable:"#001080",syntaxString:"#A31515",syntaxNumber:"#098658",syntaxType:"#267F99",syntaxOperator:"#000000",syntaxPunctuation:"#000000",thinkingOff:"lightGray",thinkingMinimal:"#767676",thinkingLow:"blue",thinkingMedium:"teal",thinkingHigh:"#875f87",thinkingXhigh:"#8b008b",bashMode:"green"},export:{pageBg:"#f8f8f8",cardBg:"#ffffff",infoBg:"#fffae6"}}});import*as Xb from"node:fs";import*as fWe from"node:path";function J9t(){let e=process.env.COLORTERM;if(e==="truecolor"||e==="24bit"||process.env.WT_SESSION)return"truecolor";let t=process.env.TERM||"";return t==="dumb"||t===""||t==="linux"||process.env.TERM_PROGRAM==="Apple_Terminal"||t==="screen"||t.startsWith("screen-")||t.startsWith("screen.")?"256color":"truecolor"}function eFt(e){let t=e.replace("#","");if(t.length!==6)throw new Error(`Invalid hex color: ${e}`);let n=Number.parseInt(t.slice(0,2),16),r=Number.parseInt(t.slice(2,4),16),i=Number.parseInt(t.slice(4,6),16);if(Number.isNaN(n)||Number.isNaN(r)||Number.isNaN(i))throw new Error(`Invalid hex color: ${e}`);return{r:n,g:r,b:i}}function X9t(e){let t=Number.POSITIVE_INFINITY,n=0;for(let[r,i]of mWe.entries()){let s=Math.abs(e-i);s<t&&(t=s,n=r)}return n}function CGo(e){let t=Number.POSITIVE_INFINITY,n=0;for(let[r,i]of Q9r.entries()){let s=Math.abs(e-i);s<t&&(t=s,n=r)}return n}function G9r(e,t,n,r,i,s){let o=e-r,a=t-i,l=n-s;return o*o*.299+a*a*.587+l*l*.114}function tFt(e,t,n){let r=X9t(e),i=X9t(t),s=X9t(n),o=mWe[r]??0,a=mWe[i]??0,l=mWe[s]??0,u=16+36*r+6*i+s,c=G9r(e,t,n,o,a,l),d=Math.round(.299*e+.587*t+.114*n),p=CGo(d),m=Q9r[p]??0,f=232+p,h=G9r(e,t,n,m,m,m),g=Math.max(e,t,n),b=Math.min(e,t,n);return g-b<10&&h<c?f:u}function H9r(e){let{r:t,g:n,b:r}=eFt(e);return tFt(t,n,r)}function Y9r(e,t,n){return`\x1B[${e<8?t+e:n+e-8}m`}function W9r(e,t){if(e==="")return"\x1B[39m";if(typeof e=="number")return e<16?Y9r(e,30,90):`\x1B[38;5;${e}m`;if(e.startsWith("#")){if(t==="truecolor"){let{r,g:i,b:s}=eFt(e);return`\x1B[38;2;${r};${i};${s}m`}return`\x1B[38;5;${H9r(e)}m`}throw new Error(`Invalid color value: ${e}`)}function TGo(e,t){if(e==="")return"\x1B[49m";if(typeof e=="number")return e<16?Y9r(e,40,100):`\x1B[48;5;${e}m`;if(e.startsWith("#")){if(t==="truecolor"){let{r,g:i,b:s}=eFt(e);return`\x1B[48;2;${r};${i};${s}m`}return`\x1B[48;5;${H9r(e)}m`}throw new Error(`Invalid color value: ${e}`)}function nFt(e,t,n=new Set){if(typeof e=="number"||e===""||e.startsWith("#"))return e;if(n.has(e))throw new Error(`Circular variable reference detected: ${e}`);if(!(e in t))throw new Error(`Variable reference not found: ${e}`);n.add(e);let r=t[e];if(r===void 0)throw new Error(`Variable reference not found: ${e}`);return nFt(r,t,n)}function Z9r(e,t={}){let n={};for(let[r,i]of Object.entries(e))n[r]=nFt(i,t);return n}function gWe(){let e=new Set(Object.keys(hWe)),t=Ege();if(Xb.existsSync(t)){let n=Xb.readdirSync(t);for(let r of n)r.endsWith(".json")&&e.add(r.slice(0,-5))}for(let n of A6.keys())e.add(n);return Array.from(e).sort()}function j9r(){let e=Ege(),t=[];for(let n of Object.keys(hWe))t.push({name:n,path:void 0});if(Xb.existsSync(e)){for(let n of Xb.readdirSync(e))if(n.endsWith(".json")){let r=n.slice(0,-5);t.some(i=>i.name===r)||t.push({name:r,path:fWe.join(e,n)})}}for(let[n,r]of A6.entries())t.some(i=>i.name===n)||t.push({name:n,path:r.sourcePath});return t.sort((n,r)=>n.name.localeCompare(r.name))}function IGo(e,t){if(!V9r.Check(t)){let n=Array.from(V9r.Errors(t)),r=[],i=[];for(let o of n){let l=o.path.match(/^\/colors\/(\w+)$/)?.[1];l&&o.message.includes("Required")?r.push(l):i.push(` - ${o.path}: ${o.message}`)}let s=`Invalid theme "${e}":
6387
+ `,t.length>=4096))break;if(t=t.slice(0,4096),!!t){for(let[n,r]of eGo)if(r.test(t))return n}}var eJ,JVo,l9r,eGo,tWe=C(()=>{"use strict";eJ="cloud.tool.error_class",JVo=["auth","permission","rate_limited","timeout","not_found","unavailable"],l9r=e=>typeof e=="string"&&JVo.includes(e),eGo=[["auth",/\b401\b|unauthori[sz]ed|unauthenticated|invalid[_ ]token|token (?:has )?expired|expired token|invalid_grant|re-?auth(?:enticate|orize)?\b|authentication (?:failed|required)|\b(?:oauth|authentication) refresh is (?:temporarily unavailable|pending)|status: auth_required\b/i],["permission",/\b403\b|forbidden|permission denied|access denied/i],["rate_limited",/\b429\b|rate[- ]limit|too many requests|quota exceeded/i],["timeout",/timed out|timeout|deadline exceeded/i],["not_found",/\b404\b|not found/i],["unavailable",/\b50[234]\b|service unavailable|bad gateway|econnrefused|connection refused|econnreset|enotfound|mcp server "[^"]*" is not (?:connected|available \(status:)/i]]});import{randomUUID as tGo}from"node:crypto";function c9r(e,t){switch(e.op){case dl.turn:case dl.modelRequest:return{op:e.op,toolName:void 0,toolSource:void 0,persona:void 0};case dl.tool:{let n=nWe(e.attributes,W9t),r=n===void 0?void 0:t.getToolSource(n),i=n!==void 0&&r==="mcp"?t.getToolMcpServer?.(n):void 0;return{op:e.op,toolName:n,toolSource:r,...i?{toolMcpServer:i}:{},persona:void 0}}case dl.subagent:return{op:e.op,toolName:void 0,toolSource:void 0,persona:nWe(e.attributes,$9t)};default:return}}function u9r(e,t,n){for(let r of e)try{r(t,n)}catch(i){nGo.warn(`agent trace sink failed: ${G9t(i)}`)}}function oGo(e){let t=e.queueDispatcher;return t.getCompletionRequestIds()[0]??t.getActiveRequestId()}function lGo(e,t,n){if(e.op!==dl.tool||t===void 0)return e;let r=n.takeToolCallMcpServer?.(t),i=n.takeToolCallFacts?.(t);return{...e,...r&&e.toolSource==="mcp"?{toolMcpServer:r}:{},...i?{toolFacts:i}:{}}}function cGo(e,t){if(t)for(let[n,r]of Object.entries(t))n.startsWith(p9r)&&r!==void 0&&(e[n]=r)}function uGo(e){let t=s9r(e),n=e[rGo];return typeof n!="string"||t?.finish_reasons?t:{...t,finish_reasons:[qGe(n)]}}function d9r(e,t,n,r){let{state:i,sinks:s}=n,o=n.now??Date.now,a=n.newId??tGo,l=i.currentTurnSpan?.spanContext?.(),u={span_id:`ms-${a()}`,started_at_ms:o()},c=nWe(e.attributes,rWe);c!==void 0&&(u.parent_tool_use_id=c);let d=nWe(e.attributes,Q9t);if(d!==void 0&&t.op===dl.tool&&(u.subagent_parent_tool_use_id=d),i.currentTurnRequestId!==void 0&&(u.turn_request_id=i.currentTurnRequestId),t.op===dl.turn){let y=oGo(i);y!==void 0&&(u.run_request_id=y),r.spanId=u.span_id}else i.currentTurnSpan&&r.spanId!==void 0&&(u.turn_span_id=r.spanId);if(l?.traceId!==void 0&&(u.trace_id=l.traceId),l?.spanId!==void 0&&(u.parent_otel_span_id=l.spanId),t.op===dl.modelRequest){let y=e.attributes?.[H9t];typeof y=="number"&&Number.isSafeInteger(y)&&(u.attempt=Math.max(1,y))}u9r(s,{...u,phase:"start"},t);let p={};cGo(p,e.attributes);let m,f,h,g,b=!1,A=!1;return{setAttribute(y,S){y.startsWith(p9r)&&S!==void 0?p[y]=S:y===yFe?b=S===!0&&t.op===dl.turn:y===eJ&&l9r(S)?m=S:y===JGe&&o9r(S)&&(f=S)},setStatus(y,S){h=y,g=S},end(){if(A)return;A=!0,r.spanId===u.span_id&&(r.spanId=void 0);let y={...u,phase:"end",ended_at_ms:o(),status:h??"ok",...aGo(b,h)};if(y.status!=="ok"&&g!==void 0&&(y.error_message=g.slice(0,iGo)),t.op===dl.modelRequest){let S=uGo(p);S&&(y.gen_ai=S)}y.status==="error"&&m!==void 0&&(y.tool_error_class=m),y.status==="error"&&f!==void 0&&(y.model_error_type=f),u9r(s,y,lGo(t,c,n))}}}function dGo(e,t){try{let n=t();return sGo(n)?n.then(r=>(e.end(),r),r=>{throw e.setStatus("error",G9t(r)),e.end(),r}):(e.end(),n)}catch(n){throw e.setStatus("error",G9t(n)),e.end(),n}}function m9r(e){let t={spanId:void 0};return{startSpan(n,r,i){let s=c9r(r,e);if(s===void 0)return qpe.startSpan(n,r,i);let o=d9r(r,s,e,t);return dGo(o,()=>i(o))},startSpanManual(n,r){let i=c9r(r,e);return i===void 0?qpe.startSpanManual(n,r):d9r(r,i,e,t)}}}var nGo,dl,W9t,rWe,$9t,Q9t,p9r,rGo,H9t,iGo,sGo,G9t,nWe,aGo,gge=C(()=>{"use strict";qt();KGe();V9t();tWe();sE();nGo=tt.child({prefix:"pi-cloud"}),dl={turn:"cloud.turn",modelRequest:"gen_ai",tool:"cloud.tool",subagent:"cloud.subagent"},W9t="cloud.tool.name",rWe="cloud.tool.use_id",$9t="cloud.subagent.persona",Q9t="cloud.subagent.parent_tool_use_id",p9r="gen_ai.",rGo="gen_ai.response.stop_reason",H9t="cloud.gen_ai.attempt",iGo=2e3,sGo=e=>typeof e?.then=="function",G9t=e=>e instanceof Error?e.message:String(e),nWe=(e,t)=>{let n=e?.[t];return typeof n=="string"?n:void 0};aGo=(e,t)=>e&&(t??"ok")==="ok"?{interrupted:!0}:{}});function iWe(e){if(Mu(e))try{return ade(e.sessionManager)}catch{return}}function Y9t(e,t,n){try{t?e.setStatus("error",n):e.setStatus("ok"),e.end()}catch(r){pGo.debug(`subagent span end failed: ${r instanceof Error?r.message:String(r)}`)}}function fGo(e){for(let t=(e?.length??0)-1;t>=0;t--){let n=e?.[t];if(n?.role==="assistant")return n.stopReason==="error"||n.stopReason==="aborted"}return!1}function f9r(e){let t=new WeakMap,n=new Map;e.on("agent_start",(r,i)=>{let s=iWe(i);s&&(t.get(i.sessionManager)?.end(),t.set(i.sessionManager,xx("cloud.subagent",{op:"cloud.subagent",attributes:{[rWe]:s.parentToolCallId,...s.persona?{[$9t]:s.persona}:{}}})))}),e.on("agent_end",(r,i)=>{if(!iWe(i))return;let s=t.get(i.sessionManager);if(!s)return;t.delete(i.sessionManager);let o=r.messages;Y9t(s,fGo(o),"subagent ended in error")}),e.on("tool_call",(r,i)=>{let s=iWe(i);if(!(!s||!r.toolCallId)){if(n.size>=mGo){let[o,a]=n.entries().next().value??[];o!==void 0&&a&&(n.delete(o),Y9t(a,!0,"subagent tool span never closed"))}n.set(r.toolCallId,xx("cloud.tool",{op:"cloud.tool",attributes:{[rWe]:r.toolCallId,[Q9t]:s.parentToolCallId,...r.toolName?{[W9t]:r.toolName}:{}}}))}}),e.on("tool_result",(r,i)=>{if(!iWe(i)||!r.toolCallId)return;let s=n.get(r.toolCallId);if(s){if(n.delete(r.toolCallId),r.isError){let o=eWe(r.content);o&&s.setAttribute(eJ,o)}Y9t(s,r.isError===!0,"tool reported error result")}})}var pGo,mGo,h9r=C(()=>{"use strict";ts();qt();KK();gge();tWe();sE();pGo=tt.child({prefix:"pi-cloud:subagent-trace"}),mGo=256});function hGo(e){return{...e,execute:(t,n,r,i,s)=>{let o=hRe(e.name);if(!o)throw new Error(`Cloud tool "${e.name}" is unavailable`);return o.execute(t,n,r,i,s)}}}function Z9t(e){for(let t of EIn())e.registerTool(hGo(t));f9r(e)}var g9r=C(()=>{"use strict";h9r();JY()});function oWe(){let e=globalThis;return e[b9r]??=new Map,e[b9r]}function sWe(){let e=globalThis;return e[y9r]??=new Map,e[y9r]}function aWe(){return[...oWe().values()]}function lWe(e){return oWe().get(e)}function E9r(e){return sWe().get(e)}function R9(e,t){oWe().set(e.name,e),t===void 0?sWe().delete(e.name):sWe().set(e.name,t)}function tJ(e,t){let n=oWe();(t===void 0||n.get(e)===t)&&(n.delete(e),sWe().delete(e))}function _9r(e){Reflect.set(e,A9r,!0)}function cWe(e){return Reflect.get(e,A9r)===!0}var b9r,y9r,A9r,J2=C(()=>{"use strict";b9r=Symbol.for("__hermes_mcp_tool_registry__"),y9r=Symbol.for("__hermes_mcp_tool_server_registry__"),A9r=Symbol.for("__hermes_mcp_extension_factory__")});function gGo(e){return{...e,execute:(t,n,r,i,s)=>{let o=lWe(e.name);if(!o)throw new Error(`MCP tool "${e.name}" is unavailable`);return o.execute(t,n,r,i,s)}}}function uWe(e){for(let t of aWe())e.registerTool(gGo(t))}var S9r=C(()=>{"use strict";J2()});import{existsSync as bGo}from"node:fs";import{homedir as bge}from"node:os";import{dirname as j9t,join as Jx,resolve as x9r}from"node:path";import{fileURLToPath as yGo}from"node:url";function C9r(){let e=process.env.PI_PACKAGE_DIR;if(e)return e==="~"?bge():e.startsWith("~/")?bge()+e.slice(1):e;let t=v9r;for(;t!==j9t(t);){if(bGo(Jx(t,"package.json")))return t;t=j9t(t)}return v9r}function dWe(){return x9r(Jx(C9r(),"docs"))}function pWe(){return x9r(Jx(C9r(),"CHANGELOG.md"))}function R9r(e){return e==="~"?bge():e.startsWith("~/")?bge()+e.slice(1):e}function Zw(){let e=process.env.AUGMENT_CACHE_DIR;return e?R9r(e):Jx(bge(),".augment")}function nr(){let e=process.env[z9t];return e?R9r(e):Zw()}function Ege(){return Jx(nr(),"themes")}function N9r(){return Jx(nr(),"models.json")}function k9r(){return Jx(nr(),"auth.json")}function O9r(){return Jx(nr(),"settings.json")}function N9(){return Zw()}function nJ(){return Jx(nr(),"bin")}function M9r(){return Jx(nr(),yge)}function P9r(){return Jx(nr(),`${ti}-debug.log`)}var AGo,v9r,ti,Ls,yge,Age,T9r,EGo,$s,I9r,w9r,z9t,Qs=C(()=>{"use strict";Nht();AGo=yGo(import.meta.url),v9r=j9t(AGo);ti=TD.piConfig?.name||"auggie",Ls=TD.piConfig?.configDir||".augment",yge="sessions-v2",Age=ti,T9r="Auggie Coding Agent",EGo="1.2.0",$s=EGo??TD.version,I9r="2afeeb74cb9a958e51870161bd3f4c7d8b6efcab",w9r="2026-11-09T18:30:16Z",z9t=`${ti.toUpperCase()}_CODING_AGENT_DIR`});var B9r,D9r=C(()=>{B9r={$schema:"https://raw.githubusercontent.com/badlogic/pi-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",name:"ansi",vars:{red:1,green:2,yellow:3,blue:4,magenta:5,cyan:6,gray:8,brightMagenta:13},colors:{accent:"magenta",border:"gray",borderAccent:"magenta",borderMuted:"gray",success:"green",error:"red",warning:"yellow",muted:"gray",dim:"gray",text:"",thinkingText:"gray",selectedBg:"gray",userMessageBg:"",userMessageText:"",customMessageBg:"",customMessageText:"",customMessageLabel:"magenta",toolPendingBg:"",toolSuccessBg:"",toolErrorBg:"",toolTitle:"magenta",toolOutput:"gray",mdHeading:"magenta",mdLink:"magenta",mdLinkUrl:"gray",mdCode:"magenta",mdCodeBlock:"green",mdCodeBlockBorder:"gray",mdQuote:"gray",mdQuoteBorder:"gray",mdHr:"gray",mdListBullet:"magenta",toolDiffAdded:"green",toolDiffRemoved:"red",toolDiffContext:"gray",syntaxComment:"gray",syntaxKeyword:"blue",syntaxFunction:"yellow",syntaxVariable:"cyan",syntaxString:"green",syntaxNumber:"magenta",syntaxType:"cyan",syntaxOperator:"",syntaxPunctuation:"",thinkingOff:"gray",thinkingMinimal:"gray",thinkingLow:"blue",thinkingMedium:"cyan",thinkingHigh:"magenta",thinkingXhigh:"brightMagenta",bashMode:"green"},export:{pageBg:"#18181e",cardBg:"#1e1e24",infoBg:"#3c3728"}}});var jw,L9r=C(()=>{jw={$schema:"https://raw.githubusercontent.com/badlogic/pi-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",name:"dark",vars:{cyan:"#00d7ff",blue:"#5f87ff",green:"#b5bd68",red:"#cc6666",yellow:"#ffff00",gray:"#808080",dimGray:"#666666",darkGray:"#505050",accent:"#8abeb7",selectedBg:"#3a3a4a",userMsgBg:"#343541",toolPendingBg:"#282832",toolSuccessBg:"#283228",toolErrorBg:"#3c2828",customMsgBg:"#2d2838"},colors:{accent:"accent",border:"blue",borderAccent:"cyan",borderMuted:"darkGray",success:"green",error:"red",warning:"yellow",muted:"gray",dim:"dimGray",text:"",thinkingText:"gray",agentRed:"#CC6666",agentBlue:"#81A2BE",agentGreen:"#B5BD68",agentYellow:"#F0C674",agentOrange:"#CE9178",agentPurple:"#B294BB",agentPink:"#D183E8",agentCyan:"#8ABEB7",selectedBg:"selectedBg",userMessageBg:"userMsgBg",userMessageText:"",customMessageBg:"customMsgBg",customMessageText:"",customMessageLabel:"#9575cd",toolPendingBg:"toolPendingBg",toolSuccessBg:"toolSuccessBg",toolErrorBg:"toolErrorBg",toolTitle:"#b294bb",toolOutput:"gray",mdHeading:"#f0c674",mdLink:"#81a2be",mdLinkUrl:"dimGray",mdCode:"accent",mdCodeBlock:"green",mdCodeBlockBorder:"gray",mdQuote:"gray",mdQuoteBorder:"gray",mdHr:"gray",mdListBullet:"accent",toolDiffAdded:"green",toolDiffRemoved:"red",toolDiffContext:"gray",syntaxComment:"#6A9955",syntaxKeyword:"#569CD6",syntaxFunction:"#DCDCAA",syntaxVariable:"#9CDCFE",syntaxString:"#CE9178",syntaxNumber:"#B5CEA8",syntaxType:"#4EC9B0",syntaxOperator:"#D4D4D4",syntaxPunctuation:"#D4D4D4",thinkingOff:"darkGray",thinkingMinimal:"#6e6e6e",thinkingLow:"#5f87af",thinkingMedium:"#81a2be",thinkingHigh:"#b294bb",thinkingXhigh:"#d183e8",bashMode:"green"},export:{pageBg:"#18181e",cardBg:"#1e1e24",infoBg:"#3c3728"}}});var U9r,F9r=C(()=>{U9r={$schema:"https://raw.githubusercontent.com/badlogic/pi-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",name:"light",vars:{teal:"#5a8080",blue:"#547da7",green:"#588458",red:"#aa5555",yellow:"#9a7326",mediumGray:"#6c6c6c",dimGray:"#767676",lightGray:"#b0b0b0",selectedBg:"#d0d0e0",userMsgBg:"#e8e8e8",toolPendingBg:"#e8e8f0",toolSuccessBg:"#e8f0e8",toolErrorBg:"#f0e8e8",customMsgBg:"#ede7f6"},colors:{accent:"teal",border:"blue",borderAccent:"teal",borderMuted:"lightGray",success:"green",error:"red",warning:"yellow",muted:"mediumGray",dim:"dimGray",text:"",thinkingText:"mediumGray",agentRed:"#AA5555",agentBlue:"#476D94",agentGreen:"#477047",agentYellow:"#8A6822",agentOrange:"#795E26",agentPurple:"#875F87",agentPink:"#8B008B",agentCyan:"#4D7070",selectedBg:"selectedBg",userMessageBg:"userMsgBg",userMessageText:"",customMessageBg:"customMsgBg",customMessageText:"",customMessageLabel:"#7e57c2",toolPendingBg:"toolPendingBg",toolSuccessBg:"toolSuccessBg",toolErrorBg:"toolErrorBg",toolTitle:"",toolOutput:"mediumGray",mdHeading:"yellow",mdLink:"blue",mdLinkUrl:"dimGray",mdCode:"teal",mdCodeBlock:"green",mdCodeBlockBorder:"mediumGray",mdQuote:"mediumGray",mdQuoteBorder:"mediumGray",mdHr:"mediumGray",mdListBullet:"green",toolDiffAdded:"green",toolDiffRemoved:"red",toolDiffContext:"mediumGray",syntaxComment:"#008000",syntaxKeyword:"#0000FF",syntaxFunction:"#795E26",syntaxVariable:"#001080",syntaxString:"#A31515",syntaxNumber:"#098658",syntaxType:"#267F99",syntaxOperator:"#000000",syntaxPunctuation:"#000000",thinkingOff:"lightGray",thinkingMinimal:"#767676",thinkingLow:"blue",thinkingMedium:"teal",thinkingHigh:"#875f87",thinkingXhigh:"#8b008b",bashMode:"green"},export:{pageBg:"#f8f8f8",cardBg:"#ffffff",infoBg:"#fffae6"}}});import*as Xb from"node:fs";import*as fWe from"node:path";function J9t(){let e=process.env.COLORTERM;if(e==="truecolor"||e==="24bit"||process.env.WT_SESSION)return"truecolor";let t=process.env.TERM||"";return t==="dumb"||t===""||t==="linux"||process.env.TERM_PROGRAM==="Apple_Terminal"||t==="screen"||t.startsWith("screen-")||t.startsWith("screen.")?"256color":"truecolor"}function eFt(e){let t=e.replace("#","");if(t.length!==6)throw new Error(`Invalid hex color: ${e}`);let n=Number.parseInt(t.slice(0,2),16),r=Number.parseInt(t.slice(2,4),16),i=Number.parseInt(t.slice(4,6),16);if(Number.isNaN(n)||Number.isNaN(r)||Number.isNaN(i))throw new Error(`Invalid hex color: ${e}`);return{r:n,g:r,b:i}}function X9t(e){let t=Number.POSITIVE_INFINITY,n=0;for(let[r,i]of mWe.entries()){let s=Math.abs(e-i);s<t&&(t=s,n=r)}return n}function CGo(e){let t=Number.POSITIVE_INFINITY,n=0;for(let[r,i]of Q9r.entries()){let s=Math.abs(e-i);s<t&&(t=s,n=r)}return n}function G9r(e,t,n,r,i,s){let o=e-r,a=t-i,l=n-s;return o*o*.299+a*a*.587+l*l*.114}function tFt(e,t,n){let r=X9t(e),i=X9t(t),s=X9t(n),o=mWe[r]??0,a=mWe[i]??0,l=mWe[s]??0,u=16+36*r+6*i+s,c=G9r(e,t,n,o,a,l),d=Math.round(.299*e+.587*t+.114*n),p=CGo(d),m=Q9r[p]??0,f=232+p,h=G9r(e,t,n,m,m,m),g=Math.max(e,t,n),b=Math.min(e,t,n);return g-b<10&&h<c?f:u}function H9r(e){let{r:t,g:n,b:r}=eFt(e);return tFt(t,n,r)}function Y9r(e,t,n){return`\x1B[${e<8?t+e:n+e-8}m`}function W9r(e,t){if(e==="")return"\x1B[39m";if(typeof e=="number")return e<16?Y9r(e,30,90):`\x1B[38;5;${e}m`;if(e.startsWith("#")){if(t==="truecolor"){let{r,g:i,b:s}=eFt(e);return`\x1B[38;2;${r};${i};${s}m`}return`\x1B[38;5;${H9r(e)}m`}throw new Error(`Invalid color value: ${e}`)}function TGo(e,t){if(e==="")return"\x1B[49m";if(typeof e=="number")return e<16?Y9r(e,40,100):`\x1B[48;5;${e}m`;if(e.startsWith("#")){if(t==="truecolor"){let{r,g:i,b:s}=eFt(e);return`\x1B[48;2;${r};${i};${s}m`}return`\x1B[48;5;${H9r(e)}m`}throw new Error(`Invalid color value: ${e}`)}function nFt(e,t,n=new Set){if(typeof e=="number"||e===""||e.startsWith("#"))return e;if(n.has(e))throw new Error(`Circular variable reference detected: ${e}`);if(!(e in t))throw new Error(`Variable reference not found: ${e}`);n.add(e);let r=t[e];if(r===void 0)throw new Error(`Variable reference not found: ${e}`);return nFt(r,t,n)}function Z9r(e,t={}){let n={};for(let[r,i]of Object.entries(e))n[r]=nFt(i,t);return n}function gWe(){let e=new Set(Object.keys(hWe)),t=Ege();if(Xb.existsSync(t)){let n=Xb.readdirSync(t);for(let r of n)r.endsWith(".json")&&e.add(r.slice(0,-5))}for(let n of A6.keys())e.add(n);return Array.from(e).sort()}function j9r(){let e=Ege(),t=[];for(let n of Object.keys(hWe))t.push({name:n,path:void 0});if(Xb.existsSync(e)){for(let n of Xb.readdirSync(e))if(n.endsWith(".json")){let r=n.slice(0,-5);t.some(i=>i.name===r)||t.push({name:r,path:fWe.join(e,n)})}}for(let[n,r]of A6.entries())t.some(i=>i.name===n)||t.push({name:n,path:r.sourcePath});return t.sort((n,r)=>n.name.localeCompare(r.name))}function IGo(e,t){if(!V9r.Check(t)){let n=Array.from(V9r.Errors(t)),r=[],i=[];for(let o of n){let l=o.path.match(/^\/colors\/(\w+)$/)?.[1];l&&o.message.includes("Required")?r.push(l):i.push(` - ${o.path}: ${o.message}`)}let s=`Invalid theme "${e}":
6388
6388
  `;throw r.length>0&&(s+=`
6389
6389
  Missing required color tokens:
6390
6390
  `,s+=r.map(o=>` - ${o}`).join(`
@@ -14258,4 +14258,4 @@ content-type/index.js:
14258
14258
  *)
14259
14259
  */
14260
14260
 
14261
- //# debugId=2f54ca2d-0c31-5f68-ade1-211569f6e457
14261
+ //# debugId=49a97f22-a90f-589d-a9ba-31f3844d1a8c
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@augmentcode/onison",
3
- "version": "1.2.0-prerelease.202611090911",
3
+ "version": "1.2.0",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "bin": {