fjall 33.0.0 → 33.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/.bundled +2 -2
- package/bin/assets/generators/account/generator.js +97 -97
- package/bin/assets/generators/application/generator.js +86 -86
- package/bin/assets/generators/cdn/generator.js +27 -27
- package/bin/assets/generators/compute/generator.js +86 -86
- package/bin/assets/generators/compute/service/generator.js +125 -125
- package/bin/assets/generators/database/generator.js +27 -27
- package/bin/assets/generators/database/proxy/generator.js +127 -127
- package/bin/assets/generators/domain/generator.js +91 -91
- package/bin/assets/generators/network/generator.js +115 -115
- package/bin/assets/generators/organisation/generator.js +93 -93
- package/bin/assets/generators/shared/files/package.json +2 -2
- package/bin/assets/generators/storage/s3/generator.js +27 -27
- package/bin/assets/generators/tunnel/generator.js +83 -83
- package/bin/fjall.bundle.js +33 -33
- package/package.json +5 -3
- package/bin/.build-source-hash +0 -37
|
@@ -101,29 +101,29 @@ while`),s.push(" (",e.call(r,"test"),");"),(0,S.concat)(s)}case"DoExpression":{v
|
|
|
101
101
|
`,u,`
|
|
102
102
|
}`):t.objectCurlySpacing?n.push("{ ",u," }"):n.push("{",u,"}")}}else n.push(a?"{ ":"{",(0,S.fromString)(", ").join(e.map(r,"specifiers")),a?" }":"}");i.source&&n.push(" from ",e.call(r,"source"),tD(e,t,r))}var d=(0,S.concat)(n);return Ud(d)!==";"&&!(i.declaration&&(i.declaration.type==="FunctionDeclaration"||i.declaration.type==="ClassDeclaration"||i.declaration.type==="TSModuleDeclaration"||i.declaration.type==="TSInterfaceDeclaration"||i.declaration.type==="TSEnumDeclaration"))&&(d=(0,S.concat)([d,";"])),d}function Md(e,t){var r=Dn.getParentExportDeclaration(e);return r?(0,Qr.default)(r.type==="DeclareExportDeclaration"):t.unshift("declare "),(0,S.concat)(t)}function Fd(e,t){return e.call(function(r){var i=r.getValue();return i?i==="plus"?(0,S.fromString)("+"):i==="minus"?(0,S.fromString)("-"):t(r):(0,S.fromString)("")},"variance")}function bo(e,t){return e.length>1?(0,S.concat)([" ",e]):(0,S.concat)([`
|
|
103
103
|
`,ly(e).indent(t.tabWidth)])}function Ud(e){var t=e.lastPos();do{var r=e.charAt(t);if(/\S/.test(r))return r}while(e.prevPos(t))}function f2(e){return Ud(e)==="}"}function sy(e){return e.replace(/['"]/g,function(t){return t==='"'?"'":'"'})}function jc(e){var t=So.getFieldValue(e,"value"),r=So.getFieldValue(e,"extra");if(r&&typeof r.raw=="string"&&t==r.rawValue)return r.raw;if(e.type==="Literal"){var i=e.raw;if(typeof i=="string"&&t==i)return i}}function cy(e){return JSON.stringify(e).replace(/[\u2028\u2029]/g,function(t){return"\\u"+t.charCodeAt(0).toString(16)})}function Ld(e,t){switch(rD.assert(e),t.quote){case"auto":{var r=cy(e),i=sy(cy(sy(e)));return r.length>i.length?i:r}case"single":return sy(cy(sy(e)));default:return cy(e)}}function ly(e){var t=Ud(e);return!t||`
|
|
104
|
-
};`.indexOf(t)<0?(0,S.concat)([e,";"]):e}});var E2=P(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.run=Zt.prettyPrint=Zt.print=Zt.visit=Zt.types=Zt.parse=void 0;var y2=(de(),Q(le)),Zne=y2.__importDefault(No("fs")),Hne=y2.__importStar(_r());Zt.types=Hne;var v2=YB();Object.defineProperty(Zt,"parse",{enumerable:!0,get:function(){return v2.parse}});var b2=g2(),Jne=_r();Object.defineProperty(Zt,"visit",{enumerable:!0,get:function(){return Jne.visit}});function S2(e,t){return new b2.Printer(t).print(e)}Zt.print=S2;function Xne(e,t){return new b2.Printer(t).printGenerically(e)}Zt.prettyPrint=Xne;function Yne(e,t){return Qne(process.argv[2],e,t)}Zt.run=Yne;function Qne(e,t,r){Zne.default.readFile(e,"utf-8",function(i,n){if(i){console.error(i);return}tie(n,t,r)})}function eie(e){process.stdout.write(e)}function tie(e,t,r){var i=r&&r.writeback||eie;t((0,v2.parse)(e,r),function(n){i(S2(n,r).code)})}});var Ke=P((
|
|
105
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){r=r.call(e)},n:function(){var d=r.next();return a=d.done,d},e:function(d){o=!0,s=d},f:function(){try{!a&&r.return!=null&&r.return()}finally{if(o)throw s}}}}function Zie(e,t){if(e){if(typeof e=="string")return Q4(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Q4(e,t)}}function Q4(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}var Hie=Cy(),t6=qe(),e6=t6.erase,Jie=t6.cursor,Xie=e=>[...Hie(e)].length;r6.exports=function(e,t){if(!t)return e6.line+Jie.to(0);let r=0,i=e.split(/\r?\n/);var n=qie(i),a;try{for(n.s();!(a=n.n()).done;){let o=a.value;r+=1+Math.floor(Math.max(Xie(o)-1,0)/t)}}catch(o){n.e(o)}finally{n.f()}return e6.lines(r)}});var AD=P((
|
|
104
|
+
};`.indexOf(t)<0?(0,S.concat)([e,";"]):e}});var E2=P(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.run=Zt.prettyPrint=Zt.print=Zt.visit=Zt.types=Zt.parse=void 0;var y2=(de(),Q(le)),Zne=y2.__importDefault(No("fs")),Hne=y2.__importStar(_r());Zt.types=Hne;var v2=YB();Object.defineProperty(Zt,"parse",{enumerable:!0,get:function(){return v2.parse}});var b2=g2(),Jne=_r();Object.defineProperty(Zt,"visit",{enumerable:!0,get:function(){return Jne.visit}});function S2(e,t){return new b2.Printer(t).print(e)}Zt.print=S2;function Xne(e,t){return new b2.Printer(t).printGenerically(e)}Zt.prettyPrint=Xne;function Yne(e,t){return Qne(process.argv[2],e,t)}Zt.run=Yne;function Qne(e,t,r){Zne.default.readFile(e,"utf-8",function(i,n){if(i){console.error(i);return}tie(n,t,r)})}function eie(e){process.stdout.write(e)}function tie(e,t,r){var i=r&&r.writeback||eie;t((0,v2.parse)(e,r),function(n){i(S2(n,r).code)})}});var Ke=P((MCe,Z4)=>{"use strict";var{FORCE_COLOR:zie,NODE_DISABLE_COLORS:Bie,TERM:Gie}=process.env,Te={enabled:!Bie&&Gie!=="dumb"&&zie!=="0",reset:je(0,0),bold:je(1,22),dim:je(2,22),italic:je(3,23),underline:je(4,24),inverse:je(7,27),hidden:je(8,28),strikethrough:je(9,29),black:je(30,39),red:je(31,39),green:je(32,39),yellow:je(33,39),blue:je(34,39),magenta:je(35,39),cyan:je(36,39),white:je(37,39),gray:je(90,39),grey:je(90,39),bgBlack:je(40,49),bgRed:je(41,49),bgGreen:je(42,49),bgYellow:je(43,49),bgBlue:je(44,49),bgMagenta:je(45,49),bgCyan:je(46,49),bgWhite:je(47,49)};function q4(e,t){let r=0,i,n="",a="";for(;r<e.length;r++)i=e[r],n+=i.open,a+=i.close,t.includes(i.close)&&(t=t.replace(i.rgx,i.close+i.open));return n+t+a}function Vie(e,t){let r={has:e,keys:t};return r.reset=Te.reset.bind(r),r.bold=Te.bold.bind(r),r.dim=Te.dim.bind(r),r.italic=Te.italic.bind(r),r.underline=Te.underline.bind(r),r.inverse=Te.inverse.bind(r),r.hidden=Te.hidden.bind(r),r.strikethrough=Te.strikethrough.bind(r),r.black=Te.black.bind(r),r.red=Te.red.bind(r),r.green=Te.green.bind(r),r.yellow=Te.yellow.bind(r),r.blue=Te.blue.bind(r),r.magenta=Te.magenta.bind(r),r.cyan=Te.cyan.bind(r),r.white=Te.white.bind(r),r.gray=Te.gray.bind(r),r.grey=Te.grey.bind(r),r.bgBlack=Te.bgBlack.bind(r),r.bgRed=Te.bgRed.bind(r),r.bgGreen=Te.bgGreen.bind(r),r.bgYellow=Te.bgYellow.bind(r),r.bgBlue=Te.bgBlue.bind(r),r.bgMagenta=Te.bgMagenta.bind(r),r.bgCyan=Te.bgCyan.bind(r),r.bgWhite=Te.bgWhite.bind(r),r}function je(e,t){let r={open:`\x1B[${e}m`,close:`\x1B[${t}m`,rgx:new RegExp(`\\x1b\\[${t}m`,"g")};return function(i){return this!==void 0&&this.has!==void 0?(this.has.includes(e)||(this.has.push(e),this.keys.push(r)),i===void 0?this:Te.enabled?q4(this.keys,i+""):i+""):i===void 0?Vie([e],[r]):Te.enabled?q4([r],i+""):i+""}}Z4.exports=Te});var J4=P((FCe,H4)=>{"use strict";H4.exports=(e,t)=>{if(!(e.meta&&e.name!=="escape")){if(e.ctrl){if(e.name==="a")return"first";if(e.name==="c"||e.name==="d")return"abort";if(e.name==="e")return"last";if(e.name==="g")return"reset"}if(t){if(e.name==="j")return"down";if(e.name==="k")return"up"}return e.name==="return"||e.name==="enter"?"submit":e.name==="backspace"?"delete":e.name==="delete"?"deleteForward":e.name==="abort"?"abort":e.name==="escape"?"exit":e.name==="tab"?"next":e.name==="pagedown"?"nextPage":e.name==="pageup"?"prevPage":e.name==="home"?"home":e.name==="end"?"end":e.name==="up"?"up":e.name==="down"?"down":e.name==="right"?"right":e.name==="left"?"left":!1}}});var Cy=P((LCe,X4)=>{"use strict";X4.exports=e=>{let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),r=new RegExp(t,"g");return typeof e=="string"?e.replace(r,""):e}});var qe=P((UCe,Y4)=>{"use strict";var xD={to(e,t){return t?`\x1B[${t+1};${e+1}H`:`\x1B[${e+1}G`},move(e,t){let r="";return e<0?r+=`\x1B[${-e}D`:e>0&&(r+=`\x1B[${e}C`),t<0?r+=`\x1B[${-t}A`:t>0&&(r+=`\x1B[${t}B`),r},up:(e=1)=>`\x1B[${e}A`,down:(e=1)=>`\x1B[${e}B`,forward:(e=1)=>`\x1B[${e}C`,backward:(e=1)=>`\x1B[${e}D`,nextLine:(e=1)=>"\x1B[E".repeat(e),prevLine:(e=1)=>"\x1B[F".repeat(e),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},Wie={up:(e=1)=>"\x1B[S".repeat(e),down:(e=1)=>"\x1B[T".repeat(e)},Kie={screen:"\x1B[2J",up:(e=1)=>"\x1B[1J".repeat(e),down:(e=1)=>"\x1B[J".repeat(e),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(e){let t="";for(let r=0;r<e;r++)t+=this.line+(r<e-1?xD.up():"");return e&&(t+=xD.left),t}};Y4.exports={cursor:xD,scroll:Wie,erase:Kie,beep:"\x07"}});var n6=P((zCe,r6)=>{"use strict";function qie(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Zie(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(d){throw d},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
105
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){r=r.call(e)},n:function(){var d=r.next();return a=d.done,d},e:function(d){o=!0,s=d},f:function(){try{!a&&r.return!=null&&r.return()}finally{if(o)throw s}}}}function Zie(e,t){if(e){if(typeof e=="string")return Q4(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Q4(e,t)}}function Q4(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}var Hie=Cy(),t6=qe(),e6=t6.erase,Jie=t6.cursor,Xie=e=>[...Hie(e)].length;r6.exports=function(e,t){if(!t)return e6.line+Jie.to(0);let r=0,i=e.split(/\r?\n/);var n=qie(i),a;try{for(n.s();!(a=n.n()).done;){let o=a.value;r+=1+Math.floor(Math.max(Xie(o)-1,0)/t)}}catch(o){n.e(o)}finally{n.f()}return e6.lines(r)}});var AD=P((BCe,i6)=>{"use strict";var Vd={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},Yie={arrowUp:Vd.arrowUp,arrowDown:Vd.arrowDown,arrowLeft:Vd.arrowLeft,arrowRight:Vd.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Qie=process.platform==="win32"?Yie:Vd;i6.exports=Qie});var o6=P((GCe,a6)=>{"use strict";var Gc=Ke(),Co=AD(),_D=Object.freeze({password:{scale:1,render:e=>"*".repeat(e.length)},emoji:{scale:2,render:e=>"\u{1F603}".repeat(e.length)},invisible:{scale:0,render:e=>""},default:{scale:1,render:e=>`${e}`}}),eae=e=>_D[e]||_D.default,Wd=Object.freeze({aborted:Gc.red(Co.cross),done:Gc.green(Co.tick),exited:Gc.yellow(Co.cross),default:Gc.cyan("?")}),tae=(e,t,r)=>t?Wd.aborted:r?Wd.exited:e?Wd.done:Wd.default,rae=e=>Gc.gray(e?Co.ellipsis:Co.pointerSmall),nae=(e,t)=>Gc.gray(e?t?Co.pointerSmall:"+":Co.line);a6.exports={styles:_D,render:eae,symbols:Wd,symbol:tae,delimiter:rae,item:nae}});var c6=P((VCe,s6)=>{"use strict";var iae=Cy();s6.exports=function(e,t){let r=String(iae(e)||"").split(/\r?\n/);return t?r.map(i=>Math.ceil(i.length/t)).reduce((i,n)=>i+n):r.length}});var l6=P((WCe,u6)=>{"use strict";u6.exports=(e,t={})=>{let r=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",i=t.width;return(e||"").split(/\r?\n/g).map(n=>n.split(/\s+/g).reduce((a,o)=>(o.length+r.length>=i||a[a.length-1].length+o.length+1<i?a[a.length-1]+=` ${o}`:a.push(`${r}${o}`),a),[r]).join(`
|
|
106
106
|
`)).join(`
|
|
107
|
-
`)}});var p6=P((
|
|
107
|
+
`)}});var p6=P((KCe,d6)=>{"use strict";d6.exports=(e,t,r)=>{r=r||t;let i=Math.min(t-r,e-Math.floor(r/2));i<0&&(i=0);let n=Math.min(i+r,t);return{startIndex:i,endIndex:n}}});var tn=P((qCe,m6)=>{"use strict";m6.exports={action:J4(),clear:n6(),style:o6(),strip:Cy(),figures:AD(),lines:c6(),wrap:l6(),entriesToDisplay:p6()}});var vi=P((ZCe,g6)=>{"use strict";var f6=No("readline"),aae=tn(),oae=aae.action,sae=No("events"),h6=qe(),cae=h6.beep,uae=h6.cursor,lae=Ke(),TD=class extends sae{constructor(t={}){super(),this.firstRender=!0,this.in=t.stdin||process.stdin,this.out=t.stdout||process.stdout,this.onRender=(t.onRender||(()=>{})).bind(this);let r=f6.createInterface({input:this.in,escapeCodeTimeout:50});f6.emitKeypressEvents(this.in,r),this.in.isTTY&&this.in.setRawMode(!0);let i=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,n=(a,o)=>{let s=oae(o,i);s===!1?this._&&this._(a,o):typeof this[s]=="function"?this[s](o):this.bell()};this.close=()=>{this.out.write(uae.show),this.in.removeListener("keypress",n),this.in.isTTY&&this.in.setRawMode(!1),r.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",n)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(cae)}render(){this.onRender(lae),this.firstRender&&(this.firstRender=!1)}};g6.exports=TD});var E6=P((HCe,S6)=>{"use strict";function y6(e,t,r,i,n,a,o){try{var s=e[a](o),u=s.value}catch(d){r(d);return}s.done?t(u):Promise.resolve(u).then(i,n)}function v6(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var a=e.apply(t,r);function o(u){y6(a,i,n,o,s,"next",u)}function s(u){y6(a,i,n,o,s,"throw",u)}o(void 0)})}}var Iy=Ke(),dae=vi(),b6=qe(),pae=b6.erase,Kd=b6.cursor,Dy=tn(),CD=Dy.style,ID=Dy.clear,mae=Dy.lines,fae=Dy.figures,DD=class extends dae{constructor(t={}){super(t),this.transform=CD.render(t.style),this.scale=this.transform.scale,this.msg=t.message,this.initial=t.initial||"",this.validator=t.validate||(()=>!0),this.value="",this.errorMsg=t.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=ID("",this.out.columns),this.render()}set value(t){!t&&this.initial?(this.placeholder=!0,this.rendered=Iy.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(t)),this._value=t,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
|
|
108
108
|
`),this.close()}validate(){var t=this;return v6(function*(){let r=yield t.validator(t.value);typeof r=="string"&&(t.errorMsg=r,r=!1),t.error=!r})()}submit(){var t=this;return v6(function*(){if(t.value=t.value||t.initial,t.cursorOffset=0,t.cursor=t.rendered.length,yield t.validate(),t.error){t.red=!0,t.fire(),t.render();return}t.done=!0,t.aborted=!1,t.fire(),t.render(),t.out.write(`
|
|
109
109
|
`),t.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(t){this.placeholder||(this.cursor=this.cursor+t,this.cursorOffset+=t)}_(t,r){let i=this.value.slice(0,this.cursor),n=this.value.slice(this.cursor);this.value=`${i}${t}${n}`,this.red=!1,this.cursor=this.placeholder?0:i.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let t=this.value.slice(0,this.cursor-1),r=this.value.slice(this.cursor);this.value=`${t}${r}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let t=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor+1);this.value=`${t}${r}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Kd.down(mae(this.outputError,this.out.columns)-1)+ID(this.outputError,this.out.columns)),this.out.write(ID(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[CD.symbol(this.done,this.aborted),Iy.bold(this.msg),CD.delimiter(this.done),this.red?Iy.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
110
110
|
`).reduce((t,r,i)=>t+`
|
|
111
|
-
${i?" ":fae.pointerSmall} ${Iy.red().italic(r)}`,"")),this.out.write(pae.line+Kd.to(0)+this.outputText+Kd.save+this.outputError+Kd.restore+Kd.move(this.cursorOffset,0)))}};S6.exports=DD});var T6=P((
|
|
111
|
+
${i?" ":fae.pointerSmall} ${Iy.red().italic(r)}`,"")),this.out.write(pae.line+Kd.to(0)+this.outputText+Kd.save+this.outputError+Kd.restore+Kd.move(this.cursorOffset,0)))}};S6.exports=DD});var T6=P((JCe,_6)=>{"use strict";var bi=Ke(),hae=vi(),qd=tn(),x6=qd.style,A6=qd.clear,wy=qd.figures,gae=qd.wrap,yae=qd.entriesToDisplay,vae=qe(),bae=vae.cursor,wD=class extends hae{constructor(t={}){super(t),this.msg=t.message,this.hint=t.hint||"- Use arrow-keys. Return to submit.",this.warn=t.warn||"- This option is disabled",this.cursor=t.initial||0,this.choices=t.choices.map((r,i)=>(typeof r=="string"&&(r={title:r,value:i}),{title:r&&(r.title||r.value||r),value:r&&(r.value===void 0?i:r.value),description:r&&r.description,selected:r&&r.selected,disabled:r&&r.disabled})),this.optionsPerPage=t.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=A6("",this.out.columns),this.render()}moveCursor(t){this.cursor=t,this.value=this.choices[t].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
112
112
|
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
113
113
|
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(t,r){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(bae.hide):this.out.write(A6(this.outputText,this.out.columns)),super.render();let t=yae(this.cursor,this.choices.length,this.optionsPerPage),r=t.startIndex,i=t.endIndex;if(this.outputText=[x6.symbol(this.done,this.aborted),bi.bold(this.msg),x6.delimiter(!1),this.done?this.selection.title:this.selection.disabled?bi.yellow(this.warn):bi.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
114
114
|
`;for(let n=r;n<i;n++){let a,o,s="",u=this.choices[n];n===r&&r>0?o=wy.arrowUp:n===i-1&&i<this.choices.length?o=wy.arrowDown:o=" ",u.disabled?(a=this.cursor===n?bi.gray().underline(u.title):bi.strikethrough().gray(u.title),o=(this.cursor===n?bi.bold().gray(wy.pointer)+" ":" ")+o):(a=this.cursor===n?bi.cyan().underline(u.title):u.title,o=(this.cursor===n?bi.cyan(wy.pointer)+" ":" ")+o,u.description&&this.cursor===n&&(s=` - ${u.description}`,(o.length+a.length+s.length>=this.out.columns||u.description.split(/\r?\n/).length>1)&&(s=`
|
|
115
115
|
`+gae(u.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${a}${bi.gray(s)}
|
|
116
|
-
`}}this.out.write(this.outputText)}};_6.exports=wD});var N6=P((
|
|
116
|
+
`}}this.out.write(this.outputText)}};_6.exports=wD});var N6=P((XCe,k6)=>{"use strict";var ky=Ke(),Sae=vi(),D6=tn(),C6=D6.style,Eae=D6.clear,w6=qe(),I6=w6.cursor,xae=w6.erase,kD=class extends Sae{constructor(t={}){super(t),this.msg=t.message,this.value=!!t.initial,this.active=t.active||"on",this.inactive=t.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
117
117
|
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
118
|
-
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(t,r){if(t===" ")this.value=!this.value;else if(t==="1")this.value=!0;else if(t==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(I6.hide):this.out.write(Eae(this.outputText,this.out.columns)),super.render(),this.outputText=[C6.symbol(this.done,this.aborted),ky.bold(this.msg),C6.delimiter(this.done),this.value?this.inactive:ky.cyan().underline(this.inactive),ky.gray("/"),this.value?ky.cyan().underline(this.active):this.active].join(" "),this.out.write(xae.line+I6.to(0)+this.outputText))}};k6.exports=kD});var kn=P((
|
|
118
|
+
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(t,r){if(t===" ")this.value=!this.value;else if(t==="1")this.value=!0;else if(t==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(I6.hide):this.out.write(Eae(this.outputText,this.out.columns)),super.render(),this.outputText=[C6.symbol(this.done,this.aborted),ky.bold(this.msg),C6.delimiter(this.done),this.value?this.inactive:ky.cyan().underline(this.inactive),ky.gray("/"),this.value?ky.cyan().underline(this.active):this.active].join(" "),this.out.write(xae.line+I6.to(0)+this.outputText))}};k6.exports=kD});var kn=P((YCe,P6)=>{"use strict";var ND=class e{constructor({token:t,date:r,parts:i,locales:n}){this.token=t,this.date=r||new Date,this.parts=i||[this],this.locales=n||{}}up(){}down(){}next(){let t=this.parts.indexOf(this);return this.parts.find((r,i)=>i>t&&r instanceof e)}setTo(t){}prev(){let t=[].concat(this.parts).reverse(),r=t.indexOf(this);return t.find((i,n)=>n>r&&i instanceof e)}toString(){return String(this.date)}};P6.exports=ND});var O6=P((QCe,R6)=>{"use strict";var Aae=kn(),PD=class extends Aae{constructor(t={}){super(t)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let t=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?t.toUpperCase():t}};R6.exports=PD});var j6=P((eIe,$6)=>{"use strict";var _ae=kn(),Tae=e=>(e=e%10,e===1?"st":e===2?"nd":e===3?"rd":"th"),RD=class extends _ae{constructor(t={}){super(t)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(t){this.date.setDate(parseInt(t.substr(-2)))}toString(){let t=this.date.getDate(),r=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+Tae(t):this.token==="d"?r+1:this.token==="ddd"?this.locales.weekdaysShort[r]:this.token==="dddd"?this.locales.weekdays[r]:t}};$6.exports=RD});var F6=P((tIe,M6)=>{"use strict";var Cae=kn(),OD=class extends Cae{constructor(t={}){super(t)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(t){this.date.setHours(parseInt(t.substr(-2)))}toString(){let t=this.date.getHours();return/h/.test(this.token)&&(t=t%12||12),this.token.length>1?String(t).padStart(2,"0"):t}};M6.exports=OD});var U6=P((rIe,L6)=>{"use strict";var Iae=kn(),$D=class extends Iae{constructor(t={}){super(t)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(t){this.date.setMilliseconds(parseInt(t.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};L6.exports=$D});var B6=P((nIe,z6)=>{"use strict";var Dae=kn(),jD=class extends Dae{constructor(t={}){super(t)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(t){this.date.setMinutes(parseInt(t.substr(-2)))}toString(){let t=this.date.getMinutes();return this.token.length>1?String(t).padStart(2,"0"):t}};z6.exports=jD});var V6=P((iIe,G6)=>{"use strict";var wae=kn(),MD=class extends wae{constructor(t={}){super(t)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(t){t=parseInt(t.substr(-2))-1,this.date.setMonth(t<0?0:t)}toString(){let t=this.date.getMonth(),r=this.token.length;return r===2?String(t+1).padStart(2,"0"):r===3?this.locales.monthsShort[t]:r===4?this.locales.months[t]:String(t+1)}};G6.exports=MD});var K6=P((aIe,W6)=>{"use strict";var kae=kn(),FD=class extends kae{constructor(t={}){super(t)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(t){this.date.setSeconds(parseInt(t.substr(-2)))}toString(){let t=this.date.getSeconds();return this.token.length>1?String(t).padStart(2,"0"):t}};W6.exports=FD});var Z6=P((oIe,q6)=>{"use strict";var Nae=kn(),LD=class extends Nae{constructor(t={}){super(t)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(t){this.date.setFullYear(t.substr(-4))}toString(){let t=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?t.substr(-2):t}};q6.exports=LD});var J6=P((sIe,H6)=>{"use strict";H6.exports={DatePart:kn(),Meridiem:O6(),Day:j6(),Hours:F6(),Milliseconds:U6(),Minutes:B6(),Month:V6(),Seconds:K6(),Year:Z6()}});var oG=P((cIe,aG)=>{"use strict";function X6(e,t,r,i,n,a,o){try{var s=e[a](o),u=s.value}catch(d){r(d);return}s.done?t(u):Promise.resolve(u).then(i,n)}function Y6(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var a=e.apply(t,r);function o(u){X6(a,i,n,o,s,"next",u)}function s(u){X6(a,i,n,o,s,"throw",u)}o(void 0)})}}var UD=Ke(),Pae=vi(),BD=tn(),Q6=BD.style,eG=BD.clear,Rae=BD.figures,iG=qe(),Oae=iG.erase,tG=iG.cursor,Si=J6(),rG=Si.DatePart,$ae=Si.Meridiem,jae=Si.Day,Mae=Si.Hours,Fae=Si.Milliseconds,Lae=Si.Minutes,Uae=Si.Month,zae=Si.Seconds,Bae=Si.Year,Gae=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,nG={1:({token:e})=>e.replace(/\\(.)/g,"$1"),2:e=>new jae(e),3:e=>new Uae(e),4:e=>new Bae(e),5:e=>new $ae(e),6:e=>new Mae(e),7:e=>new Lae(e),8:e=>new zae(e),9:e=>new Fae(e)},Vae={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")},zD=class extends Pae{constructor(t={}){super(t),this.msg=t.message,this.cursor=0,this.typed="",this.locales=Object.assign(Vae,t.locales),this._date=t.initial||new Date,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.mask=t.mask||"YYYY-MM-DD HH:mm:ss",this.clear=eG("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(t){t&&this._date.setTime(t.getTime())}set mask(t){let r;for(this.parts=[];r=Gae.exec(t);){let n=r.shift(),a=r.findIndex(o=>o!=null);this.parts.push(a in nG?nG[a]({token:r[a]||n,date:this.date,parts:this.parts,locales:this.locales}):r[a]||n)}let i=this.parts.reduce((n,a)=>(typeof a=="string"&&typeof n[n.length-1]=="string"?n[n.length-1]+=a:n.push(a),n),[]);this.parts.splice(0),this.parts.push(...i),this.reset()}moveCursor(t){this.typed="",this.cursor=t,this.fire()}reset(){this.moveCursor(this.parts.findIndex(t=>t instanceof rG)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
119
119
|
`),this.close()}validate(){var t=this;return Y6(function*(){let r=yield t.validator(t.value);typeof r=="string"&&(t.errorMsg=r,r=!1),t.error=!r})()}submit(){var t=this;return Y6(function*(){if(yield t.validate(),t.error){t.color="red",t.fire(),t.render();return}t.done=!0,t.aborted=!1,t.fire(),t.render(),t.out.write(`
|
|
120
120
|
`),t.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let t=this.parts[this.cursor].prev();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}right(){let t=this.parts[this.cursor].next();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}next(){let t=this.parts[this.cursor].next();this.moveCursor(t?this.parts.indexOf(t):this.parts.findIndex(r=>r instanceof rG)),this.render()}_(t){/\d/.test(t)&&(this.typed+=t,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(tG.hide):this.out.write(eG(this.outputText,this.out.columns)),super.render(),this.outputText=[Q6.symbol(this.done,this.aborted),UD.bold(this.msg),Q6.delimiter(!1),this.parts.reduce((t,r,i)=>t.concat(i===this.cursor&&!this.done?UD.cyan().underline(r.toString()):r),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
121
121
|
`).reduce((t,r,i)=>t+`
|
|
122
|
-
${i?" ":Rae.pointerSmall} ${UD.red().italic(r)}`,"")),this.out.write(Oae.line+tG.to(0)+this.outputText))}};aG.exports=zD});var mG=P((
|
|
122
|
+
${i?" ":Rae.pointerSmall} ${UD.red().italic(r)}`,"")),this.out.write(Oae.line+tG.to(0)+this.outputText))}};aG.exports=zD});var mG=P((uIe,pG)=>{"use strict";function sG(e,t,r,i,n,a,o){try{var s=e[a](o),u=s.value}catch(d){r(d);return}s.done?t(u):Promise.resolve(u).then(i,n)}function cG(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var a=e.apply(t,r);function o(u){sG(a,i,n,o,s,"next",u)}function s(u){sG(a,i,n,o,s,"throw",u)}o(void 0)})}}var Ny=Ke(),Wae=vi(),dG=qe(),Py=dG.cursor,Kae=dG.erase,Ry=tn(),GD=Ry.style,qae=Ry.figures,uG=Ry.clear,Zae=Ry.lines,Hae=/[0-9]/,VD=e=>e!==void 0,lG=(e,t)=>{let r=Math.pow(10,t);return Math.round(e*r)/r},WD=class extends Wae{constructor(t={}){super(t),this.transform=GD.render(t.style),this.msg=t.message,this.initial=VD(t.initial)?t.initial:"",this.float=!!t.float,this.round=t.round||2,this.inc=t.increment||1,this.min=VD(t.min)?t.min:-1/0,this.max=VD(t.max)?t.max:1/0,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(t){!t&&t!==0?(this.placeholder=!0,this.rendered=Ny.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${lG(t,this.round)}`),this._value=lG(t,this.round)),this.fire()}get value(){return this._value}parse(t){return this.float?parseFloat(t):parseInt(t)}valid(t){return t==="-"||t==="."&&this.float||Hae.test(t)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let t=this.value;this.value=t!==""?t:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
123
123
|
`),this.close()}validate(){var t=this;return cG(function*(){let r=yield t.validator(t.value);typeof r=="string"&&(t.errorMsg=r,r=!1),t.error=!r})()}submit(){var t=this;return cG(function*(){if(yield t.validate(),t.error){t.color="red",t.fire(),t.render();return}let r=t.value;t.value=r!==""?r:t.initial,t.done=!0,t.aborted=!1,t.error=!1,t.fire(),t.render(),t.out.write(`
|
|
124
124
|
`),t.close()})()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let t=this.value.toString();if(t.length===0)return this.bell();this.value=this.parse(t=t.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(t,r){if(!this.valid(t))return this.bell();let i=Date.now();if(i-this.lastHit>1e3&&(this.typed=""),this.typed+=t,this.lastHit=i,this.color="cyan",t===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Py.down(Zae(this.outputError,this.out.columns)-1)+uG(this.outputError,this.out.columns)),this.out.write(uG(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[GD.symbol(this.done,this.aborted),Ny.bold(this.msg),GD.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Ny[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
125
125
|
`).reduce((t,r,i)=>t+`
|
|
126
|
-
${i?" ":qae.pointerSmall} ${Ny.red().italic(r)}`,"")),this.out.write(Kae.line+Py.to(0)+this.outputText+Py.save+this.outputError+Py.restore))}};pG.exports=WD});var qD=P((
|
|
126
|
+
${i?" ":qae.pointerSmall} ${Ny.red().italic(r)}`,"")),this.out.write(Kae.line+Py.to(0)+this.outputText+Py.save+this.outputError+Py.restore))}};pG.exports=WD});var qD=P((lIe,gG)=>{"use strict";var Nn=Ke(),Jae=qe(),Xae=Jae.cursor,Yae=vi(),Zd=tn(),fG=Zd.clear,ca=Zd.figures,hG=Zd.style,Qae=Zd.wrap,eoe=Zd.entriesToDisplay,KD=class extends Yae{constructor(t={}){super(t),this.msg=t.message,this.cursor=t.cursor||0,this.scrollIndex=t.cursor||0,this.hint=t.hint||"",this.warn=t.warn||"- This option is disabled -",this.minSelected=t.min,this.showMinError=!1,this.maxChoices=t.max,this.instructions=t.instructions,this.optionsPerPage=t.optionsPerPage||10,this.value=t.choices.map((r,i)=>(typeof r=="string"&&(r={title:r,value:i}),{title:r&&(r.title||r.value||r),description:r&&r.description,value:r&&(r.value===void 0?i:r.value),selected:r&&r.selected,disabled:r&&r.disabled})),this.clear=fG("",this.out.columns),t.overrideRender||this.render()}reset(){this.value.map(t=>!t.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(t=>t.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
127
127
|
`),this.close()}submit(){let t=this.value.filter(r=>r.selected);this.minSelected&&t.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
128
128
|
`),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let t=this.value[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(r=>r.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let t=!this.value[this.cursor].selected;this.value.filter(r=>!r.disabled).forEach(r=>r.selected=t),this.render()}_(t,r){if(t===" ")this.handleSpaceToggle();else if(t==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
129
129
|
Instructions:
|
|
@@ -133,13 +133,13 @@ Instructions:
|
|
|
133
133
|
`:"")+" enter/return: Complete answer":""}renderOption(t,r,i,n){let a=(r.selected?Nn.green(ca.radioOn):ca.radioOff)+" "+n+" ",o,s;return r.disabled?o=t===i?Nn.gray().underline(r.title):Nn.strikethrough().gray(r.title):(o=t===i?Nn.cyan().underline(r.title):r.title,t===i&&r.description&&(s=` - ${r.description}`,(a.length+o.length+s.length>=this.out.columns||r.description.split(/\r?\n/).length>1)&&(s=`
|
|
134
134
|
`+Qae(r.description,{margin:a.length,width:this.out.columns})))),a+o+Nn.gray(s||"")}paginateOptions(t){if(t.length===0)return Nn.red("No matches for this query.");let r=eoe(this.cursor,t.length,this.optionsPerPage),i=r.startIndex,n=r.endIndex,a,o=[];for(let s=i;s<n;s++)s===i&&i>0?a=ca.arrowUp:s===n-1&&n<t.length?a=ca.arrowDown:a=" ",o.push(this.renderOption(this.cursor,t[s],s,a));return`
|
|
135
135
|
`+o.join(`
|
|
136
|
-
`)}renderOptions(t){return this.done?"":this.paginateOptions(t)}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let t=[Nn.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(Nn.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Xae.hide),super.render();let t=[hG.symbol(this.done,this.aborted),Nn.bold(this.msg),hG.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=Nn.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.value),this.out.write(this.clear+t),this.clear=fG(t,this.out.columns)}};gG.exports=KD});var AG=P((
|
|
136
|
+
`)}renderOptions(t){return this.done?"":this.paginateOptions(t)}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let t=[Nn.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(Nn.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Xae.hide),super.render();let t=[hG.symbol(this.done,this.aborted),Nn.bold(this.msg),hG.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=Nn.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.value),this.out.write(this.clear+t),this.clear=fG(t,this.out.columns)}};gG.exports=KD});var AG=P((dIe,xG)=>{"use strict";function yG(e,t,r,i,n,a,o){try{var s=e[a](o),u=s.value}catch(d){r(d);return}s.done?t(u):Promise.resolve(u).then(i,n)}function toe(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var a=e.apply(t,r);function o(u){yG(a,i,n,o,s,"next",u)}function s(u){yG(a,i,n,o,s,"throw",u)}o(void 0)})}}var Hd=Ke(),roe=vi(),EG=qe(),noe=EG.erase,vG=EG.cursor,Jd=tn(),ZD=Jd.style,bG=Jd.clear,HD=Jd.figures,ioe=Jd.wrap,aoe=Jd.entriesToDisplay,SG=(e,t)=>e[t]&&(e[t].value||e[t].title||e[t]),ooe=(e,t)=>e[t]&&(e[t].title||e[t].value||e[t]),soe=(e,t)=>{let r=e.findIndex(i=>i.value===t||i.title===t);return r>-1?r:void 0},JD=class extends roe{constructor(t={}){super(t),this.msg=t.message,this.suggest=t.suggest,this.choices=t.choices,this.initial=typeof t.initial=="number"?t.initial:soe(t.choices,t.initial),this.select=this.initial||t.cursor||0,this.i18n={noMatches:t.noMatches||"no matches found"},this.fallback=t.fallback||this.initial,this.clearFirst=t.clearFirst||!1,this.suggestions=[],this.input="",this.limit=t.limit||10,this.cursor=0,this.transform=ZD.render(t.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=bG("",this.out.columns),this.complete(this.render),this.render()}set fallback(t){this._fb=Number.isSafeInteger(parseInt(t))?parseInt(t):t}get fallback(){let t;return typeof this._fb=="number"?t=this.choices[this._fb]:typeof this._fb=="string"&&(t={title:this._fb}),t||this._fb||{title:this.i18n.noMatches}}moveSelect(t){this.select=t,this.suggestions.length>0?this.value=SG(this.suggestions,t):this.value=this.fallback.value,this.fire()}complete(t){var r=this;return toe(function*(){let i=r.completing=r.suggest(r.input,r.choices),n=yield i;if(r.completing!==i)return;r.suggestions=n.map((o,s,u)=>({title:ooe(u,s),value:SG(u,s),description:o.description})),r.completing=!1;let a=Math.max(n.length-1,0);r.moveSelect(Math.min(a,r.select)),t&&t()})()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
137
137
|
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
138
138
|
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
139
139
|
`),this.close()}_(t,r){let i=this.input.slice(0,this.cursor),n=this.input.slice(this.cursor);this.input=`${i}${t}${n}`,this.cursor=i.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let t=this.input.slice(0,this.cursor-1),r=this.input.slice(this.cursor);this.input=`${t}${r}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let t=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor+1);this.input=`${t}${r}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(t,r,i,n){let a,o=i?HD.arrowUp:n?HD.arrowDown:" ",s=r?Hd.cyan().underline(t.title):t.title;return o=(r?Hd.cyan(HD.pointer)+" ":" ")+o,t.description&&(a=` - ${t.description}`,(o.length+s.length+a.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(a=`
|
|
140
140
|
`+ioe(t.description,{margin:3,width:this.out.columns}))),o+" "+s+Hd.gray(a||"")}render(){if(this.closed)return;this.firstRender?this.out.write(vG.hide):this.out.write(bG(this.outputText,this.out.columns)),super.render();let t=aoe(this.select,this.choices.length,this.limit),r=t.startIndex,i=t.endIndex;if(this.outputText=[ZD.symbol(this.done,this.aborted,this.exited),Hd.bold(this.msg),ZD.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let n=this.suggestions.slice(r,i).map((a,o)=>this.renderOption(a,this.select===o+r,o===0&&r>0,o+r===i-1&&i<this.choices.length)).join(`
|
|
141
141
|
`);this.outputText+=`
|
|
142
|
-
`+(n||Hd.gray(this.fallback.title))}this.out.write(noe.line+vG.to(0)+this.outputText)}};xG.exports=JD});var IG=P((
|
|
142
|
+
`+(n||Hd.gray(this.fallback.title))}this.out.write(noe.line+vG.to(0)+this.outputText)}};xG.exports=JD});var IG=P((pIe,CG)=>{"use strict";var Ei=Ke(),coe=qe(),uoe=coe.cursor,loe=qD(),YD=tn(),_G=YD.clear,TG=YD.style,Vc=YD.figures,XD=class extends loe{constructor(t={}){t.overrideRender=!0,super(t),this.inputValue="",this.clear=_G("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let t=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(i=>this.inputValue?!!(typeof i.title=="string"&&i.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof i.value=="string"&&i.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let r=this.filteredOptions.findIndex(i=>i===t);this.cursor=r<0?0:r,this.render()}handleSpaceToggle(){let t=this.filteredOptions[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(r=>r.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}handleInputChange(t){this.inputValue=this.inputValue+t,this.updateFilteredOptions()}_(t,r){t===" "?this.handleSpaceToggle():this.handleInputChange(t)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
143
143
|
Instructions:
|
|
144
144
|
${Vc.arrowUp}/${Vc.arrowDown}: Highlight option
|
|
145
145
|
${Vc.arrowLeft}/${Vc.arrowRight}/[space]: Toggle selection
|
|
@@ -147,31 +147,31 @@ Instructions:
|
|
|
147
147
|
enter/return: Complete answer
|
|
148
148
|
`:""}renderCurrentInput(){return`
|
|
149
149
|
Filtered results for: ${this.inputValue?this.inputValue:Ei.gray("Enter something to filter")}
|
|
150
|
-
`}renderOption(t,r,i){let n;return r.disabled?n=t===i?Ei.gray().underline(r.title):Ei.strikethrough().gray(r.title):n=t===i?Ei.cyan().underline(r.title):r.title,(r.selected?Ei.green(Vc.radioOn):Vc.radioOff)+" "+n}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let t=[Ei.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(Ei.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(uoe.hide),super.render();let t=[TG.symbol(this.done,this.aborted),Ei.bold(this.msg),TG.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=Ei.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+t),this.clear=_G(t,this.out.columns)}};CG.exports=XD});var OG=P((
|
|
150
|
+
`}renderOption(t,r,i){let n;return r.disabled?n=t===i?Ei.gray().underline(r.title):Ei.strikethrough().gray(r.title):n=t===i?Ei.cyan().underline(r.title):r.title,(r.selected?Ei.green(Vc.radioOn):Vc.radioOff)+" "+n}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let t=[Ei.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(Ei.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(uoe.hide),super.render();let t=[TG.symbol(this.done,this.aborted),Ei.bold(this.msg),TG.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=Ei.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+t),this.clear=_G(t,this.out.columns)}};CG.exports=XD});var OG=P((mIe,RG)=>{"use strict";var DG=Ke(),doe=vi(),NG=tn(),wG=NG.style,poe=NG.clear,PG=qe(),moe=PG.erase,kG=PG.cursor,QD=class extends doe{constructor(t={}){super(t),this.msg=t.message,this.value=t.initial,this.initialValue=!!t.initial,this.yesMsg=t.yes||"yes",this.yesOption=t.yesOption||"(Y/n)",this.noMsg=t.no||"no",this.noOption=t.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
151
151
|
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
152
|
-
`),this.close()}_(t,r){return t.toLowerCase()==="y"?(this.value=!0,this.submit()):t.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(kG.hide):this.out.write(poe(this.outputText,this.out.columns)),super.render(),this.outputText=[wG.symbol(this.done,this.aborted),DG.bold(this.msg),wG.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:DG.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(moe.line+kG.to(0)+this.outputText))}};RG.exports=QD});var jG=P((
|
|
153
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){r=r.call(e)},n:function(){var d=r.next();return a=d.done,d},e:function(d){o=!0,s=d},f:function(){try{!a&&r.return!=null&&r.return()}finally{if(o)throw s}}}}function voe(e,t){if(e){if(typeof e=="string")return zG(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return zG(e,t)}}function zG(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}function BG(e,t,r,i,n,a,o){try{var s=e[a](o),u=s.value}catch(d){r(d);return}s.done?t(u):Promise.resolve(u).then(i,n)}function GG(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var a=e.apply(t,r);function o(u){BG(a,i,n,o,s,"next",u)}function s(u){BG(a,i,n,o,s,"throw",u)}o(void 0)})}}var ew=FG(),boe=["suggest","format","onState","validate","onRender","type"],VG=()=>{};function ua(){return tw.apply(this,arguments)}function tw(){return tw=GG(function*(e=[],{onSubmit:t=VG,onCancel:r=VG}={}){let i={},n=ua._override||{};e=[].concat(e);let a,o,s,u,d,p,h=(function(){var y=GG(function*(v,b,A=!1){if(!(!A&&v.validate&&v.validate(b)!==!0))return v.format?yield v.format(b,i):b});return function(b,A){return y.apply(this,arguments)}})();var g=yoe(e),l;try{for(g.s();!(l=g.n()).done;){o=l.value;var m=o;if(u=m.name,d=m.type,typeof d=="function"&&(d=yield d(a,UG({},i),o),o.type=d),!!d){for(let y in o){if(boe.includes(y))continue;let v=o[y];o[y]=typeof v=="function"?yield v(a,UG({},i),p):v}if(p=o,typeof o.message!="string")throw new Error("prompt message is required");var f=o;if(u=f.name,d=f.type,ew[d]===void 0)throw new Error(`prompt type (${d}) is not defined`);if(n[o.name]!==void 0&&(a=yield h(o,n[o.name]),a!==void 0)){i[u]=a;continue}try{a=ua._injected?Soe(ua._injected,o.initial):yield ew[d](o),i[u]=a=yield h(o,a,!0),s=yield t(o,a,i)}catch{s=!(yield r(o,i))}if(s)return i}}}catch(y){g.e(y)}finally{g.f()}return i}),tw.apply(this,arguments)}function Soe(e,t){let r=e.shift();if(r instanceof Error)throw r;return r===void 0?t:r}function Eoe(e){ua._injected=(ua._injected||[]).concat(e)}function xoe(e){ua._override=Object.assign({},e)}WG.exports=Object.assign(ua,{prompt:ua,prompts:ew,inject:Eoe,override:xoe})});var ZG=P((
|
|
152
|
+
`),this.close()}_(t,r){return t.toLowerCase()==="y"?(this.value=!0,this.submit()):t.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(kG.hide):this.out.write(poe(this.outputText,this.out.columns)),super.render(),this.outputText=[wG.symbol(this.done,this.aborted),DG.bold(this.msg),wG.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:DG.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(moe.line+kG.to(0)+this.outputText))}};RG.exports=QD});var jG=P((fIe,$G)=>{"use strict";$G.exports={TextPrompt:E6(),SelectPrompt:T6(),TogglePrompt:N6(),DatePrompt:oG(),NumberPrompt:mG(),MultiselectPrompt:qD(),AutocompletePrompt:AG(),AutocompleteMultiselectPrompt:IG(),ConfirmPrompt:OG()}});var FG=P(MG=>{"use strict";var Jt=MG,foe=jG(),Oy=e=>e;function Pn(e,t,r={}){return new Promise((i,n)=>{let a=new foe[e](t),o=r.onAbort||Oy,s=r.onSubmit||Oy,u=r.onExit||Oy;a.on("state",t.onState||Oy),a.on("submit",d=>i(s(d))),a.on("exit",d=>i(u(d))),a.on("abort",d=>n(o(d)))})}Jt.text=e=>Pn("TextPrompt",e);Jt.password=e=>(e.style="password",Jt.text(e));Jt.invisible=e=>(e.style="invisible",Jt.text(e));Jt.number=e=>Pn("NumberPrompt",e);Jt.date=e=>Pn("DatePrompt",e);Jt.confirm=e=>Pn("ConfirmPrompt",e);Jt.list=e=>{let t=e.separator||",";return Pn("TextPrompt",e,{onSubmit:r=>r.split(t).map(i=>i.trim())})};Jt.toggle=e=>Pn("TogglePrompt",e);Jt.select=e=>Pn("SelectPrompt",e);Jt.multiselect=e=>{e.choices=[].concat(e.choices||[]);let t=r=>r.filter(i=>i.selected).map(i=>i.value);return Pn("MultiselectPrompt",e,{onAbort:t,onSubmit:t})};Jt.autocompleteMultiselect=e=>{e.choices=[].concat(e.choices||[]);let t=r=>r.filter(i=>i.selected).map(i=>i.value);return Pn("AutocompleteMultiselectPrompt",e,{onAbort:t,onSubmit:t})};var hoe=(e,t)=>Promise.resolve(t.filter(r=>r.title.slice(0,e.length).toLowerCase()===e.toLowerCase()));Jt.autocomplete=e=>(e.suggest=e.suggest||hoe,e.choices=[].concat(e.choices||[]),Pn("AutocompletePrompt",e))});var KG=P((gIe,WG)=>{"use strict";function LG(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,i)}return r}function UG(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?LG(Object(r),!0).forEach(function(i){goe(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):LG(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function goe(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function yoe(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=voe(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(d){throw d},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
153
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){r=r.call(e)},n:function(){var d=r.next();return a=d.done,d},e:function(d){o=!0,s=d},f:function(){try{!a&&r.return!=null&&r.return()}finally{if(o)throw s}}}}function voe(e,t){if(e){if(typeof e=="string")return zG(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return zG(e,t)}}function zG(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}function BG(e,t,r,i,n,a,o){try{var s=e[a](o),u=s.value}catch(d){r(d);return}s.done?t(u):Promise.resolve(u).then(i,n)}function GG(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var a=e.apply(t,r);function o(u){BG(a,i,n,o,s,"next",u)}function s(u){BG(a,i,n,o,s,"throw",u)}o(void 0)})}}var ew=FG(),boe=["suggest","format","onState","validate","onRender","type"],VG=()=>{};function ua(){return tw.apply(this,arguments)}function tw(){return tw=GG(function*(e=[],{onSubmit:t=VG,onCancel:r=VG}={}){let i={},n=ua._override||{};e=[].concat(e);let a,o,s,u,d,p,h=(function(){var y=GG(function*(v,b,A=!1){if(!(!A&&v.validate&&v.validate(b)!==!0))return v.format?yield v.format(b,i):b});return function(b,A){return y.apply(this,arguments)}})();var g=yoe(e),l;try{for(g.s();!(l=g.n()).done;){o=l.value;var m=o;if(u=m.name,d=m.type,typeof d=="function"&&(d=yield d(a,UG({},i),o),o.type=d),!!d){for(let y in o){if(boe.includes(y))continue;let v=o[y];o[y]=typeof v=="function"?yield v(a,UG({},i),p):v}if(p=o,typeof o.message!="string")throw new Error("prompt message is required");var f=o;if(u=f.name,d=f.type,ew[d]===void 0)throw new Error(`prompt type (${d}) is not defined`);if(n[o.name]!==void 0&&(a=yield h(o,n[o.name]),a!==void 0)){i[u]=a;continue}try{a=ua._injected?Soe(ua._injected,o.initial):yield ew[d](o),i[u]=a=yield h(o,a,!0),s=yield t(o,a,i)}catch{s=!(yield r(o,i))}if(s)return i}}}catch(y){g.e(y)}finally{g.f()}return i}),tw.apply(this,arguments)}function Soe(e,t){let r=e.shift();if(r instanceof Error)throw r;return r===void 0?t:r}function Eoe(e){ua._injected=(ua._injected||[]).concat(e)}function xoe(e){ua._override=Object.assign({},e)}WG.exports=Object.assign(ua,{prompt:ua,prompts:ew,inject:Eoe,override:xoe})});var ZG=P((yIe,qG)=>{"use strict";qG.exports=(e,t)=>{if(!(e.meta&&e.name!=="escape")){if(e.ctrl){if(e.name==="a")return"first";if(e.name==="c"||e.name==="d")return"abort";if(e.name==="e")return"last";if(e.name==="g")return"reset"}if(t){if(e.name==="j")return"down";if(e.name==="k")return"up"}return e.name==="return"||e.name==="enter"?"submit":e.name==="backspace"?"delete":e.name==="delete"?"deleteForward":e.name==="abort"?"abort":e.name==="escape"?"exit":e.name==="tab"?"next":e.name==="pagedown"?"nextPage":e.name==="pageup"?"prevPage":e.name==="home"?"home":e.name==="end"?"end":e.name==="up"?"up":e.name==="down"?"down":e.name==="right"?"right":e.name==="left"?"left":!1}}});var $y=P((vIe,HG)=>{"use strict";HG.exports=e=>{let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),r=new RegExp(t,"g");return typeof e=="string"?e.replace(r,""):e}});var YG=P((bIe,XG)=>{"use strict";var Aoe=$y(),{erase:JG,cursor:_oe}=qe(),Toe=e=>[...Aoe(e)].length;XG.exports=function(e,t){if(!t)return JG.line+_oe.to(0);let r=0,i=e.split(/\r?\n/);for(let n of i)r+=1+Math.floor(Math.max(Toe(n)-1,0)/t);return JG.lines(r)}});var rw=P((SIe,QG)=>{"use strict";var Xd={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},Coe={arrowUp:Xd.arrowUp,arrowDown:Xd.arrowDown,arrowLeft:Xd.arrowLeft,arrowRight:Xd.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Ioe=process.platform==="win32"?Coe:Xd;QG.exports=Ioe});var tV=P((EIe,eV)=>{"use strict";var Wc=Ke(),Io=rw(),nw=Object.freeze({password:{scale:1,render:e=>"*".repeat(e.length)},emoji:{scale:2,render:e=>"\u{1F603}".repeat(e.length)},invisible:{scale:0,render:e=>""},default:{scale:1,render:e=>`${e}`}}),Doe=e=>nw[e]||nw.default,Yd=Object.freeze({aborted:Wc.red(Io.cross),done:Wc.green(Io.tick),exited:Wc.yellow(Io.cross),default:Wc.cyan("?")}),woe=(e,t,r)=>t?Yd.aborted:r?Yd.exited:e?Yd.done:Yd.default,koe=e=>Wc.gray(e?Io.ellipsis:Io.pointerSmall),Noe=(e,t)=>Wc.gray(e?t?Io.pointerSmall:"+":Io.line);eV.exports={styles:nw,render:Doe,symbols:Yd,symbol:woe,delimiter:koe,item:Noe}});var nV=P((xIe,rV)=>{"use strict";var Poe=$y();rV.exports=function(e,t){let r=String(Poe(e)||"").split(/\r?\n/);return t?r.map(i=>Math.ceil(i.length/t)).reduce((i,n)=>i+n):r.length}});var aV=P((AIe,iV)=>{"use strict";iV.exports=(e,t={})=>{let r=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",i=t.width;return(e||"").split(/\r?\n/g).map(n=>n.split(/\s+/g).reduce((a,o)=>(o.length+r.length>=i||a[a.length-1].length+o.length+1<i?a[a.length-1]+=` ${o}`:a.push(`${r}${o}`),a),[r]).join(`
|
|
154
154
|
`)).join(`
|
|
155
|
-
`)}});var sV=P((
|
|
155
|
+
`)}});var sV=P((_Ie,oV)=>{"use strict";oV.exports=(e,t,r)=>{r=r||t;let i=Math.min(t-r,e-Math.floor(r/2));i<0&&(i=0);let n=Math.min(i+r,t);return{startIndex:i,endIndex:n}}});var rn=P((TIe,cV)=>{"use strict";cV.exports={action:ZG(),clear:YG(),style:tV(),strip:$y(),figures:rw(),lines:nV(),wrap:aV(),entriesToDisplay:sV()}});var xi=P((CIe,lV)=>{"use strict";var uV=No("readline"),{action:Roe}=rn(),Ooe=No("events"),{beep:$oe,cursor:joe}=qe(),Moe=Ke(),iw=class extends Ooe{constructor(t={}){super(),this.firstRender=!0,this.in=t.stdin||process.stdin,this.out=t.stdout||process.stdout,this.onRender=(t.onRender||(()=>{})).bind(this);let r=uV.createInterface({input:this.in,escapeCodeTimeout:50});uV.emitKeypressEvents(this.in,r),this.in.isTTY&&this.in.setRawMode(!0);let i=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,n=(a,o)=>{let s=Roe(o,i);s===!1?this._&&this._(a,o):typeof this[s]=="function"?this[s](o):this.bell()};this.close=()=>{this.out.write(joe.show),this.in.removeListener("keypress",n),this.in.isTTY&&this.in.setRawMode(!1),r.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",n)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write($oe)}render(){this.onRender(Moe),this.firstRender&&(this.firstRender=!1)}};lV.exports=iw});var pV=P((IIe,dV)=>{var jy=Ke(),Foe=xi(),{erase:Loe,cursor:Qd}=qe(),{style:aw,clear:ow,lines:Uoe,figures:zoe}=rn(),sw=class extends Foe{constructor(t={}){super(t),this.transform=aw.render(t.style),this.scale=this.transform.scale,this.msg=t.message,this.initial=t.initial||"",this.validator=t.validate||(()=>!0),this.value="",this.errorMsg=t.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=ow("",this.out.columns),this.render()}set value(t){!t&&this.initial?(this.placeholder=!0,this.rendered=jy.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(t)),this._value=t,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
|
|
156
156
|
`),this.close()}async validate(){let t=await this.validator(this.value);typeof t=="string"&&(this.errorMsg=t,t=!1),this.error=!t}async submit(){if(this.value=this.value||this.initial,this.cursorOffset=0,this.cursor=this.rendered.length,await this.validate(),this.error){this.red=!0,this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
157
157
|
`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(t){this.placeholder||(this.cursor=this.cursor+t,this.cursorOffset+=t)}_(t,r){let i=this.value.slice(0,this.cursor),n=this.value.slice(this.cursor);this.value=`${i}${t}${n}`,this.red=!1,this.cursor=this.placeholder?0:i.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let t=this.value.slice(0,this.cursor-1),r=this.value.slice(this.cursor);this.value=`${t}${r}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let t=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor+1);this.value=`${t}${r}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Qd.down(Uoe(this.outputError,this.out.columns)-1)+ow(this.outputError,this.out.columns)),this.out.write(ow(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[aw.symbol(this.done,this.aborted),jy.bold(this.msg),aw.delimiter(this.done),this.red?jy.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
158
158
|
`).reduce((t,r,i)=>t+`
|
|
159
|
-
${i?" ":zoe.pointerSmall} ${jy.red().italic(r)}`,"")),this.out.write(Loe.line+Qd.to(0)+this.outputText+Qd.save+this.outputError+Qd.restore+Qd.move(this.cursorOffset,0)))}};dV.exports=sw});var gV=P((
|
|
159
|
+
${i?" ":zoe.pointerSmall} ${jy.red().italic(r)}`,"")),this.out.write(Loe.line+Qd.to(0)+this.outputText+Qd.save+this.outputError+Qd.restore+Qd.move(this.cursorOffset,0)))}};dV.exports=sw});var gV=P((DIe,hV)=>{"use strict";var Ai=Ke(),Boe=xi(),{style:mV,clear:fV,figures:My,wrap:Goe,entriesToDisplay:Voe}=rn(),{cursor:Woe}=qe(),cw=class extends Boe{constructor(t={}){super(t),this.msg=t.message,this.hint=t.hint||"- Use arrow-keys. Return to submit.",this.warn=t.warn||"- This option is disabled",this.cursor=t.initial||0,this.choices=t.choices.map((r,i)=>(typeof r=="string"&&(r={title:r,value:i}),{title:r&&(r.title||r.value||r),value:r&&(r.value===void 0?i:r.value),description:r&&r.description,selected:r&&r.selected,disabled:r&&r.disabled})),this.optionsPerPage=t.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=fV("",this.out.columns),this.render()}moveCursor(t){this.cursor=t,this.value=this.choices[t].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
160
160
|
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
161
161
|
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(t,r){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(Woe.hide):this.out.write(fV(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:r}=Voe(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[mV.symbol(this.done,this.aborted),Ai.bold(this.msg),mV.delimiter(!1),this.done?this.selection.title:this.selection.disabled?Ai.yellow(this.warn):Ai.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
162
162
|
`;for(let i=t;i<r;i++){let n,a,o="",s=this.choices[i];i===t&&t>0?a=My.arrowUp:i===r-1&&r<this.choices.length?a=My.arrowDown:a=" ",s.disabled?(n=this.cursor===i?Ai.gray().underline(s.title):Ai.strikethrough().gray(s.title),a=(this.cursor===i?Ai.bold().gray(My.pointer)+" ":" ")+a):(n=this.cursor===i?Ai.cyan().underline(s.title):s.title,a=(this.cursor===i?Ai.cyan(My.pointer)+" ":" ")+a,s.description&&this.cursor===i&&(o=` - ${s.description}`,(a.length+n.length+o.length>=this.out.columns||s.description.split(/\r?\n/).length>1)&&(o=`
|
|
163
163
|
`+Goe(s.description,{margin:3,width:this.out.columns})))),this.outputText+=`${a} ${n}${Ai.gray(o)}
|
|
164
|
-
`}}this.out.write(this.outputText)}};hV.exports=cw});var SV=P((
|
|
164
|
+
`}}this.out.write(this.outputText)}};hV.exports=cw});var SV=P((wIe,bV)=>{var Fy=Ke(),Koe=xi(),{style:yV,clear:qoe}=rn(),{cursor:vV,erase:Zoe}=qe(),uw=class extends Koe{constructor(t={}){super(t),this.msg=t.message,this.value=!!t.initial,this.active=t.active||"on",this.inactive=t.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
165
165
|
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
166
|
-
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(t,r){if(t===" ")this.value=!this.value;else if(t==="1")this.value=!0;else if(t==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(vV.hide):this.out.write(qoe(this.outputText,this.out.columns)),super.render(),this.outputText=[yV.symbol(this.done,this.aborted),Fy.bold(this.msg),yV.delimiter(this.done),this.value?this.inactive:Fy.cyan().underline(this.inactive),Fy.gray("/"),this.value?Fy.cyan().underline(this.active):this.active].join(" "),this.out.write(Zoe.line+vV.to(0)+this.outputText))}};bV.exports=uw});var Rn=P((
|
|
166
|
+
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(t,r){if(t===" ")this.value=!this.value;else if(t==="1")this.value=!0;else if(t==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(vV.hide):this.out.write(qoe(this.outputText,this.out.columns)),super.render(),this.outputText=[yV.symbol(this.done,this.aborted),Fy.bold(this.msg),yV.delimiter(this.done),this.value?this.inactive:Fy.cyan().underline(this.inactive),Fy.gray("/"),this.value?Fy.cyan().underline(this.active):this.active].join(" "),this.out.write(Zoe.line+vV.to(0)+this.outputText))}};bV.exports=uw});var Rn=P((kIe,EV)=>{"use strict";var lw=class e{constructor({token:t,date:r,parts:i,locales:n}){this.token=t,this.date=r||new Date,this.parts=i||[this],this.locales=n||{}}up(){}down(){}next(){let t=this.parts.indexOf(this);return this.parts.find((r,i)=>i>t&&r instanceof e)}setTo(t){}prev(){let t=[].concat(this.parts).reverse(),r=t.indexOf(this);return t.find((i,n)=>n>r&&i instanceof e)}toString(){return String(this.date)}};EV.exports=lw});var AV=P((NIe,xV)=>{"use strict";var Hoe=Rn(),dw=class extends Hoe{constructor(t={}){super(t)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let t=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?t.toUpperCase():t}};xV.exports=dw});var TV=P((PIe,_V)=>{"use strict";var Joe=Rn(),Xoe=e=>(e=e%10,e===1?"st":e===2?"nd":e===3?"rd":"th"),pw=class extends Joe{constructor(t={}){super(t)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(t){this.date.setDate(parseInt(t.substr(-2)))}toString(){let t=this.date.getDate(),r=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+Xoe(t):this.token==="d"?r+1:this.token==="ddd"?this.locales.weekdaysShort[r]:this.token==="dddd"?this.locales.weekdays[r]:t}};_V.exports=pw});var IV=P((RIe,CV)=>{"use strict";var Yoe=Rn(),mw=class extends Yoe{constructor(t={}){super(t)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(t){this.date.setHours(parseInt(t.substr(-2)))}toString(){let t=this.date.getHours();return/h/.test(this.token)&&(t=t%12||12),this.token.length>1?String(t).padStart(2,"0"):t}};CV.exports=mw});var wV=P((OIe,DV)=>{"use strict";var Qoe=Rn(),fw=class extends Qoe{constructor(t={}){super(t)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(t){this.date.setMilliseconds(parseInt(t.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};DV.exports=fw});var NV=P(($Ie,kV)=>{"use strict";var ese=Rn(),hw=class extends ese{constructor(t={}){super(t)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(t){this.date.setMinutes(parseInt(t.substr(-2)))}toString(){let t=this.date.getMinutes();return this.token.length>1?String(t).padStart(2,"0"):t}};kV.exports=hw});var RV=P((jIe,PV)=>{"use strict";var tse=Rn(),gw=class extends tse{constructor(t={}){super(t)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(t){t=parseInt(t.substr(-2))-1,this.date.setMonth(t<0?0:t)}toString(){let t=this.date.getMonth(),r=this.token.length;return r===2?String(t+1).padStart(2,"0"):r===3?this.locales.monthsShort[t]:r===4?this.locales.months[t]:String(t+1)}};PV.exports=gw});var $V=P((MIe,OV)=>{"use strict";var rse=Rn(),yw=class extends rse{constructor(t={}){super(t)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(t){this.date.setSeconds(parseInt(t.substr(-2)))}toString(){let t=this.date.getSeconds();return this.token.length>1?String(t).padStart(2,"0"):t}};OV.exports=yw});var MV=P((FIe,jV)=>{"use strict";var nse=Rn(),vw=class extends nse{constructor(t={}){super(t)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(t){this.date.setFullYear(t.substr(-4))}toString(){let t=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?t.substr(-2):t}};jV.exports=vw});var LV=P((LIe,FV)=>{"use strict";FV.exports={DatePart:Rn(),Meridiem:AV(),Day:TV(),Hours:IV(),Milliseconds:wV(),Minutes:NV(),Month:RV(),Seconds:$V(),Year:MV()}});var KV=P((UIe,WV)=>{"use strict";var bw=Ke(),ise=xi(),{style:UV,clear:zV,figures:ase}=rn(),{erase:ose,cursor:BV}=qe(),{DatePart:GV,Meridiem:sse,Day:cse,Hours:use,Milliseconds:lse,Minutes:dse,Month:pse,Seconds:mse,Year:fse}=LV(),hse=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,VV={1:({token:e})=>e.replace(/\\(.)/g,"$1"),2:e=>new cse(e),3:e=>new pse(e),4:e=>new fse(e),5:e=>new sse(e),6:e=>new use(e),7:e=>new dse(e),8:e=>new mse(e),9:e=>new lse(e)},gse={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")},Sw=class extends ise{constructor(t={}){super(t),this.msg=t.message,this.cursor=0,this.typed="",this.locales=Object.assign(gse,t.locales),this._date=t.initial||new Date,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.mask=t.mask||"YYYY-MM-DD HH:mm:ss",this.clear=zV("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(t){t&&this._date.setTime(t.getTime())}set mask(t){let r;for(this.parts=[];r=hse.exec(t);){let n=r.shift(),a=r.findIndex(o=>o!=null);this.parts.push(a in VV?VV[a]({token:r[a]||n,date:this.date,parts:this.parts,locales:this.locales}):r[a]||n)}let i=this.parts.reduce((n,a)=>(typeof a=="string"&&typeof n[n.length-1]=="string"?n[n.length-1]+=a:n.push(a),n),[]);this.parts.splice(0),this.parts.push(...i),this.reset()}moveCursor(t){this.typed="",this.cursor=t,this.fire()}reset(){this.moveCursor(this.parts.findIndex(t=>t instanceof GV)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
167
167
|
`),this.close()}async validate(){let t=await this.validator(this.value);typeof t=="string"&&(this.errorMsg=t,t=!1),this.error=!t}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
168
168
|
`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let t=this.parts[this.cursor].prev();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}right(){let t=this.parts[this.cursor].next();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}next(){let t=this.parts[this.cursor].next();this.moveCursor(t?this.parts.indexOf(t):this.parts.findIndex(r=>r instanceof GV)),this.render()}_(t){/\d/.test(t)&&(this.typed+=t,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(BV.hide):this.out.write(zV(this.outputText,this.out.columns)),super.render(),this.outputText=[UV.symbol(this.done,this.aborted),bw.bold(this.msg),UV.delimiter(!1),this.parts.reduce((t,r,i)=>t.concat(i===this.cursor&&!this.done?bw.cyan().underline(r.toString()):r),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
169
169
|
`).reduce((t,r,i)=>t+`
|
|
170
|
-
${i?" ":ase.pointerSmall} ${bw.red().italic(r)}`,"")),this.out.write(ose.line+BV.to(0)+this.outputText))}};WV.exports=Sw});var JV=P((
|
|
170
|
+
${i?" ":ase.pointerSmall} ${bw.red().italic(r)}`,"")),this.out.write(ose.line+BV.to(0)+this.outputText))}};WV.exports=Sw});var JV=P((zIe,HV)=>{var Ly=Ke(),yse=xi(),{cursor:Uy,erase:vse}=qe(),{style:Ew,figures:bse,clear:qV,lines:Sse}=rn(),Ese=/[0-9]/,xw=e=>e!==void 0,ZV=(e,t)=>{let r=Math.pow(10,t);return Math.round(e*r)/r},Aw=class extends yse{constructor(t={}){super(t),this.transform=Ew.render(t.style),this.msg=t.message,this.initial=xw(t.initial)?t.initial:"",this.float=!!t.float,this.round=t.round||2,this.inc=t.increment||1,this.min=xw(t.min)?t.min:-1/0,this.max=xw(t.max)?t.max:1/0,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(t){!t&&t!==0?(this.placeholder=!0,this.rendered=Ly.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${ZV(t,this.round)}`),this._value=ZV(t,this.round)),this.fire()}get value(){return this._value}parse(t){return this.float?parseFloat(t):parseInt(t)}valid(t){return t==="-"||t==="."&&this.float||Ese.test(t)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let t=this.value;this.value=t!==""?t:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
171
171
|
`),this.close()}async validate(){let t=await this.validator(this.value);typeof t=="string"&&(this.errorMsg=t,t=!1),this.error=!t}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let t=this.value;this.value=t!==""?t:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
172
172
|
`),this.close()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let t=this.value.toString();if(t.length===0)return this.bell();this.value=this.parse(t=t.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(t,r){if(!this.valid(t))return this.bell();let i=Date.now();if(i-this.lastHit>1e3&&(this.typed=""),this.typed+=t,this.lastHit=i,this.color="cyan",t===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Uy.down(Sse(this.outputError,this.out.columns)-1)+qV(this.outputError,this.out.columns)),this.out.write(qV(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Ew.symbol(this.done,this.aborted),Ly.bold(this.msg),Ew.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Ly[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
173
173
|
`).reduce((t,r,i)=>t+`
|
|
174
|
-
${i?" ":bse.pointerSmall} ${Ly.red().italic(r)}`,"")),this.out.write(vse.line+Uy.to(0)+this.outputText+Uy.save+this.outputError+Uy.restore))}};HV.exports=Aw});var Tw=P((
|
|
174
|
+
${i?" ":bse.pointerSmall} ${Ly.red().italic(r)}`,"")),this.out.write(vse.line+Uy.to(0)+this.outputText+Uy.save+this.outputError+Uy.restore))}};HV.exports=Aw});var Tw=P((BIe,QV)=>{"use strict";var On=Ke(),{cursor:xse}=qe(),Ase=xi(),{clear:XV,figures:la,style:YV,wrap:_se,entriesToDisplay:Tse}=rn(),_w=class extends Ase{constructor(t={}){super(t),this.msg=t.message,this.cursor=t.cursor||0,this.scrollIndex=t.cursor||0,this.hint=t.hint||"",this.warn=t.warn||"- This option is disabled -",this.minSelected=t.min,this.showMinError=!1,this.maxChoices=t.max,this.instructions=t.instructions,this.optionsPerPage=t.optionsPerPage||10,this.value=t.choices.map((r,i)=>(typeof r=="string"&&(r={title:r,value:i}),{title:r&&(r.title||r.value||r),description:r&&r.description,value:r&&(r.value===void 0?i:r.value),selected:r&&r.selected,disabled:r&&r.disabled})),this.clear=XV("",this.out.columns),t.overrideRender||this.render()}reset(){this.value.map(t=>!t.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(t=>t.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
175
175
|
`),this.close()}submit(){let t=this.value.filter(r=>r.selected);this.minSelected&&t.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
176
176
|
`),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let t=this.value[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(r=>r.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let t=!this.value[this.cursor].selected;this.value.filter(r=>!r.disabled).forEach(r=>r.selected=t),this.render()}_(t,r){if(t===" ")this.handleSpaceToggle();else if(t==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
177
177
|
Instructions:
|
|
@@ -181,13 +181,13 @@ Instructions:
|
|
|
181
181
|
`:"")+" enter/return: Complete answer":""}renderOption(t,r,i,n){let a=(r.selected?On.green(la.radioOn):la.radioOff)+" "+n+" ",o,s;return r.disabled?o=t===i?On.gray().underline(r.title):On.strikethrough().gray(r.title):(o=t===i?On.cyan().underline(r.title):r.title,t===i&&r.description&&(s=` - ${r.description}`,(a.length+o.length+s.length>=this.out.columns||r.description.split(/\r?\n/).length>1)&&(s=`
|
|
182
182
|
`+_se(r.description,{margin:a.length,width:this.out.columns})))),a+o+On.gray(s||"")}paginateOptions(t){if(t.length===0)return On.red("No matches for this query.");let{startIndex:r,endIndex:i}=Tse(this.cursor,t.length,this.optionsPerPage),n,a=[];for(let o=r;o<i;o++)o===r&&r>0?n=la.arrowUp:o===i-1&&i<t.length?n=la.arrowDown:n=" ",a.push(this.renderOption(this.cursor,t[o],o,n));return`
|
|
183
183
|
`+a.join(`
|
|
184
|
-
`)}renderOptions(t){return this.done?"":this.paginateOptions(t)}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let t=[On.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(On.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(xse.hide),super.render();let t=[YV.symbol(this.done,this.aborted),On.bold(this.msg),YV.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=On.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.value),this.out.write(this.clear+t),this.clear=XV(t,this.out.columns)}};QV.exports=_w});var i3=P((
|
|
184
|
+
`)}renderOptions(t){return this.done?"":this.paginateOptions(t)}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let t=[On.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(On.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(xse.hide),super.render();let t=[YV.symbol(this.done,this.aborted),On.bold(this.msg),YV.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=On.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.value),this.out.write(this.clear+t),this.clear=XV(t,this.out.columns)}};QV.exports=_w});var i3=P((GIe,n3)=>{"use strict";var ep=Ke(),Cse=xi(),{erase:Ise,cursor:e3}=qe(),{style:Cw,clear:t3,figures:Iw,wrap:Dse,entriesToDisplay:wse}=rn(),r3=(e,t)=>e[t]&&(e[t].value||e[t].title||e[t]),kse=(e,t)=>e[t]&&(e[t].title||e[t].value||e[t]),Nse=(e,t)=>{let r=e.findIndex(i=>i.value===t||i.title===t);return r>-1?r:void 0},Dw=class extends Cse{constructor(t={}){super(t),this.msg=t.message,this.suggest=t.suggest,this.choices=t.choices,this.initial=typeof t.initial=="number"?t.initial:Nse(t.choices,t.initial),this.select=this.initial||t.cursor||0,this.i18n={noMatches:t.noMatches||"no matches found"},this.fallback=t.fallback||this.initial,this.clearFirst=t.clearFirst||!1,this.suggestions=[],this.input="",this.limit=t.limit||10,this.cursor=0,this.transform=Cw.render(t.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=t3("",this.out.columns),this.complete(this.render),this.render()}set fallback(t){this._fb=Number.isSafeInteger(parseInt(t))?parseInt(t):t}get fallback(){let t;return typeof this._fb=="number"?t=this.choices[this._fb]:typeof this._fb=="string"&&(t={title:this._fb}),t||this._fb||{title:this.i18n.noMatches}}moveSelect(t){this.select=t,this.suggestions.length>0?this.value=r3(this.suggestions,t):this.value=this.fallback.value,this.fire()}async complete(t){let r=this.completing=this.suggest(this.input,this.choices),i=await r;if(this.completing!==r)return;this.suggestions=i.map((a,o,s)=>({title:kse(s,o),value:r3(s,o),description:a.description})),this.completing=!1;let n=Math.max(i.length-1,0);this.moveSelect(Math.min(n,this.select)),t&&t()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
185
185
|
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
186
186
|
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
187
187
|
`),this.close()}_(t,r){let i=this.input.slice(0,this.cursor),n=this.input.slice(this.cursor);this.input=`${i}${t}${n}`,this.cursor=i.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let t=this.input.slice(0,this.cursor-1),r=this.input.slice(this.cursor);this.input=`${t}${r}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let t=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor+1);this.input=`${t}${r}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(t,r,i,n){let a,o=i?Iw.arrowUp:n?Iw.arrowDown:" ",s=r?ep.cyan().underline(t.title):t.title;return o=(r?ep.cyan(Iw.pointer)+" ":" ")+o,t.description&&(a=` - ${t.description}`,(o.length+s.length+a.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(a=`
|
|
188
188
|
`+Dse(t.description,{margin:3,width:this.out.columns}))),o+" "+s+ep.gray(a||"")}render(){if(this.closed)return;this.firstRender?this.out.write(e3.hide):this.out.write(t3(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:r}=wse(this.select,this.choices.length,this.limit);if(this.outputText=[Cw.symbol(this.done,this.aborted,this.exited),ep.bold(this.msg),Cw.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let i=this.suggestions.slice(t,r).map((n,a)=>this.renderOption(n,this.select===a+t,a===0&&t>0,a+t===r-1&&r<this.choices.length)).join(`
|
|
189
189
|
`);this.outputText+=`
|
|
190
|
-
`+(i||ep.gray(this.fallback.title))}this.out.write(Ise.line+e3.to(0)+this.outputText)}};n3.exports=Dw});var c3=P((
|
|
190
|
+
`+(i||ep.gray(this.fallback.title))}this.out.write(Ise.line+e3.to(0)+this.outputText)}};n3.exports=Dw});var c3=P((VIe,s3)=>{"use strict";var _i=Ke(),{cursor:Pse}=qe(),Rse=Tw(),{clear:a3,style:o3,figures:Kc}=rn(),ww=class extends Rse{constructor(t={}){t.overrideRender=!0,super(t),this.inputValue="",this.clear=a3("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let t=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(i=>this.inputValue?!!(typeof i.title=="string"&&i.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof i.value=="string"&&i.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let r=this.filteredOptions.findIndex(i=>i===t);this.cursor=r<0?0:r,this.render()}handleSpaceToggle(){let t=this.filteredOptions[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(r=>r.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}handleInputChange(t){this.inputValue=this.inputValue+t,this.updateFilteredOptions()}_(t,r){t===" "?this.handleSpaceToggle():this.handleInputChange(t)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
191
191
|
Instructions:
|
|
192
192
|
${Kc.arrowUp}/${Kc.arrowDown}: Highlight option
|
|
193
193
|
${Kc.arrowLeft}/${Kc.arrowRight}/[space]: Toggle selection
|
|
@@ -195,9 +195,9 @@ Instructions:
|
|
|
195
195
|
enter/return: Complete answer
|
|
196
196
|
`:""}renderCurrentInput(){return`
|
|
197
197
|
Filtered results for: ${this.inputValue?this.inputValue:_i.gray("Enter something to filter")}
|
|
198
|
-
`}renderOption(t,r,i){let n;return r.disabled?n=t===i?_i.gray().underline(r.title):_i.strikethrough().gray(r.title):n=t===i?_i.cyan().underline(r.title):r.title,(r.selected?_i.green(Kc.radioOn):Kc.radioOff)+" "+n}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let t=[_i.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(_i.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Pse.hide),super.render();let t=[o3.symbol(this.done,this.aborted),_i.bold(this.msg),o3.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=_i.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+t),this.clear=a3(t,this.out.columns)}};s3.exports=ww});var m3=P((
|
|
198
|
+
`}renderOption(t,r,i){let n;return r.disabled?n=t===i?_i.gray().underline(r.title):_i.strikethrough().gray(r.title):n=t===i?_i.cyan().underline(r.title):r.title,(r.selected?_i.green(Kc.radioOn):Kc.radioOff)+" "+n}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let t=[_i.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(_i.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Pse.hide),super.render();let t=[o3.symbol(this.done,this.aborted),_i.bold(this.msg),o3.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=_i.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+t),this.clear=a3(t,this.out.columns)}};s3.exports=ww});var m3=P((WIe,p3)=>{var u3=Ke(),Ose=xi(),{style:l3,clear:$se}=rn(),{erase:jse,cursor:d3}=qe(),kw=class extends Ose{constructor(t={}){super(t),this.msg=t.message,this.value=t.initial,this.initialValue=!!t.initial,this.yesMsg=t.yes||"yes",this.yesOption=t.yesOption||"(Y/n)",this.noMsg=t.no||"no",this.noOption=t.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
199
199
|
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
200
|
-
`),this.close()}_(t,r){return t.toLowerCase()==="y"?(this.value=!0,this.submit()):t.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(d3.hide):this.out.write($se(this.outputText,this.out.columns)),super.render(),this.outputText=[l3.symbol(this.done,this.aborted),u3.bold(this.msg),l3.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:u3.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(jse.line+d3.to(0)+this.outputText))}};p3.exports=kw});var h3=P((VIe,f3)=>{"use strict";f3.exports={TextPrompt:pV(),SelectPrompt:gV(),TogglePrompt:SV(),DatePrompt:KV(),NumberPrompt:JV(),MultiselectPrompt:Tw(),AutocompletePrompt:i3(),AutocompleteMultiselectPrompt:c3(),ConfirmPrompt:m3()}});var y3=P(g3=>{"use strict";var Xt=g3,Mse=h3(),zy=e=>e;function $n(e,t,r={}){return new Promise((i,n)=>{let a=new Mse[e](t),o=r.onAbort||zy,s=r.onSubmit||zy,u=r.onExit||zy;a.on("state",t.onState||zy),a.on("submit",d=>i(s(d))),a.on("exit",d=>i(u(d))),a.on("abort",d=>n(o(d)))})}Xt.text=e=>$n("TextPrompt",e);Xt.password=e=>(e.style="password",Xt.text(e));Xt.invisible=e=>(e.style="invisible",Xt.text(e));Xt.number=e=>$n("NumberPrompt",e);Xt.date=e=>$n("DatePrompt",e);Xt.confirm=e=>$n("ConfirmPrompt",e);Xt.list=e=>{let t=e.separator||",";return $n("TextPrompt",e,{onSubmit:r=>r.split(t).map(i=>i.trim())})};Xt.toggle=e=>$n("TogglePrompt",e);Xt.select=e=>$n("SelectPrompt",e);Xt.multiselect=e=>{e.choices=[].concat(e.choices||[]);let t=r=>r.filter(i=>i.selected).map(i=>i.value);return $n("MultiselectPrompt",e,{onAbort:t,onSubmit:t})};Xt.autocompleteMultiselect=e=>{e.choices=[].concat(e.choices||[]);let t=r=>r.filter(i=>i.selected).map(i=>i.value);return $n("AutocompleteMultiselectPrompt",e,{onAbort:t,onSubmit:t})};var Fse=(e,t)=>Promise.resolve(t.filter(r=>r.title.slice(0,e.length).toLowerCase()===e.toLowerCase()));Xt.autocomplete=e=>(e.suggest=e.suggest||Fse,e.choices=[].concat(e.choices||[]),$n("AutocompletePrompt",e))});var S3=P((KIe,b3)=>{"use strict";var Nw=y3(),Lse=["suggest","format","onState","validate","onRender","type"],v3=()=>{};async function da(e=[],{onSubmit:t=v3,onCancel:r=v3}={}){let i={},n=da._override||{};e=[].concat(e);let a,o,s,u,d,p,h=async(g,l,m=!1)=>{if(!(!m&&g.validate&&g.validate(l)!==!0))return g.format?await g.format(l,i):l};for(o of e)if({name:u,type:d}=o,typeof d=="function"&&(d=await d(a,{...i},o),o.type=d),!!d){for(let g in o){if(Lse.includes(g))continue;let l=o[g];o[g]=typeof l=="function"?await l(a,{...i},p):l}if(p=o,typeof o.message!="string")throw new Error("prompt message is required");if({name:u,type:d}=o,Nw[d]===void 0)throw new Error(`prompt type (${d}) is not defined`);if(n[o.name]!==void 0&&(a=await h(o,n[o.name]),a!==void 0)){i[u]=a;continue}try{a=da._injected?Use(da._injected,o.initial):await Nw[d](o),i[u]=a=await h(o,a,!0),s=await t(o,a,i)}catch{s=!await r(o,i)}if(s)return i}return i}function Use(e,t){let r=e.shift();if(r instanceof Error)throw r;return r===void 0?t:r}function zse(e){da._injected=(da._injected||[]).concat(e)}function Bse(e){da._override=Object.assign({},e)}b3.exports=Object.assign(da,{prompt:da,prompts:Nw,inject:zse,override:Bse})});var x3=P((qIe,E3)=>{function Gse(e){e=(Array.isArray(e)?e:e.split(".")).map(Number);let t=0,r=process.versions.node.split(".").map(Number);for(;t<e.length;t++){if(r[t]>e[t])return!1;if(e[t]>r[t])return!0}return!1}E3.exports=Gse("8.6.0")?KG():S3()});import{join as Sr,dirname as j1,normalize as S9}from"node:path";import{readFileSync as M1,existsSync as F1}from"node:fs";var N3=Object.defineProperty,Ci=(e,t)=>N3(e,"name",{value:t,configurable:!0});function ct(e){return e.replace(/[-_](.)/g,(t,r)=>r.toUpperCase()).replace(/^./,t=>t.toUpperCase())}Ci(ct,"toPascalCase");function gr(e){return e.replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").replace(/([a-z\d])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}Ci(gr,"toKebab");function Ro(e){return gr(e).replace(/-/g,"_")}Ci(Ro,"toValidDatabaseName");function Fw(e){return gr(e).replace(/-/g,"_").toUpperCase()}Ci(Fw,"toScreamingSnake");function Lw(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}Ci(Lw,"capitalise");function Uw(e){return e.split(".").join("")}Ci(Uw,"getSafeZoneName");function fa(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}Ci(fa,"accountConstructKey");function zw(e){let t=e.replace(new RegExp("\\P{ASCII}","gu"),"");return fa(t)===fa(e)&&fa(e)!==""}Ci(zw,"hasAsciiStableConstructKey");var P3=Object.defineProperty,Oo=(e,t)=>P3(e,"name",{value:t,configurable:!0});function $o(e){return`${ct(e.split(".").join(""))}Domain`}Oo($o,"getDomainStackName");function Bw(e){return`${e}UsEast1Certificates`}Oo(Bw,"getDomainUsEast1CertificatesStackName");function Jy(e){let t=e.replace(/\./g,"-");return{hostedZoneId:`${t}-hosted-zone-id`,certificateArn:`${t}-certificate-arn`,certificateHosts:`${t}-certificate-hosts`,usEast1CertificateArn:`${t}-us-east-1-certificate-arn`,usEast1CertificateHosts:`${t}-us-east-1-certificate-hosts`,delegationRoleArn:`${t}-delegation-role-arn`,nameservers:`${t}-nameservers`}}Oo(Jy,"getDomainExportNames");var Gw=1e3;function Vw(e){let t=[],r=[];for(let i of e){let n=[...r,i];r.length>0&&Buffer.byteLength(JSON.stringify(n),"utf8")>Gw?(t.push(r),r=[i]):r=n}return r.length>0&&t.push(r),t.map(i=>JSON.stringify(i))}Oo(Vw,"serialiseHostsChunks");function Ww(e,t){return`${e}-${t}`}Oo(Ww,"hostsExportPartName");function Kw(e){return typeof e.hostedZoneId=="string"}Oo(Kw,"isManagedDomainBinding");var R3=Object.defineProperty,O3=(e,t)=>R3(e,"name",{value:t,configurable:!0});function qw(e){return`${ct(e)}ImageTag`}O3(qw,"imageTagParameterName");var $3=Object.defineProperty,zn=(e,t)=>$3(e,"name",{value:t,configurable:!0});function ha(e){return ct(e.replace(/[^A-Za-z0-9-]/g,""))}zn(ha,"safeExportToken");function Xy(e,t){let r=ha(e);return t===void 0?r:`${r}-${ha(t)}-`}zn(Xy,"albExportScope");function Zw(e,t){return`${Xy(e,t)}AlbDnsName`}zn(Zw,"albDnsExportName");function Hw(e,t){return`${Xy(e,t)}AlbHostedZoneId`}zn(Hw,"albHostedZoneIdExportName");function Jw(e,t){let r=ha(e);return t===void 0?r:`${r}-${ha(t)}-`}zn(Jw,"cdnExportScope");function Xw(e,t){return`${Jw(e,t)}CdnDistributionDomainName`}zn(Xw,"cdnDomainExportName");function Yy(e,t){return`${ha(e)}-${ha(t)}-`}zn(Yy,"bucketExportScope");function Yw(e,t){return`${Yy(e,t)}WebsiteEndpoint`}zn(Yw,"bucketWebsiteEndpointExportName");function Qw(e,t){return`${Yy(e,t)}WebsiteHostedZoneId`}zn(Qw,"bucketWebsiteHostedZoneIdExportName");var c={};Ur(c,{$brand:()=>ev,$input:()=>ES,$output:()=>SS,NEVER:()=>Qy,TimePrecision:()=>TS,ZodAny:()=>fx,ZodArray:()=>vx,ZodBase64:()=>Fm,ZodBase64URL:()=>Lm,ZodBigInt:()=>ps,ZodBigIntFormat:()=>Bm,ZodBoolean:()=>ds,ZodCIDRv4:()=>jm,ZodCIDRv6:()=>Mm,ZodCUID:()=>wm,ZodCUID2:()=>km,ZodCatch:()=>Ux,ZodCodec:()=>Cu,ZodCustom:()=>Iu,ZodCustomStringFormat:()=>us,ZodDate:()=>Eu,ZodDefault:()=>Ox,ZodDiscriminatedUnion:()=>Sx,ZodE164:()=>Um,ZodEmail:()=>Cm,ZodEmoji:()=>Im,ZodEnum:()=>ss,ZodError:()=>pq,ZodExactOptional:()=>Nx,ZodFile:()=>wx,ZodFirstPartyTypeKind:()=>Qx,ZodFunction:()=>Jx,ZodGUID:()=>gu,ZodIPv4:()=>Om,ZodIPv6:()=>$m,ZodISODate:()=>Sm,ZodISODateTime:()=>bm,ZodISODuration:()=>xm,ZodISOTime:()=>Em,ZodIntersection:()=>Ex,ZodIssueCode:()=>fq,ZodJWT:()=>zm,ZodKSUID:()=>Rm,ZodLazy:()=>qx,ZodLiteral:()=>Dx,ZodMAC:()=>sx,ZodMap:()=>Cx,ZodNaN:()=>Bx,ZodNanoID:()=>Dm,ZodNever:()=>gx,ZodNonOptional:()=>Zm,ZodNull:()=>px,ZodNullable:()=>Rx,ZodNumber:()=>ls,ZodNumberFormat:()=>_a,ZodObject:()=>Au,ZodOptional:()=>qm,ZodPipe:()=>Tu,ZodPrefault:()=>jx,ZodPreprocess:()=>Gx,ZodPromise:()=>Hx,ZodReadonly:()=>Vx,ZodRealError:()=>Lt,ZodRecord:()=>os,ZodSet:()=>Ix,ZodString:()=>cs,ZodStringFormat:()=>Ie,ZodSuccess:()=>Lx,ZodSymbol:()=>lx,ZodTemplateLiteral:()=>Kx,ZodTransform:()=>kx,ZodTuple:()=>Ax,ZodType:()=>re,ZodULID:()=>Nm,ZodURL:()=>Su,ZodUUID:()=>sn,ZodUndefined:()=>dx,ZodUnion:()=>_u,ZodUnknown:()=>hx,ZodVoid:()=>yx,ZodXID:()=>Pm,ZodXor:()=>bx,_ZodString:()=>Tm,_default:()=>$x,_function:()=>zP,any:()=>vP,array:()=>xu,base64:()=>tP,base64url:()=>rP,bigint:()=>mP,boolean:()=>ux,catch:()=>zx,check:()=>BP,cidrv4:()=>QN,cidrv6:()=>eP,clone:()=>Ct,codec:()=>MP,coerce:()=>eA,config:()=>Ze,core:()=>Vn,cuid:()=>WN,cuid2:()=>KN,custom:()=>GP,date:()=>SP,decode:()=>ex,decodeAsync:()=>rx,describe:()=>VP,discriminatedUnion:()=>CP,e164:()=>nP,email:()=>$N,emoji:()=>GN,encode:()=>QE,encodeAsync:()=>tx,endsWith:()=>Jo,enum:()=>Wm,exactOptional:()=>Px,file:()=>RP,flattenError:()=>ru,float32:()=>uP,float64:()=>lP,formatError:()=>nu,fromJSONSchema:()=>XP,function:()=>zP,getErrorMap:()=>gq,globalRegistry:()=>mt,gt:()=>an,gte:()=>Dt,guid:()=>jN,hash:()=>cP,hex:()=>sP,hostname:()=>oP,httpUrl:()=>BN,includes:()=>Zo,instanceof:()=>KP,int:()=>Am,int32:()=>dP,int64:()=>fP,intersection:()=>xx,invertCodec:()=>FP,ipv4:()=>JN,ipv6:()=>YN,iso:()=>as,json:()=>ZP,jwt:()=>iP,keyof:()=>EP,ksuid:()=>HN,lazy:()=>Zx,length:()=>xa,literal:()=>PP,locales:()=>du,looseObject:()=>_P,looseRecord:()=>DP,lowercase:()=>Ko,lt:()=>nn,lte:()=>er,mac:()=>XN,map:()=>wP,maxLength:()=>Ea,maxSize:()=>Ri,meta:()=>WP,mime:()=>Xo,minLength:()=>Gn,minSize:()=>on,multipleOf:()=>Pi,nan:()=>jP,nanoid:()=>VN,nativeEnum:()=>NP,negative:()=>um,never:()=>Gm,nonnegative:()=>dm,nonoptional:()=>Fx,nonpositive:()=>lm,normalize:()=>Yo,null:()=>mx,nullable:()=>vu,nullish:()=>OP,number:()=>cx,object:()=>xP,optional:()=>yu,overwrite:()=>Br,parse:()=>HE,parseAsync:()=>JE,partialRecord:()=>IP,pipe:()=>_m,positive:()=>cm,prefault:()=>Mx,preprocess:()=>HP,prettifyError:()=>mv,promise:()=>UP,property:()=>pm,readonly:()=>Wx,record:()=>Tx,refine:()=>Xx,regex:()=>Wo,regexes:()=>Qt,registry:()=>zp,safeDecode:()=>ix,safeDecodeAsync:()=>ox,safeEncode:()=>nx,safeEncodeAsync:()=>ax,safeParse:()=>XE,safeParseAsync:()=>YE,set:()=>kP,setErrorMap:()=>hq,size:()=>Sa,slugify:()=>rs,startsWith:()=>Ho,strictObject:()=>AP,string:()=>hu,stringFormat:()=>aP,stringbool:()=>qP,success:()=>$P,superRefine:()=>Yx,symbol:()=>gP,templateLiteral:()=>LP,toJSONSchema:()=>gm,toLowerCase:()=>es,toUpperCase:()=>ts,transform:()=>Km,treeifyError:()=>pv,trim:()=>Qo,tuple:()=>_x,uint32:()=>pP,uint64:()=>hP,ulid:()=>qN,undefined:()=>yP,union:()=>Vm,unknown:()=>Aa,uppercase:()=>qo,url:()=>zN,util:()=>M,uuid:()=>MN,uuidv4:()=>FN,uuidv6:()=>LN,uuidv7:()=>UN,void:()=>bP,xid:()=>ZN,xor:()=>TP});var Vn={};Ur(Vn,{$ZodAny:()=>Bb,$ZodArray:()=>qb,$ZodAsyncError:()=>zr,$ZodBase64:()=>Pb,$ZodBase64URL:()=>Rb,$ZodBigInt:()=>Rp,$ZodBigIntFormat:()=>Fb,$ZodBoolean:()=>su,$ZodCIDRv4:()=>wb,$ZodCIDRv6:()=>kb,$ZodCUID:()=>yb,$ZodCUID2:()=>vb,$ZodCatch:()=>dS,$ZodCheck:()=>we,$ZodCheckBigIntFormat:()=>qv,$ZodCheckEndsWith:()=>ab,$ZodCheckGreaterThan:()=>Ip,$ZodCheckIncludes:()=>nb,$ZodCheckLengthEquals:()=>Qv,$ZodCheckLessThan:()=>Cp,$ZodCheckLowerCase:()=>tb,$ZodCheckMaxLength:()=>Xv,$ZodCheckMaxSize:()=>Zv,$ZodCheckMimeType:()=>sb,$ZodCheckMinLength:()=>Yv,$ZodCheckMinSize:()=>Hv,$ZodCheckMultipleOf:()=>Wv,$ZodCheckNumberFormat:()=>Kv,$ZodCheckOverwrite:()=>cb,$ZodCheckProperty:()=>ob,$ZodCheckRegex:()=>eb,$ZodCheckSizeEquals:()=>Jv,$ZodCheckStartsWith:()=>ib,$ZodCheckStringFormat:()=>Go,$ZodCheckUpperCase:()=>rb,$ZodCodec:()=>uu,$ZodCustom:()=>bS,$ZodCustomStringFormat:()=>jb,$ZodDate:()=>Kb,$ZodDefault:()=>sS,$ZodDiscriminatedUnion:()=>Jb,$ZodE164:()=>Ob,$ZodEmail:()=>mb,$ZodEmoji:()=>hb,$ZodEncodeError:()=>Ii,$ZodEnum:()=>tS,$ZodError:()=>tu,$ZodExactOptional:()=>aS,$ZodFile:()=>nS,$ZodFunction:()=>gS,$ZodGUID:()=>db,$ZodIPv4:()=>Cb,$ZodIPv6:()=>Ib,$ZodISODate:()=>Ab,$ZodISODateTime:()=>xb,$ZodISODuration:()=>Tb,$ZodISOTime:()=>_b,$ZodIntersection:()=>Xb,$ZodJWT:()=>$b,$ZodKSUID:()=>Eb,$ZodLazy:()=>vS,$ZodLiteral:()=>rS,$ZodMAC:()=>Db,$ZodMap:()=>Qb,$ZodNaN:()=>pS,$ZodNanoID:()=>gb,$ZodNever:()=>Vb,$ZodNonOptional:()=>uS,$ZodNull:()=>zb,$ZodNullable:()=>oS,$ZodNumber:()=>Pp,$ZodNumberFormat:()=>Mb,$ZodObject:()=>kk,$ZodObjectJIT:()=>Zb,$ZodOptional:()=>$p,$ZodPipe:()=>jp,$ZodPrefault:()=>cS,$ZodPreprocess:()=>mS,$ZodPromise:()=>yS,$ZodReadonly:()=>fS,$ZodRealError:()=>Ft,$ZodRecord:()=>Yb,$ZodRegistry:()=>Up,$ZodSet:()=>eS,$ZodString:()=>ba,$ZodStringFormat:()=>Ce,$ZodSuccess:()=>lS,$ZodSymbol:()=>Lb,$ZodTemplateLiteral:()=>hS,$ZodTransform:()=>iS,$ZodTuple:()=>Op,$ZodType:()=>ee,$ZodULID:()=>bb,$ZodURL:()=>fb,$ZodUUID:()=>pb,$ZodUndefined:()=>Ub,$ZodUnion:()=>cu,$ZodUnknown:()=>Gb,$ZodVoid:()=>Wb,$ZodXID:()=>Sb,$ZodXor:()=>Hb,$brand:()=>ev,$constructor:()=>T,$input:()=>ES,$output:()=>SS,Doc:()=>ou,JSONSchema:()=>PN,JSONSchemaGenerator:()=>ym,NEVER:()=>Qy,TimePrecision:()=>TS,_any:()=>KS,_array:()=>QS,_base64:()=>im,_base64url:()=>am,_bigint:()=>LS,_boolean:()=>MS,_catch:()=>iq,_check:()=>NN,_cidrv4:()=>rm,_cidrv6:()=>nm,_coercedBigint:()=>US,_coercedBoolean:()=>FS,_coercedDate:()=>XS,_coercedNumber:()=>NS,_coercedString:()=>AS,_cuid:()=>Hp,_cuid2:()=>Jp,_custom:()=>tE,_date:()=>JS,_decode:()=>yp,_decodeAsync:()=>bp,_default:()=>tq,_discriminatedUnion:()=>GK,_e164:()=>om,_email:()=>Bp,_emoji:()=>qp,_encode:()=>gp,_encodeAsync:()=>vp,_endsWith:()=>Jo,_enum:()=>HK,_file:()=>eE,_float32:()=>RS,_float64:()=>OS,_gt:()=>an,_gte:()=>Dt,_guid:()=>pu,_includes:()=>Zo,_int:()=>PS,_int32:()=>$S,_int64:()=>zS,_intersection:()=>VK,_ipv4:()=>em,_ipv6:()=>tm,_isoDate:()=>IS,_isoDateTime:()=>CS,_isoDuration:()=>wS,_isoTime:()=>DS,_jwt:()=>sm,_ksuid:()=>Qp,_lazy:()=>cq,_length:()=>xa,_literal:()=>XK,_lowercase:()=>Ko,_lt:()=>nn,_lte:()=>er,_mac:()=>_S,_map:()=>qK,_max:()=>er,_maxLength:()=>Ea,_maxSize:()=>Ri,_mime:()=>Xo,_min:()=>Dt,_minLength:()=>Gn,_minSize:()=>on,_multipleOf:()=>Pi,_nan:()=>YS,_nanoid:()=>Zp,_nativeEnum:()=>JK,_negative:()=>um,_never:()=>ZS,_nonnegative:()=>dm,_nonoptional:()=>rq,_nonpositive:()=>lm,_normalize:()=>Yo,_null:()=>WS,_nullable:()=>eq,_number:()=>kS,_optional:()=>QK,_overwrite:()=>Br,_parse:()=>Lo,_parseAsync:()=>Uo,_pipe:()=>aq,_positive:()=>cm,_promise:()=>uq,_property:()=>pm,_readonly:()=>oq,_record:()=>KK,_refine:()=>rE,_regex:()=>Wo,_safeDecode:()=>Ep,_safeDecodeAsync:()=>Ap,_safeEncode:()=>Sp,_safeEncodeAsync:()=>xp,_safeParse:()=>zo,_safeParseAsync:()=>Bo,_set:()=>ZK,_size:()=>Sa,_slugify:()=>rs,_startsWith:()=>Ho,_string:()=>xS,_stringFormat:()=>ns,_stringbool:()=>oE,_success:()=>nq,_superRefine:()=>nE,_symbol:()=>GS,_templateLiteral:()=>sq,_toLowerCase:()=>es,_toUpperCase:()=>ts,_transform:()=>YK,_trim:()=>Qo,_tuple:()=>WK,_uint32:()=>jS,_uint64:()=>BS,_ulid:()=>Xp,_undefined:()=>VS,_union:()=>zK,_unknown:()=>qS,_uppercase:()=>qo,_url:()=>mu,_uuid:()=>Gp,_uuidv4:()=>Vp,_uuidv6:()=>Wp,_uuidv7:()=>Kp,_void:()=>HS,_xid:()=>Yp,_xor:()=>BK,clone:()=>Ct,config:()=>Ze,createStandardJSONSchemaMethod:()=>is,createToJSONSchemaMethod:()=>sE,decode:()=>uW,decodeAsync:()=>dW,describe:()=>iE,encode:()=>cW,encodeAsync:()=>lW,extractDefs:()=>$i,finalize:()=>ji,flattenError:()=>ru,formatError:()=>nu,globalConfig:()=>ga,globalRegistry:()=>mt,initializeContext:()=>Oi,isValidBase64:()=>Nb,isValidBase64URL:()=>Ck,isValidJWT:()=>Ik,locales:()=>du,meta:()=>aE,parse:()=>fp,parseAsync:()=>hp,prettifyError:()=>mv,process:()=>Ee,regexes:()=>Qt,registry:()=>zp,safeDecode:()=>mW,safeDecodeAsync:()=>hW,safeEncode:()=>pW,safeEncodeAsync:()=>fW,safeParse:()=>fv,safeParseAsync:()=>hv,toDotPath:()=>ak,toJSONSchema:()=>gm,treeifyError:()=>pv,util:()=>M,version:()=>ub});var ek,Qy=Object.freeze({status:"aborted"});function T(e,t,r){function i(s,u){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:u,constr:o,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,u);let d=o.prototype,p=Object.keys(d);for(let h=0;h<p.length;h++){let g=p[h];g in s||(s[g]=d[g].bind(s))}}let n=r?.Parent??Object;class a extends n{}Object.defineProperty(a,"name",{value:e});function o(s){var u;let d=r?.Parent?new a:this;i(d,s),(u=d._zod).deferred??(u.deferred=[]);for(let p of d._zod.deferred)p();return d}return Object.defineProperty(o,"init",{value:i}),Object.defineProperty(o,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var ev=Symbol("zod_brand"),zr=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Ii=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(ek=globalThis).__zod_globalConfig??(ek.__zod_globalConfig={});var ga=globalThis.__zod_globalConfig;function Ze(e){return e&&Object.assign(ga,e),ga}var M={};Ur(M,{BIGINT_FORMAT_RANGES:()=>lv,Class:()=>rv,NUMBER_FORMAT_RANGES:()=>uv,aborted:()=>Ni,allowsEval:()=>av,assert:()=>U3,assertEqual:()=>j3,assertIs:()=>F3,assertNever:()=>L3,assertNotEqual:()=>M3,assignProp:()=>wi,base64ToUint8Array:()=>rk,base64urlToUint8Array:()=>nW,cached:()=>Mo,captureStackTrace:()=>mp,cleanEnum:()=>rW,cleanRegex:()=>Xc,clone:()=>Ct,cloneDef:()=>B3,createTransparentProxy:()=>Z3,defineLazy:()=>ue,esc:()=>pp,escapeRegex:()=>yr,explicitlyAborted:()=>dv,extend:()=>X3,finalizeIssue:()=>It,floatSafeRemainder:()=>nv,getElementAtPath:()=>G3,getEnumValues:()=>Jc,getLengthableOrigin:()=>eu,getParsedType:()=>q3,getSizableOrigin:()=>Qc,hexToUint8Array:()=>aW,isObject:()=>ya,isPlainObject:()=>ki,issue:()=>Fo,joinValues:()=>D,jsonStringifyReplacer:()=>jo,merge:()=>Q3,mergeDefs:()=>Bn,normalizeParams:()=>L,nullish:()=>Di,numKeys:()=>K3,objectClone:()=>z3,omit:()=>J3,optionalKeys:()=>cv,parsedType:()=>j,partial:()=>eW,pick:()=>H3,prefixIssues:()=>Mt,primitiveTypes:()=>sv,promiseAllObject:()=>V3,propertyKeyTypes:()=>Yc,randomString:()=>W3,required:()=>tW,safeExtend:()=>Y3,shallowClone:()=>ov,slugify:()=>iv,stringifyPrimitive:()=>O,uint8ArrayToBase64:()=>nk,uint8ArrayToBase64url:()=>iW,uint8ArrayToHex:()=>oW,unwrapMessage:()=>Hc});function j3(e){return e}function M3(e){return e}function F3(e){}function L3(e){throw new Error("Unexpected value in exhaustive check")}function U3(e){}function Jc(e){let t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,n])=>t.indexOf(+i)===-1).map(([i,n])=>n)}function D(e,t="|"){return e.map(r=>O(r)).join(t)}function jo(e,t){return typeof t=="bigint"?t.toString():t}function Mo(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Di(e){return e==null}function Xc(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function nv(e,t){let r=e/t,i=Math.round(r),n=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-i)<n?0:r-i}var tk=Symbol("evaluating");function ue(e,t,r){let i;Object.defineProperty(e,t,{get(){if(i!==tk)return i===void 0&&(i=tk,i=r()),i},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function z3(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function wi(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Bn(...e){let t={};for(let r of e){let i=Object.getOwnPropertyDescriptors(r);Object.assign(t,i)}return Object.defineProperties({},t)}function B3(e){return Bn(e._zod.def)}function G3(e,t){return t?t.reduce((r,i)=>r?.[i],e):e}function V3(e){let t=Object.keys(e),r=t.map(i=>e[i]);return Promise.all(r).then(i=>{let n={};for(let a=0;a<t.length;a++)n[t[a]]=i[a];return n})}function W3(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let i=0;i<e;i++)r+=t[Math.floor(Math.random()*t.length)];return r}function pp(e){return JSON.stringify(e)}function iv(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var mp="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ya(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var av=Mo(()=>{if(ga.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function ki(e){if(ya(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(ya(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function ov(e){return ki(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function K3(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var q3=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Yc=new Set(["string","number","symbol"]),sv=new Set(["string","number","bigint","boolean","symbol","undefined"]);function yr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ct(e,t,r){let i=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(i._zod.parent=e),i}function L(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Z3(e){let t;return new Proxy({},{get(r,i,n){return t??(t=e()),Reflect.get(t,i,n)},set(r,i,n,a){return t??(t=e()),Reflect.set(t,i,n,a)},has(r,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(r,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(r,i,n){return t??(t=e()),Reflect.defineProperty(t,i,n)}})}function O(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function cv(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var uv={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},lv={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function H3(e,t){let r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let a=Bn(e._zod.def,{get shape(){let o={};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(o[s]=r.shape[s])}return wi(this,"shape",o),o},checks:[]});return Ct(e,a)}function J3(e,t){let r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let a=Bn(e._zod.def,{get shape(){let o={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete o[s]}return wi(this,"shape",o),o},checks:[]});return Ct(e,a)}function X3(e,t){if(!ki(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let a=e._zod.def.shape;for(let o in t)if(Object.getOwnPropertyDescriptor(a,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=Bn(e._zod.def,{get shape(){let a={...e._zod.def.shape,...t};return wi(this,"shape",a),a}});return Ct(e,n)}function Y3(e,t){if(!ki(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Bn(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return wi(this,"shape",i),i}});return Ct(e,r)}function Q3(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=Bn(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t._zod.def.shape};return wi(this,"shape",i),i},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Ct(e,r)}function eW(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let o=Bn(t._zod.def,{get shape(){let s=t._zod.def.shape,u={...s};if(r)for(let d in r){if(!(d in s))throw new Error(`Unrecognized key: "${d}"`);r[d]&&(u[d]=e?new e({type:"optional",innerType:s[d]}):s[d])}else for(let d in s)u[d]=e?new e({type:"optional",innerType:s[d]}):s[d];return wi(this,"shape",u),u},checks:[]});return Ct(t,o)}function tW(e,t,r){let i=Bn(t._zod.def,{get shape(){let n=t._zod.def.shape,a={...n};if(r)for(let o in r){if(!(o in a))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(a[o]=new e({type:"nonoptional",innerType:n[o]}))}else for(let o in n)a[o]=new e({type:"nonoptional",innerType:n[o]});return wi(this,"shape",a),a}});return Ct(t,i)}function Ni(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function dv(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function Mt(e,t){return t.map(r=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(e),r})}function Hc(e){return typeof e=="string"?e:e?.message}function It(e,t,r){let i=e.message?e.message:Hc(e.inst?._zod.def?.error?.(e))??Hc(t?.error?.(e))??Hc(r.customError?.(e))??Hc(r.localeError?.(e))??"Invalid input",{inst:n,continue:a,input:o,...s}=e;return s.path??(s.path=[]),s.message=i,t?.reportInput&&(s.input=o),s}function Qc(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function eu(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function j(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Fo(...e){let[t,r,i]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:i}:{...t}}function rW(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function rk(e){let t=atob(e),r=new Uint8Array(t.length);for(let i=0;i<t.length;i++)r[i]=t.charCodeAt(i);return r}function nk(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function nW(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return rk(t+r)}function iW(e){return nk(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function aW(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let i=0;i<t.length;i+=2)r[i/2]=Number.parseInt(t.slice(i,i+2),16);return r}function oW(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var rv=class{constructor(...t){}};var ik=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,jo,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},tu=T("$ZodError",ik),Ft=T("$ZodError",ik,{Parent:Error});function ru(e,t=r=>r.message){let r={},i=[];for(let n of e.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n))):i.push(t(n));return{formErrors:i,fieldErrors:r}}function nu(e,t=r=>r.message){let r={_errors:[]},i=(n,a=[])=>{for(let o of n.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(s=>i({issues:s},[...a,...o.path]));else if(o.code==="invalid_key")i({issues:o.issues},[...a,...o.path]);else if(o.code==="invalid_element")i({issues:o.issues},[...a,...o.path]);else{let s=[...a,...o.path];if(s.length===0)r._errors.push(t(o));else{let u=r,d=0;for(;d<s.length;){let p=s[d];d===s.length-1?(u[p]=u[p]||{_errors:[]},u[p]._errors.push(t(o))):u[p]=u[p]||{_errors:[]},u=u[p],d++}}}};return i(e),r}function pv(e,t=r=>r.message){let r={errors:[]},i=(n,a=[])=>{var o,s;for(let u of n.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(d=>i({issues:d},[...a,...u.path]));else if(u.code==="invalid_key")i({issues:u.issues},[...a,...u.path]);else if(u.code==="invalid_element")i({issues:u.issues},[...a,...u.path]);else{let d=[...a,...u.path];if(d.length===0){r.errors.push(t(u));continue}let p=r,h=0;for(;h<d.length;){let g=d[h],l=h===d.length-1;typeof g=="string"?(p.properties??(p.properties={}),(o=p.properties)[g]??(o[g]={errors:[]}),p=p.properties[g]):(p.items??(p.items=[]),(s=p.items)[g]??(s[g]={errors:[]}),p=p.items[g]),l&&p.errors.push(t(u)),h++}}};return i(e),r}function ak(e){let t=[],r=e.map(i=>typeof i=="object"?i.key:i);for(let i of r)typeof i=="number"?t.push(`[${i}]`):typeof i=="symbol"?t.push(`[${JSON.stringify(String(i))}]`):/[^\w$]/.test(i)?t.push(`[${JSON.stringify(i)}]`):(t.length&&t.push("."),t.push(i));return t.join("")}function mv(e){let t=[],r=[...e.issues].sort((i,n)=>(i.path??[]).length-(n.path??[]).length);for(let i of r)t.push(`\u2716 ${i.message}`),i.path?.length&&t.push(` \u2192 at ${ak(i.path)}`);return t.join(`
|
|
200
|
+
`),this.close()}_(t,r){return t.toLowerCase()==="y"?(this.value=!0,this.submit()):t.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(d3.hide):this.out.write($se(this.outputText,this.out.columns)),super.render(),this.outputText=[l3.symbol(this.done,this.aborted),u3.bold(this.msg),l3.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:u3.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(jse.line+d3.to(0)+this.outputText))}};p3.exports=kw});var h3=P((KIe,f3)=>{"use strict";f3.exports={TextPrompt:pV(),SelectPrompt:gV(),TogglePrompt:SV(),DatePrompt:KV(),NumberPrompt:JV(),MultiselectPrompt:Tw(),AutocompletePrompt:i3(),AutocompleteMultiselectPrompt:c3(),ConfirmPrompt:m3()}});var y3=P(g3=>{"use strict";var Xt=g3,Mse=h3(),zy=e=>e;function $n(e,t,r={}){return new Promise((i,n)=>{let a=new Mse[e](t),o=r.onAbort||zy,s=r.onSubmit||zy,u=r.onExit||zy;a.on("state",t.onState||zy),a.on("submit",d=>i(s(d))),a.on("exit",d=>i(u(d))),a.on("abort",d=>n(o(d)))})}Xt.text=e=>$n("TextPrompt",e);Xt.password=e=>(e.style="password",Xt.text(e));Xt.invisible=e=>(e.style="invisible",Xt.text(e));Xt.number=e=>$n("NumberPrompt",e);Xt.date=e=>$n("DatePrompt",e);Xt.confirm=e=>$n("ConfirmPrompt",e);Xt.list=e=>{let t=e.separator||",";return $n("TextPrompt",e,{onSubmit:r=>r.split(t).map(i=>i.trim())})};Xt.toggle=e=>$n("TogglePrompt",e);Xt.select=e=>$n("SelectPrompt",e);Xt.multiselect=e=>{e.choices=[].concat(e.choices||[]);let t=r=>r.filter(i=>i.selected).map(i=>i.value);return $n("MultiselectPrompt",e,{onAbort:t,onSubmit:t})};Xt.autocompleteMultiselect=e=>{e.choices=[].concat(e.choices||[]);let t=r=>r.filter(i=>i.selected).map(i=>i.value);return $n("AutocompleteMultiselectPrompt",e,{onAbort:t,onSubmit:t})};var Fse=(e,t)=>Promise.resolve(t.filter(r=>r.title.slice(0,e.length).toLowerCase()===e.toLowerCase()));Xt.autocomplete=e=>(e.suggest=e.suggest||Fse,e.choices=[].concat(e.choices||[]),$n("AutocompletePrompt",e))});var S3=P((ZIe,b3)=>{"use strict";var Nw=y3(),Lse=["suggest","format","onState","validate","onRender","type"],v3=()=>{};async function da(e=[],{onSubmit:t=v3,onCancel:r=v3}={}){let i={},n=da._override||{};e=[].concat(e);let a,o,s,u,d,p,h=async(g,l,m=!1)=>{if(!(!m&&g.validate&&g.validate(l)!==!0))return g.format?await g.format(l,i):l};for(o of e)if({name:u,type:d}=o,typeof d=="function"&&(d=await d(a,{...i},o),o.type=d),!!d){for(let g in o){if(Lse.includes(g))continue;let l=o[g];o[g]=typeof l=="function"?await l(a,{...i},p):l}if(p=o,typeof o.message!="string")throw new Error("prompt message is required");if({name:u,type:d}=o,Nw[d]===void 0)throw new Error(`prompt type (${d}) is not defined`);if(n[o.name]!==void 0&&(a=await h(o,n[o.name]),a!==void 0)){i[u]=a;continue}try{a=da._injected?Use(da._injected,o.initial):await Nw[d](o),i[u]=a=await h(o,a,!0),s=await t(o,a,i)}catch{s=!await r(o,i)}if(s)return i}return i}function Use(e,t){let r=e.shift();if(r instanceof Error)throw r;return r===void 0?t:r}function zse(e){da._injected=(da._injected||[]).concat(e)}function Bse(e){da._override=Object.assign({},e)}b3.exports=Object.assign(da,{prompt:da,prompts:Nw,inject:zse,override:Bse})});var x3=P((HIe,E3)=>{function Gse(e){e=(Array.isArray(e)?e:e.split(".")).map(Number);let t=0,r=process.versions.node.split(".").map(Number);for(;t<e.length;t++){if(r[t]>e[t])return!1;if(e[t]>r[t])return!0}return!1}E3.exports=Gse("8.6.0")?KG():S3()});import{join as Sr,dirname as j1,normalize as S9}from"node:path";import{readFileSync as M1,existsSync as F1}from"node:fs";var N3=Object.defineProperty,Ci=(e,t)=>N3(e,"name",{value:t,configurable:!0});function ct(e){return e.replace(/[-_](.)/g,(t,r)=>r.toUpperCase()).replace(/^./,t=>t.toUpperCase())}Ci(ct,"toPascalCase");function gr(e){return e.replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").replace(/([a-z\d])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}Ci(gr,"toKebab");function Ro(e){return gr(e).replace(/-/g,"_")}Ci(Ro,"toValidDatabaseName");function Fw(e){return gr(e).replace(/-/g,"_").toUpperCase()}Ci(Fw,"toScreamingSnake");function Lw(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}Ci(Lw,"capitalise");function Uw(e){return e.split(".").join("")}Ci(Uw,"getSafeZoneName");function fa(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}Ci(fa,"accountConstructKey");function zw(e){let t=e.replace(new RegExp("\\P{ASCII}","gu"),"");return fa(t)===fa(e)&&fa(e)!==""}Ci(zw,"hasAsciiStableConstructKey");var P3=Object.defineProperty,Oo=(e,t)=>P3(e,"name",{value:t,configurable:!0});function $o(e){return`${ct(e.split(".").join(""))}Domain`}Oo($o,"getDomainStackName");function Bw(e){return`${e}UsEast1Certificates`}Oo(Bw,"getDomainUsEast1CertificatesStackName");function Jy(e){let t=e.replace(/\./g,"-");return{hostedZoneId:`${t}-hosted-zone-id`,certificateArn:`${t}-certificate-arn`,certificateHosts:`${t}-certificate-hosts`,usEast1CertificateArn:`${t}-us-east-1-certificate-arn`,usEast1CertificateHosts:`${t}-us-east-1-certificate-hosts`,delegationRoleArn:`${t}-delegation-role-arn`,nameservers:`${t}-nameservers`}}Oo(Jy,"getDomainExportNames");var Gw=1e3;function Vw(e){let t=[],r=[];for(let i of e){let n=[...r,i];r.length>0&&Buffer.byteLength(JSON.stringify(n),"utf8")>Gw?(t.push(r),r=[i]):r=n}return r.length>0&&t.push(r),t.map(i=>JSON.stringify(i))}Oo(Vw,"serialiseHostsChunks");function Ww(e,t){return`${e}-${t}`}Oo(Ww,"hostsExportPartName");function Kw(e){return typeof e.hostedZoneId=="string"}Oo(Kw,"isManagedDomainBinding");var R3=Object.defineProperty,O3=(e,t)=>R3(e,"name",{value:t,configurable:!0});function qw(e){return`${ct(e)}ImageTag`}O3(qw,"imageTagParameterName");var $3=Object.defineProperty,zn=(e,t)=>$3(e,"name",{value:t,configurable:!0});function ha(e){return ct(e.replace(/[^A-Za-z0-9-]/g,""))}zn(ha,"safeExportToken");function Xy(e,t){let r=ha(e);return t===void 0?r:`${r}-${ha(t)}-`}zn(Xy,"albExportScope");function Zw(e,t){return`${Xy(e,t)}AlbDnsName`}zn(Zw,"albDnsExportName");function Hw(e,t){return`${Xy(e,t)}AlbHostedZoneId`}zn(Hw,"albHostedZoneIdExportName");function Jw(e,t){let r=ha(e);return t===void 0?r:`${r}-${ha(t)}-`}zn(Jw,"cdnExportScope");function Xw(e,t){return`${Jw(e,t)}CdnDistributionDomainName`}zn(Xw,"cdnDomainExportName");function Yy(e,t){return`${ha(e)}-${ha(t)}-`}zn(Yy,"bucketExportScope");function Yw(e,t){return`${Yy(e,t)}WebsiteEndpoint`}zn(Yw,"bucketWebsiteEndpointExportName");function Qw(e,t){return`${Yy(e,t)}WebsiteHostedZoneId`}zn(Qw,"bucketWebsiteHostedZoneIdExportName");var c={};Ur(c,{$brand:()=>ev,$input:()=>ES,$output:()=>SS,NEVER:()=>Qy,TimePrecision:()=>TS,ZodAny:()=>fx,ZodArray:()=>vx,ZodBase64:()=>Fm,ZodBase64URL:()=>Lm,ZodBigInt:()=>ps,ZodBigIntFormat:()=>Bm,ZodBoolean:()=>ds,ZodCIDRv4:()=>jm,ZodCIDRv6:()=>Mm,ZodCUID:()=>wm,ZodCUID2:()=>km,ZodCatch:()=>Ux,ZodCodec:()=>Cu,ZodCustom:()=>Iu,ZodCustomStringFormat:()=>us,ZodDate:()=>Eu,ZodDefault:()=>Ox,ZodDiscriminatedUnion:()=>Sx,ZodE164:()=>Um,ZodEmail:()=>Cm,ZodEmoji:()=>Im,ZodEnum:()=>ss,ZodError:()=>pq,ZodExactOptional:()=>Nx,ZodFile:()=>wx,ZodFirstPartyTypeKind:()=>Qx,ZodFunction:()=>Jx,ZodGUID:()=>gu,ZodIPv4:()=>Om,ZodIPv6:()=>$m,ZodISODate:()=>Sm,ZodISODateTime:()=>bm,ZodISODuration:()=>xm,ZodISOTime:()=>Em,ZodIntersection:()=>Ex,ZodIssueCode:()=>fq,ZodJWT:()=>zm,ZodKSUID:()=>Rm,ZodLazy:()=>qx,ZodLiteral:()=>Dx,ZodMAC:()=>sx,ZodMap:()=>Cx,ZodNaN:()=>Bx,ZodNanoID:()=>Dm,ZodNever:()=>gx,ZodNonOptional:()=>Zm,ZodNull:()=>px,ZodNullable:()=>Rx,ZodNumber:()=>ls,ZodNumberFormat:()=>_a,ZodObject:()=>Au,ZodOptional:()=>qm,ZodPipe:()=>Tu,ZodPrefault:()=>jx,ZodPreprocess:()=>Gx,ZodPromise:()=>Hx,ZodReadonly:()=>Vx,ZodRealError:()=>Lt,ZodRecord:()=>os,ZodSet:()=>Ix,ZodString:()=>cs,ZodStringFormat:()=>Ie,ZodSuccess:()=>Lx,ZodSymbol:()=>lx,ZodTemplateLiteral:()=>Kx,ZodTransform:()=>kx,ZodTuple:()=>Ax,ZodType:()=>re,ZodULID:()=>Nm,ZodURL:()=>Su,ZodUUID:()=>sn,ZodUndefined:()=>dx,ZodUnion:()=>_u,ZodUnknown:()=>hx,ZodVoid:()=>yx,ZodXID:()=>Pm,ZodXor:()=>bx,_ZodString:()=>Tm,_default:()=>$x,_function:()=>zP,any:()=>vP,array:()=>xu,base64:()=>tP,base64url:()=>rP,bigint:()=>mP,boolean:()=>ux,catch:()=>zx,check:()=>BP,cidrv4:()=>QN,cidrv6:()=>eP,clone:()=>Ct,codec:()=>MP,coerce:()=>eA,config:()=>Ze,core:()=>Vn,cuid:()=>WN,cuid2:()=>KN,custom:()=>GP,date:()=>SP,decode:()=>ex,decodeAsync:()=>rx,describe:()=>VP,discriminatedUnion:()=>CP,e164:()=>nP,email:()=>$N,emoji:()=>GN,encode:()=>QE,encodeAsync:()=>tx,endsWith:()=>Jo,enum:()=>Wm,exactOptional:()=>Px,file:()=>RP,flattenError:()=>ru,float32:()=>uP,float64:()=>lP,formatError:()=>nu,fromJSONSchema:()=>XP,function:()=>zP,getErrorMap:()=>gq,globalRegistry:()=>mt,gt:()=>an,gte:()=>Dt,guid:()=>jN,hash:()=>cP,hex:()=>sP,hostname:()=>oP,httpUrl:()=>BN,includes:()=>Zo,instanceof:()=>KP,int:()=>Am,int32:()=>dP,int64:()=>fP,intersection:()=>xx,invertCodec:()=>FP,ipv4:()=>JN,ipv6:()=>YN,iso:()=>as,json:()=>ZP,jwt:()=>iP,keyof:()=>EP,ksuid:()=>HN,lazy:()=>Zx,length:()=>xa,literal:()=>PP,locales:()=>du,looseObject:()=>_P,looseRecord:()=>DP,lowercase:()=>Ko,lt:()=>nn,lte:()=>er,mac:()=>XN,map:()=>wP,maxLength:()=>Ea,maxSize:()=>Ri,meta:()=>WP,mime:()=>Xo,minLength:()=>Gn,minSize:()=>on,multipleOf:()=>Pi,nan:()=>jP,nanoid:()=>VN,nativeEnum:()=>NP,negative:()=>um,never:()=>Gm,nonnegative:()=>dm,nonoptional:()=>Fx,nonpositive:()=>lm,normalize:()=>Yo,null:()=>mx,nullable:()=>vu,nullish:()=>OP,number:()=>cx,object:()=>xP,optional:()=>yu,overwrite:()=>Br,parse:()=>HE,parseAsync:()=>JE,partialRecord:()=>IP,pipe:()=>_m,positive:()=>cm,prefault:()=>Mx,preprocess:()=>HP,prettifyError:()=>mv,promise:()=>UP,property:()=>pm,readonly:()=>Wx,record:()=>Tx,refine:()=>Xx,regex:()=>Wo,regexes:()=>Qt,registry:()=>zp,safeDecode:()=>ix,safeDecodeAsync:()=>ox,safeEncode:()=>nx,safeEncodeAsync:()=>ax,safeParse:()=>XE,safeParseAsync:()=>YE,set:()=>kP,setErrorMap:()=>hq,size:()=>Sa,slugify:()=>rs,startsWith:()=>Ho,strictObject:()=>AP,string:()=>hu,stringFormat:()=>aP,stringbool:()=>qP,success:()=>$P,superRefine:()=>Yx,symbol:()=>gP,templateLiteral:()=>LP,toJSONSchema:()=>gm,toLowerCase:()=>es,toUpperCase:()=>ts,transform:()=>Km,treeifyError:()=>pv,trim:()=>Qo,tuple:()=>_x,uint32:()=>pP,uint64:()=>hP,ulid:()=>qN,undefined:()=>yP,union:()=>Vm,unknown:()=>Aa,uppercase:()=>qo,url:()=>zN,util:()=>M,uuid:()=>MN,uuidv4:()=>FN,uuidv6:()=>LN,uuidv7:()=>UN,void:()=>bP,xid:()=>ZN,xor:()=>TP});var Vn={};Ur(Vn,{$ZodAny:()=>Bb,$ZodArray:()=>qb,$ZodAsyncError:()=>zr,$ZodBase64:()=>Pb,$ZodBase64URL:()=>Rb,$ZodBigInt:()=>Rp,$ZodBigIntFormat:()=>Fb,$ZodBoolean:()=>su,$ZodCIDRv4:()=>wb,$ZodCIDRv6:()=>kb,$ZodCUID:()=>yb,$ZodCUID2:()=>vb,$ZodCatch:()=>dS,$ZodCheck:()=>we,$ZodCheckBigIntFormat:()=>qv,$ZodCheckEndsWith:()=>ab,$ZodCheckGreaterThan:()=>Ip,$ZodCheckIncludes:()=>nb,$ZodCheckLengthEquals:()=>Qv,$ZodCheckLessThan:()=>Cp,$ZodCheckLowerCase:()=>tb,$ZodCheckMaxLength:()=>Xv,$ZodCheckMaxSize:()=>Zv,$ZodCheckMimeType:()=>sb,$ZodCheckMinLength:()=>Yv,$ZodCheckMinSize:()=>Hv,$ZodCheckMultipleOf:()=>Wv,$ZodCheckNumberFormat:()=>Kv,$ZodCheckOverwrite:()=>cb,$ZodCheckProperty:()=>ob,$ZodCheckRegex:()=>eb,$ZodCheckSizeEquals:()=>Jv,$ZodCheckStartsWith:()=>ib,$ZodCheckStringFormat:()=>Go,$ZodCheckUpperCase:()=>rb,$ZodCodec:()=>uu,$ZodCustom:()=>bS,$ZodCustomStringFormat:()=>jb,$ZodDate:()=>Kb,$ZodDefault:()=>sS,$ZodDiscriminatedUnion:()=>Jb,$ZodE164:()=>Ob,$ZodEmail:()=>mb,$ZodEmoji:()=>hb,$ZodEncodeError:()=>Ii,$ZodEnum:()=>tS,$ZodError:()=>tu,$ZodExactOptional:()=>aS,$ZodFile:()=>nS,$ZodFunction:()=>gS,$ZodGUID:()=>db,$ZodIPv4:()=>Cb,$ZodIPv6:()=>Ib,$ZodISODate:()=>Ab,$ZodISODateTime:()=>xb,$ZodISODuration:()=>Tb,$ZodISOTime:()=>_b,$ZodIntersection:()=>Xb,$ZodJWT:()=>$b,$ZodKSUID:()=>Eb,$ZodLazy:()=>vS,$ZodLiteral:()=>rS,$ZodMAC:()=>Db,$ZodMap:()=>Qb,$ZodNaN:()=>pS,$ZodNanoID:()=>gb,$ZodNever:()=>Vb,$ZodNonOptional:()=>uS,$ZodNull:()=>zb,$ZodNullable:()=>oS,$ZodNumber:()=>Pp,$ZodNumberFormat:()=>Mb,$ZodObject:()=>kk,$ZodObjectJIT:()=>Zb,$ZodOptional:()=>$p,$ZodPipe:()=>jp,$ZodPrefault:()=>cS,$ZodPreprocess:()=>mS,$ZodPromise:()=>yS,$ZodReadonly:()=>fS,$ZodRealError:()=>Ft,$ZodRecord:()=>Yb,$ZodRegistry:()=>Up,$ZodSet:()=>eS,$ZodString:()=>ba,$ZodStringFormat:()=>Ce,$ZodSuccess:()=>lS,$ZodSymbol:()=>Lb,$ZodTemplateLiteral:()=>hS,$ZodTransform:()=>iS,$ZodTuple:()=>Op,$ZodType:()=>ee,$ZodULID:()=>bb,$ZodURL:()=>fb,$ZodUUID:()=>pb,$ZodUndefined:()=>Ub,$ZodUnion:()=>cu,$ZodUnknown:()=>Gb,$ZodVoid:()=>Wb,$ZodXID:()=>Sb,$ZodXor:()=>Hb,$brand:()=>ev,$constructor:()=>T,$input:()=>ES,$output:()=>SS,Doc:()=>ou,JSONSchema:()=>PN,JSONSchemaGenerator:()=>ym,NEVER:()=>Qy,TimePrecision:()=>TS,_any:()=>KS,_array:()=>QS,_base64:()=>im,_base64url:()=>am,_bigint:()=>LS,_boolean:()=>MS,_catch:()=>iq,_check:()=>NN,_cidrv4:()=>rm,_cidrv6:()=>nm,_coercedBigint:()=>US,_coercedBoolean:()=>FS,_coercedDate:()=>XS,_coercedNumber:()=>NS,_coercedString:()=>AS,_cuid:()=>Hp,_cuid2:()=>Jp,_custom:()=>tE,_date:()=>JS,_decode:()=>yp,_decodeAsync:()=>bp,_default:()=>tq,_discriminatedUnion:()=>GK,_e164:()=>om,_email:()=>Bp,_emoji:()=>qp,_encode:()=>gp,_encodeAsync:()=>vp,_endsWith:()=>Jo,_enum:()=>HK,_file:()=>eE,_float32:()=>RS,_float64:()=>OS,_gt:()=>an,_gte:()=>Dt,_guid:()=>pu,_includes:()=>Zo,_int:()=>PS,_int32:()=>$S,_int64:()=>zS,_intersection:()=>VK,_ipv4:()=>em,_ipv6:()=>tm,_isoDate:()=>IS,_isoDateTime:()=>CS,_isoDuration:()=>wS,_isoTime:()=>DS,_jwt:()=>sm,_ksuid:()=>Qp,_lazy:()=>cq,_length:()=>xa,_literal:()=>XK,_lowercase:()=>Ko,_lt:()=>nn,_lte:()=>er,_mac:()=>_S,_map:()=>qK,_max:()=>er,_maxLength:()=>Ea,_maxSize:()=>Ri,_mime:()=>Xo,_min:()=>Dt,_minLength:()=>Gn,_minSize:()=>on,_multipleOf:()=>Pi,_nan:()=>YS,_nanoid:()=>Zp,_nativeEnum:()=>JK,_negative:()=>um,_never:()=>ZS,_nonnegative:()=>dm,_nonoptional:()=>rq,_nonpositive:()=>lm,_normalize:()=>Yo,_null:()=>WS,_nullable:()=>eq,_number:()=>kS,_optional:()=>QK,_overwrite:()=>Br,_parse:()=>Lo,_parseAsync:()=>Uo,_pipe:()=>aq,_positive:()=>cm,_promise:()=>uq,_property:()=>pm,_readonly:()=>oq,_record:()=>KK,_refine:()=>rE,_regex:()=>Wo,_safeDecode:()=>Ep,_safeDecodeAsync:()=>Ap,_safeEncode:()=>Sp,_safeEncodeAsync:()=>xp,_safeParse:()=>zo,_safeParseAsync:()=>Bo,_set:()=>ZK,_size:()=>Sa,_slugify:()=>rs,_startsWith:()=>Ho,_string:()=>xS,_stringFormat:()=>ns,_stringbool:()=>oE,_success:()=>nq,_superRefine:()=>nE,_symbol:()=>GS,_templateLiteral:()=>sq,_toLowerCase:()=>es,_toUpperCase:()=>ts,_transform:()=>YK,_trim:()=>Qo,_tuple:()=>WK,_uint32:()=>jS,_uint64:()=>BS,_ulid:()=>Xp,_undefined:()=>VS,_union:()=>zK,_unknown:()=>qS,_uppercase:()=>qo,_url:()=>mu,_uuid:()=>Gp,_uuidv4:()=>Vp,_uuidv6:()=>Wp,_uuidv7:()=>Kp,_void:()=>HS,_xid:()=>Yp,_xor:()=>BK,clone:()=>Ct,config:()=>Ze,createStandardJSONSchemaMethod:()=>is,createToJSONSchemaMethod:()=>sE,decode:()=>uW,decodeAsync:()=>dW,describe:()=>iE,encode:()=>cW,encodeAsync:()=>lW,extractDefs:()=>$i,finalize:()=>ji,flattenError:()=>ru,formatError:()=>nu,globalConfig:()=>ga,globalRegistry:()=>mt,initializeContext:()=>Oi,isValidBase64:()=>Nb,isValidBase64URL:()=>Ck,isValidJWT:()=>Ik,locales:()=>du,meta:()=>aE,parse:()=>fp,parseAsync:()=>hp,prettifyError:()=>mv,process:()=>Ee,regexes:()=>Qt,registry:()=>zp,safeDecode:()=>mW,safeDecodeAsync:()=>hW,safeEncode:()=>pW,safeEncodeAsync:()=>fW,safeParse:()=>fv,safeParseAsync:()=>hv,toDotPath:()=>ak,toJSONSchema:()=>gm,treeifyError:()=>pv,util:()=>M,version:()=>ub});var ek,Qy=Object.freeze({status:"aborted"});function T(e,t,r){function i(s,u){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:u,constr:o,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,u);let d=o.prototype,p=Object.keys(d);for(let h=0;h<p.length;h++){let g=p[h];g in s||(s[g]=d[g].bind(s))}}let n=r?.Parent??Object;class a extends n{}Object.defineProperty(a,"name",{value:e});function o(s){var u;let d=r?.Parent?new a:this;i(d,s),(u=d._zod).deferred??(u.deferred=[]);for(let p of d._zod.deferred)p();return d}return Object.defineProperty(o,"init",{value:i}),Object.defineProperty(o,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var ev=Symbol("zod_brand"),zr=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Ii=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(ek=globalThis).__zod_globalConfig??(ek.__zod_globalConfig={});var ga=globalThis.__zod_globalConfig;function Ze(e){return e&&Object.assign(ga,e),ga}var M={};Ur(M,{BIGINT_FORMAT_RANGES:()=>lv,Class:()=>rv,NUMBER_FORMAT_RANGES:()=>uv,aborted:()=>Ni,allowsEval:()=>av,assert:()=>U3,assertEqual:()=>j3,assertIs:()=>F3,assertNever:()=>L3,assertNotEqual:()=>M3,assignProp:()=>wi,base64ToUint8Array:()=>rk,base64urlToUint8Array:()=>nW,cached:()=>Mo,captureStackTrace:()=>mp,cleanEnum:()=>rW,cleanRegex:()=>Xc,clone:()=>Ct,cloneDef:()=>B3,createTransparentProxy:()=>Z3,defineLazy:()=>ue,esc:()=>pp,escapeRegex:()=>yr,explicitlyAborted:()=>dv,extend:()=>X3,finalizeIssue:()=>It,floatSafeRemainder:()=>nv,getElementAtPath:()=>G3,getEnumValues:()=>Jc,getLengthableOrigin:()=>eu,getParsedType:()=>q3,getSizableOrigin:()=>Qc,hexToUint8Array:()=>aW,isObject:()=>ya,isPlainObject:()=>ki,issue:()=>Fo,joinValues:()=>D,jsonStringifyReplacer:()=>jo,merge:()=>Q3,mergeDefs:()=>Bn,normalizeParams:()=>L,nullish:()=>Di,numKeys:()=>K3,objectClone:()=>z3,omit:()=>J3,optionalKeys:()=>cv,parsedType:()=>j,partial:()=>eW,pick:()=>H3,prefixIssues:()=>Mt,primitiveTypes:()=>sv,promiseAllObject:()=>V3,propertyKeyTypes:()=>Yc,randomString:()=>W3,required:()=>tW,safeExtend:()=>Y3,shallowClone:()=>ov,slugify:()=>iv,stringifyPrimitive:()=>O,uint8ArrayToBase64:()=>nk,uint8ArrayToBase64url:()=>iW,uint8ArrayToHex:()=>oW,unwrapMessage:()=>Hc});function j3(e){return e}function M3(e){return e}function F3(e){}function L3(e){throw new Error("Unexpected value in exhaustive check")}function U3(e){}function Jc(e){let t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,n])=>t.indexOf(+i)===-1).map(([i,n])=>n)}function D(e,t="|"){return e.map(r=>O(r)).join(t)}function jo(e,t){return typeof t=="bigint"?t.toString():t}function Mo(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Di(e){return e==null}function Xc(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function nv(e,t){let r=e/t,i=Math.round(r),n=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-i)<n?0:r-i}var tk=Symbol("evaluating");function ue(e,t,r){let i;Object.defineProperty(e,t,{get(){if(i!==tk)return i===void 0&&(i=tk,i=r()),i},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function z3(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function wi(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Bn(...e){let t={};for(let r of e){let i=Object.getOwnPropertyDescriptors(r);Object.assign(t,i)}return Object.defineProperties({},t)}function B3(e){return Bn(e._zod.def)}function G3(e,t){return t?t.reduce((r,i)=>r?.[i],e):e}function V3(e){let t=Object.keys(e),r=t.map(i=>e[i]);return Promise.all(r).then(i=>{let n={};for(let a=0;a<t.length;a++)n[t[a]]=i[a];return n})}function W3(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let i=0;i<e;i++)r+=t[Math.floor(Math.random()*t.length)];return r}function pp(e){return JSON.stringify(e)}function iv(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var mp="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ya(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var av=Mo(()=>{if(ga.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function ki(e){if(ya(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(ya(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function ov(e){return ki(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function K3(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var q3=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Yc=new Set(["string","number","symbol"]),sv=new Set(["string","number","bigint","boolean","symbol","undefined"]);function yr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ct(e,t,r){let i=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(i._zod.parent=e),i}function L(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Z3(e){let t;return new Proxy({},{get(r,i,n){return t??(t=e()),Reflect.get(t,i,n)},set(r,i,n,a){return t??(t=e()),Reflect.set(t,i,n,a)},has(r,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(r,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(r,i,n){return t??(t=e()),Reflect.defineProperty(t,i,n)}})}function O(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function cv(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var uv={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},lv={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function H3(e,t){let r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let a=Bn(e._zod.def,{get shape(){let o={};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(o[s]=r.shape[s])}return wi(this,"shape",o),o},checks:[]});return Ct(e,a)}function J3(e,t){let r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let a=Bn(e._zod.def,{get shape(){let o={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete o[s]}return wi(this,"shape",o),o},checks:[]});return Ct(e,a)}function X3(e,t){if(!ki(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let a=e._zod.def.shape;for(let o in t)if(Object.getOwnPropertyDescriptor(a,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=Bn(e._zod.def,{get shape(){let a={...e._zod.def.shape,...t};return wi(this,"shape",a),a}});return Ct(e,n)}function Y3(e,t){if(!ki(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Bn(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return wi(this,"shape",i),i}});return Ct(e,r)}function Q3(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=Bn(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t._zod.def.shape};return wi(this,"shape",i),i},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Ct(e,r)}function eW(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let o=Bn(t._zod.def,{get shape(){let s=t._zod.def.shape,u={...s};if(r)for(let d in r){if(!(d in s))throw new Error(`Unrecognized key: "${d}"`);r[d]&&(u[d]=e?new e({type:"optional",innerType:s[d]}):s[d])}else for(let d in s)u[d]=e?new e({type:"optional",innerType:s[d]}):s[d];return wi(this,"shape",u),u},checks:[]});return Ct(t,o)}function tW(e,t,r){let i=Bn(t._zod.def,{get shape(){let n=t._zod.def.shape,a={...n};if(r)for(let o in r){if(!(o in a))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(a[o]=new e({type:"nonoptional",innerType:n[o]}))}else for(let o in n)a[o]=new e({type:"nonoptional",innerType:n[o]});return wi(this,"shape",a),a}});return Ct(t,i)}function Ni(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function dv(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function Mt(e,t){return t.map(r=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(e),r})}function Hc(e){return typeof e=="string"?e:e?.message}function It(e,t,r){let i=e.message?e.message:Hc(e.inst?._zod.def?.error?.(e))??Hc(t?.error?.(e))??Hc(r.customError?.(e))??Hc(r.localeError?.(e))??"Invalid input",{inst:n,continue:a,input:o,...s}=e;return s.path??(s.path=[]),s.message=i,t?.reportInput&&(s.input=o),s}function Qc(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function eu(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function j(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Fo(...e){let[t,r,i]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:i}:{...t}}function rW(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function rk(e){let t=atob(e),r=new Uint8Array(t.length);for(let i=0;i<t.length;i++)r[i]=t.charCodeAt(i);return r}function nk(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function nW(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return rk(t+r)}function iW(e){return nk(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function aW(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let i=0;i<t.length;i+=2)r[i/2]=Number.parseInt(t.slice(i,i+2),16);return r}function oW(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var rv=class{constructor(...t){}};var ik=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,jo,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},tu=T("$ZodError",ik),Ft=T("$ZodError",ik,{Parent:Error});function ru(e,t=r=>r.message){let r={},i=[];for(let n of e.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n))):i.push(t(n));return{formErrors:i,fieldErrors:r}}function nu(e,t=r=>r.message){let r={_errors:[]},i=(n,a=[])=>{for(let o of n.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(s=>i({issues:s},[...a,...o.path]));else if(o.code==="invalid_key")i({issues:o.issues},[...a,...o.path]);else if(o.code==="invalid_element")i({issues:o.issues},[...a,...o.path]);else{let s=[...a,...o.path];if(s.length===0)r._errors.push(t(o));else{let u=r,d=0;for(;d<s.length;){let p=s[d];d===s.length-1?(u[p]=u[p]||{_errors:[]},u[p]._errors.push(t(o))):u[p]=u[p]||{_errors:[]},u=u[p],d++}}}};return i(e),r}function pv(e,t=r=>r.message){let r={errors:[]},i=(n,a=[])=>{var o,s;for(let u of n.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(d=>i({issues:d},[...a,...u.path]));else if(u.code==="invalid_key")i({issues:u.issues},[...a,...u.path]);else if(u.code==="invalid_element")i({issues:u.issues},[...a,...u.path]);else{let d=[...a,...u.path];if(d.length===0){r.errors.push(t(u));continue}let p=r,h=0;for(;h<d.length;){let g=d[h],l=h===d.length-1;typeof g=="string"?(p.properties??(p.properties={}),(o=p.properties)[g]??(o[g]={errors:[]}),p=p.properties[g]):(p.items??(p.items=[]),(s=p.items)[g]??(s[g]={errors:[]}),p=p.items[g]),l&&p.errors.push(t(u)),h++}}};return i(e),r}function ak(e){let t=[],r=e.map(i=>typeof i=="object"?i.key:i);for(let i of r)typeof i=="number"?t.push(`[${i}]`):typeof i=="symbol"?t.push(`[${JSON.stringify(String(i))}]`):/[^\w$]/.test(i)?t.push(`[${JSON.stringify(i)}]`):(t.length&&t.push("."),t.push(i));return t.join("")}function mv(e){let t=[],r=[...e.issues].sort((i,n)=>(i.path??[]).length-(n.path??[]).length);for(let i of r)t.push(`\u2716 ${i.message}`),i.path?.length&&t.push(` \u2192 at ${ak(i.path)}`);return t.join(`
|
|
201
201
|
`)}var Lo=e=>(t,r,i,n)=>{let a=i?{...i,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},a);if(o instanceof Promise)throw new zr;if(o.issues.length){let s=new(n?.Err??e)(o.issues.map(u=>It(u,a,Ze())));throw mp(s,n?.callee),s}return o.value},fp=Lo(Ft),Uo=e=>async(t,r,i,n)=>{let a=i?{...i,async:!0}:{async:!0},o=t._zod.run({value:r,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let s=new(n?.Err??e)(o.issues.map(u=>It(u,a,Ze())));throw mp(s,n?.callee),s}return o.value},hp=Uo(Ft),zo=e=>(t,r,i)=>{let n=i?{...i,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},n);if(a instanceof Promise)throw new zr;return a.issues.length?{success:!1,error:new(e??tu)(a.issues.map(o=>It(o,n,Ze())))}:{success:!0,data:a.value}},fv=zo(Ft),Bo=e=>async(t,r,i)=>{let n=i?{...i,async:!0}:{async:!0},a=t._zod.run({value:r,issues:[]},n);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(o=>It(o,n,Ze())))}:{success:!0,data:a.value}},hv=Bo(Ft),gp=e=>(t,r,i)=>{let n=i?{...i,direction:"backward"}:{direction:"backward"};return Lo(e)(t,r,n)},cW=gp(Ft),yp=e=>(t,r,i)=>Lo(e)(t,r,i),uW=yp(Ft),vp=e=>async(t,r,i)=>{let n=i?{...i,direction:"backward"}:{direction:"backward"};return Uo(e)(t,r,n)},lW=vp(Ft),bp=e=>async(t,r,i)=>Uo(e)(t,r,i),dW=bp(Ft),Sp=e=>(t,r,i)=>{let n=i?{...i,direction:"backward"}:{direction:"backward"};return zo(e)(t,r,n)},pW=Sp(Ft),Ep=e=>(t,r,i)=>zo(e)(t,r,i),mW=Ep(Ft),xp=e=>async(t,r,i)=>{let n=i?{...i,direction:"backward"}:{direction:"backward"};return Bo(e)(t,r,n)},fW=xp(Ft),Ap=e=>async(t,r,i)=>Bo(e)(t,r,i),hW=Ap(Ft);var Qt={};Ur(Qt,{base64:()=>Nv,base64url:()=>_p,bigint:()=>Fv,boolean:()=>Uv,browserEmail:()=>AW,cidrv4:()=>wv,cidrv6:()=>kv,cuid:()=>gv,cuid2:()=>yv,date:()=>Ov,datetime:()=>jv,domain:()=>CW,duration:()=>xv,e164:()=>Rv,email:()=>_v,emoji:()=>Tv,extendedDuration:()=>gW,guid:()=>Av,hex:()=>IW,hostname:()=>TW,html5Email:()=>SW,httpProtocol:()=>Pv,idnEmail:()=>xW,integer:()=>Lv,ipv4:()=>Cv,ipv6:()=>Iv,ksuid:()=>Sv,lowercase:()=>Gv,mac:()=>Dv,md5_base64:()=>wW,md5_base64url:()=>kW,md5_hex:()=>DW,nanoid:()=>Ev,null:()=>zv,number:()=>Tp,rfc5322Email:()=>EW,sha1_base64:()=>PW,sha1_base64url:()=>RW,sha1_hex:()=>NW,sha256_base64:()=>$W,sha256_base64url:()=>jW,sha256_hex:()=>OW,sha384_base64:()=>FW,sha384_base64url:()=>LW,sha384_hex:()=>MW,sha512_base64:()=>zW,sha512_base64url:()=>BW,sha512_hex:()=>UW,string:()=>Mv,time:()=>$v,ulid:()=>vv,undefined:()=>Bv,unicodeEmail:()=>ok,uppercase:()=>Vv,uuid:()=>va,uuid4:()=>yW,uuid6:()=>vW,uuid7:()=>bW,xid:()=>bv});var gv=/^[cC][0-9a-z]{6,}$/,yv=/^[0-9a-z]+$/,vv=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,bv=/^[0-9a-vA-V]{20}$/,Sv=/^[A-Za-z0-9]{27}$/,Ev=/^[a-zA-Z0-9_-]{21}$/,xv=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,gW=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Av=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,va=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,yW=va(4),vW=va(6),bW=va(7),_v=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,SW=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,EW=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,ok=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,xW=ok,AW=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,_W="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Tv(){return new RegExp(_W,"u")}var Cv=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Iv=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Dv=e=>{let t=yr(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},wv=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,kv=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Nv=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,_p=/^[A-Za-z0-9_-]*$/,TW=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,CW=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Pv=/^https?$/,Rv=/^\+[1-9]\d{6,14}$/,sk="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Ov=new RegExp(`^${sk}$`);function ck(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function $v(e){return new RegExp(`^${ck(e)}$`)}function jv(e){let t=ck({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let i=`${t}(?:${r.join("|")})`;return new RegExp(`^${sk}T(?:${i})$`)}var Mv=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Fv=/^-?\d+n?$/,Lv=/^-?\d+$/,Tp=/^-?\d+(?:\.\d+)?$/,Uv=/^(?:true|false)$/i,zv=/^null$/i;var Bv=/^undefined$/i;var Gv=/^[^A-Z]*$/,Vv=/^[^a-z]*$/,IW=/^[0-9a-fA-F]*$/;function iu(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function au(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var DW=/^[0-9a-fA-F]{32}$/,wW=iu(22,"=="),kW=au(22),NW=/^[0-9a-fA-F]{40}$/,PW=iu(27,"="),RW=au(27),OW=/^[0-9a-fA-F]{64}$/,$W=iu(43,"="),jW=au(43),MW=/^[0-9a-fA-F]{96}$/,FW=iu(64,""),LW=au(64),UW=/^[0-9a-fA-F]{128}$/,zW=iu(86,"=="),BW=au(86);var we=T("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),lk={number:"number",bigint:"bigint",object:"date"},Cp=T("$ZodCheckLessThan",(e,t)=>{we.init(e,t);let r=lk[typeof t.value];e._zod.onattach.push(i=>{let n=i._zod.bag,a=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<a&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value<=t.value:i.value<t.value)||i.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ip=T("$ZodCheckGreaterThan",(e,t)=>{we.init(e,t);let r=lk[typeof t.value];e._zod.onattach.push(i=>{let n=i._zod.bag,a=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>a&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Wv=T("$ZodCheckMultipleOf",(e,t)=>{we.init(e,t),e._zod.onattach.push(r=>{var i;(i=r._zod.bag).multipleOf??(i.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):nv(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Kv=T("$ZodCheckNumberFormat",(e,t)=>{we.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),i=r?"int":"number",[n,a]=uv[t.format];e._zod.onattach.push(o=>{let s=o._zod.bag;s.format=t.format,s.minimum=n,s.maximum=a,r&&(s.pattern=Lv)}),e._zod.check=o=>{let s=o.value;if(r){if(!Number.isInteger(s)){o.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort});return}}s<n&&o.issues.push({origin:"number",input:s,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:"number",input:s,code:"too_big",maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),qv=T("$ZodCheckBigIntFormat",(e,t)=>{we.init(e,t);let[r,i]=lv[t.format];e._zod.onattach.push(n=>{let a=n._zod.bag;a.format=t.format,a.minimum=r,a.maximum=i}),e._zod.check=n=>{let a=n.value;a<r&&n.issues.push({origin:"bigint",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),a>i&&n.issues.push({origin:"bigint",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Zv=T("$ZodCheckMaxSize",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=i=>{let n=i.value;return!Di(n)&&n.size!==void 0}),e._zod.onattach.push(i=>{let n=i._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(i._zod.bag.maximum=t.maximum)}),e._zod.check=i=>{let n=i.value;n.size<=t.maximum||i.issues.push({origin:Qc(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Hv=T("$ZodCheckMinSize",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=i=>{let n=i.value;return!Di(n)&&n.size!==void 0}),e._zod.onattach.push(i=>{let n=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(i._zod.bag.minimum=t.minimum)}),e._zod.check=i=>{let n=i.value;n.size>=t.minimum||i.issues.push({origin:Qc(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Jv=T("$ZodCheckSizeEquals",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=i=>{let n=i.value;return!Di(n)&&n.size!==void 0}),e._zod.onattach.push(i=>{let n=i._zod.bag;n.minimum=t.size,n.maximum=t.size,n.size=t.size}),e._zod.check=i=>{let n=i.value,a=n.size;if(a===t.size)return;let o=a>t.size;i.issues.push({origin:Qc(n),...o?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),Xv=T("$ZodCheckMaxLength",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=i=>{let n=i.value;return!Di(n)&&n.length!==void 0}),e._zod.onattach.push(i=>{let n=i._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(i._zod.bag.maximum=t.maximum)}),e._zod.check=i=>{let n=i.value;if(n.length<=t.maximum)return;let o=eu(n);i.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Yv=T("$ZodCheckMinLength",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=i=>{let n=i.value;return!Di(n)&&n.length!==void 0}),e._zod.onattach.push(i=>{let n=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(i._zod.bag.minimum=t.minimum)}),e._zod.check=i=>{let n=i.value;if(n.length>=t.minimum)return;let o=eu(n);i.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Qv=T("$ZodCheckLengthEquals",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=i=>{let n=i.value;return!Di(n)&&n.length!==void 0}),e._zod.onattach.push(i=>{let n=i._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=i=>{let n=i.value,a=n.length;if(a===t.length)return;let o=eu(n),s=a>t.length;i.issues.push({origin:o,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),Go=T("$ZodCheckStringFormat",(e,t)=>{var r,i;we.init(e,t),e._zod.onattach.push(n=>{let a=n._zod.bag;a.format=t.format,t.pattern&&(a.patterns??(a.patterns=new Set),a.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),eb=T("$ZodCheckRegex",(e,t)=>{Go.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),tb=T("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Gv),Go.init(e,t)}),rb=T("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Vv),Go.init(e,t)}),nb=T("$ZodCheckIncludes",(e,t)=>{we.init(e,t);let r=yr(t.includes),i=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=i,e._zod.onattach.push(n=>{let a=n._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(i)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),ib=T("$ZodCheckStartsWith",(e,t)=>{we.init(e,t);let r=new RegExp(`^${yr(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(i=>{let n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=i=>{i.value.startsWith(t.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}}),ab=T("$ZodCheckEndsWith",(e,t)=>{we.init(e,t);let r=new RegExp(`.*${yr(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(i=>{let n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=i=>{i.value.endsWith(t.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}});function uk(e,t,r){e.issues.length&&t.issues.push(...Mt(r,e.issues))}var ob=T("$ZodCheckProperty",(e,t)=>{we.init(e,t),e._zod.check=r=>{let i=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(i instanceof Promise)return i.then(n=>uk(n,r,t.property));uk(i,r,t.property)}}),sb=T("$ZodCheckMimeType",(e,t)=>{we.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(i=>{i._zod.bag.mime=t.mime}),e._zod.check=i=>{r.has(i.value.type)||i.issues.push({code:"invalid_value",values:t.mime,input:i.value.type,inst:e,continue:!t.abort})}}),cb=T("$ZodCheckOverwrite",(e,t)=>{we.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var ou=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let i=t.split(`
|
|
202
202
|
`).filter(o=>o),n=Math.min(...i.map(o=>o.length-o.trimStart().length)),a=i.map(o=>o.slice(n)).map(o=>" ".repeat(this.indent*2)+o);for(let o of a)this.content.push(o)}compile(){let t=Function,r=this?.args,n=[...(this?.content??[""]).map(a=>` ${a}`)];return new t(...r,n.join(`
|
|
203
203
|
`))}};var ub={major:4,minor:4,patch:3};var ee=T("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ub;let i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(let n of i)for(let a of n._zod.onattach)a(e);if(i.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(o,s,u)=>{let d=Ni(o),p;for(let h of s){if(h._zod.def.when){if(dv(o)||!h._zod.def.when(o))continue}else if(d)continue;let g=o.issues.length,l=h._zod.check(o);if(l instanceof Promise&&u?.async===!1)throw new zr;if(p||l instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await l,o.issues.length!==g&&(d||(d=Ni(o,g)))});else{if(o.issues.length===g)continue;d||(d=Ni(o,g))}}return p?p.then(()=>o):o},a=(o,s,u)=>{if(Ni(o))return o.aborted=!0,o;let d=n(s,i,u);if(d instanceof Promise){if(u.async===!1)throw new zr;return d.then(p=>e._zod.parse(p,u))}return e._zod.parse(d,u)};e._zod.run=(o,s)=>{if(s.skipChecks)return e._zod.parse(o,s);if(s.direction==="backward"){let d=e._zod.parse({value:o.value,issues:[]},{...s,skipChecks:!0});return d instanceof Promise?d.then(p=>a(p,o,s)):a(d,o,s)}let u=e._zod.parse(o,s);if(u instanceof Promise){if(s.async===!1)throw new zr;return u.then(d=>n(d,i,s))}return n(u,i,s)}}ue(e,"~standard",()=>({validate:n=>{try{let a=fv(e,n);return a.success?{value:a.data}:{issues:a.error?.issues}}catch{return hv(e,n).then(o=>o.success?{value:o.data}:{issues:o.error?.issues})}},vendor:"zod",version:1}))}),ba=T("$ZodString",(e,t)=>{ee.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Mv(e._zod.bag),e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Ce=T("$ZodStringFormat",(e,t)=>{Go.init(e,t),ba.init(e,t)}),db=T("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Av),Ce.init(e,t)}),pb=T("$ZodUUID",(e,t)=>{if(t.version){let i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=va(i))}else t.pattern??(t.pattern=va());Ce.init(e,t)}),mb=T("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=_v),Ce.init(e,t)}),fb=T("$ZodURL",(e,t)=>{Ce.init(e,t),e._zod.check=r=>{try{let i=r.value.trim();if(!t.normalize&&t.protocol?.source===Pv.source&&!/^https?:\/\//i.test(i)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}let n=new URL(i);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(n.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=n.href:r.value=i;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),hb=T("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Tv()),Ce.init(e,t)}),gb=T("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Ev),Ce.init(e,t)}),yb=T("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=gv),Ce.init(e,t)}),vb=T("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=yv),Ce.init(e,t)}),bb=T("$ZodULID",(e,t)=>{t.pattern??(t.pattern=vv),Ce.init(e,t)}),Sb=T("$ZodXID",(e,t)=>{t.pattern??(t.pattern=bv),Ce.init(e,t)}),Eb=T("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Sv),Ce.init(e,t)}),xb=T("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=jv(t)),Ce.init(e,t)}),Ab=T("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Ov),Ce.init(e,t)}),_b=T("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=$v(t)),Ce.init(e,t)}),Tb=T("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=xv),Ce.init(e,t)}),Cb=T("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Cv),Ce.init(e,t),e._zod.bag.format="ipv4"}),Ib=T("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Iv),Ce.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Db=T("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Dv(t.delimiter)),Ce.init(e,t),e._zod.bag.format="mac"}),wb=T("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=wv),Ce.init(e,t)}),kb=T("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=kv),Ce.init(e,t),e._zod.check=r=>{let i=r.value.split("/");try{if(i.length!==2)throw new Error;let[n,a]=i;if(!a)throw new Error;let o=Number(a);if(`${o}`!==a)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Nb(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Pb=T("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Nv),Ce.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Nb(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Ck(e){if(!_p.test(e))return!1;let t=e.replace(/[-_]/g,i=>i==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Nb(r)}var Rb=T("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=_p),Ce.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Ck(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Ob=T("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Rv),Ce.init(e,t)});function Ik(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[i]=r;if(!i)return!1;let n=JSON.parse(atob(i));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}var $b=T("$ZodJWT",(e,t)=>{Ce.init(e,t),e._zod.check=r=>{Ik(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),jb=T("$ZodCustomStringFormat",(e,t)=>{Ce.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),Pp=T("$ZodNumber",(e,t)=>{ee.init(e,t),e._zod.pattern=e._zod.bag.pattern??Tp,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let a=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...a?{received:a}:{}}),r}}),Mb=T("$ZodNumberFormat",(e,t)=>{Kv.init(e,t),Pp.init(e,t)}),su=T("$ZodBoolean",(e,t)=>{ee.init(e,t),e._zod.pattern=Uv,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),Rp=T("$ZodBigInt",(e,t)=>{ee.init(e,t),e._zod.pattern=Fv,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),Fb=T("$ZodBigIntFormat",(e,t)=>{qv.init(e,t),Rp.init(e,t)}),Lb=T("$ZodSymbol",(e,t)=>{ee.init(e,t),e._zod.parse=(r,i)=>{let n=r.value;return typeof n=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:e}),r}}),Ub=T("$ZodUndefined",(e,t)=>{ee.init(e,t),e._zod.pattern=Bv,e._zod.values=new Set([void 0]),e._zod.parse=(r,i)=>{let n=r.value;return typeof n>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),r}}),zb=T("$ZodNull",(e,t)=>{ee.init(e,t),e._zod.pattern=zv,e._zod.values=new Set([null]),e._zod.parse=(r,i)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),Bb=T("$ZodAny",(e,t)=>{ee.init(e,t),e._zod.parse=r=>r}),Gb=T("$ZodUnknown",(e,t)=>{ee.init(e,t),e._zod.parse=r=>r}),Vb=T("$ZodNever",(e,t)=>{ee.init(e,t),e._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),Wb=T("$ZodVoid",(e,t)=>{ee.init(e,t),e._zod.parse=(r,i)=>{let n=r.value;return typeof n>"u"||r.issues.push({expected:"void",code:"invalid_type",input:n,inst:e}),r}}),Kb=T("$ZodDate",(e,t)=>{ee.init(e,t),e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let n=r.value,a=n instanceof Date;return a&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...a?{received:"Invalid Date"}:{},inst:e}),r}});function pk(e,t,r){e.issues.length&&t.issues.push(...Mt(r,e.issues)),t.value[r]=e.value}var qb=T("$ZodArray",(e,t)=>{ee.init(e,t),e._zod.parse=(r,i)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let a=[];for(let o=0;o<n.length;o++){let s=n[o],u=t.element._zod.run({value:s,issues:[]},i);u instanceof Promise?a.push(u.then(d=>pk(d,r,o))):pk(u,r,o)}return a.length?Promise.all(a).then(()=>r):r}});function Np(e,t,r,i,n,a){let o=r in i;if(e.issues.length){if(n&&a&&!o)return;t.issues.push(...Mt(r,e.issues))}if(!o&&!n){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?o&&(t.value[r]=void 0):t.value[r]=e.value}function Dk(e){let t=Object.keys(e.shape);for(let i of t)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);let r=cv(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function wk(e,t,r,i,n,a){let o=[],s=n.keySet,u=n.catchall._zod,d=u.def.type,p=u.optin==="optional",h=u.optout==="optional";for(let g in t){if(g==="__proto__"||s.has(g))continue;if(d==="never"){o.push(g);continue}let l=u.run({value:t[g],issues:[]},i);l instanceof Promise?e.push(l.then(m=>Np(m,r,g,t,p,h))):Np(l,r,g,t,p,h)}return o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>r):r}var kk=T("$ZodObject",(e,t)=>{if(ee.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let u={...s};return Object.defineProperty(t,"shape",{value:u}),u}})}let i=Mo(()=>Dk(t));ue(e._zod,"propValues",()=>{let s=t.shape,u={};for(let d in s){let p=s[d]._zod;if(p.values){u[d]??(u[d]=new Set);for(let h of p.values)u[d].add(h)}}return u});let n=ya,a=t.catchall,o;e._zod.parse=(s,u)=>{o??(o=i.value);let d=s.value;if(!n(d))return s.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),s;s.value={};let p=[],h=o.shape;for(let g of o.keys){let l=h[g],m=l._zod.optin==="optional",f=l._zod.optout==="optional",y=l._zod.run({value:d[g],issues:[]},u);y instanceof Promise?p.push(y.then(v=>Np(v,s,g,d,m,f))):Np(y,s,g,d,m,f)}return a?wk(p,d,s,u,i.value,e):p.length?Promise.all(p).then(()=>s):s}}),Zb=T("$ZodObjectJIT",(e,t)=>{kk.init(e,t);let r=e._zod.parse,i=Mo(()=>Dk(t)),n=g=>{let l=new ou(["shape","payload","ctx"]),m=i.value,f=A=>{let x=pp(A);return`shape[${x}]._zod.run({ value: input[${x}], issues: [] }, ctx)`};l.write("const input = payload.value;");let y=Object.create(null),v=0;for(let A of m.keys)y[A]=`key_${v++}`;l.write("const newResult = {};");for(let A of m.keys){let x=y[A],_=pp(A),C=g[A],R=C?._zod?.optin==="optional",W=C?._zod?.optout==="optional";l.write(`const ${x} = ${f(A)};`),R&&W?l.write(`
|
|
@@ -338,7 +338,7 @@ ${e_}
|
|
|
338
338
|
`)}
|
|
339
339
|
`}Bi(F$,"renderUpdateEnvelope");var $f,jf=!1;function OJ(e){$f=e,jf=!1}Bi(OJ,"armUpdateEnvelope");function $J(){$f=void 0,jf=!1}Bi($J,"disarmUpdateEnvelope");function L$(){if(!(jf||$f===void 0)){jf=!0;try{return $f()}catch(e){un.debug("UpdateEnvelope","Envelope source failed",{error:ae(e instanceof Error?e.message:String(e))});return}}}Bi(L$,"takeUpdateEnvelope");function Ds(){let e=L$();return e===void 0?"":F$(e)}Bi(Ds,"takeUpdateEnvelopeTail");var jJ=Object.defineProperty,Pa=(e,t)=>jJ(e,"name",{value:t,configurable:!0}),w={success:Pa(e=>e.outcome==="success","success"),error:Pa(e=>e.outcome==="error","error"),empty:Pa(e=>e.outcome==="empty","empty"),unsupported:Pa(e=>e.outcome==="unsupported","unsupported"),successDryRun:Pa(e=>e.outcome==="success"&&e.dryRun==="true","successDryRun"),successOffline:Pa(e=>e.outcome==="success"&&e.offline==="true","successOffline"),errorWithCode:Pa(e=>t=>t.outcome==="error"&&t.errorCode===e,"errorWithCode")};var MJ=Object.defineProperty,FJ=(e,t)=>MJ(e,"name",{value:t,configurable:!0}),LJ=["account deploy","add","agent install-skill","agent session-context","apps create","apps describe","apps detect","apps list","assets compliance","assets list","assets show","assets summary","aws exec","build","ci run","ci setup","ci status","ci token create","ci token list","ci token revoke","ci verify","compliance fix","compliance fix --execute","connect","connect status","costs show","create account","create app","create domain","create org","deploy","deploy diff","deploy logs","deployments cancel","deployments force-release","deployments list","destroy","dev down","dev list","dev substrate down","dev up","domain","domain create","domain delegate","domain deploy","domain destroy","domain eject","domain export","domain import","domain list","domain records list","domain sync","domain verify","drift detect","drift repair","drift resume","fjall","history","home","import","list","login","metrics show","migrate identity","modify","org bind","org deploy","org get","org identity setup-google","platform deploy","remove","restore","secrets delete","secrets exec","secrets export","secrets get","secrets import","secrets list","secrets set","services","status","target get","target list","target set","token create","token list","token revoke","token show","tunnel","undo","unlock bucket","user add","user list","user rebind","user remove","validate"],UJ=new Set(LJ);function Mf(e){return typeof e=="string"&&UJ.has(e)}FJ(Mf,"isAgentWriterSurface");var Xu="fjall";var zJ=Object.defineProperty,BJ=(e,t)=>zJ(e,"name",{value:t,configurable:!0}),U$=[{command:Xu,match:w.error,templates:["Run `fjall --help` to list the available commands"]},{command:"home",match:w.success,templates:["Run `fjall apps describe <name>` to see app details","Run `fjall deploy <name>` to deploy","Run `fjall status <name>` to check a specific app"]},{command:"home",match:w.empty,templates:[`Run \`${te.createApplicationAgent} --name "<name>"\` to create your first app`,`Run \`${te.connect}\` to connect an AWS account`]},{command:"apps list",match:w.success,templates:["Run `fjall apps describe <name>` to see app details","Run `fjall deploy <name>` to deploy",`Run \`${te.createApplicationAgent} --name "<name>"\` to create a new app`]},{command:"apps list",match:w.empty,templates:[`Run \`${te.createApplicationAgent} --name "<name>"\` to create your first app`,`Run \`${te.connect}\` to connect an AWS account first`]},{command:"apps describe",match:w.success,templates:["Run `fjall deploy <app>` to deploy","Run `fjall secrets list --app <app>` to list secrets","Run `fjall status <app>` to check health"]},{command:"apps detect",match:w.empty,templates:["Run `fjall apps detect <path> --agent` against the directory holding the application, if this was the repository root","Pass `--pattern staticsite` with `--source`, `--build-command` and `--output-dir` explicitly if the app has no recognised framework dependency"]},{command:"apps detect",match:w.success,templates:[`Run \`${te.createApplicationAgent} --name <name> --pattern <pattern>\` using the \`pattern\` column \u2014 never the \`framework\` column`,"Skip any row whose `role` is `library` \u2014 those are not deployable applications","Confirm `outputDir` exists after building: it is a framework convention, not a verified path"]},{command:"apps create",match:w.successOffline,templates:["Run `npm install` in the app directory \u2014 `--offline` skipped it",`Re-run \`${te.createApplicationAgent}\` without \`--offline\` once you have credentials, to register the app`,"Run `fjall deploy <app>` only after both of the above"]},{command:"apps create",match:w.success,templates:["Run `fjall deploy <app>` to deploy your new app","Run `fjall secrets set --app <app> DB_URL=<url>` to configure secrets"]},{command:"status",match:w.success,templates:["Run `fjall deploy <app>` to deploy","Run `fjall apps describe <app>` for details"]},{command:"deploy",match:w.success,templates:["Run `fjall status <app>` to check health","Run `fjall apps describe <app>` for full details"]},{command:"deploy",match:w.error,templates:["Run `fjall deploy <app>` to retry","Run `fjall status <app>` to check current state"]},{command:"destroy",match:w.success,templates:["Run `fjall list` to see remaining resources","Run `fjall apps list` to see remaining apps"]},{command:"destroy",match:w.error,templates:["Run `fjall destroy <app> --skip-confirmation` to force destroy","Run `fjall status <app>` to check current state"]},{command:"build",match:w.success,templates:["Run `fjall deploy <app> --image-tag <tag>` with a tag from `artefacts` to roll out this build","Run `fjall status <app>` to check health"]},{command:"connect",match:BJ(e=>e.outcome==="success"&&e.pending==="true","match"),templates:["Run `fjall connect status --external-id <externalId> --wait` to block until the stack completes"]},{command:"connect",match:w.success,templates:[`Run \`${te.accountDeploy}\` or \`${te.organisationDeploy}\` to deploy infrastructure`,`Run \`${te.createApplicationAgent} --name "<name>"\` to create an app`]},{command:"connect status",match:w.success,templates:["Run `fjall connect status --external-id <id> --wait` to block until a pending stack completes",`Run \`${te.accountDeploy}\` or \`${te.organisationDeploy}\` to deploy infrastructure`]},{command:"connect status",match:w.empty,templates:[`Run \`${te.connect}\` to connect an AWS account`]},{command:"login",match:w.success,templates:["Run `fjall apps list` to see your applications",`Run \`${te.connect}\` to connect an AWS account`]},{command:"list",match:w.success,templates:["Run `fjall apps describe <name>` for app details","Run `fjall deploy <name>` to deploy"]},{command:"add",match:w.success,templates:["Run `fjall deploy <app>` to deploy the change","Run `fjall apps describe <app>` to see updated resources"]},{command:"modify",match:w.success,templates:["Run `fjall validate --deep --app <app>` to typecheck the edited infrastructure.ts","Run `fjall deploy <app>` to deploy the change","Run `fjall undo --app <app>` to restore the .bak sidecar if the edit was wrong"]},{command:"remove",match:w.success,templates:["Run `fjall validate --deep --app <app>` to confirm nothing still references the removed resource","Run `fjall deploy <app>` to deploy the change","Run `fjall undo --app <app>` to restore the .bak sidecar if the removal was wrong"]},{command:"validate",match:w.success,templates:["Run `fjall deploy <app>` to deploy the validated infrastructure"]},{command:"validate",match:w.error,templates:["Run `fjall undo --app <app>` to restore the most recent .bak sidecar","Run `fjall history --app <app>` to list older snapshots to restore from"]},{command:"undo",match:w.success,templates:["Run `fjall validate --deep --app <app>` to confirm the restored infrastructure.ts typechecks","Run `fjall history --app <app>` to restore an older snapshot instead"]},{command:"history",match:w.success,templates:["Run `fjall history --restore <timestamp> --app <app>` to restore a specific snapshot","Run `fjall undo --app <app>` to restore the most recent .bak sidecar instead"]},{command:"history",match:w.empty,templates:["No snapshots yet \u2014 `fjall add`, `fjall modify` and `fjall remove` each write one before editing infrastructure.ts"]},{command:"tunnel",match:w.success,templates:["Run `fjall tunnel <app> --background` to run in the background"]}];var z$=[{command:"secrets list",match:w.success,templates:["Run `fjall secrets set --app <app> KEY=VALUE` to set a secret","Run `fjall rollout <app>` to restart running services with the latest values"]},{command:"secrets list",match:w.empty,templates:["Run `fjall secrets set --app <app> KEY=VALUE` to add a secret","Run `fjall secrets import --app <app> <file>` to bulk import"]},{command:"secrets get",match:w.success,templates:["Run `fjall secrets set --app <app> KEY=VALUE` to update","Run `fjall secrets list --app <app>` to see all secrets"]},{command:"secrets set",match:w.success,templates:["Run `fjall rollout <app>` to restart running services with the new value","New key? Run a full `fjall deploy <app>` so the task definition gains the reference","Run `fjall secrets list --app <app>` to verify"]},{command:"secrets delete",match:w.success,templates:["Declared for a service? Re-run with `--remove-declaration` (or edit infrastructure.ts ssmSecrets), then `fjall deploy <app>` \u2014 a stale declaration breaks task launches","Not declared anywhere? Run `fjall rollout <app>` so running services drop the previous value","Run `fjall secrets list --app <app>` to verify"]},{command:"secrets import",match:w.success,templates:["Run `fjall rollout <app>` to restart running services with the imported values","New keys? Run a full `fjall deploy <app>` so task definitions gain the references","Run `fjall secrets list --app <app>` to verify"]},{command:"secrets export",match:w.success,templates:["Run `fjall secrets list --app <app>` to see all secret names","Run `fjall secrets import --app <app> <file>` to restore"]},{command:"secrets exec",match:w.success,templates:["Run `fjall secrets list --app <app>` to see available secrets"]}];var GJ=Object.defineProperty,VJ=(e,t)=>GJ(e,"name",{value:t,configurable:!0});var B$="identity-only organisation deploys typically take 2-5 minutes",g_=`Run \`${te.organisationDeploy}\` to apply the change (${B$}).`,Ufe=`Deploy the organisation now to apply this change? (${B$})`,WJ="Groups have no members",ws="fjall user add <email> --group <group>",KJ=ws,zfe=`${WJ} \u2014 run \`${KJ}\` to declare access.`;function qJ(e,t){return`Declared identity (source "${e}"): ${String(t)} user${t===1?"":"s"}`}VJ(qJ,"formatUserListHeading");var Bfe=`No users or memberships declared. Run \`${ws}\` to add one.`;var G$=[{command:"user list",match:w.success,templates:[`Run \`${ws}\` to grant access`,`Run \`${te.organisationDeploy}\` to apply declared changes`]},{command:"user list",match:w.empty,templates:[`Run \`${ws}\` to declare the first membership`]},{command:"user add",match:w.success,templates:[g_,"Run `fjall user list` to review the declared users"]},{command:"user remove",match:w.success,templates:[g_,"Run `fjall user list` to see the remaining users"]},{command:"user rebind",match:w.success,templates:[`Run \`${te.organisationDeploy}\` to re-resolve external users against the identity store`]},{command:"org identity setup-google",match:w.success,templates:[`Run \`${ws} --live\` to declare access for a synced user`,"Run `fjall user list --live` to compare declared memberships against the identity store"]},{command:"token create",match:w.success,templates:["Run `fjall token list` to see all tokens","Save the token now \u2014 it cannot be retrieved again"]},{command:"token list",match:w.success,templates:["Run `fjall token create --name <name> --scope <scope> --expires <duration>` to create a token","Run `fjall token revoke <id>` to revoke a token"]},{command:"token show",match:w.success,templates:["Run `fjall token revoke <id>` to revoke this token","Run `fjall token list` to see all tokens"]},{command:"token revoke",match:w.success,templates:["Run `fjall token list` to see remaining tokens"]},{command:"target list",match:w.success,templates:["Run `fjall target set <name>` to change active target","Run `fjall deploy <app>` to deploy to the active target","Run `fjall apps list` to see applications"]},{command:"target list",match:w.empty,templates:[`Run \`${te.connect}\` to connect an AWS account`,`Run \`${te.login}\` to authenticate if not logged in`]},{command:"org bind",match:w.success,templates:["Run `fjall org get` to confirm the organisation's regions and accounts","Commit fjall-config.json so every checkout of this project carries the binding"]},{command:"org get",match:w.success,templates:["Run `fjall target list` to see which account/region pairs are deployable","Run `fjall accounts list` to see application-hosting accounts only"]},{command:"target get",match:w.success,templates:["Run `fjall target set <name>` to change active target","Run `fjall target list` to see all targets"]},{command:"target get",match:w.empty,templates:["Run `fjall target set <name>` to set a target","Run `fjall target list` to see available targets"]},{command:"target set",match:w.success,templates:["Run `fjall deploy <app>` to deploy to this target","Run `fjall target get` to verify the active target"]},{command:"target set",match:w.errorWithCode("NOT_FOUND"),templates:["Run `fjall target list` to see available targets",`Run \`${te.connect}\` to connect an AWS account if none available`]}];import{platform as yX,arch as vX}from"os";import*as Re from"fs";import*as Nt from"path";var ZJ=Object.defineProperty,Ff=(e,t)=>ZJ(e,"name",{value:t,configurable:!0});function HJ(e){return e.success===!0}Ff(HJ,"isSuccess");function JJ(e){return e.success===!1}Ff(JJ,"isFailure");function Ra(e){return{success:!0,data:e}}Ff(Ra,"success");function ln(e){return{success:!1,error:e}}Ff(ln,"failure");var XJ=Object.defineProperty,Lf=(e,t)=>XJ(e,"name",{value:t,configurable:!0}),YJ=Lf(e=>{try{return JSON.stringify(e)}catch{return"[unserializable]"}},"safeStringify"),V$=Lf((e,t,r,i)=>{let n=new Date().toISOString(),a=e.toUpperCase(),o=i?` ${YJ(i)}`:"";process.stderr.write(`[${n}] [${a}] [${t}] ${r}${o}
|
|
340
340
|
`)},"defaultWriter"),Oa=V$;function QJ(e){Oa=e}Lf(QJ,"configureLogWriter");function eX(){Oa=V$}Lf(eX,"resetLogWriter");var $a={info(e,t,r){Oa("info",e,t,r)},warn(e,t,r){Oa("warn",e,t,r)},error(e,t,r){Oa("error",e,t,r)},debug(e,t,r){process.env.FJALL_DEBUG==="true"&&Oa("debug",e,t,r)},trace(e,t,r){process.env.FJALL_TRACE==="true"&&Oa("trace",e,t,r)},isDebugEnabled(){return process.env.FJALL_DEBUG==="true"}};var tX=Object.defineProperty,y_=(e,t)=>tX(e,"name",{value:t,configurable:!0}),v_=c.object({name:c.string(),type:c.enum(["apex","delegated"]),parentDomain:c.string().optional(),account:c.string().optional(),region:c.string().optional()}).strict(),b_=c.object({id:c.string().min(1),name:c.string().min(1).optional()}).strict(),Uf=c.object({activeTarget:c.string().optional(),domains:c.array(v_).optional(),capacityIdentity:Hm.optional(),organisation:b_.optional()}).strict(),Yu=c.object({activeTarget:c.string().optional(),domains:c.array(v_).optional(),capacityIdentity:Hm.optional(),organisation:b_.optional()});function ja(e={}){return JSON.stringify(e,null,2)}y_(ja,"serialiseRootConfig");var zf=Uf.keyof().options;function S_(e,t,r){let i=t[r];i!==void 0&&(e[r]=i)}y_(S_,"copyDefinedKey");function Bf(e,t){if(t===void 0)return!1;let r=new Set([...Object.keys(e),...Object.keys(t)]);for(let i of r)if(e[i]!==t[i])return!1;return!0}y_(Bf,"domainEntriesEqual");var rX=Object.defineProperty,ks=(e,t)=>rX(e,"name",{value:t,configurable:!0});function Qu(e){if(e===void 0||e==="")return{kind:"absent"};let t;try{t=JSON.parse(e)}catch(a){return{kind:"unmergeable",reason:`the existing file could not be read or parsed as JSON (${ae(ze(a))})`}}if(typeof t!="object"||t===null||Array.isArray(t))return{kind:"unmergeable",reason:"it does not contain a JSON object"};let r=Yu.safeParse(t);if(!r.success){let a=r.error.issues.map(o=>`${o.path.join(".")}: ${o.message}`).join("; ");return{kind:"unmergeable",reason:`a recognised key in the existing file is malformed (${ae(a)})`}}let i={},n=zf;for(let[a,o]of Object.entries(t))n.includes(a)||(i[a]=o);return{kind:"ok",disk:{known:r.data,foreign:i}}}ks(Qu,"readRootConfigForMerge");function W$(e,t,r){return JSON.stringify(e[r])!==JSON.stringify(t[r])}ks(W$,"sessionChangedKey");function K$(e,t,r){let i=t.domains,n=r.domains??[];if(i===void 0&&n.length===0)return e;let a=ks(h=>h.toLowerCase(),"norm"),o=i??[],s=new Map(n.map(h=>[a(h.name),h])),u=new Map(o.map(h=>[a(h.name),h])),d=[],p=new Set;for(let h of e??[]){let g=a(h.name);p.add(g);let l=u.get(g),m=s.get(g);if(l!==void 0&&!Bf(l,m)){d.push(l);continue}l===void 0&&m!==void 0||d.push(h)}for(let h of o){let g=a(h.name);p.has(g)||Bf(h,s.get(g))||d.push(h)}return d}ks(K$,"mergeDomains");function el(e,t,r){let i={...e.foreign,...e.known};for(let a of zf)a!=="domains"&&W$(t,r,a)&&(t[a]===void 0?delete i[a]:S_(i,t,a));let n=K$(e.known.domains,t,r);return n!==void 0?i.domains=n:delete i.domains,i}ks(el,"mergeRootConfig");function q$(e,t,r={}){let i=Qu(e);return i.kind==="unmergeable"?{kind:"unmergeable",reason:i.reason}:i.kind==="absent"?{kind:"ok",content:ja(t)}:{kind:"ok",content:ja(el(i.disk,t,r))}}ks(q$,"mergeRootConfigContent");var nX=Object.defineProperty,iX=(e,t)=>nX(e,"name",{value:t,configurable:!0}),aX=10;var oX=c.object({activeTarget:c.string().optional()}),Gf=class e{static{iX(this,"Config")}rootConfig;configPath=null;loadFailed=!1;parseDegraded=!1;loadedSnapshot={};searchStartDir;constructor(t,r){this.rootConfig=t??{},this.configPath=r??null}static findConfigDirectory(t){let r=t!==void 0&&t!==""?t:process.cwd();for(let i=0;i<aX;i++){let n=Nt.join(r,"fjall"),a=Nt.join(n,Kn);if(Re.existsSync(a))return n;let o=Nt.join(r,Kn);if(Re.existsSync(o))return r;let s=Nt.dirname(r);if(s===r)break;r=s}return null}static loadConfigFile(t){try{return Re.accessSync(t,Re.constants.R_OK),Re.readFileSync(t,{encoding:"utf8"})}catch(r){return $a.warn("Config",`Config file at ${t} could not be read; using defaults`,{file:t,error:ae(ze(r))}),null}}static loadConfig(t){let r=e.findConfigDirectory(t);if(!r){let u=new e;return u.searchStartDir=t,u}let i=Nt.join(r,Kn),n=e.loadConfigFile(i);if(n===null){let u=new e(void 0,i);return u.searchStartDir=t,u.loadFailed=!0,u}let a,o=!1;if(n!==""){let u;try{u=JSON.parse(n)}catch(p){throw e.formatZodError(p,Kn)}let d=Uf.safeParse(u);if(d.success)a=d.data;else{let p=Yu.safeParse(u);a=p.success?p.data:{},o=!p.success,p.success?$a.warn("Config","fjall-config.json contains keys this version does not recognise (only activeTarget, domains, capacityIdentity and organisation are read). They were most likely written by a newer fjall version \u2014 leave them in place; saves preserve them verbatim.",{file:i}):$a.warn("Config","fjall-config.json has a malformed activeTarget, domains or capacityIdentity value, so its contents were ignored for this run \u2014 any capacity-identity pins it holds will NOT apply (a pinned stack deploys unpinned and is blocked by the rename gate). Fix the file by hand; do NOT regenerate it, which would discard the pins.",{file:i})}}let s=new e(a,i);return s.searchStartDir=t,s.parseDegraded=o,s.loadedSnapshot=structuredClone(s.rootConfig),s}static formatZodError(t,r){if(t instanceof c.ZodError&&t.issues.length>0){let n=t.issues.map(a=>`${a.path.join(".")}: ${a.message}`).join("; ");return new Error(`Failed to parse ${r}: ${n}`)}let i=(t instanceof Error?t.message:String(t)).replace(/\n/g," ").substring(0,500);return new Error(`Failed to parse ${r}: ${i}`)}saveConfig(){let t=Nt.join(this.resolveProjectDirectory()??Nt.join(this.searchStartDir??process.cwd(),"fjall"),Kn);if(this.loadFailed)return ln(new Error(`Refusing to save ${t}: the file exists but could not be read when this config loaded, so saving would replace its contents with state that never included them. Fix the file permissions (e.g. chmod u+rw ${t}) and retry.`));let r=Nt.dirname(t);try{Re.mkdirSync(r,{recursive:!0})}catch(s){return ln(new Error(`Cannot create config directory ${r}: ${ae(ze(s))}`))}let i=e.assertWritable(t,r);if(!i.success)return i;let n=this.mergeWithDisk(t);if(!n.success)return n;let a=ja(n.data),o=`${t}.tmp-${process.pid}`;try{Re.writeFileSync(o,a,{mode:384}),Re.renameSync(o,t)}catch(s){return ln(new Error(`Failed to save ${t}: ${ae(ze(s))}`))}return this.configPath=t,Ra(void 0)}static assertWritable(t,r){if(Re.existsSync(t))try{Re.accessSync(t,Re.constants.W_OK)}catch{return ln(new Error(`Cannot save ${t}: the file is read-only. Make it writable (e.g. chmod u+w ${t}) and retry.`))}try{Re.accessSync(r,Re.constants.W_OK)}catch{return ln(new Error(`Cannot save ${t}: the directory ${r} is not writable. Make it writable (e.g. chmod u+w ${r}) and retry.`))}return Ra(void 0)}mergeWithDisk(t){let r=e.readDiskConfigForMerge(t);return r.kind==="unmergeable"?ln(new Error(`Refusing to save ${t}: ${r.reason}. Writing now would keep only this session's state and drop everything else the file carries (including keys written by other fjall versions). Fix or remove the file and retry.`)):r.kind==="absent"?Ra(this.rootConfig):Ra(el(r.disk,this.rootConfig,this.loadedSnapshot))}static readDiskConfigForMerge(t){if(!Re.existsSync(t))return{kind:"absent"};let r;try{r=Re.readFileSync(t,{encoding:"utf8"})}catch(i){return{kind:"unmergeable",reason:`the existing file could not be read or parsed as JSON (${ae(ze(i))})`}}return Qu(r)}static getConfigDirectory(t){return e.findConfigDirectory(t)}getConfigPath(){return this.configPath}isContentUnavailable(){return this.loadFailed||this.parseDegraded}static warnedLegacyActiveTarget=!1;localConfigCache;resolveProjectDirectory(){return this.configPath!==null?Nt.dirname(this.configPath):e.findConfigDirectory(this.searchStartDir)}localConfigFile(){let t=this.resolveProjectDirectory();return t===null?null:Nt.join(t,zi,Lu)}loadLocalConfig(){if(this.localConfigCache===void 0){let t=this.localConfigFile();if(t===null)return this.localConfigCache={};try{let r=Re.readFileSync(t,{encoding:"utf8"}),i=oX.safeParse(JSON.parse(r));this.localConfigCache=i.success?i.data:{}}catch{this.localConfigCache={}}}return this.localConfigCache}writeLocalConfig(t){let r=this.localConfigFile();if(r===null)return ln(new Error("Cannot persist local state: no fjall-config.json was found from this directory, so there is no project to anchor `.fjall/local.json` to. Run this from inside a fjall project, or run `fjall create account` / `fjall create app` first."));try{Re.mkdirSync(Nt.dirname(r),{recursive:!0});let i=`${r}.tmp-${process.pid}`;Re.writeFileSync(i,JSON.stringify(t,null,2)+`
|
|
341
|
-
`,{encoding:"utf8"}),Re.renameSync(i,r),Tf(Nt.dirname(Nt.dirname(r)),[Af,...Uu],{header:KA,marker:s$})}catch(i){return ln(new Error(`Failed to write ${r}: ${ae(ze(i))}`))}return this.localConfigCache=t,Ra(void 0)}static warnLegacyActiveTargetOnce(){e.warnedLegacyActiveTarget||(e.warnedLegacyActiveTarget=!0,$a.warn("Config","`activeTarget` in fjall-config.json is deprecated and ignored: a committed target must never re-aim a deploy or CI pipeline. Run `fjall target set <name>` to store it locally in .fjall/local.json, then remove `activeTarget` from the committed fjall-config.json."))}getActiveTarget(){let t=this.loadLocalConfig().activeTarget;if(t!==void 0)return t;this.rootConfig.activeTarget!==void 0&&e.warnLegacyActiveTargetOnce()}setActiveTarget(t){let r=this.loadLocalConfig();return r.activeTarget=t,this.writeLocalConfig(r)}clearActiveTarget(){let t=this.loadLocalConfig();return delete t.activeTarget,this.writeLocalConfig(t)}getDomains(){return this.rootConfig.domains??[]}setDomains(t){this.rootConfig.domains=t}addDomain(t){this.rootConfig.domains||(this.rootConfig.domains=[]),this.rootConfig.domains.push(t)}getDomain(t){return this.rootConfig.domains?.find(r=>r.name.toLowerCase()===t.toLowerCase())}removeDomain(t){if(!this.rootConfig.domains)return!1;let r=this.rootConfig.domains.findIndex(i=>i.name.toLowerCase()===t.toLowerCase());return r===-1?!1:(this.rootConfig.domains.splice(r,1),!0)}getOrganisation(){return this.rootConfig.organisation}setOrganisation(t){this.rootConfig.organisation=t}clearOrganisation(){delete this.rootConfig.organisation}};var sX=Object.defineProperty,Gi=(e,t)=>sX(e,"name",{value:t,configurable:!0});function E_(e){let t;try{t=Gf.loadConfig(e)}catch(i){return{kind:"unreadable",reason:ae(ze(i))}}if(t.isContentUnavailable())return{kind:"unreadable",reason:"fjall-config.json exists but its contents could not be loaded (the preceding warning names the problem)"};let r=t.getOrganisation();return r!==void 0?{kind:"bound",bound:r}:t.getConfigPath()===null?{kind:"no_project"}:{kind:"unbound"}}Gi(E_,"readProjectBinding");function x_(e,t,r){switch(e.kind){case"unreadable":return e;case"no_project":return{kind:"unbound",projectFound:!1,identity:t};case"unbound":return{kind:"unbound",projectFound:!0,identity:t};case"bound":return t===null?{kind:"unverifiable",bound:e.bound,reason:r??"the organisation could not be resolved"}:e.bound.id===t.id?{kind:"matched",bound:e.bound}:{kind:"mismatched",bound:e.bound,actual:t}}}Gi(x_,"resolveBindingVerdict");function Z$(e,t={}){return x_(E_(t.startDir),e,t.unresolvedReason)}Gi(Z$,"checkProjectOrganisation");function Ma(e){return e.name!==void 0&&e.name!==""?`${e.name} (${e.id})`:e.id}Gi(Ma,"describeOrganisation");function H$(e,t,r){return`Refusing to ${e}: this project's fjall-config.json records organisation ${Ma(t)} as its home, but the credential in use belongs to ${Ma(r)}. Nothing was created, synthesised or deployed. Cure: authenticate as ${Ma(t)} ('fjall login', or set FJALL_API_KEY to a key for that organisation), or \u2014 if this project really is moving \u2014 run 'fjall org bind --org ${r.id} --force' to re-bind it.`}Gi(H$,"buildWrongOrganisationMessage");function J$(e,t){return`Refusing to ${e}: ${t}, so this project's organisation binding cannot be checked. Nothing was created, synthesised or deployed. Cure: fix fjall-config.json (permissions or contents), then re-run.`}Gi(J$,"buildUnreadableConfigMessage");function X$(e,t){return`Could not confirm which organisation your credential belongs to (${t}). Proceeding \u2014 this project is bound to ${Ma(e)}, and a mismatch would not have been caught.`}Gi(X$,"buildUnverifiableNotice");function Y$(e){return`This project is not bound to an organisation. Run 'fjall org bind' to pin it to ${Ma(e)} \u2014 afterwards, any command run here with another organisation's credential is refused instead of silently landing there.`}Gi(Y$,"buildUnboundNotice");import{createHash as lX}from"node:crypto";var cX=Object.defineProperty,uX=(e,t)=>cX(e,"name",{value:t,configurable:!0});function Q$(e,t){return lX("sha256").update(`${e}${t}`).digest("hex")}uX(Q$,"credentialFingerprint");import*as Wf from"node:fs";var dX=Object.defineProperty,Vf=(e,t)=>dX(e,"name",{value:t,configurable:!0}),e1="org-config-cache.json";function A_(){return vs(e1)}Vf(A_,"orgConfigCachePath");function __(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}Vf(__,"isObject");function T_(e){return __(e)&&typeof e.organisationId=="string"&&e.organisationId!==""&&typeof e.organisationName=="string"}Vf(T_,"isCachedCredentialIdentity");function t1(e){try{let t=A_();if(!Wf.existsSync(t))return null;let r=JSON.parse(Wf.readFileSync(t,"utf-8"));return!__(r)||r.credentialFingerprint!==e?null:T_(r.identity)?r.identity:null}catch(t){return $a.debug("cachedCredentialIdentity","Cache read failed, treating as a miss",{error:ae(ze(t))}),null}}Vf(t1,"readCachedCredentialIdentity");var pX=Object.defineProperty,mX=(e,t)=>pX(e,"name",{value:t,configurable:!0}),r1="https://fjall.io";function Kf(){let e=process.env.FJALL_API_URL;return e!==void 0&&e!==""?e:r1}mX(Kf,"resolveApiBaseUrl");var n1={name:"@fjall/cli",version:"33.0.0",repository:{type:"git",url:"git+https://github.com/fjall-tech/fjall.git",directory:"cli"},description:"Fjall CLI helper",private:!0,type:"module",bin:{fjall:"dist/src/cli.js"},files:["dist/"],scripts:{clean:"rm -rf ./dist ./dist.next ./sourcemaps","clean:node":"rm -rf ./node_modules","copy-files":'DEST="${DEST:-dist}"; find generators -type d -name files | while read dir; do mkdir -p "$DEST/$dir" && cp -R "$dir/." "$DEST/$dir/"; done && cp -R src/proto "./$DEST/src/proto"',build:"rm -rf ./dist.next ./sourcemaps && npx tsc --outDir dist.next && DEST=dist.next npm run copy-files && node ../scripts/minify-dist.mjs dist.next && chmod +x ./dist.next/src/cli.js && rm -rf ./dist && mv ./dist.next ./dist && node ../scripts/stamp-build.mjs",watch:"npm run build && npx tsc-watch","watch:only":'npx tsc-watch --onSuccess "npm run copy-files"',"fjall-cli":"node ./dist/src/cli.js",version:"npx tsx scripts/updateTemplateVersions.ts && node ../scripts/sync-ci-plugin-major.mjs",format:'prettier --write "src/**/*.{ts,tsx,js,jsx,json}" "generators/**/*.{ts,tsx,js,jsx,json}"',"format:check":'prettier --check "src/**/*.{ts,tsx,js,jsx,json}" "generators/**/*.{ts,tsx,js,jsx,json}"',lint:"eslint src/ generators/","lint:fix":"eslint src/ generators/ --fix",typecheck:"tsc --noEmit","typecheck:tests":"tsc --noEmit --project tsconfig.test.json","typecheck:scripts":"tsc --noEmit --project tsconfig.scripts.json","typecheck:all":"npm run typecheck && npm run typecheck:tests && npm run typecheck:scripts",test:"vitest run","test:watch":"vitest","test:coverage":"vitest run --coverage","test:integration":"vitest run --config vitest.config.integration.ts","test:integration:watch":"vitest --config vitest.config.integration.ts","test:e2e":"vitest run --config vitest.e2e.config.ts","test:all":"npm run test && npm run test:integration && npm run test:e2e","test:setup":"node scripts/setupTestFixtures.mjs","test:payload-compat":"npx tsx scripts/testPayloadCompatibility.ts","test:payload-compat:e2e":"npx tsx scripts/testPayloadCompatibility.ts --e2e"},engines:{node:">=22.0.0"},author:"",license:"SEE LICENSE IN LICENSE",devDependencies:{"@eslint/js":"^10.0.1","@playwright/test":"^1.62.0","@testing-library/dom":"^10.4.1","@testing-library/react":"^16.3.2","@types/ejs":"^3.1.5","@types/prompts":"^2.4.9","@types/proper-lockfile":"^4.1.4","@types/react":"^19.2.17","@typescript-eslint/parser":"^8.65.0","@vitest/coverage-v8":"^4.1.10","aws-cdk-lib":"^2.265.0",constructs:"^10.7.2",eslint:"^10.8.0","ink-testing-library":"^4.0.0",jsdom:"^30.0.1",prettier:"^3.9.6","react-dom":"^19.2.8","strip-ansi":"^6.0.1","tsc-watch":"^7.2.1",tsx:"^4.23.1","typescript-eslint":"^8.65.0",vitest:"4.1.10"},dependencies:{"@anthropic-ai/sdk":"^0.115.0","@aws-sdk/client-acm":"^3.1098.0","@aws-sdk/client-auto-scaling":"^3.1098.0","@aws-sdk/client-backup":"^3.1098.0","@aws-sdk/client-cloudformation":"^3.1098.0","@aws-sdk/client-cost-explorer":"^3.1098.0","@aws-sdk/client-ec2":"^3.1098.0","@aws-sdk/client-ecr":"^3.1098.0","@aws-sdk/client-ecs":"^3.1098.0","@aws-sdk/client-elasticache":"^3.1098.0","@aws-sdk/client-iam":"^3.1098.0","@aws-sdk/client-identitystore":"^3.1098.0","@aws-sdk/client-lambda":"^3.1098.0","@aws-sdk/client-organizations":"^3.1098.0","@aws-sdk/client-ram":"^3.1098.0","@aws-sdk/client-rds":"^3.1098.0","@aws-sdk/client-route-53":"^3.1098.0","@aws-sdk/client-s3":"^3.1098.0","@aws-sdk/client-secrets-manager":"^3.1098.0","@aws-sdk/client-ssm":"^3.1098.0","@aws-sdk/client-sso":"^3.1098.0","@aws-sdk/client-sso-admin":"^3.1098.0","@aws-sdk/client-sso-oidc":"^3.1098.0","@aws-sdk/client-sts":"^3.1098.0","@fjall/deploy-core":"^33.0.0","@fjall/generator":"^33.0.0","@fjall/util":"^33.0.0","@nx/devkit":"^23.1.0","@opennextjs/aws":"^4.1.0","@smithy/node-http-handler":"^4.9.13","@toon-format/toon":"^4.1.0","aws-cdk":"^2.1134.0",axios:"^1.19.0",chalk:"^6.0.0","cli-cursor":"^5.0.0",commander:"^15.0.0",ejs:"^6.0.1",ink:"^7.1.1","js-yaml":"^5.2.2",open:"^11.0.0",ora:"^9.4.1",prompts:"^2.4.2","proper-lockfile":"^4.1.2",protobufjs:"^8.7.1",react:"^19.2.8",typescript:"^6.0.3","update-check":"^1.5.4",zod:"^4.4.3"}};var hX=Object.defineProperty,gX=(e,t)=>hX(e,"name",{value:t,configurable:!0}),Uhe=`fjall-cli/${n1.version} node/${process.versions.node} ${yX()}/${vX()}`;var i1=Kf(),zhe=c.looseObject({deviceCode:c.string(),userCode:c.string(),verificationUri:c.string(),expiresIn:c.number(),interval:c.number()}),Bhe=c.looseObject({status:c.string(),apiKey:c.string().optional(),organisationId:c.string().optional(),organisationName:c.string().optional(),email:c.string().optional()}),Ghe=c.looseObject({application:c.looseObject({id:c.string()})}),C_=c.looseObject({id:c.string(),name:c.string(),vpcCidr:c.string().nullable(),connectedAwsAccountId:c.string().nullable()}),Vhe=c.looseObject({applications:c.array(C_),nextCursor:c.string().optional()}),Whe=c.looseObject({application:C_}),Khe=c.looseObject({applications:c.array(C_)}),qhe=c.looseObject({application:c.looseObject({id:c.string(),name:c.string()})}),Zhe=c.looseObject({primaryRegion:c.string().nullish(),secondaryRegions:c.array(c.string()).optional(),disasterRecoveryRegion:c.string().nullish(),providerAccounts:c.custom(e=>Array.isArray(e)),ssoSessions:c.record(c.string(),c.looseObject({ssoRegion:c.string(),ssoStartUrl:c.string()})).optional(),rootOidcRoleArn:c.string().nullish(),allowCodemodLlmFallback:c.boolean().optional(),rootAccessManagement:c.custom(e=>typeof e=="string").optional(),requireTrackedDeploys:c.boolean().optional().catch(void 0)}),Hhe=c.looseObject({id:c.string(),token:c.string(),tokenPrefix:c.string(),name:c.string(),scopes:c.array(c.string())}),bX=c.looseObject({id:c.string(),name:c.string(),tokenPrefix:c.string(),scopes:c.array(c.string()),resourceConstraints:c.record(c.string(),c.unknown()),sourceTag:c.string().nullable(),expiresAt:c.string(),createdAt:c.string(),revokedAt:c.string().nullable(),revokedReason:c.string().nullable(),lastUsedAt:c.string().nullable(),usageCount:c.number(),deniedCount:c.number()}),Jhe=c.looseObject({tokens:c.array(bX)}),Xhe=c.looseObject({scopes:c.array(c.string()),expiresAt:c.string().optional()}),SX=c.looseObject({id:c.string(),awsAccountId:c.string(),accountName:c.string().nullable(),environment:c.string().nullable()}),Yhe=c.looseObject({accounts:c.array(SX)}),EX=c.looseObject({id:c.string(),assetIdentifier:c.string(),name:c.string(),type:c.string(),status:c.string(),region:c.string().nullish(),_count:c.looseObject({complianceIssues:c.number()}).optional()}),xX=c.looseObject({id:c.string(),name:c.string(),assetIdentifier:c.string(),provider:c.string(),type:c.string(),status:c.string(),region:c.string().nullish(),iacStatus:c.string().nullish(),accountId:c.string().nullish(),estimatedMonthlyCost:c.string().nullish(),lastSeenAt:c.string().nullish(),createdAt:c.string().nullish(),updatedAt:c.string().nullish()}),Qhe=c.looseObject({assets:c.array(EX),nextCursor:c.string().optional()}),ege=c.looseObject({asset:xX}),AX=c.looseObject({id:c.string(),ruleId:c.string(),title:c.string(),severity:c.string(),status:c.string()}),tge=c.looseObject({issues:c.array(AX)}),rge=c.record(c.string(),c.unknown()),nge=c.union([c.array(c.record(c.string(),c.unknown())),c.record(c.string(),c.unknown())]),ige=c.record(c.string(),c.unknown()),age=c.record(c.string(),c.unknown()),oge=c.record(c.string(),c.unknown()),sge=c.record(c.string(),c.unknown()),cge=c.looseObject({deployment:c.looseObject({id:c.string()}),minCliVersion:c.string().optional()});var _X=c.object({id:c.string(),releaseNumber:c.number().int(),status:c.string(),commitSha:c.string().nullable(),branch:c.string().nullable(),createdAt:c.string(),assemblyDigest:c.string().nullable(),createdByDeploymentId:c.string().nullable(),rollbackOfReleaseId:c.string().nullable(),services:c.array(vf.strip())}),uge=c.object({releases:c.array(_X),currentReleaseId:c.string().nullable(),nextCursor:c.number().int().optional()}),TX=c.object({id:c.string(),status:c.string(),target:c.string().nullish(),applicationId:c.string().nullish(),applicationName:c.string().nullish(),connectedAwsAccountId:c.string().nullish(),source:c.string().nullish(),startedAt:c.string().nullish(),triggeredByName:c.string().nullish(),machineLabel:c.string().nullish()}),lge=c.object({deployments:c.array(TX)}),dge=c.object({cancelled:c.boolean(),message:c.string().nullish(),declined:c.boolean().nullish()}),pge=c.object({released:c.literal(!0),id:c.string().nullish()}),mge=c.looseObject({organisationId:c.string(),organisationName:c.string(),organisationSlug:c.string().min(1).optional()}),fge=c.looseObject({status:c.string(),roleArn:c.string().optional(),accountId:c.string().optional(),phase:c.string().optional(),reason:c.string().optional()}),hge=c.looseObject({token:c.string()}),CX=c.looseObject({quickCreateUrl:c.string(),externalId:c.string()}),IX=c.looseObject({alreadyConnected:c.literal(!0),account:c.looseObject({awsAccountId:c.string(),accountName:c.string().nullable(),status:c.string()})}),gge=c.union([IX,CX]);function DX(e){return"alreadyConnected"in e&&e.alreadyConnected===!0}gX(DX,"isAlreadyConnected");var yge=c.looseObject({registered:c.boolean(),repository:c.looseObject({id:c.string()}).optional()});var wX=Object.defineProperty,kX=(e,t)=>wX(e,"name",{value:t,configurable:!0});function tl(e=i1){return`Deploy tokens are minted from a signed-in browser session by an owner or admin: open ${e}/settings/ci (Settings \u2192 CI/CD Tokens).`}kX(tl,"deployTokenMintGuidance");var a1=[{command:"ci status",match:w.success,templates:["Run `fjall ci verify` to check the rest of the wiring \u2014 an active deploy token is necessary, not sufficient","Run `fjall ci token list` to see which applications, environments and accounts each active token may deploy to"]},{command:"ci status",match:w.empty,templates:[tl(),"Run `fjall ci setup --plan --app <app>` to learn where the workflow file will go and which secret name it will read (`workflowPath`, `secretName`) \u2014 the two things needed to stage the secret before minting. `--plan` mints nothing and writes nothing, and the workflow BODY is printed on the human surface only: it is not a field of the agent payload"]},{command:"ci token list",match:w.success,templates:["Run `fjall token show <id>` to inspect one token's stored constraints","Run `fjall ci token revoke <id> --reason <text>` to revoke a listed token"]},{command:"ci token list",match:w.empty,templates:[tl(),"Run `fjall ci status` to re-check readiness once a token exists"]},{command:"ci token revoke",match:w.success,templates:["Run `fjall ci token list` to confirm the token now lists as revoked \u2014 a revoked token stays listed, it does not disappear",`Any CI job still holding this token now fails to authenticate. ${tl()}`]}];var qf="Do not retry or vary flags: `supported: false` is the server's capability verdict, not an input error \u2014 every invocation answers the same until the Fjall server is updated to a version that ships this API (the `message` field names the upgrade)",o1=[{command:"deployments list",match:w.unsupported,templates:[qf]},{command:"deployments cancel",match:w.unsupported,templates:[qf]},{command:"deployments force-release",match:w.unsupported,templates:[qf]},{command:"dev list",match:w.unsupported,templates:[qf]},{command:"deployments list",match:w.success,templates:["Run `fjall deployments cancel <id>` to request co-operative cancellation of a listed deployment","Run `fjall deploy logs --deployment-id <id>` to read one deployment's logs"]},{command:"deployments cancel",match:w.success,templates:["Run `fjall deployments list` to confirm whether the slot is free, and read `cancelled` and `declined` before assuming it is: `cancelled: false` means the request was refused, `declined: true` is an already-terminal reject, and a plain granted cancel is co-operative \u2014 the deployment has to acknowledge it","Run `fjall deployments force-release <id> --confirm <id>` to clear a slot that stays occupied (organisation admin, audited \u2014 retype the id in `--confirm`)"]},{command:"deployments force-release",match:w.success,templates:["Run `fjall deployments list` to confirm the slot is free","Run `fjall deploy <app>` to retry the deployment the wedged slot was blocking"]},{command:"dev up",match:w.success,templates:["Run `fjall dev list <app>` to see every slot for this app with its `host` \u2014 rows carry `host`, not a full URL, and it is empty until the slot leaves `creating`","Run `fjall dev down <app> --branch <branch>` to tear this slot down"]},{command:"dev list",match:w.success,templates:["Run `fjall dev down <app> --branch <branch>` to tear one listed slot down \u2014 every row carries the `branch` to name here","Run `fjall dev up <app> --branch <branch>` to bring another branch up"]},{command:"dev down",match:w.success,templates:["Run `fjall dev list <app>` to see which slots remain","Run `fjall dev up <app> --branch <branch>` to bring the branch back up"]},{command:"dev substrate down",match:w.success,templates:["Run `fjall dev list <app>` to confirm no slot survives \u2014 the substrate will not tear down under live slots, and `--force` takes them with it","Any `residuals` row survives the teardown and can still cost: its `cleanupHint` names the manual step"]}];var s1=["Run `fjall domain deploy <name>` to deploy the domain","Run `fjall domain verify <name>` to check DNS delegation once it is deployed","Run `fjall domain export <name>` to export the live zone records"],c1=[{command:"org deploy",match:w.success,templates:["Run `fjall org get` to review the deployed organisation topology and accounts",`Run \`${te.accountDeploy}\` to deploy the account tier if you passed \`--no-cascade\``,`Run \`${te.createApplicationAgent} --name "<name>"\` to create an application to deploy into it`]},{command:"org deploy",match:w.error,templates:["Run `fjall org get` to see which tier of the cascade is already deployed",`Run \`${te.organisationDeploy} --no-cascade\` to retry the organisation stack alone`]},{command:"platform deploy",match:w.success,templates:[`Run \`${te.accountDeploy}\` to deploy the account tier on top of it`]},{command:"platform deploy",match:w.error,templates:["Run `fjall org get` to check the organisation tier is deployed first"]},{command:"account deploy",match:w.success,templates:["Run `fjall apps list` to see which applications are registered","Run `fjall deploy <application>` to deploy one into this account"]},{command:"account deploy",match:w.error,templates:["Run `fjall org get` to confirm the account is registered in the organisation",`Run \`${te.accountDeploy} --target <target>\` to select a specific member account`]},{command:"domain list",match:w.success,templates:["Run `fjall domain verify <name>` to check DNS delegation","Run `fjall domain export <name>` to export zone file","Run `fjall create domain --name <name>` to create a new domain"]},{command:"domain list",match:w.empty,templates:['Run `fjall create domain --name "<name>"` to create a domain',"Run `fjall domain import <name>` to import from Route53"]},{command:"domain verify",match:w.success,templates:["Run `fjall domain export <name>` to export zone file","Run `fjall domain deploy <name>` to deploy domain infrastructure"]},{command:"domain verify",match:w.error,templates:["Run `fjall domain verify <name>` to retry","Run `fjall domain list` to see existing domains"]},{command:"domain export",match:w.success,templates:["Run `fjall domain verify <name>` to check delegation","Run `fjall domain import <name>` to re-import from Route53"]},{command:"domain import",match:w.success,templates:["Run `fjall domain verify <name>` to check delegation","Run `fjall domain export <name>` to see the zone file","Run `fjall domain deploy <name>` to deploy domain infrastructure"]},{command:"domain import",match:w.error,templates:["Run `fjall domain import --hosted-zone-id <id>` to import by zone ID","Run `fjall domain list` to see existing domains"]},{command:"domain records list",match:w.success,templates:["Run `fjall domain sync <domain>` for the full zone-hygiene report","Run `fjall domain sync <domain> --fix` to remediate residue records via the destruction ceremony"]},{command:"domain records list",match:w.empty,templates:["Run `fjall domain deploy <domain>` to deploy the domain's declared records","Run `fjall domain list` to see existing domains"]},{command:"domain records list",match:w.error,templates:["Run `fjall domain records list <domain> --hosted-zone-id <id>` when the zone is not resolvable by name",`Run \`${te.connect}\` if AWS credentials are missing`]},{command:"domain sync",match:w.success,templates:["Run `fjall domain sync <domain> --fix` to remediate residue records (ceremony-gated)","Run `fjall domain records list <domain>` to see every record with its owner"]},{command:"domain sync",match:w.error,templates:["Run `fjall domain sync <domain> --hosted-zone-id <id>` when the zone is not resolvable by name","Run `fjall domain list` to see existing domains"]},{command:"domain delegate",match:w.success,templates:["Run `fjall domain verify <domain>` to confirm public DNS resolution","Run `fjall domain deploy <domain>` to continue a two-phase deploy after delegation"]},{command:"domain delegate",match:w.error,templates:["Run `fjall domain deploy <parent-domain>` so the parent publishes its DelegationRole","Run `fjall domain verify <domain> --show-delegation` for registrar instructions"]},{command:"domain destroy",match:w.success,templates:["Run `fjall domain list` to see remaining domains","Run `fjall domain sync <parent-domain>` to confirm no delegation residue remains"]},{command:"domain destroy",match:w.error,templates:["Run `fjall domain destroy <domain> --remediate '<name>'=recreate` with the exact consent the ticket names","Run `fjall domain list` to see existing domains"]},{command:"domain deploy",match:w.success,templates:["Run `fjall domain verify <domain>` to check DNS propagation","Run `fjall domain delegate <domain>` to write the NS delegation for a delegated child"]},{command:"domain deploy",match:w.error,templates:["Run `fjall domain deploy <domain>` to resume \u2014 the zone phase is retained and skipped on re-run","Run `fjall domain verify <domain> --show-delegation` for registrar delegation instructions"]},{command:"domain eject",match:w.success,templates:["Review the ejected infrastructure.ts \u2014 it is now vanilla CDK owned by you","Run `fjall domain list` to see remaining managed domains"]},{command:"create domain",match:w.success,templates:s1},{command:"domain create",match:w.success,templates:s1},{command:"create domain",match:w.error,templates:["Run `fjall domain list` to see existing domains",'Run `fjall create domain --name "<name>"` to retry with a different name']},{command:"create account",match:w.success,templates:[`Run \`${te.connect} --environment production\` to link your AWS account`,`Run \`${te.accountDeploy}\` to deploy account infrastructure (after connecting)`]},{command:"create account",match:w.error,templates:[`Run \`${te.createAccount} --primary-region <region>\` to retry`,`Run \`${te.createAccount} --help\` for usage information`]},{command:"create org",match:w.success,templates:[`Run \`${te.connect} --name "<account-name>" --region <region>\` to link the AWS Organizations management account \u2014 omit \`--environment\` so it registers at the organisation tier`,`Run \`${te.organisationDeploy}\` to deploy all infrastructure (after connecting)`]},{command:"create org",match:w.error,templates:[`Run \`${te.createOrganisation} --email "<email>"\` to retry (add \`--name "<name>"\` only for a brand-new organisation)`,`Run \`${te.createOrganisation} --help\` for all options`]},{command:"restore",match:w.successDryRun,templates:["Run `fjall restore <resourceType> --recovery-point <recoveryPointArn> --yes` to initiate restore","Run `fjall apps list` to see existing applications"]},{command:"restore",match:w.success,templates:["Open the AWS Console URL above to monitor restore progress","Run `fjall import` to import the restored resource after completion"]},{command:"restore",match:w.errorWithCode("NOT_FOUND"),templates:["Verify the recovery point ARN is correct and exists in the current region","Run `fjall restore <resourceType> --recovery-point <arn>` to retry"]},{command:"restore",match:w.errorWithCode("FORBIDDEN"),templates:["Ensure the IAM role has backup:StartRestoreJob and iam:PassRole permissions","Run `fjall restore` interactively to configure with guided setup"]},{command:"import",match:w.successDryRun,templates:["Run `fjall import --app <app> --resource-id <resourceId> --yes` to import a specific resource","Run `fjall import --app <app> --yes` to import all discovered resources"]},{command:"import",match:w.success,templates:["Run `fjall deploy <app>` to deploy with the imported resource","Run `fjall apps describe <app>` to see updated resources"]},{command:"import",match:w.errorWithCode("NOT_FOUND"),templates:[`Run \`${te.createApplicationAgent} --name "<app>"\` to create the application`,"Run `fjall apps list` to see existing applications"]},{command:"import",match:w.errorWithCode("VALIDATION_ERROR"),templates:["Run `fjall import --app <app> --resource-id <resourceId>` to import a specific resource","Run `fjall import --app <app> --resource-id <resourceId> --yes` to import immediately"]},{command:"aws exec",match:w.success,templates:["Run `fjall aws exec -- <command...>` to run another AWS CLI command","Run `fjall status` to check application health"]},{command:"aws exec",match:w.error,templates:["Retry the command \u2014 OIDC token mints can fail transiently",`Run \`${te.login}\` if the retry also fails with an authentication error`]},{command:"unlock bucket",match:w.success,templates:["Re-put sane bucket policy statements (enforceSSL deny, access grants) \u2014 the unlock deleted the ENTIRE policy","Run `fjall destroy <app>` to retry the blocked stack cleanup"]},{command:"unlock bucket",match:w.error,templates:["Ensure your credentials belong to the organisation's management account \u2014 STS AssumeRoot is rejected elsewhere","Run `fjall unlock bucket <name> --account <id> --acknowledge-root-session` to retry"]}];var NX=Object.defineProperty,p1=(e,t)=>NX(e,"name",{value:t,configurable:!0}),u1="Run `fjall connect status` to check that an AWS account is connected: asset discovery only inventories connected accounts, so an organisation with none has nothing to inventory",l1=["Run `fjall assets show <asset>` to read one asset in full \u2014 pass its `assetIdentifier`","Run `fjall assets compliance <asset>` to list an asset's recorded posture issues \u2014 pass its `assetIdentifier`, the address every server version accepts"],d1=p1(e=>e.outcome==="success"&&e.nextCursor!==void 0,"isTruncatedPage"),m1=[{command:"assets list",match:p1(e=>d1(e)&&e.fields!==void 0&&e.fields!=="","match"),templates:["This window is truncated \u2014 more assets exist beyond these rows. Run `fjall assets list --cursor <nextCursor> --fields <fields>` to fetch the next page with the same projection; `total` counts this window only, and `fjall assets summary` reports the estate-wide tally, split active/deleted",...l1]},{command:"assets list",match:d1,templates:["This window is truncated \u2014 more assets exist beyond these rows. Run `fjall assets list --cursor <nextCursor>` to fetch the next page; `total` counts this window only, and `fjall assets summary` reports the estate-wide tally, split active/deleted",...l1]},{command:"assets list",match:w.success,templates:["The `total` aggregate counts the rows in this response, not the estate: `--take` bounds the window (default 50). No `nextCursor` aggregate here means the estate ends with these rows; `fjall assets summary` reports the estate-wide tally, split active/deleted","Run `fjall assets show <asset>` to read one asset in full","Run `fjall assets compliance <asset>` to list an asset's recorded posture issues \u2014 pass its `assetIdentifier`, the address every server version accepts (row `id`s are only accepted by newer servers)"]},{command:"assets list",match:w.empty,templates:["Run `fjall assets list --status deleted` to include assets discovery has since marked deleted \u2014 the default listing hides them",u1]},{command:"assets show",match:w.success,templates:["Run `fjall assets compliance <asset>` to list the posture issues recorded against this asset","Run `fjall assets show <asset> --fields id,accountId,iacStatus,estimatedMonthlyCost,lastSeenAt` to read the fields the default projection omits"]},{command:"assets compliance",match:w.success,templates:["Read the `status` column before acting: this listing returns every issue recorded against the asset, `resolved` and `suppressed` included, where the `openIssues` count on `fjall assets list` counts only the open ones","Run `fjall compliance fix --domain compliance --issue-id <issueId>` to read this issue in full alongside the organisation's other open issues. `--domain` is the producer's category \u2014 one of `compliance`, `cost`, `performance` \u2014 not a framework name, and the response is context to reason from, not a remediation step: use `--execute` to run one","Run `fjall assets show <asset>` to read the asset these issues were raised against"]},{command:"assets compliance",match:w.empty,templates:["No issue of ANY status has been recorded against this asset \u2014 an empty listing here is not the same as issues that were resolved, which would still appear with `status: resolved`","Run `fjall assets list --fields name,assetIdentifier,openIssues` to find the assets that do carry open issues"]},{command:"assets summary",match:w.success,templates:["Run `fjall assets list --fields name,assetIdentifier,openIssues` to see which assets sit behind `withIssues` \u2014 `withIssues` counts the assets carrying at least one open issue, `openIssues` counts those issues per asset","Run `fjall assets list --take <n>` to read the rows behind these totals \u2014 page onwards with `--cursor` when the listing reports a `nextCursor`, and pass `--status deleted` to include the `deleted` rows in the listing (interleaved with active \u2014 read the `status` column). These totals are estate-wide (the summary pages the listing to exhaustion, deleted assets included): `total` counts the whole estate, `active` and `deleted` split it"]},{command:"assets summary",match:w.empty,templates:[u1]},{command:"costs show",match:w.success,templates:["Run `fjall costs --mode forecast` to see forecasted spend","Run `fjall costs --mode breakdown` to see service-level breakdown"]},{command:"costs show",match:w.error,templates:["Run `fjall costs --app <app>` to filter by application","Run `fjall costs --help` for usage information"]},{command:"metrics show",match:w.success,templates:["Run `fjall metrics --mode latency` to see latency percentiles","Run `fjall metrics --mode errors` to see error trends"]},{command:"metrics show",match:w.error,templates:["Run `fjall metrics --app <app>` to filter by application","Run `fjall metrics --help` for usage information"]},{command:"compliance fix",match:w.success,templates:["Run `fjall compliance fix --domain <domain> --issue-id <id>` to narrow the suggestions to one issue","Run `fjall deploy <app>` to apply remediation changes"]},{command:"compliance fix",match:w.error,templates:["Run `fjall compliance fix --domain <domain>` to name the compliance domain","Run `fjall compliance --help` for usage information"]},{command:"compliance fix --execute",match:w.success,templates:["Read the result's `kind` before treating the issue as fixed: `auto-pr` opened a pull request that still has to be merged, `imperative` rewrote the live policy, and `manual-hint` changed nothing \u2014 its `awsCliHint` carries the manual step, and that field is absent for rules that supply no hint (`message` is a fixed string either way)","Do not re-read the issue to confirm the cure: nothing on the remediation path writes to the issue record, so `status` stays `open` until the next discovery scan re-evaluates the asset. Verify at the thing that changed \u2014 the pull request, or the live resource","Run `fjall deploy <app>` to roll out an `auto-pr` remediation once its pull request is merged"]},{command:"deploy diff",match:w.success,templates:["Run `fjall deploy logs --deployment-id <id>` to analyse deployment logs","Run `fjall status <app>` to check current deployment health"]},{command:"deploy diff",match:w.error,templates:["Run `fjall list deployments` to see recent deployment IDs","Run `fjall deploy diff --help` for usage information"]},{command:"deploy logs",match:w.success,templates:["Run `fjall deploy diff <idA> <idB>` to compare two deployments","Run `fjall status <app>` to check current deployment health"]},{command:"deploy logs",match:w.error,templates:["Run `fjall deploy logs --deployment-id <id>` with a valid deployment ID","Run `fjall list deployments` to find a deployment ID"]}];var PX={command:"*",match:w.error,templates:["Run `fjall <command> --help` for usage information"]},f1=[...U$,...z$,...G$,...a1,...o1,...c1,...m1,PX];var RX=Object.defineProperty,OX=(e,t)=>RX(e,"name",{value:t,configurable:!0}),h1=["app","environment","region","profile","target","cluster","service","lambda","status","type"],Fa=["app","cluster","service","lambda"],$X=["status","type","region"],I_={deploy:["environment","region","target"],"deploy diff":[],"deploy logs":[],destroy:["target"],"org deploy":["target"],"org destroy":["target"],"platform deploy":["target"],"platform destroy":["target"],"account deploy":["target"],"account destroy":["target"],status:[],rollout:[],list:["app"],apps:["target"],connect:["environment","region"],"connect status":[],import:["app","region"],costs:["app"],metrics:["app"],compliance:["app"],"token create":["app","environment"],"unlock bucket":["region"],"aws exec":["app","region","target"],"secrets set":Fa,"secrets get":Fa,"secrets list":Fa,"secrets delete":Fa,"secrets export":Fa,"secrets import":Fa,"secrets exec":Fa,"assets list":$X},jX=Math.max(...Object.keys(I_).map(e=>e.split(" ").length));function D_(e){let t=e.trim().split(/\s+/).slice(1);for(let r=jX;r>=1;r--){let i=t.slice(0,r).join(" ");if(Object.hasOwn(I_,i))return I_[i]}return[]}OX(D_,"resolvePreservableFlags");var MX=Object.defineProperty,Hf=(e,t)=>MX(e,"name",{value:t,configurable:!0});function w_(e){let t=e.replace(/[\u0000-\u001f\u007f`]/g,"");return/[^\w@%+=:,./-]/.test(t)?`'${t.replace(/'/g,"'\\''")}'`:t}Hf(w_,"shellEscape");function g1(e,t,r){let i=new Set,n=e.replace(/<(\w+)>/g,(a,o)=>{let s=t[o];return s===void 0||s===""?`<${o}>`:(i.add(o),o==="command"?s:w_(s))});return y1(n,r,i)}Hf(g1,"interpolateTemplate");var Zf=class{static{Hf(this,"SuggestionResolver")}command;flags;constructor(t,r){this.command=t,this.flags=r}resolve(t){let r=f1.find(i=>(i.command===this.command||i.command==="*")&&i.match(t));return r===void 0?[]:r.templates.map(i=>g1(i,t,this.flags))}};function y1(e,t,r=new Set){let i=/`(fjall[^`]*)`/.exec(e),n=i?.[1];if(i===null||n===void 0)return e;let a=D_(n),o=[];for(let p of h1){if(!a.includes(p))continue;let h=t[p];h!==void 0&&h!==""&&!r.has(p)&&!n.includes(`--${p}`)&&o.push(`--${p} ${w_(h)}`)}if(o.length===0)return e;let s=` ${o.join(" ")}`,u=n.indexOf(" -- "),d=u===-1?`${n}${s}`:`${n.slice(0,u)}${s}${n.slice(u)}`;return e.slice(0,i.index)+`\`${d}\``+e.slice(i.index+i[0].length)}Hf(y1,"applyPreservedFlags");var FX=Object.defineProperty,Yn=(e,t)=>FX(e,"name",{value:t,configurable:!0});function Kr(e,t){if(t!==void 0&&Ns(e)){let i={};for(let[n,a]of Object.entries(e))i[n]=t.has(n)?a:Kr(a);return i}if(typeof e=="string")return ae(e);if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(i=>Kr(i));if(e instanceof Date||e instanceof RegExp)return e;let r={};for(let[i,n]of Object.entries(e))r[i]=Kr(n);return r}Yn(Kr,"maskTree");function Jf(e){if(Array.isArray(e))return e.map(Jf);if(!Ns(e))return e;let t={};for(let[r,i]of Object.entries(e))i!==void 0&&(t[r]=Jf(i));return t}Yn(Jf,"stripAbsent");function Ns(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof Date)&&!(e instanceof RegExp)}Yn(Ns,"isPlainRecord");function v1(e){let t=e?.verbatimFields;return t!==void 0&&t.length>0?new Set(t):void 0}Yn(v1,"toVerbatimKeys");function b1(e,t){return t===void 0||!Ns(e)?!1:Object.keys(e).some(r=>t.has(r))}Yn(b1,"carriesVerbatimField");function S1(e,t){let r=e;for(let i of t.split(".")){if(!Ns(r))return;r=r[i]}return r}Yn(S1,"resolveDotPath");function E1(e,t,r){let i=e.project(t),n={};for(let a of r)a in i&&(n[a]=i[a]);return n}Yn(E1,"projectSelectedFields");var rl=class{static{Yn(this,"AgentOutputWriter")}write;hasWrittenBlock=!1;resolver;flags;full;budget;requestedFields;constructor(t){this.write=t.writeFn??(r=>{process.stdout.write(r)}),this.resolver=new Zf(t.command,t.flags),this.flags=t.flags,this.full=t.full??!1,this.budget=t.budget,this.requestedFields=t.fields??[]}get isFullOutput(){return this.full}writeBlock(t){t!==""&&(this.hasWrittenBlock&&this.write(e_+`
|
|
341
|
+
`,{encoding:"utf8"}),Re.renameSync(i,r),Tf(Nt.dirname(Nt.dirname(r)),[Af,...Uu],{header:KA,marker:s$})}catch(i){return ln(new Error(`Failed to write ${r}: ${ae(ze(i))}`))}return this.localConfigCache=t,Ra(void 0)}static warnLegacyActiveTargetOnce(){e.warnedLegacyActiveTarget||(e.warnedLegacyActiveTarget=!0,$a.warn("Config","`activeTarget` in fjall-config.json is deprecated and ignored: a committed target must never re-aim a deploy or CI pipeline. Run `fjall target set <name>` to store it locally in .fjall/local.json, then remove `activeTarget` from the committed fjall-config.json."))}getActiveTarget(){let t=this.loadLocalConfig().activeTarget;if(t!==void 0)return t;this.rootConfig.activeTarget!==void 0&&e.warnLegacyActiveTargetOnce()}setActiveTarget(t){let r=this.loadLocalConfig();return r.activeTarget=t,this.writeLocalConfig(r)}clearActiveTarget(){let t=this.loadLocalConfig();return delete t.activeTarget,this.writeLocalConfig(t)}getDomains(){return this.rootConfig.domains??[]}setDomains(t){this.rootConfig.domains=t}addDomain(t){this.rootConfig.domains||(this.rootConfig.domains=[]),this.rootConfig.domains.push(t)}getDomain(t){return this.rootConfig.domains?.find(r=>r.name.toLowerCase()===t.toLowerCase())}removeDomain(t){if(!this.rootConfig.domains)return!1;let r=this.rootConfig.domains.findIndex(i=>i.name.toLowerCase()===t.toLowerCase());return r===-1?!1:(this.rootConfig.domains.splice(r,1),!0)}getOrganisation(){return this.rootConfig.organisation}setOrganisation(t){this.rootConfig.organisation=t}clearOrganisation(){delete this.rootConfig.organisation}};var sX=Object.defineProperty,Gi=(e,t)=>sX(e,"name",{value:t,configurable:!0});function E_(e){let t;try{t=Gf.loadConfig(e)}catch(i){return{kind:"unreadable",reason:ae(ze(i))}}if(t.isContentUnavailable())return{kind:"unreadable",reason:"fjall-config.json exists but its contents could not be loaded (the preceding warning names the problem)"};let r=t.getOrganisation();return r!==void 0?{kind:"bound",bound:r}:t.getConfigPath()===null?{kind:"no_project"}:{kind:"unbound"}}Gi(E_,"readProjectBinding");function x_(e,t,r){switch(e.kind){case"unreadable":return e;case"no_project":return{kind:"unbound",projectFound:!1,identity:t};case"unbound":return{kind:"unbound",projectFound:!0,identity:t};case"bound":return t===null?{kind:"unverifiable",bound:e.bound,reason:r??"the organisation could not be resolved"}:e.bound.id===t.id?{kind:"matched",bound:e.bound}:{kind:"mismatched",bound:e.bound,actual:t}}}Gi(x_,"resolveBindingVerdict");function Z$(e,t={}){return x_(E_(t.startDir),e,t.unresolvedReason)}Gi(Z$,"checkProjectOrganisation");function Ma(e){return e.name!==void 0&&e.name!==""?`${e.name} (${e.id})`:e.id}Gi(Ma,"describeOrganisation");function H$(e,t,r){return`Refusing to ${e}: this project's fjall-config.json records organisation ${Ma(t)} as its home, but the credential in use belongs to ${Ma(r)}. Nothing was created, synthesised or deployed. Cure: authenticate as ${Ma(t)} ('fjall login', or set FJALL_API_KEY to a key for that organisation), or \u2014 if this project really is moving \u2014 run 'fjall org bind --org ${r.id} --force' to re-bind it.`}Gi(H$,"buildWrongOrganisationMessage");function J$(e,t){return`Refusing to ${e}: ${t}, so this project's organisation binding cannot be checked. Nothing was created, synthesised or deployed. Cure: fix fjall-config.json (permissions or contents), then re-run.`}Gi(J$,"buildUnreadableConfigMessage");function X$(e,t){return`Could not confirm which organisation your credential belongs to (${t}). Proceeding \u2014 this project is bound to ${Ma(e)}, and a mismatch would not have been caught.`}Gi(X$,"buildUnverifiableNotice");function Y$(e){return`This project is not bound to an organisation. Run 'fjall org bind' to pin it to ${Ma(e)} \u2014 afterwards, any command run here with another organisation's credential is refused instead of silently landing there.`}Gi(Y$,"buildUnboundNotice");import{createHash as lX}from"node:crypto";var cX=Object.defineProperty,uX=(e,t)=>cX(e,"name",{value:t,configurable:!0});function Q$(e,t){return lX("sha256").update(`${e}${t}`).digest("hex")}uX(Q$,"credentialFingerprint");import*as Wf from"node:fs";var dX=Object.defineProperty,Vf=(e,t)=>dX(e,"name",{value:t,configurable:!0}),e1="org-config-cache.json";function A_(){return vs(e1)}Vf(A_,"orgConfigCachePath");function __(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}Vf(__,"isObject");function T_(e){return __(e)&&typeof e.organisationId=="string"&&e.organisationId!==""&&typeof e.organisationName=="string"}Vf(T_,"isCachedCredentialIdentity");function t1(e){try{let t=A_();if(!Wf.existsSync(t))return null;let r=JSON.parse(Wf.readFileSync(t,"utf-8"));return!__(r)||r.credentialFingerprint!==e?null:T_(r.identity)?r.identity:null}catch(t){return $a.debug("cachedCredentialIdentity","Cache read failed, treating as a miss",{error:ae(ze(t))}),null}}Vf(t1,"readCachedCredentialIdentity");var pX=Object.defineProperty,mX=(e,t)=>pX(e,"name",{value:t,configurable:!0}),r1="https://fjall.io";function Kf(){let e=process.env.FJALL_API_URL;return e!==void 0&&e!==""?e:r1}mX(Kf,"resolveApiBaseUrl");var n1={name:"@fjall/cli",version:"33.1.0",repository:{type:"git",url:"git+https://github.com/fjall-tech/fjall.git",directory:"cli"},description:"Fjall CLI helper",private:!0,type:"module",bin:{fjall:"dist/src/cli.js"},files:["dist/"],scripts:{clean:"rm -rf ./dist ./dist.next ./sourcemaps","clean:node":"rm -rf ./node_modules","copy-files":'DEST="${DEST:-dist}"; find generators -type d -name files | while read dir; do mkdir -p "$DEST/$dir" && cp -R "$dir/." "$DEST/$dir/"; done && cp -R src/proto "./$DEST/src/proto"',build:"rm -rf ./dist.next ./sourcemaps && npx tsc --outDir dist.next && DEST=dist.next npm run copy-files && node ../scripts/minify-dist.mjs dist.next && chmod +x ./dist.next/src/cli.js && rm -rf ./dist && mv ./dist.next ./dist && node ../scripts/stamp-build.mjs",watch:"npm run build && npx tsc-watch","watch:only":'npx tsc-watch --onSuccess "npm run copy-files"',"fjall-cli":"node ./dist/src/cli.js",version:"npx tsx scripts/updateTemplateVersions.ts && node ../scripts/sync-ci-plugin-major.mjs",format:'prettier --write "src/**/*.{ts,tsx,js,jsx,json}" "generators/**/*.{ts,tsx,js,jsx,json}"',"format:check":'prettier --check "src/**/*.{ts,tsx,js,jsx,json}" "generators/**/*.{ts,tsx,js,jsx,json}"',lint:"eslint src/ generators/","lint:fix":"eslint src/ generators/ --fix",typecheck:"tsc --noEmit","typecheck:tests":"tsc --noEmit --project tsconfig.test.json","typecheck:scripts":"tsc --noEmit --project tsconfig.scripts.json","typecheck:all":"npm run typecheck && npm run typecheck:tests && npm run typecheck:scripts",test:"vitest run","test:watch":"vitest","test:coverage":"vitest run --coverage","test:integration":"vitest run --config vitest.config.integration.ts","test:integration:watch":"vitest --config vitest.config.integration.ts","test:e2e":"vitest run --config vitest.e2e.config.ts","test:all":"npm run test && npm run test:integration && npm run test:e2e","test:setup":"node scripts/setupTestFixtures.mjs","test:payload-compat":"npx tsx scripts/testPayloadCompatibility.ts","test:payload-compat:e2e":"npx tsx scripts/testPayloadCompatibility.ts --e2e"},engines:{node:">=22.0.0"},author:"",license:"SEE LICENSE IN LICENSE",devDependencies:{"@eslint/js":"^10.0.1","@playwright/test":"^1.62.0","@testing-library/dom":"^10.4.1","@testing-library/react":"^16.3.2","@types/ejs":"^3.1.5","@types/prompts":"^2.4.9","@types/proper-lockfile":"^4.1.4","@types/react":"^19.2.17","@typescript-eslint/parser":"^8.65.0","@vitest/coverage-v8":"^4.1.10","aws-cdk-lib":"^2.265.0",constructs:"^10.7.2",eslint:"^10.8.0","ink-testing-library":"^4.0.0",jsdom:"^30.0.1",prettier:"^3.9.6","react-dom":"^19.2.8","strip-ansi":"^6.0.1","tsc-watch":"^7.2.1",tsx:"^4.23.1","typescript-eslint":"^8.65.0",vitest:"4.1.10"},dependencies:{"@anthropic-ai/sdk":"^0.115.0","@aws-sdk/client-acm":"^3.1098.0","@aws-sdk/client-auto-scaling":"^3.1098.0","@aws-sdk/client-backup":"^3.1098.0","@aws-sdk/client-cloudformation":"^3.1098.0","@aws-sdk/client-cost-explorer":"^3.1098.0","@aws-sdk/client-ec2":"^3.1098.0","@aws-sdk/client-ecr":"^3.1098.0","@aws-sdk/client-ecs":"^3.1098.0","@aws-sdk/client-elasticache":"^3.1098.0","@aws-sdk/client-iam":"^3.1098.0","@aws-sdk/client-identitystore":"^3.1098.0","@aws-sdk/client-lambda":"^3.1098.0","@aws-sdk/client-organizations":"^3.1098.0","@aws-sdk/client-ram":"^3.1098.0","@aws-sdk/client-rds":"^3.1098.0","@aws-sdk/client-route-53":"^3.1098.0","@aws-sdk/client-s3":"^3.1098.0","@aws-sdk/client-secrets-manager":"^3.1098.0","@aws-sdk/client-ssm":"^3.1098.0","@aws-sdk/client-sso":"^3.1098.0","@aws-sdk/client-sso-admin":"^3.1098.0","@aws-sdk/client-sso-oidc":"^3.1098.0","@aws-sdk/client-sts":"^3.1098.0","@fjall/deploy-core":"^33.1.0","@fjall/generator":"^33.1.0","@fjall/util":"^33.1.0","@nx/devkit":"^23.1.0","@opennextjs/aws":"^4.1.0","@smithy/node-http-handler":"^4.9.13","@toon-format/toon":"^4.1.0","aws-cdk":"^2.1134.0",axios:"^1.19.0",chalk:"^6.0.0","cli-cursor":"^5.0.0",commander:"^15.0.0",ejs:"^6.0.1",ink:"^7.1.1","js-yaml":"^5.2.2",open:"^11.0.0",ora:"^9.4.1",prompts:"^2.4.2","proper-lockfile":"^4.1.2",protobufjs:"^8.7.1",react:"^19.2.8",typescript:"^6.0.3","update-check":"^1.5.4",zod:"^4.4.3"}};var hX=Object.defineProperty,gX=(e,t)=>hX(e,"name",{value:t,configurable:!0}),Uhe=`fjall-cli/${n1.version} node/${process.versions.node} ${yX()}/${vX()}`;var i1=Kf(),zhe=c.looseObject({deviceCode:c.string(),userCode:c.string(),verificationUri:c.string(),expiresIn:c.number(),interval:c.number()}),Bhe=c.looseObject({status:c.string(),apiKey:c.string().optional(),organisationId:c.string().optional(),organisationName:c.string().optional(),email:c.string().optional()}),Ghe=c.looseObject({application:c.looseObject({id:c.string()})}),C_=c.looseObject({id:c.string(),name:c.string(),vpcCidr:c.string().nullable(),connectedAwsAccountId:c.string().nullable()}),Vhe=c.looseObject({applications:c.array(C_),nextCursor:c.string().optional()}),Whe=c.looseObject({application:C_}),Khe=c.looseObject({applications:c.array(C_)}),qhe=c.looseObject({application:c.looseObject({id:c.string(),name:c.string()})}),Zhe=c.looseObject({primaryRegion:c.string().nullish(),secondaryRegions:c.array(c.string()).optional(),disasterRecoveryRegion:c.string().nullish(),providerAccounts:c.custom(e=>Array.isArray(e)),ssoSessions:c.record(c.string(),c.looseObject({ssoRegion:c.string(),ssoStartUrl:c.string()})).optional(),rootOidcRoleArn:c.string().nullish(),allowCodemodLlmFallback:c.boolean().optional(),rootAccessManagement:c.custom(e=>typeof e=="string").optional(),requireTrackedDeploys:c.boolean().optional().catch(void 0)}),Hhe=c.looseObject({id:c.string(),token:c.string(),tokenPrefix:c.string(),name:c.string(),scopes:c.array(c.string())}),bX=c.looseObject({id:c.string(),name:c.string(),tokenPrefix:c.string(),scopes:c.array(c.string()),resourceConstraints:c.record(c.string(),c.unknown()),sourceTag:c.string().nullable(),expiresAt:c.string(),createdAt:c.string(),revokedAt:c.string().nullable(),revokedReason:c.string().nullable(),lastUsedAt:c.string().nullable(),usageCount:c.number(),deniedCount:c.number()}),Jhe=c.looseObject({tokens:c.array(bX)}),Xhe=c.looseObject({scopes:c.array(c.string()),expiresAt:c.string().optional()}),SX=c.looseObject({id:c.string(),awsAccountId:c.string(),accountName:c.string().nullable(),environment:c.string().nullable()}),Yhe=c.looseObject({accounts:c.array(SX)}),EX=c.looseObject({id:c.string(),assetIdentifier:c.string(),name:c.string(),type:c.string(),status:c.string(),region:c.string().nullish(),_count:c.looseObject({complianceIssues:c.number()}).optional()}),xX=c.looseObject({id:c.string(),name:c.string(),assetIdentifier:c.string(),provider:c.string(),type:c.string(),status:c.string(),region:c.string().nullish(),iacStatus:c.string().nullish(),accountId:c.string().nullish(),estimatedMonthlyCost:c.string().nullish(),lastSeenAt:c.string().nullish(),createdAt:c.string().nullish(),updatedAt:c.string().nullish()}),Qhe=c.looseObject({assets:c.array(EX),nextCursor:c.string().optional()}),ege=c.looseObject({asset:xX}),AX=c.looseObject({id:c.string(),ruleId:c.string(),title:c.string(),severity:c.string(),status:c.string()}),tge=c.looseObject({issues:c.array(AX)}),rge=c.record(c.string(),c.unknown()),nge=c.union([c.array(c.record(c.string(),c.unknown())),c.record(c.string(),c.unknown())]),ige=c.record(c.string(),c.unknown()),age=c.record(c.string(),c.unknown()),oge=c.record(c.string(),c.unknown()),sge=c.record(c.string(),c.unknown()),cge=c.looseObject({deployment:c.looseObject({id:c.string()}),minCliVersion:c.string().optional()});var _X=c.object({id:c.string(),releaseNumber:c.number().int(),status:c.string(),commitSha:c.string().nullable(),branch:c.string().nullable(),createdAt:c.string(),assemblyDigest:c.string().nullable(),createdByDeploymentId:c.string().nullable(),rollbackOfReleaseId:c.string().nullable(),services:c.array(vf.strip())}),uge=c.object({releases:c.array(_X),currentReleaseId:c.string().nullable(),nextCursor:c.number().int().optional()}),TX=c.object({id:c.string(),status:c.string(),target:c.string().nullish(),applicationId:c.string().nullish(),applicationName:c.string().nullish(),connectedAwsAccountId:c.string().nullish(),source:c.string().nullish(),startedAt:c.string().nullish(),triggeredByName:c.string().nullish(),machineLabel:c.string().nullish()}),lge=c.object({deployments:c.array(TX)}),dge=c.object({cancelled:c.boolean(),message:c.string().nullish(),declined:c.boolean().nullish()}),pge=c.object({released:c.literal(!0),id:c.string().nullish()}),mge=c.looseObject({organisationId:c.string(),organisationName:c.string(),organisationSlug:c.string().min(1).optional()}),fge=c.looseObject({status:c.string(),roleArn:c.string().optional(),accountId:c.string().optional(),phase:c.string().optional(),reason:c.string().optional()}),hge=c.looseObject({token:c.string()}),CX=c.looseObject({quickCreateUrl:c.string(),externalId:c.string()}),IX=c.looseObject({alreadyConnected:c.literal(!0),account:c.looseObject({awsAccountId:c.string(),accountName:c.string().nullable(),status:c.string()})}),gge=c.union([IX,CX]);function DX(e){return"alreadyConnected"in e&&e.alreadyConnected===!0}gX(DX,"isAlreadyConnected");var yge=c.looseObject({registered:c.boolean(),repository:c.looseObject({id:c.string()}).optional()});var wX=Object.defineProperty,kX=(e,t)=>wX(e,"name",{value:t,configurable:!0});function tl(e=i1){return`Deploy tokens are minted from a signed-in browser session by an owner or admin: open ${e}/settings/ci (Settings \u2192 CI/CD Tokens).`}kX(tl,"deployTokenMintGuidance");var a1=[{command:"ci status",match:w.success,templates:["Run `fjall ci verify` to check the rest of the wiring \u2014 an active deploy token is necessary, not sufficient","Run `fjall ci token list` to see which applications, environments and accounts each active token may deploy to"]},{command:"ci status",match:w.empty,templates:[tl(),"Run `fjall ci setup --plan --app <app>` to learn where the workflow file will go and which secret name it will read (`workflowPath`, `secretName`) \u2014 the two things needed to stage the secret before minting. `--plan` mints nothing and writes nothing, and the workflow BODY is printed on the human surface only: it is not a field of the agent payload"]},{command:"ci token list",match:w.success,templates:["Run `fjall token show <id>` to inspect one token's stored constraints","Run `fjall ci token revoke <id> --reason <text>` to revoke a listed token"]},{command:"ci token list",match:w.empty,templates:[tl(),"Run `fjall ci status` to re-check readiness once a token exists"]},{command:"ci token revoke",match:w.success,templates:["Run `fjall ci token list` to confirm the token now lists as revoked \u2014 a revoked token stays listed, it does not disappear",`Any CI job still holding this token now fails to authenticate. ${tl()}`]}];var qf="Do not retry or vary flags: `supported: false` is the server's capability verdict, not an input error \u2014 every invocation answers the same until the Fjall server is updated to a version that ships this API (the `message` field names the upgrade)",o1=[{command:"deployments list",match:w.unsupported,templates:[qf]},{command:"deployments cancel",match:w.unsupported,templates:[qf]},{command:"deployments force-release",match:w.unsupported,templates:[qf]},{command:"dev list",match:w.unsupported,templates:[qf]},{command:"deployments list",match:w.success,templates:["Run `fjall deployments cancel <id>` to request co-operative cancellation of a listed deployment","Run `fjall deploy logs --deployment-id <id>` to read one deployment's logs"]},{command:"deployments cancel",match:w.success,templates:["Run `fjall deployments list` to confirm whether the slot is free, and read `cancelled` and `declined` before assuming it is: `cancelled: false` means the request was refused, `declined: true` is an already-terminal reject, and a plain granted cancel is co-operative \u2014 the deployment has to acknowledge it","Run `fjall deployments force-release <id> --confirm <id>` to clear a slot that stays occupied (organisation admin, audited \u2014 retype the id in `--confirm`)"]},{command:"deployments force-release",match:w.success,templates:["Run `fjall deployments list` to confirm the slot is free","Run `fjall deploy <app>` to retry the deployment the wedged slot was blocking"]},{command:"dev up",match:w.success,templates:["Run `fjall dev list <app>` to see every slot for this app with its `host` \u2014 rows carry `host`, not a full URL, and it is empty until the slot leaves `creating`","Run `fjall dev down <app> --branch <branch>` to tear this slot down"]},{command:"dev list",match:w.success,templates:["Run `fjall dev down <app> --branch <branch>` to tear one listed slot down \u2014 every row carries the `branch` to name here","Run `fjall dev up <app> --branch <branch>` to bring another branch up"]},{command:"dev down",match:w.success,templates:["Run `fjall dev list <app>` to see which slots remain","Run `fjall dev up <app> --branch <branch>` to bring the branch back up"]},{command:"dev substrate down",match:w.success,templates:["Run `fjall dev list <app>` to confirm no slot survives \u2014 the substrate will not tear down under live slots, and `--force` takes them with it","Any `residuals` row survives the teardown and can still cost: its `cleanupHint` names the manual step"]}];var s1=["Run `fjall domain deploy <name>` to deploy the domain","Run `fjall domain verify <name>` to check DNS delegation once it is deployed","Run `fjall domain export <name>` to export the live zone records"],c1=[{command:"org deploy",match:w.success,templates:["Run `fjall org get` to review the deployed organisation topology and accounts",`Run \`${te.accountDeploy}\` to deploy the account tier if you passed \`--no-cascade\``,`Run \`${te.createApplicationAgent} --name "<name>"\` to create an application to deploy into it`]},{command:"org deploy",match:w.error,templates:["Run `fjall org get` to see which tier of the cascade is already deployed",`Run \`${te.organisationDeploy} --no-cascade\` to retry the organisation stack alone`]},{command:"platform deploy",match:w.success,templates:[`Run \`${te.accountDeploy}\` to deploy the account tier on top of it`]},{command:"platform deploy",match:w.error,templates:["Run `fjall org get` to check the organisation tier is deployed first"]},{command:"account deploy",match:w.success,templates:["Run `fjall apps list` to see which applications are registered","Run `fjall deploy <application>` to deploy one into this account"]},{command:"account deploy",match:w.error,templates:["Run `fjall org get` to confirm the account is registered in the organisation",`Run \`${te.accountDeploy} --target <target>\` to select a specific member account`]},{command:"domain list",match:w.success,templates:["Run `fjall domain verify <name>` to check DNS delegation","Run `fjall domain export <name>` to export zone file","Run `fjall create domain --name <name>` to create a new domain"]},{command:"domain list",match:w.empty,templates:['Run `fjall create domain --name "<name>"` to create a domain',"Run `fjall domain import <name>` to import from Route53"]},{command:"domain verify",match:w.success,templates:["Run `fjall domain export <name>` to export zone file","Run `fjall domain deploy <name>` to deploy domain infrastructure"]},{command:"domain verify",match:w.error,templates:["Run `fjall domain verify <name>` to retry","Run `fjall domain list` to see existing domains"]},{command:"domain export",match:w.success,templates:["Run `fjall domain verify <name>` to check delegation","Run `fjall domain import <name>` to re-import from Route53"]},{command:"domain import",match:w.success,templates:["Run `fjall domain verify <name>` to check delegation","Run `fjall domain export <name>` to see the zone file","Run `fjall domain deploy <name>` to deploy domain infrastructure"]},{command:"domain import",match:w.error,templates:["Run `fjall domain import --hosted-zone-id <id>` to import by zone ID","Run `fjall domain list` to see existing domains"]},{command:"domain records list",match:w.success,templates:["Run `fjall domain sync <domain>` for the full zone-hygiene report","Run `fjall domain sync <domain> --fix` to remediate residue records via the destruction ceremony"]},{command:"domain records list",match:w.empty,templates:["Run `fjall domain deploy <domain>` to deploy the domain's declared records","Run `fjall domain list` to see existing domains"]},{command:"domain records list",match:w.error,templates:["Run `fjall domain records list <domain> --hosted-zone-id <id>` when the zone is not resolvable by name",`Run \`${te.connect}\` if AWS credentials are missing`]},{command:"domain sync",match:w.success,templates:["Run `fjall domain sync <domain> --fix` to remediate residue records (ceremony-gated)","Run `fjall domain records list <domain>` to see every record with its owner"]},{command:"domain sync",match:w.error,templates:["Run `fjall domain sync <domain> --hosted-zone-id <id>` when the zone is not resolvable by name","Run `fjall domain list` to see existing domains"]},{command:"domain delegate",match:w.success,templates:["Run `fjall domain verify <domain>` to confirm public DNS resolution","Run `fjall domain deploy <domain>` to continue a two-phase deploy after delegation"]},{command:"domain delegate",match:w.error,templates:["Run `fjall domain deploy <parent-domain>` so the parent publishes its DelegationRole","Run `fjall domain verify <domain> --show-delegation` for registrar instructions"]},{command:"domain destroy",match:w.success,templates:["Run `fjall domain list` to see remaining domains","Run `fjall domain sync <parent-domain>` to confirm no delegation residue remains"]},{command:"domain destroy",match:w.error,templates:["Run `fjall domain destroy <domain> --remediate '<name>'=recreate` with the exact consent the ticket names","Run `fjall domain list` to see existing domains"]},{command:"domain deploy",match:w.success,templates:["Run `fjall domain verify <domain>` to check DNS propagation","Run `fjall domain delegate <domain>` to write the NS delegation for a delegated child"]},{command:"domain deploy",match:w.error,templates:["Run `fjall domain deploy <domain>` to resume \u2014 the zone phase is retained and skipped on re-run","Run `fjall domain verify <domain> --show-delegation` for registrar delegation instructions"]},{command:"domain eject",match:w.success,templates:["Review the ejected infrastructure.ts \u2014 it is now vanilla CDK owned by you","Run `fjall domain list` to see remaining managed domains"]},{command:"create domain",match:w.success,templates:s1},{command:"domain create",match:w.success,templates:s1},{command:"create domain",match:w.error,templates:["Run `fjall domain list` to see existing domains",'Run `fjall create domain --name "<name>"` to retry with a different name']},{command:"create account",match:w.success,templates:[`Run \`${te.connect} --environment production\` to link your AWS account`,`Run \`${te.accountDeploy}\` to deploy account infrastructure (after connecting)`]},{command:"create account",match:w.error,templates:[`Run \`${te.createAccount} --primary-region <region>\` to retry`,`Run \`${te.createAccount} --help\` for usage information`]},{command:"create org",match:w.success,templates:[`Run \`${te.connect} --name "<account-name>" --region <region>\` to link the AWS Organizations management account \u2014 omit \`--environment\` so it registers at the organisation tier`,`Run \`${te.organisationDeploy}\` to deploy all infrastructure (after connecting)`]},{command:"create org",match:w.error,templates:[`Run \`${te.createOrganisation} --email "<email>"\` to retry (add \`--name "<name>"\` only for a brand-new organisation)`,`Run \`${te.createOrganisation} --help\` for all options`]},{command:"restore",match:w.successDryRun,templates:["Run `fjall restore <resourceType> --recovery-point <recoveryPointArn> --yes` to initiate restore","Run `fjall apps list` to see existing applications"]},{command:"restore",match:w.success,templates:["Open the AWS Console URL above to monitor restore progress","Run `fjall import` to import the restored resource after completion"]},{command:"restore",match:w.errorWithCode("NOT_FOUND"),templates:["Verify the recovery point ARN is correct and exists in the current region","Run `fjall restore <resourceType> --recovery-point <arn>` to retry"]},{command:"restore",match:w.errorWithCode("FORBIDDEN"),templates:["Ensure the IAM role has backup:StartRestoreJob and iam:PassRole permissions","Run `fjall restore` interactively to configure with guided setup"]},{command:"import",match:w.successDryRun,templates:["Run `fjall import --app <app> --resource-id <resourceId> --yes` to import a specific resource","Run `fjall import --app <app> --yes` to import all discovered resources"]},{command:"import",match:w.success,templates:["Run `fjall deploy <app>` to deploy with the imported resource","Run `fjall apps describe <app>` to see updated resources"]},{command:"import",match:w.errorWithCode("NOT_FOUND"),templates:[`Run \`${te.createApplicationAgent} --name "<app>"\` to create the application`,"Run `fjall apps list` to see existing applications"]},{command:"import",match:w.errorWithCode("VALIDATION_ERROR"),templates:["Run `fjall import --app <app> --resource-id <resourceId>` to import a specific resource","Run `fjall import --app <app> --resource-id <resourceId> --yes` to import immediately"]},{command:"aws exec",match:w.success,templates:["Run `fjall aws exec -- <command...>` to run another AWS CLI command","Run `fjall status` to check application health"]},{command:"aws exec",match:w.error,templates:["Retry the command \u2014 OIDC token mints can fail transiently",`Run \`${te.login}\` if the retry also fails with an authentication error`]},{command:"unlock bucket",match:w.success,templates:["Re-put sane bucket policy statements (enforceSSL deny, access grants) \u2014 the unlock deleted the ENTIRE policy","Run `fjall destroy <app>` to retry the blocked stack cleanup"]},{command:"unlock bucket",match:w.error,templates:["Ensure your credentials belong to the organisation's management account \u2014 STS AssumeRoot is rejected elsewhere","Run `fjall unlock bucket <name> --account <id> --acknowledge-root-session` to retry"]}];var NX=Object.defineProperty,p1=(e,t)=>NX(e,"name",{value:t,configurable:!0}),u1="Run `fjall connect status` to check that an AWS account is connected: asset discovery only inventories connected accounts, so an organisation with none has nothing to inventory",l1=["Run `fjall assets show <asset>` to read one asset in full \u2014 pass its `assetIdentifier`","Run `fjall assets compliance <asset>` to list an asset's recorded posture issues \u2014 pass its `assetIdentifier`, the address every server version accepts"],d1=p1(e=>e.outcome==="success"&&e.nextCursor!==void 0,"isTruncatedPage"),m1=[{command:"assets list",match:p1(e=>d1(e)&&e.fields!==void 0&&e.fields!=="","match"),templates:["This window is truncated \u2014 more assets exist beyond these rows. Run `fjall assets list --cursor <nextCursor> --fields <fields>` to fetch the next page with the same projection; `total` counts this window only, and `fjall assets summary` reports the estate-wide tally, split active/deleted",...l1]},{command:"assets list",match:d1,templates:["This window is truncated \u2014 more assets exist beyond these rows. Run `fjall assets list --cursor <nextCursor>` to fetch the next page; `total` counts this window only, and `fjall assets summary` reports the estate-wide tally, split active/deleted",...l1]},{command:"assets list",match:w.success,templates:["The `total` aggregate counts the rows in this response, not the estate: `--take` bounds the window (default 50). No `nextCursor` aggregate here means the estate ends with these rows; `fjall assets summary` reports the estate-wide tally, split active/deleted","Run `fjall assets show <asset>` to read one asset in full","Run `fjall assets compliance <asset>` to list an asset's recorded posture issues \u2014 pass its `assetIdentifier`, the address every server version accepts (row `id`s are only accepted by newer servers)"]},{command:"assets list",match:w.empty,templates:["Run `fjall assets list --status deleted` to include assets discovery has since marked deleted \u2014 the default listing hides them",u1]},{command:"assets show",match:w.success,templates:["Run `fjall assets compliance <asset>` to list the posture issues recorded against this asset","Run `fjall assets show <asset> --fields id,accountId,iacStatus,estimatedMonthlyCost,lastSeenAt` to read the fields the default projection omits"]},{command:"assets compliance",match:w.success,templates:["Read the `status` column before acting: this listing returns every issue recorded against the asset, `resolved` and `suppressed` included, where the `openIssues` count on `fjall assets list` counts only the open ones","Run `fjall compliance fix --domain compliance --issue-id <issueId>` to read this issue in full alongside the organisation's other open issues. `--domain` is the producer's category \u2014 one of `compliance`, `cost`, `performance` \u2014 not a framework name, and the response is context to reason from, not a remediation step: use `--execute` to run one","Run `fjall assets show <asset>` to read the asset these issues were raised against"]},{command:"assets compliance",match:w.empty,templates:["No issue of ANY status has been recorded against this asset \u2014 an empty listing here is not the same as issues that were resolved, which would still appear with `status: resolved`","Run `fjall assets list --fields name,assetIdentifier,openIssues` to find the assets that do carry open issues"]},{command:"assets summary",match:w.success,templates:["Run `fjall assets list --fields name,assetIdentifier,openIssues` to see which assets sit behind `withIssues` \u2014 `withIssues` counts the assets carrying at least one open issue, `openIssues` counts those issues per asset","Run `fjall assets list --take <n>` to read the rows behind these totals \u2014 page onwards with `--cursor` when the listing reports a `nextCursor`, and pass `--status deleted` to include the `deleted` rows in the listing (interleaved with active \u2014 read the `status` column). These totals are estate-wide (the summary pages the listing to exhaustion, deleted assets included): `total` counts the whole estate, `active` and `deleted` split it"]},{command:"assets summary",match:w.empty,templates:[u1]},{command:"costs show",match:w.success,templates:["Run `fjall costs --mode forecast` to see forecasted spend","Run `fjall costs --mode breakdown` to see service-level breakdown"]},{command:"costs show",match:w.error,templates:["Run `fjall costs --app <app>` to filter by application","Run `fjall costs --help` for usage information"]},{command:"metrics show",match:w.success,templates:["Run `fjall metrics --mode latency` to see latency percentiles","Run `fjall metrics --mode errors` to see error trends"]},{command:"metrics show",match:w.error,templates:["Run `fjall metrics --app <app>` to filter by application","Run `fjall metrics --help` for usage information"]},{command:"compliance fix",match:w.success,templates:["Run `fjall compliance fix --domain <domain> --issue-id <id>` to narrow the suggestions to one issue","Run `fjall deploy <app>` to apply remediation changes"]},{command:"compliance fix",match:w.error,templates:["Run `fjall compliance fix --domain <domain>` to name the compliance domain","Run `fjall compliance --help` for usage information"]},{command:"compliance fix --execute",match:w.success,templates:["Read the result's `kind` before treating the issue as fixed: `auto-pr` opened a pull request that still has to be merged, `imperative` rewrote the live policy, and `manual-hint` changed nothing \u2014 its `awsCliHint` carries the manual step, and that field is absent for rules that supply no hint (`message` is a fixed string either way)","Do not re-read the issue to confirm the cure: nothing on the remediation path writes to the issue record, so `status` stays `open` until the next discovery scan re-evaluates the asset. Verify at the thing that changed \u2014 the pull request, or the live resource","Run `fjall deploy <app>` to roll out an `auto-pr` remediation once its pull request is merged"]},{command:"deploy diff",match:w.success,templates:["Run `fjall deploy logs --deployment-id <id>` to analyse deployment logs","Run `fjall status <app>` to check current deployment health"]},{command:"deploy diff",match:w.error,templates:["Run `fjall list deployments` to see recent deployment IDs","Run `fjall deploy diff --help` for usage information"]},{command:"deploy logs",match:w.success,templates:["Run `fjall deploy diff <idA> <idB>` to compare two deployments","Run `fjall status <app>` to check current deployment health"]},{command:"deploy logs",match:w.error,templates:["Run `fjall deploy logs --deployment-id <id>` with a valid deployment ID","Run `fjall list deployments` to find a deployment ID"]}];var PX={command:"*",match:w.error,templates:["Run `fjall <command> --help` for usage information"]},f1=[...U$,...z$,...G$,...a1,...o1,...c1,...m1,PX];var RX=Object.defineProperty,OX=(e,t)=>RX(e,"name",{value:t,configurable:!0}),h1=["app","environment","region","profile","target","cluster","service","lambda","status","type"],Fa=["app","cluster","service","lambda"],$X=["status","type","region"],I_={deploy:["environment","region","target"],"deploy diff":[],"deploy logs":[],destroy:["target"],"org deploy":["target"],"org destroy":["target"],"platform deploy":["target"],"platform destroy":["target"],"account deploy":["target"],"account destroy":["target"],status:[],rollout:[],list:["app"],apps:["target"],connect:["environment","region"],"connect status":[],import:["app","region"],costs:["app"],metrics:["app"],compliance:["app"],"token create":["app","environment"],"unlock bucket":["region"],"aws exec":["app","region","target"],"secrets set":Fa,"secrets get":Fa,"secrets list":Fa,"secrets delete":Fa,"secrets export":Fa,"secrets import":Fa,"secrets exec":Fa,"assets list":$X},jX=Math.max(...Object.keys(I_).map(e=>e.split(" ").length));function D_(e){let t=e.trim().split(/\s+/).slice(1);for(let r=jX;r>=1;r--){let i=t.slice(0,r).join(" ");if(Object.hasOwn(I_,i))return I_[i]}return[]}OX(D_,"resolvePreservableFlags");var MX=Object.defineProperty,Hf=(e,t)=>MX(e,"name",{value:t,configurable:!0});function w_(e){let t=e.replace(/[\u0000-\u001f\u007f`]/g,"");return/[^\w@%+=:,./-]/.test(t)?`'${t.replace(/'/g,"'\\''")}'`:t}Hf(w_,"shellEscape");function g1(e,t,r){let i=new Set,n=e.replace(/<(\w+)>/g,(a,o)=>{let s=t[o];return s===void 0||s===""?`<${o}>`:(i.add(o),o==="command"?s:w_(s))});return y1(n,r,i)}Hf(g1,"interpolateTemplate");var Zf=class{static{Hf(this,"SuggestionResolver")}command;flags;constructor(t,r){this.command=t,this.flags=r}resolve(t){let r=f1.find(i=>(i.command===this.command||i.command==="*")&&i.match(t));return r===void 0?[]:r.templates.map(i=>g1(i,t,this.flags))}};function y1(e,t,r=new Set){let i=/`(fjall[^`]*)`/.exec(e),n=i?.[1];if(i===null||n===void 0)return e;let a=D_(n),o=[];for(let p of h1){if(!a.includes(p))continue;let h=t[p];h!==void 0&&h!==""&&!r.has(p)&&!n.includes(`--${p}`)&&o.push(`--${p} ${w_(h)}`)}if(o.length===0)return e;let s=` ${o.join(" ")}`,u=n.indexOf(" -- "),d=u===-1?`${n}${s}`:`${n.slice(0,u)}${s}${n.slice(u)}`;return e.slice(0,i.index)+`\`${d}\``+e.slice(i.index+i[0].length)}Hf(y1,"applyPreservedFlags");var FX=Object.defineProperty,Yn=(e,t)=>FX(e,"name",{value:t,configurable:!0});function Kr(e,t){if(t!==void 0&&Ns(e)){let i={};for(let[n,a]of Object.entries(e))i[n]=t.has(n)?a:Kr(a);return i}if(typeof e=="string")return ae(e);if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(i=>Kr(i));if(e instanceof Date||e instanceof RegExp)return e;let r={};for(let[i,n]of Object.entries(e))r[i]=Kr(n);return r}Yn(Kr,"maskTree");function Jf(e){if(Array.isArray(e))return e.map(Jf);if(!Ns(e))return e;let t={};for(let[r,i]of Object.entries(e))i!==void 0&&(t[r]=Jf(i));return t}Yn(Jf,"stripAbsent");function Ns(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof Date)&&!(e instanceof RegExp)}Yn(Ns,"isPlainRecord");function v1(e){let t=e?.verbatimFields;return t!==void 0&&t.length>0?new Set(t):void 0}Yn(v1,"toVerbatimKeys");function b1(e,t){return t===void 0||!Ns(e)?!1:Object.keys(e).some(r=>t.has(r))}Yn(b1,"carriesVerbatimField");function S1(e,t){let r=e;for(let i of t.split(".")){if(!Ns(r))return;r=r[i]}return r}Yn(S1,"resolveDotPath");function E1(e,t,r){let i=e.project(t),n={};for(let a of r)a in i&&(n[a]=i[a]);return n}Yn(E1,"projectSelectedFields");var rl=class{static{Yn(this,"AgentOutputWriter")}write;hasWrittenBlock=!1;resolver;flags;full;budget;requestedFields;constructor(t){this.write=t.writeFn??(r=>{process.stdout.write(r)}),this.resolver=new Zf(t.command,t.flags),this.flags=t.flags,this.full=t.full??!1,this.budget=t.budget,this.requestedFields=t.fields??[]}get isFullOutput(){return this.full}writeBlock(t){t!==""&&(this.hasWrittenBlock&&this.write(e_+`
|
|
342
342
|
`),this.hasWrittenBlock=!0,this.write(t))}renderResult(t,r){let i=v1(r?.schema),n=Kr(t,i),a=r?.schema!==void 0&&Ns(n)?this.applySchema(n,r.schema):n,o=r_(a),s=this.resolveHelp(r?.suggestionContext),u=o+s+`
|
|
343
343
|
`;this.writeBlock((b1(a,i)?u:Of(u,this.budget))+Ds())}renderListResult(t,r,i){let n=t.map(d=>Kr(d)),a=i.fields,o=a!==void 0&&a.length>0?a:r.fields,s=n_(n,{fields:o,project:Yn(d=>E1(r,d,o),"project")},{entity:i.entity,aggregates:i.aggregates===void 0?void 0:Kr(i.aggregates)}),u=this.resolveHelp(i.suggestionContext);this.writeBlock(Of(s+u+`
|
|
344
344
|
`,this.budget)+Ds())}renderEvent(t){let r=Kr(t),i=o_({...r,value:Jf(r.value)});this.writeBlock(i)}renderError(t,r){let i={...t,message:ae(t.message),...t.details!==void 0?{details:Kr(t.details)}:{}},n=i_(i),a=this.resolveHelp(r);this.writeBlock(n+a+`
|
|
@@ -351,7 +351,7 @@ ${e_}
|
|
|
351
351
|
`)}}setDebugEnabled(t){this.debugEnabled=t}write(t,r){this.isClosing||(this.initialised||this.initialise(),this.buffer.push(t),this.debugEnabled&&r&&this.debugBuffer.push(t),this.buffer.length>=this.config.maxBufferSize&&this.flush())}flushBuffer(t,r,i){if(t.length===0||!r)return{buffer:t,stream:r};let n=r;this.fileRotator.needsRotation(i,this.config.maxFileSize)&&(n.end(),this.fileRotator.rotate(i),n=this.openStream(i));for(let a of t)n.write(JSON.stringify(a)+`
|
|
352
352
|
`);return{buffer:[],stream:n}}flush(){let t=this.flushBuffer(this.buffer,this.mainLogStream,this.mainLogPath);this.buffer=t.buffer,this.mainLogStream=t.stream;let r=this.flushBuffer(this.debugBuffer,this.debugLogStream,this.debugLogPath);this.debugBuffer=r.buffer,this.debugLogStream=r.stream}close(){this.isClosing=!0,this.flush(),this.flushInterval&&(clearInterval(this.flushInterval),this.flushInterval=null),this.mainLogStream&&(this.mainLogStream.end(),this.mainLogStream=null),this.debugLogStream&&(this.debugLogStream.end(),this.debugLogStream=null),this.buffer=[],this.debugBuffer=[],this.initialised=!1,this.isClosing=!1}async closeAndFlush(){this.isClosing=!0,this.flush(),this.flushInterval&&(clearInterval(this.flushInterval),this.flushInterval=null);let t=[];this.mainLogStream&&(t.push(this.mainLogStream),this.mainLogStream=null),this.debugLogStream&&(t.push(this.debugLogStream),this.debugLogStream=null),this.buffer=[],this.debugBuffer=[],this.initialised=!1,await Promise.all(t.map(r=>new Promise(i=>{r.end(()=>i())}))),this.isClosing=!1}};import{createWriteStream as l9,existsSync as d9,mkdirSync as p9,readdirSync as m9,statSync as f9,unlinkSync as h9}from"fs";import{join as L_}from"path";var Qn={trace:0,debug:1,info:2,warn:3,error:4},dn={MAX_FILE_SIZE:al.MAX_FILE_SIZE,MAX_FILES:al.MAX_FILES,MAX_BUFFER_SIZE:100,MAX_DEPLOYMENT_LOGS_PER_APP:100,MAX_DEPLOYMENT_LOG_BYTES_PER_APP:256*1024*1024,FLUSH_INTERVAL_MS:500,LOG_FILENAME:"fjall.jsonl",DEBUG_LOG_FILENAME:"fjall-debug.jsonl"};var s9=Object.defineProperty,c9=(e,t)=>s9(e,"name",{value:t,configurable:!0});function $s(){return nf()}c9($s,"getDefaultLogDir");var u9=Object.defineProperty,R1=(e,t)=>u9(e,"name",{value:t,configurable:!0}),g9=/^[a-zA-Z0-9_-]+-\d{4}-\d{2}-\d{2}T[\d-]+Z\.jsonl$/,y9=6e4;function O1(e,t,r){try{let i=Date.now(),n=m9(e).filter(s=>g9.test(s)).map(s=>{let u=L_(e,s);try{let d=f9(u);return{path:u,mtimeMs:d.mtimeMs,size:d.size}}catch{return}}).filter(s=>s!==void 0&&i-s.mtimeMs>=y9);n.sort((s,u)=>u.mtimeMs-s.mtimeMs);let a=0,o=0;for(let s of n){if(a===0||a<t&&o+s.size<=r){a+=1,o+=s.size;continue}try{h9(s.path)}catch{}}}catch{}}R1(O1,"pruneOldDeploymentLogs");var ol=class{static{R1(this,"DeploymentLoggerImpl")}mainLogger;appName;operationType;logStream=null;logPath;deploymentId;buffer=[];flushInterval=null;isClosing=!1;maxBufferSize=dn.MAX_BUFFER_SIZE;constructor(t,r,i){this.mainLogger=t,this.appName=r,this.operationType=i,this.deploymentId=`${i}-${Date.now()}`;let n=$s(),a=L_(n,"deployments",r);d9(a)||p9(a,{recursive:!0}),O1(a,dn.MAX_DEPLOYMENT_LOGS_PER_APP,dn.MAX_DEPLOYMENT_LOG_BYTES_PER_APP);let o=new Date().toISOString().replace(/[:.]/g,"-"),s=`${i}-${o}.jsonl`;this.logPath=L_(a,s);try{this.logStream=l9(this.logPath,{flags:"a"}),this.flushInterval=setInterval(()=>this.flush(),dn.FLUSH_INTERVAL_MS),this.info("DeploymentLogger","Deployment logging initialised",{appName:r,operationType:i,deploymentId:this.deploymentId,logPath:this.logPath})}catch{}}log(t,r,i,n,a,o){if(this.isClosing)return;let s={timestamp:new Date().toISOString(),level:t,component:r,message:i,correlationId:this.deploymentId,...n&&Object.keys(n).length>0&&{data:n},...a&&{stackName:a},...o&&{phase:o}};this.buffer.push(s),this.mainLogger.logWithCorrelation(t,r,i,this.deploymentId,n,a,o),this.buffer.length>=this.maxBufferSize&&this.flush()}flush(){if(!(this.buffer.length===0||!this.logStream)){for(let t of this.buffer)this.logStream.write(JSON.stringify(t)+`
|
|
353
353
|
`);this.buffer=[]}}info(t,r,i){this.log("info",t,r,i)}warn(t,r,i){this.log("warn",t,r,i)}error(t,r,i){this.log("error",t,r,i)}debug(t,r,i){this.log("debug",t,r,i)}stackEvent(t,r,i,n){this.log("info","StackDeployment",i,n,t,r)}dockerEvent(t,r){this.log("info","DockerOperation",t,{percentage:r})}ecsEvent(t,r,i){this.log("info","ECSDeployment",t,{percentage:r,taskCount:i})}close(){this.isClosing=!0,this.flush(),this.flushInterval&&(clearInterval(this.flushInterval),this.flushInterval=null),this.logStream&&(this.logStream.end(),this.logStream=null),this.buffer=[],this.isClosing=!1}getLogPath(){return this.logPath}getDeploymentId(){return this.deploymentId}};var v9=Object.defineProperty,B_=(e,t)=>v9(e,"name",{value:t,configurable:!0});function z_(){let e=$_();return e==="agent"||e==="mcp"}B_(z_,"isStructuredOutputMode");function $1(){return _s.isUIMode||_s.isNonInteractive}B_($1,"surfaceOwnsConsole");var th=class e{static{B_(this,"Logger")}static instance=null;config;debugEnabled;traceEnabled;minLevel;fileWriter;mainLogPath;debugLogPath;constructor(){let t=$s(),r=U_(t,"debug"),{maxFileSize:i,maxFiles:n}=F_();this.config={logDir:t,debugLogDir:r,maxFileSize:i,maxFiles:n,maxBufferSize:dn.MAX_BUFFER_SIZE,flushIntervalMs:dn.FLUSH_INTERVAL_MS},this.mainLogPath=U_(t,dn.LOG_FILENAME),this.debugLogPath=U_(r,dn.DEBUG_LOG_FILENAME),this.debugEnabled=process.env.FJALL_DEBUG==="true"||process.env.FJALL_TRACE==="true"||process.argv.includes("--verbose")||process.argv.includes("-v"),this.traceEnabled=process.env.FJALL_TRACE==="true";let a=process.env.FJALL_LOG_LEVEL?.toLowerCase();a&&a in Qn?this.minLevel=a:this.traceEnabled?this.minLevel="trace":this.debugEnabled?this.minLevel="debug":this.minLevel="info",this.fileWriter=new eh(this.config,this.mainLogPath,this.debugLogPath,this.debugEnabled)}static getInstance(){return e.instance||(e.instance=new e),e.instance}shouldLog(t){return Qn[t]>=Qn[this.minLevel]}createEntry(t,r,i,n,a,o,s){return{timestamp:new Date().toISOString(),level:t,component:r,message:i,...a&&{correlationId:a},...n&&Object.keys(n).length>0&&{data:n},...o&&{stackName:o},...s&&{phase:s}}}log(t,r,i,n,a,o,s){if(!this.shouldLog(t))return;let u=this.createEntry(t,r,i,n,a,o,s),d=t==="debug"||t==="trace";this.fileWriter.write(u,d),this.writeConsole(u)}writeConsole(t){if(z_()||$1()){this.debugEnabled&&this.writeStderrLine(t);return}let r=this.getConsolePrefix(t.level),i=`[${t.component}]`,n=`${r} ${i} ${t.message}`;t.level==="error"?console.error(n):t.level==="warn"?console.warn(n):console.log(n)}writeStderrLine(t){let r=this.getConsolePrefix(t.level),i=`[${t.component}]`,n="";if(t.data&&Object.keys(t.data).length>0)try{n=` ${JSON.stringify(t.data)}`}catch{n=" [unserialisable data]"}let a=`${r} ${i} ${t.message}${n}`;process.stderr.write(`${ae(a)}
|
|
354
|
-
`)}getConsolePrefix(t){switch(t){case"error":return"[ERROR]";case"warn":return"[WARN]";case"info":return"[INFO]";case"debug":return"[DEBUG]";case"trace":return"[TRACE]"}}error(t,r,i){this.log("error",t,r,i)}warn(t,r,i){this.log("warn",t,r,i)}info(t,r,i){this.log("info",t,r,i)}debug(t,r,i){this.log("debug",t,r,i)}trace(t,r,i){this.log("trace",t,r,i)}diagnostic(t,r,i,n){this.log(t,r,i,n),!this.debugEnabled&&z_()&&(Qn[t]<Qn.info||this.writeStderrLine(this.createEntry(t,r,i,n)))}isDebugEnabled(){return this.debugEnabled}isTraceEnabled(){return this.traceEnabled}enableDebug(){this.debugEnabled=!0,Qn[this.minLevel]>Qn.debug&&(this.minLevel="debug"),this.fileWriter.setDebugEnabled(!0),this.fileWriter.isInitialised&&this.fileWriter.initialiseDebugStream()}withCorrelation(t){return new Rs(this,t)}forDeployment(t,r="deploy"){return new ol(this,t,r)}close(){this.fileWriter.close()}async flushAndClose(){await this.fileWriter.closeAndFlush()}getLogPath(){return this.mainLogPath}getDebugLogPath(){return this.debugLogPath}getLogDir(){return this.config.logDir}logWithCorrelation(t,r,i,n,a,o,s){this.log(t,r,i,a,n,o,s)}static reset(){e.instance&&(e.instance.close(),e.instance=null)}};var un=th.getInstance();var b9=Object.defineProperty,ut=(e,t)=>b9(e,"name",{value:t,configurable:!0}),js="fjall";function Ua(e,t){let r=S9(e);if(r.includes("..")||r.startsWith("/"))throw new Error(`Invalid ${t}: path traversal is not allowed`)}ut(Ua,"assertNoTraversal");function E9(){return js}ut(E9,"getFjallPath");function x9(e){let t=j1(e);return j1(t)||"."}ut(x9,"getProjectRoot");function L1(e){if(!F1(e))throw new Error(`Infrastructure file not found: ${e}`);let t=M1(e,"utf-8"),r=U1(t);if(r===void 0)throw new Error(`Could not find appName in infrastructure file: ${e}. Expected format: const appName = "yourAppName";`);return r}ut(L1,"getAppNameFromInfrastructure");function U1(e){return e.match(/const\s+appName\s*=\s*["']([^"']+)["']/)?.[1]}ut(U1,"parseAppNameFromInfrastructureContent");function A9(e){if(!F1(e))return;let t;try{t=M1(e,"utf-8")}catch(r){un.debug("PathHelpers","Could not read organisation infrastructure",{error:ae(ze(r))});return}return t.match(/organisationName:\s*(["'])(.+?)\1/)?.[2]}ut(A9,"readOrganisationNameFromInfrastructure");function _9(e){let t=Sr(e,V_);return L1(t)}ut(_9,"getAppName");function ei(e){return Ua(e,"app name"),Sr(js,e,V_)}ut(ei,"getInfrastructurePath");function z1(e){return Ua(e,"app name"),Sr(js,e)}ut(z1,"getAppPath");function B1(e,t){let r=e??process.cwd();return t===void 0?r:(Ua(t,"container"),Sr(r,t))}ut(B1,"resolveScaffoldRootDir");function T9(e,t,r){return Sr(B1(t,r),z1(e))}ut(T9,"resolveAppScaffoldPath");function C9(e){return Ua(e,"component name"),Sr(js,e)}ut(C9,"getOrganisationComponentPath");function I9(e){return Ua(e,"deployment type"),Sr(js,e,"logs")}ut(I9,"getDeploymentLogsPath");function G1(){return Sr(js,"domains")}ut(G1,"getDomainsDir");function G_(e){return Ua(e,"domain name"),Sr(G1(),e)}ut(G_,"getDomainComponentPath");function D9(e){return Sr(G_(e),V_)}ut(D9,"getDomainInfrastructurePath");function w9(e){return Sr(G_(e),k9)}ut(w9,"getDomainZoneFilePath");var V_="infrastructure.ts",k9="zone.bind",N9="cdk.out";function P9(e){return Sr(e,N9)}ut(P9,"getCdkOutPath");var R9=Object.defineProperty,Ms=(e,t)=>R9(e,"name",{value:t,configurable:!0});function W_(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}Ms(W_,"escapeRegExp");function V1(e,t,r){let i=ei(t),n=e.read(i)?.toString();return n?new RegExp(`["']${W_(r)}["']`).test(n):!1}Ms(V1,"resourceExists");function K_(e,t,r){let i=ei(t);if(!e.read(i)?.toString())throw new Error(`Infrastructure file not found for ${t}`);if(V1(e,t,r))throw new Error(`Resource name '${r}' already exists in ${t}. Please choose a different name or remove the existing resource first.`)}Ms(K_,"assertResourceNameUnique");function O9(e,t,r){let i=ei(t),n=e.read(i)?.toString();if(!n)return 0;let a={database:/DatabaseFactory\.build\(/g,compute:/ComputeFactory\.build\(/g,lambda:/type:\s*["']lambda["']/g,ecs:/type:\s*["']ecs["']/g,ec2:/type:\s*["']ec2["']/g}[r];if(!a)return 0;let o=n.match(a);return o?o.length:0}Ms(O9,"countResourcesOfType");function $9(e,t){let r=ei(t),i=e.read(r)?.toString();if(!i)return[];let n=[],a=i.matchAll(/ComputeFactory\.build\(["']([^"']+)["'],\s*\{([^}]*?)\}/gs);for(let o of a){let s=o[1],u=o[2],d="ecs";u.includes('type: "lambda"')?d="lambda":u.includes('type: "ec2"')&&(d="ec2");let p=u.includes("connections:"),h=[];if(p){let g=u.match(/connections:\s*\[([^\]]+)\]/);if(g){let l=g[1].match(/\w+/g)??[];h.push(...l)}}n.push({name:s,type:d,hasConnections:p,connectedResources:h})}return n}Ms($9,"detectComputeResources");function q_(e,t,r){let i=ei(t),n=e.read(i)?.toString();return n?new RegExp(`databaseName:\\s*["']${W_(r)}["']`).test(n):!1}Ms(q_,"databaseExists");import*as Bc from"fs";import*as U4 from"path";var j9=Object.defineProperty,Fs=(e,t)=>j9(e,"name",{value:t,configurable:!0});function Z_(e){return e.success===!0}Fs(Z_,"isSuccess");function H_(e){return e.success===!1}Fs(H_,"isFailure");function V(e){return{success:!0,data:e}}Fs(V,"success");function $(e){return{success:!1,error:e}}Fs($,"failure");async function J_(e){try{let t=await e();return V(t)}catch(t){return $(Gr(t))}}Fs(J_,"tryAsync");function X_(e){try{let t=e();return V(t)}catch(t){return $(Gr(t))}}Fs(X_,"trySync");var M9=Object.defineProperty,F9=(e,t)=>M9(e,"name",{value:t,configurable:!0}),W1=/^[a-zA-Z][a-zA-Z0-9-]*$/,L9=Ou.source.replace(/^\^|\$$/g,""),he=Object.freeze({IDENTIFIER:W1,NEW_APP_NAME:/^[a-z][a-z0-9-]*$/,RESOURCE_NAME:/^[a-zA-Z][a-zA-Z0-9]*$/,ECS_SERVICE_NAME:W1,BUCKET_NAME:/^[a-z][a-z0-9-]*[a-z0-9]$|^[a-z][a-z0-9]*$/,DATABASE_NAME:/^[a-zA-Z][a-zA-Z0-9_]*$/,RESOURCE_TYPE:/^[a-z]+(:[a-z]+)?$/,SSM_PATH:new RegExp(`^(?:/${L9})+$`),SECRET_NAME:pf,SSM_COMPONENT:Ou,EMAIL:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,DOCKER_IMAGE:/^[a-z0-9][a-z0-9._-]*[a-z0-9](:[a-z0-9._-]+)?$/,DOMAIN:/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i,HTTP_ORIGIN:/^https?:\/\/[a-z0-9.-]+(:\d+)?$/i,PASCAL_CASE:/^[A-Z][A-Za-z0-9]*$/,AWS_ACCOUNT_ID:/^\d{12}$/,VPC_ID:/^vpc-[a-z0-9]+$/,ROLE_ARN:/^arn:aws[a-zA-Z-]*:iam::\d{12}:role\/.+$/,CIDR:/^((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\/(3[0-2]|[12]?\d)$/,SCHEDULE_EXPRESSION:/^(rate\(1 (?:minute|hour|day)\)|rate\((?:[2-9]|[1-9]\d+) (?:minutes|hours|days)\)|cron\([^\s()]+ [^\s()]+ [^\s()]+ [^\s()]+ [^\s()]+ [^\s()]+\))$/,LAMBDA_RUNTIME_IDENTIFIER:/^[A-Za-z0-9._-]+$/,ENV_VAR_NAME:/^[A-Za-z_][A-Za-z0-9_]*$/});function Y_(e){let t=/^rate\((\d+) (minute|minutes|hour|hours|day|days)\)$/.exec(e);if(!t)return;let r=t[1],i=t[2];if(r===void 0||i===void 0)return;let n=parseInt(r,10);if(!Number.isFinite(n)||n<1)return;let a=i==="minute"||i==="hour"||i==="day";if(!(a&&n!==1)&&!(!a&&n===1))return i==="minute"||i==="minutes"?{everyMs:n*6e4}:i==="hour"||i==="hours"?{everyMs:n*60*6e4}:{everyMs:n*24*60*6e4}}F9(Y_,"parseRateExpression");var K1=["t4g.medium","m7g.medium","m8g.medium","r7g.medium","r8g.medium","m7g.large","m8g.large","r7g.large","r8g.large","m7g.xlarge","m8g.xlarge","r7g.xlarge","r8g.xlarge"];var E=Object.freeze({IDENTIFIER:"Must start with a letter, contain only letters, numbers, and hyphens",NEW_APP_NAME:"Must start with a lowercase letter and contain only lowercase letters, numbers, and hyphens",IDENTIFIER_MIN_LENGTH:"Must be at least 2 characters",IDENTIFIER_NO_TRAILING_HYPHEN:"Must not end with a hyphen",IDENTIFIER_NO_CONSECUTIVE_HYPHENS:"Must not contain consecutive hyphens",RESOURCE_NAME:"Must start with a letter and contain only letters and numbers (PascalCase recommended)",ECS_SERVICE_NAME:"Service name must start with a letter and contain only letters, numbers, and hyphens",BUCKET_NAME:"Bucket name must start with a lowercase letter and contain only lowercase letters, numbers, and hyphens",DATABASE_NAME:"Database name must start with a letter and contain only letters, numbers, and underscores",RESOURCE_TYPE:"Resource type must be in format 'category' or 'category:type'",SSM_PATH:"SSM path must start with / and contain valid namespace segments (e.g., /myapp/ApiCluster/service)",SECRET_NAME:pA,SSM_COMPONENT:mf,EMAIL:"Please enter a valid email address",DOMAIN:"Please enter a valid domain (e.g., cms.example.com)",DOCKER_IMAGE:"Invalid Docker image name format",REQUIRED:{APP_NAME:"Application name is required",RESOURCE_NAME:"Resource name is required",BUCKET_NAME:"Bucket name is required",SERVICE_NAME:"Service name is required",NETWORK_NAME:"Network name is required",DATABASE_NAME:"Database name is required",ORGANISATION_NAME:"Organisation name is required",EMAIL:"Email is required",NAME:"Name is required",USERNAME:"Username is required",CONTAINER_NAME:"Container name is required",GROUP:"Group is required",PATTERN_NAME:"Pattern name is required",SOURCE:"Source directory is required",BUILD_COMMAND:"Build command is required",OUTPUT_DIR:"Output directory is required",FORMS_TO:"Forms recipient address is required",ROUTING_PATH:"Routing path is required",RESOURCE_REFERENCE:"Resource reference is required",RESOURCE_TYPE:"Resource type is required",VARIANT:"Variant is required",SUBTYPE:"Subtype is required",DEPLOY_TARGET:"Deploy target is required",DESTROY_TARGET:"Destroy target is required",CONNECTED_RESOURCE_NAME:"Connected resource names must not be empty"},MAX_LENGTH:{APP_NAME:"Application name must be 50 characters or less",RESOURCE_NAME:"Resource name must be 63 characters or less",BUCKET_NAME:"Bucket name must be 63 characters or less",SERVICE_NAME:"Service name must be 255 characters or less",NETWORK_NAME:"Network name must be 50 characters or less",DATABASE_NAME:"Database name must be 63 characters or less",ORGANISATION_NAME:"Organisation name must be 50 characters or less"},PORT:{INTEGER:"Port must be an integer",MIN:"Port must be at least 1",MAX:"Port cannot exceed 65535"},USERNAME:{MAX_LENGTH:"Username cannot exceed 63 characters"},LAMBDA:{MEMORY:{INTEGER:"Lambda memory must be an integer",MIN:"Memory must be at least 128 MB",MAX:"Memory cannot exceed 10240 MB",MULTIPLE:"Memory must be 128 MB or a multiple of 64 MB"},TIMEOUT:{INTEGER:"Timeout must be an integer",MIN:"Timeout must be at least 1 second",MAX:"Timeout cannot exceed 900 seconds"},RUNTIME:"Lambda runtime must contain only letters, digits, dots, underscores, or dashes (e.g. 'NODEJS_20_X' or 'nodejs20.x')"},ENV_VAR_NAME:"Environment variable names must start with a letter or underscore and contain only letters, digits, and underscores",PRIORITY:{INTEGER:"Priority must be an integer",MIN:"Priority must be at least 1",MAX:"Priority cannot exceed 50000"},CAPACITY:{MIN:{INTEGER:"Minimum capacity must be an integer",MIN_0:"Minimum capacity must be at least 0",MIN_1:"Minimum capacity must be at least 1",MAX:"Minimum capacity cannot exceed 100"},MAX:{INTEGER:"Maximum capacity must be an integer",MIN_0:"Maximum capacity must be at least 0",MIN_1:"Maximum capacity must be at least 1",MAX:"Maximum capacity cannot exceed 100"},DESIRED:{INTEGER:"Desired count must be an integer",MIN:"Desired count must be at least 0",MAX:"Desired count cannot exceed 100"},WARM_POOL_REQUIRED:"minCapacity 0 requires a warmPool \u2014 without it, new tasks wait 60-90s for a cold instance launch",WARM_POOL:{MIN_SIZE:{INTEGER:"Warm pool minSize must be an integer",MIN:"Warm pool minSize must be at least 0",MAX:"Warm pool minSize cannot exceed 100"},MIN_SIZE_EXCEEDS_MAX_CAPACITY:"warmPool.minSize cannot exceed maxCapacity \u2014 the warm pool cannot hold more instances than the ASG allows"}},MEMORY_LIMIT:{INTEGER:"Memory limit must be an integer",MIN_512:"Memory limit must be at least 512 MiB",MIN_128:"Memory limit must be at least 128 MiB",MAX:"Memory limit cannot exceed 30720 MiB"},DATABASE:{PORT:{INTEGER:"Database port must be an integer",MIN:"Database port must be at least 1024",MAX:"Database port cannot exceed 65535"},NAME:{REQUIRED:"Database name is required",MAX_LENGTH:"Database name must be 63 characters or less"}},CLICKHOUSE_STORAGE:{INTEGER:"ClickHouse storage must be a whole number of GiB",MIN:`ClickHouse storage must be at least ${100} GiB`,MAX:`ClickHouse storage cannot exceed ${16384} GiB (the gp3 ceiling)`},CLICKHOUSE_IOPS:{INTEGER:"ClickHouse iops must be a whole number",MIN:`ClickHouse iops must be at least ${3e3} (the gp3 baseline)`,MAX:`ClickHouse iops cannot exceed ${8e4} (the gp3 ceiling)`},CLICKHOUSE_THROUGHPUT:{INTEGER:"ClickHouse throughputMbps must be a whole number of MiB/s",MIN:`ClickHouse throughputMbps must be at least ${125} MiB/s (the gp3 baseline)`,MAX:`ClickHouse throughputMbps cannot exceed ${2e3} MiB/s (the gp3 ceiling)`},BACKUP_RETENTION:{INTEGER:"Backup retention must be an integer",MIN:"Backup retention must be at least 1 day",MAX:"Backup retention cannot exceed 35 days (the RDS automated-backup ceiling)"},CLICKHOUSE_BACKUP_RETENTION:{INTEGER:"ClickHouse backup retention must be an integer number of days",MIN:`ClickHouse backup retention must be at least ${1} day`,MAX:`ClickHouse backup retention cannot exceed ${3650} days`},SQS:{VISIBILITY_TIMEOUT:{INTEGER:"Visibility timeout must be an integer",MIN:"Visibility timeout must be at least 0 seconds",MAX:"Visibility timeout cannot exceed 43200 seconds (12 hours)"},RETENTION_PERIOD:{INTEGER:"Retention period must be an integer",MIN:"Retention period must be at least 60 seconds",MAX:"Retention period cannot exceed 1209600 seconds (14 days)"}},READER:{COUNT:{INTEGER:"Reader count must be an integer",MIN:"Reader count must be at least 0",MAX:"Reader count cannot exceed 15"}},IDENTIFIER_SUFFIX:{REQUIRED:"Identifier suffix is required when specified",MAX_LENGTH:"Identifier suffix cannot exceed 50 characters"},ROTATION:{INTEGER:"Rotation days must be an integer",MIN:"Rotation interval must be at least 1 day",MAX:"Rotation interval cannot exceed 365 days"},MAX_CONNECTIONS:{INTEGER:"Max connections must be an integer",MIN:"Max connections must be at least 1",MAX:"Max connections cannot exceed 100"},MONITORING_INTERVAL:{INTEGER:"Monitoring interval must be an integer",MIN:"Monitoring interval must be at least 0",MAX:"Monitoring interval cannot exceed 60 seconds",VALUES:"Monitoring interval must be 0, 1, 5, 10, 15, 30, or 60 seconds"},RETENTION_DAYS:{INTEGER:"Retention days must be an integer",MIN:"Retention days must be at least 1",MAX:"Retention days cannot exceed 365"},BATCH_SIZE:{INTEGER:"Batch size must be an integer",MIN:"Batch size must be at least 1",MAX:"Batch size cannot exceed 10000"},SERVICE:{UNIQUE_WITHIN_CLUSTER:"Service names must be unique within a cluster",MIN_REQUIRED:"At least one service is required",ROUTING_REQUIRED:"Multiple services with ports require routing config (path or host)"},PROXY_CONFIG:{MAX_IDLE_CONNECTIONS:{INTEGER:"Max idle connections must be an integer",MIN:"Max idle connections must be at least 0",MAX:"Max idle connections cannot exceed 100"},BORROW_TIMEOUT:{INTEGER:"Connection borrow timeout must be an integer",MIN:"Connection borrow timeout must be at least 1 second",MAX:"Connection borrow timeout cannot exceed 3600 seconds"}},MAX_AZS:{INTEGER:"Max AZs must be an integer",MIN:"Max AZs must be at least 1",MAX:"Max AZs cannot exceed 3"},BATCHING_WINDOW:{INTEGER:"Max batching window must be an integer",MIN:"Max batching window must be at least 0",MAX:"Max batching window cannot exceed 300 seconds"},HEALTH_CHECK:{INTERVAL:{INTEGER:"Health check interval must be an integer",MIN:"Health check interval must be at least 5 seconds",MAX:"Health check interval cannot exceed 300 seconds"},TIMEOUT:{INTEGER:"Health check timeout must be an integer",MIN:"Health check timeout must be at least 2 seconds",MAX:"Health check timeout cannot exceed 60 seconds"},RETRIES:{INTEGER:"Health check retries must be an integer",MIN:"Health check retries must be at least 1",MAX:"Health check retries cannot exceed 10"},START_PERIOD:{INTEGER:"Health check start period must be an integer",MIN:"Health check start period must be at least 0 seconds",MAX:"Health check start period cannot exceed 300 seconds"}},EPHEMERAL_STORAGE:{INTEGER:"Ephemeral storage size must be an integer",MIN:"Ephemeral storage size must be at least 512 MB",MAX:"Ephemeral storage size cannot exceed 10240 MB"},MAX_MESSAGE_SIZE:{INTEGER:"Max message size must be an integer",MIN:"Max message size must be at least 1024 bytes",MAX:"Max message size cannot exceed 262144 bytes (256 KB)"},CAPACITY_CONSTRAINT:{MIN_LTE_MAX:"minCapacity must be less than or equal to maxCapacity"},DIRECT_ACCESS:{NO_DOMAIN:"directAccess cannot be used with domain (no ALB for HTTPS)",NO_LOAD_BALANCER:"directAccess cannot be used with loadBalancer (mutually exclusive)"},GLOBAL_AURORA:{PRIMARY_REGION_REQUIRED:"primaryRegion is required for GlobalAurora databases"},NAT_GATEWAY:{INTEGER:"NAT gateway count must be an integer",MIN:"NAT gateway count must be at least 0",MAX:"NAT gateway count cannot exceed 3"},CIDR_MASK:{INTEGER:"CIDR mask must be an integer",MIN:"CIDR mask must be at least 16",MAX:"CIDR mask cannot exceed 28"},CPU:{INTEGER:"CPU must be an integer",MIN:"CPU must be at least 256 units",MAX:"CPU cannot exceed 4096 units"},KMS:{KEY_REQUIRED:"KMS key ARN is required when using KMS encryption"},READER_INSTANCES:{MAX:"Cannot have more than 15 reader instances",COUNT_OR_INSTANCES:"Cannot specify both 'count' and 'instances' - use one or the other"},GENERATOR_CAPACITY:{MIN:{MIN:"Minimum capacity must be at least 1",MAX:"Minimum capacity cannot exceed 1000"},MAX:{MIN:"Maximum capacity must be at least 1",MAX:"Maximum capacity cannot exceed 1000"}},INSTANCE_TYPE:"Unknown instance type. Common types include: t4g.micro, t4g.small, m5.large",ARCHITECTURE_MISMATCH:"Architecture mismatch between instance type and AMI",ALLOCATED_STORAGE:{INTEGER:"Allocated storage must be an integer",MIN:"Allocated storage must be at least 20 GB",MAX:"Allocated storage cannot exceed 65536 GB"},DLQ:{MAX_RECEIVE_COUNT:{INTEGER:"Max receive count must be an integer",MIN:"Max receive count must be at least 1",MAX:"Max receive count cannot exceed 1000"}},ALARM:{PERCENTAGE:{MIN:"Threshold must be at least 1%",MAX:"Threshold must be at most 100%"},FREE_STORAGE_GIB:{MIN:"Free storage threshold must be at least 1 GiB"},RESPONSE_TIME_MS:{MIN:"Response-time threshold must be at least 1 ms"}},REGION:"Invalid AWS region",PASCAL_CASE:"Resource name must start with an uppercase letter and contain only alphanumerics (PascalCase).",IMAGE_DOCKER_MUTEX:"image and docker are mutually exclusive",AWS_ACCOUNT_ID:"AWS account id must be exactly 12 digits (no hyphens)",VPC_ID:"VPC id must look like vpc-abc12345",ROLE_ARN:"Role ARN must have the form arn:aws:iam::<account-id>:role/<name>",CIDR:"CIDR must be in dotted-quad/prefix-length form (e.g. 10.0.0.0/16)",VPC_PEER:{MIN_REQUESTER_ACCOUNTS:"At least one requester account id is required",REGION_REQUIRED:"Peer region is required when specified",ROUTE_TABLE_ID_REQUIRED:"Route table id must not be empty"},SCHEDULE_EXPRESSION:"Schedule expression must be 'rate(N minute|minutes|hour|hours|day|days)' with N>=1, or 'cron(<6-field AWS expression>)'"});var U9=Object.defineProperty,Er=(e,t)=>U9(e,"name",{value:t,configurable:!0}),z9=["us-east-2","us-west-2","us-east-1","eu-west-1","eu-central-1","ap-southeast-1"],B9=Object.freeze(z9.flatMap(e=>{let t=hs(e);return t?[t]:[]})),s0=Object.freeze(["us-east-2","us-west-2","us-east-1","eu-west-1","ap-southeast-1"]);function rh(e){return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}Er(rh,"parseRegionList");function c0(e){return Wn.includes(e)}Er(c0,"isValidRegion");function u0(e){return/^[a-z]{2}-[a-z]+-[1-9]$/.test(e)}Er(u0,"isValidRegionFormat");function l0(e){if(!e)return s0.slice(0,3);let t=e.toLowerCase().split("-"),r=t[0],i=t.length>1?t[1]:"",n=[];return r&&i&&(n=Wn.filter(a=>a.startsWith(`${r}-${i}`))),n.length===0&&r&&(n=Wn.filter(a=>a.startsWith(`${r}-`))),n.length>0?n.slice(0,3):s0.slice(0,3)}Er(l0,"getSuggestions");function d0(e){if(c0(e))return!0;let t=l0(e);return u0(e)?`Unknown region. Try: ${t.join(", ")}`:`Invalid format. Try: ${t.join(", ")}`}Er(d0,"validateRegion");function q1(e){if(!e||e.trim()==="")return!0;let t=rh(e);for(let r of t){let i=d0(r);if(i!==!0)return i}return!0}Er(q1,"validateRegionList");function p0(e,t){return e.filter(r=>r!==t)}Er(p0,"filterDuplicateRegions");function m0(e){return{label:e.city,value:e.code,description:e.optIn?`${e.code} \u2014 opt-in required`:e.code}}Er(m0,"toRegionOption");function Z1(){return Ut.map(m0)}Er(Z1,"getRegionOptions");function H1(e){return Ut.filter(t=>t.code!==e).map(m0)}Er(H1,"getRegionOptionsExcluding");function J1(e){let t=Ut.find(r=>r.code===e);return t?t.city:e}Er(J1,"getRegionName");function X1(e){return t=>{let r=rh(t);return p0(r,e)}}Er(X1,"createRegionFormatter");var nh="33.0.0";var ih=["Aurora","Instance","GlobalAurora","ClickHouse"],Ls=["FARGATE","FARGATE_SPOT","EC2"],qr=Pu,ah=["tinkerer","lightweight","standard","resilient","enterprise"],f0="custom",sl=[...ah,f0];var G9=Object.defineProperty,V9=(e,t)=>G9(e,"name",{value:t,configurable:!0}),Sve=Object.freeze({RESOURCE_SUFFIXES:Object.freeze({storage:"Storage",database:"Database",cluster:"Cluster",function:"Function",instance:"Instance",compute:"Compute"})}),cl=["ecs","lambda","ec2"],ul=Object.freeze({ECS:"ecs",LAMBDA:"lambda",EC2:"ec2"}),oh=["code","container"],sh=Object.freeze({CODE:"code",CONTAINER:"container"}),ch=["ARM_64","X86_64"],Y1="ARM_64",ll=["NONE","AWS_IAM"],uh=["public","internal"],lh=["CPU","MEMORY"],za=["messaging","compute"],dh=["ARM","STANDARD"],h0=["Instance","Aurora"],Us=["postgresql","mysql"],dl=["web","worker"],Q1=["foundation","compliance","hardened"];var ph=["t3.nano","t3.micro","t3.small","t3.medium","t3.large","t3.xlarge","t3.2xlarge","t3a.nano","t3a.micro","t3a.small","t3a.medium","t3a.large","t3a.xlarge","t3a.2xlarge","t4g.nano","t4g.micro","t4g.small","t4g.medium","t4g.large","t4g.xlarge","t4g.2xlarge","c5.large","c5.xlarge","c5.2xlarge","c5.4xlarge","c5.9xlarge","c5.12xlarge","c5.18xlarge","c5.24xlarge","c5a.large","c5a.xlarge","c5a.2xlarge","c5a.4xlarge","c5a.8xlarge","c5a.12xlarge","c5a.16xlarge","c5a.24xlarge","c6g.medium","c6g.large","c6g.xlarge","c6g.2xlarge","c6g.4xlarge","c6g.8xlarge","c6g.12xlarge","c6g.16xlarge","r5.large","r5.xlarge","r5.2xlarge","r5.4xlarge","r5.8xlarge","r5.12xlarge","r5.16xlarge","r5.24xlarge","r5a.large","r5a.xlarge","r5a.2xlarge","r5a.4xlarge","r5a.8xlarge","r5a.12xlarge","r5a.16xlarge","r5a.24xlarge","r6g.medium","r6g.large","r6g.xlarge","r6g.2xlarge","r6g.4xlarge","r6g.8xlarge","r6g.12xlarge","r6g.16xlarge","i3.large","i3.xlarge","i3.2xlarge","i3.4xlarge","i3.8xlarge","i3.16xlarge","p3.2xlarge","p3.8xlarge","p3.16xlarge","g4dn.xlarge","g4dn.2xlarge","g4dn.4xlarge","g4dn.8xlarge","g4dn.12xlarge","g4dn.16xlarge","m5.large","m5.xlarge","m5.2xlarge","m5.4xlarge","m5.8xlarge","m5.12xlarge","m5.16xlarge","m5.24xlarge","m5a.large","m5a.xlarge","m5a.2xlarge","m5a.4xlarge","m5a.8xlarge","m5a.12xlarge","m5a.16xlarge","m5a.24xlarge"],ej=[0,1,5,10,15,30,60];function zt(e,t){return e.includes(t)}V9(zt,"constIncludes");var tj=1,rj=65535,Tve=Object.freeze({postgresql:5432,mysql:3306}),nj=128,ij=10240,mh=1,fh=900,g0=1,y0=1e3,zs=100,aj=100;var oj=3e3;var sj=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH"],cj=["standard","assets","upload","website"],Bs=["AES256","KMS"];var W9=Object.defineProperty,pl=(e,t)=>W9(e,"name",{value:t,configurable:!0}),Bt=pl(e=>c.union([c.literal(!1),e]),"optionalOrDisabled"),Ba={check:pl(e=>e.minCapacity!==void 0&&e.maxCapacity!==void 0?e.minCapacity<=e.maxCapacity:!0,"check"),params:{message:E.CAPACITY_CONSTRAINT.MIN_LTE_MAX,path:["maxCapacity"]}},ml=pl(e=>c.number().int(E.MEMORY_LIMIT.INTEGER).min(e,e===128?E.MEMORY_LIMIT.MIN_128:E.MEMORY_LIMIT.MIN_512).max(30720,E.MEMORY_LIMIT.MAX),"memoryLimitMiBSchema"),be=c.string().min(1,E.REQUIRED.RESOURCE_NAME).max(63,E.MAX_LENGTH.RESOURCE_NAME).regex(he.RESOURCE_NAME,E.RESOURCE_NAME),lj=c.string().min(1,E.REQUIRED.BUCKET_NAME).max(63,E.MAX_LENGTH.BUCKET_NAME).regex(he.BUCKET_NAME,E.BUCKET_NAME),dj=c.string().min(1,E.REQUIRED.DATABASE_NAME).max(63,E.MAX_LENGTH.DATABASE_NAME).regex(he.DATABASE_NAME,E.DATABASE_NAME);function hh(e,t=he.IDENTIFIER,r=E.IDENTIFIER){return c.string().min(2,E.IDENTIFIER_MIN_LENGTH).max(50,e).regex(t,r).refine(i=>!i.endsWith("-"),{message:E.IDENTIFIER_NO_TRAILING_HYPHEN}).refine(i=>!i.includes("--"),{message:E.IDENTIFIER_NO_CONSECUTIVE_HYPHENS})}pl(hh,"identifierSchema");var lt=hh(E.MAX_LENGTH.APP_NAME),Pve=hh(E.MAX_LENGTH.APP_NAME,he.NEW_APP_NAME,E.NEW_APP_NAME),Ga=c.number().int(E.PORT.INTEGER).min(tj,E.PORT.MIN).max(rj,E.PORT.MAX),St=c.object({key:c.string(),sourceText:c.string()}).strict(),K9=c.object({__identifier:c.string()}).strict(),q9=c.object({__expression:c.string()}).strict(),Z9=c.object({__call:c.string()}).strict(),H9=c.union([K9,q9,Z9]),J9=c.union([c.string(),c.number(),c.boolean(),H9]),Gs=c.record(c.string().regex(he.ENV_VAR_NAME,E.ENV_VAR_NAME),J9),X9=c.object({id:c.string(),name:c.string().optional(),arn:c.string().optional(),field:c.string().optional()}).strict().refine(e=>e.name!==void 0!=(e.arn!==void 0),{message:"secretsImport requires exactly one of `name` or `arn`."}),pj=c.record(c.string(),X9),Rve=c.record(c.string(),c.unknown()),v0=c.enum(sl).describe(`Application type must be one of: ${sl.join(", ")}`),b0=c.enum(vr).describe(`OpenNext deployment pattern: ${vr.join(", ")}`),Y9=c.enum(["before-imports","after-imports","after-app-init","after-tags","after-resource","end-of-file"]),Q9=c.enum(["import","app-init","tags","database","compute","storage","network","messaging","cdn","pattern","vpc-peer","vpc-peer-accepter","cross-plan-connection","custom"]),mj=c.object({sourceText:c.string(),position:Y9,afterManagedResource:c.object({type:Q9,name:c.string().optional()}).strict().optional(),originalLine:c.number().int().optional(),leadingComments:c.array(c.string()).optional(),orphaned:c.boolean().optional(),orphanedComment:c.string().optional()}).strict(),fj=c.union([c.object({tier:c.enum(qr)}).strict(),c.literal(!1)]),hj=c.union([c.object({instanceType:c.string().optional()}).strict(),c.literal(!1)]),e8=hh(E.MAX_LENGTH.ORGANISATION_NAME),t8=c.string().regex(he.EMAIL,E.EMAIL),uj=c.string().refine(e=>Wn.includes(e),{message:E.REGION}),Ove=c.object({name:e8,email:t8,accountName:c.string().optional(),primaryRegion:uj.optional().default(fs),secondaryRegions:c.array(uj).optional(),security:c.enum(Q1).optional(),force:c.boolean().optional()}).strict();function fl(e){return e.issues.map(t=>`${t.path.length>0?`${t.path.join(".")}: `:""}${t.message}`).join(`
|
|
354
|
+
`)}getConsolePrefix(t){switch(t){case"error":return"[ERROR]";case"warn":return"[WARN]";case"info":return"[INFO]";case"debug":return"[DEBUG]";case"trace":return"[TRACE]"}}error(t,r,i){this.log("error",t,r,i)}warn(t,r,i){this.log("warn",t,r,i)}info(t,r,i){this.log("info",t,r,i)}debug(t,r,i){this.log("debug",t,r,i)}trace(t,r,i){this.log("trace",t,r,i)}diagnostic(t,r,i,n){this.log(t,r,i,n),!this.debugEnabled&&z_()&&(Qn[t]<Qn.info||this.writeStderrLine(this.createEntry(t,r,i,n)))}isDebugEnabled(){return this.debugEnabled}isTraceEnabled(){return this.traceEnabled}enableDebug(){this.debugEnabled=!0,Qn[this.minLevel]>Qn.debug&&(this.minLevel="debug"),this.fileWriter.setDebugEnabled(!0),this.fileWriter.isInitialised&&this.fileWriter.initialiseDebugStream()}withCorrelation(t){return new Rs(this,t)}forDeployment(t,r="deploy"){return new ol(this,t,r)}close(){this.fileWriter.close()}async flushAndClose(){await this.fileWriter.closeAndFlush()}getLogPath(){return this.mainLogPath}getDebugLogPath(){return this.debugLogPath}getLogDir(){return this.config.logDir}logWithCorrelation(t,r,i,n,a,o,s){this.log(t,r,i,a,n,o,s)}static reset(){e.instance&&(e.instance.close(),e.instance=null)}};var un=th.getInstance();var b9=Object.defineProperty,ut=(e,t)=>b9(e,"name",{value:t,configurable:!0}),js="fjall";function Ua(e,t){let r=S9(e);if(r.includes("..")||r.startsWith("/"))throw new Error(`Invalid ${t}: path traversal is not allowed`)}ut(Ua,"assertNoTraversal");function E9(){return js}ut(E9,"getFjallPath");function x9(e){let t=j1(e);return j1(t)||"."}ut(x9,"getProjectRoot");function L1(e){if(!F1(e))throw new Error(`Infrastructure file not found: ${e}`);let t=M1(e,"utf-8"),r=U1(t);if(r===void 0)throw new Error(`Could not find appName in infrastructure file: ${e}. Expected format: const appName = "yourAppName";`);return r}ut(L1,"getAppNameFromInfrastructure");function U1(e){return e.match(/const\s+appName\s*=\s*["']([^"']+)["']/)?.[1]}ut(U1,"parseAppNameFromInfrastructureContent");function A9(e){if(!F1(e))return;let t;try{t=M1(e,"utf-8")}catch(r){un.debug("PathHelpers","Could not read organisation infrastructure",{error:ae(ze(r))});return}return t.match(/organisationName:\s*(["'])(.+?)\1/)?.[2]}ut(A9,"readOrganisationNameFromInfrastructure");function _9(e){let t=Sr(e,V_);return L1(t)}ut(_9,"getAppName");function ei(e){return Ua(e,"app name"),Sr(js,e,V_)}ut(ei,"getInfrastructurePath");function z1(e){return Ua(e,"app name"),Sr(js,e)}ut(z1,"getAppPath");function B1(e,t){let r=e??process.cwd();return t===void 0?r:(Ua(t,"container"),Sr(r,t))}ut(B1,"resolveScaffoldRootDir");function T9(e,t,r){return Sr(B1(t,r),z1(e))}ut(T9,"resolveAppScaffoldPath");function C9(e){return Ua(e,"component name"),Sr(js,e)}ut(C9,"getOrganisationComponentPath");function I9(e){return Ua(e,"deployment type"),Sr(js,e,"logs")}ut(I9,"getDeploymentLogsPath");function G1(){return Sr(js,"domains")}ut(G1,"getDomainsDir");function G_(e){return Ua(e,"domain name"),Sr(G1(),e)}ut(G_,"getDomainComponentPath");function D9(e){return Sr(G_(e),V_)}ut(D9,"getDomainInfrastructurePath");function w9(e){return Sr(G_(e),k9)}ut(w9,"getDomainZoneFilePath");var V_="infrastructure.ts",k9="zone.bind",N9="cdk.out";function P9(e){return Sr(e,N9)}ut(P9,"getCdkOutPath");var R9=Object.defineProperty,Ms=(e,t)=>R9(e,"name",{value:t,configurable:!0});function W_(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}Ms(W_,"escapeRegExp");function V1(e,t,r){let i=ei(t),n=e.read(i)?.toString();return n?new RegExp(`["']${W_(r)}["']`).test(n):!1}Ms(V1,"resourceExists");function K_(e,t,r){let i=ei(t);if(!e.read(i)?.toString())throw new Error(`Infrastructure file not found for ${t}`);if(V1(e,t,r))throw new Error(`Resource name '${r}' already exists in ${t}. Please choose a different name or remove the existing resource first.`)}Ms(K_,"assertResourceNameUnique");function O9(e,t,r){let i=ei(t),n=e.read(i)?.toString();if(!n)return 0;let a={database:/DatabaseFactory\.build\(/g,compute:/ComputeFactory\.build\(/g,lambda:/type:\s*["']lambda["']/g,ecs:/type:\s*["']ecs["']/g,ec2:/type:\s*["']ec2["']/g}[r];if(!a)return 0;let o=n.match(a);return o?o.length:0}Ms(O9,"countResourcesOfType");function $9(e,t){let r=ei(t),i=e.read(r)?.toString();if(!i)return[];let n=[],a=i.matchAll(/ComputeFactory\.build\(["']([^"']+)["'],\s*\{([^}]*?)\}/gs);for(let o of a){let s=o[1],u=o[2],d="ecs";u.includes('type: "lambda"')?d="lambda":u.includes('type: "ec2"')&&(d="ec2");let p=u.includes("connections:"),h=[];if(p){let g=u.match(/connections:\s*\[([^\]]+)\]/);if(g){let l=g[1].match(/\w+/g)??[];h.push(...l)}}n.push({name:s,type:d,hasConnections:p,connectedResources:h})}return n}Ms($9,"detectComputeResources");function q_(e,t,r){let i=ei(t),n=e.read(i)?.toString();return n?new RegExp(`databaseName:\\s*["']${W_(r)}["']`).test(n):!1}Ms(q_,"databaseExists");import*as Bc from"fs";import*as U4 from"path";var j9=Object.defineProperty,Fs=(e,t)=>j9(e,"name",{value:t,configurable:!0});function Z_(e){return e.success===!0}Fs(Z_,"isSuccess");function H_(e){return e.success===!1}Fs(H_,"isFailure");function V(e){return{success:!0,data:e}}Fs(V,"success");function $(e){return{success:!1,error:e}}Fs($,"failure");async function J_(e){try{let t=await e();return V(t)}catch(t){return $(Gr(t))}}Fs(J_,"tryAsync");function X_(e){try{let t=e();return V(t)}catch(t){return $(Gr(t))}}Fs(X_,"trySync");var M9=Object.defineProperty,F9=(e,t)=>M9(e,"name",{value:t,configurable:!0}),W1=/^[a-zA-Z][a-zA-Z0-9-]*$/,L9=Ou.source.replace(/^\^|\$$/g,""),he=Object.freeze({IDENTIFIER:W1,NEW_APP_NAME:/^[a-z][a-z0-9-]*$/,RESOURCE_NAME:/^[a-zA-Z][a-zA-Z0-9]*$/,ECS_SERVICE_NAME:W1,BUCKET_NAME:/^[a-z][a-z0-9-]*[a-z0-9]$|^[a-z][a-z0-9]*$/,DATABASE_NAME:/^[a-zA-Z][a-zA-Z0-9_]*$/,RESOURCE_TYPE:/^[a-z]+(:[a-z]+)?$/,SSM_PATH:new RegExp(`^(?:/${L9})+$`),SECRET_NAME:pf,SSM_COMPONENT:Ou,EMAIL:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,DOCKER_IMAGE:/^[a-z0-9][a-z0-9._-]*[a-z0-9](:[a-z0-9._-]+)?$/,DOMAIN:/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i,HTTP_ORIGIN:/^https?:\/\/[a-z0-9.-]+(:\d+)?$/i,PASCAL_CASE:/^[A-Z][A-Za-z0-9]*$/,AWS_ACCOUNT_ID:/^\d{12}$/,VPC_ID:/^vpc-[a-z0-9]+$/,ROLE_ARN:/^arn:aws[a-zA-Z-]*:iam::\d{12}:role\/.+$/,CIDR:/^((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\/(3[0-2]|[12]?\d)$/,SCHEDULE_EXPRESSION:/^(rate\(1 (?:minute|hour|day)\)|rate\((?:[2-9]|[1-9]\d+) (?:minutes|hours|days)\)|cron\([^\s()]+ [^\s()]+ [^\s()]+ [^\s()]+ [^\s()]+ [^\s()]+\))$/,LAMBDA_RUNTIME_IDENTIFIER:/^[A-Za-z0-9._-]+$/,ENV_VAR_NAME:/^[A-Za-z_][A-Za-z0-9_]*$/});function Y_(e){let t=/^rate\((\d+) (minute|minutes|hour|hours|day|days)\)$/.exec(e);if(!t)return;let r=t[1],i=t[2];if(r===void 0||i===void 0)return;let n=parseInt(r,10);if(!Number.isFinite(n)||n<1)return;let a=i==="minute"||i==="hour"||i==="day";if(!(a&&n!==1)&&!(!a&&n===1))return i==="minute"||i==="minutes"?{everyMs:n*6e4}:i==="hour"||i==="hours"?{everyMs:n*60*6e4}:{everyMs:n*24*60*6e4}}F9(Y_,"parseRateExpression");var K1=["t4g.medium","m7g.medium","m8g.medium","r7g.medium","r8g.medium","m7g.large","m8g.large","r7g.large","r8g.large","m7g.xlarge","m8g.xlarge","r7g.xlarge","r8g.xlarge"];var E=Object.freeze({IDENTIFIER:"Must start with a letter, contain only letters, numbers, and hyphens",NEW_APP_NAME:"Must start with a lowercase letter and contain only lowercase letters, numbers, and hyphens",IDENTIFIER_MIN_LENGTH:"Must be at least 2 characters",IDENTIFIER_NO_TRAILING_HYPHEN:"Must not end with a hyphen",IDENTIFIER_NO_CONSECUTIVE_HYPHENS:"Must not contain consecutive hyphens",RESOURCE_NAME:"Must start with a letter and contain only letters and numbers (PascalCase recommended)",ECS_SERVICE_NAME:"Service name must start with a letter and contain only letters, numbers, and hyphens",BUCKET_NAME:"Bucket name must start with a lowercase letter and contain only lowercase letters, numbers, and hyphens",DATABASE_NAME:"Database name must start with a letter and contain only letters, numbers, and underscores",RESOURCE_TYPE:"Resource type must be in format 'category' or 'category:type'",SSM_PATH:"SSM path must start with / and contain valid namespace segments (e.g., /myapp/ApiCluster/service)",SECRET_NAME:pA,SSM_COMPONENT:mf,EMAIL:"Please enter a valid email address",DOMAIN:"Please enter a valid domain (e.g., cms.example.com)",DOCKER_IMAGE:"Invalid Docker image name format",REQUIRED:{APP_NAME:"Application name is required",RESOURCE_NAME:"Resource name is required",BUCKET_NAME:"Bucket name is required",SERVICE_NAME:"Service name is required",NETWORK_NAME:"Network name is required",DATABASE_NAME:"Database name is required",ORGANISATION_NAME:"Organisation name is required",EMAIL:"Email is required",NAME:"Name is required",USERNAME:"Username is required",CONTAINER_NAME:"Container name is required",GROUP:"Group is required",PATTERN_NAME:"Pattern name is required",SOURCE:"Source directory is required",BUILD_COMMAND:"Build command is required",OUTPUT_DIR:"Output directory is required",FORMS_TO:"Forms recipient address is required",ROUTING_PATH:"Routing path is required",RESOURCE_REFERENCE:"Resource reference is required",RESOURCE_TYPE:"Resource type is required",VARIANT:"Variant is required",SUBTYPE:"Subtype is required",DEPLOY_TARGET:"Deploy target is required",DESTROY_TARGET:"Destroy target is required",CONNECTED_RESOURCE_NAME:"Connected resource names must not be empty"},MAX_LENGTH:{APP_NAME:"Application name must be 50 characters or less",RESOURCE_NAME:"Resource name must be 63 characters or less",BUCKET_NAME:"Bucket name must be 63 characters or less",SERVICE_NAME:"Service name must be 255 characters or less",NETWORK_NAME:"Network name must be 50 characters or less",DATABASE_NAME:"Database name must be 63 characters or less",ORGANISATION_NAME:"Organisation name must be 50 characters or less"},PORT:{INTEGER:"Port must be an integer",MIN:"Port must be at least 1",MAX:"Port cannot exceed 65535"},USERNAME:{MAX_LENGTH:"Username cannot exceed 63 characters"},LAMBDA:{MEMORY:{INTEGER:"Lambda memory must be an integer",MIN:"Memory must be at least 128 MB",MAX:"Memory cannot exceed 10240 MB",MULTIPLE:"Memory must be 128 MB or a multiple of 64 MB"},TIMEOUT:{INTEGER:"Timeout must be an integer",MIN:"Timeout must be at least 1 second",MAX:"Timeout cannot exceed 900 seconds"},RUNTIME:"Lambda runtime must contain only letters, digits, dots, underscores, or dashes (e.g. 'NODEJS_20_X' or 'nodejs20.x')"},ENV_VAR_NAME:"Environment variable names must start with a letter or underscore and contain only letters, digits, and underscores",PRIORITY:{INTEGER:"Priority must be an integer",MIN:"Priority must be at least 1",MAX:"Priority cannot exceed 50000"},CAPACITY:{MIN:{INTEGER:"Minimum capacity must be an integer",MIN_0:"Minimum capacity must be at least 0",MIN_1:"Minimum capacity must be at least 1",MAX:"Minimum capacity cannot exceed 100"},MAX:{INTEGER:"Maximum capacity must be an integer",MIN_0:"Maximum capacity must be at least 0",MIN_1:"Maximum capacity must be at least 1",MAX:"Maximum capacity cannot exceed 100"},DESIRED:{INTEGER:"Desired count must be an integer",MIN:"Desired count must be at least 0",MAX:"Desired count cannot exceed 100"},WARM_POOL_REQUIRED:"minCapacity 0 requires a warmPool \u2014 without it, new tasks wait 60-90s for a cold instance launch",WARM_POOL:{MIN_SIZE:{INTEGER:"Warm pool minSize must be an integer",MIN:"Warm pool minSize must be at least 0",MAX:"Warm pool minSize cannot exceed 100"},MIN_SIZE_EXCEEDS_MAX_CAPACITY:"warmPool.minSize cannot exceed maxCapacity \u2014 the warm pool cannot hold more instances than the ASG allows"}},MEMORY_LIMIT:{INTEGER:"Memory limit must be an integer",MIN_512:"Memory limit must be at least 512 MiB",MIN_128:"Memory limit must be at least 128 MiB",MAX:"Memory limit cannot exceed 30720 MiB"},DATABASE:{PORT:{INTEGER:"Database port must be an integer",MIN:"Database port must be at least 1024",MAX:"Database port cannot exceed 65535"},NAME:{REQUIRED:"Database name is required",MAX_LENGTH:"Database name must be 63 characters or less"}},CLICKHOUSE_STORAGE:{INTEGER:"ClickHouse storage must be a whole number of GiB",MIN:`ClickHouse storage must be at least ${100} GiB`,MAX:`ClickHouse storage cannot exceed ${16384} GiB (the gp3 ceiling)`},CLICKHOUSE_IOPS:{INTEGER:"ClickHouse iops must be a whole number",MIN:`ClickHouse iops must be at least ${3e3} (the gp3 baseline)`,MAX:`ClickHouse iops cannot exceed ${8e4} (the gp3 ceiling)`},CLICKHOUSE_THROUGHPUT:{INTEGER:"ClickHouse throughputMbps must be a whole number of MiB/s",MIN:`ClickHouse throughputMbps must be at least ${125} MiB/s (the gp3 baseline)`,MAX:`ClickHouse throughputMbps cannot exceed ${2e3} MiB/s (the gp3 ceiling)`},BACKUP_RETENTION:{INTEGER:"Backup retention must be an integer",MIN:"Backup retention must be at least 1 day",MAX:"Backup retention cannot exceed 35 days (the RDS automated-backup ceiling)"},CLICKHOUSE_BACKUP_RETENTION:{INTEGER:"ClickHouse backup retention must be an integer number of days",MIN:`ClickHouse backup retention must be at least ${1} day`,MAX:`ClickHouse backup retention cannot exceed ${3650} days`},SQS:{VISIBILITY_TIMEOUT:{INTEGER:"Visibility timeout must be an integer",MIN:"Visibility timeout must be at least 0 seconds",MAX:"Visibility timeout cannot exceed 43200 seconds (12 hours)"},RETENTION_PERIOD:{INTEGER:"Retention period must be an integer",MIN:"Retention period must be at least 60 seconds",MAX:"Retention period cannot exceed 1209600 seconds (14 days)"}},READER:{COUNT:{INTEGER:"Reader count must be an integer",MIN:"Reader count must be at least 0",MAX:"Reader count cannot exceed 15"}},IDENTIFIER_SUFFIX:{REQUIRED:"Identifier suffix is required when specified",MAX_LENGTH:"Identifier suffix cannot exceed 50 characters"},ROTATION:{INTEGER:"Rotation days must be an integer",MIN:"Rotation interval must be at least 1 day",MAX:"Rotation interval cannot exceed 365 days"},MAX_CONNECTIONS:{INTEGER:"Max connections must be an integer",MIN:"Max connections must be at least 1",MAX:"Max connections cannot exceed 100"},MONITORING_INTERVAL:{INTEGER:"Monitoring interval must be an integer",MIN:"Monitoring interval must be at least 0",MAX:"Monitoring interval cannot exceed 60 seconds",VALUES:"Monitoring interval must be 0, 1, 5, 10, 15, 30, or 60 seconds"},RETENTION_DAYS:{INTEGER:"Retention days must be an integer",MIN:"Retention days must be at least 1",MAX:"Retention days cannot exceed 365"},BATCH_SIZE:{INTEGER:"Batch size must be an integer",MIN:"Batch size must be at least 1",MAX:"Batch size cannot exceed 10000"},SERVICE:{UNIQUE_WITHIN_CLUSTER:"Service names must be unique within a cluster",MIN_REQUIRED:"At least one service is required",ROUTING_REQUIRED:"Multiple services with ports require routing config (path or host)"},PROXY_CONFIG:{MAX_IDLE_CONNECTIONS:{INTEGER:"Max idle connections must be an integer",MIN:"Max idle connections must be at least 0",MAX:"Max idle connections cannot exceed 100"},BORROW_TIMEOUT:{INTEGER:"Connection borrow timeout must be an integer",MIN:"Connection borrow timeout must be at least 1 second",MAX:"Connection borrow timeout cannot exceed 3600 seconds"}},MAX_AZS:{INTEGER:"Max AZs must be an integer",MIN:"Max AZs must be at least 1",MAX:"Max AZs cannot exceed 3"},BATCHING_WINDOW:{INTEGER:"Max batching window must be an integer",MIN:"Max batching window must be at least 0",MAX:"Max batching window cannot exceed 300 seconds"},HEALTH_CHECK:{INTERVAL:{INTEGER:"Health check interval must be an integer",MIN:"Health check interval must be at least 5 seconds",MAX:"Health check interval cannot exceed 300 seconds"},TIMEOUT:{INTEGER:"Health check timeout must be an integer",MIN:"Health check timeout must be at least 2 seconds",MAX:"Health check timeout cannot exceed 60 seconds"},RETRIES:{INTEGER:"Health check retries must be an integer",MIN:"Health check retries must be at least 1",MAX:"Health check retries cannot exceed 10"},START_PERIOD:{INTEGER:"Health check start period must be an integer",MIN:"Health check start period must be at least 0 seconds",MAX:"Health check start period cannot exceed 300 seconds"}},EPHEMERAL_STORAGE:{INTEGER:"Ephemeral storage size must be an integer",MIN:"Ephemeral storage size must be at least 512 MB",MAX:"Ephemeral storage size cannot exceed 10240 MB"},MAX_MESSAGE_SIZE:{INTEGER:"Max message size must be an integer",MIN:"Max message size must be at least 1024 bytes",MAX:"Max message size cannot exceed 262144 bytes (256 KB)"},CAPACITY_CONSTRAINT:{MIN_LTE_MAX:"minCapacity must be less than or equal to maxCapacity"},DIRECT_ACCESS:{NO_DOMAIN:"directAccess cannot be used with domain (no ALB for HTTPS)",NO_LOAD_BALANCER:"directAccess cannot be used with loadBalancer (mutually exclusive)"},GLOBAL_AURORA:{PRIMARY_REGION_REQUIRED:"primaryRegion is required for GlobalAurora databases"},NAT_GATEWAY:{INTEGER:"NAT gateway count must be an integer",MIN:"NAT gateway count must be at least 0",MAX:"NAT gateway count cannot exceed 3"},CIDR_MASK:{INTEGER:"CIDR mask must be an integer",MIN:"CIDR mask must be at least 16",MAX:"CIDR mask cannot exceed 28"},CPU:{INTEGER:"CPU must be an integer",MIN:"CPU must be at least 256 units",MAX:"CPU cannot exceed 4096 units"},KMS:{KEY_REQUIRED:"KMS key ARN is required when using KMS encryption"},READER_INSTANCES:{MAX:"Cannot have more than 15 reader instances",COUNT_OR_INSTANCES:"Cannot specify both 'count' and 'instances' - use one or the other"},GENERATOR_CAPACITY:{MIN:{MIN:"Minimum capacity must be at least 1",MAX:"Minimum capacity cannot exceed 1000"},MAX:{MIN:"Maximum capacity must be at least 1",MAX:"Maximum capacity cannot exceed 1000"}},INSTANCE_TYPE:"Unknown instance type. Common types include: t4g.micro, t4g.small, m5.large",ARCHITECTURE_MISMATCH:"Architecture mismatch between instance type and AMI",ALLOCATED_STORAGE:{INTEGER:"Allocated storage must be an integer",MIN:"Allocated storage must be at least 20 GB",MAX:"Allocated storage cannot exceed 65536 GB"},DLQ:{MAX_RECEIVE_COUNT:{INTEGER:"Max receive count must be an integer",MIN:"Max receive count must be at least 1",MAX:"Max receive count cannot exceed 1000"}},ALARM:{PERCENTAGE:{MIN:"Threshold must be at least 1%",MAX:"Threshold must be at most 100%"},FREE_STORAGE_GIB:{MIN:"Free storage threshold must be at least 1 GiB"},RESPONSE_TIME_MS:{MIN:"Response-time threshold must be at least 1 ms"}},REGION:"Invalid AWS region",PASCAL_CASE:"Resource name must start with an uppercase letter and contain only alphanumerics (PascalCase).",IMAGE_DOCKER_MUTEX:"image and docker are mutually exclusive",AWS_ACCOUNT_ID:"AWS account id must be exactly 12 digits (no hyphens)",VPC_ID:"VPC id must look like vpc-abc12345",ROLE_ARN:"Role ARN must have the form arn:aws:iam::<account-id>:role/<name>",CIDR:"CIDR must be in dotted-quad/prefix-length form (e.g. 10.0.0.0/16)",VPC_PEER:{MIN_REQUESTER_ACCOUNTS:"At least one requester account id is required",REGION_REQUIRED:"Peer region is required when specified",ROUTE_TABLE_ID_REQUIRED:"Route table id must not be empty"},SCHEDULE_EXPRESSION:"Schedule expression must be 'rate(N minute|minutes|hour|hours|day|days)' with N>=1, or 'cron(<6-field AWS expression>)'"});var U9=Object.defineProperty,Er=(e,t)=>U9(e,"name",{value:t,configurable:!0}),z9=["us-east-2","us-west-2","us-east-1","eu-west-1","eu-central-1","ap-southeast-1"],B9=Object.freeze(z9.flatMap(e=>{let t=hs(e);return t?[t]:[]})),s0=Object.freeze(["us-east-2","us-west-2","us-east-1","eu-west-1","ap-southeast-1"]);function rh(e){return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}Er(rh,"parseRegionList");function c0(e){return Wn.includes(e)}Er(c0,"isValidRegion");function u0(e){return/^[a-z]{2}-[a-z]+-[1-9]$/.test(e)}Er(u0,"isValidRegionFormat");function l0(e){if(!e)return s0.slice(0,3);let t=e.toLowerCase().split("-"),r=t[0],i=t.length>1?t[1]:"",n=[];return r&&i&&(n=Wn.filter(a=>a.startsWith(`${r}-${i}`))),n.length===0&&r&&(n=Wn.filter(a=>a.startsWith(`${r}-`))),n.length>0?n.slice(0,3):s0.slice(0,3)}Er(l0,"getSuggestions");function d0(e){if(c0(e))return!0;let t=l0(e);return u0(e)?`Unknown region. Try: ${t.join(", ")}`:`Invalid format. Try: ${t.join(", ")}`}Er(d0,"validateRegion");function q1(e){if(!e||e.trim()==="")return!0;let t=rh(e);for(let r of t){let i=d0(r);if(i!==!0)return i}return!0}Er(q1,"validateRegionList");function p0(e,t){return e.filter(r=>r!==t)}Er(p0,"filterDuplicateRegions");function m0(e){return{label:e.city,value:e.code,description:e.optIn?`${e.code} \u2014 opt-in required`:e.code}}Er(m0,"toRegionOption");function Z1(){return Ut.map(m0)}Er(Z1,"getRegionOptions");function H1(e){return Ut.filter(t=>t.code!==e).map(m0)}Er(H1,"getRegionOptionsExcluding");function J1(e){let t=Ut.find(r=>r.code===e);return t?t.city:e}Er(J1,"getRegionName");function X1(e){return t=>{let r=rh(t);return p0(r,e)}}Er(X1,"createRegionFormatter");var nh="33.1.0";var ih=["Aurora","Instance","GlobalAurora","ClickHouse"],Ls=["FARGATE","FARGATE_SPOT","EC2"],qr=Pu,ah=["tinkerer","lightweight","standard","resilient","enterprise"],f0="custom",sl=[...ah,f0];var G9=Object.defineProperty,V9=(e,t)=>G9(e,"name",{value:t,configurable:!0}),Sve=Object.freeze({RESOURCE_SUFFIXES:Object.freeze({storage:"Storage",database:"Database",cluster:"Cluster",function:"Function",instance:"Instance",compute:"Compute"})}),cl=["ecs","lambda","ec2"],ul=Object.freeze({ECS:"ecs",LAMBDA:"lambda",EC2:"ec2"}),oh=["code","container"],sh=Object.freeze({CODE:"code",CONTAINER:"container"}),ch=["ARM_64","X86_64"],Y1="ARM_64",ll=["NONE","AWS_IAM"],uh=["public","internal"],lh=["CPU","MEMORY"],za=["messaging","compute"],dh=["ARM","STANDARD"],h0=["Instance","Aurora"],Us=["postgresql","mysql"],dl=["web","worker"],Q1=["foundation","compliance","hardened"];var ph=["t3.nano","t3.micro","t3.small","t3.medium","t3.large","t3.xlarge","t3.2xlarge","t3a.nano","t3a.micro","t3a.small","t3a.medium","t3a.large","t3a.xlarge","t3a.2xlarge","t4g.nano","t4g.micro","t4g.small","t4g.medium","t4g.large","t4g.xlarge","t4g.2xlarge","c5.large","c5.xlarge","c5.2xlarge","c5.4xlarge","c5.9xlarge","c5.12xlarge","c5.18xlarge","c5.24xlarge","c5a.large","c5a.xlarge","c5a.2xlarge","c5a.4xlarge","c5a.8xlarge","c5a.12xlarge","c5a.16xlarge","c5a.24xlarge","c6g.medium","c6g.large","c6g.xlarge","c6g.2xlarge","c6g.4xlarge","c6g.8xlarge","c6g.12xlarge","c6g.16xlarge","r5.large","r5.xlarge","r5.2xlarge","r5.4xlarge","r5.8xlarge","r5.12xlarge","r5.16xlarge","r5.24xlarge","r5a.large","r5a.xlarge","r5a.2xlarge","r5a.4xlarge","r5a.8xlarge","r5a.12xlarge","r5a.16xlarge","r5a.24xlarge","r6g.medium","r6g.large","r6g.xlarge","r6g.2xlarge","r6g.4xlarge","r6g.8xlarge","r6g.12xlarge","r6g.16xlarge","i3.large","i3.xlarge","i3.2xlarge","i3.4xlarge","i3.8xlarge","i3.16xlarge","p3.2xlarge","p3.8xlarge","p3.16xlarge","g4dn.xlarge","g4dn.2xlarge","g4dn.4xlarge","g4dn.8xlarge","g4dn.12xlarge","g4dn.16xlarge","m5.large","m5.xlarge","m5.2xlarge","m5.4xlarge","m5.8xlarge","m5.12xlarge","m5.16xlarge","m5.24xlarge","m5a.large","m5a.xlarge","m5a.2xlarge","m5a.4xlarge","m5a.8xlarge","m5a.12xlarge","m5a.16xlarge","m5a.24xlarge"],ej=[0,1,5,10,15,30,60];function zt(e,t){return e.includes(t)}V9(zt,"constIncludes");var tj=1,rj=65535,Tve=Object.freeze({postgresql:5432,mysql:3306}),nj=128,ij=10240,mh=1,fh=900,g0=1,y0=1e3,zs=100,aj=100;var oj=3e3;var sj=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH"],cj=["standard","assets","upload","website"],Bs=["AES256","KMS"];var W9=Object.defineProperty,pl=(e,t)=>W9(e,"name",{value:t,configurable:!0}),Bt=pl(e=>c.union([c.literal(!1),e]),"optionalOrDisabled"),Ba={check:pl(e=>e.minCapacity!==void 0&&e.maxCapacity!==void 0?e.minCapacity<=e.maxCapacity:!0,"check"),params:{message:E.CAPACITY_CONSTRAINT.MIN_LTE_MAX,path:["maxCapacity"]}},ml=pl(e=>c.number().int(E.MEMORY_LIMIT.INTEGER).min(e,e===128?E.MEMORY_LIMIT.MIN_128:E.MEMORY_LIMIT.MIN_512).max(30720,E.MEMORY_LIMIT.MAX),"memoryLimitMiBSchema"),be=c.string().min(1,E.REQUIRED.RESOURCE_NAME).max(63,E.MAX_LENGTH.RESOURCE_NAME).regex(he.RESOURCE_NAME,E.RESOURCE_NAME),lj=c.string().min(1,E.REQUIRED.BUCKET_NAME).max(63,E.MAX_LENGTH.BUCKET_NAME).regex(he.BUCKET_NAME,E.BUCKET_NAME),dj=c.string().min(1,E.REQUIRED.DATABASE_NAME).max(63,E.MAX_LENGTH.DATABASE_NAME).regex(he.DATABASE_NAME,E.DATABASE_NAME);function hh(e,t=he.IDENTIFIER,r=E.IDENTIFIER){return c.string().min(2,E.IDENTIFIER_MIN_LENGTH).max(50,e).regex(t,r).refine(i=>!i.endsWith("-"),{message:E.IDENTIFIER_NO_TRAILING_HYPHEN}).refine(i=>!i.includes("--"),{message:E.IDENTIFIER_NO_CONSECUTIVE_HYPHENS})}pl(hh,"identifierSchema");var lt=hh(E.MAX_LENGTH.APP_NAME),Pve=hh(E.MAX_LENGTH.APP_NAME,he.NEW_APP_NAME,E.NEW_APP_NAME),Ga=c.number().int(E.PORT.INTEGER).min(tj,E.PORT.MIN).max(rj,E.PORT.MAX),St=c.object({key:c.string(),sourceText:c.string()}).strict(),K9=c.object({__identifier:c.string()}).strict(),q9=c.object({__expression:c.string()}).strict(),Z9=c.object({__call:c.string()}).strict(),H9=c.union([K9,q9,Z9]),J9=c.union([c.string(),c.number(),c.boolean(),H9]),Gs=c.record(c.string().regex(he.ENV_VAR_NAME,E.ENV_VAR_NAME),J9),X9=c.object({id:c.string(),name:c.string().optional(),arn:c.string().optional(),field:c.string().optional()}).strict().refine(e=>e.name!==void 0!=(e.arn!==void 0),{message:"secretsImport requires exactly one of `name` or `arn`."}),pj=c.record(c.string(),X9),Rve=c.record(c.string(),c.unknown()),v0=c.enum(sl).describe(`Application type must be one of: ${sl.join(", ")}`),b0=c.enum(vr).describe(`OpenNext deployment pattern: ${vr.join(", ")}`),Y9=c.enum(["before-imports","after-imports","after-app-init","after-tags","after-resource","end-of-file"]),Q9=c.enum(["import","app-init","tags","database","compute","storage","network","messaging","cdn","pattern","vpc-peer","vpc-peer-accepter","cross-plan-connection","custom"]),mj=c.object({sourceText:c.string(),position:Y9,afterManagedResource:c.object({type:Q9,name:c.string().optional()}).strict().optional(),originalLine:c.number().int().optional(),leadingComments:c.array(c.string()).optional(),orphaned:c.boolean().optional(),orphanedComment:c.string().optional()}).strict(),fj=c.union([c.object({tier:c.enum(qr)}).strict(),c.literal(!1)]),hj=c.union([c.object({instanceType:c.string().optional()}).strict(),c.literal(!1)]),e8=hh(E.MAX_LENGTH.ORGANISATION_NAME),t8=c.string().regex(he.EMAIL,E.EMAIL),uj=c.string().refine(e=>Wn.includes(e),{message:E.REGION}),Ove=c.object({name:e8,email:t8,accountName:c.string().optional(),primaryRegion:uj.optional().default(fs),secondaryRegions:c.array(uj).optional(),security:c.enum(Q1).optional(),force:c.boolean().optional()}).strict();function fl(e){return e.issues.map(t=>`${t.path.length>0?`${t.path.join(".")}: `:""}${t.message}`).join(`
|
|
355
355
|
`)}pl(fl,"getZodErrorMessage");var gh=c.number().min(1,E.ALARM.PERCENTAGE.MIN).max(100,E.ALARM.PERCENTAGE.MAX),S0=c.union([gh,c.literal(!1)]),r8=c.union([c.number().min(1,E.ALARM.RESPONSE_TIME_MS.MIN),c.literal(!1)]),n8=c.number().min(1,E.ALARM.FREE_STORAGE_GIB.MIN),gj=c.union([c.literal(!1),c.object({cpuThreshold:S0.optional(),memoryThreshold:S0.optional(),runningTasksMinimum:c.number().int().min(0).optional(),http5xxThreshold:S0.optional(),p99ResponseTimeThresholdMs:r8.optional()}).strict()]),yj=c.union([c.literal(!1),c.object({cpuThreshold:gh.optional(),freeStorageThresholdGiB:n8.optional(),connectionsThreshold:c.number().int().min(1).optional()}).strict()]),vj=c.union([c.literal(!1),c.object({errorRateThreshold:gh.optional(),durationThresholdPercent:gh.optional()}).strict()]);var Va=c.number().int(E.BACKUP_RETENTION.INTEGER).min(1,E.BACKUP_RETENTION.MIN).max(35,E.BACKUP_RETENTION.MAX),bj=c.number().int(E.CLICKHOUSE_STORAGE.INTEGER).min(100,E.CLICKHOUSE_STORAGE.MIN).max(16384,E.CLICKHOUSE_STORAGE.MAX),Sj=c.number().int(E.CLICKHOUSE_IOPS.INTEGER).min(3e3,E.CLICKHOUSE_IOPS.MIN).max(8e4,E.CLICKHOUSE_IOPS.MAX),Ej=c.number().int(E.CLICKHOUSE_THROUGHPUT.INTEGER).min(125,E.CLICKHOUSE_THROUGHPUT.MIN).max(2e3,E.CLICKHOUSE_THROUGHPUT.MAX),i8=c.enum(K1),xj=c.number().int(E.CLICKHOUSE_BACKUP_RETENTION.INTEGER).min(1,E.CLICKHOUSE_BACKUP_RETENTION.MIN).max(3650,E.CLICKHOUSE_BACKUP_RETENTION.MAX),hl=c.number().int(E.MONITORING_INTERVAL.INTEGER).refine(e=>zt(ej,e),{message:E.MONITORING_INTERVAL.VALUES}),vh=c.number().int(E.DATABASE.PORT.INTEGER).min(1024,E.DATABASE.PORT.MIN).max(65535,E.DATABASE.PORT.MAX),a8=c.enum(ih).describe(`Database type must be one of: ${ih.join(", ")}`),o8=c.object({maxConnections:c.number().int(E.MAX_CONNECTIONS.INTEGER).min(1,E.MAX_CONNECTIONS.MIN).max(100,E.MAX_CONNECTIONS.MAX).optional(),maxIdleConnections:c.number().int(E.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.INTEGER).min(0,E.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MIN).max(100,E.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MAX).optional(),connectionBorrowTimeout:c.number().int(E.PROXY_CONFIG.BORROW_TIMEOUT.INTEGER).min(1,E.PROXY_CONFIG.BORROW_TIMEOUT.MIN).max(3600,E.PROXY_CONFIG.BORROW_TIMEOUT.MAX).optional(),requireTLS:c.boolean().optional()}).strict().describe("RDS Proxy configuration"),s8=c.object({instanceType:c.string().optional(),availabilityZone:c.string().optional()}).strict().describe("Read replica configuration"),c8=c.object({automaticallyAfterDays:c.number().int(E.ROTATION.INTEGER).min(1,E.ROTATION.MIN).max(365,E.ROTATION.MAX).optional()}).strict().describe("Secret rotation configuration"),bh=c.object({username:c.string().min(1,E.REQUIRED.USERNAME).max(63,E.USERNAME.MAX_LENGTH).optional(),secretRotation:c8.optional()}).strict().describe("Database credentials configuration"),Sh=Bt(o8),Eh=Bt(s8),u8=c.object({scaleWithWriter:c.boolean().optional(),enableDatabaseInsights:c.boolean().optional(),identifierSuffix:c.string().min(1,E.IDENTIFIER_SUFFIX.REQUIRED).max(50,E.IDENTIFIER_SUFFIX.MAX_LENGTH).optional(),availabilityZone:c.string().optional()}).strict().describe("Configuration for a single Aurora reader instance"),gl=c.object({enableDatabaseInsights:c.boolean().optional(),identifierSuffix:c.string().min(1,E.IDENTIFIER_SUFFIX.REQUIRED).max(50,E.IDENTIFIER_SUFFIX.MAX_LENGTH).optional(),availabilityZone:c.string().optional()}).strict().describe("Configuration for Aurora writer instance"),l8=c.object({count:c.number().int(E.READER.COUNT.INTEGER).min(0,E.READER.COUNT.MIN).max(15,E.READER.COUNT.MAX).optional(),instances:c.array(u8).max(15,E.READER_INSTANCES.MAX).optional(),defaultEnableDatabaseInsights:c.boolean().optional()}).strict().refine(e=>!(e.count!==void 0&&e.instances!==void 0),{message:E.READER_INSTANCES.COUNT_OR_INSTANCES,path:["count"]}).describe("Aurora readers configuration"),yl=Bt(l8),d8=c.object({awsManaged:c.literal(!0)}).strict(),p8=c.object({useCMK:c.literal(!0)}).strict(),Aj=c.union([d8,p8]),m8=c.object({mode:c.enum(["standard","advanced"]).optional(),encryptionKey:Aj.optional()}).strict().describe("Database Insights configuration"),xh=Bt(m8),Ah=c.object({storageKey:Aj.optional()}).strict().describe("Encryption configuration (DESTRUCTIVE to change storageKey)"),vl=c.object({name:be,type:a8,databaseName:c.string().min(1,E.REQUIRED.DATABASE_NAME),instanceType:c.string().optional(),allocatedStorage:c.number().optional(),multiAz:c.boolean().optional(),publiclyAccessible:c.boolean().optional(),databaseInsights:xh.optional(),port:vh.optional(),deletionProtection:c.boolean().optional(),proxy:Sh.optional(),credentials:bh.optional(),readReplica:Eh.optional(),encryption:Ah.optional(),writer:gl.optional(),readers:yl.optional(),backupRetention:Va.optional(),preferredMaintenanceWindow:c.string().optional(),monitoringInterval:hl.optional(),primaryRegion:c.string().optional(),secondaryRegions:c.array(c.string()).optional(),globalClusterIdentifier:c.string().optional(),enableGlobalWriteForwarding:c.boolean().optional(),snapshotIdentifier:c.string().optional(),snapshotUsername:c.string().optional(),databaseEngine:c.enum(Us).optional(),engineExpression:c.string().optional(),variableName:c.string().optional(),extraProperties:c.array(St).optional(),alarms:yj.optional()}).strict(),_h=c.object({appName:lt,nameProvidedByFlag:c.boolean().optional(),databaseName:c.string().min(1,E.REQUIRED.DATABASE_NAME).max(63,E.MAX_LENGTH.DATABASE_NAME).regex(he.DATABASE_NAME,E.DATABASE_NAME),resourceName:be.optional(),connectionConfig:c.object({connectToCompute:c.array(c.string()).optional(),connectToServices:c.array(c.string()).optional()}).strict().optional(),databaseInsights:xh.optional(),port:vh.optional(),proxy:Sh.optional(),credentials:bh.optional(),encryption:Ah.optional(),deletionProtection:c.boolean().optional()}).strict(),_j={databaseType:c.literal("Instance"),instanceType:c.string().optional(),multiAz:c.boolean().optional(),readReplica:Eh.optional(),publiclyAccessible:c.boolean().optional(),backupRetention:Va.optional(),allocatedStorage:c.number().optional(),snapshotIdentifier:c.string().optional(),snapshotUsername:c.string().optional()},Tj={databaseType:c.literal("Aurora"),writer:gl.optional(),readers:yl.optional(),backupRetention:Va.optional(),preferredMaintenanceWindow:c.string().optional(),monitoringInterval:hl.optional(),snapshotIdentifier:c.string().optional(),snapshotUsername:c.string().optional()},Cj={databaseType:c.literal("GlobalAurora"),primaryRegion:c.string().min(1,E.GLOBAL_AURORA.PRIMARY_REGION_REQUIRED),secondaryRegions:c.array(c.string()).optional(),globalClusterIdentifier:c.string().optional(),enableGlobalWriteForwarding:c.boolean().optional(),writer:gl.optional(),readers:yl.optional(),backupRetention:Va.optional(),preferredMaintenanceWindow:c.string().optional(),monitoringInterval:hl.optional(),snapshotIdentifier:c.string().optional(),snapshotUsername:c.string().optional()},Ij=c.object({appName:lt,nameProvidedByFlag:c.boolean().optional(),databaseName:c.string().min(1,E.REQUIRED.DATABASE_NAME).max(63,E.MAX_LENGTH.DATABASE_NAME).regex(he.DATABASE_NAME,E.DATABASE_NAME),resourceName:be.optional(),connectionConfig:c.object({connectToCompute:c.array(c.string()).optional(),connectToServices:c.array(c.string()).optional()}).strict().optional()}).strict(),Dj={databaseType:c.literal("ClickHouse"),instanceType:i8.optional(),storageGb:bj.optional(),iops:Sj.optional(),throughputMbps:Ej.optional(),coldTier:c.union([c.object({mode:c.literal("s3")}).strict(),c.literal(!1)]).optional(),optimiseSchedule:c.union([c.string(),c.literal(!1)]).optional(),backupSchedule:c.union([c.string(),c.literal(!1)]).optional(),backupVerify:c.literal(!1).optional(),backupRetentionDays:xj.optional()},f8=_h.extend(_j).strict(),h8=_h.extend(Tj).strict(),g8=_h.extend(Cj).strict(),y8=Ij.extend(Dj).strict(),wj=c.discriminatedUnion("databaseType",[f8,h8,g8,y8]),E0=_h.extend({resourceName:be}).strict(),v8=E0.extend(_j).strict(),b8=E0.extend(Tj).strict(),S8=E0.extend(Cj).strict(),E8=Ij.extend({resourceName:be}).strict(),x8=E8.extend(Dj).strict(),Wve=c.discriminatedUnion("databaseType",[v8,b8,S8,x8]),Kve=c.object({appName:lt,databaseName:c.string().min(1,E.REQUIRED.DATABASE_NAME),maxConnections:c.number().int(E.MAX_CONNECTIONS.INTEGER).min(1,E.MAX_CONNECTIONS.MIN).max(100,E.MAX_CONNECTIONS.MAX).optional(),maxIdleConnections:c.number().int(E.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.INTEGER).min(0,E.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MIN).max(100,E.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MAX).optional(),connectionBorrowTimeout:c.number().int(E.PROXY_CONFIG.BORROW_TIMEOUT.INTEGER).min(1,E.PROXY_CONFIG.BORROW_TIMEOUT.MIN).max(3600,E.PROXY_CONFIG.BORROW_TIMEOUT.MAX).optional(),requireTLS:c.boolean().optional(),nameProvidedByFlag:c.boolean().optional()}).strict(),A8=["S","N","B"],yh=c.object({name:c.string(),type:c.enum(A8)}).strict(),kj=c.object({name:be,partitionKey:yh,sortKey:yh.optional(),globalSecondaryIndexes:c.array(c.object({indexName:c.string(),partitionKey:yh,sortKey:yh.optional()}).strict()).optional(),ttlAttribute:c.string().optional(),stream:c.boolean().optional(),variableName:c.string().optional(),extraProperties:c.array(St).optional()}).strict(),_8=c.object({mode:c.literal("s3")}).strict(),Nj=c.object({name:be,type:c.literal("ClickHouse"),databaseName:dj,instanceType:c.string().optional(),storageGb:bj.optional(),iops:Sj.optional(),throughputMbps:Ej.optional(),coldTier:c.union([_8,c.literal(!1)]).optional(),optimiseSchedule:c.union([c.string(),c.literal(!1)]).optional(),backupSchedule:c.union([c.string(),c.literal(!1)]).optional(),backupVerify:c.literal(!1).optional(),backupRetentionDays:xj.optional(),variableName:c.string().optional(),extraProperties:c.array(St).optional()}).strict();var T8=c.object({count:c.number().int(E.NAT_GATEWAY.INTEGER).min(0,E.NAT_GATEWAY.MIN).max(3,E.NAT_GATEWAY.MAX).optional()}).strict().describe("NAT gateway configuration"),Pj=Bt(T8),x0=c.enum(["cloudwatch","s3"]),C8=c.object({destination:x0.optional(),retentionDays:c.number().int(E.RETENTION_DAYS.INTEGER).min(1,E.RETENTION_DAYS.MIN).max(365,E.RETENTION_DAYS.MAX).optional(),trafficType:c.enum(["ALL","ACCEPT","REJECT"]).optional()}).strict().describe("VPC flow log configuration"),Rj=Bt(C8),I8=c.object({s3:c.boolean().optional(),dynamodb:c.boolean().optional()}).strict().describe("Gateway VPC endpoints (FREE)"),D8=Bt(I8),w8=c.object({ecr:c.boolean().optional(),secretsManager:c.boolean().optional(),kms:c.boolean().optional(),cloudwatchLogs:c.boolean().optional(),ssm:c.boolean().optional(),sts:c.boolean().optional()}).strict().describe("Interface VPC endpoints (cost per hour)"),k8=Bt(w8),N8=c.object({gateway:D8.optional(),interface:k8.optional()}).strict().describe("VPC endpoints configuration"),Oj=Bt(N8),Wa=c.object({maxAzs:c.number().int(E.MAX_AZS.INTEGER).min(1,E.MAX_AZS.MIN).max(3,E.MAX_AZS.MAX).optional(),natGateways:Pj.optional(),flowLogs:Rj.optional(),vpcEndpoints:Oj.optional(),cidrMask:c.number().int(E.CIDR_MASK.INTEGER).min(16,E.CIDR_MASK.MIN).max(28,E.CIDR_MASK.MAX).optional()}).strict(),$j=c.string().min(1,E.REQUIRED.NETWORK_NAME).max(50,E.MAX_LENGTH.NETWORK_NAME).regex(he.RESOURCE_NAME,E.RESOURCE_NAME),jj=Wa.extend({name:$j}).strict(),Mj=Bt(Wa),Xve=c.object({appName:lt,networkName:$j.optional(),maxAzs:c.number().int(E.MAX_AZS.INTEGER).min(1,E.MAX_AZS.MIN).max(3,E.MAX_AZS.MAX).optional(),natGateways:Pj.optional(),flowLogs:Rj.optional(),vpcEndpoints:Oj.optional()}).strict(),P8=he.CIDR,A0=c.string().regex(P8,E.CIDR),R8=c.object({kind:c.literal("database"),resource:c.string().min(1,E.REQUIRED.RESOURCE_REFERENCE),name:be,allowedFromCidrs:c.array(A0),access:c.enum(["read","write","readWrite"]).optional()}).strict(),O8=c.object({kind:c.literal("ecsService"),resource:c.string().min(1,E.REQUIRED.RESOURCE_REFERENCE),serviceName:c.string().min(1,E.REQUIRED.SERVICE_NAME),name:be,allowedFromCidrs:c.array(A0),port:Ga.optional()}).strict(),$8=c.discriminatedUnion("kind",[R8,O8]),Fj=c.object({name:be,peerAppName:c.string().min(1,E.REQUIRED.APP_NAME),peerAccountId:c.string().regex(he.AWS_ACCOUNT_ID,E.AWS_ACCOUNT_ID),peerRegion:c.string().min(1,E.VPC_PEER.REGION_REQUIRED).optional(),peerVpcId:c.string().regex(he.VPC_ID,E.VPC_ID).optional(),peerVpcCidr:A0.optional(),peerRoleArn:c.string().regex(he.ROLE_ARN,E.ROLE_ARN).optional(),peerRouteTableIds:c.array(c.string().min(1,E.VPC_PEER.ROUTE_TABLE_ID_REQUIRED)).optional(),localVpcName:c.string().min(1,E.REQUIRED.NETWORK_NAME).optional(),enableDnsResolution:c.boolean().optional()}).strict(),_0=c.object({name:be,requesterAccountIds:c.array(c.string().regex(he.AWS_ACCOUNT_ID,E.AWS_ACCOUNT_ID)).min(1,E.VPC_PEER.MIN_REQUESTER_ACCOUNTS),localVpcName:c.string().min(1,E.REQUIRED.NETWORK_NAME).optional(),publishToSsm:c.boolean().optional(),exposedResources:c.array($8).optional()}).strict();var Th=["storage","cdn","compute"],j8=c.object({sid:c.string().optional(),effect:c.enum(["Allow","Deny"]),principals:c.array(c.string()),actions:c.array(c.string()),resources:c.array(c.string()).optional(),conditions:c.record(c.string(),c.record(c.string(),c.union([c.string(),c.array(c.string())]))).optional()}).strict(),bl=c.object({name:be,bucketName:c.string().optional(),publicReadAccess:c.boolean().optional(),websiteHosting:c.object({indexDocument:c.string(),errorDocument:c.string().optional()}).strict().optional(),backupVaultTier:c.enum(qr).optional(),versioned:c.boolean().optional(),encryption:c.enum(Bs).optional(),kmsKeyArn:c.string().optional(),cors:c.array(c.object({allowedOrigins:c.array(c.string()),allowedMethods:c.array(c.string()),allowedHeaders:c.array(c.string()).optional(),exposedHeaders:c.array(c.string()).optional(),maxAge:c.number().optional()}).strict()).optional(),deployment:c.object({source:c.string(),prune:c.boolean().optional(),cacheControl:c.object({maxAge:c.number().optional(),immutable:c.boolean().optional()}).strict().optional()}).strict().optional(),retain:c.boolean().optional(),resourcePolicyStatements:c.array(j8).optional(),stackPlacement:c.enum(Th).optional(),variableName:c.string().optional(),extraProperties:c.array(St).optional()}).strict().refine(e=>e.encryption!=="KMS"||!!e.kmsKeyArn,{message:E.KMS.KEY_REQUIRED}),nbe=c.object({appName:lt,bucketName:lj,nameProvidedByFlag:c.boolean().optional(),storagePreset:c.enum(cj).optional(),publicReadAccess:c.boolean().optional(),websiteHosting:c.object({indexDocument:c.string(),errorDocument:c.string().optional()}).strict().optional(),backupVaultTier:c.enum(qr).optional(),versioned:c.boolean().optional(),encryption:c.enum(Bs).optional(),kmsKeyArn:c.string().optional(),cors:c.array(c.object({allowedOrigins:c.array(c.string()),allowedMethods:c.array(c.string()),allowedHeaders:c.array(c.string()).optional(),exposedHeaders:c.array(c.string()).optional(),maxAge:c.number().optional()}).strict()).optional(),connectionConfig:c.object({connectToCompute:c.array(c.string()).optional(),connectToServices:c.array(c.string()).optional()}).strict().optional()}).strict().refine(e=>e.encryption!=="KMS"||!!e.kmsKeyArn,{message:E.KMS.KEY_REQUIRED,path:["kmsKeyArn"]});var T0=c.enum(["DESTROY","RETAIN"]),Sl=c.object({name:be,queueType:c.enum(["standard","fifo"]).default("standard"),visibilityTimeout:c.number().int(E.SQS.VISIBILITY_TIMEOUT.INTEGER).min(0,E.SQS.VISIBILITY_TIMEOUT.MIN).max(43200,E.SQS.VISIBILITY_TIMEOUT.MAX).optional(),retentionPeriod:c.number().int(E.SQS.RETENTION_PERIOD.INTEGER).min(60,E.SQS.RETENTION_PERIOD.MIN).max(1209600,E.SQS.RETENTION_PERIOD.MAX).optional(),contentBasedDeduplication:c.boolean().optional(),removalPolicy:T0.optional(),variableName:c.string().optional(),extraProperties:c.array(St).optional()}).strict();var Lj=c.object({type:c.literal("basic-auth"),username:c.string().min(1),password:c.string().min(1)}).strict(),El=c.object({name:be,defaultOriginRef:c.string(),behaviours:c.array(c.object({pathPattern:c.string(),originRef:c.string(),cachePolicy:c.enum(["CACHING_OPTIMIZED","CACHING_DISABLED"]).optional()}).strict()).optional(),customDomain:c.string().optional(),certificateArn:c.string().optional(),domain:c.string().optional(),originHostname:c.string().optional(),accessGate:c.union([c.literal(!1),Lj]).optional(),extraProperties:c.array(St).optional()}).strict(),dbe=c.object({appName:c.string(),name:be.optional(),defaultOriginRef:c.string(),behaviours:c.array(c.object({pathPattern:c.string(),originRef:c.string(),cachePolicy:c.enum(["CACHING_OPTIMIZED","CACHING_DISABLED"]).optional()}).strict()).optional(),customDomain:c.string().optional(),certificateArn:c.string().optional(),domain:c.string().optional(),originHostname:c.string().optional(),accessGate:c.union([c.literal(!1),Lj]).optional(),nameProvidedByFlag:c.boolean().optional()}).strict();var M8=Object.defineProperty,C0=(e,t)=>M8(e,"name",{value:t,configurable:!0}),F8=new Set(["t4g","c6g","c6gd","c6gn","c7g","c7gd","c7gn","r6g","r6gd","r7g","r7gd","r8g","r8gd","c8g","c8gd","c8gn","m6g","m6gd","m7g","m7gd","m8g","m8gd","x8g","i8g","a1","x2gd","im4gn","is4gen","i4g","hpc7g"]);function Vi(e){let t=e.split(".")[0]??"";return F8.has(t)?"ARM":"STANDARD"}C0(Vi,"getArchitectureForInstanceType");function Ch(e,t){let r=Vi(e);return r!==t?{valid:!1,message:`Instance type '${e}' requires ${r} architecture, but '${t}' AMI was specified. Use a ${r==="ARM"?"Graviton instance (t4g, c6g, r6g, m6g, etc.)":"Intel/AMD instance (t3, c5, r5, m5, etc.)"} instead.`}:{valid:!0}}C0(Ch,"validateArchitectureMatch");function Uj(e,t){return Vi(e)===t}C0(Uj,"isArchitectureCompatible");var L8=Object.defineProperty,Ih=(e,t)=>L8(e,"name",{value:t,configurable:!0});var U8=1;var z8=/^[A-Za-z0-9_.-]+$/,B8=c.object({id:c.string().min(1,"buildSecret id cannot be empty").regex(z8,"buildSecret id may contain only letters, digits, '_', '.', and '-' (no comma, '=', or whitespace, which would break the buildx --secret argv)"),ssm:c.string().min(1,"ssm parameter name cannot be empty").optional(),secretsManager:c.object({name:c.string().min(1,"secret name cannot be empty").optional(),arn:c.string().min(1,"secret arn cannot be empty").optional(),field:c.string().min(1,"secret field cannot be empty").optional()}).strict().refine(e=>e.name===void 0!=(e.arn===void 0),"secretsManager requires exactly one of name or arn").optional(),env:c.string().min(1,"env variable name cannot be empty").optional()}).strict().superRefine((e,t)=>{[e.ssm,e.secretsManager,e.env].filter(r=>r!==void 0).length!==1&&t.addIssue({code:c.ZodIssueCode.custom,message:"buildSecret requires exactly one source (ssm, secretsManager, or env)"})}),G8=c.union([c.string(),c.object({ssm:c.string().min(1,"ssm parameter name cannot be empty").optional(),secretsManager:c.object({name:c.string().min(1,"secret name cannot be empty").optional(),arn:c.string().min(1,"secret arn cannot be empty").optional(),field:c.string().min(1,"secret field cannot be empty").optional()}).strict().refine(e=>e.name===void 0!=(e.arn===void 0),"secretsManager requires exactly one of name or arn").optional(),env:c.string().min(1,"env variable name cannot be empty").optional(),acknowledgePublic:c.boolean().optional()}).strict().superRefine((e,t)=>{[e.ssm,e.secretsManager,e.env].filter(r=>r!==void 0).length!==1&&t.addIssue({code:c.ZodIssueCode.custom,message:"buildArg value requires exactly one source (ssm, secretsManager, or env)"})})]),pn=c.object({path:c.string(),context:c.string().min(1,"context cannot be empty").optional(),target:c.string().min(1,"target cannot be empty").optional(),buildArgs:c.record(c.string(),G8).optional(),buildSecrets:c.array(B8).optional()}).strict(),gbe=pn.partial();function V8(e,t){if(t===void 0)return e;let r=t.context??e.context,i=t.target??e.target,n=t.buildArgs??e.buildArgs,a=t.buildSecrets??e.buildSecrets;return{path:t.path??e.path,...r!==void 0&&{context:r},...i!==void 0&&{target:i},...n!==void 0&&{buildArgs:n},...a!==void 0&&{buildSecrets:a}}}Ih(V8,"mergeDockerBuild");function I0(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}Ih(I0,"isRecord");function zj(e){if(!I0(e)||typeof e.path!="string"||e.path.length===0)return;let t=typeof e.context=="string"&&e.context.length>0?e.context:void 0,r=typeof e.target=="string"&&e.target.length>0?e.target:void 0,i=I0(e.buildArgs)&&Object.keys(e.buildArgs).length>0?e.buildArgs:void 0,n=Array.isArray(e.buildSecrets)&&e.buildSecrets.length>0?e.buildSecrets:void 0,a={path:e.path,...t!==void 0&&{context:t},...r!==void 0&&{target:r},...i!==void 0&&{buildArgs:i},...n!==void 0&&{buildSecrets:n}},o=pn.safeParse(a);return o.success?o.data:void 0}Ih(zj,"normaliseDockerBuild");function W8(e){if(e===void 0)return;let t=zj(e);return t===void 0?void 0:JSON.stringify(t)}Ih(W8,"dockerBuildFingerprint");var K8=c.object({name:c.string(),clusterName:c.string().optional(),docker:pn.optional(),containerPort:c.number().optional(),secrets:c.array(c.string()).optional(),ssmSecretsPath:c.string().optional(),importedSecretNames:c.array(c.string()).optional(),schemaGateImageTag:c.string().optional()}).strict(),q8=c.object({type:c.enum(vr),name:c.string(),source:c.string()}).strict(),Z8=c.object({repositoryName:c.string()}).strict(),H8=["x86_64","arm64"],J8=c.object({name:c.string(),secrets:c.array(c.string()).optional(),ssmSecretsPath:c.string().optional(),importedSecretNames:c.array(c.string()).optional(),docker:pn.optional(),imageKey:c.string().optional(),architecture:c.enum(H8).optional()}).strict(),X8=c.object({templateHash:c.string(),synthTimestamp:c.string()}).strict(),Y8=c.object({constructPath:c.string().max(512),group:c.string().max(128),resourceType:c.string().max(256)}).strict(),Q8=c.object({synthesisedBy:c.string().min(1).max(128),minimumEngineVersion:c.string().min(1).max(32),maximumEngineMajor:c.number().int().min(0).optional(),minimumAwsCdkCli:c.string().min(1).max(32).optional()}).strict(),e5=c.object({appName:c.string().min(1).max(128),slot:c.string().min(1).max(64),clusterName:c.string().min(1).max(128),anchor:c.string().min(1).max(128),pinned:c.boolean(),currentServiceName:c.string().min(1).max(256),legacyKey:c.string().min(1).max(256),legacyAnchor:c.string().min(1).max(256),legacyServiceName:c.string().min(1).max(512),legacyKeyFields:c.array(c.string().max(64)).max(32)}).strict(),t5=c.object({constructPath:c.string().min(1).max(512),resourceType:c.string().min(1).max(256),physicalNameHint:c.string().min(1).max(512),policy:c.enum(["retain","snapshot","adopted"]),destroyDisposition:c.enum(["survives","deleted-on-explicit-destroy"]),reason:c.string().min(1).max(1024),costClass:c.enum(["none","storage","fixed-monthly"]),cleanupHint:c.string().min(1).max(1024)}).strict(),ybe=c.object({version:c.literal(U8),generatedAt:c.string(),appName:c.string(),services:c.array(K8),lambdas:c.array(J8),pattern:q8.optional(),ecr:Z8.optional(),stacks:c.record(c.string(),X8),resourceMap:c.record(c.string(),Y8).optional(),engineCompat:Q8.optional(),identityAliases:c.array(e5).optional(),residuals:c.array(t5).optional()}).strict();var r5=Object.defineProperty,n5=(e,t)=>r5(e,"name",{value:t,configurable:!0});function Gj(e){return!(e.image!==void 0&&e.docker!==void 0)}n5(Gj,"imageDockerMutexCheck");var Vj=c.number().int(E.CAPACITY.MIN.INTEGER).min(g0,E.GENERATOR_CAPACITY.MIN.MIN).max(y0,E.GENERATOR_CAPACITY.MIN.MAX),Wj=c.number().int(E.CAPACITY.MAX.INTEGER).min(g0,E.GENERATOR_CAPACITY.MAX.MIN).max(y0,E.GENERATOR_CAPACITY.MAX.MAX),Vs=c.number().int(E.LAMBDA.MEMORY.INTEGER).min(nj,E.LAMBDA.MEMORY.MIN).max(ij,E.LAMBDA.MEMORY.MAX).refine(e=>e===128||e%64===0,E.LAMBDA.MEMORY.MULTIPLE),Kj=c.string().regex(he.LAMBDA_RUNTIME_IDENTIFIER,E.LAMBDA.RUNTIME),D0=c.number().int(E.CPU.INTEGER).min(256,E.CPU.MIN).max(4096,E.CPU.MAX),wh=c.number().int(E.CAPACITY.DESIRED.INTEGER).min(0,E.CAPACITY.DESIRED.MIN).max(zs,E.CAPACITY.DESIRED.MAX),xl=c.object({connectToDatabase:c.array(c.string()).optional()}).strict(),i5=c.object({minSize:c.number().int(E.CAPACITY.WARM_POOL.MIN_SIZE.INTEGER).min(0,E.CAPACITY.WARM_POOL.MIN_SIZE.MIN).max(aj,E.CAPACITY.WARM_POOL.MIN_SIZE.MAX).optional(),reuseOnScaleIn:c.boolean().optional()}).strict(),w0=c.object({instanceType:c.string().optional(),amiHardwareType:c.enum(dh).optional(),minCapacity:c.number().int(E.CAPACITY.MIN.INTEGER).min(0,E.CAPACITY.MIN.MIN_0).max(zs,E.CAPACITY.MIN.MAX).optional(),maxCapacity:c.number().int(E.CAPACITY.MAX.INTEGER).min(1,E.CAPACITY.MAX.MIN_1).max(zs,E.CAPACITY.MAX.MAX).optional(),memoryLimitMiB:ml(128).optional(),warmPool:i5.optional(),extraProperties:c.array(St).optional()}).strict().superRefine((e,t)=>{if(!e.instanceType||!e.amiHardwareType)return;let r=Ch(e.instanceType,e.amiHardwareType);r.valid||t.addIssue({code:"custom",message:r.message??E.ARCHITECTURE_MISMATCH,path:["instanceType"]})}).superRefine((e,t)=>{e.minCapacity===0&&!e.warmPool&&t.addIssue({code:"custom",message:E.CAPACITY.WARM_POOL_REQUIRED,path:["minCapacity"]}),e.warmPool?.minSize!==void 0&&e.maxCapacity!==void 0&&e.warmPool.minSize>e.maxCapacity&&t.addIssue({code:"custom",message:E.CAPACITY.WARM_POOL.MIN_SIZE_EXCEEDS_MAX_CAPACITY,path:["warmPool","minSize"]})}),a5=c.enum(cl).describe(`Compute type must be one of: ${cl.join(", ")}`),k0=c.enum(Ls).describe(`ECS capacity provider must be one of: ${Ls.join(", ")}`),N0=c.string().refine(e=>zt(ph,e),{message:E.INSTANCE_TYPE}),qj=c.object({sourceType:c.enum(["sqs","dynamodb","eventbridge"]),sourceRef:c.string().describe("Name of the source resource"),batchSize:c.number().int(E.BATCH_SIZE.INTEGER).min(1,E.BATCH_SIZE.MIN).max(1e4,E.BATCH_SIZE.MAX).optional(),startingPosition:c.enum(["TRIM_HORIZON","LATEST"]).optional(),maxBatchingWindow:c.number().int(E.BATCHING_WINDOW.INTEGER).min(0,E.BATCHING_WINDOW.MIN).max(300,E.BATCHING_WINDOW.MAX).optional(),reportBatchItemFailures:c.boolean().optional()}).strict(),o5=c.object({name:c.string().min(1,E.REQUIRED.CONTAINER_NAME).optional(),image:c.string().optional(),port:Ga.optional(),environment:Gs.optional(),secretsImport:pj.optional(),command:c.array(c.string()).optional(),entryPoint:c.array(c.string()).optional(),essential:c.boolean().optional(),healthCheck:c.object({command:c.array(c.string()),interval:c.number().int(E.HEALTH_CHECK.INTERVAL.INTEGER).min(5,E.HEALTH_CHECK.INTERVAL.MIN).max(300,E.HEALTH_CHECK.INTERVAL.MAX).optional(),timeout:c.number().int(E.HEALTH_CHECK.TIMEOUT.INTEGER).min(2,E.HEALTH_CHECK.TIMEOUT.MIN).max(60,E.HEALTH_CHECK.TIMEOUT.MAX).optional(),retries:c.number().int(E.HEALTH_CHECK.RETRIES.INTEGER).min(1,E.HEALTH_CHECK.RETRIES.MIN).max(10,E.HEALTH_CHECK.RETRIES.MAX).optional(),startPeriod:c.number().int(E.HEALTH_CHECK.START_PERIOD.INTEGER).min(0,E.HEALTH_CHECK.START_PERIOD.MIN).max(300,E.HEALTH_CHECK.START_PERIOD.MAX).optional()}).strict().optional(),ssmSecrets:c.array(c.string().regex(he.SECRET_NAME,E.SECRET_NAME)).optional(),extraProperties:c.array(St).optional()}).strict(),Zj=c.string().min(1,E.REQUIRED.SERVICE_NAME).max(255,E.MAX_LENGTH.SERVICE_NAME).regex(he.ECS_SERVICE_NAME,E.ECS_SERVICE_NAME),Hj=c.object({domain:c.string().optional(),loadBalancer:c.union([c.literal(!1),c.enum(uh)]).optional(),directAccess:c.boolean().optional(),extraProperties:c.array(St).optional()}).strict().refine(e=>!(e.directAccess&&e.domain),{message:E.DIRECT_ACCESS.NO_DOMAIN,path:["directAccess"]}).refine(e=>!(e.directAccess&&typeof e.loadBalancer=="string"),{message:E.DIRECT_ACCESS.NO_LOAD_BALANCER}).describe("Cluster-level configuration"),Dh=c.object({path:c.string().optional(),host:c.string().optional(),priority:c.number().int(E.PRIORITY.INTEGER).min(1,E.PRIORITY.MIN).max(5e4,E.PRIORITY.MAX).optional(),healthCheckPath:c.string().optional()}).strict().describe("Path/host-based routing configuration"),s5=c.object({desiredCount:wh.optional(),minCapacity:c.number().int(E.CAPACITY.MIN.INTEGER).min(0,E.CAPACITY.MIN.MIN_0).max(zs,E.CAPACITY.MIN.MAX).optional(),maxCapacity:c.number().int(E.CAPACITY.MAX.INTEGER).min(1,E.CAPACITY.MAX.MIN_1).max(zs,E.CAPACITY.MAX.MAX).optional(),scalingType:c.enum(lh).optional()}).strict().refine(Ba.check,Ba.params).describe("ECS service scaling configuration"),Jj=c.object({name:Zj,docker:pn.optional(),needsDatabaseConnection:c.boolean().optional(),needsStorageConnection:c.boolean().optional(),needsMessagingConnection:c.boolean().optional(),image:c.string().optional(),containers:c.array(o5).optional(),routing:c.union([Dh,c.array(Dh).min(1)]).optional(),serviceType:c.enum(dl).optional(),cpu:D0.optional(),memoryLimitMiB:ml(512).optional(),desiredCount:wh.optional(),scaling:Bt(s5).optional(),capacityProvider:k0,ec2Config:w0.optional(),ssmSecretsPath:c.string().regex(he.SSM_PATH,E.SSM_PATH).optional(),extraProperties:c.array(St).optional(),alarms:gj.optional()}).strict().superRefine((e,t)=>{Gj(e)||t.addIssue({code:"custom",path:["docker"],message:E.IMAGE_DOCKER_MUTEX})}).describe("Configuration for a service in an ECS cluster"),Al=c.object({name:be,type:a5,needsConnection:c.boolean(),connectedDatabase:c.array(c.string().min(1,E.REQUIRED.CONNECTED_RESOURCE_NAME)).optional(),connectedStorage:c.array(c.string().min(1,E.REQUIRED.CONNECTED_RESOURCE_NAME)).optional(),connectedMessaging:c.array(c.string().min(1,E.REQUIRED.CONNECTED_RESOURCE_NAME)).optional(),cluster:Hj.optional(),containerInsights:c.boolean().optional(),services:c.array(Jj).optional(),docker:pn.partial().optional(),deployment:c.enum(oh).optional(),codePath:c.string().optional(),timeout:c.number().int(E.LAMBDA.TIMEOUT.INTEGER).min(mh,E.LAMBDA.TIMEOUT.MIN).max(fh,E.LAMBDA.TIMEOUT.MAX).optional(),memory:Vs.optional(),handler:c.string().optional(),runtime:Kj.optional(),environment:Gs.optional(),secrets:Gs.optional(),eventSources:c.array(qj).optional(),functionUrl:c.object({authType:c.enum(ll)}).strict().optional(),description:c.string().optional(),scheduleExpression:c.string().optional(),scheduleStackPlacement:c.enum(za).optional(),architecture:c.enum(ch).optional(),ephemeralStorageSize:c.number().int(E.EPHEMERAL_STORAGE.INTEGER).min(512,E.EPHEMERAL_STORAGE.MIN).max(10240,E.EPHEMERAL_STORAGE.MAX).optional(),functionName:c.string().optional(),ssmSecrets:c.array(c.string()).optional(),ssmSecretsPath:c.string().optional(),alarms:vj.optional(),instanceType:N0.optional(),enableSSH:c.boolean().optional(),keyName:c.string().optional(),userData:c.string().optional(),securityGroups:c.array(c.string()).optional(),variableName:c.string().optional(),extraProperties:c.array(St).optional()}).strict().superRefine((e,t)=>{if(e.type==="ecs"&&e.services)for(let r=0;r<e.services.length;r++){let i=e.services[r];i?.ec2Config?.instanceType&&!i.ec2Config.amiHardwareType&&Vi(i.ec2Config.instanceType)!=="ARM"&&t.addIssue({code:"custom",message:`Service '${i.name??r}' uses instance type '${i.ec2Config.instanceType}' (x86), which requires Docker images built for linux/amd64. The default build targets linux/arm64 (Graviton). Use a Graviton instance type (t4g, c6g, r6g, m6g, etc.) or set amiHardwareType: "STANDARD" to acknowledge x86.`,path:["services",r,"ec2Config","instanceType"]})}e.type==="lambda"&&e.deployment==="container"&&e.architecture==="X86_64"&&t.addIssue({code:"custom",message:"Lambda architecture 'X86_64' requires Docker images built for linux/amd64, but the default build targets linux/arm64. Use 'ARM_64' for Graviton Lambdas (recommended) or ensure your build pipeline targets linux/amd64.",path:["architecture"]})}),Cbe=c.object({appName:lt,clusterName:be,containerPort:Ga,nameProvidedByFlag:c.boolean().optional(),ecrRepository:c.string().optional(),capacityProvider:k0.optional(),useAppEcr:c.boolean().optional(),desiredCount:wh.optional(),cpu:D0.optional(),memoryLimitMiB:ml(512).optional(),minCapacity:Vj.optional(),maxCapacity:Wj.optional(),ec2Config:w0.optional(),connectionConfig:xl.optional()}).strict().refine(Ba.check,Ba.params),Ibe=c.object({appName:lt,functionName:be,nameProvidedByFlag:c.boolean().optional(),lambdaType:c.enum(["basic","web","custom"]).optional(),ecrRepository:c.string().optional(),timeout:c.number().int(E.LAMBDA.TIMEOUT.INTEGER).min(mh,E.LAMBDA.TIMEOUT.MIN).max(fh,E.LAMBDA.TIMEOUT.MAX).optional(),memory:Vs.optional(),enableFunctionUrl:c.boolean().optional(),description:c.string().optional(),enableCors:c.boolean().optional(),corsOrigins:c.string().optional(),corsHeaders:c.string().optional(),corsMethods:c.array(c.enum(sj)).optional(),corsCredentials:c.boolean().optional(),connectionConfig:xl.optional()}).strict(),Dbe=c.object({appName:lt,instanceName:be,nameProvidedByFlag:c.boolean().optional(),instanceType:N0.optional(),enableSSH:c.boolean().optional(),minCapacity:Vj.optional(),maxCapacity:Wj.optional(),connectionConfig:xl.optional()}).strict().refine(Ba.check,Ba.params),wbe=c.object({appName:lt,clusterName:be,serviceName:Zj,capacityProvider:k0,containerPort:Ga.optional(),cpu:D0.optional(),memoryLimitMiB:ml(512).optional(),desiredCount:wh.optional(),ec2Config:w0.optional(),routing:c.union([Dh,c.array(Dh).min(1)]).optional(),docker:pn.partial().optional(),nameProvidedByFlag:c.boolean().optional(),connectionConfig:xl.optional()}).strict(),P0=c.object({appName:lt,computeName:be,nameProvidedByFlag:c.boolean().optional(),connectionConfig:xl.optional()}).strict(),c5=P0.extend({type:c.literal("ecs"),cluster:Hj.optional(),services:c.array(Jj).min(1,E.SERVICE.MIN_REQUIRED),docker:pn.partial().optional()}).strict().refine(e=>{let t=e.services.filter(r=>r.containers?.some(i=>i.port));return t.length>1?t.every(r=>(Array.isArray(r.routing)?r.routing:r.routing?[r.routing]:[]).some(i=>i.path||i.host)):!0},{message:E.SERVICE.ROUTING_REQUIRED}).refine(e=>{let t=e.services.map(r=>r.name);return new Set(t).size===t.length},{message:E.SERVICE.UNIQUE_WITHIN_CLUSTER}),u5=P0.extend({type:c.literal("lambda"),timeout:c.number().int(E.LAMBDA.TIMEOUT.INTEGER).min(mh,E.LAMBDA.TIMEOUT.MIN).max(fh,E.LAMBDA.TIMEOUT.MAX).optional(),memory:Vs.optional(),handler:c.string().optional(),runtime:Kj.optional(),environment:Gs.optional(),secrets:Gs.optional(),description:c.string().optional(),functionUrl:c.union([c.object({authType:c.enum(ll).optional()}).strict(),c.literal(!1)]).optional(),eventSources:c.array(qj).optional()}).strict(),l5=P0.extend({type:c.literal("ec2"),instanceType:N0.optional(),enableSSH:c.boolean().optional(),keyName:c.string().optional(),userData:c.string().optional(),securityGroups:c.array(c.string()).optional()}).strict(),kbe=c.discriminatedUnion("type",[c5,u5,l5]),Bj=c.object({path:c.string().min(1,E.REQUIRED.ROUTING_PATH),priority:c.number().int(E.PRIORITY.INTEGER).min(1,E.PRIORITY.MIN).max(5e4,E.PRIORITY.MAX).optional()}).strict(),Xj=c.object({name:c.string().min(1,E.REQUIRED.SERVICE_NAME).max(255,E.MAX_LENGTH.SERVICE_NAME).regex(he.RESOURCE_NAME,E.RESOURCE_NAME),serviceType:c.enum(dl).optional(),docker:pn.partial().optional(),containerPort:Ga.optional(),needsDatabaseConnection:c.boolean().optional(),routing:c.union([Bj,c.array(Bj).min(1)]).optional()}).strict().superRefine((e,t)=>{e.serviceType==="worker"&&(e.containerPort!==void 0&&t.addIssue({code:"custom",path:["containerPort"],message:"Worker services are not reachable inbound; remove containerPort."}),e.routing!==void 0&&t.addIssue({code:"custom",path:["routing"],message:"Worker services have no ALB route; remove routing."}))}),Nbe=c.object({appName:lt,instanceType:c.string().optional()}).strict();var R0=c.object({memorySize:Vs.optional(),timeout:c.number().int(E.LAMBDA.TIMEOUT.INTEGER).min(1,E.LAMBDA.TIMEOUT.MIN).max(900,E.LAMBDA.TIMEOUT.MAX).optional(),ephemeralStorageSize:c.number().int(E.EPHEMERAL_STORAGE.INTEGER).min(512,E.EPHEMERAL_STORAGE.MIN).max(10240,E.EPHEMERAL_STORAGE.MAX).optional()}).strict(),Yj=c.object({type:c.enum(h0).optional(),databaseName:c.string().optional(),databaseEngine:c.enum(Us).optional(),deletionProtection:c.boolean().optional(),backupRetention:Va.optional(),port:vh.optional(),publiclyAccessible:c.boolean().optional(),allowedIpCidr:c.string().optional(),instanceType:c.string().optional(),allocatedStorage:c.number().int(E.ALLOCATED_STORAGE.INTEGER).min(20,E.ALLOCATED_STORAGE.MIN).max(65536,E.ALLOCATED_STORAGE.MAX).optional(),multiAz:c.boolean().optional(),readReplica:Eh.optional(),writer:gl.optional(),readers:yl.optional(),allowVpcAccess:c.boolean().optional(),monitoringInterval:hl.optional(),preferredMaintenanceWindow:c.string().optional(),databaseInsights:xh.optional(),proxy:Sh.optional(),credentials:bh.optional(),encryption:Ah.optional(),snapshotIdentifier:c.string().optional(),snapshotUsername:c.string().optional()}).strict(),Qj=c.object({server:R0.optional(),imageOptimisation:R0.optional(),revalidation:R0.optional()}).strict(),O0=c.object({versioned:c.boolean().optional()}).strict(),eM=c.object({assets:O0.optional(),cache:O0.optional(),media:O0.optional()}).strict(),d5=c.object({visibilityTimeout:c.number().int(E.SQS.VISIBILITY_TIMEOUT.INTEGER).min(0,E.SQS.VISIBILITY_TIMEOUT.MIN).max(43200,E.SQS.VISIBILITY_TIMEOUT.MAX).optional(),messageRetentionPeriod:c.number().int(E.SQS.RETENTION_PERIOD.INTEGER).min(60,E.SQS.RETENTION_PERIOD.MIN).max(1209600,E.SQS.RETENTION_PERIOD.MAX).optional(),maxMessageSize:c.number().int(E.MAX_MESSAGE_SIZE.INTEGER).min(1024,E.MAX_MESSAGE_SIZE.MIN).max(262144,E.MAX_MESSAGE_SIZE.MAX).optional(),deadLetterQueue:c.union([c.literal(!1),c.object({enabled:c.boolean().optional(),maxReceiveCount:c.number().int(E.DLQ.MAX_RECEIVE_COUNT.INTEGER).min(1,E.DLQ.MAX_RECEIVE_COUNT.MIN).max(1e3,E.DLQ.MAX_RECEIVE_COUNT.MAX).optional()}).strict()]).optional()}).strict(),tM=c.object({revalidationQueue:d5.optional()}).strict(),rM=c.object({domainNames:c.array(c.string()).optional(),certificateArn:c.string().optional()}).strict(),nM=c.record(c.string().regex(he.ENV_VAR_NAME,E.ENV_VAR_NAME),c.string()).optional(),$0=c.object({type:c.literal("payload"),name:c.string().min(1,E.REQUIRED.PATTERN_NAME),domain:c.string().optional(),database:Yj.optional(),compute:Qj.optional(),storage:eM.optional(),messaging:tM.optional(),cdn:rM.optional(),environment:nM}).strict(),j0=c.object({type:c.literal("nextjs"),name:c.string().min(1,E.REQUIRED.PATTERN_NAME),domain:c.string().optional(),database:Yj.optional(),compute:Qj.optional(),storage:eM.optional(),messaging:tM.optional(),cdn:rM.optional(),environment:nM}).strict(),M0=c.enum(Mu),p5=c.object({command:c.string().min(1,E.REQUIRED.BUILD_COMMAND),outputDir:c.string().min(1,E.REQUIRED.OUTPUT_DIR)}).strict(),m5=c.object({maxAgeDays:c.number().optional(),includeSubdomains:c.boolean().optional(),preload:c.boolean().optional()}).strict(),f5=c.object({headers:c.boolean().optional(),contentSecurityPolicy:c.string().optional(),hsts:c.union([c.literal(!1),m5]).optional()}).strict(),h5=c.object({to:c.string().min(1,E.REQUIRED.FORMS_TO).regex(he.EMAIL,E.EMAIL),from:c.string().regex(he.EMAIL,E.EMAIL).optional(),corsOrigin:c.string().regex(he.HTTP_ORIGIN,"corsOrigin must be an exact origin such as https://example.com (no path, no trailing slash)").optional(),maxConcurrency:c.number().int().min(1).max(100).optional()}).strict(),g5=c.object({behaviours:c.array(c.unknown()).optional(),priceClass:c.enum(Fu).optional(),invalidateOnDeploy:c.boolean().optional()}).strict(),y5=c.object({type:c.literal("basic-auth"),username:c.string().min(1,"accessGate.username must not be empty"),password:c.string().min(1,"accessGate.password must not be empty")}).strict(),_l=c.object({type:c.literal("staticsite"),name:c.string().min(1,E.REQUIRED.PATTERN_NAME),source:c.string().min(1,E.REQUIRED.SOURCE),build:p5,routing:M0.optional(),security:f5.optional(),domain:c.string().optional(),zoneName:c.string().optional(),hostedZoneId:c.string().optional(),forms:h5.optional(),cdn:g5.optional(),accessGate:y5.optional()}).strict().superRefine((e,t)=>{if(e.forms===void 0)return;let r=e.domain;if(r===void 0||r===""){t.addIssue({code:"custom",path:["domain"],message:"A domain is required when forms are enabled: SES sends only from a verified identity, and the site's domain is the identity the pattern verifies"});return}let i=e.forms.from;i!==void 0&&!Ef(i,r)&&t.addIssue({code:"custom",path:["forms","from"],message:`forms.from must be an address at ${r} (the verified SES identity) \u2014 for example noreply@${r}. Use forms.to for the recipient.`})}),Tl=c.discriminatedUnion("type",[$0,j0,_l]),iM=c.enum(["lightweight","standard","resilient","custom"]),aM=c.object({type:c.enum(h0),instanceType:c.string().optional(),backupRetention:Va.optional(),deletionProtection:c.boolean().optional(),encryption:c.union([c.object({useCMK:c.literal(!0)}).strict(),c.literal(!1)]).optional()}).strict(),oM=c.object({memorySize:Vs.optional(),timeout:c.number().int(E.LAMBDA.TIMEOUT.INTEGER).min(1,E.LAMBDA.TIMEOUT.MIN).max(900,E.LAMBDA.TIMEOUT.MAX).optional()}).strict();var sM=c.object({appName:lt,type:v0,pattern:b0.optional(),patternConfig:Tl.optional(),owner:c.string().optional(),tags:c.record(c.string(),c.string()).optional(),vpcId:c.string().optional(),network:Wa.optional(),backup:fj.optional(),tunnel:hj.optional(),additionalNetworks:c.array(jj).optional(),database:c.array(vl),s3:c.array(bl),compute:c.array(Al),dynamodb:c.array(kj).optional(),clickhouse:c.array(Nj).optional(),sqs:c.array(Sl).optional(),cdn:El.optional(),customCodeBlocks:c.array(mj).optional(),additionalManagedImports:c.array(c.object({moduleSpecifier:c.string(),namedImports:c.array(c.string()),defaultImport:c.string().optional()}).strict()).optional()}).strict(),Xbe=c.object({name:lt,type:v0,pattern:b0.optional(),patternTier:iM.optional(),patternDomain:c.string().optional(),source:c.string().min(1,E.REQUIRED.SOURCE).optional(),buildCommand:c.string().min(1,E.REQUIRED.BUILD_COMMAND).optional(),outputDir:c.string().min(1,E.REQUIRED.OUTPUT_DIR).optional(),routing:M0.optional(),formsTo:c.string().min(1,E.REQUIRED.FORMS_TO).regex(he.EMAIL,E.EMAIL).optional(),corsOrigin:c.string().regex(he.HTTP_ORIGIN,"corsOrigin must be an exact origin such as https://example.com (no path, no trailing slash)").optional(),customDatabase:aM.optional(),customCompute:oM.optional(),region:c.string().optional(),owner:c.string().optional(),includeDatabase:c.boolean().optional(),databaseName:c.string().min(1,E.DATABASE.NAME.REQUIRED).max(63,E.DATABASE.NAME.MAX_LENGTH).optional(),vpcId:c.string().optional(),network:Mj.optional(),services:c.array(Xj).optional(),snapshotIdentifier:c.string().optional(),snapshotUsername:c.string().optional()}).strict().superRefine((e,t)=>{e.formsTo!==void 0&&(e.patternDomain!==void 0&&e.patternDomain!==""||t.addIssue({code:"custom",path:["patternDomain"],message:"A domain is required when forms are enabled: SES sends only from a verified identity, and the site's domain is the identity the pattern verifies"}))}),F0=c.object({name:be,localResource:c.string().min(1),remoteApp:c.string().min(1),remoteResource:c.string().min(1),permission:c.enum(["read","write","read-write"]),remoteArn:c.string().optional()}).strict();var v5=["fjall-managed","external","external-manual"],rSe=c.enum(v5);var cM=c.object({givenName:c.string().min(1),familyName:c.string().min(1),displayName:c.string().min(1).optional(),expires:c.string().min(1).optional()}).strict(),uM=c.object({name:c.string().min(1),path:c.string().min(1).optional()}).strict(),b5=c.union([c.object({managedPolicyArn:c.string().min(1)}).strict(),c.object({customerManagedPolicy:uM}).strict()]),S5=c.object({managedPolicies:c.array(c.string().min(1)).optional(),inlinePolicy:c.record(c.string(),c.unknown()).optional(),customerManagedPolicies:c.array(uM).optional(),permissionsBoundary:b5.optional(),sessionDuration:c.string().min(1).optional(),description:c.string().optional(),accounts:c.union([c.array(c.string().min(1)),c.literal("all")]).optional(),includeManagementAccount:c.boolean().optional(),groups:c.array(c.string().min(1)).optional()}).strict(),E5=c.object({description:c.string().optional()}).strict(),kh=c.string().regex(he.EMAIL,E.EMAIL),L0={groups:c.record(c.string(),E5).optional(),permissionSets:c.record(c.string(),S5).optional(),memberships:c.record(c.string(),c.array(kh)).optional(),resolutionVersion:c.number().int().min(1).optional(),defaultPermissionSets:c.boolean().optional()},x5=c.discriminatedUnion("source",[c.object({...L0,source:c.literal("fjall-managed"),users:c.record(kh,cM)}).strict(),c.object({...L0,source:c.literal("external")}).strict(),c.object({...L0,source:c.literal("external-manual"),users:c.record(kh,cM).optional()}).strict()]),U0=c.object({name:be,type:c.literal("organisation").optional(),organisationName:c.string().min(1).optional(),orgEmail:kh.optional(),accounts:c.unknown().optional(),accountIds:c.record(c.string(),c.string()).optional(),identityCentre:c.union([x5,c.literal(!1)]).optional(),allowedRegions:c.array(c.string().min(1)).optional()}).strict();var A5=Object.defineProperty,_5=(e,t)=>A5(e,"name",{value:t,configurable:!0}),T5=[1,3,5,7,14,30,60,90,120,150,180,365,400,545,731,1827,3653],Nh=c.object({buildkiteQueue:c.string().min(1,"buildkiteQueue cannot be empty").max(100).regex(/^[a-zA-Z0-9-_]+$/,"buildkiteQueue must be alphanumeric with hyphens/underscores"),buildkiteOrgSlug:c.string().min(1,"buildkiteOrgSlug cannot be empty").max(100).regex(/^[a-z0-9-]+$/,"buildkiteOrgSlug must be a lowercase Buildkite organisation slug"),agentTokenSsmParameterName:c.string().min(2).regex(/^\//,"agentTokenSsmParameterName must be a full path (leading /)").optional(),agentTokenKmsKeyArn:c.string().min(1).optional(),fjallApiKeySsmParameterName:c.string().min(2).regex(/^\//,"fjallApiKeySsmParameterName must be a full path (leading /)").optional(),instanceType:c.string().min(1).default("c8g.xlarge"),agentVolumeSizeGib:c.number().int().min(20).max(1e3).default(250),agentMinInstances:c.number().int().min(0).default(0),agentMaxInstances:c.number().int().min(1).default(2),agentsPerInstance:c.number().int().min(1).default(1),spotCapacityPercentage:c.number().int().min(0).max(100).default(0),scaleInIdlePeriodSeconds:c.number().int().min(60).default(600),disconnectAfterUptimeSeconds:c.number().int().min(3600).default(86400),maxInstanceLifetimeDays:c.number().int().min(1).max(365).default(7),terminateInstanceAfterJob:c.boolean().default(!1),purgeBuildsOnDiskFull:c.boolean().default(!0),terminateInstanceOnDiskFull:c.boolean().default(!1),logRetentionDays:c.number().int().min(1).default(30),agentLogRetentionDays:c.literal(T5).default(7),buildkiteAgentRelease:c.enum(["stable","beta","edge"]).default("stable"),buildkiteAgentTags:c.string().default(""),buildkiteAgentTimestampLines:c.boolean().default(!1),buildkiteAgentExperiments:c.string().default(""),buildkiteAgentTracingBackend:c.enum(["","datadog","opentelemetry"]).default(""),buildkiteAgentCancelGracePeriodSeconds:c.number().int().min(10).default(60),enableSecretsPlugin:c.boolean().default(!0),enableEcrPlugin:c.boolean().default(!1),enableDockerLoginPlugin:c.boolean().default(!1),enableDockerUserNamespaceRemap:c.boolean().default(!0),enableDockerExperimental:c.boolean().default(!1),dockerNetworkingProtocol:c.enum(["ipv4","dualstack"]).default("ipv4"),enableInstanceStorage:c.boolean().default(!1),mountTmpfsAtTmp:c.boolean().default(!0),buildkiteAgentEnableGitMirrors:c.boolean().default(!1),bootstrapScriptUrl:c.string().default(""),agentEnvFileUrl:c.string().default(""),scalerEventSchedulePeriod:c.string().min(1).default("1 minute"),scalerMinPollInterval:c.string().min(1).default("10s"),scaleOutFactor:c.string().min(1).default("1.0"),scaleOutWaitingForJobs:c.boolean().default(!1),rolePermissionsBoundaryArn:c.string().min(1).optional(),alarmSnsTopicArn:c.string().min(1).optional(),applicationId:c.string().min(1).optional(),costAllocationEnvironment:c.string().min(1).optional(),costAllocationOwner:c.string().min(1).optional()}).strict(),C5=Nh.refine(e=>e.agentMinInstances<=e.agentMaxInstances,{message:"agentMinInstances must be <= agentMaxInstances"});function I5(e){let t=C5.safeParse(e);if(!t.success){let r=t.error.issues.map(i=>` - ${i.path.join(".")||"(root)"}: ${i.message}`).join(`
|
|
356
356
|
`);throw new Error(`Buildkite: invalid props:
|
|
357
357
|
${r}`)}return t.data}_5(I5,"validateBuildkiteProps");var D5=Object.defineProperty,dM=(e,t)=>D5(e,"name",{value:t,configurable:!0});function pM(e){return`FjallDeployBoundary${e}`}dM(pM,"deployBoundaryName");var w5="/fjall/";function mM(e){return`FjallDeploy${e}`}dM(mM,"deployRoleName");var lM=`arn:*:iam::*:policy/${pM("*")}`,k5=[`arn:*:iam::*:role${w5}${mM("*")}`,"arn:*:iam::*:role/cdk-*-cfn-exec-role-*"],z0={Sid:"FjallInheritAdministratorAccess",Effect:"Allow",Action:"*",Resource:"*"},fM=[{Sid:"FjallDenyOrgAndAccountEscape",Effect:"Deny",Action:["organizations:LeaveOrganization","account:CloseAccount"],Resource:"*"},{Sid:"FjallDenyDisableAuditLogging",Effect:"Deny",Action:["cloudtrail:StopLogging"],Resource:"*"},{Sid:"FjallDenyBoundarySelfEscape",Effect:"Deny",Action:["iam:DeleteRolePermissionsBoundary"],Resource:"*"},{Sid:"FjallDenyBoundaryReplace",Effect:"Deny",Action:["iam:PutRolePermissionsBoundary"],Resource:k5,Condition:{ArnNotLike:{"iam:PermissionsBoundary":lM}}},{Sid:"FjallDenyBoundaryPolicyTamper",Effect:"Deny",Action:["iam:CreatePolicy","iam:CreatePolicyVersion","iam:DeletePolicyVersion","iam:SetDefaultPolicyVersion","iam:DeletePolicy"],Resource:lM},{Sid:"FjallDenyDisableKmsKey",Effect:"Deny",Action:["kms:DisableKey"],Resource:"*"}],hM=[...fM,{Sid:"FjallDenyStandingHumanCredentials",Effect:"Deny",Action:["iam:CreateUser","iam:CreateLoginProfile","iam:CreateAccessKey","iam:CreateAccountAlias"],Resource:"*"},{Sid:"FjallDenyDisableConfigRecorder",Effect:"Deny",Action:["config:StopConfigurationRecorder"],Resource:"*"}],N5=[...hM,{Sid:"FjallDenyAccountPasswordPolicyTamper",Effect:"Deny",Action:["iam:UpdateAccountPasswordPolicy","iam:DeleteAccountPasswordPolicy"],Resource:"*"},{Sid:"FjallDenyDisableDefaultEbsEncryption",Effect:"Deny",Action:["ec2:DisableEbsEncryptionByDefault"],Resource:"*"}];var vSe={foundation:[z0,...fM],compliance:[z0,...hM],hardened:[z0,...N5]};var P5=Object.defineProperty,dt=(e,t)=>P5(e,"name",{value:t,configurable:!0});var V0="sts.amazonaws.com";function R5(e){return`FjallDevDeploy${e}`}dt(R5,"devDeployRoleName");function O5(e){return`FjallDevProvisioner${e}`}dt(O5,"devProvisionerRoleName");function $5(e){return`FjallDevSyncWriter${e}`}dt($5,"devSyncWriterRoleName");var j5="FjallDevBoundary";function gM(e){return`arn:aws:iam::${e}:policy/${j5}`}dt(gM,"devBoundaryPolicyArn");function yM(e){return`org:${e}:dev-provisioner`}dt(yM,"devProvisionerSubject");function vM(e){return`org:${e}:dev-sync`}dt(vM,"devSyncSubject");function B0(e,t){return`org:${e}:acct:${t}`}dt(B0,"deployAccountSubject");function G0(e){return`org:${e}:*`}dt(G0,"genericMachineSubject");var M5=["discovery","connection","org-setup","dev-substrate-setup"];function bM(e,t){return`org:${e}:${t}`}dt(bM,"serviceSubject");function F5(e){let{fjallOrgId:t,providerArn:r,issuerDomain:i,accountTier:n,accountId:a}=e,o=e.machineTrustMode??"expanded",s={[`${i}:aud`]:V0},u;if(o==="account-scoped"){if(n===void 0||!uf(n)||a===void 0)throw new Error(`machineTrustMode "account-scoped" requires a governance accountTier and an accountId (got tier: ${String(n)}, accountId ${a===void 0?"absent":"present"}) \u2014 refusing to fall back to the generic machine subject: a silent fallback would re-widen the trust the \xA74.4a Step-3 contract removes`);u=[B0(t,a)]}else a!==void 0?u=[G0(t),B0(t,a)]:u=G0(t);return[{Sid:"FjallMachineSubject",Effect:"Allow",Principal:{Federated:r},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:{...s,[`${i}:sub`]:u}}},{Sid:"FjallUserSubjects",Effect:"Allow",Principal:{Federated:r},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:s,StringLike:{[`${i}:sub`]:`org:${t}:user:*`}}},{Sid:"FjallServiceSubjects",Effect:"Allow",Principal:{Federated:r},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:{...s,[`${i}:sub`]:M5.map(d=>bM(t,d))}}}]}dt(F5,"buildNarrowedDeployTrustStatements");function L5(e){let{fjallOrgId:t,providerArn:r,issuerDomain:i,accountId:n}=e;return[{Sid:"FjallDevSubjectsThisAccount",Effect:"Allow",Principal:{Federated:r},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:{[`${i}:aud`]:V0},StringLike:{[`${i}:sub`]:`org:${t}:dev:${n}:*`}}}]}dt(L5,"buildDevDeployTrustStatements");function W0(e){let{providerArn:t,issuerDomain:r,sid:i,subject:n}=e;return[{Sid:i,Effect:"Allow",Principal:{Federated:t},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:{[`${r}:aud`]:V0,[`${r}:sub`]:n}}}]}dt(W0,"buildServiceSubjectTrustStatements");function U5(e){return W0({...e,sid:"FjallDevProvisionerSubject",subject:yM(e.fjallOrgId)})}dt(U5,"buildDevProvisionerTrustStatements");function z5(e){return W0({...e,sid:"FjallDevSyncSubject",subject:vM(e.fjallOrgId)})}dt(z5,"buildDevSyncWriterTrustStatements");function B5({accountId:e}){return[{Sid:"FjallDevEcsTaggedMutations",Effect:"Allow",Action:["ecs:UpdateService","ecs:DeleteService","ecs:RunTask","ecs:StopTask"],Resource:`arn:aws:ecs:*:${e}:*`,Condition:{StringEquals:{"aws:ResourceTag/fjall:dev":"true"}}},{Sid:"FjallDevEcsTaggedCreates",Effect:"Allow",Action:["ecs:RegisterTaskDefinition","ecs:CreateService"],Resource:"*",Condition:{StringEquals:{"aws:RequestTag/fjall:dev":"true"}}},{Sid:"FjallDevEcsTagOnCreate",Effect:"Allow",Action:["ecs:TagResource"],Resource:`arn:aws:ecs:*:${e}:*`,Condition:{StringEquals:{"ecs:CreateAction":["RegisterTaskDefinition","CreateService","RunTask"]}}},{Sid:"FjallDevEcsReads",Effect:"Allow",Action:["ecs:Describe*","ecs:List*"],Resource:"*"},{Sid:"FjallDevEcsDeregisterTaskDefinition",Effect:"Allow",Action:["ecs:DeregisterTaskDefinition"],Resource:`arn:aws:ecs:*:${e}:task-definition/fjall-dev-*`},{Sid:"FjallDevElbTaggedMutations",Effect:"Allow",Action:["elasticloadbalancing:ModifyRule","elasticloadbalancing:DeleteRule","elasticloadbalancing:ModifyTargetGroup","elasticloadbalancing:ModifyTargetGroupAttributes","elasticloadbalancing:DeleteTargetGroup","elasticloadbalancing:RegisterTargets","elasticloadbalancing:DeregisterTargets"],Resource:`arn:aws:elasticloadbalancing:*:${e}:*`,Condition:{StringEquals:{"aws:ResourceTag/fjall:dev":"true"}}},{Sid:"FjallDevElbTaggedCreates",Effect:"Allow",Action:["elasticloadbalancing:CreateTargetGroup","elasticloadbalancing:CreateRule"],Resource:`arn:aws:elasticloadbalancing:*:${e}:*`,Condition:{StringEquals:{"aws:RequestTag/fjall:dev":"true"}}},{Sid:"FjallDevElbTagOnCreate",Effect:"Allow",Action:["elasticloadbalancing:AddTags"],Resource:`arn:aws:elasticloadbalancing:*:${e}:*`,Condition:{StringEquals:{"elasticloadbalancing:CreateAction":["CreateTargetGroup","CreateRule"]}}},{Sid:"FjallDevElbReads",Effect:"Allow",Action:["elasticloadbalancing:Describe*"],Resource:"*"},{Sid:"FjallDevSsmDevTree",Effect:"Allow",Action:["ssm:GetParameter*","ssm:PutParameter","ssm:AddTagsToResource"],Resource:`arn:aws:ssm:*:${e}:parameter/fjall/dev/*`},{Sid:"FjallDevLogsMutations",Effect:"Allow",Action:["logs:PutRetentionPolicy","logs:DeleteLogGroup"],Resource:`arn:aws:logs:*:${e}:log-group:/fjall/dev/*`},{Sid:"FjallDevLogsTaggedCreate",Effect:"Allow",Action:["logs:CreateLogGroup","logs:TagResource"],Resource:`arn:aws:logs:*:${e}:log-group:/fjall/dev/*`,Condition:{StringEquals:{"aws:RequestTag/fjall:dev":"true"}}},{Sid:"FjallDevLogsRead",Effect:"Allow",Action:["logs:GetLogEvents","logs:DescribeLogStreams","logs:FilterLogEvents"],Resource:`arn:aws:logs:*:${e}:log-group:/fjall/dev/*`},{Sid:"FjallDevLogsDescribeGroups",Effect:"Allow",Action:["logs:DescribeLogGroups"],Resource:"*"},{Sid:"FjallDevKmsViaDevAlias",Effect:"Allow",Action:["kms:Encrypt","kms:Decrypt","kms:GenerateDataKey"],Resource:`arn:aws:kms:*:${e}:key/*`,Condition:{"ForAnyValue:StringLike":{"kms:ResourceAliases":"alias/fjall-dev-*"}}},{Sid:"FjallDevKmsSsmSecureString",Effect:"Allow",Action:["kms:Encrypt","kms:Decrypt","kms:GenerateDataKey"],Resource:`arn:aws:kms:*:${e}:key/*`,Condition:{StringLike:{"kms:ViaService":"ssm.*.amazonaws.com"}}},{Sid:"FjallDevEcrAuthToken",Effect:"Allow",Action:["ecr:GetAuthorizationToken"],Resource:"*"},{Sid:"FjallDevEcrPushPull",Effect:"Allow",Action:["ecr:PutImage","ecr:InitiateLayerUpload","ecr:UploadLayerPart","ecr:CompleteLayerUpload","ecr:BatchCheckLayerAvailability","ecr:BatchGetImage","ecr:GetDownloadUrlForLayer","ecr:DescribeImages"],Resource:`arn:aws:ecr:*:${e}:repository/*`},{Sid:"FjallDevPassDevPathRoles",Effect:"Allow",Action:["iam:PassRole"],Resource:`arn:aws:iam::${e}:role/fjall/dev/*`}]}dt(B5,"buildDevDeployPolicyStatements");function G5({accountId:e}){return[{Sid:"FjallDevProvisionerBoundedRoleWrites",Effect:"Allow",Action:["iam:CreateRole","iam:PutRolePolicy","iam:AttachRolePolicy"],Resource:`arn:aws:iam::${e}:role/fjall/dev/*`,Condition:{StringEquals:{"iam:PermissionsBoundary":gM(e)}}},{Sid:"FjallDevProvisionerPathRoleOps",Effect:"Allow",Action:["iam:DeleteRole","iam:DeleteRolePolicy","iam:DetachRolePolicy","iam:ListRolePolicies","iam:TagRole"],Resource:`arn:aws:iam::${e}:role/fjall/dev/*`},{Sid:"FjallDevProvisionerListRoles",Effect:"Allow",Action:["iam:ListRoles"],Resource:"*"},{Sid:"FjallDevProvisionerDevMasterSecrets",Effect:"Allow",Action:["secretsmanager:GetSecretValue"],Resource:`arn:aws:secretsmanager:*:${e}:secret:fjall-dev-*`},{Sid:"FjallDevProvisionerKmsDecryptViaSecretsManager",Effect:"Allow",Action:["kms:Decrypt"],Resource:`arn:aws:kms:*:${e}:key/*`,Condition:{StringLike:{"kms:ViaService":"secretsmanager.*.amazonaws.com"}}},{Sid:"FjallDevProvisionerDataApi",Effect:"Allow",Action:["rds-data:ExecuteStatement","rds-data:BatchExecuteStatement","rds-data:BeginTransaction","rds-data:CommitTransaction","rds-data:RollbackTransaction"],Resource:`arn:aws:rds:*:${e}:cluster:fjall-dev-*`},{Sid:"FjallDevProvisionerMetrics",Effect:"Allow",Action:["cloudwatch:GetMetricData"],Resource:"*"},{Sid:"FjallDevProvisionerOrphanDiscovery",Effect:"Allow",Action:["tag:GetResources"],Resource:"*"},{Sid:"FjallDevProvisionerSsmTeardown",Effect:"Allow",Action:["ssm:DeleteParameter*"],Resource:`arn:aws:ssm:*:${e}:parameter/fjall/dev/*`},{Sid:"FjallDevProvisionerLogsTeardown",Effect:"Allow",Action:["logs:DeleteLogGroup"],Resource:`arn:aws:logs:*:${e}:log-group:/fjall/dev/*`},{Sid:"FjallDevProvisionerTaggedTeardown",Effect:"Allow",Action:["ecs:UpdateService","ecs:StopTask","ecs:DeleteService","elasticloadbalancing:DeleteRule","elasticloadbalancing:DeleteTargetGroup","elasticloadbalancing:DeregisterTargets"],Resource:[`arn:aws:ecs:*:${e}:*`,`arn:aws:elasticloadbalancing:*:${e}:*`],Condition:{StringEquals:{"aws:ResourceTag/fjall:dev":"true"}}},{Sid:"FjallDevProvisionerTeardownReads",Effect:"Allow",Action:["ecs:Describe*","elasticloadbalancing:Describe*"],Resource:"*"},{Sid:"FjallDevProvisionerImageJanitor",Effect:"Allow",Action:["ecr:ListImages","ecr:DescribeImages","ecr:BatchDeleteImage"],Resource:`arn:aws:ecr:*:${e}:repository/*`},{Sid:"FjallDevProvisionerSsmReadAll",Effect:"Allow",Action:["ssm:GetParameter*"],Resource:`arn:aws:ssm:*:${e}:parameter/*`},{Sid:"FjallDevProvisionerKmsDecryptViaSsm",Effect:"Allow",Action:["kms:Decrypt"],Resource:`arn:aws:kms:*:${e}:key/*`,Condition:{StringLike:{"kms:ViaService":"ssm.*.amazonaws.com"}}}]}dt(G5,"buildDevProvisionerPolicyStatements");function V5({accountId:e}){return[{Sid:"FjallDevSyncPrefixReadWrite",Effect:"Allow",Action:["s3:GetObject","s3:PutObject"],Resource:`arn:aws:s3:::fjall-dev-sync-${e}-*/*`,Condition:{StringEquals:{"aws:ResourceAccount":e}}}]}dt(V5,"buildDevSyncWriterPolicyStatements");function W5({accountId:e}){return[{Sid:"FjallDevBoundarySsmDevRead",Effect:"Allow",Action:["ssm:GetParameter*"],Resource:`arn:aws:ssm:*:${e}:parameter/fjall/dev/*`},{Sid:"FjallDevBoundaryKmsDecryptDevAlias",Effect:"Allow",Action:["kms:Decrypt"],Resource:`arn:aws:kms:*:${e}:key/*`,Condition:{"ForAnyValue:StringLike":{"kms:ResourceAliases":"alias/fjall-dev-*"}}},{Sid:"FjallDevBoundarySyncPrefixReadWrite",Effect:"Allow",Action:["s3:GetObject","s3:PutObject"],Resource:`arn:aws:s3:::fjall-dev-sync-${e}-*/*`,Condition:{StringEquals:{"aws:ResourceAccount":e}}},{Sid:"FjallDevBoundarySlotLogs",Effect:"Allow",Action:["logs:CreateLogStream","logs:PutLogEvents"],Resource:`arn:aws:logs:*:${e}:log-group:/fjall/dev/*`},{Sid:"FjallDevBoundarySyncQueue",Effect:"Allow",Action:["sqs:ReceiveMessage","sqs:DeleteMessage","sqs:GetQueueUrl"],Resource:`arn:aws:sqs:*:${e}:fjall-dev-sync-${e}-*`}]}dt(W5,"buildDevBoundaryStatements");var K5=Object.defineProperty,tr=(e,t)=>K5(e,"name",{value:t,configurable:!0});function H(e){return JSON.stringify(e)}tr(H,"escapeStringLiteral");function Cl(e){return e.map(H).join(", ")}tr(Cl,"formatStringArray");var q5="import:SharedAlarmTopicArn";function Ka(e=" "){return`
|
|
@@ -615,7 +615,7 @@ ${a}`)}throw n}}$g(uo,"convertToResourcePlan");var ore=Object.defineProperty,Sc=
|
|
|
615
615
|
`;return i.push(`Custom code from line ${t.originalLine} could not be positioned. Added at end of file.`),e+`
|
|
616
616
|
`+n+t.sourceText}Or(Mz,"insertOrOrphanBlock");function Lg(e,t,r){if(!t||t.length===0)return{content:e,success:!0};try{let i=ra(e),n=Kt(i),a=[],o=jz(t),s=e;for(let u of o){let d=Lz(i,n,u,r,a);s=Mz(s,u,d,a)}return{content:s,success:!0,warnings:a.length>0?a:void 0}}catch(i){return En(i,e)}}Or(Lg,"injectCustomCodeBlocks");function Fz(e,t,r,i){if(!t.afterManagedResource)return null;let n=t.afterManagedResource,a=(n.name&&r?.get(n.name))??n.name,o=e.find(u=>u.type===n.type&&u.resourceName===a);if(o)return o.endPos;let s=e.filter(u=>u.type===n.type&&u.isManaged);return s.length===1?s[0].endPos:(i&&i.push(`Resource ${na(t.afterManagedResource.type,t.afterManagedResource.name)} not found. Custom code may be orphaned.`),null)}Or(Fz,"findAfterResourcePosition");function Lz(e,t,r,i,n){switch(r.position){case"before-imports":return 0;case"after-imports":return oI(t,"import")?.endPos??0;case"after-app-init":return jg(t,"app-init")?.endPos??null;case"after-tags":return jg(t,"tags")?.endPos??null;case"after-resource":return Fz(t,r,i,n);case"end-of-file":return e.getEnd();default:return null}}Or(Lz,"findCustomCodeInsertPosition");function Uz(e,t,r){let i=Fg(e,t),n=r.sourceText;return n=Mg(i,n)+n,n.endsWith(`
|
|
617
617
|
`)||(n+=`
|
|
618
|
-
`),n}Or(Uz,"formatCustomCodeForInsertion");function zz(e){try{let t=function(n){n.kind===lo.SyntaxKind.Unknown&&i.push("Unknown node found in AST - possible parse error"),lo.forEachChild(n,t)};Or(t,"visit");let r=ra(e),i=[];return t(r),i.length>0?{valid:!1,errors:i}:{valid:!0}}catch(t){return{valid:!1,errors:[ze(t)]}}}Or(zz,"validateModifiedFile");import*as We from"typescript";var Ad=c.enum(["A","AAAA","CNAME","MX","TXT","NS","SRV","CAA"]),ure=c.object({name:c.string(),type:Ad,ttl:c.number().optional(),value:c.string(),priority:c.number().optional(),weight:c.number().optional(),port:c.number().optional()}).strict(),lre=c.object({subdomain:c.string(),targetAccount:c.string(),auto:c.boolean()}).strict(),dre=c.object({domainName:c.string(),subjectAlternativeNames:c.array(c.string())}).strict(),u0e=c.object({origin:c.string(),ttl:c.number(),records:c.array(ure),delegations:c.array(lre),certificates:c.array(dre)}).strict(),xn=Object.freeze({ORIGIN:"$ORIGIN",TTL:"$TTL",FJALL_DELEGATE:"$FJALL-DELEGATE",FJALL_CERT:"$FJALL-CERT"}),Bz="ALIAS ";var Gz=c.discriminatedUnion("kind",[c.object({kind:c.literal("ecs"),appName:c.string(),computeName:c.string().min(1).optional()}).strict(),c.object({kind:c.literal("cdn"),appName:c.string(),cdnName:c.string().min(1).optional()}).strict(),c.object({kind:c.literal("bucket"),appName:c.string(),bucketName:c.string()}).strict(),c.object({kind:c.literal("custom"),dnsName:c.string(),hostedZoneId:c.string()}).strict()]),Vz=Gz.options.map(e=>e.shape.kind.value),lI=c.enum(["A","AAAA"]),dI=c.enum(["route53","external-delegated","external-records"]),Wz=c.enum(["zone","full"]),Ug=c.string().regex(/^[A-Za-z][A-Za-z0-9]*$/),pre=c.object({kind:c.literal("standard"),type:c.enum(["A","AAAA","CNAME","MX","TXT","NS","SRV","CAA"]),name:c.string(),value:c.union([c.string(),c.array(c.string())]),ttl:c.number().int().positive().optional(),id:Ug.optional()}).strict(),mre=c.object({kind:c.literal("alias"),type:lI,name:c.string(),target:Gz,id:Ug.optional()}).strict(),fre=c.discriminatedUnion("kind",[pre,mre]),hre=c.object({domainName:c.string(),subjectAlternativeNames:c.array(c.string()).optional(),transparencyLogging:c.boolean().optional(),cloudFront:c.boolean().optional()}).strict(),gre=c.object({subdomain:c.string(),toAccount:c.string(),auto:c.boolean().optional()}).strict(),pI=c.enum(["indexed","stable"]),p0e=c.object({zoneName:c.string(),registrar:dI,recordIds:pI.optional(),hostedZoneId:c.string().optional(),delegatedSubdomain:c.string().optional(),adoptedNameServers:c.array(c.string().min(1)).min(1).optional(),records:c.array(fre),certificates:c.array(hre),delegations:c.array(gre)}).strict().refine(e=>e.registrar!=="external-delegated"||e.delegatedSubdomain!==void 0,{message:"external-delegated requires delegatedSubdomain"}).refine(e=>e.registrar!=="external-records"||e.delegations.length===0,{message:"external-records forbids delegations"}).refine(e=>e.registrar==="external-delegated"||e.adoptedNameServers===void 0,{message:"adoptedNameServers requires registrar external-delegated"}).refine(e=>e.registrar!=="external-delegated"||e.hostedZoneId===void 0==(e.adoptedNameServers===void 0),{message:"external-delegated adoption requires hostedZoneId and adoptedNameServers together (both-or-neither)"});var yre=Object.defineProperty,Xe=(e,t)=>yre(e,"name",{value:t,configurable:!0}),Zz=dI.options,Kz=Wz.options,qz=pI.options,vre=Ad.options,bre=lI.options;function fI(e){let t=[],r=Xe(n=>{if(We.isNewExpression(n)&&Hz(n.expression)){let a=Jz(n);a!==void 0&&t.push(a)}We.forEachChild(n,r)},"visit");if(r(e),t.length===0)return V(void 0);if(t.length>1)return $(new Error(`Expected exactly one 'new Domain(...)' call per infrastructure file, found ${t.length}`));let i=t[0];return i?V(i):V(void 0)}Xe(fI,"findDomainConstructCall");function Hz(e){return We.isIdentifier(e)&&e.text==="Domain"}Xe(Hz,"isDomainIdentifier");function Jz(e){let t=e.arguments;if(!t||t.length<3)return;let r=t[0],i=t[1],n=t[2];if(!r||!i||!n||!We.isObjectLiteralExpression(n))return;let a=Xz(e);if(a===void 0)return;let o=Yz(e),s=We.isStringLiteral(i)?i.text:void 0;return{callExpression:e,containingStatement:a,propsObjectLiteral:n,domainVarId:o,scopeArgumentText:r.getText(),constructIdLiteral:s}}Xe(Jz,"buildMatch");function Xz(e){let t=e;for(;t!==void 0;){if(We.isExpressionStatement(t)||We.isVariableStatement(t))return t;t=t.parent}}Xe(Xz,"findContainingTopLevelStatement");function Yz(e){let t=e.parent;for(;t!==void 0;){if(We.isVariableDeclaration(t)&&We.isIdentifier(t.name)&&t.initializer===e)return t.name.text;t=t.parent}}Xe(Yz,"extractDomainVarId");function Qz(e){switch(e.kind){case"registrar_required":return"'registrar' property is required";case"registrar_unsupported":return`'registrar' must be one of ${Zz.join(", ")}, got ${JSON.stringify(e.value)}`;case"missing_field":return`'${e.field}' property is required`;case"invalid_literal":return`'${e.field}' ${e.reason}`;case"removed_field":return`'${e.field}' was removed from the Domain API \u2014 ${e.cure}`}}Xe(Qz,"errorMessage");var Sre="declare the delegated child as its own Domain with registrar: 'external-delegated' and set 'parentDelegationRoleArn' (the CLI injects it via ManagedDomainBinding.delegationRoleArn); the child UPSERTs its NS records into the parent zone";function hI(e){let t=ye(e),r=ce(t.registrar,Zz);if(r===void 0){let u=t.registrar;if(u===void 0)return $({kind:"registrar_required"});let d=typeof u=="string"?u:Bg(u);return $({kind:"registrar_unsupported",value:d})}let i=N(t.zoneName);if(i===void 0)return $({kind:"missing_field",field:"zoneName"});let n=ce(t.recordIds,qz);if(t.recordIds!==void 0&&n===void 0)return $({kind:"invalid_literal",field:"recordIds",reason:`must be one of ${qz.map(u=>`'${u}'`).join(", ")}`});let a=rB(t.records);if(!a.success)return a;let o=sB(t.certificates);if(!o.success)return o;if(t.delegations!==void 0)return $({kind:"removed_field",field:"delegations",cure:Sre});let s={zoneName:i,recordIds:n,description:N(t.description),costAllocationEnvironment:N(t.costAllocationEnvironment),tags:cB(t.tags),records:a.data,certificates:o.data};switch(r){case"route53":return V({...s,registrar:r,hostedZoneId:N(t.hostedZoneId)});case"external-delegated":{let u=N(t.delegatedSubdomain);if(u===void 0)return $({kind:"missing_field",field:"delegatedSubdomain"});let d=N(t.hostedZoneId);if(t.hostedZoneId!==void 0&&d===void 0)return $({kind:"invalid_literal",field:"hostedZoneId",reason:"must be a literal string zone id on external-delegated \u2014 dynamic expressions cannot be round-tripped"});let p=Je(t.adoptedNameServers);if(t.adoptedNameServers!==void 0&&p===void 0)return $({kind:"invalid_literal",field:"adoptedNameServers",reason:"must be an array of literal NS hostname strings \u2014 the parent NS UPSERT writes them verbatim"});if(d===void 0!=(p===void 0))return $({kind:"invalid_literal",field:d===void 0?"hostedZoneId":"adoptedNameServers",reason:"adopting an existing child zone requires hostedZoneId and adoptedNameServers together (both-or-neither) \u2014 an imported zone exposes no name-server attribute at synth"});let h=N(t.parentDelegationRoleArn);if(t.parentDelegationRoleArn!==void 0&&h===void 0)return $({kind:"invalid_literal",field:"parentDelegationRoleArn",reason:"must be a literal string ARN (VD2-a) \u2014 the CLI injects it via ManagedDomainBinding.delegationRoleArn; dynamic expressions such as Fn.importValue are not supported"});let g=ce(t.phase,Kz);return t.phase!==void 0&&g===void 0?$({kind:"invalid_literal",field:"phase",reason:`must be one of ${Kz.map(l=>`'${l}'`).join(", ")}`}):V({...s,registrar:r,delegatedSubdomain:u,hostedZoneId:d,adoptedNameServers:p,parentDelegationRoleArn:h,phase:g})}case"external-records":return V({...s,registrar:r})}}Xe(hI,"parseDomainProps");function eB(e){return Qz(e)}Xe(eB,"parseDomainErrorMessage");function tB(e,t,r){let i=We.createSourceFile(t,e,We.ScriptTarget.Latest,!0,We.ScriptKind.TS),n=fI(i);if(!n.success)return $(new Error(n.error.message));if(n.data===void 0)return $(new Error(`Domain '${r}': no 'new Domain(...)' call found in ${t} \u2014 the file is not a Fjall domain component.`));let a=hI(n.data.propsObjectLiteral);return a.success?V(a.data):$(new Error(`Domain '${r}': infrastructure.ts could not be parsed (${a.error.kind}).`))}Xe(tB,"parseDomainInfrastructureSource");function rB(e){if(e===void 0)return V([]);if(!Array.isArray(e))return $({kind:"invalid_literal",field:"records",reason:"must be an array"});let t=[];for(let r=0;r<e.length;r++){let i=e[r];if(!Z(i))return $({kind:"invalid_literal",field:`records[${r}]`,reason:"must be an object literal"});let n=nB(i,r);if(!n.success)return n;t.push(n.data)}return V(t)}Xe(rB,"parseRecordsArray");function nB(e,t){let r=N(e.type),i=N(e.name);if(r===void 0)return $({kind:"missing_field",field:`records[${t}].type`});if(i===void 0)return $({kind:"missing_field",field:`records[${t}].name`});let n=N(e.id);if(e.id!==void 0&&(n===void 0||!Ug.safeParse(n).success))return $({kind:"invalid_literal",field:`records[${t}].id`,reason:"must be a literal alphanumeric string starting with a letter \u2014 it becomes a CloudFormation logical-ID segment"});if(e.target!==void 0){if(!bre.some(d=>d===r))return $({kind:"invalid_literal",field:`records[${t}]`,reason:`alias records must have type 'A' or 'AAAA', got '${r}'`});let u=aB(e.target);return V({kind:"alias",type:r,name:i,target:u,...n!==void 0?{id:n}:{}})}if(!vre.some(u=>u===r))return $({kind:"invalid_literal",field:`records[${t}]`,reason:`unsupported record type '${r}'`});let a=iB(e.value);if(a===void 0)return $({kind:"invalid_literal",field:`records[${t}].value`,reason:`must be a string or array of strings (got ${JSON.stringify(e.value)})`});let o=q(e.ttl),s={kind:"standard",type:r,name:i,value:a,...o!==void 0?{ttl:o}:{},...n!==void 0?{id:n}:{}};return V(s)}Xe(nB,"parseRecord");function iB(e){if(e===void 0)return;if(typeof e=="string")return e;let t=Je(e);if(t!==void 0)return t}Xe(iB,"parseRecordValue");function aB(e){if(Jr(e))return oB(e);if(Z(e)){let t=ce(e.kind,Vz);if(t==="ecs"||t==="cdn"){let r=N(e.appName);if(r!==void 0)return{kind:t,appName:r}}if(t==="bucket"){let r=N(e.appName),i=N(e.bucketName);if(r!==void 0&&i!==void 0)return{kind:t,appName:r,bucketName:i}}if(t==="custom"){let r=N(e.dnsName),i=N(e.hostedZoneId);if(r!==void 0&&i!==void 0)return{kind:t,dnsName:r,hostedZoneId:i}}}return{kind:"unresolved",sourceText:Bg(e)}}Xe(aB,"parseTarget");function oB(e){let t=e.__call.trim(),r=t.match(/^([A-Za-z_][\w$]*)\s*\(([\s\S]*)\)\s*$/);if(!r)return{kind:"unresolved",sourceText:t};let i=r[1],n=r[2]??"",a=zg(n);switch(i){case"fjallApp":{let o=An(a,0);if(o===void 0)return{kind:"dynamic",sourceText:t};if(a.length<2)return{kind:"ecs",appName:o};let s=An(a,1);return s===void 0?{kind:"dynamic",sourceText:t}:{kind:"ecs",appName:o,computeName:s}}case"fjallCdn":{let o=An(a,0);if(o===void 0)return{kind:"dynamic",sourceText:t};if(a.length<2)return{kind:"cdn",appName:o};let s=An(a,1);return s===void 0?{kind:"dynamic",sourceText:t}:{kind:"cdn",appName:o,cdnName:s}}case"fjallBucket":{if(a.length<2)return{kind:"unresolved",sourceText:t};let o=An(a,0),s=An(a,1);return o===void 0||s===void 0?{kind:"dynamic",sourceText:t}:{kind:"bucket",appName:o,bucketName:s}}case"aliasTo":{if(a.length>=2){let o=An(a,0),s=An(a,1);return o!==void 0&&s!==void 0?{kind:"custom",dnsName:o,hostedZoneId:s}:{kind:"dynamic",sourceText:t}}if(a.length===1){let o=a[0]?.trim()??"",s=mI(o,"dnsName"),u=mI(o,"hostedZoneId");return s!==void 0&&u!==void 0?{kind:"custom",dnsName:s,hostedZoneId:u}:{kind:"dynamic",sourceText:t}}return{kind:"unresolved",sourceText:t}}default:return{kind:"unresolved",sourceText:t}}}Xe(oB,"resolveCallRefTarget");function zg(e){let t=[],r=0,i=null,n="";for(let o=0;o<e.length;o++){let s=e[o];if(i!==null){if(n+=s,s==="\\"&&o+1<e.length){let u=e[o+1];u!==void 0&&(n+=u,o+=1);continue}s===i&&(i=null);continue}if(s==='"'||s==="'"||s==="`"){i=s,n+=s;continue}if(s==="("||s==="{"||s==="["){r+=1,n+=s;continue}if(s===")"||s==="}"||s==="]"){r-=1,n+=s;continue}if(s===","&&r===0){t.push(n.trim()),n="";continue}n+=s}let a=n.trim();return a.length>0&&t.push(a),t}Xe(zg,"splitTopLevelArgs");function An(e,t){let r=e[t];if(r===void 0)return;let i=r.trim();if(i.length<2)return;let n=i[0],a=i[i.length-1];if(n===a&&!(n!=='"'&&n!=="'"&&n!=="`"))return i.slice(1,-1)}Xe(An,"extractStringLiteralArg");function mI(e,t){let r=e.trim().replace(/^\{|\}$/g,""),i=zg(r);for(let n of i){let a=n.indexOf(":");if(a<0||n.slice(0,a).trim().replace(/["'`]/g,"")!==t)continue;let o=n.slice(a+1).trim();return An([o],0)}}Xe(mI,"extractObjectFieldString");function sB(e){if(e===void 0)return V([]);if(!Array.isArray(e))return $({kind:"invalid_literal",field:"certificates",reason:"must be an array"});let t=[];for(let r=0;r<e.length;r++){let i=e[r];if(typeof i=="string"){t.push({domainName:i});continue}if(!Z(i))return $({kind:"invalid_literal",field:`certificates[${r}]`,reason:"must be a string or object literal"});let n=N(i.domainName);if(n===void 0)return $({kind:"missing_field",field:`certificates[${r}].domainName`});let a=Je(i.subjectAlternativeNames),o=ne(i.transparencyLogging),s=ne(i.cloudFront);if(i.cloudFront!==void 0&&s===void 0)return $({kind:"invalid_literal",field:`certificates[${r}].cloudFront`,reason:"must be a boolean literal \u2014 the CloudFront designation drives the zone-level us-east-1 export contract and cannot be round-tripped from a dynamic expression"});t.push({domainName:n,...a!==void 0?{subjectAlternativeNames:a}:{},...o!==void 0?{transparencyLogging:o}:{},...s!==void 0?{cloudFront:s}:{}})}return V(t)}Xe(sB,"parseCertificatesArray");function cB(e){if(e===void 0||!Z(e))return;let t={};for(let[r,i]of Object.entries(e)){let n=N(i);n!==void 0&&(t[r]=n)}return Object.keys(t).length===0?void 0:t}Xe(cB,"parseStringRecord");function Bg(e){if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e=="string")return JSON.stringify(e);if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return`[${e.map(t=>Bg(t)).join(", ")}]`;if(typeof e=="object"){if("__call"in e)return String(e.__call);if("__identifier"in e)return String(e.__identifier);if("__expression"in e)return String(e.__expression);if("__unknown"in e)return String(e.__unknown)}return String(e)}Xe(Bg,"stringifyParsedValue");var vy=Po(_r(),1);var Ere=Object.defineProperty,po=(e,t)=>Ere(e,"name",{value:t,configurable:!0}),qt=Symbol("non-literal");function xre(e,t){let r={};for(let i of e.properties){if(i.type!=="Property"&&i.type!=="ObjectProperty"||i.shorthand===!0||i.computed===!0)continue;let n=di(i.key);if(n===void 0||i.value===void 0)continue;let a=Gg(i.value);a!==qt&&(r[n]=a)}return{...r,...t}}po(xre,"buildMergedLiteral");function Are(e){let t=[];for(let r of e.properties){if(r.type!=="Property"&&r.type!=="ObjectProperty"||r.shorthand===!0||r.computed===!0)continue;let i=di(r.key);i!==void 0&&t.push(i)}return t}po(Are,"collectPropertyKeys");function Gg(e){let t=e.value;switch(e.type){case"StringLiteral":return typeof t=="string"?t:qt;case"NumericLiteral":return typeof t=="number"?t:qt;case"BooleanLiteral":return typeof t=="boolean"?t:qt;case"NullLiteral":return null;case"ArrayExpression":return uB(e);case"ObjectExpression":return lB(e);default:return qt}}po(Gg,"astToLiteral");function uB(e){let t=e.elements;if(!Array.isArray(t))return qt;let r=[];for(let i of t){if(!Se(i))return qt;let n=Gg(i);if(n===qt)return qt;r.push(n)}return r}po(uB,"arrayToLiteral");function lB(e){let t=e.properties;if(!Array.isArray(t))return qt;let r={};for(let i of t){if(!Se(i)||i.type!=="Property"&&i.type!=="ObjectProperty")return qt;let n=di(i.key),a=i.value;if(n===void 0||a===void 0)return qt;let o=Gg(a);if(o===qt)return qt;r[n]=o}return r}po(lB,"objectToLiteral");function di(e){if(e===void 0)return;let t=e;if(e.type==="Identifier"&&typeof t.name=="string")return t.name;if(e.type==="StringLiteral"&&typeof t.value=="string")return t.value}po(di,"readKeyName");function Se(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}po(Se,"isNodeShape");var x2=Po(E2(),1),rie=Object.defineProperty,Eo=(e,t)=>rie(e,"name",{value:t,configurable:!0}),A2="\uFEFF",my=65279;function nie(e,t){let r=Bd(t),i=T2(e),n=x2.print(e,{quote:i,lineTerminator:r,trailingComma:!0}).code,a=_2(n,t),o=t.charCodeAt(0)===my,s=a.charCodeAt(0)===my;return o&&!s?`${A2}${a}`:a}Eo(nie,"printFile");var iie=/^(#![^\n\r]*)((?:\r?\n)*)/;function _2(e,t){let r=t.charCodeAt(0)===my?t.slice(1):t,i=iie.exec(r);if(i===null)return e;let n=i[1],a=i[2]??"";if(n===void 0)return e;let o=Eo(p=>p!==""&&a===""?Bd(t):a,"separatorOrFloor"),s=e.charCodeAt(0)===my,u=s?A2:"",d=s?e.slice(1):e;if(d.startsWith(n)){let p=d.slice(n.length).replace(/^(?:\r?\n)*/,"");return`${u}${n}${o(p)}${p}`}return d.startsWith("#!")?e:`${u}${n}${o(d)}${d}`}Eo(_2,"restoreShebangPrefix");function Bd(e){return e.includes(`\r
|
|
618
|
+
`),n}Or(Uz,"formatCustomCodeForInsertion");function zz(e){try{let t=function(n){n.kind===lo.SyntaxKind.Unknown&&i.push("Unknown node found in AST - possible parse error"),lo.forEachChild(n,t)};Or(t,"visit");let r=ra(e),i=[];return t(r),i.length>0?{valid:!1,errors:i}:{valid:!0}}catch(t){return{valid:!1,errors:[ze(t)]}}}Or(zz,"validateModifiedFile");import*as We from"typescript";var Ad=c.enum(["A","AAAA","CNAME","MX","TXT","NS","SRV","CAA"]),ure=c.object({name:c.string(),type:Ad,ttl:c.number().optional(),value:c.string(),priority:c.number().optional(),weight:c.number().optional(),port:c.number().optional()}).strict(),lre=c.object({subdomain:c.string(),targetAccount:c.string(),auto:c.boolean()}).strict(),dre=c.object({domainName:c.string(),subjectAlternativeNames:c.array(c.string())}).strict(),d0e=c.object({origin:c.string(),ttl:c.number(),records:c.array(ure),delegations:c.array(lre),certificates:c.array(dre)}).strict(),xn=Object.freeze({ORIGIN:"$ORIGIN",TTL:"$TTL",FJALL_DELEGATE:"$FJALL-DELEGATE",FJALL_CERT:"$FJALL-CERT"}),Bz="ALIAS ";var Gz=c.discriminatedUnion("kind",[c.object({kind:c.literal("ecs"),appName:c.string(),computeName:c.string().min(1).optional()}).strict(),c.object({kind:c.literal("cdn"),appName:c.string(),cdnName:c.string().min(1).optional()}).strict(),c.object({kind:c.literal("bucket"),appName:c.string(),bucketName:c.string()}).strict(),c.object({kind:c.literal("custom"),dnsName:c.string(),hostedZoneId:c.string()}).strict()]),Vz=Gz.options.map(e=>e.shape.kind.value),lI=c.enum(["A","AAAA"]),dI=c.enum(["route53","external-delegated","external-records"]),Wz=c.enum(["zone","full"]),Ug=c.string().regex(/^[A-Za-z][A-Za-z0-9]*$/),pre=c.object({kind:c.literal("standard"),type:c.enum(["A","AAAA","CNAME","MX","TXT","NS","SRV","CAA"]),name:c.string(),value:c.union([c.string(),c.array(c.string())]),ttl:c.number().int().positive().optional(),id:Ug.optional()}).strict(),mre=c.object({kind:c.literal("alias"),type:lI,name:c.string(),target:Gz,id:Ug.optional()}).strict(),fre=c.discriminatedUnion("kind",[pre,mre]),hre=c.object({domainName:c.string(),subjectAlternativeNames:c.array(c.string()).optional(),transparencyLogging:c.boolean().optional(),cloudFront:c.boolean().optional()}).strict(),gre=c.object({subdomain:c.string(),toAccount:c.string(),auto:c.boolean().optional()}).strict(),pI=c.enum(["indexed","stable"]),f0e=c.object({zoneName:c.string(),registrar:dI,recordIds:pI.optional(),hostedZoneId:c.string().optional(),delegatedSubdomain:c.string().optional(),adoptedNameServers:c.array(c.string().min(1)).min(1).optional(),records:c.array(fre),certificates:c.array(hre),delegations:c.array(gre)}).strict().refine(e=>e.registrar!=="external-delegated"||e.delegatedSubdomain!==void 0,{message:"external-delegated requires delegatedSubdomain"}).refine(e=>e.registrar!=="external-records"||e.delegations.length===0,{message:"external-records forbids delegations"}).refine(e=>e.registrar==="external-delegated"||e.adoptedNameServers===void 0,{message:"adoptedNameServers requires registrar external-delegated"}).refine(e=>e.registrar!=="external-delegated"||e.hostedZoneId===void 0==(e.adoptedNameServers===void 0),{message:"external-delegated adoption requires hostedZoneId and adoptedNameServers together (both-or-neither)"});var yre=Object.defineProperty,Xe=(e,t)=>yre(e,"name",{value:t,configurable:!0}),Zz=dI.options,Kz=Wz.options,qz=pI.options,vre=Ad.options,bre=lI.options;function fI(e){let t=[],r=Xe(n=>{if(We.isNewExpression(n)&&Hz(n.expression)){let a=Jz(n);a!==void 0&&t.push(a)}We.forEachChild(n,r)},"visit");if(r(e),t.length===0)return V(void 0);if(t.length>1)return $(new Error(`Expected exactly one 'new Domain(...)' call per infrastructure file, found ${t.length}`));let i=t[0];return i?V(i):V(void 0)}Xe(fI,"findDomainConstructCall");function Hz(e){return We.isIdentifier(e)&&e.text==="Domain"}Xe(Hz,"isDomainIdentifier");function Jz(e){let t=e.arguments;if(!t||t.length<3)return;let r=t[0],i=t[1],n=t[2];if(!r||!i||!n||!We.isObjectLiteralExpression(n))return;let a=Xz(e);if(a===void 0)return;let o=Yz(e),s=We.isStringLiteral(i)?i.text:void 0;return{callExpression:e,containingStatement:a,propsObjectLiteral:n,domainVarId:o,scopeArgumentText:r.getText(),constructIdLiteral:s}}Xe(Jz,"buildMatch");function Xz(e){let t=e;for(;t!==void 0;){if(We.isExpressionStatement(t)||We.isVariableStatement(t))return t;t=t.parent}}Xe(Xz,"findContainingTopLevelStatement");function Yz(e){let t=e.parent;for(;t!==void 0;){if(We.isVariableDeclaration(t)&&We.isIdentifier(t.name)&&t.initializer===e)return t.name.text;t=t.parent}}Xe(Yz,"extractDomainVarId");function Qz(e){switch(e.kind){case"registrar_required":return"'registrar' property is required";case"registrar_unsupported":return`'registrar' must be one of ${Zz.join(", ")}, got ${JSON.stringify(e.value)}`;case"missing_field":return`'${e.field}' property is required`;case"invalid_literal":return`'${e.field}' ${e.reason}`;case"removed_field":return`'${e.field}' was removed from the Domain API \u2014 ${e.cure}`}}Xe(Qz,"errorMessage");var Sre="declare the delegated child as its own Domain with registrar: 'external-delegated' and set 'parentDelegationRoleArn' (the CLI injects it via ManagedDomainBinding.delegationRoleArn); the child UPSERTs its NS records into the parent zone";function hI(e){let t=ye(e),r=ce(t.registrar,Zz);if(r===void 0){let u=t.registrar;if(u===void 0)return $({kind:"registrar_required"});let d=typeof u=="string"?u:Bg(u);return $({kind:"registrar_unsupported",value:d})}let i=N(t.zoneName);if(i===void 0)return $({kind:"missing_field",field:"zoneName"});let n=ce(t.recordIds,qz);if(t.recordIds!==void 0&&n===void 0)return $({kind:"invalid_literal",field:"recordIds",reason:`must be one of ${qz.map(u=>`'${u}'`).join(", ")}`});let a=rB(t.records);if(!a.success)return a;let o=sB(t.certificates);if(!o.success)return o;if(t.delegations!==void 0)return $({kind:"removed_field",field:"delegations",cure:Sre});let s={zoneName:i,recordIds:n,description:N(t.description),costAllocationEnvironment:N(t.costAllocationEnvironment),tags:cB(t.tags),records:a.data,certificates:o.data};switch(r){case"route53":return V({...s,registrar:r,hostedZoneId:N(t.hostedZoneId)});case"external-delegated":{let u=N(t.delegatedSubdomain);if(u===void 0)return $({kind:"missing_field",field:"delegatedSubdomain"});let d=N(t.hostedZoneId);if(t.hostedZoneId!==void 0&&d===void 0)return $({kind:"invalid_literal",field:"hostedZoneId",reason:"must be a literal string zone id on external-delegated \u2014 dynamic expressions cannot be round-tripped"});let p=Je(t.adoptedNameServers);if(t.adoptedNameServers!==void 0&&p===void 0)return $({kind:"invalid_literal",field:"adoptedNameServers",reason:"must be an array of literal NS hostname strings \u2014 the parent NS UPSERT writes them verbatim"});if(d===void 0!=(p===void 0))return $({kind:"invalid_literal",field:d===void 0?"hostedZoneId":"adoptedNameServers",reason:"adopting an existing child zone requires hostedZoneId and adoptedNameServers together (both-or-neither) \u2014 an imported zone exposes no name-server attribute at synth"});let h=N(t.parentDelegationRoleArn);if(t.parentDelegationRoleArn!==void 0&&h===void 0)return $({kind:"invalid_literal",field:"parentDelegationRoleArn",reason:"must be a literal string ARN (VD2-a) \u2014 the CLI injects it via ManagedDomainBinding.delegationRoleArn; dynamic expressions such as Fn.importValue are not supported"});let g=ce(t.phase,Kz);return t.phase!==void 0&&g===void 0?$({kind:"invalid_literal",field:"phase",reason:`must be one of ${Kz.map(l=>`'${l}'`).join(", ")}`}):V({...s,registrar:r,delegatedSubdomain:u,hostedZoneId:d,adoptedNameServers:p,parentDelegationRoleArn:h,phase:g})}case"external-records":return V({...s,registrar:r})}}Xe(hI,"parseDomainProps");function eB(e){return Qz(e)}Xe(eB,"parseDomainErrorMessage");function tB(e,t,r){let i=We.createSourceFile(t,e,We.ScriptTarget.Latest,!0,We.ScriptKind.TS),n=fI(i);if(!n.success)return $(new Error(n.error.message));if(n.data===void 0)return $(new Error(`Domain '${r}': no 'new Domain(...)' call found in ${t} \u2014 the file is not a Fjall domain component.`));let a=hI(n.data.propsObjectLiteral);return a.success?V(a.data):$(new Error(`Domain '${r}': infrastructure.ts could not be parsed (${a.error.kind}).`))}Xe(tB,"parseDomainInfrastructureSource");function rB(e){if(e===void 0)return V([]);if(!Array.isArray(e))return $({kind:"invalid_literal",field:"records",reason:"must be an array"});let t=[];for(let r=0;r<e.length;r++){let i=e[r];if(!Z(i))return $({kind:"invalid_literal",field:`records[${r}]`,reason:"must be an object literal"});let n=nB(i,r);if(!n.success)return n;t.push(n.data)}return V(t)}Xe(rB,"parseRecordsArray");function nB(e,t){let r=N(e.type),i=N(e.name);if(r===void 0)return $({kind:"missing_field",field:`records[${t}].type`});if(i===void 0)return $({kind:"missing_field",field:`records[${t}].name`});let n=N(e.id);if(e.id!==void 0&&(n===void 0||!Ug.safeParse(n).success))return $({kind:"invalid_literal",field:`records[${t}].id`,reason:"must be a literal alphanumeric string starting with a letter \u2014 it becomes a CloudFormation logical-ID segment"});if(e.target!==void 0){if(!bre.some(d=>d===r))return $({kind:"invalid_literal",field:`records[${t}]`,reason:`alias records must have type 'A' or 'AAAA', got '${r}'`});let u=aB(e.target);return V({kind:"alias",type:r,name:i,target:u,...n!==void 0?{id:n}:{}})}if(!vre.some(u=>u===r))return $({kind:"invalid_literal",field:`records[${t}]`,reason:`unsupported record type '${r}'`});let a=iB(e.value);if(a===void 0)return $({kind:"invalid_literal",field:`records[${t}].value`,reason:`must be a string or array of strings (got ${JSON.stringify(e.value)})`});let o=q(e.ttl),s={kind:"standard",type:r,name:i,value:a,...o!==void 0?{ttl:o}:{},...n!==void 0?{id:n}:{}};return V(s)}Xe(nB,"parseRecord");function iB(e){if(e===void 0)return;if(typeof e=="string")return e;let t=Je(e);if(t!==void 0)return t}Xe(iB,"parseRecordValue");function aB(e){if(Jr(e))return oB(e);if(Z(e)){let t=ce(e.kind,Vz);if(t==="ecs"||t==="cdn"){let r=N(e.appName);if(r!==void 0)return{kind:t,appName:r}}if(t==="bucket"){let r=N(e.appName),i=N(e.bucketName);if(r!==void 0&&i!==void 0)return{kind:t,appName:r,bucketName:i}}if(t==="custom"){let r=N(e.dnsName),i=N(e.hostedZoneId);if(r!==void 0&&i!==void 0)return{kind:t,dnsName:r,hostedZoneId:i}}}return{kind:"unresolved",sourceText:Bg(e)}}Xe(aB,"parseTarget");function oB(e){let t=e.__call.trim(),r=t.match(/^([A-Za-z_][\w$]*)\s*\(([\s\S]*)\)\s*$/);if(!r)return{kind:"unresolved",sourceText:t};let i=r[1],n=r[2]??"",a=zg(n);switch(i){case"fjallApp":{let o=An(a,0);if(o===void 0)return{kind:"dynamic",sourceText:t};if(a.length<2)return{kind:"ecs",appName:o};let s=An(a,1);return s===void 0?{kind:"dynamic",sourceText:t}:{kind:"ecs",appName:o,computeName:s}}case"fjallCdn":{let o=An(a,0);if(o===void 0)return{kind:"dynamic",sourceText:t};if(a.length<2)return{kind:"cdn",appName:o};let s=An(a,1);return s===void 0?{kind:"dynamic",sourceText:t}:{kind:"cdn",appName:o,cdnName:s}}case"fjallBucket":{if(a.length<2)return{kind:"unresolved",sourceText:t};let o=An(a,0),s=An(a,1);return o===void 0||s===void 0?{kind:"dynamic",sourceText:t}:{kind:"bucket",appName:o,bucketName:s}}case"aliasTo":{if(a.length>=2){let o=An(a,0),s=An(a,1);return o!==void 0&&s!==void 0?{kind:"custom",dnsName:o,hostedZoneId:s}:{kind:"dynamic",sourceText:t}}if(a.length===1){let o=a[0]?.trim()??"",s=mI(o,"dnsName"),u=mI(o,"hostedZoneId");return s!==void 0&&u!==void 0?{kind:"custom",dnsName:s,hostedZoneId:u}:{kind:"dynamic",sourceText:t}}return{kind:"unresolved",sourceText:t}}default:return{kind:"unresolved",sourceText:t}}}Xe(oB,"resolveCallRefTarget");function zg(e){let t=[],r=0,i=null,n="";for(let o=0;o<e.length;o++){let s=e[o];if(i!==null){if(n+=s,s==="\\"&&o+1<e.length){let u=e[o+1];u!==void 0&&(n+=u,o+=1);continue}s===i&&(i=null);continue}if(s==='"'||s==="'"||s==="`"){i=s,n+=s;continue}if(s==="("||s==="{"||s==="["){r+=1,n+=s;continue}if(s===")"||s==="}"||s==="]"){r-=1,n+=s;continue}if(s===","&&r===0){t.push(n.trim()),n="";continue}n+=s}let a=n.trim();return a.length>0&&t.push(a),t}Xe(zg,"splitTopLevelArgs");function An(e,t){let r=e[t];if(r===void 0)return;let i=r.trim();if(i.length<2)return;let n=i[0],a=i[i.length-1];if(n===a&&!(n!=='"'&&n!=="'"&&n!=="`"))return i.slice(1,-1)}Xe(An,"extractStringLiteralArg");function mI(e,t){let r=e.trim().replace(/^\{|\}$/g,""),i=zg(r);for(let n of i){let a=n.indexOf(":");if(a<0||n.slice(0,a).trim().replace(/["'`]/g,"")!==t)continue;let o=n.slice(a+1).trim();return An([o],0)}}Xe(mI,"extractObjectFieldString");function sB(e){if(e===void 0)return V([]);if(!Array.isArray(e))return $({kind:"invalid_literal",field:"certificates",reason:"must be an array"});let t=[];for(let r=0;r<e.length;r++){let i=e[r];if(typeof i=="string"){t.push({domainName:i});continue}if(!Z(i))return $({kind:"invalid_literal",field:`certificates[${r}]`,reason:"must be a string or object literal"});let n=N(i.domainName);if(n===void 0)return $({kind:"missing_field",field:`certificates[${r}].domainName`});let a=Je(i.subjectAlternativeNames),o=ne(i.transparencyLogging),s=ne(i.cloudFront);if(i.cloudFront!==void 0&&s===void 0)return $({kind:"invalid_literal",field:`certificates[${r}].cloudFront`,reason:"must be a boolean literal \u2014 the CloudFront designation drives the zone-level us-east-1 export contract and cannot be round-tripped from a dynamic expression"});t.push({domainName:n,...a!==void 0?{subjectAlternativeNames:a}:{},...o!==void 0?{transparencyLogging:o}:{},...s!==void 0?{cloudFront:s}:{}})}return V(t)}Xe(sB,"parseCertificatesArray");function cB(e){if(e===void 0||!Z(e))return;let t={};for(let[r,i]of Object.entries(e)){let n=N(i);n!==void 0&&(t[r]=n)}return Object.keys(t).length===0?void 0:t}Xe(cB,"parseStringRecord");function Bg(e){if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e=="string")return JSON.stringify(e);if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return`[${e.map(t=>Bg(t)).join(", ")}]`;if(typeof e=="object"){if("__call"in e)return String(e.__call);if("__identifier"in e)return String(e.__identifier);if("__expression"in e)return String(e.__expression);if("__unknown"in e)return String(e.__unknown)}return String(e)}Xe(Bg,"stringifyParsedValue");var vy=Po(_r(),1);var Ere=Object.defineProperty,po=(e,t)=>Ere(e,"name",{value:t,configurable:!0}),qt=Symbol("non-literal");function xre(e,t){let r={};for(let i of e.properties){if(i.type!=="Property"&&i.type!=="ObjectProperty"||i.shorthand===!0||i.computed===!0)continue;let n=di(i.key);if(n===void 0||i.value===void 0)continue;let a=Gg(i.value);a!==qt&&(r[n]=a)}return{...r,...t}}po(xre,"buildMergedLiteral");function Are(e){let t=[];for(let r of e.properties){if(r.type!=="Property"&&r.type!=="ObjectProperty"||r.shorthand===!0||r.computed===!0)continue;let i=di(r.key);i!==void 0&&t.push(i)}return t}po(Are,"collectPropertyKeys");function Gg(e){let t=e.value;switch(e.type){case"StringLiteral":return typeof t=="string"?t:qt;case"NumericLiteral":return typeof t=="number"?t:qt;case"BooleanLiteral":return typeof t=="boolean"?t:qt;case"NullLiteral":return null;case"ArrayExpression":return uB(e);case"ObjectExpression":return lB(e);default:return qt}}po(Gg,"astToLiteral");function uB(e){let t=e.elements;if(!Array.isArray(t))return qt;let r=[];for(let i of t){if(!Se(i))return qt;let n=Gg(i);if(n===qt)return qt;r.push(n)}return r}po(uB,"arrayToLiteral");function lB(e){let t=e.properties;if(!Array.isArray(t))return qt;let r={};for(let i of t){if(!Se(i)||i.type!=="Property"&&i.type!=="ObjectProperty")return qt;let n=di(i.key),a=i.value;if(n===void 0||a===void 0)return qt;let o=Gg(a);if(o===qt)return qt;r[n]=o}return r}po(lB,"objectToLiteral");function di(e){if(e===void 0)return;let t=e;if(e.type==="Identifier"&&typeof t.name=="string")return t.name;if(e.type==="StringLiteral"&&typeof t.value=="string")return t.value}po(di,"readKeyName");function Se(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}po(Se,"isNodeShape");var x2=Po(E2(),1),rie=Object.defineProperty,Eo=(e,t)=>rie(e,"name",{value:t,configurable:!0}),A2="\uFEFF",my=65279;function nie(e,t){let r=Bd(t),i=T2(e),n=x2.print(e,{quote:i,lineTerminator:r,trailingComma:!0}).code,a=_2(n,t),o=t.charCodeAt(0)===my,s=a.charCodeAt(0)===my;return o&&!s?`${A2}${a}`:a}Eo(nie,"printFile");var iie=/^(#![^\n\r]*)((?:\r?\n)*)/;function _2(e,t){let r=t.charCodeAt(0)===my?t.slice(1):t,i=iie.exec(r);if(i===null)return e;let n=i[1],a=i[2]??"";if(n===void 0)return e;let o=Eo(p=>p!==""&&a===""?Bd(t):a,"separatorOrFloor"),s=e.charCodeAt(0)===my,u=s?A2:"",d=s?e.slice(1):e;if(d.startsWith(n)){let p=d.slice(n.length).replace(/^(?:\r?\n)*/,"");return`${u}${n}${o(p)}${p}`}return d.startsWith("#!")?e:`${u}${n}${o(d)}${d}`}Eo(_2,"restoreShebangPrefix");function Bd(e){return e.includes(`\r
|
|
619
619
|
`)?`\r
|
|
620
620
|
`:`
|
|
621
621
|
`}Eo(Bd,"detectLineTerminator");function T2(e){let t=0,r=0;return C2(e,i=>{if(i.type!=="StringLiteral"&&i.type!=="Literal")return;let n=i.extra;if(!zd(n))return;let a=n.raw;if(typeof a!="string"||a.length===0)return;let o=a.charAt(0);o==="'"?t+=1:o==='"'&&(r+=1)}),t>r?"single":"double"}Eo(T2,"detectQuoteStyle");function C2(e,t){let r=[e];for(;r.length>0;){let i=r.pop();if(!(!zd(i)||typeof i.type!="string")){t(i);for(let n of Object.keys(i)){if(n==="loc"||n==="comments"||n==="tokens")continue;let a=i[n];if(Array.isArray(a))for(let o of a)zd(o)&&typeof o.type=="string"&&r.push(o);else zd(a)&&typeof a.type=="string"&&r.push(a)}}}}Eo(C2,"visit");function zd(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}Eo(zd,"isRecord");var aie=Object.defineProperty,fy=(e,t)=>aie(e,"name",{value:t,configurable:!0});function Ht(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}fy(Ht,"isRecord");function oie(e){if(!Ht(e))return;let t=e.program;if(!Ht(t))return;let r=t.body;if(Array.isArray(r)&&r.every(Ht))return r}fy(oie,"extractProgramBody");function nD(e,t){return e.length===0?0:e.split(t).length}fy(nD,"countLines");function sie(e,t){let r=Bd(e),i=nD(t,r)-nD(e,r);return i>=0?{added:i,removed:0}:{added:0,removed:-i}}fy(sie,"computeLinesDelta");var cie=Object.defineProperty,en=(e,t)=>cie(e,"name",{value:t,configurable:!0});function uie(e){let t=I2(e),r=D2(e),i=en(n=>t.get(n)===1?r.get(n):void 0,"initFor");return{resolveString(n){let a=i(n);return a===void 0?void 0:iD(a)},resolveStringArray(n){let a=i(n);if(a===void 0)return;let o=sa(a);if(o.type!=="ArrayExpression")return;let s=o.elements;if(!Array.isArray(s))return;let u=[];for(let d of s){if(!Se(d))return;let p=iD(d);if(p===void 0)return;u.push(p)}return u},objectKeysOf:en(n=>hy(n,i,new Set),"objectKeysOf")}}en(uie,"buildModuleConstResolver");function iD(e){let t=sa(e);if(t.type==="StringLiteral"){let r=t.value;return typeof r=="string"?r:void 0}if(t.type==="TemplateLiteral"){let r=t.expressions,i=t.quasis;if(!Array.isArray(r)||r.length!==0||!Array.isArray(i)||i.length!==1)return;let[n]=i;return!Ht(n)||!Ht(n.value)?void 0:typeof n.value.cooked=="string"?n.value.cooked:void 0}}en(iD,"readStaticString");var lie=new Set(["TSAsExpression","TSSatisfiesExpression","TSTypeAssertion","TSNonNullExpression","ParenthesizedExpression"]);function sa(e){let t=e;for(;lie.has(t.type);){let r=t.expression;if(!Se(r))return t;t=r}return t}en(sa,"unwrapTsWrappers");function hy(e,t,r){let i=sa(e);if(i.type==="Identifier"){let o=i.name;if(typeof o!="string"||r.has(o))return;r.add(o);let s=t(o);return s===void 0?void 0:hy(s,t,r)}if(i.type!=="ObjectExpression")return;let n=i.properties;if(!Array.isArray(n))return;let a=[];for(let o of n){if(!Se(o))return;if(o.type==="SpreadElement"||o.type==="SpreadProperty"){let d=o.argument;if(!Se(d))return;let p=hy(d,t,r);if(p===void 0)return;a.push(...p);continue}if(o.type!=="Property"&&o.type!=="ObjectProperty"&&o.type!=="ObjectMethod"||o.computed===!0)return;let s=o.key;if(!Se(s))return;let u=di(s);if(u===void 0)return;a.push(u)}return a}en(hy,"objectKeysOfNode");function I2(e){let t=new Map,r=en(a=>{t.set(a,(t.get(a)??0)+1)},"bump"),i=en(a=>{if(Se(a))switch(a.type){case"Identifier":{let o=a.name;typeof o=="string"&&r(o);return}case"ObjectPattern":{let o=a.properties;if(!Array.isArray(o))return;for(let s of o)Se(s)&&(s.type==="RestElement"||s.type==="RestProperty"?i(s.argument):i(s.value));return}case"ArrayPattern":{let o=a.elements;if(!Array.isArray(o))return;for(let s of o)i(s);return}case"AssignmentPattern":i(a.left);return;case"RestElement":i(a.argument);return;case"TSParameterProperty":i(a.parameter);return;default:return}},"bumpPattern"),n=en(a=>{let o=[a];for(;o.length>0;){let s=o.pop();if(Ht(s)){if(typeof s.type=="string"){let u=s;switch(u.type){case"VariableDeclarator":i(u.id);break;case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":{i(u.id);let d=u.params;if(Array.isArray(d))for(let p of d)i(p);break}case"ClassDeclaration":case"ClassExpression":i(u.id);break;case"ImportSpecifier":case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":i(u.local);break;case"CatchClause":i(u.param);break;default:break}}for(let u of Object.keys(s)){if(u==="loc"||u==="comments"||u==="tokens")continue;let d=s[u];if(Array.isArray(d))for(let p of d)Ht(p)&&o.push(p);else Ht(d)&&o.push(d)}}}},"visitForBindings");for(let a of e)n(a);return t}en(I2,"countBindings");function D2(e){let t=new Map;for(let r of e){let i=r.type==="ExportNamedDeclaration"?r.declaration:r;if(!Se(i)||i.type!=="VariableDeclaration"||i.kind!=="const")continue;let n=i.declarations;if(Array.isArray(n))for(let a of n){if(!Se(a)||a.type!=="VariableDeclarator")continue;let o=a.id,s=a.init;if(!Se(o)||o.type!=="Identifier"||!Se(s))continue;let u=o.name;typeof u=="string"&&t.set(u,s)}}return t}en(D2,"collectTopLevelConstInits");var die=Object.defineProperty,gy=(e,t)=>die(e,"name",{value:t,configurable:!0});function pie(e,t){return e.properties.find(r=>(r.type==="Property"||r.type==="ObjectProperty")&&r.shorthand!==!0&&r.computed!==!0&&di(r.key)===t)}gy(pie,"findPropertyByKey");function mie(e,t){return!e.properties.some(r=>r.type==="SpreadElement"||r.type==="SpreadProperty"?!0:r.type!=="Property"&&r.type!=="ObjectProperty"?!1:r.computed===!0?!0:r.shorthand===!0&&di(r.key)===t)}gy(mie,"objectAbsenceIsProvable");function fie(e,t){e.properties[e.properties.length-1]?.extra?.trailingComma===!0&&(t.extra={...t.extra??{},trailingComma:!0}),e.properties.push(t)}gy(fie,"pushPropertyPreservingComma");function yy(e,t){let r=[e];for(;r.length>0;){let i=r.pop();if(Ht(i)){typeof i.type=="string"&&t(i);for(let n of Object.keys(i)){if(n==="loc"||n==="comments"||n==="tokens")continue;let a=i[n];if(Array.isArray(a))for(let o of a)Ht(o)&&r.push(o);else Ht(a)&&r.push(a)}}}}gy(yy,"visit");var hie=Object.defineProperty,xo=(e,t)=>hie(e,"name",{value:t,configurable:!0});function oD(e,t,r){let i=[];for(let p=0;p<e.length;p++){let h=e[p];if(h===void 0)continue;let g=!1;yy(h,l=>{l.type==="CallExpression"&&by(l,t.factory,r)&&(g=!0)}),g&&i.push({statementIndex:p})}if(i.length===0)return $({kind:"statement-not-found"});if(i.length>1)return $({kind:"ambiguous",count:i.length});let n=i[0];if(n===void 0)return $({kind:"statement-not-found"});let a=e[n.statementIndex];if(a===void 0)return $({kind:"statement-not-found"});let o=a.type==="ExportNamedDeclaration"||a.type==="ExportDefaultDeclaration",s=sD(a);if(s===void 0)return $({kind:"unbindable-statement",statementType:a.type});if(s.type==="VariableDeclaration"){let p=s.declarations;if(!Array.isArray(p)||p.length!==1)return $({kind:"multiple-declarators"});let h=p[0].id;if(!Se(h)||h.type!=="Identifier")return $({kind:"pattern-binding"});let g=h.name;if(typeof g!="string")return $({kind:"unreadable-name"});let l=p[0].init;return!Se(l)||!aD(l,t,r)?$({kind:"init-not-app-method-wrap"}):V({variableName:g,resourceName:r,statementIndex:n.statementIndex})}if(o)return $({kind:"unbindable-statement",statementType:a.type});if(s.type!=="ExpressionStatement")return $({kind:"unbindable-statement",statementType:s.type});let u=s.expression;if(!Se(u)||u.type!=="CallExpression")return $({kind:"not-app-method-call"});if(by(u,t.factory,r))return $({kind:"bare-factory-call"});if(!aD(u,t,r))return $({kind:"foreign-wrapper"});let d=xr(r);return Wi.has(d)?$({kind:"reserved-word",variableName:d}):k2(e,d)?$({kind:"name-conflict",variableName:d}):V({variableName:d,resourceName:r,statementIndex:n.statementIndex,wrap:{statementIndex:n.statementIndex,expression:u}})}xo(oD,"planBinding");function gie(e,t){if(t.wrap===void 0)return;let{statementIndex:r,expression:i}=t.wrap,n=e[r],a=vy.builders.variableDeclaration("const",[vy.builders.variableDeclarator(vy.builders.identifier(t.variableName),i)]),o=n?.comments;o!==void 0&&(a.comments=o),e[r]=a}xo(gie,"applyBinding");function by(e,t,r){let i=e.callee;if(!Se(i)||i.type!=="MemberExpression"||i.computed===!0)return!1;let n=i.object,a=i.property;if(!Se(n)||n.type!=="Identifier"||n.name!==t||!Se(a)||a.type!=="Identifier"||a.name!=="build")return!1;let o=e.arguments;if(!Array.isArray(o))return!1;let s=o[0];return!Se(s)||s.type!=="StringLiteral"&&s.type!=="Literal"?!1:s.value===r}xo(by,"isFactoryBuildOf");function sD(e){if(e.type!=="ExportNamedDeclaration"&&e.type!=="ExportDefaultDeclaration")return e;let t=e.declaration;return Se(t)?t:void 0}xo(sD,"unwrapExportDeclaration");function w2(e){let t=sa(e);if(t.type!=="CallExpression")return;let r=t.callee;if(!Se(r)||r.type!=="MemberExpression"||r.computed===!0)return;let i=r.property;if(!Se(i)||i.type!=="Identifier")return;let n=i.name;return typeof n=="string"?n:void 0}xo(w2,"appMethodNameOf");function aD(e,t,r){let i=sa(e);if(w2(i)!==t.appMethod)return!1;let n=i.arguments;if(!Array.isArray(n))return!1;let a=n[0];return Se(a)?by(sa(a),t.factory,r):!1}xo(aD,"isAppMethodWrap");function k2(e,t){for(let r of e){let i=sD(r);if(i!==void 0){if(i.type==="ImportDeclaration"){let n=i.specifiers;if(!Array.isArray(n))continue;for(let a of n){let o=a.local;if(Se(o)&&o.name===t)return!0}continue}if(i.type==="VariableDeclaration"){let n=i.declarations;if(!Array.isArray(n))continue;for(let a of n){if(!Se(a))continue;let o=a.id;if(!Se(o))continue;let s=!1;if(yy(o,u=>{u.type==="Identifier"&&u.name===t&&(s=!0)}),s)return!0}continue}if(i.type==="FunctionDeclaration"||i.type==="ClassDeclaration"){let n=i.id;if(Se(n)&&n.name===t)return!0}}}return!1}xo(k2,"moduleScopeDeclares");var yie=Object.defineProperty,Fc=(e,t)=>yie(e,"name",{value:t,configurable:!0}),vie={cdn:{default:["storage","compute"]},compute:{perKey:{connectedDatabase:["database"],connectedStorage:["storage"],connectedMessaging:["messaging"]}}};function bie(e,t,r={}){let i=vie[e],n=[],a=Fc((o,s)=>{let u=t();if(u===void 0)return;let d=(s!==void 0?i?.perKey?.[s]:void 0)??i?.default??[],p=[];for(let l of d){let m=ai[l].emitWrapper?.appMethod;if(m===void 0)continue;let f=oD(u,{factory:Gt[l],appMethod:m},o);if(f.success){p.push(f.data);continue}if(f.error.kind!=="statement-not-found")return}if(p.length!==1)return;let h=p[0];if(h===void 0)return;let g=r.mustPrecedeStatementIndex;if(!(g!==void 0&&h.statementIndex>=g))return h.wrap!==void 0&&n.push({plan:h,...s!==void 0&&{planKey:s}}),h.variableName},"resolveBinding");return{resolveBinding:a,resolveBindings:Fc((o,s)=>{let u=n.length,d=[];for(let p of o){let h=a(p,s);if(h===void 0){n.length=u;return}d.push(h)}return d},"resolveBindings"),takePendingWraps:Fc(()=>{let o=n;return n=[],o.map(s=>s.plan)},"takePendingWraps"),pendingDeclarations:Fc(()=>n.map(({plan:o,planKey:s})=>({variableName:o.variableName,resourceName:o.resourceName,statementIndex:o.statementIndex,...s!==void 0&&{planKey:s}})),"pendingDeclarations")}}Fc(bie,"createSiblingBindingResolution");function cD(e){let t=new Map;for(let r of e){let i=t.get(r.variableName);if(i===void 0){t.set(r.variableName,r);continue}if(i.statementIndex!==r.statementIndex)return{first:i,second:r}}}Fc(cD,"findPendingWrapCollision");var Sie=Object.defineProperty,Fr=(e,t)=>Sie(e,"name",{value:t,configurable:!0});function N2(e){return e?.map(t=>({name:t.name,...t.serviceType!==void 0&&{serviceType:t.serviceType},...t.docker!==void 0&&{docker:t.docker},...t.containerPort!==void 0&&{containerPort:t.containerPort},...t.needsDatabaseConnection!==void 0&&{needsDatabaseConnection:t.needsDatabaseConnection},...t.routing!==void 0&&{routing:t.routing}}))}Fr(N2,"toUserServiceConfigs");function P2(e,t,r=!0,i,n){let a={appName:e,type:t,database:[],s3:[],compute:[]};if(t==="custom")return a;let o=t,s=si[o];return{...a,database:R2(e,s,o,r,n),compute:M2(e,s,o,r,i),network:s.network,backup:s.backup}}Fr(P2,"planApplicationResources");function R2(e,t,r,i,n){let a=gC(r),o=t.database[a];return!i||o===null?[]:[{name:e,type:a,databaseName:Ro(e),variableName:`${xr(e)}Database`,...o,...n?.snapshotIdentifier!==void 0&&{snapshotIdentifier:n.snapshotIdentifier},...n?.snapshotUsername!==void 0&&{snapshotUsername:n.snapshotUsername}}]}Fr(R2,"buildDatabasePlan");function O2(e,t){if(!(e===void 0&&t===void 0))return{scaling:{...e!==void 0&&{minCapacity:e},...t!==void 0&&{maxCapacity:t}}}}Fr(O2,"buildScalingConfig");function uD(e){let{minCapacity:t,maxCapacity:r,...i}=e;return{...i,...O2(t,r)}}Fr(uD,"planServiceFromTierPreset");function $2(e,t){let r=uD(e),i=t?.serviceType==="worker",n=t?.containerPort??oj,a=t?.docker;return{...r,...a?.path!==void 0&&{docker:{path:a.path,...a.context!==void 0&&{context:a.context},...a.target!==void 0&&{target:a.target}}},...t?.needsDatabaseConnection!==void 0&&{needsDatabaseConnection:t.needsDatabaseConnection},...i&&{serviceType:"worker"},containers:i?[{}]:[{port:n}]}}Fr($2,"buildServiceEntry");function j2(e,t){return t||e?.directAccess===!0?e:{...e,loadBalancer:!1}}Fr(j2,"resolveClusterConfig");function M2(e,t,r,i,n){let a=t.compute.ecs,o=(n&&n.length>0?yC(r,n):a.services.map((u,d)=>({...u,name:d===0?"api":`service-${d+1}`}))).map((u,d)=>$2(u,n?.[d])),s=o.some(u=>u.containers?.some(d=>d.port!==void 0));return[{name:e,type:ul.ECS,needsConnection:i,connectedDatabase:i?[e]:void 0,variableName:`${xr(e)}Compute`,cluster:j2(a.cluster,s),services:o}]}Fr(M2,"buildComputePlan");function F2(e){let t=[],r=0,i=Fr((a,o,s)=>{t.push({variableName:a,resourceName:o,statementIndex:r++,planKey:s})},"declare");for(let a of e.additionalNetworks??[])i(xr(a.name),a.name,"additionalNetworks");if(uc(e))return t;for(let a of e.database)Vl(a,e)&&i(ke(a),a.name,"database");for(let a of e.clickhouse??[])Wl(a,e)&&i(ke(a),a.name,"clickhouse");for(let a of e.s3)rd(a,e)&&i(ke(a),a.name,"s3");for(let a of e.dynamodb??[])i(ke(a),a.name,"dynamodb");for(let a of e.sqs??[])nd(a,e)&&i(ke(a),a.name,"sqs");let n=ld(e);for(let a of e.compute)(n.has(a.name)||a.scheduleExpression!==void 0)&&i(ke(a),a.name,"compute");return t}Fr(F2,"collectPlannedDeclarations");function L2(e){let t=[],r=/^const\s+([A-Za-z_$][A-Za-z0-9_$]*)\s*=/gm,i=ud(e),n=-1,a;for(;(a=r.exec(i))!==null;){let o=a[1];o!==void 0&&t.push({variableName:o,resourceName:o,statementIndex:n--,planKey:"prelude"})}return t}Fr(L2,"collectPreludeDeclarations");function Lc(e,t){let r=F2(e),i=r.find(s=>Wi.has(s.variableName));if(i!==void 0)return $(new Error(`Cannot generate infrastructure: ${i.planKey} resource "${i.resourceName}" binds the module-scope const \`${i.variableName}\`, a JavaScript reserved word \u2014 the generated file would not parse. Rename the resource, or give it a distinct variableName in the plan.`));let n=cD([...L2(e),...r]);if(n!==void 0)return n.first.planKey==="prelude"?$(new Error(`Cannot generate infrastructure: ${n.second.planKey} resource "${n.second.resourceName}" binds the module-scope const \`${n.first.variableName}\`, which the scaffold prelude itself declares \u2014 the generated file would not compile (Identifier '${n.first.variableName}' has already been declared). Rename the resource, or give it a distinct variableName in the plan.`)):$(new Error(`Cannot generate infrastructure: ${n.first.planKey} resource "${n.first.resourceName}" and ${n.second.planKey} resource "${n.second.resourceName}" both bind the module-scope const \`${n.first.variableName}\` \u2014 the generated file would not compile (Identifier '${n.first.variableName}' has already been declared). Rename one of the resources, or give one a distinct variableName in the plan.`));if(!uc(e)){let s=lg(e);if(s!==void 0)return $(new Error(`Cannot generate infrastructure: compute resource "${s.resourceName}" key \`${s.key}\` cannot be emitted \u2014 ${s.reason}`))}let a=[Sg(e),ud(e),bg(e)];if(uc(e))a.push(od(e),cd(e));else{let s=ld(e);a.push(cd(e),eg(e),tg(e),pg(e),mg(e),fg(e),dg(e,s),Eg(e))}let o=a.join("");if(e.customCodeBlocks&&e.customCodeBlocks.length>0){let s=Lg(o,e.customCodeBlocks,t?.resourceMapping);return s.success?V(s.content):$(new Error(`Custom code injection failed: ${s.error??"unknown error"}`))}return V(o)}Fr(Lc,"generateInfrastructureFromPlan");var Eie=Object.defineProperty,Uc=(e,t)=>Eie(e,"name",{value:t,configurable:!0}),xie=hC("standard");function U2(e){return Tl.options.some(t=>t.shape?.type?.value===e)}Uc(U2,"isPatternConfigType");function z2(e,t,r){let{tier:i="standard",domain:n,database:a,compute:o,cdn:s,environment:u,tags:d}=r??{},p=Ag(i);if(!p&&i!=="custom")return $(new Error(`Invalid pattern tier: "${i}". Valid tiers are: ${[...pd,"custom"].join(", ")}`));if(!U2(t))return $(new Error(`Unsupported pattern type: ${t}`));let h=p?xg(i):null,g=W2(t,e,{domain:n,database:a,compute:o,cdn:s,environment:u,tierPreset:h});if(!g.success)return g;let l=g.data;return V({appName:e,type:"standard",pattern:t,network:h?h.network:xie,backup:h?h.backup:!1,patternConfig:l,database:[],s3:[],compute:[],tags:d??{}})}Uc(z2,"planOpenNextResources");function B2(e,t){return{type:e?.type??t.database.type,instanceType:e?.instanceType??t.database.instanceType,...e?.backupRetention!==void 0&&{backupRetention:e.backupRetention},deletionProtection:e?.deletionProtection??t.database.deletionProtection,...e?.databaseName!==void 0&&{databaseName:e.databaseName},...e?.publiclyAccessible!==void 0&&{publiclyAccessible:e.publiclyAccessible},...e?.allowedIpCidr!==void 0&&{allowedIpCidr:e.allowedIpCidr},...e?.encryption!==void 0&&{encryption:e.encryption}}}Uc(B2,"mergeDatabaseConfig");function G2(e,t){return{memorySize:e?.memorySize??t.compute.memorySize,timeout:e?.timeout??t.compute.timeout}}Uc(G2,"mergeComputeConfig");function V2(e){let{encryption:t,...r}=e;return{...r,...t&&{encryption:{storageKey:t}}}}Uc(V2,"toPatternDatabaseConfig");function W2(e,t,r){let{domain:i,database:n,compute:a,cdn:o,environment:s,tierPreset:u}=r,d=u?B2(n,u):n,p=u?G2(a,u):a,h={type:e,name:t,domain:i,database:d?V2(d):void 0,compute:p?{server:p}:void 0,cdn:o?{domainNames:o.domainNames,certificateArn:o.certificateArn}:void 0,environment:s},g=Tl.safeParse(h);return g.success?V(g.data):$(new Error(`Invalid pattern config: ${g.error.message}`))}Uc(W2,"buildPatternConfig");var Aie=Object.defineProperty,_ie=(e,t)=>Aie(e,"name",{value:t,configurable:!0});function K2(e,t){let r={type:"staticsite",name:e,source:t.source,build:t.build,...t.routing!==void 0&&{routing:t.routing},...t.security!==void 0&&{security:t.security},...t.domain!==void 0&&{domain:t.domain},...t.forms!==void 0&&{forms:t.forms},...t.cdn!==void 0&&{cdn:t.cdn}},i=_l.safeParse(r);return i.success?V({appName:e,type:"standard",pattern:"staticsite",patternConfig:i.data,database:[],s3:[],compute:[],tags:t.tags??{}}):$(new Error(`Invalid static-site pattern config: ${i.error.message}`))}_ie(K2,"planStaticSiteResources");var Tie=Object.defineProperty,Sy=(e,t)=>Tie(e,"name",{value:t,configurable:!0});function q2(e){let t=e.split("/");if(t.length!==2||!t[0]||!t[1])throw new Error(`Invalid service reference format: '${e}'. Expected 'ClusterName/ServiceName'.`);return t[0]}Sy(q2,"parseServiceReference");function lD(e,t,r){r==="database"?(e.needsConnection=!0,e.connectedDatabase=[...new Set([...e.connectedDatabase??[],t])]):e.connectedStorage=[...new Set([...e.connectedStorage??[],t])]}Sy(lD,"addResourceConnection");function zc(e,t,r,i){let n=new Set(t),a=[...new Set(t.map(q2))];for(let o of a){let s=e.compute.find(u=>u.name===o);if(s?.services){lD(s,r,i);for(let u of s.services){let d=`${o}/${u.name}`;n.has(d)&&(i==="database"?u.needsDatabaseConnection=!0:u.needsStorageConnection=!0)}}}}Sy(zc,"applyServiceConnections");function Ao(e,t,r,i){for(let n of e.compute)if(t.includes(n.name)&&(lD(n,r,i),n.services))for(let a of n.services)i==="database"?a.needsDatabaseConnection=!0:a.needsStorageConnection=!0}Sy(Ao,"applyComputeConnections");var Cie=Object.defineProperty,ot=(e,t)=>Cie(e,"name",{value:t,configurable:!0});function Z2(e){let t=e.database.length>0,r=e.cdn!==void 0;return[{type:"database",label:"Database (RDS)",available:!0},{type:"database:proxy",label:"RDS Proxy",available:t,reason:t?void 0:"Requires at least one database"},{type:"storage:s3",label:"S3 Bucket",available:!0},{type:"network",label:"Network (VPC)",available:!0},{type:"compute:ecs",label:"Compute (ECS)",available:!0},{type:"compute:lambda",label:"Compute (Lambda)",available:!0},{type:"cdn",label:"CDN (CloudFront)",available:!r,reason:r?"A CDN is already configured. Remove existing CDN first.":void 0},{type:"tunnel",label:"Database Tunnel",available:t&&!e.tunnel,reason:t?e.tunnel?"Tunnel is already enabled":void 0:"Requires at least one database"}]}ot(Z2,"listAvailableResources");function Gd(e,t){if(pD(e,t.resourceName))return $(new Error(mD(t.resourceName)));switch(t.type){case"database":return H2(e,t);case"database:proxy":return J2(e,t);case"storage:s3":return V(void 0);case"network":return V(void 0);case"compute:ecs":return!t.services||t.services.length===0?$(new Error("ECS compute requires at least one service.")):V(void 0);case"compute:lambda":return V(void 0);case"cdn":return X2(e,t);case"tunnel":return Y2(e);default:{let r=t;return $(new Error(`Unknown resource type: ${String(r)}`))}}}ot(Gd,"validateResourceAddition");function H2(e,t){let r=t.databaseName??t.resourceName.toLowerCase();return e.database.some(i=>i.databaseName===r)?$(new Error(`Database name '${r}' already exists. Choose a different database name.`)):t.databaseType==="GlobalAurora"&&!t.primaryRegion?$(new Error("GlobalAurora databases require a primaryRegion.")):V(void 0)}ot(H2,"validateDatabaseAddition");function J2(e,t){let r=e.database.find(i=>i.name===t.targetDatabase||i.databaseName===t.targetDatabase);if(!r){let i=e.database.map(n=>n.name).join(", ")||"none";return $(new Error(`Database '${t.targetDatabase}' not found. Available databases: ${i}`))}return r.proxy!==void 0&&r.proxy!==!1?$(new Error(`Database '${r.name}' already has RDS Proxy enabled.`)):V(void 0)}ot(J2,"validateProxyAddition");function X2(e,t){if(e.cdn)return $(new Error("A CDN is already configured for this application. Remove the existing CDN first."));if(!dD(e,t.defaultOriginRef))return $(new Error(`Origin '${t.defaultOriginRef}' not found in plan. CDN origin must reference an existing resource.`));if(t.behaviours){for(let r of t.behaviours)if(!dD(e,r.originRef))return $(new Error(`Behaviour origin '${r.originRef}' not found in plan.`))}return V(void 0)}ot(X2,"validateCdnAddition");function Y2(e){return e.tunnel&&typeof e.tunnel=="object"?$(new Error("Tunnel is already enabled for this application.")):e.database.length===0?$(new Error("No databases found \u2014 tunnel requires at least one relational database.")):V(void 0)}ot(Y2,"validateTunnelAddition");function Ey(e,t){let r=Gd(e,t);if(!r.success)return r;switch(t.type){case"database":return Q2(e,t);case"database:proxy":return e4(e,t);case"storage:s3":return t4(e,t);case"network":return r4(e,t);case"compute:ecs":return n4(e,t);case"compute:lambda":return i4(e,t);case"cdn":return a4(e,t);case"tunnel":return o4(e,t);default:{let i=t;return $(new Error(`Unknown resource type: ${String(i)}`))}}}ot(Ey,"addResourceToPlan");function Q2(e,t){let r=t.databaseName??t.resourceName.toLowerCase(),i={name:t.resourceName,type:t.databaseType,databaseName:r},n;switch(t.databaseType){case"Instance":n={...i,...t.instanceType!==void 0?{instanceType:t.instanceType}:{},...t.multiAz!==void 0?{multiAz:t.multiAz}:{},...t.readReplica!==void 0?{readReplica:t.readReplica}:{},...t.publiclyAccessible!==void 0?{publiclyAccessible:t.publiclyAccessible}:{},...t.backupRetention!==void 0?{backupRetention:t.backupRetention}:{}};break;case"Aurora":n={...i,...t.writer!==void 0?{writer:t.writer}:{},...t.readers!==void 0?{readers:t.readers}:{},...t.backupRetention!==void 0?{backupRetention:t.backupRetention}:{},...t.preferredMaintenanceWindow!==void 0?{preferredMaintenanceWindow:t.preferredMaintenanceWindow}:{}};break;case"GlobalAurora":n={...i,primaryRegion:t.primaryRegion,...t.secondaryRegions!==void 0?{secondaryRegions:t.secondaryRegions}:{}};break;default:{let o=t.databaseType;return $(new Error(`Unknown database type: ${String(o)}`))}}let a={...e,database:[...e.database,n]};return fD(a,t.resourceName,"database",t),V(a)}ot(Q2,"addDatabase");function e4(e,t){let r=e.database.map(a=>({...a})),i=r.find(a=>a.name===t.targetDatabase||a.databaseName===t.targetDatabase);if(!i)return $(new Error(`Database '${t.targetDatabase}' not found.`));let n={};return t.maxConnections!==void 0&&(n.maxConnections=t.maxConnections),t.maxIdleConnections!==void 0&&(n.maxIdleConnections=t.maxIdleConnections),t.connectionBorrowTimeout!==void 0&&(n.connectionBorrowTimeout=t.connectionBorrowTimeout),t.requireTLS!==void 0&&(n.requireTLS=t.requireTLS),i.proxy=Object.keys(n).length>0?n:{},V({...e,database:r})}ot(e4,"addProxy");function t4(e,t){let r=t.bucketName??t.resourceName.toLowerCase(),i=ct(r),n=e.s3.length,a=n===0?"":`${n+1}`,o={name:i,bucketName:r,variableName:`bucket${a}`,...t.publicReadAccess!==void 0?{publicReadAccess:t.publicReadAccess}:{},...t.versioned!==void 0?{versioned:t.versioned}:{},...t.encryption!==void 0?{encryption:t.encryption}:{},...t.websiteHosting?{websiteHosting:{indexDocument:"index.html"}}:{}},s={...e,s3:[...e.s3,o]};return fD(s,i,"storage",t),V(s)}ot(t4,"addS3");function r4(e,t){let r={};if(t.maxAzs!==void 0&&(r.maxAzs=t.maxAzs),t.natGateways!==void 0&&(r.natGateways=t.natGateways),t.flowLogs!==void 0&&(r.flowLogs=t.flowLogs),t.vpcEndpoints!==void 0&&(r.vpcEndpoints=t.vpcEndpoints),t.networkName){let i={name:t.networkName,...r};return V({...e,additionalNetworks:[...e.additionalNetworks??[],i]})}return V({...e,network:{...e.network??{},...r}})}ot(r4,"addNetwork");function n4(e,t){let r=t.connectedDatabase??[],i={name:t.resourceName,type:"ecs",needsConnection:r.length>0,connectedDatabase:r,...t.loadBalancer!==void 0?{cluster:{loadBalancer:t.loadBalancer}}:{},services:t.services.map(n=>({name:n.name,capacityProvider:n.capacityProvider??"FARGATE",...n.port!==void 0?{containers:[{port:n.port}]}:{},...n.cpu!==void 0?{cpu:n.cpu}:{},...n.memory!==void 0?{memoryLimitMiB:n.memory}:{}})),...t.docker!==void 0&&{docker:t.docker}};return V({...e,compute:[...e.compute,i]})}ot(n4,"addEcsCompute");function i4(e,t){let r=t.connectedDatabase??[],i={name:t.resourceName,type:"lambda",needsConnection:r.length>0,connectedDatabase:r,...t.timeout!==void 0?{timeout:t.timeout}:{},...t.memory!==void 0?{memory:t.memory}:{},...t.handler!==void 0?{handler:t.handler}:{},...t.runtime!==void 0?{runtime:t.runtime}:{}};return V({...e,compute:[...e.compute,i]})}ot(i4,"addLambdaCompute");function a4(e,t){let r={name:t.resourceName,defaultOriginRef:t.defaultOriginRef,...t.customDomain!==void 0?{customDomain:t.customDomain}:{},...t.certificateArn!==void 0?{certificateArn:t.certificateArn}:{},...t.domain!==void 0?{domain:t.domain}:{},...t.originHostname!==void 0?{originHostname:t.originHostname}:{},...t.behaviours&&t.behaviours.length>0?{behaviours:[...t.behaviours].map(i=>({pathPattern:i.pathPattern,originRef:i.originRef,...i.cachePolicy!==void 0?{cachePolicy:i.cachePolicy}:{}}))}:{}};return V({...e,cdn:r})}ot(a4,"addCdn");function o4(e,t){let r=t.instanceType?{instanceType:t.instanceType}:{};return V({...e,tunnel:r})}ot(o4,"addTunnel");function pD(e,t){let r=[...e.database.map(i=>i.name),...(e.clickhouse??[]).map(i=>i.name),...e.s3.map(i=>i.name),...e.compute.map(i=>i.name),...(e.dynamodb??[]).map(i=>i.name),...(e.sqs??[]).map(i=>i.name),...(e.additionalNetworks??[]).map(i=>i.name)];return e.cdn&&r.push(e.cdn.name),r.includes(t)}ot(pD,"isResourceNameTaken");function mD(e){return`Resource name '${e}' is already used in this application.`}ot(mD,"resourceNameTakenMessage");function dD(e,t){return e.database.some(r=>r.name===t)||e.s3.some(r=>r.name===t)||e.compute.some(r=>r.name===t)||(e.dynamodb??[]).some(r=>r.name===t)||(e.sqs??[]).some(r=>r.name===t)}ot(dD,"resourceExistsInPlan");function fD(e,t,r,i){i.connectToCompute&&i.connectToCompute.length>0&&Ao(e,[...i.connectToCompute],t,r),i.connectToServices&&i.connectToServices.length>0&&zc(e,[...i.connectToServices],t,r)}ot(fD,"applyConnections");var Iie=Object.defineProperty,Die=(e,t)=>Iie(e,"name",{value:t,configurable:!0});function s4(e,t,r){let i;try{i=ta(e,{extractCustomCode:!0})}catch(u){return $(new Error(`Failed to parse infrastructure.ts: ${u instanceof Error?u.message:String(u)}`))}let n;try{n=uo(i,t,{skipValidation:!0})}catch(u){return $(new Error(`Failed to build resource plan: ${u instanceof Error?u.message:String(u)}`))}i.customCodeBlocks&&i.customCodeBlocks.length>0&&(n.customCodeBlocks=i.customCodeBlocks);let a=Gd(n,r);if(!a.success)return a;let o=Ey(n,r);if(!o.success)return o;let s=Lc(o.data);return s.success?V({originalContent:e,modifiedContent:s.data,addedResource:{type:r.type,name:r.resourceName}}):$(new Error(`Code generation failed: ${s.error.message}`))}Die(s4,"generateResourceChange");var wie=Object.defineProperty,_o=(e,t)=>wie(e,"name",{value:t,configurable:!0});function wn(e,...t){let r={};for(let i of t)e[i]!==void 0&&(r[i]=e[i]);return r}_o(wn,"pickDefined");function xy(e,t){let r={name:e,type:t.databaseType,databaseName:t.databaseName,...wn(t,"databaseInsights","port","proxy","credentials","encryption","deletionProtection")};switch(t.databaseType){case"Instance":return{...r,...wn(t,"instanceType","multiAz","readReplica","publiclyAccessible","backupRetention","allocatedStorage","snapshotIdentifier","snapshotUsername")};case"Aurora":return{...r,...wn(t,"writer","readers","backupRetention","preferredMaintenanceWindow","monitoringInterval","snapshotIdentifier","snapshotUsername")};case"GlobalAurora":return{...r,primaryRegion:t.primaryRegion,...t.secondaryRegions&&t.secondaryRegions.length>0&&{secondaryRegions:t.secondaryRegions},...wn(t,"globalClusterIdentifier","enableGlobalWriteForwarding","writer","readers","backupRetention","preferredMaintenanceWindow","monitoringInterval","snapshotIdentifier","snapshotUsername")};default:return t}}_o(xy,"buildRelationalResourcePlan");function Ay(e){return`${e}Database`}_o(Ay,"defaultRelationalDatabaseName");function _y(e,t){return`Database name '${e}' already exists in ${t}. Please choose a different database name.`}_o(_y,"duplicateDatabaseNameMessage");function c4(e,t){let r=e.find(n=>n.name===t.databaseName||n.databaseName===t.databaseName);if(!r)return{ok:!1,message:`Database '${t.databaseName}' not found. Available databases: ${e.map(n=>n.name).join(", ")||"none"}`};if(r.proxy!==void 0&&r.proxy!==!1)return{ok:!1,message:`Database '${r.name}' already has RDS Proxy enabled.`};let i=wn(t,"maxConnections","maxIdleConnections","connectionBorrowTimeout","requireTLS");return{ok:!0,database:r,proxyValue:Object.keys(i).length>0?i:{}}}_o(c4,"resolveProxyAddition");function Ty(e,t){return{name:e,type:"ClickHouse",databaseName:t.databaseName,...wn(t,"instanceType","storageGb","iops","throughputMbps","coldTier","optimiseSchedule","backupSchedule","backupVerify","backupRetentionDays")}}_o(Ty,"buildClickHouseResourcePlan");function u4(e,t,r){let i=t.storagePreset??"standard",n=_g[i],a=r===0?"":`${r+1}`;return{name:e,bucketName:t.bucketName,variableName:`bucket${a}`,...n,...wn(t,"publicReadAccess","websiteHosting","backupVaultTier","versioned","encryption","kmsKeyArn","cors")}}_o(u4,"buildS3ResourcePlan");var kie=Object.defineProperty,yi=(e,t)=>kie(e,"name",{value:t,configurable:!0}),Nie=new Set(Ad.options);function l4(e){return Nie.has(e.toUpperCase())}yi(l4,"isRecordType");function d4(e){return e.endsWith(".")?e.slice(0,-1):e}yi(d4,"stripTrailingDot");function p4(e){let t=!1;for(let r=0;r<e.length;r++)if(e[r]==='"')t=!t;else if(e[r]===";"&&!t)return e.slice(0,r).trimEnd();return e}yi(p4,"stripInlineComment");function m4(e,t){let r=e.slice(t).join(" "),i=[],n="",a=!1;for(let o of r)o==='"'?(a&&(i.push(n),n=""),a=!a):a&&(n+=o);return i.join(" ")}yi(m4,"parseTxtValue");function f4(e){let t=/;\s*auto\s*$/.test(e),r=e.replace(/;\s*auto\s*$/,"").trim().match(/^\$FJALL-DELEGATE\s+(\S+)\s+TO\s+(\S+)$/i);if(r)return{subdomain:r[1],targetAccount:r[2],auto:t}}yi(f4,"parseDelegateDirective");function h4(e){if(e.length<2)return;let t=e[1],r=e.slice(2);return{domainName:t,subjectAlternativeNames:r}}yi(h4,"parseCertDirective");function g4(e){let t=[],r="",i=!1;for(let n of e)n==='"'?(i=!i,r+=n):/\s/.test(n)&&!i?r.length>0&&(t.push(r),r=""):r+=n;return r.length>0&&t.push(r),t}yi(g4,"tokenise");function y4(e){if(e.length<2)return;let t=0,r=e[t++],i,n;for(;t<e.length&&n===void 0;){let o=e[t].toUpperCase();if(o==="IN")t++;else if(l4(o))n=o,t++;else if(/^\d+$/.test(e[t]))i=parseInt(e[t],10),t++;else return}if(!n)return;let a=e.slice(t);switch(n){case"MX":{if(a.length<2)return;let o=parseInt(a[0],10),s=a.slice(1).join(" ");return{name:r,type:n,ttl:i,value:s,priority:o}}case"SRV":{if(a.length<4)return;let o=parseInt(a[0],10),s=parseInt(a[1],10),u=parseInt(a[2],10),d=a[3];return{name:r,type:n,ttl:i,value:d,priority:o,weight:s,port:u}}case"TXT":{let o=m4(e,t);return{name:r,type:n,ttl:i,value:o}}case"CAA":{let o=a.join(" ");return{name:r,type:n,ttl:i,value:o}}case"A":case"AAAA":{if(a.length===0)return;if(a[0].toUpperCase()==="ALIAS"){if(a.length<2)return;let o=a.slice(1).join(" ");return{name:r,type:n,ttl:i,value:`${Bz}${o}`}}return{name:r,type:n,ttl:i,value:a[0]}}default:return a.length===0?void 0:{name:r,type:n,ttl:i,value:a[0]}}}yi(y4,"parseRecord");function v4(e){let t=e.split(`
|
|
@@ -818,4 +818,4 @@ ${fl(i.error)}`);return i.data}To(V4,"validateGeneratorOptions");function W4(e,t
|
|
|
818
818
|
`),[e[0].name];let i=[];for(;i.length===0;)i=(await(0,Pw.default)([{type:"multiselect",name:"selected",message:t,choices:e.map(n=>({title:n.name,value:n.name,description:r?.(n),selected:!1}))}]))?.selected||[],i.length===0&&process.stdout.write(`
|
|
819
819
|
Please select at least one resource
|
|
820
820
|
|
|
821
|
-
`);return i}A3(Ow,"selectResources");var Wse=Object.defineProperty,Kse=(e,t)=>Wse(e,"name",{value:t,configurable:!0});async function $w(e,t,r,i,n){if(e.compute.length===0)return;if(t.connectionConfig){let{connectToCompute:o=[],connectToServices:s=[]}=t.connectionConfig;s.length>0&&zc(e,s,r,i),o.length>0&&Ao(e,o,r,i);return}if(t.nameProvidedByFlag||!await Rw(e.compute.length,"compute resource",n.singularPrompt,n.pluralPrompt))return;let a=await Ow(e.compute,"Select compute resources to connect:",o=>o.type.toUpperCase());a.length>0&&Ao(e,a,r,i)}Kse($w,"handleResourceConnections");var qse=Object.defineProperty,Zse=(e,t)=>qse(e,"name",{value:t,configurable:!0});async function _3(e,t){await ED(e,wj,t,"database",async({tree:r,validated:i,plan:n})=>{let a=i.databaseType==="ClickHouse",o=a?`${i.appName}Analytics`:Ay(i.appName),s=i.resourceName||o;if(K_(r,i.appName,s),q_(r,i.appName,i.databaseName))throw new Error(_y(i.databaseName,i.appName));let u;if(a){let d=Ty(s,i);u={...n,clickhouse:[...n.clickhouse??[],d]}}else{let d=xy(s,i);u={...n,database:[...n.database,d]}}return await $w(u,i,s,"database",{singularPrompt:"Found an existing compute resource. Configure database access for it?",pluralPrompt:"Found {count} compute resources. Configure database access for them?"}),u})}Zse(_3,"databaseGenerator");var
|
|
821
|
+
`);return i}A3(Ow,"selectResources");var Wse=Object.defineProperty,Kse=(e,t)=>Wse(e,"name",{value:t,configurable:!0});async function $w(e,t,r,i,n){if(e.compute.length===0)return;if(t.connectionConfig){let{connectToCompute:o=[],connectToServices:s=[]}=t.connectionConfig;s.length>0&&zc(e,s,r,i),o.length>0&&Ao(e,o,r,i);return}if(t.nameProvidedByFlag||!await Rw(e.compute.length,"compute resource",n.singularPrompt,n.pluralPrompt))return;let a=await Ow(e.compute,"Select compute resources to connect:",o=>o.type.toUpperCase());a.length>0&&Ao(e,a,r,i)}Kse($w,"handleResourceConnections");var qse=Object.defineProperty,Zse=(e,t)=>qse(e,"name",{value:t,configurable:!0});async function _3(e,t){await ED(e,wj,t,"database",async({tree:r,validated:i,plan:n})=>{let a=i.databaseType==="ClickHouse",o=a?`${i.appName}Analytics`:Ay(i.appName),s=i.resourceName||o;if(K_(r,i.appName,s),q_(r,i.appName,i.databaseName))throw new Error(_y(i.databaseName,i.appName));let u;if(a){let d=Ty(s,i);u={...n,clickhouse:[...n.clickhouse??[],d]}}else{let d=xy(s,i);u={...n,database:[...n.database,d]}}return await $w(u,i,s,"database",{singularPrompt:"Found an existing compute resource. Configure database access for it?",pluralPrompt:"Found {count} compute resources. Configure database access for them?"}),u})}Zse(_3,"databaseGenerator");var iDe=_3;export{_3 as databaseGenerator,iDe as default};
|