@minimax-ai/code 0.3.5 → 0.3.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/CHANGELOG.zh-CN.md +23 -0
  3. package/README.md +33 -2
  4. package/README.zh-CN.md +28 -2
  5. package/chunks/{application-HUWMCHND.js → application-LFPFVITL.js} +1 -1
  6. package/chunks/{auth-command-BYZBT26P.js → auth-command-ZZXFBWOS.js} +1 -1
  7. package/chunks/{azure-openai-responses-FWEOB2GJ.js → azure-openai-responses-TYAI4QCH.js} +1 -1
  8. package/chunks/{chunk-XRVRMFGU.js → chunk-5MDJKLXG.js} +1 -1
  9. package/chunks/{chunk-XAM5MDT7.js → chunk-ACTS7L64.js} +1 -1
  10. package/chunks/{chunk-MZPFHOPH.js → chunk-E3Y7YZFG.js} +1 -1
  11. package/chunks/{chunk-JAU52A7E.js → chunk-GMXY243M.js} +1 -1
  12. package/chunks/{chunk-B3RZOZAM.js → chunk-MQKRH5EW.js} +426 -426
  13. package/chunks/chunk-NW6DSOE3.js +3 -0
  14. package/chunks/{chunk-H3N3OSTE.js → chunk-RTN2VVTR.js} +495 -495
  15. package/chunks/{chunk-BLWZ6QN5.js → chunk-RXHPXCVW.js} +1 -1
  16. package/chunks/chunk-SEVVS6ZS.js +5 -0
  17. package/chunks/chunk-UQHSY5YK.js +164 -0
  18. package/chunks/{chunk-LA56ACSJ.js → chunk-WMOPXI4T.js} +7 -7
  19. package/chunks/{chunk-SAVPNWES.js → chunk-XO2KLR35.js} +20 -20
  20. package/chunks/{data-dir-VQU534BQ.js → data-dir-BYKXIBNJ.js} +1 -1
  21. package/chunks/dist-2YKPF46H.js +2 -0
  22. package/chunks/install-source-6JLUO3MG.js +2 -0
  23. package/chunks/{launcher-MX2NVH43.js → launcher-N4XF6G4T.js} +147 -146
  24. package/chunks/{lifecycle-FOX6WX4K.js → lifecycle-2Z6U4ZFY.js} +1 -1
  25. package/chunks/{main-QMF5ARJ7.js → main-LM42U7RA.js} +15 -14
  26. package/chunks/{openai-codex-responses-4DFNORNB.js → openai-codex-responses-HB3H25XX.js} +1 -1
  27. package/chunks/{openai-completions-7UHFNP2X.js → openai-completions-4CWNFN62.js} +1 -1
  28. package/chunks/{openai-responses-FVDPT4UA.js → openai-responses-3ODEYAEO.js} +1 -1
  29. package/chunks/{plugin-command-PPXN6LWR.js → plugin-command-ENLMEUEV.js} +1 -1
  30. package/chunks/{provider-command-B3MUOIKK.js → provider-command-SHDAR5N3.js} +1 -1
  31. package/chunks/{run-acp-command-VU6B46YW.js → run-acp-command-IIRG3KK2.js} +2 -2
  32. package/chunks/{run-exec-command-3MEFVBVG.js → run-exec-command-CWJBGPN7.js} +1 -1
  33. package/chunks/{update-UUNJOWUN.js → update-HTLJYRQR.js} +1 -1
  34. package/cli.js +2 -2
  35. package/package.json +1 -1
  36. package/verify-native-install.mjs +4 -4
  37. package/chunks/chunk-GGVSHD4M.js +0 -165
  38. package/chunks/chunk-KIJODLFS.js +0 -5
  39. package/chunks/dist-K5PPY2Q5.js +0 -2
