@fern-api/frond-cli 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.cjs +1966 -0
- package/package.json +17 -0
package/cli.cjs
ADDED
@@ -0,0 +1,1966 @@
|
|
1
|
+
"use strict";var Wu=Object.create;var mn=Object.defineProperty;var Hu=Object.getOwnPropertyDescriptor;var zu=Object.getOwnPropertyNames;var Qu=Object.getPrototypeOf,Zu=Object.prototype.hasOwnProperty;var g=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Xu=(n,e)=>{for(var t in e)mn(n,t,{get:e[t],enumerable:!0})},_i=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of zu(e))!Zu.call(n,s)&&s!==t&&mn(n,s,{get:()=>e[s],enumerable:!(r=Hu(e,s))||r.enumerable});return n};var x=(n,e,t)=>(t=n!=null?Wu(Qu(n)):{},_i(e||!n||!n.__esModule?mn(t,"default",{value:n,enumerable:!0}):t,n)),ef=n=>_i(mn({},"__esModule",{value:!0}),n);var Q=g(_r=>{"use strict";_r.fromCallback=function(n){return Object.defineProperty(function(...e){if(typeof e[e.length-1]=="function")n.apply(this,e);else return new Promise((t,r)=>{e.push((s,i)=>s!=null?r(s):t(i)),n.apply(this,e)})},"name",{value:n.name})};_r.fromPromise=function(n){return Object.defineProperty(function(...e){let t=e[e.length-1];if(typeof t!="function")return n.apply(this,e);e.pop(),n.apply(this,e).then(r=>t(null,r),t)},"name",{value:n.name})}});var Ki=g((Bg,Mi)=>{"use strict";var je=require("constants"),tf=process.cwd,yn=null,nf=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return yn||(yn=tf.call(process)),yn};try{process.cwd()}catch{}typeof process.chdir=="function"&&(Fr=process.chdir,process.chdir=function(n){yn=null,Fr.call(process,n)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Fr));var Fr;Mi.exports=rf;function rf(n){je.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(n),n.lutimes||t(n),n.chown=i(n.chown),n.fchown=i(n.fchown),n.lchown=i(n.lchown),n.chmod=r(n.chmod),n.fchmod=r(n.fchmod),n.lchmod=r(n.lchmod),n.chownSync=o(n.chownSync),n.fchownSync=o(n.fchownSync),n.lchownSync=o(n.lchownSync),n.chmodSync=s(n.chmodSync),n.fchmodSync=s(n.fchmodSync),n.lchmodSync=s(n.lchmodSync),n.stat=a(n.stat),n.fstat=a(n.fstat),n.lstat=a(n.lstat),n.statSync=c(n.statSync),n.fstatSync=c(n.fstatSync),n.lstatSync=c(n.lstatSync),n.chmod&&!n.lchmod&&(n.lchmod=function(u,f,d){d&&process.nextTick(d)},n.lchmodSync=function(){}),n.chown&&!n.lchown&&(n.lchown=function(u,f,d,h){h&&process.nextTick(h)},n.lchownSync=function(){}),nf==="win32"&&(n.rename=typeof n.rename!="function"?n.rename:function(u){function f(d,h,y){var p=Date.now(),m=0;u(d,h,function S(b){if(b&&(b.code==="EACCES"||b.code==="EPERM"||b.code==="EBUSY")&&Date.now()-p<6e4){setTimeout(function(){n.stat(h,function(w,E){w&&w.code==="ENOENT"?u(d,h,S):y(b)})},m),m<100&&(m+=10);return}y&&y(b)})}return Object.setPrototypeOf&&Object.setPrototypeOf(f,u),f}(n.rename)),n.read=typeof n.read!="function"?n.read:function(u){function f(d,h,y,p,m,S){var b;if(S&&typeof S=="function"){var w=0;b=function(E,C,N){if(E&&E.code==="EAGAIN"&&w<10)return w++,u.call(n,d,h,y,p,m,b);S.apply(this,arguments)}}return u.call(n,d,h,y,p,m,b)}return Object.setPrototypeOf&&Object.setPrototypeOf(f,u),f}(n.read),n.readSync=typeof n.readSync!="function"?n.readSync:function(u){return function(f,d,h,y,p){for(var m=0;;)try{return u.call(n,f,d,h,y,p)}catch(S){if(S.code==="EAGAIN"&&m<10){m++;continue}throw S}}}(n.readSync);function e(u){u.lchmod=function(f,d,h){u.open(f,je.O_WRONLY|je.O_SYMLINK,d,function(y,p){if(y){h&&h(y);return}u.fchmod(p,d,function(m){u.close(p,function(S){h&&h(m||S)})})})},u.lchmodSync=function(f,d){var h=u.openSync(f,je.O_WRONLY|je.O_SYMLINK,d),y=!0,p;try{p=u.fchmodSync(h,d),y=!1}finally{if(y)try{u.closeSync(h)}catch{}else u.closeSync(h)}return p}}function t(u){je.hasOwnProperty("O_SYMLINK")&&u.futimes?(u.lutimes=function(f,d,h,y){u.open(f,je.O_SYMLINK,function(p,m){if(p){y&&y(p);return}u.futimes(m,d,h,function(S){u.close(m,function(b){y&&y(S||b)})})})},u.lutimesSync=function(f,d,h){var y=u.openSync(f,je.O_SYMLINK),p,m=!0;try{p=u.futimesSync(y,d,h),m=!1}finally{if(m)try{u.closeSync(y)}catch{}else u.closeSync(y)}return p}):u.futimes&&(u.lutimes=function(f,d,h,y){y&&process.nextTick(y)},u.lutimesSync=function(){})}function r(u){return u&&function(f,d,h){return u.call(n,f,d,function(y){l(y)&&(y=null),h&&h.apply(this,arguments)})}}function s(u){return u&&function(f,d){try{return u.call(n,f,d)}catch(h){if(!l(h))throw h}}}function i(u){return u&&function(f,d,h,y){return u.call(n,f,d,h,function(p){l(p)&&(p=null),y&&y.apply(this,arguments)})}}function o(u){return u&&function(f,d,h){try{return u.call(n,f,d,h)}catch(y){if(!l(y))throw y}}}function a(u){return u&&function(f,d,h){typeof d=="function"&&(h=d,d=null);function y(p,m){m&&(m.uid<0&&(m.uid+=4294967296),m.gid<0&&(m.gid+=4294967296)),h&&h.apply(this,arguments)}return d?u.call(n,f,d,y):u.call(n,f,y)}}function c(u){return u&&function(f,d){var h=d?u.call(n,f,d):u.call(n,f);return h&&(h.uid<0&&(h.uid+=4294967296),h.gid<0&&(h.gid+=4294967296)),h}}function l(u){if(!u||u.code==="ENOSYS")return!0;var f=!process.getuid||process.getuid()!==0;return!!(f&&(u.code==="EINVAL"||u.code==="EPERM"))}}});var Ui=g((Gg,Gi)=>{"use strict";var Bi=require("stream").Stream;Gi.exports=sf;function sf(n){return{ReadStream:e,WriteStream:t};function e(r,s){if(!(this instanceof e))return new e(r,s);Bi.call(this);var i=this;this.path=r,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,s=s||{};for(var o=Object.keys(s),a=0,c=o.length;a<c;a++){var l=o[a];this[l]=s[l]}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(){i._read()});return}n.open(this.path,this.flags,this.mode,function(u,f){if(u){i.emit("error",u),i.readable=!1;return}i.fd=f,i.emit("open",f),i._read()})}function t(r,s){if(!(this instanceof t))return new t(r,s);Bi.call(this),this.path=r,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,s=s||{};for(var i=Object.keys(s),o=0,a=i.length;o<a;o++){var c=i[o];this[c]=s[c]}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=n.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var Yi=g((Ug,Ji)=>{"use strict";Ji.exports=af;var of=Object.getPrototypeOf||function(n){return n.__proto__};function af(n){if(n===null||typeof n!="object")return n;if(n instanceof Object)var e={__proto__:of(n)};else var e=Object.create(null);return Object.getOwnPropertyNames(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}),e}});var ut=g((Jg,Mr)=>{"use strict";var M=require("fs"),cf=Ki(),lf=Ui(),uf=Yi(),gn=require("util"),te,bn;typeof Symbol=="function"&&typeof Symbol.for=="function"?(te=Symbol.for("graceful-fs.queue"),bn=Symbol.for("graceful-fs.previous")):(te="___graceful-fs.queue",bn="___graceful-fs.previous");function ff(){}function Hi(n,e){Object.defineProperty(n,te,{get:function(){return e}})}var Xe=ff;gn.debuglog?Xe=gn.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Xe=function(){var n=gn.format.apply(gn,arguments);n="GFS4: "+n.split(/\n/).join(`
|
2
|
+
GFS4: `),console.error(n)});M[te]||(Vi=global[te]||[],Hi(M,Vi),M.close=function(n){function e(t,r){return n.call(M,t,function(s){s||Wi(),typeof r=="function"&&r.apply(this,arguments)})}return Object.defineProperty(e,bn,{value:n}),e}(M.close),M.closeSync=function(n){function e(t){n.apply(M,arguments),Wi()}return Object.defineProperty(e,bn,{value:n}),e}(M.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Xe(M[te]),require("assert").equal(M[te].length,0)}));var Vi;global[te]||Hi(global,M[te]);Mr.exports=jr(uf(M));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!M.__patched&&(Mr.exports=jr(M),M.__patched=!0);function jr(n){cf(n),n.gracefulify=jr,n.createReadStream=C,n.createWriteStream=N;var e=n.readFile;n.readFile=t;function t(k,D,$){return typeof D=="function"&&($=D,D=null),P(k,D,$);function P(B,z,R,K){return e(B,z,function(T){T&&(T.code==="EMFILE"||T.code==="ENFILE")?lt([P,[B,z,R],T,K||Date.now(),Date.now()]):typeof R=="function"&&R.apply(this,arguments)})}}var r=n.writeFile;n.writeFile=s;function s(k,D,$,P){return typeof $=="function"&&(P=$,$=null),B(k,D,$,P);function B(z,R,K,T,ee){return r(z,R,K,function(F){F&&(F.code==="EMFILE"||F.code==="ENFILE")?lt([B,[z,R,K,T],F,ee||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}var i=n.appendFile;i&&(n.appendFile=o);function o(k,D,$,P){return typeof $=="function"&&(P=$,$=null),B(k,D,$,P);function B(z,R,K,T,ee){return i(z,R,K,function(F){F&&(F.code==="EMFILE"||F.code==="ENFILE")?lt([B,[z,R,K,T],F,ee||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}var a=n.copyFile;a&&(n.copyFile=c);function c(k,D,$,P){return typeof $=="function"&&(P=$,$=0),B(k,D,$,P);function B(z,R,K,T,ee){return a(z,R,K,function(F){F&&(F.code==="EMFILE"||F.code==="ENFILE")?lt([B,[z,R,K,T],F,ee||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}var l=n.readdir;n.readdir=f;var u=/^v[0-5]\./;function f(k,D,$){typeof D=="function"&&($=D,D=null);var P=u.test(process.version)?function(R,K,T,ee){return l(R,B(R,K,T,ee))}:function(R,K,T,ee){return l(R,K,B(R,K,T,ee))};return P(k,D,$);function B(z,R,K,T){return function(ee,F){ee&&(ee.code==="EMFILE"||ee.code==="ENFILE")?lt([P,[z,R,K],ee,T||Date.now(),Date.now()]):(F&&F.sort&&F.sort(),typeof K=="function"&&K.call(this,ee,F))}}}if(process.version.substr(0,4)==="v0.8"){var d=lf(n);S=d.ReadStream,w=d.WriteStream}var h=n.ReadStream;h&&(S.prototype=Object.create(h.prototype),S.prototype.open=b);var y=n.WriteStream;y&&(w.prototype=Object.create(y.prototype),w.prototype.open=E),Object.defineProperty(n,"ReadStream",{get:function(){return S},set:function(k){S=k},enumerable:!0,configurable:!0}),Object.defineProperty(n,"WriteStream",{get:function(){return w},set:function(k){w=k},enumerable:!0,configurable:!0});var p=S;Object.defineProperty(n,"FileReadStream",{get:function(){return p},set:function(k){p=k},enumerable:!0,configurable:!0});var m=w;Object.defineProperty(n,"FileWriteStream",{get:function(){return m},set:function(k){m=k},enumerable:!0,configurable:!0});function S(k,D){return this instanceof S?(h.apply(this,arguments),this):S.apply(Object.create(S.prototype),arguments)}function b(){var k=this;v(k.path,k.flags,k.mode,function(D,$){D?(k.autoClose&&k.destroy(),k.emit("error",D)):(k.fd=$,k.emit("open",$),k.read())})}function w(k,D){return this instanceof w?(y.apply(this,arguments),this):w.apply(Object.create(w.prototype),arguments)}function E(){var k=this;v(k.path,k.flags,k.mode,function(D,$){D?(k.destroy(),k.emit("error",D)):(k.fd=$,k.emit("open",$))})}function C(k,D){return new n.ReadStream(k,D)}function N(k,D){return new n.WriteStream(k,D)}var q=n.open;n.open=v;function v(k,D,$,P){return typeof $=="function"&&(P=$,$=null),B(k,D,$,P);function B(z,R,K,T,ee){return q(z,R,K,function(F,jg){F&&(F.code==="EMFILE"||F.code==="ENFILE")?lt([B,[z,R,K,T],F,ee||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}return n}function lt(n){Xe("ENQUEUE",n[0].name,n[1]),M[te].push(n),Rr()}var Sn;function Wi(){for(var n=Date.now(),e=0;e<M[te].length;++e)M[te][e].length>2&&(M[te][e][3]=n,M[te][e][4]=n);Rr()}function Rr(){if(clearTimeout(Sn),Sn=void 0,M[te].length!==0){var n=M[te].shift(),e=n[0],t=n[1],r=n[2],s=n[3],i=n[4];if(s===void 0)Xe("RETRY",e.name,t),e.apply(null,t);else if(Date.now()-s>=6e4){Xe("TIMEOUT",e.name,t);var o=t.pop();typeof o=="function"&&o.call(null,r)}else{var a=Date.now()-i,c=Math.max(i-s,1),l=Math.min(c*1.2,100);a>=l?(Xe("RETRY",e.name,t),e.apply(null,t.concat([s]))):M[te].push(n)}Sn===void 0&&(Sn=setTimeout(Rr,0))}}});var le=g(Te=>{"use strict";var zi=Q().fromCallback,ce=ut(),df=["access","appendFile","chmod","chown","close","copyFile","cp","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","glob","lchmod","lchown","lutimes","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","utimes","writeFile"].filter(n=>typeof ce[n]=="function");Object.assign(Te,ce);df.forEach(n=>{Te[n]=zi(ce[n])});Te.exists=function(n,e){return typeof e=="function"?ce.exists(n,e):new Promise(t=>ce.exists(n,t))};Te.read=function(n,e,t,r,s,i){return typeof i=="function"?ce.read(n,e,t,r,s,i):new Promise((o,a)=>{ce.read(n,e,t,r,s,(c,l,u)=>{if(c)return a(c);o({bytesRead:l,buffer:u})})})};Te.write=function(n,e,...t){return typeof t[t.length-1]=="function"?ce.write(n,e,...t):new Promise((r,s)=>{ce.write(n,e,...t,(i,o,a)=>{if(i)return s(i);r({bytesWritten:o,buffer:a})})})};Te.readv=function(n,e,...t){return typeof t[t.length-1]=="function"?ce.readv(n,e,...t):new Promise((r,s)=>{ce.readv(n,e,...t,(i,o,a)=>{if(i)return s(i);r({bytesRead:o,buffers:a})})})};Te.writev=function(n,e,...t){return typeof t[t.length-1]=="function"?ce.writev(n,e,...t):new Promise((r,s)=>{ce.writev(n,e,...t,(i,o,a)=>{if(i)return s(i);r({bytesWritten:o,buffers:a})})})};typeof ce.realpath.native=="function"?Te.realpath.native=zi(ce.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var Zi=g((Vg,Qi)=>{"use strict";var pf=require("path");Qi.exports.checkPath=function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(pf.parse(e).root,""))){let r=new Error(`Path contains invalid characters: ${e}`);throw r.code="EINVAL",r}}});var no=g((Wg,Kr)=>{"use strict";var Xi=le(),{checkPath:eo}=Zi(),to=n=>{let e={mode:511};return typeof n=="number"?n:{...e,...n}.mode};Kr.exports.makeDir=async(n,e)=>(eo(n),Xi.mkdir(n,{mode:to(e),recursive:!0}));Kr.exports.makeDirSync=(n,e)=>(eo(n),Xi.mkdirSync(n,{mode:to(e),recursive:!0}))});var Ee=g((Hg,ro)=>{"use strict";var hf=Q().fromPromise,{makeDir:mf,makeDirSync:Br}=no(),Gr=hf(mf);ro.exports={mkdirs:Gr,mkdirsSync:Br,mkdirp:Gr,mkdirpSync:Br,ensureDir:Gr,ensureDirSync:Br}});var Re=g((zg,io)=>{"use strict";var yf=Q().fromPromise,so=le();function gf(n){return so.access(n).then(()=>!0).catch(()=>!1)}io.exports={pathExists:yf(gf),pathExistsSync:so.existsSync}});var Ur=g((Qg,oo)=>{"use strict";var ft=le(),Sf=Q().fromPromise;async function bf(n,e,t){let r=await ft.open(n,"r+"),s=null;try{await ft.futimes(r,e,t)}finally{try{await ft.close(r)}catch(i){s=i}}if(s)throw s}function wf(n,e,t){let r=ft.openSync(n,"r+");return ft.futimesSync(r,e,t),ft.closeSync(r)}oo.exports={utimesMillis:Sf(bf),utimesMillisSync:wf}});var et=g((Zg,uo)=>{"use strict";var dt=le(),Z=require("path"),ao=Q().fromPromise;function vf(n,e,t){let r=t.dereference?s=>dt.stat(s,{bigint:!0}):s=>dt.lstat(s,{bigint:!0});return Promise.all([r(n),r(e).catch(s=>{if(s.code==="ENOENT")return null;throw s})]).then(([s,i])=>({srcStat:s,destStat:i}))}function kf(n,e,t){let r,s=t.dereference?o=>dt.statSync(o,{bigint:!0}):o=>dt.lstatSync(o,{bigint:!0}),i=s(n);try{r=s(e)}catch(o){if(o.code==="ENOENT")return{srcStat:i,destStat:null};throw o}return{srcStat:i,destStat:r}}async function Ef(n,e,t,r){let{srcStat:s,destStat:i}=await vf(n,e,r);if(i){if($t(s,i)){let o=Z.basename(n),a=Z.basename(e);if(t==="move"&&o!==a&&o.toLowerCase()===a.toLowerCase())return{srcStat:s,destStat:i,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(s.isDirectory()&&!i.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${n}'.`);if(!s.isDirectory()&&i.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${n}'.`)}if(s.isDirectory()&&Jr(n,e))throw new Error(wn(n,e,t));return{srcStat:s,destStat:i}}function Cf(n,e,t,r){let{srcStat:s,destStat:i}=kf(n,e,r);if(i){if($t(s,i)){let o=Z.basename(n),a=Z.basename(e);if(t==="move"&&o!==a&&o.toLowerCase()===a.toLowerCase())return{srcStat:s,destStat:i,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(s.isDirectory()&&!i.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${n}'.`);if(!s.isDirectory()&&i.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${n}'.`)}if(s.isDirectory()&&Jr(n,e))throw new Error(wn(n,e,t));return{srcStat:s,destStat:i}}async function co(n,e,t,r){let s=Z.resolve(Z.dirname(n)),i=Z.resolve(Z.dirname(t));if(i===s||i===Z.parse(i).root)return;let o;try{o=await dt.stat(i,{bigint:!0})}catch(a){if(a.code==="ENOENT")return;throw a}if($t(e,o))throw new Error(wn(n,t,r));return co(n,e,i,r)}function lo(n,e,t,r){let s=Z.resolve(Z.dirname(n)),i=Z.resolve(Z.dirname(t));if(i===s||i===Z.parse(i).root)return;let o;try{o=dt.statSync(i,{bigint:!0})}catch(a){if(a.code==="ENOENT")return;throw a}if($t(e,o))throw new Error(wn(n,t,r));return lo(n,e,i,r)}function $t(n,e){return e.ino&&e.dev&&e.ino===n.ino&&e.dev===n.dev}function Jr(n,e){let t=Z.resolve(n).split(Z.sep).filter(s=>s),r=Z.resolve(e).split(Z.sep).filter(s=>s);return t.every((s,i)=>r[i]===s)}function wn(n,e,t){return`Cannot ${t} '${n}' to a subdirectory of itself, '${e}'.`}uo.exports={checkPaths:ao(Ef),checkPathsSync:Cf,checkParentPaths:ao(co),checkParentPathsSync:lo,isSrcSubdir:Jr,areIdentical:$t}});var yo=g((Xg,mo)=>{"use strict";var se=le(),Pt=require("path"),{mkdirs:Nf}=Ee(),{pathExists:Df}=Re(),{utimesMillis:$f}=Ur(),At=et();async function Pf(n,e,t={}){typeof t=="function"&&(t={filter:t}),t.clobber="clobber"in t?!!t.clobber:!0,t.overwrite="overwrite"in t?!!t.overwrite:t.clobber,t.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
|
3
|
+
|
4
|
+
see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:r,destStat:s}=await At.checkPaths(n,e,"copy",t);if(await At.checkParentPaths(n,r,e,"copy"),!await po(n,e,t))return;let o=Pt.dirname(e);await Df(o)||await Nf(o),await ho(s,n,e,t)}async function po(n,e,t){return t.filter?t.filter(n,e):!0}async function ho(n,e,t,r){let i=await(r.dereference?se.stat:se.lstat)(e);if(i.isDirectory())return If(i,n,e,t,r);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return Af(i,n,e,t,r);if(i.isSymbolicLink())return qf(n,e,t,r);throw i.isSocket()?new Error(`Cannot copy a socket file: ${e}`):i.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}async function Af(n,e,t,r,s){if(!e)return fo(n,t,r,s);if(s.overwrite)return await se.unlink(r),fo(n,t,r,s);if(s.errorOnExist)throw new Error(`'${r}' already exists`)}async function fo(n,e,t,r){if(await se.copyFile(e,t),r.preserveTimestamps){Lf(n.mode)&&await Of(t,n.mode);let s=await se.stat(e);await $f(t,s.atime,s.mtime)}return se.chmod(t,n.mode)}function Lf(n){return(n&128)===0}function Of(n,e){return se.chmod(n,e|128)}async function If(n,e,t,r,s){e||await se.mkdir(r);let i=[];for await(let o of await se.opendir(t)){let a=Pt.join(t,o.name),c=Pt.join(r,o.name);i.push(po(a,c,s).then(l=>{if(l)return At.checkPaths(a,c,"copy",s).then(({destStat:u})=>ho(u,a,c,s))}))}await Promise.all(i),e||await se.chmod(r,n.mode)}async function qf(n,e,t,r){let s=await se.readlink(e);if(r.dereference&&(s=Pt.resolve(process.cwd(),s)),!n)return se.symlink(s,t);let i=null;try{i=await se.readlink(t)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return se.symlink(s,t);throw o}if(r.dereference&&(i=Pt.resolve(process.cwd(),i)),At.isSrcSubdir(s,i))throw new Error(`Cannot copy '${s}' to a subdirectory of itself, '${i}'.`);if(At.isSrcSubdir(i,s))throw new Error(`Cannot overwrite '${i}' with '${s}'.`);return await se.unlink(t),se.symlink(s,t)}mo.exports=Pf});var vo=g((eS,wo)=>{"use strict";var ue=ut(),Lt=require("path"),Tf=Ee().mkdirsSync,xf=Ur().utimesMillisSync,Ot=et();function _f(n,e,t){typeof t=="function"&&(t={filter:t}),t=t||{},t.clobber="clobber"in t?!!t.clobber:!0,t.overwrite="overwrite"in t?!!t.overwrite:t.clobber,t.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
|
5
|
+
|
6
|
+
see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:r,destStat:s}=Ot.checkPathsSync(n,e,"copy",t);if(Ot.checkParentPathsSync(n,r,e,"copy"),t.filter&&!t.filter(n,e))return;let i=Lt.dirname(e);return ue.existsSync(i)||Tf(i),go(s,n,e,t)}function go(n,e,t,r){let i=(r.dereference?ue.statSync:ue.lstatSync)(e);if(i.isDirectory())return Gf(i,n,e,t,r);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return Ff(i,n,e,t,r);if(i.isSymbolicLink())return Yf(n,e,t,r);throw i.isSocket()?new Error(`Cannot copy a socket file: ${e}`):i.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}function Ff(n,e,t,r,s){return e?jf(n,t,r,s):So(n,t,r,s)}function jf(n,e,t,r){if(r.overwrite)return ue.unlinkSync(t),So(n,e,t,r);if(r.errorOnExist)throw new Error(`'${t}' already exists`)}function So(n,e,t,r){return ue.copyFileSync(e,t),r.preserveTimestamps&&Rf(n.mode,e,t),Yr(t,n.mode)}function Rf(n,e,t){return Mf(n)&&Kf(t,n),Bf(e,t)}function Mf(n){return(n&128)===0}function Kf(n,e){return Yr(n,e|128)}function Yr(n,e){return ue.chmodSync(n,e)}function Bf(n,e){let t=ue.statSync(n);return xf(e,t.atime,t.mtime)}function Gf(n,e,t,r,s){return e?bo(t,r,s):Uf(n.mode,t,r,s)}function Uf(n,e,t,r){return ue.mkdirSync(t),bo(e,t,r),Yr(t,n)}function bo(n,e,t){let r=ue.opendirSync(n);try{let s;for(;(s=r.readSync())!==null;)Jf(s.name,n,e,t)}finally{r.closeSync()}}function Jf(n,e,t,r){let s=Lt.join(e,n),i=Lt.join(t,n);if(r.filter&&!r.filter(s,i))return;let{destStat:o}=Ot.checkPathsSync(s,i,"copy",r);return go(o,s,i,r)}function Yf(n,e,t,r){let s=ue.readlinkSync(e);if(r.dereference&&(s=Lt.resolve(process.cwd(),s)),n){let i;try{i=ue.readlinkSync(t)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return ue.symlinkSync(s,t);throw o}if(r.dereference&&(i=Lt.resolve(process.cwd(),i)),Ot.isSrcSubdir(s,i))throw new Error(`Cannot copy '${s}' to a subdirectory of itself, '${i}'.`);if(Ot.isSrcSubdir(i,s))throw new Error(`Cannot overwrite '${i}' with '${s}'.`);return Vf(s,t)}else return ue.symlinkSync(s,t)}function Vf(n,e){return ue.unlinkSync(e),ue.symlinkSync(n,e)}wo.exports=_f});var vn=g((tS,ko)=>{"use strict";var Wf=Q().fromPromise;ko.exports={copy:Wf(yo()),copySync:vo()}});var It=g((nS,Co)=>{"use strict";var Eo=ut(),Hf=Q().fromCallback;function zf(n,e){Eo.rm(n,{recursive:!0,force:!0},e)}function Qf(n){Eo.rmSync(n,{recursive:!0,force:!0})}Co.exports={remove:Hf(zf),removeSync:Qf}});var Io=g((rS,Oo)=>{"use strict";var Zf=Q().fromPromise,$o=le(),Po=require("path"),Ao=Ee(),Lo=It(),No=Zf(async function(e){let t;try{t=await $o.readdir(e)}catch{return Ao.mkdirs(e)}return Promise.all(t.map(r=>Lo.remove(Po.join(e,r))))});function Do(n){let e;try{e=$o.readdirSync(n)}catch{return Ao.mkdirsSync(n)}e.forEach(t=>{t=Po.join(n,t),Lo.removeSync(t)})}Oo.exports={emptyDirSync:Do,emptydirSync:Do,emptyDir:No,emptydir:No}});var _o=g((sS,xo)=>{"use strict";var Xf=Q().fromPromise,qo=require("path"),xe=le(),To=Ee();async function ed(n){let e;try{e=await xe.stat(n)}catch{}if(e&&e.isFile())return;let t=qo.dirname(n),r=null;try{r=await xe.stat(t)}catch(s){if(s.code==="ENOENT"){await To.mkdirs(t),await xe.writeFile(n,"");return}else throw s}r.isDirectory()?await xe.writeFile(n,""):await xe.readdir(t)}function td(n){let e;try{e=xe.statSync(n)}catch{}if(e&&e.isFile())return;let t=qo.dirname(n);try{xe.statSync(t).isDirectory()||xe.readdirSync(t)}catch(r){if(r&&r.code==="ENOENT")To.mkdirsSync(t);else throw r}xe.writeFileSync(n,"")}xo.exports={createFile:Xf(ed),createFileSync:td}});var Ko=g((iS,Mo)=>{"use strict";var nd=Q().fromPromise,Fo=require("path"),Me=le(),jo=Ee(),{pathExists:rd}=Re(),{areIdentical:Ro}=et();async function sd(n,e){let t;try{t=await Me.lstat(e)}catch{}let r;try{r=await Me.lstat(n)}catch(o){throw o.message=o.message.replace("lstat","ensureLink"),o}if(t&&Ro(r,t))return;let s=Fo.dirname(e);await rd(s)||await jo.mkdirs(s),await Me.link(n,e)}function id(n,e){let t;try{t=Me.lstatSync(e)}catch{}try{let i=Me.lstatSync(n);if(t&&Ro(i,t))return}catch(i){throw i.message=i.message.replace("lstat","ensureLink"),i}let r=Fo.dirname(e);return Me.existsSync(r)||jo.mkdirsSync(r),Me.linkSync(n,e)}Mo.exports={createLink:nd(sd),createLinkSync:id}});var Go=g((oS,Bo)=>{"use strict";var Ke=require("path"),qt=le(),{pathExists:od}=Re(),ad=Q().fromPromise;async function cd(n,e){if(Ke.isAbsolute(n)){try{await qt.lstat(n)}catch(i){throw i.message=i.message.replace("lstat","ensureSymlink"),i}return{toCwd:n,toDst:n}}let t=Ke.dirname(e),r=Ke.join(t,n);if(await od(r))return{toCwd:r,toDst:n};try{await qt.lstat(n)}catch(i){throw i.message=i.message.replace("lstat","ensureSymlink"),i}return{toCwd:n,toDst:Ke.relative(t,n)}}function ld(n,e){if(Ke.isAbsolute(n)){if(!qt.existsSync(n))throw new Error("absolute srcpath does not exist");return{toCwd:n,toDst:n}}let t=Ke.dirname(e),r=Ke.join(t,n);if(qt.existsSync(r))return{toCwd:r,toDst:n};if(!qt.existsSync(n))throw new Error("relative srcpath does not exist");return{toCwd:n,toDst:Ke.relative(t,n)}}Bo.exports={symlinkPaths:ad(cd),symlinkPathsSync:ld}});var Yo=g((aS,Jo)=>{"use strict";var Uo=le(),ud=Q().fromPromise;async function fd(n,e){if(e)return e;let t;try{t=await Uo.lstat(n)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}function dd(n,e){if(e)return e;let t;try{t=Uo.lstatSync(n)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}Jo.exports={symlinkType:ud(fd),symlinkTypeSync:dd}});var zo=g((cS,Ho)=>{"use strict";var pd=Q().fromPromise,Vo=require("path"),Ae=le(),{mkdirs:hd,mkdirsSync:md}=Ee(),{symlinkPaths:yd,symlinkPathsSync:gd}=Go(),{symlinkType:Sd,symlinkTypeSync:bd}=Yo(),{pathExists:wd}=Re(),{areIdentical:Wo}=et();async function vd(n,e,t){let r;try{r=await Ae.lstat(e)}catch{}if(r&&r.isSymbolicLink()){let[a,c]=await Promise.all([Ae.stat(n),Ae.stat(e)]);if(Wo(a,c))return}let s=await yd(n,e);n=s.toDst;let i=await Sd(s.toCwd,t),o=Vo.dirname(e);return await wd(o)||await hd(o),Ae.symlink(n,e,i)}function kd(n,e,t){let r;try{r=Ae.lstatSync(e)}catch{}if(r&&r.isSymbolicLink()){let a=Ae.statSync(n),c=Ae.statSync(e);if(Wo(a,c))return}let s=gd(n,e);n=s.toDst,t=bd(s.toCwd,t);let i=Vo.dirname(e);return Ae.existsSync(i)||md(i),Ae.symlinkSync(n,e,t)}Ho.exports={createSymlink:pd(vd),createSymlinkSync:kd}});var sa=g((lS,ra)=>{"use strict";var{createFile:Qo,createFileSync:Zo}=_o(),{createLink:Xo,createLinkSync:ea}=Ko(),{createSymlink:ta,createSymlinkSync:na}=zo();ra.exports={createFile:Qo,createFileSync:Zo,ensureFile:Qo,ensureFileSync:Zo,createLink:Xo,createLinkSync:ea,ensureLink:Xo,ensureLinkSync:ea,createSymlink:ta,createSymlinkSync:na,ensureSymlink:ta,ensureSymlinkSync:na}});var kn=g((uS,ia)=>{"use strict";function Ed(n,{EOL:e=`
|
7
|
+
`,finalEOL:t=!0,replacer:r=null,spaces:s}={}){let i=t?e:"";return JSON.stringify(n,r,s).replace(/\n/g,e)+i}function Cd(n){return Buffer.isBuffer(n)&&(n=n.toString("utf8")),n.replace(/^\uFEFF/,"")}ia.exports={stringify:Ed,stripBom:Cd}});var la=g((fS,ca)=>{"use strict";var pt;try{pt=ut()}catch{pt=require("fs")}var En=Q(),{stringify:oa,stripBom:aa}=kn();async function Nd(n,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||pt,r="throws"in e?e.throws:!0,s=await En.fromCallback(t.readFile)(n,e);s=aa(s);let i;try{i=JSON.parse(s,e?e.reviver:null)}catch(o){if(r)throw o.message=`${n}: ${o.message}`,o;return null}return i}var Dd=En.fromPromise(Nd);function $d(n,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||pt,r="throws"in e?e.throws:!0;try{let s=t.readFileSync(n,e);return s=aa(s),JSON.parse(s,e.reviver)}catch(s){if(r)throw s.message=`${n}: ${s.message}`,s;return null}}async function Pd(n,e,t={}){let r=t.fs||pt,s=oa(e,t);await En.fromCallback(r.writeFile)(n,s,t)}var Ad=En.fromPromise(Pd);function Ld(n,e,t={}){let r=t.fs||pt,s=oa(e,t);return r.writeFileSync(n,s,t)}var Od={readFile:Dd,readFileSync:$d,writeFile:Ad,writeFileSync:Ld};ca.exports=Od});var fa=g((dS,ua)=>{"use strict";var Cn=la();ua.exports={readJson:Cn.readFile,readJsonSync:Cn.readFileSync,writeJson:Cn.writeFile,writeJsonSync:Cn.writeFileSync}});var Nn=g((pS,ha)=>{"use strict";var Id=Q().fromPromise,Vr=le(),da=require("path"),pa=Ee(),qd=Re().pathExists;async function Td(n,e,t="utf-8"){let r=da.dirname(n);return await qd(r)||await pa.mkdirs(r),Vr.writeFile(n,e,t)}function xd(n,...e){let t=da.dirname(n);Vr.existsSync(t)||pa.mkdirsSync(t),Vr.writeFileSync(n,...e)}ha.exports={outputFile:Id(Td),outputFileSync:xd}});var ya=g((hS,ma)=>{"use strict";var{stringify:_d}=kn(),{outputFile:Fd}=Nn();async function jd(n,e,t={}){let r=_d(e,t);await Fd(n,r,t)}ma.exports=jd});var Sa=g((mS,ga)=>{"use strict";var{stringify:Rd}=kn(),{outputFileSync:Md}=Nn();function Kd(n,e,t){let r=Rd(e,t);Md(n,r,t)}ga.exports=Kd});var wa=g((yS,ba)=>{"use strict";var Bd=Q().fromPromise,fe=fa();fe.outputJson=Bd(ya());fe.outputJsonSync=Sa();fe.outputJSON=fe.outputJson;fe.outputJSONSync=fe.outputJsonSync;fe.writeJSON=fe.writeJson;fe.writeJSONSync=fe.writeJsonSync;fe.readJSON=fe.readJson;fe.readJSONSync=fe.readJsonSync;ba.exports=fe});var Na=g((gS,Ca)=>{"use strict";var Gd=le(),va=require("path"),{copy:Ud}=vn(),{remove:Ea}=It(),{mkdirp:Jd}=Ee(),{pathExists:Yd}=Re(),ka=et();async function Vd(n,e,t={}){let r=t.overwrite||t.clobber||!1,{srcStat:s,isChangingCase:i=!1}=await ka.checkPaths(n,e,"move",t);await ka.checkParentPaths(n,s,e,"move");let o=va.dirname(e);return va.parse(o).root!==o&&await Jd(o),Wd(n,e,r,i)}async function Wd(n,e,t,r){if(!r){if(t)await Ea(e);else if(await Yd(e))throw new Error("dest already exists.")}try{await Gd.rename(n,e)}catch(s){if(s.code!=="EXDEV")throw s;await Hd(n,e,t)}}async function Hd(n,e,t){return await Ud(n,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),Ea(n)}Ca.exports=Vd});var La=g((SS,Aa)=>{"use strict";var $a=ut(),Hr=require("path"),zd=vn().copySync,Pa=It().removeSync,Qd=Ee().mkdirpSync,Da=et();function Zd(n,e,t){t=t||{};let r=t.overwrite||t.clobber||!1,{srcStat:s,isChangingCase:i=!1}=Da.checkPathsSync(n,e,"move",t);return Da.checkParentPathsSync(n,s,e,"move"),Xd(e)||Qd(Hr.dirname(e)),ep(n,e,r,i)}function Xd(n){let e=Hr.dirname(n);return Hr.parse(e).root===e}function ep(n,e,t,r){if(r)return Wr(n,e,t);if(t)return Pa(e),Wr(n,e,t);if($a.existsSync(e))throw new Error("dest already exists.");return Wr(n,e,t)}function Wr(n,e,t){try{$a.renameSync(n,e)}catch(r){if(r.code!=="EXDEV")throw r;return tp(n,e,t)}}function tp(n,e,t){return zd(n,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),Pa(n)}Aa.exports=Zd});var Ia=g((bS,Oa)=>{"use strict";var np=Q().fromPromise;Oa.exports={move:np(Na()),moveSync:La()}});var Ta=g((wS,qa)=>{"use strict";qa.exports={...le(),...vn(),...Io(),...sa(),...wa(),...Ee(),...Ia(),...Nn(),...Re(),...It()}});var A=g(ne=>{"use strict";var Qr=Symbol.for("yaml.alias"),Ba=Symbol.for("yaml.document"),An=Symbol.for("yaml.map"),Ga=Symbol.for("yaml.pair"),Zr=Symbol.for("yaml.scalar"),Ln=Symbol.for("yaml.seq"),_e=Symbol.for("yaml.node.type"),cp=n=>!!n&&typeof n=="object"&&n[_e]===Qr,lp=n=>!!n&&typeof n=="object"&&n[_e]===Ba,up=n=>!!n&&typeof n=="object"&&n[_e]===An,fp=n=>!!n&&typeof n=="object"&&n[_e]===Ga,Ua=n=>!!n&&typeof n=="object"&&n[_e]===Zr,dp=n=>!!n&&typeof n=="object"&&n[_e]===Ln;function Ja(n){if(n&&typeof n=="object")switch(n[_e]){case An:case Ln:return!0}return!1}function pp(n){if(n&&typeof n=="object")switch(n[_e]){case Qr:case An:case Zr:case Ln:return!0}return!1}var hp=n=>(Ua(n)||Ja(n))&&!!n.anchor;ne.ALIAS=Qr;ne.DOC=Ba;ne.MAP=An;ne.NODE_TYPE=_e;ne.PAIR=Ga;ne.SCALAR=Zr;ne.SEQ=Ln;ne.hasAnchor=hp;ne.isAlias=cp;ne.isCollection=Ja;ne.isDocument=lp;ne.isMap=up;ne.isNode=pp;ne.isPair=fp;ne.isScalar=Ua;ne.isSeq=dp});var xt=g(Xr=>{"use strict";var J=A(),he=Symbol("break visit"),Ya=Symbol("skip children"),Le=Symbol("remove node");function On(n,e){let t=Va(e);J.isDocument(n)?ht(null,n.contents,t,Object.freeze([n]))===Le&&(n.contents=null):ht(null,n,t,Object.freeze([]))}On.BREAK=he;On.SKIP=Ya;On.REMOVE=Le;function ht(n,e,t,r){let s=Wa(n,e,t,r);if(J.isNode(s)||J.isPair(s))return Ha(n,r,s),ht(n,s,t,r);if(typeof s!="symbol"){if(J.isCollection(e)){r=Object.freeze(r.concat(e));for(let i=0;i<e.items.length;++i){let o=ht(i,e.items[i],t,r);if(typeof o=="number")i=o-1;else{if(o===he)return he;o===Le&&(e.items.splice(i,1),i-=1)}}}else if(J.isPair(e)){r=Object.freeze(r.concat(e));let i=ht("key",e.key,t,r);if(i===he)return he;i===Le&&(e.key=null);let o=ht("value",e.value,t,r);if(o===he)return he;o===Le&&(e.value=null)}}return s}async function In(n,e){let t=Va(e);J.isDocument(n)?await mt(null,n.contents,t,Object.freeze([n]))===Le&&(n.contents=null):await mt(null,n,t,Object.freeze([]))}In.BREAK=he;In.SKIP=Ya;In.REMOVE=Le;async function mt(n,e,t,r){let s=await Wa(n,e,t,r);if(J.isNode(s)||J.isPair(s))return Ha(n,r,s),mt(n,s,t,r);if(typeof s!="symbol"){if(J.isCollection(e)){r=Object.freeze(r.concat(e));for(let i=0;i<e.items.length;++i){let o=await mt(i,e.items[i],t,r);if(typeof o=="number")i=o-1;else{if(o===he)return he;o===Le&&(e.items.splice(i,1),i-=1)}}}else if(J.isPair(e)){r=Object.freeze(r.concat(e));let i=await mt("key",e.key,t,r);if(i===he)return he;i===Le&&(e.key=null);let o=await mt("value",e.value,t,r);if(o===he)return he;o===Le&&(e.value=null)}}return s}function Va(n){return typeof n=="object"&&(n.Collection||n.Node||n.Value)?Object.assign({Alias:n.Node,Map:n.Node,Scalar:n.Node,Seq:n.Node},n.Value&&{Map:n.Value,Scalar:n.Value,Seq:n.Value},n.Collection&&{Map:n.Collection,Seq:n.Collection},n):n}function Wa(n,e,t,r){if(typeof t=="function")return t(n,e,r);if(J.isMap(e))return t.Map?.(n,e,r);if(J.isSeq(e))return t.Seq?.(n,e,r);if(J.isPair(e))return t.Pair?.(n,e,r);if(J.isScalar(e))return t.Scalar?.(n,e,r);if(J.isAlias(e))return t.Alias?.(n,e,r)}function Ha(n,e,t){let r=e[e.length-1];if(J.isCollection(r))r.items[n]=t;else if(J.isPair(r))n==="key"?r.key=t:r.value=t;else if(J.isDocument(r))r.contents=t;else{let s=J.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${s} parent`)}}Xr.visit=On;Xr.visitAsync=In});var es=g(Qa=>{"use strict";var za=A(),mp=xt(),yp={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},gp=n=>n.replace(/[!,[\]{}]/g,e=>yp[e]),_t=class n{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},n.defaultYaml,e),this.tags=Object.assign({},n.defaultTags,t)}clone(){let e=new n(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new n(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:n.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},n.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:n.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},n.defaultTags),this.atNextDocument=!1);let r=e.trim().split(/[ \t]+/),s=r.shift();switch(s){case"%TAG":{if(r.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[i,o]=r;return this.tags[i]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[i]=r;if(i==="1.1"||i==="1.2")return this.yaml.version=i,!0;{let o=/^\d+\.\d+$/.test(i);return t(6,`Unsupported YAML version ${i}`,o),!1}}default:return t(0,`Unknown directive ${s}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}let[,r,s]=e.match(/^(.*!)([^!]*)$/s);s||t(`The ${e} tag has no suffix`);let i=this.tags[r];if(i)try{return i+decodeURIComponent(s)}catch(o){return t(String(o)),null}return r==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,r]of Object.entries(this.tags))if(e.startsWith(r))return t+gp(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),s;if(e&&r.length>0&&za.isNode(e.contents)){let i={};mp.visit(e.contents,(o,a)=>{za.isNode(a)&&a.tag&&(i[a.tag]=!0)}),s=Object.keys(i)}else s=[];for(let[i,o]of r)i==="!!"&&o==="tag:yaml.org,2002:"||(!e||s.some(a=>a.startsWith(o)))&&t.push(`%TAG ${i} ${o}`);return t.join(`
|
8
|
+
`)}};_t.defaultYaml={explicit:!1,version:"1.2"};_t.defaultTags={"!!":"tag:yaml.org,2002:"};Qa.Directives=_t});var qn=g(Ft=>{"use strict";var Za=A(),Sp=xt();function bp(n){if(/[\x00-\x19\s,[\]{}]/.test(n)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(n)}`;throw new Error(t)}return!0}function Xa(n){let e=new Set;return Sp.visit(n,{Value(t,r){r.anchor&&e.add(r.anchor)}}),e}function ec(n,e){for(let t=1;;++t){let r=`${n}${t}`;if(!e.has(r))return r}}function wp(n,e){let t=[],r=new Map,s=null;return{onAnchor:i=>{t.push(i),s??(s=Xa(n));let o=ec(e,s);return s.add(o),o},setAnchors:()=>{for(let i of t){let o=r.get(i);if(typeof o=="object"&&o.anchor&&(Za.isScalar(o.node)||Za.isCollection(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=i,a}}},sourceObjects:r}}Ft.anchorIsValid=bp;Ft.anchorNames=Xa;Ft.createNodeAnchors=wp;Ft.findNewAnchor=ec});var ts=g(tc=>{"use strict";function jt(n,e,t,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let s=0,i=r.length;s<i;++s){let o=r[s],a=jt(n,r,String(s),o);a===void 0?delete r[s]:a!==o&&(r[s]=a)}else if(r instanceof Map)for(let s of Array.from(r.keys())){let i=r.get(s),o=jt(n,r,s,i);o===void 0?r.delete(s):o!==i&&r.set(s,o)}else if(r instanceof Set)for(let s of Array.from(r)){let i=jt(n,r,s,s);i===void 0?r.delete(s):i!==s&&(r.delete(s),r.add(i))}else for(let[s,i]of Object.entries(r)){let o=jt(n,r,s,i);o===void 0?delete r[s]:o!==i&&(r[s]=o)}return n.call(e,t,r)}tc.applyReviver=jt});var Be=g(rc=>{"use strict";var vp=A();function nc(n,e,t){if(Array.isArray(n))return n.map((r,s)=>nc(r,String(s),t));if(n&&typeof n.toJSON=="function"){if(!t||!vp.hasAnchor(n))return n.toJSON(e,t);let r={aliasCount:0,count:1,res:void 0};t.anchors.set(n,r),t.onCreate=i=>{r.res=i,delete t.onCreate};let s=n.toJSON(e,t);return t.onCreate&&t.onCreate(s),s}return typeof n=="bigint"&&!t?.keep?Number(n):n}rc.toJS=nc});var Tn=g(ic=>{"use strict";var kp=ts(),sc=A(),Ep=Be(),ns=class{constructor(e){Object.defineProperty(this,sc.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:r,onAnchor:s,reviver:i}={}){if(!sc.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},a=Ep.toJS(this,"",o);if(typeof s=="function")for(let{count:c,res:l}of o.anchors.values())s(l,c);return typeof i=="function"?kp.applyReviver(i,{"":a},"",a):a}};ic.NodeBase=ns});var Rt=g(oc=>{"use strict";var Cp=qn(),Np=xt(),yt=A(),Dp=Tn(),$p=Be(),rs=class extends Dp.NodeBase{constructor(e){super(yt.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){let r;t?.aliasResolveCache?r=t.aliasResolveCache:(r=[],Np.visit(e,{Node:(i,o)=>{(yt.isAlias(o)||yt.hasAnchor(o))&&r.push(o)}}),t&&(t.aliasResolveCache=r));let s;for(let i of r){if(i===this)break;i.anchor===this.source&&(s=i)}return s}toJSON(e,t){if(!t)return{source:this.source};let{anchors:r,doc:s,maxAliasCount:i}=t,o=this.resolve(s,t);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=r.get(o);if(a||($p.toJS(o,null,t),a=r.get(o)),!a||a.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=xn(s,o,r)),a.count*a.aliasCount>i)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,t,r){let s=`*${this.source}`;if(e){if(Cp.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(i)}if(e.implicitKey)return`${s} `}return s}};function xn(n,e,t){if(yt.isAlias(e)){let r=e.resolve(n),s=t&&r&&t.get(r);return s?s.count*s.aliasCount:0}else if(yt.isCollection(e)){let r=0;for(let s of e.items){let i=xn(n,s,t);i>r&&(r=i)}return r}else if(yt.isPair(e)){let r=xn(n,e.key,t),s=xn(n,e.value,t);return Math.max(r,s)}return 1}oc.Alias=rs});var G=g(ss=>{"use strict";var Pp=A(),Ap=Tn(),Lp=Be(),Op=n=>!n||typeof n!="function"&&typeof n!="object",Ge=class extends Ap.NodeBase{constructor(e){super(Pp.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:Lp.toJS(this.value,e,t)}toString(){return String(this.value)}};Ge.BLOCK_FOLDED="BLOCK_FOLDED";Ge.BLOCK_LITERAL="BLOCK_LITERAL";Ge.PLAIN="PLAIN";Ge.QUOTE_DOUBLE="QUOTE_DOUBLE";Ge.QUOTE_SINGLE="QUOTE_SINGLE";ss.Scalar=Ge;ss.isScalarValue=Op});var Mt=g(cc=>{"use strict";var Ip=Rt(),tt=A(),ac=G(),qp="tag:yaml.org,2002:";function Tp(n,e,t){if(e){let r=t.filter(i=>i.tag===e),s=r.find(i=>!i.format)??r[0];if(!s)throw new Error(`Tag ${e} not found`);return s}return t.find(r=>r.identify?.(n)&&!r.format)}function xp(n,e,t){if(tt.isDocument(n)&&(n=n.contents),tt.isNode(n))return n;if(tt.isPair(n)){let f=t.schema[tt.MAP].createNode?.(t.schema,null,t);return f.items.push(n),f}(n instanceof String||n instanceof Number||n instanceof Boolean||typeof BigInt<"u"&&n instanceof BigInt)&&(n=n.valueOf());let{aliasDuplicateObjects:r,onAnchor:s,onTagObj:i,schema:o,sourceObjects:a}=t,c;if(r&&n&&typeof n=="object"){if(c=a.get(n),c)return c.anchor??(c.anchor=s(n)),new Ip.Alias(c.anchor);c={anchor:null,node:null},a.set(n,c)}e?.startsWith("!!")&&(e=qp+e.slice(2));let l=Tp(n,e,o.tags);if(!l){if(n&&typeof n.toJSON=="function"&&(n=n.toJSON()),!n||typeof n!="object"){let f=new ac.Scalar(n);return c&&(c.node=f),f}l=n instanceof Map?o[tt.MAP]:Symbol.iterator in Object(n)?o[tt.SEQ]:o[tt.MAP]}i&&(i(l),delete t.onTagObj);let u=l?.createNode?l.createNode(t.schema,n,t):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(t.schema,n,t):new ac.Scalar(n);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}cc.createNode=xp});var Fn=g(_n=>{"use strict";var _p=Mt(),Oe=A(),Fp=Tn();function is(n,e,t){let r=t;for(let s=e.length-1;s>=0;--s){let i=e[s];if(typeof i=="number"&&Number.isInteger(i)&&i>=0){let o=[];o[i]=r,r=o}else r=new Map([[i,r]])}return _p.createNode(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:n,sourceObjects:new Map})}var lc=n=>n==null||typeof n=="object"&&!!n[Symbol.iterator]().next().done,os=class extends Fp.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(r=>Oe.isNode(r)||Oe.isPair(r)?r.clone(e):r),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(lc(e))this.add(t);else{let[r,...s]=e,i=this.get(r,!0);if(Oe.isCollection(i))i.addIn(s,t);else if(i===void 0&&this.schema)this.set(r,is(this.schema,s,t));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${s}`)}}deleteIn(e){let[t,...r]=e;if(r.length===0)return this.delete(t);let s=this.get(t,!0);if(Oe.isCollection(s))return s.deleteIn(r);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${r}`)}getIn(e,t){let[r,...s]=e,i=this.get(r,!0);return s.length===0?!t&&Oe.isScalar(i)?i.value:i:Oe.isCollection(i)?i.getIn(s,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!Oe.isPair(t))return!1;let r=t.value;return r==null||e&&Oe.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[t,...r]=e;if(r.length===0)return this.has(t);let s=this.get(t,!0);return Oe.isCollection(s)?s.hasIn(r):!1}setIn(e,t){let[r,...s]=e;if(s.length===0)this.set(r,t);else{let i=this.get(r,!0);if(Oe.isCollection(i))i.setIn(s,t);else if(i===void 0&&this.schema)this.set(r,is(this.schema,s,t));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${s}`)}}};_n.Collection=os;_n.collectionFromPath=is;_n.isEmptyPath=lc});var Kt=g(jn=>{"use strict";var jp=n=>n.replace(/^(?!$)(?: $)?/gm,"#");function as(n,e){return/^\n+$/.test(n)?n.substring(1):e?n.replace(/^(?! *$)/gm,e):n}var Rp=(n,e,t)=>n.endsWith(`
|
9
|
+
`)?as(t,e):t.includes(`
|
10
|
+
`)?`
|
11
|
+
`+as(t,e):(n.endsWith(" ")?"":" ")+t;jn.indentComment=as;jn.lineComment=Rp;jn.stringifyComment=jp});var fc=g(Bt=>{"use strict";var Mp="flow",cs="block",Rn="quoted";function Kp(n,e,t="flow",{indentAtStart:r,lineWidth:s=80,minContentWidth:i=20,onFold:o,onOverflow:a}={}){if(!s||s<0)return n;s<i&&(i=0);let c=Math.max(1+i,1+s-e.length);if(n.length<=c)return n;let l=[],u={},f=s-e.length;typeof r=="number"&&(r>s-Math.max(2,i)?l.push(0):f=s-r);let d,h,y=!1,p=-1,m=-1,S=-1;t===cs&&(p=uc(n,p,e.length),p!==-1&&(f=p+c));for(let w;w=n[p+=1];){if(t===Rn&&w==="\\"){switch(m=p,n[p+1]){case"x":p+=3;break;case"u":p+=5;break;case"U":p+=9;break;default:p+=1}S=p}if(w===`
|
12
|
+
`)t===cs&&(p=uc(n,p,e.length)),f=p+e.length+c,d=void 0;else{if(w===" "&&h&&h!==" "&&h!==`
|
13
|
+
`&&h!==" "){let E=n[p+1];E&&E!==" "&&E!==`
|
14
|
+
`&&E!==" "&&(d=p)}if(p>=f)if(d)l.push(d),f=d+c,d=void 0;else if(t===Rn){for(;h===" "||h===" ";)h=w,w=n[p+=1],y=!0;let E=p>S+1?p-2:m-1;if(u[E])return n;l.push(E),u[E]=!0,f=E+c,d=void 0}else y=!0}h=w}if(y&&a&&a(),l.length===0)return n;o&&o();let b=n.slice(0,l[0]);for(let w=0;w<l.length;++w){let E=l[w],C=l[w+1]||n.length;E===0?b=`
|
15
|
+
${e}${n.slice(0,C)}`:(t===Rn&&u[E]&&(b+=`${n[E]}\\`),b+=`
|
16
|
+
${e}${n.slice(E+1,C)}`)}return b}function uc(n,e,t){let r=e,s=e+1,i=n[s];for(;i===" "||i===" ";)if(e<s+t)i=n[++e];else{do i=n[++e];while(i&&i!==`
|
17
|
+
`);r=e,s=e+1,i=n[s]}return r}Bt.FOLD_BLOCK=cs;Bt.FOLD_FLOW=Mp;Bt.FOLD_QUOTED=Rn;Bt.foldFlowLines=Kp});var Ut=g(dc=>{"use strict";var Ce=G(),Ue=fc(),Kn=(n,e)=>({indentAtStart:e?n.indent.length:n.indentAtStart,lineWidth:n.options.lineWidth,minContentWidth:n.options.minContentWidth}),Bn=n=>/^(%|---|\.\.\.)/m.test(n);function Bp(n,e,t){if(!e||e<0)return!1;let r=e-t,s=n.length;if(s<=r)return!1;for(let i=0,o=0;i<s;++i)if(n[i]===`
|
18
|
+
`){if(i-o>r)return!0;if(o=i+1,s-o<=r)return!1}return!0}function Gt(n,e){let t=JSON.stringify(n);if(e.options.doubleQuotedAsJSON)return t;let{implicitKey:r}=e,s=e.options.doubleQuotedMinMultiLineLength,i=e.indent||(Bn(n)?" ":""),o="",a=0;for(let c=0,l=t[c];l;l=t[++c])if(l===" "&&t[c+1]==="\\"&&t[c+2]==="n"&&(o+=t.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(t[c+1]){case"u":{o+=t.slice(a,c);let u=t.substr(c+2,4);switch(u){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:u.substr(0,2)==="00"?o+="\\x"+u.substr(2):o+=t.substr(c,6)}c+=5,a=c+1}break;case"n":if(r||t[c+2]==='"'||t.length<s)c+=1;else{for(o+=t.slice(a,c)+`
|
19
|
+
|
20
|
+
`;t[c+2]==="\\"&&t[c+3]==="n"&&t[c+4]!=='"';)o+=`
|
21
|
+
`,c+=2;o+=i,t[c+2]===" "&&(o+="\\"),c+=1,a=c+1}break;default:c+=1}return o=a?o+t.slice(a):t,r?o:Ue.foldFlowLines(o,i,Ue.FOLD_QUOTED,Kn(e,!1))}function ls(n,e){if(e.options.singleQuote===!1||e.implicitKey&&n.includes(`
|
22
|
+
`)||/[ \t]\n|\n[ \t]/.test(n))return Gt(n,e);let t=e.indent||(Bn(n)?" ":""),r="'"+n.replace(/'/g,"''").replace(/\n+/g,`$&
|
23
|
+
${t}`)+"'";return e.implicitKey?r:Ue.foldFlowLines(r,t,Ue.FOLD_FLOW,Kn(e,!1))}function gt(n,e){let{singleQuote:t}=e.options,r;if(t===!1)r=Gt;else{let s=n.includes('"'),i=n.includes("'");s&&!i?r=ls:i&&!s?r=Gt:r=t?ls:Gt}return r(n,e)}var us;try{us=new RegExp(`(^|(?<!
|
24
|
+
))
|
25
|
+
+(?!
|
26
|
+
|$)`,"g")}catch{us=/\n+(?!\n|$)/g}function Mn({comment:n,type:e,value:t},r,s,i){let{blockQuote:o,commentString:a,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(t)||/^\s*$/.test(t))return gt(t,r);let l=r.indent||(r.forceBlockIndent||Bn(t)?" ":""),u=o==="literal"?!0:o==="folded"||e===Ce.Scalar.BLOCK_FOLDED?!1:e===Ce.Scalar.BLOCK_LITERAL?!0:!Bp(t,c,l.length);if(!t)return u?`|
|
27
|
+
`:`>
|
28
|
+
`;let f,d;for(d=t.length;d>0;--d){let C=t[d-1];if(C!==`
|
29
|
+
`&&C!==" "&&C!==" ")break}let h=t.substring(d),y=h.indexOf(`
|
30
|
+
`);y===-1?f="-":t===h||y!==h.length-1?(f="+",i&&i()):f="",h&&(t=t.slice(0,-h.length),h[h.length-1]===`
|
31
|
+
`&&(h=h.slice(0,-1)),h=h.replace(us,`$&${l}`));let p=!1,m,S=-1;for(m=0;m<t.length;++m){let C=t[m];if(C===" ")p=!0;else if(C===`
|
32
|
+
`)S=m;else break}let b=t.substring(0,S<m?S+1:m);b&&(t=t.substring(b.length),b=b.replace(/\n+/g,`$&${l}`));let E=(p?l?"2":"1":"")+f;if(n&&(E+=" "+a(n.replace(/ ?[\r\n]+/g," ")),s&&s()),!u){let C=t.replace(/\n+/g,`
|
33
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),N=!1,q=Kn(r,!0);o!=="folded"&&e!==Ce.Scalar.BLOCK_FOLDED&&(q.onOverflow=()=>{N=!0});let v=Ue.foldFlowLines(`${b}${C}${h}`,l,Ue.FOLD_BLOCK,q);if(!N)return`>${E}
|
34
|
+
${l}${v}`}return t=t.replace(/\n+/g,`$&${l}`),`|${E}
|
35
|
+
${l}${b}${t}${h}`}function Gp(n,e,t,r){let{type:s,value:i}=n,{actualString:o,implicitKey:a,indent:c,indentStep:l,inFlow:u}=e;if(a&&i.includes(`
|
36
|
+
`)||u&&/[[\]{},]/.test(i))return gt(i,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(i))return a||u||!i.includes(`
|
37
|
+
`)?gt(i,e):Mn(n,e,t,r);if(!a&&!u&&s!==Ce.Scalar.PLAIN&&i.includes(`
|
38
|
+
`))return Mn(n,e,t,r);if(Bn(i)){if(c==="")return e.forceBlockIndent=!0,Mn(n,e,t,r);if(a&&c===l)return gt(i,e)}let f=i.replace(/\n+/g,`$&
|
39
|
+
${c}`);if(o){let d=p=>p.default&&p.tag!=="tag:yaml.org,2002:str"&&p.test?.test(f),{compat:h,tags:y}=e.doc.schema;if(y.some(d)||h?.some(d))return gt(i,e)}return a?f:Ue.foldFlowLines(f,c,Ue.FOLD_FLOW,Kn(e,!1))}function Up(n,e,t,r){let{implicitKey:s,inFlow:i}=e,o=typeof n.value=="string"?n:Object.assign({},n,{value:String(n.value)}),{type:a}=n;a!==Ce.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=Ce.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Ce.Scalar.BLOCK_FOLDED:case Ce.Scalar.BLOCK_LITERAL:return s||i?gt(o.value,e):Mn(o,e,t,r);case Ce.Scalar.QUOTE_DOUBLE:return Gt(o.value,e);case Ce.Scalar.QUOTE_SINGLE:return ls(o.value,e);case Ce.Scalar.PLAIN:return Gp(o,e,t,r);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:f}=e.options,d=s&&u||f;if(l=c(d),l===null)throw new Error(`Unsupported default string type ${d}`)}return l}dc.stringifyString=Up});var Jt=g(fs=>{"use strict";var Jp=qn(),Je=A(),Yp=Kt(),Vp=Ut();function Wp(n,e){let t=Object.assign({blockQuote:!0,commentString:Yp.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trueStr:"true",verifyAliasOrder:!0},n.schema.toStringOptions,e),r;switch(t.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:n,flowCollectionPadding:t.flowCollectionPadding?" ":"",indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:r,options:t}}function Hp(n,e){if(e.tag){let s=n.filter(i=>i.tag===e.tag);if(s.length>0)return s.find(i=>i.format===e.format)??s[0]}let t,r;if(Je.isScalar(e)){r=e.value;let s=n.filter(i=>i.identify?.(r));if(s.length>1){let i=s.filter(o=>o.test);i.length>0&&(s=i)}t=s.find(i=>i.format===e.format)??s.find(i=>!i.format)}else r=e,t=n.find(s=>s.nodeClass&&r instanceof s.nodeClass);if(!t){let s=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${s} value`)}return t}function zp(n,e,{anchors:t,doc:r}){if(!r.directives)return"";let s=[],i=(Je.isScalar(n)||Je.isCollection(n))&&n.anchor;i&&Jp.anchorIsValid(i)&&(t.add(i),s.push(`&${i}`));let o=n.tag??(e.default?null:e.tag);return o&&s.push(r.directives.tagString(o)),s.join(" ")}function Qp(n,e,t,r){if(Je.isPair(n))return n.toString(e,t,r);if(Je.isAlias(n)){if(e.doc.directives)return n.toString(e);if(e.resolvedAliases?.has(n))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(n):e.resolvedAliases=new Set([n]),n=n.resolve(e.doc)}let s,i=Je.isNode(n)?n:e.doc.createNode(n,{onTagObj:c=>s=c});s??(s=Hp(e.doc.schema.tags,i));let o=zp(i,s,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof s.stringify=="function"?s.stringify(i,e,t,r):Je.isScalar(i)?Vp.stringifyString(i,e,t,r):i.toString(e,t,r);return o?Je.isScalar(i)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
|
40
|
+
${e.indent}${a}`:a}fs.createStringifyContext=Wp;fs.stringify=Qp});var yc=g(mc=>{"use strict";var Fe=A(),pc=G(),hc=Jt(),Yt=Kt();function Zp({key:n,value:e},t,r,s){let{allNullValues:i,doc:o,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:f}}=t,d=Fe.isNode(n)&&n.comment||null;if(f){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(Fe.isCollection(n)||!Fe.isNode(n)&&typeof n=="object"){let q="With simple keys, collection cannot be used as a key value";throw new Error(q)}}let h=!f&&(!n||d&&e==null&&!t.inFlow||Fe.isCollection(n)||(Fe.isScalar(n)?n.type===pc.Scalar.BLOCK_FOLDED||n.type===pc.Scalar.BLOCK_LITERAL:typeof n=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!h&&(f||!i),indent:a+c});let y=!1,p=!1,m=hc.stringify(n,t,()=>y=!0,()=>p=!0);if(!h&&!t.inFlow&&m.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");h=!0}if(t.inFlow){if(i||e==null)return y&&r&&r(),m===""?"?":h?`? ${m}`:m}else if(i&&!f||e==null&&h)return m=`? ${m}`,d&&!y?m+=Yt.lineComment(m,t.indent,l(d)):p&&s&&s(),m;y&&(d=null),h?(d&&(m+=Yt.lineComment(m,t.indent,l(d))),m=`? ${m}
|
41
|
+
${a}:`):(m=`${m}:`,d&&(m+=Yt.lineComment(m,t.indent,l(d))));let S,b,w;Fe.isNode(e)?(S=!!e.spaceBefore,b=e.commentBefore,w=e.comment):(S=!1,b=null,w=null,e&&typeof e=="object"&&(e=o.createNode(e))),t.implicitKey=!1,!h&&!d&&Fe.isScalar(e)&&(t.indentAtStart=m.length+1),p=!1,!u&&c.length>=2&&!t.inFlow&&!h&&Fe.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let E=!1,C=hc.stringify(e,t,()=>E=!0,()=>p=!0),N=" ";if(d||S||b){if(N=S?`
|
42
|
+
`:"",b){let q=l(b);N+=`
|
43
|
+
${Yt.indentComment(q,t.indent)}`}C===""&&!t.inFlow?N===`
|
44
|
+
`&&(N=`
|
45
|
+
|
46
|
+
`):N+=`
|
47
|
+
${t.indent}`}else if(!h&&Fe.isCollection(e)){let q=C[0],v=C.indexOf(`
|
48
|
+
`),k=v!==-1,D=t.inFlow??e.flow??e.items.length===0;if(k||!D){let $=!1;if(k&&(q==="&"||q==="!")){let P=C.indexOf(" ");q==="&"&&P!==-1&&P<v&&C[P+1]==="!"&&(P=C.indexOf(" ",P+1)),(P===-1||v<P)&&($=!0)}$||(N=`
|
49
|
+
${t.indent}`)}}else(C===""||C[0]===`
|
50
|
+
`)&&(N="");return m+=N+C,t.inFlow?E&&r&&r():w&&!E?m+=Yt.lineComment(m,t.indent,l(w)):p&&s&&s(),m}mc.stringifyPair=Zp});var ps=g(ds=>{"use strict";var gc=require("process");function Xp(n,...e){n==="debug"&&console.log(...e)}function eh(n,e){(n==="debug"||n==="warn")&&(typeof gc.emitWarning=="function"?gc.emitWarning(e):console.warn(e))}ds.debug=Xp;ds.warn=eh});var Yn=g(Jn=>{"use strict";var Vt=A(),Sc=G(),Gn="<<",Un={identify:n=>n===Gn||typeof n=="symbol"&&n.description===Gn,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Sc.Scalar(Symbol(Gn)),{addToJSMap:bc}),stringify:()=>Gn},th=(n,e)=>(Un.identify(e)||Vt.isScalar(e)&&(!e.type||e.type===Sc.Scalar.PLAIN)&&Un.identify(e.value))&&n?.doc.schema.tags.some(t=>t.tag===Un.tag&&t.default);function bc(n,e,t){if(t=n&&Vt.isAlias(t)?t.resolve(n.doc):t,Vt.isSeq(t))for(let r of t.items)hs(n,e,r);else if(Array.isArray(t))for(let r of t)hs(n,e,r);else hs(n,e,t)}function hs(n,e,t){let r=n&&Vt.isAlias(t)?t.resolve(n.doc):t;if(!Vt.isMap(r))throw new Error("Merge sources must be maps or map aliases");let s=r.toJSON(null,n,Map);for(let[i,o]of s)e instanceof Map?e.has(i)||e.set(i,o):e instanceof Set?e.add(i):Object.prototype.hasOwnProperty.call(e,i)||Object.defineProperty(e,i,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}Jn.addMergeToJSMap=bc;Jn.isMergeKey=th;Jn.merge=Un});var ys=g(kc=>{"use strict";var nh=ps(),wc=Yn(),rh=Jt(),vc=A(),ms=Be();function sh(n,e,{key:t,value:r}){if(vc.isNode(t)&&t.addToJSMap)t.addToJSMap(n,e,r);else if(wc.isMergeKey(n,t))wc.addMergeToJSMap(n,e,r);else{let s=ms.toJS(t,"",n);if(e instanceof Map)e.set(s,ms.toJS(r,s,n));else if(e instanceof Set)e.add(s);else{let i=ih(t,s,n),o=ms.toJS(r,i,n);i in e?Object.defineProperty(e,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[i]=o}}return e}function ih(n,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(vc.isNode(n)&&t?.doc){let r=rh.createStringifyContext(t.doc,{});r.anchors=new Set;for(let i of t.anchors.keys())r.anchors.add(i.anchor);r.inFlow=!0,r.inStringifyKey=!0;let s=n.toString(r);if(!t.mapKeyWarned){let i=JSON.stringify(s);i.length>40&&(i=i.substring(0,36)+'..."'),nh.warn(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${i}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return s}return JSON.stringify(e)}kc.addPairToJSMap=sh});var Ye=g(gs=>{"use strict";var Ec=Mt(),oh=yc(),ah=ys(),Vn=A();function ch(n,e,t){let r=Ec.createNode(n,void 0,t),s=Ec.createNode(e,void 0,t);return new Wn(r,s)}var Wn=class n{constructor(e,t=null){Object.defineProperty(this,Vn.NODE_TYPE,{value:Vn.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:r}=this;return Vn.isNode(t)&&(t=t.clone(e)),Vn.isNode(r)&&(r=r.clone(e)),new n(t,r)}toJSON(e,t){let r=t?.mapAsMap?new Map:{};return ah.addPairToJSMap(t,r,this)}toString(e,t,r){return e?.doc?oh.stringifyPair(this,e,t,r):JSON.stringify(this)}};gs.Pair=Wn;gs.createPair=ch});var Ss=g(Nc=>{"use strict";var nt=A(),Cc=Jt(),Hn=Kt();function lh(n,e,t){return(e.inFlow??n.flow?fh:uh)(n,e,t)}function uh({comment:n,items:e},t,{blockItemPrefix:r,flowChars:s,itemIndent:i,onChompKeep:o,onComment:a}){let{indent:c,options:{commentString:l}}=t,u=Object.assign({},t,{indent:i,type:null}),f=!1,d=[];for(let y=0;y<e.length;++y){let p=e[y],m=null;if(nt.isNode(p))!f&&p.spaceBefore&&d.push(""),zn(t,d,p.commentBefore,f),p.comment&&(m=p.comment);else if(nt.isPair(p)){let b=nt.isNode(p.key)?p.key:null;b&&(!f&&b.spaceBefore&&d.push(""),zn(t,d,b.commentBefore,f))}f=!1;let S=Cc.stringify(p,u,()=>m=null,()=>f=!0);m&&(S+=Hn.lineComment(S,i,l(m))),f&&m&&(f=!1),d.push(r+S)}let h;if(d.length===0)h=s.start+s.end;else{h=d[0];for(let y=1;y<d.length;++y){let p=d[y];h+=p?`
|
51
|
+
${c}${p}`:`
|
52
|
+
`}}return n?(h+=`
|
53
|
+
`+Hn.indentComment(l(n),c),a&&a()):f&&o&&o(),h}function fh({items:n},e,{flowChars:t,itemIndent:r}){let{indent:s,indentStep:i,flowCollectionPadding:o,options:{commentString:a}}=e;r+=i;let c=Object.assign({},e,{indent:r,inFlow:!0,type:null}),l=!1,u=0,f=[];for(let y=0;y<n.length;++y){let p=n[y],m=null;if(nt.isNode(p))p.spaceBefore&&f.push(""),zn(e,f,p.commentBefore,!1),p.comment&&(m=p.comment);else if(nt.isPair(p)){let b=nt.isNode(p.key)?p.key:null;b&&(b.spaceBefore&&f.push(""),zn(e,f,b.commentBefore,!1),b.comment&&(l=!0));let w=nt.isNode(p.value)?p.value:null;w?(w.comment&&(m=w.comment),w.commentBefore&&(l=!0)):p.value==null&&b?.comment&&(m=b.comment)}m&&(l=!0);let S=Cc.stringify(p,c,()=>m=null);y<n.length-1&&(S+=","),m&&(S+=Hn.lineComment(S,r,a(m))),!l&&(f.length>u||S.includes(`
|
54
|
+
`))&&(l=!0),f.push(S),u=f.length}let{start:d,end:h}=t;if(f.length===0)return d+h;if(!l){let y=f.reduce((p,m)=>p+m.length+2,2);l=e.options.lineWidth>0&&y>e.options.lineWidth}if(l){let y=d;for(let p of f)y+=p?`
|
55
|
+
${i}${s}${p}`:`
|
56
|
+
`;return`${y}
|
57
|
+
${s}${h}`}else return`${d}${o}${f.join(" ")}${o}${h}`}function zn({indent:n,options:{commentString:e}},t,r,s){if(r&&s&&(r=r.replace(/^\n+/,"")),r){let i=Hn.indentComment(e(r),n);t.push(i.trimStart())}}Nc.stringifyCollection=lh});var We=g(ws=>{"use strict";var dh=Ss(),ph=ys(),hh=Fn(),Ve=A(),Qn=Ye(),mh=G();function Wt(n,e){let t=Ve.isScalar(e)?e.value:e;for(let r of n)if(Ve.isPair(r)&&(r.key===e||r.key===t||Ve.isScalar(r.key)&&r.key.value===t))return r}var bs=class extends hh.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Ve.MAP,e),this.items=[]}static from(e,t,r){let{keepUndefined:s,replacer:i}=r,o=new this(e),a=(c,l)=>{if(typeof i=="function")l=i.call(t,c,l);else if(Array.isArray(i)&&!i.includes(c))return;(l!==void 0||s)&&o.items.push(Qn.createPair(c,l,r))};if(t instanceof Map)for(let[c,l]of t)a(c,l);else if(t&&typeof t=="object")for(let c of Object.keys(t))a(c,t[c]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,t){let r;Ve.isPair(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new Qn.Pair(e,e?.value):r=new Qn.Pair(e.key,e.value);let s=Wt(this.items,r.key),i=this.schema?.sortMapEntries;if(s){if(!t)throw new Error(`Key ${r.key} already set`);Ve.isScalar(s.value)&&mh.isScalarValue(r.value)?s.value.value=r.value:s.value=r.value}else if(i){let o=this.items.findIndex(a=>i(r,a)<0);o===-1?this.items.push(r):this.items.splice(o,0,r)}else this.items.push(r)}delete(e){let t=Wt(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let s=Wt(this.items,e)?.value;return(!t&&Ve.isScalar(s)?s.value:s)??void 0}has(e){return!!Wt(this.items,e)}set(e,t){this.add(new Qn.Pair(e,t),!0)}toJSON(e,t,r){let s=r?new r:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(s);for(let i of this.items)ph.addPairToJSMap(t,s,i);return s}toString(e,t,r){if(!e)return JSON.stringify(this);for(let s of this.items)if(!Ve.isPair(s))throw new Error(`Map items must all be pairs; found ${JSON.stringify(s)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),dh.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:t})}};ws.YAMLMap=bs;ws.findPair=Wt});var St=g($c=>{"use strict";var yh=A(),Dc=We(),gh={collection:"map",default:!0,nodeClass:Dc.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(n,e){return yh.isMap(n)||e("Expected a mapping for this tag"),n},createNode:(n,e,t)=>Dc.YAMLMap.from(n,e,t)};$c.map=gh});var He=g(Pc=>{"use strict";var Sh=Mt(),bh=Ss(),wh=Fn(),Xn=A(),vh=G(),kh=Be(),vs=class extends wh.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Xn.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=Zn(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){let r=Zn(e);if(typeof r!="number")return;let s=this.items[r];return!t&&Xn.isScalar(s)?s.value:s}has(e){let t=Zn(e);return typeof t=="number"&&t<this.items.length}set(e,t){let r=Zn(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let s=this.items[r];Xn.isScalar(s)&&vh.isScalarValue(t)?s.value=t:this.items[r]=t}toJSON(e,t){let r=[];t?.onCreate&&t.onCreate(r);let s=0;for(let i of this.items)r.push(kh.toJS(i,String(s++),t));return r}toString(e,t,r){return e?bh.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:t}):JSON.stringify(this)}static from(e,t,r){let{replacer:s}=r,i=new this(e);if(t&&Symbol.iterator in Object(t)){let o=0;for(let a of t){if(typeof s=="function"){let c=t instanceof Set?a:String(o++);a=s.call(t,c,a)}i.items.push(Sh.createNode(a,void 0,r))}}return i}};function Zn(n){let e=Xn.isScalar(n)?n.value:n;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}Pc.YAMLSeq=vs});var bt=g(Lc=>{"use strict";var Eh=A(),Ac=He(),Ch={collection:"seq",default:!0,nodeClass:Ac.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(n,e){return Eh.isSeq(n)||e("Expected a sequence for this tag"),n},createNode:(n,e,t)=>Ac.YAMLSeq.from(n,e,t)};Lc.seq=Ch});var Ht=g(Oc=>{"use strict";var Nh=Ut(),Dh={identify:n=>typeof n=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:n=>n,stringify(n,e,t,r){return e=Object.assign({actualString:!0},e),Nh.stringifyString(n,e,t,r)}};Oc.string=Dh});var er=g(Tc=>{"use strict";var Ic=G(),qc={identify:n=>n==null,createNode:()=>new Ic.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Ic.Scalar(null),stringify:({source:n},e)=>typeof n=="string"&&qc.test.test(n)?n:e.options.nullStr};Tc.nullTag=qc});var ks=g(_c=>{"use strict";var $h=G(),xc={identify:n=>typeof n=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:n=>new $h.Scalar(n[0]==="t"||n[0]==="T"),stringify({source:n,value:e},t){if(n&&xc.test.test(n)){let r=n[0]==="t"||n[0]==="T";if(e===r)return n}return e?t.options.trueStr:t.options.falseStr}};_c.boolTag=xc});var wt=g(Fc=>{"use strict";function Ph({format:n,minFractionDigits:e,tag:t,value:r}){if(typeof r=="bigint")return String(r);let s=typeof r=="number"?r:Number(r);if(!isFinite(s))return isNaN(s)?".nan":s<0?"-.inf":".inf";let i=JSON.stringify(r);if(!n&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^\d/.test(i)){let o=i.indexOf(".");o<0&&(o=i.length,i+=".");let a=e-(i.length-o-1);for(;a-- >0;)i+="0"}return i}Fc.stringifyNumber=Ph});var Cs=g(tr=>{"use strict";var Ah=G(),Es=wt(),Lh={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:n=>n.slice(-3).toLowerCase()==="nan"?NaN:n[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Es.stringifyNumber},Oh={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:n=>parseFloat(n),stringify(n){let e=Number(n.value);return isFinite(e)?e.toExponential():Es.stringifyNumber(n)}},Ih={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(n){let e=new Ah.Scalar(parseFloat(n)),t=n.indexOf(".");return t!==-1&&n[n.length-1]==="0"&&(e.minFractionDigits=n.length-t-1),e},stringify:Es.stringifyNumber};tr.float=Ih;tr.floatExp=Oh;tr.floatNaN=Lh});var Ds=g(rr=>{"use strict";var jc=wt(),nr=n=>typeof n=="bigint"||Number.isInteger(n),Ns=(n,e,t,{intAsBigInt:r})=>r?BigInt(n):parseInt(n.substring(e),t);function Rc(n,e,t){let{value:r}=n;return nr(r)&&r>=0?t+r.toString(e):jc.stringifyNumber(n)}var qh={identify:n=>nr(n)&&n>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(n,e,t)=>Ns(n,2,8,t),stringify:n=>Rc(n,8,"0o")},Th={identify:nr,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(n,e,t)=>Ns(n,0,10,t),stringify:jc.stringifyNumber},xh={identify:n=>nr(n)&&n>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(n,e,t)=>Ns(n,2,16,t),stringify:n=>Rc(n,16,"0x")};rr.int=Th;rr.intHex=xh;rr.intOct=qh});var Kc=g(Mc=>{"use strict";var _h=St(),Fh=er(),jh=bt(),Rh=Ht(),Mh=ks(),$s=Cs(),Ps=Ds(),Kh=[_h.map,jh.seq,Rh.string,Fh.nullTag,Mh.boolTag,Ps.intOct,Ps.int,Ps.intHex,$s.floatNaN,$s.floatExp,$s.float];Mc.schema=Kh});var Uc=g(Gc=>{"use strict";var Bh=G(),Gh=St(),Uh=bt();function Bc(n){return typeof n=="bigint"||Number.isInteger(n)}var sr=({value:n})=>JSON.stringify(n),Jh=[{identify:n=>typeof n=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:n=>n,stringify:sr},{identify:n=>n==null,createNode:()=>new Bh.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:sr},{identify:n=>typeof n=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:n=>n==="true",stringify:sr},{identify:Bc,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(n,e,{intAsBigInt:t})=>t?BigInt(n):parseInt(n,10),stringify:({value:n})=>Bc(n)?n.toString():JSON.stringify(n)},{identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:n=>parseFloat(n),stringify:sr}],Yh={default:!0,tag:"",test:/^/,resolve(n,e){return e(`Unresolved plain scalar ${JSON.stringify(n)}`),n}},Vh=[Gh.map,Uh.seq].concat(Jh,Yh);Gc.schema=Vh});var Ls=g(Jc=>{"use strict";var zt=require("buffer"),As=G(),Wh=Ut(),Hh={identify:n=>n instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(n,e){if(typeof zt.Buffer=="function")return zt.Buffer.from(n,"base64");if(typeof atob=="function"){let t=atob(n.replace(/[\n\r]/g,"")),r=new Uint8Array(t.length);for(let s=0;s<t.length;++s)r[s]=t.charCodeAt(s);return r}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),n},stringify({comment:n,type:e,value:t},r,s,i){if(!t)return"";let o=t,a;if(typeof zt.Buffer=="function")a=o instanceof zt.Buffer?o.toString("base64"):zt.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<o.length;++l)c+=String.fromCharCode(o[l]);a=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=As.Scalar.BLOCK_LITERAL),e!==As.Scalar.QUOTE_DOUBLE){let c=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),l=Math.ceil(a.length/c),u=new Array(l);for(let f=0,d=0;f<l;++f,d+=c)u[f]=a.substr(d,c);a=u.join(e===As.Scalar.BLOCK_LITERAL?`
|
58
|
+
`:" ")}return Wh.stringifyString({comment:n,type:e,value:a},r,s,i)}};Jc.binary=Hh});var ar=g(or=>{"use strict";var ir=A(),Os=Ye(),zh=G(),Qh=He();function Yc(n,e){if(ir.isSeq(n))for(let t=0;t<n.items.length;++t){let r=n.items[t];if(!ir.isPair(r)){if(ir.isMap(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let s=r.items[0]||new Os.Pair(new zh.Scalar(null));if(r.commentBefore&&(s.key.commentBefore=s.key.commentBefore?`${r.commentBefore}
|
59
|
+
${s.key.commentBefore}`:r.commentBefore),r.comment){let i=s.value??s.key;i.comment=i.comment?`${r.comment}
|
60
|
+
${i.comment}`:r.comment}r=s}n.items[t]=ir.isPair(r)?r:new Os.Pair(r)}}else e("Expected a sequence for this tag");return n}function Vc(n,e,t){let{replacer:r}=t,s=new Qh.YAMLSeq(n);s.tag="tag:yaml.org,2002:pairs";let i=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof r=="function"&&(o=r.call(e,String(i++),o));let a,c;if(Array.isArray(o))if(o.length===2)a=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let l=Object.keys(o);if(l.length===1)a=l[0],c=o[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=o;s.items.push(Os.createPair(a,c,t))}return s}var Zh={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Yc,createNode:Vc};or.createPairs=Vc;or.pairs=Zh;or.resolvePairs=Yc});var Ts=g(qs=>{"use strict";var Wc=A(),Is=Be(),Qt=We(),Xh=He(),Hc=ar(),rt=class n extends Xh.YAMLSeq{constructor(){super(),this.add=Qt.YAMLMap.prototype.add.bind(this),this.delete=Qt.YAMLMap.prototype.delete.bind(this),this.get=Qt.YAMLMap.prototype.get.bind(this),this.has=Qt.YAMLMap.prototype.has.bind(this),this.set=Qt.YAMLMap.prototype.set.bind(this),this.tag=n.tag}toJSON(e,t){if(!t)return super.toJSON(e);let r=new Map;t?.onCreate&&t.onCreate(r);for(let s of this.items){let i,o;if(Wc.isPair(s)?(i=Is.toJS(s.key,"",t),o=Is.toJS(s.value,i,t)):i=Is.toJS(s,"",t),r.has(i))throw new Error("Ordered maps must not include duplicate keys");r.set(i,o)}return r}static from(e,t,r){let s=Hc.createPairs(e,t,r),i=new this;return i.items=s.items,i}};rt.tag="tag:yaml.org,2002:omap";var em={collection:"seq",identify:n=>n instanceof Map,nodeClass:rt,default:!1,tag:"tag:yaml.org,2002:omap",resolve(n,e){let t=Hc.resolvePairs(n,e),r=[];for(let{key:s}of t.items)Wc.isScalar(s)&&(r.includes(s.value)?e(`Ordered maps must not include duplicate keys: ${s.value}`):r.push(s.value));return Object.assign(new rt,t)},createNode:(n,e,t)=>rt.from(n,e,t)};qs.YAMLOMap=rt;qs.omap=em});var el=g(xs=>{"use strict";var zc=G();function Qc({value:n,source:e},t){return e&&(n?Zc:Xc).test.test(e)?e:n?t.options.trueStr:t.options.falseStr}var Zc={identify:n=>n===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new zc.Scalar(!0),stringify:Qc},Xc={identify:n=>n===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new zc.Scalar(!1),stringify:Qc};xs.falseTag=Xc;xs.trueTag=Zc});var tl=g(cr=>{"use strict";var tm=G(),_s=wt(),nm={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:n=>n.slice(-3).toLowerCase()==="nan"?NaN:n[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:_s.stringifyNumber},rm={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:n=>parseFloat(n.replace(/_/g,"")),stringify(n){let e=Number(n.value);return isFinite(e)?e.toExponential():_s.stringifyNumber(n)}},sm={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(n){let e=new tm.Scalar(parseFloat(n.replace(/_/g,""))),t=n.indexOf(".");if(t!==-1){let r=n.substring(t+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:_s.stringifyNumber};cr.float=sm;cr.floatExp=rm;cr.floatNaN=nm});var rl=g(Xt=>{"use strict";var nl=wt(),Zt=n=>typeof n=="bigint"||Number.isInteger(n);function lr(n,e,t,{intAsBigInt:r}){let s=n[0];if((s==="-"||s==="+")&&(e+=1),n=n.substring(e).replace(/_/g,""),r){switch(t){case 2:n=`0b${n}`;break;case 8:n=`0o${n}`;break;case 16:n=`0x${n}`;break}let o=BigInt(n);return s==="-"?BigInt(-1)*o:o}let i=parseInt(n,t);return s==="-"?-1*i:i}function Fs(n,e,t){let{value:r}=n;if(Zt(r)){let s=r.toString(e);return r<0?"-"+t+s.substr(1):t+s}return nl.stringifyNumber(n)}var im={identify:Zt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(n,e,t)=>lr(n,2,2,t),stringify:n=>Fs(n,2,"0b")},om={identify:Zt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(n,e,t)=>lr(n,1,8,t),stringify:n=>Fs(n,8,"0")},am={identify:Zt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(n,e,t)=>lr(n,0,10,t),stringify:nl.stringifyNumber},cm={identify:Zt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(n,e,t)=>lr(n,2,16,t),stringify:n=>Fs(n,16,"0x")};Xt.int=am;Xt.intBin=im;Xt.intHex=cm;Xt.intOct=om});var Rs=g(js=>{"use strict";var dr=A(),ur=Ye(),fr=We(),st=class n extends fr.YAMLMap{constructor(e){super(e),this.tag=n.tag}add(e){let t;dr.isPair(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new ur.Pair(e.key,null):t=new ur.Pair(e,null),fr.findPair(this.items,t.key)||this.items.push(t)}get(e,t){let r=fr.findPair(this.items,e);return!t&&dr.isPair(r)?dr.isScalar(r.key)?r.key.value:r.key:r}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let r=fr.findPair(this.items,e);r&&!t?this.items.splice(this.items.indexOf(r),1):!r&&t&&this.items.push(new ur.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,r);throw new Error("Set items must all have null values")}static from(e,t,r){let{replacer:s}=r,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let o of t)typeof s=="function"&&(o=s.call(t,o,o)),i.items.push(ur.createPair(o,null,r));return i}};st.tag="tag:yaml.org,2002:set";var lm={collection:"map",identify:n=>n instanceof Set,nodeClass:st,default:!1,tag:"tag:yaml.org,2002:set",createNode:(n,e,t)=>st.from(n,e,t),resolve(n,e){if(dr.isMap(n)){if(n.hasAllNullValues(!0))return Object.assign(new st,n);e("Set items must all have null values")}else e("Expected a mapping for this tag");return n}};js.YAMLSet=st;js.set=lm});var Ks=g(pr=>{"use strict";var um=wt();function Ms(n,e){let t=n[0],r=t==="-"||t==="+"?n.substring(1):n,s=o=>e?BigInt(o):Number(o),i=r.replace(/_/g,"").split(":").reduce((o,a)=>o*s(60)+s(a),s(0));return t==="-"?s(-1)*i:i}function sl(n){let{value:e}=n,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return um.stringifyNumber(n);let r="";e<0&&(r="-",e*=t(-1));let s=t(60),i=[e%s];return e<60?i.unshift(0):(e=(e-i[0])/s,i.unshift(e%s),e>=60&&(e=(e-i[0])/s,i.unshift(e))),r+i.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var fm={identify:n=>typeof n=="bigint"||Number.isInteger(n),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(n,e,{intAsBigInt:t})=>Ms(n,t),stringify:sl},dm={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:n=>Ms(n,!1),stringify:sl},il={identify:n=>n instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(n){let e=n.match(il.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,t,r,s,i,o,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(t,r-1,s,i||0,o||0,a||0,c),u=e[8];if(u&&u!=="Z"){let f=Ms(u,!1);Math.abs(f)<30&&(f*=60),l-=6e4*f}return new Date(l)},stringify:({value:n})=>n?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};pr.floatTime=dm;pr.intTime=fm;pr.timestamp=il});var cl=g(al=>{"use strict";var pm=St(),hm=er(),mm=bt(),ym=Ht(),gm=Ls(),ol=el(),Bs=tl(),hr=rl(),Sm=Yn(),bm=Ts(),wm=ar(),vm=Rs(),Gs=Ks(),km=[pm.map,mm.seq,ym.string,hm.nullTag,ol.trueTag,ol.falseTag,hr.intBin,hr.intOct,hr.int,hr.intHex,Bs.floatNaN,Bs.floatExp,Bs.float,gm.binary,Sm.merge,bm.omap,wm.pairs,vm.set,Gs.intTime,Gs.floatTime,Gs.timestamp];al.schema=km});var Sl=g(Ys=>{"use strict";var dl=St(),Em=er(),pl=bt(),Cm=Ht(),Nm=ks(),Us=Cs(),Js=Ds(),Dm=Kc(),$m=Uc(),hl=Ls(),en=Yn(),ml=Ts(),yl=ar(),ll=cl(),gl=Rs(),mr=Ks(),ul=new Map([["core",Dm.schema],["failsafe",[dl.map,pl.seq,Cm.string]],["json",$m.schema],["yaml11",ll.schema],["yaml-1.1",ll.schema]]),fl={binary:hl.binary,bool:Nm.boolTag,float:Us.float,floatExp:Us.floatExp,floatNaN:Us.floatNaN,floatTime:mr.floatTime,int:Js.int,intHex:Js.intHex,intOct:Js.intOct,intTime:mr.intTime,map:dl.map,merge:en.merge,null:Em.nullTag,omap:ml.omap,pairs:yl.pairs,seq:pl.seq,set:gl.set,timestamp:mr.timestamp},Pm={"tag:yaml.org,2002:binary":hl.binary,"tag:yaml.org,2002:merge":en.merge,"tag:yaml.org,2002:omap":ml.omap,"tag:yaml.org,2002:pairs":yl.pairs,"tag:yaml.org,2002:set":gl.set,"tag:yaml.org,2002:timestamp":mr.timestamp};function Am(n,e,t){let r=ul.get(e);if(r&&!n)return t&&!r.includes(en.merge)?r.concat(en.merge):r.slice();let s=r;if(!s)if(Array.isArray(n))s=[];else{let i=Array.from(ul.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${i} or define customTags array`)}if(Array.isArray(n))for(let i of n)s=s.concat(i);else typeof n=="function"&&(s=n(s.slice()));return t&&(s=s.concat(en.merge)),s.reduce((i,o)=>{let a=typeof o=="string"?fl[o]:o;if(!a){let c=JSON.stringify(o),l=Object.keys(fl).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return i.includes(a)||i.push(a),i},[])}Ys.coreKnownTags=Pm;Ys.getTags=Am});var Hs=g(bl=>{"use strict";var Vs=A(),Lm=St(),Om=bt(),Im=Ht(),yr=Sl(),qm=(n,e)=>n.key<e.key?-1:n.key>e.key?1:0,Ws=class n{constructor({compat:e,customTags:t,merge:r,resolveKnownTags:s,schema:i,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?yr.getTags(e,"compat"):e?yr.getTags(null,e):null,this.name=typeof i=="string"&&i||"core",this.knownTags=s?yr.coreKnownTags:{},this.tags=yr.getTags(t,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,Vs.MAP,{value:Lm.map}),Object.defineProperty(this,Vs.SCALAR,{value:Im.string}),Object.defineProperty(this,Vs.SEQ,{value:Om.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?qm:null}clone(){let e=Object.create(n.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};bl.Schema=Ws});var vl=g(wl=>{"use strict";var Tm=A(),zs=Jt(),tn=Kt();function xm(n,e){let t=[],r=e.directives===!0;if(e.directives!==!1&&n.directives){let c=n.directives.toString(n);c?(t.push(c),r=!0):n.directives.docStart&&(r=!0)}r&&t.push("---");let s=zs.createStringifyContext(n,e),{commentString:i}=s.options;if(n.commentBefore){t.length!==1&&t.unshift("");let c=i(n.commentBefore);t.unshift(tn.indentComment(c,""))}let o=!1,a=null;if(n.contents){if(Tm.isNode(n.contents)){if(n.contents.spaceBefore&&r&&t.push(""),n.contents.commentBefore){let u=i(n.contents.commentBefore);t.push(tn.indentComment(u,""))}s.forceBlockIndent=!!n.comment,a=n.contents.comment}let c=a?void 0:()=>o=!0,l=zs.stringify(n.contents,s,()=>a=null,c);a&&(l+=tn.lineComment(l,"",i(a))),(l[0]==="|"||l[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${l}`:t.push(l)}else t.push(zs.stringify(n.contents,s));if(n.directives?.docEnd)if(n.comment){let c=i(n.comment);c.includes(`
|
61
|
+
`)?(t.push("..."),t.push(tn.indentComment(c,""))):t.push(`... ${c}`)}else t.push("...");else{let c=n.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||a)&&t[t.length-1]!==""&&t.push(""),t.push(tn.indentComment(i(c),"")))}return t.join(`
|
62
|
+
`)+`
|
63
|
+
`}wl.stringifyDocument=xm});var nn=g(kl=>{"use strict";var _m=Rt(),vt=Fn(),ve=A(),Fm=Ye(),jm=Be(),Rm=Hs(),Mm=vl(),Qs=qn(),Km=ts(),Bm=Mt(),Zs=es(),Xs=class n{constructor(e,t,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ve.NODE_TYPE,{value:ve.DOC});let s=null;typeof t=="function"||Array.isArray(t)?s=t:r===void 0&&t&&(r=t,t=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=i;let{version:o}=i;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new Zs.Directives({version:o}),this.setSchema(o,r),this.contents=e===void 0?null:this.createNode(e,s,r)}clone(){let e=Object.create(n.prototype,{[ve.NODE_TYPE]:{value:ve.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=ve.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){kt(this.contents)&&this.contents.add(e)}addIn(e,t){kt(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let r=Qs.anchorNames(this);e.anchor=!t||r.has(t)?Qs.findNewAnchor(t||"a",r):t}return new _m.Alias(e.anchor)}createNode(e,t,r){let s;if(typeof t=="function")e=t.call({"":e},"",e),s=t;else if(Array.isArray(t)){let m=b=>typeof b=="number"||b instanceof String||b instanceof Number,S=t.filter(m).map(String);S.length>0&&(t=t.concat(S)),s=t}else r===void 0&&t&&(r=t,t=void 0);let{aliasDuplicateObjects:i,anchorPrefix:o,flow:a,keepUndefined:c,onTagObj:l,tag:u}=r??{},{onAnchor:f,setAnchors:d,sourceObjects:h}=Qs.createNodeAnchors(this,o||"a"),y={aliasDuplicateObjects:i??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:l,replacer:s,schema:this.schema,sourceObjects:h},p=Bm.createNode(e,u,y);return a&&ve.isCollection(p)&&(p.flow=!0),d(),p}createPair(e,t,r={}){let s=this.createNode(e,null,r),i=this.createNode(t,null,r);return new Fm.Pair(s,i)}delete(e){return kt(this.contents)?this.contents.delete(e):!1}deleteIn(e){return vt.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):kt(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return ve.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return vt.isEmptyPath(e)?!t&&ve.isScalar(this.contents)?this.contents.value:this.contents:ve.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return ve.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return vt.isEmptyPath(e)?this.contents!==void 0:ve.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=vt.collectionFromPath(this.schema,[e],t):kt(this.contents)&&this.contents.set(e,t)}setIn(e,t){vt.isEmptyPath(e)?this.contents=t:this.contents==null?this.contents=vt.collectionFromPath(this.schema,Array.from(e),t):kt(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let r;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Zs.Directives({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new Zs.Directives({version:e}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let s=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${s}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(r)this.schema=new Rm.Schema(Object.assign(r,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:r,maxAliasCount:s,onAnchor:i,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},c=jm.toJS(this.contents,t??"",a);if(typeof i=="function")for(let{count:l,res:u}of a.anchors.values())i(u,l);return typeof o=="function"?Km.applyReviver(o,{"":c},"",c):c}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return Mm.stringifyDocument(this,e)}};function kt(n){if(ve.isCollection(n))return!0;throw new Error("Expected a YAML collection as document contents")}kl.Document=Xs});var on=g(sn=>{"use strict";var rn=class extends Error{constructor(e,t,r,s){super(),this.name=e,this.code=r,this.message=s,this.pos=t}},ei=class extends rn{constructor(e,t,r){super("YAMLParseError",e,t,r)}},ti=class extends rn{constructor(e,t,r){super("YAMLWarning",e,t,r)}},Gm=(n,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(a=>e.linePos(a));let{line:r,col:s}=t.linePos[0];t.message+=` at line ${r}, column ${s}`;let i=s-1,o=n.substring(e.lineStarts[r-1],e.lineStarts[r]).replace(/[\n\r]+$/,"");if(i>=60&&o.length>80){let a=Math.min(i-39,o.length-79);o="\u2026"+o.substring(a),i-=a-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),r>1&&/^ *$/.test(o.substring(0,i))){let a=n.substring(e.lineStarts[r-2],e.lineStarts[r-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
64
|
+
`),o=a+o}if(/[^ ]/.test(o)){let a=1,c=t.linePos[1];c&&c.line===r&&c.col>s&&(a=Math.max(1,Math.min(c.col-s,80-i)));let l=" ".repeat(i)+"^".repeat(a);t.message+=`:
|
65
|
+
|
66
|
+
${o}
|
67
|
+
${l}
|
68
|
+
`}};sn.YAMLError=rn;sn.YAMLParseError=ei;sn.YAMLWarning=ti;sn.prettifyError=Gm});var an=g(El=>{"use strict";function Um(n,{flow:e,indicator:t,next:r,offset:s,onError:i,parentIndent:o,startOnNewline:a}){let c=!1,l=a,u=a,f="",d="",h=!1,y=!1,p=null,m=null,S=null,b=null,w=null,E=null,C=null;for(let v of n)switch(y&&(v.type!=="space"&&v.type!=="newline"&&v.type!=="comma"&&i(v.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),y=!1),p&&(l&&v.type!=="comment"&&v.type!=="newline"&&i(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),p=null),v.type){case"space":!e&&(t!=="doc-start"||r?.type!=="flow-collection")&&v.source.includes(" ")&&(p=v),u=!0;break;case"comment":{u||i(v,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let k=v.source.substring(1)||" ";f?f+=d+k:f=k,d="",l=!1;break}case"newline":l?f?f+=v.source:(!E||t!=="seq-item-ind")&&(c=!0):d+=v.source,l=!0,h=!0,(m||S)&&(b=v),u=!0;break;case"anchor":m&&i(v,"MULTIPLE_ANCHORS","A node can have at most one anchor"),v.source.endsWith(":")&&i(v.offset+v.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=v,C??(C=v.offset),l=!1,u=!1,y=!0;break;case"tag":{S&&i(v,"MULTIPLE_TAGS","A node can have at most one tag"),S=v,C??(C=v.offset),l=!1,u=!1,y=!0;break}case t:(m||S)&&i(v,"BAD_PROP_ORDER",`Anchors and tags must be after the ${v.source} indicator`),E&&i(v,"UNEXPECTED_TOKEN",`Unexpected ${v.source} in ${e??"collection"}`),E=v,l=t==="seq-item-ind"||t==="explicit-key-ind",u=!1;break;case"comma":if(e){w&&i(v,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),w=v,l=!1,u=!1;break}default:i(v,"UNEXPECTED_TOKEN",`Unexpected ${v.type} token`),l=!1,u=!1}let N=n[n.length-1],q=N?N.offset+N.source.length:s;return y&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&i(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),p&&(l&&p.indent<=o||r?.type==="block-map"||r?.type==="block-seq")&&i(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:w,found:E,spaceBefore:c,comment:f,hasNewline:h,anchor:m,tag:S,newlineAfterProp:b,end:q,start:C??q}}El.resolveProps=Um});var gr=g(Cl=>{"use strict";function ni(n){if(!n)return null;switch(n.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(n.source.includes(`
|
69
|
+
`))return!0;if(n.end){for(let e of n.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of n.items){for(let t of e.start)if(t.type==="newline")return!0;if(e.sep){for(let t of e.sep)if(t.type==="newline")return!0}if(ni(e.key)||ni(e.value))return!0}return!1;default:return!0}}Cl.containsNewline=ni});var ri=g(Nl=>{"use strict";var Jm=gr();function Ym(n,e,t){if(e?.type==="flow-collection"){let r=e.end[0];r.indent===n&&(r.source==="]"||r.source==="}")&&Jm.containsNewline(e)&&t(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Nl.flowIndentCheck=Ym});var si=g($l=>{"use strict";var Dl=A();function Vm(n,e,t){let{uniqueKeys:r}=n.options;if(r===!1)return!1;let s=typeof r=="function"?r:(i,o)=>i===o||Dl.isScalar(i)&&Dl.isScalar(o)&&i.value===o.value;return e.some(i=>s(i.key,t))}$l.mapIncludes=Vm});var ql=g(Il=>{"use strict";var Pl=Ye(),Wm=We(),Al=an(),Hm=gr(),Ll=ri(),zm=si(),Ol="All mapping items must start at the same column";function Qm({composeNode:n,composeEmptyNode:e},t,r,s,i){let o=i?.nodeClass??Wm.YAMLMap,a=new o(t.schema);t.atRoot&&(t.atRoot=!1);let c=r.offset,l=null;for(let u of r.items){let{start:f,key:d,sep:h,value:y}=u,p=Al.resolveProps(f,{indicator:"explicit-key-ind",next:d??h?.[0],offset:c,onError:s,parentIndent:r.indent,startOnNewline:!0}),m=!p.found;if(m){if(d&&(d.type==="block-seq"?s(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==r.indent&&s(c,"BAD_INDENT",Ol)),!p.anchor&&!p.tag&&!h){l=p.end,p.comment&&(a.comment?a.comment+=`
|
70
|
+
`+p.comment:a.comment=p.comment);continue}(p.newlineAfterProp||Hm.containsNewline(d))&&s(d??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else p.found?.indent!==r.indent&&s(c,"BAD_INDENT",Ol);t.atKey=!0;let S=p.end,b=d?n(t,d,p,s):e(t,S,f,null,p,s);t.schema.compat&&Ll.flowIndentCheck(r.indent,d,s),t.atKey=!1,zm.mapIncludes(t,a.items,b)&&s(S,"DUPLICATE_KEY","Map keys must be unique");let w=Al.resolveProps(h??[],{indicator:"map-value-ind",next:y,offset:b.range[2],onError:s,parentIndent:r.indent,startOnNewline:!d||d.type==="block-scalar"});if(c=w.end,w.found){m&&(y?.type==="block-map"&&!w.hasNewline&&s(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&p.start<w.found.offset-1024&&s(b.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let E=y?n(t,y,w,s):e(t,c,h,null,w,s);t.schema.compat&&Ll.flowIndentCheck(r.indent,y,s),c=E.range[2];let C=new Pl.Pair(b,E);t.options.keepSourceTokens&&(C.srcToken=u),a.items.push(C)}else{m&&s(b.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),w.comment&&(b.comment?b.comment+=`
|
71
|
+
`+w.comment:b.comment=w.comment);let E=new Pl.Pair(b);t.options.keepSourceTokens&&(E.srcToken=u),a.items.push(E)}}return l&&l<c&&s(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[r.offset,c,l??c],a}Il.resolveBlockMap=Qm});var xl=g(Tl=>{"use strict";var Zm=He(),Xm=an(),ey=ri();function ty({composeNode:n,composeEmptyNode:e},t,r,s,i){let o=i?.nodeClass??Zm.YAMLSeq,a=new o(t.schema);t.atRoot&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let c=r.offset,l=null;for(let{start:u,value:f}of r.items){let d=Xm.resolveProps(u,{indicator:"seq-item-ind",next:f,offset:c,onError:s,parentIndent:r.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||f)f&&f.type==="block-seq"?s(d.end,"BAD_INDENT","All sequence items must start at the same column"):s(c,"MISSING_CHAR","Sequence item without - indicator");else{l=d.end,d.comment&&(a.comment=d.comment);continue}let h=f?n(t,f,d,s):e(t,d.end,u,null,d,s);t.schema.compat&&ey.flowIndentCheck(r.indent,f,s),c=h.range[2],a.items.push(h)}return a.range=[r.offset,c,l??c],a}Tl.resolveBlockSeq=ty});var Et=g(_l=>{"use strict";function ny(n,e,t,r){let s="";if(n){let i=!1,o="";for(let a of n){let{source:c,type:l}=a;switch(l){case"space":i=!0;break;case"comment":{t&&!i&&r(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";s?s+=o+u:s=u,o="";break}case"newline":s&&(o+=c),i=!0;break;default:r(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:s,offset:e}}_l.resolveEnd=ny});var Ml=g(Rl=>{"use strict";var ry=A(),sy=Ye(),Fl=We(),iy=He(),oy=Et(),jl=an(),ay=gr(),cy=si(),ii="Block collections are not allowed within flow collections",oi=n=>n&&(n.type==="block-map"||n.type==="block-seq");function ly({composeNode:n,composeEmptyNode:e},t,r,s,i){let o=r.start.source==="{",a=o?"flow map":"flow sequence",c=i?.nodeClass??(o?Fl.YAMLMap:iy.YAMLSeq),l=new c(t.schema);l.flow=!0;let u=t.atRoot;u&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let f=r.offset+r.start.source.length;for(let m=0;m<r.items.length;++m){let S=r.items[m],{start:b,key:w,sep:E,value:C}=S,N=jl.resolveProps(b,{flow:a,indicator:"explicit-key-ind",next:w??E?.[0],offset:f,onError:s,parentIndent:r.indent,startOnNewline:!1});if(!N.found){if(!N.anchor&&!N.tag&&!E&&!C){m===0&&N.comma?s(N.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):m<r.items.length-1&&s(N.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),N.comment&&(l.comment?l.comment+=`
|
72
|
+
`+N.comment:l.comment=N.comment),f=N.end;continue}!o&&t.options.strict&&ay.containsNewline(w)&&s(w,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)N.comma&&s(N.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(N.comma||s(N.start,"MISSING_CHAR",`Missing , between ${a} items`),N.comment){let q="";e:for(let v of b)switch(v.type){case"comma":case"space":break;case"comment":q=v.source.substring(1);break e;default:break e}if(q){let v=l.items[l.items.length-1];ry.isPair(v)&&(v=v.value??v.key),v.comment?v.comment+=`
|
73
|
+
`+q:v.comment=q,N.comment=N.comment.substring(q.length+1)}}if(!o&&!E&&!N.found){let q=C?n(t,C,N,s):e(t,N.end,E,null,N,s);l.items.push(q),f=q.range[2],oi(C)&&s(q.range,"BLOCK_IN_FLOW",ii)}else{t.atKey=!0;let q=N.end,v=w?n(t,w,N,s):e(t,q,b,null,N,s);oi(w)&&s(v.range,"BLOCK_IN_FLOW",ii),t.atKey=!1;let k=jl.resolveProps(E??[],{flow:a,indicator:"map-value-ind",next:C,offset:v.range[2],onError:s,parentIndent:r.indent,startOnNewline:!1});if(k.found){if(!o&&!N.found&&t.options.strict){if(E)for(let P of E){if(P===k.found)break;if(P.type==="newline"){s(P,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}N.start<k.found.offset-1024&&s(k.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else C&&("source"in C&&C.source&&C.source[0]===":"?s(C,"MISSING_CHAR",`Missing space after : in ${a}`):s(k.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let D=C?n(t,C,k,s):k.found?e(t,k.end,E,null,k,s):null;D?oi(C)&&s(D.range,"BLOCK_IN_FLOW",ii):k.comment&&(v.comment?v.comment+=`
|
74
|
+
`+k.comment:v.comment=k.comment);let $=new sy.Pair(v,D);if(t.options.keepSourceTokens&&($.srcToken=S),o){let P=l;cy.mapIncludes(t,P.items,v)&&s(q,"DUPLICATE_KEY","Map keys must be unique"),P.items.push($)}else{let P=new Fl.YAMLMap(t.schema);P.flow=!0,P.items.push($);let B=(D??v).range;P.range=[v.range[0],B[1],B[2]],l.items.push(P)}f=D?D.range[2]:k.end}}let d=o?"}":"]",[h,...y]=r.end,p=f;if(h&&h.source===d)p=h.offset+h.source.length;else{let m=a[0].toUpperCase()+a.substring(1),S=u?`${m} must end with a ${d}`:`${m} in block collection must be sufficiently indented and end with a ${d}`;s(f,u?"MISSING_CHAR":"BAD_INDENT",S),h&&h.source.length!==1&&y.unshift(h)}if(y.length>0){let m=oy.resolveEnd(y,p,t.options.strict,s);m.comment&&(l.comment?l.comment+=`
|
75
|
+
`+m.comment:l.comment=m.comment),l.range=[r.offset,p,m.offset]}else l.range=[r.offset,p,p];return l}Rl.resolveFlowCollection=ly});var Bl=g(Kl=>{"use strict";var uy=A(),fy=G(),dy=We(),py=He(),hy=ql(),my=xl(),yy=Ml();function ai(n,e,t,r,s,i){let o=t.type==="block-map"?hy.resolveBlockMap(n,e,t,r,i):t.type==="block-seq"?my.resolveBlockSeq(n,e,t,r,i):yy.resolveFlowCollection(n,e,t,r,i),a=o.constructor;return s==="!"||s===a.tagName?(o.tag=a.tagName,o):(s&&(o.tag=s),o)}function gy(n,e,t,r,s){let i=r.tag,o=i?e.directives.tagName(i.source,d=>s(i,"TAG_RESOLVE_FAILED",d)):null;if(t.type==="block-seq"){let{anchor:d,newlineAfterProp:h}=r,y=d&&i?d.offset>i.offset?d:i:d??i;y&&(!h||h.offset<y.offset)&&s(y,"MISSING_CHAR","Missing newline after block sequence props")}let a=t.type==="block-map"?"map":t.type==="block-seq"?"seq":t.start.source==="{"?"map":"seq";if(!i||!o||o==="!"||o===dy.YAMLMap.tagName&&a==="map"||o===py.YAMLSeq.tagName&&a==="seq")return ai(n,e,t,s,o);let c=e.schema.tags.find(d=>d.tag===o&&d.collection===a);if(!c){let d=e.schema.knownTags[o];if(d&&d.collection===a)e.schema.tags.push(Object.assign({},d,{default:!1})),c=d;else return d?s(i,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):s(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),ai(n,e,t,s,o)}let l=ai(n,e,t,s,o,c),u=c.resolve?.(l,d=>s(i,"TAG_RESOLVE_FAILED",d),e.options)??l,f=uy.isNode(u)?u:new fy.Scalar(u);return f.range=l.range,f.tag=o,c?.format&&(f.format=c.format),f}Kl.composeCollection=gy});var li=g(Gl=>{"use strict";var ci=G();function Sy(n,e,t){let r=e.offset,s=by(e,n.options.strict,t);if(!s)return{value:"",type:null,comment:"",range:[r,r,r]};let i=s.mode===">"?ci.Scalar.BLOCK_FOLDED:ci.Scalar.BLOCK_LITERAL,o=e.source?wy(e.source):[],a=o.length;for(let p=o.length-1;p>=0;--p){let m=o[p][1];if(m===""||m==="\r")a=p;else break}if(a===0){let p=s.chomp==="+"&&o.length>0?`
|
76
|
+
`.repeat(Math.max(1,o.length-1)):"",m=r+s.length;return e.source&&(m+=e.source.length),{value:p,type:i,comment:s.comment,range:[r,m,m]}}let c=e.indent+s.indent,l=e.offset+s.length,u=0;for(let p=0;p<a;++p){let[m,S]=o[p];if(S===""||S==="\r")s.indent===0&&m.length>c&&(c=m.length);else{m.length<c&&t(l+m.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),s.indent===0&&(c=m.length),u=p,c===0&&!n.atRoot&&t(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=m.length+S.length+1}for(let p=o.length-1;p>=a;--p)o[p][0].length>c&&(a=p+1);let f="",d="",h=!1;for(let p=0;p<u;++p)f+=o[p][0].slice(c)+`
|
77
|
+
`;for(let p=u;p<a;++p){let[m,S]=o[p];l+=m.length+S.length+1;let b=S[S.length-1]==="\r";if(b&&(S=S.slice(0,-1)),S&&m.length<c){let E=`Block scalar lines must not be less indented than their ${s.indent?"explicit indentation indicator":"first line"}`;t(l-S.length-(b?2:1),"BAD_INDENT",E),m=""}i===ci.Scalar.BLOCK_LITERAL?(f+=d+m.slice(c)+S,d=`
|
78
|
+
`):m.length>c||S[0]===" "?(d===" "?d=`
|
79
|
+
`:!h&&d===`
|
80
|
+
`&&(d=`
|
81
|
+
|
82
|
+
`),f+=d+m.slice(c)+S,d=`
|
83
|
+
`,h=!0):S===""?d===`
|
84
|
+
`?f+=`
|
85
|
+
`:d=`
|
86
|
+
`:(f+=d+S,d=" ",h=!1)}switch(s.chomp){case"-":break;case"+":for(let p=a;p<o.length;++p)f+=`
|
87
|
+
`+o[p][0].slice(c);f[f.length-1]!==`
|
88
|
+
`&&(f+=`
|
89
|
+
`);break;default:f+=`
|
90
|
+
`}let y=r+s.length+e.source.length;return{value:f,type:i,comment:s.comment,range:[r,y,y]}}function by({offset:n,props:e},t,r){if(e[0].type!=="block-scalar-header")return r(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:s}=e[0],i=s[0],o=0,a="",c=-1;for(let d=1;d<s.length;++d){let h=s[d];if(!a&&(h==="-"||h==="+"))a=h;else{let y=Number(h);!o&&y?o=y:c===-1&&(c=n+d)}}c!==-1&&r(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${s}`);let l=!1,u="",f=s.length;for(let d=1;d<e.length;++d){let h=e[d];switch(h.type){case"space":l=!0;case"newline":f+=h.source.length;break;case"comment":t&&!l&&r(h,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=h.source.length,u=h.source.substring(1);break;case"error":r(h,"UNEXPECTED_TOKEN",h.message),f+=h.source.length;break;default:{let y=`Unexpected token in block scalar header: ${h.type}`;r(h,"UNEXPECTED_TOKEN",y);let p=h.source;p&&typeof p=="string"&&(f+=p.length)}}}return{mode:i,indent:o,chomp:a,comment:u,length:f}}function wy(n){let e=n.split(/\n( *)/),t=e[0],r=t.match(/^( *)/),i=[r?.[1]?[r[1],t.slice(r[1].length)]:["",t]];for(let o=1;o<e.length;o+=2)i.push([e[o],e[o+1]]);return i}Gl.resolveBlockScalar=Sy});var fi=g(Jl=>{"use strict";var ui=G(),vy=Et();function ky(n,e,t){let{offset:r,type:s,source:i,end:o}=n,a,c,l=(d,h,y)=>t(r+d,h,y);switch(s){case"scalar":a=ui.Scalar.PLAIN,c=Ey(i,l);break;case"single-quoted-scalar":a=ui.Scalar.QUOTE_SINGLE,c=Cy(i,l);break;case"double-quoted-scalar":a=ui.Scalar.QUOTE_DOUBLE,c=Ny(i,l);break;default:return t(n,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${s}`),{value:"",type:null,comment:"",range:[r,r+i.length,r+i.length]}}let u=r+i.length,f=vy.resolveEnd(o,u,e,t);return{value:c,type:a,comment:f.comment,range:[r,u,f.offset]}}function Ey(n,e){let t="";switch(n[0]){case" ":t="a tab character";break;case",":t="flow indicator character ,";break;case"%":t="directive indicator character %";break;case"|":case">":{t=`block scalar indicator ${n[0]}`;break}case"@":case"`":{t=`reserved character ${n[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),Ul(n)}function Cy(n,e){return(n[n.length-1]!=="'"||n.length===1)&&e(n.length,"MISSING_CHAR","Missing closing 'quote"),Ul(n.slice(1,-1)).replace(/''/g,"'")}function Ul(n){let e,t;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
91
|
+
`,"sy"),t=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
92
|
+
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,t=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=e.exec(n);if(!r)return n;let s=r[1],i=" ",o=e.lastIndex;for(t.lastIndex=o;r=t.exec(n);)r[1]===""?i===`
|
93
|
+
`?s+=i:i=`
|
94
|
+
`:(s+=i+r[1],i=" "),o=t.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,r=a.exec(n),s+i+(r?.[1]??"")}function Ny(n,e){let t="";for(let r=1;r<n.length-1;++r){let s=n[r];if(!(s==="\r"&&n[r+1]===`
|
95
|
+
`))if(s===`
|
96
|
+
`){let{fold:i,offset:o}=Dy(n,r);t+=i,r=o}else if(s==="\\"){let i=n[++r],o=$y[i];if(o)t+=o;else if(i===`
|
97
|
+
`)for(i=n[r+1];i===" "||i===" ";)i=n[++r+1];else if(i==="\r"&&n[r+1]===`
|
98
|
+
`)for(i=n[++r+1];i===" "||i===" ";)i=n[++r+1];else if(i==="x"||i==="u"||i==="U"){let a={x:2,u:4,U:8}[i];t+=Py(n,r+1,a,e),r+=a}else{let a=n.substr(r-1,2);e(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),t+=a}}else if(s===" "||s===" "){let i=r,o=n[r+1];for(;o===" "||o===" ";)o=n[++r+1];o!==`
|
99
|
+
`&&!(o==="\r"&&n[r+2]===`
|
100
|
+
`)&&(t+=r>i?n.slice(i,r+1):s)}else t+=s}return(n[n.length-1]!=='"'||n.length===1)&&e(n.length,"MISSING_CHAR",'Missing closing "quote'),t}function Dy(n,e){let t="",r=n[e+1];for(;(r===" "||r===" "||r===`
|
101
|
+
`||r==="\r")&&!(r==="\r"&&n[e+2]!==`
|
102
|
+
`);)r===`
|
103
|
+
`&&(t+=`
|
104
|
+
`),e+=1,r=n[e+1];return t||(t=" "),{fold:t,offset:e}}var $y={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
105
|
+
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Py(n,e,t,r){let s=n.substr(e,t),o=s.length===t&&/^[0-9a-fA-F]+$/.test(s)?parseInt(s,16):NaN;if(isNaN(o)){let a=n.substr(e-2,t+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}Jl.resolveFlowScalar=ky});var Wl=g(Vl=>{"use strict";var it=A(),Yl=G(),Ay=li(),Ly=fi();function Oy(n,e,t,r){let{value:s,type:i,comment:o,range:a}=e.type==="block-scalar"?Ay.resolveBlockScalar(n,e,r):Ly.resolveFlowScalar(e,n.options.strict,r),c=t?n.directives.tagName(t.source,f=>r(t,"TAG_RESOLVE_FAILED",f)):null,l;n.options.stringKeys&&n.atKey?l=n.schema[it.SCALAR]:c?l=Iy(n.schema,s,c,t,r):e.type==="scalar"?l=qy(n,s,e,r):l=n.schema[it.SCALAR];let u;try{let f=l.resolve(s,d=>r(t??e,"TAG_RESOLVE_FAILED",d),n.options);u=it.isScalar(f)?f:new Yl.Scalar(f)}catch(f){let d=f instanceof Error?f.message:String(f);r(t??e,"TAG_RESOLVE_FAILED",d),u=new Yl.Scalar(s)}return u.range=a,u.source=s,i&&(u.type=i),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function Iy(n,e,t,r,s){if(t==="!")return n[it.SCALAR];let i=[];for(let a of n.tags)if(!a.collection&&a.tag===t)if(a.default&&a.test)i.push(a);else return a;for(let a of i)if(a.test?.test(e))return a;let o=n.knownTags[t];return o&&!o.collection?(n.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(s(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),n[it.SCALAR])}function qy({atKey:n,directives:e,schema:t},r,s,i){let o=t.tags.find(a=>(a.default===!0||n&&a.default==="key")&&a.test?.test(r))||t[it.SCALAR];if(t.compat){let a=t.compat.find(c=>c.default&&c.test?.test(r))??t[it.SCALAR];if(o.tag!==a.tag){let c=e.tagString(o.tag),l=e.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;i(s,"TAG_RESOLVE_FAILED",u,!0)}}return o}Vl.composeScalar=Oy});var zl=g(Hl=>{"use strict";function Ty(n,e,t){if(e){t??(t=e.length);for(let r=t-1;r>=0;--r){let s=e[r];switch(s.type){case"space":case"comment":case"newline":n-=s.source.length;continue}for(s=e[++r];s?.type==="space";)n+=s.source.length,s=e[++r];break}}return n}Hl.emptyScalarPosition=Ty});var Xl=g(pi=>{"use strict";var xy=Rt(),_y=A(),Fy=Bl(),Ql=Wl(),jy=Et(),Ry=zl(),My={composeNode:Zl,composeEmptyNode:di};function Zl(n,e,t,r){let s=n.atKey,{spaceBefore:i,comment:o,anchor:a,tag:c}=t,l,u=!0;switch(e.type){case"alias":l=Ky(n,e,r),(a||c)&&r(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=Ql.composeScalar(n,e,c,r),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":l=Fy.composeCollection(My,n,e,t,r),a&&(l.anchor=a.source.substring(1));break;default:{let f=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",f),l=di(n,e.offset,void 0,null,t,r),u=!1}}return a&&l.anchor===""&&r(a,"BAD_ALIAS","Anchor cannot be an empty string"),s&&n.options.stringKeys&&(!_y.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&r(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),i&&(l.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?l.comment=o:l.commentBefore=o),n.options.keepSourceTokens&&u&&(l.srcToken=e),l}function di(n,e,t,r,{spaceBefore:s,comment:i,anchor:o,tag:a,end:c},l){let u={type:"scalar",offset:Ry.emptyScalarPosition(e,t,r),indent:-1,source:""},f=Ql.composeScalar(n,u,a,l);return o&&(f.anchor=o.source.substring(1),f.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),s&&(f.spaceBefore=!0),i&&(f.comment=i,f.range[2]=c),f}function Ky({options:n},{offset:e,source:t,end:r},s){let i=new xy.Alias(t.substring(1));i.source===""&&s(e,"BAD_ALIAS","Alias cannot be an empty string"),i.source.endsWith(":")&&s(e+t.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+t.length,a=jy.resolveEnd(r,o,n.strict,s);return i.range=[e,o,a.offset],a.comment&&(i.comment=a.comment),i}pi.composeEmptyNode=di;pi.composeNode=Zl});var nu=g(tu=>{"use strict";var By=nn(),eu=Xl(),Gy=Et(),Uy=an();function Jy(n,e,{offset:t,start:r,value:s,end:i},o){let a=Object.assign({_directives:e},n),c=new By.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Uy.resolveProps(r,{indicator:"doc-start",next:s??i?.[0],offset:t,onError:o,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,s&&(s.type==="block-map"||s.type==="block-seq")&&!u.hasNewline&&o(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=s?eu.composeNode(l,s,u,o):eu.composeEmptyNode(l,u.end,r,null,u,o);let f=c.contents.range[2],d=Gy.resolveEnd(i,f,!1,o);return d.comment&&(c.comment=d.comment),c.range=[t,f,d.offset],c}tu.composeDoc=Jy});var mi=g(iu=>{"use strict";var Yy=require("process"),Vy=es(),Wy=nn(),cn=on(),ru=A(),Hy=nu(),zy=Et();function ln(n){if(typeof n=="number")return[n,n+1];if(Array.isArray(n))return n.length===2?n:[n[0],n[1]];let{offset:e,source:t}=n;return[e,e+(typeof t=="string"?t.length:1)]}function su(n){let e="",t=!1,r=!1;for(let s=0;s<n.length;++s){let i=n[s];switch(i[0]){case"#":e+=(e===""?"":r?`
|
106
|
+
|
107
|
+
`:`
|
108
|
+
`)+(i.substring(1)||" "),t=!0,r=!1;break;case"%":n[s+1]?.[0]!=="#"&&(s+=1),t=!1;break;default:t||(r=!0),t=!1}}return{comment:e,afterEmptyLine:r}}var hi=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,r,s,i)=>{let o=ln(t);i?this.warnings.push(new cn.YAMLWarning(o,r,s)):this.errors.push(new cn.YAMLParseError(o,r,s))},this.directives=new Vy.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:r,afterEmptyLine:s}=su(this.prelude);if(r){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}
|
109
|
+
${r}`:r;else if(s||e.directives.docStart||!i)e.commentBefore=r;else if(ru.isCollection(i)&&!i.flow&&i.items.length>0){let o=i.items[0];ru.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${r}
|
110
|
+
${a}`:r}else{let o=i.commentBefore;i.commentBefore=o?`${r}
|
111
|
+
${o}`:r}}t?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:su(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,r=-1){for(let s of e)yield*this.next(s);yield*this.end(t,r)}*next(e){switch(Yy.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(t,r,s)=>{let i=ln(e);i[0]+=t,this.onError(i,"BAD_DIRECTIVE",r,s)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=Hy.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,r=new cn.YAMLParseError(ln(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new cn.YAMLParseError(ln(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let t=zy.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
|
112
|
+
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new cn.YAMLParseError(ln(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let r=Object.assign({_directives:this.directives},this.options),s=new Wy.Document(void 0,r);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),s.range=[0,t,t],this.decorate(s,!1),yield s}}};iu.Composer=hi});var cu=g(Sr=>{"use strict";var Qy=li(),Zy=fi(),Xy=on(),ou=Ut();function eg(n,e=!0,t){if(n){let r=(s,i,o)=>{let a=typeof s=="number"?s:Array.isArray(s)?s[0]:s.offset;if(t)t(a,i,o);else throw new Xy.YAMLParseError([a,a+1],i,o)};switch(n.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Zy.resolveFlowScalar(n,e,r);case"block-scalar":return Qy.resolveBlockScalar({options:{strict:e}},n,r)}}return null}function tg(n,e){let{implicitKey:t=!1,indent:r,inFlow:s=!1,offset:i=-1,type:o="PLAIN"}=e,a=ou.stringifyString({type:o,value:n},{implicitKey:t,indent:r>0?" ".repeat(r):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:r,source:`
|
113
|
+
`}];switch(a[0]){case"|":case">":{let l=a.indexOf(`
|
114
|
+
`),u=a.substring(0,l),f=a.substring(l+1)+`
|
115
|
+
`,d=[{type:"block-scalar-header",offset:i,indent:r,source:u}];return au(d,c)||d.push({type:"newline",offset:-1,indent:r,source:`
|
116
|
+
`}),{type:"block-scalar",offset:i,indent:r,props:d,source:f}}case'"':return{type:"double-quoted-scalar",offset:i,indent:r,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:i,indent:r,source:a,end:c};default:return{type:"scalar",offset:i,indent:r,source:a,end:c}}}function ng(n,e,t={}){let{afterKey:r=!1,implicitKey:s=!1,inFlow:i=!1,type:o}=t,a="indent"in n?n.indent:null;if(r&&typeof a=="number"&&(a+=2),!o)switch(n.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let l=n.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let c=ou.stringifyString({type:o,value:e},{implicitKey:s||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":rg(n,c);break;case'"':yi(n,c,"double-quoted-scalar");break;case"'":yi(n,c,"single-quoted-scalar");break;default:yi(n,c,"scalar")}}function rg(n,e){let t=e.indexOf(`
|
117
|
+
`),r=e.substring(0,t),s=e.substring(t+1)+`
|
118
|
+
`;if(n.type==="block-scalar"){let i=n.props[0];if(i.type!=="block-scalar-header")throw new Error("Invalid block scalar header");i.source=r,n.source=s}else{let{offset:i}=n,o="indent"in n?n.indent:-1,a=[{type:"block-scalar-header",offset:i,indent:o,source:r}];au(a,"end"in n?n.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
|
119
|
+
`});for(let c of Object.keys(n))c!=="type"&&c!=="offset"&&delete n[c];Object.assign(n,{type:"block-scalar",indent:o,props:a,source:s})}}function au(n,e){if(e)for(let t of e)switch(t.type){case"space":case"comment":n.push(t);break;case"newline":return n.push(t),!0}return!1}function yi(n,e,t){switch(n.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":n.type=t,n.source=e;break;case"block-scalar":{let r=n.props.slice(1),s=e.length;n.props[0].type==="block-scalar-header"&&(s-=n.props[0].source.length);for(let i of r)i.offset+=s;delete n.props,Object.assign(n,{type:t,source:e,end:r});break}case"block-map":case"block-seq":{let s={type:"newline",offset:n.offset+e.length,indent:n.indent,source:`
|
120
|
+
`};delete n.items,Object.assign(n,{type:t,source:e,end:[s]});break}default:{let r="indent"in n?n.indent:-1,s="end"in n&&Array.isArray(n.end)?n.end.filter(i=>i.type==="space"||i.type==="comment"||i.type==="newline"):[];for(let i of Object.keys(n))i!=="type"&&i!=="offset"&&delete n[i];Object.assign(n,{type:t,indent:r,source:e,end:s})}}}Sr.createScalarToken=tg;Sr.resolveAsScalar=eg;Sr.setScalarValue=ng});var uu=g(lu=>{"use strict";var sg=n=>"type"in n?wr(n):br(n);function wr(n){switch(n.type){case"block-scalar":{let e="";for(let t of n.props)e+=wr(t);return e+n.source}case"block-map":case"block-seq":{let e="";for(let t of n.items)e+=br(t);return e}case"flow-collection":{let e=n.start.source;for(let t of n.items)e+=br(t);for(let t of n.end)e+=t.source;return e}case"document":{let e=br(n);if(n.end)for(let t of n.end)e+=t.source;return e}default:{let e=n.source;if("end"in n&&n.end)for(let t of n.end)e+=t.source;return e}}}function br({start:n,key:e,sep:t,value:r}){let s="";for(let i of n)s+=i.source;if(e&&(s+=wr(e)),t)for(let i of t)s+=i.source;return r&&(s+=wr(r)),s}lu.stringify=sg});var hu=g(pu=>{"use strict";var gi=Symbol("break visit"),ig=Symbol("skip children"),fu=Symbol("remove item");function ot(n,e){"type"in n&&n.type==="document"&&(n={start:n.start,value:n.value}),du(Object.freeze([]),n,e)}ot.BREAK=gi;ot.SKIP=ig;ot.REMOVE=fu;ot.itemAtPath=(n,e)=>{let t=n;for(let[r,s]of e){let i=t?.[r];if(i&&"items"in i)t=i.items[s];else return}return t};ot.parentCollection=(n,e)=>{let t=ot.itemAtPath(n,e.slice(0,-1)),r=e[e.length-1][0],s=t?.[r];if(s&&"items"in s)return s;throw new Error("Parent collection not found")};function du(n,e,t){let r=t(e,n);if(typeof r=="symbol")return r;for(let s of["key","value"]){let i=e[s];if(i&&"items"in i){for(let o=0;o<i.items.length;++o){let a=du(Object.freeze(n.concat([[s,o]])),i.items[o],t);if(typeof a=="number")o=a-1;else{if(a===gi)return gi;a===fu&&(i.items.splice(o,1),o-=1)}}typeof r=="function"&&s==="key"&&(r=r(e,n))}}return typeof r=="function"?r(e,n):r}pu.visit=ot});var vr=g(me=>{"use strict";var Si=cu(),og=uu(),ag=hu(),bi="\uFEFF",wi="",vi="",ki="",cg=n=>!!n&&"items"in n,lg=n=>!!n&&(n.type==="scalar"||n.type==="single-quoted-scalar"||n.type==="double-quoted-scalar"||n.type==="block-scalar");function ug(n){switch(n){case bi:return"<BOM>";case wi:return"<DOC>";case vi:return"<FLOW_END>";case ki:return"<SCALAR>";default:return JSON.stringify(n)}}function fg(n){switch(n){case bi:return"byte-order-mark";case wi:return"doc-mode";case vi:return"flow-error-end";case ki:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
121
|
+
`:case`\r
|
122
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(n[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}me.createScalarToken=Si.createScalarToken;me.resolveAsScalar=Si.resolveAsScalar;me.setScalarValue=Si.setScalarValue;me.stringify=og.stringify;me.visit=ag.visit;me.BOM=bi;me.DOCUMENT=wi;me.FLOW_END=vi;me.SCALAR=ki;me.isCollection=cg;me.isScalar=lg;me.prettyToken=ug;me.tokenType=fg});var Ni=g(yu=>{"use strict";var un=vr();function Ne(n){switch(n){case void 0:case" ":case`
|
123
|
+
`:case"\r":case" ":return!0;default:return!1}}var mu=new Set("0123456789ABCDEFabcdef"),dg=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),kr=new Set(",[]{}"),pg=new Set(` ,[]{}
|
124
|
+
\r `),Ei=n=>!n||pg.has(n),Ci=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let r=this.next??"stream";for(;r&&(t||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===`
|
125
|
+
`?!0:t==="\r"?this.buffer[e+1]===`
|
126
|
+
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let r=0;for(;t===" ";)t=this.buffer[++r+e];if(t==="\r"){let s=this.buffer[r+e+1];if(s===`
|
127
|
+
`||!s&&!this.atEnd)return e+r+1}return t===`
|
128
|
+
`||r>=this.indentNext||!t&&!this.atEnd?e+r:-1}if(t==="-"||t==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&Ne(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
129
|
+
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===un.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let t=e.length,r=e.indexOf("#");for(;r!==-1;){let i=e[r-1];if(i===" "||i===" "){t=r-1;break}else r=e.indexOf("#",r+1)}for(;;){let i=e[t-1];if(i===" "||i===" ")t-=1;else break}let s=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-s),this.pushNewline(),"stream"}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield un.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let t=this.peek(3);if((t==="---"||t==="...")&&Ne(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,t==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Ne(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Ne(t)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Ei),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,r=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=r=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let s=this.getLine();if(s===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&s[0]!=="#"||r===0&&(s.startsWith("---")||s.startsWith("..."))&&Ne(s[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(s[0]==="]"||s[0]==="}")))return this.flowLevel=0,yield un.FLOW_END,yield*this.parseLineStart();let i=0;for(;s[i]===",";)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),s[i]){case void 0:return"flow";case"#":return yield*this.pushCount(s.length-i),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Ei),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||Ne(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;t!==-1&&this.buffer[t+1]==="'";)t=this.buffer.indexOf("'",t+2);else for(;t!==-1;){let i=0;for(;this.buffer[t-1-i]==="\\";)i+=1;if(i%2===0)break;t=this.buffer.indexOf('"',t+1)}let r=this.buffer.substring(0,t),s=r.indexOf(`
|
130
|
+
`,this.pos);if(s!==-1){for(;s!==-1;){let i=this.continueScalar(s+1);if(i===-1)break;s=r.indexOf(`
|
131
|
+
`,i)}s!==-1&&(t=s-(r[s-1]==="\r"?2:1))}if(t===-1){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t==="+")this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil(t=>Ne(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,r;e:for(let i=this.pos;r=this.buffer[i];++i)switch(r){case" ":t+=1;break;case`
|
132
|
+
`:e=i,t=0;break;case"\r":{let o=this.buffer[i+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
|
133
|
+
`)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let i=this.continueScalar(e+1);if(i===-1)break;e=this.buffer.indexOf(`
|
134
|
+
`,i)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let s=e+1;for(r=this.buffer[s];r===" ";)r=this.buffer[++s];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===`
|
135
|
+
`;)r=this.buffer[++s];e=s-1}else if(!this.blockScalarKeep)do{let i=e-1,o=this.buffer[i];o==="\r"&&(o=this.buffer[--i]);let a=i;for(;o===" ";)o=this.buffer[--i];if(o===`
|
136
|
+
`&&i>=this.pos&&i+1+t>a)e=i;else break}while(!0);return yield un.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,r=this.pos-1,s;for(;s=this.buffer[++r];)if(s===":"){let i=this.buffer[r+1];if(Ne(i)||e&&kr.has(i))break;t=r}else if(Ne(s)){let i=this.buffer[r+1];if(s==="\r"&&(i===`
|
137
|
+
`?(r+=1,s=`
|
138
|
+
`,i=this.buffer[r+1]):t=r),i==="#"||e&&kr.has(i))break;if(s===`
|
139
|
+
`){let o=this.continueScalar(r+1);if(o===-1)break;r=Math.max(r,o-2)}}else{if(e&&kr.has(s))break;t=r}return!s&&!this.atEnd?this.setNext("plain-scalar"):(yield un.SCALAR,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.length):(t&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(Ei))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,t=this.charAt(1);if(Ne(t)||e&&kr.has(t))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!Ne(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(dg.has(t))t=this.buffer[++e];else if(t==="%"&&mu.has(this.buffer[e+1])&&mu.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
140
|
+
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
141
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,r;do r=this.buffer[++t];while(r===" "||e&&r===" ");let s=t-this.pos;return s>0&&(yield this.buffer.substr(this.pos,s),this.pos=t),s}*pushUntil(e){let t=this.pos,r=this.buffer[t];for(;!e(r);)r=this.buffer[++t];return yield*this.pushToIndex(t,!1)}};yu.Lexer=Ci});var $i=g(gu=>{"use strict";var Di=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,r=this.lineStarts.length;for(;t<r;){let i=t+r>>1;this.lineStarts[i]<e?t=i+1:r=i}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let s=this.lineStarts[t-1];return{line:t,col:e-s+1}}}};gu.LineCounter=Di});var Ai=g(ku=>{"use strict";var hg=require("process"),Su=vr(),mg=Ni();function ze(n,e){for(let t=0;t<n.length;++t)if(n[t].type===e)return!0;return!1}function bu(n){for(let e=0;e<n.length;++e)switch(n[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function vu(n){switch(n?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Er(n){switch(n.type){case"document":return n.start;case"block-map":{let e=n.items[n.items.length-1];return e.sep??e.start}case"block-seq":return n.items[n.items.length-1].start;default:return[]}}function Ct(n){if(n.length===0)return[];let e=n.length;e:for(;--e>=0;)switch(n[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;n[++e]?.type==="space";);return n.splice(e,n.length)}function wu(n){if(n.start.type==="flow-seq-start")for(let e of n.items)e.sep&&!e.value&&!ze(e.start,"explicit-key-ind")&&!ze(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,vu(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}var Pi=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new mg.Lexer,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(e,t))yield*this.next(r);t||(yield*this.end())}*next(e){if(this.source=e,hg.env.LOG_TOKENS&&console.log("|",Su.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=Su.tokenType(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&(!e||e.type!=="doc-end")){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield t;else{let r=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in r?r.indent:0:t.type==="flow-collection"&&r.type==="document"&&(t.indent=0),t.type==="flow-collection"&&wu(t),r.type){case"document":r.value=t;break;case"block-scalar":r.props.push(t);break;case"block-map":{let s=r.items[r.items.length-1];if(s.value){r.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(s.sep)s.value=t;else{Object.assign(s,{key:t,sep:[]}),this.onKeyLine=!s.explicitKey;return}break}case"block-seq":{let s=r.items[r.items.length-1];s.value?r.items.push({start:[],value:t}):s.value=t;break}case"flow-collection":{let s=r.items[r.items.length-1];!s||s.value?r.items.push({start:[],key:t,sep:[]}):s.sep?s.value=t:Object.assign(s,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let s=t.items[t.items.length-1];s&&!s.sep&&!s.value&&s.start.length>0&&bu(s.start)===-1&&(t.indent===0||s.start.every(i=>i.type!=="comment"||i.indent<t.indent))&&(r.type==="document"?r.end=s.start:r.items.push({start:s.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{bu(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let t=Er(this.peek(2)),r=Ct(t),s;e.end?(s=e.end,s.push(this.sourceToken),delete e.end):s=[this.sourceToken];let i={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let t=this.source.indexOf(`
|
142
|
+
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
143
|
+
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let r="end"in t.value?t.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let s=e.items[e.items.length-2]?.value?.end;if(Array.isArray(s)){Array.prototype.push.apply(s,t.start),s.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,s=r&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",i=[];if(s&&t.sep&&!t.value){let o=[];for(let a=0;a<t.sep.length;++a){let c=t.sep[a];switch(c.type){case"newline":o.push(a);break;case"space":break;case"comment":c.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(i=t.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":s||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):s||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(ze(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(vu(t.key)&&!ze(t.sep,"newline")){let o=Ct(t.start),a=t.key,c=t.sep;c.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:c}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken);else if(ze(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let o=Ct(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||s?e.items.push({start:i,key:null,sep:[this.sourceToken]}):ze(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);s||t.value?(e.items.push({start:i,key:o,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(o):(Object.assign(t,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!t.explicitKey&&t.sep&&!ze(t.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&e.items.push({start:i});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let r="end"in t.value?t.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let s=e.items[e.items.length-2]?.value?.end;if(Array.isArray(s)){Array.prototype.push.apply(s,t.start),s.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||ze(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r&&r.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:s,sep:[]}):t.sep?this.stack.push(s):Object.assign(t,{key:s,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let s=Er(r),i=Ct(s);wu(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
|
144
|
+
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
145
|
+
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=Er(e),r=Ct(t);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=Er(e),r=Ct(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};ku.Parser=Pi});var $u=g(dn=>{"use strict";var Eu=mi(),yg=nn(),fn=on(),gg=ps(),Sg=A(),bg=$i(),Cu=Ai();function Nu(n){let e=n.prettyErrors!==!1;return{lineCounter:n.lineCounter||e&&new bg.LineCounter||null,prettyErrors:e}}function wg(n,e={}){let{lineCounter:t,prettyErrors:r}=Nu(e),s=new Cu.Parser(t?.addNewLine),i=new Eu.Composer(e),o=Array.from(i.compose(s.parse(n)));if(r&&t)for(let a of o)a.errors.forEach(fn.prettifyError(n,t)),a.warnings.forEach(fn.prettifyError(n,t));return o.length>0?o:Object.assign([],{empty:!0},i.streamInfo())}function Du(n,e={}){let{lineCounter:t,prettyErrors:r}=Nu(e),s=new Cu.Parser(t?.addNewLine),i=new Eu.Composer(e),o=null;for(let a of i.compose(s.parse(n),!0,n.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new fn.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&t&&(o.errors.forEach(fn.prettifyError(n,t)),o.warnings.forEach(fn.prettifyError(n,t))),o}function vg(n,e,t){let r;typeof e=="function"?r=e:t===void 0&&e&&typeof e=="object"&&(t=e);let s=Du(n,t);if(!s)return null;if(s.warnings.forEach(i=>gg.warn(s.options.logLevel,i)),s.errors.length>0){if(s.options.logLevel!=="silent")throw s.errors[0];s.errors=[]}return s.toJS(Object.assign({reviver:r},t))}function kg(n,e,t){let r=null;if(typeof e=="function"||Array.isArray(e)?r=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){let s=Math.round(t);t=s<1?void 0:s>8?{indent:8}:{indent:s}}if(n===void 0){let{keepUndefined:s}=t??e??{};if(!s)return}return Sg.isDocument(n)&&!r?n.toString(t):new yg.Document(n,r,t).toString(t)}dn.parse=vg;dn.parseAllDocuments=wg;dn.parseDocument=Du;dn.stringify=kg});var Oi=g(O=>{"use strict";var Eg=mi(),Cg=nn(),Ng=Hs(),Li=on(),Dg=Rt(),Qe=A(),$g=Ye(),Pg=G(),Ag=We(),Lg=He(),Og=vr(),Ig=Ni(),qg=$i(),Tg=Ai(),Cr=$u(),Pu=xt();O.Composer=Eg.Composer;O.Document=Cg.Document;O.Schema=Ng.Schema;O.YAMLError=Li.YAMLError;O.YAMLParseError=Li.YAMLParseError;O.YAMLWarning=Li.YAMLWarning;O.Alias=Dg.Alias;O.isAlias=Qe.isAlias;O.isCollection=Qe.isCollection;O.isDocument=Qe.isDocument;O.isMap=Qe.isMap;O.isNode=Qe.isNode;O.isPair=Qe.isPair;O.isScalar=Qe.isScalar;O.isSeq=Qe.isSeq;O.Pair=$g.Pair;O.Scalar=Pg.Scalar;O.YAMLMap=Ag.YAMLMap;O.YAMLSeq=Lg.YAMLSeq;O.CST=Og;O.Lexer=Ig.Lexer;O.LineCounter=qg.LineCounter;O.Parser=Tg.Parser;O.parse=Cr.parse;O.parseAllDocuments=Cr.parseAllDocuments;O.parseDocument=Cr.parseDocument;O.stringify=Cr.stringify;O.visit=Pu.visit;O.visitAsync=Pu.visitAsync});var Fg={};Xu(Fg,{main:()=>Vu});module.exports=ef(Fg);var Fi=require("child_process"),ji=require("fs"),Ri=require("path"),Pe=class{configs=null;loadConfigs(){if(this.configs)return this.configs;try{let e=(0,Ri.join)(__dirname,"..","companies.json"),t=(0,ji.readFileSync)(e,"utf-8");return this.configs=JSON.parse(t),this.configs}catch(e){throw new Error(`Failed to load company configurations: ${e instanceof Error?e.message:"Unknown error"}`)}}getCompanyConfig(e){return this.loadConfigs()[e]||null}getAllCompanies(){let e=this.loadConfigs();return Object.keys(e)}hasCompany(e){return this.getCompanyConfig(e)!==null}async openGithubRepo(e){let t=this.getCompanyConfig(e);if(!t)return{success:!1,message:`Company '${e}' not found. Available companies: ${this.getAllCompanies().join(", ")}`};let r=t.configRepo;r.endsWith(".git")&&(r=r.slice(0,-4)),r.startsWith("git@github.com:")&&(r=r.replace("git@github.com:","https://github.com/"));try{let s=process.platform,i,o;return s==="darwin"?(i="open",o=[r]):s==="win32"?(i="start",o=["",r]):(i="xdg-open",o=[r]),(0,Fi.spawn)(i,o,{detached:!0,stdio:"ignore"}).unref(),{success:!0,message:`Opening ${r} in default browser`}}catch(s){return{success:!1,message:`Failed to open browser: ${s instanceof Error?s.message:"Unknown error"}`}}}};var Ma=require("fs"),Ka=require("os"),$n=require("path");var _a=require("path"),Fa=require("readline"),ja=x(Ta(),1),{copy:rp,ensureDir:xa,pathExists:Tt,readdir:sp,remove:ip,stat:op}=ja.default,zr=class{async promptConfirmation(e){return new Promise(t=>{let r=(0,Fa.createInterface)({input:process.stdin,output:process.stdout});r.question(`${e} (y/N): `,s=>{r.close();let i=s.toLowerCase().trim();t(i==="y"||i==="yes")})})}async safeCopy(e,t,r={}){let{overwrite:s=!1,skipExisting:i=!1,onOverwrite:o}=r;try{if(!await Tt(e))return{success:!1,message:`Source path does not exist: ${e}`};await xa((0,_a.dirname)(t));let a=await Tt(t);if(a){if(i)return{success:!0,message:`Target already exists, skipping: ${t}`,skippedFiles:[t]};if(!s&&!o)return{success:!1,message:`Target already exists: ${t}. Use overwrite option or provide onOverwrite callback to proceed.`};if(o){if(!await o(e,t))return{success:!1,message:`Copy cancelled by user for: ${t}`}}else if(s&&!await this.promptConfirmation(`Target already exists at ${t}. Overwrite?`))return{success:!1,message:`Copy cancelled by user for: ${t}`};process.stdout.write(`\u26A0\uFE0F Overwriting existing path: ${t}
|
146
|
+
`)}return await rp(e,t,{overwrite:!0}),{success:!0,message:`Successfully copied ${e} to ${t}`,overwrittenFiles:a?[t]:void 0}}catch(a){return{success:!1,message:`Failed to copy ${e} to ${t}: ${a}`}}}async getDirectoryInfo(e){try{if(!await Tt(e))return{exists:!1,isEmpty:!1,fileCount:0,subdirectoryCount:0};let r=await sp(e,{withFileTypes:!0}),s=r.filter(o=>o.isFile()).length,i=r.filter(o=>o.isDirectory()).length;return{exists:!0,isEmpty:r.length===0,fileCount:s,subdirectoryCount:i}}catch{return{exists:!1,isEmpty:!1,fileCount:0,subdirectoryCount:0}}}async safeRemove(e,t=!1){try{return await Tt(e)?t?(await ip(e),{success:!0,message:`Successfully removed: ${e}`}):{success:!1,message:`Removal not confirmed for: ${e}. Set confirm=true to proceed.`}:{success:!0,message:`Path does not exist (already removed): ${e}`}}catch(r){return{success:!1,message:`Failed to remove ${e}: ${r}`}}}async ensureDirectory(e){try{return await xa(e),{success:!0,message:`Directory ensured: ${e}`}}catch(t){return{success:!1,message:`Failed to ensure directory ${e}: ${t}`}}}async exists(e){return Tt(e)}async getStats(e){try{let t=await op(e);return{isFile:t.isFile(),isDirectory:t.isDirectory(),size:t.size}}catch{return null}}},de=new zr;var Ra=require("child_process");function ap(n,e){if(n!=="gh")return;let t=[/^push$/,/^repo\s+push/,/^pr\s+create/,/^pr\s+merge/];if(e.length>0&&e[0]==="repo"){let s=e[1];if(s&&!["clone","list","view"].includes(s))throw new Error(`Dangerous gh repo command blocked: '${s}'. Only clone, list, and view are allowed.`)}if(e.length>0&&e[0]==="pr")throw new Error(`Dangerous gh pr command blocked: '${e[0]}'. PR operations are not allowed in config repo manager.`);if(e.length>0&&e[0]==="push")throw new Error("Dangerous gh push command blocked. Push operations are not allowed in config repo manager.");let r=e.join(" ");for(let s of t)if(s.test(r))throw new Error(`Dangerous gh command blocked: '${r}'. This command could modify remote repositories.`)}function Dn(n,e,t={}){return new Promise(r=>{try{ap(n,e)}catch(i){process.stderr.write(`Security Error: ${i instanceof Error?i.message:"Unknown error"}
|
147
|
+
`),r({success:!1,exitCode:1,signal:null});return}let s=(0,Ra.spawn)(n,e,{stdio:"inherit",cwd:t.cwd,shell:!0});s.on("close",(i,o)=>{r({success:i===0,exitCode:i,signal:o})}),s.on("error",i=>{process.stderr.write(`Failed to execute command: ${i.message}
|
148
|
+
`),r({success:!1,exitCode:null,signal:null})})})}var Pn=class{configProvider;baseDir;constructor(){this.configProvider=new Pe,this.baseDir=(0,$n.join)((0,Ka.homedir)(),".frond")}getRepoPath(e){return(0,$n.join)(this.baseDir,"config-repos",e)}async checkGhCliInstalled(){return(await Dn("gh",["--version"])).success?{installed:!0}:{installed:!1,message:`GitHub CLI (gh) is not installed or not accessible. Please install it from https://cli.github.com/ and ensure it's in your PATH.
|
149
|
+
|
150
|
+
After installation, you'll need to authenticate with two GitHub accounts:
|
151
|
+
1. Your personal GitHub account: gh auth login
|
152
|
+
2. The fern-support account: gh auth login --hostname github.com
|
153
|
+
|
154
|
+
You can switch between accounts using: gh auth switch`}}async cloneCompanyRepo(e){let t=await this.checkGhCliInstalled();if(!t.installed)return{success:!1,repoPath:"",message:t.message||"GitHub CLI not available"};let r=this.configProvider.getCompanyConfig(e);if(!r)return{success:!1,repoPath:"",message:`Company '${e}' not found in configuration. Available companies: ${this.configProvider.getAllCompanies().join(", ")}`};if(r.configRepo==="unknown")return{success:!1,repoPath:"",message:`The configuration repository for '${e}' is set to "unknown". Please find the correct repository URL and update it in packages/company-config/companies.json.`};let s=this.getRepoPath(e),i=(0,$n.join)(this.baseDir,"config-repos"),o=await de.ensureDirectory(i);return o.success?(0,Ma.existsSync)(s)?{success:!1,repoPath:s,message:`Repository already exists at ${s}`}:(process.stdout.write(`Cloning ${r.configRepo} to ${s}...
|
155
|
+
`),(await Dn("gh",["repo","clone",r.configRepo,s])).success?(process.stdout.write(`Setting up git authentication for ${s}...
|
156
|
+
`),(await Dn("gh",["auth","setup-git"],{cwd:s})).success||process.stderr.write(`Warning: Failed to setup git authentication, but repo was cloned successfully.
|
157
|
+
`),{success:!0,repoPath:s,message:`Successfully cloned and configured ${e} config repository`}):{success:!1,repoPath:s,message:`Failed to clone repository '${r.configRepo}'.
|
158
|
+
|
159
|
+
This may be because:
|
160
|
+
1. The repository doesn't exist or you don't have access to it
|
161
|
+
2. Your GitHub CLI is not authenticated with the correct account
|
162
|
+
|
163
|
+
If this is a private repository under the fern-support organization, you may need to switch to the fern-support account:
|
164
|
+
gh auth switch
|
165
|
+
|
166
|
+
To see all your authenticated accounts:
|
167
|
+
gh auth status
|
168
|
+
|
169
|
+
To add the fern-support account if not already configured:
|
170
|
+
gh auth login --hostname github.com`}):{success:!1,repoPath:s,message:o.message}}listAvailableCompanies(){return this.configProvider.getAllCompanies()}};var Nt=require("fs"),Dt=require("fs/promises"),$r=require("os"),U=require("path");var Lu=x(Oi(),1);var Ii=require("fs"),pn=require("fs/promises"),qi=require("os"),Nr=require("path");var Ze=class{configPath;constructor(){this.configPath=(0,Nr.join)((0,qi.homedir)(),".frond",".frondrc")}async getConfig(){try{if(!(0,Ii.existsSync)(this.configPath))return{};let e=await(0,pn.readFile)(this.configPath,"utf-8");return JSON.parse(e)}catch(e){return process.stderr.write(`Warning: Failed to read config file: ${e}
|
171
|
+
`),{}}}async setLocalFernRepoPath(e){let t=(0,Nr.join)(e,"packages","cli","cli","dist","prod","cli.cjs");if(!(0,Ii.existsSync)(t))throw new Error(`Invalid fern repository path: ${t} not found. Make sure the fern repository is built.`);let r=await this.getConfig();r.localFernRepoPath=e;let s=(0,Nr.join)((0,qi.homedir)(),".frond");await de.ensureDirectory(s),await(0,pn.writeFile)(this.configPath,JSON.stringify(r,null,2)),process.stdout.write(`\u2705 Local fern repository path set to: ${e}
|
172
|
+
`)}async getLocalFernRepoPath(){return(await this.getConfig()).localFernRepoPath}async clearLocalFernRepoPath(){let e=await this.getConfig();delete e.localFernRepoPath,await(0,pn.writeFile)(this.configPath,JSON.stringify(e,null,2)),process.stdout.write(`\u2705 Local fern repository path cleared
|
173
|
+
`)}};var Au=require("child_process");function at(n,e,t={}){return new Promise(r=>{let s=(0,Au.spawn)(n,e,{stdio:"inherit",cwd:t.cwd,shell:!0});s.on("close",(i,o)=>{r({success:i===0,exitCode:i,signal:o})}),s.on("error",i=>{process.stderr.write(`Failed to execute command: ${i.message}
|
174
|
+
`),r({success:!1,exitCode:null,signal:null})})})}var Dr=class{configProvider;baseDir;configManager;constructor(){this.configProvider=new Pe,this.baseDir=(0,U.join)((0,$r.homedir)(),".frond"),this.configManager=new Ze}getRepoPath(e){return(0,U.join)(this.baseDir,"config-repos",e)}getSdkOutputPath(e,t){return(0,U.join)(this.baseDir,"sdks",e,`${t}-sdk`)}async parseGeneratorsYml(e,t){let r=t?(0,U.join)(e,"fern","apis",t,"generators.yml"):(0,U.join)(e,"fern","generators.yml");if(!(0,Nt.existsSync)(r))throw new Error(`generators.yml not found at ${r}`);let s=await(0,Dt.readFile)(r,"utf-8");return(0,Lu.parse)(s)}async getTargetRepository(e,t,r){let i=(await this.parseGeneratorsYml(e,r)).groups?.[t];if(!i)throw new Error(`Group '${t}' not found in generators.yml`);let o=i.generators?.[0];if(!o?.github?.repository)throw new Error(`No GitHub repository found for group '${t}' in generators.yml`);return o.github.repository}async createTempDirectory(){let e=(0,U.join)((0,$r.tmpdir)(),`frond-${Date.now()}-${Math.random().toString(36).substring(7)}`);return await de.ensureDirectory(e),e}async parseFernIgnore(e){let t=(0,U.join)(e,".fernignore");if(!(0,Nt.existsSync)(t))return[];try{return(await(0,Dt.readFile)(t,"utf-8")).split(`
|
175
|
+
`).map(s=>s.trim()).filter(s=>s&&!s.startsWith("#"))}catch{return[]}}shouldIgnoreFile(e,t){for(let r of t)if(r.includes("*")){if(new RegExp(r.replace(/\*/g,".*")).test(e))return!0}else if(e.includes(r))return!0;return!1}async getOutputSubdirectories(e){try{let{readdir:t}=await import("fs/promises");return(await t(e,{withFileTypes:!0})).filter(s=>s.isDirectory()).map(s=>s.name)}catch{return[]}}async findBestOutputSubdirectory(e,t){let r=await this.getOutputSubdirectories(e);if(r.length===0)throw new Error("No output directories found in temp path");if(r.length===1){let c=r[0];if(!c)throw new Error("Unexpected: subdirs has length 1 but first element is undefined");return c}let i=t.split("/")[1];if(!i){let c=r[0];if(!c)throw new Error("Unexpected: subdirs array is non-empty but first element is undefined");return c}let o=r.find(c=>c.toLowerCase().includes(i.toLowerCase())||i.toLowerCase().includes(c.toLowerCase()));if(o)return o;let a=r[0];if(!a)throw new Error("Unexpected: subdirs array is non-empty but first element is undefined");return process.stdout.write(`\u26A0\uFE0F Multiple output directories found: ${r.join(", ")}. Using first one: ${a}
|
176
|
+
`),a}async copyFilesWithIgnoreFilter(e,t,r){let{readdir:s,stat:i}=await import("fs/promises"),o=await s(e,{withFileTypes:!0});for(let a of o){let c=(0,U.join)(e,a.name),l=(0,U.join)(t,a.name),u=a.name;if(this.shouldIgnoreFile(u,r)){process.stdout.write(`\u23ED\uFE0F Skipping ignored file: ${u}
|
177
|
+
`);continue}if(a.isDirectory())await de.ensureDirectory(l),await this.copyFilesWithIgnoreFilter(c,l,r);else{let f=await de.safeCopy(c,l,{overwrite:!0});f.success||process.stderr.write(`\u26A0\uFE0F Failed to copy ${u}: ${f.message}
|
178
|
+
`)}}}async buildFernCommand(e){if(e){let t=await this.configManager.getLocalFernRepoPath();if(!t)throw new Error("Local fern repository path not configured. Use frond config to set it up.");let r=(0,U.join)(t,"packages","cli","cli","dist","prod","cli.cjs");if(!(0,Nt.existsSync)(r))throw new Error(`Local fern CLI not found at ${r}. Make sure the fern repository is built.`);return{command:"FERN_NO_VERSION_REDIRECTION=true node",args:["--enable-source-maps",r]}}return{command:"fern",args:[]}}async copySdksToOutputDirectory(e,t,r,s,i){let o=[],a=s||(i?(0,U.join)(t,"fern","apis",i,".preview"):(0,U.join)(t,"fern",".preview")),l={"ts-sdk":"typescript","typescript-sdk":"typescript","python-sdk":"python","py-sdk":"python","java-sdk":"java","go-sdk":"go","csharp-sdk":"csharp","cs-sdk":"csharp"}[r];l||process.stdout.write(`\u26A0\uFE0F Unknown group '${r}', will attempt to copy all found SDKs
|
179
|
+
`);let u=(0,U.join)(this.baseDir,"sdks",e);if(await de.ensureDirectory(u),!await de.exists(a))return process.stdout.write(`\u26A0\uFE0F Source directory not found at ${a}
|
180
|
+
`),o;try{let f=await de.getDirectoryInfo(a);if(!f.exists||f.isEmpty)return process.stdout.write(`\u26A0\uFE0F Source directory is empty at ${a}
|
181
|
+
`),o;let{readdir:d}=await import("fs/promises"),h=await d(a,{withFileTypes:!0}),y=[{patterns:["typescript","ts"],language:"typescript"},{patterns:["python","py"],language:"python"},{patterns:["java"],language:"java"},{patterns:["go"],language:"go"},{patterns:["csharp","cs","dotnet"],language:"csharp"}];for(let p of h)if(p.isDirectory()){let m=p.name.toLowerCase(),S=y.find(({patterns:b})=>b.some(w=>m.includes(w)));if(S){if(l&&S.language!==l){process.stdout.write(`\u23ED\uFE0F Skipping ${S.language} SDK (expected ${l})
|
182
|
+
`);continue}let b=(0,U.join)(a,p.name),w=this.getSdkOutputPath(e,S.language);process.stdout.write(`Copying ${S.language} SDK from ${b} to ${w}...
|
183
|
+
`);let E=await de.safeCopy(b,w,{overwrite:!0});E.success?(o.push({language:S.language,path:w}),process.stdout.write(`\u2705 Successfully copied ${S.language} SDK
|
184
|
+
`)):process.stderr.write(`\u274C Failed to copy ${S.language} SDK: ${E.message}
|
185
|
+
`)}}}catch(f){process.stderr.write(`\u26A0\uFE0F Error reading source directory: ${f}
|
186
|
+
`)}return o}async getFernVersion(e,t){if(e)return"0.0.0";try{let r=this.getRepoPath(t),s=(0,U.join)(r,"fern","fern.config.json");if((0,Nt.existsSync)(s))return JSON.parse(await(0,Dt.readFile)(s,"utf-8")).version||"unknown"}catch{}return"unknown"}async getGeneratorInfo(e,t,r,s){if(r)return{name:`local-${t}`,version:"0.0.0"};try{let i=this.getRepoPath(e),a=(await this.parseGeneratorsYml(i,s)).groups?.[t];if(a?.generators?.[0]){let c=a.generators[0];if(c.github?.repository)return{name:c.github.repository.split("/")[1]||"unknown",version:"latest"}}}catch{}return{name:"unknown",version:"unknown"}}async saveGenerationArtifact(e,t,r,s){try{let i=await this.getFernVersion(r.useLocalFern,t),o=await this.getGeneratorInfo(t,r.group,r.useLocalGenerator,r.api),a={timestamp:new Date().toISOString(),companyName:t,group:r.group,api:r.api,fernMode:r.useLocalFern?"local":"standard",fernVersion:i,generatorMode:r.useLocalGenerator?"local":"standard",generatorName:o.name,generatorVersion:o.version,fernCliPath:r.useLocalFern?s:void 0,outputPath:e},c=(0,U.join)(e,"frond-gen-artifact.json");await(0,Dt.writeFile)(c,JSON.stringify(a,null,2),"utf-8"),process.stdout.write(`\u{1F4C4} Generated artifact file: ${c}
|
187
|
+
`)}catch(i){process.stderr.write(`\u26A0\uFE0F Warning: Could not save generation artifact: ${i}
|
188
|
+
`)}}async generateSdk(e,t={}){if(!this.configProvider.getCompanyConfig(e))return{success:!1,repoPath:"",message:`Company '${e}' not found in configuration. Available companies: ${this.configProvider.getAllCompanies().join(", ")}`};let s=this.getRepoPath(e);if(!(0,Nt.existsSync)(s))return{success:!1,repoPath:s,message:`Repository not found at ${s}. Run 'frond clone ${e}' first.`};let i={group:t.group||"ts-sdk",logLevel:t.logLevel||"debug",preview:t.useLocalFern?!1:t.preview!==!1,useLocalGenerator:t.useLocalGenerator||!1,useLocalFern:t.useLocalFern||!1,api:t.api};if(!i.preview&&!i.useLocalGenerator)return{success:!1,repoPath:s,message:`Safety check failed: frond generate commands must include either --preview or --generator-local flag for safety. Current options: preview=${i.preview}, local=${i.useLocalGenerator}`};let o;try{o=await this.buildFernCommand(i.useLocalFern)}catch(h){return{success:!1,repoPath:s,message:`Failed to setup fern command: ${h instanceof Error?h.message:String(h)}`}}let a=[...o.args,"generate"];i.preview&&a.push("--preview");let c;i.useLocalGenerator&&(c=await this.createTempDirectory(),a.push("--lfs-override",c),a.push("--local")),a.push("--group",i.group),a.push("--log-level",i.logLevel),i.api&&a.push("--api",i.api);let l=i.useLocalFern?"local fern":"fern";if(process.stdout.write(`Running ${l} ${a.slice(o.args.length).join(" ")} in ${s}...
|
189
|
+
`),!a.includes("--preview")&&!a.includes("--lfs-override"))return{success:!1,repoPath:s,message:`Safety check failed: fern generate commands must include either --preview or --lfs-override flag for safety. Current args: ${a.join(" ")}`};if(!(await at(o.command,a,{cwd:s})).success)return{success:!1,repoPath:s,message:"Failed to generate SDK. Make sure fern CLI is installed and the repository has a valid fern configuration."};if(i.useLocalFern&&c)try{let h=await this.getTargetRepository(s,i.group,i.api);process.stdout.write(`Found target repository: ${h}
|
190
|
+
`);let y=i.group.replace("-sdk",""),p=this.getSdkOutputPath(e,y);process.stdout.write(`Cleaning up existing directory at ${p}...
|
191
|
+
`),(await at("rm",["-rf",p],{})).success||process.stdout.write(`\u26A0\uFE0F Warning: Could not remove existing directory
|
192
|
+
`),process.stdout.write(`Cloning ${h} to ${p}...
|
193
|
+
`);let S=`https://github.com/${h}.git`;if(!(await at("gh",["repo","clone",S,p],{})).success)throw new Error(`Failed to clone repository ${h}`);let w=await this.findBestOutputSubdirectory(c,h),E=(0,U.join)(c,w);process.stdout.write(`Using output subdirectory: ${w}
|
194
|
+
`);let C=await this.parseFernIgnore(p);process.stdout.write(`Found ${C.length} ignore patterns in .fernignore
|
195
|
+
`),process.stdout.write(`Copying generated files from ${E} to ${p} with .fernignore filtering...
|
196
|
+
`),await this.copyFilesWithIgnoreFilter(E,p,C);let N=i.useLocalFern?(0,U.join)(await this.configManager.getLocalFernRepoPath()||"","packages","cli","cli","dist","prod","cli.cjs"):void 0;return await this.saveGenerationArtifact(p,e,i,N),await de.exists(c)&&await at("rm",["-rf",c],{}),{success:!0,repoPath:s,message:`Successfully generated ${i.group} SDK for ${e} using --local mode. Output written to ${p}`,copiedSdks:[{language:y,path:p}]}}catch(h){return c&&await de.exists(c)&&await at("rm",["-rf",c],{}),{success:!1,repoPath:s,message:`Failed to process --local mode: ${h instanceof Error?h.message:String(h)}`}}process.stdout.write(`Copying generated SDKs to output directory...
|
197
|
+
`);let f=await this.copySdksToOutputDirectory(e,s,i.group,c,i.api);if(f.length>0){let h=i.useLocalFern?(0,U.join)(await this.configManager.getLocalFernRepoPath()||"","packages","cli","cli","dist","prod","cli.cjs"):void 0;for(let y of f)await this.saveGenerationArtifact(y.path,e,i,h)}let d=`Successfully generated ${i.group} SDK for ${e}`;if(f.length>0){let h=f.map(y=>y.language).join(", ");d+=`. Copied ${f.length} SDK(s): ${h}`}else d+=". Note: No SDKs were found in the expected preview directory.";return c&&await de.exists(c)&&await at("rm",["-rf",c],{}),{success:!0,repoPath:s,message:d,copiedSdks:f}}listAvailableCompanies(){return this.configProvider.getAllCompanies()}getConfigManager(){return this.configManager}};var Ti=require("os");var j=x(require("fs"),1),H=x(require("path"),1);var be=x(require("fs"),1),Ie=x(require("path"),1),Pr=class{async generate(e,t,r){this.createMainProjectFile(e,t,r),this.createMainFile(e,t),this.createDirectoryStructure(t),this.createGitIgnore(t),this.createEnvFile(t),this.createReadme(e,t,r)}createMainProjectFile(e,t,r){let s=this.getRelativeSdkPath(t,r),i=this.sanitizeForCsharpProject(e.companyName),o=this.findSdkProjectFile(r),a=`<Project Sdk="Microsoft.NET.Sdk">
|
198
|
+
|
199
|
+
<PropertyGroup>
|
200
|
+
<OutputType>Exe</OutputType>
|
201
|
+
<TargetFramework>net8.0</TargetFramework>
|
202
|
+
<LangVersion>12</LangVersion>
|
203
|
+
<ImplicitUsings>enable</ImplicitUsings>
|
204
|
+
<Nullable>enable</Nullable>
|
205
|
+
<AssemblyName>${i}.Sandbox.${this.sanitizeForCsharpProject(e.sandboxName)}</AssemblyName>
|
206
|
+
<RootNamespace>${i}.Sandbox</RootNamespace>
|
207
|
+
</PropertyGroup>
|
208
|
+
|
209
|
+
<ItemGroup>
|
210
|
+
<PackageReference Include="DotNetEnv" Version="3.1.1" />
|
211
|
+
</ItemGroup>
|
212
|
+
|
213
|
+
<ItemGroup>
|
214
|
+
${o?`<ProjectReference Include="${s}/${o}" />`:"<!-- TODO: Add project reference to SDK -->"}
|
215
|
+
</ItemGroup>
|
216
|
+
|
217
|
+
</Project>
|
218
|
+
`;be.writeFileSync(Ie.join(t,`${i}.Sandbox.csproj`),a)}createDirectoryStructure(e){let t=Ie.join(e,"Properties");be.mkdirSync(t,{recursive:!0})}createMainFile(e,t){let r=this.sanitizeForCsharpProject(e.companyName),s=this.getClientClassName(e.companyName),i=`using System;
|
219
|
+
using System.Threading.Tasks;
|
220
|
+
using DotNetEnv;
|
221
|
+
// NOTE: You may need to adjust this using statement based on the actual SDK namespace
|
222
|
+
// using ${r};
|
223
|
+
|
224
|
+
namespace ${r}.Sandbox;
|
225
|
+
|
226
|
+
/// <summary>
|
227
|
+
/// ${e.companyName} SDK Sandbox
|
228
|
+
///
|
229
|
+
/// This is a test sandbox for the locally generated ${e.companyName} SDK.
|
230
|
+
/// Modify this file to test different SDK functionality and reproduce issues.
|
231
|
+
/// </summary>
|
232
|
+
public class Program
|
233
|
+
{
|
234
|
+
public static async Task Main(string[] args)
|
235
|
+
{
|
236
|
+
Console.WriteLine("Starting ${e.companyName} SDK sandbox...");
|
237
|
+
|
238
|
+
try
|
239
|
+
{
|
240
|
+
// Load environment variables from .env file
|
241
|
+
Env.Load();
|
242
|
+
|
243
|
+
// Load API key from environment
|
244
|
+
var apiKey = Environment.GetEnvironmentVariable("API_KEY");
|
245
|
+
if (string.IsNullOrEmpty(apiKey))
|
246
|
+
{
|
247
|
+
Console.WriteLine("Warning: API_KEY not found in environment. Please check your .env file.");
|
248
|
+
}
|
249
|
+
|
250
|
+
// Initialize the SDK client
|
251
|
+
// NOTE: You'll need to adjust this based on the actual SDK structure
|
252
|
+
// var client = new ${s}(apiKey ?? "");
|
253
|
+
|
254
|
+
Console.WriteLine("SDK imported successfully!");
|
255
|
+
Console.WriteLine($"Client would be initialized here with API key: {(apiKey != null ? "[REDACTED]" : "null")}");
|
256
|
+
|
257
|
+
// Add your test code here
|
258
|
+
// Example:
|
259
|
+
// var response = await client.SomeMethodAsync();
|
260
|
+
// Console.WriteLine($"Response: {response}");
|
261
|
+
|
262
|
+
Console.WriteLine("Sandbox completed successfully!");
|
263
|
+
}
|
264
|
+
catch (Exception ex)
|
265
|
+
{
|
266
|
+
Console.WriteLine($"Error in sandbox: {ex.Message}");
|
267
|
+
Console.WriteLine(ex.StackTrace);
|
268
|
+
Environment.Exit(1);
|
269
|
+
}
|
270
|
+
}
|
271
|
+
}
|
272
|
+
`;be.writeFileSync(Ie.join(t,"Program.cs"),i)}createGitIgnore(e){be.writeFileSync(Ie.join(e,".gitignore"),`# Build results
|
273
|
+
[Dd]ebug/
|
274
|
+
[Dd]ebugPublic/
|
275
|
+
[Rr]elease/
|
276
|
+
[Rr]eleases/
|
277
|
+
x64/
|
278
|
+
x86/
|
279
|
+
build/
|
280
|
+
bld/
|
281
|
+
[Bb]in/
|
282
|
+
[Oo]bj/
|
283
|
+
|
284
|
+
# Visual Studio files
|
285
|
+
.vs/
|
286
|
+
*.suo
|
287
|
+
*.user
|
288
|
+
*.userosscache
|
289
|
+
*.sln.docstates
|
290
|
+
*.vcxproj.filters
|
291
|
+
*.vcxproj.user
|
292
|
+
|
293
|
+
# Rider files
|
294
|
+
.idea/
|
295
|
+
*.sln.iml
|
296
|
+
|
297
|
+
# User-specific files
|
298
|
+
*.rsuser
|
299
|
+
*.suo
|
300
|
+
*.user
|
301
|
+
*.userosscache
|
302
|
+
*.sln.docstates
|
303
|
+
|
304
|
+
# Environment variables
|
305
|
+
.env
|
306
|
+
.env.local
|
307
|
+
|
308
|
+
# Frond SDK symlink
|
309
|
+
.frond
|
310
|
+
|
311
|
+
# OS files
|
312
|
+
.DS_Store
|
313
|
+
Thumbs.db
|
314
|
+
|
315
|
+
# Logs
|
316
|
+
*.log
|
317
|
+
|
318
|
+
# NuGet packages
|
319
|
+
*.nupkg
|
320
|
+
*.snupkg
|
321
|
+
.nuget/
|
322
|
+
|
323
|
+
# Test results
|
324
|
+
TestResults/
|
325
|
+
coverage/
|
326
|
+
*.coverage
|
327
|
+
*.coveragexml
|
328
|
+
|
329
|
+
# Benchmark results
|
330
|
+
BenchmarkDotNet.Artifacts/
|
331
|
+
|
332
|
+
# .NET Core
|
333
|
+
project.lock.json
|
334
|
+
project.fragment.lock.json
|
335
|
+
artifacts/
|
336
|
+
|
337
|
+
# StyleCop
|
338
|
+
StyleCopReport.xml
|
339
|
+
|
340
|
+
# Files built by Visual Studio
|
341
|
+
*_i.c
|
342
|
+
*_p.c
|
343
|
+
*_h.h
|
344
|
+
*.ilk
|
345
|
+
*.meta
|
346
|
+
*.obj
|
347
|
+
*.iobj
|
348
|
+
*.pch
|
349
|
+
*.pdb
|
350
|
+
*.ipdb
|
351
|
+
*.pgc
|
352
|
+
*.pgd
|
353
|
+
*.rsp
|
354
|
+
*.sbr
|
355
|
+
*.tlb
|
356
|
+
*.tli
|
357
|
+
*.tlh
|
358
|
+
*.tmp
|
359
|
+
*.tmp_proj
|
360
|
+
*_wpftmp.csproj
|
361
|
+
*.log
|
362
|
+
*.tlog
|
363
|
+
*.vspscc
|
364
|
+
*.vssscc
|
365
|
+
.builds
|
366
|
+
*.pidb
|
367
|
+
*.svclog
|
368
|
+
*.scc
|
369
|
+
|
370
|
+
# Chutzpah Test files
|
371
|
+
_Chutzpah*
|
372
|
+
|
373
|
+
# Visual C++ cache files
|
374
|
+
ipch/
|
375
|
+
*.aps
|
376
|
+
*.ncb
|
377
|
+
*.opendb
|
378
|
+
*.opensdf
|
379
|
+
*.sdf
|
380
|
+
*.cachefile
|
381
|
+
*.VC.db
|
382
|
+
*.VC.VC.opendb
|
383
|
+
|
384
|
+
# Visual Studio profiler
|
385
|
+
*.psess
|
386
|
+
*.vsp
|
387
|
+
*.vspx
|
388
|
+
*.sap
|
389
|
+
|
390
|
+
# Web publish profiles
|
391
|
+
PublishScripts/
|
392
|
+
|
393
|
+
# NuGet Symbol Packages
|
394
|
+
*.snupkg
|
395
|
+
|
396
|
+
# MSTest test Results
|
397
|
+
[Tt]est[Rr]esult*/
|
398
|
+
[Bb]uild[Ll]og.*
|
399
|
+
|
400
|
+
# NUNIT
|
401
|
+
*.VisualState.xml
|
402
|
+
TestResult.xml
|
403
|
+
|
404
|
+
# NCrunch
|
405
|
+
_NCrunch_*
|
406
|
+
.*crunch*.local.xml
|
407
|
+
nCrunchTemp_*
|
408
|
+
|
409
|
+
# MightyMoose
|
410
|
+
*.mm.*
|
411
|
+
AutoTest.Net/
|
412
|
+
|
413
|
+
# Web workbench (sass)
|
414
|
+
.sass-cache/
|
415
|
+
|
416
|
+
# Installshield output folder
|
417
|
+
[Ee]xpress/
|
418
|
+
|
419
|
+
# DocProject is a documentation generator add-in
|
420
|
+
DocProject/buildhelp/
|
421
|
+
DocProject/Help/*.HxT
|
422
|
+
DocProject/Help/*.HxC
|
423
|
+
DocProject/Help/Html2
|
424
|
+
DocProject/Help/html
|
425
|
+
|
426
|
+
# Click-Once directory
|
427
|
+
publish/
|
428
|
+
|
429
|
+
# Publish Web Output
|
430
|
+
*.[Pp]ublish.xml
|
431
|
+
*.azurePubxml
|
432
|
+
*.pubxml
|
433
|
+
*.publishproj
|
434
|
+
|
435
|
+
# Windows Azure Build Output
|
436
|
+
csx/
|
437
|
+
*.build.csdef
|
438
|
+
|
439
|
+
# Windows Store app package directory
|
440
|
+
AppPackages/
|
441
|
+
|
442
|
+
# Others
|
443
|
+
ClientBin/
|
444
|
+
~$*
|
445
|
+
*~
|
446
|
+
*.dbmdl
|
447
|
+
*.dbproj.schemaview
|
448
|
+
*.publishsettings
|
449
|
+
orleans.codegen.cs
|
450
|
+
|
451
|
+
# RIA/Silverlight projects
|
452
|
+
Generated_Code/
|
453
|
+
|
454
|
+
# Backup & report files from converting an old project file to a newer
|
455
|
+
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
456
|
+
_UpgradeReport_Files/
|
457
|
+
Backup*/
|
458
|
+
UpgradeLog*.XML
|
459
|
+
UpgradeLog*.htm
|
460
|
+
|
461
|
+
# SQL Server files
|
462
|
+
*.mdf
|
463
|
+
*.ldf
|
464
|
+
|
465
|
+
# Business Intelligence projects
|
466
|
+
*.rdl.data
|
467
|
+
*.bim.layout
|
468
|
+
*.bim_*.settings
|
469
|
+
|
470
|
+
# Microsoft Fakes
|
471
|
+
FakesAssemblies/
|
472
|
+
|
473
|
+
# LightSwitch generated files
|
474
|
+
GeneratedArtifacts/
|
475
|
+
_Pvt_Extensions/
|
476
|
+
ModelManifest.xml
|
477
|
+
`)}createEnvFile(e){be.writeFileSync(Ie.join(e,".env"),`API_KEY=your_api_key_here
|
478
|
+
`)}createReadme(e,t,r){let s=this.getRelativeSdkPath(t,r),i=this.sanitizeForCsharpProject(e.companyName),o=`# ${e.sandboxName}
|
479
|
+
|
480
|
+
**Company:** ${e.companyName}
|
481
|
+
**Language:** csharp
|
482
|
+
**SDK Path:** ${s}
|
483
|
+
|
484
|
+
${e.description?e.description:`This is a sandbox project for testing the locally generated SDK for ${e.companyName}.`}
|
485
|
+
|
486
|
+
## \u26A0\uFE0F Important Note
|
487
|
+
|
488
|
+
**The initial generated code is not guaranteed to run without modifications.** You may need to:
|
489
|
+
- Update import statements to match the actual SDK structure
|
490
|
+
- Correct client class names and initialization parameters
|
491
|
+
- Adjust method calls and parameter names based on the SDK's API
|
492
|
+
- Set up proper environment variables and authentication
|
493
|
+
|
494
|
+
## Prerequisites
|
495
|
+
|
496
|
+
- .NET 8.0 SDK or higher
|
497
|
+
- No additional tools required
|
498
|
+
|
499
|
+
## Getting Started
|
500
|
+
|
501
|
+
1. **Build and run the sandbox** (automatically builds SDK first):
|
502
|
+
\`\`\`bash
|
503
|
+
dotnet run
|
504
|
+
\`\`\`
|
505
|
+
|
506
|
+
2. **Just build the sandbox**:
|
507
|
+
\`\`\`bash
|
508
|
+
dotnet build
|
509
|
+
\`\`\`
|
510
|
+
|
511
|
+
3. **Build the local SDK separately** (if needed):
|
512
|
+
\`\`\`bash
|
513
|
+
cd "${s}"
|
514
|
+
dotnet build
|
515
|
+
\`\`\`
|
516
|
+
|
517
|
+
## Other Commands
|
518
|
+
|
519
|
+
- \`dotnet clean\` - Clean build artifacts
|
520
|
+
- \`dotnet test\` - Run tests (if any)
|
521
|
+
- \`dotnet publish\` - Create published output
|
522
|
+
- \`dotnet restore\` - Restore NuGet packages
|
523
|
+
|
524
|
+
## Environment Configuration
|
525
|
+
|
526
|
+
Create a \`.env\` file in the project root with your API credentials:
|
527
|
+
\`\`\`
|
528
|
+
API_KEY=your_actual_api_key_here
|
529
|
+
\`\`\`
|
530
|
+
|
531
|
+
## IDE Setup
|
532
|
+
|
533
|
+
### Visual Studio
|
534
|
+
1. Open the \`.csproj\` file or the folder containing it
|
535
|
+
2. Visual Studio will automatically restore NuGet packages
|
536
|
+
3. Set the project as startup project if needed
|
537
|
+
4. Press F5 to run
|
538
|
+
|
539
|
+
### VS Code
|
540
|
+
1. Install the "C# Dev Kit" extension
|
541
|
+
2. Open the project directory
|
542
|
+
3. VS Code will automatically detect the .NET project
|
543
|
+
4. Use \`Ctrl+F5\` to run without debugging
|
544
|
+
|
545
|
+
### Rider
|
546
|
+
1. Open the project directory or \`.csproj\` file
|
547
|
+
2. Rider will automatically restore packages and configure the project
|
548
|
+
3. Use the Run button or \`Ctrl+F5\` to execute
|
549
|
+
|
550
|
+
## Troubleshooting
|
551
|
+
|
552
|
+
- If you get compilation errors about missing SDK classes, build the SDK first: \`cd "${s}" && dotnet build\`
|
553
|
+
- Check that the project reference in \`${i}.Sandbox.csproj\` points to the correct SDK project file
|
554
|
+
- Verify .NET version with \`dotnet --version\` (should be 8.0+)
|
555
|
+
- If packages fail to restore, try \`dotnet restore --force\`
|
556
|
+
- For namespace issues, check the SDK's actual namespace in its source files
|
557
|
+
|
558
|
+
## Publishing
|
559
|
+
|
560
|
+
To share this sandbox with other developers:
|
561
|
+
\`\`\`bash
|
562
|
+
frond publish-sandbox ${e.sandboxName} <your-name>
|
563
|
+
\`\`\`
|
564
|
+
`;be.writeFileSync(Ie.join(t,"README.md"),o)}getClientClassName(e){return`${e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}Client`}getRelativeSdkPath(e,t){let r=process.env.HOME||process.env.USERPROFILE||"";return t.replace(Ie.join(r,".frond"),".frond")}sanitizeForCsharpProject(e){return e.replace(/[^a-zA-Z0-9]/g,"_").split("_").map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}findSdkProjectFile(e){try{let t=Ie.join(e,"src");if(!be.existsSync(t))return null;let r=be.readdirSync(t,{withFileTypes:!0});for(let s of r)if(s.isDirectory()){let i=Ie.join(t,s.name,`${s.name}.csproj`);if(be.existsSync(i)&&!s.name.includes("Test"))return`src/${s.name}/${s.name}.csproj`}}catch{}return null}};var we=x(require("fs"),1),De=x(require("path"),1),Ar=class{async generate(e,t,r){this.createGoMod(e,t,r),this.createMainFile(e,t,r),this.createMakefile(e,t,r),this.createReadme(e,t,r),this.createEnvFile(t),this.createGitIgnore(t)}createGoMod(e,t,r){let s=`${e.companyName}-sandbox-${e.sandboxName}`,i=this.getRelativeSdkPath(t,r),o=this.getPackageName(r,e.companyName),a=`module ${s}
|
565
|
+
|
566
|
+
go 1.21
|
567
|
+
|
568
|
+
// Local SDK dependency
|
569
|
+
replace ${o} => ${i}
|
570
|
+
|
571
|
+
require (
|
572
|
+
${o} v0.0.0-00010101000000-000000000000
|
573
|
+
github.com/joho/godotenv v1.5.1
|
574
|
+
)
|
575
|
+
`;we.writeFileSync(De.join(t,"go.mod"),a)}createMainFile(e,t,r){let s=this.getPackageName(r,e.companyName),{clientImport:i,optionImport:o,clientInit:a}=this.getClientSetup(r,s),c=`// ${e.companyName} SDK Sandbox
|
576
|
+
//
|
577
|
+
// This is a test sandbox for the locally generated ${e.companyName} SDK.
|
578
|
+
// Modify this file to test different SDK functionality and reproduce issues.
|
579
|
+
|
580
|
+
package main
|
581
|
+
|
582
|
+
import (
|
583
|
+
"fmt"
|
584
|
+
"log"
|
585
|
+
"os"
|
586
|
+
|
587
|
+
${i}
|
588
|
+
${o}
|
589
|
+
"github.com/joho/godotenv"
|
590
|
+
)
|
591
|
+
|
592
|
+
func main() {
|
593
|
+
fmt.Println("Starting ${e.companyName} SDK sandbox...")
|
594
|
+
|
595
|
+
// Load environment variables
|
596
|
+
err := godotenv.Load()
|
597
|
+
if err != nil {
|
598
|
+
log.Printf("Warning: Error loading .env file: %v", err)
|
599
|
+
}
|
600
|
+
|
601
|
+
apiKey := os.Getenv("API_KEY")
|
602
|
+
if apiKey == "" {
|
603
|
+
log.Printf("Warning: API_KEY not set in environment variables")
|
604
|
+
}
|
605
|
+
|
606
|
+
// Initialize the SDK client
|
607
|
+
// NOTE: You may need to update the configuration based on actual SDK structure
|
608
|
+
${a}
|
609
|
+
|
610
|
+
fmt.Printf("SDK imported and client initialized successfully! Client: %T\\n", sdkClient)
|
611
|
+
|
612
|
+
// Add your test code here
|
613
|
+
// Example:
|
614
|
+
// response, err := sdkClient.SomeService.SomeMethod()
|
615
|
+
// if err != nil {
|
616
|
+
// log.Fatalf("Error calling SDK method: %v", err)
|
617
|
+
// }
|
618
|
+
// fmt.Printf("Response: %+v\\n", response)
|
619
|
+
|
620
|
+
fmt.Println("Sandbox completed successfully!")
|
621
|
+
}
|
622
|
+
`;we.writeFileSync(De.join(t,"main.go"),c)}createMakefile(e,t,r){let s=`# Makefile for ${e.companyName} Go SDK Sandbox
|
623
|
+
|
624
|
+
.PHONY: help build run clean tidy mod-download test
|
625
|
+
|
626
|
+
help: ## Display this help message
|
627
|
+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\\033[36m%-15s\\033[0m %s\\n", $$1, $$2}'
|
628
|
+
|
629
|
+
build: ## Build the sandbox binary
|
630
|
+
go build -o bin/sandbox main.go
|
631
|
+
|
632
|
+
run: ## Run the sandbox
|
633
|
+
go run main.go
|
634
|
+
|
635
|
+
clean: ## Clean build artifacts
|
636
|
+
rm -rf bin/
|
637
|
+
go clean
|
638
|
+
|
639
|
+
tidy: ## Tidy go modules
|
640
|
+
go mod tidy
|
641
|
+
|
642
|
+
mod-download: ## Download dependencies
|
643
|
+
go mod download
|
644
|
+
|
645
|
+
test: ## Run tests (if any)
|
646
|
+
go test ./...
|
647
|
+
|
648
|
+
install-deps: ## Install development dependencies
|
649
|
+
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
650
|
+
|
651
|
+
lint: ## Run linter
|
652
|
+
golangci-lint run
|
653
|
+
|
654
|
+
fmt: ## Format code
|
655
|
+
go fmt ./...
|
656
|
+
|
657
|
+
vet: ## Run go vet
|
658
|
+
go vet ./...
|
659
|
+
|
660
|
+
check: fmt vet lint ## Run all code quality checks
|
661
|
+
|
662
|
+
.DEFAULT_GOAL := help
|
663
|
+
`;we.writeFileSync(De.join(t,"Makefile"),s)}createGitIgnore(e){we.writeFileSync(De.join(e,".gitignore"),`# Binaries for programs and plugins
|
664
|
+
*.exe
|
665
|
+
*.exe~
|
666
|
+
*.dll
|
667
|
+
*.so
|
668
|
+
*.dylib
|
669
|
+
bin/
|
670
|
+
sandbox
|
671
|
+
|
672
|
+
# Test binary, built with \`go test -c\`
|
673
|
+
*.test
|
674
|
+
|
675
|
+
# Output of the go coverage tool, specifically when used with LiteIDE
|
676
|
+
*.out
|
677
|
+
|
678
|
+
# Dependency directories (remove the comment below to include it)
|
679
|
+
# vendor/
|
680
|
+
|
681
|
+
# Go workspace file
|
682
|
+
go.work
|
683
|
+
|
684
|
+
# Environment variables
|
685
|
+
.env
|
686
|
+
.env.local
|
687
|
+
|
688
|
+
# Frond SDK symlink
|
689
|
+
.frond
|
690
|
+
|
691
|
+
# IDE
|
692
|
+
.vscode/
|
693
|
+
.idea/
|
694
|
+
*.swp
|
695
|
+
*.swo
|
696
|
+
|
697
|
+
# OS
|
698
|
+
.DS_Store
|
699
|
+
Thumbs.db
|
700
|
+
|
701
|
+
# Logs
|
702
|
+
*.log
|
703
|
+
|
704
|
+
# Go module cache
|
705
|
+
go.sum
|
706
|
+
`)}createReadme(e,t,r){let s=this.getRelativeSdkPath(t,r),i=`# ${e.sandboxName}
|
707
|
+
|
708
|
+
**Company:** ${e.companyName}
|
709
|
+
**Language:** go
|
710
|
+
**SDK Path:** ${s}
|
711
|
+
|
712
|
+
${e.description?e.description:`This is a sandbox project for testing the locally generated SDK for ${e.companyName}.`}
|
713
|
+
|
714
|
+
## \u26A0\uFE0F Important Note
|
715
|
+
|
716
|
+
**The initial generated code is not guaranteed to run without modifications.** You may need to:
|
717
|
+
- Update import statements to match the actual SDK structure
|
718
|
+
- Correct client class names and initialization parameters
|
719
|
+
- Adjust method calls and parameter names based on the SDK's API
|
720
|
+
- Set up proper environment variables and authentication
|
721
|
+
|
722
|
+
## Prerequisites
|
723
|
+
|
724
|
+
- Go 1.21 or later
|
725
|
+
- Make (optional, for using Makefile commands)
|
726
|
+
|
727
|
+
## Getting Started
|
728
|
+
|
729
|
+
1. **Download dependencies**:
|
730
|
+
\`\`\`bash
|
731
|
+
go mod download
|
732
|
+
\`\`\`
|
733
|
+
|
734
|
+
2. **Run your sandbox**:
|
735
|
+
\`\`\`bash
|
736
|
+
go run main.go
|
737
|
+
\`\`\`
|
738
|
+
|
739
|
+
Or using Make:
|
740
|
+
\`\`\`bash
|
741
|
+
make run
|
742
|
+
\`\`\`
|
743
|
+
|
744
|
+
3. **Build the binary** (optional):
|
745
|
+
\`\`\`bash
|
746
|
+
make build
|
747
|
+
./bin/sandbox
|
748
|
+
\`\`\`
|
749
|
+
|
750
|
+
## Development Commands
|
751
|
+
|
752
|
+
- \`make help\` - Show available commands
|
753
|
+
- \`make build\` - Build the sandbox binary
|
754
|
+
- \`make run\` - Run the sandbox
|
755
|
+
- \`make clean\` - Clean build artifacts
|
756
|
+
- \`make tidy\` - Tidy go modules
|
757
|
+
- \`make test\` - Run tests
|
758
|
+
- \`make fmt\` - Format code
|
759
|
+
- \`make vet\` - Run go vet
|
760
|
+
- \`make lint\` - Run linter (requires golangci-lint)
|
761
|
+
- \`make check\` - Run all code quality checks
|
762
|
+
|
763
|
+
## Environment Variables
|
764
|
+
|
765
|
+
Create a \`.env\` file in this directory with your configuration:
|
766
|
+
|
767
|
+
\`\`\`
|
768
|
+
API_KEY=your_api_key_here
|
769
|
+
\`\`\`
|
770
|
+
|
771
|
+
## Publishing
|
772
|
+
|
773
|
+
To share this sandbox with other developers:
|
774
|
+
\`\`\`bash
|
775
|
+
frond publish-sandbox ${e.sandboxName} <your-name>
|
776
|
+
\`\`\`
|
777
|
+
`;we.writeFileSync(De.join(t,"README.md"),i)}createEnvFile(e){we.writeFileSync(De.join(e,".env"),`API_KEY="your_api_key_here"
|
778
|
+
`)}getClientTypeName(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()+"Client"}getPackageName(e,t){let r=De.join(e,"go.mod");if(we.existsSync(r))try{let i=we.readFileSync(r,"utf-8").match(/^module\s+(.+)$/m);if(i&&i[1])return i[1].trim()}catch{}return t}getClientSetup(e,t){let r=De.join(e,"client"),s=De.join(e,"option");if(we.existsSync(r)&&we.existsSync(s))return{clientImport:`"${t}/client"`,optionImport:`"${t}/option"`,clientInit:`sdkClient := client.NewClient(
|
779
|
+
option.WithToken(apiKey),
|
780
|
+
// Add other required configuration options
|
781
|
+
)`};let i=this.getClientTypeName("");return{clientImport:`"${t}"`,optionImport:"// No option package found",clientInit:`// Initialize the SDK client - update based on actual SDK structure
|
782
|
+
sdkClient := ${t}.New${i}(${t}.Config{
|
783
|
+
Token: apiKey,
|
784
|
+
// Add other required configuration fields
|
785
|
+
})`}}getRelativeSdkPath(e,t){let r=process.env.HOME||process.env.USERPROFILE||"";return t.replace(De.join(r,".frond"),".frond")}};var V=x(require("fs"),1),Y=x(require("path"),1),Lr=class{async generate(e,t,r){this.createBuildGradle(e,t,r),this.createGradleProperties(t),this.createSettingsGradle(e,t),this.createGradleWrapper(t),this.createMainFile(e,t),this.createDirectoryStructure(t),this.createGitIgnore(t),this.createEnvFile(t),this.createReadme(e,t,r)}createBuildGradle(e,t,r){let s=this.getRelativeSdkPath(t,r),i=this.sanitizeForJavaPackage(e.companyName),o=`plugins {
|
786
|
+
id 'java'
|
787
|
+
id 'application'
|
788
|
+
}
|
789
|
+
|
790
|
+
group = 'com.${i}.sandbox'
|
791
|
+
version = '1.0.0'
|
792
|
+
|
793
|
+
java {
|
794
|
+
sourceCompatibility = JavaVersion.VERSION_11
|
795
|
+
targetCompatibility = JavaVersion.VERSION_11
|
796
|
+
}
|
797
|
+
|
798
|
+
repositories {
|
799
|
+
mavenCentral()
|
800
|
+
flatDir {
|
801
|
+
dirs '${s}/build/libs'
|
802
|
+
}
|
803
|
+
}
|
804
|
+
|
805
|
+
dependencies {
|
806
|
+
// Local SDK dependency
|
807
|
+
implementation fileTree(dir: '${s}/build/libs', include: '*.jar')
|
808
|
+
|
809
|
+
// HTTP Client dependencies
|
810
|
+
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
|
811
|
+
|
812
|
+
// JSON processing
|
813
|
+
implementation 'com.fasterxml.jackson.core:jackson-databind:2.16.0'
|
814
|
+
|
815
|
+
// Environment variables support
|
816
|
+
implementation 'io.github.cdimascio:dotenv-java:3.0.0'
|
817
|
+
|
818
|
+
// Logging
|
819
|
+
implementation 'org.slf4j:slf4j-simple:2.0.9'
|
820
|
+
|
821
|
+
// Test dependencies
|
822
|
+
testImplementation 'junit:junit:4.13.2'
|
823
|
+
}
|
824
|
+
|
825
|
+
application {
|
826
|
+
mainClass = 'com.${i}.sandbox.SandboxApplication'
|
827
|
+
}
|
828
|
+
|
829
|
+
tasks.register('buildSdk') {
|
830
|
+
description = 'Build the local SDK'
|
831
|
+
group = 'build'
|
832
|
+
doLast {
|
833
|
+
def sdkDir = '${s}'
|
834
|
+
def gradlewExists = file("\${sdkDir}/gradlew").exists()
|
835
|
+
|
836
|
+
// First run spotlessApply to fix formatting issues
|
837
|
+
exec {
|
838
|
+
workingDir sdkDir
|
839
|
+
if (gradlewExists) {
|
840
|
+
commandLine './gradlew', 'spotlessApply'
|
841
|
+
} else {
|
842
|
+
commandLine 'gradle', 'spotlessApply'
|
843
|
+
}
|
844
|
+
ignoreExitValue = true // Don't fail if spotless task doesn't exist
|
845
|
+
}
|
846
|
+
|
847
|
+
// Then build the SDK
|
848
|
+
exec {
|
849
|
+
workingDir sdkDir
|
850
|
+
if (gradlewExists) {
|
851
|
+
commandLine './gradlew', 'build'
|
852
|
+
} else {
|
853
|
+
commandLine 'gradle', 'build'
|
854
|
+
}
|
855
|
+
}
|
856
|
+
}
|
857
|
+
}
|
858
|
+
|
859
|
+
compileJava.dependsOn buildSdk
|
860
|
+
|
861
|
+
test {
|
862
|
+
useJUnitPlatform()
|
863
|
+
}
|
864
|
+
`;V.writeFileSync(Y.join(t,"build.gradle"),o)}createGradleProperties(e){V.writeFileSync(Y.join(e,"gradle.properties"),`org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
865
|
+
org.gradle.parallel=true
|
866
|
+
org.gradle.caching=true
|
867
|
+
`)}createSettingsGradle(e,t){let r=`rootProject.name = '${e.companyName}-sandbox-${e.sandboxName}'
|
868
|
+
`;V.writeFileSync(Y.join(t,"settings.gradle"),r)}createGradleWrapper(e){let t=Y.join(e,"gradle","wrapper");V.mkdirSync(t,{recursive:!0}),V.writeFileSync(Y.join(t,"gradle-wrapper.properties"),`distributionBase=GRADLE_USER_HOME
|
869
|
+
distributionPath=wrapper/dists
|
870
|
+
distributionUrl=https\\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
871
|
+
networkTimeout=10000
|
872
|
+
validateDistributionUrl=true
|
873
|
+
zipStoreBase=GRADLE_USER_HOME
|
874
|
+
zipStorePath=wrapper/dists
|
875
|
+
`),V.writeFileSync(Y.join(e,"gradlew"),`#!/bin/sh
|
876
|
+
# Simple Gradle wrapper - downloads gradle if needed
|
877
|
+
GRADLE_USER_HOME=\${GRADLE_USER_HOME:-"$HOME/.gradle"}
|
878
|
+
GRADLE_VERSION="8.5"
|
879
|
+
GRADLE_ZIP="gradle-\${GRADLE_VERSION}-bin.zip"
|
880
|
+
GRADLE_URL="https://services.gradle.org/distributions/\${GRADLE_ZIP}"
|
881
|
+
GRADLE_HOME="$GRADLE_USER_HOME/wrapper/dists/\${GRADLE_ZIP}/gradle-\${GRADLE_VERSION}"
|
882
|
+
|
883
|
+
if [ ! -d "$GRADLE_HOME" ]; then
|
884
|
+
echo "Downloading Gradle \${GRADLE_VERSION}..."
|
885
|
+
mkdir -p "$GRADLE_USER_HOME/wrapper/dists/\${GRADLE_ZIP}"
|
886
|
+
curl -L "$GRADLE_URL" -o "$GRADLE_USER_HOME/wrapper/dists/\${GRADLE_ZIP}/\${GRADLE_ZIP}"
|
887
|
+
cd "$GRADLE_USER_HOME/wrapper/dists/\${GRADLE_ZIP}"
|
888
|
+
unzip -q "\${GRADLE_ZIP}"
|
889
|
+
mv "gradle-\${GRADLE_VERSION}" "\${GRADLE_ZIP}"
|
890
|
+
cd - > /dev/null
|
891
|
+
fi
|
892
|
+
|
893
|
+
export GRADLE_HOME
|
894
|
+
exec "$GRADLE_HOME/bin/gradle" "$@"
|
895
|
+
`),V.chmodSync(Y.join(e,"gradlew"),493),V.writeFileSync(Y.join(e,"gradlew.bat"),`@echo off
|
896
|
+
rem Simple Gradle wrapper for Windows
|
897
|
+
set GRADLE_USER_HOME=%USERPROFILE%\\.gradle
|
898
|
+
set GRADLE_VERSION=8.5
|
899
|
+
set GRADLE_ZIP=gradle-%GRADLE_VERSION%-bin.zip
|
900
|
+
set GRADLE_URL=https://services.gradle.org/distributions/%GRADLE_ZIP%
|
901
|
+
set GRADLE_HOME=%GRADLE_USER_HOME%\\wrapper\\dists\\%GRADLE_ZIP%\\gradle-%GRADLE_VERSION%
|
902
|
+
|
903
|
+
if not exist "%GRADLE_HOME%" (
|
904
|
+
echo Downloading Gradle %GRADLE_VERSION%...
|
905
|
+
mkdir "%GRADLE_USER_HOME%\\wrapper\\dists\\%GRADLE_ZIP%"
|
906
|
+
powershell -Command "Invoke-WebRequest '%GRADLE_URL%' -OutFile '%GRADLE_USER_HOME%\\wrapper\\dists\\%GRADLE_ZIP%\\%GRADLE_ZIP%'"
|
907
|
+
cd /d "%GRADLE_USER_HOME%\\wrapper\\dists\\%GRADLE_ZIP%"
|
908
|
+
powershell -Command "Expand-Archive '%GRADLE_ZIP%' -DestinationPath '.'"
|
909
|
+
ren "gradle-%GRADLE_VERSION%" "%GRADLE_ZIP%"
|
910
|
+
cd /d "%~dp0"
|
911
|
+
)
|
912
|
+
|
913
|
+
"%GRADLE_HOME%\\bin\\gradle.bat" %*
|
914
|
+
`)}createDirectoryStructure(e){let t=Y.join(e,"src","main","java"),r=Y.join(e,"src","test","java"),s=Y.join(e,"src","main","resources");V.mkdirSync(t,{recursive:!0}),V.mkdirSync(r,{recursive:!0}),V.mkdirSync(s,{recursive:!0})}createMainFile(e,t){let r=this.sanitizeForJavaPackage(e.companyName),s=`com.${r}.sandbox`,i=this.getClientClassName(e.companyName),o=Y.join(t,"src","main","java"),a=Y.join(o,"com",r,"sandbox");V.mkdirSync(a,{recursive:!0});let c=`package ${s};
|
915
|
+
|
916
|
+
/**
|
917
|
+
* ${e.companyName} SDK Sandbox
|
918
|
+
*
|
919
|
+
* This is a test sandbox for the locally generated ${e.companyName} SDK.
|
920
|
+
* Modify this file to test different SDK functionality and reproduce issues.
|
921
|
+
*/
|
922
|
+
|
923
|
+
import io.github.cdimascio.dotenv.Dotenv;
|
924
|
+
// NOTE: You may need to adjust these imports based on the actual SDK structure
|
925
|
+
// import com.${e.companyName}.client.${i};
|
926
|
+
// import com.${e.companyName}.client.models.*;
|
927
|
+
|
928
|
+
public class SandboxApplication {
|
929
|
+
|
930
|
+
private static final Dotenv dotenv = Dotenv.configure().ignoreIfMissing().load();
|
931
|
+
|
932
|
+
public static void main(String[] args) {
|
933
|
+
System.out.println("Starting ${e.companyName} SDK sandbox...");
|
934
|
+
|
935
|
+
try {
|
936
|
+
// Load API key from environment
|
937
|
+
String apiKey = dotenv.get("API_KEY");
|
938
|
+
if (apiKey == null || apiKey.isEmpty()) {
|
939
|
+
System.err.println("Warning: API_KEY not found in environment. Please check your .env file.");
|
940
|
+
}
|
941
|
+
|
942
|
+
// Initialize the SDK client
|
943
|
+
// NOTE: You'll need to adjust this based on the actual SDK structure
|
944
|
+
// ${i} client = new ${i}.Builder()
|
945
|
+
// .token(apiKey)
|
946
|
+
// .build();
|
947
|
+
|
948
|
+
System.out.println("SDK imported successfully!");
|
949
|
+
System.out.println("Client would be initialized here with API key: " +
|
950
|
+
(apiKey != null ? "[REDACTED]" : "null"));
|
951
|
+
|
952
|
+
// Add your test code here
|
953
|
+
// Example:
|
954
|
+
// SomeResponse response = client.someMethod();
|
955
|
+
// System.out.println("Response: " + response);
|
956
|
+
|
957
|
+
System.out.println("Sandbox completed successfully!");
|
958
|
+
|
959
|
+
} catch (Exception e) {
|
960
|
+
System.err.println("Error in sandbox: " + e.getMessage());
|
961
|
+
e.printStackTrace();
|
962
|
+
System.exit(1);
|
963
|
+
}
|
964
|
+
}
|
965
|
+
}
|
966
|
+
`;V.writeFileSync(Y.join(a,"SandboxApplication.java"),c)}createGitIgnore(e){V.writeFileSync(Y.join(e,".gitignore"),`# Gradle build output
|
967
|
+
build/
|
968
|
+
!gradle/wrapper/gradle-wrapper.jar
|
969
|
+
!**/src/main/**/build/
|
970
|
+
!**/src/test/**/build/
|
971
|
+
|
972
|
+
# Gradle cache
|
973
|
+
.gradle/
|
974
|
+
|
975
|
+
# IDE files
|
976
|
+
.idea/
|
977
|
+
*.iws
|
978
|
+
*.iml
|
979
|
+
*.ipr
|
980
|
+
.vscode/
|
981
|
+
|
982
|
+
# Eclipse files
|
983
|
+
.classpath
|
984
|
+
.project
|
985
|
+
.settings/
|
986
|
+
bin/
|
987
|
+
|
988
|
+
# NetBeans files
|
989
|
+
/nbproject/private/
|
990
|
+
/nbbuild/
|
991
|
+
/dist/
|
992
|
+
/nbdist/
|
993
|
+
/.nb-gradle/
|
994
|
+
|
995
|
+
# Environment variables
|
996
|
+
.env
|
997
|
+
.env.local
|
998
|
+
|
999
|
+
# Frond SDK symlink
|
1000
|
+
.frond
|
1001
|
+
|
1002
|
+
# OS files
|
1003
|
+
.DS_Store
|
1004
|
+
Thumbs.db
|
1005
|
+
|
1006
|
+
# Logs
|
1007
|
+
*.log
|
1008
|
+
|
1009
|
+
# Dependency check
|
1010
|
+
dependency-check-report.html
|
1011
|
+
`)}createEnvFile(e){V.writeFileSync(Y.join(e,".env"),`API_KEY=your_api_key_here
|
1012
|
+
`)}createReadme(e,t,r){let s=this.getRelativeSdkPath(t,r),i=`# ${e.sandboxName}
|
1013
|
+
|
1014
|
+
**Company:** ${e.companyName}
|
1015
|
+
**Language:** java
|
1016
|
+
**SDK Path:** ${s}
|
1017
|
+
|
1018
|
+
${e.description?e.description:`This is a sandbox project for testing the locally generated SDK for ${e.companyName}.`}
|
1019
|
+
|
1020
|
+
## \u26A0\uFE0F Important Note
|
1021
|
+
|
1022
|
+
**The initial generated code is not guaranteed to run without modifications.** You may need to:
|
1023
|
+
- Update import statements to match the actual SDK structure
|
1024
|
+
- Correct client class names and initialization parameters
|
1025
|
+
- Adjust method calls and parameter names based on the SDK's API
|
1026
|
+
- Set up proper environment variables and authentication
|
1027
|
+
|
1028
|
+
## Prerequisites
|
1029
|
+
|
1030
|
+
- Java 11 or higher
|
1031
|
+
- No need to install Gradle (uses Gradle Wrapper)
|
1032
|
+
|
1033
|
+
## Getting Started
|
1034
|
+
|
1035
|
+
1. **Build and run the sandbox** (automatically builds SDK first):
|
1036
|
+
\`\`\`bash
|
1037
|
+
./gradlew run
|
1038
|
+
\`\`\`
|
1039
|
+
|
1040
|
+
On Windows:
|
1041
|
+
\`\`\`bash
|
1042
|
+
gradlew.bat run
|
1043
|
+
\`\`\`
|
1044
|
+
|
1045
|
+
2. **Just compile the sandbox**:
|
1046
|
+
\`\`\`bash
|
1047
|
+
./gradlew build
|
1048
|
+
\`\`\`
|
1049
|
+
|
1050
|
+
3. **Build the local SDK separately** (if needed):
|
1051
|
+
\`\`\`bash
|
1052
|
+
./gradlew buildSdk
|
1053
|
+
\`\`\`
|
1054
|
+
|
1055
|
+
**Note:** The buildSdk task automatically:
|
1056
|
+
- Detects if the SDK uses a Gradle wrapper (gradlew) or requires global Gradle installation
|
1057
|
+
- Runs \`spotlessApply\` first to fix any formatting issues
|
1058
|
+
- Then builds the SDK
|
1059
|
+
|
1060
|
+
## Other Commands
|
1061
|
+
|
1062
|
+
- \`./gradlew clean\` - Clean build artifacts
|
1063
|
+
- \`./gradlew test\` - Run tests
|
1064
|
+
- \`./gradlew jar\` - Create JAR file
|
1065
|
+
- \`./gradlew clean build run\` - Clean, build, and run in one command
|
1066
|
+
|
1067
|
+
## Environment Configuration
|
1068
|
+
|
1069
|
+
Create a \`.env\` file in the project root with your API credentials:
|
1070
|
+
\`\`\`
|
1071
|
+
API_KEY=your_actual_api_key_here
|
1072
|
+
\`\`\`
|
1073
|
+
|
1074
|
+
## IDE Setup
|
1075
|
+
|
1076
|
+
### IntelliJ IDEA
|
1077
|
+
1. Open the project directory
|
1078
|
+
2. IDEA should automatically detect the Gradle project
|
1079
|
+
3. Make sure Project SDK is set to Java 11+
|
1080
|
+
4. IDEA will automatically download dependencies
|
1081
|
+
|
1082
|
+
### Eclipse
|
1083
|
+
1. Import > Existing Gradle Project
|
1084
|
+
2. Select the project directory
|
1085
|
+
3. Eclipse will import the project and download dependencies
|
1086
|
+
|
1087
|
+
### VS Code
|
1088
|
+
1. Install the "Extension Pack for Java"
|
1089
|
+
2. Open the project directory
|
1090
|
+
3. VS Code will automatically configure the Gradle project
|
1091
|
+
|
1092
|
+
## Troubleshooting
|
1093
|
+
|
1094
|
+
- If you get compilation errors about missing SDK classes, run \`./gradlew buildSdk\` to build the local SDK
|
1095
|
+
- Check that the SDK path in \`build.gradle\` matches your actual SDK location
|
1096
|
+
- Verify Java version with \`java -version\` (should be 11+)
|
1097
|
+
- If Gradle wrapper fails to download, check your internet connection
|
1098
|
+
- If the SDK build fails, make sure you have Gradle installed globally (\`gradle --version\`) since some SDKs don't include a wrapper
|
1099
|
+
|
1100
|
+
## Publishing
|
1101
|
+
|
1102
|
+
To share this sandbox with other developers:
|
1103
|
+
\`\`\`bash
|
1104
|
+
frond publish-sandbox ${e.sandboxName} <your-name>
|
1105
|
+
\`\`\`
|
1106
|
+
`;V.writeFileSync(Y.join(t,"README.md"),i)}getClientClassName(e){return`${e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}Client`}getRelativeSdkPath(e,t){let r=process.env.HOME||process.env.USERPROFILE||"";return t.replace(Y.join(r,".frond"),".frond")}sanitizeForJavaPackage(e){return e.replace(/[^a-zA-Z0-9]/g,"_").toLowerCase()}};var pe=x(require("fs"),1),$e=x(require("path"),1),Or=class{async generate(e,t,r){this.createComposerJson(e,t,r),this.createMainFile(e,t,r),this.createEnvFile(t,e),this.createGitIgnore(t),this.createReadme(e,t,r),this.createPhpUnitConfig(t)}createComposerJson(e,t,r){let s=this.getRelativeSdkPath(t,r),i=this.getSdkPackageName(r,e.companyName),o={name:`${e.companyName.toLowerCase()}/${e.sandboxName}-sandbox`,description:`Sandbox project for testing ${e.companyName} SDK`,type:"project",require:{php:"^8.1","vlucas/phpdotenv":"^5.5","guzzlehttp/guzzle":"^7.8",[i]:"@dev"},"require-dev":{"phpunit/phpunit":"^10.5","phpstan/phpstan":"^1.10","squizlabs/php_codesniffer":"^3.8"},autoload:{"psr-4":{[`${this.getNamespace(e.companyName)}\\\\Sandbox\\\\`]:"src/"}},"autoload-dev":{"psr-4":{[`${this.getNamespace(e.companyName)}\\\\Sandbox\\\\Tests\\\\`]:"tests/"}},repositories:[{type:"path",url:s,options:{symlink:!0}}],scripts:{start:"php main.php",test:"phpunit","test:unit":"phpunit --testsuite=unit",phpstan:"phpstan analyse src tests --level=5","cs:check":"phpcs src tests","cs:fix":"phpcbf src tests",quality:["@phpstan","@cs:check","@test"]},config:{"sort-packages":!0,"allow-plugins":{"php-http/discovery":!0}},minimum_stability:"stable","prefer-stable":!0};pe.writeFileSync($e.join(t,"composer.json"),JSON.stringify(o,null,4))}createMainFile(e,t,r){let s=$e.join(t,"src");pe.mkdirSync(s,{recursive:!0});let i=this.getClientClassName(e.companyName),o=this.getSdkNamespace(r,e.companyName),a=`<?php
|
1107
|
+
|
1108
|
+
/**
|
1109
|
+
* ${e.companyName} SDK Sandbox
|
1110
|
+
*
|
1111
|
+
* This is a test sandbox for the locally generated ${e.companyName} SDK.
|
1112
|
+
* Modify this file to test different SDK functionality and reproduce issues.
|
1113
|
+
*/
|
1114
|
+
|
1115
|
+
declare(strict_types=1);
|
1116
|
+
|
1117
|
+
require_once __DIR__ . '/vendor/autoload.php';
|
1118
|
+
|
1119
|
+
use Dotenv\\Dotenv;
|
1120
|
+
use ${o}\\${i};
|
1121
|
+
|
1122
|
+
// Load environment variables
|
1123
|
+
$dotenv = Dotenv::createImmutable(__DIR__);
|
1124
|
+
$dotenv->load();
|
1125
|
+
|
1126
|
+
function main(): void
|
1127
|
+
{
|
1128
|
+
echo "Starting ${e.companyName} SDK sandbox...\\n";
|
1129
|
+
|
1130
|
+
try {
|
1131
|
+
// Initialize the SDK client
|
1132
|
+
// NOTE: You'll need to update the API key in the .env file
|
1133
|
+
$apiKey = $_ENV['${e.companyName.toUpperCase()}_API_KEY'] ?? null;
|
1134
|
+
|
1135
|
+
if (!$apiKey) {
|
1136
|
+
throw new \\InvalidArgumentException('API key not found in environment variables');
|
1137
|
+
}
|
1138
|
+
|
1139
|
+
echo "SDK imported successfully!\\n";
|
1140
|
+
|
1141
|
+
$client = new ${i}($apiKey);
|
1142
|
+
|
1143
|
+
echo "Client initialized. Testing connection...\\n";
|
1144
|
+
|
1145
|
+
// Add your test code here
|
1146
|
+
// Example:
|
1147
|
+
// $response = $client->someMethod();
|
1148
|
+
// echo "Response: " . json_encode($response) . "\\n";
|
1149
|
+
|
1150
|
+
echo "Sandbox completed successfully!\\n";
|
1151
|
+
|
1152
|
+
} catch (\\Exception $e) {
|
1153
|
+
echo "Error in sandbox: " . $e->getMessage() . "\\n";
|
1154
|
+
exit(1);
|
1155
|
+
}
|
1156
|
+
}
|
1157
|
+
|
1158
|
+
// Run the main function
|
1159
|
+
main();
|
1160
|
+
`;pe.writeFileSync($e.join(t,"main.php"),a),pe.chmodSync($e.join(t,"main.php"),493)}createEnvFile(e,t){let r=`# API Configuration
|
1161
|
+
${t.companyName.toUpperCase()}_API_KEY="your-api-key-here"
|
1162
|
+
|
1163
|
+
# Optional: Custom base URL
|
1164
|
+
# ${t.companyName.toUpperCase()}_BASE_URL="https://api.example.com"
|
1165
|
+
|
1166
|
+
# Debug mode (true/false)
|
1167
|
+
DEBUG=false
|
1168
|
+
`;pe.writeFileSync($e.join(e,".env"),r)}createGitIgnore(e){pe.writeFileSync($e.join(e,".gitignore"),`# Dependencies
|
1169
|
+
/vendor/
|
1170
|
+
composer.lock
|
1171
|
+
|
1172
|
+
# Environment variables
|
1173
|
+
.env
|
1174
|
+
.env.local
|
1175
|
+
.env.*.local
|
1176
|
+
|
1177
|
+
# Frond SDK symlink
|
1178
|
+
.frond
|
1179
|
+
|
1180
|
+
# IDE files
|
1181
|
+
.vscode/
|
1182
|
+
.idea/
|
1183
|
+
*.swp
|
1184
|
+
*.swo
|
1185
|
+
|
1186
|
+
# OS files
|
1187
|
+
.DS_Store
|
1188
|
+
Thumbs.db
|
1189
|
+
|
1190
|
+
# Logs
|
1191
|
+
*.log
|
1192
|
+
|
1193
|
+
# PHP specific
|
1194
|
+
*.cache
|
1195
|
+
.phpunit.result.cache
|
1196
|
+
|
1197
|
+
# Build artifacts
|
1198
|
+
/build/
|
1199
|
+
/dist/
|
1200
|
+
|
1201
|
+
# Coverage reports
|
1202
|
+
/coverage/
|
1203
|
+
coverage.xml
|
1204
|
+
coverage.clover
|
1205
|
+
`)}createPhpUnitConfig(e){pe.writeFileSync($e.join(e,"phpunit.xml"),`<?xml version="1.0" encoding="UTF-8"?>
|
1206
|
+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
1207
|
+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
|
1208
|
+
bootstrap="vendor/autoload.php"
|
1209
|
+
colors="true"
|
1210
|
+
cacheDirectory=".phpunit.cache"
|
1211
|
+
failOnWarning="true"
|
1212
|
+
failOnRisky="true"
|
1213
|
+
failOnEmptyTestSuite="true"
|
1214
|
+
beStrictAboutOutputDuringTests="true"
|
1215
|
+
beStrictAboutTodoAnnotatedTests="true"
|
1216
|
+
beStrictAboutChangesToGlobalState="true">
|
1217
|
+
|
1218
|
+
<testsuites>
|
1219
|
+
<testsuite name="unit">
|
1220
|
+
<directory>tests/Unit</directory>
|
1221
|
+
</testsuite>
|
1222
|
+
<testsuite name="integration">
|
1223
|
+
<directory>tests/Integration</directory>
|
1224
|
+
</testsuite>
|
1225
|
+
</testsuites>
|
1226
|
+
|
1227
|
+
<source>
|
1228
|
+
<include>
|
1229
|
+
<directory>src</directory>
|
1230
|
+
</include>
|
1231
|
+
</source>
|
1232
|
+
|
1233
|
+
<coverage>
|
1234
|
+
<report>
|
1235
|
+
<html outputDirectory="coverage"/>
|
1236
|
+
<text outputFile="php://stdout"/>
|
1237
|
+
</report>
|
1238
|
+
</coverage>
|
1239
|
+
</phpunit>
|
1240
|
+
`)}createReadme(e,t,r){let s=this.getRelativeSdkPath(t,r),i=`# ${e.sandboxName}
|
1241
|
+
|
1242
|
+
**Company:** ${e.companyName}
|
1243
|
+
**Language:** php
|
1244
|
+
**SDK Path:** ${s}
|
1245
|
+
|
1246
|
+
${e.description?e.description:`This is a sandbox project for testing the locally generated SDK for ${e.companyName}.`}
|
1247
|
+
|
1248
|
+
## \u26A0\uFE0F Important Note
|
1249
|
+
|
1250
|
+
**The initial generated code is not guaranteed to run without modifications.** You may need to:
|
1251
|
+
- Update import statements to match the actual SDK structure
|
1252
|
+
- Correct client class names and initialization parameters
|
1253
|
+
- Adjust method calls and parameter names based on the SDK's API
|
1254
|
+
- Set up proper environment variables and authentication
|
1255
|
+
|
1256
|
+
## Requirements
|
1257
|
+
|
1258
|
+
- PHP 8.1 or higher
|
1259
|
+
- Composer
|
1260
|
+
|
1261
|
+
## Getting Started
|
1262
|
+
|
1263
|
+
1. **Install dependencies**:
|
1264
|
+
\`\`\`bash
|
1265
|
+
composer install
|
1266
|
+
\`\`\`
|
1267
|
+
|
1268
|
+
2. **Configure environment**:
|
1269
|
+
- Copy \`.env\` to \`.env.local\` and update with your API credentials
|
1270
|
+
- Or set the \`${e.companyName.toUpperCase()}_API_KEY\` environment variable
|
1271
|
+
|
1272
|
+
3. **Run your script**:
|
1273
|
+
\`\`\`bash
|
1274
|
+
composer start
|
1275
|
+
# or
|
1276
|
+
php main.php
|
1277
|
+
\`\`\`
|
1278
|
+
|
1279
|
+
## Development Commands
|
1280
|
+
|
1281
|
+
- \`composer test\` - Run all tests
|
1282
|
+
- \`composer test:unit\` - Run unit tests only
|
1283
|
+
- \`composer phpstan\` - Run static analysis
|
1284
|
+
- \`composer cs:check\` - Check code style
|
1285
|
+
- \`composer cs:fix\` - Fix code style issues
|
1286
|
+
- \`composer quality\` - Run all quality checks
|
1287
|
+
|
1288
|
+
## Project Structure
|
1289
|
+
|
1290
|
+
- \`main.php\` - Main sandbox script
|
1291
|
+
- \`src/\` - Source code directory
|
1292
|
+
- \`tests/\` - Test files
|
1293
|
+
- \`vendor/\` - Composer dependencies (auto-generated)
|
1294
|
+
|
1295
|
+
## Testing
|
1296
|
+
|
1297
|
+
This sandbox includes PHPUnit for testing. Create test files in the \`tests/\` directory:
|
1298
|
+
|
1299
|
+
\`\`\`bash
|
1300
|
+
mkdir -p tests/Unit tests/Integration
|
1301
|
+
composer test
|
1302
|
+
\`\`\`
|
1303
|
+
|
1304
|
+
## Publishing
|
1305
|
+
|
1306
|
+
To share this sandbox with other developers:
|
1307
|
+
\`\`\`bash
|
1308
|
+
frond publish-sandbox ${e.sandboxName} <your-name>
|
1309
|
+
\`\`\`
|
1310
|
+
|
1311
|
+
## Troubleshooting
|
1312
|
+
|
1313
|
+
1. **SDK not found**: Make sure the SDK path is correct and the SDK has been generated
|
1314
|
+
2. **Composer errors**: Try \`composer clear-cache\` and \`composer install\` again
|
1315
|
+
3. **PHP version**: Ensure you're running PHP 8.1 or higher (\`php --version\`)
|
1316
|
+
`;pe.writeFileSync($e.join(t,"README.md"),i)}getNamespace(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}getClientClassName(e){return"SeedClient"}getSdkNamespace(e,t){return"Seed"}getRelativeSdkPath(e,t){let r=process.env.HOME||process.env.USERPROFILE||"";return t.replace($e.join(r,".frond"),".frond")}getSdkPackageName(e,t){let r=$e.join(e,"composer.json");if(pe.existsSync(r))try{let s=JSON.parse(pe.readFileSync(r,"utf-8"));if(s.name&&typeof s.name=="string")return s.name}catch{}return`${t}/php-sdk`}};var X=x(require("fs"),1),ke=x(require("path"),1),Ir=class{async generate(e,t,r){this.createMainFile(e,t,r),this.createPyProjectToml(e,t,r),this.createReadme(e,t,r),this.createEnvFile(t),this.createGitIgnore(t)}createPyProjectToml(e,t,r){let s=this.getRelativeSdkPath(t,r),i=this.getSdkPackageName(r,e.companyName),o=`[build-system]
|
1317
|
+
requires = ["poetry-core"]
|
1318
|
+
build-backend = "poetry.core.masonry.api"
|
1319
|
+
|
1320
|
+
[tool.poetry]
|
1321
|
+
name = "${e.companyName}-sandbox-${e.sandboxName}"
|
1322
|
+
version = "1.0.0"
|
1323
|
+
description = "Sandbox project for testing ${e.companyName} SDK"
|
1324
|
+
authors = ["Developer <developer@example.com>"]
|
1325
|
+
readme = "README.md"
|
1326
|
+
packages = [{include = "*.py"}]
|
1327
|
+
|
1328
|
+
[tool.poetry.dependencies]
|
1329
|
+
python = ">=3.10,<3.14"
|
1330
|
+
${i} = { path = "${s}", develop = true }
|
1331
|
+
requests = "^2.31.0"
|
1332
|
+
python-dotenv = "^1.0.0"
|
1333
|
+
|
1334
|
+
[tool.poetry.scripts]
|
1335
|
+
start = "main:main"
|
1336
|
+
|
1337
|
+
[tool.poetry.group.dev.dependencies]
|
1338
|
+
pytest = "^7.0.0"
|
1339
|
+
black = "^23.0.0"
|
1340
|
+
flake8 = "^6.0.0"
|
1341
|
+
mypy = "^1.0.0"
|
1342
|
+
|
1343
|
+
[tool.black]
|
1344
|
+
line-length = 88
|
1345
|
+
target-version = ['py38']
|
1346
|
+
|
1347
|
+
[tool.mypy]
|
1348
|
+
python_version = "3.8"
|
1349
|
+
warn_return_any = true
|
1350
|
+
warn_unused_configs = true
|
1351
|
+
`;X.writeFileSync(ke.join(t,"pyproject.toml"),o)}createMainFile(e,t,r){let s=this.getSdkPackageName(r,e.companyName),i=this.getModuleName(r,e.companyName),o=this.getClientClassName(e.companyName),a=`#!/usr/bin/env python3
|
1352
|
+
"""
|
1353
|
+
${e.companyName} SDK Sandbox
|
1354
|
+
|
1355
|
+
This is a test sandbox for the locally generated ${e.companyName} SDK.
|
1356
|
+
Modify this file to test different SDK functionality and reproduce issues.
|
1357
|
+
"""
|
1358
|
+
|
1359
|
+
import os
|
1360
|
+
import sys
|
1361
|
+
from typing import Any
|
1362
|
+
|
1363
|
+
# Load environment variables
|
1364
|
+
from ${i} import ${o}
|
1365
|
+
from dotenv import load_dotenv
|
1366
|
+
load_dotenv()
|
1367
|
+
|
1368
|
+
def main() -> None:
|
1369
|
+
"""Main function to test the ${e.companyName} SDK."""
|
1370
|
+
print(f"Starting ${e.companyName} SDK sandbox...")
|
1371
|
+
|
1372
|
+
try:
|
1373
|
+
# Import the generated SDK
|
1374
|
+
# NOTE: You may need to adjust this import based on the actual SDK structure
|
1375
|
+
# import ${i} as sdk
|
1376
|
+
|
1377
|
+
print("SDK imported successfully!")
|
1378
|
+
|
1379
|
+
# Initialize the SDK client
|
1380
|
+
# NOTE: You'll need to provide actual configuration/credentials
|
1381
|
+
client = ${o}(
|
1382
|
+
token=os.getenv("API_KEY"),
|
1383
|
+
# Add other required configuration
|
1384
|
+
)
|
1385
|
+
|
1386
|
+
print("Initialized client")
|
1387
|
+
|
1388
|
+
# Add your test code here
|
1389
|
+
# Example:
|
1390
|
+
# response = client.some_method()
|
1391
|
+
# print(f"Response: {response}")
|
1392
|
+
|
1393
|
+
print("Sandbox completed successfully!")
|
1394
|
+
|
1395
|
+
except ImportError as e:
|
1396
|
+
print(f"Failed to import SDK: {e}")
|
1397
|
+
print("Make sure the SDK is properly installed with: pip install -r requirements.txt")
|
1398
|
+
sys.exit(1)
|
1399
|
+
except Exception as e:
|
1400
|
+
print(f"Error in sandbox: {e}")
|
1401
|
+
sys.exit(1)
|
1402
|
+
|
1403
|
+
if __name__ == "__main__":
|
1404
|
+
main()
|
1405
|
+
`;X.writeFileSync(ke.join(t,"main.py"),a),X.chmodSync(ke.join(t,"main.py"),493)}createGitIgnore(e){X.writeFileSync(ke.join(e,".gitignore"),`# Byte-compiled / optimized / DLL files
|
1406
|
+
__pycache__/
|
1407
|
+
*.py[cod]
|
1408
|
+
*$py.class
|
1409
|
+
|
1410
|
+
# C extensions
|
1411
|
+
*.so
|
1412
|
+
|
1413
|
+
# Distribution / packaging
|
1414
|
+
.Python
|
1415
|
+
build/
|
1416
|
+
develop-eggs/
|
1417
|
+
dist/
|
1418
|
+
downloads/
|
1419
|
+
eggs/
|
1420
|
+
.eggs/
|
1421
|
+
lib/
|
1422
|
+
lib64/
|
1423
|
+
parts/
|
1424
|
+
sdist/
|
1425
|
+
var/
|
1426
|
+
wheels/
|
1427
|
+
pip-wheel-metadata/
|
1428
|
+
share/python-wheels/
|
1429
|
+
*.egg-info/
|
1430
|
+
.installed.cfg
|
1431
|
+
*.egg
|
1432
|
+
MANIFEST
|
1433
|
+
|
1434
|
+
# PyInstaller
|
1435
|
+
*.manifest
|
1436
|
+
*.spec
|
1437
|
+
|
1438
|
+
# Installer logs
|
1439
|
+
pip-log.txt
|
1440
|
+
pip-delete-this-directory.txt
|
1441
|
+
|
1442
|
+
# Unit test / coverage reports
|
1443
|
+
htmlcov/
|
1444
|
+
.tox/
|
1445
|
+
.nox/
|
1446
|
+
.coverage
|
1447
|
+
.coverage.*
|
1448
|
+
.cache
|
1449
|
+
nosetests.xml
|
1450
|
+
coverage.xml
|
1451
|
+
*.cover
|
1452
|
+
*.py,cover
|
1453
|
+
.hypothesis/
|
1454
|
+
.pytest_cache/
|
1455
|
+
|
1456
|
+
# Virtual environments
|
1457
|
+
.env
|
1458
|
+
.env.local
|
1459
|
+
.venv
|
1460
|
+
env/
|
1461
|
+
venv/
|
1462
|
+
ENV/
|
1463
|
+
env.bak/
|
1464
|
+
venv.bak/
|
1465
|
+
|
1466
|
+
# Frond SDK symlink
|
1467
|
+
.frond
|
1468
|
+
|
1469
|
+
# IDEs
|
1470
|
+
.vscode/
|
1471
|
+
.idea/
|
1472
|
+
*.swp
|
1473
|
+
*.swo
|
1474
|
+
|
1475
|
+
# OS
|
1476
|
+
.DS_Store
|
1477
|
+
Thumbs.db
|
1478
|
+
|
1479
|
+
# Jupyter Notebook
|
1480
|
+
.ipynb_checkpoints
|
1481
|
+
|
1482
|
+
# pyenv
|
1483
|
+
.python-version
|
1484
|
+
`)}createReadme(e,t,r){let s=this.getRelativeSdkPath(t,r),i=`# ${e.sandboxName}
|
1485
|
+
|
1486
|
+
**Company:** ${e.companyName}
|
1487
|
+
**Language:** python
|
1488
|
+
**SDK Path:** ${s}
|
1489
|
+
|
1490
|
+
${e.description?e.description:`This is a sandbox project for testing the locally generated SDK for ${e.companyName}.`}
|
1491
|
+
|
1492
|
+
## \u26A0\uFE0F Important Note
|
1493
|
+
|
1494
|
+
**The initial generated code is not guaranteed to run without modifications.** You may need to:
|
1495
|
+
- Update import statements to match the actual SDK structure
|
1496
|
+
- Correct client class names and initialization parameters
|
1497
|
+
- Adjust method calls and parameter names based on the SDK's API
|
1498
|
+
- Set up proper environment variables and authentication
|
1499
|
+
|
1500
|
+
## Getting Started
|
1501
|
+
|
1502
|
+
1. **Install Poetry** (if not already installed):
|
1503
|
+
\`\`\`bash
|
1504
|
+
pip install poetry
|
1505
|
+
\`\`\`
|
1506
|
+
|
1507
|
+
2. **Install dependencies**:
|
1508
|
+
\`\`\`bash
|
1509
|
+
poetry install
|
1510
|
+
\`\`\`
|
1511
|
+
|
1512
|
+
3. **Run your script**:
|
1513
|
+
\`\`\`bash
|
1514
|
+
poetry run python main.py
|
1515
|
+
\`\`\`
|
1516
|
+
|
1517
|
+
## Alternative: Using pip
|
1518
|
+
|
1519
|
+
If you prefer pip over Poetry:
|
1520
|
+
|
1521
|
+
1. **Install dependencies**:
|
1522
|
+
\`\`\`bash
|
1523
|
+
pip install -r requirements.txt
|
1524
|
+
\`\`\`
|
1525
|
+
|
1526
|
+
2. **Run your script**:
|
1527
|
+
\`\`\`bash
|
1528
|
+
python main.py
|
1529
|
+
\`\`\`
|
1530
|
+
|
1531
|
+
## Development Commands (Poetry)
|
1532
|
+
|
1533
|
+
- \`poetry run pytest\` - Run tests
|
1534
|
+
- \`poetry run black .\` - Format code
|
1535
|
+
- \`poetry run flake8\` - Lint code
|
1536
|
+
- \`poetry run mypy .\` - Type check
|
1537
|
+
|
1538
|
+
## Publishing
|
1539
|
+
|
1540
|
+
To share this sandbox with other developers:
|
1541
|
+
\`\`\`bash
|
1542
|
+
frond publish-sandbox ${e.sandboxName} <your-name>
|
1543
|
+
\`\`\`
|
1544
|
+
`;X.writeFileSync(ke.join(t,"README.md"),i)}createEnvFile(e){X.writeFileSync(ke.join(e,".env"),`API_KEY="<your_api_key>"
|
1545
|
+
`)}getClientClassName(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}getModuleName(e,t){let r=ke.join(e,"src");if(X.existsSync(r))try{let i=X.readdirSync(r).find(o=>{let a=ke.join(r,o);return X.statSync(a).isDirectory()&&X.existsSync(ke.join(a,"__init__.py"))});if(i)return i}catch{}return t}getRelativeSdkPath(e,t){let r=process.env.HOME||process.env.USERPROFILE||"";return t.replace(ke.join(r,".frond"),".frond")}getSdkPackageName(e,t){let r=ke.join(e,"pyproject.toml");if(X.existsSync(r))try{let s=X.readFileSync(r,"utf-8"),i=s.match(/^\[tool\.poetry\]\s*\n(?:.*\n)*?name\s*=\s*["']([^"']+)["']/m);if(i&&i[1])return i[1];let o=s.match(/^\[project\]\s*\n(?:.*\n)*?name\s*=\s*["']([^"']+)["']/m);if(o&&o[1])return o[1]}catch{}return`python-${t}`}};var W=x(require("fs"),1),ye=x(require("path"),1),qr=class{async generate(e,t,r){this.createGemfile(e,t,r),this.createRakefile(t),this.createMainFile(e,t,r),this.createGemfileLock(t),this.createReadme(e,t,r),this.createEnvFile(t),this.createGitIgnore(t),this.createRubyVersion(t)}createGemfile(e,t,r){let s=this.getRelativeSdkPath(t,r),o=`# frozen_string_literal: true
|
1546
|
+
|
1547
|
+
source "https://rubygems.org"
|
1548
|
+
|
1549
|
+
ruby ">= 3.0.0"
|
1550
|
+
|
1551
|
+
# Local SDK dependency
|
1552
|
+
gem "${this.getSdkGemName(r,e.companyName)}", path: "${s}"
|
1553
|
+
|
1554
|
+
# Common dependencies
|
1555
|
+
gem "dotenv", "~> 3.0"
|
1556
|
+
|
1557
|
+
# Development and test dependencies
|
1558
|
+
gem "minitest", "~> 5.0"
|
1559
|
+
gem "rake", "~> 13.0"
|
1560
|
+
gem "rubocop", "~> 1.21"
|
1561
|
+
`;W.writeFileSync(ye.join(t,"Gemfile"),o)}createRakefile(e){W.writeFileSync(ye.join(e,"Rakefile"),`# frozen_string_literal: true
|
1562
|
+
|
1563
|
+
require "rake/testtask"
|
1564
|
+
require "rubocop/rake_task"
|
1565
|
+
|
1566
|
+
task default: %i[test rubocop]
|
1567
|
+
|
1568
|
+
Rake::TestTask.new do |t|
|
1569
|
+
t.pattern = "./test/**/test_*.rb"
|
1570
|
+
end
|
1571
|
+
|
1572
|
+
RuboCop::RakeTask.new
|
1573
|
+
`)}createGemfileLock(e){W.writeFileSync(ye.join(e,"Gemfile.lock"),`GEM
|
1574
|
+
remote: https://rubygems.org/
|
1575
|
+
specs:
|
1576
|
+
|
1577
|
+
PLATFORMS
|
1578
|
+
ruby
|
1579
|
+
|
1580
|
+
DEPENDENCIES
|
1581
|
+
|
1582
|
+
BUNDLED WITH
|
1583
|
+
2.4.0
|
1584
|
+
`)}createMainFile(e,t,r){let s=this.getSdkGemName(r,e.companyName),i=this.getClientClassName(r,e.companyName),o=`#!/usr/bin/env ruby
|
1585
|
+
# frozen_string_literal: true
|
1586
|
+
|
1587
|
+
# ${e.companyName} SDK Sandbox
|
1588
|
+
#
|
1589
|
+
# This is a test sandbox for the locally generated ${e.companyName} SDK.
|
1590
|
+
# Modify this file to test different SDK functionality and reproduce issues.
|
1591
|
+
|
1592
|
+
require 'dotenv/load'
|
1593
|
+
require '${s}'
|
1594
|
+
|
1595
|
+
def main
|
1596
|
+
puts "Starting ${e.companyName} SDK sandbox..."
|
1597
|
+
|
1598
|
+
begin
|
1599
|
+
# Load environment variables
|
1600
|
+
api_key = ENV['API_KEY']
|
1601
|
+
|
1602
|
+
if api_key.nil? || api_key.empty?
|
1603
|
+
puts "Warning: API_KEY not found in environment variables"
|
1604
|
+
puts "Please set your API key in the .env file"
|
1605
|
+
end
|
1606
|
+
|
1607
|
+
puts "SDK required successfully!"
|
1608
|
+
|
1609
|
+
# Initialize the SDK client
|
1610
|
+
# NOTE: You'll need to provide actual configuration/credentials
|
1611
|
+
client = ${i}.new(
|
1612
|
+
token: api_key
|
1613
|
+
# Add other required configuration parameters as needed
|
1614
|
+
)
|
1615
|
+
|
1616
|
+
puts "Client initialized successfully!"
|
1617
|
+
|
1618
|
+
# Add your test code here
|
1619
|
+
# Example:
|
1620
|
+
# response = client.some_method
|
1621
|
+
# puts "Response: #{response}"
|
1622
|
+
|
1623
|
+
puts "Sandbox completed successfully!"
|
1624
|
+
|
1625
|
+
rescue LoadError => e
|
1626
|
+
puts "Failed to require SDK: #{e.message}"
|
1627
|
+
puts "Make sure the SDK is properly installed with: bundle install"
|
1628
|
+
exit 1
|
1629
|
+
rescue StandardError => e
|
1630
|
+
puts "Error in sandbox: #{e.message}"
|
1631
|
+
puts e.backtrace
|
1632
|
+
exit 1
|
1633
|
+
end
|
1634
|
+
end
|
1635
|
+
|
1636
|
+
# Run the main function if this file is executed directly
|
1637
|
+
main if __FILE__ == $PROGRAM_NAME
|
1638
|
+
`;W.writeFileSync(ye.join(t,"main.rb"),o),W.chmodSync(ye.join(t,"main.rb"),493)}createRubyVersion(e){W.writeFileSync(ye.join(e,".ruby-version"),`3.2.0
|
1639
|
+
`)}createGitIgnore(e){W.writeFileSync(ye.join(e,".gitignore"),`# Ruby
|
1640
|
+
*.gem
|
1641
|
+
*.rbc
|
1642
|
+
.bundle
|
1643
|
+
.config
|
1644
|
+
coverage
|
1645
|
+
lib/bundler/man
|
1646
|
+
pkg
|
1647
|
+
rdoc
|
1648
|
+
spec/reports
|
1649
|
+
test/tmp
|
1650
|
+
test/version_tmp
|
1651
|
+
tmp
|
1652
|
+
.yardoc
|
1653
|
+
.sass-cache
|
1654
|
+
Gemfile.lock
|
1655
|
+
|
1656
|
+
# RVM / rbenv
|
1657
|
+
.rvmrc
|
1658
|
+
.ruby-version
|
1659
|
+
.ruby-gemset
|
1660
|
+
|
1661
|
+
# IDE
|
1662
|
+
.vscode/
|
1663
|
+
.idea/
|
1664
|
+
*.swp
|
1665
|
+
*.swo
|
1666
|
+
|
1667
|
+
# OS
|
1668
|
+
.DS_Store
|
1669
|
+
Thumbs.db
|
1670
|
+
|
1671
|
+
# Logs
|
1672
|
+
*.log
|
1673
|
+
|
1674
|
+
# Environment variables
|
1675
|
+
.env
|
1676
|
+
.env.local
|
1677
|
+
.env.production
|
1678
|
+
.env.staging
|
1679
|
+
|
1680
|
+
# Frond SDK symlink
|
1681
|
+
.frond
|
1682
|
+
|
1683
|
+
# Pry history
|
1684
|
+
.pry_history
|
1685
|
+
|
1686
|
+
# RSpec
|
1687
|
+
.rspec_status
|
1688
|
+
|
1689
|
+
# Yard
|
1690
|
+
.yardoc/
|
1691
|
+
doc/
|
1692
|
+
`)}createReadme(e,t,r){let s=this.getRelativeSdkPath(t,r),i=`# ${e.sandboxName}
|
1693
|
+
|
1694
|
+
**Company:** ${e.companyName}
|
1695
|
+
**Language:** ruby
|
1696
|
+
**SDK Path:** ${s}
|
1697
|
+
|
1698
|
+
${e.description?e.description:`This is a sandbox project for testing the locally generated SDK for ${e.companyName}.`}
|
1699
|
+
|
1700
|
+
## \u26A0\uFE0F Important Note
|
1701
|
+
|
1702
|
+
**The initial generated code is not guaranteed to run without modifications.** You may need to:
|
1703
|
+
- Update import statements to match the actual SDK structure
|
1704
|
+
- Correct client class names and initialization parameters
|
1705
|
+
- Adjust method calls and parameter names based on the SDK's API
|
1706
|
+
- Set up proper environment variables and authentication
|
1707
|
+
|
1708
|
+
## Prerequisites
|
1709
|
+
|
1710
|
+
- Ruby >= 3.0.0
|
1711
|
+
- Bundler gem: \`gem install bundler\`
|
1712
|
+
|
1713
|
+
## Getting Started
|
1714
|
+
|
1715
|
+
1. **Install dependencies**:
|
1716
|
+
\`\`\`bash
|
1717
|
+
bundle install
|
1718
|
+
\`\`\`
|
1719
|
+
|
1720
|
+
2. **Set up environment variables**:
|
1721
|
+
\`\`\`bash
|
1722
|
+
cp .env .env.local
|
1723
|
+
# Edit .env.local with your actual API keys
|
1724
|
+
\`\`\`
|
1725
|
+
|
1726
|
+
3. **Run your script**:
|
1727
|
+
\`\`\`bash
|
1728
|
+
ruby main.rb
|
1729
|
+
\`\`\`
|
1730
|
+
|
1731
|
+
## Alternative: Using bundle exec
|
1732
|
+
|
1733
|
+
If you encounter gem conflicts, use bundle exec:
|
1734
|
+
|
1735
|
+
\`\`\`bash
|
1736
|
+
bundle exec ruby main.rb
|
1737
|
+
\`\`\`
|
1738
|
+
|
1739
|
+
## Development Commands
|
1740
|
+
|
1741
|
+
- \`bundle install\` - Install dependencies
|
1742
|
+
- \`bundle update\` - Update dependencies
|
1743
|
+
- \`rake test\` - Run tests (if you add any)
|
1744
|
+
- \`rake rubocop\` - Lint code
|
1745
|
+
- \`bundle exec rubocop -a\` - Auto-fix linting issues
|
1746
|
+
- \`rake\` - Run default tasks (test + rubocop)
|
1747
|
+
|
1748
|
+
## Ruby Version Management
|
1749
|
+
|
1750
|
+
This project uses Ruby >= 3.0.0. If you're using rbenv or RVM:
|
1751
|
+
|
1752
|
+
- rbenv: \`rbenv install $(cat .ruby-version)\`
|
1753
|
+
- RVM: \`rvm install $(cat .ruby-version)\`
|
1754
|
+
|
1755
|
+
## Publishing
|
1756
|
+
|
1757
|
+
To share this sandbox with other developers:
|
1758
|
+
\`\`\`bash
|
1759
|
+
frond publish-sandbox ${e.sandboxName} <your-name>
|
1760
|
+
\`\`\`
|
1761
|
+
`;W.writeFileSync(ye.join(t,"README.md"),i)}createEnvFile(e){W.writeFileSync(ye.join(e,".env"),`API_KEY=your_api_key_here
|
1762
|
+
`)}getClientClassName(e,t){try{let r=ye.join(e,"lib");if(W.existsSync(r)){let s=W.readdirSync(r).filter(i=>i.endsWith(".rb"));for(let i of s){let o=ye.join(r,i),a=W.readFileSync(o,"utf-8");if(a.includes("class Client")){let c=a.match(/module\s+(\w+)/);if(c&&c[1])return`${c[1]}::Client`}}}}catch{}return t.split(/[-_]/).map(r=>r.charAt(0).toUpperCase()+r.slice(1).toLowerCase()).join("")+"Client"}getRelativeSdkPath(e,t){let r=process.env.HOME||process.env.USERPROFILE||"";return t.replace(ye.join(r,".frond"),".frond")}getSdkGemName(e,t){try{let r=W.readdirSync(e).filter(s=>s.endsWith(".gemspec"));if(r.length>0){let s=r[0];if(s){let i=ye.join(e,s),o=W.readFileSync(i,"utf-8"),a=o.match(/spec\.name\s*=\s*["']([^"']+)["']/);if(a&&a[1])return a[1];let c=o.match(/s\.name\s*=\s*["']([^"']+)["']/);if(c&&c[1])return c[1];let l=o.match(/gem\.name\s*=\s*["']([^"']+)["']/);if(l&&l[1])return l[1]}}}catch{}return`${t.toLowerCase().replace(/[^a-z0-9]/g,"_")}_sdk`}};var re=x(require("fs"),1),ge=x(require("path"),1),Tr=class{async generate(e,t,r){this.createPackageJson(e,t,r),this.createTsConfig(t),this.createMainFile(e,t),this.createGitIgnore(t),this.createPnpmWorkspace(t),this.createBuildScript(e,t,r),this.createReadme(e,t,r)}createPackageJson(e,t,r){let s=ge.join(r,"package.json"),i=this.getRelativeSdkPath(t,r),o=`file:${i}`;if(re.existsSync(s))try{JSON.parse(re.readFileSync(s,"utf-8")).name&&(o=`file:${i}`)}catch{}let a={name:`${e.companyName}-sandbox-${e.sandboxName}`,version:"1.0.0",description:`Sandbox project for testing ${e.companyName} SDK`,main:"lib/index",packageManager:"pnpm@9.4.0",engines:{npm:"please-use-pnpm",pnpm:"^9.4.0",node:">=18.0.0"},scripts:{bootstrap:"pnpm build:localdeps && pnpm install && pnpm build",rebootstrap:"pnpm clean:all && pnpm bootstrap",build:"tsc --build",rebuild:"pnpm clean && pnpm build","build:localdeps":"bash scripts/build-local-client-sdk.sh",start:"node lib/index",dev:"npx ts-node src/index.ts",clean:"rm -rf lib tsconfig.tsbuildinfo","clean:all":"pnpm clean && rm -rf node_modules","install:clean":"rm -rf node_modules && npminstall"},dependencies:{dotenv:"^17.2.1",[`${e.companyName}-client`]:o},devDependencies:{"@types/dotenv":"^6.1.1","@types/node":"^20.0.0","ts-node":"^10.9.0",typescript:"^5.0.0"}};re.writeFileSync(ge.join(t,"package.json"),JSON.stringify(a,null,2))}createTsConfig(e){let t={compilerOptions:{target:"ES2020",module:"commonjs",lib:["ES2020"],outDir:"./lib",rootDir:"./src",strict:!0,esModuleInterop:!0,skipLibCheck:!0,forceConsistentCasingInFileNames:!0,moduleResolution:"node",resolveJsonModule:!0,declaration:!0,declarationMap:!0,sourceMap:!0,composite:!0},include:["src/**/*"],exclude:["node_modules","lib"]};re.writeFileSync(ge.join(e,"tsconfig.json"),JSON.stringify(t,null,2))}createMainFile(e,t){let r=ge.join(t,"src");re.mkdirSync(r,{recursive:!0});let s=`/**
|
1763
|
+
* ${e.companyName} SDK Sandbox
|
1764
|
+
*
|
1765
|
+
* This is a test sandbox for the locally generated ${e.companyName} SDK.
|
1766
|
+
* Modify this file to test different SDK functionality and reproduce issues.
|
1767
|
+
*/
|
1768
|
+
|
1769
|
+
// Import the generated SDK
|
1770
|
+
// NOTE: You may need to adjust this import based on the actual SDK structure
|
1771
|
+
import { ${this.getClientClassName(e.companyName)} } from '${e.companyName}-client';
|
1772
|
+
import dotenv from 'dotenv';
|
1773
|
+
|
1774
|
+
dotenv.config();
|
1775
|
+
const ${e.companyName.toUpperCase()}_API_KEY = process.env.${e.companyName.toUpperCase()}_API_KEY;
|
1776
|
+
|
1777
|
+
async function main(): Promise<void> {
|
1778
|
+
console.log('Starting ${e.companyName} SDK sandbox...')
|
1779
|
+
|
1780
|
+
try {
|
1781
|
+
// Initialize the SDK client
|
1782
|
+
// NOTE: You'll need to update the api key in the .env file
|
1783
|
+
|
1784
|
+
console.log('SDK imported successfully!')
|
1785
|
+
const client = new ${this.getClientClassName(e.companyName)}({
|
1786
|
+
token: ${e.companyName.toUpperCase()}_API_KEY
|
1787
|
+
})
|
1788
|
+
console.log("Client initialized. Testing connection...")
|
1789
|
+
|
1790
|
+
// Add your test code here
|
1791
|
+
// Example:
|
1792
|
+
// const response = await client.someMethod()
|
1793
|
+
// console.log('Response:', response)
|
1794
|
+
|
1795
|
+
} catch (error) {
|
1796
|
+
console.error('Error in sandbox:', error)
|
1797
|
+
process.exit(1)
|
1798
|
+
}
|
1799
|
+
}
|
1800
|
+
|
1801
|
+
// Run the main function
|
1802
|
+
main().catch((error) => {
|
1803
|
+
console.error('Unhandled error:', error)
|
1804
|
+
process.exit(1)
|
1805
|
+
})
|
1806
|
+
`;re.writeFileSync(ge.join(r,"index.ts"),s)}createGitIgnore(e){re.writeFileSync(ge.join(e,".gitignore"),`# Dependencies
|
1807
|
+
node_modules/
|
1808
|
+
|
1809
|
+
# Build output
|
1810
|
+
lib/
|
1811
|
+
*.tsbuildinfo
|
1812
|
+
|
1813
|
+
# Environment variables
|
1814
|
+
.env
|
1815
|
+
.env.local
|
1816
|
+
|
1817
|
+
# IDE
|
1818
|
+
.vscode/
|
1819
|
+
.idea/
|
1820
|
+
|
1821
|
+
# OS
|
1822
|
+
.DS_Store
|
1823
|
+
Thumbs.db
|
1824
|
+
|
1825
|
+
# Logs
|
1826
|
+
*.log
|
1827
|
+
npm-debug.log*
|
1828
|
+
yarn-debug.log*
|
1829
|
+
yarn-error.log*
|
1830
|
+
|
1831
|
+
# Frond SDK symlink
|
1832
|
+
.frond
|
1833
|
+
`)}createPnpmWorkspace(e){re.writeFileSync(ge.join(e,"pnpm-workspace.yaml"),`packages: []
|
1834
|
+
`)}createBuildScript(e,t,r){let s=ge.join(t,"scripts");re.mkdirSync(s,{recursive:!0});let i=process.env.HOME||process.env.USERPROFILE||"",a=`#!/bin/bash
|
1835
|
+
|
1836
|
+
# Use the local .frond symlink to find SDK
|
1837
|
+
SDK_PATH=".frond${r.replace(ge.join(i,".frond"),"")}"
|
1838
|
+
|
1839
|
+
if [ ! -L ".frond" ]; then
|
1840
|
+
echo "Error: .frond symlink not found. Run 'frond relink' to create it."
|
1841
|
+
exit 1
|
1842
|
+
fi
|
1843
|
+
|
1844
|
+
echo "Found SDK path: $SDK_PATH"
|
1845
|
+
|
1846
|
+
# Resolve the relative path to absolute path
|
1847
|
+
RESOLVED_SDK_PATH=$(cd "$SDK_PATH" && pwd)
|
1848
|
+
|
1849
|
+
if [ $? -ne 0 ] || [ ! -d "$RESOLVED_SDK_PATH" ]; then
|
1850
|
+
echo "Error: Directory $SDK_PATH does not exist or cannot be resolved"
|
1851
|
+
exit 1
|
1852
|
+
fi
|
1853
|
+
|
1854
|
+
# Change to the SDK directory
|
1855
|
+
echo "Changing to directory: $RESOLVED_SDK_PATH"
|
1856
|
+
cd "$RESOLVED_SDK_PATH"
|
1857
|
+
|
1858
|
+
# Run the build commands
|
1859
|
+
echo "Running npm install..."
|
1860
|
+
npm install
|
1861
|
+
|
1862
|
+
if [ $? -ne 0 ]; then
|
1863
|
+
echo "Error: npm install failed"
|
1864
|
+
exit 1
|
1865
|
+
fi
|
1866
|
+
|
1867
|
+
echo "Running npm run build..."
|
1868
|
+
npm run build
|
1869
|
+
|
1870
|
+
if [ $? -ne 0 ]; then
|
1871
|
+
echo "Error: npm run build failed"
|
1872
|
+
exit 1
|
1873
|
+
fi
|
1874
|
+
|
1875
|
+
echo "Running npm run prepack..."
|
1876
|
+
npm run prepack
|
1877
|
+
|
1878
|
+
if [ $? -ne 0 ]; then
|
1879
|
+
echo "Error: npm run prepack failed"
|
1880
|
+
exit 1
|
1881
|
+
fi
|
1882
|
+
|
1883
|
+
echo "Build completed successfully!"
|
1884
|
+
`;re.writeFileSync(ge.join(s,"build-local-client-sdk.sh"),a),re.chmodSync(ge.join(s,"build-local-client-sdk.sh"),493)}createReadme(e,t,r){let s=this.getRelativeSdkPath(t,r),i=`# ${e.sandboxName}
|
1885
|
+
|
1886
|
+
**Company:** ${e.companyName}
|
1887
|
+
**Language:** typescript
|
1888
|
+
**SDK Path:** ${s}
|
1889
|
+
|
1890
|
+
${e.description?e.description:`This is a sandbox project for testing the locally generated SDK for ${e.companyName}.`}
|
1891
|
+
|
1892
|
+
## \u26A0\uFE0F Important Note
|
1893
|
+
|
1894
|
+
**The initial generated code is not guaranteed to run without modifications.** You may need to:
|
1895
|
+
- Update import statements to match the actual SDK structure
|
1896
|
+
- Correct client class names and initialization parameters
|
1897
|
+
- Adjust method calls and parameter names based on the SDK's API
|
1898
|
+
- Set up proper environment variables and authentication
|
1899
|
+
|
1900
|
+
## Getting Started
|
1901
|
+
|
1902
|
+
1. **Bootstrap the project** (builds dependencies and installs packages):
|
1903
|
+
\`\`\`bash
|
1904
|
+
pnpm bootstrap
|
1905
|
+
\`\`\`
|
1906
|
+
|
1907
|
+
2. **Run your script**:
|
1908
|
+
\`\`\`bash
|
1909
|
+
pnpm start
|
1910
|
+
\`\`\`
|
1911
|
+
|
1912
|
+
3. **Rebuild after making changes**:
|
1913
|
+
\`\`\`bash
|
1914
|
+
pnpm rebuild
|
1915
|
+
\`\`\`
|
1916
|
+
|
1917
|
+
## Other Commands
|
1918
|
+
|
1919
|
+
- \`pnpm dev\` - Run with ts-node for development
|
1920
|
+
- \`pnpm clean\` - Clean build artifacts
|
1921
|
+
- \`pnpm clean:all\` - Clean everything including node_modules
|
1922
|
+
- \`pnpm rebootstrap\` - Full clean and bootstrap
|
1923
|
+
|
1924
|
+
## Publishing
|
1925
|
+
|
1926
|
+
To share this sandbox with other developers:
|
1927
|
+
\`\`\`bash
|
1928
|
+
frond publish-sandbox ${e.sandboxName} <your-name>
|
1929
|
+
\`\`\`
|
1930
|
+
`;re.writeFileSync(ge.join(t,"README.md"),i)}getClientClassName(e){return`${e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}Client`}getRelativeSdkPath(e,t){let r=process.env.HOME||process.env.USERPROFILE||"";return t.replace(ge.join(r,".frond"),".frond")}};var I;(function(n){n.Typescript="typescript",n.Python="python",n.Java="java",n.Go="go",n.Csharp="csharp",n.Php="php",n.Ruby="ruby"})(I||(I={}));var hn=class{configProvider;rootDir;constructor(){this.configProvider=new Pe,this.rootDir=this.findProjectRoot()}findProjectRoot(){let e=process.cwd();for(;e!==H.dirname(e);){let t=H.join(e,"package.json"),r=H.join(e,"pnpm-workspace.yaml");if(j.existsSync(t))try{if(JSON.parse(j.readFileSync(t,"utf-8")).name==="frond")return e}catch{}if(j.existsSync(r))return e;e=H.dirname(e)}return process.cwd()}async createSandbox(e){try{this.ensureSandboxDirectories();let t=H.join(this.rootDir,"sandboxes","local",e.sandboxName);if(j.existsSync(t))return{success:!1,message:`Sandbox '${e.sandboxName}' already exists at ${t}`};if(!this.configProvider.getCompanyConfig(e.companyName))return{success:!1,message:`Company '${e.companyName}' not found in configuration`};let s=e.sdkPath||this.detectSdkPath(e.companyName,e.language);return!s||!j.existsSync(s)?{success:!1,message:`SDK not found at ${s}. Please generate SDK first with 'frond generate ${e.companyName}' or provide a custom SDK path`}:(await this.generateSandboxProject(e,t,s),{success:!0,message:`Sandbox '${e.sandboxName}' created successfully at ${t}`,sandboxPath:t})}catch(t){return{success:!1,message:`Failed to create sandbox: ${t}`}}}ensureSandboxDirectories(){let e=H.join(this.rootDir,"sandboxes"),t=H.join(e,"local"),r=H.join(e,"published");for(let s of[e,t,r])j.existsSync(s)||j.mkdirSync(s,{recursive:!0})}detectSdkPath(e,t){let r=H.join((0,Ti.homedir)(),".frond"),s=H.join(r,"sdks",e,`${t}-sdk`);if(j.existsSync(s))return s;let i=H.join(r,"config-repos",e),o={[I.Typescript]:["fern-typescript-sdk","fern-ts-sdk","typescript-sdk","ts-sdk"],[I.Python]:["fern-python-sdk","python-sdk"],[I.Java]:["fern-java-sdk","java-sdk"],[I.Go]:["fern-go-sdk","go-sdk"],[I.Csharp]:["fern-csharp-sdk","csharp-sdk","fern-dotnet-sdk","dotnet-sdk"],[I.Ruby]:["fern-ruby-sdk","ruby-sdk"],[I.Php]:["fern-php-sdk","php-sdk"]},a=H.join(i,"fern",".preview");if(j.existsSync(a)){let l=o[t];for(let u of l){let f=H.join(a,u);if(j.existsSync(f))return f}}if(j.existsSync(a))try{let l=j.readdirSync(a,{withFileTypes:!0}),u=[t,t.replace("typescript","ts")];for(let f of l)if(f.isDirectory()){let d=f.name.toLowerCase();if(u.some(h=>d.includes(h)))return H.join(a,f.name)}}catch{}let c={[I.Typescript]:["sdks/typescript","generated/sdks/typescript","output/typescript"],[I.Python]:["sdks/python","generated/sdks/python","output/python"],[I.Java]:["sdks/java","generated/sdks/java","output/java"],[I.Go]:["sdks/go","generated/sdks/go","output/go"],[I.Csharp]:["sdks/csharp","generated/sdks/csharp","output/csharp"],[I.Ruby]:["sdks/ruby","generated/sdks/ruby","output/ruby"],[I.Php]:["sdks/php","generated/sdks/php","output/php"]};for(let l of c[t]){let u=H.join(i,l);if(j.existsSync(u))return u}return null}async generateSandboxProject(e,t,r){switch(j.mkdirSync(t,{recursive:!0}),e.language){case I.Typescript:await new Tr().generate(e,t,r);break;case I.Python:await new Ir().generate(e,t,r);break;case I.Ruby:await new qr().generate(e,t,r);break;case I.Java:await new Lr().generate(e,t,r);break;case I.Go:await new Ar().generate(e,t,r);break;case I.Csharp:await new Pr().generate(e,t,r);break;case I.Php:await new Or().generate(e,t,r);break;default:throw new Error(`Language '${e.language}' not yet supported`)}this.createFrondSymlink(t)}createFrondSymlink(e){let t=process.env.HOME||process.env.USERPROFILE||(0,Ti.homedir)(),r=H.join(t,".frond"),s=H.join(e,".frond");if(j.existsSync(r))try{j.existsSync(s)&&j.unlinkSync(s),j.symlinkSync(r,s,"dir")}catch(i){process.stderr.write(`Warning: Could not create .frond symlink in ${e}: ${i}
|
1931
|
+
`)}}};var L=x(require("fs"),1),ie=x(require("path"),1),ct=class{rootDir;constructor(){this.rootDir=this.findProjectRoot()}findProjectRoot(){let e=process.cwd();for(;e!==ie.dirname(e);){let t=ie.join(e,"package.json"),r=ie.join(e,"pnpm-workspace.yaml");if(L.existsSync(t))try{if(JSON.parse(L.readFileSync(t,"utf-8")).name==="frond")return e}catch{}if(L.existsSync(r))return e;e=ie.dirname(e)}return process.cwd()}async publishSandbox(e,t){try{let r=ie.join(this.rootDir,"sandboxes","local",e),s=ie.join(this.rootDir,"sandboxes","published",t,e);if(!L.existsSync(r))return{success:!1,message:`Sandbox '${e}' not found in local sandboxes`};if(L.existsSync(s))return{success:!1,message:`Sandbox '${e}' already published by ${t}`};let i=ie.join(this.rootDir,"sandboxes","published",t);return L.existsSync(i)||L.mkdirSync(i,{recursive:!0}),this.copyDirectory(r,s),this.updatePublishedReadme(s,t),{success:!0,message:`Sandbox '${e}' published successfully to sandboxes/published/${t}/${e}`,sandboxPath:s}}catch(r){return{success:!1,message:`Failed to publish sandbox: ${r}`}}}async unpublishSandbox(e,t){try{let r=ie.join(this.rootDir,"sandboxes","published",t,e);if(!L.existsSync(r))return{success:!1,message:`Published sandbox '${e}' by ${t} not found`};L.rmSync(r,{recursive:!0,force:!0});let s=ie.join(this.rootDir,"sandboxes","published",t);return L.readdirSync(s).length===0&&L.rmSync(s,{recursive:!0,force:!0}),{success:!0,message:`Sandbox '${e}' unpublished successfully from ${t}'s published sandboxes`}}catch(r){return{success:!1,message:`Failed to unpublish sandbox: ${r}`}}}listPublishedSandboxes(){let e=ie.join(this.rootDir,"sandboxes","published"),t={};if(!L.existsSync(e))return t;let r=L.readdirSync(e,{withFileTypes:!0}).filter(s=>s.isDirectory()).map(s=>s.name);for(let s of r){let i=ie.join(e,s),o=L.readdirSync(i,{withFileTypes:!0}).filter(a=>a.isDirectory()).map(a=>a.name);t[s]=o}return t}copyDirectory(e,t){L.existsSync(t)||L.mkdirSync(t,{recursive:!0});let r=L.readdirSync(e,{withFileTypes:!0});for(let s of r){if(s.name===".frond")continue;let i=ie.join(e,s.name),o=ie.join(t,s.name);if(s.isDirectory())this.copyDirectory(i,o);else if(s.isSymbolicLink())try{let a=L.readlinkSync(i);L.symlinkSync(a,o)}catch(a){process.stderr.write(`Warning: Could not copy symlink ${s.name}: ${a}
|
1932
|
+
`)}else L.copyFileSync(i,o)}}updatePublishedReadme(e,t){let r=ie.join(e,"README.md");if(L.existsSync(r)){let s=L.readFileSync(r,"utf-8");s=`> **Published by:** ${t}
|
1933
|
+
> **Published on:** ${new Date().toISOString().split("T")[0]}
|
1934
|
+
|
1935
|
+
`+s,L.writeFileSync(r,s)}}};var oe=require("child_process"),_=require("fs"),ae=require("path"),Ou=x(Oi(),1);var Se=x(require("fs"),1),qe=x(require("path"),1);function xr(){let n=process.cwd(),e="";for(;n!==qe.dirname(n);){let s=qe.join(n,"package.json");if(Se.existsSync(s))try{let i=JSON.parse(Se.readFileSync(s,"utf-8"));if(i.workspaces||i.name==="frond"){e=n;break}}catch{}n=qe.dirname(n)}e||(e=process.cwd());let t=qe.join(e,".frond"),r=qe.join(process.env.HOME||process.env.USERPROFILE||"",".frond");if(Se.existsSync(t))try{if(Se.lstatSync(t).isSymbolicLink()){let i=Se.readlinkSync(t);if(qe.resolve(qe.dirname(t),i)===r)return}Se.rmSync(t,{recursive:!0,force:!0})}catch{}if(Se.existsSync(r))try{Se.symlinkSync(r,t,"dir")}catch{}}function Iu(n){let e={ts:I.Typescript,py:I.Python,cs:I.Csharp,"c#":I.Csharp,rb:I.Ruby},t=["typescript","python","java","go","csharp","php","ruby"],r=Object.keys(e),s=n.toLowerCase();if(s=e[s]??s,!t.includes(s))throw new Error(`Unsupported language '${n}'. Supported: ${t.join(", ")} or nicknames: ${r.join(", ")}`);return s}async function qu(n){return xr(),await new Pn().cloneCompanyRepo(n)}async function Tu(n,e){return xr(),await new Dr().generateSdk(n,e)}async function xu(n){return await new Pe().openGithubRepo(n)}async function _u(n){return xr(),await new hn().createSandbox(n)}async function Fu(n,e){return await new ct().publishSandbox(n,e)}async function ju(n,e){return await new ct().unpublishSandbox(n,e)}function Ru(){return new ct().listPublishedSandboxes()}async function Mu(n){try{return await new Ze().setLocalFernRepoPath(n),{success:!0,message:`Local fern repository path set to: ${n}`}}catch(e){return{success:!1,message:`Failed to set local fern path: ${e instanceof Error?e.message:String(e)}`}}}async function xi(){try{let e=await new Ze().getLocalFernRepoPath();return e?{success:!0,message:`Local fern repository path: ${e}`,path:e}:{success:!0,message:"No local fern repository path configured"}}catch(n){return{success:!1,message:`Failed to get local fern path: ${n instanceof Error?n.message:String(n)}`}}}async function Ku(){try{return await new Ze().clearLocalFernRepoPath(),{success:!0,message:"Local fern repository path cleared"}}catch(n){return{success:!1,message:`Failed to clear local fern path: ${n instanceof Error?n.message:String(n)}`}}}function Bu(n,e){try{let t=`${n}:${e}`;return(0,oe.execSync)(`docker image inspect ${t}`,{stdio:"pipe"}),!0}catch{return!1}}function Gu(n,e,t){try{let r=(0,ae.join)(process.env.HOME||"",".frond","config-repos",n,"fern",...t?["apis",t]:[],"generators.yml");if(!(0,_.existsSync)(r))return null;let s=(0,_.readFileSync)(r,"utf8"),o=Ou.parse(s).groups?.[e];return!o||!o.generators||o.generators.length===0?null:o.generators[0]??null}catch{return null}}async function Uu(n,e){try{let t=await xi();if(!t.success||!t.path)return{success:!1,message:"Local fern repository not configured. Use frond config set-local-fern <path> to set it."};let r=["ts-sdk","python-sdk","java-sdk","go-sdk","csharp-sdk","ruby-sdk","php-sdk"];if(!r.includes(n))return{success:!1,message:`Unsupported generator '${n}'. Supported: ${r.join(", ")}`};if(!/^\d+\.\d+\.\d+(-[a-zA-Z0-9-.]+)?(\+[a-zA-Z0-9-.]+)?$/.test(e))return{success:!1,message:`Invalid semantic version '${e}'. Use format like '1.0.0'`};let i=t.path;switch(n){case"ts-sdk":(0,oe.execSync)("pnpm --filter @fern-typescript/sdk-generator-cli dist:cli",{cwd:i,stdio:"inherit"}),(0,oe.execSync)(`docker build -f ./Dockerfile -t fernapi/fern-typescript-node-sdk:${e} ../../../..`,{cwd:i+"/generators/typescript/sdk/cli",stdio:"inherit"});break;case"python-sdk":(0,oe.execSync)("pnpm --filter @fern-api/python-sdk dist:cli",{cwd:i,stdio:"inherit"}),(0,oe.execSync)(`docker build -f ./generators/python/sdk/Dockerfile -t fernapi/fern-python-sdk:${e} .`,{cwd:i,stdio:"inherit"});break;case"java-sdk":(0,oe.execSync)("./gradlew :sdk:distTar",{cwd:i+"/generators/java",stdio:"inherit"}),(0,oe.execSync)(`docker build -f generators/java/sdk/Dockerfile -t fernapi/fern-java-sdk:${e} .`,{cwd:i,stdio:"inherit"});break;case"go-sdk":(0,oe.execSync)("pnpm --filter @fern-api/go-sdk dist:cli",{cwd:i,stdio:"inherit"}),(0,oe.execSync)(`docker build -f ./generators/go/sdk/Dockerfile -t fernapi/fern-go-sdk:${e} .`,{cwd:i,stdio:"inherit"});break;case"csharp-sdk":(0,oe.execSync)("pnpm --filter @fern-api/fern-csharp-sdk dist:cli",{cwd:i,stdio:"inherit"}),(0,oe.execSync)(`docker build -f ./generators/csharp/sdk/Dockerfile -t fernapi/fern-csharp-sdk:${e} .`,{cwd:i,stdio:"inherit"});break;case"ruby-sdk":(0,oe.execSync)("pnpm --filter @fern-api/ruby-sdk dist:cli",{cwd:i,stdio:"inherit"}),(0,oe.execSync)(`docker build -f ./generators/ruby/sdk/Dockerfile -t fernapi/fern-ruby-sdk:${e} .`,{cwd:i,stdio:"inherit"});break;case"php-sdk":(0,oe.execSync)("pnpm --filter @fern-api/php-sdk dist:cli",{cwd:i,stdio:"inherit"}),(0,oe.execSync)(`docker build -f ./generators/php/sdk/Dockerfile -t fernapi/fern-php-sdk:${e} .`,{cwd:i,stdio:"inherit"});break;default:return{success:!1,message:`Unknown generator '${n}'`}}return{success:!0,message:`Successfully built ${n} generator v${e}`}}catch(t){return{success:!1,message:`Failed to build generator: ${t instanceof Error?t.message:String(t)}`}}}function xg(){let n=process.cwd();for(;n!==(0,ae.join)(n,"..");){let e=(0,ae.join)(n,"package.json"),t=(0,ae.join)(n,"pnpm-workspace.yaml");if((0,_.existsSync)(e))try{if(JSON.parse((0,_.readFileSync)(e,"utf-8")).name==="frond")return n}catch{}if((0,_.existsSync)(t))return n;n=(0,ae.join)(n,"..")}return process.cwd()}async function Ju(){try{let o=function(a){let c=(0,_.readdirSync)(a);for(let l of c){let u=(0,ae.join)(a,l);if((0,_.lstatSync)(u).isDirectory()){let d=(0,ae.join)(u,"package.json"),h=(0,ae.join)(u,"composer.json"),y=(0,ae.join)(u,"go.mod"),p=(0,ae.join)(u,"Gemfile"),m=(0,ae.join)(u,"pyproject.toml"),S=(0,_.readdirSync)(u).filter(E=>E.endsWith(".csproj")),b=(0,ae.join)(u,"build.gradle");if((0,_.existsSync)(d)||(0,_.existsSync)(h)||(0,_.existsSync)(y)||(0,_.existsSync)(p)||(0,_.existsSync)(m)||S.length>0||(0,_.existsSync)(b)){let E=(0,ae.join)(u,".frond");if((0,_.existsSync)(E))try{(0,_.unlinkSync)(E)}catch{}try{(0,_.symlinkSync)(t,E,"dir"),i++}catch{}}else o(u)}}};var n=o;let e=process.env.HOME||process.env.USERPROFILE||"",t=(0,ae.join)(e,".frond");if(!(0,_.existsSync)(t))return{success:!1,message:"~/.frond directory not found"};let r=xg(),s=(0,ae.join)(r,"sandboxes");if(!(0,_.existsSync)(s))return{success:!0,message:`No sandboxes directory found, nothing to relink. sandboxes dir: ${s}`,relinkCount:0};let i=0;return o(s),{success:!0,message:`Relinked ${i} sandbox projects`,relinkCount:i}}catch(e){return{success:!1,message:`Failed to relink sandboxes: ${e instanceof Error?e.message:String(e)}`}}}var Yu=require("commander");function _g(){let n=new Yu.Command;n.name("frond").description("frond-scripts CLI").version("0.0.0"),n.command("clone").description("Clone a company's configuration repository").argument("<company-name>","Name of the company").action(async t=>{let r=await qu(t);r.success?(process.stdout.write(`${r.message}
|
1936
|
+
`),process.exit(0)):(process.stderr.write(`Error: ${r.message}
|
1937
|
+
`),process.exit(1))}),n.command("generate").description("Generate SDK using fern CLI for specified group").argument("<company-name>","Name of the company").requiredOption("-g, --group <group-name>","SDK group to generate").option("--generator-local","Use local fern CLI instead of standard").option("--fern-local","Use local fern cli with no version redirection").option("--api <api-name>","Specify API name for fern generate").action(async(t,r)=>{if(r.generatorLocal){let i=Gu(t,r.group,r.api);i||(process.stderr.write(`Error: Could not find generator info for group '${r.group}' in ${t}/fern/generators.yml
|
1938
|
+
`),process.exit(1)),Bu(i.name,i.version)||(process.stderr.write(`Error: Docker image '${i.name}:${i.version}' not found locally.
|
1939
|
+
`),process.stderr.write(`Run 'frond generator ${r.group} ${i.version}' to build it locally.
|
1940
|
+
`),process.exit(1)),process.stdout.write(`\u2713 Found local Docker image: ${i.name}:${i.version}
|
1941
|
+
`)}let s=await Tu(t,{group:r.group,useLocalFern:r.fernLocal,useLocalGenerator:r.generatorLocal,api:r.api});s.success?(process.stdout.write(`${s.message}
|
1942
|
+
`),process.exit(0)):(process.stderr.write(`Error: ${s.message}
|
1943
|
+
`),process.exit(1))}),n.command("github").description("Open company's GitHub repository in browser").argument("<company-name>","Name of the company").action(async t=>{let r=await xu(t);r.success?(process.stdout.write(`${r.message}
|
1944
|
+
`),process.exit(0)):(process.stderr.write(`Error: ${r.message}
|
1945
|
+
`),process.exit(1))}),n.command("sandbox").description("Create a sandbox project for testing SDK").argument("<company-name>","Name of the company").option("-l, --language <language>","Language for sandbox (typescript/ts, python/py, java, go, csharp/cs, php, ruby/rb)","typescript").option("-n, --name <name>","Name for the sandbox project").option("-d, --description <description>","Description of the sandbox").option("--sdk-path <path>","Custom path to SDK (auto-detected if not provided)").action(async(t,r)=>{let s=Iu(r.language),i=r.name||`${t}-test`,o=await _u({companyName:t,language:s,sandboxName:i,sdkPath:r.sdkPath,description:r.description});o.success?(process.stdout.write(`${o.message}
|
1946
|
+
`),process.exit(0)):(process.stderr.write(`Error: ${o.message}
|
1947
|
+
`),process.exit(1))}),n.command("publish-sandbox").description("Publish a sandbox to share with team").argument("<sandbox-name>","Name of the sandbox").argument("<developer-name>","Name of the developer").action(async(t,r)=>{let s=await Fu(t,r);s.success?(process.stdout.write(`${s.message}
|
1948
|
+
`),process.exit(0)):(process.stderr.write(`Error: ${s.message}
|
1949
|
+
`),process.exit(1))}),n.command("unpublish-sandbox").description("Remove a published sandbox").argument("<sandbox-name>","Name of the sandbox").argument("<developer-name>","Name of the developer").action(async(t,r)=>{let s=await ju(t,r);s.success?(process.stdout.write(`${s.message}
|
1950
|
+
`),process.exit(0)):(process.stderr.write(`Error: ${s.message}
|
1951
|
+
`),process.exit(1))}),n.command("list-sandboxes").description("List all published sandboxes").action(()=>{let t=Ru();if(process.stdout.write(`Published Sandboxes:
|
1952
|
+
`),Object.keys(t).length===0)process.stdout.write(` (none)
|
1953
|
+
`);else for(let[r,s]of Object.entries(t)){process.stdout.write(` ${r}:
|
1954
|
+
`);for(let i of s)process.stdout.write(` - ${i}
|
1955
|
+
`)}process.exit(0)}),n.command("generator").description("Generate a local docker image for a generator").argument("<generator>","Generator type (ts-sdk, python-sdk, java-sdk, go-sdk, csharp-sdk, ruby-sdk, php-sdk)").argument("<version>","Semantic version number (e.g., 1.0.0)").action(async(t,r)=>{process.stdout.write(`Building ${t} generator v${r}...
|
1956
|
+
`);let s=await Uu(t,r);s.success?(process.stdout.write(`${s.message}
|
1957
|
+
`),process.exit(0)):(process.stderr.write(`Error: ${s.message}
|
1958
|
+
`),process.exit(1))});let e=n.command("config").description("Manage frond configuration");return e.command("set-local-fern").description("Set path to local fern repository").argument("<path>","Path to local fern repository directory").action(async t=>{let r=await Mu(t);r.success?(process.stdout.write(`${r.message}
|
1959
|
+
`),process.exit(0)):(process.stderr.write(`Error: ${r.message}
|
1960
|
+
`),process.exit(1))}),e.command("get-local-fern").description("Get currently configured local fern repository path").action(async()=>{let t=await xi();process.stdout.write(`${t.message}
|
1961
|
+
`),process.exit(t.success?0:1)}),e.command("clear-local-fern").description("Clear local fern repository path configuration").action(async()=>{let t=await Ku();t.success?(process.stdout.write(`${t.message}
|
1962
|
+
`),process.exit(0)):(process.stderr.write(`Error: ${t.message}
|
1963
|
+
`),process.exit(1))}),n.command("relink").description("Update .frond symlinks in all sandbox projects").action(async()=>{let t=await Ju();t.success?(t.relinkCount!==void 0&&t.relinkCount>0&&process.stdout.write(`Relinked ${t.relinkCount} sandbox projects
|
1964
|
+
`),process.stdout.write(`${t.message}
|
1965
|
+
`),process.exit(0)):(process.stderr.write(`Error: ${t.message}
|
1966
|
+
`),process.exit(1))}),n}async function Vu(){await _g().parseAsync(process.argv)}process.on("unhandledRejection",(n,e)=>{process.stderr.write(["Unhandled Rejection at:",e,"reason:",n].join(" ")),process.exit(1)});process.on("uncaughtException",n=>{process.stderr.write(["Uncaught Exception:",n].join(" ")),process.exit(1)});Vu().catch(n=>{process.stderr.write(["CLI execution failed:",n].join(" ")),process.exit(1)});0&&(module.exports={main});
|