@minimax-ai/code 0.6.5 → 0.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +68 -0
- package/CHANGELOG.zh-CN.md +31 -0
- package/README.md +70 -7
- package/README.zh-CN.md +44 -4
- package/chunks/{auth-command-OLQL7FZY.js → auth-command-VA6MMKOP.js} +1 -1
- package/chunks/{chunk-JL7ZXU6T.js → chunk-52X742AN.js} +1 -1
- package/chunks/{chunk-JIWEZSQY.js → chunk-6GW6IUZR.js} +628 -628
- package/chunks/{chunk-37SOT72H.js → chunk-AKM6CI7T.js} +1 -1
- package/chunks/{chunk-OSA3A5UV.js → chunk-EGP34E73.js} +1 -1
- package/chunks/{chunk-TWO6GIVD.js → chunk-EZ7Q2NM4.js} +94 -94
- package/chunks/{chunk-2XPMNZVR.js → chunk-G5QL7ZHU.js} +698 -695
- package/chunks/{chunk-NFVRVRCL.js → chunk-VCAGMAY5.js} +1 -1
- package/chunks/{chunk-LM3FMMAB.js → chunk-WQPQHX2N.js} +1 -1
- package/chunks/{data-dir-KFZIXVT7.js → data-dir-IMRONFFA.js} +1 -1
- package/chunks/dist-63237B2W.js +2 -0
- package/chunks/{launcher-BK5UP7KA.js → launcher-2D42AKF4.js} +3 -3
- package/chunks/{lifecycle-RMTLVDXY.js → lifecycle-6LKB3S4X.js} +1 -1
- package/chunks/{main-ANJ6TEDF.js → main-FUHP65PE.js} +2 -2
- package/chunks/{plugin-command-AXB4A2DP.js → plugin-command-3LA4XJID.js} +1 -1
- package/chunks/{provider-command-2MVBCAF6.js → provider-command-JDVYHLEY.js} +1 -1
- package/chunks/{run-acp-command-4JFNMYRS.js → run-acp-command-XI3VD2JU.js} +2 -2
- package/chunks/{run-exec-command-SAUHM46S.js → run-exec-command-4UXC3AHS.js} +1 -1
- package/cli.js +2 -2
- package/package.json +1 -1
- package/chunks/dist-PBZ5PIWM.js +0 -2
|
@@ -1,76 +1,76 @@
|
|
|
1
1
|
import { createRequire as __mavis_cR } from "module"; import { basename as __mavis_basename, dirname as __mavis_dirname, join as __mavis_join } from "path"; import { fileURLToPath as __mavis_fileURLToPath, pathToFileURL as __mavis_pathToFileURL } from "url"; const __mavis_tuiCurrentModuleDir = __mavis_dirname(__mavis_fileURLToPath(import.meta.url)); const __mavis_tuiPackageRoot = __mavis_basename(__mavis_tuiCurrentModuleDir) === "chunks" ? __mavis_dirname(__mavis_tuiCurrentModuleDir) : __mavis_tuiCurrentModuleDir; const __mavis_tuiPackageEntryUrl = __mavis_pathToFileURL(__mavis_join(__mavis_tuiPackageRoot, "cli.js")).href; const require = __mavis_cR(__mavis_tuiPackageEntryUrl); const __dirname = __mavis_tuiPackageRoot;
|
|
2
|
-
import{n as
|
|
3
|
-
GFS4: `),console.error(e)});D[Z]||(zl=global[Z]||[],ec(D,zl),D.close=(function(e){function t(n,i){return e.call(D,n,function(r){r||Zl(),typeof i=="function"&&i.apply(this,arguments)})}return Object.defineProperty(t,Xn,{value:e}),t})(D.close),D.closeSync=(function(e){function t(n){e.apply(D,arguments),Zl()}return Object.defineProperty(t,Xn,{value:e}),t})(D.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Ze(D[Z]),ue("assert").equal(D[Z].length,0)}));var zl;global[Z]||ec(global,D[Z]);Gr.exports=Vr(Ty(D));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!D.__patched&&(Gr.exports=Vr(D),D.__patched=!0);function Vr(e){Cy(e),e.gracefulify=Vr,e.createReadStream=k,e.createWriteStream=C;var t=e.readFile;e.readFile=n;function n(A,O,E){return typeof O=="function"&&(E=O,O=null),T(A,O,E);function T($,W,F,q){return t($,W,function(N){N&&(N.code==="EMFILE"||N.code==="ENFILE")?bt([T,[$,W,F],N,q||Date.now(),Date.now()]):typeof F=="function"&&F.apply(this,arguments)})}}var i=e.writeFile;e.writeFile=r;function r(A,O,E,T){return typeof E=="function"&&(T=E,E=null),$(A,O,E,T);function $(W,F,q,N,Q){return i(W,F,q,function(R){R&&(R.code==="EMFILE"||R.code==="ENFILE")?bt([$,[W,F,q,N],R,Q||Date.now(),Date.now()]):typeof N=="function"&&N.apply(this,arguments)})}}var o=e.appendFile;o&&(e.appendFile=s);function s(A,O,E,T){return typeof E=="function"&&(T=E,E=null),$(A,O,E,T);function $(W,F,q,N,Q){return o(W,F,q,function(R){R&&(R.code==="EMFILE"||R.code==="ENFILE")?bt([$,[W,F,q,N],R,Q||Date.now(),Date.now()]):typeof N=="function"&&N.apply(this,arguments)})}}var a=e.copyFile;a&&(e.copyFile=l);function l(A,O,E,T){return typeof E=="function"&&(T=E,E=0),$(A,O,E,T);function $(W,F,q,N,Q){return a(W,F,q,function(R){R&&(R.code==="EMFILE"||R.code==="ENFILE")?bt([$,[W,F,q,N],R,Q||Date.now(),Date.now()]):typeof N=="function"&&N.apply(this,arguments)})}}var c=e.readdir;e.readdir=f;var u=/^v[0-5]\./;function f(A,O,E){typeof O=="function"&&(E=O,O=null);var T=u.test(process.version)?function(F,q,N,Q){return c(F,$(F,q,N,Q))}:function(F,q,N,Q){return c(F,q,$(F,q,N,Q))};return T(A,O,E);function $(W,F,q,N){return function(Q,R){Q&&(Q.code==="EMFILE"||Q.code==="ENFILE")?bt([T,[W,F,q],Q,N||Date.now(),Date.now()]):(R&&R.sort&&R.sort(),typeof q=="function"&&q.call(this,Q,R))}}}if(process.version.substr(0,4)==="v0.8"){var d=Oy(e);g=d.ReadStream,v=d.WriteStream}var p=e.ReadStream;p&&(g.prototype=Object.create(p.prototype),g.prototype.open=b);var h=e.WriteStream;h&&(v.prototype=Object.create(h.prototype),v.prototype.open=x),Object.defineProperty(e,"ReadStream",{get:function(){return g},set:function(A){g=A},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return v},set:function(A){v=A},enumerable:!0,configurable:!0});var m=g;Object.defineProperty(e,"FileReadStream",{get:function(){return m},set:function(A){m=A},enumerable:!0,configurable:!0});var y=v;Object.defineProperty(e,"FileWriteStream",{get:function(){return y},set:function(A){y=A},enumerable:!0,configurable:!0});function g(A,O){return this instanceof g?(p.apply(this,arguments),this):g.apply(Object.create(g.prototype),arguments)}function b(){var A=this;w(A.path,A.flags,A.mode,function(O,E){O?(A.autoClose&&A.destroy(),A.emit("error",O)):(A.fd=E,A.emit("open",E),A.read())})}function v(A,O){return this instanceof v?(h.apply(this,arguments),this):v.apply(Object.create(v.prototype),arguments)}function x(){var A=this;w(A.path,A.flags,A.mode,function(O,E){O?(A.destroy(),A.emit("error",O)):(A.fd=E,A.emit("open",E))})}function k(A,O){return new e.ReadStream(A,O)}function C(A,O){return new e.WriteStream(A,O)}var L=e.open;e.open=w;function w(A,O,E,T){return typeof E=="function"&&(T=E,E=null),$(A,O,E,T);function $(W,F,q,N,Q){return L(W,F,q,function(R,d_){R&&(R.code==="EMFILE"||R.code==="ENFILE")?bt([$,[W,F,q,N],R,Q||Date.now(),Date.now()]):typeof N=="function"&&N.apply(this,arguments)})}}return e}function bt(e){Ze("ENQUEUE",e[0].name,e[1]),D[Z].push(e),Yr()}var Jn;function Zl(){for(var e=Date.now(),t=0;t<D[Z].length;++t)D[Z][t].length>2&&(D[Z][t][3]=e,D[Z][t][4]=e);Yr()}function Yr(){if(clearTimeout(Jn),Jn=void 0,D[Z].length!==0){var e=D[Z].shift(),t=e[0],n=e[1],i=e[2],r=e[3],o=e[4];if(r===void 0)Ze("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-r>=6e4){Ze("TIMEOUT",t.name,n);var s=n.pop();typeof s=="function"&&s.call(null,i)}else{var a=Date.now()-o,l=Math.max(o-r,1),c=Math.min(l*1.2,100);a>=c?(Ze("RETRY",t.name,n),t.apply(null,n.concat([r]))):D[Z].push(e)}Jn===void 0&&(Jn=setTimeout(Yr,0))}}});var nc=S((__,tc)=>{function fe(e,t){typeof t=="boolean"&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}tc.exports=fe;fe.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};fe.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};fe.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),n=this._timeouts.shift();else return!1;var i=this,r=setTimeout(function(){i._attempts++,i._operationTimeoutCb&&(i._timeout=setTimeout(function(){i._operationTimeoutCb(i._attempts)},i._operationTimeout),i._options.unref&&i._timeout.unref()),i._fn(i._attempts)},n);return this._options.unref&&r.unref(),!0};fe.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};fe.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)};fe.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)};fe.prototype.start=fe.prototype.try;fe.prototype.errors=function(){return this._errors};fe.prototype.attempts=function(){return this._attempts};fe.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,i=0;i<this._errors.length;i++){var r=this._errors[i],o=r.message,s=(e[o]||0)+1;e[o]=s,s>=n&&(t=r,n=s)}return t}});var ic=S(et=>{var Ly=nc();et.operation=function(e){var t=et.timeouts(e);return new Ly(t,{forever:e&&e.forever,unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})};et.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var i=[],r=0;r<t.retries;r++)i.push(this.createTimeout(r,t));return e&&e.forever&&!i.length&&i.push(this.createTimeout(r,t)),i.sort(function(o,s){return o-s}),i};et.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,i=Math.round(n*t.minTimeout*Math.pow(t.factor,e));return i=Math.min(i,t.maxTimeout),i};et.wrap=function(e,t,n){if(t instanceof Array&&(n=t,t=null),!n){n=[];for(var i in e)typeof e[i]=="function"&&n.push(i)}for(var r=0;r<n.length;r++){var o=n[r],s=e[o];e[o]=function(l){var c=et.operation(t),u=Array.prototype.slice.call(arguments,1),f=u.pop();u.push(function(d){c.retry(d)||(d&&(arguments[0]=c.mainError()),f.apply(this,arguments))}),c.attempt(function(){l.apply(e,u)})}.bind(e,s),e[o].options=t}}});var oc=S((x_,rc)=>{rc.exports=ic()});var sc=S((k_,Qn)=>{Qn.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Qn.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Qn.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var fc=S((C_,At)=>{var P=global.process,tt=function(e){return e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function"};tt(P)?(ac=ue("assert"),St=sc(),lc=/^win/i.test(P.platform),zt=ue("events"),typeof zt!="function"&&(zt=zt.EventEmitter),P.__signal_exit_emitter__?J=P.__signal_exit_emitter__:(J=P.__signal_exit_emitter__=new zt,J.count=0,J.emitted={}),J.infinite||(J.setMaxListeners(1/0),J.infinite=!0),At.exports=function(e,t){if(!tt(global.process))return function(){};ac.equal(typeof e,"function","a callback must be provided for exit handler"),vt===!1&&Hr();var n="exit";t&&t.alwaysLast&&(n="afterexit");var i=function(){J.removeListener(n,e),J.listeners("exit").length===0&&J.listeners("afterexit").length===0&&zn()};return J.on(n,e),i},zn=function(){!vt||!tt(global.process)||(vt=!1,St.forEach(function(t){try{P.removeListener(t,Zn[t])}catch{}}),P.emit=ei,P.reallyExit=Jr,J.count-=1)},At.exports.unload=zn,nt=function(t,n,i){J.emitted[t]||(J.emitted[t]=!0,J.emit(t,n,i))},Zn={},St.forEach(function(e){Zn[e]=function(){if(tt(global.process)){var n=P.listeners(e);n.length===J.count&&(zn(),nt("exit",null,e),nt("afterexit",null,e),lc&&e==="SIGHUP"&&(e="SIGINT"),P.kill(P.pid,e))}}}),At.exports.signals=function(){return St},vt=!1,Hr=function(){vt||!tt(global.process)||(vt=!0,J.count+=1,St=St.filter(function(t){try{return P.on(t,Zn[t]),!0}catch{return!1}}),P.emit=uc,P.reallyExit=cc)},At.exports.load=Hr,Jr=P.reallyExit,cc=function(t){tt(global.process)&&(P.exitCode=t||0,nt("exit",P.exitCode,null),nt("afterexit",P.exitCode,null),Jr.call(P,P.exitCode))},ei=P.emit,uc=function(t,n){if(t==="exit"&&tt(global.process)){n!==void 0&&(P.exitCode=n);var i=ei.apply(this,arguments);return nt("exit",P.exitCode,null),nt("afterexit",P.exitCode,null),i}else return ei.apply(this,arguments)}):At.exports=function(){return function(){}};var ac,St,lc,zt,J,zn,nt,Zn,vt,Hr,Jr,cc,ei,uc});var pc=S((O_,Xr)=>{"use strict";var dc=Symbol();function My(e,t,n){let i=t[dc];if(i)return t.stat(e,(o,s)=>{if(o)return n(o);n(null,s.mtime,i)});let r=new Date(Math.ceil(Date.now()/1e3)*1e3+5);t.utimes(e,r,r,o=>{if(o)return n(o);t.stat(e,(s,a)=>{if(s)return n(s);let l=a.mtime.getTime()%1e3===0?"s":"ms";Object.defineProperty(t,dc,{value:l}),n(null,a.mtime,l)})})}function Ny(e){let t=Date.now();return e==="s"&&(t=Math.ceil(t/1e3)*1e3),new Date(t)}Xr.exports.probe=My;Xr.exports.getMtime=Ny});var bc=S((T_,en)=>{"use strict";var Ry=ue("path"),Zr=Wr(),Py=oc(),Fy=fc(),mc=pc(),Ee={};function Zt(e,t){return t.lockfilePath||`${e}.lock`}function eo(e,t,n){if(!t.realpath)return n(null,Ry.resolve(e));t.fs.realpath(e,n)}function zr(e,t,n){let i=Zt(e,t);t.fs.mkdir(i,r=>{if(!r)return mc.probe(i,t.fs,(o,s,a)=>{if(o)return t.fs.rmdir(i,()=>{}),n(o);n(null,s,a)});if(r.code!=="EEXIST")return n(r);if(t.stale<=0)return n(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:e}));t.fs.stat(i,(o,s)=>{if(o)return o.code==="ENOENT"?zr(e,{...t,stale:0},n):n(o);if(!hc(s,t))return n(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:e}));yc(e,t,a=>{if(a)return n(a);zr(e,{...t,stale:0},n)})})})}function hc(e,t){return e.mtime.getTime()<Date.now()-t.stale}function yc(e,t,n){t.fs.rmdir(Zt(e,t),i=>{if(i&&i.code!=="ENOENT")return n(i);n()})}function ti(e,t){let n=Ee[e];n.updateTimeout||(n.updateDelay=n.updateDelay||t.update,n.updateTimeout=setTimeout(()=>{n.updateTimeout=null,t.fs.stat(n.lockfilePath,(i,r)=>{let o=n.lastUpdate+t.stale<Date.now();if(i)return i.code==="ENOENT"||o?Qr(e,n,Object.assign(i,{code:"ECOMPROMISED"})):(n.updateDelay=1e3,ti(e,t));if(!(n.mtime.getTime()===r.mtime.getTime()))return Qr(e,n,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let a=mc.getMtime(n.mtimePrecision);t.fs.utimes(n.lockfilePath,a,a,l=>{let c=n.lastUpdate+t.stale<Date.now();if(!n.released){if(l)return l.code==="ENOENT"||c?Qr(e,n,Object.assign(l,{code:"ECOMPROMISED"})):(n.updateDelay=1e3,ti(e,t));n.mtime=a,n.lastUpdate=Date.now(),n.updateDelay=null,ti(e,t)}})})},n.updateDelay),n.updateTimeout.unref&&n.updateTimeout.unref())}function Qr(e,t,n){t.released=!0,t.updateTimeout&&clearTimeout(t.updateTimeout),Ee[e]===t&&delete Ee[e],t.options.onCompromised(n)}function Dy(e,t,n){t={stale:1e4,update:null,realpath:!0,retries:0,fs:Zr,onCompromised:i=>{throw i},...t},t.retries=t.retries||0,t.retries=typeof t.retries=="number"?{retries:t.retries}:t.retries,t.stale=Math.max(t.stale||0,2e3),t.update=t.update==null?t.stale/2:t.update||0,t.update=Math.max(Math.min(t.update,t.stale/2),1e3),eo(e,t,(i,r)=>{if(i)return n(i);let o=Py.operation(t.retries);o.attempt(()=>{zr(r,t,(s,a,l)=>{if(o.retry(s))return;if(s)return n(o.mainError());let c=Ee[r]={lockfilePath:Zt(r,t),mtime:a,mtimePrecision:l,options:t,lastUpdate:Date.now()};ti(r,t),n(null,u=>{if(c.released)return u&&u(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));gc(r,{...t,realpath:!1},u)})})})})}function gc(e,t,n){t={fs:Zr,realpath:!0,...t},eo(e,t,(i,r)=>{if(i)return n(i);let o=Ee[r];if(!o)return n(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));o.updateTimeout&&clearTimeout(o.updateTimeout),o.released=!0,delete Ee[r],yc(r,t,n)})}function By(e,t,n){t={stale:1e4,realpath:!0,fs:Zr,...t},t.stale=Math.max(t.stale||0,2e3),eo(e,t,(i,r)=>{if(i)return n(i);t.fs.stat(Zt(r,t),(o,s)=>o?o.code==="ENOENT"?n(null,!1):n(o):n(null,!hc(s,t)))})}function qy(){return Ee}Fy(()=>{for(let e in Ee){let t=Ee[e].options;try{t.fs.rmdirSync(Zt(e,t))}catch{}}});en.exports.lock=Dy;en.exports.unlock=gc;en.exports.check=By;en.exports.getLocks=qy});var vc=S((I_,Sc)=>{"use strict";var $y=Wr();function jy(e){let t=["mkdir","realpath","stat","rmdir","utimes"],n={...e};return t.forEach(i=>{n[i]=(...r)=>{let o=r.pop(),s;try{s=e[`${i}Sync`](...r)}catch(a){return o(a)}o(null,s)}}),n}function Uy(e){return(...t)=>new Promise((n,i)=>{t.push((r,o)=>{r?i(r):n(o)}),e(...t)})}function Ky(e){return(...t)=>{let n,i;if(t.push((r,o)=>{n=r,i=o}),e(...t),n)throw n;return i}}function Vy(e){if(e={...e},e.fs=jy(e.fs||$y),typeof e.retries=="number"&&e.retries>0||e.retries&&typeof e.retries.retries=="number"&&e.retries.retries>0)throw Object.assign(new Error("Cannot use retries with the sync api"),{code:"ESYNC"});return e}Sc.exports={toPromise:Uy,toSync:Ky,toSyncOptions:Vy}});var no=S((L_,Re)=>{"use strict";var wt=bc(),{toPromise:ni,toSync:ii,toSyncOptions:to}=vc();async function Ac(e,t){let n=await ni(wt.lock)(e,t);return ni(n)}function Yy(e,t){let n=ii(wt.lock)(e,to(t));return ii(n)}function Gy(e,t){return ni(wt.unlock)(e,t)}function Wy(e,t){return ii(wt.unlock)(e,to(t))}function Hy(e,t){return ni(wt.check)(e,t)}function Jy(e,t){return ii(wt.check)(e,to(t))}Re.exports=Ac;Re.exports.lock=Ac;Re.exports.unlock=Gy;Re.exports.lockSync=Yy;Re.exports.unlockSync=Wy;Re.exports.check=Hy;Re.exports.checkSync=Jy});var I=S(ee=>{"use strict";var oo=Symbol.for("yaml.alias"),Cc=Symbol.for("yaml.document"),ri=Symbol.for("yaml.map"),Oc=Symbol.for("yaml.pair"),so=Symbol.for("yaml.scalar"),oi=Symbol.for("yaml.seq"),xe=Symbol.for("yaml.node.type"),Zy=e=>!!e&&typeof e=="object"&&e[xe]===oo,eg=e=>!!e&&typeof e=="object"&&e[xe]===Cc,tg=e=>!!e&&typeof e=="object"&&e[xe]===ri,ng=e=>!!e&&typeof e=="object"&&e[xe]===Oc,Tc=e=>!!e&&typeof e=="object"&&e[xe]===so,ig=e=>!!e&&typeof e=="object"&&e[xe]===oi;function Ic(e){if(e&&typeof e=="object")switch(e[xe]){case ri:case oi:return!0}return!1}function rg(e){if(e&&typeof e=="object")switch(e[xe]){case oo:case ri:case so:case oi:return!0}return!1}var og=e=>(Tc(e)||Ic(e))&&!!e.anchor;ee.ALIAS=oo;ee.DOC=Cc;ee.MAP=ri;ee.NODE_TYPE=xe;ee.PAIR=Oc;ee.SCALAR=so;ee.SEQ=oi;ee.hasAnchor=og;ee.isAlias=Zy;ee.isCollection=Ic;ee.isDocument=eg;ee.isMap=tg;ee.isNode=rg;ee.isPair=ng;ee.isScalar=Tc;ee.isSeq=ig});var tn=S(ao=>{"use strict";var V=I(),ae=Symbol("break visit"),Lc=Symbol("skip children"),Se=Symbol("remove node");function si(e,t){let n=Mc(t);V.isDocument(e)?xt(null,e.contents,n,Object.freeze([e]))===Se&&(e.contents=null):xt(null,e,n,Object.freeze([]))}si.BREAK=ae;si.SKIP=Lc;si.REMOVE=Se;function xt(e,t,n,i){let r=Nc(e,t,n,i);if(V.isNode(r)||V.isPair(r))return Rc(e,i,r),xt(e,r,n,i);if(typeof r!="symbol"){if(V.isCollection(t)){i=Object.freeze(i.concat(t));for(let o=0;o<t.items.length;++o){let s=xt(o,t.items[o],n,i);if(typeof s=="number")o=s-1;else{if(s===ae)return ae;s===Se&&(t.items.splice(o,1),o-=1)}}}else if(V.isPair(t)){i=Object.freeze(i.concat(t));let o=xt("key",t.key,n,i);if(o===ae)return ae;o===Se&&(t.key=null);let s=xt("value",t.value,n,i);if(s===ae)return ae;s===Se&&(t.value=null)}}return r}async function ai(e,t){let n=Mc(t);V.isDocument(e)?await kt(null,e.contents,n,Object.freeze([e]))===Se&&(e.contents=null):await kt(null,e,n,Object.freeze([]))}ai.BREAK=ae;ai.SKIP=Lc;ai.REMOVE=Se;async function kt(e,t,n,i){let r=await Nc(e,t,n,i);if(V.isNode(r)||V.isPair(r))return Rc(e,i,r),kt(e,r,n,i);if(typeof r!="symbol"){if(V.isCollection(t)){i=Object.freeze(i.concat(t));for(let o=0;o<t.items.length;++o){let s=await kt(o,t.items[o],n,i);if(typeof s=="number")o=s-1;else{if(s===ae)return ae;s===Se&&(t.items.splice(o,1),o-=1)}}}else if(V.isPair(t)){i=Object.freeze(i.concat(t));let o=await kt("key",t.key,n,i);if(o===ae)return ae;o===Se&&(t.key=null);let s=await kt("value",t.value,n,i);if(s===ae)return ae;s===Se&&(t.value=null)}}return r}function Mc(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Nc(e,t,n,i){if(typeof n=="function")return n(e,t,i);if(V.isMap(t))return n.Map?.(e,t,i);if(V.isSeq(t))return n.Seq?.(e,t,i);if(V.isPair(t))return n.Pair?.(e,t,i);if(V.isScalar(t))return n.Scalar?.(e,t,i);if(V.isAlias(t))return n.Alias?.(e,t,i)}function Rc(e,t,n){let i=t[t.length-1];if(V.isCollection(i))i.items[e]=n;else if(V.isPair(i))e==="key"?i.key=n:i.value=n;else if(V.isDocument(i))i.contents=n;else{let r=V.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}ao.visit=si;ao.visitAsync=ai});var lo=S(Fc=>{"use strict";var Pc=I(),sg=tn(),ag={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},lg=e=>e.replace(/[!,[\]{}]/g,t=>ag[t]),nn=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let i=t.trim().split(/[ \t]+/),r=i.shift();switch(r){case"%TAG":{if(i.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;let[o,s]=i;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[o]=i;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return n(6,`Unsupported YAML version ${o}`,s),!1}}default:return n(0,`Unknown directive ${r}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let s=t.slice(2,-1);return s==="!"||s==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),s)}let[,i,r]=t.match(/^(.*!)([^!]*)$/s);r||n(`The ${t} tag has no suffix`);let o=this.tags[i];if(o)try{return o+decodeURIComponent(r)}catch(s){return n(String(s)),null}return i==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[n,i]of Object.entries(this.tags))if(t.startsWith(i))return n+lg(t.substring(i.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags),r;if(t&&i.length>0&&Pc.isNode(t.contents)){let o={};sg.visit(t.contents,(s,a)=>{Pc.isNode(a)&&a.tag&&(o[a.tag]=!0)}),r=Object.keys(o)}else r=[];for(let[o,s]of i)o==="!!"&&s==="tag:yaml.org,2002:"||(!t||r.some(a=>a.startsWith(s)))&&n.push(`%TAG ${o} ${s}`);return n.join(`
|
|
4
|
-
`)}};nn.defaultYaml={explicit:!1,version:"1.2"};nn.defaultTags={"!!":"tag:yaml.org,2002:"};
|
|
5
|
-
`)?
|
|
2
|
+
import{n as Tr}from"./chunk-3FETZOUF.js";import{a as ue,c as S,e as Or}from"./chunk-D76SO2ME.js";var Jl=S((ww,Hl)=>{var Ne=ue("constants"),xy=process.cwd,Hn=null,ky=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Hn||(Hn=xy.call(process)),Hn};try{process.cwd()}catch{}typeof process.chdir=="function"&&(Vr=process.chdir,process.chdir=function(e){Hn=null,Vr.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Vr));var Vr;Hl.exports=Cy;function Cy(e){Ne.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&t(e),e.lutimes||n(e),e.chown=o(e.chown),e.fchown=o(e.fchown),e.lchown=o(e.lchown),e.chmod=i(e.chmod),e.fchmod=i(e.fchmod),e.lchmod=i(e.lchmod),e.chownSync=s(e.chownSync),e.fchownSync=s(e.fchownSync),e.lchownSync=s(e.lchownSync),e.chmodSync=r(e.chmodSync),e.fchmodSync=r(e.fchmodSync),e.lchmodSync=r(e.lchmodSync),e.stat=a(e.stat),e.fstat=a(e.fstat),e.lstat=a(e.lstat),e.statSync=l(e.statSync),e.fstatSync=l(e.fstatSync),e.lstatSync=l(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(u,f,d){d&&process.nextTick(d)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(u,f,d,p){p&&process.nextTick(p)},e.lchownSync=function(){}),ky==="win32"&&(e.rename=typeof e.rename!="function"?e.rename:(function(u){function f(d,p,h){var m=Date.now(),y=0;u(d,p,function g(b){if(b&&(b.code==="EACCES"||b.code==="EPERM"||b.code==="EBUSY")&&Date.now()-m<6e4){setTimeout(function(){e.stat(p,function(v,x){v&&v.code==="ENOENT"?u(d,p,g):h(b)})},y),y<100&&(y+=10);return}h&&h(b)})}return Object.setPrototypeOf&&Object.setPrototypeOf(f,u),f})(e.rename)),e.read=typeof e.read!="function"?e.read:(function(u){function f(d,p,h,m,y,g){var b;if(g&&typeof g=="function"){var v=0;b=function(x,k,C){if(x&&x.code==="EAGAIN"&&v<10)return v++,u.call(e,d,p,h,m,y,b);g.apply(this,arguments)}}return u.call(e,d,p,h,m,y,b)}return Object.setPrototypeOf&&Object.setPrototypeOf(f,u),f})(e.read),e.readSync=typeof e.readSync!="function"?e.readSync:(function(u){return function(f,d,p,h,m){for(var y=0;;)try{return u.call(e,f,d,p,h,m)}catch(g){if(g.code==="EAGAIN"&&y<10){y++;continue}throw g}}})(e.readSync);function t(u){u.lchmod=function(f,d,p){u.open(f,Ne.O_WRONLY|Ne.O_SYMLINK,d,function(h,m){if(h){p&&p(h);return}u.fchmod(m,d,function(y){u.close(m,function(g){p&&p(y||g)})})})},u.lchmodSync=function(f,d){var p=u.openSync(f,Ne.O_WRONLY|Ne.O_SYMLINK,d),h=!0,m;try{m=u.fchmodSync(p,d),h=!1}finally{if(h)try{u.closeSync(p)}catch{}else u.closeSync(p)}return m}}function n(u){Ne.hasOwnProperty("O_SYMLINK")&&u.futimes?(u.lutimes=function(f,d,p,h){u.open(f,Ne.O_SYMLINK,function(m,y){if(m){h&&h(m);return}u.futimes(y,d,p,function(g){u.close(y,function(b){h&&h(g||b)})})})},u.lutimesSync=function(f,d,p){var h=u.openSync(f,Ne.O_SYMLINK),m,y=!0;try{m=u.futimesSync(h,d,p),y=!1}finally{if(y)try{u.closeSync(h)}catch{}else u.closeSync(h)}return m}):u.futimes&&(u.lutimes=function(f,d,p,h){h&&process.nextTick(h)},u.lutimesSync=function(){})}function i(u){return u&&function(f,d,p){return u.call(e,f,d,function(h){c(h)&&(h=null),p&&p.apply(this,arguments)})}}function r(u){return u&&function(f,d){try{return u.call(e,f,d)}catch(p){if(!c(p))throw p}}}function o(u){return u&&function(f,d,p,h){return u.call(e,f,d,p,function(m){c(m)&&(m=null),h&&h.apply(this,arguments)})}}function s(u){return u&&function(f,d,p){try{return u.call(e,f,d,p)}catch(h){if(!c(h))throw h}}}function a(u){return u&&function(f,d,p){typeof d=="function"&&(p=d,d=null);function h(m,y){y&&(y.uid<0&&(y.uid+=4294967296),y.gid<0&&(y.gid+=4294967296)),p&&p.apply(this,arguments)}return d?u.call(e,f,d,h):u.call(e,f,h)}}function l(u){return u&&function(f,d){var p=d?u.call(e,f,d):u.call(e,f);return p&&(p.uid<0&&(p.uid+=4294967296),p.gid<0&&(p.gid+=4294967296)),p}}function c(u){if(!u||u.code==="ENOSYS")return!0;var f=!process.getuid||process.getuid()!==0;return!!(f&&(u.code==="EINVAL"||u.code==="EPERM"))}}});var zl=S((Ew,Ql)=>{var Xl=ue("stream").Stream;Ql.exports=Oy;function Oy(e){return{ReadStream:t,WriteStream:n};function t(i,r){if(!(this instanceof t))return new t(i,r);Xl.call(this);var o=this;this.path=i,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,r=r||{};for(var s=Object.keys(r),a=0,l=s.length;a<l;a++){var c=s[a];this[c]=r[c]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){o._read()});return}e.open(this.path,this.flags,this.mode,function(u,f){if(u){o.emit("error",u),o.readable=!1;return}o.fd=f,o.emit("open",f),o._read()})}function n(i,r){if(!(this instanceof n))return new n(i,r);Xl.call(this),this.path=i,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,r=r||{};for(var o=Object.keys(r),s=0,a=o.length;s<a;s++){var l=o[s];this[l]=r[l]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var ec=S((xw,Zl)=>{"use strict";Zl.exports=Iy;var Ty=Object.getPrototypeOf||function(e){return e.__proto__};function Iy(e){if(e===null||typeof e!="object")return e;if(e instanceof Object)var t={__proto__:Ty(e)};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}),t}});var Hr=S((kw,Wr)=>{var F=ue("fs"),My=Jl(),Ly=zl(),Ny=ec(),Jn=ue("util"),Z,Qn;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Z=Symbol.for("graceful-fs.queue"),Qn=Symbol.for("graceful-fs.previous")):(Z="___graceful-fs.queue",Qn="___graceful-fs.previous");function Ry(){}function ic(e,t){Object.defineProperty(e,Z,{get:function(){return t}})}var Ze=Ry;Jn.debuglog?Ze=Jn.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Ze=function(){var e=Jn.format.apply(Jn,arguments);e="GFS4: "+e.split(/\n/).join(`
|
|
3
|
+
GFS4: `),console.error(e)});F[Z]||(tc=global[Z]||[],ic(F,tc),F.close=(function(e){function t(n,i){return e.call(F,n,function(r){r||nc(),typeof i=="function"&&i.apply(this,arguments)})}return Object.defineProperty(t,Qn,{value:e}),t})(F.close),F.closeSync=(function(e){function t(n){e.apply(F,arguments),nc()}return Object.defineProperty(t,Qn,{value:e}),t})(F.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Ze(F[Z]),ue("assert").equal(F[Z].length,0)}));var tc;global[Z]||ic(global,F[Z]);Wr.exports=Yr(Ny(F));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!F.__patched&&(Wr.exports=Yr(F),F.__patched=!0);function Yr(e){My(e),e.gracefulify=Yr,e.createReadStream=k,e.createWriteStream=C;var t=e.readFile;e.readFile=n;function n(A,O,E){return typeof O=="function"&&(E=O,O=null),T(A,O,E);function T($,W,D,q){return t($,W,function(N){N&&(N.code==="EMFILE"||N.code==="ENFILE")?bt([T,[$,W,D],N,q||Date.now(),Date.now()]):typeof D=="function"&&D.apply(this,arguments)})}}var i=e.writeFile;e.writeFile=r;function r(A,O,E,T){return typeof E=="function"&&(T=E,E=null),$(A,O,E,T);function $(W,D,q,N,Q){return i(W,D,q,function(R){R&&(R.code==="EMFILE"||R.code==="ENFILE")?bt([$,[W,D,q,N],R,Q||Date.now(),Date.now()]):typeof N=="function"&&N.apply(this,arguments)})}}var o=e.appendFile;o&&(e.appendFile=s);function s(A,O,E,T){return typeof E=="function"&&(T=E,E=null),$(A,O,E,T);function $(W,D,q,N,Q){return o(W,D,q,function(R){R&&(R.code==="EMFILE"||R.code==="ENFILE")?bt([$,[W,D,q,N],R,Q||Date.now(),Date.now()]):typeof N=="function"&&N.apply(this,arguments)})}}var a=e.copyFile;a&&(e.copyFile=l);function l(A,O,E,T){return typeof E=="function"&&(T=E,E=0),$(A,O,E,T);function $(W,D,q,N,Q){return a(W,D,q,function(R){R&&(R.code==="EMFILE"||R.code==="ENFILE")?bt([$,[W,D,q,N],R,Q||Date.now(),Date.now()]):typeof N=="function"&&N.apply(this,arguments)})}}var c=e.readdir;e.readdir=f;var u=/^v[0-5]\./;function f(A,O,E){typeof O=="function"&&(E=O,O=null);var T=u.test(process.version)?function(D,q,N,Q){return c(D,$(D,q,N,Q))}:function(D,q,N,Q){return c(D,q,$(D,q,N,Q))};return T(A,O,E);function $(W,D,q,N){return function(Q,R){Q&&(Q.code==="EMFILE"||Q.code==="ENFILE")?bt([T,[W,D,q],Q,N||Date.now(),Date.now()]):(R&&R.sort&&R.sort(),typeof q=="function"&&q.call(this,Q,R))}}}if(process.version.substr(0,4)==="v0.8"){var d=Ly(e);g=d.ReadStream,v=d.WriteStream}var p=e.ReadStream;p&&(g.prototype=Object.create(p.prototype),g.prototype.open=b);var h=e.WriteStream;h&&(v.prototype=Object.create(h.prototype),v.prototype.open=x),Object.defineProperty(e,"ReadStream",{get:function(){return g},set:function(A){g=A},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return v},set:function(A){v=A},enumerable:!0,configurable:!0});var m=g;Object.defineProperty(e,"FileReadStream",{get:function(){return m},set:function(A){m=A},enumerable:!0,configurable:!0});var y=v;Object.defineProperty(e,"FileWriteStream",{get:function(){return y},set:function(A){y=A},enumerable:!0,configurable:!0});function g(A,O){return this instanceof g?(p.apply(this,arguments),this):g.apply(Object.create(g.prototype),arguments)}function b(){var A=this;_(A.path,A.flags,A.mode,function(O,E){O?(A.autoClose&&A.destroy(),A.emit("error",O)):(A.fd=E,A.emit("open",E),A.read())})}function v(A,O){return this instanceof v?(h.apply(this,arguments),this):v.apply(Object.create(v.prototype),arguments)}function x(){var A=this;_(A.path,A.flags,A.mode,function(O,E){O?(A.destroy(),A.emit("error",O)):(A.fd=E,A.emit("open",E))})}function k(A,O){return new e.ReadStream(A,O)}function C(A,O){return new e.WriteStream(A,O)}var M=e.open;e.open=_;function _(A,O,E,T){return typeof E=="function"&&(T=E,E=null),$(A,O,E,T);function $(W,D,q,N,Q){return M(W,D,q,function(R,yw){R&&(R.code==="EMFILE"||R.code==="ENFILE")?bt([$,[W,D,q,N],R,Q||Date.now(),Date.now()]):typeof N=="function"&&N.apply(this,arguments)})}}return e}function bt(e){Ze("ENQUEUE",e[0].name,e[1]),F[Z].push(e),Gr()}var Xn;function nc(){for(var e=Date.now(),t=0;t<F[Z].length;++t)F[Z][t].length>2&&(F[Z][t][3]=e,F[Z][t][4]=e);Gr()}function Gr(){if(clearTimeout(Xn),Xn=void 0,F[Z].length!==0){var e=F[Z].shift(),t=e[0],n=e[1],i=e[2],r=e[3],o=e[4];if(r===void 0)Ze("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-r>=6e4){Ze("TIMEOUT",t.name,n);var s=n.pop();typeof s=="function"&&s.call(null,i)}else{var a=Date.now()-o,l=Math.max(o-r,1),c=Math.min(l*1.2,100);a>=c?(Ze("RETRY",t.name,n),t.apply(null,n.concat([r]))):F[Z].push(e)}Xn===void 0&&(Xn=setTimeout(Gr,0))}}});var oc=S((Cw,rc)=>{function fe(e,t){typeof t=="boolean"&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}rc.exports=fe;fe.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};fe.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};fe.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),n=this._timeouts.shift();else return!1;var i=this,r=setTimeout(function(){i._attempts++,i._operationTimeoutCb&&(i._timeout=setTimeout(function(){i._operationTimeoutCb(i._attempts)},i._operationTimeout),i._options.unref&&i._timeout.unref()),i._fn(i._attempts)},n);return this._options.unref&&r.unref(),!0};fe.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};fe.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)};fe.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)};fe.prototype.start=fe.prototype.try;fe.prototype.errors=function(){return this._errors};fe.prototype.attempts=function(){return this._attempts};fe.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,i=0;i<this._errors.length;i++){var r=this._errors[i],o=r.message,s=(e[o]||0)+1;e[o]=s,s>=n&&(t=r,n=s)}return t}});var sc=S(et=>{var Py=oc();et.operation=function(e){var t=et.timeouts(e);return new Py(t,{forever:e&&e.forever,unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})};et.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var i=[],r=0;r<t.retries;r++)i.push(this.createTimeout(r,t));return e&&e.forever&&!i.length&&i.push(this.createTimeout(r,t)),i.sort(function(o,s){return o-s}),i};et.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,i=Math.round(n*t.minTimeout*Math.pow(t.factor,e));return i=Math.min(i,t.maxTimeout),i};et.wrap=function(e,t,n){if(t instanceof Array&&(n=t,t=null),!n){n=[];for(var i in e)typeof e[i]=="function"&&n.push(i)}for(var r=0;r<n.length;r++){var o=n[r],s=e[o];e[o]=function(l){var c=et.operation(t),u=Array.prototype.slice.call(arguments,1),f=u.pop();u.push(function(d){c.retry(d)||(d&&(arguments[0]=c.mainError()),f.apply(this,arguments))}),c.attempt(function(){l.apply(e,u)})}.bind(e,s),e[o].options=t}}});var lc=S((Tw,ac)=>{ac.exports=sc()});var cc=S((Iw,zn)=>{zn.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&zn.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&zn.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var mc=S((Mw,At)=>{var P=global.process,tt=function(e){return e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function"};tt(P)?(uc=ue("assert"),St=cc(),fc=/^win/i.test(P.platform),zt=ue("events"),typeof zt!="function"&&(zt=zt.EventEmitter),P.__signal_exit_emitter__?J=P.__signal_exit_emitter__:(J=P.__signal_exit_emitter__=new zt,J.count=0,J.emitted={}),J.infinite||(J.setMaxListeners(1/0),J.infinite=!0),At.exports=function(e,t){if(!tt(global.process))return function(){};uc.equal(typeof e,"function","a callback must be provided for exit handler"),vt===!1&&Jr();var n="exit";t&&t.alwaysLast&&(n="afterexit");var i=function(){J.removeListener(n,e),J.listeners("exit").length===0&&J.listeners("afterexit").length===0&&Zn()};return J.on(n,e),i},Zn=function(){!vt||!tt(global.process)||(vt=!1,St.forEach(function(t){try{P.removeListener(t,ei[t])}catch{}}),P.emit=ti,P.reallyExit=Xr,J.count-=1)},At.exports.unload=Zn,nt=function(t,n,i){J.emitted[t]||(J.emitted[t]=!0,J.emit(t,n,i))},ei={},St.forEach(function(e){ei[e]=function(){if(tt(global.process)){var n=P.listeners(e);n.length===J.count&&(Zn(),nt("exit",null,e),nt("afterexit",null,e),fc&&e==="SIGHUP"&&(e="SIGINT"),P.kill(P.pid,e))}}}),At.exports.signals=function(){return St},vt=!1,Jr=function(){vt||!tt(global.process)||(vt=!0,J.count+=1,St=St.filter(function(t){try{return P.on(t,ei[t]),!0}catch{return!1}}),P.emit=pc,P.reallyExit=dc)},At.exports.load=Jr,Xr=P.reallyExit,dc=function(t){tt(global.process)&&(P.exitCode=t||0,nt("exit",P.exitCode,null),nt("afterexit",P.exitCode,null),Xr.call(P,P.exitCode))},ti=P.emit,pc=function(t,n){if(t==="exit"&&tt(global.process)){n!==void 0&&(P.exitCode=n);var i=ti.apply(this,arguments);return nt("exit",P.exitCode,null),nt("afterexit",P.exitCode,null),i}else return ti.apply(this,arguments)}):At.exports=function(){return function(){}};var uc,St,fc,zt,J,Zn,nt,ei,vt,Jr,Xr,dc,ti,pc});var yc=S((Lw,Qr)=>{"use strict";var hc=Symbol();function Dy(e,t,n){let i=t[hc];if(i)return t.stat(e,(o,s)=>{if(o)return n(o);n(null,s.mtime,i)});let r=new Date(Math.ceil(Date.now()/1e3)*1e3+5);t.utimes(e,r,r,o=>{if(o)return n(o);t.stat(e,(s,a)=>{if(s)return n(s);let l=a.mtime.getTime()%1e3===0?"s":"ms";Object.defineProperty(t,hc,{value:l}),n(null,a.mtime,l)})})}function Fy(e){let t=Date.now();return e==="s"&&(t=Math.ceil(t/1e3)*1e3),new Date(t)}Qr.exports.probe=Dy;Qr.exports.getMtime=Fy});var Ac=S((Nw,en)=>{"use strict";var By=ue("path"),eo=Hr(),qy=lc(),$y=mc(),gc=yc(),Ee={};function Zt(e,t){return t.lockfilePath||`${e}.lock`}function to(e,t,n){if(!t.realpath)return n(null,By.resolve(e));t.fs.realpath(e,n)}function Zr(e,t,n){let i=Zt(e,t);t.fs.mkdir(i,r=>{if(!r)return gc.probe(i,t.fs,(o,s,a)=>{if(o)return t.fs.rmdir(i,()=>{}),n(o);n(null,s,a)});if(r.code!=="EEXIST")return n(r);if(t.stale<=0)return n(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:e}));t.fs.stat(i,(o,s)=>{if(o)return o.code==="ENOENT"?Zr(e,{...t,stale:0},n):n(o);if(!bc(s,t))return n(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:e}));Sc(e,t,a=>{if(a)return n(a);Zr(e,{...t,stale:0},n)})})})}function bc(e,t){return e.mtime.getTime()<Date.now()-t.stale}function Sc(e,t,n){t.fs.rmdir(Zt(e,t),i=>{if(i&&i.code!=="ENOENT")return n(i);n()})}function ni(e,t){let n=Ee[e];n.updateTimeout||(n.updateDelay=n.updateDelay||t.update,n.updateTimeout=setTimeout(()=>{n.updateTimeout=null,t.fs.stat(n.lockfilePath,(i,r)=>{let o=n.lastUpdate+t.stale<Date.now();if(i)return i.code==="ENOENT"||o?zr(e,n,Object.assign(i,{code:"ECOMPROMISED"})):(n.updateDelay=1e3,ni(e,t));if(!(n.mtime.getTime()===r.mtime.getTime()))return zr(e,n,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let a=gc.getMtime(n.mtimePrecision);t.fs.utimes(n.lockfilePath,a,a,l=>{let c=n.lastUpdate+t.stale<Date.now();if(!n.released){if(l)return l.code==="ENOENT"||c?zr(e,n,Object.assign(l,{code:"ECOMPROMISED"})):(n.updateDelay=1e3,ni(e,t));n.mtime=a,n.lastUpdate=Date.now(),n.updateDelay=null,ni(e,t)}})})},n.updateDelay),n.updateTimeout.unref&&n.updateTimeout.unref())}function zr(e,t,n){t.released=!0,t.updateTimeout&&clearTimeout(t.updateTimeout),Ee[e]===t&&delete Ee[e],t.options.onCompromised(n)}function jy(e,t,n){t={stale:1e4,update:null,realpath:!0,retries:0,fs:eo,onCompromised:i=>{throw i},...t},t.retries=t.retries||0,t.retries=typeof t.retries=="number"?{retries:t.retries}:t.retries,t.stale=Math.max(t.stale||0,2e3),t.update=t.update==null?t.stale/2:t.update||0,t.update=Math.max(Math.min(t.update,t.stale/2),1e3),to(e,t,(i,r)=>{if(i)return n(i);let o=qy.operation(t.retries);o.attempt(()=>{Zr(r,t,(s,a,l)=>{if(o.retry(s))return;if(s)return n(o.mainError());let c=Ee[r]={lockfilePath:Zt(r,t),mtime:a,mtimePrecision:l,options:t,lastUpdate:Date.now()};ni(r,t),n(null,u=>{if(c.released)return u&&u(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));vc(r,{...t,realpath:!1},u)})})})})}function vc(e,t,n){t={fs:eo,realpath:!0,...t},to(e,t,(i,r)=>{if(i)return n(i);let o=Ee[r];if(!o)return n(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));o.updateTimeout&&clearTimeout(o.updateTimeout),o.released=!0,delete Ee[r],Sc(r,t,n)})}function Uy(e,t,n){t={stale:1e4,realpath:!0,fs:eo,...t},t.stale=Math.max(t.stale||0,2e3),to(e,t,(i,r)=>{if(i)return n(i);t.fs.stat(Zt(r,t),(o,s)=>o?o.code==="ENOENT"?n(null,!1):n(o):n(null,!bc(s,t)))})}function Ky(){return Ee}$y(()=>{for(let e in Ee){let t=Ee[e].options;try{t.fs.rmdirSync(Zt(e,t))}catch{}}});en.exports.lock=jy;en.exports.unlock=vc;en.exports.check=Uy;en.exports.getLocks=Ky});var wc=S((Rw,_c)=>{"use strict";var Vy=Hr();function Yy(e){let t=["mkdir","realpath","stat","rmdir","utimes"],n={...e};return t.forEach(i=>{n[i]=(...r)=>{let o=r.pop(),s;try{s=e[`${i}Sync`](...r)}catch(a){return o(a)}o(null,s)}}),n}function Gy(e){return(...t)=>new Promise((n,i)=>{t.push((r,o)=>{r?i(r):n(o)}),e(...t)})}function Wy(e){return(...t)=>{let n,i;if(t.push((r,o)=>{n=r,i=o}),e(...t),n)throw n;return i}}function Hy(e){if(e={...e},e.fs=Yy(e.fs||Vy),typeof e.retries=="number"&&e.retries>0||e.retries&&typeof e.retries.retries=="number"&&e.retries.retries>0)throw Object.assign(new Error("Cannot use retries with the sync api"),{code:"ESYNC"});return e}_c.exports={toPromise:Gy,toSync:Wy,toSyncOptions:Hy}});var io=S((Pw,Re)=>{"use strict";var _t=Ac(),{toPromise:ii,toSync:ri,toSyncOptions:no}=wc();async function Ec(e,t){let n=await ii(_t.lock)(e,t);return ii(n)}function Jy(e,t){let n=ri(_t.lock)(e,no(t));return ri(n)}function Xy(e,t){return ii(_t.unlock)(e,t)}function Qy(e,t){return ri(_t.unlock)(e,no(t))}function zy(e,t){return ii(_t.check)(e,t)}function Zy(e,t){return ri(_t.check)(e,no(t))}Re.exports=Ec;Re.exports.lock=Ec;Re.exports.unlock=Xy;Re.exports.lockSync=Jy;Re.exports.unlockSync=Qy;Re.exports.check=zy;Re.exports.checkSync=Zy});var I=S(ee=>{"use strict";var so=Symbol.for("yaml.alias"),Ic=Symbol.for("yaml.document"),oi=Symbol.for("yaml.map"),Mc=Symbol.for("yaml.pair"),ao=Symbol.for("yaml.scalar"),si=Symbol.for("yaml.seq"),xe=Symbol.for("yaml.node.type"),ig=e=>!!e&&typeof e=="object"&&e[xe]===so,rg=e=>!!e&&typeof e=="object"&&e[xe]===Ic,og=e=>!!e&&typeof e=="object"&&e[xe]===oi,sg=e=>!!e&&typeof e=="object"&&e[xe]===Mc,Lc=e=>!!e&&typeof e=="object"&&e[xe]===ao,ag=e=>!!e&&typeof e=="object"&&e[xe]===si;function Nc(e){if(e&&typeof e=="object")switch(e[xe]){case oi:case si:return!0}return!1}function lg(e){if(e&&typeof e=="object")switch(e[xe]){case so:case oi:case ao:case si:return!0}return!1}var cg=e=>(Lc(e)||Nc(e))&&!!e.anchor;ee.ALIAS=so;ee.DOC=Ic;ee.MAP=oi;ee.NODE_TYPE=xe;ee.PAIR=Mc;ee.SCALAR=ao;ee.SEQ=si;ee.hasAnchor=cg;ee.isAlias=ig;ee.isCollection=Nc;ee.isDocument=rg;ee.isMap=og;ee.isNode=lg;ee.isPair=sg;ee.isScalar=Lc;ee.isSeq=ag});var tn=S(lo=>{"use strict";var V=I(),ae=Symbol("break visit"),Rc=Symbol("skip children"),Se=Symbol("remove node");function ai(e,t){let n=Pc(t);V.isDocument(e)?xt(null,e.contents,n,Object.freeze([e]))===Se&&(e.contents=null):xt(null,e,n,Object.freeze([]))}ai.BREAK=ae;ai.SKIP=Rc;ai.REMOVE=Se;function xt(e,t,n,i){let r=Dc(e,t,n,i);if(V.isNode(r)||V.isPair(r))return Fc(e,i,r),xt(e,r,n,i);if(typeof r!="symbol"){if(V.isCollection(t)){i=Object.freeze(i.concat(t));for(let o=0;o<t.items.length;++o){let s=xt(o,t.items[o],n,i);if(typeof s=="number")o=s-1;else{if(s===ae)return ae;s===Se&&(t.items.splice(o,1),o-=1)}}}else if(V.isPair(t)){i=Object.freeze(i.concat(t));let o=xt("key",t.key,n,i);if(o===ae)return ae;o===Se&&(t.key=null);let s=xt("value",t.value,n,i);if(s===ae)return ae;s===Se&&(t.value=null)}}return r}async function li(e,t){let n=Pc(t);V.isDocument(e)?await kt(null,e.contents,n,Object.freeze([e]))===Se&&(e.contents=null):await kt(null,e,n,Object.freeze([]))}li.BREAK=ae;li.SKIP=Rc;li.REMOVE=Se;async function kt(e,t,n,i){let r=await Dc(e,t,n,i);if(V.isNode(r)||V.isPair(r))return Fc(e,i,r),kt(e,r,n,i);if(typeof r!="symbol"){if(V.isCollection(t)){i=Object.freeze(i.concat(t));for(let o=0;o<t.items.length;++o){let s=await kt(o,t.items[o],n,i);if(typeof s=="number")o=s-1;else{if(s===ae)return ae;s===Se&&(t.items.splice(o,1),o-=1)}}}else if(V.isPair(t)){i=Object.freeze(i.concat(t));let o=await kt("key",t.key,n,i);if(o===ae)return ae;o===Se&&(t.key=null);let s=await kt("value",t.value,n,i);if(s===ae)return ae;s===Se&&(t.value=null)}}return r}function Pc(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Dc(e,t,n,i){if(typeof n=="function")return n(e,t,i);if(V.isMap(t))return n.Map?.(e,t,i);if(V.isSeq(t))return n.Seq?.(e,t,i);if(V.isPair(t))return n.Pair?.(e,t,i);if(V.isScalar(t))return n.Scalar?.(e,t,i);if(V.isAlias(t))return n.Alias?.(e,t,i)}function Fc(e,t,n){let i=t[t.length-1];if(V.isCollection(i))i.items[e]=n;else if(V.isPair(i))e==="key"?i.key=n:i.value=n;else if(V.isDocument(i))i.contents=n;else{let r=V.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}lo.visit=ai;lo.visitAsync=li});var co=S(qc=>{"use strict";var Bc=I(),ug=tn(),fg={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},dg=e=>e.replace(/[!,[\]{}]/g,t=>fg[t]),nn=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let i=t.trim().split(/[ \t]+/),r=i.shift();switch(r){case"%TAG":{if(i.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;let[o,s]=i;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[o]=i;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return n(6,`Unsupported YAML version ${o}`,s),!1}}default:return n(0,`Unknown directive ${r}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let s=t.slice(2,-1);return s==="!"||s==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),s)}let[,i,r]=t.match(/^(.*!)([^!]*)$/s);r||n(`The ${t} tag has no suffix`);let o=this.tags[i];if(o)try{return o+decodeURIComponent(r)}catch(s){return n(String(s)),null}return i==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[n,i]of Object.entries(this.tags))if(t.startsWith(i))return n+dg(t.substring(i.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags),r;if(t&&i.length>0&&Bc.isNode(t.contents)){let o={};ug.visit(t.contents,(s,a)=>{Bc.isNode(a)&&a.tag&&(o[a.tag]=!0)}),r=Object.keys(o)}else r=[];for(let[o,s]of i)o==="!!"&&s==="tag:yaml.org,2002:"||(!t||r.some(a=>a.startsWith(s)))&&n.push(`%TAG ${o} ${s}`);return n.join(`
|
|
4
|
+
`)}};nn.defaultYaml={explicit:!1,version:"1.2"};nn.defaultTags={"!!":"tag:yaml.org,2002:"};qc.Directives=nn});var ci=S(rn=>{"use strict";var $c=I(),pg=tn();function mg(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function jc(e){let t=new Set;return pg.visit(e,{Value(n,i){i.anchor&&t.add(i.anchor)}}),t}function Uc(e,t){for(let n=1;;++n){let i=`${e}${n}`;if(!t.has(i))return i}}function hg(e,t){let n=[],i=new Map,r=null;return{onAnchor:o=>{n.push(o),r??(r=jc(e));let s=Uc(t,r);return r.add(s),s},setAnchors:()=>{for(let o of n){let s=i.get(o);if(typeof s=="object"&&s.anchor&&($c.isScalar(s.node)||$c.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:i}}rn.anchorIsValid=mg;rn.anchorNames=jc;rn.createNodeAnchors=hg;rn.findNewAnchor=Uc});var uo=S(Kc=>{"use strict";function on(e,t,n,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let r=0,o=i.length;r<o;++r){let s=i[r],a=on(e,i,String(r),s);a===void 0?delete i[r]:a!==s&&(i[r]=a)}else if(i instanceof Map)for(let r of Array.from(i.keys())){let o=i.get(r),s=on(e,i,r,o);s===void 0?i.delete(r):s!==o&&i.set(r,s)}else if(i instanceof Set)for(let r of Array.from(i)){let o=on(e,i,r,r);o===void 0?i.delete(r):o!==r&&(i.delete(r),i.add(o))}else for(let[r,o]of Object.entries(i)){let s=on(e,i,r,o);s===void 0?delete i[r]:s!==o&&(i[r]=s)}return e.call(t,n,i)}Kc.applyReviver=on});var De=S(Yc=>{"use strict";var yg=I();function Vc(e,t,n){if(Array.isArray(e))return e.map((i,r)=>Vc(i,String(r),n));if(e&&typeof e.toJSON=="function"){if(!n||!yg.hasAnchor(e))return e.toJSON(t,n);let i={aliasCount:0,count:1,res:void 0};n.anchors.set(e,i),n.onCreate=o=>{i.res=o,delete n.onCreate};let r=e.toJSON(t,n);return n.onCreate&&n.onCreate(r),r}return typeof e=="bigint"&&!n?.keep?Number(e):e}Yc.toJS=Vc});var ui=S(Wc=>{"use strict";var gg=uo(),Gc=I(),bg=De(),fo=class{constructor(t){Object.defineProperty(this,Gc.NODE_TYPE,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:i,onAnchor:r,reviver:o}={}){if(!Gc.isDocument(t))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},a=bg.toJS(this,"",s);if(typeof r=="function")for(let{count:l,res:c}of s.anchors.values())r(c,l);return typeof o=="function"?gg.applyReviver(o,{"":a},"",a):a}};Wc.NodeBase=fo});var sn=S(Hc=>{"use strict";var Sg=ci(),vg=tn(),Ct=I(),Ag=ui(),_g=De(),po=class extends Ag.NodeBase{constructor(t){super(Ct.ALIAS),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){if(n?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let i;n?.aliasResolveCache?i=n.aliasResolveCache:(i=[],vg.visit(t,{Node:(o,s)=>{(Ct.isAlias(s)||Ct.hasAnchor(s))&&i.push(s)}}),n&&(n.aliasResolveCache=i));let r;for(let o of i){if(o===this)break;o.anchor===this.source&&(r=o)}return r}toJSON(t,n){if(!n)return{source:this.source};let{anchors:i,doc:r,maxAliasCount:o}=n,s=this.resolve(r,n);if(!s){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=i.get(s);if(a||(_g.toJS(s,null,n),a=i.get(s)),a?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=fi(r,s,i)),a.count*a.aliasCount>o)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(t,n,i){let r=`*${this.source}`;if(t){if(Sg.anchorIsValid(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(t.implicitKey)return`${r} `}return r}};function fi(e,t,n){if(Ct.isAlias(t)){let i=t.resolve(e),r=n&&i&&n.get(i);return r?r.count*r.aliasCount:0}else if(Ct.isCollection(t)){let i=0;for(let r of t.items){let o=fi(e,r,n);o>i&&(i=o)}return i}else if(Ct.isPair(t)){let i=fi(e,t.key,n),r=fi(e,t.value,n);return Math.max(i,r)}return 1}Hc.Alias=po});var U=S(mo=>{"use strict";var wg=I(),Eg=ui(),xg=De(),kg=e=>!e||typeof e!="function"&&typeof e!="object",Fe=class extends Eg.NodeBase{constructor(t){super(wg.SCALAR),this.value=t}toJSON(t,n){return n?.keep?this.value:xg.toJS(this.value,t,n)}toString(){return String(this.value)}};Fe.BLOCK_FOLDED="BLOCK_FOLDED";Fe.BLOCK_LITERAL="BLOCK_LITERAL";Fe.PLAIN="PLAIN";Fe.QUOTE_DOUBLE="QUOTE_DOUBLE";Fe.QUOTE_SINGLE="QUOTE_SINGLE";mo.Scalar=Fe;mo.isScalarValue=kg});var an=S(Xc=>{"use strict";var Cg=sn(),rt=I(),Jc=U(),Og="tag:yaml.org,2002:";function Tg(e,t,n){if(t){let i=n.filter(o=>o.tag===t),r=i.find(o=>!o.format)??i[0];if(!r)throw new Error(`Tag ${t} not found`);return r}return n.find(i=>i.identify?.(e)&&!i.format)}function Ig(e,t,n){if(rt.isDocument(e)&&(e=e.contents),rt.isNode(e))return e;if(rt.isPair(e)){let f=n.schema[rt.MAP].createNode?.(n.schema,null,n);return f.items.push(e),f}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:i,onAnchor:r,onTagObj:o,schema:s,sourceObjects:a}=n,l;if(i&&e&&typeof e=="object"){if(l=a.get(e),l)return l.anchor??(l.anchor=r(e)),new Cg.Alias(l.anchor);l={anchor:null,node:null},a.set(e,l)}t?.startsWith("!!")&&(t=Og+t.slice(2));let c=Tg(e,t,s.tags);if(!c){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let f=new Jc.Scalar(e);return l&&(l.node=f),f}c=e instanceof Map?s[rt.MAP]:Symbol.iterator in Object(e)?s[rt.SEQ]:s[rt.MAP]}o&&(o(c),delete n.onTagObj);let u=c?.createNode?c.createNode(n.schema,e,n):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(n.schema,e,n):new Jc.Scalar(e);return t?u.tag=t:c.default||(u.tag=c.tag),l&&(l.node=u),u}Xc.createNode=Ig});var pi=S(di=>{"use strict";var Mg=an(),ve=I(),Lg=ui();function ho(e,t,n){let i=n;for(let r=t.length-1;r>=0;--r){let o=t[r];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=i,i=s}else i=new Map([[o,i]])}return Mg.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var Qc=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,yo=class extends Lg.NodeBase{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(i=>ve.isNode(i)||ve.isPair(i)?i.clone(t):i),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(Qc(t))this.add(n);else{let[i,...r]=t,o=this.get(i,!0);if(ve.isCollection(o))o.addIn(r,n);else if(o===void 0&&this.schema)this.set(i,ho(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}deleteIn(t){let[n,...i]=t;if(i.length===0)return this.delete(n);let r=this.get(n,!0);if(ve.isCollection(r))return r.deleteIn(i);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}getIn(t,n){let[i,...r]=t,o=this.get(i,!0);return r.length===0?!n&&ve.isScalar(o)?o.value:o:ve.isCollection(o)?o.getIn(r,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!ve.isPair(n))return!1;let i=n.value;return i==null||t&&ve.isScalar(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(t){let[n,...i]=t;if(i.length===0)return this.has(n);let r=this.get(n,!0);return ve.isCollection(r)?r.hasIn(i):!1}setIn(t,n){let[i,...r]=t;if(r.length===0)this.set(i,n);else{let o=this.get(i,!0);if(ve.isCollection(o))o.setIn(r,n);else if(o===void 0&&this.schema)this.set(i,ho(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}};di.Collection=yo;di.collectionFromPath=ho;di.isEmptyPath=Qc});var ln=S(mi=>{"use strict";var Ng=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function go(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var Rg=(e,t,n)=>e.endsWith(`
|
|
5
|
+
`)?go(n,t):n.includes(`
|
|
6
6
|
`)?`
|
|
7
|
-
`+
|
|
8
|
-
`)n===
|
|
7
|
+
`+go(n,t):(e.endsWith(" ")?"":" ")+n;mi.indentComment=go;mi.lineComment=Rg;mi.stringifyComment=Ng});var Zc=S(cn=>{"use strict";var Pg="flow",bo="block",hi="quoted";function Dg(e,t,n="flow",{indentAtStart:i,lineWidth:r=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!r||r<0)return e;r<o&&(o=0);let l=Math.max(1+o,1+r-t.length);if(e.length<=l)return e;let c=[],u={},f=r-t.length;typeof i=="number"&&(i>r-Math.max(2,o)?c.push(0):f=r-i);let d,p,h=!1,m=-1,y=-1,g=-1;n===bo&&(m=zc(e,m,t.length),m!==-1&&(f=m+l));for(let v;v=e[m+=1];){if(n===hi&&v==="\\"){switch(y=m,e[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}g=m}if(v===`
|
|
8
|
+
`)n===bo&&(m=zc(e,m,t.length)),f=m+t.length+l,d=void 0;else{if(v===" "&&p&&p!==" "&&p!==`
|
|
9
9
|
`&&p!==" "){let x=e[m+1];x&&x!==" "&&x!==`
|
|
10
|
-
`&&x!==" "&&(d=m)}if(m>=f)if(d)c.push(d),f=d+l,d=void 0;else if(n===
|
|
11
|
-
${t}${e.slice(0,k)}`:(n===
|
|
12
|
-
${t}${e.slice(x+1,k)}`)}return b}function
|
|
13
|
-
`);i=t,r=t+1,o=e[r]}return i}cn.FOLD_BLOCK=
|
|
14
|
-
`){if(o-s>i)return!0;if(s=o+1,r-s<=i)return!1}return!0}function un(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:i}=t,r=t.options.doubleQuotedMinMultiLineLength,o=t.indent||(
|
|
10
|
+
`&&x!==" "&&(d=m)}if(m>=f)if(d)c.push(d),f=d+l,d=void 0;else if(n===hi){for(;p===" "||p===" ";)p=v,v=e[m+=1],h=!0;let x=m>g+1?m-2:y-1;if(u[x])return e;c.push(x),u[x]=!0,f=x+l,d=void 0}else h=!0}p=v}if(h&&a&&a(),c.length===0)return e;s&&s();let b=e.slice(0,c[0]);for(let v=0;v<c.length;++v){let x=c[v],k=c[v+1]||e.length;x===0?b=`
|
|
11
|
+
${t}${e.slice(0,k)}`:(n===hi&&u[x]&&(b+=`${e[x]}\\`),b+=`
|
|
12
|
+
${t}${e.slice(x+1,k)}`)}return b}function zc(e,t,n){let i=t,r=t+1,o=e[r];for(;o===" "||o===" ";)if(t<r+n)o=e[++t];else{do o=e[++t];while(o&&o!==`
|
|
13
|
+
`);i=t,r=t+1,o=e[r]}return i}cn.FOLD_BLOCK=bo;cn.FOLD_FLOW=Pg;cn.FOLD_QUOTED=hi;cn.foldFlowLines=Dg});var fn=S(eu=>{"use strict";var pe=U(),Be=Zc(),gi=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),bi=e=>/^(%|---|\.\.\.)/m.test(e);function Fg(e,t,n){if(!t||t<0)return!1;let i=t-n,r=e.length;if(r<=i)return!1;for(let o=0,s=0;o<r;++o)if(e[o]===`
|
|
14
|
+
`){if(o-s>i)return!0;if(s=o+1,r-s<=i)return!1}return!0}function un(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:i}=t,r=t.options.doubleQuotedMinMultiLineLength,o=t.indent||(bi(e)?" ":""),s="",a=0;for(let l=0,c=n[l];c;c=n[++l])if(c===" "&&n[l+1]==="\\"&&n[l+2]==="n"&&(s+=n.slice(a,l)+"\\ ",l+=1,a=l,c="\\"),c==="\\")switch(n[l+1]){case"u":{s+=n.slice(a,l);let u=n.substr(l+2,4);switch(u){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:u.substr(0,2)==="00"?s+="\\x"+u.substr(2):s+=n.substr(l,6)}l+=5,a=l+1}break;case"n":if(i||n[l+2]==='"'||n.length<r)l+=1;else{for(s+=n.slice(a,l)+`
|
|
15
15
|
|
|
16
16
|
`;n[l+2]==="\\"&&n[l+3]==="n"&&n[l+4]!=='"';)s+=`
|
|
17
|
-
`,l+=2;s+=o,n[l+2]===" "&&(s+="\\"),l+=1,a=l+1}break;default:l+=1}return s=a?s+n.slice(a):n,i?s:Be.foldFlowLines(s,o,Be.FOLD_QUOTED,
|
|
18
|
-
`)||/[ \t]\n|\n[ \t]/.test(e))return un(e,t);let n=t.indent||(
|
|
19
|
-
${n}`)+"'";return t.implicitKey?i:Be.foldFlowLines(i,n,Be.FOLD_FLOW,
|
|
17
|
+
`,l+=2;s+=o,n[l+2]===" "&&(s+="\\"),l+=1,a=l+1}break;default:l+=1}return s=a?s+n.slice(a):n,i?s:Be.foldFlowLines(s,o,Be.FOLD_QUOTED,gi(t,!1))}function So(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
18
|
+
`)||/[ \t]\n|\n[ \t]/.test(e))return un(e,t);let n=t.indent||(bi(e)?" ":""),i="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
19
|
+
${n}`)+"'";return t.implicitKey?i:Be.foldFlowLines(i,n,Be.FOLD_FLOW,gi(t,!1))}function Ot(e,t){let{singleQuote:n}=t.options,i;if(n===!1)i=un;else{let r=e.includes('"'),o=e.includes("'");r&&!o?i=So:o&&!r?i=un:i=n?So:un}return i(e,t)}var vo;try{vo=new RegExp(`(^|(?<!
|
|
20
20
|
))
|
|
21
21
|
+(?!
|
|
22
|
-
|$)`,"g")}catch{
|
|
22
|
+
|$)`,"g")}catch{vo=/\n+(?!\n|$)/g}function yi({comment:e,type:t,value:n},i,r,o){let{blockQuote:s,commentString:a,lineWidth:l}=i.options;if(!s||/\n[\t ]+$/.test(n))return Ot(n,i);let c=i.indent||(i.forceBlockIndent||bi(n)?" ":""),u=s==="literal"?!0:s==="folded"||t===pe.Scalar.BLOCK_FOLDED?!1:t===pe.Scalar.BLOCK_LITERAL?!0:!Fg(n,l,c.length);if(!n)return u?`|
|
|
23
23
|
`:`>
|
|
24
24
|
`;let f,d;for(d=n.length;d>0;--d){let k=n[d-1];if(k!==`
|
|
25
25
|
`&&k!==" "&&k!==" ")break}let p=n.substring(d),h=p.indexOf(`
|
|
26
26
|
`);h===-1?f="-":n===p||h!==p.length-1?(f="+",o&&o()):f="",p&&(n=n.slice(0,-p.length),p[p.length-1]===`
|
|
27
|
-
`&&(p=p.slice(0,-1)),p=p.replace(
|
|
27
|
+
`&&(p=p.slice(0,-1)),p=p.replace(vo,`$&${c}`));let m=!1,y,g=-1;for(y=0;y<n.length;++y){let k=n[y];if(k===" ")m=!0;else if(k===`
|
|
28
28
|
`)g=y;else break}let b=n.substring(0,g<y?g+1:y);b&&(n=n.substring(b.length),b=b.replace(/\n+/g,`$&${c}`));let x=(m?c?"2":"1":"")+f;if(e&&(x+=" "+a(e.replace(/ ?[\r\n]+/g," ")),r&&r()),!u){let k=n.replace(/\n+/g,`
|
|
29
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),C=!1,
|
|
30
|
-
${c}${
|
|
31
|
-
${c}${b}${n}${p}`}function
|
|
29
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),C=!1,M=gi(i,!0);s!=="folded"&&t!==pe.Scalar.BLOCK_FOLDED&&(M.onOverflow=()=>{C=!0});let _=Be.foldFlowLines(`${b}${k}${p}`,c,Be.FOLD_BLOCK,M);if(!C)return`>${x}
|
|
30
|
+
${c}${_}`}return n=n.replace(/\n+/g,`$&${c}`),`|${x}
|
|
31
|
+
${c}${b}${n}${p}`}function Bg(e,t,n,i){let{type:r,value:o}=e,{actualString:s,implicitKey:a,indent:l,indentStep:c,inFlow:u}=t;if(a&&o.includes(`
|
|
32
32
|
`)||u&&/[[\]{},]/.test(o))return Ot(o,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(`
|
|
33
|
-
`)?Ot(o,t):
|
|
34
|
-
`))return
|
|
35
|
-
${l}`);if(s){let d=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(f),{compat:p,tags:h}=t.doc.schema;if(h.some(d)||p?.some(d))return Ot(o,t)}return a?f:Be.foldFlowLines(f,l,Be.FOLD_FLOW,
|
|
36
|
-
${t.indent}${a}`:a}
|
|
37
|
-
${a}:`):(y=`${y}:`,d&&(y+=pn.lineComment(y,n.indent,c(d))));let g,b,v;ke.isNode(t)?(g=!!t.spaceBefore,b=t.commentBefore,v=t.comment):(g=!1,b=null,v=null,t&&typeof t=="object"&&(t=s.createNode(t))),n.implicitKey=!1,!p&&!d&&ke.isScalar(t)&&(n.indentAtStart=y.length+1),m=!1,!u&&l.length>=2&&!n.inFlow&&!p&&ke.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let x=!1,k=
|
|
38
|
-
`:"",b){let
|
|
39
|
-
${pn.indentComment(
|
|
33
|
+
`)?Ot(o,t):yi(e,t,n,i);if(!a&&!u&&r!==pe.Scalar.PLAIN&&o.includes(`
|
|
34
|
+
`))return yi(e,t,n,i);if(bi(o)){if(l==="")return t.forceBlockIndent=!0,yi(e,t,n,i);if(a&&l===c)return Ot(o,t)}let f=o.replace(/\n+/g,`$&
|
|
35
|
+
${l}`);if(s){let d=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(f),{compat:p,tags:h}=t.doc.schema;if(h.some(d)||p?.some(d))return Ot(o,t)}return a?f:Be.foldFlowLines(f,l,Be.FOLD_FLOW,gi(t,!1))}function qg(e,t,n,i){let{implicitKey:r,inFlow:o}=t,s=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:a}=e;a!==pe.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=pe.Scalar.QUOTE_DOUBLE);let l=u=>{switch(u){case pe.Scalar.BLOCK_FOLDED:case pe.Scalar.BLOCK_LITERAL:return r||o?Ot(s.value,t):yi(s,t,n,i);case pe.Scalar.QUOTE_DOUBLE:return un(s.value,t);case pe.Scalar.QUOTE_SINGLE:return So(s.value,t);case pe.Scalar.PLAIN:return Bg(s,t,n,i);default:return null}},c=l(a);if(c===null){let{defaultKeyType:u,defaultStringType:f}=t.options,d=r&&u||f;if(c=l(d),c===null)throw new Error(`Unsupported default string type ${d}`)}return c}eu.stringifyString=qg});var dn=S(Ao=>{"use strict";var $g=ci(),qe=I(),jg=ln(),Ug=fn();function Kg(e,t){let n=Object.assign({blockQuote:!0,commentString:jg.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t),i;switch(n.collectionStyle){case"block":i=!1;break;case"flow":i=!0;break;default:i=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:i,options:n}}function Vg(e,t){if(t.tag){let r=e.filter(o=>o.tag===t.tag);if(r.length>0)return r.find(o=>o.format===t.format)??r[0]}let n,i;if(qe.isScalar(t)){i=t.value;let r=e.filter(o=>o.identify?.(i));if(r.length>1){let o=r.filter(s=>s.test);o.length>0&&(r=o)}n=r.find(o=>o.format===t.format)??r.find(o=>!o.format)}else i=t,n=e.find(r=>r.nodeClass&&i instanceof r.nodeClass);if(!n){let r=i?.constructor?.name??(i===null?"null":typeof i);throw new Error(`Tag not resolved for ${r} value`)}return n}function Yg(e,t,{anchors:n,doc:i}){if(!i.directives)return"";let r=[],o=(qe.isScalar(e)||qe.isCollection(e))&&e.anchor;o&&$g.anchorIsValid(o)&&(n.add(o),r.push(`&${o}`));let s=e.tag??(t.default?null:t.tag);return s&&r.push(i.directives.tagString(s)),r.join(" ")}function Gg(e,t,n,i){if(qe.isPair(e))return e.toString(t,n,i);if(qe.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let r,o=qe.isNode(e)?e:t.doc.createNode(e,{onTagObj:l=>r=l});r??(r=Vg(t.doc.schema.tags,o));let s=Yg(o,r,t);s.length>0&&(t.indentAtStart=(t.indentAtStart??0)+s.length+1);let a=typeof r.stringify=="function"?r.stringify(o,t,n,i):qe.isScalar(o)?Ug.stringifyString(o,t,n,i):o.toString(t,n,i);return s?qe.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s}
|
|
36
|
+
${t.indent}${a}`:a}Ao.createStringifyContext=Kg;Ao.stringify=Gg});var ru=S(iu=>{"use strict";var ke=I(),tu=U(),nu=dn(),pn=ln();function Wg({key:e,value:t},n,i,r){let{allNullValues:o,doc:s,indent:a,indentStep:l,options:{commentString:c,indentSeq:u,simpleKeys:f}}=n,d=ke.isNode(e)&&e.comment||null;if(f){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(ke.isCollection(e)||!ke.isNode(e)&&typeof e=="object"){let M="With simple keys, collection cannot be used as a key value";throw new Error(M)}}let p=!f&&(!e||d&&t==null&&!n.inFlow||ke.isCollection(e)||(ke.isScalar(e)?e.type===tu.Scalar.BLOCK_FOLDED||e.type===tu.Scalar.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(f||!o),indent:a+l});let h=!1,m=!1,y=nu.stringify(e,n,()=>h=!0,()=>m=!0);if(!p&&!n.inFlow&&y.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(n.inFlow){if(o||t==null)return h&&i&&i(),y===""?"?":p?`? ${y}`:y}else if(o&&!f||t==null&&p)return y=`? ${y}`,d&&!h?y+=pn.lineComment(y,n.indent,c(d)):m&&r&&r(),y;h&&(d=null),p?(d&&(y+=pn.lineComment(y,n.indent,c(d))),y=`? ${y}
|
|
37
|
+
${a}:`):(y=`${y}:`,d&&(y+=pn.lineComment(y,n.indent,c(d))));let g,b,v;ke.isNode(t)?(g=!!t.spaceBefore,b=t.commentBefore,v=t.comment):(g=!1,b=null,v=null,t&&typeof t=="object"&&(t=s.createNode(t))),n.implicitKey=!1,!p&&!d&&ke.isScalar(t)&&(n.indentAtStart=y.length+1),m=!1,!u&&l.length>=2&&!n.inFlow&&!p&&ke.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let x=!1,k=nu.stringify(t,n,()=>x=!0,()=>m=!0),C=" ";if(d||g||b){if(C=g?`
|
|
38
|
+
`:"",b){let M=c(b);C+=`
|
|
39
|
+
${pn.indentComment(M,n.indent)}`}k===""&&!n.inFlow?C===`
|
|
40
40
|
`&&v&&(C=`
|
|
41
41
|
|
|
42
42
|
`):C+=`
|
|
43
|
-
${n.indent}`}else if(!p&&ke.isCollection(t)){let
|
|
44
|
-
`),A=
|
|
43
|
+
${n.indent}`}else if(!p&&ke.isCollection(t)){let M=k[0],_=k.indexOf(`
|
|
44
|
+
`),A=_!==-1,O=n.inFlow??t.flow??t.items.length===0;if(A||!O){let E=!1;if(A&&(M==="&"||M==="!")){let T=k.indexOf(" ");M==="&"&&T!==-1&&T<_&&k[T+1]==="!"&&(T=k.indexOf(" ",T+1)),(T===-1||_<T)&&(E=!0)}E||(C=`
|
|
45
45
|
${n.indent}`)}}else(k===""||k[0]===`
|
|
46
|
-
`)&&(C="");return y+=C+k,n.inFlow?x&&i&&i():v&&!x?y+=pn.lineComment(y,n.indent,c(v)):m&&r&&r(),y}
|
|
46
|
+
`)&&(C="");return y+=C+k,n.inFlow?x&&i&&i():v&&!x?y+=pn.lineComment(y,n.indent,c(v)):m&&r&&r(),y}iu.stringifyPair=Wg});var wo=S(_o=>{"use strict";var ou=ue("process");function Hg(e,...t){e==="debug"&&console.log(...t)}function Jg(e,t){(e==="debug"||e==="warn")&&(typeof ou.emitWarning=="function"?ou.emitWarning(t):console.warn(t))}_o.debug=Hg;_o.warn=Jg});var wi=S(_i=>{"use strict";var Ai=I(),su=U(),Si="<<",vi={identify:e=>e===Si||typeof e=="symbol"&&e.description===Si,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new su.Scalar(Symbol(Si)),{addToJSMap:au}),stringify:()=>Si},Xg=(e,t)=>(vi.identify(t)||Ai.isScalar(t)&&(!t.type||t.type===su.Scalar.PLAIN)&&vi.identify(t.value))&&e?.doc.schema.tags.some(n=>n.tag===vi.tag&&n.default);function au(e,t,n){let i=lu(e,n);if(Ai.isSeq(i))for(let r of i.items)Eo(e,t,r);else if(Array.isArray(i))for(let r of i)Eo(e,t,r);else Eo(e,t,i)}function Eo(e,t,n){let i=lu(e,n);if(!Ai.isMap(i))throw new Error("Merge sources must be maps or map aliases");let r=i.toJSON(null,e,Map);for(let[o,s]of r)t instanceof Map?t.has(o)||t.set(o,s):t instanceof Set?t.add(o):Object.prototype.hasOwnProperty.call(t,o)||Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return t}function lu(e,t){return e&&Ai.isAlias(t)?t.resolve(e.doc,e):t}_i.addMergeToJSMap=au;_i.isMergeKey=Xg;_i.merge=vi});var ko=S(fu=>{"use strict";var Qg=wo(),cu=wi(),zg=dn(),uu=I(),xo=De();function Zg(e,t,{key:n,value:i}){if(uu.isNode(n)&&n.addToJSMap)n.addToJSMap(e,t,i);else if(cu.isMergeKey(e,n))cu.addMergeToJSMap(e,t,i);else{let r=xo.toJS(n,"",e);if(t instanceof Map)t.set(r,xo.toJS(i,r,e));else if(t instanceof Set)t.add(r);else{let o=eb(n,r,e),s=xo.toJS(i,o,e);o in t?Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):t[o]=s}}return t}function eb(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(uu.isNode(e)&&n?.doc){let i=zg.createStringifyContext(n.doc,{});i.anchors=new Set;for(let o of n.anchors.keys())i.anchors.add(o.anchor);i.inFlow=!0,i.inStringifyKey=!0;let r=e.toString(i);if(!n.mapKeyWarned){let o=JSON.stringify(r);o.length>40&&(o=o.substring(0,36)+'..."'),Qg.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}fu.addPairToJSMap=Zg});var $e=S(Co=>{"use strict";var du=an(),tb=ru(),nb=ko(),Ei=I();function ib(e,t,n){let i=du.createNode(e,void 0,n),r=du.createNode(t,void 0,n);return new xi(i,r)}var xi=class e{constructor(t,n=null){Object.defineProperty(this,Ei.NODE_TYPE,{value:Ei.PAIR}),this.key=t,this.value=n}clone(t){let{key:n,value:i}=this;return Ei.isNode(n)&&(n=n.clone(t)),Ei.isNode(i)&&(i=i.clone(t)),new e(n,i)}toJSON(t,n){let i=n?.mapAsMap?new Map:{};return nb.addPairToJSMap(n,i,this)}toString(t,n,i){return t?.doc?tb.stringifyPair(this,t,n,i):JSON.stringify(this)}};Co.Pair=xi;Co.createPair=ib});var Oo=S(mu=>{"use strict";var ot=I(),pu=dn(),ki=ln();function rb(e,t,n){return(t.inFlow??e.flow?sb:ob)(e,t,n)}function ob({comment:e,items:t},n,{blockItemPrefix:i,flowChars:r,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:l,options:{commentString:c}}=n,u=Object.assign({},n,{indent:o,type:null}),f=!1,d=[];for(let h=0;h<t.length;++h){let m=t[h],y=null;if(ot.isNode(m))!f&&m.spaceBefore&&d.push(""),Ci(n,d,m.commentBefore,f),m.comment&&(y=m.comment);else if(ot.isPair(m)){let b=ot.isNode(m.key)?m.key:null;b&&(!f&&b.spaceBefore&&d.push(""),Ci(n,d,b.commentBefore,f))}f=!1;let g=pu.stringify(m,u,()=>y=null,()=>f=!0);y&&(g+=ki.lineComment(g,o,c(y))),f&&y&&(f=!1),d.push(i+g)}let p;if(d.length===0)p=r.start+r.end;else{p=d[0];for(let h=1;h<d.length;++h){let m=d[h];p+=m?`
|
|
47
47
|
${l}${m}`:`
|
|
48
48
|
`}}return e?(p+=`
|
|
49
|
-
`+
|
|
50
|
-
`)),h<e.length-1?g+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(c||(c=f.reduce((b,v)=>b+v.length+2,2)+(g.length+2)>t.options.lineWidth)),c&&(g+=",")),y&&(g+=
|
|
49
|
+
`+ki.indentComment(c(e),l),a&&a()):f&&s&&s(),p}function sb({items:e},t,{flowChars:n,itemIndent:i}){let{indent:r,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=t;i+=o;let l=Object.assign({},t,{indent:i,inFlow:!0,type:null}),c=!1,u=0,f=[];for(let h=0;h<e.length;++h){let m=e[h],y=null;if(ot.isNode(m))m.spaceBefore&&f.push(""),Ci(t,f,m.commentBefore,!1),m.comment&&(y=m.comment);else if(ot.isPair(m)){let b=ot.isNode(m.key)?m.key:null;b&&(b.spaceBefore&&f.push(""),Ci(t,f,b.commentBefore,!1),b.comment&&(c=!0));let v=ot.isNode(m.value)?m.value:null;v?(v.comment&&(y=v.comment),v.commentBefore&&(c=!0)):m.value==null&&b?.comment&&(y=b.comment)}y&&(c=!0);let g=pu.stringify(m,l,()=>y=null);c||(c=f.length>u||g.includes(`
|
|
50
|
+
`)),h<e.length-1?g+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(c||(c=f.reduce((b,v)=>b+v.length+2,2)+(g.length+2)>t.options.lineWidth)),c&&(g+=",")),y&&(g+=ki.lineComment(g,i,a(y))),f.push(g),u=f.length}let{start:d,end:p}=n;if(f.length===0)return d+p;if(!c){let h=f.reduce((m,y)=>m+y.length+2,2);c=t.options.lineWidth>0&&h>t.options.lineWidth}if(c){let h=d;for(let m of f)h+=m?`
|
|
51
51
|
${o}${r}${m}`:`
|
|
52
52
|
`;return`${h}
|
|
53
|
-
${r}${p}`}else return`${d}${s}${f.join(" ")}${s}${p}`}function
|
|
54
|
-
`:" ")}return
|
|
53
|
+
${r}${p}`}else return`${d}${s}${f.join(" ")}${s}${p}`}function Ci({indent:e,options:{commentString:t}},n,i,r){if(i&&r&&(i=i.replace(/^\n+/,"")),i){let o=ki.indentComment(t(i),e);n.push(o.trimStart())}}mu.stringifyCollection=rb});var Ue=S(Io=>{"use strict";var ab=Oo(),lb=ko(),cb=pi(),je=I(),Oi=$e(),ub=U();function mn(e,t){let n=je.isScalar(t)?t.value:t;for(let i of e)if(je.isPair(i)&&(i.key===t||i.key===n||je.isScalar(i.key)&&i.key.value===n))return i}var To=class extends cb.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(je.MAP,t),this.items=[]}static from(t,n,i){let{keepUndefined:r,replacer:o}=i,s=new this(t),a=(l,c)=>{if(typeof o=="function")c=o.call(n,l,c);else if(Array.isArray(o)&&!o.includes(l))return;(c!==void 0||r)&&s.items.push(Oi.createPair(l,c,i))};if(n instanceof Map)for(let[l,c]of n)a(l,c);else if(n&&typeof n=="object")for(let l of Object.keys(n))a(l,n[l]);return typeof t.sortMapEntries=="function"&&s.items.sort(t.sortMapEntries),s}add(t,n){let i;je.isPair(t)?i=t:!t||typeof t!="object"||!("key"in t)?i=new Oi.Pair(t,t?.value):i=new Oi.Pair(t.key,t.value);let r=mn(this.items,i.key),o=this.schema?.sortMapEntries;if(r){if(!n)throw new Error(`Key ${i.key} already set`);je.isScalar(r.value)&&ub.isScalarValue(i.value)?r.value.value=i.value:r.value=i.value}else if(o){let s=this.items.findIndex(a=>o(i,a)<0);s===-1?this.items.push(i):this.items.splice(s,0,i)}else this.items.push(i)}delete(t){let n=mn(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){let r=mn(this.items,t)?.value;return(!n&&je.isScalar(r)?r.value:r)??void 0}has(t){return!!mn(this.items,t)}set(t,n){this.add(new Oi.Pair(t,n),!0)}toJSON(t,n,i){let r=i?new i:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(r);for(let o of this.items)lb.addPairToJSMap(n,r,o);return r}toString(t,n,i){if(!t)return JSON.stringify(this);for(let r of this.items)if(!je.isPair(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),ab.stringifyCollection(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:i,onComment:n})}};Io.YAMLMap=To;Io.findPair=mn});var Tt=S(yu=>{"use strict";var fb=I(),hu=Ue(),db={collection:"map",default:!0,nodeClass:hu.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){return fb.isMap(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>hu.YAMLMap.from(e,t,n)};yu.map=db});var Ke=S(gu=>{"use strict";var pb=an(),mb=Oo(),hb=pi(),Ii=I(),yb=U(),gb=De(),Mo=class extends hb.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(Ii.SEQ,t),this.items=[]}add(t){this.items.push(t)}delete(t){let n=Ti(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){let i=Ti(t);if(typeof i!="number")return;let r=this.items[i];return!n&&Ii.isScalar(r)?r.value:r}has(t){let n=Ti(t);return typeof n=="number"&&n<this.items.length}set(t,n){let i=Ti(t);if(typeof i!="number")throw new Error(`Expected a valid index, not ${t}.`);let r=this.items[i];Ii.isScalar(r)&&yb.isScalarValue(n)?r.value=n:this.items[i]=n}toJSON(t,n){let i=[];n?.onCreate&&n.onCreate(i);let r=0;for(let o of this.items)i.push(gb.toJS(o,String(r++),n));return i}toString(t,n,i){return t?mb.stringifyCollection(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:i,onComment:n}):JSON.stringify(this)}static from(t,n,i){let{replacer:r}=i,o=new this(t);if(n&&Symbol.iterator in Object(n)){let s=0;for(let a of n){if(typeof r=="function"){let l=n instanceof Set?a:String(s++);a=r.call(n,l,a)}o.items.push(pb.createNode(a,void 0,i))}}return o}};function Ti(e){let t=Ii.isScalar(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}gu.YAMLSeq=Mo});var It=S(Su=>{"use strict";var bb=I(),bu=Ke(),Sb={collection:"seq",default:!0,nodeClass:bu.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){return bb.isSeq(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>bu.YAMLSeq.from(e,t,n)};Su.seq=Sb});var hn=S(vu=>{"use strict";var vb=fn(),Ab={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,i){return t=Object.assign({actualString:!0},t),vb.stringifyString(e,t,n,i)}};vu.string=Ab});var Mi=S(wu=>{"use strict";var Au=U(),_u={identify:e=>e==null,createNode:()=>new Au.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Au.Scalar(null),stringify:({source:e},t)=>typeof e=="string"&&_u.test.test(e)?e:t.options.nullStr};wu.nullTag=_u});var Lo=S(xu=>{"use strict";var _b=U(),Eu={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new _b.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&Eu.test.test(e)){let i=e[0]==="t"||e[0]==="T";if(t===i)return e}return t?n.options.trueStr:n.options.falseStr}};xu.boolTag=Eu});var Mt=S(ku=>{"use strict";function wb({format:e,minFractionDigits:t,tag:n,value:i}){if(typeof i=="bigint")return String(i);let r=typeof i=="number"?i:Number(i);if(!isFinite(r))return isNaN(r)?".nan":r<0?"-.inf":".inf";let o=Object.is(i,-0)?"-0":JSON.stringify(i);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=t-(o.length-s-1);for(;a-- >0;)o+="0"}return o}ku.stringifyNumber=wb});var Ro=S(Li=>{"use strict";var Eb=U(),No=Mt(),xb={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:No.stringifyNumber},kb={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():No.stringifyNumber(e)}},Cb={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new Eb.Scalar(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:No.stringifyNumber};Li.float=Cb;Li.floatExp=kb;Li.floatNaN=xb});var Do=S(Ri=>{"use strict";var Cu=Mt(),Ni=e=>typeof e=="bigint"||Number.isInteger(e),Po=(e,t,n,{intAsBigInt:i})=>i?BigInt(e):parseInt(e.substring(t),n);function Ou(e,t,n){let{value:i}=e;return Ni(i)&&i>=0?n+i.toString(t):Cu.stringifyNumber(e)}var Ob={identify:e=>Ni(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>Po(e,2,8,n),stringify:e=>Ou(e,8,"0o")},Tb={identify:Ni,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>Po(e,0,10,n),stringify:Cu.stringifyNumber},Ib={identify:e=>Ni(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>Po(e,2,16,n),stringify:e=>Ou(e,16,"0x")};Ri.int=Tb;Ri.intHex=Ib;Ri.intOct=Ob});var Iu=S(Tu=>{"use strict";var Mb=Tt(),Lb=Mi(),Nb=It(),Rb=hn(),Pb=Lo(),Fo=Ro(),Bo=Do(),Db=[Mb.map,Nb.seq,Rb.string,Lb.nullTag,Pb.boolTag,Bo.intOct,Bo.int,Bo.intHex,Fo.floatNaN,Fo.floatExp,Fo.float];Tu.schema=Db});var Nu=S(Lu=>{"use strict";var Fb=U(),Bb=Tt(),qb=It();function Mu(e){return typeof e=="bigint"||Number.isInteger(e)}var Pi=({value:e})=>JSON.stringify(e),$b=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:Pi},{identify:e=>e==null,createNode:()=>new Fb.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Pi},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:Pi},{identify:Mu,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>Mu(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Pi}],jb={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},Ub=[Bb.map,qb.seq].concat($b,jb);Lu.schema=Ub});var $o=S(Ru=>{"use strict";var yn=ue("buffer"),qo=U(),Kb=fn(),Vb={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof yn.Buffer=="function")return yn.Buffer.from(e,"base64");if(typeof atob=="function"){let n=atob(e.replace(/[\n\r]/g,"")),i=new Uint8Array(n.length);for(let r=0;r<n.length;++r)i[r]=n.charCodeAt(r);return i}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:n},i,r,o){if(!n)return"";let s=n,a;if(typeof yn.Buffer=="function")a=s instanceof yn.Buffer?s.toString("base64"):yn.Buffer.from(s.buffer).toString("base64");else if(typeof btoa=="function"){let l="";for(let c=0;c<s.length;++c)l+=String.fromCharCode(s[c]);a=btoa(l)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=qo.Scalar.BLOCK_LITERAL),t!==qo.Scalar.QUOTE_DOUBLE){let l=Math.max(i.options.lineWidth-i.indent.length,i.options.minContentWidth),c=Math.ceil(a.length/l),u=new Array(c);for(let f=0,d=0;f<c;++f,d+=l)u[f]=a.substr(d,l);a=u.join(t===qo.Scalar.BLOCK_LITERAL?`
|
|
54
|
+
`:" ")}return Kb.stringifyString({comment:e,type:t,value:a},i,r,o)}};Ru.binary=Vb});var Bi=S(Fi=>{"use strict";var Di=I(),jo=$e(),Yb=U(),Gb=Ke();function Pu(e,t){if(Di.isSeq(e))for(let n=0;n<e.items.length;++n){let i=e.items[n];if(!Di.isPair(i)){if(Di.isMap(i)){i.items.length>1&&t("Each pair must have its own sequence indicator");let r=i.items[0]||new jo.Pair(new Yb.Scalar(null));if(i.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${i.commentBefore}
|
|
55
55
|
${r.key.commentBefore}`:i.commentBefore),i.comment){let o=r.value??r.key;o.comment=o.comment?`${i.comment}
|
|
56
|
-
${o.comment}`:i.comment}i=r}e.items[n]=Pi.isPair(i)?i:new $o.Pair(i)}}else t("Expected a sequence for this tag");return e}function Nu(e,t,n){let{replacer:i}=n,r=new Ub.YAMLSeq(e);r.tag="tag:yaml.org,2002:pairs";let o=0;if(t&&Symbol.iterator in Object(t))for(let s of t){typeof i=="function"&&(s=i.call(t,String(o++),s));let a,l;if(Array.isArray(s))if(s.length===2)a=s[0],l=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let c=Object.keys(s);if(c.length===1)a=c[0],l=s[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=s;r.items.push($o.createPair(a,l,n))}return r}var Kb={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Mu,createNode:Nu};Fi.createPairs=Nu;Fi.pairs=Kb;Fi.resolvePairs=Mu});var Ko=S(Uo=>{"use strict";var Ru=I(),jo=Fe(),gn=Ue(),Vb=Ke(),Pu=Di(),st=class e extends Vb.YAMLSeq{constructor(){super(),this.add=gn.YAMLMap.prototype.add.bind(this),this.delete=gn.YAMLMap.prototype.delete.bind(this),this.get=gn.YAMLMap.prototype.get.bind(this),this.has=gn.YAMLMap.prototype.has.bind(this),this.set=gn.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,n){if(!n)return super.toJSON(t);let i=new Map;n?.onCreate&&n.onCreate(i);for(let r of this.items){let o,s;if(Ru.isPair(r)?(o=jo.toJS(r.key,"",n),s=jo.toJS(r.value,o,n)):o=jo.toJS(r,"",n),i.has(o))throw new Error("Ordered maps must not include duplicate keys");i.set(o,s)}return i}static from(t,n,i){let r=Pu.createPairs(t,n,i),o=new this;return o.items=r.items,o}};st.tag="tag:yaml.org,2002:omap";var Yb={collection:"seq",identify:e=>e instanceof Map,nodeClass:st,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let n=Pu.resolvePairs(e,t),i=[];for(let{key:r}of n.items)Ru.isScalar(r)&&(i.includes(r.value)?t(`Ordered maps must not include duplicate keys: ${r.value}`):i.push(r.value));return Object.assign(new st,n)},createNode:(e,t,n)=>st.from(e,t,n)};Uo.YAMLOMap=st;Uo.omap=Yb});var $u=S(Vo=>{"use strict";var Fu=U();function Du({value:e,source:t},n){return t&&(e?Bu:qu).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var Bu={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Fu.Scalar(!0),stringify:Du},qu={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Fu.Scalar(!1),stringify:Du};Vo.falseTag=qu;Vo.trueTag=Bu});var ju=S(Bi=>{"use strict";var Gb=U(),Yo=Lt(),Wb={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Yo.stringifyNumber},Hb={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Yo.stringifyNumber(e)}},Jb={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new Gb.Scalar(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){let i=e.substring(n+1).replace(/_/g,"");i[i.length-1]==="0"&&(t.minFractionDigits=i.length)}return t},stringify:Yo.stringifyNumber};Bi.float=Jb;Bi.floatExp=Hb;Bi.floatNaN=Wb});var Ku=S(Sn=>{"use strict";var Uu=Lt(),bn=e=>typeof e=="bigint"||Number.isInteger(e);function qi(e,t,n,{intAsBigInt:i}){let r=e[0];if((r==="-"||r==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),i){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let s=BigInt(e);return r==="-"?BigInt(-1)*s:s}let o=parseInt(e,n);return r==="-"?-1*o:o}function Go(e,t,n){let{value:i}=e;if(bn(i)){let r=i.toString(t);return i<0?"-"+n+r.substr(1):n+r}return Uu.stringifyNumber(e)}var Xb={identify:bn,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>qi(e,2,2,n),stringify:e=>Go(e,2,"0b")},Qb={identify:bn,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>qi(e,1,8,n),stringify:e=>Go(e,8,"0")},zb={identify:bn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>qi(e,0,10,n),stringify:Uu.stringifyNumber},Zb={identify:bn,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>qi(e,2,16,n),stringify:e=>Go(e,16,"0x")};Sn.int=zb;Sn.intBin=Xb;Sn.intHex=Zb;Sn.intOct=Qb});var Ho=S(Wo=>{"use strict";var Ui=I(),$i=$e(),ji=Ue(),at=class e extends ji.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let n;Ui.isPair(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new $i.Pair(t.key,null):n=new $i.Pair(t,null),ji.findPair(this.items,n.key)||this.items.push(n)}get(t,n){let i=ji.findPair(this.items,t);return!n&&Ui.isPair(i)?Ui.isScalar(i.key)?i.key.value:i.key:i}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let i=ji.findPair(this.items,t);i&&!n?this.items.splice(this.items.indexOf(i),1):!i&&n&&this.items.push(new $i.Pair(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,i){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,i);throw new Error("Set items must all have null values")}static from(t,n,i){let{replacer:r}=i,o=new this(t);if(n&&Symbol.iterator in Object(n))for(let s of n)typeof r=="function"&&(s=r.call(n,s,s)),o.items.push($i.createPair(s,null,i));return o}};at.tag="tag:yaml.org,2002:set";var e0={collection:"map",identify:e=>e instanceof Set,nodeClass:at,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>at.from(e,t,n),resolve(e,t){if(Ui.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new at,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};Wo.YAMLSet=at;Wo.set=e0});var Xo=S(Ki=>{"use strict";var t0=Lt();function Jo(e,t){let n=e[0],i=n==="-"||n==="+"?e.substring(1):e,r=s=>t?BigInt(s):Number(s),o=i.replace(/_/g,"").split(":").reduce((s,a)=>s*r(60)+r(a),r(0));return n==="-"?r(-1)*o:o}function Vu(e){let{value:t}=e,n=s=>s;if(typeof t=="bigint")n=s=>BigInt(s);else if(isNaN(t)||!isFinite(t))return t0.stringifyNumber(e);let i="";t<0&&(i="-",t*=n(-1));let r=n(60),o=[t%r];return t<60?o.unshift(0):(t=(t-o[0])/r,o.unshift(t%r),t>=60&&(t=(t-o[0])/r,o.unshift(t))),i+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var n0={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>Jo(e,n),stringify:Vu},i0={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>Jo(e,!1),stringify:Vu},Yu={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(Yu.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,i,r,o,s,a]=t.map(Number),l=t[7]?Number((t[7]+"00").substr(1,3)):0,c=Date.UTC(n,i-1,r,o||0,s||0,a||0,l),u=t[8];if(u&&u!=="Z"){let f=Jo(u,!1);Math.abs(f)<30&&(f*=60),c-=6e4*f}return new Date(c)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Ki.floatTime=i0;Ki.intTime=n0;Ki.timestamp=Yu});var Hu=S(Wu=>{"use strict";var r0=Tt(),o0=Ii(),s0=It(),a0=hn(),l0=qo(),Gu=$u(),Qo=ju(),Vi=Ku(),c0=wi(),u0=Ko(),f0=Di(),d0=Ho(),zo=Xo(),p0=[r0.map,s0.seq,a0.string,o0.nullTag,Gu.trueTag,Gu.falseTag,Vi.intBin,Vi.intOct,Vi.int,Vi.intHex,Qo.floatNaN,Qo.floatExp,Qo.float,l0.binary,c0.merge,u0.omap,f0.pairs,d0.set,zo.intTime,zo.floatTime,zo.timestamp];Wu.schema=p0});var of=S(ts=>{"use strict";var zu=Tt(),m0=Ii(),Zu=It(),h0=hn(),y0=Lo(),Zo=No(),es=Po(),g0=Cu(),b0=Iu(),ef=qo(),vn=wi(),tf=Ko(),nf=Di(),Ju=Hu(),rf=Ho(),Yi=Xo(),Xu=new Map([["core",g0.schema],["failsafe",[zu.map,Zu.seq,h0.string]],["json",b0.schema],["yaml11",Ju.schema],["yaml-1.1",Ju.schema]]),Qu={binary:ef.binary,bool:y0.boolTag,float:Zo.float,floatExp:Zo.floatExp,floatNaN:Zo.floatNaN,floatTime:Yi.floatTime,int:es.int,intHex:es.intHex,intOct:es.intOct,intTime:Yi.intTime,map:zu.map,merge:vn.merge,null:m0.nullTag,omap:tf.omap,pairs:nf.pairs,seq:Zu.seq,set:rf.set,timestamp:Yi.timestamp},S0={"tag:yaml.org,2002:binary":ef.binary,"tag:yaml.org,2002:merge":vn.merge,"tag:yaml.org,2002:omap":tf.omap,"tag:yaml.org,2002:pairs":nf.pairs,"tag:yaml.org,2002:set":rf.set,"tag:yaml.org,2002:timestamp":Yi.timestamp};function v0(e,t,n){let i=Xu.get(t);if(i&&!e)return n&&!i.includes(vn.merge)?i.concat(vn.merge):i.slice();let r=i;if(!r)if(Array.isArray(e))r=[];else{let o=Array.from(Xu.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${o} or define customTags array`)}if(Array.isArray(e))for(let o of e)r=r.concat(o);else typeof e=="function"&&(r=e(r.slice()));return n&&(r=r.concat(vn.merge)),r.reduce((o,s)=>{let a=typeof s=="string"?Qu[s]:s;if(!a){let l=JSON.stringify(s),c=Object.keys(Qu).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return o.includes(a)||o.push(a),o},[])}ts.coreKnownTags=S0;ts.getTags=v0});var rs=S(sf=>{"use strict";var ns=I(),A0=Tt(),w0=It(),_0=hn(),Gi=of(),E0=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,is=class e{constructor({compat:t,customTags:n,merge:i,resolveKnownTags:r,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(t)?Gi.getTags(t,"compat"):t?Gi.getTags(null,t):null,this.name=typeof o=="string"&&o||"core",this.knownTags=r?Gi.coreKnownTags:{},this.tags=Gi.getTags(n,this.name,i),this.toStringOptions=a??null,Object.defineProperty(this,ns.MAP,{value:A0.map}),Object.defineProperty(this,ns.SCALAR,{value:_0.string}),Object.defineProperty(this,ns.SEQ,{value:w0.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?E0:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};sf.Schema=is});var lf=S(af=>{"use strict";var x0=I(),os=dn(),An=ln();function k0(e,t){let n=[],i=t.directives===!0;if(t.directives!==!1&&e.directives){let l=e.directives.toString(e);l?(n.push(l),i=!0):e.directives.docStart&&(i=!0)}i&&n.push("---");let r=os.createStringifyContext(e,t),{commentString:o}=r.options;if(e.commentBefore){n.length!==1&&n.unshift("");let l=o(e.commentBefore);n.unshift(An.indentComment(l,""))}let s=!1,a=null;if(e.contents){if(x0.isNode(e.contents)){if(e.contents.spaceBefore&&i&&n.push(""),e.contents.commentBefore){let u=o(e.contents.commentBefore);n.push(An.indentComment(u,""))}r.forceBlockIndent=!!e.comment,a=e.contents.comment}let l=a?void 0:()=>s=!0,c=os.stringify(e.contents,r,()=>a=null,l);a&&(c+=An.lineComment(c,"",o(a))),(c[0]==="|"||c[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(os.stringify(e.contents,r));if(e.directives?.docEnd)if(e.comment){let l=o(e.comment);l.includes(`
|
|
56
|
+
${o.comment}`:i.comment}i=r}e.items[n]=Di.isPair(i)?i:new jo.Pair(i)}}else t("Expected a sequence for this tag");return e}function Du(e,t,n){let{replacer:i}=n,r=new Gb.YAMLSeq(e);r.tag="tag:yaml.org,2002:pairs";let o=0;if(t&&Symbol.iterator in Object(t))for(let s of t){typeof i=="function"&&(s=i.call(t,String(o++),s));let a,l;if(Array.isArray(s))if(s.length===2)a=s[0],l=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let c=Object.keys(s);if(c.length===1)a=c[0],l=s[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=s;r.items.push(jo.createPair(a,l,n))}return r}var Wb={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Pu,createNode:Du};Fi.createPairs=Du;Fi.pairs=Wb;Fi.resolvePairs=Pu});var Vo=S(Ko=>{"use strict";var Fu=I(),Uo=De(),gn=Ue(),Hb=Ke(),Bu=Bi(),st=class e extends Hb.YAMLSeq{constructor(){super(),this.add=gn.YAMLMap.prototype.add.bind(this),this.delete=gn.YAMLMap.prototype.delete.bind(this),this.get=gn.YAMLMap.prototype.get.bind(this),this.has=gn.YAMLMap.prototype.has.bind(this),this.set=gn.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,n){if(!n)return super.toJSON(t);let i=new Map;n?.onCreate&&n.onCreate(i);for(let r of this.items){let o,s;if(Fu.isPair(r)?(o=Uo.toJS(r.key,"",n),s=Uo.toJS(r.value,o,n)):o=Uo.toJS(r,"",n),i.has(o))throw new Error("Ordered maps must not include duplicate keys");i.set(o,s)}return i}static from(t,n,i){let r=Bu.createPairs(t,n,i),o=new this;return o.items=r.items,o}};st.tag="tag:yaml.org,2002:omap";var Jb={collection:"seq",identify:e=>e instanceof Map,nodeClass:st,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let n=Bu.resolvePairs(e,t),i=[];for(let{key:r}of n.items)Fu.isScalar(r)&&(i.includes(r.value)?t(`Ordered maps must not include duplicate keys: ${r.value}`):i.push(r.value));return Object.assign(new st,n)},createNode:(e,t,n)=>st.from(e,t,n)};Ko.YAMLOMap=st;Ko.omap=Jb});var Ku=S(Yo=>{"use strict";var qu=U();function $u({value:e,source:t},n){return t&&(e?ju:Uu).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var ju={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new qu.Scalar(!0),stringify:$u},Uu={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new qu.Scalar(!1),stringify:$u};Yo.falseTag=Uu;Yo.trueTag=ju});var Vu=S(qi=>{"use strict";var Xb=U(),Go=Mt(),Qb={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Go.stringifyNumber},zb={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Go.stringifyNumber(e)}},Zb={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new Xb.Scalar(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){let i=e.substring(n+1).replace(/_/g,"");i[i.length-1]==="0"&&(t.minFractionDigits=i.length)}return t},stringify:Go.stringifyNumber};qi.float=Zb;qi.floatExp=zb;qi.floatNaN=Qb});var Gu=S(Sn=>{"use strict";var Yu=Mt(),bn=e=>typeof e=="bigint"||Number.isInteger(e);function $i(e,t,n,{intAsBigInt:i}){let r=e[0];if((r==="-"||r==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),i){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let s=BigInt(e);return r==="-"?BigInt(-1)*s:s}let o=parseInt(e,n);return r==="-"?-1*o:o}function Wo(e,t,n){let{value:i}=e;if(bn(i)){let r=i.toString(t);return i<0?"-"+n+r.substr(1):n+r}return Yu.stringifyNumber(e)}var e0={identify:bn,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>$i(e,2,2,n),stringify:e=>Wo(e,2,"0b")},t0={identify:bn,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>$i(e,1,8,n),stringify:e=>Wo(e,8,"0")},n0={identify:bn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>$i(e,0,10,n),stringify:Yu.stringifyNumber},i0={identify:bn,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>$i(e,2,16,n),stringify:e=>Wo(e,16,"0x")};Sn.int=n0;Sn.intBin=e0;Sn.intHex=i0;Sn.intOct=t0});var Jo=S(Ho=>{"use strict";var Ki=I(),ji=$e(),Ui=Ue(),at=class e extends Ui.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let n;Ki.isPair(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new ji.Pair(t.key,null):n=new ji.Pair(t,null),Ui.findPair(this.items,n.key)||this.items.push(n)}get(t,n){let i=Ui.findPair(this.items,t);return!n&&Ki.isPair(i)?Ki.isScalar(i.key)?i.key.value:i.key:i}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let i=Ui.findPair(this.items,t);i&&!n?this.items.splice(this.items.indexOf(i),1):!i&&n&&this.items.push(new ji.Pair(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,i){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,i);throw new Error("Set items must all have null values")}static from(t,n,i){let{replacer:r}=i,o=new this(t);if(n&&Symbol.iterator in Object(n))for(let s of n)typeof r=="function"&&(s=r.call(n,s,s)),o.items.push(ji.createPair(s,null,i));return o}};at.tag="tag:yaml.org,2002:set";var r0={collection:"map",identify:e=>e instanceof Set,nodeClass:at,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>at.from(e,t,n),resolve(e,t){if(Ki.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new at,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};Ho.YAMLSet=at;Ho.set=r0});var Qo=S(Vi=>{"use strict";var o0=Mt();function Xo(e,t){let n=e[0],i=n==="-"||n==="+"?e.substring(1):e,r=s=>t?BigInt(s):Number(s),o=i.replace(/_/g,"").split(":").reduce((s,a)=>s*r(60)+r(a),r(0));return n==="-"?r(-1)*o:o}function Wu(e){let{value:t}=e,n=s=>s;if(typeof t=="bigint")n=s=>BigInt(s);else if(isNaN(t)||!isFinite(t))return o0.stringifyNumber(e);let i="";t<0&&(i="-",t*=n(-1));let r=n(60),o=[t%r];return t<60?o.unshift(0):(t=(t-o[0])/r,o.unshift(t%r),t>=60&&(t=(t-o[0])/r,o.unshift(t))),i+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var s0={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>Xo(e,n),stringify:Wu},a0={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>Xo(e,!1),stringify:Wu},Hu={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(Hu.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,i,r,o,s,a]=t.map(Number),l=t[7]?Number((t[7]+"00").substr(1,3)):0,c=Date.UTC(n,i-1,r,o||0,s||0,a||0,l),u=t[8];if(u&&u!=="Z"){let f=Xo(u,!1);Math.abs(f)<30&&(f*=60),c-=6e4*f}return new Date(c)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Vi.floatTime=a0;Vi.intTime=s0;Vi.timestamp=Hu});var Qu=S(Xu=>{"use strict";var l0=Tt(),c0=Mi(),u0=It(),f0=hn(),d0=$o(),Ju=Ku(),zo=Vu(),Yi=Gu(),p0=wi(),m0=Vo(),h0=Bi(),y0=Jo(),Zo=Qo(),g0=[l0.map,u0.seq,f0.string,c0.nullTag,Ju.trueTag,Ju.falseTag,Yi.intBin,Yi.intOct,Yi.int,Yi.intHex,zo.floatNaN,zo.floatExp,zo.float,d0.binary,p0.merge,m0.omap,h0.pairs,y0.set,Zo.intTime,Zo.floatTime,Zo.timestamp];Xu.schema=g0});var lf=S(ns=>{"use strict";var tf=Tt(),b0=Mi(),nf=It(),S0=hn(),v0=Lo(),es=Ro(),ts=Do(),A0=Iu(),_0=Nu(),rf=$o(),vn=wi(),of=Vo(),sf=Bi(),zu=Qu(),af=Jo(),Gi=Qo(),Zu=new Map([["core",A0.schema],["failsafe",[tf.map,nf.seq,S0.string]],["json",_0.schema],["yaml11",zu.schema],["yaml-1.1",zu.schema]]),ef={binary:rf.binary,bool:v0.boolTag,float:es.float,floatExp:es.floatExp,floatNaN:es.floatNaN,floatTime:Gi.floatTime,int:ts.int,intHex:ts.intHex,intOct:ts.intOct,intTime:Gi.intTime,map:tf.map,merge:vn.merge,null:b0.nullTag,omap:of.omap,pairs:sf.pairs,seq:nf.seq,set:af.set,timestamp:Gi.timestamp},w0={"tag:yaml.org,2002:binary":rf.binary,"tag:yaml.org,2002:merge":vn.merge,"tag:yaml.org,2002:omap":of.omap,"tag:yaml.org,2002:pairs":sf.pairs,"tag:yaml.org,2002:set":af.set,"tag:yaml.org,2002:timestamp":Gi.timestamp};function E0(e,t,n){let i=Zu.get(t);if(i&&!e)return n&&!i.includes(vn.merge)?i.concat(vn.merge):i.slice();let r=i;if(!r)if(Array.isArray(e))r=[];else{let o=Array.from(Zu.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${o} or define customTags array`)}if(Array.isArray(e))for(let o of e)r=r.concat(o);else typeof e=="function"&&(r=e(r.slice()));return n&&(r=r.concat(vn.merge)),r.reduce((o,s)=>{let a=typeof s=="string"?ef[s]:s;if(!a){let l=JSON.stringify(s),c=Object.keys(ef).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return o.includes(a)||o.push(a),o},[])}ns.coreKnownTags=w0;ns.getTags=E0});var os=S(cf=>{"use strict";var is=I(),x0=Tt(),k0=It(),C0=hn(),Wi=lf(),O0=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,rs=class e{constructor({compat:t,customTags:n,merge:i,resolveKnownTags:r,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(t)?Wi.getTags(t,"compat"):t?Wi.getTags(null,t):null,this.name=typeof o=="string"&&o||"core",this.knownTags=r?Wi.coreKnownTags:{},this.tags=Wi.getTags(n,this.name,i),this.toStringOptions=a??null,Object.defineProperty(this,is.MAP,{value:x0.map}),Object.defineProperty(this,is.SCALAR,{value:C0.string}),Object.defineProperty(this,is.SEQ,{value:k0.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?O0:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};cf.Schema=rs});var ff=S(uf=>{"use strict";var T0=I(),ss=dn(),An=ln();function I0(e,t){let n=[],i=t.directives===!0;if(t.directives!==!1&&e.directives){let l=e.directives.toString(e);l?(n.push(l),i=!0):e.directives.docStart&&(i=!0)}i&&n.push("---");let r=ss.createStringifyContext(e,t),{commentString:o}=r.options;if(e.commentBefore){n.length!==1&&n.unshift("");let l=o(e.commentBefore);n.unshift(An.indentComment(l,""))}let s=!1,a=null;if(e.contents){if(T0.isNode(e.contents)){if(e.contents.spaceBefore&&i&&n.push(""),e.contents.commentBefore){let u=o(e.contents.commentBefore);n.push(An.indentComment(u,""))}r.forceBlockIndent=!!e.comment,a=e.contents.comment}let l=a?void 0:()=>s=!0,c=ss.stringify(e.contents,r,()=>a=null,l);a&&(c+=An.lineComment(c,"",o(a))),(c[0]==="|"||c[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(ss.stringify(e.contents,r));if(e.directives?.docEnd)if(e.comment){let l=o(e.comment);l.includes(`
|
|
57
57
|
`)?(n.push("..."),n.push(An.indentComment(l,""))):n.push(`... ${l}`)}else n.push("...");else{let l=e.comment;l&&s&&(l=l.replace(/^\n+/,"")),l&&((!s||a)&&n[n.length-1]!==""&&n.push(""),n.push(An.indentComment(o(l),"")))}return n.join(`
|
|
58
58
|
`)+`
|
|
59
|
-
`}
|
|
59
|
+
`}uf.stringifyDocument=I0});var _n=S(df=>{"use strict";var M0=sn(),Lt=pi(),de=I(),L0=$e(),N0=De(),R0=os(),P0=ff(),as=ci(),D0=uo(),F0=an(),ls=co(),cs=class e{constructor(t,n,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,de.NODE_TYPE,{value:de.DOC});let r=null;typeof n=="function"||Array.isArray(n)?r=n:i===void 0&&n&&(i=n,n=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},i);this.options=o;let{version:s}=o;i?._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new ls.Directives({version:s}),this.setSchema(s,i),this.contents=t===void 0?null:this.createNode(t,r,i)}clone(){let t=Object.create(e.prototype,{[de.NODE_TYPE]:{value:de.DOC}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=de.isNode(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){Nt(this.contents)&&this.contents.add(t)}addIn(t,n){Nt(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){let i=as.anchorNames(this);t.anchor=!n||i.has(n)?as.findNewAnchor(n||"a",i):n}return new M0.Alias(t.anchor)}createNode(t,n,i){let r;if(typeof n=="function")t=n.call({"":t},"",t),r=n;else if(Array.isArray(n)){let y=b=>typeof b=="number"||b instanceof String||b instanceof Number,g=n.filter(y).map(String);g.length>0&&(n=n.concat(g)),r=n}else i===void 0&&n&&(i=n,n=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:l,onTagObj:c,tag:u}=i??{},{onAnchor:f,setAnchors:d,sourceObjects:p}=as.createNodeAnchors(this,s||"a"),h={aliasDuplicateObjects:o??!0,keepUndefined:l??!1,onAnchor:f,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:p},m=F0.createNode(t,u,h);return a&&de.isCollection(m)&&(m.flow=!0),d(),m}createPair(t,n,i={}){let r=this.createNode(t,null,i),o=this.createNode(n,null,i);return new L0.Pair(r,o)}delete(t){return Nt(this.contents)?this.contents.delete(t):!1}deleteIn(t){return Lt.isEmptyPath(t)?this.contents==null?!1:(this.contents=null,!0):Nt(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return de.isCollection(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return Lt.isEmptyPath(t)?!n&&de.isScalar(this.contents)?this.contents.value:this.contents:de.isCollection(this.contents)?this.contents.getIn(t,n):void 0}has(t){return de.isCollection(this.contents)?this.contents.has(t):!1}hasIn(t){return Lt.isEmptyPath(t)?this.contents!==void 0:de.isCollection(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=Lt.collectionFromPath(this.schema,[t],n):Nt(this.contents)&&this.contents.set(t,n)}setIn(t,n){Lt.isEmptyPath(t)?this.contents=n:this.contents==null?this.contents=Lt.collectionFromPath(this.schema,Array.from(t),n):Nt(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let i;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new ls.Directives({version:"1.1"}),i={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new ls.Directives({version:t}),i={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,i=null;break;default:{let r=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${r}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(i)this.schema=new R0.Schema(Object.assign(i,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:i,maxAliasCount:r,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!t,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},l=N0.toJS(this.contents,n??"",a);if(typeof o=="function")for(let{count:c,res:u}of a.anchors.values())o(u,c);return typeof s=="function"?D0.applyReviver(s,{"":l},"",l):l}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return P0.stringifyDocument(this,t)}};function Nt(e){if(de.isCollection(e))return!0;throw new Error("Expected a YAML collection as document contents")}df.Document=cs});var xn=S(En=>{"use strict";var wn=class extends Error{constructor(t,n,i,r){super(),this.name=t,this.code=i,this.message=r,this.pos=n}},us=class extends wn{constructor(t,n,i){super("YAMLParseError",t,n,i)}},fs=class extends wn{constructor(t,n,i){super("YAMLWarning",t,n,i)}},B0=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>t.linePos(a));let{line:i,col:r}=n.linePos[0];n.message+=` at line ${i}, column ${r}`;let o=r-1,s=e.substring(t.lineStarts[i-1],t.lineStarts[i]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="\u2026"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"\u2026"),i>1&&/^ *$/.test(s.substring(0,o))){let a=e.substring(t.lineStarts[i-2],t.lineStarts[i-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
|
60
60
|
`),s=a+s}if(/[^ ]/.test(s)){let a=1,l=n.linePos[1];l?.line===i&&l.col>r&&(a=Math.max(1,Math.min(l.col-r,80-o)));let c=" ".repeat(o)+"^".repeat(a);n.message+=`:
|
|
61
61
|
|
|
62
62
|
${s}
|
|
63
63
|
${c}
|
|
64
|
-
`}};En.YAMLError=
|
|
65
|
-
`))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let n of t.start)if(n.type==="newline")return!0;if(t.sep){for(let n of t.sep)if(n.type==="newline")return!0}if(
|
|
66
|
-
`+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp
|
|
67
|
-
`+v.comment:b.comment=v.comment);let x=new
|
|
68
|
-
`+C.comment:c.comment=C.comment),f=C.end;continue}!s&&n.options.strict&&
|
|
69
|
-
`+
|
|
70
|
-
`+A.comment:
|
|
71
|
-
`+y.comment:c.comment=y.comment),c.range=[i.offset,m,y.offset]}else c.range=[i.offset,m,m];return c}
|
|
64
|
+
`}};En.YAMLError=wn;En.YAMLParseError=us;En.YAMLWarning=fs;En.prettifyError=B0});var kn=S(pf=>{"use strict";function q0(e,{flow:t,indicator:n,next:i,offset:r,onError:o,parentIndent:s,startOnNewline:a}){let l=!1,c=a,u=a,f="",d="",p=!1,h=!1,m=null,y=null,g=null,b=null,v=null,x=null,k=null;for(let _ of e)switch(h&&(_.type!=="space"&&_.type!=="newline"&&_.type!=="comma"&&o(_.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h=!1),m&&(c&&_.type!=="comment"&&_.type!=="newline"&&o(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),m=null),_.type){case"space":!t&&(n!=="doc-start"||i?.type!=="flow-collection")&&_.source.includes(" ")&&(m=_),u=!0;break;case"comment":{u||o(_,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let A=_.source.substring(1)||" ";f?f+=d+A:f=A,d="",c=!1;break}case"newline":c?f?f+=_.source:(!x||n!=="seq-item-ind")&&(l=!0):d+=_.source,c=!0,p=!0,(y||g)&&(b=_),u=!0;break;case"anchor":y&&o(_,"MULTIPLE_ANCHORS","A node can have at most one anchor"),_.source.endsWith(":")&&o(_.offset+_.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),y=_,k??(k=_.offset),c=!1,u=!1,h=!0;break;case"tag":{g&&o(_,"MULTIPLE_TAGS","A node can have at most one tag"),g=_,k??(k=_.offset),c=!1,u=!1,h=!0;break}case n:(y||g)&&o(_,"BAD_PROP_ORDER",`Anchors and tags must be after the ${_.source} indicator`),x&&o(_,"UNEXPECTED_TOKEN",`Unexpected ${_.source} in ${t??"collection"}`),x=_,c=n==="seq-item-ind"||n==="explicit-key-ind",u=!1;break;case"comma":if(t){v&&o(_,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),v=_,c=!1,u=!1;break}default:o(_,"UNEXPECTED_TOKEN",`Unexpected ${_.type} token`),c=!1,u=!1}let C=e[e.length-1],M=C?C.offset+C.source.length:r;return h&&i&&i.type!=="space"&&i.type!=="newline"&&i.type!=="comma"&&(i.type!=="scalar"||i.source!=="")&&o(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m&&(c&&m.indent<=s||i?.type==="block-map"||i?.type==="block-seq")&&o(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:v,found:x,spaceBefore:l,comment:f,hasNewline:p,anchor:y,tag:g,newlineAfterProp:b,end:M,start:k??M}}pf.resolveProps=q0});var Hi=S(mf=>{"use strict";function ds(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
|
|
65
|
+
`))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let n of t.start)if(n.type==="newline")return!0;if(t.sep){for(let n of t.sep)if(n.type==="newline")return!0}if(ds(t.key)||ds(t.value))return!0}return!1;default:return!0}}mf.containsNewline=ds});var ps=S(hf=>{"use strict";var $0=Hi();function j0(e,t,n){if(t?.type==="flow-collection"){let i=t.end[0];i.indent===e&&(i.source==="]"||i.source==="}")&&$0.containsNewline(t)&&n(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}hf.flowIndentCheck=j0});var ms=S(gf=>{"use strict";var yf=I();function U0(e,t,n){let{uniqueKeys:i}=e.options;if(i===!1)return!1;let r=typeof i=="function"?i:(o,s)=>o===s||yf.isScalar(o)&&yf.isScalar(s)&&o.value===s.value;return t.some(o=>r(o.key,n))}gf.mapIncludes=U0});var wf=S(_f=>{"use strict";var bf=$e(),K0=Ue(),Sf=kn(),V0=Hi(),vf=ps(),Y0=ms(),Af="All mapping items must start at the same column";function G0({composeNode:e,composeEmptyNode:t},n,i,r,o){let s=o?.nodeClass??K0.YAMLMap,a=new s(n.schema);n.atRoot&&(n.atRoot=!1);let l=i.offset,c=null;for(let u of i.items){let{start:f,key:d,sep:p,value:h}=u,m=Sf.resolveProps(f,{indicator:"explicit-key-ind",next:d??p?.[0],offset:l,onError:r,parentIndent:i.indent,startOnNewline:!0}),y=!m.found;if(y){if(d&&(d.type==="block-seq"?r(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==i.indent&&r(l,"BAD_INDENT",Af)),!m.anchor&&!m.tag&&!p){c=m.end,m.comment&&(a.comment?a.comment+=`
|
|
66
|
+
`+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||V0.containsNewline(d))&&r(d??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else m.found?.indent!==i.indent&&r(l,"BAD_INDENT",Af);n.atKey=!0;let g=m.end,b=d?e(n,d,m,r):t(n,g,f,null,m,r);n.schema.compat&&vf.flowIndentCheck(i.indent,d,r),n.atKey=!1,Y0.mapIncludes(n,a.items,b)&&r(g,"DUPLICATE_KEY","Map keys must be unique");let v=Sf.resolveProps(p??[],{indicator:"map-value-ind",next:h,offset:b.range[2],onError:r,parentIndent:i.indent,startOnNewline:!d||d.type==="block-scalar"});if(l=v.end,v.found){y&&(h?.type==="block-map"&&!v.hasNewline&&r(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&m.start<v.found.offset-1024&&r(b.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let x=h?e(n,h,v,r):t(n,l,p,null,v,r);n.schema.compat&&vf.flowIndentCheck(i.indent,h,r),l=x.range[2];let k=new bf.Pair(b,x);n.options.keepSourceTokens&&(k.srcToken=u),a.items.push(k)}else{y&&r(b.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),v.comment&&(b.comment?b.comment+=`
|
|
67
|
+
`+v.comment:b.comment=v.comment);let x=new bf.Pair(b);n.options.keepSourceTokens&&(x.srcToken=u),a.items.push(x)}}return c&&c<l&&r(c,"IMPOSSIBLE","Map comment with trailing content"),a.range=[i.offset,l,c??l],a}_f.resolveBlockMap=G0});var xf=S(Ef=>{"use strict";var W0=Ke(),H0=kn(),J0=ps();function X0({composeNode:e,composeEmptyNode:t},n,i,r,o){let s=o?.nodeClass??W0.YAMLSeq,a=new s(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let l=i.offset,c=null;for(let{start:u,value:f}of i.items){let d=H0.resolveProps(u,{indicator:"seq-item-ind",next:f,offset:l,onError:r,parentIndent:i.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||f)f?.type==="block-seq"?r(d.end,"BAD_INDENT","All sequence items must start at the same column"):r(l,"MISSING_CHAR","Sequence item without - indicator");else{c=d.end,d.comment&&(a.comment=d.comment);continue}let p=f?e(n,f,d,r):t(n,d.end,u,null,d,r);n.schema.compat&&J0.flowIndentCheck(i.indent,f,r),l=p.range[2],a.items.push(p)}return a.range=[i.offset,l,c??l],a}Ef.resolveBlockSeq=X0});var Rt=S(kf=>{"use strict";function Q0(e,t,n,i){let r="";if(e){let o=!1,s="";for(let a of e){let{source:l,type:c}=a;switch(c){case"space":o=!0;break;case"comment":{n&&!o&&i(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=l.substring(1)||" ";r?r+=s+u:r=u,s="";break}case"newline":r&&(s+=l),o=!0;break;default:i(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}t+=l.length}}return{comment:r,offset:t}}kf.resolveEnd=Q0});var If=S(Tf=>{"use strict";var z0=I(),Z0=$e(),Cf=Ue(),eS=Ke(),tS=Rt(),Of=kn(),nS=Hi(),iS=ms(),hs="Block collections are not allowed within flow collections",ys=e=>e&&(e.type==="block-map"||e.type==="block-seq");function rS({composeNode:e,composeEmptyNode:t},n,i,r,o){let s=i.start.source==="{",a=s?"flow map":"flow sequence",l=o?.nodeClass??(s?Cf.YAMLMap:eS.YAMLSeq),c=new l(n.schema);c.flow=!0;let u=n.atRoot;u&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let f=i.offset+i.start.source.length;for(let y=0;y<i.items.length;++y){let g=i.items[y],{start:b,key:v,sep:x,value:k}=g,C=Of.resolveProps(b,{flow:a,indicator:"explicit-key-ind",next:v??x?.[0],offset:f,onError:r,parentIndent:i.indent,startOnNewline:!1});if(!C.found){if(!C.anchor&&!C.tag&&!x&&!k){y===0&&C.comma?r(C.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):y<i.items.length-1&&r(C.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),C.comment&&(c.comment?c.comment+=`
|
|
68
|
+
`+C.comment:c.comment=C.comment),f=C.end;continue}!s&&n.options.strict&&nS.containsNewline(v)&&r(v,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(y===0)C.comma&&r(C.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(C.comma||r(C.start,"MISSING_CHAR",`Missing , between ${a} items`),C.comment){let M="";e:for(let _ of b)switch(_.type){case"comma":case"space":break;case"comment":M=_.source.substring(1);break e;default:break e}if(M){let _=c.items[c.items.length-1];z0.isPair(_)&&(_=_.value??_.key),_.comment?_.comment+=`
|
|
69
|
+
`+M:_.comment=M,C.comment=C.comment.substring(M.length+1)}}if(!s&&!x&&!C.found){let M=k?e(n,k,C,r):t(n,C.end,x,null,C,r);c.items.push(M),f=M.range[2],ys(k)&&r(M.range,"BLOCK_IN_FLOW",hs)}else{n.atKey=!0;let M=C.end,_=v?e(n,v,C,r):t(n,M,b,null,C,r);ys(v)&&r(_.range,"BLOCK_IN_FLOW",hs),n.atKey=!1;let A=Of.resolveProps(x??[],{flow:a,indicator:"map-value-ind",next:k,offset:_.range[2],onError:r,parentIndent:i.indent,startOnNewline:!1});if(A.found){if(!s&&!C.found&&n.options.strict){if(x)for(let T of x){if(T===A.found)break;if(T.type==="newline"){r(T,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}C.start<A.found.offset-1024&&r(A.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else k&&("source"in k&&k.source?.[0]===":"?r(k,"MISSING_CHAR",`Missing space after : in ${a}`):r(A.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let O=k?e(n,k,A,r):A.found?t(n,A.end,x,null,A,r):null;O?ys(k)&&r(O.range,"BLOCK_IN_FLOW",hs):A.comment&&(_.comment?_.comment+=`
|
|
70
|
+
`+A.comment:_.comment=A.comment);let E=new Z0.Pair(_,O);if(n.options.keepSourceTokens&&(E.srcToken=g),s){let T=c;iS.mapIncludes(n,T.items,_)&&r(M,"DUPLICATE_KEY","Map keys must be unique"),T.items.push(E)}else{let T=new Cf.YAMLMap(n.schema);T.flow=!0,T.items.push(E);let $=(O??_).range;T.range=[_.range[0],$[1],$[2]],c.items.push(T)}f=O?O.range[2]:A.end}}let d=s?"}":"]",[p,...h]=i.end,m=f;if(p?.source===d)m=p.offset+p.source.length;else{let y=a[0].toUpperCase()+a.substring(1),g=u?`${y} must end with a ${d}`:`${y} in block collection must be sufficiently indented and end with a ${d}`;r(f,u?"MISSING_CHAR":"BAD_INDENT",g),p&&p.source.length!==1&&h.unshift(p)}if(h.length>0){let y=tS.resolveEnd(h,m,n.options.strict,r);y.comment&&(c.comment?c.comment+=`
|
|
71
|
+
`+y.comment:c.comment=y.comment),c.range=[i.offset,m,y.offset]}else c.range=[i.offset,m,m];return c}Tf.resolveFlowCollection=rS});var Lf=S(Mf=>{"use strict";var oS=I(),sS=U(),aS=Ue(),lS=Ke(),cS=wf(),uS=xf(),fS=If();function gs(e,t,n,i,r,o){let s=n.type==="block-map"?cS.resolveBlockMap(e,t,n,i,o):n.type==="block-seq"?uS.resolveBlockSeq(e,t,n,i,o):fS.resolveFlowCollection(e,t,n,i,o),a=s.constructor;return r==="!"||r===a.tagName?(s.tag=a.tagName,s):(r&&(s.tag=r),s)}function dS(e,t,n,i,r){let o=i.tag,s=o?t.directives.tagName(o.source,d=>r(o,"TAG_RESOLVE_FAILED",d)):null;if(n.type==="block-seq"){let{anchor:d,newlineAfterProp:p}=i,h=d&&o?d.offset>o.offset?d:o:d??o;h&&(!p||p.offset<h.offset)&&r(h,"MISSING_CHAR","Missing newline after block sequence props")}let a=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!o||!s||s==="!"||s===aS.YAMLMap.tagName&&a==="map"||s===lS.YAMLSeq.tagName&&a==="seq")return gs(e,t,n,r,s);let l=t.schema.tags.find(d=>d.tag===s&&d.collection===a);if(!l){let d=t.schema.knownTags[s];if(d?.collection===a)t.schema.tags.push(Object.assign({},d,{default:!1})),l=d;else return d?r(o,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):r(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),gs(e,t,n,r,s)}let c=gs(e,t,n,r,s,l),u=l.resolve?.(c,d=>r(o,"TAG_RESOLVE_FAILED",d),t.options)??c,f=oS.isNode(u)?u:new sS.Scalar(u);return f.range=c.range,f.tag=s,l?.format&&(f.format=l.format),f}Mf.composeCollection=dS});var Ss=S(Nf=>{"use strict";var bs=U();function pS(e,t,n){let i=t.offset,r=mS(t,e.options.strict,n);if(!r)return{value:"",type:null,comment:"",range:[i,i,i]};let o=r.mode===">"?bs.Scalar.BLOCK_FOLDED:bs.Scalar.BLOCK_LITERAL,s=t.source?hS(t.source):[],a=s.length;for(let m=s.length-1;m>=0;--m){let y=s[m][1];if(y===""||y==="\r")a=m;else break}if(a===0){let m=r.chomp==="+"&&s.length>0?`
|
|
72
72
|
`.repeat(Math.max(1,s.length-1)):"",y=i+r.length;return t.source&&(y+=t.source.length),{value:m,type:o,comment:r.comment,range:[i,y,y]}}let l=t.indent+r.indent,c=t.offset+r.length,u=0;for(let m=0;m<a;++m){let[y,g]=s[m];if(g===""||g==="\r")r.indent===0&&y.length>l&&(l=y.length);else{y.length<l&&n(c+y.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),r.indent===0&&(l=y.length),u=m,l===0&&!e.atRoot&&n(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=y.length+g.length+1}for(let m=s.length-1;m>=a;--m)s[m][0].length>l&&(a=m+1);let f="",d="",p=!1;for(let m=0;m<u;++m)f+=s[m][0].slice(l)+`
|
|
73
|
-
`;for(let m=u;m<a;++m){let[y,g]=s[m];c+=y.length+g.length+1;let b=g[g.length-1]==="\r";if(b&&(g=g.slice(0,-1)),g&&y.length<l){let x=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;n(c-g.length-(b?2:1),"BAD_INDENT",x),y=""}o===
|
|
73
|
+
`;for(let m=u;m<a;++m){let[y,g]=s[m];c+=y.length+g.length+1;let b=g[g.length-1]==="\r";if(b&&(g=g.slice(0,-1)),g&&y.length<l){let x=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;n(c-g.length-(b?2:1),"BAD_INDENT",x),y=""}o===bs.Scalar.BLOCK_LITERAL?(f+=d+y.slice(l)+g,d=`
|
|
74
74
|
`):y.length>l||g[0]===" "?(d===" "?d=`
|
|
75
75
|
`:!p&&d===`
|
|
76
76
|
`&&(d=`
|
|
@@ -83,62 +83,62 @@ ${c}
|
|
|
83
83
|
`+s[m][0].slice(l);f[f.length-1]!==`
|
|
84
84
|
`&&(f+=`
|
|
85
85
|
`);break;default:f+=`
|
|
86
|
-
`}let h=i+r.length+t.source.length;return{value:f,type:o,comment:r.comment,range:[i,h,h]}}function
|
|
86
|
+
`}let h=i+r.length+t.source.length;return{value:f,type:o,comment:r.comment,range:[i,h,h]}}function mS({offset:e,props:t},n,i){if(t[0].type!=="block-scalar-header")return i(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:r}=t[0],o=r[0],s=0,a="",l=-1;for(let d=1;d<r.length;++d){let p=r[d];if(!a&&(p==="-"||p==="+"))a=p;else{let h=Number(p);!s&&h?s=h:l===-1&&(l=e+d)}}l!==-1&&i(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${r}`);let c=!1,u="",f=r.length;for(let d=1;d<t.length;++d){let p=t[d];switch(p.type){case"space":c=!0;case"newline":f+=p.source.length;break;case"comment":n&&!c&&i(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=p.source.length,u=p.source.substring(1);break;case"error":i(p,"UNEXPECTED_TOKEN",p.message),f+=p.source.length;break;default:{let h=`Unexpected token in block scalar header: ${p.type}`;i(p,"UNEXPECTED_TOKEN",h);let m=p.source;m&&typeof m=="string"&&(f+=m.length)}}}return{mode:o,indent:s,chomp:a,comment:u,length:f}}function hS(e){let t=e.split(/\n( *)/),n=t[0],i=n.match(/^( *)/),o=[i?.[1]?[i[1],n.slice(i[1].length)]:["",n]];for(let s=1;s<t.length;s+=2)o.push([t[s],t[s+1]]);return o}Nf.resolveBlockScalar=pS});var As=S(Pf=>{"use strict";var vs=U(),yS=Rt();function gS(e,t,n){let{offset:i,type:r,source:o,end:s}=e,a,l,c=(d,p,h)=>n(i+d,p,h);switch(r){case"scalar":a=vs.Scalar.PLAIN,l=bS(o,c);break;case"single-quoted-scalar":a=vs.Scalar.QUOTE_SINGLE,l=SS(o,c);break;case"double-quoted-scalar":a=vs.Scalar.QUOTE_DOUBLE,l=vS(o,c);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[i,i+o.length,i+o.length]}}let u=i+o.length,f=yS.resolveEnd(s,u,t,n);return{value:l,type:a,comment:f.comment,range:[i,u,f.offset]}}function bS(e,t){let n="";switch(e[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),Rf(e)}function SS(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),Rf(e.slice(1,-1)).replace(/''/g,"'")}function Rf(e){let t,n;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
87
87
|
`,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
88
88
|
`,"sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let i=t.exec(e);if(!i)return e;let r=i[1],o=" ",s=t.lastIndex;for(n.lastIndex=s;i=n.exec(e);)i[1]===""?o===`
|
|
89
89
|
`?r+=o:o=`
|
|
90
|
-
`:(r+=o+i[1],o=" "),s=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=s,i=a.exec(e),r+o+(i?.[1]??"")}function
|
|
90
|
+
`:(r+=o+i[1],o=" "),s=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=s,i=a.exec(e),r+o+(i?.[1]??"")}function vS(e,t){let n="";for(let i=1;i<e.length-1;++i){let r=e[i];if(!(r==="\r"&&e[i+1]===`
|
|
91
91
|
`))if(r===`
|
|
92
|
-
`){let{fold:o,offset:s}=
|
|
92
|
+
`){let{fold:o,offset:s}=AS(e,i);n+=o,i=s}else if(r==="\\"){let o=e[++i],s=_S[o];if(s)n+=s;else if(o===`
|
|
93
93
|
`)for(o=e[i+1];o===" "||o===" ";)o=e[++i+1];else if(o==="\r"&&e[i+1]===`
|
|
94
|
-
`)for(o=e[++i+1];o===" "||o===" ";)o=e[++i+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;n+=
|
|
94
|
+
`)for(o=e[++i+1];o===" "||o===" ";)o=e[++i+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;n+=wS(e,i+1,a,t),i+=a}else{let a=e.substr(i-1,2);t(i-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),n+=a}}else if(r===" "||r===" "){let o=i,s=e[i+1];for(;s===" "||s===" ";)s=e[++i+1];s!==`
|
|
95
95
|
`&&!(s==="\r"&&e[i+2]===`
|
|
96
|
-
`)&&(n+=i>o?e.slice(o,i+1):r)}else n+=r}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function
|
|
96
|
+
`)&&(n+=i>o?e.slice(o,i+1):r)}else n+=r}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function AS(e,t){let n="",i=e[t+1];for(;(i===" "||i===" "||i===`
|
|
97
97
|
`||i==="\r")&&!(i==="\r"&&e[t+2]!==`
|
|
98
98
|
`);)i===`
|
|
99
99
|
`&&(n+=`
|
|
100
|
-
`),t+=1,i=e[t+1];return n||(n=" "),{fold:n,offset:t}}var
|
|
101
|
-
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function
|
|
100
|
+
`),t+=1,i=e[t+1];return n||(n=" "),{fold:n,offset:t}}var _S={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
101
|
+
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function wS(e,t,n,i){let r=e.substr(t,n),s=r.length===n&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;try{return String.fromCodePoint(s)}catch{let a=e.substr(t-2,n+2);return i(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}Pf.resolveFlowScalar=gS});var Bf=S(Ff=>{"use strict";var lt=I(),Df=U(),ES=Ss(),xS=As();function kS(e,t,n,i){let{value:r,type:o,comment:s,range:a}=t.type==="block-scalar"?ES.resolveBlockScalar(e,t,i):xS.resolveFlowScalar(t,e.options.strict,i),l=n?e.directives.tagName(n.source,f=>i(n,"TAG_RESOLVE_FAILED",f)):null,c;e.options.stringKeys&&e.atKey?c=e.schema[lt.SCALAR]:l?c=CS(e.schema,r,l,n,i):t.type==="scalar"?c=OS(e,r,t,i):c=e.schema[lt.SCALAR];let u;try{let f=c.resolve(r,d=>i(n??t,"TAG_RESOLVE_FAILED",d),e.options);u=lt.isScalar(f)?f:new Df.Scalar(f)}catch(f){let d=f instanceof Error?f.message:String(f);i(n??t,"TAG_RESOLVE_FAILED",d),u=new Df.Scalar(r)}return u.range=a,u.source=r,o&&(u.type=o),l&&(u.tag=l),c.format&&(u.format=c.format),s&&(u.comment=s),u}function CS(e,t,n,i,r){if(n==="!")return e[lt.SCALAR];let o=[];for(let a of e.tags)if(!a.collection&&a.tag===n)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(t))return a;let s=e.knownTags[n];return s&&!s.collection?(e.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(r(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[lt.SCALAR])}function OS({atKey:e,directives:t,schema:n},i,r,o){let s=n.tags.find(a=>(a.default===!0||e&&a.default==="key")&&a.test?.test(i))||n[lt.SCALAR];if(n.compat){let a=n.compat.find(l=>l.default&&l.test?.test(i))??n[lt.SCALAR];if(s.tag!==a.tag){let l=t.tagString(s.tag),c=t.tagString(a.tag),u=`Value may be parsed as either ${l} or ${c}`;o(r,"TAG_RESOLVE_FAILED",u,!0)}}return s}Ff.composeScalar=kS});var $f=S(qf=>{"use strict";function TS(e,t,n){if(t){n??(n=t.length);for(let i=n-1;i>=0;--i){let r=t[i];switch(r.type){case"space":case"comment":case"newline":e-=r.source.length;continue}for(r=t[++i];r?.type==="space";)e+=r.source.length,r=t[++i];break}}return e}qf.emptyScalarPosition=TS});var Kf=S(ws=>{"use strict";var IS=sn(),MS=I(),LS=Lf(),jf=Bf(),NS=Rt(),RS=$f(),PS={composeNode:Uf,composeEmptyNode:_s};function Uf(e,t,n,i){let r=e.atKey,{spaceBefore:o,comment:s,anchor:a,tag:l}=n,c,u=!0;switch(t.type){case"alias":c=DS(e,t,i),(a||l)&&i(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":c=jf.composeScalar(e,t,l,i),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=LS.composeCollection(PS,e,t,n,i),a&&(c.anchor=a.source.substring(1))}catch(f){let d=f instanceof Error?f.message:String(f);i(t,"RESOURCE_EXHAUSTION",d)}break;default:{let f=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;i(t,"UNEXPECTED_TOKEN",f),u=!1}}return c??(c=_s(e,t.offset,void 0,null,n,i)),a&&c.anchor===""&&i(a,"BAD_ALIAS","Anchor cannot be an empty string"),r&&e.options.stringKeys&&(!MS.isScalar(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&i(l??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(c.spaceBefore=!0),s&&(t.type==="scalar"&&t.source===""?c.comment=s:c.commentBefore=s),e.options.keepSourceTokens&&u&&(c.srcToken=t),c}function _s(e,t,n,i,{spaceBefore:r,comment:o,anchor:s,tag:a,end:l},c){let u={type:"scalar",offset:RS.emptyScalarPosition(t,n,i),indent:-1,source:""},f=jf.composeScalar(e,u,a,c);return s&&(f.anchor=s.source.substring(1),f.anchor===""&&c(s,"BAD_ALIAS","Anchor cannot be an empty string")),r&&(f.spaceBefore=!0),o&&(f.comment=o,f.range[2]=l),f}function DS({options:e},{offset:t,source:n,end:i},r){let o=new IS.Alias(n.substring(1));o.source===""&&r(t,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&r(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=t+n.length,a=NS.resolveEnd(i,s,e.strict,r);return o.range=[t,s,a.offset],a.comment&&(o.comment=a.comment),o}ws.composeEmptyNode=_s;ws.composeNode=Uf});var Gf=S(Yf=>{"use strict";var FS=_n(),Vf=Kf(),BS=Rt(),qS=kn();function $S(e,t,{offset:n,start:i,value:r,end:o},s){let a=Object.assign({_directives:t},e),l=new FS.Document(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},u=qS.resolveProps(i,{indicator:"doc-start",next:r??o?.[0],offset:n,onError:s,parentIndent:0,startOnNewline:!0});u.found&&(l.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!u.hasNewline&&s(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=r?Vf.composeNode(c,r,u,s):Vf.composeEmptyNode(c,u.end,i,null,u,s);let f=l.contents.range[2],d=BS.resolveEnd(o,f,!1,s);return d.comment&&(l.comment=d.comment),l.range=[n,f,d.offset],l}Yf.composeDoc=$S});var xs=S(Jf=>{"use strict";var jS=ue("process"),US=co(),KS=_n(),Cn=xn(),Wf=I(),VS=Gf(),YS=Rt();function On(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function Hf(e){let t="",n=!1,i=!1;for(let r=0;r<e.length;++r){let o=e[r];switch(o[0]){case"#":t+=(t===""?"":i?`
|
|
102
102
|
|
|
103
103
|
`:`
|
|
104
|
-
`)+(o.substring(1)||" "),n=!0,i=!1;break;case"%":e[r+1]?.[0]!=="#"&&(r+=1),n=!1;break;default:n||(i=!0),n=!1}}return{comment:t,afterEmptyLine:i}}var
|
|
105
|
-
${i}`:i;else if(r||t.directives.docStart||!o)t.commentBefore=i;else if(
|
|
104
|
+
`)+(o.substring(1)||" "),n=!0,i=!1;break;case"%":e[r+1]?.[0]!=="#"&&(r+=1),n=!1;break;default:n||(i=!0),n=!1}}return{comment:t,afterEmptyLine:i}}var Es=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,i,r,o)=>{let s=On(n);o?this.warnings.push(new Cn.YAMLWarning(s,i,r)):this.errors.push(new Cn.YAMLParseError(s,i,r))},this.directives=new US.Directives({version:t.version||"1.2"}),this.options=t}decorate(t,n){let{comment:i,afterEmptyLine:r}=Hf(this.prelude);if(i){let o=t.contents;if(n)t.comment=t.comment?`${t.comment}
|
|
105
|
+
${i}`:i;else if(r||t.directives.docStart||!o)t.commentBefore=i;else if(Wf.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];Wf.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${i}
|
|
106
106
|
${a}`:i}else{let s=o.commentBefore;o.commentBefore=s?`${i}
|
|
107
|
-
${s}`:i}}if(n){for(let o=0;o<this.errors.length;++o)t.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)t.warnings.push(this.warnings[o])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:
|
|
108
|
-
${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new Cn.YAMLParseError(On(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let i=Object.assign({_directives:this.directives},this.options),r=new
|
|
107
|
+
${s}`:i}}if(n){for(let o=0;o<this.errors.length;++o)t.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)t.warnings.push(this.warnings[o])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Hf(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,n=!1,i=-1){for(let r of t)yield*this.next(r);yield*this.end(n,i)}*next(t){switch(jS.env.LOG_STREAM&&console.dir(t,{depth:null}),t.type){case"directive":this.directives.add(t.source,(n,i,r)=>{let o=On(t);o[0]+=n,this.onError(o,"BAD_DIRECTIVE",i,r)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let n=VS.composeDoc(this.options,this.directives,t,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{let n=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,i=new Cn.YAMLParseError(On(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(i):this.doc.errors.push(i);break}case"doc-end":{if(!this.doc){let i="Unexpected doc-end without preceding document";this.errors.push(new Cn.YAMLParseError(On(t),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;let n=YS.resolveEnd(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let i=this.doc.comment;this.doc.comment=i?`${i}
|
|
108
|
+
${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new Cn.YAMLParseError(On(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let i=Object.assign({_directives:this.directives},this.options),r=new KS.Document(void 0,i);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),r.range=[0,n,n],this.decorate(r,!1),yield r}}};Jf.Composer=Es});var zf=S(Ji=>{"use strict";var GS=Ss(),WS=As(),HS=xn(),Xf=fn();function JS(e,t=!0,n){if(e){let i=(r,o,s)=>{let a=typeof r=="number"?r:Array.isArray(r)?r[0]:r.offset;if(n)n(a,o,s);else throw new HS.YAMLParseError([a,a+1],o,s)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return WS.resolveFlowScalar(e,t,i);case"block-scalar":return GS.resolveBlockScalar({options:{strict:t}},e,i)}}return null}function XS(e,t){let{implicitKey:n=!1,indent:i,inFlow:r=!1,offset:o=-1,type:s="PLAIN"}=t,a=Xf.stringifyString({type:s,value:e},{implicitKey:n,indent:i>0?" ".repeat(i):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}}),l=t.end??[{type:"newline",offset:-1,indent:i,source:`
|
|
109
109
|
`}];switch(a[0]){case"|":case">":{let c=a.indexOf(`
|
|
110
110
|
`),u=a.substring(0,c),f=a.substring(c+1)+`
|
|
111
|
-
`,d=[{type:"block-scalar-header",offset:o,indent:i,source:u}];return
|
|
112
|
-
`}),{type:"block-scalar",offset:o,indent:i,props:d,source:f}}case'"':return{type:"double-quoted-scalar",offset:o,indent:i,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:o,indent:i,source:a,end:l};default:return{type:"scalar",offset:o,indent:i,source:a,end:l}}}function
|
|
111
|
+
`,d=[{type:"block-scalar-header",offset:o,indent:i,source:u}];return Qf(d,l)||d.push({type:"newline",offset:-1,indent:i,source:`
|
|
112
|
+
`}),{type:"block-scalar",offset:o,indent:i,props:d,source:f}}case'"':return{type:"double-quoted-scalar",offset:o,indent:i,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:o,indent:i,source:a,end:l};default:return{type:"scalar",offset:o,indent:i,source:a,end:l}}}function QS(e,t,n={}){let{afterKey:i=!1,implicitKey:r=!1,inFlow:o=!1,type:s}=n,a="indent"in e?e.indent:null;if(i&&typeof a=="number"&&(a+=2),!s)switch(e.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let c=e.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let l=Xf.stringifyString({type:s,value:t},{implicitKey:r||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":zS(e,l);break;case'"':ks(e,l,"double-quoted-scalar");break;case"'":ks(e,l,"single-quoted-scalar");break;default:ks(e,l,"scalar")}}function zS(e,t){let n=t.indexOf(`
|
|
113
113
|
`),i=t.substring(0,n),r=t.substring(n+1)+`
|
|
114
|
-
`;if(e.type==="block-scalar"){let o=e.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=i,e.source=r}else{let{offset:o}=e,s="indent"in e?e.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:i}];
|
|
115
|
-
`});for(let l of Object.keys(e))l!=="type"&&l!=="offset"&&delete e[l];Object.assign(e,{type:"block-scalar",indent:s,props:a,source:r})}}function
|
|
116
|
-
`};delete e.items,Object.assign(e,{type:n,source:t,end:[r]});break}default:{let i="indent"in e?e.indent:-1,r="end"in e&&Array.isArray(e.end)?e.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(e))o!=="type"&&o!=="offset"&&delete e[o];Object.assign(e,{type:n,indent:i,source:t,end:r})}}}
|
|
114
|
+
`;if(e.type==="block-scalar"){let o=e.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=i,e.source=r}else{let{offset:o}=e,s="indent"in e?e.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:i}];Qf(a,"end"in e?e.end:void 0)||a.push({type:"newline",offset:-1,indent:s,source:`
|
|
115
|
+
`});for(let l of Object.keys(e))l!=="type"&&l!=="offset"&&delete e[l];Object.assign(e,{type:"block-scalar",indent:s,props:a,source:r})}}function Qf(e,t){if(t)for(let n of t)switch(n.type){case"space":case"comment":e.push(n);break;case"newline":return e.push(n),!0}return!1}function ks(e,t,n){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=n,e.source=t;break;case"block-scalar":{let i=e.props.slice(1),r=t.length;e.props[0].type==="block-scalar-header"&&(r-=e.props[0].source.length);for(let o of i)o.offset+=r;delete e.props,Object.assign(e,{type:n,source:t,end:i});break}case"block-map":case"block-seq":{let r={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
|
|
116
|
+
`};delete e.items,Object.assign(e,{type:n,source:t,end:[r]});break}default:{let i="indent"in e?e.indent:-1,r="end"in e&&Array.isArray(e.end)?e.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(e))o!=="type"&&o!=="offset"&&delete e[o];Object.assign(e,{type:n,indent:i,source:t,end:r})}}}Ji.createScalarToken=XS;Ji.resolveAsScalar=JS;Ji.setScalarValue=QS});var ed=S(Zf=>{"use strict";var ZS=e=>"type"in e?Qi(e):Xi(e);function Qi(e){switch(e.type){case"block-scalar":{let t="";for(let n of e.props)t+=Qi(n);return t+e.source}case"block-map":case"block-seq":{let t="";for(let n of e.items)t+=Xi(n);return t}case"flow-collection":{let t=e.start.source;for(let n of e.items)t+=Xi(n);for(let n of e.end)t+=n.source;return t}case"document":{let t=Xi(e);if(e.end)for(let n of e.end)t+=n.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let n of e.end)t+=n.source;return t}}}function Xi({start:e,key:t,sep:n,value:i}){let r="";for(let o of e)r+=o.source;if(t&&(r+=Qi(t)),n)for(let o of n)r+=o.source;return i&&(r+=Qi(i)),r}Zf.stringify=ZS});var rd=S(id=>{"use strict";var Cs=Symbol("break visit"),ev=Symbol("skip children"),td=Symbol("remove item");function ct(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),nd(Object.freeze([]),e,t)}ct.BREAK=Cs;ct.SKIP=ev;ct.REMOVE=td;ct.itemAtPath=(e,t)=>{let n=e;for(let[i,r]of t){let o=n?.[i];if(o&&"items"in o)n=o.items[r];else return}return n};ct.parentCollection=(e,t)=>{let n=ct.itemAtPath(e,t.slice(0,-1)),i=t[t.length-1][0],r=n?.[i];if(r&&"items"in r)return r;throw new Error("Parent collection not found")};function nd(e,t,n){let i=n(t,e);if(typeof i=="symbol")return i;for(let r of["key","value"]){let o=t[r];if(o&&"items"in o){for(let s=0;s<o.items.length;++s){let a=nd(Object.freeze(e.concat([[r,s]])),o.items[s],n);if(typeof a=="number")s=a-1;else{if(a===Cs)return Cs;a===td&&(o.items.splice(s,1),s-=1)}}typeof i=="function"&&r==="key"&&(i=i(t,e))}}return typeof i=="function"?i(t,e):i}id.visit=ct});var zi=S(le=>{"use strict";var Os=zf(),tv=ed(),nv=rd(),Ts="\uFEFF",Is="",Ms="",Ls="",iv=e=>!!e&&"items"in e,rv=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function ov(e){switch(e){case Ts:return"<BOM>";case Is:return"<DOC>";case Ms:return"<FLOW_END>";case Ls:return"<SCALAR>";default:return JSON.stringify(e)}}function sv(e){switch(e){case Ts:return"byte-order-mark";case Is:return"doc-mode";case Ms:return"flow-error-end";case Ls:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
117
117
|
`:case`\r
|
|
118
|
-
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}le.createScalarToken=
|
|
119
|
-
`:case"\r":case" ":return!0;default:return!1}}var
|
|
120
|
-
\r `),
|
|
118
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}le.createScalarToken=Os.createScalarToken;le.resolveAsScalar=Os.resolveAsScalar;le.setScalarValue=Os.setScalarValue;le.stringify=tv.stringify;le.visit=nv.visit;le.BOM=Ts;le.DOCUMENT=Is;le.FLOW_END=Ms;le.SCALAR=Ls;le.isCollection=iv;le.isScalar=rv;le.prettyToken=ov;le.tokenType=sv});var Ps=S(sd=>{"use strict";var Tn=zi();function me(e){switch(e){case void 0:case" ":case`
|
|
119
|
+
`:case"\r":case" ":return!0;default:return!1}}var od=new Set("0123456789ABCDEFabcdef"),av=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Zi=new Set(",[]{}"),lv=new Set(` ,[]{}
|
|
120
|
+
\r `),Ns=e=>!e||lv.has(e),Rs=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,n=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!n;let i=this.next??"stream";for(;i&&(n||this.hasChars(1));)i=yield*this.parseNext(i)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===`
|
|
121
121
|
`?!0:n==="\r"?this.buffer[t+1]===`
|
|
122
122
|
`:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let n=this.buffer[t];if(this.indentNext>0){let i=0;for(;n===" ";)n=this.buffer[++i+t];if(n==="\r"){let r=this.buffer[i+t+1];if(r===`
|
|
123
123
|
`||!r&&!this.atEnd)return t+i+1}return n===`
|
|
124
124
|
`||i>=this.indentNext||!n&&!this.atEnd?t+i:-1}if(n==="-"||n==="."){let i=this.buffer.substr(t,3);if((i==="---"||i==="...")&&me(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
|
|
125
|
-
`,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===Tn.BOM&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let n=t.length,i=t.indexOf("#");for(;i!==-1;){let o=t[i-1];if(o===" "||o===" "){n=i-1;break}else i=t.indexOf("#",i+1)}for(;;){let o=t[n-1];if(o===" "||o===" ")n-=1;else break}let r=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-n),yield*this.pushNewline(),"stream"}return yield Tn.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&me(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!me(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&me(n)){let i=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=i,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let t=this.getLine();if(t===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(t[n]){case"#":yield*this.pushCount(t.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(
|
|
125
|
+
`,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===Tn.BOM&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let n=t.length,i=t.indexOf("#");for(;i!==-1;){let o=t[i-1];if(o===" "||o===" "){n=i-1;break}else i=t.indexOf("#",i+1)}for(;;){let o=t[n-1];if(o===" "||o===" ")n-=1;else break}let r=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-n),yield*this.pushNewline(),"stream"}return yield Tn.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&me(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!me(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&me(n)){let i=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=i,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let t=this.getLine();if(t===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(t[n]){case"#":yield*this.pushCount(t.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Ns),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,n,i=-1;do t=yield*this.pushNewline(),t>0?(n=yield*this.pushSpaces(!1),this.indentValue=i=n):n=0,n+=yield*this.pushSpaces(!0);while(t+n>0);let r=this.getLine();if(r===null)return this.setNext("flow");if((i!==-1&&i<this.indentNext&&r[0]!=="#"||i===0&&(r.startsWith("---")||r.startsWith("..."))&&me(r[3]))&&!(i===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield Tn.FLOW_END,yield*this.parseLineStart();let o=0;for(;r[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),r[o]){case void 0:return"flow";case"#":return yield*this.pushCount(r.length-o),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Ns),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let s=this.charAt(1);if(this.flowKey||me(s)||s===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let t=this.charAt(0),n=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let o=0;for(;this.buffer[n-1-o]==="\\";)o+=1;if(o%2===0)break;n=this.buffer.indexOf('"',n+1)}let i=this.buffer.substring(0,n),r=i.indexOf(`
|
|
126
126
|
`,this.pos);if(r!==-1){for(;r!==-1;){let o=this.continueScalar(r+1);if(o===-1)break;r=i.indexOf(`
|
|
127
127
|
`,o)}r!==-1&&(n=r-(i[r-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){let n=this.buffer[++t];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>me(n)||n==="#")}*parseBlockScalar(){let t=this.pos-1,n=0,i;e:for(let o=this.pos;i=this.buffer[o];++o)switch(i){case" ":n+=1;break;case`
|
|
128
128
|
`:t=o,n=0;break;case"\r":{let s=this.buffer[o+1];if(!s&&!this.atEnd)return this.setNext("block-scalar");if(s===`
|
|
129
129
|
`)break}default:break e}if(!i&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let o=this.continueScalar(t+1);if(o===-1)break;t=this.buffer.indexOf(`
|
|
130
130
|
`,o)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let r=t+1;for(i=this.buffer[r];i===" ";)i=this.buffer[++r];if(i===" "){for(;i===" "||i===" "||i==="\r"||i===`
|
|
131
131
|
`;)i=this.buffer[++r];t=r-1}else if(!this.blockScalarKeep)do{let o=t-1,s=this.buffer[o];s==="\r"&&(s=this.buffer[--o]);let a=o;for(;s===" ";)s=this.buffer[--o];if(s===`
|
|
132
|
-
`&&o>=this.pos&&o+1+n>a)t=o;else break}while(!0);return yield Tn.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,n=this.pos-1,i=this.pos-1,r;for(;r=this.buffer[++i];)if(r===":"){let o=this.buffer[i+1];if(me(o)||t&&
|
|
132
|
+
`&&o>=this.pos&&o+1+n>a)t=o;else break}while(!0);return yield Tn.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,n=this.pos-1,i=this.pos-1,r;for(;r=this.buffer[++i];)if(r===":"){let o=this.buffer[i+1];if(me(o)||t&&Zi.has(o))break;n=i}else if(me(r)){let o=this.buffer[i+1];if(r==="\r"&&(o===`
|
|
133
133
|
`?(i+=1,r=`
|
|
134
|
-
`,o=this.buffer[i+1]):n=i),o==="#"||t&&
|
|
135
|
-
`){let s=this.continueScalar(i+1);if(s===-1)break;i=Math.max(i,s-2)}}else{if(t&&
|
|
134
|
+
`,o=this.buffer[i+1]):n=i),o==="#"||t&&Zi.has(o))break;if(r===`
|
|
135
|
+
`){let s=this.continueScalar(i+1);if(s===-1)break;i=Math.max(i,s-2)}}else{if(t&&Zi.has(r))break;n=i}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield Tn.SCALAR,yield*this.pushToIndex(n+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,n){let i=this.buffer.slice(this.pos,t);return i?(yield i,this.pos+=i.length,i.length):(n&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(Ns),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,i=this.charAt(1);if(me(i)||n&&Zi.has(i)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,n=this.buffer[t];for(;!me(n)&&n!==">";)n=this.buffer[++t];return yield*this.pushToIndex(n===">"?t+1:t,!1)}else{let t=this.pos+1,n=this.buffer[t];for(;n;)if(av.has(n))n=this.buffer[++t];else if(n==="%"&&od.has(this.buffer[t+1])&&od.has(this.buffer[t+2]))n=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){let t=this.buffer[this.pos];return t===`
|
|
136
136
|
`?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===`
|
|
137
|
-
`?yield*this.pushCount(2):0}*pushSpaces(t){let n=this.pos-1,i;do i=this.buffer[++n];while(i===" "||t&&i===" ");let r=n-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=n),r}*pushUntil(t){let n=this.pos,i=this.buffer[n];for(;!t(i);)i=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};
|
|
137
|
+
`?yield*this.pushCount(2):0}*pushSpaces(t){let n=this.pos-1,i;do i=this.buffer[++n];while(i===" "||t&&i===" ");let r=n-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=n),r}*pushUntil(t){let n=this.pos,i=this.buffer[n];for(;!t(i);)i=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};sd.Lexer=Rs});var Fs=S(ad=>{"use strict";var Ds=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,i=this.lineStarts.length;for(;n<i;){let o=n+i>>1;this.lineStarts[o]<t?n=o+1:i=o}if(this.lineStarts[n]===t)return{line:n+1,col:1};if(n===0)return{line:0,col:t};let r=this.lineStarts[n-1];return{line:n,col:t-r+1}}}};ad.LineCounter=Ds});var qs=S(dd=>{"use strict";var cv=ue("process"),ld=zi(),uv=Ps();function Ve(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function cd(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function fd(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function er(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function Pt(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function tr(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function ud(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!Ve(t.start,"explicit-key-ind")&&!Ve(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,fd(t.value)?t.value.end?tr(t.value.end,t.sep):t.value.end=t.sep:tr(t.start,t.sep),delete t.sep)}var Bs=class{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new uv.Lexer,this.onNewLine=t}*parse(t,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let i of this.lexer.lex(t,n))yield*this.next(i);n||(yield*this.end())}*next(t){if(this.source=t,cv.env.LOG_TOKENS&&console.log("|",ld.prettyToken(t)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let n=ld.tokenType(t);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{let i=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:i,source:t}),this.offset+=t.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let t=this.peek(1);if(this.type==="doc-end"&&t?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){let n=t??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let i=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in i?i.indent:0:n.type==="flow-collection"&&i.type==="document"&&(n.indent=0),n.type==="flow-collection"&&ud(n),i.type){case"document":i.value=n;break;case"block-scalar":i.props.push(n);break;case"block-map":{let r=i.items[i.items.length-1];if(r.value){i.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(r.sep)r.value=n;else{Object.assign(r,{key:n,sep:[]}),this.onKeyLine=!r.explicitKey;return}break}case"block-seq":{let r=i.items[i.items.length-1];r.value?i.items.push({start:[],value:n}):r.value=n;break}case"flow-collection":{let r=i.items[i.items.length-1];!r||r.value?i.items.push({start:[],key:n,sep:[]}):r.sep?r.value=n:Object.assign(r,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((i.type==="document"||i.type==="block-map"||i.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let r=n.items[n.items.length-1];r&&!r.sep&&!r.value&&r.start.length>0&&cd(r.start)===-1&&(n.indent===0||r.start.every(o=>o.type!=="comment"||o.indent<n.indent))&&(i.type==="document"?i.end=r.start:i.items.push({start:r.start}),n.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{cd(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}let n=this.startBlockValue(t);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){let n=er(this.peek(2)),i=Pt(n),r;t.end?(r=t.end,r.push(this.sourceToken),delete t.end):r=[this.sourceToken];let o={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:i,key:t,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
|
|
138
138
|
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
139
|
-
`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let i="end"in n.value?n.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,t.indent)){let r=t.items[t.items.length-2]?.value?.end;if(Array.isArray(r)){
|
|
139
|
+
`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let i="end"in n.value?n.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,t.indent)){let r=t.items[t.items.length-2]?.value?.end;if(Array.isArray(r)){tr(r,n.start),r.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let i=!this.onKeyLine&&this.indent===t.indent,r=i&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",o=[];if(r&&n.sep&&!n.value){let s=[];for(let a=0;a<n.sep.length;++a){let l=n.sep[a];switch(l.type){case"newline":s.push(a);break;case"space":break;case"comment":l.indent>t.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=n.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":r||n.value?(o.push(this.sourceToken),t.items.push({start:o}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):r||n.value?(o.push(this.sourceToken),t.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ve(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(fd(n.key)&&!Ve(n.sep,"newline")){let s=Pt(n.start),a=n.key,l=n.sep;l.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:l}]})}else o.length>0?n.sep=n.sep.concat(o,this.sourceToken):n.sep.push(this.sourceToken);else if(Ve(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let s=Pt(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||r?t.items.push({start:o,key:null,sep:[this.sourceToken]}):Ve(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);r||n.value?(t.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(s):(Object.assign(n,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(t);if(s){if(s.type==="block-seq"){if(!n.explicitKey&&n.sep&&!Ve(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else i&&t.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){let i="end"in n.value?n.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,t.indent)){let r=t.items[t.items.length-2]?.value?.end;if(Array.isArray(r)){tr(r,n.start),r.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=t.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;n.value||Ve(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){let i=this.startBlockValue(t);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let n=t.items[t.items.length-1];if(this.type==="flow-error-end"){let i;do yield*this.pop(),i=this.peek(1);while(i?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?t.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let r=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:r,sep:[]}):n.sep?this.stack.push(r):Object.assign(n,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}let i=this.startBlockValue(t);i?this.stack.push(i):(yield*this.pop(),yield*this.step())}else{let i=this.peek(2);if(i.type==="block-map"&&(this.type==="map-value-ind"&&i.indent===t.indent||this.type==="newline"&&!i.items[i.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&i.type!=="flow-collection"){let r=er(i),o=Pt(r);ud(t);let s=t.end.splice(1,t.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:o,key:t,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let n=this.source.indexOf(`
|
|
140
140
|
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
141
|
-
`,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=
|
|
141
|
+
`,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=er(t),i=Pt(n);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=er(t),i=Pt(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(i=>i.type==="newline"||i.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};dd.Parser=Bs});var gd=S(Mn=>{"use strict";var pd=xs(),fv=_n(),In=xn(),dv=wo(),pv=I(),mv=Fs(),md=qs();function hd(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new mv.LineCounter||null,prettyErrors:t}}function hv(e,t={}){let{lineCounter:n,prettyErrors:i}=hd(t),r=new md.Parser(n?.addNewLine),o=new pd.Composer(t),s=Array.from(o.compose(r.parse(e)));if(i&&n)for(let a of s)a.errors.forEach(In.prettifyError(e,n)),a.warnings.forEach(In.prettifyError(e,n));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function yd(e,t={}){let{lineCounter:n,prettyErrors:i}=hd(t),r=new md.Parser(n?.addNewLine),o=new pd.Composer(t),s=null;for(let a of o.compose(r.parse(e),!0,e.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new In.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&n&&(s.errors.forEach(In.prettifyError(e,n)),s.warnings.forEach(In.prettifyError(e,n))),s}function yv(e,t,n){let i;typeof t=="function"?i=t:n===void 0&&t&&typeof t=="object"&&(n=t);let r=yd(e,n);if(!r)return null;if(r.warnings.forEach(o=>dv.warn(r.options.logLevel,o)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:i},n))}function gv(e,t,n){let i=null;if(typeof t=="function"||Array.isArray(t)?i=t:n===void 0&&t&&(n=t),typeof n=="string"&&(n=n.length),typeof n=="number"){let r=Math.round(n);n=r<1?void 0:r>8?{indent:8}:{indent:r}}if(e===void 0){let{keepUndefined:r}=n??t??{};if(!r)return}return pv.isDocument(e)&&!i?e.toString(n):new fv.Document(e,i,n).toString(n)}Mn.parse=yv;Mn.parseAllDocuments=hv;Mn.parseDocument=yd;Mn.stringify=gv});var Sd=S(L=>{"use strict";var bv=xs(),Sv=_n(),vv=os(),$s=xn(),Av=sn(),Ye=I(),_v=$e(),wv=U(),Ev=Ue(),xv=Ke(),kv=zi(),Cv=Ps(),Ov=Fs(),Tv=qs(),nr=gd(),bd=tn();L.Composer=bv.Composer;L.Document=Sv.Document;L.Schema=vv.Schema;L.YAMLError=$s.YAMLError;L.YAMLParseError=$s.YAMLParseError;L.YAMLWarning=$s.YAMLWarning;L.Alias=Av.Alias;L.isAlias=Ye.isAlias;L.isCollection=Ye.isCollection;L.isDocument=Ye.isDocument;L.isMap=Ye.isMap;L.isNode=Ye.isNode;L.isPair=Ye.isPair;L.isScalar=Ye.isScalar;L.isSeq=Ye.isSeq;L.Pair=_v.Pair;L.Scalar=wv.Scalar;L.YAMLMap=Ev.YAMLMap;L.YAMLSeq=xv.YAMLSeq;L.CST=kv;L.Lexer=Cv.Lexer;L.LineCounter=Ov.LineCounter;L.Parser=Tv.Parser;L.parse=nr.parse;L.parseAllDocuments=nr.parseAllDocuments;L.parseDocument=nr.parseDocument;L.stringify=nr.stringify;L.visit=bd.visit;L.visitAsync=bd.visitAsync});function Va(e){return!1}function gw(e){return e.replace(/^#{2,4} MCP\/App citation examples\r?\n\r?\n```\r?\n[\s\S]*?^```\r?\n\s*/gm,t=>t.includes("#mavis-source=")?"":t).replace(/^#{2,4} Citations\r?\n(?:[ \t]*\r?\n)*Cite every used result where it supports the answer\.[\s\S]*?^Do not cite unused calls or unsupported claims, invent metadata, output bare parenthesized links, or add trailing source\/reference lists\.\r?\n*/gm,t=>t.includes("Citation candidate")?"":t)}function bw(e){let n=["- Independent tool calls can run in parallel in one response.","- Issue independent tool calls together when safe. Run dependent calls or conflicting writes sequentially, and follow each tool's concurrency restrictions."].find(u=>e.includes(u));if(!n)return e;let i="- Reference code as `file_path:line_number` \u2014 it's clickable.",r="- Reference code as `file_path:line_number` so it is clickable. Place references near the relevant claim; group them only when there are many files.",o=["- Cite sources where they support the answer, using exact source URLs or supplied links.","- Place references near the relevant claim; group them only when there are many files.","- Cite only sources you used; do not invent sources or links."].join(`
|
|
142
142
|
`),a=["- When referencing code, use `file_path:line_number` format.","- When citing one or two files, place one or two `file_path:line_number` references in the relevant conclusion sentence. Use a separate evidence list only when there are many references.",i,"- Reference code as `file_path:line_number` \u2014 it's clickable in the TUI."].reduce((u,f)=>u.replaceAll(`${f}\r
|
|
143
143
|
`,"").replaceAll(`${f}
|
|
144
144
|
`,""),e.replace(r,"- Place references near the relevant claim; group them only when there are many files.")).replace(n,`${n}
|
|
@@ -153,41 +153,41 @@ ${o}
|
|
|
153
153
|
${u}`):`${a.trimEnd()}
|
|
154
154
|
|
|
155
155
|
## References
|
|
156
|
-
${o}`}function
|
|
156
|
+
${o}`}function om(e,t=process.env){return Va({platform:e,internalBuild:t.__MAVIS_BUILD_INTERNAL==="true",insideBuild:t.__MAVIS_BUILD_INSIDE==="true"})}import{randomBytes as eg}from"node:crypto";import{promises as Pe}from"node:fs";import{dirname as tg,join as xc}from"node:path";function sl(e){return typeof e>"u"||e===null}function sm(e){return typeof e=="object"&&e!==null}function am(e){return Array.isArray(e)?e:sl(e)?[]:[e]}function lm(e,t){var n,i,r,o;if(t)for(o=Object.keys(t),n=0,i=o.length;n<i;n+=1)r=o[n],e[r]=t[r];return e}function cm(e,t){var n="",i;for(i=0;i<t;i+=1)n+=e;return n}function um(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var fm=sl,dm=sm,pm=am,mm=cm,hm=um,ym=lm,K={isNothing:fm,isObject:dm,toArray:pm,repeat:mm,isNegativeZero:hm,extend:ym};function al(e,t){var n="",i=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(n+=`
|
|
157
157
|
|
|
158
|
-
`+e.mark.snippet),i+" "+n):i}function Ht(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=
|
|
159
|
-
`+a;for(c=
|
|
158
|
+
`+e.mark.snippet),i+" "+n):i}function Ht(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=al(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Ht.prototype=Object.create(Error.prototype);Ht.prototype.constructor=Ht;Ht.prototype.toString=function(t){return this.name+": "+al(this,t)};var ie=Ht;function Ir(e,t,n,i,r){var o="",s="",a=Math.floor(r/2)-1;return i-t>a&&(o=" ... ",t=i-a+o.length),n-i>a&&(s=" ...",n=i+a-s.length),{str:o+e.slice(t,n).replace(/\t/g,"\u2192")+s,pos:i-t+o.length}}function Mr(e,t){return K.repeat(" ",t-e.length)+e}function gm(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var n=/\r?\n|\r|\0/g,i=[0],r=[],o,s=-1;o=n.exec(e.buffer);)r.push(o.index),i.push(o.index+o[0].length),e.position<=o.index&&s<0&&(s=i.length-2);s<0&&(s=i.length-1);var a="",l,c,u=Math.min(e.line+t.linesAfter,r.length).toString().length,f=t.maxLength-(t.indent+u+3);for(l=1;l<=t.linesBefore&&!(s-l<0);l++)c=Ir(e.buffer,i[s-l],r[s-l],e.position-(i[s]-i[s-l]),f),a=K.repeat(" ",t.indent)+Mr((e.line-l+1).toString(),u)+" | "+c.str+`
|
|
159
|
+
`+a;for(c=Ir(e.buffer,i[s],r[s],e.position,f),a+=K.repeat(" ",t.indent)+Mr((e.line+1).toString(),u)+" | "+c.str+`
|
|
160
160
|
`,a+=K.repeat("-",t.indent+u+3+c.pos)+`^
|
|
161
|
-
`,l=1;l<=t.linesAfter&&!(s+l>=r.length);l++)c=
|
|
162
|
-
`;return a.replace(/\n$/,"")}var
|
|
163
|
-
\r`;function
|
|
164
|
-
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"\x85":e===95?"\xA0":e===76?"\u2028":e===80?"\u2029":""}function
|
|
165
|
-
`,t-1))}function
|
|
161
|
+
`,l=1;l<=t.linesAfter&&!(s+l>=r.length);l++)c=Ir(e.buffer,i[s+l],r[s+l],e.position-(i[s]-i[s+l]),f),a+=K.repeat(" ",t.indent)+Mr((e.line+l+1).toString(),u)+" | "+c.str+`
|
|
162
|
+
`;return a.replace(/\n$/,"")}var bm=gm,Sm=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],vm=["scalar","sequence","mapping"];function Am(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(i){t[String(i)]=n})}),t}function _m(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(Sm.indexOf(n)===-1)throw new ie('Unknown option "'+n+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(n){return n},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=Am(t.styleAliases||null),vm.indexOf(this.kind)===-1)throw new ie('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var z=_m;function Ya(e,t){var n=[];return e[t].forEach(function(i){var r=n.length;n.forEach(function(o,s){o.tag===i.tag&&o.kind===i.kind&&o.multi===i.multi&&(r=s)}),n[r]=i}),n}function wm(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,n;function i(r){r.multi?(e.multi[r.kind].push(r),e.multi.fallback.push(r)):e[r.kind][r.tag]=e.fallback[r.tag]=r}for(t=0,n=arguments.length;t<n;t+=1)arguments[t].forEach(i);return e}function Nr(e){return this.extend(e)}Nr.prototype.extend=function(t){var n=[],i=[];if(t instanceof z)i.push(t);else if(Array.isArray(t))i=i.concat(t);else if(t&&(Array.isArray(t.implicit)||Array.isArray(t.explicit)))t.implicit&&(n=n.concat(t.implicit)),t.explicit&&(i=i.concat(t.explicit));else throw new ie("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(o){if(!(o instanceof z))throw new ie("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(o.loadKind&&o.loadKind!=="scalar")throw new ie("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(o.multi)throw new ie("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),i.forEach(function(o){if(!(o instanceof z))throw new ie("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var r=Object.create(Nr.prototype);return r.implicit=(this.implicit||[]).concat(n),r.explicit=(this.explicit||[]).concat(i),r.compiledImplicit=Ya(r,"implicit"),r.compiledExplicit=Ya(r,"explicit"),r.compiledTypeMap=wm(r.compiledImplicit,r.compiledExplicit),r};var ll=Nr,cl=new z("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),ul=new z("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),fl=new z("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),dl=new ll({explicit:[cl,ul,fl]});function Em(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function xm(){return null}function km(e){return e===null}var pl=new z("tag:yaml.org,2002:null",{kind:"scalar",resolve:Em,construct:xm,predicate:km,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function Cm(e){if(e===null)return!1;var t=e.length;return t===4&&(e==="true"||e==="True"||e==="TRUE")||t===5&&(e==="false"||e==="False"||e==="FALSE")}function Om(e){return e==="true"||e==="True"||e==="TRUE"}function Tm(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var ml=new z("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Cm,construct:Om,predicate:Tm,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function Im(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function Mm(e){return 48<=e&&e<=55}function Lm(e){return 48<=e&&e<=57}function Nm(e){if(e===null)return!1;var t=e.length,n=0,i=!1,r;if(!t)return!1;if(r=e[n],(r==="-"||r==="+")&&(r=e[++n]),r==="0"){if(n+1===t)return!0;if(r=e[++n],r==="b"){for(n++;n<t;n++)if(r=e[n],r!=="_"){if(r!=="0"&&r!=="1")return!1;i=!0}return i&&r!=="_"}if(r==="x"){for(n++;n<t;n++)if(r=e[n],r!=="_"){if(!Im(e.charCodeAt(n)))return!1;i=!0}return i&&r!=="_"}if(r==="o"){for(n++;n<t;n++)if(r=e[n],r!=="_"){if(!Mm(e.charCodeAt(n)))return!1;i=!0}return i&&r!=="_"}}if(r==="_")return!1;for(;n<t;n++)if(r=e[n],r!=="_"){if(!Lm(e.charCodeAt(n)))return!1;i=!0}return!(!i||r==="_")}function Rm(e){var t=e,n=1,i;if(t.indexOf("_")!==-1&&(t=t.replace(/_/g,"")),i=t[0],(i==="-"||i==="+")&&(i==="-"&&(n=-1),t=t.slice(1),i=t[0]),t==="0")return 0;if(i==="0"){if(t[1]==="b")return n*parseInt(t.slice(2),2);if(t[1]==="x")return n*parseInt(t.slice(2),16);if(t[1]==="o")return n*parseInt(t.slice(2),8)}return n*parseInt(t,10)}function Pm(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!K.isNegativeZero(e)}var hl=new z("tag:yaml.org,2002:int",{kind:"scalar",resolve:Nm,construct:Rm,predicate:Pm,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Dm=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Fm(e){return!(e===null||!Dm.test(e)||e[e.length-1]==="_")}function Bm(e){var t,n;return t=e.replace(/_/g,"").toLowerCase(),n=t[0]==="-"?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),t===".inf"?n===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:t===".nan"?NaN:n*parseFloat(t,10)}var qm=/^[-+]?[0-9]+e/;function $m(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(K.isNegativeZero(e))return"-0.0";return n=e.toString(10),qm.test(n)?n.replace("e",".e"):n}function jm(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||K.isNegativeZero(e))}var yl=new z("tag:yaml.org,2002:float",{kind:"scalar",resolve:Fm,construct:Bm,predicate:jm,represent:$m,defaultStyle:"lowercase"}),gl=dl.extend({implicit:[pl,ml,hl,yl]}),bl=gl,Sl=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),vl=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function Um(e){return e===null?!1:Sl.exec(e)!==null||vl.exec(e)!==null}function Km(e){var t,n,i,r,o,s,a,l=0,c=null,u,f,d;if(t=Sl.exec(e),t===null&&(t=vl.exec(e)),t===null)throw new Error("Date resolve error");if(n=+t[1],i=+t[2]-1,r=+t[3],!t[4])return new Date(Date.UTC(n,i,r));if(o=+t[4],s=+t[5],a=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(u=+t[10],f=+(t[11]||0),c=(u*60+f)*6e4,t[9]==="-"&&(c=-c)),d=new Date(Date.UTC(n,i,r,o,s,a,l)),c&&d.setTime(d.getTime()-c),d}function Vm(e){return e.toISOString()}var Al=new z("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:Um,construct:Km,instanceOf:Date,represent:Vm});function Ym(e){return e==="<<"||e===null}var _l=new z("tag:yaml.org,2002:merge",{kind:"scalar",resolve:Ym}),Br=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
163
|
+
\r`;function Gm(e){if(e===null)return!1;var t,n,i=0,r=e.length,o=Br;for(n=0;n<r;n++)if(t=o.indexOf(e.charAt(n)),!(t>64)){if(t<0)return!1;i+=6}return i%8===0}function Wm(e){var t,n,i=e.replace(/[\r\n=]/g,""),r=i.length,o=Br,s=0,a=[];for(t=0;t<r;t++)t%4===0&&t&&(a.push(s>>16&255),a.push(s>>8&255),a.push(s&255)),s=s<<6|o.indexOf(i.charAt(t));return n=r%4*6,n===0?(a.push(s>>16&255),a.push(s>>8&255),a.push(s&255)):n===18?(a.push(s>>10&255),a.push(s>>2&255)):n===12&&a.push(s>>4&255),new Uint8Array(a)}function Hm(e){var t="",n=0,i,r,o=e.length,s=Br;for(i=0;i<o;i++)i%3===0&&i&&(t+=s[n>>18&63],t+=s[n>>12&63],t+=s[n>>6&63],t+=s[n&63]),n=(n<<8)+e[i];return r=o%3,r===0?(t+=s[n>>18&63],t+=s[n>>12&63],t+=s[n>>6&63],t+=s[n&63]):r===2?(t+=s[n>>10&63],t+=s[n>>4&63],t+=s[n<<2&63],t+=s[64]):r===1&&(t+=s[n>>2&63],t+=s[n<<4&63],t+=s[64],t+=s[64]),t}function Jm(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var wl=new z("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Gm,construct:Wm,predicate:Jm,represent:Hm}),Xm=Object.prototype.hasOwnProperty,Qm=Object.prototype.toString;function zm(e){if(e===null)return!0;var t=[],n,i,r,o,s,a=e;for(n=0,i=a.length;n<i;n+=1){if(r=a[n],s=!1,Qm.call(r)!=="[object Object]")return!1;for(o in r)if(Xm.call(r,o))if(!s)s=!0;else return!1;if(!s)return!1;if(t.indexOf(o)===-1)t.push(o);else return!1}return!0}function Zm(e){return e!==null?e:[]}var El=new z("tag:yaml.org,2002:omap",{kind:"sequence",resolve:zm,construct:Zm}),eh=Object.prototype.toString;function th(e){if(e===null)return!0;var t,n,i,r,o,s=e;for(o=new Array(s.length),t=0,n=s.length;t<n;t+=1){if(i=s[t],eh.call(i)!=="[object Object]"||(r=Object.keys(i),r.length!==1))return!1;o[t]=[r[0],i[r[0]]]}return!0}function nh(e){if(e===null)return[];var t,n,i,r,o,s=e;for(o=new Array(s.length),t=0,n=s.length;t<n;t+=1)i=s[t],r=Object.keys(i),o[t]=[r[0],i[r[0]]];return o}var xl=new z("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:th,construct:nh}),ih=Object.prototype.hasOwnProperty;function rh(e){if(e===null)return!0;var t,n=e;for(t in n)if(ih.call(n,t)&&n[t]!==null)return!1;return!0}function oh(e){return e!==null?e:{}}var kl=new z("tag:yaml.org,2002:set",{kind:"mapping",resolve:rh,construct:oh}),qr=bl.extend({implicit:[Al,_l],explicit:[wl,El,xl,kl]}),Le=Object.prototype.hasOwnProperty,Un=1,Cl=2,Ol=3,Kn=4,Lr=1,sh=2,Ga=3,ah=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,lh=/[\x85\u2028\u2029]/,ch=/[,\[\]\{\}]/,Tl=/^(?:!|!!|![a-z\-]+!)$/i,Il=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Wa(e){return Object.prototype.toString.call(e)}function ge(e){return e===10||e===13}function ze(e){return e===9||e===32}function se(e){return e===9||e===32||e===10||e===13}function ht(e){return e===44||e===91||e===93||e===123||e===125}function uh(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function fh(e){return e===120?2:e===117?4:e===85?8:0}function dh(e){return 48<=e&&e<=57?e-48:-1}function Ha(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
|
|
164
|
+
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"\x85":e===95?"\xA0":e===76?"\u2028":e===80?"\u2029":""}function ph(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function Ml(e,t,n){t==="__proto__"?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[t]=n}var Ll=new Array(256),Nl=new Array(256);for(Qe=0;Qe<256;Qe++)Ll[Qe]=Ha(Qe)?1:0,Nl[Qe]=Ha(Qe);var Qe;function mh(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||qr,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function Rl(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=bm(n),new ie(t,n)}function w(e,t){throw Rl(e,t)}function Vn(e,t){e.onWarning&&e.onWarning.call(null,Rl(e,t))}var Ja={YAML:function(t,n,i){var r,o,s;t.version!==null&&w(t,"duplication of %YAML directive"),i.length!==1&&w(t,"YAML directive accepts exactly one argument"),r=/^([0-9]+)\.([0-9]+)$/.exec(i[0]),r===null&&w(t,"ill-formed argument of the YAML directive"),o=parseInt(r[1],10),s=parseInt(r[2],10),o!==1&&w(t,"unacceptable YAML version of the document"),t.version=i[0],t.checkLineBreaks=s<2,s!==1&&s!==2&&Vn(t,"unsupported YAML version of the document")},TAG:function(t,n,i){var r,o;i.length!==2&&w(t,"TAG directive accepts exactly two arguments"),r=i[0],o=i[1],Tl.test(r)||w(t,"ill-formed tag handle (first argument) of the TAG directive"),Le.call(t.tagMap,r)&&w(t,'there is a previously declared suffix for "'+r+'" tag handle'),Il.test(o)||w(t,"ill-formed tag prefix (second argument) of the TAG directive");try{o=decodeURIComponent(o)}catch{w(t,"tag prefix is malformed: "+o)}t.tagMap[r]=o}};function Me(e,t,n,i){var r,o,s,a;if(t<n){if(a=e.input.slice(t,n),i)for(r=0,o=a.length;r<o;r+=1)s=a.charCodeAt(r),s===9||32<=s&&s<=1114111||w(e,"expected valid JSON character");else ah.test(a)&&w(e,"the stream contains non-printable characters");e.result+=a}}function Xa(e,t,n,i){var r,o,s,a;for(K.isObject(n)||w(e,"cannot merge mappings; the provided source object is unacceptable"),r=Object.keys(n),s=0,a=r.length;s<a;s+=1)o=r[s],Le.call(t,o)||(Ml(t,o,n[o]),i[o]=!0)}function yt(e,t,n,i,r,o,s,a,l){var c,u;if(Array.isArray(r))for(r=Array.prototype.slice.call(r),c=0,u=r.length;c<u;c+=1)Array.isArray(r[c])&&w(e,"nested arrays are not supported inside keys"),typeof r=="object"&&Wa(r[c])==="[object Object]"&&(r[c]="[object Object]");if(typeof r=="object"&&Wa(r)==="[object Object]"&&(r="[object Object]"),r=String(r),t===null&&(t={}),i==="tag:yaml.org,2002:merge")if(Array.isArray(o))for(c=0,u=o.length;c<u;c+=1)Xa(e,t,o[c],n);else Xa(e,t,o,n);else!e.json&&!Le.call(n,r)&&Le.call(t,r)&&(e.line=s||e.line,e.lineStart=a||e.lineStart,e.position=l||e.position,w(e,"duplicated mapping key")),Ml(t,r,o),delete n[r];return t}function $r(e){var t;t=e.input.charCodeAt(e.position),t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):w(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function j(e,t,n){for(var i=0,r=e.input.charCodeAt(e.position);r!==0;){for(;ze(r);)r===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),r=e.input.charCodeAt(++e.position);if(t&&r===35)do r=e.input.charCodeAt(++e.position);while(r!==10&&r!==13&&r!==0);if(ge(r))for($r(e),r=e.input.charCodeAt(e.position),i++,e.lineIndent=0;r===32;)e.lineIndent++,r=e.input.charCodeAt(++e.position);else break}return n!==-1&&i!==0&&e.lineIndent<n&&Vn(e,"deficient indentation"),i}function Wn(e){var t=e.position,n;return n=e.input.charCodeAt(t),!!((n===45||n===46)&&n===e.input.charCodeAt(t+1)&&n===e.input.charCodeAt(t+2)&&(t+=3,n=e.input.charCodeAt(t),n===0||se(n)))}function jr(e,t){t===1?e.result+=" ":t>1&&(e.result+=K.repeat(`
|
|
165
|
+
`,t-1))}function hh(e,t,n){var i,r,o,s,a,l,c,u,f=e.kind,d=e.result,p;if(p=e.input.charCodeAt(e.position),se(p)||ht(p)||p===35||p===38||p===42||p===33||p===124||p===62||p===39||p===34||p===37||p===64||p===96||(p===63||p===45)&&(r=e.input.charCodeAt(e.position+1),se(r)||n&&ht(r)))return!1;for(e.kind="scalar",e.result="",o=s=e.position,a=!1;p!==0;){if(p===58){if(r=e.input.charCodeAt(e.position+1),se(r)||n&&ht(r))break}else if(p===35){if(i=e.input.charCodeAt(e.position-1),se(i))break}else{if(e.position===e.lineStart&&Wn(e)||n&&ht(p))break;if(ge(p))if(l=e.line,c=e.lineStart,u=e.lineIndent,j(e,!1,-1),e.lineIndent>=t){a=!0,p=e.input.charCodeAt(e.position);continue}else{e.position=s,e.line=l,e.lineStart=c,e.lineIndent=u;break}}a&&(Me(e,o,s,!1),jr(e,e.line-l),o=s=e.position,a=!1),ze(p)||(s=e.position+1),p=e.input.charCodeAt(++e.position)}return Me(e,o,s,!1),e.result?!0:(e.kind=f,e.result=d,!1)}function yh(e,t){var n,i,r;if(n=e.input.charCodeAt(e.position),n!==39)return!1;for(e.kind="scalar",e.result="",e.position++,i=r=e.position;(n=e.input.charCodeAt(e.position))!==0;)if(n===39)if(Me(e,i,e.position,!0),n=e.input.charCodeAt(++e.position),n===39)i=e.position,e.position++,r=e.position;else return!0;else ge(n)?(Me(e,i,r,!0),jr(e,j(e,!1,t)),i=r=e.position):e.position===e.lineStart&&Wn(e)?w(e,"unexpected end of the document within a single quoted scalar"):(e.position++,r=e.position);w(e,"unexpected end of the stream within a single quoted scalar")}function gh(e,t){var n,i,r,o,s,a;if(a=e.input.charCodeAt(e.position),a!==34)return!1;for(e.kind="scalar",e.result="",e.position++,n=i=e.position;(a=e.input.charCodeAt(e.position))!==0;){if(a===34)return Me(e,n,e.position,!0),e.position++,!0;if(a===92){if(Me(e,n,e.position,!0),a=e.input.charCodeAt(++e.position),ge(a))j(e,!1,t);else if(a<256&&Ll[a])e.result+=Nl[a],e.position++;else if((s=fh(a))>0){for(r=s,o=0;r>0;r--)a=e.input.charCodeAt(++e.position),(s=uh(a))>=0?o=(o<<4)+s:w(e,"expected hexadecimal character");e.result+=ph(o),e.position++}else w(e,"unknown escape sequence");n=i=e.position}else ge(a)?(Me(e,n,i,!0),jr(e,j(e,!1,t)),n=i=e.position):e.position===e.lineStart&&Wn(e)?w(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}w(e,"unexpected end of the stream within a double quoted scalar")}function bh(e,t){var n=!0,i,r,o,s=e.tag,a,l=e.anchor,c,u,f,d,p,h=Object.create(null),m,y,g,b;if(b=e.input.charCodeAt(e.position),b===91)u=93,p=!1,a=[];else if(b===123)u=125,p=!0,a={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=a),b=e.input.charCodeAt(++e.position);b!==0;){if(j(e,!0,t),b=e.input.charCodeAt(e.position),b===u)return e.position++,e.tag=s,e.anchor=l,e.kind=p?"mapping":"sequence",e.result=a,!0;n?b===44&&w(e,"expected the node content, but found ','"):w(e,"missed comma between flow collection entries"),y=m=g=null,f=d=!1,b===63&&(c=e.input.charCodeAt(e.position+1),se(c)&&(f=d=!0,e.position++,j(e,!0,t))),i=e.line,r=e.lineStart,o=e.position,gt(e,t,Un,!1,!0),y=e.tag,m=e.result,j(e,!0,t),b=e.input.charCodeAt(e.position),(d||e.line===i)&&b===58&&(f=!0,b=e.input.charCodeAt(++e.position),j(e,!0,t),gt(e,t,Un,!1,!0),g=e.result),p?yt(e,a,h,y,m,g,i,r,o):f?a.push(yt(e,null,h,y,m,g,i,r,o)):a.push(m),j(e,!0,t),b=e.input.charCodeAt(e.position),b===44?(n=!0,b=e.input.charCodeAt(++e.position)):n=!1}w(e,"unexpected end of the stream within a flow collection")}function Sh(e,t){var n,i,r=Lr,o=!1,s=!1,a=t,l=0,c=!1,u,f;if(f=e.input.charCodeAt(e.position),f===124)i=!1;else if(f===62)i=!0;else return!1;for(e.kind="scalar",e.result="";f!==0;)if(f=e.input.charCodeAt(++e.position),f===43||f===45)Lr===r?r=f===43?Ga:sh:w(e,"repeat of a chomping mode identifier");else if((u=dh(f))>=0)u===0?w(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?w(e,"repeat of an indentation width identifier"):(a=t+u-1,s=!0);else break;if(ze(f)){do f=e.input.charCodeAt(++e.position);while(ze(f));if(f===35)do f=e.input.charCodeAt(++e.position);while(!ge(f)&&f!==0)}for(;f!==0;){for($r(e),e.lineIndent=0,f=e.input.charCodeAt(e.position);(!s||e.lineIndent<a)&&f===32;)e.lineIndent++,f=e.input.charCodeAt(++e.position);if(!s&&e.lineIndent>a&&(a=e.lineIndent),ge(f)){l++;continue}if(e.lineIndent<a){r===Ga?e.result+=K.repeat(`
|
|
166
166
|
`,o?1+l:l):r===Lr&&o&&(e.result+=`
|
|
167
167
|
`);break}for(i?ze(f)?(c=!0,e.result+=K.repeat(`
|
|
168
168
|
`,o?1+l:l)):c?(c=!1,e.result+=K.repeat(`
|
|
169
169
|
`,l+1)):l===0?o&&(e.result+=" "):e.result+=K.repeat(`
|
|
170
170
|
`,l):e.result+=K.repeat(`
|
|
171
|
-
`,o?1+l:l),o=!0,s=!0,l=0,n=e.position;!ge(f)&&f!==0;)f=e.input.charCodeAt(++e.position);
|
|
172
|
-
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var n=new
|
|
171
|
+
`,o?1+l:l),o=!0,s=!0,l=0,n=e.position;!ge(f)&&f!==0;)f=e.input.charCodeAt(++e.position);Me(e,n,e.position,!1)}return!0}function Qa(e,t){var n,i=e.tag,r=e.anchor,o=[],s,a=!1,l;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=o),l=e.input.charCodeAt(e.position);l!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,w(e,"tab characters must not be used in indentation")),!(l!==45||(s=e.input.charCodeAt(e.position+1),!se(s))));){if(a=!0,e.position++,j(e,!0,-1)&&e.lineIndent<=t){o.push(null),l=e.input.charCodeAt(e.position);continue}if(n=e.line,gt(e,t,Ol,!1,!0),o.push(e.result),j(e,!0,-1),l=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&l!==0)w(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return a?(e.tag=i,e.anchor=r,e.kind="sequence",e.result=o,!0):!1}function vh(e,t,n){var i,r,o,s,a,l,c=e.tag,u=e.anchor,f={},d=Object.create(null),p=null,h=null,m=null,y=!1,g=!1,b;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=f),b=e.input.charCodeAt(e.position);b!==0;){if(!y&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,w(e,"tab characters must not be used in indentation")),i=e.input.charCodeAt(e.position+1),o=e.line,(b===63||b===58)&&se(i))b===63?(y&&(yt(e,f,d,p,h,null,s,a,l),p=h=m=null),g=!0,y=!0,r=!0):y?(y=!1,r=!0):w(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,b=i;else{if(s=e.line,a=e.lineStart,l=e.position,!gt(e,n,Cl,!1,!0))break;if(e.line===o){for(b=e.input.charCodeAt(e.position);ze(b);)b=e.input.charCodeAt(++e.position);if(b===58)b=e.input.charCodeAt(++e.position),se(b)||w(e,"a whitespace character is expected after the key-value separator within a block mapping"),y&&(yt(e,f,d,p,h,null,s,a,l),p=h=m=null),g=!0,y=!1,r=!1,p=e.tag,h=e.result;else if(g)w(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=c,e.anchor=u,!0}else if(g)w(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=c,e.anchor=u,!0}if((e.line===o||e.lineIndent>t)&&(y&&(s=e.line,a=e.lineStart,l=e.position),gt(e,t,Kn,!0,r)&&(y?h=e.result:m=e.result),y||(yt(e,f,d,p,h,m,s,a,l),p=h=m=null),j(e,!0,-1),b=e.input.charCodeAt(e.position)),(e.line===o||e.lineIndent>t)&&b!==0)w(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return y&&yt(e,f,d,p,h,null,s,a,l),g&&(e.tag=c,e.anchor=u,e.kind="mapping",e.result=f),g}function Ah(e){var t,n=!1,i=!1,r,o,s;if(s=e.input.charCodeAt(e.position),s!==33)return!1;if(e.tag!==null&&w(e,"duplication of a tag property"),s=e.input.charCodeAt(++e.position),s===60?(n=!0,s=e.input.charCodeAt(++e.position)):s===33?(i=!0,r="!!",s=e.input.charCodeAt(++e.position)):r="!",t=e.position,n){do s=e.input.charCodeAt(++e.position);while(s!==0&&s!==62);e.position<e.length?(o=e.input.slice(t,e.position),s=e.input.charCodeAt(++e.position)):w(e,"unexpected end of the stream within a verbatim tag")}else{for(;s!==0&&!se(s);)s===33&&(i?w(e,"tag suffix cannot contain exclamation marks"):(r=e.input.slice(t-1,e.position+1),Tl.test(r)||w(e,"named tag handle cannot contain such characters"),i=!0,t=e.position+1)),s=e.input.charCodeAt(++e.position);o=e.input.slice(t,e.position),ch.test(o)&&w(e,"tag suffix cannot contain flow indicator characters")}o&&!Il.test(o)&&w(e,"tag name cannot contain such characters: "+o);try{o=decodeURIComponent(o)}catch{w(e,"tag name is malformed: "+o)}return n?e.tag=o:Le.call(e.tagMap,r)?e.tag=e.tagMap[r]+o:r==="!"?e.tag="!"+o:r==="!!"?e.tag="tag:yaml.org,2002:"+o:w(e,'undeclared tag handle "'+r+'"'),!0}function _h(e){var t,n;if(n=e.input.charCodeAt(e.position),n!==38)return!1;for(e.anchor!==null&&w(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!se(n)&&!ht(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&w(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function wh(e){var t,n,i;if(i=e.input.charCodeAt(e.position),i!==42)return!1;for(i=e.input.charCodeAt(++e.position),t=e.position;i!==0&&!se(i)&&!ht(i);)i=e.input.charCodeAt(++e.position);return e.position===t&&w(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),Le.call(e.anchorMap,n)||w(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],j(e,!0,-1),!0}function gt(e,t,n,i,r){var o,s,a,l=1,c=!1,u=!1,f,d,p,h,m,y;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,o=s=a=Kn===n||Ol===n,i&&j(e,!0,-1)&&(c=!0,e.lineIndent>t?l=1:e.lineIndent===t?l=0:e.lineIndent<t&&(l=-1)),l===1)for(;Ah(e)||_h(e);)j(e,!0,-1)?(c=!0,a=o,e.lineIndent>t?l=1:e.lineIndent===t?l=0:e.lineIndent<t&&(l=-1)):a=!1;if(a&&(a=c||r),(l===1||Kn===n)&&(Un===n||Cl===n?m=t:m=t+1,y=e.position-e.lineStart,l===1?a&&(Qa(e,y)||vh(e,y,m))||bh(e,m)?u=!0:(s&&Sh(e,m)||yh(e,m)||gh(e,m)?u=!0:wh(e)?(u=!0,(e.tag!==null||e.anchor!==null)&&w(e,"alias node should not have any properties")):hh(e,m,Un===n)&&(u=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):l===0&&(u=a&&Qa(e,y))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&w(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),f=0,d=e.implicitTypes.length;f<d;f+=1)if(h=e.implicitTypes[f],h.resolve(e.result)){e.result=h.construct(e.result),e.tag=h.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(Le.call(e.typeMap[e.kind||"fallback"],e.tag))h=e.typeMap[e.kind||"fallback"][e.tag];else for(h=null,p=e.typeMap.multi[e.kind||"fallback"],f=0,d=p.length;f<d;f+=1)if(e.tag.slice(0,p[f].tag.length)===p[f].tag){h=p[f];break}h||w(e,"unknown tag !<"+e.tag+">"),e.result!==null&&h.kind!==e.kind&&w(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+h.kind+'", not "'+e.kind+'"'),h.resolve(e.result,e.tag)?(e.result=h.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):w(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||u}function Eh(e){var t=e.position,n,i,r,o=!1,s;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(s=e.input.charCodeAt(e.position))!==0&&(j(e,!0,-1),s=e.input.charCodeAt(e.position),!(e.lineIndent>0||s!==37));){for(o=!0,s=e.input.charCodeAt(++e.position),n=e.position;s!==0&&!se(s);)s=e.input.charCodeAt(++e.position);for(i=e.input.slice(n,e.position),r=[],i.length<1&&w(e,"directive name must not be less than one character in length");s!==0;){for(;ze(s);)s=e.input.charCodeAt(++e.position);if(s===35){do s=e.input.charCodeAt(++e.position);while(s!==0&&!ge(s));break}if(ge(s))break;for(n=e.position;s!==0&&!se(s);)s=e.input.charCodeAt(++e.position);r.push(e.input.slice(n,e.position))}s!==0&&$r(e),Le.call(Ja,i)?Ja[i](e,i,r):Vn(e,'unknown document directive "'+i+'"')}if(j(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,j(e,!0,-1)):o&&w(e,"directives end mark is expected"),gt(e,e.lineIndent-1,Kn,!1,!0),j(e,!0,-1),e.checkLineBreaks&&lh.test(e.input.slice(t,e.position))&&Vn(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&Wn(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,j(e,!0,-1));return}if(e.position<e.length-1)w(e,"end of the stream or a document separator is expected");else return}function Pl(e,t){e=String(e),t=t||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
|
|
172
|
+
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var n=new mh(e,t),i=e.indexOf("\0");for(i!==-1&&(n.position=i,w(n,"null byte is not allowed in input")),n.input+="\0";n.input.charCodeAt(n.position)===32;)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)Eh(n);return n.documents}function xh(e,t,n){t!==null&&typeof t=="object"&&typeof n>"u"&&(n=t,t=null);var i=Pl(e,n);if(typeof t!="function")return i;for(var r=0,o=i.length;r<o;r+=1)t(i[r])}function kh(e,t){var n=Pl(e,t);if(n.length!==0){if(n.length===1)return n[0];throw new ie("expected a single document in the stream, but found more")}}var Ch=xh,Oh=kh,Dl={loadAll:Ch,load:Oh},Fl=Object.prototype.toString,Bl=Object.prototype.hasOwnProperty,Ur=65279,Th=9,Jt=10,Ih=13,Mh=32,Lh=33,Nh=34,Rr=35,Rh=37,Ph=38,Dh=39,Fh=42,ql=44,Bh=45,Yn=58,qh=61,$h=62,jh=63,Uh=64,$l=91,jl=93,Kh=96,Ul=123,Vh=124,Kl=125,te={};te[0]="\\0";te[7]="\\a";te[8]="\\b";te[9]="\\t";te[10]="\\n";te[11]="\\v";te[12]="\\f";te[13]="\\r";te[27]="\\e";te[34]='\\"';te[92]="\\\\";te[133]="\\N";te[160]="\\_";te[8232]="\\L";te[8233]="\\P";var Yh=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],Gh=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function Wh(e,t){var n,i,r,o,s,a,l;if(t===null)return{};for(n={},i=Object.keys(t),r=0,o=i.length;r<o;r+=1)s=i[r],a=String(t[s]),s.slice(0,2)==="!!"&&(s="tag:yaml.org,2002:"+s.slice(2)),l=e.compiledTypeMap.fallback[s],l&&Bl.call(l.styleAliases,a)&&(a=l.styleAliases[a]),n[s]=a;return n}function Hh(e){var t,n,i;if(t=e.toString(16).toUpperCase(),e<=255)n="x",i=2;else if(e<=65535)n="u",i=4;else if(e<=4294967295)n="U",i=8;else throw new ie("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+n+K.repeat("0",i-t.length)+t}var Jh=1,Xt=2;function Xh(e){this.schema=e.schema||qr,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=K.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=Wh(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?Xt:Jh,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function za(e,t){for(var n=K.repeat(" ",t),i=0,r=-1,o="",s,a=e.length;i<a;)r=e.indexOf(`
|
|
173
173
|
`,i),r===-1?(s=e.slice(i),i=a):(s=e.slice(i,r+1),i=r+1),s.length&&s!==`
|
|
174
|
-
`&&(o+=n),o+=s;return o}function
|
|
175
|
-
`+K.repeat(" ",e.indent*t)}function
|
|
174
|
+
`&&(o+=n),o+=s;return o}function Pr(e,t){return`
|
|
175
|
+
`+K.repeat(" ",e.indent*t)}function Qh(e,t){var n,i,r;for(n=0,i=e.implicitTypes.length;n<i;n+=1)if(r=e.implicitTypes[n],r.resolve(t))return!0;return!1}function Gn(e){return e===Mh||e===Th}function Qt(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==Ur||65536<=e&&e<=1114111}function Za(e){return Qt(e)&&e!==Ur&&e!==Ih&&e!==Jt}function el(e,t,n){var i=Za(e),r=i&&!Gn(e);return(n?i:i&&e!==ql&&e!==$l&&e!==jl&&e!==Ul&&e!==Kl)&&e!==Rr&&!(t===Yn&&!r)||Za(t)&&!Gn(t)&&e===Rr||t===Yn&&r}function zh(e){return Qt(e)&&e!==Ur&&!Gn(e)&&e!==Bh&&e!==jh&&e!==Yn&&e!==ql&&e!==$l&&e!==jl&&e!==Ul&&e!==Kl&&e!==Rr&&e!==Ph&&e!==Fh&&e!==Lh&&e!==Vh&&e!==qh&&e!==$h&&e!==Dh&&e!==Nh&&e!==Rh&&e!==Uh&&e!==Kh}function Zh(e){return!Gn(e)&&e!==Yn}function Wt(e,t){var n=e.charCodeAt(t),i;return n>=55296&&n<=56319&&t+1<e.length&&(i=e.charCodeAt(t+1),i>=56320&&i<=57343)?(n-55296)*1024+i-56320+65536:n}function Vl(e){var t=/^\n* /;return t.test(e)}var Yl=1,Dr=2,Gl=3,Wl=4,mt=5;function ey(e,t,n,i,r,o,s,a){var l,c=0,u=null,f=!1,d=!1,p=i!==-1,h=-1,m=zh(Wt(e,0))&&Zh(Wt(e,e.length-1));if(t||s)for(l=0;l<e.length;c>=65536?l+=2:l++){if(c=Wt(e,l),!Qt(c))return mt;m=m&&el(c,u,a),u=c}else{for(l=0;l<e.length;c>=65536?l+=2:l++){if(c=Wt(e,l),c===Jt)f=!0,p&&(d=d||l-h-1>i&&e[h+1]!==" ",h=l);else if(!Qt(c))return mt;m=m&&el(c,u,a),u=c}d=d||p&&l-h-1>i&&e[h+1]!==" "}return!f&&!d?m&&!s&&!r(e)?Yl:o===Xt?mt:Dr:n>9&&Vl(e)?mt:s?o===Xt?mt:Dr:d?Wl:Gl}function ty(e,t,n,i,r){e.dump=(function(){if(t.length===0)return e.quotingType===Xt?'""':"''";if(!e.noCompatMode&&(Yh.indexOf(t)!==-1||Gh.test(t)))return e.quotingType===Xt?'"'+t+'"':"'"+t+"'";var o=e.indent*Math.max(1,n),s=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-o),a=i||e.flowLevel>-1&&n>=e.flowLevel;function l(c){return Qh(e,c)}switch(ey(t,a,e.indent,s,l,e.quotingType,e.forceQuotes&&!i,r)){case Yl:return t;case Dr:return"'"+t.replace(/'/g,"''")+"'";case Gl:return"|"+tl(t,e.indent)+nl(za(t,o));case Wl:return">"+tl(t,e.indent)+nl(za(ny(t,s),o));case mt:return'"'+iy(t)+'"';default:throw new ie("impossible error: invalid scalar style")}})()}function tl(e,t){var n=Vl(e)?String(t):"",i=e[e.length-1]===`
|
|
176
176
|
`,r=i&&(e[e.length-2]===`
|
|
177
177
|
`||e===`
|
|
178
178
|
`),o=r?"+":i?"":"-";return n+o+`
|
|
179
|
-
`}function
|
|
180
|
-
`?e.slice(0,-1):e}function
|
|
181
|
-
`);return c=c!==-1?c:e.length,n.lastIndex=c,
|
|
179
|
+
`}function nl(e){return e[e.length-1]===`
|
|
180
|
+
`?e.slice(0,-1):e}function ny(e,t){for(var n=/(\n+)([^\n]*)/g,i=(function(){var c=e.indexOf(`
|
|
181
|
+
`);return c=c!==-1?c:e.length,n.lastIndex=c,il(e.slice(0,c),t)})(),r=e[0]===`
|
|
182
182
|
`||e[0]===" ",o,s;s=n.exec(e);){var a=s[1],l=s[2];o=l[0]===" ",i+=a+(!r&&!o&&l!==""?`
|
|
183
|
-
`:"")+
|
|
183
|
+
`:"")+il(l,t),r=o}return i}function il(e,t){if(e===""||e[0]===" ")return e;for(var n=/ [^ ]/g,i,r=0,o,s=0,a=0,l="";i=n.exec(e);)a=i.index,a-r>t&&(o=s>r?s:a,l+=`
|
|
184
184
|
`+e.slice(r,o),r=o+1),s=a;return l+=`
|
|
185
185
|
`,e.length-r>t&&s>r?l+=e.slice(r,s)+`
|
|
186
|
-
`+e.slice(s+1):l+=e.slice(r),l.slice(1)}function
|
|
187
|
-
`:""}var
|
|
188
|
-
`)?n.source:JSON.stringify(n.source),r=n.tag?`!<${n.tag}> `:"",o=H.load(`value: ${r}${i}`).value;
|
|
189
|
-
`)||void 0,i.items=i.items.filter(a=>!r.includes(a));for(let[a,l]of Object.entries(o))i.has(Sd(i,a))||i.set(a,gd(e,l))}}),e.setSchema(e.directives?.yaml.version??"1.2",{schema:"core",compat:"yaml-1.1",customTags:["timestamp"],merge:!1})}function gd(e,t){let n=e.createNode(t,{aliasDuplicateObjects:!1});return(0,Y.visit)(n,{Pair(i,r){(0,Y.isScalar)(r.key)&&r.key.value==="<<"&&(r.key.type="QUOTE_DOUBLE")}}),n}function Ov(e,t){if(Ft(t.custom_provider))for(let[n,i]of Object.entries(t.custom_provider)){if(!Ft(i)||!Ft(i.models))continue;let r=vd(e,["custom_provider",n,"models"]);Ad(e,r,Object.keys(i.models))}}function Ad(e,t,n){let i=e.getIn(t,!0);if(!(0,Y.isMap)(i))throw new Error("Expected a model mapping when applying config order");let r=new Map(i.items.map(o=>[(0,Y.isScalar)(o.key)?String(o.key.value):o.key,o]));i.items=n.map(o=>{let s=r.get(o);if(!s)throw new Error("Expected an existing model when applying config order");return s})}function $s(e,t,n=[]){if(!Ft(e)||!Ft(t))return Tv(e,t)?[]:[{kind:"set",path:n,value:t}];let i=[];for(let r of new Set([...Object.keys(e),...Object.keys(t)])){let o=[...n,r];!(r in t)||t[r]===void 0?i.push({kind:"delete",path:o}):r in e?i.push(...$s(e[r],t[r],o)):i.push({kind:"set",path:o,value:t[r]})}if(n.length===3&&n[0]==="custom_provider"&&n[2]==="models"){let r=Object.keys(t).filter(o=>t[o]!==void 0);js(Object.keys(e),r)||i.push({kind:"reorder",path:n,keys:r})}return i}function Tv(e,t){if(e===t)return!0;if(e===null||t===null||typeof e!="object"||typeof t!="object")return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}function bd(e){return H.dump(e,{indent:2,lineWidth:-1,noRefs:!0})}function Ft(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Dt(e){if(typeof e!="object"||e===null)return!1;if("v2_enabled"in e&&typeof e.v2_enabled=="boolean")return e.v2_enabled;if(!("v2"in e))return!1;let t=e.v2;return typeof t!="object"||t===null?!1:"enabled"in t&&typeof t.enabled=="boolean"?t.enabled:"writeEnabled"in t&&t.writeEnabled===!0||"recallEnabled"in t&&t.recallEnabled===!0}var nr={enabled:!1,detailedLoggingEnabled:!1,writeEnabled:!1,recallEnabled:!1,eligibleSessionIdleMs:600*1e3,maxCaptureInputTokens:64e3,maxSessionDocBytes:64*1024,maxSelectedSessions:256,maxConsolidationInputTokens:256e3,maxMemoryMarkdownBytes:2*1024*1024,maxSummaryInjectionTokens:2500,maxCaptureSessionsPerWake:6,maxCaptureConcurrency:2,eligibleSessionMaxAgeDays:30,maxCaptureAttemptsPerRevision:3,captureFailureBackoffMs:3600*1e3,publicationCooldownMs:360*60*1e3,maxConsolidationAgentTurns:64,minModelQuotaRemainingPercent:25,captureModel:void 0,captureReasoningEffort:"low",consolidationModel:void 0,consolidationReasoningEffort:"medium",retentionDays:90};function Ed(e,t){let n=e.memory,i=n!=null&&typeof n=="object"&&!Array.isArray(n)?n:{},r=i.dailyDigest,o=r!=null&&typeof r=="object"&&!Array.isArray(r)?r:{},s=i.v2,a=s!=null&&typeof s=="object"&&!Array.isArray(s)?s:{},l=t.v2,c=i.legacyRecallDisabledAgents;return{legacyRecallDisabledAgents:c&&typeof c=="object"&&!Array.isArray(c)?Object.fromEntries(Object.entries(c).filter(([,u])=>typeof u=="boolean")):{},enabled:typeof i.enabled=="boolean"?i.enabled:t.enabled,proactive:typeof i.proactive=="boolean"?i.proactive:t.proactive,dailyDigest:{enabled:typeof o.enabled=="boolean"?o.enabled:t.dailyDigest.enabled},v2_enabled:typeof i.v2_enabled=="boolean"||["enabled","writeEnabled","recallEnabled"].some(u=>typeof a[u]=="boolean")?Dt(i):Dt(t),v2:{...typeof a.enabled=="boolean"?{enabled:a.enabled}:{},detailedLoggingEnabled:Us(a.detailedLoggingEnabled,l.detailedLoggingEnabled),writeEnabled:Us(a.writeEnabled,l.writeEnabled),recallEnabled:Us(a.recallEnabled,l.recallEnabled),eligibleSessionIdleMs:re(a.eligibleSessionIdleMs,l.eligibleSessionIdleMs),maxCaptureInputTokens:re(a.maxCaptureInputTokens,l.maxCaptureInputTokens),maxSessionDocBytes:re(a.maxSessionDocBytes,l.maxSessionDocBytes),maxSelectedSessions:re(a.maxSelectedSessions,l.maxSelectedSessions),maxConsolidationInputTokens:re(a.maxConsolidationInputTokens,l.maxConsolidationInputTokens),maxMemoryMarkdownBytes:re(a.maxMemoryMarkdownBytes,l.maxMemoryMarkdownBytes),maxSummaryInjectionTokens:re(a.maxSummaryInjectionTokens,l.maxSummaryInjectionTokens),maxCaptureSessionsPerWake:re(a.maxCaptureSessionsPerWake,l.maxCaptureSessionsPerWake),maxCaptureConcurrency:re(a.maxCaptureConcurrency,l.maxCaptureConcurrency),eligibleSessionMaxAgeDays:re(a.eligibleSessionMaxAgeDays,l.eligibleSessionMaxAgeDays),maxCaptureAttemptsPerRevision:re(a.maxCaptureAttemptsPerRevision,l.maxCaptureAttemptsPerRevision),captureFailureBackoffMs:re(a.captureFailureBackoffMs,l.captureFailureBackoffMs),publicationCooldownMs:re(a.publicationCooldownMs,l.publicationCooldownMs),maxConsolidationAgentTurns:re(a.maxConsolidationAgentTurns,l.maxConsolidationAgentTurns),minModelQuotaRemainingPercent:Iv(a.minModelQuotaRemainingPercent,l.minModelQuotaRemainingPercent),captureModel:wd(a.captureModel,l.captureModel),captureReasoningEffort:_d(a.captureReasoningEffort,l.captureReasoningEffort),consolidationModel:wd(a.consolidationModel,l.consolidationModel),consolidationReasoningEffort:_d(a.consolidationReasoningEffort,l.consolidationReasoningEffort),retentionDays:re(a.retentionDays,l.retentionDays)}}}function Us(e,t){return typeof e=="boolean"?e:t}function re(e,t){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0?e:t}function Iv(e,t){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0&&e<=100?e:t}function wd(e,t){return typeof e=="string"&&e.trim().length>0?e.trim():t}function _d(e,t){return e==="low"||e==="medium"||e==="high"?e:t}function Lv(e,t){return!Dt(e)&&e?.enabled!==!1&&e?.legacyRecallDisabledAgents?.[t]!==!0}import oe from"node:path";import IA from"node:os";import{spawnSync as LA}from"node:child_process";import{fileURLToPath as MA}from"node:url";function xd(e){let t=e.tui;if(t==null||typeof t!="object"||Array.isArray(t))return{};let n=t,i=n.notifications,r;if(i&&typeof i=="object"&&!Array.isArray(i)){let{when:l,method:c}=i;r={...l==="unfocused"||l==="always"||l==="never"?{when:l}:{},...c==="auto"||c==="osc9"||c==="osc777"||c==="bel"?{method:c}:{}}}let o=n.statusLine,s=Array.isArray(o)?o.filter(l=>typeof l=="string").map(l=>l.trim()).filter(Boolean):void 0,a=Mv(n.customStatusLine);return{...typeof n.showTips=="boolean"?{showTips:n.showTips}:{},...r?{notifications:r}:{},...s?{statusLine:s}:{},...a?{customStatusLine:a}:{}}}function Mv(e){if(e==null||typeof e!="object"||Array.isArray(e))return;let t=e,n=typeof t.command=="string"?t.command.trim():"";if(n)return{command:n,...t.display==="inline"||t.display==="block"?{display:t.display}:{},...t.position==="above"||t.position==="below"?{position:t.position}:{},...t.colorMode==="plain"||t.colorMode==="ansi"?{colorMode:t.colorMode}:{},...typeof t.maxLines=="number"&&Number.isFinite(t.maxLines)?{maxLines:t.maxLines}:{},...typeof t.timeoutMs=="number"&&Number.isFinite(t.timeoutMs)?{timeoutMs:t.timeoutMs}:{},...typeof t.intervalSeconds=="number"&&Number.isFinite(t.intervalSeconds)?{intervalSeconds:t.intervalSeconds}:{}}}import{createHash as Nv,randomUUID as Rv}from"node:crypto";import rr from"node:fs";import ir from"node:path";function Od(e){if(e==null||typeof e!="object"||Array.isArray(e))return;let t=e,n={};typeof t.apiKey=="string"&&(n.apiKey=t.apiKey),typeof t.baseURL=="string"&&(n.baseURL=t.baseURL);let i=Vs(t.modelContextLimits);return i&&(n.modelContextLimits=i),Object.keys(n).length>0?n:void 0}function Vs(e){if(!B(e))return;let t=Object.entries(e).filter(n=>n[0].length>0&&Number.isSafeInteger(n[1])&&n[1]>0);return t.length>0?Object.fromEntries(t):void 0}function Td(e,t){return t?Object.fromEntries(Object.entries(e).map(([n,i])=>{let r=t[n];return[n,r!==void 0&&i.contextWindowOptions?.includes(r)?{...i,limit:{...i.limit,context:r}}:i]})):e}function Ys(e){let t=e.provider?.minimax,n=t?.catalogModels??t?.models??_t;return Td(Object.fromEntries(Object.entries(n).filter(([,i])=>i.enabled!==!1)),e.minimax_api?.modelContextLimits)}function Id(e,t){let n=e.minimax;return n?.models?{...e,minimax:{...n,catalogModels:n.models,models:Td(n.models,t)}}:e}function Ld(e){if(e==null||typeof e!="object"||Array.isArray(e))return;let t=Object.entries(e).filter(([,n])=>n!=null&&typeof n=="object"&&!Array.isArray(n));if(t.length!==0)return Object.fromEntries(t.map(([n,i])=>[n,Nd(i)]))}function Md(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,B(n)?Nd(n):n]))}function Nd(e){if(!B(e.models))return e;let t=!1,n=Object.fromEntries(Object.entries(e.models).map(([i,r])=>{if(!B(r)||!B(r.thinking))return[i,r];let o=typeof r.thinking.effort=="string"?r.thinking.effort.trim():"",s=typeof r.thinking.defaultEffort=="string"?r.thinking.defaultEffort.trim():"";if(!Object.hasOwn(r.thinking,"effort")&&!Object.hasOwn(r.thinking,"defaultEffort"))return[i,r];let a=[],l=new Set;if(Array.isArray(r.thinking.effortOptions))for(let d of r.thinking.effortOptions){if(typeof d!="string")continue;let p=d.trim();!p||l.has(p)||(l.add(p),a.push(p))}o&&!l.has(o)&&(l.add(o),a.push(o)),s&&!l.has(s)&&(l.add(s),a.push(s));let c={...r.thinking};delete c.effort,delete c.effortOptions,delete c.defaultEffort;let u={...c,...a.length>0?{effortOptions:a}:{},...s?{defaultEffort:s}:{}},f={...r};return Object.keys(u).length>0?f.thinking=u:delete f.thinking,t=!0,[i,f]}));return t?{...e,models:n}:e}var Rd="byok_legacy_provider_to_custom_provider_v1",Pd="config.yaml.bak.byok-legacy-provider.",Ks=new Set(["minimax","minimax_api","provider","custom_provider"]),Pv=/^[A-Za-z0-9 _-]+$/;function Fd(e,t){let n={migrated:!1,migratedProviders:{}};if(!t.isManagedRuntime()||!rr.existsSync(e))return n;let i=Bv(e);if(!B(i.provider))return n;let r=i.provider,o=B(i.custom_provider)?i.custom_provider:{},s=Wv(i),a={},l={...o},c=new Set(Object.keys(l)),u=!1,f=t.getManagedPreset().provider;for(let[d,p]of Object.entries(r)){if(!qv(d,p,f))continue;let h=s.providers[d];if(h&&!Ks.has(h)&&!B(l[h])){delete r[d],u=!0;continue}let m=h&&!Ks.has(h)?h:Uv(d,p,c);a[d]=m,B(l[m])||(l[m]=jv(p),c.add(m),u=!0),s.providers[d]!==m&&(s.providers[d]=m,u=!0),delete r[d],u=!0}if(!u&&Object.keys(a).length===0)return n;if(u=Cd(i,"defaultModel",a)||u,u=Cd(i,"defaultLightModel",a)||u,u=Yv(i,a)||u,!u)return{migrated:!1,migratedProviders:a};Object.keys(l).length>0?i.custom_provider=l:delete i.custom_provider,Hv(i,s);try{let d=Gv(e);return it(e,H.dump(i,{indent:2,lineWidth:-1,noRefs:!0})),{migrated:!0,migratedProviders:a,backupPath:d}}catch(d){return console.warn(`[config] legacy BYOK provider migration skipped: ${Xv(d)}`),{migrated:!1,migratedProviders:a}}}function Dd(e,t){let n=e.provider,i=e.defaultModel;if(Object.prototype.hasOwnProperty.call(n,"minimax_api")){let{minimax_api:h,...m}=n;n=m,console.warn('[config] "minimax_api" is a reserved provider id; ignoring provider.minimax_api from config.yaml')}let o=t.getManagedPreset().provider.minimax,s=n.minimax,a=t.isManagedRuntime();if(!(a||Fv(s,t)))return{provider:n,defaultModel:i};let c=s?.options,u=a&&t.shouldEnforceManagedProviderProtection(),f=Dv(o.models,s?.models),d=typeof c?.baseURL=="string"&&c.baseURL.length>0?c.baseURL:void 0,p=u&&d!=null&&!t.isManagedPresetBaseUrl(d);return n={...n,minimax:{...o,...s??{},npm:s?.npm??o.npm,models:f,options:{...o.options??{},...c??{},...p?{apiKey:o.options?.apiKey}:{},...u?{authMode:"managed-login",baseURL:o.options?.baseURL}:{}}}},{provider:n,defaultModel:i}}function Fv(e,t){let n=e?.options;return n?.authMode==="managed-login"?!0:typeof n?.baseURL=="string"&&t.isManagedPresetBaseUrl(n.baseURL)}function Dv(e,t){return t&&Object.keys(t).length>0?t:e??{}}function Bv(e){try{let t=H.load(rr.readFileSync(e,"utf-8"));return B(t)?t:{}}catch{return{}}}function qv(e,t,n){return e==="minimax"||e==="minimax_api"||!Jv(t)||!$v(t)?!1:!Object.prototype.hasOwnProperty.call(n,e)}function $v(e){let t=B(e.options)?e.options:void 0;return typeof t?.apiKey=="string"&&t.apiKey.trim().length>0&&typeof t.baseURL=="string"&&t.baseURL.trim().length>0&&B(e.models)}function jv(e){let t=B(e.options)?e.options:{};return{...e,kind:"custom",enabled:e.enabled!==!1,options:{...t,authMode:"api-key"}}}function Uv(e,t,n){let i=B(t)?t:{},r=typeof i.name=="string"?i.name:void 0,o=`provider-${Kv(e)}`,s=kd(e)??kd(r)??o;for(let a=0;;a+=1){let l=a===0?s:`${s}-${a+1}`;if(!n.has(l)&&!Ks.has(l))return l}}function kd(e){let t=e?.trim();return!t||!Pv.test(t)?void 0:t.toLowerCase().replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")||void 0}function Kv(e){return Nv("sha256").update(e).digest("hex").slice(0,8)}function Cd(e,t,n){let i=e[t];if(typeof i!="string")return!1;let r=Vv(i,n);return r===i?!1:(e[t]=r,!0)}function Vv(e,t){let n=e.indexOf("/");if(n<=0||n===e.length-1)return e;let i=e.slice(0,n),r=t[i];return r?`custom_provider:${r}/${e.slice(n+1)}`:e}function Yv(e,t){if(!B(e.nexus)||!B(e.nexus.model))return!1;let n=e.nexus.model.providerID;if(typeof n!="string")return!1;let i=t[n];return i?(e.nexus.model.providerID=`custom_provider:${i}`,!0):!1}function Bd(e){if(process.platform==="win32")return;let t=ir.dirname(e),n;try{n=rr.readdirSync(t,{withFileTypes:!0})}catch{console.warn(`[config] Could not inspect legacy BYOK backups in ${JSON.stringify(t)}. Backup permissions were not verified; check directory access and restrict backup permissions manually.`);return}for(let i of n)if(i.isFile()&&i.name.startsWith(Pd)){let r=ir.join(t,i.name);try{Et(r)}catch{console.warn(`[config] Could not restrict legacy BYOK backup ${JSON.stringify(r)}. It may still be readable by other users; restrict its permissions manually.`)}}}function Gv(e){let t=ir.join(ir.dirname(e),`${Pd}${Date.now()}.${Rv()}`);return Et(e),it(t,rr.readFileSync(e),!0),t}function Wv(e){let n=(B(e.migrations)?e.migrations:void 0)?.[Rd];return{providers:B(n)&&B(n.providers)?Object.fromEntries(Object.entries(n.providers).filter(r=>typeof r[1]=="string")):{}}}function Hv(e,t){let n=B(e.migrations)?e.migrations:{};n[Rd]={version:1,providers:t.providers},e.migrations=n}function Jv(e){return B(e)?typeof e.name=="string"||typeof e.npm=="string"||typeof e.api=="string"||B(e.options)||B(e.models):!1}function B(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function Xv(e){return e instanceof Error?e.message:String(e)}function qd(e,t){if(e==null||typeof e!="object"||Array.isArray(e))return t;let n=Reflect.get(e,"mode"),i=Reflect.get(e,"turnDiffCard");return{mode:n==="inline"||n==="subagent"?n:t.mode,turnDiffCard:i==="concise"||i==="standard"?i:t.turnDiffCard,modeSource:n==="inline"||n==="subagent"?"explicit":"default"}}function $d(e,t){let n=t.keepAlive,i=t.xdg,r=t.spawnConcurrency,o=()=>({enabled:n.enabled,maxProcesses:n.maxProcesses,maxLifetimeMs:n.maxLifetimeMs,agents:[...n.agents]}),s=e.opencode;if(s==null||typeof s!="object"||Array.isArray(s))return{keepAlive:o(),xdg:{...i},spawnConcurrency:r};let a=s,l=a.spawnConcurrency,c=typeof l=="number"&&Number.isFinite(l)&&l>0&&Number.isInteger(l)?l:r,u=Qv(a.xdg,i),f=a.keepAlive;if(f==null||typeof f!="object"||Array.isArray(f))return{keepAlive:o(),xdg:u,spawnConcurrency:c};let d=f,p=d.maxProcesses,h=typeof p=="number"&&Number.isFinite(p)&&p>0&&Number.isInteger(p)?p:n.maxProcesses,m=d.maxLifetimeMs,y=typeof m=="number"&&Number.isFinite(m)&&m>0&&Number.isInteger(m)?m:n.maxLifetimeMs,g=d.agents,b;return Array.isArray(g)?(b=g.filter(v=>typeof v=="string"&&v.length>0),b.length===0&&(b=[...n.agents])):b=[...n.agents],{keepAlive:{enabled:typeof d.enabled=="boolean"?d.enabled:n.enabled,maxProcesses:h,maxLifetimeMs:y,agents:b},xdg:u,spawnConcurrency:c}}function Qv(e,t){let n=e!=null&&typeof e=="object"&&!Array.isArray(e)?e:void 0,i=n?.startupImport,r=i==="background"||i==="blocking"||i==="off"?i:t.startupImport;return{dataIsolation:typeof n?.dataIsolation=="boolean"?n.dataIsolation:t.dataIsolation,startupImport:r}}function or(e){let t=JSON.stringify({level:40,time:Date.now(),name:"config.asr",msg:e});process.stderr.write(`${t}
|
|
190
|
-
`)}var ar={enabled:!0};function jd(e){if(e==null||typeof e!="object"||Array.isArray(e))return!1;let t=e,n=typeof t.apiKey=="string"&&t.apiKey.trim().length>0,i=typeof t.resourceId=="string"&&t.resourceId.trim().length>0;return n||i}function sr(e){return typeof e=="string"&&e.trim().length>0}function Ud(e){let t=e.asr;if(t==null||typeof t!="object"||Array.isArray(t))return{...ar};let n=t;return jd(n.seed)&&or("Ignoring legacy `asr.seed.*` in config \u2014 Seed ASR was retired from the daemon; only Amadeus remains. Remove `asr.seed` from config.yaml."),jd(n.qwen)&&or("Ignoring legacy `asr.qwen.apiKey` in config \u2014 Qwen ASR was retired from the daemon; only Amadeus remains. Remove `asr.qwen` from config.yaml."),(sr(n.mode)||sr(n.proxyBaseUrl))&&or("Ignoring legacy `asr.mode` / `asr.proxyBaseUrl` in config \u2014 the daemon no longer runs the shared asr-proxy WebSocket path. The Amadeus HTTP proxy is managed by the application environment. Remove these keys from config.yaml."),(sr(n.primaryProvider)||sr(n.fallbackProvider))&&or("Ignoring legacy `asr.primaryProvider` / `asr.fallbackProvider` in config \u2014 only Amadeus remains and provider selection is no longer configurable. Remove these keys from config.yaml."),{enabled:typeof n.enabled=="boolean"?n.enabled:ar.enabled}}var zv={policyOwner:"core",storageWriteVersion:2,classifierTimeoutMs:6e4,userConfirmationEnabled:!0};function Kd(e,t=zv){let n=e.permission;if(n==null||typeof n!="object"||Array.isArray(n))return{...t};let i=n,r=i.policyOwner===void 0?t.policyOwner:i.policyOwner==="engine"||i.policyOwner==="core"?i.policyOwner:"engine",o=i.storageWriteVersion===1||i.storageWriteVersion===2?i.storageWriteVersion:t.storageWriteVersion,s=i.classifierTimeoutMs,a=typeof s=="number"&&Number.isFinite(s)&&s>=5e3?Math.floor(s):t.classifierTimeoutMs,l=typeof i.userConfirmationEnabled=="boolean"?i.userConfirmationEnabled:t.userConfirmationEnabled;return{policyOwner:r,storageWriteVersion:o,classifierTimeoutMs:a,userConfirmationEnabled:l}}var Vd=["user-cc","user-codex","user-agents","workspace-minimax","workspace-cc","workspace-agents"],Zv={"user-cc":"user-claude","workspace-cc":"workspace-claude"},cr={external:{enabled:!0,walkUp:!0,duplicateWarn:!0,sources:{"workspace-minimax":{enabled:!0,priority:65},"workspace-cc":{enabled:!0,priority:60},"workspace-agents":{enabled:!0,priority:55},"user-cc":{enabled:!0,priority:40},"user-codex":{enabled:!0,priority:35},"user-agents":{enabled:!0,priority:30}}}};function lr(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function eA(e,t){return lr(e)?{enabled:typeof e.enabled=="boolean"?e.enabled:t.enabled,priority:typeof e.priority=="number"&&Number.isFinite(e.priority)?e.priority:t.priority}:t}function Gs(e){let t=cr,n=lr(e.skills)?e.skills:{},i=lr(n.external)?n.external:{},r=lr(i.sources)?i.sources:{},o={...t.external.sources};for(let s of Vd){let a=Zv[s],l=Object.hasOwn(r,s)?r[s]:a?r[a]:void 0;o[s]=eA(l,t.external.sources[s])}return{external:{enabled:typeof i.enabled=="boolean"?i.enabled:t.external.enabled,walkUp:typeof i.walkUp=="boolean"?i.walkUp:t.external.walkUp,duplicateWarn:typeof i.duplicateWarn=="boolean"?i.duplicateWarn:t.external.duplicateWarn,sources:o}}}var tA=Vd;var Yd=["pi-agent"],Bt="pi-agent";function Gd(e){return typeof e!="string"?Bt:Yd.includes(e)?e:Bt}function Ws(e){return e==null||typeof e!="object"||Array.isArray(e)?{defaultFramework:Bt}:{defaultFramework:Gd(e.defaultFramework)}}import G from"node:fs";import nA from"node:os";import qt from"node:path";var zd=".minimax",Zd=".mavis",iA={error:()=>{},info:()=>{},warn:()=>{}};function zs(e){return e??nA.homedir()}function ep(e,t){return t?`${e}-${t}`:e}function tp(e,t){return qt.join(zs(e),ep(zd,t))}function np(e,t){return qt.join(zs(e),ep(Zd,t))}function Js(e){try{let t=G.lstatSync(e);return t.isSymbolicLink()?{kind:"link"}:t.isDirectory()?{kind:"directory"}:{kind:"other"}}catch(t){let n=t.code;return n==="ENOENT"||n==="ENOTDIR"?{kind:"missing"}:{kind:"inaccessible",error:t}}}function Hs(e){let t=qt.resolve(e);return process.platform==="win32"?(t=t.replace(/^\\\\\?\\/,""),t.toLowerCase()):t}function Zs(e,t){try{let n=G.readlinkSync(e),i=Hs(t);return Hs(qt.resolve(qt.dirname(e),n))===i||Hs(n)===i}catch{return!1}}function ur(e,t,n){if(!Zs(e,t))try{G.symlinkSync(t,e,process.platform==="win32"?"junction":"dir")}catch(i){n.warn(`Failed to create compat link ${e} -> ${t}: ${String(i)}`)}}function Wd(e,t,n){if(t.kind==="missing")return!0;if(t.kind==="link"||t.kind==="other")try{return G.unlinkSync(e),!0}catch(i){return n.warn(`Failed to remove ${e} before creating compat link: ${String(i)}`),!1}return!1}function Xs(e){try{let t=G.readdirSync(e);if(t.length===0)return"empty";if(t.length===1&&t[0]==="workspace")try{return G.readdirSync(qt.join(e,"workspace")).length>0?"hasData":"empty"}catch{return"unknown"}return"hasData"}catch{return"unknown"}}function Qs(e){try{return G.statSync(e).isDirectory()?Xs(e):void 0}catch{return"unknown"}}function rA(e,t){return`${e}.backup-${t()}`}function oA(e,t,n){let i=rA(e,n);try{return G.renameSync(e,i),t.warn(`Backed up legacy data dir ${e} -> ${i}`),!0}catch(r){return t.warn(`Failed to back up legacy data dir ${e}: ${String(r)}`),!1}}function sA(e,t,n,i){if(Zs(e,t))return!0;let r=Js(e);if(r.kind==="missing")return!0;if(r.kind==="link"){let o=Qs(e);return o==="hasData"||o==="unknown"?(n.warn(`Cannot replace legacy data dir symlink ${e}; it may point to real data outside ${t}`),!1):Wd(e,r,n)}return r.kind==="other"?Wd(e,r,n):r.kind==="directory"?oA(e,n,i):(n.warn(`Cannot replace inaccessible legacy data dir ${e}; leaving it untouched`),!1)}function Hd(e,t,n,i){sA(e,t,n,i)&&ur(e,t,n)}function aA(e,t){try{return G.rmSync(e,{recursive:!0,force:!1}),!0}catch(n){return t.warn(`Failed to remove empty primary data dir ${e}: ${String(n)}`),!1}}function Jd(e,t,n){try{return G.renameSync(e,t),n.info(`Migrated legacy data dir ${e} -> ${t}`),!0}catch(i){return n.warn(`Failed to migrate legacy data dir ${e} -> ${t}: ${String(i)}`),!1}}function lA(e,t,n,i){try{G.cpSync(e,n,{recursive:!0,errorOnExist:!0,force:!1}),G.unlinkSync(t);try{G.rmSync(e,{recursive:!0,force:!1})}catch(r){i.warn(`Copied legacy symlink data dir ${e} -> ${n}, but failed to remove old target: ${String(r)}`)}return i.info(`Copied legacy data dir symlink target ${e} -> ${n}`),!0}catch(r){try{G.existsSync(n)&&G.rmSync(n,{recursive:!0,force:!0})}catch(o){i.warn(`Failed to clean up partial primary data dir ${n}: ${String(o)}`)}return i.warn(`Failed to copy legacy symlink data dir ${t} -> ${n}: ${String(r)}`),!1}}function Xd(e,t,n){try{let i=G.realpathSync(e);try{G.renameSync(i,t)}catch(r){if(r.code==="EXDEV")return lA(i,e,t,n);throw r}return G.unlinkSync(e),n.info(`Migrated legacy data dir symlink target ${i} -> ${t}`),!0}catch(i){return n.warn(`Failed to migrate legacy symlink data dir ${e} -> ${t}: ${String(i)}`),!1}}function Qd(e,t){try{return G.mkdirSync(e,{recursive:!0}),!0}catch(n){return t.warn(`Failed to create primary data dir ${e}: ${String(n)}`),!1}}function cA(e,t,n,i){let r=Js(e),o=Js(t);if(r.kind==="inaccessible")return n.warn(`Primary data dir ${e} is inaccessible; not treating it as missing`),e;if(r.kind==="directory"){let s=Xs(e),a=o.kind==="directory"?Xs(t):o.kind==="link"?Qs(t)??"empty":"empty";if(s==="empty"){if(o.kind==="inaccessible"||a==="unknown")return n.warn(`Legacy data dir ${t} may contain data but is inaccessible; not using empty primary ${e}`),t;if((o.kind==="directory"||o.kind==="link")&&a==="hasData"){if(!aA(e,n))return t;if(o.kind==="link"){if(!Xd(t,e,n))return t}else if(!Jd(t,e,n))return t;return ur(t,e,n),e}}return Hd(t,e,n,i),e}if(Zs(t,e))return Qd(e,n),e;if(o.kind==="directory")return Jd(t,e,n)?(ur(t,e,n),e):t;if(o.kind==="link"){let s=Qs(t);if(s==="hasData")return Xd(t,e,n)?(ur(t,e,n),e):t;if(s==="unknown")return n.warn(`Legacy data dir symlink ${t} target is inaccessible; not treating it as missing`),t}return o.kind==="inaccessible"?(n.warn(`Legacy data dir ${t} is inaccessible; not treating it as missing`),t):r.kind==="link"||r.kind==="other"?(n.warn(`Primary data dir path ${e} exists but is not a directory; using it without migration`),e):(Qd(e,n),Hd(t,e,n,i),e)}function Ge(e={}){let t=zs(e.homeDir),n=e.profile??null;return cA(tp(t,n),np(t,n),e.logger??iA,e.nowMs??Date.now)}function uA(e,t){return Ge({homeDir:e,logger:t})}function fA(e,t,n){return Ge({homeDir:t,profile:e,logger:n})}var oa=["read","write","edit","bash","task_query","task_output","task_stop","grep","glob","todowrite","web_fetch","website_deploy","workspace_semantic_search"],sa=["images_understand","image_synthesize","images_search_and_download","image_reverse_search","submit_video_generation","query_video_generation","gen_videos","batch_text_to_video","batch_image_to_video","get_voice_list","batch_text_to_audio","batch_text_to_music","synthesize_speech","batch_synthesize_speech","audios_understand","videos_understand","transcribe_audio"],aa=["code-review","deep-research","deploy-website","docx","edit-deployed-website","init","lark-tools","llm-call","mcode-tools-master","mavis-doctor","pdf","plugin-creator","pptx","skill-creator","skill-refiner","visual-page","x-link-reader","xlsx"],op=["control-in-app-browser","resume-codex","mavis","create-agent","minimax-code-product","miniapp-creator"],dA=new Set(["modelConfigId","persona","tools","builtinTools","skills","features"]),pA=new Set(["enabled"]),ia=new Set(["mavis","delegation","webSearch"]),sp=new Set(oa),ip=["task_query","task_output","task_stop"],ap=new Set(sa),ra=new Set(aa),lp=new Set(op),mA=new Set(["plan-mode"]);function la(e){let t=fr(e),n=fr(t?.default);return{default:n?yA(n):{}}}function hA(e,t="agent"){if(e===void 0)return{};let n=ta(e,t);na(n,dA,t);let i={};if(n.modelConfigId!==void 0&&((typeof n.modelConfigId!="string"||!n.modelConfigId.trim())&&ce(`${t}.modelConfigId`,"must be a non-empty string"),i.modelConfigId=n.modelConfigId.trim()),n.persona!==void 0){let r=ta(n.persona,`${t}.persona`);na(r,pA,`${t}.persona`),r.enabled!==void 0&&typeof r.enabled!="boolean"&&ce(`${t}.persona.enabled`,"must be a boolean"),i.persona={...typeof r.enabled=="boolean"?{enabled:r.enabled}:{}}}if(n.tools!==void 0&&(Array.isArray(n.tools)||ce(`${t}.tools`,"must be an array"),i.tools=n.tools.map((r,o)=>((typeof r!="string"||!sp.has(r))&&ce(`${t}.tools[${o}]`,`must be one of ${oa.join(", ")}`),r))),n.builtinTools!==void 0&&(Array.isArray(n.builtinTools)||ce(`${t}.builtinTools`,"must be an array"),i.builtinTools=n.builtinTools.map((r,o)=>(r==="web_search"&&ce(`${t}.builtinTools[${o}]`,"web_search is feature-owned; use features.webSearch"),(typeof r!="string"||!ap.has(r))&&ce(`${t}.builtinTools[${o}]`,`must be one of ${sa.join(", ")}`),r))),n.skills!==void 0&&(Array.isArray(n.skills)||ce(`${t}.skills`,"must be an array"),i.skills=n.skills.map((r,o)=>{if(typeof r=="string"&&lp.has(r.trim())){let s=r.trim();ce(`${t}.skills[${o}]`,`${s} is capability-owned; use its owning Tool or feature switch`)}return(typeof r!="string"||!ra.has(r.trim()))&&ce(`${t}.skills[${o}]`,`must be one of ${aa.join(", ")}`),r.trim()})),n.features!==void 0){let r=ta(n.features,`${t}.features`);na(r,ia,`${t}.features`);for(let o of ia)r[o]!==void 0&&typeof r[o]!="boolean"&&ce(`${t}.features.${o}`,"must be a boolean");i.features={...typeof r.mavis=="boolean"?{mavis:r.mavis}:{},...typeof r.delegation=="boolean"?{delegation:r.delegation}:{},...typeof r.webSearch=="boolean"?{webSearch:r.webSearch}:{}}}return i}function yA(e){let t={};typeof e.modelConfigId=="string"&&e.modelConfigId.trim()&&(t.modelConfigId=e.modelConfigId.trim());let n=fr(e.persona);if(typeof n?.enabled=="boolean"&&(t.persona={enabled:n.enabled}),rp(e.tools,sp)){let r=[...e.tools];ip.some(o=>r.includes(o))||r.push(...ip),t.tools=r}if(rp(e.builtinTools,ap)&&(t.builtinTools=[...e.builtinTools]),Array.isArray(e.skills)){let r=e.skills.map(o=>typeof o=="string"?o.trim():o);r.every(o=>typeof o=="string"&&(ra.has(o)||mA.has(o))&&!lp.has(o))&&(t.skills=r.filter(o=>typeof o=="string"&&ra.has(o)))}let i=fr(e.features);if(i){let r={};for(let o of ia)typeof i[o]=="boolean"&&(r[o]=i[o]);Object.keys(r).length>0&&(t.features=r)}return t}function fr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0}function rp(e,t){return Array.isArray(e)&&e.every(n=>typeof n=="string"&&t.has(n))}function gA(e={},t={}){return{persona:{enabled:t.persona?.enabled??e.persona?.enabled??!0},tools:ea(t.tools??e.tools),builtinTools:ea(t.builtinTools??e.builtinTools),skills:ea(t.skills??e.skills),features:{mavis:t.features?.mavis??e.features?.mavis??!0,delegation:t.features?.delegation??e.features?.delegation??!0,webSearch:t.features?.webSearch??e.features?.webSearch??!0}}}function bA(e,t){return e.tools===void 0||e.tools.includes(t)}function SA(e,t){return e.builtinTools===void 0||e.builtinTools.includes(t)}function vA(e,t){return e.skills===void 0||e.skills.includes(t)}function ea(e){return e===void 0?void 0:[...e]}function ta(e,t){return(e==null||typeof e!="object"||Array.isArray(e))&&ce(t,"must be an object"),e}function na(e,t,n){for(let i of Object.keys(e))t.has(i)||ce(`${n}.${i}`,"is not supported")}function ce(e,t){throw new Error(`Invalid configuration at ${e}: ${t}`)}var ca={enabled:!0};function cp(e,t=ca){let n=e.askUser;if(n==null||typeof n!="object"||Array.isArray(n))return{...t};let i=n;return{enabled:typeof i.enabled=="boolean"?i.enabled:t.enabled}}var We={enabled:!0,enabledSource:"default"};function ua(e,t=We){let n=e.dataContribution;if(n==null||typeof n!="object"||Array.isArray(n))return{...t,enabledSource:"default"};let i=n,r=typeof i.enabled=="boolean";return{enabled:r?i.enabled:t.enabled,enabledSource:r?"explicit":"default"}}function up(e){try{let t=e()?.dataContribution?.enabled;return typeof t=="boolean"?t:We.enabled}catch{return We.enabled}}var pp=["none","evaluator","subagent"],mp=["brief","transcript"],hp=["same-route-small-fast"],yp="goal-verifier-readonly",gp=[yp],he={budget:{graceSteps:1},breaker:{repeatedReplyLimit:3},verifier:{repeatedNotMetLimit:5,evidence:"brief"},evaluator:{modelPolicy:"same-route-small-fast",maxTokens:32e3,timeoutSeconds:60,maxRetries:1}},fa={budget:{graceSteps:3},evaluator:{maxRetries:1}};function da(e){let t=[],n=$t(e,"goal",t);jt(n,"goal",t,["objectiveMaxChars","verification","budget","breaker","verifier","evaluator","subagent"]);let i=$t(n.budget,"goal.budget",t);jt(i,"goal.budget",t,["defaultTokens","defaultMainTurns","defaultActiveSeconds","graceSteps"]);let r=$t(n.breaker,"goal.breaker",t);jt(r,"goal.breaker",t,["repeatedReplyLimit"]);let o=$t(n.verifier,"goal.verifier",t);jt(o,"goal.verifier",t,["repeatedNotMetLimit","evidence"]);let s=$t(n.evaluator,"goal.evaluator",t);jt(s,"goal.evaluator",t,["modelPolicy","maxTokens","timeoutSeconds","maxRetries"]);let a=$t(n.subagent,"goal.subagent",t);jt(a,"goal.subagent",t,["profile","maxTurns","maxTokens","timeoutSeconds"]);let l=dp(n.verification,"goal.verification",pp,t),c=ut(n.objectiveMaxChars,"goal.objectiveMaxChars",t,{min:1}),u=ut(i.defaultTokens,"goal.budget.defaultTokens",t,{min:1}),f=ut(i.defaultMainTurns,"goal.budget.defaultMainTurns",t,{min:1}),d=ut(i.defaultActiveSeconds,"goal.budget.defaultActiveSeconds",t,{min:1}),p=dp(a.profile,"goal.subagent.profile",gp,t),h=ut(a.maxTurns,"goal.subagent.maxTurns",t,{min:1}),m=ut(a.maxTokens,"goal.subagent.maxTokens",t,{min:1}),y=ut(a.timeoutSeconds,"goal.subagent.timeoutSeconds",t,{min:1}),g={...p!==void 0?{profile:p}:{},...h!==void 0?{maxTurns:h}:{},...m!==void 0?{maxTokens:m}:{},...y!==void 0?{timeoutSeconds:y}:{}};return{config:{...c!==void 0?{objectiveMaxChars:c}:{},...l!==void 0?{verification:l}:{},budget:{...u!==void 0?{defaultTokens:u}:{},...f!==void 0?{defaultMainTurns:f}:{},...d!==void 0?{defaultActiveSeconds:d}:{},graceSteps:Ut(i.graceSteps,"goal.budget.graceSteps",he.budget.graceSteps,t,{min:0,max:fa.budget.graceSteps})},breaker:{repeatedReplyLimit:Ut(r.repeatedReplyLimit,"goal.breaker.repeatedReplyLimit",he.breaker.repeatedReplyLimit,t,{min:1})},verifier:{repeatedNotMetLimit:Ut(o.repeatedNotMetLimit,"goal.verifier.repeatedNotMetLimit",he.verifier.repeatedNotMetLimit,t,{min:1}),evidence:fp(o.evidence,"goal.verifier.evidence",mp,he.verifier.evidence,t)},evaluator:{modelPolicy:fp(s.modelPolicy,"goal.evaluator.modelPolicy",hp,he.evaluator.modelPolicy,t),maxTokens:Ut(s.maxTokens,"goal.evaluator.maxTokens",he.evaluator.maxTokens,t,{min:1}),timeoutSeconds:Ut(s.timeoutSeconds,"goal.evaluator.timeoutSeconds",he.evaluator.timeoutSeconds,t,{min:1}),maxRetries:Ut(s.maxRetries,"goal.evaluator.maxRetries",he.evaluator.maxRetries,t,{min:0,max:fa.evaluator.maxRetries})},...Object.keys(g).length>0?{subagent:g}:{}},warnings:t}}function $t(e,t,n){return e===void 0?{}:e===null||typeof e!="object"||Array.isArray(e)?(n.push(He(t,"expected an object; using defaults")),{}):e}function jt(e,t,n,i){for(let r of Object.keys(e))i.includes(r)||n.push(He(`${t}.${r}`,"unknown key ignored"))}function Ut(e,t,n,i,r){return e==null?n:!Number.isInteger(e)||e<r.min?(i.push(He(t,`expected an integer >= ${r.min}; using default`)),n):r.max!=null&&e>r.max?(i.push(He(t,`exceeds maximum ${r.max}; clamped`)),r.max):e}function ut(e,t,n,i){if(e!=null){if(!Number.isInteger(e)||e<i.min){n.push(He(t,`expected an integer >= ${i.min}; ignored`));return}return i.max!=null&&e>i.max?(n.push(He(t,`exceeds maximum ${i.max}; clamped`)),i.max):e}}function fp(e,t,n,i,r){return e==null?i:typeof e!="string"||!n.includes(e)?(r.push(He(t,`expected one of: ${n.join(", ")}; using default`)),i):e}function dp(e,t,n,i){if(e!=null){if(typeof e!="string"||!n.includes(e)){i.push(He(t,`expected one of: ${n.join(", ")}; ignored`));return}return e}}function He(e,t){return`Invalid goal config at ${e}: ${t}`}var Ae={enabled:!0,maxInlineKiB:64,mcpDetailsMaxInlineKiB:32,watermarkKiB:256,minSavingsKiB:256,minCandidateKiB:2,keepRecentRounds:5},AA=Math.floor(Number.MAX_SAFE_INTEGER/1024);function pa(e){let t=_A(e)?e:{};return{enabled:typeof t.enabled=="boolean"?t.enabled:Ae.enabled,maxInlineKiB:Rn(t.maxInlineKiB,Ae.maxInlineKiB),mcpDetailsMaxInlineKiB:Rn(t.mcpDetailsMaxInlineKiB,Ae.mcpDetailsMaxInlineKiB),watermarkKiB:Rn(t.watermarkKiB,Ae.watermarkKiB),minSavingsKiB:Rn(t.minSavingsKiB,Ae.minSavingsKiB),minCandidateKiB:Rn(t.minCandidateKiB,Ae.minCandidateKiB),keepRecentRounds:wA(t.keepRecentRounds,Ae.keepRecentRounds)}}function Rn(e,t){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0&&e<=AA?e:t}function wA(e,t){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0?e:t}function _A(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Pn={};function ma(e){if(e==null||typeof e!="object"||Array.isArray(e))return{...Pn};let t=Reflect.get(e,"chromePath");return typeof t!="string"||!t.trim()?{...Pn}:{chromePath:t.trim()}}import{isIP as EA}from"node:net";function bp(e){return{enabled:!1,filesystemMode:"full_access"}}function Sp(e){return!e.enabled||e.filesystemMode==="full_access"?{enabled:!1,filesystemMode:"full_access"}:{...e}}function ya(e){let t=bp(e);return{enabled:t.enabled,filesystem:{policy:{mode:t.filesystemMode},denyRead:[],denyWrite:[]},network:{policy:{mode:"allow_all"},deniedDomains:[]},localAccess:"open"}}var ga=ya(process.platform),xA=new Set(["read_only","workspace_write","delete_guard","full_access"]),kA=new Set(["deny","allow_all"]);function ba(e,t=process.platform){let n=ya(t);if(e===void 0)return n;let i=Fn(e,"sandbox",["enabled","filesystem","network","localAccess"]),r=i.filesystem===void 0?{}:Fn(i.filesystem,"sandbox.filesystem",["policy","denyRead","denyWrite","allowGitConfig"]),o=r.policy===void 0?{}:Fn(r.policy,"sandbox.filesystem.policy",["mode"]),s=i.network===void 0?{}:Fn(i.network,"sandbox.network",["policy","deniedDomains"]),a=s.policy===void 0?{}:Fn(s.policy,"sandbox.network.policy",["mode"]),l=i.enabled===void 0?n.enabled:CA(i.enabled,"sandbox.enabled"),c=o.mode??(l?"delete_guard":"full_access");if(typeof c!="string"||!xA.has(c))throw new Error(`Invalid sandbox.filesystem.policy.mode "${String(c)}"`);let u=a.mode??n.network.policy.mode;if(typeof u!="string"||!kA.has(u))throw new Error(`Invalid sandbox.network.policy.mode "${String(u)}"`);let f=s.deniedDomains===void 0?[...n.network.deniedDomains]:ha(s.deniedDomains,"sandbox.network.deniedDomains");for(let p of f)OA(p);let d=Sp({enabled:l,filesystemMode:c});return{enabled:d.enabled,filesystem:{policy:{mode:d.filesystemMode},denyRead:r.denyRead===void 0?[...n.filesystem.denyRead]:ha(r.denyRead,"sandbox.filesystem.denyRead"),denyWrite:r.denyWrite===void 0?[...n.filesystem.denyWrite]:ha(r.denyWrite,"sandbox.filesystem.denyWrite")},network:{policy:{mode:"allow_all"},deniedDomains:[]},localAccess:i.localAccess===void 0?n.localAccess:i.localAccess==="open"||i.localAccess==="restricted"?i.localAccess:(()=>{throw new Error(`Invalid sandbox.localAccess "${String(i.localAccess)}"`)})()}}function Fn(e,t,n){if(e==null||typeof e!="object"||Array.isArray(e))throw new Error(`Invalid ${t}: expected object`);let i=e,r=Object.keys(i).find(o=>!n.includes(o));if(r)throw new Error(`Unknown ${t}.${r}`);return i}function CA(e,t){if(typeof e!="boolean")throw new Error(`Invalid ${t}: expected boolean`);return e}function ha(e,t){if(!Array.isArray(e)||e.some(n=>typeof n!="string"))throw new Error(`Invalid ${t}: expected string array`);return[...e]}function OA(e){let t=()=>{throw new Error(`Invalid sandbox.network.deniedDomains entry "${e}"`)},n=e.match(/^\[([^\]]+)\](?::(.+))?$/);if(n){EA(n[1]??"")!==6&&t(),vp(n[2],e);return}(e.match(/:/g)??[]).length>1&&t();let i=e.lastIndexOf(":"),r=i>-1?e.slice(0,i):e,o=i>-1?e.slice(i+1):void 0;vp(o,e),r!=="*"&&(TA(r)||t())}function TA(e){if(e.includes("://")||e.includes("/")||e.includes(":"))return!1;if(e==="localhost")return!0;if(e.startsWith("*.")){let n=e.slice(2).split(".");return n.length>=2&&n.every(i=>i.length>0)}return e.includes("*")?!1:e.includes(".")&&!e.startsWith(".")&&!e.endsWith(".")}function vp(e,t){if(e===void 0)return;let n=Number(e);if(!/^[1-9][0-9]{0,4}$/.test(e)||!Number.isInteger(n)||n>65535)throw new Error(`Invalid sandbox.network.deniedDomains entry "${t}"`)}var dr={maxConcurrentPerSession:4};function Sa(e){let n=(e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{}).maxConcurrentPerSession;return{maxConcurrentPerSession:typeof n=="number"&&Number.isSafeInteger(n)&&n>0?n:dr.maxConcurrentPerSession}}function Ap(e,t){return t.length===0?!1:t.includes("*")?!0:t.includes(e)}function NA(){return process.env.__MAVIS_ALLOW_LEGACY_RUNTIME_ENV==="1"}var wp={dev:"test",test:"test",staging:"staging",prod:"prod"};function RA(e){return e==="cn"||e==="en"}function Op(e){return e==="test"||e==="prod"||e==="dev"||e==="staging"}function Tp(){let e=process.env.MAVIS_REGION;if(RA(e))return e;if(mr()){let t=process.env.NEXT_PUBLIC_LOCALE;if(t==="zh")return"cn";if(t==="en")return"en"}return"en"}function Te(){let e=process.env.MAVIS_BUILD_ENV;if(Op(e))return e;if(mr()){let t=process.env.NEXT_PUBLIC_BUILD_ENV,n=t&&Object.prototype.hasOwnProperty.call(wp,t)?wp[t]:void 0;if(n)return n}return"dev"}function pr(){if(Lp("managed"))return!0;let e=process.env.__MAVIS_RUNTIME_MANAGED;return e==="1"?!0:e==="0"?!1:!!(mr()||Te()==="prod"||Te()==="staging")}function mr(){let e=process.versions;return process.env.ELECTRON_RUN_AS_NODE==="1"||typeof e.electron=="string"}function hr(){return`${Tp()}-${Te()}`}var Ce={none:0,test:1,internal:2,online:3},PA={internal:"internal",inside:"online"};function FA(e){for(let[t,n]of Object.entries(e)){if(Ce[n.defaultVisibility]>Ce[n.configurableVisibility])throw new Error(`Invalid beta feature definition "${t}": defaultVisibility (${n.defaultVisibility}) must not exceed configurableVisibility (${n.configurableVisibility})`);for(let i of n.defaultBuildVariants??[]){let r=PA[i];if(Ce[r]>Ce[n.configurableVisibility])throw new Error(`Invalid beta feature definition "${t}": defaultBuildVariant (${i}) must not exceed configurableVisibility (${n.configurableVisibility})`)}for(let i of n.defaultBuildEnvironments??[])if(Ce[i==="prod"?"online":"test"]>Ce[n.configurableVisibility])throw new Error(`Invalid beta feature definition "${t}": defaultBuildEnvironment (${i}) must not exceed configurableVisibility (${n.configurableVisibility})`)}}var Bn={autoMemory:{defaultVisibility:"online",configurableVisibility:"online"},skillEvolve:{defaultVisibility:"test",configurableVisibility:"online"},skillEvolveBuiltinMr:{defaultVisibility:"none",configurableVisibility:"test"},skillProposal:{defaultVisibility:"test",configurableVisibility:"online"},browserBridge:{defaultVisibility:"test",configurableVisibility:"online"},filePanelBrowser:{defaultVisibility:"online",configurableVisibility:"online"},filePanelBrowserMultiTab:{defaultVisibility:"online",configurableVisibility:"online"},browserUseTooling:{defaultVisibility:"online",configurableVisibility:"online"},browserUseAutoOpenPanel:{defaultVisibility:"online",configurableVisibility:"online"},browserAgentCursor:{defaultVisibility:"online",configurableVisibility:"online"},desktopPlanMode:{defaultVisibility:"online",configurableVisibility:"online"},desktopPlanModeAgentEntry:{defaultVisibility:"none",configurableVisibility:"online"},peek:{defaultVisibility:"test",configurableVisibility:"test"},keepAlive:{defaultVisibility:"test",configurableVisibility:"test"},promptOverride:{defaultVisibility:"test",configurableVisibility:"test"},asr:{defaultVisibility:"online",configurableVisibility:"online"},taskHistoryProjectGrouping:{defaultVisibility:"online",configurableVisibility:"online"},threadGoal:{defaultVisibility:"online",configurableVisibility:"online"},mcodeTools:{defaultVisibility:"none",defaultBuildEnvironments:["dev","test","staging","prod"],defaultPlatforms:["darwin","linux","win32"],configurableVisibility:"online"},codexOAuth:{defaultVisibility:"online",configurableVisibility:"online"}};FA(Bn);function DA(e){return(e.buildEnv??Te())!=="prod"?"test":e.internalBuild===!0?"internal":"online"}function BA(e,t){let n=e.defaultBuildVariants;return n?t.internalBuild===!0&&n.includes("internal")||t.insideBuild===!0&&n.includes("inside"):!1}function qA(e,t){let n=t.defaultBuildEnvironment??t.buildEnv??_a();return e.defaultBuildEnvironments?.includes(n)===!0}function _a(){let e=mr()?process.env.NEXT_PUBLIC_BUILD_ENV:void 0;return Op(e)?e:Te()}function _p(e,t){return e.defaultPlatforms?.includes(t.platform??process.platform)!==!1}function Ea(e,t,n={}){let i=Bn[e],r=Ce[DA(n)],o=n.defaultBuildEnvironment??n.buildEnv??_a();return e==="mcodeTools"&&o==="dev"&&n.mcodeToolsDevMode==="published"&&_p(i,n)?!0:t===!1?!1:t===!0?r<=Ce[i.configurableVisibility]:_p(i,n)?qA(i,n)||BA(i,n)?!0:r<=Ce[i.defaultVisibility]:!1}function $A(e){return Bn[e].configurableVisibility==="online"}function xa(e=process.env){return e.__MAVIS_BUILD_INTERNAL==="true"}function jA(e=process.env){return e.__MAVIS_BUILD_INSIDE==="true"}var UA={APP_DIR:".minimax",ENV_PREFIX:"minimax",CLI_NAME:"minimax"},Ip="__MAVIS_RUNTIME";function yr(e){return NA()?process.env[`${Ip}_${e}`]:void 0}function gr(e){let t=`--${e}`;for(let n=2;n<process.argv.length;n++){let i=process.argv[n];if(i===t)return process.argv[n+1];if(i?.startsWith(`${t}=`))return i.slice(t.length+1)}}function Lp(e){let t=`--${e}`;return process.argv.slice(2).some(n=>n===t||n.startsWith(`${t}=`))}var Kt=5321,Aa=5001,va=65535,Mp=500,ka=2,KA=Mp*ka,Np=KA+ka,Ep=1,VA=new Set(["agent-archon","mavis"]),xp=(()=>{let t=new Uint32Array(256);for(let n=0;n<256;n++){let i=n<<24;for(let r=0;r<8;r++)i=(i&2147483648)!==0?79764919^i<<1:i<<1,i>>>=0;t[n]=i>>>0}return t})();function YA(e){let t=Buffer.from(`${e}
|
|
191
|
-
`,"utf-8"),n=0;for(let r of t)n=(
|
|
192
|
-
`)){let n=/file:\/\/[^)\s]+/u.exec(t)?.[0]?.replace(/:\d+:\d+$/u,"");if(n)try{return oe.dirname(MA(n))}catch{}let i=/\(?((?:\/|[A-Za-z]:\\)[^()]+?\.(?:cjs|mjs|js|ts)):\d+:\d+\)?/u.exec(t)?.[1];if(i)return oe.dirname(i)}}function QA(){let e=Sr();return e||(br()?dt().profile:null)}function Ca(){let e=Sr();if(HA())return wa();if(br()){let n=dt();if(n.autoDetected&&n.profile)return Ge({profile:n.profile})}let t=wa();return t||(e?Ge({profile:e}):Ge())}function Vt(){return oe.join(Ca(),"config.yaml")}var vr={"cn-test":"https://agent.minimaxi.com/mavis/api/v1/llm/v1","cn-dev":"https://agent.minimaxi.com/mavis/api/v1/llm/v1","cn-staging":"https://agent.minimaxi.com/mavis/api/v1/llm/v1","en-test":"https://agent.minimax.io/mavis/api/v1/llm/v1","en-dev":"https://agent.minimax.io/mavis/api/v1/llm/v1","en-staging":"https://agent.minimax.io/mavis/api/v1/llm/v1","cn-prod":"https://agent.minimax.cn/mavis/api/v1/llm/v1","en-prod":"https://agent.minimax.io/mavis/api/v1/llm/v1"},Dp=["https://agent.minimaxi.com/mavis/api/v1/llm/v1"],zA=new Set([...Object.values(vr),...Dp]),ZA=new Set([...Object.values(vr),...Dp].map(e=>new URL(e).origin));function Bp(e){if(zA.has(e))return!0;try{let t=new URL(e);return!t.username&&!t.password&&ZA.has(t.origin)}catch{return!1}}function qp(){return Te()==="test"}function ew(){return!qp()}function tw(e){if(!pr()||!Oe.existsSync(e))return;let t=$p(e),{provider:n}=t;if(n==null||typeof n!="object"||Array.isArray(n))return;let{minimax:i}=n;if(i==null||typeof i!="object"||Array.isArray(i))return;let{options:r}=i;if(r==null||typeof r!="object"||Array.isArray(r))return;let o=r.baseURL;if(typeof o!="string")return;let s=vr[hr()];if(o===s||!Bp(o))return;let a=Oe.readFileSync(e);r.baseURL=s;try{let l=a.toString("utf-8");it(e,Nn(l,Mn(l),t))}catch(l){let c=!1;try{c=Oe.readFileSync(e).equals(a)}catch{}if(!c)throw l;console.warn("[config] managed preset baseURL sync skipped; config file unchanged, using runtime provider settings")}}function Je(e){return{provider:{minimax:{name:"MiniMax",npm:"@ai-sdk/anthropic",options:{authMode:"managed-login",apiKey:"sk-xxx",baseURL:vr[e]},models:_t}},defaultModel:"minimax/MiniMax-M3.1-Flash-Preview"}}var Oa={"cn-test":Je("cn-test"),"cn-dev":Je("cn-dev"),"cn-staging":Je("cn-staging"),"cn-prod":Je("cn-prod"),"en-test":Je("en-test"),"en-dev":Je("en-dev"),"en-staging":Je("en-staging"),"en-prod":Je("en-prod")},X={logLevel:"info",devPort:Aa,permissionMode:"auto",sseErrorPush:{history:!0,stream:!0},beta:Object.fromEntries(Object.keys(Bn).map(e=>[e,Ea(e,void 0,{buildEnv:"dev"})])),agents:{default:{}},memory:{enabled:!0,proactive:!1,dailyDigest:{enabled:!1},v2:{...nr}},subagent:{...dr},skillEvolve:{enabled:!0,inSession:{N:20,minIntervalSeconds:30,maxPendingPerSession:1},signalCooldownHours:24,minConfidence:.7,excludeAgents:["skill-editor"],disableModelPrefixes:["MiniMax-M2"],builtinMrEnabled:!1,sourceRepo:void 0,proposal:{enabled:!1,eligibleAgents:["mavis"],minMessageCount:40,skipPassiveSessionEnd:!0},lifecycle:{staleThresholdDays:15,archiveThresholdDays:30}},sessionRotate:{enabled:!0,activeSessionLookbackHours:12},agentStop:{debounceMs:500,maxActiveSpanMs:1800*1e3},asr:{...ar},skills:cr,askUser:{...ca},dataContribution:{...We},sessionTitle:{enabled:!0},cli:{spawn:{enabled:!1}},browser:{...Pn},tui:{},opencode:{xdg:{dataIsolation:!1,startupImport:"off"},keepAlive:{enabled:!1,maxProcesses:5,maxLifetimeMs:288e5,agents:["mavis","main","verifier","code-reviewer"]},spawnConcurrency:3},contextManagement:{disableSystemReminderModels:[],cuMaxScreenshotsInContext:2},runawayGuard:{enabled:!0},toolResultCompaction:{...Ae},agentRuntime:{defaultFramework:Bt},logRetentionDays:3,worktreeRefreshBeforeCreate:!0,review:{mode:"subagent",turnDiffCard:"concise",modeSource:"default"},goal:structuredClone(he),sandbox:structuredClone(ga),goalWarnings:[]};function nw(){let e=Vt(),t=oe.dirname(e);if(Oe.existsSync(t)||Oe.mkdirSync(t,{recursive:!0}),Oe.existsSync(e)){Ia(e);return}if(!pr()){let r=Ge({homeDir:IA.homedir()}),o=oe.join(r,"config.yaml");e!==o&&Oe.existsSync(o)&&(Et(o),it(e,Oe.readFileSync(o),!0));return}let n=Oa[hr()],i=H.dump({logLevel:X.logLevel,provider:Ta?n.provider:void 0,defaultModel:n.defaultModel,dataContribution:{enabled:We.enabled},memory:{enabled:!1}});it(e,i,!0)}function $p(e=Vt()){return Mn(iw(e))}function iw(e=Vt()){try{return Oe.readFileSync(e,"utf-8")}catch{return""}}var Dn=null;function rw(e){if(e==null||typeof e!="object"||Array.isArray(e))return;let t=e;return{branchFinish:typeof t.branchFinish=="boolean"?t.branchFinish:!1}}var jp={isManagedRuntime:pr,shouldEnforceManagedProviderProtection:ew,getManagedPreset:()=>Oa[hr()],isManagedPresetBaseUrl:Bp},Up=!0,Ta=!0;function ow(e){Up=e}function sw(e){Ta=e}function Ia(e){Et(e),Bd(e),Up&&Fd(e,jp),Ta&&tw(e)}function Ar(){Dn=null}function wr(){if(Dn)return Dn;nw();let e=$p();return Dn=La(e,Ca()),Dn}function La(e,t){let n=e.sseErrorPush,i=n!=null&&typeof n=="object"&&!Array.isArray(n)?n:void 0,r=typeof e.devPort=="number"?e.devPort:X.devPort;if(br()&&!Fp()){let c=dt();c.autoDetected&&(r=c.uiPort)}let o=da(e.goal),s=Dd({provider:e.provider!=null&&typeof e.provider=="object"&&!Array.isArray(e.provider)?Md(e.provider):{},defaultModel:typeof e.defaultModel=="string"?e.defaultModel:void 0},jp),a=Vs(e.minimaxModelContextLimits),l=aw(e);return{logLevel:typeof e.logLevel=="string"?e.logLevel:X.logLevel,devPort:r,...s,provider:Id(s.provider,a),defaultModelVariant:typeof e.defaultModelVariant=="string"?e.defaultModelVariant:void 0,defaultModelThinking:e.defaultModelThinking&&typeof e.defaultModelThinking=="object"&&typeof e.defaultModelThinking.effort=="string"?{effort:e.defaultModelThinking.effort}:void 0,defaultModelContextWindow:Number.isSafeInteger(e.defaultModelContextWindow)&&Number(e.defaultModelContextWindow)>0&&Number(e.defaultModelContextWindow)<=2147483647?Number(e.defaultModelContextWindow):void 0,minimax_api:Od(e.minimax_api),minimaxModelContextLimits:a,custom_provider:Ld(e.custom_provider),minimaxModelSource:typeof e.minimaxModelSource=="string"&&(e.minimaxModelSource==="token_plan"||e.minimaxModelSource==="minimax_api_key")?e.minimaxModelSource:void 0,nexus:e.nexus!=null&&typeof e.nexus=="object"&&!Array.isArray(e.nexus)?(()=>{let c={};typeof Reflect.get(e.nexus,"enabled")=="boolean"&&(c.enabled=Reflect.get(e.nexus,"enabled"));let u=Reflect.get(e.nexus,"model");return u!=null&&typeof u=="object"&&!Array.isArray(u)&&typeof Reflect.get(u,"providerID")=="string"&&typeof Reflect.get(u,"modelID")=="string"&&(c.model={providerID:Reflect.get(u,"providerID"),modelID:Reflect.get(u,"modelID"),...typeof Reflect.get(u,"variant")=="string"?{variant:Reflect.get(u,"variant")}:{}}),Object.keys(c).length>0?c:void 0})():void 0,defaultLightModel:typeof e.defaultLightModel=="string"?e.defaultLightModel:void 0,permissionMode:typeof e.permissionMode=="string"&&["default","bypassPermissions","auto","off"].includes(e.permissionMode)?e.permissionMode:X.permissionMode,permission:Kd(e),sseErrorPush:{history:typeof i?.history=="boolean"?i.history:X.sseErrorPush.history,stream:typeof i?.stream=="boolean"?i.stream:X.sseErrorPush.stream},notifications:rw(e.notifications),dataDir:t,agentsDir:oe.join(t,"agents"),sessionsDir:oe.join(t,"sessions"),memoryDir:oe.join(t,"memory"),skillsDir:oe.join(t,"skills"),builtinSkillsDir:oe.join(t,".builtin-skills"),logsDir:oe.join(t,"logs"),pluginsDir:oe.join(t,"plugins"),plansDir:oe.join(t,"plans"),harnessesDir:oe.join(t,"harnesses"),subAgentsDir:oe.join(t,"subagents"),beta:l,agents:la(e.agents),memory:Ed(e,X.memory),subagent:Sa(e.subagent),skillEvolve:uw(e,l),sessionRotate:fw(e),agentStop:dw(e),asr:Ud(e),skills:Gs(e),askUser:cp(e,X.askUser),dataContribution:ua(e,X.dataContribution),sessionTitle:pw(e),cli:mw(e),browser:ma(e.browser),tui:xd(e),opencode:$d(e,X.opencode),contextManagement:hw(e),runawayGuard:ro(e.runawayGuard),toolResultCompaction:pa(e.toolResultCompaction),agentRuntime:Ws(e.agentRuntime),logRetentionDays:yw(e),contentReview:gw(e),mcpToolSearch:bw(e),review:qd(e.review,X.review),worktreeRefreshBeforeCreate:e.worktreeRefreshBeforeCreate!==!1,promptConfig:Kp(e.promptConfig),goal:o.config,goalWarnings:o.warnings,sandbox:ba(e.sandbox)}}function aw(e){let t=e.beta!=null&&typeof e.beta=="object"&&!Array.isArray(e.beta)?e.beta:{},n={buildEnv:Te(),defaultBuildEnvironment:_a(),internalBuild:xa(),insideBuild:jA(),mcodeToolsDevMode:process.env.MAVIS_DEV_MCODE_TOOLS_MODE==="published"?"published":void 0},i={};for(let r of Object.keys(Bn))i[r]=Ea(r,t[r],n);return i}function lw(e){let t=e.provider;if(t==null||typeof t!="object"||Array.isArray(t))return[];let n=[];for(let i of Object.values(t)){if(i==null||typeof i!="object"||Array.isArray(i))continue;let{models:r}=i;r==null||typeof r!="object"||Array.isArray(r)||n.push(...Object.keys(r))}return n}function cw(e,t){if(t.length===0)return!0;let n=lw(e);if(n.length===0)return!1;let i=t.map(r=>r.toLowerCase());return!n.every(r=>i.some(o=>r.toLowerCase().startsWith(o)))}function Cp(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function uw(e,t){let n=X.skillEvolve,i=e.skillEvolve,o=i!=null&&typeof i=="object"&&!Array.isArray(i)?i:{},s=o.inSession,{inSession:a}=n;if(s!=null&&typeof s=="object"&&!Array.isArray(s)){let E=s;a={N:typeof E.N=="number"&&E.N>0?E.N:n.inSession.N,minIntervalSeconds:typeof E.minIntervalSeconds=="number"&&E.minIntervalSeconds>=0?E.minIntervalSeconds:n.inSession.minIntervalSeconds,maxPendingPerSession:typeof E.maxPendingPerSession=="number"&&E.maxPendingPerSession>=1?E.maxPendingPerSession:n.inSession.maxPendingPerSession}}let l=o.excludeAgents,c=Array.isArray(l)&&l.every(E=>typeof E=="string")?l:n.excludeAgents,u=Array.isArray(o.disableModelPrefixes)&&o.disableModelPrefixes.every(E=>typeof E=="string")?o.disableModelPrefixes:n.disableModelPrefixes,f=t.skillEvolve?typeof o.enabled=="boolean"?o.enabled:cw(e,u):!1,d=f&&t.skillEvolveBuiltinMr?typeof o.builtinMrEnabled=="boolean"?o.builtinMrEnabled:n.builtinMrEnabled:!1,p=o.sourceRepo,h=typeof p=="string"&&p.trim().length>0?p.trim():n.sourceRepo,m=o.proposal,y=n.proposal,g=m!=null&&typeof m=="object"&&!Array.isArray(m)?m:{},b=Array.isArray(g.eligibleAgents)&&g.eligibleAgents.every(E=>typeof E=="string")?g.eligibleAgents:y.eligibleAgents,v=typeof g.minMessageCount=="number"&&g.minMessageCount>=1?Math.floor(g.minMessageCount):y.minMessageCount,x=typeof g.skipPassiveSessionEnd=="boolean"?g.skipPassiveSessionEnd:y.skipPassiveSessionEnd,k=typeof g.enabled=="boolean"?g.enabled:null,C=f&&t.skillProposal?k??!0:!1,L=o.lifecycle,w=L&&typeof L=="object"&&!Array.isArray(L)?L:{},A=Cp(w.staleThresholdDays,n.lifecycle.staleThresholdDays),O=Cp(w.archiveThresholdDays,n.lifecycle.archiveThresholdDays);if(!(A<O))throw new Error(`Invalid skillEvolve.lifecycle config: staleThresholdDays (${A}) must be strictly less than archiveThresholdDays (${O}).`);return{enabled:f,inSession:a,signalCooldownHours:typeof o.signalCooldownHours=="number"&&o.signalCooldownHours>0?o.signalCooldownHours:n.signalCooldownHours,minConfidence:typeof o.minConfidence=="number"&&o.minConfidence>=0&&o.minConfidence<=1?o.minConfidence:n.minConfidence,scannerModel:typeof o.scannerModel=="string"?o.scannerModel:void 0,excludeAgents:c,disableModelPrefixes:u,builtinMrEnabled:d,sourceRepo:h,proposal:{enabled:C,eligibleAgents:b,minMessageCount:v,skipPassiveSessionEnd:x},lifecycle:{staleThresholdDays:A,archiveThresholdDays:O}}}function fw(e){let t=X.sessionRotate,n=e.sessionRotate;if(n==null||typeof n!="object"||Array.isArray(n))return{...t};let i=n,r=i.activeSessionLookbackHours;return{enabled:typeof i.enabled=="boolean"?i.enabled:t.enabled,activeSessionLookbackHours:typeof r=="number"&&Number.isFinite(r)&&r>0?r:t.activeSessionLookbackHours}}function dw(e){let t=X.agentStop,n=e.agentStop;if(n==null||typeof n!="object"||Array.isArray(n))return{...t};let i=n,r=i.debounceMs,o=i.maxActiveSpanMs;return{debounceMs:typeof r=="number"&&Number.isFinite(r)&&r>=0?r:t.debounceMs,maxActiveSpanMs:typeof o=="number"&&Number.isFinite(o)&&o>=0?o:t.maxActiveSpanMs}}function Kp(e){let t=Te()==="prod"&&!xa();if(e==null||typeof e!="object"||Array.isArray(e))return{autoUpdate:t};let n=e.autoUpdate;return{autoUpdate:typeof n=="boolean"?n:t}}function pw(e){let t=X.sessionTitle,n=e.sessionTitle;if(n==null||typeof n!="object"||Array.isArray(n))return{...t};let i=n;return{enabled:typeof i.enabled=="boolean"?i.enabled:t.enabled}}function mw(e){let t=X.cli,n=e.cli;if(n==null||typeof n!="object"||Array.isArray(n))return{spawn:{...t.spawn}};let i=n.spawn;if(i==null||typeof i!="object"||Array.isArray(i))return{spawn:{...t.spawn}};let r=i;return{spawn:{enabled:typeof r.enabled=="boolean"?r.enabled:t.spawn.enabled}}}function hw(e){let t=X.contextManagement,n=e.contextManagement;if(n==null||typeof n!="object"||Array.isArray(n))return{disableSystemReminderModels:[...t.disableSystemReminderModels],cuMaxScreenshotsInContext:t.cuMaxScreenshotsInContext};let i=n,r=i.disableSystemReminderModels,o=Array.isArray(r)&&r.every(l=>typeof l=="string"&&l.length>0)?r:[...t.disableSystemReminderModels],s=i.cuMaxScreenshotsInContext,a=typeof s=="number"&&Number.isFinite(s)&&s>=0?Math.floor(s):t.cuMaxScreenshotsInContext;return{disableSystemReminderModels:o,cuMaxScreenshotsInContext:a}}function yw(e){let t=e.logRetentionDays;return typeof t=="number"&&t>=1&&Number.isFinite(t)?Math.floor(t):X.logRetentionDays}function gw(e){let t=e.contentReview;if(t==null||typeof t!="object"||Array.isArray(t))return;let n={},i=Reflect.get(t,"enabled");typeof i=="boolean"&&(n.enabled=i);let r=Reflect.get(t,"testBaseURL");return typeof r=="string"&&r.trim()&&(n.testBaseURL=r.trim()),Object.keys(n).length>0?n:void 0}function bw(e){let t=e.mcpToolSearch;if(t==null||typeof t!="object"||Array.isArray(t))return;let n={},i=Reflect.get(t,"enabled");typeof i=="boolean"&&(n.enabled=i);let r=Reflect.get(t,"systemHint");typeof r=="boolean"&&(n.systemHint=r);let o=Reflect.get(t,"thresholdPct");typeof o=="number"&&(n.thresholdPct=o);let s=Reflect.get(t,"minDeferCount");typeof s=="number"&&(n.minDeferCount=s);let a=Reflect.get(t,"topKDefault");typeof a=="number"&&(n.topKDefault=a);let l=Reflect.get(t,"topKMax");typeof l=="number"&&(n.topKMax=l);let c=Reflect.get(t,"maxSchemaTextLen");typeof c=="number"&&(n.maxSchemaTextLen=c);let u=Reflect.get(t,"modelWhitelist");return Array.isArray(u)&&(n.modelWhitelist=u.filter(f=>typeof f=="string")),Object.keys(n).length>0?n:void 0}function Vp(){let e=Pp();if(br()&&!Fp()){let t=dt();if(t.autoDetected)return t.runtimePort}return e??Kt}function Sw(e=Vp()){let t=e+Np;if(t<=va)return t;let n=e+Ep;if(n<=va)return n;throw new Error(`Cannot allocate an OpenCode sidecar port for runtime port ${String(e)}; choose a runtime port <= ${String(va-Ep)}.`)}var vw=["agent.minimaxi.com","agent.minimaxi.com","agent.minimax.io","agent.minimax.io","agent.minimax.io","agent.minimax.cn","agent.minimaxi.com"],Aw=new Set(vw.map(e=>`https://${e}`));function ww(e,t){return/^custom_provider:minimax-legacy(?:-\d+)?$/u.test(e)&&(!t||Ma(t))}function Ma(e){try{let t=new URL(e);return t.username||t.password?!1:Aw.has(t.origin.toLowerCase())}catch{return!1}}function _w(e){if(!(e!=="managed-login"&&e!=="api-key"&&e!=="oauth"))return e}function Na(e){let t=typeof e?.baseURL=="string"?e.baseURL.trim():"",n=t.length>0&&Ma(t),i=_w(e?.authMode),r=[];return typeof e?.authMode=="string"&&!i&&r.push(`Unknown provider authMode "${e.authMode}"; falling back to compatibility resolution.`),i?(i==="managed-login"&&t.length>0&&!n&&!e?.allowManagedBaseURLOverride&&r.push("Provider authMode is managed-login but baseURL is not a known managed MiniMax host."),{authMode:i,source:"explicit",managedBaseURL:n,warnings:r}):n?(r.push("Provider authMode is inferred from a managed MiniMax baseURL; set options.authMode: managed-login to make this explicit."),{authMode:"managed-login",source:"inferred-managed-base-url",managedBaseURL:n,warnings:r}):{authMode:"api-key",source:"default-api-key",managedBaseURL:n,warnings:r}}var Ie="minimax",Yt="minimax_api",Ra="custom_provider:";function Ew(e,t){return e==="anthropic-messages"&&(t===Ie||t===Yt)}function Pa(e,t){if(t===Yt)return"minimax_api_key";if(t.startsWith(Ra))return"custom_provider";if(t!==Ie)return"configured_provider";if(e.minimaxModelSource==="minimax_api_key")return"minimax_api_key";let n=e.provider?.[t]?.options;return Na({authMode:n?.authMode,baseURL:n?.baseURL}).authMode==="managed-login"?"managed_token_plan":"configured_provider"}function Yp(e,t,n){switch(Pa(e,t)){case"managed_token_plan":return _r(e.provider?.[t],!0);case"minimax_api_key":{let r=e.provider?.[Ie];return _r({...r,models:r?.models??_t},!0)}case"custom_provider":{let r=e.custom_provider?.[t.slice(Ra.length)];return!r||r.enabled===!1?[]:_r(r)}case"configured_provider":return _r(e.provider?.[t])}}function xw(e){let t=Pa(e.config,e.providerId),n=e.modelId.trim();return n.length>0&&Yp(e.config,e.providerId,e.preset).includes(n)?{available:!0,route:t}:{available:!1,route:t,code:e.source==="config_default"?"DEFAULT_MODEL_NOT_AVAILABLE_FOR_ROUTE":"MODEL_NOT_AVAILABLE_FOR_ROUTE",message:`Model "${e.providerId}/${e.modelId}" is not available for the "${t}" route (preset ${e.preset}).`}}function _r(e,t=!1){let n=Object.entries(e?.models??{}).filter(([,s])=>s?.enabled!==!1).map(([s])=>s),i=e?.model_order;if(!t||!Array.isArray(i)||!i.every(s=>typeof s=="string"))return n;let r=new Set(n);return[...i.filter(s=>r.delete(s)),...n.filter(s=>r.has(s))]}var kw=/^\$\{([A-Za-z_][A-Za-z0-9_]*)\}$/;function Fa(e){if(typeof e=="string")return kw.exec(e.trim())?.[1]}function Gp(e){let{field:t,provider:n,value:i}=e;if(i==null)return;if(typeof i!="string")throw new Error(`Provider "${n}": ${t} must be a string or a \`\${NAME}\` environment variable reference, received ${Tw(i)}.`);let r=i.trim();if(!r)return;let o=Fa(r);if(!o)return r;let s=(e.env??process.env)[o]?.trim();if(!s)throw new Error(`Provider "${n}": ${t} references environment variable "${o}", which is not set.`);return s}function Cw(e){if(!(typeof e.value=="string"&&e.value.trim().length>0))return{configured:!1};let n=Ow(e.value)?"env":"plaintext";try{let i=Gp(e);return{configured:!0,source:n,...i?{secret:i}:{}}}catch{return{configured:!0,source:n}}}function Ow(e){return Fa(e)!==void 0}function Tw(e){return Array.isArray(e)?"a list":`a ${typeof e}`}import{randomBytes as Iw}from"node:crypto";import pt,{readFileSync as Lw}from"node:fs";import{dirname as Wp,join as Mw}from"node:path";var Hp=Cr(no(),1);var Ba=384,Er=new Set(["__proto__","prototype","constructor"]),Nw=["minimax_api","custom_provider"];async function Rw(e){let t=e.trim();if(!t||t.includes(".")||Er.has(t))throw new ne("Invalid provider id");return $n(async n=>(ye(n.provider)&&delete n.provider[t],{write:!0,value:void 0})).then(({config:n})=>({config:n}))}async function Pw(e){if(!ye(e)||!ye(e.models))throw new ne("Invalid managed MiniMax provider snapshot");return xr(e),$n(async t=>(t.provider={...ye(t.provider)?t.provider:{},[Ie]:structuredClone(e)},{write:!0,value:void 0})).then(({config:t})=>({config:t}))}var ne=class extends Error{name="LocalModelProviderConfigValidationError"},qn=class extends Error{name="LocalModelProviderConfigWriteError";constructor(){super("Local runtime failed to update config file")}};async function Fw(e){return $n(async(t,n)=>{let i={minimax_api:ye(t.minimax_api)?t.minimax_api:void 0,custom_provider:jw(ye(t.custom_provider)?t.custom_provider:void 0),minimaxModelSource:typeof t.minimaxModelSource=="string"?t.minimaxModelSource:void 0,defaultModel:typeof t.defaultModel=="string"?t.defaultModel:void 0,defaultModelVariant:typeof t.defaultModelVariant=="string"?t.defaultModelVariant:void 0};await e(i,n);for(let r of Nw){let o=i[r];if(o===void 0){delete t[r];continue}if(!ye(o))throw new ne(`Invalid BYOK config subtree "${r}"`);xr(o),t[r]=o}return Da(t,"minimaxModelSource",i.minimaxModelSource),t.defaultModel!==i.defaultModel&&(delete t.defaultModelThinking,delete t.defaultModelContextWindow),Da(t,"defaultModel",i.defaultModel),Da(t,"defaultModelVariant",i.defaultModelVariant),{write:!0,value:void 0}}).then(({config:t})=>({config:t}))}async function Dw(e){let t=e.modelKey.trim();if(!t)throw new ne("Default model must not be empty");if(e.contextLimit!==void 0&&(!Number.isSafeInteger(e.contextLimit)||e.contextLimit<=0||e.contextLimit>2147483647))throw new ne("Invalid default context");if(e.thinking?.effort!==void 0&&(typeof e.thinking.effort!="string"||!e.thinking.effort.trim()))throw new ne("Invalid default effort");return $n(async n=>(n.defaultModel=t,e.contextLimit===void 0?delete n.defaultModelContextWindow:n.defaultModelContextWindow=e.contextLimit,e.thinking?.effort===void 0?delete n.defaultModelThinking:n.defaultModelThinking={effort:e.thinking.effort},e.variant===void 0?delete n.defaultModelVariant:n.defaultModelVariant=e.variant,{write:!0,value:void 0})).then(({config:n})=>({config:n}))}async function Bw(e,t){let n=e.modelId.trim();if(e.providerId!==Ie&&e.providerId!==Yt||!n||Er.has(n))throw new ne("Invalid MiniMax model context target");let i=await $n(async(r,o)=>{let s=e.providerId===Ie?o.provider?.[e.providerId]?.models?.[n]:Ys(o)[n];if(e.providerId===Yt&&!s?.contextWindowOptions?.includes(e.contextLimit))throw new ne("Invalid MiniMax API context limit");if(s?.limit?.context!==e.expectedContextLimit)return{write:!1,value:!1};if(!await t(o))return{write:!1,value:!1};let a=e.providerId===Ie?["minimaxModelContextLimits",n]:["minimax_api","modelContextLimits",n];return Uw(r,a,e.contextLimit),{write:!0,value:!0}});return{config:i.config,updated:i.value}}async function $n(e){let t=Vt(),n;try{await pt.promises.mkdir(Wp(t),{recursive:!0}),await pt.promises.writeFile(t,"",{flag:"a",mode:Ba}),await pt.promises.chmod(t,Ba),n=await Hp.default.lock(t,{stale:1e4,retries:{retries:20,factor:1,minTimeout:5,maxTimeout:25}});let i=$w(t),r=structuredClone(i);Ar();let o=await e(r,wr());return o.write&&(xr(r),await qw(t,Nn(Lw(t,"utf-8"),i,r)),Ar()),{config:wr(),value:o.value}}catch(i){throw i instanceof ne||i instanceof qn?i:new qn}finally{await n?.().catch(()=>{})}}async function qw(e,t){let n=Mw(Wp(e),`.config-tmp-${Iw(6).toString("hex")}`),i=!1;try{let r=Ba,o=await pt.promises.open(n,"wx",r);i=!0;try{await o.writeFile(t,"utf-8"),await o.chmod(r)}finally{await o.close()}await pt.promises.rename(n,e)}catch{throw i&&await pt.promises.unlink(n).catch(()=>{}),new qn}}function $w(e){let t=pt.readFileSync(e,"utf-8"),n;try{n=H.load(t)}catch{throw new ne("Invalid config.yaml: unable to parse YAML")}if(n==null)return{};if(!ye(n)||Object.getPrototypeOf(n)!==Object.prototype)throw new ne("Invalid config.yaml: expected a YAML mapping");return n}function jw(e){if(e)return Object.fromEntries(Object.entries(e).filter(([,t])=>ye(t)))}function Da(e,t,n){n===void 0?delete e[t]:e[t]=n}function Uw(e,t,n){let i=t.at(-1);if(!i)throw new ne("Invalid config path");let r=e;for(let o of t.slice(0,-1)){if(!o||Er.has(o))throw new ne("Invalid config path");let s=r[o];if(ye(s))r=s;else{let a={};r[o]=a,r=a}}r[i]=n}function xr(e){for(let[t,n]of Object.entries(e)){if(!t||Er.has(t))throw new ne(`Local runtime cannot update config field segment "${t}"`);ye(n)&&xr(n)}}function ye(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function zw(e){let t=e.trim();if(!t)return null;if(t.startsWith("{"))try{let i=JSON.parse(t),r=typeof i.pid=="number"?i.pid:parseInt(String(i.pid),10);if(isNaN(r)||r<=0)return null;let o=Zw(i.owner)?i.owner:"unknown",s=e_(i.startedAt);return{pid:r,owner:o,...s!==void 0?{startedAt:s}:{},...typeof i.mode=="string"?{mode:i.mode}:{},...typeof i.startupToken=="string"?{startupToken:i.startupToken}:{}}}catch{return null}let n=parseInt(t,10);return isNaN(n)||n<=0?null:{pid:n,owner:"unknown"}}function Zw(e){return e==="electron"||e==="cli"||e==="unknown"}function e_(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e!="string")return;let t=new Date(e).getTime();return Number.isFinite(t)?t:void 0}function t_(e,t){let n={pid:e,owner:t,startedAt:Date.now()};return JSON.stringify(n)}function n_(){let e=process.argv.slice(2);for(let t=0;t<e.length;t++){let n=e[t],i=n==="--owner"?e[t+1]:n?.startsWith("--owner=")?n.slice(8):void 0;if(i==="electron")return"electron";if(i==="service"||i==="cli")return"cli"}return"cli"}import Xe from"node:fs";import i_ from"node:path";var Jp="local-runtime.auth.json";function we(e){return typeof e=="string"&&e.trim().length>0?e.trim():void 0}function qa(e){return e?{...we(e.accessToken)?{accessToken:we(e.accessToken)}:{},...we(e.realUserID)?{realUserID:we(e.realUserID)}:{},...we(e.userEmail)?{userEmail:we(e.userEmail)}:{},...we(e.userName)?{userName:we(e.userName)}:{},...we(e.subUserName)?{subUserName:we(e.subUserName)}:{}}:{}}function kr(e){return i_.join(e,Jp)}function r_(e){try{let t=Xe.readFileSync(kr(e),"utf-8"),n=JSON.parse(t);if(n.version!==1||!n.auth||typeof n.auth!="object")return;let i=qa(n.auth);return i.accessToken?i:void 0}catch{return}}function o_(e,t,n={}){let i=kr(e),r=qa(t);if(!r.accessToken)return Xp(e),{path:i,written:!1};Xe.mkdirSync(e,{recursive:!0,mode:448});let o={version:1,updatedAtMs:Date.now(),auth:r},s=`${i}.${process.pid}.${Date.now()}.tmp`;return Xe.writeFileSync(s,`${JSON.stringify(o,null,2)}
|
|
193
|
-
`,{encoding:"utf-8",mode:384}),n.retryWindowsFileSystem?(
|
|
186
|
+
`+e.slice(s+1):l+=e.slice(r),l.slice(1)}function iy(e){for(var t="",n=0,i,r=0;r<e.length;n>=65536?r+=2:r++)n=Wt(e,r),i=te[n],!i&&Qt(n)?(t+=e[r],n>=65536&&(t+=e[r+1])):t+=i||Hh(n);return t}function ry(e,t,n){var i="",r=e.tag,o,s,a;for(o=0,s=n.length;o<s;o+=1)a=n[o],e.replacer&&(a=e.replacer.call(n,String(o),a)),(we(e,t,a,!1,!1)||typeof a>"u"&&we(e,t,null,!1,!1))&&(i!==""&&(i+=","+(e.condenseFlow?"":" ")),i+=e.dump);e.tag=r,e.dump="["+i+"]"}function rl(e,t,n,i){var r="",o=e.tag,s,a,l;for(s=0,a=n.length;s<a;s+=1)l=n[s],e.replacer&&(l=e.replacer.call(n,String(s),l)),(we(e,t+1,l,!0,!0,!1,!0)||typeof l>"u"&&we(e,t+1,null,!0,!0,!1,!0))&&((!i||r!=="")&&(r+=Pr(e,t)),e.dump&&Jt===e.dump.charCodeAt(0)?r+="-":r+="- ",r+=e.dump);e.tag=o,e.dump=r||"[]"}function oy(e,t,n){var i="",r=e.tag,o=Object.keys(n),s,a,l,c,u;for(s=0,a=o.length;s<a;s+=1)u="",i!==""&&(u+=", "),e.condenseFlow&&(u+='"'),l=o[s],c=n[l],e.replacer&&(c=e.replacer.call(n,l,c)),we(e,t,l,!1,!1)&&(e.dump.length>1024&&(u+="? "),u+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),we(e,t,c,!1,!1)&&(u+=e.dump,i+=u));e.tag=r,e.dump="{"+i+"}"}function sy(e,t,n,i){var r="",o=e.tag,s=Object.keys(n),a,l,c,u,f,d;if(e.sortKeys===!0)s.sort();else if(typeof e.sortKeys=="function")s.sort(e.sortKeys);else if(e.sortKeys)throw new ie("sortKeys must be a boolean or a function");for(a=0,l=s.length;a<l;a+=1)d="",(!i||r!=="")&&(d+=Pr(e,t)),c=s[a],u=n[c],e.replacer&&(u=e.replacer.call(n,c,u)),we(e,t+1,c,!0,!0,!0)&&(f=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,f&&(e.dump&&Jt===e.dump.charCodeAt(0)?d+="?":d+="? "),d+=e.dump,f&&(d+=Pr(e,t)),we(e,t+1,u,!0,f)&&(e.dump&&Jt===e.dump.charCodeAt(0)?d+=":":d+=": ",d+=e.dump,r+=d));e.tag=o,e.dump=r||"{}"}function ol(e,t,n){var i,r,o,s,a,l;for(r=n?e.explicitTypes:e.implicitTypes,o=0,s=r.length;o<s;o+=1)if(a=r[o],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof t=="object"&&t instanceof a.instanceOf)&&(!a.predicate||a.predicate(t))){if(n?a.multi&&a.representName?e.tag=a.representName(t):e.tag=a.tag:e.tag="?",a.represent){if(l=e.styleMap[a.tag]||a.defaultStyle,Fl.call(a.represent)==="[object Function]")i=a.represent(t,l);else if(Bl.call(a.represent,l))i=a.represent[l](t,l);else throw new ie("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');e.dump=i}return!0}return!1}function we(e,t,n,i,r,o,s){e.tag=null,e.dump=n,ol(e,n,!1)||ol(e,n,!0);var a=Fl.call(e.dump),l=i,c;i&&(i=e.flowLevel<0||e.flowLevel>t);var u=a==="[object Object]"||a==="[object Array]",f,d;if(u&&(f=e.duplicates.indexOf(n),d=f!==-1),(e.tag!==null&&e.tag!=="?"||d||e.indent!==2&&t>0)&&(r=!1),d&&e.usedDuplicates[f])e.dump="*ref_"+f;else{if(u&&d&&!e.usedDuplicates[f]&&(e.usedDuplicates[f]=!0),a==="[object Object]")i&&Object.keys(e.dump).length!==0?(sy(e,t,e.dump,r),d&&(e.dump="&ref_"+f+e.dump)):(oy(e,t,e.dump),d&&(e.dump="&ref_"+f+" "+e.dump));else if(a==="[object Array]")i&&e.dump.length!==0?(e.noArrayIndent&&!s&&t>0?rl(e,t-1,e.dump,r):rl(e,t,e.dump,r),d&&(e.dump="&ref_"+f+e.dump)):(ry(e,t,e.dump),d&&(e.dump="&ref_"+f+" "+e.dump));else if(a==="[object String]")e.tag!=="?"&&ty(e,e.dump,t,o,l);else{if(a==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new ie("unacceptable kind of an object to dump "+a)}e.tag!==null&&e.tag!=="?"&&(c=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",e.dump=c+" "+e.dump)}return!0}function ay(e,t){var n=[],i=[],r,o;for(Fr(e,n,i),r=0,o=i.length;r<o;r+=1)t.duplicates.push(n[i[r]]);t.usedDuplicates=new Array(o)}function Fr(e,t,n){var i,r,o;if(e!==null&&typeof e=="object")if(r=t.indexOf(e),r!==-1)n.indexOf(r)===-1&&n.push(r);else if(t.push(e),Array.isArray(e))for(r=0,o=e.length;r<o;r+=1)Fr(e[r],t,n);else for(i=Object.keys(e),r=0,o=i.length;r<o;r+=1)Fr(e[i[r]],t,n)}function ly(e,t){t=t||{};var n=new Xh(t);n.noRefs||ay(e,n);var i=e;return n.replacer&&(i=n.replacer.call({"":i},"",i)),we(n,0,i,!0,!0)?n.dump+`
|
|
187
|
+
`:""}var cy=ly,uy={dump:cy};function Kr(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var fy=z,dy=ll,py=dl,my=gl,hy=bl,yy=qr,gy=Dl.load,by=Dl.loadAll,Sy=uy.dump,vy=ie,Ay={binary:wl,float:yl,map:fl,null:pl,pairs:xl,set:kl,timestamp:Al,bool:ml,int:hl,merge:_l,omap:El,seq:ul,str:cl},_y=Kr("safeLoad","load"),wy=Kr("safeLoadAll","loadAll"),Ey=Kr("safeDump","dump"),H={Type:fy,Schema:dy,FAILSAFE_SCHEMA:py,JSON_SCHEMA:my,CORE_SCHEMA:hy,DEFAULT_SCHEMA:yy,load:gy,loadAll:by,dump:Sy,YAMLException:vy,types:Ay,safeLoad:_y,safeLoadAll:wy,safeDump:Ey};var Cc=Or(io(),1);async function ng(e,t){let n=xc(e,"config.yaml"),i,r=!1,o;try{await Pe.mkdir(e,{recursive:!0}),await Pe.writeFile(n,"",{flag:"a",mode:384});let s=await Pe.realpath(n);i=xc(tg(s),`.config-tmp-${eg(6).toString("hex")}`),o=await Cc.default.lock(s,{stale:1e4,retries:{retries:20,factor:1,minTimeout:5,maxTimeout:25}}),await Pe.chmod(s,384);let a=await Pe.readFile(s,"utf8"),c=(a.trim()===""?void 0:H.load(a))??{};if(!kc(c))throw new Error("Invalid config document");let u=c.tui??{};if(!kc(u))throw new Error("Invalid TUI settings");let f={...u};t===void 0?delete f.statusLine:f.statusLine=[...t];let d={...c,tui:f},p=384,h=await Pe.open(i,"wx",p);r=!0;try{await h.writeFile(H.dump(d,{lineWidth:-1,noRefs:!0}),"utf8"),await h.chmod(p)}finally{await h.close()}await Pe.rename(i,s)}catch{throw new Error("Unable to save status line settings. Check config.yaml syntax and permissions.")}finally{r&&i&&await Pe.unlink(i).catch(()=>{}),await o?.().catch(()=>{})}}function kc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&Object.getPrototypeOf(e)===Object.prototype}function ro(e){if(typeof e!="object"||e===null||Array.isArray(e))return{};let t=e.enabled;return typeof t=="boolean"?{enabled:t}:{}}function oo(e,t){return{enabled:ro(t).enabled??ro(e).enabled??!0}}var Oc={support_files_api:!0,files_api_upload_endpoint:"/v1/files/upload",max_image_bytes_inline:10485760,max_video_bytes_inline:52428800,max_request_body_bytes:67108864,max_attachments_count:4,max_images_per_request:20},wt={"MiniMax-M3":{name:"MiniMax-M3",attachment:!0,reasoning:!0,tool_call:!0,temperature:!0,modalities:{input:["text","image","video"],output:["text"]},limit:{context:512e3,output:128e3},contextWindowOptions:[512e3,1e6],contextWindowOptionHints:{1e6:"higher_usage"},options:{reasoningSummary:"auto"},thinking_config:{mode:"switchable",default_value:"true"},variants:{"none-thinking":{thinking:{type:"disabled"}},thinking:{thinking:{type:"adaptive"}}},capabilities:Oc},"MiniMax-M3.1-Flash-Preview":{name:"M3.1-Flash-Preview",attachment:!0,reasoning:!0,tool_call:!0,temperature:!0,modalities:{input:["text","image","video"],output:["text"]},limit:{context:512e3,output:128e3},contextWindowOptions:[512e3,1e6],contextWindowOptionHints:{1e6:"higher_usage"},options:{reasoningSummary:"auto"},thinking:{effortOptions:["default","low","medium","high","xhigh","max"],defaultEffort:"default"},thinking_config:{mode:"forced_on"},variants:{"none-thinking":{thinking:{type:"disabled"}},thinking:{thinking:{type:"adaptive"}}},capabilities:Oc},"MiniMax-M2.7-highspeed":{name:"MiniMax-M2.7-highspeed",attachment:!1,reasoning:!0,tool_call:!0,temperature:!0,modalities:{input:["text"],output:["text"]},limit:{context:2e5,output:128e3}},"MiniMax-M2.7":{name:"MiniMax-M2.7",attachment:!1,reasoning:!0,tool_call:!0,temperature:!0,modalities:{input:["text"],output:["text"]},limit:{context:2e5,output:128e3}}};import Oe from"node:fs";import be from"node:fs";var Tc=384;function Et(e){if(process.platform==="win32")return;let t=be.statSync(e).mode;(t&63)!==0&&be.chmodSync(e,t&448)}function it(e,t,n=!1){let i=be.constants.O_WRONLY|be.constants.O_CREAT|(n?be.constants.O_EXCL:0),r=be.openSync(e,i,Tc);try{be.fchmodSync(r,Tc),be.ftruncateSync(r,0),be.writeFileSync(r,t)}finally{be.closeSync(r)}}import{isDeepStrictEqual as Us}from"node:util";var Y=Or(Sd(),1);function Ln(e){try{let t=H.load(e);return Dt(t)?t:{}}catch{return{}}}function Nn(e,t,n){let i=(0,Y.parseDocument)(e,{schema:"core",compat:"yaml-1.1",customTags:["timestamp"],merge:!0});if(i.errors.length>0||!(0,Y.isMap)(i.contents)&&e.trim()!=="")return Ad(n);try{let r=js(t,n);if(r.length===0)return e;Iv(i),Mv(i),Lv(i,Ln(e));for(let l of r){let c=wd(i,l.path);l.kind==="delete"?i.deleteIn(c):l.kind==="reorder"?Ed(i,c,l.keys):i.setIn(c,l.value)}let o=i.toString({indent:2,lineWidth:-1}),s=H.load(o),a=H.load(Ad(n));if(!Us(s,a)||js(s,a).some(l=>l.kind==="reorder"))throw new Error("The serialized configuration does not match the intended values");return o}catch(r){throw new Error(`config.yaml could not be rewritten: ${r instanceof Error?r.message:String(r)}${r instanceof RangeError?". Remove the self-referential YAML anchor and retry.":""}`)}}function Iv(e){(0,Y.visit)(e,{Scalar(t,n){if(n.addToJSMap||typeof n.source!="string"||n.type!=="PLAIN"&&!n.tag)return;let i=n.type==="PLAIN"&&!n.source.includes(`
|
|
188
|
+
`)?n.source:JSON.stringify(n.source),r=n.tag?`!<${n.tag}> `:"",o=H.load(`value: ${r}${i}`).value;Us(n.value,o)||(n.value=o,delete n.format)}})}function _d(e,t){return e.items.find(n=>(0,Y.isScalar)(n.key)&&String(n.key.value)===t)?.key??t}function wd(e,t){let n=[],i=e.contents;for(let r of t)n.push((0,Y.isMap)(i)?_d(i,r):r),i=e.getIn(n,!0);return n}function Mv(e){let t=new Map;(0,Y.visit)(e,{Alias(n,i){let r=i.toJS(e),o=vd(e,r);o.comment=i.comment,o.commentBefore=i.commentBefore,o.spaceBefore=i.spaceBefore,t.set(i,o)}}),(0,Y.visit)(e,{Alias:(n,i)=>t.get(i)}),(0,Y.visit)(e,{Map(n,i){let r=i.items.filter(a=>(0,Y.isScalar)(a.key)&&a.key.addToJSMap);if(r.length===0)return;let o=i.toJS(e),s=r.flatMap(a=>[a.key,a.value].flatMap(l=>(0,Y.isNode)(l)?[l.commentBefore,l.comment]:[]));i.commentBefore=[i.commentBefore,...s].filter(Boolean).join(`
|
|
189
|
+
`)||void 0,i.items=i.items.filter(a=>!r.includes(a));for(let[a,l]of Object.entries(o))i.has(_d(i,a))||i.set(a,vd(e,l))}}),e.setSchema(e.directives?.yaml.version??"1.2",{schema:"core",compat:"yaml-1.1",customTags:["timestamp"],merge:!1})}function vd(e,t){let n=e.createNode(t,{aliasDuplicateObjects:!1});return(0,Y.visit)(n,{Pair(i,r){(0,Y.isScalar)(r.key)&&r.key.value==="<<"&&(r.key.type="QUOTE_DOUBLE")}}),n}function Lv(e,t){if(Dt(t.custom_provider))for(let[n,i]of Object.entries(t.custom_provider)){if(!Dt(i)||!Dt(i.models))continue;let r=wd(e,["custom_provider",n,"models"]);Ed(e,r,Object.keys(i.models))}}function Ed(e,t,n){let i=e.getIn(t,!0);if(!(0,Y.isMap)(i))throw new Error("Expected a model mapping when applying config order");let r=new Map(i.items.map(o=>[(0,Y.isScalar)(o.key)?String(o.key.value):o.key,o]));i.items=n.map(o=>{let s=r.get(o);if(!s)throw new Error("Expected an existing model when applying config order");return s})}function js(e,t,n=[]){if(!Dt(e)||!Dt(t))return Nv(e,t)?[]:[{kind:"set",path:n,value:t}];let i=[];for(let r of new Set([...Object.keys(e),...Object.keys(t)])){let o=[...n,r];!(r in t)||t[r]===void 0?i.push({kind:"delete",path:o}):r in e?i.push(...js(e[r],t[r],o)):i.push({kind:"set",path:o,value:t[r]})}if(n.length===3&&n[0]==="custom_provider"&&n[2]==="models"){let r=Object.keys(t).filter(o=>t[o]!==void 0);Us(Object.keys(e),r)||i.push({kind:"reorder",path:n,keys:r})}return i}function Nv(e,t){if(e===t)return!0;if(e===null||t===null||typeof e!="object"||typeof t!="object")return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}function Ad(e){return H.dump(e,{indent:2,lineWidth:-1,noRefs:!0})}function Dt(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Ft(e){if(typeof e!="object"||e===null)return!1;if("v2_enabled"in e&&typeof e.v2_enabled=="boolean")return e.v2_enabled;if(!("v2"in e))return!1;let t=e.v2;return typeof t!="object"||t===null?!1:"enabled"in t&&typeof t.enabled=="boolean"?t.enabled:"writeEnabled"in t&&t.writeEnabled===!0||"recallEnabled"in t&&t.recallEnabled===!0}var ir={enabled:!1,detailedLoggingEnabled:!1,writeEnabled:!1,recallEnabled:!1,eligibleSessionIdleMs:600*1e3,maxCaptureInputTokens:64e3,maxSessionDocBytes:64*1024,maxSelectedSessions:256,maxConsolidationInputTokens:256e3,maxMemoryMarkdownBytes:2*1024*1024,maxSummaryInjectionTokens:2500,maxCaptureSessionsPerWake:6,maxCaptureConcurrency:2,eligibleSessionMaxAgeDays:30,maxCaptureAttemptsPerRevision:3,captureFailureBackoffMs:3600*1e3,publicationCooldownMs:360*60*1e3,maxConsolidationAgentTurns:64,minModelQuotaRemainingPercent:25,captureModel:void 0,captureReasoningEffort:"low",consolidationModel:void 0,consolidationReasoningEffort:"medium",retentionDays:90};function Cd(e,t){let n=e.memory,i=n!=null&&typeof n=="object"&&!Array.isArray(n)?n:{},r=i.dailyDigest,o=r!=null&&typeof r=="object"&&!Array.isArray(r)?r:{},s=i.v2,a=s!=null&&typeof s=="object"&&!Array.isArray(s)?s:{},l=t.v2,c=i.legacyRecallDisabledAgents;return{legacyRecallDisabledAgents:c&&typeof c=="object"&&!Array.isArray(c)?Object.fromEntries(Object.entries(c).filter(([,u])=>typeof u=="boolean")):{},enabled:typeof i.enabled=="boolean"?i.enabled:t.enabled,proactive:typeof i.proactive=="boolean"?i.proactive:t.proactive,dailyDigest:{enabled:typeof o.enabled=="boolean"?o.enabled:t.dailyDigest.enabled},v2_enabled:typeof i.v2_enabled=="boolean"||["enabled","writeEnabled","recallEnabled"].some(u=>typeof a[u]=="boolean")?Ft(i):Ft(t),v2:{...typeof a.enabled=="boolean"?{enabled:a.enabled}:{},detailedLoggingEnabled:Ks(a.detailedLoggingEnabled,l.detailedLoggingEnabled),writeEnabled:Ks(a.writeEnabled,l.writeEnabled),recallEnabled:Ks(a.recallEnabled,l.recallEnabled),eligibleSessionIdleMs:re(a.eligibleSessionIdleMs,l.eligibleSessionIdleMs),maxCaptureInputTokens:re(a.maxCaptureInputTokens,l.maxCaptureInputTokens),maxSessionDocBytes:re(a.maxSessionDocBytes,l.maxSessionDocBytes),maxSelectedSessions:re(a.maxSelectedSessions,l.maxSelectedSessions),maxConsolidationInputTokens:re(a.maxConsolidationInputTokens,l.maxConsolidationInputTokens),maxMemoryMarkdownBytes:re(a.maxMemoryMarkdownBytes,l.maxMemoryMarkdownBytes),maxSummaryInjectionTokens:re(a.maxSummaryInjectionTokens,l.maxSummaryInjectionTokens),maxCaptureSessionsPerWake:re(a.maxCaptureSessionsPerWake,l.maxCaptureSessionsPerWake),maxCaptureConcurrency:re(a.maxCaptureConcurrency,l.maxCaptureConcurrency),eligibleSessionMaxAgeDays:re(a.eligibleSessionMaxAgeDays,l.eligibleSessionMaxAgeDays),maxCaptureAttemptsPerRevision:re(a.maxCaptureAttemptsPerRevision,l.maxCaptureAttemptsPerRevision),captureFailureBackoffMs:re(a.captureFailureBackoffMs,l.captureFailureBackoffMs),publicationCooldownMs:re(a.publicationCooldownMs,l.publicationCooldownMs),maxConsolidationAgentTurns:re(a.maxConsolidationAgentTurns,l.maxConsolidationAgentTurns),minModelQuotaRemainingPercent:Rv(a.minModelQuotaRemainingPercent,l.minModelQuotaRemainingPercent),captureModel:xd(a.captureModel,l.captureModel),captureReasoningEffort:kd(a.captureReasoningEffort,l.captureReasoningEffort),consolidationModel:xd(a.consolidationModel,l.consolidationModel),consolidationReasoningEffort:kd(a.consolidationReasoningEffort,l.consolidationReasoningEffort),retentionDays:re(a.retentionDays,l.retentionDays)}}}function Ks(e,t){return typeof e=="boolean"?e:t}function re(e,t){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0?e:t}function Rv(e,t){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0&&e<=100?e:t}function xd(e,t){return typeof e=="string"&&e.trim().length>0?e.trim():t}function kd(e,t){return e==="low"||e==="medium"||e==="high"?e:t}function Pv(e,t){return!Ft(e)&&e?.enabled!==!1&&e?.legacyRecallDisabledAgents?.[t]!==!0}import oe from"node:path";import RA from"node:os";import{spawnSync as PA}from"node:child_process";import{fileURLToPath as DA}from"node:url";function Od(e){let t=e.tui;if(t==null||typeof t!="object"||Array.isArray(t))return{};let n=t,i=n.notifications,r;if(i&&typeof i=="object"&&!Array.isArray(i)){let{when:l,method:c}=i;r={...l==="unfocused"||l==="always"||l==="never"?{when:l}:{},...c==="auto"||c==="osc9"||c==="osc777"||c==="bel"?{method:c}:{}}}let o=n.statusLine,s=Array.isArray(o)?o.filter(l=>typeof l=="string").map(l=>l.trim()).filter(Boolean):void 0,a=Dv(n.customStatusLine);return{...typeof n.showTips=="boolean"?{showTips:n.showTips}:{},...r?{notifications:r}:{},...s?{statusLine:s}:{},...a?{customStatusLine:a}:{}}}function Dv(e){if(e==null||typeof e!="object"||Array.isArray(e))return;let t=e,n=typeof t.command=="string"?t.command.trim():"";if(n)return{command:n,...t.display==="inline"||t.display==="block"?{display:t.display}:{},...t.position==="above"||t.position==="below"?{position:t.position}:{},...t.colorMode==="plain"||t.colorMode==="ansi"?{colorMode:t.colorMode}:{},...typeof t.maxLines=="number"&&Number.isFinite(t.maxLines)?{maxLines:t.maxLines}:{},...typeof t.timeoutMs=="number"&&Number.isFinite(t.timeoutMs)?{timeoutMs:t.timeoutMs}:{},...typeof t.intervalSeconds=="number"&&Number.isFinite(t.intervalSeconds)?{intervalSeconds:t.intervalSeconds}:{}}}import{createHash as Fv,randomUUID as Bv}from"node:crypto";import or from"node:fs";import rr from"node:path";function Md(e){if(e==null||typeof e!="object"||Array.isArray(e))return;let t=e,n={};typeof t.apiKey=="string"&&(n.apiKey=t.apiKey),typeof t.baseURL=="string"&&(n.baseURL=t.baseURL);let i=Ys(t.modelContextLimits);return i&&(n.modelContextLimits=i),Object.keys(n).length>0?n:void 0}function Ys(e){if(!B(e))return;let t=Object.entries(e).filter(n=>n[0].length>0&&Number.isSafeInteger(n[1])&&n[1]>0);return t.length>0?Object.fromEntries(t):void 0}function Ld(e,t){return t?Object.fromEntries(Object.entries(e).map(([n,i])=>{let r=t[n];return[n,r!==void 0&&i.contextWindowOptions?.includes(r)?{...i,limit:{...i.limit,context:r}}:i]})):e}function Gs(e){let t=e.provider?.minimax,n=t?.catalogModels??t?.models??wt;return Ld(Object.fromEntries(Object.entries(n).filter(([,i])=>i.enabled!==!1)),e.minimax_api?.modelContextLimits)}function Nd(e,t){let n=e.minimax;return n?.models?{...e,minimax:{...n,catalogModels:n.models,models:Ld(n.models,t)}}:e}function Rd(e){if(e==null||typeof e!="object"||Array.isArray(e))return;let t=Object.entries(e).filter(([,n])=>n!=null&&typeof n=="object"&&!Array.isArray(n));if(t.length!==0)return Object.fromEntries(t.map(([n,i])=>[n,Dd(i)]))}function Pd(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,B(n)?Dd(n):n]))}function Dd(e){if(!B(e.models))return e;let t=!1,n=Object.fromEntries(Object.entries(e.models).map(([i,r])=>{if(!B(r)||!B(r.thinking))return[i,r];let o=typeof r.thinking.effort=="string"?r.thinking.effort.trim():"",s=typeof r.thinking.defaultEffort=="string"?r.thinking.defaultEffort.trim():"";if(!Object.hasOwn(r.thinking,"effort")&&!Object.hasOwn(r.thinking,"defaultEffort"))return[i,r];let a=[],l=new Set;if(Array.isArray(r.thinking.effortOptions))for(let d of r.thinking.effortOptions){if(typeof d!="string")continue;let p=d.trim();!p||l.has(p)||(l.add(p),a.push(p))}o&&!l.has(o)&&(l.add(o),a.push(o)),s&&!l.has(s)&&(l.add(s),a.push(s));let c={...r.thinking};delete c.effort,delete c.effortOptions,delete c.defaultEffort;let u={...c,...a.length>0?{effortOptions:a}:{},...s?{defaultEffort:s}:{}},f={...r};return Object.keys(u).length>0?f.thinking=u:delete f.thinking,t=!0,[i,f]}));return t?{...e,models:n}:e}var Fd="byok_legacy_provider_to_custom_provider_v1",Bd="config.yaml.bak.byok-legacy-provider.",Vs=new Set(["minimax","minimax_api","provider","custom_provider"]),qv=/^[A-Za-z0-9 _-]+$/;function qd(e,t){let n={migrated:!1,migratedProviders:{}};if(!t.isManagedRuntime()||!or.existsSync(e))return n;let i=Uv(e);if(!B(i.provider))return n;let r=i.provider,o=B(i.custom_provider)?i.custom_provider:{},s=Qv(i),a={},l={...o},c=new Set(Object.keys(l)),u=!1,f=t.getManagedPreset().provider;for(let[d,p]of Object.entries(r)){if(!Kv(d,p,f))continue;let h=s.providers[d];if(h&&!Vs.has(h)&&!B(l[h])){delete r[d],u=!0;continue}let m=h&&!Vs.has(h)?h:Gv(d,p,c);a[d]=m,B(l[m])||(l[m]=Yv(p),c.add(m),u=!0),s.providers[d]!==m&&(s.providers[d]=m,u=!0),delete r[d],u=!0}if(!u&&Object.keys(a).length===0)return n;if(u=Id(i,"defaultModel",a)||u,u=Id(i,"defaultLightModel",a)||u,u=Jv(i,a)||u,!u)return{migrated:!1,migratedProviders:a};Object.keys(l).length>0?i.custom_provider=l:delete i.custom_provider,zv(i,s);try{let d=Xv(e);return it(e,H.dump(i,{indent:2,lineWidth:-1,noRefs:!0})),{migrated:!0,migratedProviders:a,backupPath:d}}catch(d){return console.warn(`[config] legacy BYOK provider migration skipped: ${eA(d)}`),{migrated:!1,migratedProviders:a}}}function $d(e,t){let n=e.provider,i=e.defaultModel;if(Object.prototype.hasOwnProperty.call(n,"minimax_api")){let{minimax_api:h,...m}=n;n=m,console.warn('[config] "minimax_api" is a reserved provider id; ignoring provider.minimax_api from config.yaml')}let o=t.getManagedPreset().provider.minimax,s=n.minimax,a=t.isManagedRuntime();if(!(a||$v(s,t)))return{provider:n,defaultModel:i};let c=s?.options,u=a&&t.shouldEnforceManagedProviderProtection(),f=jv(o.models,s?.models),d=typeof c?.baseURL=="string"&&c.baseURL.length>0?c.baseURL:void 0,p=u&&d!=null&&!t.isManagedPresetBaseUrl(d);return n={...n,minimax:{...o,...s??{},npm:s?.npm??o.npm,models:f,options:{...o.options??{},...c??{},...p?{apiKey:o.options?.apiKey}:{},...u?{authMode:"managed-login",baseURL:o.options?.baseURL}:{}}}},{provider:n,defaultModel:i}}function $v(e,t){let n=e?.options;return n?.authMode==="managed-login"?!0:typeof n?.baseURL=="string"&&t.isManagedPresetBaseUrl(n.baseURL)}function jv(e,t){return t&&Object.keys(t).length>0?t:e??{}}function Uv(e){try{let t=H.load(or.readFileSync(e,"utf-8"));return B(t)?t:{}}catch{return{}}}function Kv(e,t,n){return e==="minimax"||e==="minimax_api"||!Zv(t)||!Vv(t)?!1:!Object.prototype.hasOwnProperty.call(n,e)}function Vv(e){let t=B(e.options)?e.options:void 0;return typeof t?.apiKey=="string"&&t.apiKey.trim().length>0&&typeof t.baseURL=="string"&&t.baseURL.trim().length>0&&B(e.models)}function Yv(e){let t=B(e.options)?e.options:{};return{...e,kind:"custom",enabled:e.enabled!==!1,options:{...t,authMode:"api-key"}}}function Gv(e,t,n){let i=B(t)?t:{},r=typeof i.name=="string"?i.name:void 0,o=`provider-${Wv(e)}`,s=Td(e)??Td(r)??o;for(let a=0;;a+=1){let l=a===0?s:`${s}-${a+1}`;if(!n.has(l)&&!Vs.has(l))return l}}function Td(e){let t=e?.trim();return!t||!qv.test(t)?void 0:t.toLowerCase().replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")||void 0}function Wv(e){return Fv("sha256").update(e).digest("hex").slice(0,8)}function Id(e,t,n){let i=e[t];if(typeof i!="string")return!1;let r=Hv(i,n);return r===i?!1:(e[t]=r,!0)}function Hv(e,t){let n=e.indexOf("/");if(n<=0||n===e.length-1)return e;let i=e.slice(0,n),r=t[i];return r?`custom_provider:${r}/${e.slice(n+1)}`:e}function Jv(e,t){if(!B(e.nexus)||!B(e.nexus.model))return!1;let n=e.nexus.model.providerID;if(typeof n!="string")return!1;let i=t[n];return i?(e.nexus.model.providerID=`custom_provider:${i}`,!0):!1}function jd(e){if(process.platform==="win32")return;let t=rr.dirname(e),n;try{n=or.readdirSync(t,{withFileTypes:!0})}catch{console.warn(`[config] Could not inspect legacy BYOK backups in ${JSON.stringify(t)}. Backup permissions were not verified; check directory access and restrict backup permissions manually.`);return}for(let i of n)if(i.isFile()&&i.name.startsWith(Bd)){let r=rr.join(t,i.name);try{Et(r)}catch{console.warn(`[config] Could not restrict legacy BYOK backup ${JSON.stringify(r)}. It may still be readable by other users; restrict its permissions manually.`)}}}function Xv(e){let t=rr.join(rr.dirname(e),`${Bd}${Date.now()}.${Bv()}`);return Et(e),it(t,or.readFileSync(e),!0),t}function Qv(e){let n=(B(e.migrations)?e.migrations:void 0)?.[Fd];return{providers:B(n)&&B(n.providers)?Object.fromEntries(Object.entries(n.providers).filter(r=>typeof r[1]=="string")):{}}}function zv(e,t){let n=B(e.migrations)?e.migrations:{};n[Fd]={version:1,providers:t.providers},e.migrations=n}function Zv(e){return B(e)?typeof e.name=="string"||typeof e.npm=="string"||typeof e.api=="string"||B(e.options)||B(e.models):!1}function B(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function eA(e){return e instanceof Error?e.message:String(e)}function Ud(e,t){if(e==null||typeof e!="object"||Array.isArray(e))return t;let n=Reflect.get(e,"mode"),i=Reflect.get(e,"turnDiffCard");return{mode:n==="inline"||n==="subagent"?n:t.mode,turnDiffCard:i==="concise"||i==="standard"?i:t.turnDiffCard,modeSource:n==="inline"||n==="subagent"?"explicit":"default"}}function Kd(e,t){let n=t.keepAlive,i=t.xdg,r=t.spawnConcurrency,o=()=>({enabled:n.enabled,maxProcesses:n.maxProcesses,maxLifetimeMs:n.maxLifetimeMs,agents:[...n.agents]}),s=e.opencode;if(s==null||typeof s!="object"||Array.isArray(s))return{keepAlive:o(),xdg:{...i},spawnConcurrency:r};let a=s,l=a.spawnConcurrency,c=typeof l=="number"&&Number.isFinite(l)&&l>0&&Number.isInteger(l)?l:r,u=tA(a.xdg,i),f=a.keepAlive;if(f==null||typeof f!="object"||Array.isArray(f))return{keepAlive:o(),xdg:u,spawnConcurrency:c};let d=f,p=d.maxProcesses,h=typeof p=="number"&&Number.isFinite(p)&&p>0&&Number.isInteger(p)?p:n.maxProcesses,m=d.maxLifetimeMs,y=typeof m=="number"&&Number.isFinite(m)&&m>0&&Number.isInteger(m)?m:n.maxLifetimeMs,g=d.agents,b;return Array.isArray(g)?(b=g.filter(v=>typeof v=="string"&&v.length>0),b.length===0&&(b=[...n.agents])):b=[...n.agents],{keepAlive:{enabled:typeof d.enabled=="boolean"?d.enabled:n.enabled,maxProcesses:h,maxLifetimeMs:y,agents:b},xdg:u,spawnConcurrency:c}}function tA(e,t){let n=e!=null&&typeof e=="object"&&!Array.isArray(e)?e:void 0,i=n?.startupImport,r=i==="background"||i==="blocking"||i==="off"?i:t.startupImport;return{dataIsolation:typeof n?.dataIsolation=="boolean"?n.dataIsolation:t.dataIsolation,startupImport:r}}function sr(e){let t=JSON.stringify({level:40,time:Date.now(),name:"config.asr",msg:e});process.stderr.write(`${t}
|
|
190
|
+
`)}var lr={enabled:!0};function Vd(e){if(e==null||typeof e!="object"||Array.isArray(e))return!1;let t=e,n=typeof t.apiKey=="string"&&t.apiKey.trim().length>0,i=typeof t.resourceId=="string"&&t.resourceId.trim().length>0;return n||i}function ar(e){return typeof e=="string"&&e.trim().length>0}function Yd(e){let t=e.asr;if(t==null||typeof t!="object"||Array.isArray(t))return{...lr};let n=t;return Vd(n.seed)&&sr("Ignoring legacy `asr.seed.*` in config \u2014 Seed ASR was retired from the daemon; only Amadeus remains. Remove `asr.seed` from config.yaml."),Vd(n.qwen)&&sr("Ignoring legacy `asr.qwen.apiKey` in config \u2014 Qwen ASR was retired from the daemon; only Amadeus remains. Remove `asr.qwen` from config.yaml."),(ar(n.mode)||ar(n.proxyBaseUrl))&&sr("Ignoring legacy `asr.mode` / `asr.proxyBaseUrl` in config \u2014 the daemon no longer runs the shared asr-proxy WebSocket path. The Amadeus HTTP proxy is managed by the application environment. Remove these keys from config.yaml."),(ar(n.primaryProvider)||ar(n.fallbackProvider))&&sr("Ignoring legacy `asr.primaryProvider` / `asr.fallbackProvider` in config \u2014 only Amadeus remains and provider selection is no longer configurable. Remove these keys from config.yaml."),{enabled:typeof n.enabled=="boolean"?n.enabled:lr.enabled}}var nA={policyOwner:"core",storageWriteVersion:2,classifierTimeoutMs:6e4,userConfirmationEnabled:!0};function Gd(e,t=nA){let n=e.permission;if(n==null||typeof n!="object"||Array.isArray(n))return{...t};let i=n,r=i.policyOwner===void 0?t.policyOwner:i.policyOwner==="engine"||i.policyOwner==="core"?i.policyOwner:"engine",o=i.storageWriteVersion===1||i.storageWriteVersion===2?i.storageWriteVersion:t.storageWriteVersion,s=i.classifierTimeoutMs,a=typeof s=="number"&&Number.isFinite(s)&&s>=5e3?Math.floor(s):t.classifierTimeoutMs,l=typeof i.userConfirmationEnabled=="boolean"?i.userConfirmationEnabled:t.userConfirmationEnabled;return{policyOwner:r,storageWriteVersion:o,classifierTimeoutMs:a,userConfirmationEnabled:l}}var Wd=["user-cc","user-codex","user-agents","workspace-minimax","workspace-cc","workspace-agents"],iA={"user-cc":"user-claude","workspace-cc":"workspace-claude"},ur={external:{enabled:!0,walkUp:!0,duplicateWarn:!0,sources:{"workspace-minimax":{enabled:!0,priority:65},"workspace-cc":{enabled:!0,priority:60},"workspace-agents":{enabled:!0,priority:55},"user-cc":{enabled:!0,priority:40},"user-codex":{enabled:!0,priority:35},"user-agents":{enabled:!0,priority:30}}}};function cr(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function rA(e,t){return cr(e)?{enabled:typeof e.enabled=="boolean"?e.enabled:t.enabled,priority:typeof e.priority=="number"&&Number.isFinite(e.priority)?e.priority:t.priority}:t}function Ws(e){let t=ur,n=cr(e.skills)?e.skills:{},i=cr(n.external)?n.external:{},r=cr(i.sources)?i.sources:{},o={...t.external.sources};for(let s of Wd){let a=iA[s],l=Object.hasOwn(r,s)?r[s]:a?r[a]:void 0;o[s]=rA(l,t.external.sources[s])}return{external:{enabled:typeof i.enabled=="boolean"?i.enabled:t.external.enabled,walkUp:typeof i.walkUp=="boolean"?i.walkUp:t.external.walkUp,duplicateWarn:typeof i.duplicateWarn=="boolean"?i.duplicateWarn:t.external.duplicateWarn,sources:o}}}var oA=Wd;var Hd=["pi-agent"],Bt="pi-agent";function Jd(e){return typeof e!="string"?Bt:Hd.includes(e)?e:Bt}function Hs(e){return e==null||typeof e!="object"||Array.isArray(e)?{defaultFramework:Bt}:{defaultFramework:Jd(e.defaultFramework)}}import G from"node:fs";import sA from"node:os";import qt from"node:path";var tp=".minimax",np=".mavis",aA={error:()=>{},info:()=>{},warn:()=>{}};function Zs(e){return e??sA.homedir()}function ip(e,t){return t?`${e}-${t}`:e}function rp(e,t){return qt.join(Zs(e),ip(tp,t))}function op(e,t){return qt.join(Zs(e),ip(np,t))}function Xs(e){try{let t=G.lstatSync(e);return t.isSymbolicLink()?{kind:"link"}:t.isDirectory()?{kind:"directory"}:{kind:"other"}}catch(t){let n=t.code;return n==="ENOENT"||n==="ENOTDIR"?{kind:"missing"}:{kind:"inaccessible",error:t}}}function Js(e){let t=qt.resolve(e);return process.platform==="win32"?(t=t.replace(/^\\\\\?\\/,""),t.toLowerCase()):t}function ea(e,t){try{let n=G.readlinkSync(e),i=Js(t);return Js(qt.resolve(qt.dirname(e),n))===i||Js(n)===i}catch{return!1}}function fr(e,t,n){if(!ea(e,t))try{G.symlinkSync(t,e,process.platform==="win32"?"junction":"dir")}catch(i){n.warn(`Failed to create compat link ${e} -> ${t}: ${String(i)}`)}}function Xd(e,t,n){if(t.kind==="missing")return!0;if(t.kind==="link"||t.kind==="other")try{return G.unlinkSync(e),!0}catch(i){return n.warn(`Failed to remove ${e} before creating compat link: ${String(i)}`),!1}return!1}function Qs(e){try{let t=G.readdirSync(e);if(t.length===0)return"empty";if(t.length===1&&t[0]==="workspace")try{return G.readdirSync(qt.join(e,"workspace")).length>0?"hasData":"empty"}catch{return"unknown"}return"hasData"}catch{return"unknown"}}function zs(e){try{return G.statSync(e).isDirectory()?Qs(e):void 0}catch{return"unknown"}}function lA(e,t){return`${e}.backup-${t()}`}function cA(e,t,n){let i=lA(e,n);try{return G.renameSync(e,i),t.warn(`Backed up legacy data dir ${e} -> ${i}`),!0}catch(r){return t.warn(`Failed to back up legacy data dir ${e}: ${String(r)}`),!1}}function uA(e,t,n,i){if(ea(e,t))return!0;let r=Xs(e);if(r.kind==="missing")return!0;if(r.kind==="link"){let o=zs(e);return o==="hasData"||o==="unknown"?(n.warn(`Cannot replace legacy data dir symlink ${e}; it may point to real data outside ${t}`),!1):Xd(e,r,n)}return r.kind==="other"?Xd(e,r,n):r.kind==="directory"?cA(e,n,i):(n.warn(`Cannot replace inaccessible legacy data dir ${e}; leaving it untouched`),!1)}function Qd(e,t,n,i){uA(e,t,n,i)&&fr(e,t,n)}function fA(e,t){try{return G.rmSync(e,{recursive:!0,force:!1}),!0}catch(n){return t.warn(`Failed to remove empty primary data dir ${e}: ${String(n)}`),!1}}function zd(e,t,n){try{return G.renameSync(e,t),n.info(`Migrated legacy data dir ${e} -> ${t}`),!0}catch(i){return n.warn(`Failed to migrate legacy data dir ${e} -> ${t}: ${String(i)}`),!1}}function dA(e,t,n,i){try{G.cpSync(e,n,{recursive:!0,errorOnExist:!0,force:!1}),G.unlinkSync(t);try{G.rmSync(e,{recursive:!0,force:!1})}catch(r){i.warn(`Copied legacy symlink data dir ${e} -> ${n}, but failed to remove old target: ${String(r)}`)}return i.info(`Copied legacy data dir symlink target ${e} -> ${n}`),!0}catch(r){try{G.existsSync(n)&&G.rmSync(n,{recursive:!0,force:!0})}catch(o){i.warn(`Failed to clean up partial primary data dir ${n}: ${String(o)}`)}return i.warn(`Failed to copy legacy symlink data dir ${t} -> ${n}: ${String(r)}`),!1}}function Zd(e,t,n){try{let i=G.realpathSync(e);try{G.renameSync(i,t)}catch(r){if(r.code==="EXDEV")return dA(i,e,t,n);throw r}return G.unlinkSync(e),n.info(`Migrated legacy data dir symlink target ${i} -> ${t}`),!0}catch(i){return n.warn(`Failed to migrate legacy symlink data dir ${e} -> ${t}: ${String(i)}`),!1}}function ep(e,t){try{return G.mkdirSync(e,{recursive:!0}),!0}catch(n){return t.warn(`Failed to create primary data dir ${e}: ${String(n)}`),!1}}function pA(e,t,n,i){let r=Xs(e),o=Xs(t);if(r.kind==="inaccessible")return n.warn(`Primary data dir ${e} is inaccessible; not treating it as missing`),e;if(r.kind==="directory"){let s=Qs(e),a=o.kind==="directory"?Qs(t):o.kind==="link"?zs(t)??"empty":"empty";if(s==="empty"){if(o.kind==="inaccessible"||a==="unknown")return n.warn(`Legacy data dir ${t} may contain data but is inaccessible; not using empty primary ${e}`),t;if((o.kind==="directory"||o.kind==="link")&&a==="hasData"){if(!fA(e,n))return t;if(o.kind==="link"){if(!Zd(t,e,n))return t}else if(!zd(t,e,n))return t;return fr(t,e,n),e}}return Qd(t,e,n,i),e}if(ea(t,e))return ep(e,n),e;if(o.kind==="directory")return zd(t,e,n)?(fr(t,e,n),e):t;if(o.kind==="link"){let s=zs(t);if(s==="hasData")return Zd(t,e,n)?(fr(t,e,n),e):t;if(s==="unknown")return n.warn(`Legacy data dir symlink ${t} target is inaccessible; not treating it as missing`),t}return o.kind==="inaccessible"?(n.warn(`Legacy data dir ${t} is inaccessible; not treating it as missing`),t):r.kind==="link"||r.kind==="other"?(n.warn(`Primary data dir path ${e} exists but is not a directory; using it without migration`),e):(ep(e,n),Qd(t,e,n,i),e)}function Ge(e={}){let t=Zs(e.homeDir),n=e.profile??null;return pA(rp(t,n),op(t,n),e.logger??aA,e.nowMs??Date.now)}function mA(e,t){return Ge({homeDir:e,logger:t})}function hA(e,t,n){return Ge({homeDir:t,profile:e,logger:n})}var sa=["read","write","edit","bash","task_query","task_output","task_stop","grep","glob","todowrite","web_fetch","website_deploy","workspace_semantic_search"],aa=["images_understand","image_synthesize","images_search_and_download","image_reverse_search","submit_video_generation","query_video_generation","gen_videos","batch_text_to_video","batch_image_to_video","get_voice_list","batch_text_to_audio","batch_text_to_music","synthesize_speech","batch_synthesize_speech","audios_understand","videos_understand","transcribe_audio"],la=["code-review","deep-research","deploy-website","docx","edit-deployed-website","init","lark-tools","llm-call","mcode-tools-master","mavis-doctor","pdf","plugin-creator","pptx","skill-creator","skill-refiner","visual-page","x-link-reader","xlsx"],lp=["control-in-app-browser","resume-codex","mavis","create-agent","minimax-code-product","miniapp-creator"],yA=new Set(["modelConfigId","persona","tools","builtinTools","skills","features"]),gA=new Set(["enabled"]),ra=new Set(["mavis","delegation","webSearch"]),cp=new Set(sa),sp=["task_query","task_output","task_stop"],up=new Set(aa),oa=new Set(la),fp=new Set(lp),bA=new Set(["plan-mode"]);function ca(e){let t=dr(e),n=dr(t?.default);return{default:n?vA(n):{}}}function SA(e,t="agent"){if(e===void 0)return{};let n=na(e,t);ia(n,yA,t);let i={};if(n.modelConfigId!==void 0&&((typeof n.modelConfigId!="string"||!n.modelConfigId.trim())&&ce(`${t}.modelConfigId`,"must be a non-empty string"),i.modelConfigId=n.modelConfigId.trim()),n.persona!==void 0){let r=na(n.persona,`${t}.persona`);ia(r,gA,`${t}.persona`),r.enabled!==void 0&&typeof r.enabled!="boolean"&&ce(`${t}.persona.enabled`,"must be a boolean"),i.persona={...typeof r.enabled=="boolean"?{enabled:r.enabled}:{}}}if(n.tools!==void 0&&(Array.isArray(n.tools)||ce(`${t}.tools`,"must be an array"),i.tools=n.tools.map((r,o)=>((typeof r!="string"||!cp.has(r))&&ce(`${t}.tools[${o}]`,`must be one of ${sa.join(", ")}`),r))),n.builtinTools!==void 0&&(Array.isArray(n.builtinTools)||ce(`${t}.builtinTools`,"must be an array"),i.builtinTools=n.builtinTools.map((r,o)=>(r==="web_search"&&ce(`${t}.builtinTools[${o}]`,"web_search is feature-owned; use features.webSearch"),(typeof r!="string"||!up.has(r))&&ce(`${t}.builtinTools[${o}]`,`must be one of ${aa.join(", ")}`),r))),n.skills!==void 0&&(Array.isArray(n.skills)||ce(`${t}.skills`,"must be an array"),i.skills=n.skills.map((r,o)=>{if(typeof r=="string"&&fp.has(r.trim())){let s=r.trim();ce(`${t}.skills[${o}]`,`${s} is capability-owned; use its owning Tool or feature switch`)}return(typeof r!="string"||!oa.has(r.trim()))&&ce(`${t}.skills[${o}]`,`must be one of ${la.join(", ")}`),r.trim()})),n.features!==void 0){let r=na(n.features,`${t}.features`);ia(r,ra,`${t}.features`);for(let o of ra)r[o]!==void 0&&typeof r[o]!="boolean"&&ce(`${t}.features.${o}`,"must be a boolean");i.features={...typeof r.mavis=="boolean"?{mavis:r.mavis}:{},...typeof r.delegation=="boolean"?{delegation:r.delegation}:{},...typeof r.webSearch=="boolean"?{webSearch:r.webSearch}:{}}}return i}function vA(e){let t={};typeof e.modelConfigId=="string"&&e.modelConfigId.trim()&&(t.modelConfigId=e.modelConfigId.trim());let n=dr(e.persona);if(typeof n?.enabled=="boolean"&&(t.persona={enabled:n.enabled}),ap(e.tools,cp)){let r=[...e.tools];sp.some(o=>r.includes(o))||r.push(...sp),t.tools=r}if(ap(e.builtinTools,up)&&(t.builtinTools=[...e.builtinTools]),Array.isArray(e.skills)){let r=e.skills.map(o=>typeof o=="string"?o.trim():o);r.every(o=>typeof o=="string"&&(oa.has(o)||bA.has(o))&&!fp.has(o))&&(t.skills=r.filter(o=>typeof o=="string"&&oa.has(o)))}let i=dr(e.features);if(i){let r={};for(let o of ra)typeof i[o]=="boolean"&&(r[o]=i[o]);Object.keys(r).length>0&&(t.features=r)}return t}function dr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0}function ap(e,t){return Array.isArray(e)&&e.every(n=>typeof n=="string"&&t.has(n))}function AA(e={},t={}){return{persona:{enabled:t.persona?.enabled??e.persona?.enabled??!0},tools:ta(t.tools??e.tools),builtinTools:ta(t.builtinTools??e.builtinTools),skills:ta(t.skills??e.skills),features:{mavis:t.features?.mavis??e.features?.mavis??!0,delegation:t.features?.delegation??e.features?.delegation??!0,webSearch:t.features?.webSearch??e.features?.webSearch??!0}}}function _A(e,t){return e.tools===void 0||e.tools.includes(t)}function wA(e,t){return e.builtinTools===void 0||e.builtinTools.includes(t)}function EA(e,t){return e.skills===void 0||e.skills.includes(t)}function ta(e){return e===void 0?void 0:[...e]}function na(e,t){return(e==null||typeof e!="object"||Array.isArray(e))&&ce(t,"must be an object"),e}function ia(e,t,n){for(let i of Object.keys(e))t.has(i)||ce(`${n}.${i}`,"is not supported")}function ce(e,t){throw new Error(`Invalid configuration at ${e}: ${t}`)}var ua={enabled:!0};function dp(e,t=ua){let n=e.askUser;if(n==null||typeof n!="object"||Array.isArray(n))return{...t};let i=n;return{enabled:typeof i.enabled=="boolean"?i.enabled:t.enabled}}var We={enabled:!0,enabledSource:"default"};function fa(e,t=We){let n=e.dataContribution;if(n==null||typeof n!="object"||Array.isArray(n))return{...t,enabledSource:"default"};let i=n,r=typeof i.enabled=="boolean";return{enabled:r?i.enabled:t.enabled,enabledSource:r?"explicit":"default"}}function pp(e){try{let t=e()?.dataContribution?.enabled;return typeof t=="boolean"?t:We.enabled}catch{return We.enabled}}var yp=["none","evaluator","subagent"],gp=["brief","transcript"],bp=["same-route-small-fast"],Sp="goal-verifier-readonly",vp=[Sp],he={budget:{graceSteps:1},breaker:{repeatedReplyLimit:3},verifier:{repeatedNotMetLimit:5,evidence:"brief"},evaluator:{modelPolicy:"same-route-small-fast",maxTokens:32e3,timeoutSeconds:60,maxRetries:1}},da={budget:{graceSteps:3},evaluator:{maxRetries:1}};function pa(e){let t=[],n=$t(e,"goal",t);jt(n,"goal",t,["objectiveMaxChars","verification","budget","breaker","verifier","evaluator","subagent"]);let i=$t(n.budget,"goal.budget",t);jt(i,"goal.budget",t,["defaultTokens","defaultMainTurns","defaultActiveSeconds","graceSteps"]);let r=$t(n.breaker,"goal.breaker",t);jt(r,"goal.breaker",t,["repeatedReplyLimit"]);let o=$t(n.verifier,"goal.verifier",t);jt(o,"goal.verifier",t,["repeatedNotMetLimit","evidence"]);let s=$t(n.evaluator,"goal.evaluator",t);jt(s,"goal.evaluator",t,["modelPolicy","maxTokens","timeoutSeconds","maxRetries"]);let a=$t(n.subagent,"goal.subagent",t);jt(a,"goal.subagent",t,["profile","maxTurns","maxTokens","timeoutSeconds"]);let l=hp(n.verification,"goal.verification",yp,t),c=ut(n.objectiveMaxChars,"goal.objectiveMaxChars",t,{min:1}),u=ut(i.defaultTokens,"goal.budget.defaultTokens",t,{min:1}),f=ut(i.defaultMainTurns,"goal.budget.defaultMainTurns",t,{min:1}),d=ut(i.defaultActiveSeconds,"goal.budget.defaultActiveSeconds",t,{min:1}),p=hp(a.profile,"goal.subagent.profile",vp,t),h=ut(a.maxTurns,"goal.subagent.maxTurns",t,{min:1}),m=ut(a.maxTokens,"goal.subagent.maxTokens",t,{min:1}),y=ut(a.timeoutSeconds,"goal.subagent.timeoutSeconds",t,{min:1}),g={...p!==void 0?{profile:p}:{},...h!==void 0?{maxTurns:h}:{},...m!==void 0?{maxTokens:m}:{},...y!==void 0?{timeoutSeconds:y}:{}};return{config:{...c!==void 0?{objectiveMaxChars:c}:{},...l!==void 0?{verification:l}:{},budget:{...u!==void 0?{defaultTokens:u}:{},...f!==void 0?{defaultMainTurns:f}:{},...d!==void 0?{defaultActiveSeconds:d}:{},graceSteps:Ut(i.graceSteps,"goal.budget.graceSteps",he.budget.graceSteps,t,{min:0,max:da.budget.graceSteps})},breaker:{repeatedReplyLimit:Ut(r.repeatedReplyLimit,"goal.breaker.repeatedReplyLimit",he.breaker.repeatedReplyLimit,t,{min:1})},verifier:{repeatedNotMetLimit:Ut(o.repeatedNotMetLimit,"goal.verifier.repeatedNotMetLimit",he.verifier.repeatedNotMetLimit,t,{min:1}),evidence:mp(o.evidence,"goal.verifier.evidence",gp,he.verifier.evidence,t)},evaluator:{modelPolicy:mp(s.modelPolicy,"goal.evaluator.modelPolicy",bp,he.evaluator.modelPolicy,t),maxTokens:Ut(s.maxTokens,"goal.evaluator.maxTokens",he.evaluator.maxTokens,t,{min:1}),timeoutSeconds:Ut(s.timeoutSeconds,"goal.evaluator.timeoutSeconds",he.evaluator.timeoutSeconds,t,{min:1}),maxRetries:Ut(s.maxRetries,"goal.evaluator.maxRetries",he.evaluator.maxRetries,t,{min:0,max:da.evaluator.maxRetries})},...Object.keys(g).length>0?{subagent:g}:{}},warnings:t}}function $t(e,t,n){return e===void 0?{}:e===null||typeof e!="object"||Array.isArray(e)?(n.push(He(t,"expected an object; using defaults")),{}):e}function jt(e,t,n,i){for(let r of Object.keys(e))i.includes(r)||n.push(He(`${t}.${r}`,"unknown key ignored"))}function Ut(e,t,n,i,r){return e==null?n:!Number.isInteger(e)||e<r.min?(i.push(He(t,`expected an integer >= ${r.min}; using default`)),n):r.max!=null&&e>r.max?(i.push(He(t,`exceeds maximum ${r.max}; clamped`)),r.max):e}function ut(e,t,n,i){if(e!=null){if(!Number.isInteger(e)||e<i.min){n.push(He(t,`expected an integer >= ${i.min}; ignored`));return}return i.max!=null&&e>i.max?(n.push(He(t,`exceeds maximum ${i.max}; clamped`)),i.max):e}}function mp(e,t,n,i,r){return e==null?i:typeof e!="string"||!n.includes(e)?(r.push(He(t,`expected one of: ${n.join(", ")}; using default`)),i):e}function hp(e,t,n,i){if(e!=null){if(typeof e!="string"||!n.includes(e)){i.push(He(t,`expected one of: ${n.join(", ")}; ignored`));return}return e}}function He(e,t){return`Invalid goal config at ${e}: ${t}`}var Ae={enabled:!0,maxInlineKiB:64,mcpDetailsMaxInlineKiB:32,watermarkKiB:256,minSavingsKiB:256,minCandidateKiB:2,keepRecentRounds:5},xA=Math.floor(Number.MAX_SAFE_INTEGER/1024);function ma(e){let t=CA(e)?e:{};return{enabled:typeof t.enabled=="boolean"?t.enabled:Ae.enabled,maxInlineKiB:Rn(t.maxInlineKiB,Ae.maxInlineKiB),mcpDetailsMaxInlineKiB:Rn(t.mcpDetailsMaxInlineKiB,Ae.mcpDetailsMaxInlineKiB),watermarkKiB:Rn(t.watermarkKiB,Ae.watermarkKiB),minSavingsKiB:Rn(t.minSavingsKiB,Ae.minSavingsKiB),minCandidateKiB:Rn(t.minCandidateKiB,Ae.minCandidateKiB),keepRecentRounds:kA(t.keepRecentRounds,Ae.keepRecentRounds)}}function Rn(e,t){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0&&e<=xA?e:t}function kA(e,t){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0?e:t}function CA(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Pn={recoveryDivisor:2,image:{max_width:2e3,max_height:2e3,max_base64_bytes:4718592}};function ya(e){let t=Ap(e)?e:{},n=t.recoveryDivisor,i=Ap(t.image)?t.image:{},r=Pn.image;return{recoveryDivisor:typeof n=="number"&&Number.isFinite(n)&&n>1?n:Pn.recoveryDivisor,image:{max_width:ha(i.max_width)??r.max_width,max_height:ha(i.max_height)??r.max_height,max_base64_bytes:Math.min(ha(i.max_base64_bytes)??r.max_base64_bytes,5242880)}}}function ha(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0?e:void 0}function Ap(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Dn={};function ga(e){if(e==null||typeof e!="object"||Array.isArray(e))return{...Dn};let t=Reflect.get(e,"chromePath");return typeof t!="string"||!t.trim()?{...Dn}:{chromePath:t.trim()}}import{isIP as OA}from"node:net";function _p(e){return{enabled:!1,filesystemMode:"full_access"}}function wp(e){return!e.enabled||e.filesystemMode==="full_access"?{enabled:!1,filesystemMode:"full_access"}:{...e}}function Sa(e){let t=_p(e);return{enabled:t.enabled,filesystem:{policy:{mode:t.filesystemMode},denyRead:[],denyWrite:[]},network:{policy:{mode:"allow_all"},deniedDomains:[]},localAccess:"open"}}var va=Sa(process.platform),TA=new Set(["read_only","workspace_write","delete_guard","full_access"]),IA=new Set(["deny","allow_all"]);function Aa(e,t=process.platform){let n=Sa(t);if(e===void 0)return n;let i=Fn(e,"sandbox",["enabled","filesystem","network","localAccess"]),r=i.filesystem===void 0?{}:Fn(i.filesystem,"sandbox.filesystem",["policy","denyRead","denyWrite","allowGitConfig"]),o=r.policy===void 0?{}:Fn(r.policy,"sandbox.filesystem.policy",["mode"]),s=i.network===void 0?{}:Fn(i.network,"sandbox.network",["policy","deniedDomains"]),a=s.policy===void 0?{}:Fn(s.policy,"sandbox.network.policy",["mode"]),l=i.enabled===void 0?n.enabled:MA(i.enabled,"sandbox.enabled"),c=o.mode??(l?"delete_guard":"full_access");if(typeof c!="string"||!TA.has(c))throw new Error(`Invalid sandbox.filesystem.policy.mode "${String(c)}"`);let u=a.mode??n.network.policy.mode;if(typeof u!="string"||!IA.has(u))throw new Error(`Invalid sandbox.network.policy.mode "${String(u)}"`);let f=s.deniedDomains===void 0?[...n.network.deniedDomains]:ba(s.deniedDomains,"sandbox.network.deniedDomains");for(let p of f)LA(p);let d=wp({enabled:l,filesystemMode:c});return{enabled:d.enabled,filesystem:{policy:{mode:d.filesystemMode},denyRead:r.denyRead===void 0?[...n.filesystem.denyRead]:ba(r.denyRead,"sandbox.filesystem.denyRead"),denyWrite:r.denyWrite===void 0?[...n.filesystem.denyWrite]:ba(r.denyWrite,"sandbox.filesystem.denyWrite")},network:{policy:{mode:"allow_all"},deniedDomains:[]},localAccess:i.localAccess===void 0?n.localAccess:i.localAccess==="open"||i.localAccess==="restricted"?i.localAccess:(()=>{throw new Error(`Invalid sandbox.localAccess "${String(i.localAccess)}"`)})()}}function Fn(e,t,n){if(e==null||typeof e!="object"||Array.isArray(e))throw new Error(`Invalid ${t}: expected object`);let i=e,r=Object.keys(i).find(o=>!n.includes(o));if(r)throw new Error(`Unknown ${t}.${r}`);return i}function MA(e,t){if(typeof e!="boolean")throw new Error(`Invalid ${t}: expected boolean`);return e}function ba(e,t){if(!Array.isArray(e)||e.some(n=>typeof n!="string"))throw new Error(`Invalid ${t}: expected string array`);return[...e]}function LA(e){let t=()=>{throw new Error(`Invalid sandbox.network.deniedDomains entry "${e}"`)},n=e.match(/^\[([^\]]+)\](?::(.+))?$/);if(n){OA(n[1]??"")!==6&&t(),Ep(n[2],e);return}(e.match(/:/g)??[]).length>1&&t();let i=e.lastIndexOf(":"),r=i>-1?e.slice(0,i):e,o=i>-1?e.slice(i+1):void 0;Ep(o,e),r!=="*"&&(NA(r)||t())}function NA(e){if(e.includes("://")||e.includes("/")||e.includes(":"))return!1;if(e==="localhost")return!0;if(e.startsWith("*.")){let n=e.slice(2).split(".");return n.length>=2&&n.every(i=>i.length>0)}return e.includes("*")?!1:e.includes(".")&&!e.startsWith(".")&&!e.endsWith(".")}function Ep(e,t){if(e===void 0)return;let n=Number(e);if(!/^[1-9][0-9]{0,4}$/.test(e)||!Number.isInteger(n)||n>65535)throw new Error(`Invalid sandbox.network.deniedDomains entry "${t}"`)}var pr={maxConcurrentPerSession:4};function _a(e){let n=(e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{}).maxConcurrentPerSession;return{maxConcurrentPerSession:typeof n=="number"&&Number.isSafeInteger(n)&&n>0?n:pr.maxConcurrentPerSession}}function xp(e,t){return t.length===0?!1:t.includes("*")?!0:t.includes(e)}function FA(){return process.env.__MAVIS_ALLOW_LEGACY_RUNTIME_ENV==="1"}var kp={dev:"test",test:"test",staging:"staging",prod:"prod"};function BA(e){return e==="cn"||e==="en"}function Lp(e){return e==="test"||e==="prod"||e==="dev"||e==="staging"}function Np(){let e=process.env.MAVIS_REGION;if(BA(e))return e;if(hr()){let t=process.env.NEXT_PUBLIC_LOCALE;if(t==="zh")return"cn";if(t==="en")return"en"}return"en"}function Te(){let e=process.env.MAVIS_BUILD_ENV;if(Lp(e))return e;if(hr()){let t=process.env.NEXT_PUBLIC_BUILD_ENV,n=t&&Object.prototype.hasOwnProperty.call(kp,t)?kp[t]:void 0;if(n)return n}return"dev"}function mr(){if(Pp("managed"))return!0;let e=process.env.__MAVIS_RUNTIME_MANAGED;return e==="1"?!0:e==="0"?!1:!!(hr()||Te()==="prod"||Te()==="staging")}function hr(){let e=process.versions;return process.env.ELECTRON_RUN_AS_NODE==="1"||typeof e.electron=="string"}function yr(){return`${Np()}-${Te()}`}var Ce={none:0,test:1,internal:2,online:3},qA={internal:"internal",inside:"online"};function $A(e){for(let[t,n]of Object.entries(e)){if(Ce[n.defaultVisibility]>Ce[n.configurableVisibility])throw new Error(`Invalid beta feature definition "${t}": defaultVisibility (${n.defaultVisibility}) must not exceed configurableVisibility (${n.configurableVisibility})`);for(let i of n.defaultBuildVariants??[]){let r=qA[i];if(Ce[r]>Ce[n.configurableVisibility])throw new Error(`Invalid beta feature definition "${t}": defaultBuildVariant (${i}) must not exceed configurableVisibility (${n.configurableVisibility})`)}for(let i of n.defaultBuildEnvironments??[])if(Ce[i==="prod"?"online":"test"]>Ce[n.configurableVisibility])throw new Error(`Invalid beta feature definition "${t}": defaultBuildEnvironment (${i}) must not exceed configurableVisibility (${n.configurableVisibility})`)}}var qn={autoMemory:{defaultVisibility:"online",configurableVisibility:"online"},skillEvolve:{defaultVisibility:"test",configurableVisibility:"online"},skillEvolveBuiltinMr:{defaultVisibility:"none",configurableVisibility:"test"},skillProposal:{defaultVisibility:"test",configurableVisibility:"online"},browserBridge:{defaultVisibility:"test",configurableVisibility:"online"},filePanelBrowser:{defaultVisibility:"online",configurableVisibility:"online"},filePanelBrowserMultiTab:{defaultVisibility:"online",configurableVisibility:"online"},browserUseTooling:{defaultVisibility:"online",configurableVisibility:"online"},browserUseAutoOpenPanel:{defaultVisibility:"online",configurableVisibility:"online"},browserAgentCursor:{defaultVisibility:"online",configurableVisibility:"online"},desktopPlanMode:{defaultVisibility:"online",configurableVisibility:"online"},desktopPlanModeAgentEntry:{defaultVisibility:"none",configurableVisibility:"online"},peek:{defaultVisibility:"test",configurableVisibility:"test"},keepAlive:{defaultVisibility:"test",configurableVisibility:"test"},promptOverride:{defaultVisibility:"test",configurableVisibility:"test"},asr:{defaultVisibility:"online",configurableVisibility:"online"},taskHistoryProjectGrouping:{defaultVisibility:"online",configurableVisibility:"online"},threadGoal:{defaultVisibility:"online",configurableVisibility:"online"},mcodeTools:{defaultVisibility:"none",defaultBuildEnvironments:["dev","test","staging","prod"],defaultPlatforms:["darwin","linux","win32"],configurableVisibility:"online"},codexOAuth:{defaultVisibility:"online",configurableVisibility:"online"}};$A(qn);function jA(e){return(e.buildEnv??Te())!=="prod"?"test":e.internalBuild===!0?"internal":"online"}function UA(e,t){let n=e.defaultBuildVariants;return n?t.internalBuild===!0&&n.includes("internal")||t.insideBuild===!0&&n.includes("inside"):!1}function KA(e,t){let n=t.defaultBuildEnvironment??t.buildEnv??ka();return e.defaultBuildEnvironments?.includes(n)===!0}function ka(){let e=hr()?process.env.NEXT_PUBLIC_BUILD_ENV:void 0;return Lp(e)?e:Te()}function Cp(e,t){return e.defaultPlatforms?.includes(t.platform??process.platform)!==!1}function Ca(e,t,n={}){let i=qn[e],r=Ce[jA(n)],o=n.defaultBuildEnvironment??n.buildEnv??ka();return e==="mcodeTools"&&o==="dev"&&n.mcodeToolsDevMode==="published"&&Cp(i,n)?!0:t===!1?!1:t===!0?r<=Ce[i.configurableVisibility]:Cp(i,n)?KA(i,n)||UA(i,n)?!0:r<=Ce[i.defaultVisibility]:!1}function VA(e){return qn[e].configurableVisibility==="online"}function Oa(e=process.env){return e.__MAVIS_BUILD_INTERNAL==="true"}function YA(e=process.env){return e.__MAVIS_BUILD_INSIDE==="true"}var GA={APP_DIR:".minimax",ENV_PREFIX:"minimax",CLI_NAME:"minimax"},Rp="__MAVIS_RUNTIME";function gr(e){return FA()?process.env[`${Rp}_${e}`]:void 0}function br(e){let t=`--${e}`;for(let n=2;n<process.argv.length;n++){let i=process.argv[n];if(i===t)return process.argv[n+1];if(i?.startsWith(`${t}=`))return i.slice(t.length+1)}}function Pp(e){let t=`--${e}`;return process.argv.slice(2).some(n=>n===t||n.startsWith(`${t}=`))}var Kt=5321,Ea=5001,wa=65535,Dp=500,Ta=2,WA=Dp*Ta,Fp=WA+Ta,Op=1,HA=new Set(["agent-archon","mavis"]),Tp=(()=>{let t=new Uint32Array(256);for(let n=0;n<256;n++){let i=n<<24;for(let r=0;r<8;r++)i=(i&2147483648)!==0?79764919^i<<1:i<<1,i>>>=0;t[n]=i>>>0}return t})();function JA(e){let t=Buffer.from(`${e}
|
|
191
|
+
`,"utf-8"),n=0;for(let r of t)n=(Tp[(n>>>24^r)&255]^n<<8)>>>0;let i=t.length;for(;i!==0;)n=(Tp[(n>>>24^i&255)&255]^n<<8)>>>0,i>>>=8;return(n^4294967295)>>>0}function XA(e){return JA(e)%Dp*Ta+2}function Ip(e,t){try{let n=PA("git",e,{encoding:"utf-8",timeout:3e3,stdio:["ignore","pipe","pipe"],...t?{cwd:t}:{}});return n.status===0&&n.stdout?n.stdout.trim():null}catch{return null}}function QA(e){return e.match(/[/:]([^/:]+?)(?:\.git)?$/)?.[1]??null}function Bp(){return process.env.MINIMAX_DATA_DIR?.trim()||process.env.MAVIS_DATA_DIR?.trim()}function Sr(){return!(Pp("disable-git-auto-config")||gr("DISABLE_GIT_AUTO_CONFIG")||br("data-dir")||Bp())}function vr(){let e=br("profile")??gr("PROFILE");return e&&e.length>0?e:null}function qp(){let e=br("port")??gr("PORT"),t=e?parseInt(e,10):NaN;return Number.isNaN(t)?null:t}function xa(){let e=br("data-dir")??Bp()??gr("DATA_DIR");return e&&e.length>0?e:null}function zA(){return!!(vr()&&xa())}function $p(){return!!(vr()&&qp()!==null)}var ft=null;function ZA(){ft=null}function dt(){if(ft!==null)return ft;let e={runtimePort:Kt,uiPort:Ea,profile:null,autoDetected:!1};return ft=e,e}function e_(){try{if(typeof __dirname=="string")return __dirname}catch{}let e=new Error().stack??"";for(let t of e.split(`
|
|
192
|
+
`)){let n=/file:\/\/[^)\s]+/u.exec(t)?.[0]?.replace(/:\d+:\d+$/u,"");if(n)try{return oe.dirname(DA(n))}catch{}let i=/\(?((?:\/|[A-Za-z]:\\)[^()]+?\.(?:cjs|mjs|js|ts)):\d+:\d+\)?/u.exec(t)?.[1];if(i)return oe.dirname(i)}}function t_(){let e=vr();return e||(Sr()?dt().profile:null)}function Ia(){let e=vr();if(zA())return xa();if(Sr()){let n=dt();if(n.autoDetected&&n.profile)return Ge({profile:n.profile})}let t=xa();return t||(e?Ge({profile:e}):Ge())}function Vt(){return oe.join(Ia(),"config.yaml")}var Ar={"cn-test":"https://agent.minimaxi.com/mavis/api/v1/llm/v1","cn-dev":"https://agent.minimaxi.com/mavis/api/v1/llm/v1","cn-staging":"https://agent.minimaxi.com/mavis/api/v1/llm/v1","en-test":"https://agent.minimax.io/mavis/api/v1/llm/v1","en-dev":"https://agent.minimax.io/mavis/api/v1/llm/v1","en-staging":"https://agent.minimax.io/mavis/api/v1/llm/v1","cn-prod":"https://agent.minimax.cn/mavis/api/v1/llm/v1","en-prod":"https://agent.minimax.io/mavis/api/v1/llm/v1"},jp=["https://agent.minimaxi.com/mavis/api/v1/llm/v1"],n_=new Set([...Object.values(Ar),...jp]),i_=new Set([...Object.values(Ar),...jp].map(e=>new URL(e).origin));function Up(e){if(n_.has(e))return!0;try{let t=new URL(e);return!t.username&&!t.password&&i_.has(t.origin)}catch{return!1}}function Kp(){return Te()==="test"}function r_(){return!Kp()}function o_(e){if(!mr()||!Oe.existsSync(e))return;let t=Vp(e),{provider:n}=t;if(n==null||typeof n!="object"||Array.isArray(n))return;let{minimax:i}=n;if(i==null||typeof i!="object"||Array.isArray(i))return;let{options:r}=i;if(r==null||typeof r!="object"||Array.isArray(r))return;let o=r.baseURL;if(typeof o!="string")return;let s=Ar[yr()];if(o===s||!Up(o))return;let a=Oe.readFileSync(e);r.baseURL=s;try{let l=a.toString("utf-8");it(e,Nn(l,Ln(l),t))}catch(l){let c=!1;try{c=Oe.readFileSync(e).equals(a)}catch{}if(!c)throw l;console.warn("[config] managed preset baseURL sync skipped; config file unchanged, using runtime provider settings")}}function Je(e){return{provider:{minimax:{name:"MiniMax",npm:"@ai-sdk/anthropic",options:{authMode:"managed-login",apiKey:"sk-xxx",baseURL:Ar[e]},models:wt}},defaultModel:"minimax/MiniMax-M3.1-Flash-Preview"}}var Ma={"cn-test":Je("cn-test"),"cn-dev":Je("cn-dev"),"cn-staging":Je("cn-staging"),"cn-prod":Je("cn-prod"),"en-test":Je("en-test"),"en-dev":Je("en-dev"),"en-staging":Je("en-staging"),"en-prod":Je("en-prod")},X={logLevel:"info",devPort:Ea,permissionMode:"auto",sseErrorPush:{history:!0,stream:!0},beta:Object.fromEntries(Object.keys(qn).map(e=>[e,Ca(e,void 0,{buildEnv:"dev"})])),agents:{default:{}},memory:{enabled:!0,proactive:!1,dailyDigest:{enabled:!1},v2:{...ir}},subagent:{...pr},skillEvolve:{enabled:!0,inSession:{N:20,minIntervalSeconds:30,maxPendingPerSession:1},signalCooldownHours:24,minConfidence:.7,excludeAgents:["skill-editor"],disableModelPrefixes:["MiniMax-M2"],builtinMrEnabled:!1,sourceRepo:void 0,proposal:{enabled:!1,eligibleAgents:["mavis"],minMessageCount:40,skipPassiveSessionEnd:!0},lifecycle:{staleThresholdDays:15,archiveThresholdDays:30}},sessionRotate:{enabled:!0,activeSessionLookbackHours:12},agentStop:{debounceMs:500,maxActiveSpanMs:1800*1e3},asr:{...lr},skills:ur,askUser:{...ua},dataContribution:{...We},sessionTitle:{enabled:!0},cli:{spawn:{enabled:!1}},browser:{...Dn},tui:{},opencode:{xdg:{dataIsolation:!1,startupImport:"off"},keepAlive:{enabled:!1,maxProcesses:5,maxLifetimeMs:288e5,agents:["mavis","main","verifier","code-reviewer"]},spawnConcurrency:3},contextManagement:{disableSystemReminderModels:[],cuMaxScreenshotsInContext:2},runawayGuard:{enabled:!0},toolResultCompaction:{...Ae},requestMedia:{...Pn},agentRuntime:{defaultFramework:Bt},logRetentionDays:3,worktreeRefreshBeforeCreate:!0,review:{mode:"subagent",turnDiffCard:"concise",modeSource:"default"},goal:structuredClone(he),sandbox:structuredClone(va),goalWarnings:[]};function s_(){let e=Vt(),t=oe.dirname(e);if(Oe.existsSync(t)||Oe.mkdirSync(t,{recursive:!0}),Oe.existsSync(e)){Na(e);return}if(!mr()){let r=Ge({homeDir:RA.homedir()}),o=oe.join(r,"config.yaml");e!==o&&Oe.existsSync(o)&&(Et(o),it(e,Oe.readFileSync(o),!0));return}let n=Ma[yr()],i=H.dump({logLevel:X.logLevel,provider:La?n.provider:void 0,defaultModel:n.defaultModel,dataContribution:{enabled:We.enabled},memory:{enabled:!1}});it(e,i,!0)}function Vp(e=Vt()){return Ln(a_(e))}function a_(e=Vt()){try{return Oe.readFileSync(e,"utf-8")}catch{return""}}var Bn=null;function l_(e){if(e==null||typeof e!="object"||Array.isArray(e))return;let t=e;return{branchFinish:typeof t.branchFinish=="boolean"?t.branchFinish:!1}}var Yp={isManagedRuntime:mr,shouldEnforceManagedProviderProtection:r_,getManagedPreset:()=>Ma[yr()],isManagedPresetBaseUrl:Up},Gp=!0,La=!0;function c_(e){Gp=e}function u_(e){La=e}function Na(e){Et(e),jd(e),Gp&&qd(e,Yp),La&&o_(e)}function _r(){Bn=null}function wr(){if(Bn)return Bn;s_();let e=Vp();return Bn=Ra(e,Ia()),Bn}function Ra(e,t){let n=e.sseErrorPush,i=n!=null&&typeof n=="object"&&!Array.isArray(n)?n:void 0,r=typeof e.devPort=="number"?e.devPort:X.devPort;if(Sr()&&!$p()){let c=dt();c.autoDetected&&(r=c.uiPort)}let o=pa(e.goal),s=$d({provider:e.provider!=null&&typeof e.provider=="object"&&!Array.isArray(e.provider)?Pd(e.provider):{},defaultModel:typeof e.defaultModel=="string"?e.defaultModel:void 0},Yp),a=Ys(e.minimaxModelContextLimits),l=f_(e);return{logLevel:typeof e.logLevel=="string"?e.logLevel:X.logLevel,devPort:r,...s,provider:Nd(s.provider,a),defaultModelVariant:typeof e.defaultModelVariant=="string"?e.defaultModelVariant:void 0,defaultModelThinking:e.defaultModelThinking&&typeof e.defaultModelThinking=="object"&&typeof e.defaultModelThinking.effort=="string"?{effort:e.defaultModelThinking.effort}:void 0,defaultModelContextWindow:Number.isSafeInteger(e.defaultModelContextWindow)&&Number(e.defaultModelContextWindow)>0&&Number(e.defaultModelContextWindow)<=2147483647?Number(e.defaultModelContextWindow):void 0,minimax_api:Md(e.minimax_api),minimaxModelContextLimits:a,custom_provider:Rd(e.custom_provider),minimaxModelSource:typeof e.minimaxModelSource=="string"&&(e.minimaxModelSource==="token_plan"||e.minimaxModelSource==="minimax_api_key")?e.minimaxModelSource:void 0,nexus:e.nexus!=null&&typeof e.nexus=="object"&&!Array.isArray(e.nexus)?(()=>{let c={};typeof Reflect.get(e.nexus,"enabled")=="boolean"&&(c.enabled=Reflect.get(e.nexus,"enabled"));let u=Reflect.get(e.nexus,"model");return u!=null&&typeof u=="object"&&!Array.isArray(u)&&typeof Reflect.get(u,"providerID")=="string"&&typeof Reflect.get(u,"modelID")=="string"&&(c.model={providerID:Reflect.get(u,"providerID"),modelID:Reflect.get(u,"modelID"),...typeof Reflect.get(u,"variant")=="string"?{variant:Reflect.get(u,"variant")}:{}}),Object.keys(c).length>0?c:void 0})():void 0,defaultLightModel:typeof e.defaultLightModel=="string"?e.defaultLightModel:void 0,permissionMode:typeof e.permissionMode=="string"&&["default","bypassPermissions","auto","off"].includes(e.permissionMode)?e.permissionMode:X.permissionMode,permission:Gd(e),sseErrorPush:{history:typeof i?.history=="boolean"?i.history:X.sseErrorPush.history,stream:typeof i?.stream=="boolean"?i.stream:X.sseErrorPush.stream},notifications:l_(e.notifications),dataDir:t,agentsDir:oe.join(t,"agents"),sessionsDir:oe.join(t,"sessions"),memoryDir:oe.join(t,"memory"),skillsDir:oe.join(t,"skills"),builtinSkillsDir:oe.join(t,".builtin-skills"),logsDir:oe.join(t,"logs"),pluginsDir:oe.join(t,"plugins"),plansDir:oe.join(t,"plans"),harnessesDir:oe.join(t,"harnesses"),subAgentsDir:oe.join(t,"subagents"),beta:l,agents:ca(e.agents),memory:Cd(e,X.memory),subagent:_a(e.subagent),skillEvolve:m_(e,l),sessionRotate:h_(e),agentStop:y_(e),asr:Yd(e),skills:Ws(e),askUser:dp(e,X.askUser),dataContribution:fa(e,X.dataContribution),sessionTitle:g_(e),cli:b_(e),browser:ga(e.browser),tui:Od(e),opencode:Kd(e,X.opencode),contextManagement:S_(e),runawayGuard:oo(e.runawayGuard),toolResultCompaction:ma(e.toolResultCompaction),requestMedia:ya(e.requestMedia),agentRuntime:Hs(e.agentRuntime),logRetentionDays:v_(e),contentReview:A_(e),mcpToolSearch:__(e),review:Ud(e.review,X.review),worktreeRefreshBeforeCreate:e.worktreeRefreshBeforeCreate!==!1,promptConfig:Wp(e.promptConfig),goal:o.config,goalWarnings:o.warnings,sandbox:Aa(e.sandbox)}}function f_(e){let t=e.beta!=null&&typeof e.beta=="object"&&!Array.isArray(e.beta)?e.beta:{},n={buildEnv:Te(),defaultBuildEnvironment:ka(),internalBuild:Oa(),insideBuild:YA(),mcodeToolsDevMode:process.env.MAVIS_DEV_MCODE_TOOLS_MODE==="published"?"published":void 0},i={};for(let r of Object.keys(qn))i[r]=Ca(r,t[r],n);return i}function d_(e){let t=e.provider;if(t==null||typeof t!="object"||Array.isArray(t))return[];let n=[];for(let i of Object.values(t)){if(i==null||typeof i!="object"||Array.isArray(i))continue;let{models:r}=i;r==null||typeof r!="object"||Array.isArray(r)||n.push(...Object.keys(r))}return n}function p_(e,t){if(t.length===0)return!0;let n=d_(e);if(n.length===0)return!1;let i=t.map(r=>r.toLowerCase());return!n.every(r=>i.some(o=>r.toLowerCase().startsWith(o)))}function Mp(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function m_(e,t){let n=X.skillEvolve,i=e.skillEvolve,o=i!=null&&typeof i=="object"&&!Array.isArray(i)?i:{},s=o.inSession,{inSession:a}=n;if(s!=null&&typeof s=="object"&&!Array.isArray(s)){let E=s;a={N:typeof E.N=="number"&&E.N>0?E.N:n.inSession.N,minIntervalSeconds:typeof E.minIntervalSeconds=="number"&&E.minIntervalSeconds>=0?E.minIntervalSeconds:n.inSession.minIntervalSeconds,maxPendingPerSession:typeof E.maxPendingPerSession=="number"&&E.maxPendingPerSession>=1?E.maxPendingPerSession:n.inSession.maxPendingPerSession}}let l=o.excludeAgents,c=Array.isArray(l)&&l.every(E=>typeof E=="string")?l:n.excludeAgents,u=Array.isArray(o.disableModelPrefixes)&&o.disableModelPrefixes.every(E=>typeof E=="string")?o.disableModelPrefixes:n.disableModelPrefixes,f=t.skillEvolve?typeof o.enabled=="boolean"?o.enabled:p_(e,u):!1,d=f&&t.skillEvolveBuiltinMr?typeof o.builtinMrEnabled=="boolean"?o.builtinMrEnabled:n.builtinMrEnabled:!1,p=o.sourceRepo,h=typeof p=="string"&&p.trim().length>0?p.trim():n.sourceRepo,m=o.proposal,y=n.proposal,g=m!=null&&typeof m=="object"&&!Array.isArray(m)?m:{},b=Array.isArray(g.eligibleAgents)&&g.eligibleAgents.every(E=>typeof E=="string")?g.eligibleAgents:y.eligibleAgents,v=typeof g.minMessageCount=="number"&&g.minMessageCount>=1?Math.floor(g.minMessageCount):y.minMessageCount,x=typeof g.skipPassiveSessionEnd=="boolean"?g.skipPassiveSessionEnd:y.skipPassiveSessionEnd,k=typeof g.enabled=="boolean"?g.enabled:null,C=f&&t.skillProposal?k??!0:!1,M=o.lifecycle,_=M&&typeof M=="object"&&!Array.isArray(M)?M:{},A=Mp(_.staleThresholdDays,n.lifecycle.staleThresholdDays),O=Mp(_.archiveThresholdDays,n.lifecycle.archiveThresholdDays);if(!(A<O))throw new Error(`Invalid skillEvolve.lifecycle config: staleThresholdDays (${A}) must be strictly less than archiveThresholdDays (${O}).`);return{enabled:f,inSession:a,signalCooldownHours:typeof o.signalCooldownHours=="number"&&o.signalCooldownHours>0?o.signalCooldownHours:n.signalCooldownHours,minConfidence:typeof o.minConfidence=="number"&&o.minConfidence>=0&&o.minConfidence<=1?o.minConfidence:n.minConfidence,scannerModel:typeof o.scannerModel=="string"?o.scannerModel:void 0,excludeAgents:c,disableModelPrefixes:u,builtinMrEnabled:d,sourceRepo:h,proposal:{enabled:C,eligibleAgents:b,minMessageCount:v,skipPassiveSessionEnd:x},lifecycle:{staleThresholdDays:A,archiveThresholdDays:O}}}function h_(e){let t=X.sessionRotate,n=e.sessionRotate;if(n==null||typeof n!="object"||Array.isArray(n))return{...t};let i=n,r=i.activeSessionLookbackHours;return{enabled:typeof i.enabled=="boolean"?i.enabled:t.enabled,activeSessionLookbackHours:typeof r=="number"&&Number.isFinite(r)&&r>0?r:t.activeSessionLookbackHours}}function y_(e){let t=X.agentStop,n=e.agentStop;if(n==null||typeof n!="object"||Array.isArray(n))return{...t};let i=n,r=i.debounceMs,o=i.maxActiveSpanMs;return{debounceMs:typeof r=="number"&&Number.isFinite(r)&&r>=0?r:t.debounceMs,maxActiveSpanMs:typeof o=="number"&&Number.isFinite(o)&&o>=0?o:t.maxActiveSpanMs}}function Wp(e){let t=Te()==="prod"&&!Oa();if(e==null||typeof e!="object"||Array.isArray(e))return{autoUpdate:t};let n=e.autoUpdate;return{autoUpdate:typeof n=="boolean"?n:t}}function g_(e){let t=X.sessionTitle,n=e.sessionTitle;if(n==null||typeof n!="object"||Array.isArray(n))return{...t};let i=n;return{enabled:typeof i.enabled=="boolean"?i.enabled:t.enabled}}function b_(e){let t=X.cli,n=e.cli;if(n==null||typeof n!="object"||Array.isArray(n))return{spawn:{...t.spawn}};let i=n.spawn;if(i==null||typeof i!="object"||Array.isArray(i))return{spawn:{...t.spawn}};let r=i;return{spawn:{enabled:typeof r.enabled=="boolean"?r.enabled:t.spawn.enabled}}}function S_(e){let t=X.contextManagement,n=e.contextManagement;if(n==null||typeof n!="object"||Array.isArray(n))return{disableSystemReminderModels:[...t.disableSystemReminderModels],cuMaxScreenshotsInContext:t.cuMaxScreenshotsInContext};let i=n,r=i.disableSystemReminderModels,o=Array.isArray(r)&&r.every(l=>typeof l=="string"&&l.length>0)?r:[...t.disableSystemReminderModels],s=i.cuMaxScreenshotsInContext,a=typeof s=="number"&&Number.isFinite(s)&&s>=0?Math.floor(s):t.cuMaxScreenshotsInContext;return{disableSystemReminderModels:o,cuMaxScreenshotsInContext:a}}function v_(e){let t=e.logRetentionDays;return typeof t=="number"&&t>=1&&Number.isFinite(t)?Math.floor(t):X.logRetentionDays}function A_(e){let t=e.contentReview;if(t==null||typeof t!="object"||Array.isArray(t))return;let n={},i=Reflect.get(t,"enabled");typeof i=="boolean"&&(n.enabled=i);let r=Reflect.get(t,"testBaseURL");return typeof r=="string"&&r.trim()&&(n.testBaseURL=r.trim()),Object.keys(n).length>0?n:void 0}function __(e){let t=e.mcpToolSearch;if(t==null||typeof t!="object"||Array.isArray(t))return;let n={},i=Reflect.get(t,"enabled");typeof i=="boolean"&&(n.enabled=i);let r=Reflect.get(t,"systemHint");typeof r=="boolean"&&(n.systemHint=r);let o=Reflect.get(t,"thresholdPct");typeof o=="number"&&(n.thresholdPct=o);let s=Reflect.get(t,"minDeferCount");typeof s=="number"&&(n.minDeferCount=s);let a=Reflect.get(t,"topKDefault");typeof a=="number"&&(n.topKDefault=a);let l=Reflect.get(t,"topKMax");typeof l=="number"&&(n.topKMax=l);let c=Reflect.get(t,"maxSchemaTextLen");typeof c=="number"&&(n.maxSchemaTextLen=c);let u=Reflect.get(t,"modelWhitelist");return Array.isArray(u)&&(n.modelWhitelist=u.filter(f=>typeof f=="string")),Object.keys(n).length>0?n:void 0}function Hp(){let e=qp();if(Sr()&&!$p()){let t=dt();if(t.autoDetected)return t.runtimePort}return e??Kt}function w_(e=Hp()){let t=e+Fp;if(t<=wa)return t;let n=e+Op;if(n<=wa)return n;throw new Error(`Cannot allocate an OpenCode sidecar port for runtime port ${String(e)}; choose a runtime port <= ${String(wa-Op)}.`)}var E_=["agent.minimaxi.com","agent.minimaxi.com","agent.minimax.io","agent.minimax.io","agent.minimax.io","agent.minimax.cn","agent.minimaxi.com"],x_=new Set(E_.map(e=>`https://${e}`));function k_(e,t){return/^custom_provider:minimax-legacy(?:-\d+)?$/u.test(e)&&(!t||Pa(t))}function Pa(e){try{let t=new URL(e);return t.username||t.password?!1:x_.has(t.origin.toLowerCase())}catch{return!1}}function C_(e){if(!(e!=="managed-login"&&e!=="api-key"&&e!=="oauth"))return e}function Da(e){let t=typeof e?.baseURL=="string"?e.baseURL.trim():"",n=t.length>0&&Pa(t),i=C_(e?.authMode),r=[];return typeof e?.authMode=="string"&&!i&&r.push(`Unknown provider authMode "${e.authMode}"; falling back to compatibility resolution.`),i?(i==="managed-login"&&t.length>0&&!n&&!e?.allowManagedBaseURLOverride&&r.push("Provider authMode is managed-login but baseURL is not a known managed MiniMax host."),{authMode:i,source:"explicit",managedBaseURL:n,warnings:r}):n?(r.push("Provider authMode is inferred from a managed MiniMax baseURL; set options.authMode: managed-login to make this explicit."),{authMode:"managed-login",source:"inferred-managed-base-url",managedBaseURL:n,warnings:r}):{authMode:"api-key",source:"default-api-key",managedBaseURL:n,warnings:r}}var Ie="minimax",Yt="minimax_api",Fa="custom_provider:";function O_(e,t){return e==="anthropic-messages"&&(t===Ie||t===Yt)}function Ba(e,t){if(t===Yt)return"minimax_api_key";if(t.startsWith(Fa))return"custom_provider";if(t!==Ie)return"configured_provider";if(e.minimaxModelSource==="minimax_api_key")return"minimax_api_key";let n=e.provider?.[t]?.options;return Da({authMode:n?.authMode,baseURL:n?.baseURL}).authMode==="managed-login"?"managed_token_plan":"configured_provider"}function Jp(e,t,n){switch(Ba(e,t)){case"managed_token_plan":return Er(e.provider?.[t],!0);case"minimax_api_key":{let r=e.provider?.[Ie];return Er({...r,models:r?.models??wt},!0)}case"custom_provider":{let r=e.custom_provider?.[t.slice(Fa.length)];return!r||r.enabled===!1?[]:Er(r)}case"configured_provider":return Er(e.provider?.[t])}}function T_(e){let t=Ba(e.config,e.providerId),n=e.modelId.trim();return n.length>0&&Jp(e.config,e.providerId,e.preset).includes(n)?{available:!0,route:t}:{available:!1,route:t,code:e.source==="config_default"?"DEFAULT_MODEL_NOT_AVAILABLE_FOR_ROUTE":"MODEL_NOT_AVAILABLE_FOR_ROUTE",message:`Model "${e.providerId}/${e.modelId}" is not available for the "${t}" route (preset ${e.preset}).`}}function Er(e,t=!1){let n=Object.entries(e?.models??{}).filter(([,s])=>s?.enabled!==!1).map(([s])=>s),i=e?.model_order;if(!t||!Array.isArray(i)||!i.every(s=>typeof s=="string"))return n;let r=new Set(n);return[...i.filter(s=>r.delete(s)),...n.filter(s=>r.has(s))]}var I_=/^\$\{([A-Za-z_][A-Za-z0-9_]*)\}$/;function qa(e){if(typeof e=="string")return I_.exec(e.trim())?.[1]}function Xp(e){let{field:t,provider:n,value:i}=e;if(i==null)return;if(typeof i!="string")throw new Error(`Provider "${n}": ${t} must be a string or a \`\${NAME}\` environment variable reference, received ${N_(i)}.`);let r=i.trim();if(!r)return;let o=qa(r);if(!o)return r;let s=(e.env??process.env)[o]?.trim();if(!s)throw new Error(`Provider "${n}": ${t} references environment variable "${o}", which is not set.`);return s}function M_(e){if(!(typeof e.value=="string"&&e.value.trim().length>0))return{configured:!1};let n=L_(e.value)?"env":"plaintext";try{let i=Xp(e);return{configured:!0,source:n,...i?{secret:i}:{}}}catch{return{configured:!0,source:n}}}function L_(e){return qa(e)!==void 0}function N_(e){return Array.isArray(e)?"a list":`a ${typeof e}`}import{randomBytes as R_}from"node:crypto";import pt,{readFileSync as P_}from"node:fs";import{dirname as Qp,join as D_}from"node:path";var zp=Or(io(),1);var ja=384,xr=new Set(["__proto__","prototype","constructor"]),F_=["minimax_api","custom_provider"];async function B_(e){let t=e.trim();if(!t||t.includes(".")||xr.has(t))throw new ne("Invalid provider id");return jn(async n=>(ye(n.provider)&&delete n.provider[t],{write:!0,value:void 0})).then(({config:n})=>({config:n}))}async function q_(e){if(!ye(e)||!ye(e.models))throw new ne("Invalid managed MiniMax provider snapshot");return kr(e),jn(async t=>(t.provider={...ye(t.provider)?t.provider:{},[Ie]:structuredClone(e)},{write:!0,value:void 0})).then(({config:t})=>({config:t}))}var ne=class extends Error{name="LocalModelProviderConfigValidationError"},$n=class extends Error{name="LocalModelProviderConfigWriteError";constructor(){super("Local runtime failed to update config file")}};async function $_(e){return jn(async(t,n)=>{let i={minimax_api:ye(t.minimax_api)?t.minimax_api:void 0,custom_provider:Y_(ye(t.custom_provider)?t.custom_provider:void 0),minimaxModelSource:typeof t.minimaxModelSource=="string"?t.minimaxModelSource:void 0,defaultModel:typeof t.defaultModel=="string"?t.defaultModel:void 0,defaultModelVariant:typeof t.defaultModelVariant=="string"?t.defaultModelVariant:void 0};await e(i,n);for(let r of F_){let o=i[r];if(o===void 0){delete t[r];continue}if(!ye(o))throw new ne(`Invalid BYOK config subtree "${r}"`);kr(o),t[r]=o}return $a(t,"minimaxModelSource",i.minimaxModelSource),t.defaultModel!==i.defaultModel&&(delete t.defaultModelThinking,delete t.defaultModelContextWindow),$a(t,"defaultModel",i.defaultModel),$a(t,"defaultModelVariant",i.defaultModelVariant),{write:!0,value:void 0}}).then(({config:t})=>({config:t}))}async function j_(e){let t=e.modelKey.trim();if(!t)throw new ne("Default model must not be empty");if(e.contextLimit!==void 0&&(!Number.isSafeInteger(e.contextLimit)||e.contextLimit<=0||e.contextLimit>2147483647))throw new ne("Invalid default context");if(e.thinking?.effort!==void 0&&(typeof e.thinking.effort!="string"||!e.thinking.effort.trim()))throw new ne("Invalid default effort");return jn(async n=>(n.defaultModel=t,e.contextLimit===void 0?delete n.defaultModelContextWindow:n.defaultModelContextWindow=e.contextLimit,e.thinking?.effort===void 0?delete n.defaultModelThinking:n.defaultModelThinking={effort:e.thinking.effort},e.variant===void 0?delete n.defaultModelVariant:n.defaultModelVariant=e.variant,{write:!0,value:void 0})).then(({config:n})=>({config:n}))}async function U_(e,t){let n=e.modelId.trim();if(e.providerId!==Ie&&e.providerId!==Yt||!n||xr.has(n))throw new ne("Invalid MiniMax model context target");let i=await jn(async(r,o)=>{let s=e.providerId===Ie?o.provider?.[e.providerId]?.models?.[n]:Gs(o)[n];if(e.providerId===Yt&&!s?.contextWindowOptions?.includes(e.contextLimit))throw new ne("Invalid MiniMax API context limit");if(s?.limit?.context!==e.expectedContextLimit)return{write:!1,value:!1};if(!await t(o))return{write:!1,value:!1};let a=e.providerId===Ie?["minimaxModelContextLimits",n]:["minimax_api","modelContextLimits",n];return G_(r,a,e.contextLimit),{write:!0,value:!0}});return{config:i.config,updated:i.value}}async function jn(e){let t=Vt(),n;try{await pt.promises.mkdir(Qp(t),{recursive:!0}),await pt.promises.writeFile(t,"",{flag:"a",mode:ja}),await pt.promises.chmod(t,ja),n=await zp.default.lock(t,{stale:1e4,retries:{retries:20,factor:1,minTimeout:5,maxTimeout:25}});let i=V_(t),r=structuredClone(i);_r();let o=await e(r,wr());return o.write&&(kr(r),await K_(t,Nn(P_(t,"utf-8"),i,r)),_r()),{config:wr(),value:o.value}}catch(i){throw i instanceof ne||i instanceof $n?i:new $n}finally{await n?.().catch(()=>{})}}async function K_(e,t){let n=D_(Qp(e),`.config-tmp-${R_(6).toString("hex")}`),i=!1;try{let r=ja,o=await pt.promises.open(n,"wx",r);i=!0;try{await o.writeFile(t,"utf-8"),await o.chmod(r)}finally{await o.close()}await pt.promises.rename(n,e)}catch{throw i&&await pt.promises.unlink(n).catch(()=>{}),new $n}}function V_(e){let t=pt.readFileSync(e,"utf-8"),n;try{n=H.load(t)}catch{throw new ne("Invalid config.yaml: unable to parse YAML")}if(n==null)return{};if(!ye(n)||Object.getPrototypeOf(n)!==Object.prototype)throw new ne("Invalid config.yaml: expected a YAML mapping");return n}function Y_(e){if(e)return Object.fromEntries(Object.entries(e).filter(([,t])=>ye(t)))}function $a(e,t,n){n===void 0?delete e[t]:e[t]=n}function G_(e,t,n){let i=t.at(-1);if(!i)throw new ne("Invalid config path");let r=e;for(let o of t.slice(0,-1)){if(!o||xr.has(o))throw new ne("Invalid config path");let s=r[o];if(ye(s))r=s;else{let a={};r[o]=a,r=a}}r[i]=n}function kr(e){for(let[t,n]of Object.entries(e)){if(!t||xr.has(t))throw new ne(`Local runtime cannot update config field segment "${t}"`);ye(n)&&kr(n)}}function ye(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function nw(e){let t=e.trim();if(!t)return null;if(t.startsWith("{"))try{let i=JSON.parse(t),r=typeof i.pid=="number"?i.pid:parseInt(String(i.pid),10);if(isNaN(r)||r<=0)return null;let o=iw(i.owner)?i.owner:"unknown",s=rw(i.startedAt);return{pid:r,owner:o,...s!==void 0?{startedAt:s}:{},...typeof i.mode=="string"?{mode:i.mode}:{},...typeof i.startupToken=="string"?{startupToken:i.startupToken}:{}}}catch{return null}let n=parseInt(t,10);return isNaN(n)||n<=0?null:{pid:n,owner:"unknown"}}function iw(e){return e==="electron"||e==="cli"||e==="unknown"}function rw(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e!="string")return;let t=new Date(e).getTime();return Number.isFinite(t)?t:void 0}function ow(e,t){let n={pid:e,owner:t,startedAt:Date.now()};return JSON.stringify(n)}function sw(){let e=process.argv.slice(2);for(let t=0;t<e.length;t++){let n=e[t],i=n==="--owner"?e[t+1]:n?.startsWith("--owner=")?n.slice(8):void 0;if(i==="electron")return"electron";if(i==="service"||i==="cli")return"cli"}return"cli"}import Xe from"node:fs";import aw from"node:path";var Zp="local-runtime.auth.json";function _e(e){return typeof e=="string"&&e.trim().length>0?e.trim():void 0}function Ua(e){return e?{..._e(e.accessToken)?{accessToken:_e(e.accessToken)}:{},..._e(e.realUserID)?{realUserID:_e(e.realUserID)}:{},..._e(e.userEmail)?{userEmail:_e(e.userEmail)}:{},..._e(e.userName)?{userName:_e(e.userName)}:{},..._e(e.subUserName)?{subUserName:_e(e.subUserName)}:{}}:{}}function Cr(e){return aw.join(e,Zp)}function lw(e){try{let t=Xe.readFileSync(Cr(e),"utf-8"),n=JSON.parse(t);if(n.version!==1||!n.auth||typeof n.auth!="object")return;let i=Ua(n.auth);return i.accessToken?i:void 0}catch{return}}function cw(e,t,n={}){let i=Cr(e),r=Ua(t);if(!r.accessToken)return em(e),{path:i,written:!1};Xe.mkdirSync(e,{recursive:!0,mode:448});let o={version:1,updatedAtMs:Date.now(),auth:r},s=`${i}.${process.pid}.${Date.now()}.tmp`;return Xe.writeFileSync(s,`${JSON.stringify(o,null,2)}
|
|
193
|
+
`,{encoding:"utf-8",mode:384}),n.retryWindowsFileSystem?(Tr(()=>Xe.renameSync(s,i)),Tr(()=>Xe.chmodSync(i,384))):(Xe.renameSync(s,i),Xe.chmodSync(i,384)),{path:i,written:!0}}function em(e){try{Xe.rmSync(Cr(e),{force:!0})}catch{}}import tm from"node:net";var nm={"e2e-runtime":5e3,"e2e-ui":5500,"smoke-runtime":7e3},Ka=100;async function uw(e,t={}){let n=t.isPortFree??dw,i=t.getFreePort??pw,r=t.getWorktreeBasePort??fw,o=r()+nm[e],s=o-r();if(s<Ka)throw new Error(`pickTestPort(${e}): role offset ${s} collides with app runtime (0); must be >= ${Ka}.`);return o>65535?i():await n(o)?o:i()}function fw(){let e=dt();return e.autoDetected?e.runtimePort:Kt}async function dw(e){return new Promise(t=>{let n=tm.createServer();n.once("error",()=>t(!1)),n.listen(e,"127.0.0.1",()=>{n.close(()=>t(!0))})})}async function pw(){return new Promise((e,t)=>{let n=tm.createServer();n.listen(0,"127.0.0.1",()=>{let i=n.address();if(i&&typeof i!="string"){let{port:r}=i;n.close(()=>e(r))}else n.close(()=>t(new Error("Failed to get free port")))}),n.on("error",t)})}import im from"node:fs";var Gt=class extends Error{code;configPath;constructor(t,n,i,r){super(i,r),this.name="ConfigFileError",this.code=t,this.configPath=n}};function rm(e){let t;try{t=im.readFileSync(e,"utf-8")}catch(i){throw new Gt("CONFIG_READ_FAILED",e,`Cannot read config ${e}.`,{cause:i})}let n;try{n=H.load(t)}catch(i){throw new Gt("CONFIG_PARSE_FAILED",e,`Config is not valid YAML: ${e}`,{cause:i})}if(n==null||typeof n!="object"||Array.isArray(n))throw new Gt("CONFIG_ROOT_INVALID",e,`Config root must be an object: ${e}`);return n}function mw(e,t){return im.existsSync(e)&&Na(e),Ra(rm(e),t.dataDir)}function hw(e,t){let n=rm(e);if(n.beta==null||typeof n.beta!="object"||Array.isArray(n.beta))return;let i=n.beta[t];return typeof i=="boolean"?i:void 0}export{io as a,gw as b,bw as c,om as d,H as e,ng as f,ro as g,oo as h,Sd as i,Ln as j,Nn as k,Ft as l,ir as m,Pv as n,Gs as o,ur as p,Ws as q,oA as r,Hd as s,Bt as t,Jd as u,Hs as v,tp as w,np as x,rp as y,op as z,Ge as A,mA as B,hA as C,sa as D,aa as E,la as F,lp as G,ca as H,SA as I,AA as J,_A as K,wA as L,EA as M,We as N,fa as O,pp as P,yp as Q,gp as R,bp as S,Sp as T,vp as U,he as V,da as W,pa as X,Ae as Y,ma as Z,Pn as _,ya as $,Dn as aa,ga as ba,wp as ca,Sa as da,va as ea,Aa as fa,pr as ga,_a as ha,xp as ia,Np as ja,Te as ka,mr as la,yr as ma,Ca as na,VA as oa,Oa as pa,GA as qa,Rp as ra,Kt as sa,Fp as ta,ZA as ua,dt as va,t_ as wa,Ia as xa,Vt as ya,Kp as za,Ma as Aa,c_ as Ba,u_ as Ca,_r as Da,wr as Ea,Wp as Fa,Hp as Ga,w_ as Ha,k_ as Ia,Pa as Ja,Da as Ka,Ie as La,Yt as Ma,Fa as Na,O_ as Oa,Ba as Pa,Jp as Qa,T_ as Ra,qa as Sa,Xp as Ta,M_ as Ua,B_ as Va,q_ as Wa,$_ as Xa,j_ as Ya,U_ as Za,nw as _a,ow as $a,sw as ab,Zp as bb,Ua as cb,Cr as db,lw as eb,cw as fb,em as gb,nm as hb,Ka as ib,uw as jb,Gt as kb,mw as lb,hw as mb};
|