@@ -1,38 +1,38 @@
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{e as Xn}from"./chunk-MMRA4VD2.js";import{a as ae,c as W,e as Sa}from"./chunk-D76SO2ME.js";var Uo=W((Zd,Do)=>{var de=ae("constants"),Bc=process.cwd,Nn=null,jc=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Nn||(Nn=Bc.call(process)),Nn};try{process.cwd()}catch{}typeof process.chdir=="function"&&(zr=process.chdir,process.chdir=function(e){Nn=null,zr.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,zr));var zr;Do.exports=$c;function $c(e){de.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&n(e),e.lutimes||r(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=a(e.chownSync),e.fchownSync=a(e.fchownSync),e.lchownSync=a(e.lchownSync),e.chmodSync=t(e.chmodSync),e.fchmodSync=t(e.fchmodSync),e.lchmodSync=t(e.lchmodSync),e.stat=l(e.stat),e.fstat=l(e.fstat),e.lstat=l(e.lstat),e.statSync=u(e.statSync),e.fstatSync=u(e.fstatSync),e.lstatSync=u(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(s,c,d){d&&process.nextTick(d)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(s,c,d,p){p&&process.nextTick(p)},e.lchownSync=function(){}),jc==="win32"&&(e.rename=typeof e.rename!="function"?e.rename:(function(s){function c(d,p,m){var h=Date.now(),y=0;s(d,p,function _(x){if(x&&(x.code==="EACCES"||x.code==="EPERM"||x.code==="EBUSY")&&Date.now()-h<6e4){setTimeout(function(){e.stat(p,function(k,ye){k&&k.code==="ENOENT"?s(d,p,_):m(x)})},y),y<100&&(y+=10);return}m&&m(x)})}return Object.setPrototypeOf&&Object.setPrototypeOf(c,s),c})(e.rename)),e.read=typeof e.read!="function"?e.read:(function(s){function c(d,p,m,h,y,_){var x;if(_&&typeof _=="function"){var k=0;x=function(ye,cn,fn){if(ye&&ye.code==="EAGAIN"&&k<10)return k++,s.call(e,d,p,m,h,y,x);_.apply(this,arguments)}}return s.call(e,d,p,m,h,y,x)}return Object.setPrototypeOf&&Object.setPrototypeOf(c,s),c})(e.read),e.readSync=typeof e.readSync!="function"?e.readSync:(function(s){return function(c,d,p,m,h){for(var y=0;;)try{return s.call(e,c,d,p,m,h)}catch(_){if(_.code==="EAGAIN"&&y<10){y++;continue}throw _}}})(e.readSync);function n(s){s.lchmod=function(c,d,p){s.open(c,de.O_WRONLY|de.O_SYMLINK,d,function(m,h){if(m){p&&p(m);return}s.fchmod(h,d,function(y){s.close(h,function(_){p&&p(y||_)})})})},s.lchmodSync=function(c,d){var p=s.openSync(c,de.O_WRONLY|de.O_SYMLINK,d),m=!0,h;try{h=s.fchmodSync(p,d),m=!1}finally{if(m)try{s.closeSync(p)}catch{}else s.closeSync(p)}return h}}function r(s){de.hasOwnProperty("O_SYMLINK")&&s.futimes?(s.lutimes=function(c,d,p,m){s.open(c,de.O_SYMLINK,function(h,y){if(h){m&&m(h);return}s.futimes(y,d,p,function(_){s.close(y,function(x){m&&m(_||x)})})})},s.lutimesSync=function(c,d,p){var m=s.openSync(c,de.O_SYMLINK),h,y=!0;try{h=s.futimesSync(m,d,p),y=!1}finally{if(y)try{s.closeSync(m)}catch{}else s.closeSync(m)}return h}):s.futimes&&(s.lutimes=function(c,d,p,m){m&&process.nextTick(m)},s.lutimesSync=function(){})}function i(s){return s&&function(c,d,p){return s.call(e,c,d,function(m){f(m)&&(m=null),p&&p.apply(this,arguments)})}}function t(s){return s&&function(c,d){try{return s.call(e,c,d)}catch(p){if(!f(p))throw p}}}function o(s){return s&&function(c,d,p,m){return s.call(e,c,d,p,function(h){f(h)&&(h=null),m&&m.apply(this,arguments)})}}function a(s){return s&&function(c,d,p){try{return s.call(e,c,d,p)}catch(m){if(!f(m))throw m}}}function l(s){return s&&function(c,d,p){typeof d=="function"&&(p=d,d=null);function m(h,y){y&&(y.uid<0&&(y.uid+=4294967296),y.gid<0&&(y.gid+=4294967296)),p&&p.apply(this,arguments)}return d?s.call(e,c,d,m):s.call(e,c,m)}}function u(s){return s&&function(c,d){var p=d?s.call(e,c,d):s.call(e,c);return p&&(p.uid<0&&(p.uid+=4294967296),p.gid<0&&(p.gid+=4294967296)),p}}function f(s){if(!s||s.code==="ENOSYS")return!0;var c=!process.getuid||process.getuid()!==0;return!!(c&&(s.code==="EINVAL"||s.code==="EPERM"))}}});var $o=W((ep,jo)=>{var Bo=ae("stream").Stream;jo.exports=Vc;function Vc(e){return{ReadStream:n,WriteStream:r};function n(i,t){if(!(this instanceof n))return new n(i,t);Bo.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,t=t||{};for(var a=Object.keys(t),l=0,u=a.length;l<u;l++){var f=a[l];this[f]=t[f]}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(s,c){if(s){o.emit("error",s),o.readable=!1;return}o.fd=c,o.emit("open",c),o._read()})}function r(i,t){if(!(this instanceof r))return new r(i,t);Bo.call(this),this.path=i,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,t=t||{};for(var o=Object.keys(t),a=0,l=o.length;a<l;a++){var u=o[a];this[u]=t[u]}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 Go=W((np,Vo)=>{"use strict";Vo.exports=Kc;var Gc=Object.getPrototypeOf||function(e){return e.__proto__};function Kc(e){if(e===null||typeof e!="object")return e;if(e instanceof Object)var n={__proto__:Gc(e)};else var n=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(e,r))}),n}});var ei=W((rp,Zr)=>{var C=ae("fs"),Yc=Uo(),Hc=$o(),Wc=Go(),Dn=ae("util"),$,Bn;typeof Symbol=="function"&&typeof Symbol.for=="function"?($=Symbol.for("graceful-fs.queue"),Bn=Symbol.for("graceful-fs.previous")):($="___graceful-fs.queue",Bn="___graceful-fs.previous");function qc(){}function Ho(e,n){Object.defineProperty(e,$,{get:function(){return n}})}var Se=qc;Dn.debuglog?Se=Dn.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Se=function(){var e=Dn.format.apply(Dn,arguments);e="GFS4: "+e.split(/\n/).join(`
3
- GFS4: `),console.error(e)});C[$]||(Ko=global[$]||[],Ho(C,Ko),C.close=(function(e){function n(r,i){return e.call(C,r,function(t){t||Yo(),typeof i=="function"&&i.apply(this,arguments)})}return Object.defineProperty(n,Bn,{value:e}),n})(C.close),C.closeSync=(function(e){function n(r){e.apply(C,arguments),Yo()}return Object.defineProperty(n,Bn,{value:e}),n})(C.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Se(C[$]),ae("assert").equal(C[$].length,0)}));var Ko;global[$]||Ho(global,C[$]);Zr.exports=Qr(Wc(C));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!C.__patched&&(Zr.exports=Qr(C),C.__patched=!0);function Qr(e){Yc(e),e.gracefulify=Qr,e.createReadStream=cn,e.createWriteStream=fn;var n=e.readFile;e.readFile=r;function r(b,A,v){return typeof A=="function"&&(v=A,A=null),D(b,A,v);function D(U,P,I,L){return n(U,P,function(E){E&&(E.code==="EMFILE"||E.code==="ENFILE")?Ge([D,[U,P,I],E,L||Date.now(),Date.now()]):typeof I=="function"&&I.apply(this,arguments)})}}var i=e.writeFile;e.writeFile=t;function t(b,A,v,D){return typeof v=="function"&&(D=v,v=null),U(b,A,v,D);function U(P,I,L,E,B){return i(P,I,L,function(M){M&&(M.code==="EMFILE"||M.code==="ENFILE")?Ge([U,[P,I,L,E],M,B||Date.now(),Date.now()]):typeof E=="function"&&E.apply(this,arguments)})}}var o=e.appendFile;o&&(e.appendFile=a);function a(b,A,v,D){return typeof v=="function"&&(D=v,v=null),U(b,A,v,D);function U(P,I,L,E,B){return o(P,I,L,function(M){M&&(M.code==="EMFILE"||M.code==="ENFILE")?Ge([U,[P,I,L,E],M,B||Date.now(),Date.now()]):typeof E=="function"&&E.apply(this,arguments)})}}var l=e.copyFile;l&&(e.copyFile=u);function u(b,A,v,D){return typeof v=="function"&&(D=v,v=0),U(b,A,v,D);function U(P,I,L,E,B){return l(P,I,L,function(M){M&&(M.code==="EMFILE"||M.code==="ENFILE")?Ge([U,[P,I,L,E],M,B||Date.now(),Date.now()]):typeof E=="function"&&E.apply(this,arguments)})}}var f=e.readdir;e.readdir=c;var s=/^v[0-5]\./;function c(b,A,v){typeof A=="function"&&(v=A,A=null);var D=s.test(process.version)?function(I,L,E,B){return f(I,U(I,L,E,B))}:function(I,L,E,B){return f(I,L,U(I,L,E,B))};return D(b,A,v);function U(P,I,L,E){return function(B,M){B&&(B.code==="EMFILE"||B.code==="ENFILE")?Ge([D,[P,I,L],B,E||Date.now(),Date.now()]):(M&&M.sort&&M.sort(),typeof L=="function"&&L.call(this,B,M))}}}if(process.version.substr(0,4)==="v0.8"){var d=Hc(e);_=d.ReadStream,k=d.WriteStream}var p=e.ReadStream;p&&(_.prototype=Object.create(p.prototype),_.prototype.open=x);var m=e.WriteStream;m&&(k.prototype=Object.create(m.prototype),k.prototype.open=ye),Object.defineProperty(e,"ReadStream",{get:function(){return _},set:function(b){_=b},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return k},set:function(b){k=b},enumerable:!0,configurable:!0});var h=_;Object.defineProperty(e,"FileReadStream",{get:function(){return h},set:function(b){h=b},enumerable:!0,configurable:!0});var y=k;Object.defineProperty(e,"FileWriteStream",{get:function(){return y},set:function(b){y=b},enumerable:!0,configurable:!0});function _(b,A){return this instanceof _?(p.apply(this,arguments),this):_.apply(Object.create(_.prototype),arguments)}function x(){var b=this;Le(b.path,b.flags,b.mode,function(A,v){A?(b.autoClose&&b.destroy(),b.emit("error",A)):(b.fd=v,b.emit("open",v),b.read())})}function k(b,A){return this instanceof k?(m.apply(this,arguments),this):k.apply(Object.create(k.prototype),arguments)}function ye(){var b=this;Le(b.path,b.flags,b.mode,function(A,v){A?(b.destroy(),b.emit("error",A)):(b.fd=v,b.emit("open",v))})}function cn(b,A){return new e.ReadStream(b,A)}function fn(b,A){return new e.WriteStream(b,A)}var Ce=e.open;e.open=Le;function Le(b,A,v,D){return typeof v=="function"&&(D=v,v=null),U(b,A,v,D);function U(P,I,L,E,B){return Ce(P,I,L,function(M,rd){M&&(M.code==="EMFILE"||M.code==="ENFILE")?Ge([U,[P,I,L,E],M,B||Date.now(),Date.now()]):typeof E=="function"&&E.apply(this,arguments)})}}return e}function Ge(e){Se("ENQUEUE",e[0].name,e[1]),C[$].push(e),Jr()}var Un;function Yo(){for(var e=Date.now(),n=0;n<C[$].length;++n)C[$][n].length>2&&(C[$][n][3]=e,C[$][n][4]=e);Jr()}function Jr(){if(clearTimeout(Un),Un=void 0,C[$].length!==0){var e=C[$].shift(),n=e[0],r=e[1],i=e[2],t=e[3],o=e[4];if(t===void 0)Se("RETRY",n.name,r),n.apply(null,r);else if(Date.now()-t>=6e4){Se("TIMEOUT",n.name,r);var a=r.pop();typeof a=="function"&&a.call(null,i)}else{var l=Date.now()-o,u=Math.max(o-t,1),f=Math.min(u*1.2,100);l>=f?(Se("RETRY",n.name,r),n.apply(null,r.concat([t]))):C[$].push(e)}Un===void 0&&(Un=setTimeout(Jr,0))}}});var qo=W((ip,Wo)=>{function X(e,n){typeof n=="boolean"&&(n={forever:n}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=n||{},this._maxRetryTime=n&&n.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))}Wo.exports=X;X.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};X.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};X.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var n=new Date().getTime();if(e&&n-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),r=this._timeouts.shift();else return!1;var i=this,t=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)},r);return this._options.unref&&t.unref(),!0};X.prototype.attempt=function(e,n){this._fn=e,n&&(n.timeout&&(this._operationTimeout=n.timeout),n.cb&&(this._operationTimeoutCb=n.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};X.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)};X.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)};X.prototype.start=X.prototype.try;X.prototype.errors=function(){return this._errors};X.prototype.attempts=function(){return this._attempts};X.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},n=null,r=0,i=0;i<this._errors.length;i++){var t=this._errors[i],o=t.message,a=(e[o]||0)+1;e[o]=a,a>=r&&(n=t,r=a)}return n}});var Xo=W(Me=>{var Xc=qo();Me.operation=function(e){var n=Me.timeouts(e);return new Xc(n,{forever:e&&e.forever,unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})};Me.timeouts=function(e){if(e instanceof Array)return[].concat(e);var n={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in e)n[r]=e[r];if(n.minTimeout>n.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var i=[],t=0;t<n.retries;t++)i.push(this.createTimeout(t,n));return e&&e.forever&&!i.length&&i.push(this.createTimeout(t,n)),i.sort(function(o,a){return o-a}),i};Me.createTimeout=function(e,n){var r=n.randomize?Math.random()+1:1,i=Math.round(r*n.minTimeout*Math.pow(n.factor,e));return i=Math.min(i,n.maxTimeout),i};Me.wrap=function(e,n,r){if(n instanceof Array&&(r=n,n=null),!r){r=[];for(var i in e)typeof e[i]=="function"&&r.push(i)}for(var t=0;t<r.length;t++){var o=r[t],a=e[o];e[o]=function(u){var f=Me.operation(n),s=Array.prototype.slice.call(arguments,1),c=s.pop();s.push(function(d){f.retry(d)||(d&&(arguments[0]=f.mainError()),c.apply(this,arguments))}),f.attempt(function(){u.apply(e,s)})}.bind(e,a),e[o].options=n}}});var Qo=W((op,zo)=>{zo.exports=Xo()});var Jo=W((ap,jn)=>{jn.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&jn.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&jn.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var ia=W((lp,He)=>{var T=global.process,Te=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"};Te(T)?(Zo=ae("assert"),Ke=Jo(),ea=/^win/i.test(T.platform),an=ae("events"),typeof an!="function"&&(an=an.EventEmitter),T.__signal_exit_emitter__?N=T.__signal_exit_emitter__:(N=T.__signal_exit_emitter__=new an,N.count=0,N.emitted={}),N.infinite||(N.setMaxListeners(1/0),N.infinite=!0),He.exports=function(e,n){if(!Te(global.process))return function(){};Zo.equal(typeof e,"function","a callback must be provided for exit handler"),Ye===!1&&ni();var r="exit";n&&n.alwaysLast&&(r="afterexit");var i=function(){N.removeListener(r,e),N.listeners("exit").length===0&&N.listeners("afterexit").length===0&&$n()};return N.on(r,e),i},$n=function(){!Ye||!Te(global.process)||(Ye=!1,Ke.forEach(function(n){try{T.removeListener(n,Vn[n])}catch{}}),T.emit=Gn,T.reallyExit=ri,N.count-=1)},He.exports.unload=$n,Ie=function(n,r,i){N.emitted[n]||(N.emitted[n]=!0,N.emit(n,r,i))},Vn={},Ke.forEach(function(e){Vn[e]=function(){if(Te(global.process)){var r=T.listeners(e);r.length===N.count&&($n(),Ie("exit",null,e),Ie("afterexit",null,e),ea&&e==="SIGHUP"&&(e="SIGINT"),T.kill(T.pid,e))}}}),He.exports.signals=function(){return Ke},Ye=!1,ni=function(){Ye||!Te(global.process)||(Ye=!0,N.count+=1,Ke=Ke.filter(function(n){try{return T.on(n,Vn[n]),!0}catch{return!1}}),T.emit=ra,T.reallyExit=na)},He.exports.load=ni,ri=T.reallyExit,na=function(n){Te(global.process)&&(T.exitCode=n||0,Ie("exit",T.exitCode,null),Ie("afterexit",T.exitCode,null),ri.call(T,T.exitCode))},Gn=T.emit,ra=function(n,r){if(n==="exit"&&Te(global.process)){r!==void 0&&(T.exitCode=r);var i=Gn.apply(this,arguments);return Ie("exit",T.exitCode,null),Ie("afterexit",T.exitCode,null),i}else return Gn.apply(this,arguments)}):He.exports=function(){return function(){}};var Zo,Ke,ea,an,N,$n,Ie,Vn,Ye,ni,ri,na,Gn,ra});var oa=W((up,ii)=>{"use strict";var ta=Symbol();function zc(e,n,r){let i=n[ta];if(i)return n.stat(e,(o,a)=>{if(o)return r(o);r(null,a.mtime,i)});let t=new Date(Math.ceil(Date.now()/1e3)*1e3+5);n.utimes(e,t,t,o=>{if(o)return r(o);n.stat(e,(a,l)=>{if(a)return r(a);let u=l.mtime.getTime()%1e3===0?"s":"ms";Object.defineProperty(n,ta,{value:u}),r(null,l.mtime,u)})})}function Qc(e){let n=Date.now();return e==="s"&&(n=Math.ceil(n/1e3)*1e3),new Date(n)}ii.exports.probe=zc;ii.exports.getMtime=Qc});var ca=W((sp,un)=>{"use strict";var Jc=ae("path"),ai=ei(),Zc=Qo(),ef=ia(),aa=oa(),oe={};function ln(e,n){return n.lockfilePath||`${e}.lock`}function li(e,n,r){if(!n.realpath)return r(null,Jc.resolve(e));n.fs.realpath(e,r)}function oi(e,n,r){let i=ln(e,n);n.fs.mkdir(i,t=>{if(!t)return aa.probe(i,n.fs,(o,a,l)=>{if(o)return n.fs.rmdir(i,()=>{}),r(o);r(null,a,l)});if(t.code!=="EEXIST")return r(t);if(n.stale<=0)return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:e}));n.fs.stat(i,(o,a)=>{if(o)return o.code==="ENOENT"?oi(e,{...n,stale:0},r):r(o);if(!la(a,n))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:e}));ua(e,n,l=>{if(l)return r(l);oi(e,{...n,stale:0},r)})})})}function la(e,n){return e.mtime.getTime()<Date.now()-n.stale}function ua(e,n,r){n.fs.rmdir(ln(e,n),i=>{if(i&&i.code!=="ENOENT")return r(i);r()})}function Kn(e,n){let r=oe[e];r.updateTimeout||(r.updateDelay=r.updateDelay||n.update,r.updateTimeout=setTimeout(()=>{r.updateTimeout=null,n.fs.stat(r.lockfilePath,(i,t)=>{let o=r.lastUpdate+n.stale<Date.now();if(i)return i.code==="ENOENT"||o?ti(e,r,Object.assign(i,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Kn(e,n));if(!(r.mtime.getTime()===t.mtime.getTime()))return ti(e,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let l=aa.getMtime(r.mtimePrecision);n.fs.utimes(r.lockfilePath,l,l,u=>{let f=r.lastUpdate+n.stale<Date.now();if(!r.released){if(u)return u.code==="ENOENT"||f?ti(e,r,Object.assign(u,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Kn(e,n));r.mtime=l,r.lastUpdate=Date.now(),r.updateDelay=null,Kn(e,n)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function ti(e,n,r){n.released=!0,n.updateTimeout&&clearTimeout(n.updateTimeout),oe[e]===n&&delete oe[e],n.options.onCompromised(r)}function nf(e,n,r){n={stale:1e4,update:null,realpath:!0,retries:0,fs:ai,onCompromised:i=>{throw i},...n},n.retries=n.retries||0,n.retries=typeof n.retries=="number"?{retries:n.retries}:n.retries,n.stale=Math.max(n.stale||0,2e3),n.update=n.update==null?n.stale/2:n.update||0,n.update=Math.max(Math.min(n.update,n.stale/2),1e3),li(e,n,(i,t)=>{if(i)return r(i);let o=Zc.operation(n.retries);o.attempt(()=>{oi(t,n,(a,l,u)=>{if(o.retry(a))return;if(a)return r(o.mainError());let f=oe[t]={lockfilePath:ln(t,n),mtime:l,mtimePrecision:u,options:n,lastUpdate:Date.now()};Kn(t,n),r(null,s=>{if(f.released)return s&&s(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));sa(t,{...n,realpath:!1},s)})})})})}function sa(e,n,r){n={fs:ai,realpath:!0,...n},li(e,n,(i,t)=>{if(i)return r(i);let o=oe[t];if(!o)return r(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));o.updateTimeout&&clearTimeout(o.updateTimeout),o.released=!0,delete oe[t],ua(t,n,r)})}function rf(e,n,r){n={stale:1e4,realpath:!0,fs:ai,...n},n.stale=Math.max(n.stale||0,2e3),li(e,n,(i,t)=>{if(i)return r(i);n.fs.stat(ln(t,n),(o,a)=>o?o.code==="ENOENT"?r(null,!1):r(o):r(null,!la(a,n)))})}function tf(){return oe}ef(()=>{for(let e in oe){let n=oe[e].options;try{n.fs.rmdirSync(ln(e,n))}catch{}}});un.exports.lock=nf;un.exports.unlock=sa;un.exports.check=rf;un.exports.getLocks=tf});var da=W((cp,fa)=>{"use strict";var of=ei();function af(e){let n=["mkdir","realpath","stat","rmdir","utimes"],r={...e};return n.forEach(i=>{r[i]=(...t)=>{let o=t.pop(),a;try{a=e[`${i}Sync`](...t)}catch(l){return o(l)}o(null,a)}}),r}function lf(e){return(...n)=>new Promise((r,i)=>{n.push((t,o)=>{t?i(t):r(o)}),e(...n)})}function uf(e){return(...n)=>{let r,i;if(n.push((t,o)=>{r=t,i=o}),e(...n),r)throw r;return i}}function sf(e){if(e={...e},e.fs=af(e.fs||of),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}fa.exports={toPromise:lf,toSync:uf,toSyncOptions:sf}});var ma=W((fp,pe)=>{"use strict";var We=ca(),{toPromise:Yn,toSync:Hn,toSyncOptions:ui}=da();async function pa(e,n){let r=await Yn(We.lock)(e,n);return Yn(r)}function cf(e,n){let r=Hn(We.lock)(e,ui(n));return Hn(r)}function ff(e,n){return Yn(We.unlock)(e,n)}function df(e,n){return Hn(We.unlock)(e,ui(n))}function pf(e,n){return Yn(We.check)(e,n)}function mf(e,n){return Hn(We.check)(e,ui(n))}pe.exports=pa;pe.exports.lock=pa;pe.exports.unlock=ff;pe.exports.lockSync=cf;pe.exports.unlockSync=df;pe.exports.check=pf;pe.exports.checkSync=mf});import re from"node:fs";import G from"node:path";import yo from"node:os";import{spawnSync as Vs}from"node:child_process";import{fileURLToPath as Gs}from"node:url";function Li(e){return typeof e>"u"||e===null}function Ma(e){return typeof e=="object"&&e!==null}function Ta(e){return Array.isArray(e)?e:Li(e)?[]:[e]}function Ia(e,n){var r,i,t,o;if(n)for(o=Object.keys(n),r=0,i=o.length;r<i;r+=1)t=o[r],e[t]=n[t];return e}function Oa(e,n){var r="",i;for(i=0;i<n;i+=1)r+=e;return r}function Ca(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var La=Li,ka=Ma,Ra=Ta,wa=Oa,Fa=Ca,Pa=Ia,w={isNothing:La,isObject:ka,toArray:Ra,repeat:wa,isNegativeZero:Fa,extend:Pa};function ki(e,n){var r="",i=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(r+='in "'+e.mark.name+'" '),r+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!n&&e.mark.snippet&&(r+=`
2
+ import{e as Xn}from"./chunk-MMRA4VD2.js";import{a as ae,c as W,e as Ta}from"./chunk-D76SO2ME.js";var jo=W((tp,Bo)=>{var de=ae("constants"),Vc=process.cwd,Nn=null,Gc=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Nn||(Nn=Vc.call(process)),Nn};try{process.cwd()}catch{}typeof process.chdir=="function"&&(Jr=process.chdir,process.chdir=function(e){Nn=null,Jr.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Jr));var Jr;Bo.exports=Kc;function Kc(e){de.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&n(e),e.lutimes||r(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=a(e.chownSync),e.fchownSync=a(e.fchownSync),e.lchownSync=a(e.lchownSync),e.chmodSync=t(e.chmodSync),e.fchmodSync=t(e.fchmodSync),e.lchmodSync=t(e.lchmodSync),e.stat=l(e.stat),e.fstat=l(e.fstat),e.lstat=l(e.lstat),e.statSync=u(e.statSync),e.fstatSync=u(e.fstatSync),e.lstatSync=u(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(s,c,d){d&&process.nextTick(d)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(s,c,d,p){p&&process.nextTick(p)},e.lchownSync=function(){}),Gc==="win32"&&(e.rename=typeof e.rename!="function"?e.rename:(function(s){function c(d,p,m){var h=Date.now(),y=0;s(d,p,function _(x){if(x&&(x.code==="EACCES"||x.code==="EPERM"||x.code==="EBUSY")&&Date.now()-h<6e4){setTimeout(function(){e.stat(p,function(k,ye){k&&k.code==="ENOENT"?s(d,p,_):m(x)})},y),y<100&&(y+=10);return}m&&m(x)})}return Object.setPrototypeOf&&Object.setPrototypeOf(c,s),c})(e.rename)),e.read=typeof e.read!="function"?e.read:(function(s){function c(d,p,m,h,y,_){var x;if(_&&typeof _=="function"){var k=0;x=function(ye,cn,fn){if(ye&&ye.code==="EAGAIN"&&k<10)return k++,s.call(e,d,p,m,h,y,x);_.apply(this,arguments)}}return s.call(e,d,p,m,h,y,x)}return Object.setPrototypeOf&&Object.setPrototypeOf(c,s),c})(e.read),e.readSync=typeof e.readSync!="function"?e.readSync:(function(s){return function(c,d,p,m,h){for(var y=0;;)try{return s.call(e,c,d,p,m,h)}catch(_){if(_.code==="EAGAIN"&&y<10){y++;continue}throw _}}})(e.readSync);function n(s){s.lchmod=function(c,d,p){s.open(c,de.O_WRONLY|de.O_SYMLINK,d,function(m,h){if(m){p&&p(m);return}s.fchmod(h,d,function(y){s.close(h,function(_){p&&p(y||_)})})})},s.lchmodSync=function(c,d){var p=s.openSync(c,de.O_WRONLY|de.O_SYMLINK,d),m=!0,h;try{h=s.fchmodSync(p,d),m=!1}finally{if(m)try{s.closeSync(p)}catch{}else s.closeSync(p)}return h}}function r(s){de.hasOwnProperty("O_SYMLINK")&&s.futimes?(s.lutimes=function(c,d,p,m){s.open(c,de.O_SYMLINK,function(h,y){if(h){m&&m(h);return}s.futimes(y,d,p,function(_){s.close(y,function(x){m&&m(_||x)})})})},s.lutimesSync=function(c,d,p){var m=s.openSync(c,de.O_SYMLINK),h,y=!0;try{h=s.futimesSync(m,d,p),y=!1}finally{if(y)try{s.closeSync(m)}catch{}else s.closeSync(m)}return h}):s.futimes&&(s.lutimes=function(c,d,p,m){m&&process.nextTick(m)},s.lutimesSync=function(){})}function i(s){return s&&function(c,d,p){return s.call(e,c,d,function(m){f(m)&&(m=null),p&&p.apply(this,arguments)})}}function t(s){return s&&function(c,d){try{return s.call(e,c,d)}catch(p){if(!f(p))throw p}}}function o(s){return s&&function(c,d,p,m){return s.call(e,c,d,p,function(h){f(h)&&(h=null),m&&m.apply(this,arguments)})}}function a(s){return s&&function(c,d,p){try{return s.call(e,c,d,p)}catch(m){if(!f(m))throw m}}}function l(s){return s&&function(c,d,p){typeof d=="function"&&(p=d,d=null);function m(h,y){y&&(y.uid<0&&(y.uid+=4294967296),y.gid<0&&(y.gid+=4294967296)),p&&p.apply(this,arguments)}return d?s.call(e,c,d,m):s.call(e,c,m)}}function u(s){return s&&function(c,d){var p=d?s.call(e,c,d):s.call(e,c);return p&&(p.uid<0&&(p.uid+=4294967296),p.gid<0&&(p.gid+=4294967296)),p}}function f(s){if(!s||s.code==="ENOSYS")return!0;var c=!process.getuid||process.getuid()!==0;return!!(c&&(s.code==="EINVAL"||s.code==="EPERM"))}}});var Go=W((op,Vo)=>{var $o=ae("stream").Stream;Vo.exports=Yc;function Yc(e){return{ReadStream:n,WriteStream:r};function n(i,t){if(!(this instanceof n))return new n(i,t);$o.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,t=t||{};for(var a=Object.keys(t),l=0,u=a.length;l<u;l++){var f=a[l];this[f]=t[f]}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(s,c){if(s){o.emit("error",s),o.readable=!1;return}o.fd=c,o.emit("open",c),o._read()})}function r(i,t){if(!(this instanceof r))return new r(i,t);$o.call(this),this.path=i,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,t=t||{};for(var o=Object.keys(t),a=0,l=o.length;a<l;a++){var u=o[a];this[u]=t[u]}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 Yo=W((ap,Ko)=>{"use strict";Ko.exports=Wc;var Hc=Object.getPrototypeOf||function(e){return e.__proto__};function Wc(e){if(e===null||typeof e!="object")return e;if(e instanceof Object)var n={__proto__:Hc(e)};else var n=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(e,r))}),n}});var ri=W((lp,ni)=>{var C=ae("fs"),qc=jo(),Xc=Go(),zc=Yo(),Dn=ae("util"),$,Bn;typeof Symbol=="function"&&typeof Symbol.for=="function"?($=Symbol.for("graceful-fs.queue"),Bn=Symbol.for("graceful-fs.previous")):($="___graceful-fs.queue",Bn="___graceful-fs.previous");function Qc(){}function qo(e,n){Object.defineProperty(e,$,{get:function(){return n}})}var Se=Qc;Dn.debuglog?Se=Dn.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Se=function(){var e=Dn.format.apply(Dn,arguments);e="GFS4: "+e.split(/\n/).join(`
3
+ GFS4: `),console.error(e)});C[$]||(Ho=global[$]||[],qo(C,Ho),C.close=(function(e){function n(r,i){return e.call(C,r,function(t){t||Wo(),typeof i=="function"&&i.apply(this,arguments)})}return Object.defineProperty(n,Bn,{value:e}),n})(C.close),C.closeSync=(function(e){function n(r){e.apply(C,arguments),Wo()}return Object.defineProperty(n,Bn,{value:e}),n})(C.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Se(C[$]),ae("assert").equal(C[$].length,0)}));var Ho;global[$]||qo(global,C[$]);ni.exports=Zr(zc(C));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!C.__patched&&(ni.exports=Zr(C),C.__patched=!0);function Zr(e){qc(e),e.gracefulify=Zr,e.createReadStream=cn,e.createWriteStream=fn;var n=e.readFile;e.readFile=r;function r(b,A,v){return typeof A=="function"&&(v=A,A=null),D(b,A,v);function D(U,F,I,L){return n(U,F,function(E){E&&(E.code==="EMFILE"||E.code==="ENFILE")?Ge([D,[U,F,I],E,L||Date.now(),Date.now()]):typeof I=="function"&&I.apply(this,arguments)})}}var i=e.writeFile;e.writeFile=t;function t(b,A,v,D){return typeof v=="function"&&(D=v,v=null),U(b,A,v,D);function U(F,I,L,E,B){return i(F,I,L,function(M){M&&(M.code==="EMFILE"||M.code==="ENFILE")?Ge([U,[F,I,L,E],M,B||Date.now(),Date.now()]):typeof E=="function"&&E.apply(this,arguments)})}}var o=e.appendFile;o&&(e.appendFile=a);function a(b,A,v,D){return typeof v=="function"&&(D=v,v=null),U(b,A,v,D);function U(F,I,L,E,B){return o(F,I,L,function(M){M&&(M.code==="EMFILE"||M.code==="ENFILE")?Ge([U,[F,I,L,E],M,B||Date.now(),Date.now()]):typeof E=="function"&&E.apply(this,arguments)})}}var l=e.copyFile;l&&(e.copyFile=u);function u(b,A,v,D){return typeof v=="function"&&(D=v,v=0),U(b,A,v,D);function U(F,I,L,E,B){return l(F,I,L,function(M){M&&(M.code==="EMFILE"||M.code==="ENFILE")?Ge([U,[F,I,L,E],M,B||Date.now(),Date.now()]):typeof E=="function"&&E.apply(this,arguments)})}}var f=e.readdir;e.readdir=c;var s=/^v[0-5]\./;function c(b,A,v){typeof A=="function"&&(v=A,A=null);var D=s.test(process.version)?function(I,L,E,B){return f(I,U(I,L,E,B))}:function(I,L,E,B){return f(I,L,U(I,L,E,B))};return D(b,A,v);function U(F,I,L,E){return function(B,M){B&&(B.code==="EMFILE"||B.code==="ENFILE")?Ge([D,[F,I,L],B,E||Date.now(),Date.now()]):(M&&M.sort&&M.sort(),typeof L=="function"&&L.call(this,B,M))}}}if(process.version.substr(0,4)==="v0.8"){var d=Xc(e);_=d.ReadStream,k=d.WriteStream}var p=e.ReadStream;p&&(_.prototype=Object.create(p.prototype),_.prototype.open=x);var m=e.WriteStream;m&&(k.prototype=Object.create(m.prototype),k.prototype.open=ye),Object.defineProperty(e,"ReadStream",{get:function(){return _},set:function(b){_=b},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return k},set:function(b){k=b},enumerable:!0,configurable:!0});var h=_;Object.defineProperty(e,"FileReadStream",{get:function(){return h},set:function(b){h=b},enumerable:!0,configurable:!0});var y=k;Object.defineProperty(e,"FileWriteStream",{get:function(){return y},set:function(b){y=b},enumerable:!0,configurable:!0});function _(b,A){return this instanceof _?(p.apply(this,arguments),this):_.apply(Object.create(_.prototype),arguments)}function x(){var b=this;Le(b.path,b.flags,b.mode,function(A,v){A?(b.autoClose&&b.destroy(),b.emit("error",A)):(b.fd=v,b.emit("open",v),b.read())})}function k(b,A){return this instanceof k?(m.apply(this,arguments),this):k.apply(Object.create(k.prototype),arguments)}function ye(){var b=this;Le(b.path,b.flags,b.mode,function(A,v){A?(b.destroy(),b.emit("error",A)):(b.fd=v,b.emit("open",v))})}function cn(b,A){return new e.ReadStream(b,A)}function fn(b,A){return new e.WriteStream(b,A)}var Ce=e.open;e.open=Le;function Le(b,A,v,D){return typeof v=="function"&&(D=v,v=null),U(b,A,v,D);function U(F,I,L,E,B){return Ce(F,I,L,function(M,od){M&&(M.code==="EMFILE"||M.code==="ENFILE")?Ge([U,[F,I,L,E],M,B||Date.now(),Date.now()]):typeof E=="function"&&E.apply(this,arguments)})}}return e}function Ge(e){Se("ENQUEUE",e[0].name,e[1]),C[$].push(e),ei()}var Un;function Wo(){for(var e=Date.now(),n=0;n<C[$].length;++n)C[$][n].length>2&&(C[$][n][3]=e,C[$][n][4]=e);ei()}function ei(){if(clearTimeout(Un),Un=void 0,C[$].length!==0){var e=C[$].shift(),n=e[0],r=e[1],i=e[2],t=e[3],o=e[4];if(t===void 0)Se("RETRY",n.name,r),n.apply(null,r);else if(Date.now()-t>=6e4){Se("TIMEOUT",n.name,r);var a=r.pop();typeof a=="function"&&a.call(null,i)}else{var l=Date.now()-o,u=Math.max(o-t,1),f=Math.min(u*1.2,100);l>=f?(Se("RETRY",n.name,r),n.apply(null,r.concat([t]))):C[$].push(e)}Un===void 0&&(Un=setTimeout(ei,0))}}});var zo=W((up,Xo)=>{function X(e,n){typeof n=="boolean"&&(n={forever:n}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=n||{},this._maxRetryTime=n&&n.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))}Xo.exports=X;X.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};X.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};X.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var n=new Date().getTime();if(e&&n-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),r=this._timeouts.shift();else return!1;var i=this,t=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)},r);return this._options.unref&&t.unref(),!0};X.prototype.attempt=function(e,n){this._fn=e,n&&(n.timeout&&(this._operationTimeout=n.timeout),n.cb&&(this._operationTimeoutCb=n.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};X.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)};X.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)};X.prototype.start=X.prototype.try;X.prototype.errors=function(){return this._errors};X.prototype.attempts=function(){return this._attempts};X.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},n=null,r=0,i=0;i<this._errors.length;i++){var t=this._errors[i],o=t.message,a=(e[o]||0)+1;e[o]=a,a>=r&&(n=t,r=a)}return n}});var Qo=W(Me=>{var Jc=zo();Me.operation=function(e){var n=Me.timeouts(e);return new Jc(n,{forever:e&&e.forever,unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})};Me.timeouts=function(e){if(e instanceof Array)return[].concat(e);var n={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in e)n[r]=e[r];if(n.minTimeout>n.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var i=[],t=0;t<n.retries;t++)i.push(this.createTimeout(t,n));return e&&e.forever&&!i.length&&i.push(this.createTimeout(t,n)),i.sort(function(o,a){return o-a}),i};Me.createTimeout=function(e,n){var r=n.randomize?Math.random()+1:1,i=Math.round(r*n.minTimeout*Math.pow(n.factor,e));return i=Math.min(i,n.maxTimeout),i};Me.wrap=function(e,n,r){if(n instanceof Array&&(r=n,n=null),!r){r=[];for(var i in e)typeof e[i]=="function"&&r.push(i)}for(var t=0;t<r.length;t++){var o=r[t],a=e[o];e[o]=function(u){var f=Me.operation(n),s=Array.prototype.slice.call(arguments,1),c=s.pop();s.push(function(d){f.retry(d)||(d&&(arguments[0]=f.mainError()),c.apply(this,arguments))}),f.attempt(function(){u.apply(e,s)})}.bind(e,a),e[o].options=n}}});var Zo=W((cp,Jo)=>{Jo.exports=Qo()});var ea=W((fp,jn)=>{jn.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&jn.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&jn.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var oa=W((dp,He)=>{var T=global.process,Te=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"};Te(T)?(na=ae("assert"),Ke=ea(),ra=/^win/i.test(T.platform),an=ae("events"),typeof an!="function"&&(an=an.EventEmitter),T.__signal_exit_emitter__?N=T.__signal_exit_emitter__:(N=T.__signal_exit_emitter__=new an,N.count=0,N.emitted={}),N.infinite||(N.setMaxListeners(1/0),N.infinite=!0),He.exports=function(e,n){if(!Te(global.process))return function(){};na.equal(typeof e,"function","a callback must be provided for exit handler"),Ye===!1&&ii();var r="exit";n&&n.alwaysLast&&(r="afterexit");var i=function(){N.removeListener(r,e),N.listeners("exit").length===0&&N.listeners("afterexit").length===0&&$n()};return N.on(r,e),i},$n=function(){!Ye||!Te(global.process)||(Ye=!1,Ke.forEach(function(n){try{T.removeListener(n,Vn[n])}catch{}}),T.emit=Gn,T.reallyExit=ti,N.count-=1)},He.exports.unload=$n,Ie=function(n,r,i){N.emitted[n]||(N.emitted[n]=!0,N.emit(n,r,i))},Vn={},Ke.forEach(function(e){Vn[e]=function(){if(Te(global.process)){var r=T.listeners(e);r.length===N.count&&($n(),Ie("exit",null,e),Ie("afterexit",null,e),ra&&e==="SIGHUP"&&(e="SIGINT"),T.kill(T.pid,e))}}}),He.exports.signals=function(){return Ke},Ye=!1,ii=function(){Ye||!Te(global.process)||(Ye=!0,N.count+=1,Ke=Ke.filter(function(n){try{return T.on(n,Vn[n]),!0}catch{return!1}}),T.emit=ta,T.reallyExit=ia)},He.exports.load=ii,ti=T.reallyExit,ia=function(n){Te(global.process)&&(T.exitCode=n||0,Ie("exit",T.exitCode,null),Ie("afterexit",T.exitCode,null),ti.call(T,T.exitCode))},Gn=T.emit,ta=function(n,r){if(n==="exit"&&Te(global.process)){r!==void 0&&(T.exitCode=r);var i=Gn.apply(this,arguments);return Ie("exit",T.exitCode,null),Ie("afterexit",T.exitCode,null),i}else return Gn.apply(this,arguments)}):He.exports=function(){return function(){}};var na,Ke,ra,an,N,$n,Ie,Vn,Ye,ii,ti,ia,Gn,ta});var la=W((pp,oi)=>{"use strict";var aa=Symbol();function Zc(e,n,r){let i=n[aa];if(i)return n.stat(e,(o,a)=>{if(o)return r(o);r(null,a.mtime,i)});let t=new Date(Math.ceil(Date.now()/1e3)*1e3+5);n.utimes(e,t,t,o=>{if(o)return r(o);n.stat(e,(a,l)=>{if(a)return r(a);let u=l.mtime.getTime()%1e3===0?"s":"ms";Object.defineProperty(n,aa,{value:u}),r(null,l.mtime,u)})})}function ef(e){let n=Date.now();return e==="s"&&(n=Math.ceil(n/1e3)*1e3),new Date(n)}oi.exports.probe=Zc;oi.exports.getMtime=ef});var da=W((mp,un)=>{"use strict";var nf=ae("path"),ui=ri(),rf=Zo(),tf=oa(),ua=la(),oe={};function ln(e,n){return n.lockfilePath||`${e}.lock`}function si(e,n,r){if(!n.realpath)return r(null,nf.resolve(e));n.fs.realpath(e,r)}function li(e,n,r){let i=ln(e,n);n.fs.mkdir(i,t=>{if(!t)return ua.probe(i,n.fs,(o,a,l)=>{if(o)return n.fs.rmdir(i,()=>{}),r(o);r(null,a,l)});if(t.code!=="EEXIST")return r(t);if(n.stale<=0)return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:e}));n.fs.stat(i,(o,a)=>{if(o)return o.code==="ENOENT"?li(e,{...n,stale:0},r):r(o);if(!sa(a,n))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:e}));ca(e,n,l=>{if(l)return r(l);li(e,{...n,stale:0},r)})})})}function sa(e,n){return e.mtime.getTime()<Date.now()-n.stale}function ca(e,n,r){n.fs.rmdir(ln(e,n),i=>{if(i&&i.code!=="ENOENT")return r(i);r()})}function Kn(e,n){let r=oe[e];r.updateTimeout||(r.updateDelay=r.updateDelay||n.update,r.updateTimeout=setTimeout(()=>{r.updateTimeout=null,n.fs.stat(r.lockfilePath,(i,t)=>{let o=r.lastUpdate+n.stale<Date.now();if(i)return i.code==="ENOENT"||o?ai(e,r,Object.assign(i,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Kn(e,n));if(!(r.mtime.getTime()===t.mtime.getTime()))return ai(e,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let l=ua.getMtime(r.mtimePrecision);n.fs.utimes(r.lockfilePath,l,l,u=>{let f=r.lastUpdate+n.stale<Date.now();if(!r.released){if(u)return u.code==="ENOENT"||f?ai(e,r,Object.assign(u,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Kn(e,n));r.mtime=l,r.lastUpdate=Date.now(),r.updateDelay=null,Kn(e,n)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function ai(e,n,r){n.released=!0,n.updateTimeout&&clearTimeout(n.updateTimeout),oe[e]===n&&delete oe[e],n.options.onCompromised(r)}function of(e,n,r){n={stale:1e4,update:null,realpath:!0,retries:0,fs:ui,onCompromised:i=>{throw i},...n},n.retries=n.retries||0,n.retries=typeof n.retries=="number"?{retries:n.retries}:n.retries,n.stale=Math.max(n.stale||0,2e3),n.update=n.update==null?n.stale/2:n.update||0,n.update=Math.max(Math.min(n.update,n.stale/2),1e3),si(e,n,(i,t)=>{if(i)return r(i);let o=rf.operation(n.retries);o.attempt(()=>{li(t,n,(a,l,u)=>{if(o.retry(a))return;if(a)return r(o.mainError());let f=oe[t]={lockfilePath:ln(t,n),mtime:l,mtimePrecision:u,options:n,lastUpdate:Date.now()};Kn(t,n),r(null,s=>{if(f.released)return s&&s(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));fa(t,{...n,realpath:!1},s)})})})})}function fa(e,n,r){n={fs:ui,realpath:!0,...n},si(e,n,(i,t)=>{if(i)return r(i);let o=oe[t];if(!o)return r(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));o.updateTimeout&&clearTimeout(o.updateTimeout),o.released=!0,delete oe[t],ca(t,n,r)})}function af(e,n,r){n={stale:1e4,realpath:!0,fs:ui,...n},n.stale=Math.max(n.stale||0,2e3),si(e,n,(i,t)=>{if(i)return r(i);n.fs.stat(ln(t,n),(o,a)=>o?o.code==="ENOENT"?r(null,!1):r(o):r(null,!sa(a,n)))})}function lf(){return oe}tf(()=>{for(let e in oe){let n=oe[e].options;try{n.fs.rmdirSync(ln(e,n))}catch{}}});un.exports.lock=of;un.exports.unlock=fa;un.exports.check=af;un.exports.getLocks=lf});var ma=W((hp,pa)=>{"use strict";var uf=ri();function sf(e){let n=["mkdir","realpath","stat","rmdir","utimes"],r={...e};return n.forEach(i=>{r[i]=(...t)=>{let o=t.pop(),a;try{a=e[`${i}Sync`](...t)}catch(l){return o(l)}o(null,a)}}),r}function cf(e){return(...n)=>new Promise((r,i)=>{n.push((t,o)=>{t?i(t):r(o)}),e(...n)})}function ff(e){return(...n)=>{let r,i;if(n.push((t,o)=>{r=t,i=o}),e(...n),r)throw r;return i}}function df(e){if(e={...e},e.fs=sf(e.fs||uf),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}pa.exports={toPromise:cf,toSync:ff,toSyncOptions:df}});var ya=W((yp,pe)=>{"use strict";var We=da(),{toPromise:Yn,toSync:Hn,toSyncOptions:ci}=ma();async function ha(e,n){let r=await Yn(We.lock)(e,n);return Yn(r)}function pf(e,n){let r=Hn(We.lock)(e,ci(n));return Hn(r)}function mf(e,n){return Yn(We.unlock)(e,n)}function hf(e,n){return Hn(We.unlock)(e,ci(n))}function yf(e,n){return Yn(We.check)(e,n)}function gf(e,n){return Hn(We.check)(e,ci(n))}pe.exports=ha;pe.exports.lock=ha;pe.exports.unlock=mf;pe.exports.lockSync=pf;pe.exports.unlockSync=hf;pe.exports.check=yf;pe.exports.checkSync=gf});import re from"node:fs";import G from"node:path";import _o from"node:os";import{spawnSync as Ks}from"node:child_process";import{fileURLToPath as Ys}from"node:url";function Ri(e){return typeof e>"u"||e===null}function Ia(e){return typeof e=="object"&&e!==null}function Oa(e){return Array.isArray(e)?e:Ri(e)?[]:[e]}function Ca(e,n){var r,i,t,o;if(n)for(o=Object.keys(n),r=0,i=o.length;r<i;r+=1)t=o[r],e[t]=n[t];return e}function La(e,n){var r="",i;for(i=0;i<n;i+=1)r+=e;return r}function ka(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var Ra=Ri,wa=Ia,Pa=Oa,Fa=La,Na=ka,Da=Ca,w={isNothing:Ra,isObject:wa,toArray:Pa,repeat:Fa,isNegativeZero:Na,extend:Da};function wi(e,n){var r="",i=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(r+='in "'+e.mark.name+'" '),r+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!n&&e.mark.snippet&&(r+=`
4
4
 
5
- `+e.mark.snippet),i+" "+r):i}function ze(e,n){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=n,this.message=ki(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}ze.prototype=Object.create(Error.prototype);ze.prototype.constructor=ze;ze.prototype.toString=function(n){return this.name+": "+ki(this,n)};var K=ze;function zn(e,n,r,i,t){var o="",a="",l=Math.floor(t/2)-1;return i-n>l&&(o=" ... ",n=i-l+o.length),r-i>l&&(a=" ...",r=i+l-a.length),{str:o+e.slice(n,r).replace(/\t/g,"\u2192")+a,pos:i-n+o.length}}function Qn(e,n){return w.repeat(" ",n-e.length)+e}function Na(e,n){if(n=Object.create(n||null),!e.buffer)return null;n.maxLength||(n.maxLength=79),typeof n.indent!="number"&&(n.indent=1),typeof n.linesBefore!="number"&&(n.linesBefore=3),typeof n.linesAfter!="number"&&(n.linesAfter=2);for(var r=/\r?\n|\r|\0/g,i=[0],t=[],o,a=-1;o=r.exec(e.buffer);)t.push(o.index),i.push(o.index+o[0].length),e.position<=o.index&&a<0&&(a=i.length-2);a<0&&(a=i.length-1);var l="",u,f,s=Math.min(e.line+n.linesAfter,t.length).toString().length,c=n.maxLength-(n.indent+s+3);for(u=1;u<=n.linesBefore&&!(a-u<0);u++)f=zn(e.buffer,i[a-u],t[a-u],e.position-(i[a]-i[a-u]),c),l=w.repeat(" ",n.indent)+Qn((e.line-u+1).toString(),s)+" | "+f.str+`
5
+ `+e.mark.snippet),i+" "+r):i}function ze(e,n){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=n,this.message=wi(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}ze.prototype=Object.create(Error.prototype);ze.prototype.constructor=ze;ze.prototype.toString=function(n){return this.name+": "+wi(this,n)};var K=ze;function zn(e,n,r,i,t){var o="",a="",l=Math.floor(t/2)-1;return i-n>l&&(o=" ... ",n=i-l+o.length),r-i>l&&(a=" ...",r=i+l-a.length),{str:o+e.slice(n,r).replace(/\t/g,"\u2192")+a,pos:i-n+o.length}}function Qn(e,n){return w.repeat(" ",n-e.length)+e}function Ua(e,n){if(n=Object.create(n||null),!e.buffer)return null;n.maxLength||(n.maxLength=79),typeof n.indent!="number"&&(n.indent=1),typeof n.linesBefore!="number"&&(n.linesBefore=3),typeof n.linesAfter!="number"&&(n.linesAfter=2);for(var r=/\r?\n|\r|\0/g,i=[0],t=[],o,a=-1;o=r.exec(e.buffer);)t.push(o.index),i.push(o.index+o[0].length),e.position<=o.index&&a<0&&(a=i.length-2);a<0&&(a=i.length-1);var l="",u,f,s=Math.min(e.line+n.linesAfter,t.length).toString().length,c=n.maxLength-(n.indent+s+3);for(u=1;u<=n.linesBefore&&!(a-u<0);u++)f=zn(e.buffer,i[a-u],t[a-u],e.position-(i[a]-i[a-u]),c),l=w.repeat(" ",n.indent)+Qn((e.line-u+1).toString(),s)+" | "+f.str+`
6
6
  `+l;for(f=zn(e.buffer,i[a],t[a],e.position,c),l+=w.repeat(" ",n.indent)+Qn((e.line+1).toString(),s)+" | "+f.str+`
7
7
  `,l+=w.repeat("-",n.indent+s+3+f.pos)+`^
8
8
  `,u=1;u<=n.linesAfter&&!(a+u>=t.length);u++)f=zn(e.buffer,i[a+u],t[a+u],e.position-(i[a]-i[a+u]),c),l+=w.repeat(" ",n.indent)+Qn((e.line+u+1).toString(),s)+" | "+f.str+`
9
- `;return l.replace(/\n$/,"")}var Da=Na,Ua=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Ba=["scalar","sequence","mapping"];function ja(e){var n={};return e!==null&&Object.keys(e).forEach(function(r){e[r].forEach(function(i){n[String(i)]=r})}),n}function $a(e,n){if(n=n||{},Object.keys(n).forEach(function(r){if(Ua.indexOf(r)===-1)throw new K('Unknown option "'+r+'" is met in definition of "'+e+'" YAML type.')}),this.options=n,this.tag=e,this.kind=n.kind||null,this.resolve=n.resolve||function(){return!0},this.construct=n.construct||function(r){return r},this.instanceOf=n.instanceOf||null,this.predicate=n.predicate||null,this.represent=n.represent||null,this.representName=n.representName||null,this.defaultStyle=n.defaultStyle||null,this.multi=n.multi||!1,this.styleAliases=ja(n.styleAliases||null),Ba.indexOf(this.kind)===-1)throw new K('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var j=$a;function hi(e,n){var r=[];return e[n].forEach(function(i){var t=r.length;r.forEach(function(o,a){o.tag===i.tag&&o.kind===i.kind&&o.multi===i.multi&&(t=a)}),r[t]=i}),r}function Va(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},n,r;function i(t){t.multi?(e.multi[t.kind].push(t),e.multi.fallback.push(t)):e[t.kind][t.tag]=e.fallback[t.tag]=t}for(n=0,r=arguments.length;n<r;n+=1)arguments[n].forEach(i);return e}function Zn(e){return this.extend(e)}Zn.prototype.extend=function(n){var r=[],i=[];if(n instanceof j)i.push(n);else if(Array.isArray(n))i=i.concat(n);else if(n&&(Array.isArray(n.implicit)||Array.isArray(n.explicit)))n.implicit&&(r=r.concat(n.implicit)),n.explicit&&(i=i.concat(n.explicit));else throw new K("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(o){if(!(o instanceof j))throw new K("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(o.loadKind&&o.loadKind!=="scalar")throw new K("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 K("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 j))throw new K("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var t=Object.create(Zn.prototype);return t.implicit=(this.implicit||[]).concat(r),t.explicit=(this.explicit||[]).concat(i),t.compiledImplicit=hi(t,"implicit"),t.compiledExplicit=hi(t,"explicit"),t.compiledTypeMap=Va(t.compiledImplicit,t.compiledExplicit),t};var Ri=Zn,wi=new j("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),Fi=new j("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),Pi=new j("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),Ni=new Ri({explicit:[wi,Fi,Pi]});function Ga(e){if(e===null)return!0;var n=e.length;return n===1&&e==="~"||n===4&&(e==="null"||e==="Null"||e==="NULL")}function Ka(){return null}function Ya(e){return e===null}var Di=new j("tag:yaml.org,2002:null",{kind:"scalar",resolve:Ga,construct:Ka,predicate:Ya,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function Ha(e){if(e===null)return!1;var n=e.length;return n===4&&(e==="true"||e==="True"||e==="TRUE")||n===5&&(e==="false"||e==="False"||e==="FALSE")}function Wa(e){return e==="true"||e==="True"||e==="TRUE"}function qa(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var Ui=new j("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Ha,construct:Wa,predicate:qa,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 Xa(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function za(e){return 48<=e&&e<=55}function Qa(e){return 48<=e&&e<=57}function Ja(e){if(e===null)return!1;var n=e.length,r=0,i=!1,t;if(!n)return!1;if(t=e[r],(t==="-"||t==="+")&&(t=e[++r]),t==="0"){if(r+1===n)return!0;if(t=e[++r],t==="b"){for(r++;r<n;r++)if(t=e[r],t!=="_"){if(t!=="0"&&t!=="1")return!1;i=!0}return i&&t!=="_"}if(t==="x"){for(r++;r<n;r++)if(t=e[r],t!=="_"){if(!Xa(e.charCodeAt(r)))return!1;i=!0}return i&&t!=="_"}if(t==="o"){for(r++;r<n;r++)if(t=e[r],t!=="_"){if(!za(e.charCodeAt(r)))return!1;i=!0}return i&&t!=="_"}}if(t==="_")return!1;for(;r<n;r++)if(t=e[r],t!=="_"){if(!Qa(e.charCodeAt(r)))return!1;i=!0}return!(!i||t==="_")}function Za(e){var n=e,r=1,i;if(n.indexOf("_")!==-1&&(n=n.replace(/_/g,"")),i=n[0],(i==="-"||i==="+")&&(i==="-"&&(r=-1),n=n.slice(1),i=n[0]),n==="0")return 0;if(i==="0"){if(n[1]==="b")return r*parseInt(n.slice(2),2);if(n[1]==="x")return r*parseInt(n.slice(2),16);if(n[1]==="o")return r*parseInt(n.slice(2),8)}return r*parseInt(n,10)}function el(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!w.isNegativeZero(e)}var Bi=new j("tag:yaml.org,2002:int",{kind:"scalar",resolve:Ja,construct:Za,predicate:el,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"]}}),nl=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function rl(e){return!(e===null||!nl.test(e)||e[e.length-1]==="_")}function il(e){var n,r;return n=e.replace(/_/g,"").toLowerCase(),r=n[0]==="-"?-1:1,"+-".indexOf(n[0])>=0&&(n=n.slice(1)),n===".inf"?r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:n===".nan"?NaN:r*parseFloat(n,10)}var tl=/^[-+]?[0-9]+e/;function ol(e,n){var r;if(isNaN(e))switch(n){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(n){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(n){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(w.isNegativeZero(e))return"-0.0";return r=e.toString(10),tl.test(r)?r.replace("e",".e"):r}function al(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||w.isNegativeZero(e))}var ji=new j("tag:yaml.org,2002:float",{kind:"scalar",resolve:rl,construct:il,predicate:al,represent:ol,defaultStyle:"lowercase"}),$i=Ni.extend({implicit:[Di,Ui,Bi,ji]}),Vi=$i,Gi=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Ki=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 ll(e){return e===null?!1:Gi.exec(e)!==null||Ki.exec(e)!==null}function ul(e){var n,r,i,t,o,a,l,u=0,f=null,s,c,d;if(n=Gi.exec(e),n===null&&(n=Ki.exec(e)),n===null)throw new Error("Date resolve error");if(r=+n[1],i=+n[2]-1,t=+n[3],!n[4])return new Date(Date.UTC(r,i,t));if(o=+n[4],a=+n[5],l=+n[6],n[7]){for(u=n[7].slice(0,3);u.length<3;)u+="0";u=+u}return n[9]&&(s=+n[10],c=+(n[11]||0),f=(s*60+c)*6e4,n[9]==="-"&&(f=-f)),d=new Date(Date.UTC(r,i,t,o,a,l,u)),f&&d.setTime(d.getTime()-f),d}function sl(e){return e.toISOString()}var Yi=new j("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:ll,construct:ul,instanceOf:Date,represent:sl});function cl(e){return e==="<<"||e===null}var Hi=new j("tag:yaml.org,2002:merge",{kind:"scalar",resolve:cl}),tr=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
10
- \r`;function fl(e){if(e===null)return!1;var n,r,i=0,t=e.length,o=tr;for(r=0;r<t;r++)if(n=o.indexOf(e.charAt(r)),!(n>64)){if(n<0)return!1;i+=6}return i%8===0}function dl(e){var n,r,i=e.replace(/[\r\n=]/g,""),t=i.length,o=tr,a=0,l=[];for(n=0;n<t;n++)n%4===0&&n&&(l.push(a>>16&255),l.push(a>>8&255),l.push(a&255)),a=a<<6|o.indexOf(i.charAt(n));return r=t%4*6,r===0?(l.push(a>>16&255),l.push(a>>8&255),l.push(a&255)):r===18?(l.push(a>>10&255),l.push(a>>2&255)):r===12&&l.push(a>>4&255),new Uint8Array(l)}function pl(e){var n="",r=0,i,t,o=e.length,a=tr;for(i=0;i<o;i++)i%3===0&&i&&(n+=a[r>>18&63],n+=a[r>>12&63],n+=a[r>>6&63],n+=a[r&63]),r=(r<<8)+e[i];return t=o%3,t===0?(n+=a[r>>18&63],n+=a[r>>12&63],n+=a[r>>6&63],n+=a[r&63]):t===2?(n+=a[r>>10&63],n+=a[r>>4&63],n+=a[r<<2&63],n+=a[64]):t===1&&(n+=a[r>>2&63],n+=a[r<<4&63],n+=a[64],n+=a[64]),n}function ml(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var Wi=new j("tag:yaml.org,2002:binary",{kind:"scalar",resolve:fl,construct:dl,predicate:ml,represent:pl}),hl=Object.prototype.hasOwnProperty,yl=Object.prototype.toString;function gl(e){if(e===null)return!0;var n=[],r,i,t,o,a,l=e;for(r=0,i=l.length;r<i;r+=1){if(t=l[r],a=!1,yl.call(t)!=="[object Object]")return!1;for(o in t)if(hl.call(t,o))if(!a)a=!0;else return!1;if(!a)return!1;if(n.indexOf(o)===-1)n.push(o);else return!1}return!0}function xl(e){return e!==null?e:[]}var qi=new j("tag:yaml.org,2002:omap",{kind:"sequence",resolve:gl,construct:xl}),_l=Object.prototype.toString;function bl(e){if(e===null)return!0;var n,r,i,t,o,a=e;for(o=new Array(a.length),n=0,r=a.length;n<r;n+=1){if(i=a[n],_l.call(i)!=="[object Object]"||(t=Object.keys(i),t.length!==1))return!1;o[n]=[t[0],i[t[0]]]}return!0}function vl(e){if(e===null)return[];var n,r,i,t,o,a=e;for(o=new Array(a.length),n=0,r=a.length;n<r;n+=1)i=a[n],t=Object.keys(i),o[n]=[t[0],i[t[0]]];return o}var Xi=new j("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:bl,construct:vl}),Al=Object.prototype.hasOwnProperty;function El(e){if(e===null)return!0;var n,r=e;for(n in r)if(Al.call(r,n)&&r[n]!==null)return!1;return!0}function Sl(e){return e!==null?e:{}}var zi=new j("tag:yaml.org,2002:set",{kind:"mapping",resolve:El,construct:Sl}),or=Vi.extend({implicit:[Yi,Hi],explicit:[Wi,qi,Xi,zi]}),ue=Object.prototype.hasOwnProperty,dn=1,Qi=2,Ji=3,pn=4,Jn=1,Ml=2,yi=3,Tl=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Il=/[\x85\u2028\u2029]/,Ol=/[,\[\]\{\}]/,Zi=/^(?:!|!!|![a-z\-]+!)$/i,et=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function gi(e){return Object.prototype.toString.call(e)}function Q(e){return e===10||e===13}function xe(e){return e===9||e===32}function H(e){return e===9||e===32||e===10||e===13}function Re(e){return e===44||e===91||e===93||e===123||e===125}function Cl(e){var n;return 48<=e&&e<=57?e-48:(n=e|32,97<=n&&n<=102?n-97+10:-1)}function Ll(e){return e===120?2:e===117?4:e===85?8:0}function kl(e){return 48<=e&&e<=57?e-48:-1}function xi(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
11
- `: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 Rl(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function nt(e,n,r){n==="__proto__"?Object.defineProperty(e,n,{configurable:!0,enumerable:!0,writable:!0,value:r}):e[n]=r}var rt=new Array(256),it=new Array(256);for(ge=0;ge<256;ge++)rt[ge]=xi(ge)?1:0,it[ge]=xi(ge);var ge;function wl(e,n){this.input=e,this.filename=n.filename||null,this.schema=n.schema||or,this.onWarning=n.onWarning||null,this.legacy=n.legacy||!1,this.json=n.json||!1,this.listener=n.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 tt(e,n){var r={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return r.snippet=Da(r),new K(n,r)}function g(e,n){throw tt(e,n)}function mn(e,n){e.onWarning&&e.onWarning.call(null,tt(e,n))}var _i={YAML:function(n,r,i){var t,o,a;n.version!==null&&g(n,"duplication of %YAML directive"),i.length!==1&&g(n,"YAML directive accepts exactly one argument"),t=/^([0-9]+)\.([0-9]+)$/.exec(i[0]),t===null&&g(n,"ill-formed argument of the YAML directive"),o=parseInt(t[1],10),a=parseInt(t[2],10),o!==1&&g(n,"unacceptable YAML version of the document"),n.version=i[0],n.checkLineBreaks=a<2,a!==1&&a!==2&&mn(n,"unsupported YAML version of the document")},TAG:function(n,r,i){var t,o;i.length!==2&&g(n,"TAG directive accepts exactly two arguments"),t=i[0],o=i[1],Zi.test(t)||g(n,"ill-formed tag handle (first argument) of the TAG directive"),ue.call(n.tagMap,t)&&g(n,'there is a previously declared suffix for "'+t+'" tag handle'),et.test(o)||g(n,"ill-formed tag prefix (second argument) of the TAG directive");try{o=decodeURIComponent(o)}catch{g(n,"tag prefix is malformed: "+o)}n.tagMap[t]=o}};function le(e,n,r,i){var t,o,a,l;if(n<r){if(l=e.input.slice(n,r),i)for(t=0,o=l.length;t<o;t+=1)a=l.charCodeAt(t),a===9||32<=a&&a<=1114111||g(e,"expected valid JSON character");else Tl.test(l)&&g(e,"the stream contains non-printable characters");e.result+=l}}function bi(e,n,r,i){var t,o,a,l;for(w.isObject(r)||g(e,"cannot merge mappings; the provided source object is unacceptable"),t=Object.keys(r),a=0,l=t.length;a<l;a+=1)o=t[a],ue.call(n,o)||(nt(n,o,r[o]),i[o]=!0)}function we(e,n,r,i,t,o,a,l,u){var f,s;if(Array.isArray(t))for(t=Array.prototype.slice.call(t),f=0,s=t.length;f<s;f+=1)Array.isArray(t[f])&&g(e,"nested arrays are not supported inside keys"),typeof t=="object"&&gi(t[f])==="[object Object]"&&(t[f]="[object Object]");if(typeof t=="object"&&gi(t)==="[object Object]"&&(t="[object Object]"),t=String(t),n===null&&(n={}),i==="tag:yaml.org,2002:merge")if(Array.isArray(o))for(f=0,s=o.length;f<s;f+=1)bi(e,n,o[f],r);else bi(e,n,o,r);else!e.json&&!ue.call(r,t)&&ue.call(n,t)&&(e.line=a||e.line,e.lineStart=l||e.lineStart,e.position=u||e.position,g(e,"duplicated mapping key")),nt(n,t,o),delete r[t];return n}function ar(e){var n;n=e.input.charCodeAt(e.position),n===10?e.position++:n===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):g(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function R(e,n,r){for(var i=0,t=e.input.charCodeAt(e.position);t!==0;){for(;xe(t);)t===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),t=e.input.charCodeAt(++e.position);if(n&&t===35)do t=e.input.charCodeAt(++e.position);while(t!==10&&t!==13&&t!==0);if(Q(t))for(ar(e),t=e.input.charCodeAt(e.position),i++,e.lineIndent=0;t===32;)e.lineIndent++,t=e.input.charCodeAt(++e.position);else break}return r!==-1&&i!==0&&e.lineIndent<r&&mn(e,"deficient indentation"),i}function gn(e){var n=e.position,r;return r=e.input.charCodeAt(n),!!((r===45||r===46)&&r===e.input.charCodeAt(n+1)&&r===e.input.charCodeAt(n+2)&&(n+=3,r=e.input.charCodeAt(n),r===0||H(r)))}function lr(e,n){n===1?e.result+=" ":n>1&&(e.result+=w.repeat(`
12
- `,n-1))}function Fl(e,n,r){var i,t,o,a,l,u,f,s,c=e.kind,d=e.result,p;if(p=e.input.charCodeAt(e.position),H(p)||Re(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)&&(t=e.input.charCodeAt(e.position+1),H(t)||r&&Re(t)))return!1;for(e.kind="scalar",e.result="",o=a=e.position,l=!1;p!==0;){if(p===58){if(t=e.input.charCodeAt(e.position+1),H(t)||r&&Re(t))break}else if(p===35){if(i=e.input.charCodeAt(e.position-1),H(i))break}else{if(e.position===e.lineStart&&gn(e)||r&&Re(p))break;if(Q(p))if(u=e.line,f=e.lineStart,s=e.lineIndent,R(e,!1,-1),e.lineIndent>=n){l=!0,p=e.input.charCodeAt(e.position);continue}else{e.position=a,e.line=u,e.lineStart=f,e.lineIndent=s;break}}l&&(le(e,o,a,!1),lr(e,e.line-u),o=a=e.position,l=!1),xe(p)||(a=e.position+1),p=e.input.charCodeAt(++e.position)}return le(e,o,a,!1),e.result?!0:(e.kind=c,e.result=d,!1)}function Pl(e,n){var r,i,t;if(r=e.input.charCodeAt(e.position),r!==39)return!1;for(e.kind="scalar",e.result="",e.position++,i=t=e.position;(r=e.input.charCodeAt(e.position))!==0;)if(r===39)if(le(e,i,e.position,!0),r=e.input.charCodeAt(++e.position),r===39)i=e.position,e.position++,t=e.position;else return!0;else Q(r)?(le(e,i,t,!0),lr(e,R(e,!1,n)),i=t=e.position):e.position===e.lineStart&&gn(e)?g(e,"unexpected end of the document within a single quoted scalar"):(e.position++,t=e.position);g(e,"unexpected end of the stream within a single quoted scalar")}function Nl(e,n){var r,i,t,o,a,l;if(l=e.input.charCodeAt(e.position),l!==34)return!1;for(e.kind="scalar",e.result="",e.position++,r=i=e.position;(l=e.input.charCodeAt(e.position))!==0;){if(l===34)return le(e,r,e.position,!0),e.position++,!0;if(l===92){if(le(e,r,e.position,!0),l=e.input.charCodeAt(++e.position),Q(l))R(e,!1,n);else if(l<256&&rt[l])e.result+=it[l],e.position++;else if((a=Ll(l))>0){for(t=a,o=0;t>0;t--)l=e.input.charCodeAt(++e.position),(a=Cl(l))>=0?o=(o<<4)+a:g(e,"expected hexadecimal character");e.result+=Rl(o),e.position++}else g(e,"unknown escape sequence");r=i=e.position}else Q(l)?(le(e,r,i,!0),lr(e,R(e,!1,n)),r=i=e.position):e.position===e.lineStart&&gn(e)?g(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}g(e,"unexpected end of the stream within a double quoted scalar")}function Dl(e,n){var r=!0,i,t,o,a=e.tag,l,u=e.anchor,f,s,c,d,p,m=Object.create(null),h,y,_,x;if(x=e.input.charCodeAt(e.position),x===91)s=93,p=!1,l=[];else if(x===123)s=125,p=!0,l={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=l),x=e.input.charCodeAt(++e.position);x!==0;){if(R(e,!0,n),x=e.input.charCodeAt(e.position),x===s)return e.position++,e.tag=a,e.anchor=u,e.kind=p?"mapping":"sequence",e.result=l,!0;r?x===44&&g(e,"expected the node content, but found ','"):g(e,"missed comma between flow collection entries"),y=h=_=null,c=d=!1,x===63&&(f=e.input.charCodeAt(e.position+1),H(f)&&(c=d=!0,e.position++,R(e,!0,n))),i=e.line,t=e.lineStart,o=e.position,Fe(e,n,dn,!1,!0),y=e.tag,h=e.result,R(e,!0,n),x=e.input.charCodeAt(e.position),(d||e.line===i)&&x===58&&(c=!0,x=e.input.charCodeAt(++e.position),R(e,!0,n),Fe(e,n,dn,!1,!0),_=e.result),p?we(e,l,m,y,h,_,i,t,o):c?l.push(we(e,null,m,y,h,_,i,t,o)):l.push(h),R(e,!0,n),x=e.input.charCodeAt(e.position),x===44?(r=!0,x=e.input.charCodeAt(++e.position)):r=!1}g(e,"unexpected end of the stream within a flow collection")}function Ul(e,n){var r,i,t=Jn,o=!1,a=!1,l=n,u=0,f=!1,s,c;if(c=e.input.charCodeAt(e.position),c===124)i=!1;else if(c===62)i=!0;else return!1;for(e.kind="scalar",e.result="";c!==0;)if(c=e.input.charCodeAt(++e.position),c===43||c===45)Jn===t?t=c===43?yi:Ml:g(e,"repeat of a chomping mode identifier");else if((s=kl(c))>=0)s===0?g(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):a?g(e,"repeat of an indentation width identifier"):(l=n+s-1,a=!0);else break;if(xe(c)){do c=e.input.charCodeAt(++e.position);while(xe(c));if(c===35)do c=e.input.charCodeAt(++e.position);while(!Q(c)&&c!==0)}for(;c!==0;){for(ar(e),e.lineIndent=0,c=e.input.charCodeAt(e.position);(!a||e.lineIndent<l)&&c===32;)e.lineIndent++,c=e.input.charCodeAt(++e.position);if(!a&&e.lineIndent>l&&(l=e.lineIndent),Q(c)){u++;continue}if(e.lineIndent<l){t===yi?e.result+=w.repeat(`
9
+ `;return l.replace(/\n$/,"")}var Ba=Ua,ja=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],$a=["scalar","sequence","mapping"];function Va(e){var n={};return e!==null&&Object.keys(e).forEach(function(r){e[r].forEach(function(i){n[String(i)]=r})}),n}function Ga(e,n){if(n=n||{},Object.keys(n).forEach(function(r){if(ja.indexOf(r)===-1)throw new K('Unknown option "'+r+'" is met in definition of "'+e+'" YAML type.')}),this.options=n,this.tag=e,this.kind=n.kind||null,this.resolve=n.resolve||function(){return!0},this.construct=n.construct||function(r){return r},this.instanceOf=n.instanceOf||null,this.predicate=n.predicate||null,this.represent=n.represent||null,this.representName=n.representName||null,this.defaultStyle=n.defaultStyle||null,this.multi=n.multi||!1,this.styleAliases=Va(n.styleAliases||null),$a.indexOf(this.kind)===-1)throw new K('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var j=Ga;function gi(e,n){var r=[];return e[n].forEach(function(i){var t=r.length;r.forEach(function(o,a){o.tag===i.tag&&o.kind===i.kind&&o.multi===i.multi&&(t=a)}),r[t]=i}),r}function Ka(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},n,r;function i(t){t.multi?(e.multi[t.kind].push(t),e.multi.fallback.push(t)):e[t.kind][t.tag]=e.fallback[t.tag]=t}for(n=0,r=arguments.length;n<r;n+=1)arguments[n].forEach(i);return e}function Zn(e){return this.extend(e)}Zn.prototype.extend=function(n){var r=[],i=[];if(n instanceof j)i.push(n);else if(Array.isArray(n))i=i.concat(n);else if(n&&(Array.isArray(n.implicit)||Array.isArray(n.explicit)))n.implicit&&(r=r.concat(n.implicit)),n.explicit&&(i=i.concat(n.explicit));else throw new K("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(o){if(!(o instanceof j))throw new K("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(o.loadKind&&o.loadKind!=="scalar")throw new K("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 K("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 j))throw new K("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var t=Object.create(Zn.prototype);return t.implicit=(this.implicit||[]).concat(r),t.explicit=(this.explicit||[]).concat(i),t.compiledImplicit=gi(t,"implicit"),t.compiledExplicit=gi(t,"explicit"),t.compiledTypeMap=Ka(t.compiledImplicit,t.compiledExplicit),t};var Pi=Zn,Fi=new j("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),Ni=new j("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),Di=new j("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),Ui=new Pi({explicit:[Fi,Ni,Di]});function Ya(e){if(e===null)return!0;var n=e.length;return n===1&&e==="~"||n===4&&(e==="null"||e==="Null"||e==="NULL")}function Ha(){return null}function Wa(e){return e===null}var Bi=new j("tag:yaml.org,2002:null",{kind:"scalar",resolve:Ya,construct:Ha,predicate:Wa,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function qa(e){if(e===null)return!1;var n=e.length;return n===4&&(e==="true"||e==="True"||e==="TRUE")||n===5&&(e==="false"||e==="False"||e==="FALSE")}function Xa(e){return e==="true"||e==="True"||e==="TRUE"}function za(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var ji=new j("tag:yaml.org,2002:bool",{kind:"scalar",resolve:qa,construct:Xa,predicate:za,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 Qa(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function Ja(e){return 48<=e&&e<=55}function Za(e){return 48<=e&&e<=57}function el(e){if(e===null)return!1;var n=e.length,r=0,i=!1,t;if(!n)return!1;if(t=e[r],(t==="-"||t==="+")&&(t=e[++r]),t==="0"){if(r+1===n)return!0;if(t=e[++r],t==="b"){for(r++;r<n;r++)if(t=e[r],t!=="_"){if(t!=="0"&&t!=="1")return!1;i=!0}return i&&t!=="_"}if(t==="x"){for(r++;r<n;r++)if(t=e[r],t!=="_"){if(!Qa(e.charCodeAt(r)))return!1;i=!0}return i&&t!=="_"}if(t==="o"){for(r++;r<n;r++)if(t=e[r],t!=="_"){if(!Ja(e.charCodeAt(r)))return!1;i=!0}return i&&t!=="_"}}if(t==="_")return!1;for(;r<n;r++)if(t=e[r],t!=="_"){if(!Za(e.charCodeAt(r)))return!1;i=!0}return!(!i||t==="_")}function nl(e){var n=e,r=1,i;if(n.indexOf("_")!==-1&&(n=n.replace(/_/g,"")),i=n[0],(i==="-"||i==="+")&&(i==="-"&&(r=-1),n=n.slice(1),i=n[0]),n==="0")return 0;if(i==="0"){if(n[1]==="b")return r*parseInt(n.slice(2),2);if(n[1]==="x")return r*parseInt(n.slice(2),16);if(n[1]==="o")return r*parseInt(n.slice(2),8)}return r*parseInt(n,10)}function rl(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!w.isNegativeZero(e)}var $i=new j("tag:yaml.org,2002:int",{kind:"scalar",resolve:el,construct:nl,predicate:rl,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"]}}),il=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function tl(e){return!(e===null||!il.test(e)||e[e.length-1]==="_")}function ol(e){var n,r;return n=e.replace(/_/g,"").toLowerCase(),r=n[0]==="-"?-1:1,"+-".indexOf(n[0])>=0&&(n=n.slice(1)),n===".inf"?r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:n===".nan"?NaN:r*parseFloat(n,10)}var al=/^[-+]?[0-9]+e/;function ll(e,n){var r;if(isNaN(e))switch(n){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(n){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(n){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(w.isNegativeZero(e))return"-0.0";return r=e.toString(10),al.test(r)?r.replace("e",".e"):r}function ul(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||w.isNegativeZero(e))}var Vi=new j("tag:yaml.org,2002:float",{kind:"scalar",resolve:tl,construct:ol,predicate:ul,represent:ll,defaultStyle:"lowercase"}),Gi=Ui.extend({implicit:[Bi,ji,$i,Vi]}),Ki=Gi,Yi=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Hi=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 sl(e){return e===null?!1:Yi.exec(e)!==null||Hi.exec(e)!==null}function cl(e){var n,r,i,t,o,a,l,u=0,f=null,s,c,d;if(n=Yi.exec(e),n===null&&(n=Hi.exec(e)),n===null)throw new Error("Date resolve error");if(r=+n[1],i=+n[2]-1,t=+n[3],!n[4])return new Date(Date.UTC(r,i,t));if(o=+n[4],a=+n[5],l=+n[6],n[7]){for(u=n[7].slice(0,3);u.length<3;)u+="0";u=+u}return n[9]&&(s=+n[10],c=+(n[11]||0),f=(s*60+c)*6e4,n[9]==="-"&&(f=-f)),d=new Date(Date.UTC(r,i,t,o,a,l,u)),f&&d.setTime(d.getTime()-f),d}function fl(e){return e.toISOString()}var Wi=new j("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:sl,construct:cl,instanceOf:Date,represent:fl});function dl(e){return e==="<<"||e===null}var qi=new j("tag:yaml.org,2002:merge",{kind:"scalar",resolve:dl}),tr=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
10
+ \r`;function pl(e){if(e===null)return!1;var n,r,i=0,t=e.length,o=tr;for(r=0;r<t;r++)if(n=o.indexOf(e.charAt(r)),!(n>64)){if(n<0)return!1;i+=6}return i%8===0}function ml(e){var n,r,i=e.replace(/[\r\n=]/g,""),t=i.length,o=tr,a=0,l=[];for(n=0;n<t;n++)n%4===0&&n&&(l.push(a>>16&255),l.push(a>>8&255),l.push(a&255)),a=a<<6|o.indexOf(i.charAt(n));return r=t%4*6,r===0?(l.push(a>>16&255),l.push(a>>8&255),l.push(a&255)):r===18?(l.push(a>>10&255),l.push(a>>2&255)):r===12&&l.push(a>>4&255),new Uint8Array(l)}function hl(e){var n="",r=0,i,t,o=e.length,a=tr;for(i=0;i<o;i++)i%3===0&&i&&(n+=a[r>>18&63],n+=a[r>>12&63],n+=a[r>>6&63],n+=a[r&63]),r=(r<<8)+e[i];return t=o%3,t===0?(n+=a[r>>18&63],n+=a[r>>12&63],n+=a[r>>6&63],n+=a[r&63]):t===2?(n+=a[r>>10&63],n+=a[r>>4&63],n+=a[r<<2&63],n+=a[64]):t===1&&(n+=a[r>>2&63],n+=a[r<<4&63],n+=a[64],n+=a[64]),n}function yl(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var Xi=new j("tag:yaml.org,2002:binary",{kind:"scalar",resolve:pl,construct:ml,predicate:yl,represent:hl}),gl=Object.prototype.hasOwnProperty,xl=Object.prototype.toString;function _l(e){if(e===null)return!0;var n=[],r,i,t,o,a,l=e;for(r=0,i=l.length;r<i;r+=1){if(t=l[r],a=!1,xl.call(t)!=="[object Object]")return!1;for(o in t)if(gl.call(t,o))if(!a)a=!0;else return!1;if(!a)return!1;if(n.indexOf(o)===-1)n.push(o);else return!1}return!0}function bl(e){return e!==null?e:[]}var zi=new j("tag:yaml.org,2002:omap",{kind:"sequence",resolve:_l,construct:bl}),vl=Object.prototype.toString;function Al(e){if(e===null)return!0;var n,r,i,t,o,a=e;for(o=new Array(a.length),n=0,r=a.length;n<r;n+=1){if(i=a[n],vl.call(i)!=="[object Object]"||(t=Object.keys(i),t.length!==1))return!1;o[n]=[t[0],i[t[0]]]}return!0}function El(e){if(e===null)return[];var n,r,i,t,o,a=e;for(o=new Array(a.length),n=0,r=a.length;n<r;n+=1)i=a[n],t=Object.keys(i),o[n]=[t[0],i[t[0]]];return o}var Qi=new j("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:Al,construct:El}),Sl=Object.prototype.hasOwnProperty;function Ml(e){if(e===null)return!0;var n,r=e;for(n in r)if(Sl.call(r,n)&&r[n]!==null)return!1;return!0}function Tl(e){return e!==null?e:{}}var Ji=new j("tag:yaml.org,2002:set",{kind:"mapping",resolve:Ml,construct:Tl}),or=Ki.extend({implicit:[Wi,qi],explicit:[Xi,zi,Qi,Ji]}),ue=Object.prototype.hasOwnProperty,dn=1,Zi=2,et=3,pn=4,Jn=1,Il=2,xi=3,Ol=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Cl=/[\x85\u2028\u2029]/,Ll=/[,\[\]\{\}]/,nt=/^(?:!|!!|![a-z\-]+!)$/i,rt=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function _i(e){return Object.prototype.toString.call(e)}function Q(e){return e===10||e===13}function xe(e){return e===9||e===32}function H(e){return e===9||e===32||e===10||e===13}function Re(e){return e===44||e===91||e===93||e===123||e===125}function kl(e){var n;return 48<=e&&e<=57?e-48:(n=e|32,97<=n&&n<=102?n-97+10:-1)}function Rl(e){return e===120?2:e===117?4:e===85?8:0}function wl(e){return 48<=e&&e<=57?e-48:-1}function bi(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
11
+ `: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 Pl(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function it(e,n,r){n==="__proto__"?Object.defineProperty(e,n,{configurable:!0,enumerable:!0,writable:!0,value:r}):e[n]=r}var tt=new Array(256),ot=new Array(256);for(ge=0;ge<256;ge++)tt[ge]=bi(ge)?1:0,ot[ge]=bi(ge);var ge;function Fl(e,n){this.input=e,this.filename=n.filename||null,this.schema=n.schema||or,this.onWarning=n.onWarning||null,this.legacy=n.legacy||!1,this.json=n.json||!1,this.listener=n.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 at(e,n){var r={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return r.snippet=Ba(r),new K(n,r)}function g(e,n){throw at(e,n)}function mn(e,n){e.onWarning&&e.onWarning.call(null,at(e,n))}var vi={YAML:function(n,r,i){var t,o,a;n.version!==null&&g(n,"duplication of %YAML directive"),i.length!==1&&g(n,"YAML directive accepts exactly one argument"),t=/^([0-9]+)\.([0-9]+)$/.exec(i[0]),t===null&&g(n,"ill-formed argument of the YAML directive"),o=parseInt(t[1],10),a=parseInt(t[2],10),o!==1&&g(n,"unacceptable YAML version of the document"),n.version=i[0],n.checkLineBreaks=a<2,a!==1&&a!==2&&mn(n,"unsupported YAML version of the document")},TAG:function(n,r,i){var t,o;i.length!==2&&g(n,"TAG directive accepts exactly two arguments"),t=i[0],o=i[1],nt.test(t)||g(n,"ill-formed tag handle (first argument) of the TAG directive"),ue.call(n.tagMap,t)&&g(n,'there is a previously declared suffix for "'+t+'" tag handle'),rt.test(o)||g(n,"ill-formed tag prefix (second argument) of the TAG directive");try{o=decodeURIComponent(o)}catch{g(n,"tag prefix is malformed: "+o)}n.tagMap[t]=o}};function le(e,n,r,i){var t,o,a,l;if(n<r){if(l=e.input.slice(n,r),i)for(t=0,o=l.length;t<o;t+=1)a=l.charCodeAt(t),a===9||32<=a&&a<=1114111||g(e,"expected valid JSON character");else Ol.test(l)&&g(e,"the stream contains non-printable characters");e.result+=l}}function Ai(e,n,r,i){var t,o,a,l;for(w.isObject(r)||g(e,"cannot merge mappings; the provided source object is unacceptable"),t=Object.keys(r),a=0,l=t.length;a<l;a+=1)o=t[a],ue.call(n,o)||(it(n,o,r[o]),i[o]=!0)}function we(e,n,r,i,t,o,a,l,u){var f,s;if(Array.isArray(t))for(t=Array.prototype.slice.call(t),f=0,s=t.length;f<s;f+=1)Array.isArray(t[f])&&g(e,"nested arrays are not supported inside keys"),typeof t=="object"&&_i(t[f])==="[object Object]"&&(t[f]="[object Object]");if(typeof t=="object"&&_i(t)==="[object Object]"&&(t="[object Object]"),t=String(t),n===null&&(n={}),i==="tag:yaml.org,2002:merge")if(Array.isArray(o))for(f=0,s=o.length;f<s;f+=1)Ai(e,n,o[f],r);else Ai(e,n,o,r);else!e.json&&!ue.call(r,t)&&ue.call(n,t)&&(e.line=a||e.line,e.lineStart=l||e.lineStart,e.position=u||e.position,g(e,"duplicated mapping key")),it(n,t,o),delete r[t];return n}function ar(e){var n;n=e.input.charCodeAt(e.position),n===10?e.position++:n===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):g(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function R(e,n,r){for(var i=0,t=e.input.charCodeAt(e.position);t!==0;){for(;xe(t);)t===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),t=e.input.charCodeAt(++e.position);if(n&&t===35)do t=e.input.charCodeAt(++e.position);while(t!==10&&t!==13&&t!==0);if(Q(t))for(ar(e),t=e.input.charCodeAt(e.position),i++,e.lineIndent=0;t===32;)e.lineIndent++,t=e.input.charCodeAt(++e.position);else break}return r!==-1&&i!==0&&e.lineIndent<r&&mn(e,"deficient indentation"),i}function gn(e){var n=e.position,r;return r=e.input.charCodeAt(n),!!((r===45||r===46)&&r===e.input.charCodeAt(n+1)&&r===e.input.charCodeAt(n+2)&&(n+=3,r=e.input.charCodeAt(n),r===0||H(r)))}function lr(e,n){n===1?e.result+=" ":n>1&&(e.result+=w.repeat(`
12
+ `,n-1))}function Nl(e,n,r){var i,t,o,a,l,u,f,s,c=e.kind,d=e.result,p;if(p=e.input.charCodeAt(e.position),H(p)||Re(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)&&(t=e.input.charCodeAt(e.position+1),H(t)||r&&Re(t)))return!1;for(e.kind="scalar",e.result="",o=a=e.position,l=!1;p!==0;){if(p===58){if(t=e.input.charCodeAt(e.position+1),H(t)||r&&Re(t))break}else if(p===35){if(i=e.input.charCodeAt(e.position-1),H(i))break}else{if(e.position===e.lineStart&&gn(e)||r&&Re(p))break;if(Q(p))if(u=e.line,f=e.lineStart,s=e.lineIndent,R(e,!1,-1),e.lineIndent>=n){l=!0,p=e.input.charCodeAt(e.position);continue}else{e.position=a,e.line=u,e.lineStart=f,e.lineIndent=s;break}}l&&(le(e,o,a,!1),lr(e,e.line-u),o=a=e.position,l=!1),xe(p)||(a=e.position+1),p=e.input.charCodeAt(++e.position)}return le(e,o,a,!1),e.result?!0:(e.kind=c,e.result=d,!1)}function Dl(e,n){var r,i,t;if(r=e.input.charCodeAt(e.position),r!==39)return!1;for(e.kind="scalar",e.result="",e.position++,i=t=e.position;(r=e.input.charCodeAt(e.position))!==0;)if(r===39)if(le(e,i,e.position,!0),r=e.input.charCodeAt(++e.position),r===39)i=e.position,e.position++,t=e.position;else return!0;else Q(r)?(le(e,i,t,!0),lr(e,R(e,!1,n)),i=t=e.position):e.position===e.lineStart&&gn(e)?g(e,"unexpected end of the document within a single quoted scalar"):(e.position++,t=e.position);g(e,"unexpected end of the stream within a single quoted scalar")}function Ul(e,n){var r,i,t,o,a,l;if(l=e.input.charCodeAt(e.position),l!==34)return!1;for(e.kind="scalar",e.result="",e.position++,r=i=e.position;(l=e.input.charCodeAt(e.position))!==0;){if(l===34)return le(e,r,e.position,!0),e.position++,!0;if(l===92){if(le(e,r,e.position,!0),l=e.input.charCodeAt(++e.position),Q(l))R(e,!1,n);else if(l<256&&tt[l])e.result+=ot[l],e.position++;else if((a=Rl(l))>0){for(t=a,o=0;t>0;t--)l=e.input.charCodeAt(++e.position),(a=kl(l))>=0?o=(o<<4)+a:g(e,"expected hexadecimal character");e.result+=Pl(o),e.position++}else g(e,"unknown escape sequence");r=i=e.position}else Q(l)?(le(e,r,i,!0),lr(e,R(e,!1,n)),r=i=e.position):e.position===e.lineStart&&gn(e)?g(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}g(e,"unexpected end of the stream within a double quoted scalar")}function Bl(e,n){var r=!0,i,t,o,a=e.tag,l,u=e.anchor,f,s,c,d,p,m=Object.create(null),h,y,_,x;if(x=e.input.charCodeAt(e.position),x===91)s=93,p=!1,l=[];else if(x===123)s=125,p=!0,l={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=l),x=e.input.charCodeAt(++e.position);x!==0;){if(R(e,!0,n),x=e.input.charCodeAt(e.position),x===s)return e.position++,e.tag=a,e.anchor=u,e.kind=p?"mapping":"sequence",e.result=l,!0;r?x===44&&g(e,"expected the node content, but found ','"):g(e,"missed comma between flow collection entries"),y=h=_=null,c=d=!1,x===63&&(f=e.input.charCodeAt(e.position+1),H(f)&&(c=d=!0,e.position++,R(e,!0,n))),i=e.line,t=e.lineStart,o=e.position,Pe(e,n,dn,!1,!0),y=e.tag,h=e.result,R(e,!0,n),x=e.input.charCodeAt(e.position),(d||e.line===i)&&x===58&&(c=!0,x=e.input.charCodeAt(++e.position),R(e,!0,n),Pe(e,n,dn,!1,!0),_=e.result),p?we(e,l,m,y,h,_,i,t,o):c?l.push(we(e,null,m,y,h,_,i,t,o)):l.push(h),R(e,!0,n),x=e.input.charCodeAt(e.position),x===44?(r=!0,x=e.input.charCodeAt(++e.position)):r=!1}g(e,"unexpected end of the stream within a flow collection")}function jl(e,n){var r,i,t=Jn,o=!1,a=!1,l=n,u=0,f=!1,s,c;if(c=e.input.charCodeAt(e.position),c===124)i=!1;else if(c===62)i=!0;else return!1;for(e.kind="scalar",e.result="";c!==0;)if(c=e.input.charCodeAt(++e.position),c===43||c===45)Jn===t?t=c===43?xi:Il:g(e,"repeat of a chomping mode identifier");else if((s=wl(c))>=0)s===0?g(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):a?g(e,"repeat of an indentation width identifier"):(l=n+s-1,a=!0);else break;if(xe(c)){do c=e.input.charCodeAt(++e.position);while(xe(c));if(c===35)do c=e.input.charCodeAt(++e.position);while(!Q(c)&&c!==0)}for(;c!==0;){for(ar(e),e.lineIndent=0,c=e.input.charCodeAt(e.position);(!a||e.lineIndent<l)&&c===32;)e.lineIndent++,c=e.input.charCodeAt(++e.position);if(!a&&e.lineIndent>l&&(l=e.lineIndent),Q(c)){u++;continue}if(e.lineIndent<l){t===xi?e.result+=w.repeat(`
13
13
  `,o?1+u:u):t===Jn&&o&&(e.result+=`
14
14
  `);break}for(i?xe(c)?(f=!0,e.result+=w.repeat(`
15
15
  `,o?1+u:u)):f?(f=!1,e.result+=w.repeat(`
16
16
  `,u+1)):u===0?o&&(e.result+=" "):e.result+=w.repeat(`
17
17
  `,u):e.result+=w.repeat(`
18
- `,o?1+u:u),o=!0,a=!0,u=0,r=e.position;!Q(c)&&c!==0;)c=e.input.charCodeAt(++e.position);le(e,r,e.position,!1)}return!0}function vi(e,n){var r,i=e.tag,t=e.anchor,o=[],a,l=!1,u;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=o),u=e.input.charCodeAt(e.position);u!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,g(e,"tab characters must not be used in indentation")),!(u!==45||(a=e.input.charCodeAt(e.position+1),!H(a))));){if(l=!0,e.position++,R(e,!0,-1)&&e.lineIndent<=n){o.push(null),u=e.input.charCodeAt(e.position);continue}if(r=e.line,Fe(e,n,Ji,!1,!0),o.push(e.result),R(e,!0,-1),u=e.input.charCodeAt(e.position),(e.line===r||e.lineIndent>n)&&u!==0)g(e,"bad indentation of a sequence entry");else if(e.lineIndent<n)break}return l?(e.tag=i,e.anchor=t,e.kind="sequence",e.result=o,!0):!1}function Bl(e,n,r){var i,t,o,a,l,u,f=e.tag,s=e.anchor,c={},d=Object.create(null),p=null,m=null,h=null,y=!1,_=!1,x;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=c),x=e.input.charCodeAt(e.position);x!==0;){if(!y&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,g(e,"tab characters must not be used in indentation")),i=e.input.charCodeAt(e.position+1),o=e.line,(x===63||x===58)&&H(i))x===63?(y&&(we(e,c,d,p,m,null,a,l,u),p=m=h=null),_=!0,y=!0,t=!0):y?(y=!1,t=!0):g(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,x=i;else{if(a=e.line,l=e.lineStart,u=e.position,!Fe(e,r,Qi,!1,!0))break;if(e.line===o){for(x=e.input.charCodeAt(e.position);xe(x);)x=e.input.charCodeAt(++e.position);if(x===58)x=e.input.charCodeAt(++e.position),H(x)||g(e,"a whitespace character is expected after the key-value separator within a block mapping"),y&&(we(e,c,d,p,m,null,a,l,u),p=m=h=null),_=!0,y=!1,t=!1,p=e.tag,m=e.result;else if(_)g(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=f,e.anchor=s,!0}else if(_)g(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=f,e.anchor=s,!0}if((e.line===o||e.lineIndent>n)&&(y&&(a=e.line,l=e.lineStart,u=e.position),Fe(e,n,pn,!0,t)&&(y?m=e.result:h=e.result),y||(we(e,c,d,p,m,h,a,l,u),p=m=h=null),R(e,!0,-1),x=e.input.charCodeAt(e.position)),(e.line===o||e.lineIndent>n)&&x!==0)g(e,"bad indentation of a mapping entry");else if(e.lineIndent<n)break}return y&&we(e,c,d,p,m,null,a,l,u),_&&(e.tag=f,e.anchor=s,e.kind="mapping",e.result=c),_}function jl(e){var n,r=!1,i=!1,t,o,a;if(a=e.input.charCodeAt(e.position),a!==33)return!1;if(e.tag!==null&&g(e,"duplication of a tag property"),a=e.input.charCodeAt(++e.position),a===60?(r=!0,a=e.input.charCodeAt(++e.position)):a===33?(i=!0,t="!!",a=e.input.charCodeAt(++e.position)):t="!",n=e.position,r){do a=e.input.charCodeAt(++e.position);while(a!==0&&a!==62);e.position<e.length?(o=e.input.slice(n,e.position),a=e.input.charCodeAt(++e.position)):g(e,"unexpected end of the stream within a verbatim tag")}else{for(;a!==0&&!H(a);)a===33&&(i?g(e,"tag suffix cannot contain exclamation marks"):(t=e.input.slice(n-1,e.position+1),Zi.test(t)||g(e,"named tag handle cannot contain such characters"),i=!0,n=e.position+1)),a=e.input.charCodeAt(++e.position);o=e.input.slice(n,e.position),Ol.test(o)&&g(e,"tag suffix cannot contain flow indicator characters")}o&&!et.test(o)&&g(e,"tag name cannot contain such characters: "+o);try{o=decodeURIComponent(o)}catch{g(e,"tag name is malformed: "+o)}return r?e.tag=o:ue.call(e.tagMap,t)?e.tag=e.tagMap[t]+o:t==="!"?e.tag="!"+o:t==="!!"?e.tag="tag:yaml.org,2002:"+o:g(e,'undeclared tag handle "'+t+'"'),!0}function $l(e){var n,r;if(r=e.input.charCodeAt(e.position),r!==38)return!1;for(e.anchor!==null&&g(e,"duplication of an anchor property"),r=e.input.charCodeAt(++e.position),n=e.position;r!==0&&!H(r)&&!Re(r);)r=e.input.charCodeAt(++e.position);return e.position===n&&g(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(n,e.position),!0}function Vl(e){var n,r,i;if(i=e.input.charCodeAt(e.position),i!==42)return!1;for(i=e.input.charCodeAt(++e.position),n=e.position;i!==0&&!H(i)&&!Re(i);)i=e.input.charCodeAt(++e.position);return e.position===n&&g(e,"name of an alias node must contain at least one character"),r=e.input.slice(n,e.position),ue.call(e.anchorMap,r)||g(e,'unidentified alias "'+r+'"'),e.result=e.anchorMap[r],R(e,!0,-1),!0}function Fe(e,n,r,i,t){var o,a,l,u=1,f=!1,s=!1,c,d,p,m,h,y;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,o=a=l=pn===r||Ji===r,i&&R(e,!0,-1)&&(f=!0,e.lineIndent>n?u=1:e.lineIndent===n?u=0:e.lineIndent<n&&(u=-1)),u===1)for(;jl(e)||$l(e);)R(e,!0,-1)?(f=!0,l=o,e.lineIndent>n?u=1:e.lineIndent===n?u=0:e.lineIndent<n&&(u=-1)):l=!1;if(l&&(l=f||t),(u===1||pn===r)&&(dn===r||Qi===r?h=n:h=n+1,y=e.position-e.lineStart,u===1?l&&(vi(e,y)||Bl(e,y,h))||Dl(e,h)?s=!0:(a&&Ul(e,h)||Pl(e,h)||Nl(e,h)?s=!0:Vl(e)?(s=!0,(e.tag!==null||e.anchor!==null)&&g(e,"alias node should not have any properties")):Fl(e,h,dn===r)&&(s=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):u===0&&(s=l&&vi(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"&&g(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),c=0,d=e.implicitTypes.length;c<d;c+=1)if(m=e.implicitTypes[c],m.resolve(e.result)){e.result=m.construct(e.result),e.tag=m.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(ue.call(e.typeMap[e.kind||"fallback"],e.tag))m=e.typeMap[e.kind||"fallback"][e.tag];else for(m=null,p=e.typeMap.multi[e.kind||"fallback"],c=0,d=p.length;c<d;c+=1)if(e.tag.slice(0,p[c].tag.length)===p[c].tag){m=p[c];break}m||g(e,"unknown tag !<"+e.tag+">"),e.result!==null&&m.kind!==e.kind&&g(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+m.kind+'", not "'+e.kind+'"'),m.resolve(e.result,e.tag)?(e.result=m.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):g(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||s}function Gl(e){var n=e.position,r,i,t,o=!1,a;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(a=e.input.charCodeAt(e.position))!==0&&(R(e,!0,-1),a=e.input.charCodeAt(e.position),!(e.lineIndent>0||a!==37));){for(o=!0,a=e.input.charCodeAt(++e.position),r=e.position;a!==0&&!H(a);)a=e.input.charCodeAt(++e.position);for(i=e.input.slice(r,e.position),t=[],i.length<1&&g(e,"directive name must not be less than one character in length");a!==0;){for(;xe(a);)a=e.input.charCodeAt(++e.position);if(a===35){do a=e.input.charCodeAt(++e.position);while(a!==0&&!Q(a));break}if(Q(a))break;for(r=e.position;a!==0&&!H(a);)a=e.input.charCodeAt(++e.position);t.push(e.input.slice(r,e.position))}a!==0&&ar(e),ue.call(_i,i)?_i[i](e,i,t):mn(e,'unknown document directive "'+i+'"')}if(R(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,R(e,!0,-1)):o&&g(e,"directives end mark is expected"),Fe(e,e.lineIndent-1,pn,!1,!0),R(e,!0,-1),e.checkLineBreaks&&Il.test(e.input.slice(n,e.position))&&mn(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&gn(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,R(e,!0,-1));return}if(e.position<e.length-1)g(e,"end of the stream or a document separator is expected");else return}function ot(e,n){e=String(e),n=n||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
19
- `),e.charCodeAt(0)===65279&&(e=e.slice(1)));var r=new wl(e,n),i=e.indexOf("\0");for(i!==-1&&(r.position=i,g(r,"null byte is not allowed in input")),r.input+="\0";r.input.charCodeAt(r.position)===32;)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)Gl(r);return r.documents}function Kl(e,n,r){n!==null&&typeof n=="object"&&typeof r>"u"&&(r=n,n=null);var i=ot(e,r);if(typeof n!="function")return i;for(var t=0,o=i.length;t<o;t+=1)n(i[t])}function Yl(e,n){var r=ot(e,n);if(r.length!==0){if(r.length===1)return r[0];throw new K("expected a single document in the stream, but found more")}}var Hl=Kl,Wl=Yl,at={loadAll:Hl,load:Wl},lt=Object.prototype.toString,ut=Object.prototype.hasOwnProperty,ur=65279,ql=9,Qe=10,Xl=13,zl=32,Ql=33,Jl=34,er=35,Zl=37,eu=38,nu=39,ru=42,st=44,iu=45,hn=58,tu=61,ou=62,au=63,lu=64,ct=91,ft=93,uu=96,dt=123,su=124,pt=125,V={};V[0]="\\0";V[7]="\\a";V[8]="\\b";V[9]="\\t";V[10]="\\n";V[11]="\\v";V[12]="\\f";V[13]="\\r";V[27]="\\e";V[34]='\\"';V[92]="\\\\";V[133]="\\N";V[160]="\\_";V[8232]="\\L";V[8233]="\\P";var cu=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],fu=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function du(e,n){var r,i,t,o,a,l,u;if(n===null)return{};for(r={},i=Object.keys(n),t=0,o=i.length;t<o;t+=1)a=i[t],l=String(n[a]),a.slice(0,2)==="!!"&&(a="tag:yaml.org,2002:"+a.slice(2)),u=e.compiledTypeMap.fallback[a],u&&ut.call(u.styleAliases,l)&&(l=u.styleAliases[l]),r[a]=l;return r}function pu(e){var n,r,i;if(n=e.toString(16).toUpperCase(),e<=255)r="x",i=2;else if(e<=65535)r="u",i=4;else if(e<=4294967295)r="U",i=8;else throw new K("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+r+w.repeat("0",i-n.length)+n}var mu=1,Je=2;function hu(e){this.schema=e.schema||or,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=w.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=du(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==='"'?Je:mu,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 Ai(e,n){for(var r=w.repeat(" ",n),i=0,t=-1,o="",a,l=e.length;i<l;)t=e.indexOf(`
18
+ `,o?1+u:u),o=!0,a=!0,u=0,r=e.position;!Q(c)&&c!==0;)c=e.input.charCodeAt(++e.position);le(e,r,e.position,!1)}return!0}function Ei(e,n){var r,i=e.tag,t=e.anchor,o=[],a,l=!1,u;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=o),u=e.input.charCodeAt(e.position);u!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,g(e,"tab characters must not be used in indentation")),!(u!==45||(a=e.input.charCodeAt(e.position+1),!H(a))));){if(l=!0,e.position++,R(e,!0,-1)&&e.lineIndent<=n){o.push(null),u=e.input.charCodeAt(e.position);continue}if(r=e.line,Pe(e,n,et,!1,!0),o.push(e.result),R(e,!0,-1),u=e.input.charCodeAt(e.position),(e.line===r||e.lineIndent>n)&&u!==0)g(e,"bad indentation of a sequence entry");else if(e.lineIndent<n)break}return l?(e.tag=i,e.anchor=t,e.kind="sequence",e.result=o,!0):!1}function $l(e,n,r){var i,t,o,a,l,u,f=e.tag,s=e.anchor,c={},d=Object.create(null),p=null,m=null,h=null,y=!1,_=!1,x;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=c),x=e.input.charCodeAt(e.position);x!==0;){if(!y&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,g(e,"tab characters must not be used in indentation")),i=e.input.charCodeAt(e.position+1),o=e.line,(x===63||x===58)&&H(i))x===63?(y&&(we(e,c,d,p,m,null,a,l,u),p=m=h=null),_=!0,y=!0,t=!0):y?(y=!1,t=!0):g(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,x=i;else{if(a=e.line,l=e.lineStart,u=e.position,!Pe(e,r,Zi,!1,!0))break;if(e.line===o){for(x=e.input.charCodeAt(e.position);xe(x);)x=e.input.charCodeAt(++e.position);if(x===58)x=e.input.charCodeAt(++e.position),H(x)||g(e,"a whitespace character is expected after the key-value separator within a block mapping"),y&&(we(e,c,d,p,m,null,a,l,u),p=m=h=null),_=!0,y=!1,t=!1,p=e.tag,m=e.result;else if(_)g(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=f,e.anchor=s,!0}else if(_)g(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=f,e.anchor=s,!0}if((e.line===o||e.lineIndent>n)&&(y&&(a=e.line,l=e.lineStart,u=e.position),Pe(e,n,pn,!0,t)&&(y?m=e.result:h=e.result),y||(we(e,c,d,p,m,h,a,l,u),p=m=h=null),R(e,!0,-1),x=e.input.charCodeAt(e.position)),(e.line===o||e.lineIndent>n)&&x!==0)g(e,"bad indentation of a mapping entry");else if(e.lineIndent<n)break}return y&&we(e,c,d,p,m,null,a,l,u),_&&(e.tag=f,e.anchor=s,e.kind="mapping",e.result=c),_}function Vl(e){var n,r=!1,i=!1,t,o,a;if(a=e.input.charCodeAt(e.position),a!==33)return!1;if(e.tag!==null&&g(e,"duplication of a tag property"),a=e.input.charCodeAt(++e.position),a===60?(r=!0,a=e.input.charCodeAt(++e.position)):a===33?(i=!0,t="!!",a=e.input.charCodeAt(++e.position)):t="!",n=e.position,r){do a=e.input.charCodeAt(++e.position);while(a!==0&&a!==62);e.position<e.length?(o=e.input.slice(n,e.position),a=e.input.charCodeAt(++e.position)):g(e,"unexpected end of the stream within a verbatim tag")}else{for(;a!==0&&!H(a);)a===33&&(i?g(e,"tag suffix cannot contain exclamation marks"):(t=e.input.slice(n-1,e.position+1),nt.test(t)||g(e,"named tag handle cannot contain such characters"),i=!0,n=e.position+1)),a=e.input.charCodeAt(++e.position);o=e.input.slice(n,e.position),Ll.test(o)&&g(e,"tag suffix cannot contain flow indicator characters")}o&&!rt.test(o)&&g(e,"tag name cannot contain such characters: "+o);try{o=decodeURIComponent(o)}catch{g(e,"tag name is malformed: "+o)}return r?e.tag=o:ue.call(e.tagMap,t)?e.tag=e.tagMap[t]+o:t==="!"?e.tag="!"+o:t==="!!"?e.tag="tag:yaml.org,2002:"+o:g(e,'undeclared tag handle "'+t+'"'),!0}function Gl(e){var n,r;if(r=e.input.charCodeAt(e.position),r!==38)return!1;for(e.anchor!==null&&g(e,"duplication of an anchor property"),r=e.input.charCodeAt(++e.position),n=e.position;r!==0&&!H(r)&&!Re(r);)r=e.input.charCodeAt(++e.position);return e.position===n&&g(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(n,e.position),!0}function Kl(e){var n,r,i;if(i=e.input.charCodeAt(e.position),i!==42)return!1;for(i=e.input.charCodeAt(++e.position),n=e.position;i!==0&&!H(i)&&!Re(i);)i=e.input.charCodeAt(++e.position);return e.position===n&&g(e,"name of an alias node must contain at least one character"),r=e.input.slice(n,e.position),ue.call(e.anchorMap,r)||g(e,'unidentified alias "'+r+'"'),e.result=e.anchorMap[r],R(e,!0,-1),!0}function Pe(e,n,r,i,t){var o,a,l,u=1,f=!1,s=!1,c,d,p,m,h,y;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,o=a=l=pn===r||et===r,i&&R(e,!0,-1)&&(f=!0,e.lineIndent>n?u=1:e.lineIndent===n?u=0:e.lineIndent<n&&(u=-1)),u===1)for(;Vl(e)||Gl(e);)R(e,!0,-1)?(f=!0,l=o,e.lineIndent>n?u=1:e.lineIndent===n?u=0:e.lineIndent<n&&(u=-1)):l=!1;if(l&&(l=f||t),(u===1||pn===r)&&(dn===r||Zi===r?h=n:h=n+1,y=e.position-e.lineStart,u===1?l&&(Ei(e,y)||$l(e,y,h))||Bl(e,h)?s=!0:(a&&jl(e,h)||Dl(e,h)||Ul(e,h)?s=!0:Kl(e)?(s=!0,(e.tag!==null||e.anchor!==null)&&g(e,"alias node should not have any properties")):Nl(e,h,dn===r)&&(s=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):u===0&&(s=l&&Ei(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"&&g(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),c=0,d=e.implicitTypes.length;c<d;c+=1)if(m=e.implicitTypes[c],m.resolve(e.result)){e.result=m.construct(e.result),e.tag=m.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(ue.call(e.typeMap[e.kind||"fallback"],e.tag))m=e.typeMap[e.kind||"fallback"][e.tag];else for(m=null,p=e.typeMap.multi[e.kind||"fallback"],c=0,d=p.length;c<d;c+=1)if(e.tag.slice(0,p[c].tag.length)===p[c].tag){m=p[c];break}m||g(e,"unknown tag !<"+e.tag+">"),e.result!==null&&m.kind!==e.kind&&g(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+m.kind+'", not "'+e.kind+'"'),m.resolve(e.result,e.tag)?(e.result=m.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):g(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||s}function Yl(e){var n=e.position,r,i,t,o=!1,a;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(a=e.input.charCodeAt(e.position))!==0&&(R(e,!0,-1),a=e.input.charCodeAt(e.position),!(e.lineIndent>0||a!==37));){for(o=!0,a=e.input.charCodeAt(++e.position),r=e.position;a!==0&&!H(a);)a=e.input.charCodeAt(++e.position);for(i=e.input.slice(r,e.position),t=[],i.length<1&&g(e,"directive name must not be less than one character in length");a!==0;){for(;xe(a);)a=e.input.charCodeAt(++e.position);if(a===35){do a=e.input.charCodeAt(++e.position);while(a!==0&&!Q(a));break}if(Q(a))break;for(r=e.position;a!==0&&!H(a);)a=e.input.charCodeAt(++e.position);t.push(e.input.slice(r,e.position))}a!==0&&ar(e),ue.call(vi,i)?vi[i](e,i,t):mn(e,'unknown document directive "'+i+'"')}if(R(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,R(e,!0,-1)):o&&g(e,"directives end mark is expected"),Pe(e,e.lineIndent-1,pn,!1,!0),R(e,!0,-1),e.checkLineBreaks&&Cl.test(e.input.slice(n,e.position))&&mn(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&gn(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,R(e,!0,-1));return}if(e.position<e.length-1)g(e,"end of the stream or a document separator is expected");else return}function lt(e,n){e=String(e),n=n||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
19
+ `),e.charCodeAt(0)===65279&&(e=e.slice(1)));var r=new Fl(e,n),i=e.indexOf("\0");for(i!==-1&&(r.position=i,g(r,"null byte is not allowed in input")),r.input+="\0";r.input.charCodeAt(r.position)===32;)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)Yl(r);return r.documents}function Hl(e,n,r){n!==null&&typeof n=="object"&&typeof r>"u"&&(r=n,n=null);var i=lt(e,r);if(typeof n!="function")return i;for(var t=0,o=i.length;t<o;t+=1)n(i[t])}function Wl(e,n){var r=lt(e,n);if(r.length!==0){if(r.length===1)return r[0];throw new K("expected a single document in the stream, but found more")}}var ql=Hl,Xl=Wl,ut={loadAll:ql,load:Xl},st=Object.prototype.toString,ct=Object.prototype.hasOwnProperty,ur=65279,zl=9,Qe=10,Ql=13,Jl=32,Zl=33,eu=34,er=35,nu=37,ru=38,iu=39,tu=42,ft=44,ou=45,hn=58,au=61,lu=62,uu=63,su=64,dt=91,pt=93,cu=96,mt=123,fu=124,ht=125,V={};V[0]="\\0";V[7]="\\a";V[8]="\\b";V[9]="\\t";V[10]="\\n";V[11]="\\v";V[12]="\\f";V[13]="\\r";V[27]="\\e";V[34]='\\"';V[92]="\\\\";V[133]="\\N";V[160]="\\_";V[8232]="\\L";V[8233]="\\P";var du=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],pu=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function mu(e,n){var r,i,t,o,a,l,u;if(n===null)return{};for(r={},i=Object.keys(n),t=0,o=i.length;t<o;t+=1)a=i[t],l=String(n[a]),a.slice(0,2)==="!!"&&(a="tag:yaml.org,2002:"+a.slice(2)),u=e.compiledTypeMap.fallback[a],u&&ct.call(u.styleAliases,l)&&(l=u.styleAliases[l]),r[a]=l;return r}function hu(e){var n,r,i;if(n=e.toString(16).toUpperCase(),e<=255)r="x",i=2;else if(e<=65535)r="u",i=4;else if(e<=4294967295)r="U",i=8;else throw new K("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+r+w.repeat("0",i-n.length)+n}var yu=1,Je=2;function gu(e){this.schema=e.schema||or,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=w.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=mu(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==='"'?Je:yu,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 Si(e,n){for(var r=w.repeat(" ",n),i=0,t=-1,o="",a,l=e.length;i<l;)t=e.indexOf(`
20
20
  `,i),t===-1?(a=e.slice(i),i=l):(a=e.slice(i,t+1),i=t+1),a.length&&a!==`
21
21
  `&&(o+=r),o+=a;return o}function nr(e,n){return`
22
- `+w.repeat(" ",e.indent*n)}function yu(e,n){var r,i,t;for(r=0,i=e.implicitTypes.length;r<i;r+=1)if(t=e.implicitTypes[r],t.resolve(n))return!0;return!1}function yn(e){return e===zl||e===ql}function Ze(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 Ei(e){return Ze(e)&&e!==ur&&e!==Xl&&e!==Qe}function Si(e,n,r){var i=Ei(e),t=i&&!yn(e);return(r?i:i&&e!==st&&e!==ct&&e!==ft&&e!==dt&&e!==pt)&&e!==er&&!(n===hn&&!t)||Ei(n)&&!yn(n)&&e===er||n===hn&&t}function gu(e){return Ze(e)&&e!==ur&&!yn(e)&&e!==iu&&e!==au&&e!==hn&&e!==st&&e!==ct&&e!==ft&&e!==dt&&e!==pt&&e!==er&&e!==eu&&e!==ru&&e!==Ql&&e!==su&&e!==tu&&e!==ou&&e!==nu&&e!==Jl&&e!==Zl&&e!==lu&&e!==uu}function xu(e){return!yn(e)&&e!==hn}function Xe(e,n){var r=e.charCodeAt(n),i;return r>=55296&&r<=56319&&n+1<e.length&&(i=e.charCodeAt(n+1),i>=56320&&i<=57343)?(r-55296)*1024+i-56320+65536:r}function mt(e){var n=/^\n* /;return n.test(e)}var ht=1,rr=2,yt=3,gt=4,ke=5;function _u(e,n,r,i,t,o,a,l){var u,f=0,s=null,c=!1,d=!1,p=i!==-1,m=-1,h=gu(Xe(e,0))&&xu(Xe(e,e.length-1));if(n||a)for(u=0;u<e.length;f>=65536?u+=2:u++){if(f=Xe(e,u),!Ze(f))return ke;h=h&&Si(f,s,l),s=f}else{for(u=0;u<e.length;f>=65536?u+=2:u++){if(f=Xe(e,u),f===Qe)c=!0,p&&(d=d||u-m-1>i&&e[m+1]!==" ",m=u);else if(!Ze(f))return ke;h=h&&Si(f,s,l),s=f}d=d||p&&u-m-1>i&&e[m+1]!==" "}return!c&&!d?h&&!a&&!t(e)?ht:o===Je?ke:rr:r>9&&mt(e)?ke:a?o===Je?ke:rr:d?gt:yt}function bu(e,n,r,i,t){e.dump=(function(){if(n.length===0)return e.quotingType===Je?'""':"''";if(!e.noCompatMode&&(cu.indexOf(n)!==-1||fu.test(n)))return e.quotingType===Je?'"'+n+'"':"'"+n+"'";var o=e.indent*Math.max(1,r),a=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-o),l=i||e.flowLevel>-1&&r>=e.flowLevel;function u(f){return yu(e,f)}switch(_u(n,l,e.indent,a,u,e.quotingType,e.forceQuotes&&!i,t)){case ht:return n;case rr:return"'"+n.replace(/'/g,"''")+"'";case yt:return"|"+Mi(n,e.indent)+Ti(Ai(n,o));case gt:return">"+Mi(n,e.indent)+Ti(Ai(vu(n,a),o));case ke:return'"'+Au(n)+'"';default:throw new K("impossible error: invalid scalar style")}})()}function Mi(e,n){var r=mt(e)?String(n):"",i=e[e.length-1]===`
22
+ `+w.repeat(" ",e.indent*n)}function xu(e,n){var r,i,t;for(r=0,i=e.implicitTypes.length;r<i;r+=1)if(t=e.implicitTypes[r],t.resolve(n))return!0;return!1}function yn(e){return e===Jl||e===zl}function Ze(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 Mi(e){return Ze(e)&&e!==ur&&e!==Ql&&e!==Qe}function Ti(e,n,r){var i=Mi(e),t=i&&!yn(e);return(r?i:i&&e!==ft&&e!==dt&&e!==pt&&e!==mt&&e!==ht)&&e!==er&&!(n===hn&&!t)||Mi(n)&&!yn(n)&&e===er||n===hn&&t}function _u(e){return Ze(e)&&e!==ur&&!yn(e)&&e!==ou&&e!==uu&&e!==hn&&e!==ft&&e!==dt&&e!==pt&&e!==mt&&e!==ht&&e!==er&&e!==ru&&e!==tu&&e!==Zl&&e!==fu&&e!==au&&e!==lu&&e!==iu&&e!==eu&&e!==nu&&e!==su&&e!==cu}function bu(e){return!yn(e)&&e!==hn}function Xe(e,n){var r=e.charCodeAt(n),i;return r>=55296&&r<=56319&&n+1<e.length&&(i=e.charCodeAt(n+1),i>=56320&&i<=57343)?(r-55296)*1024+i-56320+65536:r}function yt(e){var n=/^\n* /;return n.test(e)}var gt=1,rr=2,xt=3,_t=4,ke=5;function vu(e,n,r,i,t,o,a,l){var u,f=0,s=null,c=!1,d=!1,p=i!==-1,m=-1,h=_u(Xe(e,0))&&bu(Xe(e,e.length-1));if(n||a)for(u=0;u<e.length;f>=65536?u+=2:u++){if(f=Xe(e,u),!Ze(f))return ke;h=h&&Ti(f,s,l),s=f}else{for(u=0;u<e.length;f>=65536?u+=2:u++){if(f=Xe(e,u),f===Qe)c=!0,p&&(d=d||u-m-1>i&&e[m+1]!==" ",m=u);else if(!Ze(f))return ke;h=h&&Ti(f,s,l),s=f}d=d||p&&u-m-1>i&&e[m+1]!==" "}return!c&&!d?h&&!a&&!t(e)?gt:o===Je?ke:rr:r>9&&yt(e)?ke:a?o===Je?ke:rr:d?_t:xt}function Au(e,n,r,i,t){e.dump=(function(){if(n.length===0)return e.quotingType===Je?'""':"''";if(!e.noCompatMode&&(du.indexOf(n)!==-1||pu.test(n)))return e.quotingType===Je?'"'+n+'"':"'"+n+"'";var o=e.indent*Math.max(1,r),a=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-o),l=i||e.flowLevel>-1&&r>=e.flowLevel;function u(f){return xu(e,f)}switch(vu(n,l,e.indent,a,u,e.quotingType,e.forceQuotes&&!i,t)){case gt:return n;case rr:return"'"+n.replace(/'/g,"''")+"'";case xt:return"|"+Ii(n,e.indent)+Oi(Si(n,o));case _t:return">"+Ii(n,e.indent)+Oi(Si(Eu(n,a),o));case ke:return'"'+Su(n)+'"';default:throw new K("impossible error: invalid scalar style")}})()}function Ii(e,n){var r=yt(e)?String(n):"",i=e[e.length-1]===`
23
23
  `,t=i&&(e[e.length-2]===`
24
24
  `||e===`
25
25
  `),o=t?"+":i?"":"-";return r+o+`
26
- `}function Ti(e){return e[e.length-1]===`
27
- `?e.slice(0,-1):e}function vu(e,n){for(var r=/(\n+)([^\n]*)/g,i=(function(){var f=e.indexOf(`
28
- `);return f=f!==-1?f:e.length,r.lastIndex=f,Ii(e.slice(0,f),n)})(),t=e[0]===`
26
+ `}function Oi(e){return e[e.length-1]===`
27
+ `?e.slice(0,-1):e}function Eu(e,n){for(var r=/(\n+)([^\n]*)/g,i=(function(){var f=e.indexOf(`
28
+ `);return f=f!==-1?f:e.length,r.lastIndex=f,Ci(e.slice(0,f),n)})(),t=e[0]===`
29
29
  `||e[0]===" ",o,a;a=r.exec(e);){var l=a[1],u=a[2];o=u[0]===" ",i+=l+(!t&&!o&&u!==""?`
30
- `:"")+Ii(u,n),t=o}return i}function Ii(e,n){if(e===""||e[0]===" ")return e;for(var r=/ [^ ]/g,i,t=0,o,a=0,l=0,u="";i=r.exec(e);)l=i.index,l-t>n&&(o=a>t?a:l,u+=`
30
+ `:"")+Ci(u,n),t=o}return i}function Ci(e,n){if(e===""||e[0]===" ")return e;for(var r=/ [^ ]/g,i,t=0,o,a=0,l=0,u="";i=r.exec(e);)l=i.index,l-t>n&&(o=a>t?a:l,u+=`
31
31
  `+e.slice(t,o),t=o+1),a=l;return u+=`
32
32
  `,e.length-t>n&&a>t?u+=e.slice(t,a)+`
33
- `+e.slice(a+1):u+=e.slice(t),u.slice(1)}function Au(e){for(var n="",r=0,i,t=0;t<e.length;r>=65536?t+=2:t++)r=Xe(e,t),i=V[r],!i&&Ze(r)?(n+=e[t],r>=65536&&(n+=e[t+1])):n+=i||pu(r);return n}function Eu(e,n,r){var i="",t=e.tag,o,a,l;for(o=0,a=r.length;o<a;o+=1)l=r[o],e.replacer&&(l=e.replacer.call(r,String(o),l)),(ee(e,n,l,!1,!1)||typeof l>"u"&&ee(e,n,null,!1,!1))&&(i!==""&&(i+=","+(e.condenseFlow?"":" ")),i+=e.dump);e.tag=t,e.dump="["+i+"]"}function Oi(e,n,r,i){var t="",o=e.tag,a,l,u;for(a=0,l=r.length;a<l;a+=1)u=r[a],e.replacer&&(u=e.replacer.call(r,String(a),u)),(ee(e,n+1,u,!0,!0,!1,!0)||typeof u>"u"&&ee(e,n+1,null,!0,!0,!1,!0))&&((!i||t!=="")&&(t+=nr(e,n)),e.dump&&Qe===e.dump.charCodeAt(0)?t+="-":t+="- ",t+=e.dump);e.tag=o,e.dump=t||"[]"}function Su(e,n,r){var i="",t=e.tag,o=Object.keys(r),a,l,u,f,s;for(a=0,l=o.length;a<l;a+=1)s="",i!==""&&(s+=", "),e.condenseFlow&&(s+='"'),u=o[a],f=r[u],e.replacer&&(f=e.replacer.call(r,u,f)),ee(e,n,u,!1,!1)&&(e.dump.length>1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),ee(e,n,f,!1,!1)&&(s+=e.dump,i+=s));e.tag=t,e.dump="{"+i+"}"}function Mu(e,n,r,i){var t="",o=e.tag,a=Object.keys(r),l,u,f,s,c,d;if(e.sortKeys===!0)a.sort();else if(typeof e.sortKeys=="function")a.sort(e.sortKeys);else if(e.sortKeys)throw new K("sortKeys must be a boolean or a function");for(l=0,u=a.length;l<u;l+=1)d="",(!i||t!=="")&&(d+=nr(e,n)),f=a[l],s=r[f],e.replacer&&(s=e.replacer.call(r,f,s)),ee(e,n+1,f,!0,!0,!0)&&(c=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,c&&(e.dump&&Qe===e.dump.charCodeAt(0)?d+="?":d+="? "),d+=e.dump,c&&(d+=nr(e,n)),ee(e,n+1,s,!0,c)&&(e.dump&&Qe===e.dump.charCodeAt(0)?d+=":":d+=": ",d+=e.dump,t+=d));e.tag=o,e.dump=t||"{}"}function Ci(e,n,r){var i,t,o,a,l,u;for(t=r?e.explicitTypes:e.implicitTypes,o=0,a=t.length;o<a;o+=1)if(l=t[o],(l.instanceOf||l.predicate)&&(!l.instanceOf||typeof n=="object"&&n instanceof l.instanceOf)&&(!l.predicate||l.predicate(n))){if(r?l.multi&&l.representName?e.tag=l.representName(n):e.tag=l.tag:e.tag="?",l.represent){if(u=e.styleMap[l.tag]||l.defaultStyle,lt.call(l.represent)==="[object Function]")i=l.represent(n,u);else if(ut.call(l.represent,u))i=l.represent[u](n,u);else throw new K("!<"+l.tag+'> tag resolver accepts not "'+u+'" style');e.dump=i}return!0}return!1}function ee(e,n,r,i,t,o,a){e.tag=null,e.dump=r,Ci(e,r,!1)||Ci(e,r,!0);var l=lt.call(e.dump),u=i,f;i&&(i=e.flowLevel<0||e.flowLevel>n);var s=l==="[object Object]"||l==="[object Array]",c,d;if(s&&(c=e.duplicates.indexOf(r),d=c!==-1),(e.tag!==null&&e.tag!=="?"||d||e.indent!==2&&n>0)&&(t=!1),d&&e.usedDuplicates[c])e.dump="*ref_"+c;else{if(s&&d&&!e.usedDuplicates[c]&&(e.usedDuplicates[c]=!0),l==="[object Object]")i&&Object.keys(e.dump).length!==0?(Mu(e,n,e.dump,t),d&&(e.dump="&ref_"+c+e.dump)):(Su(e,n,e.dump),d&&(e.dump="&ref_"+c+" "+e.dump));else if(l==="[object Array]")i&&e.dump.length!==0?(e.noArrayIndent&&!a&&n>0?Oi(e,n-1,e.dump,t):Oi(e,n,e.dump,t),d&&(e.dump="&ref_"+c+e.dump)):(Eu(e,n,e.dump),d&&(e.dump="&ref_"+c+" "+e.dump));else if(l==="[object String]")e.tag!=="?"&&bu(e,e.dump,n,o,u);else{if(l==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new K("unacceptable kind of an object to dump "+l)}e.tag!==null&&e.tag!=="?"&&(f=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?f="!"+f:f.slice(0,18)==="tag:yaml.org,2002:"?f="!!"+f.slice(18):f="!<"+f+">",e.dump=f+" "+e.dump)}return!0}function Tu(e,n){var r=[],i=[],t,o;for(ir(e,r,i),t=0,o=i.length;t<o;t+=1)n.duplicates.push(r[i[t]]);n.usedDuplicates=new Array(o)}function ir(e,n,r){var i,t,o;if(e!==null&&typeof e=="object")if(t=n.indexOf(e),t!==-1)r.indexOf(t)===-1&&r.push(t);else if(n.push(e),Array.isArray(e))for(t=0,o=e.length;t<o;t+=1)ir(e[t],n,r);else for(i=Object.keys(e),t=0,o=i.length;t<o;t+=1)ir(e[i[t]],n,r)}function Iu(e,n){n=n||{};var r=new hu(n);r.noRefs||Tu(e,r);var i=e;return r.replacer&&(i=r.replacer.call({"":i},"",i)),ee(r,0,i,!0,!0)?r.dump+`
34
- `:""}var Ou=Iu,Cu={dump:Ou};function sr(e,n){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+n+" instead, which is now safe by default.")}}var Lu=j,ku=Ri,Ru=Ni,wu=$i,Fu=Vi,Pu=or,Nu=at.load,Du=at.loadAll,Uu=Cu.dump,Bu=K,ju={binary:Wi,float:ji,map:Pi,null:Di,pairs:Xi,set:zi,timestamp:Yi,bool:Ui,int:Bi,merge:Hi,omap:qi,seq:Fi,str:wi},$u=sr("safeLoad","load"),Vu=sr("safeLoadAll","loadAll"),Gu=sr("safeDump","dump"),Y={Type:Lu,Schema:ku,FAILSAFE_SCHEMA:Ru,JSON_SCHEMA:wu,CORE_SCHEMA:Fu,DEFAULT_SCHEMA:Pu,load:Nu,loadAll:Du,dump:Uu,YAMLException:Bu,types:ju,safeLoad:$u,safeLoadAll:Vu,safeDump:Gu};import{createHash as Ku}from"node:crypto";import xn from"node:fs";import xt from"node:path";function vt(e){if(e==null||typeof e!="object"||Array.isArray(e))return;let n=e,r={};return typeof n.apiKey=="string"&&(r.apiKey=n.apiKey),typeof n.baseURL=="string"&&(r.baseURL=n.baseURL),Object.keys(r).length>0?r:void 0}function At(e){if(e==null||typeof e!="object"||Array.isArray(e))return;let n=Object.entries(e).filter(([,r])=>r!=null&&typeof r=="object"&&!Array.isArray(r));if(n.length!==0)return Object.fromEntries(n.map(([r,i])=>[r,St(i)]))}function Et(e){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,S(r)?St(r):r]))}function St(e){if(!S(e.models))return e;let n=!1,r=Object.fromEntries(Object.entries(e.models).map(([i,t])=>{if(!S(t)||!S(t.thinking))return[i,t];let o=typeof t.thinking.effort=="string"?t.thinking.effort.trim():"",a=typeof t.thinking.defaultEffort=="string"?t.thinking.defaultEffort.trim():"";if(!Object.hasOwn(t.thinking,"effort")&&!Object.hasOwn(t.thinking,"defaultEffort"))return[i,t];let l=[],u=new Set;if(Array.isArray(t.thinking.effortOptions))for(let h of t.thinking.effortOptions){if(typeof h!="string")continue;let y=h.trim();!y||u.has(y)||(u.add(y),l.push(y))}o&&!u.has(o)&&(u.add(o),l.push(o)),a&&!u.has(a)&&(u.add(a),l.push(a));let{effort:f,effortOptions:s,defaultEffort:c,...d}=t.thinking,p={...d,...l.length>0?{effortOptions:l}:{}},m={...t};return Object.keys(p).length>0?m.thinking=p:delete m.thinking,n=!0,[i,m]}));return n?{...e,models:r}:e}var Mt="byok_legacy_provider_to_custom_provider_v1",Yu="config.yaml.bak.byok-legacy-provider.",cr=new Set(["minimax","minimax_api","provider","custom_provider"]),Hu=/^[A-Za-z0-9 _-]+$/,Wu=["support_files_api","files_api_upload_endpoint","max_image_bytes_inline","max_video_bytes_inline","max_request_body_bytes","max_attachments_count"];function Tt(e,n){let r={migrated:!1,migratedProviders:{}};if(!n.isManagedRuntime()||!xn.existsSync(e))return r;let i=Ct(e);if(!S(i.provider))return r;let t=i.provider,o=S(i.custom_provider)?i.custom_provider:{},a=Lt(i),l={},u={...o},f=new Set(Object.keys(u)),s=!1,c=n.getManagedPreset().provider;for(let[d,p]of Object.entries(t)){if(!ns(d,p,c,n))continue;let m=a.providers[d];if(m&&!cr.has(m)&&!S(u[m])){delete t[d],s=!0;continue}let h=m&&!cr.has(m)?m:os(d,p,f);l[d]=h,S(u[h])||(u[h]=is(p),f.add(h),s=!0),a.providers[d]!==h&&(a.providers[d]=h,s=!0),delete t[d],s=!0}if(!s&&Object.keys(l).length===0)return r;if(s=bt(i,"defaultModel",l)||s,s=bt(i,"defaultLightModel",l)||s,s=us(i,l)||s,!s)return{migrated:!1,migratedProviders:l};Object.keys(u).length>0?i.custom_provider=u:delete i.custom_provider,cs(i,a);try{let d=ss(e);return xn.writeFileSync(e,Y.dump(i,{indent:2,lineWidth:-1,noRefs:!0}),"utf-8"),{migrated:!0,migratedProviders:l,backupPath:d}}catch(d){return console.warn(`[config] legacy BYOK provider migration skipped: ${ds(d)}`),{migrated:!1,migratedProviders:l}}}function qu(e,n){let r=Ct(e),i=S(r.custom_provider)?r.custom_provider:{},t=Lt(r),o=new Set(n?.excludedLegacyProviderIds??[]);return Object.fromEntries(Object.entries(t.providers).filter(([a,l])=>a.length>0&&!o.has(a)&&l.length>0&&S(i[l])))}function It(e,n){let r=e.provider,i=e.defaultModel;if(Object.prototype.hasOwnProperty.call(r,"minimax_api")){let{minimax_api:m,...h}=r;r=h,console.warn('[config] "minimax_api" is a reserved provider id; ignoring provider.minimax_api from config.yaml')}let o=n.getManagedPreset().provider.minimax,a=r.minimax,l=n.isManagedRuntime();if(!(l||Xu(a,n)))return{provider:r,defaultModel:i};let f=a?.options,s=l&&n.shouldEnforceManagedProviderProtection(),c=zu(o.models,a?.models),d=typeof f?.baseURL=="string"&&f.baseURL.length>0?f.baseURL:void 0,p=s&&d!=null&&!n.isManagedPresetBaseUrl(d);return r={...r,minimax:{...o,...a??{},npm:a?.npm??o.npm,models:c,options:{...o.options??{},...f??{},...p?{apiKey:o.options?.apiKey}:{},...s?{authMode:"managed-login",baseURL:o.options?.baseURL}:{}}}},{provider:r,defaultModel:i}}function Xu(e,n){let r=e?.options;return r?.authMode==="managed-login"?!0:typeof r?.baseURL=="string"&&n.isManagedPresetBaseUrl(r.baseURL)}function zu(e,n){let r={};for(let[t,o]of Object.entries(e??{}))r[t]=Qu(o,n?.[t]);let i=r["MiniMax-M3"];return i&&(r["MiniMax-M3"]={...i,limit:{...i.limit,context:i.limit?.context===1e6?1e6:512e3,output:i.limit?.output??128e3}}),r}function Qu(e,n){return n?{...e,...n,capabilities:Ju(e.capabilities,n.capabilities)}:e}function Ju(e,n){if(!e&&!n)return;let r={...e??{},...n??{}};for(let i of Wu){if(!Object.prototype.hasOwnProperty.call(e??{},i)||!Object.prototype.hasOwnProperty.call(n??{},i))continue;let t=Zu(i,n?.[i]);t===void 0?r[i]=e?.[i]:r[i]=t}return r}function Zu(e,n){switch(e){case"support_files_api":return typeof n=="boolean"?n:void 0;case"files_api_upload_endpoint":return typeof n=="string"&&n.trim().length>0?n.trim():void 0;case"max_image_bytes_inline":case"max_video_bytes_inline":case"max_request_body_bytes":return Ot(n);case"max_attachments_count":return es(n)}}function Ot(e){if(typeof e=="number")return Number.isFinite(e)&&e>0?e:void 0;if(typeof e!="string")return;let n=e.trim();if(!n)return;let r=Number(n);return Number.isFinite(r)&&r>0?n:void 0}function es(e){let n=Ot(e);if(n===void 0)return;let r=typeof n=="number"?n:Number(n);return Number.isInteger(r)&&r>0?n:void 0}function Ct(e){try{let n=Y.load(xn.readFileSync(e,"utf-8"));return S(n)?n:{}}catch{return{}}}function ns(e,n,r,i){if(e==="minimax_api"||!fs(n)||!rs(n))return!1;if(!Object.prototype.hasOwnProperty.call(r,e))return!0;if(e!=="minimax"||!i.shouldEnforceManagedProviderProtection())return!1;let t=ts(n);return!!(t&&!i.isManagedPresetBaseUrl(t))}function rs(e){let n=S(e.options)?e.options:void 0;return typeof n?.apiKey=="string"&&n.apiKey.trim().length>0&&typeof n.baseURL=="string"&&n.baseURL.trim().length>0&&S(e.models)}function is(e){let n=S(e.options)?e.options:{};return{...e,kind:"custom",enabled:e.enabled!==!1,options:{...n,authMode:"api-key"}}}function ts(e){let r=(S(e.options)?e.options:void 0)?.baseURL;return typeof r=="string"&&r.length>0?r:void 0}function os(e,n,r){let i=S(n)?n:{},t=typeof i.name=="string"?i.name:void 0,o=`provider-${as(e)}`,a=e==="minimax"?"minimax-legacy":_t(e)??_t(t)??o;for(let l=0;;l+=1){let u=l===0?a:`${a}-${l+1}`;if(!r.has(u)&&!cr.has(u))return u}}function _t(e){let n=e?.trim();return!n||!Hu.test(n)?void 0:n.toLowerCase().replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")||void 0}function as(e){return Ku("sha256").update(e).digest("hex").slice(0,8)}function bt(e,n,r){let i=e[n];if(typeof i!="string")return!1;let t=ls(i,r);return t===i?!1:(e[n]=t,!0)}function ls(e,n){let r=e.indexOf("/");if(r<=0||r===e.length-1)return e;let i=e.slice(0,r),t=n[i];return t?`custom_provider:${t}/${e.slice(r+1)}`:e}function us(e,n){if(!S(e.nexus)||!S(e.nexus.model))return!1;let r=e.nexus.model.providerID;if(typeof r!="string")return!1;let i=n[r];return i?(e.nexus.model.providerID=`custom_provider:${i}`,!0):!1}function ss(e){let n=xt.join(xt.dirname(e),`${Yu}${Date.now()}`);return xn.copyFileSync(e,n),n}function Lt(e){let r=(S(e.migrations)?e.migrations:void 0)?.[Mt];return{providers:S(r)&&S(r.providers)?Object.fromEntries(Object.entries(r.providers).filter(t=>typeof t[1]=="string")):{}}}function cs(e,n){let r=S(e.migrations)?e.migrations:{};r[Mt]={version:1,providers:n.providers},e.migrations=r}function fs(e){return S(e)?typeof e.name=="string"||typeof e.npm=="string"||typeof e.api=="string"||S(e.options)||S(e.models):!1}function S(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function ds(e){return e instanceof Error?e.message:String(e)}var en="native";function nn(e){return e==="native"||e==="mcp"?e:en}function kt(e){if(e==="mcp")throw new Error("MCP backend coming in v2 follow-up plan")}function Rt(e,n){let r=n.keepAlive,i=n.xdg,t=n.spawnConcurrency,o=()=>({enabled:r.enabled,maxProcesses:r.maxProcesses,maxLifetimeMs:r.maxLifetimeMs,agents:[...r.agents]}),a=e.opencode;if(a==null||typeof a!="object"||Array.isArray(a))return{keepAlive:o(),xdg:{...i},spawnConcurrency:t};let l=a,u=l.spawnConcurrency,f=typeof u=="number"&&Number.isFinite(u)&&u>0&&Number.isInteger(u)?u:t,s=ps(l.xdg,i),c=l.keepAlive;if(c==null||typeof c!="object"||Array.isArray(c))return{keepAlive:o(),xdg:s,spawnConcurrency:f};let d=c,p=d.maxProcesses,m=typeof p=="number"&&Number.isFinite(p)&&p>0&&Number.isInteger(p)?p:r.maxProcesses,h=d.maxLifetimeMs,y=typeof h=="number"&&Number.isFinite(h)&&h>0&&Number.isInteger(h)?h:r.maxLifetimeMs,_=d.agents,x;return Array.isArray(_)?(x=_.filter(k=>typeof k=="string"&&k.length>0),x.length===0&&(x=[...r.agents])):x=[...r.agents],{keepAlive:{enabled:typeof d.enabled=="boolean"?d.enabled:r.enabled,maxProcesses:m,maxLifetimeMs:y,agents:x},xdg:s,spawnConcurrency:f}}function ps(e,n){let r=e!=null&&typeof e=="object"&&!Array.isArray(e)?e:void 0,i=r?.startupImport,t=i==="background"||i==="blocking"||i==="off"?i:n.startupImport;return{dataIsolation:typeof r?.dataIsolation=="boolean"?r.dataIsolation:n.dataIsolation,startupImport:t}}function _n(e){let n=JSON.stringify({level:40,time:Date.now(),name:"config.asr",msg:e});process.stderr.write(`${n}
35
- `)}var vn={enabled:!0};function wt(e){if(e==null||typeof e!="object"||Array.isArray(e))return!1;let n=e,r=typeof n.apiKey=="string"&&n.apiKey.trim().length>0,i=typeof n.resourceId=="string"&&n.resourceId.trim().length>0;return r||i}function bn(e){return typeof e=="string"&&e.trim().length>0}function Ft(e){let n=e.asr;if(n==null||typeof n!="object"||Array.isArray(n))return{...vn};let r=n;return wt(r.seed)&&_n("Ignoring legacy `asr.seed.*` in config \u2014 Seed ASR was retired from the daemon; only Amadeus remains. Remove `asr.seed` from config.yaml."),wt(r.qwen)&&_n("Ignoring legacy `asr.qwen.apiKey` in config \u2014 Qwen ASR was retired from the daemon; only Amadeus remains. Remove `asr.qwen` from config.yaml."),(bn(r.mode)||bn(r.proxyBaseUrl))&&_n("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."),(bn(r.primaryProvider)||bn(r.fallbackProvider))&&_n("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 r.enabled=="boolean"?r.enabled:vn.enabled}}var dr={policyServer:{url:"",requestTimeoutMs:5e3}},ms="http://127.0.0.1:8443";function hs(e){return e==="prod"?"":ms}function ys(e,n){return typeof e=="number"&&Number.isFinite(e)&&e>0?Math.floor(e):n}function fr(e){if(e.length===0)return!1;try{return new URL(e),!0}catch{return!1}}function Pt(e,n){let r=e.nd,i=r!=null&&typeof r=="object"&&!Array.isArray(r)?r.policyServer:void 0,t=i!=null&&typeof i=="object"&&!Array.isArray(i)?i:{},o=process.env.MAVIS_ND_POLICY_SERVER_URL,a=typeof o=="string"&&o.trim().length>0?o.trim():void 0,l=t.url,u=typeof l=="string"&&l.trim().length>0?l.trim():void 0,f="";if(a&&fr(a))f=a;else if(u&&fr(u))f=u;else{let s=hs(n);f=fr(s)?s:""}return{policyServer:{url:f,requestTimeoutMs:ys(t.requestTimeoutMs,dr.policyServer.requestTimeoutMs)}}}var gs={policyOwner:"core",storageWriteVersion:2,classifierTimeoutMs:6e4,userConfirmationEnabled:!0};function Nt(e,n=gs){let r=e.permission;if(r==null||typeof r!="object"||Array.isArray(r))return{...n};let i=r,t=i.policyOwner===void 0?n.policyOwner:i.policyOwner==="engine"||i.policyOwner==="core"?i.policyOwner:"engine",o=i.storageWriteVersion===1||i.storageWriteVersion===2?i.storageWriteVersion:n.storageWriteVersion,a=i.classifierTimeoutMs,l=typeof a=="number"&&Number.isFinite(a)&&a>=5e3?Math.floor(a):n.classifierTimeoutMs,u=typeof i.userConfirmationEnabled=="boolean"?i.userConfirmationEnabled:n.userConfirmationEnabled;return{policyOwner:t,storageWriteVersion:o,classifierTimeoutMs:l,userConfirmationEnabled:u}}function Dt(e,n){return n.length===0?!1:n.includes("*")?!0:n.includes(e)}var Ut=["user-cc","user-codex","user-agents","workspace-minimax","workspace-cc","workspace-agents"],xs={"user-cc":"user-claude","workspace-cc":"workspace-claude"},En={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 An(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function _s(e,n){return An(e)?{enabled:typeof e.enabled=="boolean"?e.enabled:n.enabled,priority:typeof e.priority=="number"&&Number.isFinite(e.priority)?e.priority:n.priority}:n}function pr(e){let n=En,r=An(e.skills)?e.skills:{},i=An(r.external)?r.external:{},t=An(i.sources)?i.sources:{},o={...n.external.sources};for(let a of Ut){let l=xs[a],u=Object.hasOwn(t,a)?t[a]:l?t[l]:void 0;o[a]=_s(u,n.external.sources[a])}return{external:{enabled:typeof i.enabled=="boolean"?i.enabled:n.external.enabled,walkUp:typeof i.walkUp=="boolean"?i.walkUp:n.external.walkUp,duplicateWarn:typeof i.duplicateWarn=="boolean"?i.duplicateWarn:n.external.duplicateWarn,sources:o}}}var bs=Ut;var Bt=["pi-agent"],Pe="pi-agent";function jt(e){return typeof e!="string"?Pe:Bt.includes(e)?e:Pe}function mr(e){return e==null||typeof e!="object"||Array.isArray(e)?{defaultFramework:Pe}:{defaultFramework:jt(e.defaultFramework)}}import F from"node:fs";import vs from"node:os";import Ne from"node:path";var Ht=".minimax",Wt=".mavis",As={error:()=>{},info:()=>{},warn:()=>{}};function _r(e){return e??vs.homedir()}function qt(e,n){return n?`${e}-${n}`:e}function Xt(e,n){return Ne.join(_r(e),qt(Ht,n))}function zt(e,n){return Ne.join(_r(e),qt(Wt,n))}function yr(e){try{let n=F.lstatSync(e);return n.isSymbolicLink()?{kind:"link"}:n.isDirectory()?{kind:"directory"}:{kind:"other"}}catch(n){let r=n.code;return r==="ENOENT"||r==="ENOTDIR"?{kind:"missing"}:{kind:"inaccessible",error:n}}}function hr(e){let n=Ne.resolve(e);return process.platform==="win32"?(n=n.replace(/^\\\\\?\\/,""),n.toLowerCase()):n}function br(e,n){try{let r=F.readlinkSync(e),i=hr(n);return hr(Ne.resolve(Ne.dirname(e),r))===i||hr(r)===i}catch{return!1}}function Sn(e,n,r){if(!br(e,n))try{F.symlinkSync(n,e,process.platform==="win32"?"junction":"dir")}catch(i){r.warn(`Failed to create compat link ${e} -> ${n}: ${String(i)}`)}}function $t(e,n,r){if(n.kind==="missing")return!0;if(n.kind==="link"||n.kind==="other")try{return F.unlinkSync(e),!0}catch(i){return r.warn(`Failed to remove ${e} before creating compat link: ${String(i)}`),!1}return!1}function gr(e){try{let n=F.readdirSync(e);if(n.length===0)return"empty";if(n.length===1&&n[0]==="workspace")try{return F.readdirSync(Ne.join(e,"workspace")).length>0?"hasData":"empty"}catch{return"unknown"}return"hasData"}catch{return"unknown"}}function xr(e){try{return F.statSync(e).isDirectory()?gr(e):void 0}catch{return"unknown"}}function Es(e,n){return`${e}.backup-${n()}`}function Ss(e,n,r){let i=Es(e,r);try{return F.renameSync(e,i),n.warn(`Backed up legacy data dir ${e} -> ${i}`),!0}catch(t){return n.warn(`Failed to back up legacy data dir ${e}: ${String(t)}`),!1}}function Ms(e,n,r,i){if(br(e,n))return!0;let t=yr(e);if(t.kind==="missing")return!0;if(t.kind==="link"){let o=xr(e);return o==="hasData"||o==="unknown"?(r.warn(`Cannot replace legacy data dir symlink ${e}; it may point to real data outside ${n}`),!1):$t(e,t,r)}return t.kind==="other"?$t(e,t,r):t.kind==="directory"?Ss(e,r,i):(r.warn(`Cannot replace inaccessible legacy data dir ${e}; leaving it untouched`),!1)}function Vt(e,n,r,i){Ms(e,n,r,i)&&Sn(e,n,r)}function Ts(e,n){try{return F.rmSync(e,{recursive:!0,force:!1}),!0}catch(r){return n.warn(`Failed to remove empty primary data dir ${e}: ${String(r)}`),!1}}function Gt(e,n,r){try{return F.renameSync(e,n),r.info(`Migrated legacy data dir ${e} -> ${n}`),!0}catch(i){return r.warn(`Failed to migrate legacy data dir ${e} -> ${n}: ${String(i)}`),!1}}function Is(e,n,r,i){try{F.cpSync(e,r,{recursive:!0,errorOnExist:!0,force:!1}),F.unlinkSync(n);try{F.rmSync(e,{recursive:!0,force:!1})}catch(t){i.warn(`Copied legacy symlink data dir ${e} -> ${r}, but failed to remove old target: ${String(t)}`)}return i.info(`Copied legacy data dir symlink target ${e} -> ${r}`),!0}catch(t){try{F.existsSync(r)&&F.rmSync(r,{recursive:!0,force:!0})}catch(o){i.warn(`Failed to clean up partial primary data dir ${r}: ${String(o)}`)}return i.warn(`Failed to copy legacy symlink data dir ${n} -> ${r}: ${String(t)}`),!1}}function Kt(e,n,r){try{let i=F.realpathSync(e);try{F.renameSync(i,n)}catch(t){if(t.code==="EXDEV")return Is(i,e,n,r);throw t}return F.unlinkSync(e),r.info(`Migrated legacy data dir symlink target ${i} -> ${n}`),!0}catch(i){return r.warn(`Failed to migrate legacy symlink data dir ${e} -> ${n}: ${String(i)}`),!1}}function Yt(e,n){try{return F.mkdirSync(e,{recursive:!0}),!0}catch(r){return n.warn(`Failed to create primary data dir ${e}: ${String(r)}`),!1}}function Os(e,n,r,i){let t=yr(e),o=yr(n);if(t.kind==="inaccessible")return r.warn(`Primary data dir ${e} is inaccessible; not treating it as missing`),e;if(t.kind==="directory"){let a=gr(e),l=o.kind==="directory"?gr(n):o.kind==="link"?xr(n)??"empty":"empty";if(a==="empty"){if(o.kind==="inaccessible"||l==="unknown")return r.warn(`Legacy data dir ${n} may contain data but is inaccessible; not using empty primary ${e}`),n;if((o.kind==="directory"||o.kind==="link")&&l==="hasData"){if(!Ts(e,r))return n;if(o.kind==="link"){if(!Kt(n,e,r))return n}else if(!Gt(n,e,r))return n;return Sn(n,e,r),e}}return Vt(n,e,r,i),e}if(br(n,e))return Yt(e,r),e;if(o.kind==="directory")return Gt(n,e,r)?(Sn(n,e,r),e):n;if(o.kind==="link"){let a=xr(n);if(a==="hasData")return Kt(n,e,r)?(Sn(n,e,r),e):n;if(a==="unknown")return r.warn(`Legacy data dir symlink ${n} target is inaccessible; not treating it as missing`),n}return o.kind==="inaccessible"?(r.warn(`Legacy data dir ${n} is inaccessible; not treating it as missing`),n):t.kind==="link"||t.kind==="other"?(r.warn(`Primary data dir path ${e} exists but is not a directory; using it without migration`),e):(Yt(e,r),Vt(n,e,r,i),e)}function se(e={}){let n=_r(e.homeDir),r=e.profile??null;return Os(Xt(n,r),zt(n,r),e.logger??As,e.nowMs??Date.now)}function Cs(e,n){return se({homeDir:e,logger:n})}function Ls(e,n,r){return se({homeDir:n,profile:e,logger:r})}var Tr=["read","write","edit","bash","grep","glob","todowrite","web_fetch","website_deploy","workspace_semantic_search"],Ir=["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"],Or=["code-review","deep-research","docx","init","lark-tools","llm-call","mcode-tools-master","mavis-doctor","pdf","plugin-creator","pptx","skill-creator","skill-refiner","visual-page","x-link-reader","xlsx"],Jt=["control-in-app-browser","cu-desktop","resume-codex","mavis","create-agent","minimax-code-product","mavis-team","miniapp-creator"],ks=new Set(["modelConfigId","persona","tools","builtinTools","skills","features"]),Rs=new Set(["enabled"]),Sr=new Set(["mavis","delegation","webSearch"]),Zt=new Set(Tr),eo=new Set(Ir),Mr=new Set(Or),no=new Set(Jt),ws=new Set(["plan-mode"]);function Cr(e){let n=Mn(e),r=Mn(n?.default);return{default:r?Ps(r):{}}}function Fs(e,n="agent"){if(e===void 0)return{};let r=Ar(e,n);Er(r,ks,n);let i={};if(r.modelConfigId!==void 0&&((typeof r.modelConfigId!="string"||!r.modelConfigId.trim())&&q(`${n}.modelConfigId`,"must be a non-empty string"),i.modelConfigId=r.modelConfigId.trim()),r.persona!==void 0){let t=Ar(r.persona,`${n}.persona`);Er(t,Rs,`${n}.persona`),t.enabled!==void 0&&typeof t.enabled!="boolean"&&q(`${n}.persona.enabled`,"must be a boolean"),i.persona={...typeof t.enabled=="boolean"?{enabled:t.enabled}:{}}}if(r.tools!==void 0&&(Array.isArray(r.tools)||q(`${n}.tools`,"must be an array"),i.tools=r.tools.map((t,o)=>((typeof t!="string"||!Zt.has(t))&&q(`${n}.tools[${o}]`,`must be one of ${Tr.join(", ")}`),t))),r.builtinTools!==void 0&&(Array.isArray(r.builtinTools)||q(`${n}.builtinTools`,"must be an array"),i.builtinTools=r.builtinTools.map((t,o)=>(t==="web_search"&&q(`${n}.builtinTools[${o}]`,"web_search is feature-owned; use features.webSearch"),(typeof t!="string"||!eo.has(t))&&q(`${n}.builtinTools[${o}]`,`must be one of ${Ir.join(", ")}`),t))),r.skills!==void 0&&(Array.isArray(r.skills)||q(`${n}.skills`,"must be an array"),i.skills=r.skills.map((t,o)=>{if(typeof t=="string"&&no.has(t.trim())){let a=t.trim();q(`${n}.skills[${o}]`,`${a} is capability-owned; use its owning Tool or feature switch`)}return(typeof t!="string"||!Mr.has(t.trim()))&&q(`${n}.skills[${o}]`,`must be one of ${Or.join(", ")}`),t.trim()})),r.features!==void 0){let t=Ar(r.features,`${n}.features`);Er(t,Sr,`${n}.features`);for(let o of Sr)t[o]!==void 0&&typeof t[o]!="boolean"&&q(`${n}.features.${o}`,"must be a boolean");i.features={...typeof t.mavis=="boolean"?{mavis:t.mavis}:{},...typeof t.delegation=="boolean"?{delegation:t.delegation}:{},...typeof t.webSearch=="boolean"?{webSearch:t.webSearch}:{}}}return i}function Ps(e){let n={};typeof e.modelConfigId=="string"&&e.modelConfigId.trim()&&(n.modelConfigId=e.modelConfigId.trim());let r=Mn(e.persona);if(typeof r?.enabled=="boolean"&&(n.persona={enabled:r.enabled}),Qt(e.tools,Zt)&&(n.tools=[...e.tools]),Qt(e.builtinTools,eo)&&(n.builtinTools=[...e.builtinTools]),Array.isArray(e.skills)){let t=e.skills.map(o=>typeof o=="string"?o.trim():o);t.every(o=>typeof o=="string"&&(Mr.has(o)||ws.has(o))&&!no.has(o))&&(n.skills=t.filter(o=>typeof o=="string"&&Mr.has(o)))}let i=Mn(e.features);if(i){let t={};for(let o of Sr)typeof i[o]=="boolean"&&(t[o]=i[o]);Object.keys(t).length>0&&(n.features=t)}return n}function Mn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0}function Qt(e,n){return Array.isArray(e)&&e.every(r=>typeof r=="string"&&n.has(r))}function Ns(e={},n={}){return{persona:{enabled:n.persona?.enabled??e.persona?.enabled??!0},tools:vr(n.tools??e.tools),builtinTools:vr(n.builtinTools??e.builtinTools),skills:vr(n.skills??e.skills),features:{mavis:n.features?.mavis??e.features?.mavis??!0,delegation:n.features?.delegation??e.features?.delegation??!0,webSearch:n.features?.webSearch??e.features?.webSearch??!0}}}function Ds(e,n){return e.tools===void 0||e.tools.includes(n)}function Us(e,n){return e.builtinTools===void 0||e.builtinTools.includes(n)}function Bs(e,n){return e.skills===void 0||e.skills.includes(n)}function vr(e){return e===void 0?void 0:[...e]}function Ar(e,n){return(e==null||typeof e!="object"||Array.isArray(e))&&q(n,"must be an object"),e}function Er(e,n,r){for(let i of Object.keys(e))n.has(i)||q(`${r}.${i}`,"is not supported")}function q(e,n){throw new Error(`Invalid configuration at ${e}: ${n}`)}var to=["none","evaluator","subagent"],oo=["brief","transcript"],ao=["same-route-small-fast"],lo="goal-verifier-readonly",uo=[lo],z={budget:{graceSteps:1},breaker:{repeatedReplyLimit:3},verifier:{repeatedNotMetLimit:5,evidence:"brief"},evaluator:{modelPolicy:"same-route-small-fast",maxTokens:32e3,timeoutSeconds:60,maxRetries:1}},Lr={budget:{graceSteps:3},evaluator:{maxRetries:1}};function kr(e){let n=[],r=De(e,"goal",n);Ue(r,"goal",n,["objectiveMaxChars","verification","budget","breaker","verifier","evaluator","subagent"]);let i=De(r.budget,"goal.budget",n);Ue(i,"goal.budget",n,["defaultTokens","defaultMainTurns","defaultActiveSeconds","graceSteps"]);let t=De(r.breaker,"goal.breaker",n);Ue(t,"goal.breaker",n,["repeatedReplyLimit"]);let o=De(r.verifier,"goal.verifier",n);Ue(o,"goal.verifier",n,["repeatedNotMetLimit","evidence"]);let a=De(r.evaluator,"goal.evaluator",n);Ue(a,"goal.evaluator",n,["modelPolicy","maxTokens","timeoutSeconds","maxRetries"]);let l=De(r.subagent,"goal.subagent",n);Ue(l,"goal.subagent",n,["profile","maxTurns","maxTokens","timeoutSeconds"]);let u=io(r.verification,"goal.verification",to,n),f=_e(r.objectiveMaxChars,"goal.objectiveMaxChars",n,{min:1}),s=_e(i.defaultTokens,"goal.budget.defaultTokens",n,{min:1}),c=_e(i.defaultMainTurns,"goal.budget.defaultMainTurns",n,{min:1}),d=_e(i.defaultActiveSeconds,"goal.budget.defaultActiveSeconds",n,{min:1}),p=io(l.profile,"goal.subagent.profile",uo,n),m=_e(l.maxTurns,"goal.subagent.maxTurns",n,{min:1}),h=_e(l.maxTokens,"goal.subagent.maxTokens",n,{min:1}),y=_e(l.timeoutSeconds,"goal.subagent.timeoutSeconds",n,{min:1}),_={...p!==void 0?{profile:p}:{},...m!==void 0?{maxTurns:m}:{},...h!==void 0?{maxTokens:h}:{},...y!==void 0?{timeoutSeconds:y}:{}};return{config:{...f!==void 0?{objectiveMaxChars:f}:{},...u!==void 0?{verification:u}:{},budget:{...s!==void 0?{defaultTokens:s}:{},...c!==void 0?{defaultMainTurns:c}:{},...d!==void 0?{defaultActiveSeconds:d}:{},graceSteps:Be(i.graceSteps,"goal.budget.graceSteps",z.budget.graceSteps,n,{min:0,max:Lr.budget.graceSteps})},breaker:{repeatedReplyLimit:Be(t.repeatedReplyLimit,"goal.breaker.repeatedReplyLimit",z.breaker.repeatedReplyLimit,n,{min:1})},verifier:{repeatedNotMetLimit:Be(o.repeatedNotMetLimit,"goal.verifier.repeatedNotMetLimit",z.verifier.repeatedNotMetLimit,n,{min:1}),evidence:ro(o.evidence,"goal.verifier.evidence",oo,z.verifier.evidence,n)},evaluator:{modelPolicy:ro(a.modelPolicy,"goal.evaluator.modelPolicy",ao,z.evaluator.modelPolicy,n),maxTokens:Be(a.maxTokens,"goal.evaluator.maxTokens",z.evaluator.maxTokens,n,{min:1}),timeoutSeconds:Be(a.timeoutSeconds,"goal.evaluator.timeoutSeconds",z.evaluator.timeoutSeconds,n,{min:1}),maxRetries:Be(a.maxRetries,"goal.evaluator.maxRetries",z.evaluator.maxRetries,n,{min:0,max:Lr.evaluator.maxRetries})},...Object.keys(_).length>0?{subagent:_}:{}},warnings:n}}function De(e,n,r){return e===void 0?{}:e===null||typeof e!="object"||Array.isArray(e)?(r.push(ce(n,"expected an object; using defaults")),{}):e}function Ue(e,n,r,i){for(let t of Object.keys(e))i.includes(t)||r.push(ce(`${n}.${t}`,"unknown key ignored"))}function Be(e,n,r,i,t){return e==null?r:!Number.isInteger(e)||e<t.min?(i.push(ce(n,`expected an integer >= ${t.min}; using default`)),r):t.max!=null&&e>t.max?(i.push(ce(n,`exceeds maximum ${t.max}; clamped`)),t.max):e}function _e(e,n,r,i){if(e!=null){if(!Number.isInteger(e)||e<i.min){r.push(ce(n,`expected an integer >= ${i.min}; ignored`));return}return i.max!=null&&e>i.max?(r.push(ce(n,`exceeds maximum ${i.max}; clamped`)),i.max):e}}function ro(e,n,r,i,t){return e==null?i:typeof e!="string"||!r.includes(e)?(t.push(ce(n,`expected one of: ${r.join(", ")}; using default`)),i):e}function io(e,n,r,i){if(e!=null){if(typeof e!="string"||!r.includes(e)){i.push(ce(n,`expected one of: ${r.join(", ")}; ignored`));return}return e}}function ce(e,n){return`Invalid goal config at ${e}: ${n}`}var ne={enabled:!0,maxInlineKiB:32,mcpDetailsMaxInlineKiB:32,watermarkKiB:256,minSavingsKiB:128,minCandidateKiB:2},js=Math.floor(Number.MAX_SAFE_INTEGER/1024);function Rr(e){let n=$s(e)?e:{};return{enabled:typeof n.enabled=="boolean"?n.enabled:ne.enabled,maxInlineKiB:rn(n.maxInlineKiB,ne.maxInlineKiB),mcpDetailsMaxInlineKiB:rn(n.mcpDetailsMaxInlineKiB,ne.mcpDetailsMaxInlineKiB),watermarkKiB:rn(n.watermarkKiB,ne.watermarkKiB),minSavingsKiB:rn(n.minSavingsKiB,ne.minSavingsKiB),minCandidateKiB:rn(n.minCandidateKiB,ne.minCandidateKiB)}}function rn(e,n){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0&&e<=js?e:n}function $s(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ks(){return process.env.__MAVIS_ALLOW_LEGACY_RUNTIME_ENV==="1"}var so={dev:"test",test:"test",staging:"staging",prod:"prod"};function Ys(e){return e==="cn"||e==="en"}function go(e){return e==="test"||e==="prod"||e==="dev"||e==="staging"}function xo(){let e=process.env.MAVIS_REGION;if(Ys(e))return e;if(In()){let n=process.env.NEXT_PUBLIC_LOCALE;if(n==="zh")return"cn";if(n==="en")return"en"}return"en"}function te(){let e=process.env.MAVIS_BUILD_ENV;if(go(e))return e;if(In()){let n=process.env.NEXT_PUBLIC_BUILD_ENV,r=n&&Object.prototype.hasOwnProperty.call(so,n)?so[n]:void 0;if(r)return r}return"dev"}function Tn(){if(vo("managed"))return!0;let e=process.env.__MAVIS_RUNTIME_MANAGED;return e==="1"?!0:e==="0"?!1:!!(In()||te()==="prod"||te()==="staging")}function In(){let e=process.versions;return process.env.ELECTRON_RUN_AS_NODE==="1"||typeof e.electron=="string"}function On(){return`${xo()}-${te()}`}var ie={none:0,test:1,internal:2,online:3},Hs={internal:"internal",inside:"online"};function Ws(e){for(let[n,r]of Object.entries(e)){if(ie[r.defaultVisibility]>ie[r.configurableVisibility])throw new Error(`Invalid beta feature definition "${n}": defaultVisibility (${r.defaultVisibility}) must not exceed configurableVisibility (${r.configurableVisibility})`);for(let i of r.defaultBuildVariants??[]){let t=Hs[i];if(ie[t]>ie[r.configurableVisibility])throw new Error(`Invalid beta feature definition "${n}": defaultBuildVariant (${i}) must not exceed configurableVisibility (${r.configurableVisibility})`)}for(let i of r.defaultBuildEnvironments??[])if(ie[i==="prod"?"online":"test"]>ie[r.configurableVisibility])throw new Error(`Invalid beta feature definition "${n}": defaultBuildEnvironment (${i}) must not exceed configurableVisibility (${r.configurableVisibility})`)}}var on={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"},cuMode:{defaultVisibility:"online",configurableVisibility:"online"},asr:{defaultVisibility:"internal",configurableVisibility:"internal"},teamPlanWorkspaceCard:{defaultVisibility:"test",configurableVisibility:"online"},teamPlanDrilldown:{defaultVisibility:"test",configurableVisibility:"test"},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:"none",defaultBuildVariants:["internal"],configurableVisibility:"online"}};Ws(on);function qs(e){return(e.buildEnv??te())!=="prod"?"test":e.internalBuild===!0?"internal":"online"}function Xs(e,n){let r=e.defaultBuildVariants;return r?n.internalBuild===!0&&r.includes("internal")||n.insideBuild===!0&&r.includes("inside"):!1}function zs(e,n){let r=n.defaultBuildEnvironment??n.buildEnv??Nr();return e.defaultBuildEnvironments?.includes(r)===!0}function Nr(){let e=In()?process.env.NEXT_PUBLIC_BUILD_ENV:void 0;return go(e)?e:te()}function co(e,n){return e.defaultPlatforms?.includes(n.platform??process.platform)!==!1}function Dr(e,n,r={}){let i=on[e],t=ie[qs(r)],o=r.defaultBuildEnvironment??r.buildEnv??Nr();return e==="mcodeTools"&&o==="dev"&&r.mcodeToolsDevMode==="published"&&co(i,r)?!0:n===!1?!1:n===!0?t<=ie[i.configurableVisibility]:co(i,r)?zs(i,r)||Xs(i,r)?!0:t<=ie[i.defaultVisibility]:!1}function Qs(e){return on[e].configurableVisibility==="online"}function _o(e=process.env){return e.__MAVIS_BUILD_INTERNAL==="true"}function Js(e=process.env){return e.__MAVIS_BUILD_INSIDE==="true"}var bo={APP_DIR:".minimax",ENV_PREFIX:"minimax",CLI_NAME:"minimax"},Ur="__MAVIS_RUNTIME";function Cn(e){return Ks()?process.env[`${Ur}_${e}`]:void 0}function Ln(e){let n=`--${e}`;for(let r=2;r<process.argv.length;r++){let i=process.argv[r];if(i===n)return process.argv[r+1];if(i?.startsWith(`${n}=`))return i.slice(n.length+1)}}function vo(e){let n=`--${e}`;return process.argv.slice(2).some(r=>r===n||r.startsWith(`${n}=`))}var Yd=G.join(yo.homedir(),bo.APP_DIR),ve=5321,Fr=5001,wr=65535,Ao=500,Br=2,Zs=Ao*Br,Eo=Zs+Br,fo=1,ec=new Set(["agent-archon","mavis"]),Hd=`${Ur}_DISABLE_GIT_AUTO_CONFIG`,po=(()=>{let n=new Uint32Array(256);for(let r=0;r<256;r++){let i=r<<24;for(let t=0;t<8;t++)i=(i&2147483648)!==0?79764919^i<<1:i<<1,i>>>=0;n[r]=i>>>0}return n})();function nc(e){let n=Buffer.from(`${e}
36
- `,"utf-8"),r=0;for(let t of n)r=(po[(r>>>24^t)&255]^r<<8)>>>0;let i=n.length;for(;i!==0;)r=(po[(r>>>24^i&255)&255]^r<<8)>>>0,i>>>=8;return(r^4294967295)>>>0}function rc(e){return nc(e)%Ao*Br+2}function mo(e,n){try{let r=Vs("git",e,{encoding:"utf-8",timeout:3e3,stdio:["ignore","pipe","pipe"],...n?{cwd:n}:{}});return r.status===0&&r.stdout?r.stdout.trim():null}catch{return null}}function ic(e){return e.match(/[/:]([^/:]+?)(?:\.git)?$/)?.[1]??null}function So(){return process.env.MINIMAX_DATA_DIR?.trim()||process.env.MAVIS_DATA_DIR?.trim()}function kn(){return!(vo("disable-git-auto-config")||Cn("DISABLE_GIT_AUTO_CONFIG")||Ln("data-dir")||So())}function Rn(){let e=Ln("profile")??Cn("PROFILE");return e&&e.length>0?e:null}function jr(){let e=Ln("port")??Cn("PORT"),n=e?parseInt(e,10):NaN;return Number.isNaN(n)?null:n}function Pr(){let e=Ln("data-dir")??So()??Cn("DATA_DIR");return e&&e.length>0?e:null}function tc(){return!!(Rn()&&Pr())}function Mo(){return!!(Rn()&&jr()!==null)}var be=null;function oc(){be=null}function Ae(){if(be!==null)return be;let e={runtimePort:ve,uiPort:Fr,profile:null,autoDetected:!1};return be=e,e}function ac(){try{if(typeof __dirname=="string")return __dirname}catch{}let e=new Error().stack??"";for(let n of e.split(`
37
- `)){let r=/file:\/\/[^)\s]+/u.exec(n)?.[0]?.replace(/:\d+:\d+$/u,"");if(r)try{return G.dirname(Gs(r))}catch{}let i=/\(?((?:\/|[A-Za-z]:\\)[^()]+?\.(?:cjs|mjs|js|ts)):\d+:\d+\)?/u.exec(n)?.[1];if(i)return G.dirname(i)}}function lc(){let e=Rn();return e||(kn()?Ae().profile:null)}function $r(){let e=Rn();if(tc())return Pr();if(kn()){let r=Ae();if(r.autoDetected&&r.profile)return se({profile:r.profile})}let n=Pr();return n||(e?se({profile:e}):se())}function Ee(){return G.join($r(),"config.yaml")}var uc={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},To={"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},options:{reasoningSummary:"auto"},thinking_config:{mode:"switchable",default_value:"true"},variants:{"none-thinking":{thinking:{type:"disabled"}},thinking:{thinking:{type:"adaptive"}}},capabilities:uc},"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}}},Vr=To,wn={"cn-test":["MiniMax-M3","MiniMax-M2.7-highspeed","MiniMax-M2.7"],"cn-dev":["MiniMax-M3","MiniMax-M2.7-highspeed","MiniMax-M2.7"],"cn-staging":["MiniMax-M3","MiniMax-M2.7-highspeed","MiniMax-M2.7"],"cn-prod":["MiniMax-M3","MiniMax-M2.7-highspeed","MiniMax-M2.7"],"en-test":["MiniMax-M3","MiniMax-M2.7-highspeed","MiniMax-M2.7"],"en-dev":["MiniMax-M3","MiniMax-M2.7-highspeed","MiniMax-M2.7"],"en-staging":["MiniMax-M3","MiniMax-M2.7-highspeed","MiniMax-M2.7"],"en-prod":["MiniMax-M3","MiniMax-M2.7-highspeed","MiniMax-M2.7"]};function sc(e){return Object.fromEntries(wn[e].flatMap(n=>{let r=To[n];return r?[[n,r]]:[]}))}var Fn={"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"},Io=["https://agent.minimaxi.com/mavis/api/v1/llm/v1"],cc=new Set([...Object.values(Fn),...Io]),fc=new Set([...Object.values(Fn),...Io].map(e=>new URL(e).origin));function Oo(e){if(cc.has(e))return!0;try{let n=new URL(e);return!n.username&&!n.password&&fc.has(n.origin)}catch{return!1}}function Co(){return te()==="test"}function dc(){return!Co()}function pc(e){if(!Tn()||!re.existsSync(e))return;let n=Lo(e),{provider:r}=n;if(r==null||typeof r!="object"||Array.isArray(r))return;let{minimax:i}=r;if(i==null||typeof i!="object"||Array.isArray(i))return;let{options:t}=i;if(t==null||typeof t!="object"||Array.isArray(t))return;let o=t.baseURL;if(typeof o!="string")return;let a=Fn[On()];o===a||!Oo(o)||(t.baseURL=a,re.writeFileSync(e,Y.dump(n,{indent:2,lineWidth:-1,noRefs:!0}),"utf-8"))}function fe(e){return{provider:{minimax:{name:"MiniMax",npm:"@ai-sdk/anthropic",options:{authMode:"managed-login",apiKey:"sk-xxx",baseURL:Fn[e]},models:sc(e)}},defaultModel:"minimax/MiniMax-M3"}}var Gr={"cn-test":fe("cn-test"),"cn-dev":fe("cn-dev"),"cn-staging":fe("cn-staging"),"cn-prod":fe("cn-prod"),"en-test":fe("en-test"),"en-dev":fe("en-dev"),"en-staging":fe("en-staging"),"en-prod":fe("en-prod")},O={logLevel:"info",devPort:Fr,permissionMode:"auto",sseErrorPush:{history:!0,stream:!0},beta:Object.fromEntries(Object.keys(on).map(e=>[e,Dr(e,void 0,{buildEnv:"dev"})])),agents:{default:{}},memory:{enabled:!0,proactive:!1,dailyDigest:{enabled:!1}},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:{...vn},nd:{...dr},skills:En,askUser:{enabled:!0},sessionTitle:{enabled:!0},cli:{spawn:{enabled:!1}},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},toolResultCompaction:{...ne},agentRuntime:{defaultFramework:Pe},logRetentionDays:3,cuBackend:en,review:{mode:"subagent"},goal:structuredClone(z),goalWarnings:[]};function mc(){let e=Ee(),n=G.dirname(e);if(re.existsSync(n)||re.mkdirSync(n,{recursive:!0}),re.existsSync(e)){Kr(e);return}if(!Tn()){let t=se({homeDir:yo.homedir()}),o=G.join(t,"config.yaml");e!==o&&re.existsSync(o)&&re.copyFileSync(o,e);return}let r=Gr[On()],i=Y.dump({logLevel:O.logLevel,provider:r.provider,defaultModel:r.defaultModel});re.writeFileSync(e,i,"utf-8")}function Lo(e=Ee()){try{let n=re.readFileSync(e,"utf-8"),r=Y.load(n);return r!=null&&typeof r=="object"&&!Array.isArray(r)?r:{}}catch{return{}}}var tn=null;function hc(e){if(e==null||typeof e!="object"||Array.isArray(e))return;let n=e;return{branchFinish:typeof n.branchFinish=="boolean"?n.branchFinish:!1}}var ko={isManagedRuntime:Tn,shouldEnforceManagedProviderProtection:dc,getManagedPreset:()=>Gr[On()],isManagedPresetBaseUrl:Oo},Ro=!0;function yc(e){Ro=e}function Kr(e){Ro&&Tt(e,ko),pc(e)}function je(){tn=null}function $e(){if(tn)return tn;mc();let e=Lo();return tn=Yr(e,$r()),tn}function Yr(e,n){let r=e.sseErrorPush,i=r!=null&&typeof r=="object"&&!Array.isArray(r)?r:void 0,t,o=jr();if(kn()&&!Mo()){let l=Ae();l.autoDetected?t=l.uiPort:t=typeof e.devPort=="number"?e.devPort:O.devPort}else t=typeof e.devPort=="number"?e.devPort:O.devPort;let a=kr(e.goal);return{logLevel:typeof e.logLevel=="string"?e.logLevel:O.logLevel,devPort:t,...It({provider:e.provider!=null&&typeof e.provider=="object"&&!Array.isArray(e.provider)?Et(e.provider):{},defaultModel:typeof e.defaultModel=="string"?e.defaultModel:void 0},ko),defaultModelVariant:typeof e.defaultModelVariant=="string"?e.defaultModelVariant:void 0,minimax_api:vt(e.minimax_api),custom_provider:At(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 l={};typeof Reflect.get(e.nexus,"enabled")=="boolean"&&(l.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"&&(l.model={providerID:Reflect.get(u,"providerID"),modelID:Reflect.get(u,"modelID"),...typeof Reflect.get(u,"variant")=="string"?{variant:Reflect.get(u,"variant")}:{}}),Object.keys(l).length>0?l: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:O.permissionMode,permission:Nt(e),sseErrorPush:{history:typeof i?.history=="boolean"?i.history:O.sseErrorPush.history,stream:typeof i?.stream=="boolean"?i.stream:O.sseErrorPush.stream},notifications:hc(e.notifications),dataDir:n,agentsDir:G.join(n,"agents"),sessionsDir:G.join(n,"sessions"),memoryDir:G.join(n,"memory"),skillsDir:G.join(n,"skills"),builtinSkillsDir:G.join(n,".builtin-skills"),logsDir:G.join(n,"logs"),pluginsDir:G.join(n,"plugins"),plansDir:G.join(n,"plans"),harnessesDir:G.join(n,"harnesses"),subAgentsDir:G.join(n,"subagents"),beta:wo(e),agents:Cr(e.agents),memory:xc(e),skillEvolve:vc(e),sessionRotate:Ac(e),agentStop:Ec(e),asr:Ft(e),nd:Pt(e,te()),skills:pr(e),askUser:Sc(e),sessionTitle:Mc(e),cli:Ic(e),tui:Tc(e),opencode:Oc(e),contextManagement:Cc(e),toolResultCompaction:Rr(e.toolResultCompaction),agentRuntime:mr(e.agentRuntime),logRetentionDays:Lc(e),contentReview:kc(e),mcpToolSearch:Rc(e),cuBackend:nn(e.cuBackend),review:gc(e.review),goal:a.config,goalWarnings:a.warnings}}function gc(e){if(e==null||typeof e!="object"||Array.isArray(e))return O.review;let n=Reflect.get(e,"mode");return{mode:n==="inline"||n==="subagent"?n:O.review.mode}}function xc(e){let n=e.memory,r=n!=null&&typeof n=="object"&&!Array.isArray(n)?n:{},i=r.dailyDigest,t=i!=null&&typeof i=="object"&&!Array.isArray(i)?i:{};return{enabled:typeof r.enabled=="boolean"?r.enabled:O.memory.enabled,proactive:typeof r.proactive=="boolean"?r.proactive:O.memory.proactive,dailyDigest:{enabled:typeof t.enabled=="boolean"?t.enabled:O.memory.dailyDigest.enabled}}}function wo(e){let n=e.beta!=null&&typeof e.beta=="object"&&!Array.isArray(e.beta)?e.beta:{},r={};for(let i of Object.keys(on))r[i]=Dr(i,n[i],{buildEnv:te(),defaultBuildEnvironment:Nr(),internalBuild:_o(),insideBuild:Js(),mcodeToolsDevMode:process.env.MAVIS_DEV_MCODE_TOOLS_MODE==="published"?"published":void 0});return r}function _c(e){let n=e.provider;if(n==null||typeof n!="object"||Array.isArray(n))return[];let r=[];for(let i of Object.values(n)){if(i==null||typeof i!="object"||Array.isArray(i))continue;let{models:t}=i;t==null||typeof t!="object"||Array.isArray(t)||r.push(...Object.keys(t))}return r}function bc(e,n){if(n.length===0)return!0;let r=_c(e);if(r.length===0)return!1;let i=n.map(t=>t.toLowerCase());return!r.every(t=>i.some(o=>t.toLowerCase().startsWith(o)))}function ho(e,n){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:n}function vc(e){let n=O.skillEvolve,r=e.skillEvolve,t=r!=null&&typeof r=="object"&&!Array.isArray(r)?r:{},o=t.inSession,{inSession:a}=n;if(o!=null&&typeof o=="object"&&!Array.isArray(o)){let v=o;a={N:typeof v.N=="number"&&v.N>0?v.N:n.inSession.N,minIntervalSeconds:typeof v.minIntervalSeconds=="number"&&v.minIntervalSeconds>=0?v.minIntervalSeconds:n.inSession.minIntervalSeconds,maxPendingPerSession:typeof v.maxPendingPerSession=="number"&&v.maxPendingPerSession>=1?v.maxPendingPerSession:n.inSession.maxPendingPerSession}}let l=t.excludeAgents,u=Array.isArray(l)&&l.every(v=>typeof v=="string")?l:n.excludeAgents,f=Array.isArray(t.disableModelPrefixes)&&t.disableModelPrefixes.every(v=>typeof v=="string")?t.disableModelPrefixes:n.disableModelPrefixes,s=wo(e),c=s.skillEvolve?typeof t.enabled=="boolean"?t.enabled:bc(e,f):!1,d=c&&s.skillEvolveBuiltinMr?typeof t.builtinMrEnabled=="boolean"?t.builtinMrEnabled:n.builtinMrEnabled:!1,p=t.sourceRepo,m=typeof p=="string"&&p.trim().length>0?p.trim():n.sourceRepo,h=t.proposal,y=n.proposal,_=h!=null&&typeof h=="object"&&!Array.isArray(h)?h:{},x=Array.isArray(_.eligibleAgents)&&_.eligibleAgents.every(v=>typeof v=="string")?_.eligibleAgents:y.eligibleAgents,k=typeof _.minMessageCount=="number"&&_.minMessageCount>=1?Math.floor(_.minMessageCount):y.minMessageCount,ye=typeof _.skipPassiveSessionEnd=="boolean"?_.skipPassiveSessionEnd:y.skipPassiveSessionEnd,cn=typeof _.enabled=="boolean"?_.enabled:null,fn=c&&s.skillProposal?cn??!0:!1,Ce=t.lifecycle,Le=Ce&&typeof Ce=="object"&&!Array.isArray(Ce)?Ce:{},b=ho(Le.staleThresholdDays,n.lifecycle.staleThresholdDays),A=ho(Le.archiveThresholdDays,n.lifecycle.archiveThresholdDays);if(!(b<A))throw new Error(`Invalid skillEvolve.lifecycle config: staleThresholdDays (${b}) must be strictly less than archiveThresholdDays (${A}).`);return{enabled:c,inSession:a,signalCooldownHours:typeof t.signalCooldownHours=="number"&&t.signalCooldownHours>0?t.signalCooldownHours:n.signalCooldownHours,minConfidence:typeof t.minConfidence=="number"&&t.minConfidence>=0&&t.minConfidence<=1?t.minConfidence:n.minConfidence,scannerModel:typeof t.scannerModel=="string"?t.scannerModel:void 0,excludeAgents:u,disableModelPrefixes:f,builtinMrEnabled:d,sourceRepo:m,proposal:{enabled:fn,eligibleAgents:x,minMessageCount:k,skipPassiveSessionEnd:ye},lifecycle:{staleThresholdDays:b,archiveThresholdDays:A}}}function Ac(e){let n=O.sessionRotate,r=e.sessionRotate;if(r==null||typeof r!="object"||Array.isArray(r))return{...n};let i=r,t=i.activeSessionLookbackHours;return{enabled:typeof i.enabled=="boolean"?i.enabled:n.enabled,activeSessionLookbackHours:typeof t=="number"&&Number.isFinite(t)&&t>0?t:n.activeSessionLookbackHours}}function Ec(e){let n=O.agentStop,r=e.agentStop;if(r==null||typeof r!="object"||Array.isArray(r))return{...n};let i=r,t=i.debounceMs,o=i.maxActiveSpanMs;return{debounceMs:typeof t=="number"&&Number.isFinite(t)&&t>=0?t:n.debounceMs,maxActiveSpanMs:typeof o=="number"&&Number.isFinite(o)&&o>=0?o:n.maxActiveSpanMs}}function Sc(e){let n=O.askUser,r=e.askUser;if(r==null||typeof r!="object"||Array.isArray(r))return{...n};let i=r;return{enabled:typeof i.enabled=="boolean"?i.enabled:n.enabled}}function Mc(e){let n=O.sessionTitle,r=e.sessionTitle;if(r==null||typeof r!="object"||Array.isArray(r))return{...n};let i=r;return{enabled:typeof i.enabled=="boolean"?i.enabled:n.enabled}}function Tc(e){let n=e.tui;if(n==null||typeof n!="object"||Array.isArray(n))return{};let r=n,i=r.statusLine,t=Array.isArray(i)?i.filter(o=>typeof o=="string").map(o=>o.trim()).filter(Boolean):void 0;return{...typeof r.showTips=="boolean"?{showTips:r.showTips}:{},...t?{statusLine:t}:{}}}function Ic(e){let n=O.cli,r=e.cli;if(r==null||typeof r!="object"||Array.isArray(r))return{spawn:{...n.spawn}};let i=r.spawn;if(i==null||typeof i!="object"||Array.isArray(i))return{spawn:{...n.spawn}};let t=i;return{spawn:{enabled:typeof t.enabled=="boolean"?t.enabled:n.spawn.enabled}}}function Oc(e){return Rt(e,{keepAlive:O.opencode.keepAlive,xdg:O.opencode.xdg,spawnConcurrency:O.opencode.spawnConcurrency})}function Cc(e){let n=O.contextManagement,r=e.contextManagement;if(r==null||typeof r!="object"||Array.isArray(r))return{disableSystemReminderModels:[...n.disableSystemReminderModels],cuMaxScreenshotsInContext:n.cuMaxScreenshotsInContext};let i=r,t=i.disableSystemReminderModels,o=Array.isArray(t)&&t.every(u=>typeof u=="string"&&u.length>0)?t:[...n.disableSystemReminderModels],a=i.cuMaxScreenshotsInContext,l=typeof a=="number"&&Number.isFinite(a)&&a>=0?Math.floor(a):n.cuMaxScreenshotsInContext;return{disableSystemReminderModels:o,cuMaxScreenshotsInContext:l}}function Lc(e){let n=e.logRetentionDays;return typeof n=="number"&&n>=1&&Number.isFinite(n)?Math.floor(n):O.logRetentionDays}function kc(e){let n=e.contentReview;if(n==null||typeof n!="object"||Array.isArray(n))return;let r={},i=Reflect.get(n,"enabled");typeof i=="boolean"&&(r.enabled=i);let t=Reflect.get(n,"testBaseURL");return typeof t=="string"&&t.trim()&&(r.testBaseURL=t.trim()),Object.keys(r).length>0?r:void 0}function Rc(e){let n=e.mcpToolSearch;if(n==null||typeof n!="object"||Array.isArray(n))return;let r={},i=Reflect.get(n,"enabled");typeof i=="boolean"&&(r.enabled=i);let t=Reflect.get(n,"systemHint");typeof t=="boolean"&&(r.systemHint=t);let o=Reflect.get(n,"thresholdPct");typeof o=="number"&&(r.thresholdPct=o);let a=Reflect.get(n,"minDeferCount");typeof a=="number"&&(r.minDeferCount=a);let l=Reflect.get(n,"topKDefault");typeof l=="number"&&(r.topKDefault=l);let u=Reflect.get(n,"topKMax");typeof u=="number"&&(r.topKMax=u);let f=Reflect.get(n,"maxSchemaTextLen");typeof f=="number"&&(r.maxSchemaTextLen=f);let s=Reflect.get(n,"modelWhitelist");return Array.isArray(s)&&(r.modelWhitelist=s.filter(c=>typeof c=="string")),Object.keys(r).length>0?r:void 0}function Fo(){let e=jr();if(kn()&&!Mo()){let n=Ae();return n.autoDetected?n.runtimePort:e??ve}return e??ve}function wc(e=Fo()){let n=e+Eo;if(n<=wr)return n;let r=e+fo;if(r<=wr)return r;throw new Error(`Cannot allocate an OpenCode sidecar port for runtime port ${String(e)}; choose a runtime port <= ${String(wr-fo)}.`)}var Fc=["agent.minimaxi.com","agent.minimaxi.com","agent.minimax.io","agent.minimax.io","agent.minimax.io","agent.minimax.cn","agent.minimaxi.com"],Pc=new Set(Fc.map(e=>`https://${e}`));function Po(e){try{let n=new URL(e);return n.username||n.password?!1:Pc.has(n.origin.toLowerCase())}catch{return!1}}function Nc(e){if(!(e!=="managed-login"&&e!=="api-key"&&e!=="oauth"))return e}function Hr(e){let n=typeof e?.baseURL=="string"?e.baseURL.trim():"",r=n.length>0&&Po(n),i=Nc(e?.authMode),t=[];return typeof e?.authMode=="string"&&!i&&t.push(`Unknown provider authMode "${e.authMode}"; falling back to compatibility resolution.`),i?(i==="managed-login"&&n.length>0&&!r&&!e?.allowManagedBaseURLOverride&&t.push("Provider authMode is managed-login but baseURL is not a known managed MiniMax host."),{authMode:i,source:"explicit",managedBaseURL:r,warnings:t}):r?(t.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:r,warnings:t}):{authMode:"api-key",source:"default-api-key",managedBaseURL:r,warnings:t}}var Ve="minimax",Wr="minimax_api",qr="custom_provider:";function Dc(e,n){return e==="anthropic-messages"&&(n===Ve||n===Wr)}function Xr(e,n){if(n===Wr)return"minimax_api_key";if(n.startsWith(qr))return"custom_provider";if(n!==Ve)return"configured_provider";if(e.minimaxModelSource==="minimax_api_key")return"minimax_api_key";let r=e.provider?.[n]?.options;return Hr({authMode:r?.authMode,baseURL:r?.baseURL}).authMode==="managed-login"?"managed_token_plan":"configured_provider"}function No(e,n,r){switch(Xr(e,n)){case"managed_token_plan":{let t=wn[r],o=Pn(e.provider?.[n]);return o.length===0?t:t.filter(a=>o.includes(a))}case"minimax_api_key":{let t=Object.keys(Vr),o=Pn(e.provider?.[Ve]);return[...t,...o.filter(a=>!t.includes(a))]}case"custom_provider":{let t=e.custom_provider?.[n.slice(qr.length)];return!t||t.enabled===!1?[]:Pn(t)}case"configured_provider":return Pn(e.provider?.[n])}}function Uc(e){let n=Xr(e.config,e.providerId),r=e.modelId.trim();return r.length>0&&No(e.config,e.providerId,e.preset).includes(r)?{available:!0,route:n}:{available:!1,route:n,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 "${n}" route (preset ${e.preset}).`}}function Pn(e){return Object.entries(e?.models??{}).filter(([,n])=>n?.enabled!==!1).map(([n])=>n)}import{randomBytes as hf}from"node:crypto";import Oe,{existsSync as yf,readFileSync as gf}from"node:fs";import{dirname as ha,join as xf}from"node:path";var ya=Sa(ma(),1);var ga=384,ci=new Set(["__proto__","prototype","constructor"]),_f=["minimax_api","custom_provider"];async function bf(e){let n=e.trim();if(!n||n.includes(".")||ci.has(n))throw new J("Invalid provider id");return Wn(async r=>(me(r.provider)&&delete r.provider[n],{write:!0,value:void 0})).then(({config:r})=>({config:r}))}var J=class extends Error{name="LocalModelProviderConfigValidationError"},sn=class extends Error{name="LocalModelProviderConfigWriteError";constructor(){super("Local runtime failed to update config file")}};async function vf(e){return Wn(async(n,r)=>{let i={minimax_api:me(n.minimax_api)?n.minimax_api:void 0,custom_provider:If(me(n.custom_provider)?n.custom_provider:void 0),minimaxModelSource:typeof n.minimaxModelSource=="string"?n.minimaxModelSource:void 0,defaultModel:typeof n.defaultModel=="string"?n.defaultModel:void 0,defaultModelVariant:typeof n.defaultModelVariant=="string"?n.defaultModelVariant:void 0};await e(i,r);for(let t of _f){let o=i[t];if(o===void 0){delete n[t];continue}if(!me(o))throw new J(`Invalid BYOK config subtree "${t}"`);fi(o),n[t]=o}return si(n,"minimaxModelSource",i.minimaxModelSource),si(n,"defaultModel",i.defaultModel),si(n,"defaultModelVariant",i.defaultModelVariant),{write:!0,value:void 0}}).then(({config:n})=>({config:n}))}async function Af(e){let n=e.modelKey.trim();if(!n)throw new J("Default model must not be empty");return Wn(async r=>(r.defaultModel=n,e.variant===void 0?delete r.defaultModelVariant:r.defaultModelVariant=e.variant,{write:!0,value:void 0})).then(({config:r})=>({config:r}))}async function Ef(e,n){if(e.providerId!==Ve||e.modelId!=="MiniMax-M3")throw new J("Invalid MiniMax model context target");let r=await Wn(async(i,t)=>t.provider?.[e.providerId]?.models?.[e.modelId]?.limit?.context!==e.expectedContextLimit?{write:!1,value:!1}:await n(t)?(Of(i,["provider",e.providerId,"models",e.modelId,"limit","context"],e.contextLimit),{write:!0,value:!0}):{write:!1,value:!1});return{config:r.config,updated:r.value}}async function Wn(e){let n=Ee(),r;try{await Oe.promises.mkdir(ha(n),{recursive:!0}),await Oe.promises.writeFile(n,"",{flag:"a",mode:ga}),r=await ya.default.lock(n,{stale:1e4,retries:{retries:20,factor:1,minTimeout:5,maxTimeout:25}});let i=Tf(n);je();let t=await e(i,$e());return t.write&&(fi(i),await Sf(n,Y.dump(i,{indent:2,lineWidth:-1,noRefs:!0})),je()),{config:$e(),value:t.value}}catch(i){throw i instanceof J||i instanceof sn?i:new sn}finally{await r?.().catch(()=>{})}}async function Sf(e,n){let r=xf(ha(e),`.config-tmp-${hf(6).toString("hex")}`);try{let i=await Mf(e);await Oe.promises.writeFile(r,n,{encoding:"utf-8",mode:i}),await Oe.promises.chmod(r,i),await Oe.promises.rename(r,e)}catch{throw await Oe.promises.unlink(r).catch(()=>{}),new sn}}async function Mf(e){try{return(await Oe.promises.stat(e)).mode&511}catch(n){if(Cf(n)&&n.code==="ENOENT")return ga;throw n}}function Tf(e){if(!yf(e))return{};try{let n=Y.load(gf(e,"utf-8"));return me(n)?n:{}}catch{return{}}}function If(e){if(e)return Object.fromEntries(Object.entries(e).filter(([,n])=>me(n)))}function si(e,n,r){r===void 0?delete e[n]:e[n]=r}function Of(e,n,r){let i=n.at(-1);if(!i)throw new J("Invalid config path");let t=e;for(let o of n.slice(0,-1)){if(!o||ci.has(o))throw new J("Invalid config path");let a=t[o];if(me(a))t=a;else{let l={};t[o]=l,t=l}}t[i]=r}function fi(e){for(let[n,r]of Object.entries(e)){if(!n||ci.has(n))throw new J(`Local runtime cannot update config field segment "${n}"`);me(r)&&fi(r)}}function Cf(e){return e instanceof Error&&"code"in e}function me(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Bf(e){let n=e.trim();if(!n)return null;if(n.startsWith("{"))try{let i=JSON.parse(n),t=typeof i.pid=="number"?i.pid:parseInt(String(i.pid),10);if(isNaN(t)||t<=0)return null;let o=jf(i.owner)?i.owner:"unknown",a=$f(i.startedAt);return{pid:t,owner:o,...a!==void 0?{startedAt:a}:{},...typeof i.mode=="string"?{mode:i.mode}:{},...typeof i.startupToken=="string"?{startupToken:i.startupToken}:{}}}catch{return null}let r=parseInt(n,10);return isNaN(r)||r<=0?null:{pid:r,owner:"unknown"}}function jf(e){return e==="electron"||e==="cli"||e==="unknown"}function $f(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e!="string")return;let n=new Date(e).getTime();return Number.isFinite(n)?n:void 0}function Vf(e,n){let r={pid:e,owner:n,startedAt:Date.now()};return JSON.stringify(r)}function Gf(){let e=process.argv.slice(2);for(let n=0;n<e.length;n++){let r=e[n],i=r==="--owner"?e[n+1]:r?.startsWith("--owner=")?r.slice(8):void 0;if(i==="electron")return"electron";if(i==="service"||i==="cli")return"cli"}return"cli"}import he from"node:fs";import Kf from"node:path";var xa="local-runtime.auth.json";function Z(e){return typeof e=="string"&&e.trim().length>0?e.trim():void 0}function di(e){return e?{...Z(e.accessToken)?{accessToken:Z(e.accessToken)}:{},...Z(e.realUserID)?{realUserID:Z(e.realUserID)}:{},...Z(e.userEmail)?{userEmail:Z(e.userEmail)}:{},...Z(e.userName)?{userName:Z(e.userName)}:{},...Z(e.subUserName)?{subUserName:Z(e.subUserName)}:{}}:{}}function qn(e){return Kf.join(e,xa)}function Yf(e){try{let n=he.readFileSync(qn(e),"utf-8"),r=JSON.parse(n);if(r.version!==1||!r.auth||typeof r.auth!="object")return;let i=di(r.auth);return i.accessToken?i:void 0}catch{return}}function Hf(e,n,r={}){let i=qn(e),t=di(n);if(!t.accessToken)return _a(e),{path:i,written:!1};he.mkdirSync(e,{recursive:!0,mode:448});let o={version:1,updatedAtMs:Date.now(),auth:t},a=`${i}.${process.pid}.${Date.now()}.tmp`;return he.writeFileSync(a,`${JSON.stringify(o,null,2)}
38
- `,{encoding:"utf-8",mode:384}),r.retryWindowsFileSystem?(Xn(()=>he.renameSync(a,i)),Xn(()=>he.chmodSync(i,384))):(he.renameSync(a,i),he.chmodSync(i,384)),{path:i,written:!0}}function _a(e){try{he.rmSync(qn(e),{force:!0})}catch{}}import ba from"node:net";var va={"e2e-runtime":5e3,"e2e-ui":5500,"smoke-runtime":7e3},pi=100;async function Wf(e,n={}){let r=n.isPortFree??Xf,i=n.getFreePort??zf,t=n.getWorktreeBasePort??qf,o=t()+va[e],a=o-t();if(a<pi)throw new Error(`pickTestPort(${e}): role offset ${a} collides with app runtime (0); must be >= ${pi}.`);return o>65535?i():await r(o)?o:i()}function qf(){let e=Ae();return e.autoDetected?e.runtimePort:ve}async function Xf(e){return new Promise(n=>{let r=ba.createServer();r.once("error",()=>n(!1)),r.listen(e,"127.0.0.1",()=>{r.close(()=>n(!0))})})}async function zf(){return new Promise((e,n)=>{let r=ba.createServer();r.listen(0,"127.0.0.1",()=>{let i=r.address();if(i&&typeof i!="string"){let{port:t}=i;r.close(()=>e(t))}else r.close(()=>n(new Error("Failed to get free port")))}),r.on("error",n)})}import mi from"node:fs";import Qf from"node:path";var Jf=new Set(["native","mcp"]);function Aa(){return nn($e().cuBackend)}function Zf(e){if(!Jf.has(e))throw new Error(`invalid cuBackend value: ${String(e)}`);let n=Ee(),r={};try{let i=mi.readFileSync(n,"utf-8"),t=Y.load(i);t!=null&&typeof t=="object"&&!Array.isArray(t)&&(r=t)}catch{}r.cuBackend=e,mi.mkdirSync(Qf.dirname(n),{recursive:!0}),mi.writeFileSync(n,Y.dump(r),"utf-8"),je()}function ed(e=Aa()){kt(e)}import Ea from"node:fs";var qe=class extends Error{code;configPath;constructor(n,r,i,t){super(i,t),this.name="ConfigFileError",this.code=n,this.configPath=r}};function nd(e,n){Ea.existsSync(e)&&Kr(e);let r;try{r=Ea.readFileSync(e,"utf-8")}catch(t){throw new qe("CONFIG_READ_FAILED",e,`Cannot read config ${e}.`,{cause:t})}let i;try{i=Y.load(r)}catch(t){throw new qe("CONFIG_PARSE_FAILED",e,`Config is not valid YAML: ${e}`,{cause:t})}if(i==null||typeof i!="object"||Array.isArray(i))throw new qe("CONFIG_ROOT_INVALID",e,`Config root must be an object: ${e}`);return Yr(i,n.dataDir)}export{ma as a,Y as b,qu as c,en as d,nn as e,Dt as f,En as g,pr as h,bs as i,Bt as j,Pe as k,jt as l,mr as m,Ht as n,Wt as o,Xt as p,zt as q,se as r,Cs as s,Ls as t,Tr as u,Ir as v,Or as w,Jt as x,Cr as y,Fs as z,Ns as A,Ds as B,Us as C,Bs as D,to as E,oo as F,ao as G,lo as H,uo as I,z as J,Lr as K,kr as L,ne as M,Rr as N,xo as O,te as P,Tn as Q,On as R,Dr as S,Qs as T,_o as U,bo as V,Ur as W,ve as X,Eo as Y,oc as Z,Ae as _,lc as $,$r as aa,Ee as ba,Vr as ca,wn as da,Co as ea,Gr as fa,yc as ga,je as ha,$e as ia,Fo as ja,wc as ka,Po as la,Hr as ma,Ve as na,Wr as oa,qr as pa,Dc as qa,Xr as ra,No as sa,Uc as ta,bf as ua,vf as va,Af as wa,Ef as xa,Bf as ya,Vf as za,Gf as Aa,xa as Ba,di as Ca,qn as Da,Yf as Ea,Hf as Fa,_a as Ga,va as Ha,pi as Ia,Wf as Ja,Aa as Ka,Zf as La,ed as Ma,qe as Na,nd as Oa};
33
+ `+e.slice(a+1):u+=e.slice(t),u.slice(1)}function Su(e){for(var n="",r=0,i,t=0;t<e.length;r>=65536?t+=2:t++)r=Xe(e,t),i=V[r],!i&&Ze(r)?(n+=e[t],r>=65536&&(n+=e[t+1])):n+=i||hu(r);return n}function Mu(e,n,r){var i="",t=e.tag,o,a,l;for(o=0,a=r.length;o<a;o+=1)l=r[o],e.replacer&&(l=e.replacer.call(r,String(o),l)),(ee(e,n,l,!1,!1)||typeof l>"u"&&ee(e,n,null,!1,!1))&&(i!==""&&(i+=","+(e.condenseFlow?"":" ")),i+=e.dump);e.tag=t,e.dump="["+i+"]"}function Li(e,n,r,i){var t="",o=e.tag,a,l,u;for(a=0,l=r.length;a<l;a+=1)u=r[a],e.replacer&&(u=e.replacer.call(r,String(a),u)),(ee(e,n+1,u,!0,!0,!1,!0)||typeof u>"u"&&ee(e,n+1,null,!0,!0,!1,!0))&&((!i||t!=="")&&(t+=nr(e,n)),e.dump&&Qe===e.dump.charCodeAt(0)?t+="-":t+="- ",t+=e.dump);e.tag=o,e.dump=t||"[]"}function Tu(e,n,r){var i="",t=e.tag,o=Object.keys(r),a,l,u,f,s;for(a=0,l=o.length;a<l;a+=1)s="",i!==""&&(s+=", "),e.condenseFlow&&(s+='"'),u=o[a],f=r[u],e.replacer&&(f=e.replacer.call(r,u,f)),ee(e,n,u,!1,!1)&&(e.dump.length>1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),ee(e,n,f,!1,!1)&&(s+=e.dump,i+=s));e.tag=t,e.dump="{"+i+"}"}function Iu(e,n,r,i){var t="",o=e.tag,a=Object.keys(r),l,u,f,s,c,d;if(e.sortKeys===!0)a.sort();else if(typeof e.sortKeys=="function")a.sort(e.sortKeys);else if(e.sortKeys)throw new K("sortKeys must be a boolean or a function");for(l=0,u=a.length;l<u;l+=1)d="",(!i||t!=="")&&(d+=nr(e,n)),f=a[l],s=r[f],e.replacer&&(s=e.replacer.call(r,f,s)),ee(e,n+1,f,!0,!0,!0)&&(c=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,c&&(e.dump&&Qe===e.dump.charCodeAt(0)?d+="?":d+="? "),d+=e.dump,c&&(d+=nr(e,n)),ee(e,n+1,s,!0,c)&&(e.dump&&Qe===e.dump.charCodeAt(0)?d+=":":d+=": ",d+=e.dump,t+=d));e.tag=o,e.dump=t||"{}"}function ki(e,n,r){var i,t,o,a,l,u;for(t=r?e.explicitTypes:e.implicitTypes,o=0,a=t.length;o<a;o+=1)if(l=t[o],(l.instanceOf||l.predicate)&&(!l.instanceOf||typeof n=="object"&&n instanceof l.instanceOf)&&(!l.predicate||l.predicate(n))){if(r?l.multi&&l.representName?e.tag=l.representName(n):e.tag=l.tag:e.tag="?",l.represent){if(u=e.styleMap[l.tag]||l.defaultStyle,st.call(l.represent)==="[object Function]")i=l.represent(n,u);else if(ct.call(l.represent,u))i=l.represent[u](n,u);else throw new K("!<"+l.tag+'> tag resolver accepts not "'+u+'" style');e.dump=i}return!0}return!1}function ee(e,n,r,i,t,o,a){e.tag=null,e.dump=r,ki(e,r,!1)||ki(e,r,!0);var l=st.call(e.dump),u=i,f;i&&(i=e.flowLevel<0||e.flowLevel>n);var s=l==="[object Object]"||l==="[object Array]",c,d;if(s&&(c=e.duplicates.indexOf(r),d=c!==-1),(e.tag!==null&&e.tag!=="?"||d||e.indent!==2&&n>0)&&(t=!1),d&&e.usedDuplicates[c])e.dump="*ref_"+c;else{if(s&&d&&!e.usedDuplicates[c]&&(e.usedDuplicates[c]=!0),l==="[object Object]")i&&Object.keys(e.dump).length!==0?(Iu(e,n,e.dump,t),d&&(e.dump="&ref_"+c+e.dump)):(Tu(e,n,e.dump),d&&(e.dump="&ref_"+c+" "+e.dump));else if(l==="[object Array]")i&&e.dump.length!==0?(e.noArrayIndent&&!a&&n>0?Li(e,n-1,e.dump,t):Li(e,n,e.dump,t),d&&(e.dump="&ref_"+c+e.dump)):(Mu(e,n,e.dump),d&&(e.dump="&ref_"+c+" "+e.dump));else if(l==="[object String]")e.tag!=="?"&&Au(e,e.dump,n,o,u);else{if(l==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new K("unacceptable kind of an object to dump "+l)}e.tag!==null&&e.tag!=="?"&&(f=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?f="!"+f:f.slice(0,18)==="tag:yaml.org,2002:"?f="!!"+f.slice(18):f="!<"+f+">",e.dump=f+" "+e.dump)}return!0}function Ou(e,n){var r=[],i=[],t,o;for(ir(e,r,i),t=0,o=i.length;t<o;t+=1)n.duplicates.push(r[i[t]]);n.usedDuplicates=new Array(o)}function ir(e,n,r){var i,t,o;if(e!==null&&typeof e=="object")if(t=n.indexOf(e),t!==-1)r.indexOf(t)===-1&&r.push(t);else if(n.push(e),Array.isArray(e))for(t=0,o=e.length;t<o;t+=1)ir(e[t],n,r);else for(i=Object.keys(e),t=0,o=i.length;t<o;t+=1)ir(e[i[t]],n,r)}function Cu(e,n){n=n||{};var r=new gu(n);r.noRefs||Ou(e,r);var i=e;return r.replacer&&(i=r.replacer.call({"":i},"",i)),ee(r,0,i,!0,!0)?r.dump+`
34
+ `:""}var Lu=Cu,ku={dump:Lu};function sr(e,n){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+n+" instead, which is now safe by default.")}}var Ru=j,wu=Pi,Pu=Ui,Fu=Gi,Nu=Ki,Du=or,Uu=ut.load,Bu=ut.loadAll,ju=ku.dump,$u=K,Vu={binary:Xi,float:Vi,map:Di,null:Bi,pairs:Qi,set:Ji,timestamp:Wi,bool:ji,int:$i,merge:qi,omap:zi,seq:Ni,str:Fi},Gu=sr("safeLoad","load"),Ku=sr("safeLoadAll","loadAll"),Yu=sr("safeDump","dump"),Y={Type:Ru,Schema:wu,FAILSAFE_SCHEMA:Pu,JSON_SCHEMA:Fu,CORE_SCHEMA:Nu,DEFAULT_SCHEMA:Du,load:Uu,loadAll:Bu,dump:ju,YAMLException:$u,types:Vu,safeLoad:Gu,safeLoadAll:Ku,safeDump:Yu};function bt(e){let n=e.tui;if(n==null||typeof n!="object"||Array.isArray(n))return{};let r=n,i=r.notifications,t;if(i&&typeof i=="object"&&!Array.isArray(i)){let{when:l,method:u}=i;t={...l==="unfocused"||l==="always"||l==="never"?{when:l}:{},...u==="auto"||u==="osc9"||u==="osc777"||u==="bel"?{method:u}:{}}}let o=r.statusLine,a=Array.isArray(o)?o.filter(l=>typeof l=="string").map(l=>l.trim()).filter(Boolean):void 0;return{...typeof r.showTips=="boolean"?{showTips:r.showTips}:{},...t?{notifications:t}:{},...a?{statusLine:a}:{}}}import{createHash as Hu}from"node:crypto";import xn from"node:fs";import vt from"node:path";function St(e){if(e==null||typeof e!="object"||Array.isArray(e))return;let n=e,r={};return typeof n.apiKey=="string"&&(r.apiKey=n.apiKey),typeof n.baseURL=="string"&&(r.baseURL=n.baseURL),Object.keys(r).length>0?r:void 0}function Mt(e){if(e==null||typeof e!="object"||Array.isArray(e))return;let n=Object.entries(e).filter(([,r])=>r!=null&&typeof r=="object"&&!Array.isArray(r));if(n.length!==0)return Object.fromEntries(n.map(([r,i])=>[r,It(i)]))}function Tt(e){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,S(r)?It(r):r]))}function It(e){if(!S(e.models))return e;let n=!1,r=Object.fromEntries(Object.entries(e.models).map(([i,t])=>{if(!S(t)||!S(t.thinking))return[i,t];let o=typeof t.thinking.effort=="string"?t.thinking.effort.trim():"",a=typeof t.thinking.defaultEffort=="string"?t.thinking.defaultEffort.trim():"";if(!Object.hasOwn(t.thinking,"effort")&&!Object.hasOwn(t.thinking,"defaultEffort"))return[i,t];let l=[],u=new Set;if(Array.isArray(t.thinking.effortOptions))for(let h of t.thinking.effortOptions){if(typeof h!="string")continue;let y=h.trim();!y||u.has(y)||(u.add(y),l.push(y))}o&&!u.has(o)&&(u.add(o),l.push(o)),a&&!u.has(a)&&(u.add(a),l.push(a));let{effort:f,effortOptions:s,defaultEffort:c,...d}=t.thinking,p={...d,...l.length>0?{effortOptions:l}:{}},m={...t};return Object.keys(p).length>0?m.thinking=p:delete m.thinking,n=!0,[i,m]}));return n?{...e,models:r}:e}var Ot="byok_legacy_provider_to_custom_provider_v1",Wu="config.yaml.bak.byok-legacy-provider.",cr=new Set(["minimax","minimax_api","provider","custom_provider"]),qu=/^[A-Za-z0-9 _-]+$/,Xu=["support_files_api","files_api_upload_endpoint","max_image_bytes_inline","max_video_bytes_inline","max_request_body_bytes","max_attachments_count"];function Ct(e,n){let r={migrated:!1,migratedProviders:{}};if(!n.isManagedRuntime()||!xn.existsSync(e))return r;let i=Rt(e);if(!S(i.provider))return r;let t=i.provider,o=S(i.custom_provider)?i.custom_provider:{},a=wt(i),l={},u={...o},f=new Set(Object.keys(u)),s=!1,c=n.getManagedPreset().provider;for(let[d,p]of Object.entries(t)){if(!is(d,p,c,n))continue;let m=a.providers[d];if(m&&!cr.has(m)&&!S(u[m])){delete t[d],s=!0;continue}let h=m&&!cr.has(m)?m:ls(d,p,f);l[d]=h,S(u[h])||(u[h]=os(p),f.add(h),s=!0),a.providers[d]!==h&&(a.providers[d]=h,s=!0),delete t[d],s=!0}if(!s&&Object.keys(l).length===0)return r;if(s=Et(i,"defaultModel",l)||s,s=Et(i,"defaultLightModel",l)||s,s=cs(i,l)||s,!s)return{migrated:!1,migratedProviders:l};Object.keys(u).length>0?i.custom_provider=u:delete i.custom_provider,ds(i,a);try{let d=fs(e);return xn.writeFileSync(e,Y.dump(i,{indent:2,lineWidth:-1,noRefs:!0}),"utf-8"),{migrated:!0,migratedProviders:l,backupPath:d}}catch(d){return console.warn(`[config] legacy BYOK provider migration skipped: ${ms(d)}`),{migrated:!1,migratedProviders:l}}}function zu(e,n){let r=Rt(e),i=S(r.custom_provider)?r.custom_provider:{},t=wt(r),o=new Set(n?.excludedLegacyProviderIds??[]);return Object.fromEntries(Object.entries(t.providers).filter(([a,l])=>a.length>0&&!o.has(a)&&l.length>0&&S(i[l])))}function Lt(e,n){let r=e.provider,i=e.defaultModel;if(Object.prototype.hasOwnProperty.call(r,"minimax_api")){let{minimax_api:m,...h}=r;r=h,console.warn('[config] "minimax_api" is a reserved provider id; ignoring provider.minimax_api from config.yaml')}let o=n.getManagedPreset().provider.minimax,a=r.minimax,l=n.isManagedRuntime();if(!(l||Qu(a,n)))return{provider:r,defaultModel:i};let f=a?.options,s=l&&n.shouldEnforceManagedProviderProtection(),c=Ju(o.models,a?.models),d=typeof f?.baseURL=="string"&&f.baseURL.length>0?f.baseURL:void 0,p=s&&d!=null&&!n.isManagedPresetBaseUrl(d);return r={...r,minimax:{...o,...a??{},npm:a?.npm??o.npm,models:c,options:{...o.options??{},...f??{},...p?{apiKey:o.options?.apiKey}:{},...s?{authMode:"managed-login",baseURL:o.options?.baseURL}:{}}}},{provider:r,defaultModel:i}}function Qu(e,n){let r=e?.options;return r?.authMode==="managed-login"?!0:typeof r?.baseURL=="string"&&n.isManagedPresetBaseUrl(r.baseURL)}function Ju(e,n){let r={};for(let[t,o]of Object.entries(e??{}))r[t]=Zu(o,n?.[t]);let i=r["MiniMax-M3"];return i&&(r["MiniMax-M3"]={...i,limit:{...i.limit,context:i.limit?.context===1e6?1e6:512e3,output:i.limit?.output??128e3}}),r}function Zu(e,n){return n?{...e,...n,capabilities:es(e.capabilities,n.capabilities)}:e}function es(e,n){if(!e&&!n)return;let r={...e??{},...n??{}};for(let i of Xu){if(!Object.prototype.hasOwnProperty.call(e??{},i)||!Object.prototype.hasOwnProperty.call(n??{},i))continue;let t=ns(i,n?.[i]);t===void 0?r[i]=e?.[i]:r[i]=t}return r}function ns(e,n){switch(e){case"support_files_api":return typeof n=="boolean"?n:void 0;case"files_api_upload_endpoint":return typeof n=="string"&&n.trim().length>0?n.trim():void 0;case"max_image_bytes_inline":case"max_video_bytes_inline":case"max_request_body_bytes":return kt(n);case"max_attachments_count":return rs(n)}}function kt(e){if(typeof e=="number")return Number.isFinite(e)&&e>0?e:void 0;if(typeof e!="string")return;let n=e.trim();if(!n)return;let r=Number(n);return Number.isFinite(r)&&r>0?n:void 0}function rs(e){let n=kt(e);if(n===void 0)return;let r=typeof n=="number"?n:Number(n);return Number.isInteger(r)&&r>0?n:void 0}function Rt(e){try{let n=Y.load(xn.readFileSync(e,"utf-8"));return S(n)?n:{}}catch{return{}}}function is(e,n,r,i){if(e==="minimax_api"||!ps(n)||!ts(n))return!1;if(!Object.prototype.hasOwnProperty.call(r,e))return!0;if(e!=="minimax"||!i.shouldEnforceManagedProviderProtection())return!1;let t=as(n);return!!(t&&!i.isManagedPresetBaseUrl(t))}function ts(e){let n=S(e.options)?e.options:void 0;return typeof n?.apiKey=="string"&&n.apiKey.trim().length>0&&typeof n.baseURL=="string"&&n.baseURL.trim().length>0&&S(e.models)}function os(e){let n=S(e.options)?e.options:{};return{...e,kind:"custom",enabled:e.enabled!==!1,options:{...n,authMode:"api-key"}}}function as(e){let r=(S(e.options)?e.options:void 0)?.baseURL;return typeof r=="string"&&r.length>0?r:void 0}function ls(e,n,r){let i=S(n)?n:{},t=typeof i.name=="string"?i.name:void 0,o=`provider-${us(e)}`,a=e==="minimax"?"minimax-legacy":At(e)??At(t)??o;for(let l=0;;l+=1){let u=l===0?a:`${a}-${l+1}`;if(!r.has(u)&&!cr.has(u))return u}}function At(e){let n=e?.trim();return!n||!qu.test(n)?void 0:n.toLowerCase().replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")||void 0}function us(e){return Hu("sha256").update(e).digest("hex").slice(0,8)}function Et(e,n,r){let i=e[n];if(typeof i!="string")return!1;let t=ss(i,r);return t===i?!1:(e[n]=t,!0)}function ss(e,n){let r=e.indexOf("/");if(r<=0||r===e.length-1)return e;let i=e.slice(0,r),t=n[i];return t?`custom_provider:${t}/${e.slice(r+1)}`:e}function cs(e,n){if(!S(e.nexus)||!S(e.nexus.model))return!1;let r=e.nexus.model.providerID;if(typeof r!="string")return!1;let i=n[r];return i?(e.nexus.model.providerID=`custom_provider:${i}`,!0):!1}function fs(e){let n=vt.join(vt.dirname(e),`${Wu}${Date.now()}`);return xn.copyFileSync(e,n),n}function wt(e){let r=(S(e.migrations)?e.migrations:void 0)?.[Ot];return{providers:S(r)&&S(r.providers)?Object.fromEntries(Object.entries(r.providers).filter(t=>typeof t[1]=="string")):{}}}function ds(e,n){let r=S(e.migrations)?e.migrations:{};r[Ot]={version:1,providers:n.providers},e.migrations=r}function ps(e){return S(e)?typeof e.name=="string"||typeof e.npm=="string"||typeof e.api=="string"||S(e.options)||S(e.models):!1}function S(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function ms(e){return e instanceof Error?e.message:String(e)}var en="native";function nn(e){return e==="native"||e==="mcp"?e:en}function Pt(e){if(e==="mcp")throw new Error("MCP backend coming in v2 follow-up plan")}function Ft(e,n){let r=n.keepAlive,i=n.xdg,t=n.spawnConcurrency,o=()=>({enabled:r.enabled,maxProcesses:r.maxProcesses,maxLifetimeMs:r.maxLifetimeMs,agents:[...r.agents]}),a=e.opencode;if(a==null||typeof a!="object"||Array.isArray(a))return{keepAlive:o(),xdg:{...i},spawnConcurrency:t};let l=a,u=l.spawnConcurrency,f=typeof u=="number"&&Number.isFinite(u)&&u>0&&Number.isInteger(u)?u:t,s=hs(l.xdg,i),c=l.keepAlive;if(c==null||typeof c!="object"||Array.isArray(c))return{keepAlive:o(),xdg:s,spawnConcurrency:f};let d=c,p=d.maxProcesses,m=typeof p=="number"&&Number.isFinite(p)&&p>0&&Number.isInteger(p)?p:r.maxProcesses,h=d.maxLifetimeMs,y=typeof h=="number"&&Number.isFinite(h)&&h>0&&Number.isInteger(h)?h:r.maxLifetimeMs,_=d.agents,x;return Array.isArray(_)?(x=_.filter(k=>typeof k=="string"&&k.length>0),x.length===0&&(x=[...r.agents])):x=[...r.agents],{keepAlive:{enabled:typeof d.enabled=="boolean"?d.enabled:r.enabled,maxProcesses:m,maxLifetimeMs:y,agents:x},xdg:s,spawnConcurrency:f}}function hs(e,n){let r=e!=null&&typeof e=="object"&&!Array.isArray(e)?e:void 0,i=r?.startupImport,t=i==="background"||i==="blocking"||i==="off"?i:n.startupImport;return{dataIsolation:typeof r?.dataIsolation=="boolean"?r.dataIsolation:n.dataIsolation,startupImport:t}}function _n(e){let n=JSON.stringify({level:40,time:Date.now(),name:"config.asr",msg:e});process.stderr.write(`${n}
35
+ `)}var vn={enabled:!0};function Nt(e){if(e==null||typeof e!="object"||Array.isArray(e))return!1;let n=e,r=typeof n.apiKey=="string"&&n.apiKey.trim().length>0,i=typeof n.resourceId=="string"&&n.resourceId.trim().length>0;return r||i}function bn(e){return typeof e=="string"&&e.trim().length>0}function Dt(e){let n=e.asr;if(n==null||typeof n!="object"||Array.isArray(n))return{...vn};let r=n;return Nt(r.seed)&&_n("Ignoring legacy `asr.seed.*` in config \u2014 Seed ASR was retired from the daemon; only Amadeus remains. Remove `asr.seed` from config.yaml."),Nt(r.qwen)&&_n("Ignoring legacy `asr.qwen.apiKey` in config \u2014 Qwen ASR was retired from the daemon; only Amadeus remains. Remove `asr.qwen` from config.yaml."),(bn(r.mode)||bn(r.proxyBaseUrl))&&_n("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."),(bn(r.primaryProvider)||bn(r.fallbackProvider))&&_n("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 r.enabled=="boolean"?r.enabled:vn.enabled}}var dr={policyServer:{url:"",requestTimeoutMs:5e3}},ys="http://127.0.0.1:8443";function gs(e){return e==="prod"?"":ys}function xs(e,n){return typeof e=="number"&&Number.isFinite(e)&&e>0?Math.floor(e):n}function fr(e){if(e.length===0)return!1;try{return new URL(e),!0}catch{return!1}}function Ut(e,n){let r=e.nd,i=r!=null&&typeof r=="object"&&!Array.isArray(r)?r.policyServer:void 0,t=i!=null&&typeof i=="object"&&!Array.isArray(i)?i:{},o=process.env.MAVIS_ND_POLICY_SERVER_URL,a=typeof o=="string"&&o.trim().length>0?o.trim():void 0,l=t.url,u=typeof l=="string"&&l.trim().length>0?l.trim():void 0,f="";if(a&&fr(a))f=a;else if(u&&fr(u))f=u;else{let s=gs(n);f=fr(s)?s:""}return{policyServer:{url:f,requestTimeoutMs:xs(t.requestTimeoutMs,dr.policyServer.requestTimeoutMs)}}}var _s={policyOwner:"core",storageWriteVersion:2,classifierTimeoutMs:6e4,userConfirmationEnabled:!0};function Bt(e,n=_s){let r=e.permission;if(r==null||typeof r!="object"||Array.isArray(r))return{...n};let i=r,t=i.policyOwner===void 0?n.policyOwner:i.policyOwner==="engine"||i.policyOwner==="core"?i.policyOwner:"engine",o=i.storageWriteVersion===1||i.storageWriteVersion===2?i.storageWriteVersion:n.storageWriteVersion,a=i.classifierTimeoutMs,l=typeof a=="number"&&Number.isFinite(a)&&a>=5e3?Math.floor(a):n.classifierTimeoutMs,u=typeof i.userConfirmationEnabled=="boolean"?i.userConfirmationEnabled:n.userConfirmationEnabled;return{policyOwner:t,storageWriteVersion:o,classifierTimeoutMs:l,userConfirmationEnabled:u}}function jt(e,n){return n.length===0?!1:n.includes("*")?!0:n.includes(e)}var $t=["user-cc","user-codex","user-agents","workspace-minimax","workspace-cc","workspace-agents"],bs={"user-cc":"user-claude","workspace-cc":"workspace-claude"},En={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 An(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function vs(e,n){return An(e)?{enabled:typeof e.enabled=="boolean"?e.enabled:n.enabled,priority:typeof e.priority=="number"&&Number.isFinite(e.priority)?e.priority:n.priority}:n}function pr(e){let n=En,r=An(e.skills)?e.skills:{},i=An(r.external)?r.external:{},t=An(i.sources)?i.sources:{},o={...n.external.sources};for(let a of $t){let l=bs[a],u=Object.hasOwn(t,a)?t[a]:l?t[l]:void 0;o[a]=vs(u,n.external.sources[a])}return{external:{enabled:typeof i.enabled=="boolean"?i.enabled:n.external.enabled,walkUp:typeof i.walkUp=="boolean"?i.walkUp:n.external.walkUp,duplicateWarn:typeof i.duplicateWarn=="boolean"?i.duplicateWarn:n.external.duplicateWarn,sources:o}}}var As=$t;var Vt=["pi-agent"],Fe="pi-agent";function Gt(e){return typeof e!="string"?Fe:Vt.includes(e)?e:Fe}function mr(e){return e==null||typeof e!="object"||Array.isArray(e)?{defaultFramework:Fe}:{defaultFramework:Gt(e.defaultFramework)}}import P from"node:fs";import Es from"node:os";import Ne from"node:path";var Xt=".minimax",zt=".mavis",Ss={error:()=>{},info:()=>{},warn:()=>{}};function _r(e){return e??Es.homedir()}function Qt(e,n){return n?`${e}-${n}`:e}function Jt(e,n){return Ne.join(_r(e),Qt(Xt,n))}function Zt(e,n){return Ne.join(_r(e),Qt(zt,n))}function yr(e){try{let n=P.lstatSync(e);return n.isSymbolicLink()?{kind:"link"}:n.isDirectory()?{kind:"directory"}:{kind:"other"}}catch(n){let r=n.code;return r==="ENOENT"||r==="ENOTDIR"?{kind:"missing"}:{kind:"inaccessible",error:n}}}function hr(e){let n=Ne.resolve(e);return process.platform==="win32"?(n=n.replace(/^\\\\\?\\/,""),n.toLowerCase()):n}function br(e,n){try{let r=P.readlinkSync(e),i=hr(n);return hr(Ne.resolve(Ne.dirname(e),r))===i||hr(r)===i}catch{return!1}}function Sn(e,n,r){if(!br(e,n))try{P.symlinkSync(n,e,process.platform==="win32"?"junction":"dir")}catch(i){r.warn(`Failed to create compat link ${e} -> ${n}: ${String(i)}`)}}function Kt(e,n,r){if(n.kind==="missing")return!0;if(n.kind==="link"||n.kind==="other")try{return P.unlinkSync(e),!0}catch(i){return r.warn(`Failed to remove ${e} before creating compat link: ${String(i)}`),!1}return!1}function gr(e){try{let n=P.readdirSync(e);if(n.length===0)return"empty";if(n.length===1&&n[0]==="workspace")try{return P.readdirSync(Ne.join(e,"workspace")).length>0?"hasData":"empty"}catch{return"unknown"}return"hasData"}catch{return"unknown"}}function xr(e){try{return P.statSync(e).isDirectory()?gr(e):void 0}catch{return"unknown"}}function Ms(e,n){return`${e}.backup-${n()}`}function Ts(e,n,r){let i=Ms(e,r);try{return P.renameSync(e,i),n.warn(`Backed up legacy data dir ${e} -> ${i}`),!0}catch(t){return n.warn(`Failed to back up legacy data dir ${e}: ${String(t)}`),!1}}function Is(e,n,r,i){if(br(e,n))return!0;let t=yr(e);if(t.kind==="missing")return!0;if(t.kind==="link"){let o=xr(e);return o==="hasData"||o==="unknown"?(r.warn(`Cannot replace legacy data dir symlink ${e}; it may point to real data outside ${n}`),!1):Kt(e,t,r)}return t.kind==="other"?Kt(e,t,r):t.kind==="directory"?Ts(e,r,i):(r.warn(`Cannot replace inaccessible legacy data dir ${e}; leaving it untouched`),!1)}function Yt(e,n,r,i){Is(e,n,r,i)&&Sn(e,n,r)}function Os(e,n){try{return P.rmSync(e,{recursive:!0,force:!1}),!0}catch(r){return n.warn(`Failed to remove empty primary data dir ${e}: ${String(r)}`),!1}}function Ht(e,n,r){try{return P.renameSync(e,n),r.info(`Migrated legacy data dir ${e} -> ${n}`),!0}catch(i){return r.warn(`Failed to migrate legacy data dir ${e} -> ${n}: ${String(i)}`),!1}}function Cs(e,n,r,i){try{P.cpSync(e,r,{recursive:!0,errorOnExist:!0,force:!1}),P.unlinkSync(n);try{P.rmSync(e,{recursive:!0,force:!1})}catch(t){i.warn(`Copied legacy symlink data dir ${e} -> ${r}, but failed to remove old target: ${String(t)}`)}return i.info(`Copied legacy data dir symlink target ${e} -> ${r}`),!0}catch(t){try{P.existsSync(r)&&P.rmSync(r,{recursive:!0,force:!0})}catch(o){i.warn(`Failed to clean up partial primary data dir ${r}: ${String(o)}`)}return i.warn(`Failed to copy legacy symlink data dir ${n} -> ${r}: ${String(t)}`),!1}}function Wt(e,n,r){try{let i=P.realpathSync(e);try{P.renameSync(i,n)}catch(t){if(t.code==="EXDEV")return Cs(i,e,n,r);throw t}return P.unlinkSync(e),r.info(`Migrated legacy data dir symlink target ${i} -> ${n}`),!0}catch(i){return r.warn(`Failed to migrate legacy symlink data dir ${e} -> ${n}: ${String(i)}`),!1}}function qt(e,n){try{return P.mkdirSync(e,{recursive:!0}),!0}catch(r){return n.warn(`Failed to create primary data dir ${e}: ${String(r)}`),!1}}function Ls(e,n,r,i){let t=yr(e),o=yr(n);if(t.kind==="inaccessible")return r.warn(`Primary data dir ${e} is inaccessible; not treating it as missing`),e;if(t.kind==="directory"){let a=gr(e),l=o.kind==="directory"?gr(n):o.kind==="link"?xr(n)??"empty":"empty";if(a==="empty"){if(o.kind==="inaccessible"||l==="unknown")return r.warn(`Legacy data dir ${n} may contain data but is inaccessible; not using empty primary ${e}`),n;if((o.kind==="directory"||o.kind==="link")&&l==="hasData"){if(!Os(e,r))return n;if(o.kind==="link"){if(!Wt(n,e,r))return n}else if(!Ht(n,e,r))return n;return Sn(n,e,r),e}}return Yt(n,e,r,i),e}if(br(n,e))return qt(e,r),e;if(o.kind==="directory")return Ht(n,e,r)?(Sn(n,e,r),e):n;if(o.kind==="link"){let a=xr(n);if(a==="hasData")return Wt(n,e,r)?(Sn(n,e,r),e):n;if(a==="unknown")return r.warn(`Legacy data dir symlink ${n} target is inaccessible; not treating it as missing`),n}return o.kind==="inaccessible"?(r.warn(`Legacy data dir ${n} is inaccessible; not treating it as missing`),n):t.kind==="link"||t.kind==="other"?(r.warn(`Primary data dir path ${e} exists but is not a directory; using it without migration`),e):(qt(e,r),Yt(n,e,r,i),e)}function se(e={}){let n=_r(e.homeDir),r=e.profile??null;return Ls(Jt(n,r),Zt(n,r),e.logger??Ss,e.nowMs??Date.now)}function ks(e,n){return se({homeDir:e,logger:n})}function Rs(e,n,r){return se({homeDir:n,profile:e,logger:r})}var Tr=["read","write","edit","bash","grep","glob","todowrite","web_fetch","website_deploy","workspace_semantic_search"],Ir=["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"],Or=["code-review","deep-research","docx","init","lark-tools","llm-call","mcode-tools-master","mavis-doctor","pdf","plugin-creator","pptx","skill-creator","skill-refiner","visual-page","x-link-reader","xlsx"],no=["control-in-app-browser","cu-desktop","resume-codex","mavis","create-agent","minimax-code-product","mavis-team","miniapp-creator"],ws=new Set(["modelConfigId","persona","tools","builtinTools","skills","features"]),Ps=new Set(["enabled"]),Sr=new Set(["mavis","delegation","webSearch"]),ro=new Set(Tr),io=new Set(Ir),Mr=new Set(Or),to=new Set(no),Fs=new Set(["plan-mode"]);function Cr(e){let n=Mn(e),r=Mn(n?.default);return{default:r?Ds(r):{}}}function Ns(e,n="agent"){if(e===void 0)return{};let r=Ar(e,n);Er(r,ws,n);let i={};if(r.modelConfigId!==void 0&&((typeof r.modelConfigId!="string"||!r.modelConfigId.trim())&&q(`${n}.modelConfigId`,"must be a non-empty string"),i.modelConfigId=r.modelConfigId.trim()),r.persona!==void 0){let t=Ar(r.persona,`${n}.persona`);Er(t,Ps,`${n}.persona`),t.enabled!==void 0&&typeof t.enabled!="boolean"&&q(`${n}.persona.enabled`,"must be a boolean"),i.persona={...typeof t.enabled=="boolean"?{enabled:t.enabled}:{}}}if(r.tools!==void 0&&(Array.isArray(r.tools)||q(`${n}.tools`,"must be an array"),i.tools=r.tools.map((t,o)=>((typeof t!="string"||!ro.has(t))&&q(`${n}.tools[${o}]`,`must be one of ${Tr.join(", ")}`),t))),r.builtinTools!==void 0&&(Array.isArray(r.builtinTools)||q(`${n}.builtinTools`,"must be an array"),i.builtinTools=r.builtinTools.map((t,o)=>(t==="web_search"&&q(`${n}.builtinTools[${o}]`,"web_search is feature-owned; use features.webSearch"),(typeof t!="string"||!io.has(t))&&q(`${n}.builtinTools[${o}]`,`must be one of ${Ir.join(", ")}`),t))),r.skills!==void 0&&(Array.isArray(r.skills)||q(`${n}.skills`,"must be an array"),i.skills=r.skills.map((t,o)=>{if(typeof t=="string"&&to.has(t.trim())){let a=t.trim();q(`${n}.skills[${o}]`,`${a} is capability-owned; use its owning Tool or feature switch`)}return(typeof t!="string"||!Mr.has(t.trim()))&&q(`${n}.skills[${o}]`,`must be one of ${Or.join(", ")}`),t.trim()})),r.features!==void 0){let t=Ar(r.features,`${n}.features`);Er(t,Sr,`${n}.features`);for(let o of Sr)t[o]!==void 0&&typeof t[o]!="boolean"&&q(`${n}.features.${o}`,"must be a boolean");i.features={...typeof t.mavis=="boolean"?{mavis:t.mavis}:{},...typeof t.delegation=="boolean"?{delegation:t.delegation}:{},...typeof t.webSearch=="boolean"?{webSearch:t.webSearch}:{}}}return i}function Ds(e){let n={};typeof e.modelConfigId=="string"&&e.modelConfigId.trim()&&(n.modelConfigId=e.modelConfigId.trim());let r=Mn(e.persona);if(typeof r?.enabled=="boolean"&&(n.persona={enabled:r.enabled}),eo(e.tools,ro)&&(n.tools=[...e.tools]),eo(e.builtinTools,io)&&(n.builtinTools=[...e.builtinTools]),Array.isArray(e.skills)){let t=e.skills.map(o=>typeof o=="string"?o.trim():o);t.every(o=>typeof o=="string"&&(Mr.has(o)||Fs.has(o))&&!to.has(o))&&(n.skills=t.filter(o=>typeof o=="string"&&Mr.has(o)))}let i=Mn(e.features);if(i){let t={};for(let o of Sr)typeof i[o]=="boolean"&&(t[o]=i[o]);Object.keys(t).length>0&&(n.features=t)}return n}function Mn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0}function eo(e,n){return Array.isArray(e)&&e.every(r=>typeof r=="string"&&n.has(r))}function Us(e={},n={}){return{persona:{enabled:n.persona?.enabled??e.persona?.enabled??!0},tools:vr(n.tools??e.tools),builtinTools:vr(n.builtinTools??e.builtinTools),skills:vr(n.skills??e.skills),features:{mavis:n.features?.mavis??e.features?.mavis??!0,delegation:n.features?.delegation??e.features?.delegation??!0,webSearch:n.features?.webSearch??e.features?.webSearch??!0}}}function Bs(e,n){return e.tools===void 0||e.tools.includes(n)}function js(e,n){return e.builtinTools===void 0||e.builtinTools.includes(n)}function $s(e,n){return e.skills===void 0||e.skills.includes(n)}function vr(e){return e===void 0?void 0:[...e]}function Ar(e,n){return(e==null||typeof e!="object"||Array.isArray(e))&&q(n,"must be an object"),e}function Er(e,n,r){for(let i of Object.keys(e))n.has(i)||q(`${r}.${i}`,"is not supported")}function q(e,n){throw new Error(`Invalid configuration at ${e}: ${n}`)}var lo=["none","evaluator","subagent"],uo=["brief","transcript"],so=["same-route-small-fast"],co="goal-verifier-readonly",fo=[co],z={budget:{graceSteps:1},breaker:{repeatedReplyLimit:3},verifier:{repeatedNotMetLimit:5,evidence:"brief"},evaluator:{modelPolicy:"same-route-small-fast",maxTokens:32e3,timeoutSeconds:60,maxRetries:1}},Lr={budget:{graceSteps:3},evaluator:{maxRetries:1}};function kr(e){let n=[],r=De(e,"goal",n);Ue(r,"goal",n,["objectiveMaxChars","verification","budget","breaker","verifier","evaluator","subagent"]);let i=De(r.budget,"goal.budget",n);Ue(i,"goal.budget",n,["defaultTokens","defaultMainTurns","defaultActiveSeconds","graceSteps"]);let t=De(r.breaker,"goal.breaker",n);Ue(t,"goal.breaker",n,["repeatedReplyLimit"]);let o=De(r.verifier,"goal.verifier",n);Ue(o,"goal.verifier",n,["repeatedNotMetLimit","evidence"]);let a=De(r.evaluator,"goal.evaluator",n);Ue(a,"goal.evaluator",n,["modelPolicy","maxTokens","timeoutSeconds","maxRetries"]);let l=De(r.subagent,"goal.subagent",n);Ue(l,"goal.subagent",n,["profile","maxTurns","maxTokens","timeoutSeconds"]);let u=ao(r.verification,"goal.verification",lo,n),f=_e(r.objectiveMaxChars,"goal.objectiveMaxChars",n,{min:1}),s=_e(i.defaultTokens,"goal.budget.defaultTokens",n,{min:1}),c=_e(i.defaultMainTurns,"goal.budget.defaultMainTurns",n,{min:1}),d=_e(i.defaultActiveSeconds,"goal.budget.defaultActiveSeconds",n,{min:1}),p=ao(l.profile,"goal.subagent.profile",fo,n),m=_e(l.maxTurns,"goal.subagent.maxTurns",n,{min:1}),h=_e(l.maxTokens,"goal.subagent.maxTokens",n,{min:1}),y=_e(l.timeoutSeconds,"goal.subagent.timeoutSeconds",n,{min:1}),_={...p!==void 0?{profile:p}:{},...m!==void 0?{maxTurns:m}:{},...h!==void 0?{maxTokens:h}:{},...y!==void 0?{timeoutSeconds:y}:{}};return{config:{...f!==void 0?{objectiveMaxChars:f}:{},...u!==void 0?{verification:u}:{},budget:{...s!==void 0?{defaultTokens:s}:{},...c!==void 0?{defaultMainTurns:c}:{},...d!==void 0?{defaultActiveSeconds:d}:{},graceSteps:Be(i.graceSteps,"goal.budget.graceSteps",z.budget.graceSteps,n,{min:0,max:Lr.budget.graceSteps})},breaker:{repeatedReplyLimit:Be(t.repeatedReplyLimit,"goal.breaker.repeatedReplyLimit",z.breaker.repeatedReplyLimit,n,{min:1})},verifier:{repeatedNotMetLimit:Be(o.repeatedNotMetLimit,"goal.verifier.repeatedNotMetLimit",z.verifier.repeatedNotMetLimit,n,{min:1}),evidence:oo(o.evidence,"goal.verifier.evidence",uo,z.verifier.evidence,n)},evaluator:{modelPolicy:oo(a.modelPolicy,"goal.evaluator.modelPolicy",so,z.evaluator.modelPolicy,n),maxTokens:Be(a.maxTokens,"goal.evaluator.maxTokens",z.evaluator.maxTokens,n,{min:1}),timeoutSeconds:Be(a.timeoutSeconds,"goal.evaluator.timeoutSeconds",z.evaluator.timeoutSeconds,n,{min:1}),maxRetries:Be(a.maxRetries,"goal.evaluator.maxRetries",z.evaluator.maxRetries,n,{min:0,max:Lr.evaluator.maxRetries})},...Object.keys(_).length>0?{subagent:_}:{}},warnings:n}}function De(e,n,r){return e===void 0?{}:e===null||typeof e!="object"||Array.isArray(e)?(r.push(ce(n,"expected an object; using defaults")),{}):e}function Ue(e,n,r,i){for(let t of Object.keys(e))i.includes(t)||r.push(ce(`${n}.${t}`,"unknown key ignored"))}function Be(e,n,r,i,t){return e==null?r:!Number.isInteger(e)||e<t.min?(i.push(ce(n,`expected an integer >= ${t.min}; using default`)),r):t.max!=null&&e>t.max?(i.push(ce(n,`exceeds maximum ${t.max}; clamped`)),t.max):e}function _e(e,n,r,i){if(e!=null){if(!Number.isInteger(e)||e<i.min){r.push(ce(n,`expected an integer >= ${i.min}; ignored`));return}return i.max!=null&&e>i.max?(r.push(ce(n,`exceeds maximum ${i.max}; clamped`)),i.max):e}}function oo(e,n,r,i,t){return e==null?i:typeof e!="string"||!r.includes(e)?(t.push(ce(n,`expected one of: ${r.join(", ")}; using default`)),i):e}function ao(e,n,r,i){if(e!=null){if(typeof e!="string"||!r.includes(e)){i.push(ce(n,`expected one of: ${r.join(", ")}; ignored`));return}return e}}function ce(e,n){return`Invalid goal config at ${e}: ${n}`}var ne={enabled:!0,maxInlineKiB:32,mcpDetailsMaxInlineKiB:32,watermarkKiB:256,minSavingsKiB:128,minCandidateKiB:2},Vs=Math.floor(Number.MAX_SAFE_INTEGER/1024);function Rr(e){let n=Gs(e)?e:{};return{enabled:typeof n.enabled=="boolean"?n.enabled:ne.enabled,maxInlineKiB:rn(n.maxInlineKiB,ne.maxInlineKiB),mcpDetailsMaxInlineKiB:rn(n.mcpDetailsMaxInlineKiB,ne.mcpDetailsMaxInlineKiB),watermarkKiB:rn(n.watermarkKiB,ne.watermarkKiB),minSavingsKiB:rn(n.minSavingsKiB,ne.minSavingsKiB),minCandidateKiB:rn(n.minCandidateKiB,ne.minCandidateKiB)}}function rn(e,n){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0&&e<=Vs?e:n}function Gs(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Hs(){return process.env.__MAVIS_ALLOW_LEGACY_RUNTIME_ENV==="1"}var po={dev:"test",test:"test",staging:"staging",prod:"prod"};function Ws(e){return e==="cn"||e==="en"}function bo(e){return e==="test"||e==="prod"||e==="dev"||e==="staging"}function vo(){let e=process.env.MAVIS_REGION;if(Ws(e))return e;if(In()){let n=process.env.NEXT_PUBLIC_LOCALE;if(n==="zh")return"cn";if(n==="en")return"en"}return"en"}function te(){let e=process.env.MAVIS_BUILD_ENV;if(bo(e))return e;if(In()){let n=process.env.NEXT_PUBLIC_BUILD_ENV,r=n&&Object.prototype.hasOwnProperty.call(po,n)?po[n]:void 0;if(r)return r}return"dev"}function Tn(){if(So("managed"))return!0;let e=process.env.__MAVIS_RUNTIME_MANAGED;return e==="1"?!0:e==="0"?!1:!!(In()||te()==="prod"||te()==="staging")}function In(){let e=process.versions;return process.env.ELECTRON_RUN_AS_NODE==="1"||typeof e.electron=="string"}function On(){return`${vo()}-${te()}`}var ie={none:0,test:1,internal:2,online:3},qs={internal:"internal",inside:"online"};function Xs(e){for(let[n,r]of Object.entries(e)){if(ie[r.defaultVisibility]>ie[r.configurableVisibility])throw new Error(`Invalid beta feature definition "${n}": defaultVisibility (${r.defaultVisibility}) must not exceed configurableVisibility (${r.configurableVisibility})`);for(let i of r.defaultBuildVariants??[]){let t=qs[i];if(ie[t]>ie[r.configurableVisibility])throw new Error(`Invalid beta feature definition "${n}": defaultBuildVariant (${i}) must not exceed configurableVisibility (${r.configurableVisibility})`)}for(let i of r.defaultBuildEnvironments??[])if(ie[i==="prod"?"online":"test"]>ie[r.configurableVisibility])throw new Error(`Invalid beta feature definition "${n}": defaultBuildEnvironment (${i}) must not exceed configurableVisibility (${r.configurableVisibility})`)}}var on={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"},cuMode:{defaultVisibility:"online",configurableVisibility:"online"},asr:{defaultVisibility:"internal",configurableVisibility:"internal"},teamPlanWorkspaceCard:{defaultVisibility:"test",configurableVisibility:"online"},teamPlanDrilldown:{defaultVisibility:"test",configurableVisibility:"test"},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:"none",defaultBuildVariants:["internal"],configurableVisibility:"online"}};Xs(on);function zs(e){return(e.buildEnv??te())!=="prod"?"test":e.internalBuild===!0?"internal":"online"}function Qs(e,n){let r=e.defaultBuildVariants;return r?n.internalBuild===!0&&r.includes("internal")||n.insideBuild===!0&&r.includes("inside"):!1}function Js(e,n){let r=n.defaultBuildEnvironment??n.buildEnv??Nr();return e.defaultBuildEnvironments?.includes(r)===!0}function Nr(){let e=In()?process.env.NEXT_PUBLIC_BUILD_ENV:void 0;return bo(e)?e:te()}function mo(e,n){return e.defaultPlatforms?.includes(n.platform??process.platform)!==!1}function Dr(e,n,r={}){let i=on[e],t=ie[zs(r)],o=r.defaultBuildEnvironment??r.buildEnv??Nr();return e==="mcodeTools"&&o==="dev"&&r.mcodeToolsDevMode==="published"&&mo(i,r)?!0:n===!1?!1:n===!0?t<=ie[i.configurableVisibility]:mo(i,r)?Js(i,r)||Qs(i,r)?!0:t<=ie[i.defaultVisibility]:!1}function Zs(e){return on[e].configurableVisibility==="online"}function Ao(e=process.env){return e.__MAVIS_BUILD_INTERNAL==="true"}function ec(e=process.env){return e.__MAVIS_BUILD_INSIDE==="true"}var Eo={APP_DIR:".minimax",ENV_PREFIX:"minimax",CLI_NAME:"minimax"},Ur="__MAVIS_RUNTIME";function Cn(e){return Hs()?process.env[`${Ur}_${e}`]:void 0}function Ln(e){let n=`--${e}`;for(let r=2;r<process.argv.length;r++){let i=process.argv[r];if(i===n)return process.argv[r+1];if(i?.startsWith(`${n}=`))return i.slice(n.length+1)}}function So(e){let n=`--${e}`;return process.argv.slice(2).some(r=>r===n||r.startsWith(`${n}=`))}var zd=G.join(_o.homedir(),Eo.APP_DIR),ve=5321,Pr=5001,wr=65535,Mo=500,Br=2,nc=Mo*Br,To=nc+Br,ho=1,rc=new Set(["agent-archon","mavis"]),Qd=`${Ur}_DISABLE_GIT_AUTO_CONFIG`,yo=(()=>{let n=new Uint32Array(256);for(let r=0;r<256;r++){let i=r<<24;for(let t=0;t<8;t++)i=(i&2147483648)!==0?79764919^i<<1:i<<1,i>>>=0;n[r]=i>>>0}return n})();function ic(e){let n=Buffer.from(`${e}
36
+ `,"utf-8"),r=0;for(let t of n)r=(yo[(r>>>24^t)&255]^r<<8)>>>0;let i=n.length;for(;i!==0;)r=(yo[(r>>>24^i&255)&255]^r<<8)>>>0,i>>>=8;return(r^4294967295)>>>0}function tc(e){return ic(e)%Mo*Br+2}function go(e,n){try{let r=Ks("git",e,{encoding:"utf-8",timeout:3e3,stdio:["ignore","pipe","pipe"],...n?{cwd:n}:{}});return r.status===0&&r.stdout?r.stdout.trim():null}catch{return null}}function oc(e){return e.match(/[/:]([^/:]+?)(?:\.git)?$/)?.[1]??null}function Io(){return process.env.MINIMAX_DATA_DIR?.trim()||process.env.MAVIS_DATA_DIR?.trim()}function kn(){return!(So("disable-git-auto-config")||Cn("DISABLE_GIT_AUTO_CONFIG")||Ln("data-dir")||Io())}function Rn(){let e=Ln("profile")??Cn("PROFILE");return e&&e.length>0?e:null}function jr(){let e=Ln("port")??Cn("PORT"),n=e?parseInt(e,10):NaN;return Number.isNaN(n)?null:n}function Fr(){let e=Ln("data-dir")??Io()??Cn("DATA_DIR");return e&&e.length>0?e:null}function ac(){return!!(Rn()&&Fr())}function Oo(){return!!(Rn()&&jr()!==null)}var be=null;function lc(){be=null}function Ae(){if(be!==null)return be;let e={runtimePort:ve,uiPort:Pr,profile:null,autoDetected:!1};return be=e,e}function uc(){try{if(typeof __dirname=="string")return __dirname}catch{}let e=new Error().stack??"";for(let n of e.split(`
37
+ `)){let r=/file:\/\/[^)\s]+/u.exec(n)?.[0]?.replace(/:\d+:\d+$/u,"");if(r)try{return G.dirname(Ys(r))}catch{}let i=/\(?((?:\/|[A-Za-z]:\\)[^()]+?\.(?:cjs|mjs|js|ts)):\d+:\d+\)?/u.exec(n)?.[1];if(i)return G.dirname(i)}}function sc(){let e=Rn();return e||(kn()?Ae().profile:null)}function $r(){let e=Rn();if(ac())return Fr();if(kn()){let r=Ae();if(r.autoDetected&&r.profile)return se({profile:r.profile})}let n=Fr();return n||(e?se({profile:e}):se())}function Ee(){return G.join($r(),"config.yaml")}var cc={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},Co={"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},options:{reasoningSummary:"auto"},thinking_config:{mode:"switchable",default_value:"true"},variants:{"none-thinking":{thinking:{type:"disabled"}},thinking:{thinking:{type:"adaptive"}}},capabilities:cc},"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}}},Vr=Co,wn={"cn-test":["MiniMax-M3","MiniMax-M2.7-highspeed","MiniMax-M2.7"],"cn-dev":["MiniMax-M3","MiniMax-M2.7-highspeed","MiniMax-M2.7"],"cn-staging":["MiniMax-M3","MiniMax-M2.7-highspeed","MiniMax-M2.7"],"cn-prod":["MiniMax-M3","MiniMax-M2.7-highspeed","MiniMax-M2.7"],"en-test":["MiniMax-M3","MiniMax-M2.7-highspeed","MiniMax-M2.7"],"en-dev":["MiniMax-M3","MiniMax-M2.7-highspeed","MiniMax-M2.7"],"en-staging":["MiniMax-M3","MiniMax-M2.7-highspeed","MiniMax-M2.7"],"en-prod":["MiniMax-M3","MiniMax-M2.7-highspeed","MiniMax-M2.7"]};function fc(e){return Object.fromEntries(wn[e].flatMap(n=>{let r=Co[n];return r?[[n,r]]:[]}))}var Pn={"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"},Lo=["https://agent.minimaxi.com/mavis/api/v1/llm/v1"],dc=new Set([...Object.values(Pn),...Lo]),pc=new Set([...Object.values(Pn),...Lo].map(e=>new URL(e).origin));function ko(e){if(dc.has(e))return!0;try{let n=new URL(e);return!n.username&&!n.password&&pc.has(n.origin)}catch{return!1}}function Ro(){return te()==="test"}function mc(){return!Ro()}function hc(e){if(!Tn()||!re.existsSync(e))return;let n=wo(e),{provider:r}=n;if(r==null||typeof r!="object"||Array.isArray(r))return;let{minimax:i}=r;if(i==null||typeof i!="object"||Array.isArray(i))return;let{options:t}=i;if(t==null||typeof t!="object"||Array.isArray(t))return;let o=t.baseURL;if(typeof o!="string")return;let a=Pn[On()];o===a||!ko(o)||(t.baseURL=a,re.writeFileSync(e,Y.dump(n,{indent:2,lineWidth:-1,noRefs:!0}),"utf-8"))}function fe(e){return{provider:{minimax:{name:"MiniMax",npm:"@ai-sdk/anthropic",options:{authMode:"managed-login",apiKey:"sk-xxx",baseURL:Pn[e]},models:fc(e)}},defaultModel:"minimax/MiniMax-M3"}}var Gr={"cn-test":fe("cn-test"),"cn-dev":fe("cn-dev"),"cn-staging":fe("cn-staging"),"cn-prod":fe("cn-prod"),"en-test":fe("en-test"),"en-dev":fe("en-dev"),"en-staging":fe("en-staging"),"en-prod":fe("en-prod")},O={logLevel:"info",devPort:Pr,permissionMode:"auto",sseErrorPush:{history:!0,stream:!0},beta:Object.fromEntries(Object.keys(on).map(e=>[e,Dr(e,void 0,{buildEnv:"dev"})])),agents:{default:{}},memory:{enabled:!0,proactive:!1,dailyDigest:{enabled:!1}},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:{...vn},nd:{...dr},skills:En,askUser:{enabled:!0},sessionTitle:{enabled:!0},cli:{spawn:{enabled:!1}},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},toolResultCompaction:{...ne},agentRuntime:{defaultFramework:Fe},logRetentionDays:3,cuBackend:en,review:{mode:"subagent"},goal:structuredClone(z),goalWarnings:[]};function yc(){let e=Ee(),n=G.dirname(e);if(re.existsSync(n)||re.mkdirSync(n,{recursive:!0}),re.existsSync(e)){Yr(e);return}if(!Tn()){let t=se({homeDir:_o.homedir()}),o=G.join(t,"config.yaml");e!==o&&re.existsSync(o)&&re.copyFileSync(o,e);return}let r=Gr[On()],i=Y.dump({logLevel:O.logLevel,provider:Kr?r.provider:void 0,defaultModel:r.defaultModel});re.writeFileSync(e,i,"utf-8")}function wo(e=Ee()){try{let n=re.readFileSync(e,"utf-8"),r=Y.load(n);return r!=null&&typeof r=="object"&&!Array.isArray(r)?r:{}}catch{return{}}}var tn=null;function gc(e){if(e==null||typeof e!="object"||Array.isArray(e))return;let n=e;return{branchFinish:typeof n.branchFinish=="boolean"?n.branchFinish:!1}}var Po={isManagedRuntime:Tn,shouldEnforceManagedProviderProtection:mc,getManagedPreset:()=>Gr[On()],isManagedPresetBaseUrl:ko},Fo=!0,Kr=!0;function xc(e){Fo=e}function _c(e){Kr=e}function Yr(e){Fo&&Ct(e,Po),Kr&&hc(e)}function je(){tn=null}function $e(){if(tn)return tn;yc();let e=wo();return tn=Hr(e,$r()),tn}function Hr(e,n){let r=e.sseErrorPush,i=r!=null&&typeof r=="object"&&!Array.isArray(r)?r:void 0,t,o=jr();if(kn()&&!Oo()){let l=Ae();l.autoDetected?t=l.uiPort:t=typeof e.devPort=="number"?e.devPort:O.devPort}else t=typeof e.devPort=="number"?e.devPort:O.devPort;let a=kr(e.goal);return{logLevel:typeof e.logLevel=="string"?e.logLevel:O.logLevel,devPort:t,...Lt({provider:e.provider!=null&&typeof e.provider=="object"&&!Array.isArray(e.provider)?Tt(e.provider):{},defaultModel:typeof e.defaultModel=="string"?e.defaultModel:void 0},Po),defaultModelVariant:typeof e.defaultModelVariant=="string"?e.defaultModelVariant:void 0,minimax_api:St(e.minimax_api),custom_provider:Mt(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 l={};typeof Reflect.get(e.nexus,"enabled")=="boolean"&&(l.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"&&(l.model={providerID:Reflect.get(u,"providerID"),modelID:Reflect.get(u,"modelID"),...typeof Reflect.get(u,"variant")=="string"?{variant:Reflect.get(u,"variant")}:{}}),Object.keys(l).length>0?l: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:O.permissionMode,permission:Bt(e),sseErrorPush:{history:typeof i?.history=="boolean"?i.history:O.sseErrorPush.history,stream:typeof i?.stream=="boolean"?i.stream:O.sseErrorPush.stream},notifications:gc(e.notifications),dataDir:n,agentsDir:G.join(n,"agents"),sessionsDir:G.join(n,"sessions"),memoryDir:G.join(n,"memory"),skillsDir:G.join(n,"skills"),builtinSkillsDir:G.join(n,".builtin-skills"),logsDir:G.join(n,"logs"),pluginsDir:G.join(n,"plugins"),plansDir:G.join(n,"plans"),harnessesDir:G.join(n,"harnesses"),subAgentsDir:G.join(n,"subagents"),beta:No(e),agents:Cr(e.agents),memory:vc(e),skillEvolve:Sc(e),sessionRotate:Mc(e),agentStop:Tc(e),asr:Dt(e),nd:Ut(e,te()),skills:pr(e),askUser:Ic(e),sessionTitle:Oc(e),cli:Cc(e),tui:bt(e),opencode:Lc(e),contextManagement:kc(e),toolResultCompaction:Rr(e.toolResultCompaction),agentRuntime:mr(e.agentRuntime),logRetentionDays:Rc(e),contentReview:wc(e),mcpToolSearch:Pc(e),cuBackend:nn(e.cuBackend),review:bc(e.review),goal:a.config,goalWarnings:a.warnings}}function bc(e){if(e==null||typeof e!="object"||Array.isArray(e))return O.review;let n=Reflect.get(e,"mode");return{mode:n==="inline"||n==="subagent"?n:O.review.mode}}function vc(e){let n=e.memory,r=n!=null&&typeof n=="object"&&!Array.isArray(n)?n:{},i=r.dailyDigest,t=i!=null&&typeof i=="object"&&!Array.isArray(i)?i:{};return{enabled:typeof r.enabled=="boolean"?r.enabled:O.memory.enabled,proactive:typeof r.proactive=="boolean"?r.proactive:O.memory.proactive,dailyDigest:{enabled:typeof t.enabled=="boolean"?t.enabled:O.memory.dailyDigest.enabled}}}function No(e){let n=e.beta!=null&&typeof e.beta=="object"&&!Array.isArray(e.beta)?e.beta:{},r={};for(let i of Object.keys(on))r[i]=Dr(i,n[i],{buildEnv:te(),defaultBuildEnvironment:Nr(),internalBuild:Ao(),insideBuild:ec(),mcodeToolsDevMode:process.env.MAVIS_DEV_MCODE_TOOLS_MODE==="published"?"published":void 0});return r}function Ac(e){let n=e.provider;if(n==null||typeof n!="object"||Array.isArray(n))return[];let r=[];for(let i of Object.values(n)){if(i==null||typeof i!="object"||Array.isArray(i))continue;let{models:t}=i;t==null||typeof t!="object"||Array.isArray(t)||r.push(...Object.keys(t))}return r}function Ec(e,n){if(n.length===0)return!0;let r=Ac(e);if(r.length===0)return!1;let i=n.map(t=>t.toLowerCase());return!r.every(t=>i.some(o=>t.toLowerCase().startsWith(o)))}function xo(e,n){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:n}function Sc(e){let n=O.skillEvolve,r=e.skillEvolve,t=r!=null&&typeof r=="object"&&!Array.isArray(r)?r:{},o=t.inSession,{inSession:a}=n;if(o!=null&&typeof o=="object"&&!Array.isArray(o)){let v=o;a={N:typeof v.N=="number"&&v.N>0?v.N:n.inSession.N,minIntervalSeconds:typeof v.minIntervalSeconds=="number"&&v.minIntervalSeconds>=0?v.minIntervalSeconds:n.inSession.minIntervalSeconds,maxPendingPerSession:typeof v.maxPendingPerSession=="number"&&v.maxPendingPerSession>=1?v.maxPendingPerSession:n.inSession.maxPendingPerSession}}let l=t.excludeAgents,u=Array.isArray(l)&&l.every(v=>typeof v=="string")?l:n.excludeAgents,f=Array.isArray(t.disableModelPrefixes)&&t.disableModelPrefixes.every(v=>typeof v=="string")?t.disableModelPrefixes:n.disableModelPrefixes,s=No(e),c=s.skillEvolve?typeof t.enabled=="boolean"?t.enabled:Ec(e,f):!1,d=c&&s.skillEvolveBuiltinMr?typeof t.builtinMrEnabled=="boolean"?t.builtinMrEnabled:n.builtinMrEnabled:!1,p=t.sourceRepo,m=typeof p=="string"&&p.trim().length>0?p.trim():n.sourceRepo,h=t.proposal,y=n.proposal,_=h!=null&&typeof h=="object"&&!Array.isArray(h)?h:{},x=Array.isArray(_.eligibleAgents)&&_.eligibleAgents.every(v=>typeof v=="string")?_.eligibleAgents:y.eligibleAgents,k=typeof _.minMessageCount=="number"&&_.minMessageCount>=1?Math.floor(_.minMessageCount):y.minMessageCount,ye=typeof _.skipPassiveSessionEnd=="boolean"?_.skipPassiveSessionEnd:y.skipPassiveSessionEnd,cn=typeof _.enabled=="boolean"?_.enabled:null,fn=c&&s.skillProposal?cn??!0:!1,Ce=t.lifecycle,Le=Ce&&typeof Ce=="object"&&!Array.isArray(Ce)?Ce:{},b=xo(Le.staleThresholdDays,n.lifecycle.staleThresholdDays),A=xo(Le.archiveThresholdDays,n.lifecycle.archiveThresholdDays);if(!(b<A))throw new Error(`Invalid skillEvolve.lifecycle config: staleThresholdDays (${b}) must be strictly less than archiveThresholdDays (${A}).`);return{enabled:c,inSession:a,signalCooldownHours:typeof t.signalCooldownHours=="number"&&t.signalCooldownHours>0?t.signalCooldownHours:n.signalCooldownHours,minConfidence:typeof t.minConfidence=="number"&&t.minConfidence>=0&&t.minConfidence<=1?t.minConfidence:n.minConfidence,scannerModel:typeof t.scannerModel=="string"?t.scannerModel:void 0,excludeAgents:u,disableModelPrefixes:f,builtinMrEnabled:d,sourceRepo:m,proposal:{enabled:fn,eligibleAgents:x,minMessageCount:k,skipPassiveSessionEnd:ye},lifecycle:{staleThresholdDays:b,archiveThresholdDays:A}}}function Mc(e){let n=O.sessionRotate,r=e.sessionRotate;if(r==null||typeof r!="object"||Array.isArray(r))return{...n};let i=r,t=i.activeSessionLookbackHours;return{enabled:typeof i.enabled=="boolean"?i.enabled:n.enabled,activeSessionLookbackHours:typeof t=="number"&&Number.isFinite(t)&&t>0?t:n.activeSessionLookbackHours}}function Tc(e){let n=O.agentStop,r=e.agentStop;if(r==null||typeof r!="object"||Array.isArray(r))return{...n};let i=r,t=i.debounceMs,o=i.maxActiveSpanMs;return{debounceMs:typeof t=="number"&&Number.isFinite(t)&&t>=0?t:n.debounceMs,maxActiveSpanMs:typeof o=="number"&&Number.isFinite(o)&&o>=0?o:n.maxActiveSpanMs}}function Ic(e){let n=O.askUser,r=e.askUser;if(r==null||typeof r!="object"||Array.isArray(r))return{...n};let i=r;return{enabled:typeof i.enabled=="boolean"?i.enabled:n.enabled}}function Oc(e){let n=O.sessionTitle,r=e.sessionTitle;if(r==null||typeof r!="object"||Array.isArray(r))return{...n};let i=r;return{enabled:typeof i.enabled=="boolean"?i.enabled:n.enabled}}function Cc(e){let n=O.cli,r=e.cli;if(r==null||typeof r!="object"||Array.isArray(r))return{spawn:{...n.spawn}};let i=r.spawn;if(i==null||typeof i!="object"||Array.isArray(i))return{spawn:{...n.spawn}};let t=i;return{spawn:{enabled:typeof t.enabled=="boolean"?t.enabled:n.spawn.enabled}}}function Lc(e){return Ft(e,{keepAlive:O.opencode.keepAlive,xdg:O.opencode.xdg,spawnConcurrency:O.opencode.spawnConcurrency})}function kc(e){let n=O.contextManagement,r=e.contextManagement;if(r==null||typeof r!="object"||Array.isArray(r))return{disableSystemReminderModels:[...n.disableSystemReminderModels],cuMaxScreenshotsInContext:n.cuMaxScreenshotsInContext};let i=r,t=i.disableSystemReminderModels,o=Array.isArray(t)&&t.every(u=>typeof u=="string"&&u.length>0)?t:[...n.disableSystemReminderModels],a=i.cuMaxScreenshotsInContext,l=typeof a=="number"&&Number.isFinite(a)&&a>=0?Math.floor(a):n.cuMaxScreenshotsInContext;return{disableSystemReminderModels:o,cuMaxScreenshotsInContext:l}}function Rc(e){let n=e.logRetentionDays;return typeof n=="number"&&n>=1&&Number.isFinite(n)?Math.floor(n):O.logRetentionDays}function wc(e){let n=e.contentReview;if(n==null||typeof n!="object"||Array.isArray(n))return;let r={},i=Reflect.get(n,"enabled");typeof i=="boolean"&&(r.enabled=i);let t=Reflect.get(n,"testBaseURL");return typeof t=="string"&&t.trim()&&(r.testBaseURL=t.trim()),Object.keys(r).length>0?r:void 0}function Pc(e){let n=e.mcpToolSearch;if(n==null||typeof n!="object"||Array.isArray(n))return;let r={},i=Reflect.get(n,"enabled");typeof i=="boolean"&&(r.enabled=i);let t=Reflect.get(n,"systemHint");typeof t=="boolean"&&(r.systemHint=t);let o=Reflect.get(n,"thresholdPct");typeof o=="number"&&(r.thresholdPct=o);let a=Reflect.get(n,"minDeferCount");typeof a=="number"&&(r.minDeferCount=a);let l=Reflect.get(n,"topKDefault");typeof l=="number"&&(r.topKDefault=l);let u=Reflect.get(n,"topKMax");typeof u=="number"&&(r.topKMax=u);let f=Reflect.get(n,"maxSchemaTextLen");typeof f=="number"&&(r.maxSchemaTextLen=f);let s=Reflect.get(n,"modelWhitelist");return Array.isArray(s)&&(r.modelWhitelist=s.filter(c=>typeof c=="string")),Object.keys(r).length>0?r:void 0}function Do(){let e=jr();if(kn()&&!Oo()){let n=Ae();return n.autoDetected?n.runtimePort:e??ve}return e??ve}function Fc(e=Do()){let n=e+To;if(n<=wr)return n;let r=e+ho;if(r<=wr)return r;throw new Error(`Cannot allocate an OpenCode sidecar port for runtime port ${String(e)}; choose a runtime port <= ${String(wr-ho)}.`)}var Nc=["agent.minimaxi.com","agent.minimaxi.com","agent.minimax.io","agent.minimax.io","agent.minimax.io","agent.minimax.cn","agent.minimaxi.com"],Dc=new Set(Nc.map(e=>`https://${e}`));function Uc(e,n){return/^custom_provider:minimax-legacy(?:-\d+)?$/u.test(e)&&(!n||Wr(n))}function Wr(e){try{let n=new URL(e);return n.username||n.password?!1:Dc.has(n.origin.toLowerCase())}catch{return!1}}function Bc(e){if(!(e!=="managed-login"&&e!=="api-key"&&e!=="oauth"))return e}function qr(e){let n=typeof e?.baseURL=="string"?e.baseURL.trim():"",r=n.length>0&&Wr(n),i=Bc(e?.authMode),t=[];return typeof e?.authMode=="string"&&!i&&t.push(`Unknown provider authMode "${e.authMode}"; falling back to compatibility resolution.`),i?(i==="managed-login"&&n.length>0&&!r&&!e?.allowManagedBaseURLOverride&&t.push("Provider authMode is managed-login but baseURL is not a known managed MiniMax host."),{authMode:i,source:"explicit",managedBaseURL:r,warnings:t}):r?(t.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:r,warnings:t}):{authMode:"api-key",source:"default-api-key",managedBaseURL:r,warnings:t}}var Ve="minimax",Xr="minimax_api",zr="custom_provider:";function jc(e,n){return e==="anthropic-messages"&&(n===Ve||n===Xr)}function Qr(e,n){if(n===Xr)return"minimax_api_key";if(n.startsWith(zr))return"custom_provider";if(n!==Ve)return"configured_provider";if(e.minimaxModelSource==="minimax_api_key")return"minimax_api_key";let r=e.provider?.[n]?.options;return qr({authMode:r?.authMode,baseURL:r?.baseURL}).authMode==="managed-login"?"managed_token_plan":"configured_provider"}function Uo(e,n,r){switch(Qr(e,n)){case"managed_token_plan":{let t=wn[r],o=Fn(e.provider?.[n]);return o.length===0?t:t.filter(a=>o.includes(a))}case"minimax_api_key":{let t=Object.keys(Vr),o=Fn(e.provider?.[Ve]);return[...t,...o.filter(a=>!t.includes(a))]}case"custom_provider":{let t=e.custom_provider?.[n.slice(zr.length)];return!t||t.enabled===!1?[]:Fn(t)}case"configured_provider":return Fn(e.provider?.[n])}}function $c(e){let n=Qr(e.config,e.providerId),r=e.modelId.trim();return r.length>0&&Uo(e.config,e.providerId,e.preset).includes(r)?{available:!0,route:n}:{available:!1,route:n,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 "${n}" route (preset ${e.preset}).`}}function Fn(e){return Object.entries(e?.models??{}).filter(([,n])=>n?.enabled!==!1).map(([n])=>n)}import{randomBytes as xf}from"node:crypto";import Oe,{existsSync as _f,readFileSync as bf}from"node:fs";import{dirname as ga,join as vf}from"node:path";var xa=Ta(ya(),1);var _a=384,di=new Set(["__proto__","prototype","constructor"]),Af=["minimax_api","custom_provider"];async function Ef(e){let n=e.trim();if(!n||n.includes(".")||di.has(n))throw new J("Invalid provider id");return Wn(async r=>(me(r.provider)&&delete r.provider[n],{write:!0,value:void 0})).then(({config:r})=>({config:r}))}var J=class extends Error{name="LocalModelProviderConfigValidationError"},sn=class extends Error{name="LocalModelProviderConfigWriteError";constructor(){super("Local runtime failed to update config file")}};async function Sf(e){return Wn(async(n,r)=>{let i={minimax_api:me(n.minimax_api)?n.minimax_api:void 0,custom_provider:Lf(me(n.custom_provider)?n.custom_provider:void 0),minimaxModelSource:typeof n.minimaxModelSource=="string"?n.minimaxModelSource:void 0,defaultModel:typeof n.defaultModel=="string"?n.defaultModel:void 0,defaultModelVariant:typeof n.defaultModelVariant=="string"?n.defaultModelVariant:void 0};await e(i,r);for(let t of Af){let o=i[t];if(o===void 0){delete n[t];continue}if(!me(o))throw new J(`Invalid BYOK config subtree "${t}"`);pi(o),n[t]=o}return fi(n,"minimaxModelSource",i.minimaxModelSource),fi(n,"defaultModel",i.defaultModel),fi(n,"defaultModelVariant",i.defaultModelVariant),{write:!0,value:void 0}}).then(({config:n})=>({config:n}))}async function Mf(e){let n=e.modelKey.trim();if(!n)throw new J("Default model must not be empty");return Wn(async r=>(r.defaultModel=n,e.variant===void 0?delete r.defaultModelVariant:r.defaultModelVariant=e.variant,{write:!0,value:void 0})).then(({config:r})=>({config:r}))}async function Tf(e,n){if(e.providerId!==Ve||e.modelId!=="MiniMax-M3")throw new J("Invalid MiniMax model context target");let r=await Wn(async(i,t)=>t.provider?.[e.providerId]?.models?.[e.modelId]?.limit?.context!==e.expectedContextLimit?{write:!1,value:!1}:await n(t)?(kf(i,["provider",e.providerId,"models",e.modelId,"limit","context"],e.contextLimit),{write:!0,value:!0}):{write:!1,value:!1});return{config:r.config,updated:r.value}}async function Wn(e){let n=Ee(),r;try{await Oe.promises.mkdir(ga(n),{recursive:!0}),await Oe.promises.writeFile(n,"",{flag:"a",mode:_a}),r=await xa.default.lock(n,{stale:1e4,retries:{retries:20,factor:1,minTimeout:5,maxTimeout:25}});let i=Cf(n);je();let t=await e(i,$e());return t.write&&(pi(i),await If(n,Y.dump(i,{indent:2,lineWidth:-1,noRefs:!0})),je()),{config:$e(),value:t.value}}catch(i){throw i instanceof J||i instanceof sn?i:new sn}finally{await r?.().catch(()=>{})}}async function If(e,n){let r=vf(ga(e),`.config-tmp-${xf(6).toString("hex")}`);try{let i=await Of(e);await Oe.promises.writeFile(r,n,{encoding:"utf-8",mode:i}),await Oe.promises.chmod(r,i),await Oe.promises.rename(r,e)}catch{throw await Oe.promises.unlink(r).catch(()=>{}),new sn}}async function Of(e){try{return(await Oe.promises.stat(e)).mode&511}catch(n){if(Rf(n)&&n.code==="ENOENT")return _a;throw n}}function Cf(e){if(!_f(e))return{};try{let n=Y.load(bf(e,"utf-8"));return me(n)?n:{}}catch{return{}}}function Lf(e){if(e)return Object.fromEntries(Object.entries(e).filter(([,n])=>me(n)))}function fi(e,n,r){r===void 0?delete e[n]:e[n]=r}function kf(e,n,r){let i=n.at(-1);if(!i)throw new J("Invalid config path");let t=e;for(let o of n.slice(0,-1)){if(!o||di.has(o))throw new J("Invalid config path");let a=t[o];if(me(a))t=a;else{let l={};t[o]=l,t=l}}t[i]=r}function pi(e){for(let[n,r]of Object.entries(e)){if(!n||di.has(n))throw new J(`Local runtime cannot update config field segment "${n}"`);me(r)&&pi(r)}}function Rf(e){return e instanceof Error&&"code"in e}function me(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Vf(e){let n=e.trim();if(!n)return null;if(n.startsWith("{"))try{let i=JSON.parse(n),t=typeof i.pid=="number"?i.pid:parseInt(String(i.pid),10);if(isNaN(t)||t<=0)return null;let o=Gf(i.owner)?i.owner:"unknown",a=Kf(i.startedAt);return{pid:t,owner:o,...a!==void 0?{startedAt:a}:{},...typeof i.mode=="string"?{mode:i.mode}:{},...typeof i.startupToken=="string"?{startupToken:i.startupToken}:{}}}catch{return null}let r=parseInt(n,10);return isNaN(r)||r<=0?null:{pid:r,owner:"unknown"}}function Gf(e){return e==="electron"||e==="cli"||e==="unknown"}function Kf(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e!="string")return;let n=new Date(e).getTime();return Number.isFinite(n)?n:void 0}function Yf(e,n){let r={pid:e,owner:n,startedAt:Date.now()};return JSON.stringify(r)}function Hf(){let e=process.argv.slice(2);for(let n=0;n<e.length;n++){let r=e[n],i=r==="--owner"?e[n+1]:r?.startsWith("--owner=")?r.slice(8):void 0;if(i==="electron")return"electron";if(i==="service"||i==="cli")return"cli"}return"cli"}import he from"node:fs";import Wf from"node:path";var ba="local-runtime.auth.json";function Z(e){return typeof e=="string"&&e.trim().length>0?e.trim():void 0}function mi(e){return e?{...Z(e.accessToken)?{accessToken:Z(e.accessToken)}:{},...Z(e.realUserID)?{realUserID:Z(e.realUserID)}:{},...Z(e.userEmail)?{userEmail:Z(e.userEmail)}:{},...Z(e.userName)?{userName:Z(e.userName)}:{},...Z(e.subUserName)?{subUserName:Z(e.subUserName)}:{}}:{}}function qn(e){return Wf.join(e,ba)}function qf(e){try{let n=he.readFileSync(qn(e),"utf-8"),r=JSON.parse(n);if(r.version!==1||!r.auth||typeof r.auth!="object")return;let i=mi(r.auth);return i.accessToken?i:void 0}catch{return}}function Xf(e,n,r={}){let i=qn(e),t=mi(n);if(!t.accessToken)return va(e),{path:i,written:!1};he.mkdirSync(e,{recursive:!0,mode:448});let o={version:1,updatedAtMs:Date.now(),auth:t},a=`${i}.${process.pid}.${Date.now()}.tmp`;return he.writeFileSync(a,`${JSON.stringify(o,null,2)}
38
+ `,{encoding:"utf-8",mode:384}),r.retryWindowsFileSystem?(Xn(()=>he.renameSync(a,i)),Xn(()=>he.chmodSync(i,384))):(he.renameSync(a,i),he.chmodSync(i,384)),{path:i,written:!0}}function va(e){try{he.rmSync(qn(e),{force:!0})}catch{}}import Aa from"node:net";var Ea={"e2e-runtime":5e3,"e2e-ui":5500,"smoke-runtime":7e3},hi=100;async function zf(e,n={}){let r=n.isPortFree??Jf,i=n.getFreePort??Zf,t=n.getWorktreeBasePort??Qf,o=t()+Ea[e],a=o-t();if(a<hi)throw new Error(`pickTestPort(${e}): role offset ${a} collides with app runtime (0); must be >= ${hi}.`);return o>65535?i():await r(o)?o:i()}function Qf(){let e=Ae();return e.autoDetected?e.runtimePort:ve}async function Jf(e){return new Promise(n=>{let r=Aa.createServer();r.once("error",()=>n(!1)),r.listen(e,"127.0.0.1",()=>{r.close(()=>n(!0))})})}async function Zf(){return new Promise((e,n)=>{let r=Aa.createServer();r.listen(0,"127.0.0.1",()=>{let i=r.address();if(i&&typeof i!="string"){let{port:t}=i;r.close(()=>e(t))}else r.close(()=>n(new Error("Failed to get free port")))}),r.on("error",n)})}import yi from"node:fs";import ed from"node:path";var nd=new Set(["native","mcp"]);function Sa(){return nn($e().cuBackend)}function rd(e){if(!nd.has(e))throw new Error(`invalid cuBackend value: ${String(e)}`);let n=Ee(),r={};try{let i=yi.readFileSync(n,"utf-8"),t=Y.load(i);t!=null&&typeof t=="object"&&!Array.isArray(t)&&(r=t)}catch{}r.cuBackend=e,yi.mkdirSync(ed.dirname(n),{recursive:!0}),yi.writeFileSync(n,Y.dump(r),"utf-8"),je()}function id(e=Sa()){Pt(e)}import Ma from"node:fs";var qe=class extends Error{code;configPath;constructor(n,r,i,t){super(i,t),this.name="ConfigFileError",this.code=n,this.configPath=r}};function td(e,n){Ma.existsSync(e)&&Yr(e);let r;try{r=Ma.readFileSync(e,"utf-8")}catch(t){throw new qe("CONFIG_READ_FAILED",e,`Cannot read config ${e}.`,{cause:t})}let i;try{i=Y.load(r)}catch(t){throw new qe("CONFIG_PARSE_FAILED",e,`Config is not valid YAML: ${e}`,{cause:t})}if(i==null||typeof i!="object"||Array.isArray(i))throw new qe("CONFIG_ROOT_INVALID",e,`Config root must be an object: ${e}`);return Hr(i,n.dataDir)}export{ya as a,Y as b,zu as c,en as d,nn as e,jt as f,En as g,pr as h,As as i,Vt as j,Fe as k,Gt as l,mr as m,Xt as n,zt as o,Jt as p,Zt as q,se as r,ks as s,Rs as t,Tr as u,Ir as v,Or as w,no as x,Cr as y,Ns as z,Us as A,Bs as B,js as C,$s as D,lo as E,uo as F,so as G,co as H,fo as I,z as J,Lr as K,kr as L,ne as M,Rr as N,vo as O,te as P,Tn as Q,On as R,Dr as S,Zs as T,Ao as U,Eo as V,Ur as W,ve as X,To as Y,lc as Z,Ae as _,sc as $,$r as aa,Ee as ba,Vr as ca,wn as da,Ro as ea,Gr as fa,xc as ga,_c as ha,je as ia,$e as ja,Do as ka,Fc as la,Uc as ma,Wr as na,qr as oa,Ve as pa,Xr as qa,zr as ra,jc as sa,Qr as ta,Uo as ua,$c as va,Ef as wa,Sf as xa,Mf as ya,Tf as za,Vf as Aa,Yf as Ba,Hf as Ca,ba as Da,mi as Ea,qn as Fa,qf as Ga,Xf as Ha,va as Ia,Ea as Ja,hi as Ka,zf as La,Sa as Ma,rd as Na,id as Oa,qe as Pa,td as Qa};