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"),KI(e,t,r))}var d=(0,S.concat)(n);return Md(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 Od(e,t){var r=Dn.getParentExportDeclaration(e);return r?(0,Qr.default)(r.type==="DeclareExportDeclaration"):t.unshift("declare "),(0,S.concat)(t)}function $d(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
|
`,sy(e).indent(t.tabWidth)])}function Md(e){var t=e.lastPos();do{var r=e.charAt(t);if(/\S/.test(r))return r}while(e.prevPos(t))}function QB(e){return Md(e)==="}"}function iy(e){return e.replace(/['"]/g,function(t){return t==='"'?"'":'"'})}function Rc(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 ay(e){return JSON.stringify(e).replace(/[\u2028\u2029]/g,function(t){return"\\u"+t.charCodeAt(0).toString(16)})}function jd(e,t){switch(ZI.assert(e),t.quote){case"auto":{var r=ay(e),i=iy(ay(iy(e)));return r.length>i.length?i:r}case"single":return iy(ay(iy(e)));default:return ay(e)}}function sy(e){var t=Md(e);return!t||`
|
|
104
|
-
};`.indexOf(t)<0?(0,S.concat)([e,";"]):e}});var o2=P(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.run=qt.prettyPrint=qt.print=qt.visit=qt.types=qt.parse=void 0;var r2=(de(),Q(le)),wne=r2.__importDefault(No("fs")),kne=r2.__importStar(Ar());qt.types=kne;var n2=MB();Object.defineProperty(qt,"parse",{enumerable:!0,get:function(){return n2.parse}});var i2=t2(),Nne=Ar();Object.defineProperty(qt,"visit",{enumerable:!0,get:function(){return Nne.visit}});function a2(e,t){return new i2.Printer(t).print(e)}qt.print=a2;function Pne(e,t){return new i2.Printer(t).printGenerically(e)}qt.prettyPrint=Pne;function Rne(e,t){return One(process.argv[2],e,t)}qt.run=Rne;function One(e,t,r){wne.default.readFile(e,"utf-8",function(i,n){if(i){console.error(i);return}jne(n,t,r)})}function $ne(e){process.stdout.write(e)}function jne(e,t,r){var i=r&&r.writeback||$ne;t((0,n2.parse)(e,r),function(n){i(a2(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 Gie(e,t){if(e){if(typeof e=="string")return J4(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 J4(e,t)}}function J4(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 Vie=Ey(),Y4=Ze(),X4=Y4.erase,Wie=Y4.cursor,Kie=e=>[...Vie(e)].length;Q4.exports=function(e,t){if(!t)return X4.line+Wie.to(0);let r=0,i=e.split(/\r?\n/);var n=Bie(i),a;try{for(n.s();!(a=n.n()).done;){let o=a.value;r+=1+Math.floor(Math.max(Kie(o)-1,0)/t)}}catch(o){n.e(o)}finally{n.f()}return X4.lines(r)}});var yD=P((
|
|
104
|
+
};`.indexOf(t)<0?(0,S.concat)([e,";"]):e}});var o2=P(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.run=qt.prettyPrint=qt.print=qt.visit=qt.types=qt.parse=void 0;var r2=(de(),Q(le)),wne=r2.__importDefault(No("fs")),kne=r2.__importStar(Ar());qt.types=kne;var n2=MB();Object.defineProperty(qt,"parse",{enumerable:!0,get:function(){return n2.parse}});var i2=t2(),Nne=Ar();Object.defineProperty(qt,"visit",{enumerable:!0,get:function(){return Nne.visit}});function a2(e,t){return new i2.Printer(t).print(e)}qt.print=a2;function Pne(e,t){return new i2.Printer(t).printGenerically(e)}qt.prettyPrint=Pne;function Rne(e,t){return One(process.argv[2],e,t)}qt.run=Rne;function One(e,t,r){wne.default.readFile(e,"utf-8",function(i,n){if(i){console.error(i);return}jne(n,t,r)})}function $ne(e){process.stdout.write(e)}function jne(e,t,r){var i=r&&r.writeback||$ne;t((0,n2.parse)(e,r),function(n){i(a2(n,r).code)})}});var Ke=P((DCe,W4)=>{"use strict";var{FORCE_COLOR:jie,NODE_DISABLE_COLORS:Mie,TERM:Fie}=process.env,Te={enabled:!Mie&&Fie!=="dumb"&&jie!=="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 V4(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 Lie(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?V4(this.keys,i+""):i+""):i===void 0?Lie([e],[r]):Te.enabled?V4([r],i+""):i+""}}W4.exports=Te});var Z4=P((wCe,K4)=>{"use strict";K4.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 Ey=P((kCe,q4)=>{"use strict";q4.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 Ze=P((NCe,H4)=>{"use strict";var gD={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"},Uie={up:(e=1)=>"\x1B[S".repeat(e),down:(e=1)=>"\x1B[T".repeat(e)},zie={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?gD.up():"");return e&&(t+=gD.left),t}};H4.exports={cursor:gD,scroll:Uie,erase:zie,beep:"\x07"}});var e6=P((PCe,Q4)=>{"use strict";function Bie(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Gie(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 Gie(e,t){if(e){if(typeof e=="string")return J4(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 J4(e,t)}}function J4(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 Vie=Ey(),Y4=Ze(),X4=Y4.erase,Wie=Y4.cursor,Kie=e=>[...Vie(e)].length;Q4.exports=function(e,t){if(!t)return X4.line+Wie.to(0);let r=0,i=e.split(/\r?\n/);var n=Bie(i),a;try{for(n.s();!(a=n.n()).done;){let o=a.value;r+=1+Math.floor(Math.max(Kie(o)-1,0)/t)}}catch(o){n.e(o)}finally{n.f()}return X4.lines(r)}});var yD=P((RCe,t6)=>{"use strict";var zd={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},Zie={arrowUp:zd.arrowUp,arrowDown:zd.arrowDown,arrowLeft:zd.arrowLeft,arrowRight:zd.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},qie=process.platform==="win32"?Zie:zd;t6.exports=qie});var n6=P((OCe,r6)=>{"use strict";var Uc=Ke(),Co=yD(),vD=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}`}}),Hie=e=>vD[e]||vD.default,Bd=Object.freeze({aborted:Uc.red(Co.cross),done:Uc.green(Co.tick),exited:Uc.yellow(Co.cross),default:Uc.cyan("?")}),Jie=(e,t,r)=>t?Bd.aborted:r?Bd.exited:e?Bd.done:Bd.default,Xie=e=>Uc.gray(e?Co.ellipsis:Co.pointerSmall),Yie=(e,t)=>Uc.gray(e?t?Co.pointerSmall:"+":Co.line);r6.exports={styles:vD,render:Hie,symbols:Bd,symbol:Jie,delimiter:Xie,item:Yie}});var a6=P(($Ce,i6)=>{"use strict";var Qie=Ey();i6.exports=function(e,t){let r=String(Qie(e)||"").split(/\r?\n/);return t?r.map(i=>Math.ceil(i.length/t)).reduce((i,n)=>i+n):r.length}});var s6=P((jCe,o6)=>{"use strict";o6.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 u6=P((
|
|
107
|
+
`)}});var u6=P((MCe,c6)=>{"use strict";c6.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((FCe,l6)=>{"use strict";l6.exports={action:Z4(),clear:e6(),style:n6(),strip:Ey(),figures:yD(),lines:a6(),wrap:s6(),entriesToDisplay:u6()}});var yi=P((LCe,m6)=>{"use strict";var d6=No("readline"),eae=tn(),tae=eae.action,rae=No("events"),p6=Ze(),nae=p6.beep,iae=p6.cursor,aae=Ke(),bD=class extends rae{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=d6.createInterface({input:this.in,escapeCodeTimeout:50});d6.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=tae(o,i);s===!1?this._&&this._(a,o):typeof this[s]=="function"?this[s](o):this.bell()};this.close=()=>{this.out.write(iae.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(nae)}render(){this.onRender(aae),this.firstRender&&(this.firstRender=!1)}};m6.exports=bD});var v6=P((UCe,y6)=>{"use strict";function f6(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 h6(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var a=e.apply(t,r);function o(u){f6(a,i,n,o,s,"next",u)}function s(u){f6(a,i,n,o,s,"throw",u)}o(void 0)})}}var xy=Ke(),oae=yi(),g6=Ze(),sae=g6.erase,Gd=g6.cursor,Ay=tn(),SD=Ay.style,ED=Ay.clear,cae=Ay.lines,uae=Ay.figures,xD=class extends oae{constructor(t={}){super(t),this.transform=SD.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=ED("",this.out.columns),this.render()}set value(t){!t&&this.initial?(this.placeholder=!0,this.rendered=xy.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 h6(function*(){let r=yield t.validator(t.value);typeof r=="string"&&(t.errorMsg=r,r=!1),t.error=!r})()}submit(){var t=this;return h6(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(Gd.down(cae(this.outputError,this.out.columns)-1)+ED(this.outputError,this.out.columns)),this.out.write(ED(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[SD.symbol(this.done,this.aborted),xy.bold(this.msg),SD.delimiter(this.done),this.red?xy.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
110
110
|
`).reduce((t,r,i)=>t+`
|
|
111
|
-
${i?" ":uae.pointerSmall} ${xy.red().italic(r)}`,"")),this.out.write(sae.line+Gd.to(0)+this.outputText+Gd.save+this.outputError+Gd.restore+Gd.move(this.cursorOffset,0)))}};y6.exports=xD});var x6=P((
|
|
111
|
+
${i?" ":uae.pointerSmall} ${xy.red().italic(r)}`,"")),this.out.write(sae.line+Gd.to(0)+this.outputText+Gd.save+this.outputError+Gd.restore+Gd.move(this.cursorOffset,0)))}};y6.exports=xD});var x6=P((zCe,E6)=>{"use strict";var vi=Ke(),lae=yi(),Vd=tn(),b6=Vd.style,S6=Vd.clear,_y=Vd.figures,dae=Vd.wrap,pae=Vd.entriesToDisplay,mae=Ze(),fae=mae.cursor,AD=class extends lae{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=S6("",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(fae.hide):this.out.write(S6(this.outputText,this.out.columns)),super.render();let t=pae(this.cursor,this.choices.length,this.optionsPerPage),r=t.startIndex,i=t.endIndex;if(this.outputText=[b6.symbol(this.done,this.aborted),vi.bold(this.msg),b6.delimiter(!1),this.done?this.selection.title:this.selection.disabled?vi.yellow(this.warn):vi.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=_y.arrowUp:n===i-1&&i<this.choices.length?o=_y.arrowDown:o=" ",u.disabled?(a=this.cursor===n?vi.gray().underline(u.title):vi.strikethrough().gray(u.title),o=(this.cursor===n?vi.bold().gray(_y.pointer)+" ":" ")+o):(a=this.cursor===n?vi.cyan().underline(u.title):u.title,o=(this.cursor===n?vi.cyan(_y.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
|
`+dae(u.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${a}${vi.gray(s)}
|
|
116
|
-
`}}this.out.write(this.outputText)}};E6.exports=AD});var D6=P((
|
|
116
|
+
`}}this.out.write(this.outputText)}};E6.exports=AD});var D6=P((BCe,I6)=>{"use strict";var Ty=Ke(),hae=yi(),T6=tn(),A6=T6.style,gae=T6.clear,C6=Ze(),_6=C6.cursor,yae=C6.erase,_D=class extends hae{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(_6.hide):this.out.write(gae(this.outputText,this.out.columns)),super.render(),this.outputText=[A6.symbol(this.done,this.aborted),Ty.bold(this.msg),A6.delimiter(this.done),this.value?this.inactive:Ty.cyan().underline(this.inactive),Ty.gray("/"),this.value?Ty.cyan().underline(this.active):this.active].join(" "),this.out.write(yae.line+_6.to(0)+this.outputText))}};I6.exports=_D});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(_6.hide):this.out.write(gae(this.outputText,this.out.columns)),super.render(),this.outputText=[A6.symbol(this.done,this.aborted),Ty.bold(this.msg),A6.delimiter(this.done),this.value?this.inactive:Ty.cyan().underline(this.inactive),Ty.gray("/"),this.value?Ty.cyan().underline(this.active):this.active].join(" "),this.out.write(yae.line+_6.to(0)+this.outputText))}};I6.exports=_D});var kn=P((GCe,w6)=>{"use strict";var TD=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)}};w6.exports=TD});var N6=P((VCe,k6)=>{"use strict";var vae=kn(),CD=class extends vae{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}};k6.exports=CD});var R6=P((WCe,P6)=>{"use strict";var bae=kn(),Sae=e=>(e=e%10,e===1?"st":e===2?"nd":e===3?"rd":"th"),ID=class extends bae{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+Sae(t):this.token==="d"?r+1:this.token==="ddd"?this.locales.weekdaysShort[r]:this.token==="dddd"?this.locales.weekdays[r]:t}};P6.exports=ID});var $6=P((KCe,O6)=>{"use strict";var Eae=kn(),DD=class extends Eae{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}};O6.exports=DD});var M6=P((ZCe,j6)=>{"use strict";var xae=kn(),wD=class extends xae{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)}};j6.exports=wD});var L6=P((qCe,F6)=>{"use strict";var Aae=kn(),kD=class extends Aae{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}};F6.exports=kD});var z6=P((HCe,U6)=>{"use strict";var _ae=kn(),ND=class extends _ae{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)}};U6.exports=ND});var G6=P((JCe,B6)=>{"use strict";var Tae=kn(),PD=class extends Tae{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}};B6.exports=PD});var W6=P((XCe,V6)=>{"use strict";var Cae=kn(),RD=class extends Cae{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}};V6.exports=RD});var Z6=P((YCe,K6)=>{"use strict";K6.exports={DatePart:kn(),Meridiem:N6(),Day:R6(),Hours:$6(),Milliseconds:M6(),Minutes:L6(),Month:z6(),Seconds:G6(),Year:W6()}});var nG=P((QCe,rG)=>{"use strict";function q6(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 H6(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var a=e.apply(t,r);function o(u){q6(a,i,n,o,s,"next",u)}function s(u){q6(a,i,n,o,s,"throw",u)}o(void 0)})}}var OD=Ke(),Iae=yi(),jD=tn(),J6=jD.style,X6=jD.clear,Dae=jD.figures,tG=Ze(),wae=tG.erase,Y6=tG.cursor,bi=Z6(),Q6=bi.DatePart,kae=bi.Meridiem,Nae=bi.Day,Pae=bi.Hours,Rae=bi.Milliseconds,Oae=bi.Minutes,$ae=bi.Month,jae=bi.Seconds,Mae=bi.Year,Fae=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,eG={1:({token:e})=>e.replace(/\\(.)/g,"$1"),2:e=>new Nae(e),3:e=>new $ae(e),4:e=>new Mae(e),5:e=>new kae(e),6:e=>new Pae(e),7:e=>new Oae(e),8:e=>new jae(e),9:e=>new Rae(e)},Lae={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(",")},$D=class extends Iae{constructor(t={}){super(t),this.msg=t.message,this.cursor=0,this.typed="",this.locales=Object.assign(Lae,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=X6("",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=Fae.exec(t);){let n=r.shift(),a=r.findIndex(o=>o!=null);this.parts.push(a in eG?eG[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 Q6)),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 H6(function*(){let r=yield t.validator(t.value);typeof r=="string"&&(t.errorMsg=r,r=!1),t.error=!r})()}submit(){var t=this;return H6(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 Q6)),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(Y6.hide):this.out.write(X6(this.outputText,this.out.columns)),super.render(),this.outputText=[J6.symbol(this.done,this.aborted),OD.bold(this.msg),J6.delimiter(!1),this.parts.reduce((t,r,i)=>t.concat(i===this.cursor&&!this.done?OD.cyan().underline(r.toString()):r),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
121
121
|
`).reduce((t,r,i)=>t+`
|
|
122
|
-
${i?" ":Dae.pointerSmall} ${OD.red().italic(r)}`,"")),this.out.write(wae.line+Y6.to(0)+this.outputText))}};rG.exports=$D});var lG=P((
|
|
122
|
+
${i?" ":Dae.pointerSmall} ${OD.red().italic(r)}`,"")),this.out.write(wae.line+Y6.to(0)+this.outputText))}};rG.exports=$D});var lG=P((eIe,uG)=>{"use strict";function iG(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 aG(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var a=e.apply(t,r);function o(u){iG(a,i,n,o,s,"next",u)}function s(u){iG(a,i,n,o,s,"throw",u)}o(void 0)})}}var Cy=Ke(),Uae=yi(),cG=Ze(),Iy=cG.cursor,zae=cG.erase,Dy=tn(),MD=Dy.style,Bae=Dy.figures,oG=Dy.clear,Gae=Dy.lines,Vae=/[0-9]/,FD=e=>e!==void 0,sG=(e,t)=>{let r=Math.pow(10,t);return Math.round(e*r)/r},LD=class extends Uae{constructor(t={}){super(t),this.transform=MD.render(t.style),this.msg=t.message,this.initial=FD(t.initial)?t.initial:"",this.float=!!t.float,this.round=t.round||2,this.inc=t.increment||1,this.min=FD(t.min)?t.min:-1/0,this.max=FD(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=Cy.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${sG(t,this.round)}`),this._value=sG(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||Vae.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 aG(function*(){let r=yield t.validator(t.value);typeof r=="string"&&(t.errorMsg=r,r=!1),t.error=!r})()}submit(){var t=this;return aG(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(Iy.down(Gae(this.outputError,this.out.columns)-1)+oG(this.outputError,this.out.columns)),this.out.write(oG(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[MD.symbol(this.done,this.aborted),Cy.bold(this.msg),MD.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Cy[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
125
125
|
`).reduce((t,r,i)=>t+`
|
|
126
|
-
${i?" ":Bae.pointerSmall} ${Cy.red().italic(r)}`,"")),this.out.write(zae.line+Iy.to(0)+this.outputText+Iy.save+this.outputError+Iy.restore))}};uG.exports=LD});var zD=P((
|
|
126
|
+
${i?" ":Bae.pointerSmall} ${Cy.red().italic(r)}`,"")),this.out.write(zae.line+Iy.to(0)+this.outputText+Iy.save+this.outputError+Iy.restore))}};uG.exports=LD});var zD=P((tIe,mG)=>{"use strict";var Nn=Ke(),Wae=Ze(),Kae=Wae.cursor,Zae=yi(),Wd=tn(),dG=Wd.clear,sa=Wd.figures,pG=Wd.style,qae=Wd.wrap,Hae=Wd.entriesToDisplay,UD=class extends Zae{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=dG("",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(sa.radioOn):sa.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=Hae(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=sa.arrowUp:s===n-1&&n<t.length?a=sa.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(Kae.hide),super.render();let t=[pG.symbol(this.done,this.aborted),Nn.bold(this.msg),pG.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=dG(t,this.out.columns)}};mG.exports=UD});var SG=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(Kae.hide),super.render();let t=[pG.symbol(this.done,this.aborted),Nn.bold(this.msg),pG.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=dG(t,this.out.columns)}};mG.exports=UD});var SG=P((rIe,bG)=>{"use strict";function fG(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 Jae(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var a=e.apply(t,r);function o(u){fG(a,i,n,o,s,"next",u)}function s(u){fG(a,i,n,o,s,"throw",u)}o(void 0)})}}var Kd=Ke(),Xae=yi(),vG=Ze(),Yae=vG.erase,hG=vG.cursor,Zd=tn(),BD=Zd.style,gG=Zd.clear,GD=Zd.figures,Qae=Zd.wrap,eoe=Zd.entriesToDisplay,yG=(e,t)=>e[t]&&(e[t].value||e[t].title||e[t]),toe=(e,t)=>e[t]&&(e[t].title||e[t].value||e[t]),roe=(e,t)=>{let r=e.findIndex(i=>i.value===t||i.title===t);return r>-1?r:void 0},VD=class extends Xae{constructor(t={}){super(t),this.msg=t.message,this.suggest=t.suggest,this.choices=t.choices,this.initial=typeof t.initial=="number"?t.initial:roe(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=BD.render(t.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=gG("",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=yG(this.suggestions,t):this.value=this.fallback.value,this.fire()}complete(t){var r=this;return Jae(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:toe(u,s),value:yG(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?GD.arrowUp:n?GD.arrowDown:" ",s=r?Kd.cyan().underline(t.title):t.title;return o=(r?Kd.cyan(GD.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
|
`+Qae(t.description,{margin:3,width:this.out.columns}))),o+" "+s+Kd.gray(a||"")}render(){if(this.closed)return;this.firstRender?this.out.write(hG.hide):this.out.write(gG(this.outputText,this.out.columns)),super.render();let t=eoe(this.select,this.choices.length,this.limit),r=t.startIndex,i=t.endIndex;if(this.outputText=[BD.symbol(this.done,this.aborted,this.exited),Kd.bold(this.msg),BD.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||Kd.gray(this.fallback.title))}this.out.write(Yae.line+hG.to(0)+this.outputText)}};bG.exports=VD});var _G=P((
|
|
142
|
+
`+(n||Kd.gray(this.fallback.title))}this.out.write(Yae.line+hG.to(0)+this.outputText)}};bG.exports=VD});var _G=P((nIe,AG)=>{"use strict";var Si=Ke(),noe=Ze(),ioe=noe.cursor,aoe=zD(),KD=tn(),EG=KD.clear,xG=KD.style,zc=KD.figures,WD=class extends aoe{constructor(t={}){t.overrideRender=!0,super(t),this.inputValue="",this.clear=EG("",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
|
${zc.arrowUp}/${zc.arrowDown}: Highlight option
|
|
145
145
|
${zc.arrowLeft}/${zc.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:Si.gray("Enter something to filter")}
|
|
150
|
-
`}renderOption(t,r,i){let n;return r.disabled?n=t===i?Si.gray().underline(r.title):Si.strikethrough().gray(r.title):n=t===i?Si.cyan().underline(r.title):r.title,(r.selected?Si.green(zc.radioOn):zc.radioOff)+" "+n}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let t=[Si.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(Si.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(ioe.hide),super.render();let t=[xG.symbol(this.done,this.aborted),Si.bold(this.msg),xG.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=Si.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=EG(t,this.out.columns)}};AG.exports=WD});var NG=P((
|
|
150
|
+
`}renderOption(t,r,i){let n;return r.disabled?n=t===i?Si.gray().underline(r.title):Si.strikethrough().gray(r.title):n=t===i?Si.cyan().underline(r.title):r.title,(r.selected?Si.green(zc.radioOn):zc.radioOff)+" "+n}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let t=[Si.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(Si.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(ioe.hide),super.render();let t=[xG.symbol(this.done,this.aborted),Si.bold(this.msg),xG.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=Si.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=EG(t,this.out.columns)}};AG.exports=WD});var NG=P((iIe,kG)=>{"use strict";var TG=Ke(),ooe=yi(),DG=tn(),CG=DG.style,soe=DG.clear,wG=Ze(),coe=wG.erase,IG=wG.cursor,ZD=class extends ooe{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(IG.hide):this.out.write(soe(this.outputText,this.out.columns)),super.render(),this.outputText=[CG.symbol(this.done,this.aborted),TG.bold(this.msg),CG.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:TG.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(coe.line+IG.to(0)+this.outputText))}};kG.exports=ZD});var RG=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 moe(e,t){if(e){if(typeof e=="string")return FG(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 FG(e,t)}}function FG(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 LG(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 UG(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var a=e.apply(t,r);function o(u){LG(a,i,n,o,s,"next",u)}function s(u){LG(a,i,n,o,s,"throw",u)}o(void 0)})}}var qD=$G(),foe=["suggest","format","onState","validate","onRender","type"],zG=()=>{};function ca(){return HD.apply(this,arguments)}function HD(){return HD=UG(function*(e=[],{onSubmit:t=zG,onCancel:r=zG}={}){let i={},n=ca._override||{};e=[].concat(e);let a,o,s,u,d,p,h=(function(){var y=UG(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=poe(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,MG({},i),o),o.type=d),!!d){for(let y in o){if(foe.includes(y))continue;let v=o[y];o[y]=typeof v=="function"?yield v(a,MG({},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,qD[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=ca._injected?hoe(ca._injected,o.initial):yield qD[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}),HD.apply(this,arguments)}function hoe(e,t){let r=e.shift();if(r instanceof Error)throw r;return r===void 0?t:r}function goe(e){ca._injected=(ca._injected||[]).concat(e)}function yoe(e){ca._override=Object.assign({},e)}BG.exports=Object.assign(ca,{prompt:ca,prompts:qD,inject:goe,override:yoe})});var WG=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(IG.hide):this.out.write(soe(this.outputText,this.out.columns)),super.render(),this.outputText=[CG.symbol(this.done,this.aborted),TG.bold(this.msg),CG.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:TG.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(coe.line+IG.to(0)+this.outputText))}};kG.exports=ZD});var RG=P((aIe,PG)=>{"use strict";PG.exports={TextPrompt:v6(),SelectPrompt:x6(),TogglePrompt:D6(),DatePrompt:nG(),NumberPrompt:lG(),MultiselectPrompt:zD(),AutocompletePrompt:SG(),AutocompleteMultiselectPrompt:_G(),ConfirmPrompt:NG()}});var $G=P(OG=>{"use strict";var Jt=OG,uoe=RG(),wy=e=>e;function Pn(e,t,r={}){return new Promise((i,n)=>{let a=new uoe[e](t),o=r.onAbort||wy,s=r.onSubmit||wy,u=r.onExit||wy;a.on("state",t.onState||wy),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 loe=(e,t)=>Promise.resolve(t.filter(r=>r.title.slice(0,e.length).toLowerCase()===e.toLowerCase()));Jt.autocomplete=e=>(e.suggest=e.suggest||loe,e.choices=[].concat(e.choices||[]),Pn("AutocompletePrompt",e))});var GG=P((sIe,BG)=>{"use strict";function jG(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 MG(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?jG(Object(r),!0).forEach(function(i){doe(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jG(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function doe(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function poe(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=moe(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 moe(e,t){if(e){if(typeof e=="string")return FG(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 FG(e,t)}}function FG(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 LG(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 UG(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var a=e.apply(t,r);function o(u){LG(a,i,n,o,s,"next",u)}function s(u){LG(a,i,n,o,s,"throw",u)}o(void 0)})}}var qD=$G(),foe=["suggest","format","onState","validate","onRender","type"],zG=()=>{};function ca(){return HD.apply(this,arguments)}function HD(){return HD=UG(function*(e=[],{onSubmit:t=zG,onCancel:r=zG}={}){let i={},n=ca._override||{};e=[].concat(e);let a,o,s,u,d,p,h=(function(){var y=UG(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=poe(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,MG({},i),o),o.type=d),!!d){for(let y in o){if(foe.includes(y))continue;let v=o[y];o[y]=typeof v=="function"?yield v(a,MG({},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,qD[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=ca._injected?hoe(ca._injected,o.initial):yield qD[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}),HD.apply(this,arguments)}function hoe(e,t){let r=e.shift();if(r instanceof Error)throw r;return r===void 0?t:r}function goe(e){ca._injected=(ca._injected||[]).concat(e)}function yoe(e){ca._override=Object.assign({},e)}BG.exports=Object.assign(ca,{prompt:ca,prompts:qD,inject:goe,override:yoe})});var WG=P((cIe,VG)=>{"use strict";VG.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 ky=P((uIe,KG)=>{"use strict";KG.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 HG=P((lIe,qG)=>{"use strict";var voe=ky(),{erase:ZG,cursor:boe}=Ze(),Soe=e=>[...voe(e)].length;qG.exports=function(e,t){if(!t)return ZG.line+boe.to(0);let r=0,i=e.split(/\r?\n/);for(let n of i)r+=1+Math.floor(Math.max(Soe(n)-1,0)/t);return ZG.lines(r)}});var JD=P((dIe,JG)=>{"use strict";var qd={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},Eoe={arrowUp:qd.arrowUp,arrowDown:qd.arrowDown,arrowLeft:qd.arrowLeft,arrowRight:qd.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},xoe=process.platform==="win32"?Eoe:qd;JG.exports=xoe});var YG=P((pIe,XG)=>{"use strict";var Bc=Ke(),Io=JD(),XD=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}`}}),Aoe=e=>XD[e]||XD.default,Hd=Object.freeze({aborted:Bc.red(Io.cross),done:Bc.green(Io.tick),exited:Bc.yellow(Io.cross),default:Bc.cyan("?")}),_oe=(e,t,r)=>t?Hd.aborted:r?Hd.exited:e?Hd.done:Hd.default,Toe=e=>Bc.gray(e?Io.ellipsis:Io.pointerSmall),Coe=(e,t)=>Bc.gray(e?t?Io.pointerSmall:"+":Io.line);XG.exports={styles:XD,render:Aoe,symbols:Hd,symbol:_oe,delimiter:Toe,item:Coe}});var eV=P((mIe,QG)=>{"use strict";var Ioe=ky();QG.exports=function(e,t){let r=String(Ioe(e)||"").split(/\r?\n/);return t?r.map(i=>Math.ceil(i.length/t)).reduce((i,n)=>i+n):r.length}});var rV=P((fIe,tV)=>{"use strict";tV.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 iV=P((
|
|
155
|
+
`)}});var iV=P((hIe,nV)=>{"use strict";nV.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((gIe,aV)=>{"use strict";aV.exports={action:WG(),clear:HG(),style:YG(),strip:ky(),figures:JD(),lines:eV(),wrap:rV(),entriesToDisplay:iV()}});var Ei=P((yIe,sV)=>{"use strict";var oV=No("readline"),{action:Doe}=rn(),woe=No("events"),{beep:koe,cursor:Noe}=Ze(),Poe=Ke(),YD=class extends woe{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=oV.createInterface({input:this.in,escapeCodeTimeout:50});oV.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=Doe(o,i);s===!1?this._&&this._(a,o):typeof this[s]=="function"?this[s](o):this.bell()};this.close=()=>{this.out.write(Noe.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(koe)}render(){this.onRender(Poe),this.firstRender&&(this.firstRender=!1)}};sV.exports=YD});var uV=P((vIe,cV)=>{var Ny=Ke(),Roe=Ei(),{erase:Ooe,cursor:Jd}=Ze(),{style:QD,clear:ew,lines:$oe,figures:joe}=rn(),tw=class extends Roe{constructor(t={}){super(t),this.transform=QD.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=ew("",this.out.columns),this.render()}set value(t){!t&&this.initial?(this.placeholder=!0,this.rendered=Ny.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(Jd.down($oe(this.outputError,this.out.columns)-1)+ew(this.outputError,this.out.columns)),this.out.write(ew(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[QD.symbol(this.done,this.aborted),Ny.bold(this.msg),QD.delimiter(this.done),this.red?Ny.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
158
158
|
`).reduce((t,r,i)=>t+`
|
|
159
|
-
${i?" ":joe.pointerSmall} ${Ny.red().italic(r)}`,"")),this.out.write(Ooe.line+Jd.to(0)+this.outputText+Jd.save+this.outputError+Jd.restore+Jd.move(this.cursorOffset,0)))}};cV.exports=tw});var mV=P((
|
|
159
|
+
${i?" ":joe.pointerSmall} ${Ny.red().italic(r)}`,"")),this.out.write(Ooe.line+Jd.to(0)+this.outputText+Jd.save+this.outputError+Jd.restore+Jd.move(this.cursorOffset,0)))}};cV.exports=tw});var mV=P((bIe,pV)=>{"use strict";var xi=Ke(),Moe=Ei(),{style:lV,clear:dV,figures:Py,wrap:Foe,entriesToDisplay:Loe}=rn(),{cursor:Uoe}=Ze(),rw=class extends Moe{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=dV("",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(Uoe.hide):this.out.write(dV(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:r}=Loe(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[lV.symbol(this.done,this.aborted),xi.bold(this.msg),lV.delimiter(!1),this.done?this.selection.title:this.selection.disabled?xi.yellow(this.warn):xi.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=Py.arrowUp:i===r-1&&r<this.choices.length?a=Py.arrowDown:a=" ",s.disabled?(n=this.cursor===i?xi.gray().underline(s.title):xi.strikethrough().gray(s.title),a=(this.cursor===i?xi.bold().gray(Py.pointer)+" ":" ")+a):(n=this.cursor===i?xi.cyan().underline(s.title):s.title,a=(this.cursor===i?xi.cyan(Py.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
|
`+Foe(s.description,{margin:3,width:this.out.columns})))),this.outputText+=`${a} ${n}${xi.gray(o)}
|
|
164
|
-
`}}this.out.write(this.outputText)}};pV.exports=rw});var yV=P((
|
|
164
|
+
`}}this.out.write(this.outputText)}};pV.exports=rw});var yV=P((SIe,gV)=>{var Ry=Ke(),zoe=Ei(),{style:fV,clear:Boe}=rn(),{cursor:hV,erase:Goe}=Ze(),nw=class extends zoe{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(hV.hide):this.out.write(Boe(this.outputText,this.out.columns)),super.render(),this.outputText=[fV.symbol(this.done,this.aborted),Ry.bold(this.msg),fV.delimiter(this.done),this.value?this.inactive:Ry.cyan().underline(this.inactive),Ry.gray("/"),this.value?Ry.cyan().underline(this.active):this.active].join(" "),this.out.write(Goe.line+hV.to(0)+this.outputText))}};gV.exports=nw});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(hV.hide):this.out.write(Boe(this.outputText,this.out.columns)),super.render(),this.outputText=[fV.symbol(this.done,this.aborted),Ry.bold(this.msg),fV.delimiter(this.done),this.value?this.inactive:Ry.cyan().underline(this.inactive),Ry.gray("/"),this.value?Ry.cyan().underline(this.active):this.active].join(" "),this.out.write(Goe.line+hV.to(0)+this.outputText))}};gV.exports=nw});var Rn=P((EIe,vV)=>{"use strict";var iw=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)}};vV.exports=iw});var SV=P((xIe,bV)=>{"use strict";var Voe=Rn(),aw=class extends Voe{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}};bV.exports=aw});var xV=P((AIe,EV)=>{"use strict";var Woe=Rn(),Koe=e=>(e=e%10,e===1?"st":e===2?"nd":e===3?"rd":"th"),ow=class extends Woe{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+Koe(t):this.token==="d"?r+1:this.token==="ddd"?this.locales.weekdaysShort[r]:this.token==="dddd"?this.locales.weekdays[r]:t}};EV.exports=ow});var _V=P((_Ie,AV)=>{"use strict";var Zoe=Rn(),sw=class extends Zoe{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}};AV.exports=sw});var CV=P((TIe,TV)=>{"use strict";var qoe=Rn(),cw=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)}};TV.exports=cw});var DV=P((CIe,IV)=>{"use strict";var Hoe=Rn(),uw=class extends Hoe{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}};IV.exports=uw});var kV=P((IIe,wV)=>{"use strict";var Joe=Rn(),lw=class extends Joe{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)}};wV.exports=lw});var PV=P((DIe,NV)=>{"use strict";var Xoe=Rn(),dw=class extends Xoe{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}};NV.exports=dw});var OV=P((wIe,RV)=>{"use strict";var Yoe=Rn(),pw=class extends Yoe{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}};RV.exports=pw});var jV=P((kIe,$V)=>{"use strict";$V.exports={DatePart:Rn(),Meridiem:SV(),Day:xV(),Hours:_V(),Milliseconds:CV(),Minutes:DV(),Month:kV(),Seconds:PV(),Year:OV()}});var GV=P((NIe,BV)=>{"use strict";var mw=Ke(),Qoe=Ei(),{style:MV,clear:FV,figures:ese}=rn(),{erase:tse,cursor:LV}=Ze(),{DatePart:UV,Meridiem:rse,Day:nse,Hours:ise,Milliseconds:ase,Minutes:ose,Month:sse,Seconds:cse,Year:use}=jV(),lse=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,zV={1:({token:e})=>e.replace(/\\(.)/g,"$1"),2:e=>new nse(e),3:e=>new sse(e),4:e=>new use(e),5:e=>new rse(e),6:e=>new ise(e),7:e=>new ose(e),8:e=>new cse(e),9:e=>new ase(e)},dse={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(",")},fw=class extends Qoe{constructor(t={}){super(t),this.msg=t.message,this.cursor=0,this.typed="",this.locales=Object.assign(dse,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=FV("",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=lse.exec(t);){let n=r.shift(),a=r.findIndex(o=>o!=null);this.parts.push(a in zV?zV[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 UV)),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 UV)),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(LV.hide):this.out.write(FV(this.outputText,this.out.columns)),super.render(),this.outputText=[MV.symbol(this.done,this.aborted),mw.bold(this.msg),MV.delimiter(!1),this.parts.reduce((t,r,i)=>t.concat(i===this.cursor&&!this.done?mw.cyan().underline(r.toString()):r),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
169
169
|
`).reduce((t,r,i)=>t+`
|
|
170
|
-
${i?" ":ese.pointerSmall} ${mw.red().italic(r)}`,"")),this.out.write(tse.line+LV.to(0)+this.outputText))}};BV.exports=fw});var ZV=P((
|
|
170
|
+
${i?" ":ese.pointerSmall} ${mw.red().italic(r)}`,"")),this.out.write(tse.line+LV.to(0)+this.outputText))}};BV.exports=fw});var ZV=P((PIe,KV)=>{var Oy=Ke(),pse=Ei(),{cursor:$y,erase:mse}=Ze(),{style:hw,figures:fse,clear:VV,lines:hse}=rn(),gse=/[0-9]/,gw=e=>e!==void 0,WV=(e,t)=>{let r=Math.pow(10,t);return Math.round(e*r)/r},yw=class extends pse{constructor(t={}){super(t),this.transform=hw.render(t.style),this.msg=t.message,this.initial=gw(t.initial)?t.initial:"",this.float=!!t.float,this.round=t.round||2,this.inc=t.increment||1,this.min=gw(t.min)?t.min:-1/0,this.max=gw(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=Oy.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${WV(t,this.round)}`),this._value=WV(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||gse.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($y.down(hse(this.outputError,this.out.columns)-1)+VV(this.outputError,this.out.columns)),this.out.write(VV(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[hw.symbol(this.done,this.aborted),Oy.bold(this.msg),hw.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Oy[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
173
173
|
`).reduce((t,r,i)=>t+`
|
|
174
|
-
${i?" ":fse.pointerSmall} ${Oy.red().italic(r)}`,"")),this.out.write(mse.line+$y.to(0)+this.outputText+$y.save+this.outputError+$y.restore))}};KV.exports=yw});var bw=P((
|
|
174
|
+
${i?" ":fse.pointerSmall} ${Oy.red().italic(r)}`,"")),this.out.write(mse.line+$y.to(0)+this.outputText+$y.save+this.outputError+$y.restore))}};KV.exports=yw});var bw=P((RIe,JV)=>{"use strict";var On=Ke(),{cursor:yse}=Ze(),vse=Ei(),{clear:qV,figures:ua,style:HV,wrap:bse,entriesToDisplay:Sse}=rn(),vw=class extends vse{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=qV("",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(ua.radioOn):ua.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
|
`+bse(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}=Sse(this.cursor,t.length,this.optionsPerPage),n,a=[];for(let o=r;o<i;o++)o===r&&r>0?n=ua.arrowUp:o===i-1&&i<t.length?n=ua.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(yse.hide),super.render();let t=[HV.symbol(this.done,this.aborted),On.bold(this.msg),HV.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=qV(t,this.out.columns)}};JV.exports=vw});var t3=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(yse.hide),super.render();let t=[HV.symbol(this.done,this.aborted),On.bold(this.msg),HV.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=qV(t,this.out.columns)}};JV.exports=vw});var t3=P((OIe,e3)=>{"use strict";var Xd=Ke(),Ese=Ei(),{erase:xse,cursor:XV}=Ze(),{style:Sw,clear:YV,figures:Ew,wrap:Ase,entriesToDisplay:_se}=rn(),QV=(e,t)=>e[t]&&(e[t].value||e[t].title||e[t]),Tse=(e,t)=>e[t]&&(e[t].title||e[t].value||e[t]),Cse=(e,t)=>{let r=e.findIndex(i=>i.value===t||i.title===t);return r>-1?r:void 0},xw=class extends Ese{constructor(t={}){super(t),this.msg=t.message,this.suggest=t.suggest,this.choices=t.choices,this.initial=typeof t.initial=="number"?t.initial:Cse(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=Sw.render(t.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=YV("",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=QV(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:Tse(s,o),value:QV(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?Ew.arrowUp:n?Ew.arrowDown:" ",s=r?Xd.cyan().underline(t.title):t.title;return o=(r?Xd.cyan(Ew.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
|
`+Ase(t.description,{margin:3,width:this.out.columns}))),o+" "+s+Xd.gray(a||"")}render(){if(this.closed)return;this.firstRender?this.out.write(XV.hide):this.out.write(YV(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:r}=_se(this.select,this.choices.length,this.limit);if(this.outputText=[Sw.symbol(this.done,this.aborted,this.exited),Xd.bold(this.msg),Sw.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||Xd.gray(this.fallback.title))}this.out.write(xse.line+XV.to(0)+this.outputText)}};e3.exports=xw});var a3=P((
|
|
190
|
+
`+(i||Xd.gray(this.fallback.title))}this.out.write(xse.line+XV.to(0)+this.outputText)}};e3.exports=xw});var a3=P(($Ie,i3)=>{"use strict";var Ai=Ke(),{cursor:Ise}=Ze(),Dse=bw(),{clear:r3,style:n3,figures:Gc}=rn(),Aw=class extends Dse{constructor(t={}){t.overrideRender=!0,super(t),this.inputValue="",this.clear=r3("",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
|
${Gc.arrowUp}/${Gc.arrowDown}: Highlight option
|
|
193
193
|
${Gc.arrowLeft}/${Gc.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:Ai.gray("Enter something to filter")}
|
|
198
|
-
`}renderOption(t,r,i){let n;return r.disabled?n=t===i?Ai.gray().underline(r.title):Ai.strikethrough().gray(r.title):n=t===i?Ai.cyan().underline(r.title):r.title,(r.selected?Ai.green(Gc.radioOn):Gc.radioOff)+" "+n}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let t=[Ai.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(Ai.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Ise.hide),super.render();let t=[n3.symbol(this.done,this.aborted),Ai.bold(this.msg),n3.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=Ai.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=r3(t,this.out.columns)}};i3.exports=Aw});var l3=P((
|
|
198
|
+
`}renderOption(t,r,i){let n;return r.disabled?n=t===i?Ai.gray().underline(r.title):Ai.strikethrough().gray(r.title):n=t===i?Ai.cyan().underline(r.title):r.title,(r.selected?Ai.green(Gc.radioOn):Gc.radioOff)+" "+n}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let t=[Ai.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(Ai.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Ise.hide),super.render();let t=[n3.symbol(this.done,this.aborted),Ai.bold(this.msg),n3.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=Ai.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=r3(t,this.out.columns)}};i3.exports=Aw});var l3=P((jIe,u3)=>{var o3=Ke(),wse=Ei(),{style:s3,clear:kse}=rn(),{erase:Nse,cursor:c3}=Ze(),_w=class extends wse{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(c3.hide):this.out.write(kse(this.outputText,this.out.columns)),super.render(),this.outputText=[s3.symbol(this.done,this.aborted),o3.bold(this.msg),s3.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:o3.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Nse.line+c3.to(0)+this.outputText))}};u3.exports=_w});var p3=P(($Ie,d3)=>{"use strict";d3.exports={TextPrompt:uV(),SelectPrompt:mV(),TogglePrompt:yV(),DatePrompt:GV(),NumberPrompt:ZV(),MultiselectPrompt:bw(),AutocompletePrompt:t3(),AutocompleteMultiselectPrompt:a3(),ConfirmPrompt:l3()}});var f3=P(m3=>{"use strict";var Xt=m3,Pse=p3(),jy=e=>e;function $n(e,t,r={}){return new Promise((i,n)=>{let a=new Pse[e](t),o=r.onAbort||jy,s=r.onSubmit||jy,u=r.onExit||jy;a.on("state",t.onState||jy),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 Rse=(e,t)=>Promise.resolve(t.filter(r=>r.title.slice(0,e.length).toLowerCase()===e.toLowerCase()));Xt.autocomplete=e=>(e.suggest=e.suggest||Rse,e.choices=[].concat(e.choices||[]),$n("AutocompletePrompt",e))});var y3=P((MIe,g3)=>{"use strict";var Tw=f3(),Ose=["suggest","format","onState","validate","onRender","type"],h3=()=>{};async function la(e=[],{onSubmit:t=h3,onCancel:r=h3}={}){let i={},n=la._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(Ose.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,Tw[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=la._injected?$se(la._injected,o.initial):await Tw[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 $se(e,t){let r=e.shift();if(r instanceof Error)throw r;return r===void 0?t:r}function jse(e){la._injected=(la._injected||[]).concat(e)}function Mse(e){la._override=Object.assign({},e)}g3.exports=Object.assign(la,{prompt:la,prompts:Tw,inject:jse,override:Mse})});var Cw=P((FIe,v3)=>{function Fse(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}v3.exports=Fse("8.6.0")?GG():y3()});import*as Lc from"fs";import*as M4 from"path";var w3=Object.defineProperty,Ti=(e,t)=>w3(e,"name",{value:t,configurable:!0});function Qe(e){return e.replace(/[-_](.)/g,(t,r)=>r.toUpperCase()).replace(/^./,t=>t.toUpperCase())}Ti(Qe,"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()}Ti(gr,"toKebab");function Po(e){return gr(e).replace(/-/g,"_")}Ti(Po,"toValidDatabaseName");function Pw(e){return gr(e).replace(/-/g,"_").toUpperCase()}Ti(Pw,"toScreamingSnake");function Rw(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}Ti(Rw,"capitalise");function Ow(e){return e.split(".").join("")}Ti(Ow,"getSafeZoneName");function ha(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}Ti(ha,"accountConstructKey");function $w(e){let t=e.replace(new RegExp("\\P{ASCII}","gu"),"");return ha(t)===ha(e)&&ha(e)!==""}Ti($w,"hasAsciiStableConstructKey");var k3=Object.defineProperty,Ro=(e,t)=>k3(e,"name",{value:t,configurable:!0});function Oo(e){return`${Qe(e.split(".").join(""))}Domain`}Ro(Oo,"getDomainStackName");function jw(e){return`${e}UsEast1Certificates`}Ro(jw,"getDomainUsEast1CertificatesStackName");function Ky(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`}}Ro(Ky,"getDomainExportNames");var Mw=1e3;function Fw(e){let t=[],r=[];for(let i of e){let n=[...r,i];r.length>0&&Buffer.byteLength(JSON.stringify(n),"utf8")>Mw?(t.push(r),r=[i]):r=n}return r.length>0&&t.push(r),t.map(i=>JSON.stringify(i))}Ro(Fw,"serialiseHostsChunks");function Lw(e,t){return`${e}-${t}`}Ro(Lw,"hostsExportPartName");function Uw(e){return typeof e.hostedZoneId=="string"}Ro(Uw,"isManagedDomainBinding");var N3=Object.defineProperty,P3=(e,t)=>N3(e,"name",{value:t,configurable:!0});function zw(e){return`${Qe(e)}ImageTag`}P3(zw,"imageTagParameterName");var R3=Object.defineProperty,zn=(e,t)=>R3(e,"name",{value:t,configurable:!0});function ga(e){return Qe(e.replace(/[^A-Za-z0-9-]/g,""))}zn(ga,"safeExportToken");function Zy(e,t){let r=ga(e);return t===void 0?r:`${r}-${ga(t)}-`}zn(Zy,"albExportScope");function Bw(e,t){return`${Zy(e,t)}AlbDnsName`}zn(Bw,"albDnsExportName");function Gw(e,t){return`${Zy(e,t)}AlbHostedZoneId`}zn(Gw,"albHostedZoneIdExportName");function Vw(e,t){let r=ga(e);return t===void 0?r:`${r}-${ga(t)}-`}zn(Vw,"cdnExportScope");function Ww(e,t){return`${Vw(e,t)}CdnDistributionDomainName`}zn(Ww,"cdnDomainExportName");function qy(e,t){return`${ga(e)}-${ga(t)}-`}zn(qy,"bucketExportScope");function Kw(e,t){return`${qy(e,t)}WebsiteEndpoint`}zn(Kw,"bucketWebsiteEndpointExportName");function Zw(e,t){return`${qy(e,t)}WebsiteHostedZoneId`}zn(Zw,"bucketWebsiteHostedZoneIdExportName");var c={};Ur(c,{$brand:()=>Jy,$input:()=>yS,$output:()=>gS,NEVER:()=>Hy,TimePrecision:()=>ES,ZodAny:()=>lx,ZodArray:()=>fx,ZodBase64:()=>$m,ZodBase64URL:()=>jm,ZodBigInt:()=>ds,ZodBigIntFormat:()=>Lm,ZodBoolean:()=>ls,ZodCIDRv4:()=>Rm,ZodCIDRv6:()=>Om,ZodCUID:()=>Cm,ZodCUID2:()=>Im,ZodCatch:()=>jx,ZodCodec:()=>Au,ZodCustom:()=>_u,ZodCustomStringFormat:()=>cs,ZodDate:()=>vu,ZodDefault:()=>kx,ZodDiscriminatedUnion:()=>gx,ZodE164:()=>Mm,ZodEmail:()=>Am,ZodEmoji:()=>_m,ZodEnum:()=>os,ZodError:()=>lZ,ZodExactOptional:()=>Ix,ZodFile:()=>Tx,ZodFirstPartyTypeKind:()=>Hx,ZodFunction:()=>Kx,ZodGUID:()=>mu,ZodIPv4:()=>Nm,ZodIPv6:()=>Pm,ZodISODate:()=>ym,ZodISODateTime:()=>gm,ZodISODuration:()=>bm,ZodISOTime:()=>vm,ZodIntersection:()=>yx,ZodIssueCode:()=>pZ,ZodJWT:()=>Fm,ZodKSUID:()=>km,ZodLazy:()=>Gx,ZodLiteral:()=>_x,ZodMAC:()=>nx,ZodMap:()=>xx,ZodNaN:()=>Fx,ZodNanoID:()=>Tm,ZodNever:()=>px,ZodNonOptional:()=>Wm,ZodNull:()=>cx,ZodNullable:()=>wx,ZodNumber:()=>us,ZodNumberFormat:()=>Ta,ZodObject:()=>Su,ZodOptional:()=>Vm,ZodPipe:()=>xu,ZodPrefault:()=>Px,ZodPreprocess:()=>Lx,ZodPromise:()=>Wx,ZodReadonly:()=>Ux,ZodRealError:()=>Lt,ZodRecord:()=>as,ZodSet:()=>Ax,ZodString:()=>ss,ZodStringFormat:()=>Ie,ZodSuccess:()=>$x,ZodSymbol:()=>ox,ZodTemplateLiteral:()=>Bx,ZodTransform:()=>Cx,ZodTuple:()=>bx,ZodType:()=>re,ZodULID:()=>Dm,ZodURL:()=>yu,ZodUUID:()=>sn,ZodUndefined:()=>sx,ZodUnion:()=>Eu,ZodUnknown:()=>dx,ZodVoid:()=>mx,ZodXID:()=>wm,ZodXor:()=>hx,_ZodString:()=>xm,_default:()=>Nx,_function:()=>$P,any:()=>pP,array:()=>bu,base64:()=>HN,base64url:()=>JN,bigint:()=>sP,boolean:()=>ax,catch:()=>Mx,check:()=>jP,cidrv4:()=>ZN,cidrv6:()=>qN,clone:()=>Ct,codec:()=>NP,coerce:()=>Jx,config:()=>qe,core:()=>Vn,cuid:()=>LN,cuid2:()=>UN,custom:()=>MP,date:()=>fP,decode:()=>JE,decodeAsync:()=>YE,describe:()=>FP,discriminatedUnion:()=>SP,e164:()=>XN,email:()=>wN,emoji:()=>MN,encode:()=>HE,encodeAsync:()=>XE,endsWith:()=>Ho,enum:()=>Bm,exactOptional:()=>Dx,file:()=>IP,flattenError:()=>Qc,float32:()=>nP,float64:()=>iP,formatError:()=>eu,fromJSONSchema:()=>WP,function:()=>$P,getErrorMap:()=>fZ,globalRegistry:()=>mt,gt:()=>an,gte:()=>Dt,guid:()=>kN,hash:()=>rP,hex:()=>tP,hostname:()=>eP,httpUrl:()=>jN,includes:()=>Zo,instanceof:()=>UP,int:()=>Sm,int32:()=>aP,int64:()=>cP,intersection:()=>vx,invertCodec:()=>PP,ipv4:()=>VN,ipv6:()=>KN,iso:()=>is,json:()=>BP,jwt:()=>YN,keyof:()=>hP,ksuid:()=>GN,lazy:()=>Vx,length:()=>Aa,literal:()=>CP,locales:()=>cu,looseObject:()=>vP,looseRecord:()=>xP,lowercase:()=>Wo,lt:()=>nn,lte:()=>er,mac:()=>WN,map:()=>AP,maxLength:()=>xa,maxSize:()=>Pi,meta:()=>LP,mime:()=>Jo,minLength:()=>Gn,minSize:()=>on,multipleOf:()=>Ni,nan:()=>kP,nanoid:()=>FN,nativeEnum:()=>TP,negative:()=>om,never:()=>Um,nonnegative:()=>cm,nonoptional:()=>Ox,nonpositive:()=>sm,normalize:()=>Xo,null:()=>ux,nullable:()=>hu,nullish:()=>DP,number:()=>ix,object:()=>gP,optional:()=>fu,overwrite:()=>Br,parse:()=>WE,parseAsync:()=>KE,partialRecord:()=>EP,pipe:()=>Em,positive:()=>am,prefault:()=>Rx,preprocess:()=>GP,prettifyError:()=>uv,promise:()=>OP,property:()=>um,readonly:()=>zx,record:()=>Ex,refine:()=>Zx,regex:()=>Vo,regexes:()=>Qt,registry:()=>Fp,safeDecode:()=>ex,safeDecodeAsync:()=>rx,safeEncode:()=>QE,safeEncodeAsync:()=>tx,safeParse:()=>ZE,safeParseAsync:()=>qE,set:()=>_P,setErrorMap:()=>mZ,size:()=>Ea,slugify:()=>ts,startsWith:()=>qo,strictObject:()=>yP,string:()=>pu,stringFormat:()=>QN,stringbool:()=>zP,success:()=>wP,superRefine:()=>qx,symbol:()=>lP,templateLiteral:()=>RP,toJSONSchema:()=>mm,toLowerCase:()=>Qo,toUpperCase:()=>es,transform:()=>Gm,treeifyError:()=>cv,trim:()=>Yo,tuple:()=>Sx,uint32:()=>oP,uint64:()=>uP,ulid:()=>zN,undefined:()=>dP,union:()=>zm,unknown:()=>_a,uppercase:()=>Ko,url:()=>$N,util:()=>M,uuid:()=>NN,uuidv4:()=>PN,uuidv6:()=>RN,uuidv7:()=>ON,void:()=>mP,xid:()=>BN,xor:()=>bP});var Vn={};Ur(Vn,{$ZodAny:()=>Fb,$ZodArray:()=>Gb,$ZodAsyncError:()=>zr,$ZodBase64:()=>Db,$ZodBase64URL:()=>wb,$ZodBigInt:()=>kp,$ZodBigIntFormat:()=>Ob,$ZodBoolean:()=>iu,$ZodCIDRv4:()=>Tb,$ZodCIDRv6:()=>Cb,$ZodCUID:()=>mb,$ZodCUID2:()=>fb,$ZodCatch:()=>sS,$ZodCheck:()=>we,$ZodCheckBigIntFormat:()=>Gv,$ZodCheckEndsWith:()=>tb,$ZodCheckGreaterThan:()=>_p,$ZodCheckIncludes:()=>Qv,$ZodCheckLengthEquals:()=>Hv,$ZodCheckLessThan:()=>Ap,$ZodCheckLowerCase:()=>Xv,$ZodCheckMaxLength:()=>Zv,$ZodCheckMaxSize:()=>Vv,$ZodCheckMimeType:()=>nb,$ZodCheckMinLength:()=>qv,$ZodCheckMinSize:()=>Wv,$ZodCheckMultipleOf:()=>zv,$ZodCheckNumberFormat:()=>Bv,$ZodCheckOverwrite:()=>ib,$ZodCheckProperty:()=>rb,$ZodCheckRegex:()=>Jv,$ZodCheckSizeEquals:()=>Kv,$ZodCheckStartsWith:()=>eb,$ZodCheckStringFormat:()=>Bo,$ZodCheckUpperCase:()=>Yv,$ZodCodec:()=>ou,$ZodCustom:()=>hS,$ZodCustomStringFormat:()=>Pb,$ZodDate:()=>Bb,$ZodDefault:()=>nS,$ZodDiscriminatedUnion:()=>Kb,$ZodE164:()=>kb,$ZodEmail:()=>ub,$ZodEmoji:()=>db,$ZodEncodeError:()=>Ci,$ZodEnum:()=>Xb,$ZodError:()=>Yc,$ZodExactOptional:()=>tS,$ZodFile:()=>Qb,$ZodFunction:()=>pS,$ZodGUID:()=>sb,$ZodIPv4:()=>xb,$ZodIPv6:()=>Ab,$ZodISODate:()=>bb,$ZodISODateTime:()=>vb,$ZodISODuration:()=>Eb,$ZodISOTime:()=>Sb,$ZodIntersection:()=>Zb,$ZodJWT:()=>Nb,$ZodKSUID:()=>yb,$ZodLazy:()=>fS,$ZodLiteral:()=>Yb,$ZodMAC:()=>_b,$ZodMap:()=>Hb,$ZodNaN:()=>cS,$ZodNanoID:()=>pb,$ZodNever:()=>Ub,$ZodNonOptional:()=>aS,$ZodNull:()=>Mb,$ZodNullable:()=>rS,$ZodNumber:()=>wp,$ZodNumberFormat:()=>Rb,$ZodObject:()=>_k,$ZodObjectJIT:()=>Vb,$ZodOptional:()=>Pp,$ZodPipe:()=>Rp,$ZodPrefault:()=>iS,$ZodPreprocess:()=>uS,$ZodPromise:()=>mS,$ZodReadonly:()=>lS,$ZodRealError:()=>Ft,$ZodRecord:()=>qb,$ZodRegistry:()=>Mp,$ZodSet:()=>Jb,$ZodString:()=>Sa,$ZodStringFormat:()=>Ce,$ZodSuccess:()=>oS,$ZodSymbol:()=>$b,$ZodTemplateLiteral:()=>dS,$ZodTransform:()=>eS,$ZodTuple:()=>Np,$ZodType:()=>ee,$ZodULID:()=>hb,$ZodURL:()=>lb,$ZodUUID:()=>cb,$ZodUndefined:()=>jb,$ZodUnion:()=>au,$ZodUnknown:()=>Lb,$ZodVoid:()=>zb,$ZodXID:()=>gb,$ZodXor:()=>Wb,$brand:()=>Jy,$constructor:()=>T,$input:()=>yS,$output:()=>gS,Doc:()=>nu,JSONSchema:()=>CN,JSONSchemaGenerator:()=>fm,NEVER:()=>Hy,TimePrecision:()=>ES,_any:()=>BS,_array:()=>HS,_base64:()=>tm,_base64url:()=>rm,_bigint:()=>$S,_boolean:()=>RS,_catch:()=>rZ,_check:()=>TN,_cidrv4:()=>Qp,_cidrv6:()=>em,_coercedBigint:()=>jS,_coercedBoolean:()=>OS,_coercedDate:()=>ZS,_coercedNumber:()=>IS,_coercedString:()=>bS,_cuid:()=>Kp,_cuid2:()=>Zp,_custom:()=>XS,_date:()=>KS,_decode:()=>fp,_decodeAsync:()=>gp,_default:()=>QK,_discriminatedUnion:()=>zK,_e164:()=>nm,_email:()=>Lp,_emoji:()=>Vp,_encode:()=>mp,_encodeAsync:()=>hp,_endsWith:()=>Ho,_enum:()=>ZK,_file:()=>JS,_float32:()=>wS,_float64:()=>kS,_gt:()=>an,_gte:()=>Dt,_guid:()=>uu,_includes:()=>Zo,_int:()=>DS,_int32:()=>NS,_int64:()=>MS,_intersection:()=>BK,_ipv4:()=>Xp,_ipv6:()=>Yp,_isoDate:()=>AS,_isoDateTime:()=>xS,_isoDuration:()=>TS,_isoTime:()=>_S,_jwt:()=>im,_ksuid:()=>Jp,_lazy:()=>oZ,_length:()=>Aa,_literal:()=>HK,_lowercase:()=>Wo,_lt:()=>nn,_lte:()=>er,_mac:()=>SS,_map:()=>WK,_max:()=>er,_maxLength:()=>xa,_maxSize:()=>Pi,_mime:()=>Jo,_min:()=>Dt,_minLength:()=>Gn,_minSize:()=>on,_multipleOf:()=>Ni,_nan:()=>qS,_nanoid:()=>Wp,_nativeEnum:()=>qK,_negative:()=>om,_never:()=>VS,_nonnegative:()=>cm,_nonoptional:()=>eZ,_nonpositive:()=>sm,_normalize:()=>Xo,_null:()=>zS,_nullable:()=>YK,_number:()=>CS,_optional:()=>XK,_overwrite:()=>Br,_parse:()=>Fo,_parseAsync:()=>Lo,_pipe:()=>nZ,_positive:()=>am,_promise:()=>sZ,_property:()=>um,_readonly:()=>iZ,_record:()=>VK,_refine:()=>YS,_regex:()=>Vo,_safeDecode:()=>vp,_safeDecodeAsync:()=>Sp,_safeEncode:()=>yp,_safeEncodeAsync:()=>bp,_safeParse:()=>Uo,_safeParseAsync:()=>zo,_set:()=>KK,_size:()=>Ea,_slugify:()=>ts,_startsWith:()=>qo,_string:()=>vS,_stringFormat:()=>rs,_stringbool:()=>rE,_success:()=>tZ,_superRefine:()=>QS,_symbol:()=>LS,_templateLiteral:()=>aZ,_toLowerCase:()=>Qo,_toUpperCase:()=>es,_transform:()=>JK,_trim:()=>Yo,_tuple:()=>GK,_uint32:()=>PS,_uint64:()=>FS,_ulid:()=>qp,_undefined:()=>US,_union:()=>LK,_unknown:()=>GS,_uppercase:()=>Ko,_url:()=>lu,_uuid:()=>Up,_uuidv4:()=>zp,_uuidv6:()=>Bp,_uuidv7:()=>Gp,_void:()=>WS,_xid:()=>Hp,_xor:()=>UK,clone:()=>Ct,config:()=>qe,createStandardJSONSchemaMethod:()=>ns,createToJSONSchemaMethod:()=>nE,decode:()=>sW,decodeAsync:()=>uW,describe:()=>eE,encode:()=>oW,encodeAsync:()=>cW,extractDefs:()=>Oi,finalize:()=>$i,flattenError:()=>Qc,formatError:()=>eu,globalConfig:()=>ya,globalRegistry:()=>mt,initializeContext:()=>Ri,isValidBase64:()=>Ib,isValidBase64URL:()=>Sk,isValidJWT:()=>Ek,locales:()=>cu,meta:()=>tE,parse:()=>dp,parseAsync:()=>pp,prettifyError:()=>uv,process:()=>Ee,regexes:()=>Qt,registry:()=>Fp,safeDecode:()=>dW,safeDecodeAsync:()=>mW,safeEncode:()=>lW,safeEncodeAsync:()=>pW,safeParse:()=>lv,safeParseAsync:()=>dv,toDotPath:()=>Qw,toJSONSchema:()=>mm,treeifyError:()=>cv,util:()=>M,version:()=>ab});var qw,Hy=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 Jy=Symbol("zod_brand"),zr=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Ci=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(qw=globalThis).__zod_globalConfig??(qw.__zod_globalConfig={});var ya=globalThis.__zod_globalConfig;function qe(e){return e&&Object.assign(ya,e),ya}var M={};Ur(M,{BIGINT_FORMAT_RANGES:()=>ov,Class:()=>Yy,NUMBER_FORMAT_RANGES:()=>av,aborted:()=>ki,allowsEval:()=>tv,assert:()=>F3,assertEqual:()=>O3,assertIs:()=>j3,assertNever:()=>M3,assertNotEqual:()=>$3,assignProp:()=>Di,base64ToUint8Array:()=>Jw,base64urlToUint8Array:()=>tW,cached:()=>jo,captureStackTrace:()=>lp,cleanEnum:()=>eW,cleanRegex:()=>qc,clone:()=>Ct,cloneDef:()=>U3,createTransparentProxy:()=>K3,defineLazy:()=>ue,esc:()=>up,escapeRegex:()=>yr,explicitlyAborted:()=>sv,extend:()=>H3,finalizeIssue:()=>It,floatSafeRemainder:()=>Qy,getElementAtPath:()=>z3,getEnumValues:()=>Zc,getLengthableOrigin:()=>Xc,getParsedType:()=>W3,getSizableOrigin:()=>Jc,hexToUint8Array:()=>nW,isObject:()=>va,isPlainObject:()=>wi,issue:()=>Mo,joinValues:()=>D,jsonStringifyReplacer:()=>$o,merge:()=>X3,mergeDefs:()=>Bn,normalizeParams:()=>L,nullish:()=>Ii,numKeys:()=>V3,objectClone:()=>L3,omit:()=>q3,optionalKeys:()=>iv,parsedType:()=>j,partial:()=>Y3,pick:()=>Z3,prefixIssues:()=>Mt,primitiveTypes:()=>nv,promiseAllObject:()=>B3,propertyKeyTypes:()=>Hc,randomString:()=>G3,required:()=>Q3,safeExtend:()=>J3,shallowClone:()=>rv,slugify:()=>ev,stringifyPrimitive:()=>O,uint8ArrayToBase64:()=>Xw,uint8ArrayToBase64url:()=>rW,uint8ArrayToHex:()=>iW,unwrapMessage:()=>Kc});function O3(e){return e}function $3(e){return e}function j3(e){}function M3(e){throw new Error("Unexpected value in exhaustive check")}function F3(e){}function Zc(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 $o(e,t){return typeof t=="bigint"?t.toString():t}function jo(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Ii(e){return e==null}function qc(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Qy(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 Hw=Symbol("evaluating");function ue(e,t,r){let i;Object.defineProperty(e,t,{get(){if(i!==Hw)return i===void 0&&(i=Hw,i=r()),i},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function L3(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Di(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 U3(e){return Bn(e._zod.def)}function z3(e,t){return t?t.reduce((r,i)=>r?.[i],e):e}function B3(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 G3(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let i=0;i<e;i++)r+=t[Math.floor(Math.random()*t.length)];return r}function up(e){return JSON.stringify(e)}function ev(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var lp="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function va(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var tv=jo(()=>{if(ya.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function wi(e){if(va(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(va(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function rv(e){return wi(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function V3(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var W3=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}`)}},Hc=new Set(["string","number","symbol"]),nv=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 K3(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 iv(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var av={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]},ov={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Z3(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 Di(this,"shape",o),o},checks:[]});return Ct(e,a)}function q3(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 Di(this,"shape",o),o},checks:[]});return Ct(e,a)}function H3(e,t){if(!wi(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 Di(this,"shape",a),a}});return Ct(e,n)}function J3(e,t){if(!wi(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 Di(this,"shape",i),i}});return Ct(e,r)}function X3(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 Di(this,"shape",i),i},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Ct(e,r)}function Y3(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 Di(this,"shape",u),u},checks:[]});return Ct(t,o)}function Q3(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 Di(this,"shape",a),a}});return Ct(t,i)}function ki(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 sv(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 Kc(e){return typeof e=="string"?e:e?.message}function It(e,t,r){let i=e.message?e.message:Kc(e.inst?._zod.def?.error?.(e))??Kc(t?.error?.(e))??Kc(r.customError?.(e))??Kc(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 Jc(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Xc(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 Mo(...e){let[t,r,i]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:i}:{...t}}function eW(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Jw(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 Xw(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function tW(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Jw(t+r)}function rW(e){return Xw(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function nW(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 iW(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Yy=class{constructor(...t){}};var Yw=(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,$o,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Yc=T("$ZodError",Yw),Ft=T("$ZodError",Yw,{Parent:Error});function Qc(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 eu(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 cv(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 Qw(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 uv(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 ${Qw(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(c3.hide):this.out.write(kse(this.outputText,this.out.columns)),super.render(),this.outputText=[s3.symbol(this.done,this.aborted),o3.bold(this.msg),s3.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:o3.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Nse.line+c3.to(0)+this.outputText))}};u3.exports=_w});var p3=P((MIe,d3)=>{"use strict";d3.exports={TextPrompt:uV(),SelectPrompt:mV(),TogglePrompt:yV(),DatePrompt:GV(),NumberPrompt:ZV(),MultiselectPrompt:bw(),AutocompletePrompt:t3(),AutocompleteMultiselectPrompt:a3(),ConfirmPrompt:l3()}});var f3=P(m3=>{"use strict";var Xt=m3,Pse=p3(),jy=e=>e;function $n(e,t,r={}){return new Promise((i,n)=>{let a=new Pse[e](t),o=r.onAbort||jy,s=r.onSubmit||jy,u=r.onExit||jy;a.on("state",t.onState||jy),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 Rse=(e,t)=>Promise.resolve(t.filter(r=>r.title.slice(0,e.length).toLowerCase()===e.toLowerCase()));Xt.autocomplete=e=>(e.suggest=e.suggest||Rse,e.choices=[].concat(e.choices||[]),$n("AutocompletePrompt",e))});var y3=P((LIe,g3)=>{"use strict";var Tw=f3(),Ose=["suggest","format","onState","validate","onRender","type"],h3=()=>{};async function la(e=[],{onSubmit:t=h3,onCancel:r=h3}={}){let i={},n=la._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(Ose.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,Tw[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=la._injected?$se(la._injected,o.initial):await Tw[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 $se(e,t){let r=e.shift();if(r instanceof Error)throw r;return r===void 0?t:r}function jse(e){la._injected=(la._injected||[]).concat(e)}function Mse(e){la._override=Object.assign({},e)}g3.exports=Object.assign(la,{prompt:la,prompts:Tw,inject:jse,override:Mse})});var Cw=P((UIe,v3)=>{function Fse(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}v3.exports=Fse("8.6.0")?GG():y3()});import*as Lc from"fs";import*as M4 from"path";var w3=Object.defineProperty,Ti=(e,t)=>w3(e,"name",{value:t,configurable:!0});function Qe(e){return e.replace(/[-_](.)/g,(t,r)=>r.toUpperCase()).replace(/^./,t=>t.toUpperCase())}Ti(Qe,"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()}Ti(gr,"toKebab");function Po(e){return gr(e).replace(/-/g,"_")}Ti(Po,"toValidDatabaseName");function Pw(e){return gr(e).replace(/-/g,"_").toUpperCase()}Ti(Pw,"toScreamingSnake");function Rw(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}Ti(Rw,"capitalise");function Ow(e){return e.split(".").join("")}Ti(Ow,"getSafeZoneName");function ha(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}Ti(ha,"accountConstructKey");function $w(e){let t=e.replace(new RegExp("\\P{ASCII}","gu"),"");return ha(t)===ha(e)&&ha(e)!==""}Ti($w,"hasAsciiStableConstructKey");var k3=Object.defineProperty,Ro=(e,t)=>k3(e,"name",{value:t,configurable:!0});function Oo(e){return`${Qe(e.split(".").join(""))}Domain`}Ro(Oo,"getDomainStackName");function jw(e){return`${e}UsEast1Certificates`}Ro(jw,"getDomainUsEast1CertificatesStackName");function Ky(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`}}Ro(Ky,"getDomainExportNames");var Mw=1e3;function Fw(e){let t=[],r=[];for(let i of e){let n=[...r,i];r.length>0&&Buffer.byteLength(JSON.stringify(n),"utf8")>Mw?(t.push(r),r=[i]):r=n}return r.length>0&&t.push(r),t.map(i=>JSON.stringify(i))}Ro(Fw,"serialiseHostsChunks");function Lw(e,t){return`${e}-${t}`}Ro(Lw,"hostsExportPartName");function Uw(e){return typeof e.hostedZoneId=="string"}Ro(Uw,"isManagedDomainBinding");var N3=Object.defineProperty,P3=(e,t)=>N3(e,"name",{value:t,configurable:!0});function zw(e){return`${Qe(e)}ImageTag`}P3(zw,"imageTagParameterName");var R3=Object.defineProperty,zn=(e,t)=>R3(e,"name",{value:t,configurable:!0});function ga(e){return Qe(e.replace(/[^A-Za-z0-9-]/g,""))}zn(ga,"safeExportToken");function Zy(e,t){let r=ga(e);return t===void 0?r:`${r}-${ga(t)}-`}zn(Zy,"albExportScope");function Bw(e,t){return`${Zy(e,t)}AlbDnsName`}zn(Bw,"albDnsExportName");function Gw(e,t){return`${Zy(e,t)}AlbHostedZoneId`}zn(Gw,"albHostedZoneIdExportName");function Vw(e,t){let r=ga(e);return t===void 0?r:`${r}-${ga(t)}-`}zn(Vw,"cdnExportScope");function Ww(e,t){return`${Vw(e,t)}CdnDistributionDomainName`}zn(Ww,"cdnDomainExportName");function qy(e,t){return`${ga(e)}-${ga(t)}-`}zn(qy,"bucketExportScope");function Kw(e,t){return`${qy(e,t)}WebsiteEndpoint`}zn(Kw,"bucketWebsiteEndpointExportName");function Zw(e,t){return`${qy(e,t)}WebsiteHostedZoneId`}zn(Zw,"bucketWebsiteHostedZoneIdExportName");var c={};Ur(c,{$brand:()=>Jy,$input:()=>yS,$output:()=>gS,NEVER:()=>Hy,TimePrecision:()=>ES,ZodAny:()=>lx,ZodArray:()=>fx,ZodBase64:()=>$m,ZodBase64URL:()=>jm,ZodBigInt:()=>ds,ZodBigIntFormat:()=>Lm,ZodBoolean:()=>ls,ZodCIDRv4:()=>Rm,ZodCIDRv6:()=>Om,ZodCUID:()=>Cm,ZodCUID2:()=>Im,ZodCatch:()=>jx,ZodCodec:()=>Au,ZodCustom:()=>_u,ZodCustomStringFormat:()=>cs,ZodDate:()=>vu,ZodDefault:()=>kx,ZodDiscriminatedUnion:()=>gx,ZodE164:()=>Mm,ZodEmail:()=>Am,ZodEmoji:()=>_m,ZodEnum:()=>os,ZodError:()=>lZ,ZodExactOptional:()=>Ix,ZodFile:()=>Tx,ZodFirstPartyTypeKind:()=>Hx,ZodFunction:()=>Kx,ZodGUID:()=>mu,ZodIPv4:()=>Nm,ZodIPv6:()=>Pm,ZodISODate:()=>ym,ZodISODateTime:()=>gm,ZodISODuration:()=>bm,ZodISOTime:()=>vm,ZodIntersection:()=>yx,ZodIssueCode:()=>pZ,ZodJWT:()=>Fm,ZodKSUID:()=>km,ZodLazy:()=>Gx,ZodLiteral:()=>_x,ZodMAC:()=>nx,ZodMap:()=>xx,ZodNaN:()=>Fx,ZodNanoID:()=>Tm,ZodNever:()=>px,ZodNonOptional:()=>Wm,ZodNull:()=>cx,ZodNullable:()=>wx,ZodNumber:()=>us,ZodNumberFormat:()=>Ta,ZodObject:()=>Su,ZodOptional:()=>Vm,ZodPipe:()=>xu,ZodPrefault:()=>Px,ZodPreprocess:()=>Lx,ZodPromise:()=>Wx,ZodReadonly:()=>Ux,ZodRealError:()=>Lt,ZodRecord:()=>as,ZodSet:()=>Ax,ZodString:()=>ss,ZodStringFormat:()=>Ie,ZodSuccess:()=>$x,ZodSymbol:()=>ox,ZodTemplateLiteral:()=>Bx,ZodTransform:()=>Cx,ZodTuple:()=>bx,ZodType:()=>re,ZodULID:()=>Dm,ZodURL:()=>yu,ZodUUID:()=>sn,ZodUndefined:()=>sx,ZodUnion:()=>Eu,ZodUnknown:()=>dx,ZodVoid:()=>mx,ZodXID:()=>wm,ZodXor:()=>hx,_ZodString:()=>xm,_default:()=>Nx,_function:()=>$P,any:()=>pP,array:()=>bu,base64:()=>HN,base64url:()=>JN,bigint:()=>sP,boolean:()=>ax,catch:()=>Mx,check:()=>jP,cidrv4:()=>ZN,cidrv6:()=>qN,clone:()=>Ct,codec:()=>NP,coerce:()=>Jx,config:()=>qe,core:()=>Vn,cuid:()=>LN,cuid2:()=>UN,custom:()=>MP,date:()=>fP,decode:()=>JE,decodeAsync:()=>YE,describe:()=>FP,discriminatedUnion:()=>SP,e164:()=>XN,email:()=>wN,emoji:()=>MN,encode:()=>HE,encodeAsync:()=>XE,endsWith:()=>Ho,enum:()=>Bm,exactOptional:()=>Dx,file:()=>IP,flattenError:()=>Qc,float32:()=>nP,float64:()=>iP,formatError:()=>eu,fromJSONSchema:()=>WP,function:()=>$P,getErrorMap:()=>fZ,globalRegistry:()=>mt,gt:()=>an,gte:()=>Dt,guid:()=>kN,hash:()=>rP,hex:()=>tP,hostname:()=>eP,httpUrl:()=>jN,includes:()=>Zo,instanceof:()=>UP,int:()=>Sm,int32:()=>aP,int64:()=>cP,intersection:()=>vx,invertCodec:()=>PP,ipv4:()=>VN,ipv6:()=>KN,iso:()=>is,json:()=>BP,jwt:()=>YN,keyof:()=>hP,ksuid:()=>GN,lazy:()=>Vx,length:()=>Aa,literal:()=>CP,locales:()=>cu,looseObject:()=>vP,looseRecord:()=>xP,lowercase:()=>Wo,lt:()=>nn,lte:()=>er,mac:()=>WN,map:()=>AP,maxLength:()=>xa,maxSize:()=>Pi,meta:()=>LP,mime:()=>Jo,minLength:()=>Gn,minSize:()=>on,multipleOf:()=>Ni,nan:()=>kP,nanoid:()=>FN,nativeEnum:()=>TP,negative:()=>om,never:()=>Um,nonnegative:()=>cm,nonoptional:()=>Ox,nonpositive:()=>sm,normalize:()=>Xo,null:()=>ux,nullable:()=>hu,nullish:()=>DP,number:()=>ix,object:()=>gP,optional:()=>fu,overwrite:()=>Br,parse:()=>WE,parseAsync:()=>KE,partialRecord:()=>EP,pipe:()=>Em,positive:()=>am,prefault:()=>Rx,preprocess:()=>GP,prettifyError:()=>uv,promise:()=>OP,property:()=>um,readonly:()=>zx,record:()=>Ex,refine:()=>Zx,regex:()=>Vo,regexes:()=>Qt,registry:()=>Fp,safeDecode:()=>ex,safeDecodeAsync:()=>rx,safeEncode:()=>QE,safeEncodeAsync:()=>tx,safeParse:()=>ZE,safeParseAsync:()=>qE,set:()=>_P,setErrorMap:()=>mZ,size:()=>Ea,slugify:()=>ts,startsWith:()=>qo,strictObject:()=>yP,string:()=>pu,stringFormat:()=>QN,stringbool:()=>zP,success:()=>wP,superRefine:()=>qx,symbol:()=>lP,templateLiteral:()=>RP,toJSONSchema:()=>mm,toLowerCase:()=>Qo,toUpperCase:()=>es,transform:()=>Gm,treeifyError:()=>cv,trim:()=>Yo,tuple:()=>Sx,uint32:()=>oP,uint64:()=>uP,ulid:()=>zN,undefined:()=>dP,union:()=>zm,unknown:()=>_a,uppercase:()=>Ko,url:()=>$N,util:()=>M,uuid:()=>NN,uuidv4:()=>PN,uuidv6:()=>RN,uuidv7:()=>ON,void:()=>mP,xid:()=>BN,xor:()=>bP});var Vn={};Ur(Vn,{$ZodAny:()=>Fb,$ZodArray:()=>Gb,$ZodAsyncError:()=>zr,$ZodBase64:()=>Db,$ZodBase64URL:()=>wb,$ZodBigInt:()=>kp,$ZodBigIntFormat:()=>Ob,$ZodBoolean:()=>iu,$ZodCIDRv4:()=>Tb,$ZodCIDRv6:()=>Cb,$ZodCUID:()=>mb,$ZodCUID2:()=>fb,$ZodCatch:()=>sS,$ZodCheck:()=>we,$ZodCheckBigIntFormat:()=>Gv,$ZodCheckEndsWith:()=>tb,$ZodCheckGreaterThan:()=>_p,$ZodCheckIncludes:()=>Qv,$ZodCheckLengthEquals:()=>Hv,$ZodCheckLessThan:()=>Ap,$ZodCheckLowerCase:()=>Xv,$ZodCheckMaxLength:()=>Zv,$ZodCheckMaxSize:()=>Vv,$ZodCheckMimeType:()=>nb,$ZodCheckMinLength:()=>qv,$ZodCheckMinSize:()=>Wv,$ZodCheckMultipleOf:()=>zv,$ZodCheckNumberFormat:()=>Bv,$ZodCheckOverwrite:()=>ib,$ZodCheckProperty:()=>rb,$ZodCheckRegex:()=>Jv,$ZodCheckSizeEquals:()=>Kv,$ZodCheckStartsWith:()=>eb,$ZodCheckStringFormat:()=>Bo,$ZodCheckUpperCase:()=>Yv,$ZodCodec:()=>ou,$ZodCustom:()=>hS,$ZodCustomStringFormat:()=>Pb,$ZodDate:()=>Bb,$ZodDefault:()=>nS,$ZodDiscriminatedUnion:()=>Kb,$ZodE164:()=>kb,$ZodEmail:()=>ub,$ZodEmoji:()=>db,$ZodEncodeError:()=>Ci,$ZodEnum:()=>Xb,$ZodError:()=>Yc,$ZodExactOptional:()=>tS,$ZodFile:()=>Qb,$ZodFunction:()=>pS,$ZodGUID:()=>sb,$ZodIPv4:()=>xb,$ZodIPv6:()=>Ab,$ZodISODate:()=>bb,$ZodISODateTime:()=>vb,$ZodISODuration:()=>Eb,$ZodISOTime:()=>Sb,$ZodIntersection:()=>Zb,$ZodJWT:()=>Nb,$ZodKSUID:()=>yb,$ZodLazy:()=>fS,$ZodLiteral:()=>Yb,$ZodMAC:()=>_b,$ZodMap:()=>Hb,$ZodNaN:()=>cS,$ZodNanoID:()=>pb,$ZodNever:()=>Ub,$ZodNonOptional:()=>aS,$ZodNull:()=>Mb,$ZodNullable:()=>rS,$ZodNumber:()=>wp,$ZodNumberFormat:()=>Rb,$ZodObject:()=>_k,$ZodObjectJIT:()=>Vb,$ZodOptional:()=>Pp,$ZodPipe:()=>Rp,$ZodPrefault:()=>iS,$ZodPreprocess:()=>uS,$ZodPromise:()=>mS,$ZodReadonly:()=>lS,$ZodRealError:()=>Ft,$ZodRecord:()=>qb,$ZodRegistry:()=>Mp,$ZodSet:()=>Jb,$ZodString:()=>Sa,$ZodStringFormat:()=>Ce,$ZodSuccess:()=>oS,$ZodSymbol:()=>$b,$ZodTemplateLiteral:()=>dS,$ZodTransform:()=>eS,$ZodTuple:()=>Np,$ZodType:()=>ee,$ZodULID:()=>hb,$ZodURL:()=>lb,$ZodUUID:()=>cb,$ZodUndefined:()=>jb,$ZodUnion:()=>au,$ZodUnknown:()=>Lb,$ZodVoid:()=>zb,$ZodXID:()=>gb,$ZodXor:()=>Wb,$brand:()=>Jy,$constructor:()=>T,$input:()=>yS,$output:()=>gS,Doc:()=>nu,JSONSchema:()=>CN,JSONSchemaGenerator:()=>fm,NEVER:()=>Hy,TimePrecision:()=>ES,_any:()=>BS,_array:()=>HS,_base64:()=>tm,_base64url:()=>rm,_bigint:()=>$S,_boolean:()=>RS,_catch:()=>rZ,_check:()=>TN,_cidrv4:()=>Qp,_cidrv6:()=>em,_coercedBigint:()=>jS,_coercedBoolean:()=>OS,_coercedDate:()=>ZS,_coercedNumber:()=>IS,_coercedString:()=>bS,_cuid:()=>Kp,_cuid2:()=>Zp,_custom:()=>XS,_date:()=>KS,_decode:()=>fp,_decodeAsync:()=>gp,_default:()=>QK,_discriminatedUnion:()=>zK,_e164:()=>nm,_email:()=>Lp,_emoji:()=>Vp,_encode:()=>mp,_encodeAsync:()=>hp,_endsWith:()=>Ho,_enum:()=>ZK,_file:()=>JS,_float32:()=>wS,_float64:()=>kS,_gt:()=>an,_gte:()=>Dt,_guid:()=>uu,_includes:()=>Zo,_int:()=>DS,_int32:()=>NS,_int64:()=>MS,_intersection:()=>BK,_ipv4:()=>Xp,_ipv6:()=>Yp,_isoDate:()=>AS,_isoDateTime:()=>xS,_isoDuration:()=>TS,_isoTime:()=>_S,_jwt:()=>im,_ksuid:()=>Jp,_lazy:()=>oZ,_length:()=>Aa,_literal:()=>HK,_lowercase:()=>Wo,_lt:()=>nn,_lte:()=>er,_mac:()=>SS,_map:()=>WK,_max:()=>er,_maxLength:()=>xa,_maxSize:()=>Pi,_mime:()=>Jo,_min:()=>Dt,_minLength:()=>Gn,_minSize:()=>on,_multipleOf:()=>Ni,_nan:()=>qS,_nanoid:()=>Wp,_nativeEnum:()=>qK,_negative:()=>om,_never:()=>VS,_nonnegative:()=>cm,_nonoptional:()=>eZ,_nonpositive:()=>sm,_normalize:()=>Xo,_null:()=>zS,_nullable:()=>YK,_number:()=>CS,_optional:()=>XK,_overwrite:()=>Br,_parse:()=>Fo,_parseAsync:()=>Lo,_pipe:()=>nZ,_positive:()=>am,_promise:()=>sZ,_property:()=>um,_readonly:()=>iZ,_record:()=>VK,_refine:()=>YS,_regex:()=>Vo,_safeDecode:()=>vp,_safeDecodeAsync:()=>Sp,_safeEncode:()=>yp,_safeEncodeAsync:()=>bp,_safeParse:()=>Uo,_safeParseAsync:()=>zo,_set:()=>KK,_size:()=>Ea,_slugify:()=>ts,_startsWith:()=>qo,_string:()=>vS,_stringFormat:()=>rs,_stringbool:()=>rE,_success:()=>tZ,_superRefine:()=>QS,_symbol:()=>LS,_templateLiteral:()=>aZ,_toLowerCase:()=>Qo,_toUpperCase:()=>es,_transform:()=>JK,_trim:()=>Yo,_tuple:()=>GK,_uint32:()=>PS,_uint64:()=>FS,_ulid:()=>qp,_undefined:()=>US,_union:()=>LK,_unknown:()=>GS,_uppercase:()=>Ko,_url:()=>lu,_uuid:()=>Up,_uuidv4:()=>zp,_uuidv6:()=>Bp,_uuidv7:()=>Gp,_void:()=>WS,_xid:()=>Hp,_xor:()=>UK,clone:()=>Ct,config:()=>qe,createStandardJSONSchemaMethod:()=>ns,createToJSONSchemaMethod:()=>nE,decode:()=>sW,decodeAsync:()=>uW,describe:()=>eE,encode:()=>oW,encodeAsync:()=>cW,extractDefs:()=>Oi,finalize:()=>$i,flattenError:()=>Qc,formatError:()=>eu,globalConfig:()=>ya,globalRegistry:()=>mt,initializeContext:()=>Ri,isValidBase64:()=>Ib,isValidBase64URL:()=>Sk,isValidJWT:()=>Ek,locales:()=>cu,meta:()=>tE,parse:()=>dp,parseAsync:()=>pp,prettifyError:()=>uv,process:()=>Ee,regexes:()=>Qt,registry:()=>Fp,safeDecode:()=>dW,safeDecodeAsync:()=>mW,safeEncode:()=>lW,safeEncodeAsync:()=>pW,safeParse:()=>lv,safeParseAsync:()=>dv,toDotPath:()=>Qw,toJSONSchema:()=>mm,treeifyError:()=>cv,util:()=>M,version:()=>ab});var qw,Hy=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 Jy=Symbol("zod_brand"),zr=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Ci=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(qw=globalThis).__zod_globalConfig??(qw.__zod_globalConfig={});var ya=globalThis.__zod_globalConfig;function qe(e){return e&&Object.assign(ya,e),ya}var M={};Ur(M,{BIGINT_FORMAT_RANGES:()=>ov,Class:()=>Yy,NUMBER_FORMAT_RANGES:()=>av,aborted:()=>ki,allowsEval:()=>tv,assert:()=>F3,assertEqual:()=>O3,assertIs:()=>j3,assertNever:()=>M3,assertNotEqual:()=>$3,assignProp:()=>Di,base64ToUint8Array:()=>Jw,base64urlToUint8Array:()=>tW,cached:()=>jo,captureStackTrace:()=>lp,cleanEnum:()=>eW,cleanRegex:()=>qc,clone:()=>Ct,cloneDef:()=>U3,createTransparentProxy:()=>K3,defineLazy:()=>ue,esc:()=>up,escapeRegex:()=>yr,explicitlyAborted:()=>sv,extend:()=>H3,finalizeIssue:()=>It,floatSafeRemainder:()=>Qy,getElementAtPath:()=>z3,getEnumValues:()=>Zc,getLengthableOrigin:()=>Xc,getParsedType:()=>W3,getSizableOrigin:()=>Jc,hexToUint8Array:()=>nW,isObject:()=>va,isPlainObject:()=>wi,issue:()=>Mo,joinValues:()=>D,jsonStringifyReplacer:()=>$o,merge:()=>X3,mergeDefs:()=>Bn,normalizeParams:()=>L,nullish:()=>Ii,numKeys:()=>V3,objectClone:()=>L3,omit:()=>q3,optionalKeys:()=>iv,parsedType:()=>j,partial:()=>Y3,pick:()=>Z3,prefixIssues:()=>Mt,primitiveTypes:()=>nv,promiseAllObject:()=>B3,propertyKeyTypes:()=>Hc,randomString:()=>G3,required:()=>Q3,safeExtend:()=>J3,shallowClone:()=>rv,slugify:()=>ev,stringifyPrimitive:()=>O,uint8ArrayToBase64:()=>Xw,uint8ArrayToBase64url:()=>rW,uint8ArrayToHex:()=>iW,unwrapMessage:()=>Kc});function O3(e){return e}function $3(e){return e}function j3(e){}function M3(e){throw new Error("Unexpected value in exhaustive check")}function F3(e){}function Zc(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 $o(e,t){return typeof t=="bigint"?t.toString():t}function jo(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Ii(e){return e==null}function qc(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Qy(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 Hw=Symbol("evaluating");function ue(e,t,r){let i;Object.defineProperty(e,t,{get(){if(i!==Hw)return i===void 0&&(i=Hw,i=r()),i},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function L3(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Di(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 U3(e){return Bn(e._zod.def)}function z3(e,t){return t?t.reduce((r,i)=>r?.[i],e):e}function B3(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 G3(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let i=0;i<e;i++)r+=t[Math.floor(Math.random()*t.length)];return r}function up(e){return JSON.stringify(e)}function ev(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var lp="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function va(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var tv=jo(()=>{if(ya.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function wi(e){if(va(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(va(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function rv(e){return wi(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function V3(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var W3=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}`)}},Hc=new Set(["string","number","symbol"]),nv=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 K3(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 iv(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var av={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]},ov={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Z3(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 Di(this,"shape",o),o},checks:[]});return Ct(e,a)}function q3(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 Di(this,"shape",o),o},checks:[]});return Ct(e,a)}function H3(e,t){if(!wi(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 Di(this,"shape",a),a}});return Ct(e,n)}function J3(e,t){if(!wi(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 Di(this,"shape",i),i}});return Ct(e,r)}function X3(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 Di(this,"shape",i),i},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Ct(e,r)}function Y3(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 Di(this,"shape",u),u},checks:[]});return Ct(t,o)}function Q3(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 Di(this,"shape",a),a}});return Ct(t,i)}function ki(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 sv(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 Kc(e){return typeof e=="string"?e:e?.message}function It(e,t,r){let i=e.message?e.message:Kc(e.inst?._zod.def?.error?.(e))??Kc(t?.error?.(e))??Kc(r.customError?.(e))??Kc(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 Jc(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Xc(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 Mo(...e){let[t,r,i]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:i}:{...t}}function eW(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Jw(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 Xw(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function tW(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Jw(t+r)}function rW(e){return Xw(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function nW(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 iW(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Yy=class{constructor(...t){}};var Yw=(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,$o,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Yc=T("$ZodError",Yw),Ft=T("$ZodError",Yw,{Parent:Error});function Qc(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 eu(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 cv(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 Qw(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 uv(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 ${Qw(i.path)}`);return t.join(`
|
|
201
201
|
`)}var Fo=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,qe())));throw lp(s,n?.callee),s}return o.value},dp=Fo(Ft),Lo=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,qe())));throw lp(s,n?.callee),s}return o.value},pp=Lo(Ft),Uo=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??Yc)(a.issues.map(o=>It(o,n,qe())))}:{success:!0,data:a.value}},lv=Uo(Ft),zo=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,qe())))}:{success:!0,data:a.value}},dv=zo(Ft),mp=e=>(t,r,i)=>{let n=i?{...i,direction:"backward"}:{direction:"backward"};return Fo(e)(t,r,n)},oW=mp(Ft),fp=e=>(t,r,i)=>Fo(e)(t,r,i),sW=fp(Ft),hp=e=>async(t,r,i)=>{let n=i?{...i,direction:"backward"}:{direction:"backward"};return Lo(e)(t,r,n)},cW=hp(Ft),gp=e=>async(t,r,i)=>Lo(e)(t,r,i),uW=gp(Ft),yp=e=>(t,r,i)=>{let n=i?{...i,direction:"backward"}:{direction:"backward"};return Uo(e)(t,r,n)},lW=yp(Ft),vp=e=>(t,r,i)=>Uo(e)(t,r,i),dW=vp(Ft),bp=e=>async(t,r,i)=>{let n=i?{...i,direction:"backward"}:{direction:"backward"};return zo(e)(t,r,n)},pW=bp(Ft),Sp=e=>async(t,r,i)=>zo(e)(t,r,i),mW=Sp(Ft);var Qt={};Ur(Qt,{base64:()=>Iv,base64url:()=>Ep,bigint:()=>Ov,boolean:()=>jv,browserEmail:()=>EW,cidrv4:()=>Tv,cidrv6:()=>Cv,cuid:()=>pv,cuid2:()=>mv,date:()=>kv,datetime:()=>Pv,domain:()=>_W,duration:()=>vv,e164:()=>wv,email:()=>Sv,emoji:()=>Ev,extendedDuration:()=>fW,guid:()=>bv,hex:()=>TW,hostname:()=>AW,html5Email:()=>vW,httpProtocol:()=>Dv,idnEmail:()=>SW,integer:()=>$v,ipv4:()=>xv,ipv6:()=>Av,ksuid:()=>gv,lowercase:()=>Lv,mac:()=>_v,md5_base64:()=>IW,md5_base64url:()=>DW,md5_hex:()=>CW,nanoid:()=>yv,null:()=>Mv,number:()=>xp,rfc5322Email:()=>bW,sha1_base64:()=>kW,sha1_base64url:()=>NW,sha1_hex:()=>wW,sha256_base64:()=>RW,sha256_base64url:()=>OW,sha256_hex:()=>PW,sha384_base64:()=>jW,sha384_base64url:()=>MW,sha384_hex:()=>$W,sha512_base64:()=>LW,sha512_base64url:()=>UW,sha512_hex:()=>FW,string:()=>Rv,time:()=>Nv,ulid:()=>fv,undefined:()=>Fv,unicodeEmail:()=>ek,uppercase:()=>Uv,uuid:()=>ba,uuid4:()=>hW,uuid6:()=>gW,uuid7:()=>yW,xid:()=>hv});var pv=/^[cC][0-9a-z]{6,}$/,mv=/^[0-9a-z]+$/,fv=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,hv=/^[0-9a-vA-V]{20}$/,gv=/^[A-Za-z0-9]{27}$/,yv=/^[a-zA-Z0-9_-]{21}$/,vv=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,fW=/^[-+]?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)?)??$/,bv=/^([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})$/,ba=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)$/,hW=ba(4),gW=ba(6),yW=ba(7),Sv=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,vW=/^[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])?)*$/,bW=/^(([^<>()\[\]\\.,;:\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,}))$/,ek=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,SW=ek,EW=/^[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])?)*$/,xW="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Ev(){return new RegExp(xW,"u")}var xv=/^(?:(?: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])$/,Av=/^(([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}|:))$/,_v=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}$`)},Tv=/^((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])$/,Cv=/^(([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])$/,Iv=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ep=/^[A-Za-z0-9_-]*$/,AW=/^(?=.{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])?)*\.?$/,_W=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Dv=/^https?$/,wv=/^\+[1-9]\d{6,14}$/,tk="(?:(?:\\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])))",kv=new RegExp(`^${tk}$`);function rk(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 Nv(e){return new RegExp(`^${rk(e)}$`)}function Pv(e){let t=rk({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(`^${tk}T(?:${i})$`)}var Rv=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Ov=/^-?\d+n?$/,$v=/^-?\d+$/,xp=/^-?\d+(?:\.\d+)?$/,jv=/^(?:true|false)$/i,Mv=/^null$/i;var Fv=/^undefined$/i;var Lv=/^[^A-Z]*$/,Uv=/^[^a-z]*$/,TW=/^[0-9a-fA-F]*$/;function tu(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function ru(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var CW=/^[0-9a-fA-F]{32}$/,IW=tu(22,"=="),DW=ru(22),wW=/^[0-9a-fA-F]{40}$/,kW=tu(27,"="),NW=ru(27),PW=/^[0-9a-fA-F]{64}$/,RW=tu(43,"="),OW=ru(43),$W=/^[0-9a-fA-F]{96}$/,jW=tu(64,""),MW=ru(64),FW=/^[0-9a-fA-F]{128}$/,LW=tu(86,"=="),UW=ru(86);var we=T("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),ik={number:"number",bigint:"bigint",object:"date"},Ap=T("$ZodCheckLessThan",(e,t)=>{we.init(e,t);let r=ik[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})}}),_p=T("$ZodCheckGreaterThan",(e,t)=>{we.init(e,t);let r=ik[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})}}),zv=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):Qy(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})}}),Bv=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]=av[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=$v)}),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})}}),Gv=T("$ZodCheckBigIntFormat",(e,t)=>{we.init(e,t);let[r,i]=ov[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})}}),Vv=T("$ZodCheckMaxSize",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=i=>{let n=i.value;return!Ii(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:Jc(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Wv=T("$ZodCheckMinSize",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=i=>{let n=i.value;return!Ii(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:Jc(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Kv=T("$ZodCheckSizeEquals",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=i=>{let n=i.value;return!Ii(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:Jc(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})}}),Zv=T("$ZodCheckMaxLength",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=i=>{let n=i.value;return!Ii(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=Xc(n);i.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),qv=T("$ZodCheckMinLength",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=i=>{let n=i.value;return!Ii(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=Xc(n);i.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Hv=T("$ZodCheckLengthEquals",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=i=>{let n=i.value;return!Ii(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=Xc(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})}}),Bo=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=()=>{})}),Jv=T("$ZodCheckRegex",(e,t)=>{Bo.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})}}),Xv=T("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Lv),Bo.init(e,t)}),Yv=T("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Uv),Bo.init(e,t)}),Qv=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})}}),eb=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})}}),tb=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 nk(e,t,r){e.issues.length&&t.issues.push(...Mt(r,e.issues))}var rb=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=>nk(n,r,t.property));nk(i,r,t.property)}}),nb=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})}}),ib=T("$ZodCheckOverwrite",(e,t)=>{we.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var nu=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 ab={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=ab;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=ki(o),p;for(let h of s){if(h._zod.def.when){if(sv(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=ki(o,g)))});else{if(o.issues.length===g)continue;d||(d=ki(o,g))}}return p?p.then(()=>o):o},a=(o,s,u)=>{if(ki(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=lv(e,n);return a.success?{value:a.data}:{issues:a.error?.issues}}catch{return dv(e,n).then(o=>o.success?{value:o.data}:{issues:o.error?.issues})}},vendor:"zod",version:1}))}),Sa=T("$ZodString",(e,t)=>{ee.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Rv(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)=>{Bo.init(e,t),Sa.init(e,t)}),sb=T("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=bv),Ce.init(e,t)}),cb=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=ba(i))}else t.pattern??(t.pattern=ba());Ce.init(e,t)}),ub=T("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Sv),Ce.init(e,t)}),lb=T("$ZodURL",(e,t)=>{Ce.init(e,t),e._zod.check=r=>{try{let i=r.value.trim();if(!t.normalize&&t.protocol?.source===Dv.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})}}}),db=T("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Ev()),Ce.init(e,t)}),pb=T("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=yv),Ce.init(e,t)}),mb=T("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=pv),Ce.init(e,t)}),fb=T("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=mv),Ce.init(e,t)}),hb=T("$ZodULID",(e,t)=>{t.pattern??(t.pattern=fv),Ce.init(e,t)}),gb=T("$ZodXID",(e,t)=>{t.pattern??(t.pattern=hv),Ce.init(e,t)}),yb=T("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=gv),Ce.init(e,t)}),vb=T("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Pv(t)),Ce.init(e,t)}),bb=T("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=kv),Ce.init(e,t)}),Sb=T("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Nv(t)),Ce.init(e,t)}),Eb=T("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=vv),Ce.init(e,t)}),xb=T("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=xv),Ce.init(e,t),e._zod.bag.format="ipv4"}),Ab=T("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Av),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})}}}),_b=T("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=_v(t.delimiter)),Ce.init(e,t),e._zod.bag.format="mac"}),Tb=T("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Tv),Ce.init(e,t)}),Cb=T("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Cv),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 Ib(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Db=T("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Iv),Ce.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Ib(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Sk(e){if(!Ep.test(e))return!1;let t=e.replace(/[-_]/g,i=>i==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Ib(r)}var wb=T("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ep),Ce.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Sk(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),kb=T("$ZodE164",(e,t)=>{t.pattern??(t.pattern=wv),Ce.init(e,t)});function Ek(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 Nb=T("$ZodJWT",(e,t)=>{Ce.init(e,t),e._zod.check=r=>{Ek(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Pb=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})}}),wp=T("$ZodNumber",(e,t)=>{ee.init(e,t),e._zod.pattern=e._zod.bag.pattern??xp,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}}),Rb=T("$ZodNumberFormat",(e,t)=>{Bv.init(e,t),wp.init(e,t)}),iu=T("$ZodBoolean",(e,t)=>{ee.init(e,t),e._zod.pattern=jv,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}}),kp=T("$ZodBigInt",(e,t)=>{ee.init(e,t),e._zod.pattern=Ov,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}}),Ob=T("$ZodBigIntFormat",(e,t)=>{Gv.init(e,t),kp.init(e,t)}),$b=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}}),jb=T("$ZodUndefined",(e,t)=>{ee.init(e,t),e._zod.pattern=Fv,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}}),Mb=T("$ZodNull",(e,t)=>{ee.init(e,t),e._zod.pattern=Mv,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}}),Fb=T("$ZodAny",(e,t)=>{ee.init(e,t),e._zod.parse=r=>r}),Lb=T("$ZodUnknown",(e,t)=>{ee.init(e,t),e._zod.parse=r=>r}),Ub=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)}),zb=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}}),Bb=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 ok(e,t,r){e.issues.length&&t.issues.push(...Mt(r,e.issues)),t.value[r]=e.value}var Gb=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=>ok(d,r,o))):ok(u,r,o)}return a.length?Promise.all(a).then(()=>r):r}});function Dp(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 xk(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=iv(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Ak(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=>Dp(m,r,g,t,p,h))):Dp(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 _k=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=jo(()=>xk(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=va,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=>Dp(v,s,g,d,m,f))):Dp(y,s,g,d,m,f)}return a?Ak(p,d,s,u,i.value,e):p.length?Promise.all(p).then(()=>s):s}}),Vb=T("$ZodObjectJIT",(e,t)=>{_k.init(e,t);let r=e._zod.parse,i=jo(()=>xk(t)),n=g=>{let l=new nu(["shape","payload","ctx"]),m=i.value,f=A=>{let x=up(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],_=up(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 @@ ${JA}
|
|
|
338
338
|
`)}
|
|
339
339
|
`}zi(P$,"renderUpdateEnvelope");var Pf,Rf=!1;function PJ(e){Pf=e,Rf=!1}zi(PJ,"armUpdateEnvelope");function RJ(){Pf=void 0,Rf=!1}zi(RJ,"disarmUpdateEnvelope");function R$(){if(!(Rf||Pf===void 0)){Rf=!0;try{return Pf()}catch(e){un.debug("UpdateEnvelope","Envelope source failed",{error:ae(e instanceof Error?e.message:String(e))});return}}}zi(R$,"takeUpdateEnvelope");function Is(){let e=R$();return e===void 0?"":P$(e)}zi(Is,"takeUpdateEnvelopeTail");var OJ=Object.defineProperty,Ra=(e,t)=>OJ(e,"name",{value:t,configurable:!0}),w={success:Ra(e=>e.outcome==="success","success"),error:Ra(e=>e.outcome==="error","error"),empty:Ra(e=>e.outcome==="empty","empty"),unsupported:Ra(e=>e.outcome==="unsupported","unsupported"),successDryRun:Ra(e=>e.outcome==="success"&&e.dryRun==="true","successDryRun"),successOffline:Ra(e=>e.outcome==="success"&&e.offline==="true","successOffline"),errorWithCode:Ra(e=>t=>t.outcome==="error"&&t.errorCode===e,"errorWithCode")};var $J=Object.defineProperty,jJ=(e,t)=>$J(e,"name",{value:t,configurable:!0}),MJ=["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"],FJ=new Set(MJ);function Of(e){return typeof e=="string"&&FJ.has(e)}jJ(Of,"isAgentWriterSurface");var qu="fjall";var LJ=Object.defineProperty,UJ=(e,t)=>LJ(e,"name",{value:t,configurable:!0}),O$=[{command:qu,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:UJ(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 $$=[{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 zJ=Object.defineProperty,BJ=(e,t)=>zJ(e,"name",{value:t,configurable:!0});var j$="identity-only organisation deploys typically take 2-5 minutes",p_=`Run \`${te.organisationDeploy}\` to apply the change (${j$}).`,Nfe=`Deploy the organisation now to apply this change? (${j$})`,GJ="Groups have no members",Ds="fjall user add <email> --group <group>",VJ=Ds,Pfe=`${GJ} \u2014 run \`${VJ}\` to declare access.`;function WJ(e,t){return`Declared identity (source "${e}"): ${String(t)} user${t===1?"":"s"}`}BJ(WJ,"formatUserListHeading");var Rfe=`No users or memberships declared. Run \`${Ds}\` to add one.`;var M$=[{command:"user list",match:w.success,templates:[`Run \`${Ds}\` to grant access`,`Run \`${te.organisationDeploy}\` to apply declared changes`]},{command:"user list",match:w.empty,templates:[`Run \`${Ds}\` to declare the first membership`]},{command:"user add",match:w.success,templates:[p_,"Run `fjall user list` to review the declared users"]},{command:"user remove",match:w.success,templates:[p_,"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 \`${Ds} --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 hX,arch as gX}from"os";import*as Re from"fs";import*as Nt from"path";var KJ=Object.defineProperty,$f=(e,t)=>KJ(e,"name",{value:t,configurable:!0});function ZJ(e){return e.success===!0}$f(ZJ,"isSuccess");function qJ(e){return e.success===!1}$f(qJ,"isFailure");function Oa(e){return{success:!0,data:e}}$f(Oa,"success");function ln(e){return{success:!1,error:e}}$f(ln,"failure");var HJ=Object.defineProperty,jf=(e,t)=>HJ(e,"name",{value:t,configurable:!0}),JJ=jf(e=>{try{return JSON.stringify(e)}catch{return"[unserializable]"}},"safeStringify"),F$=jf((e,t,r,i)=>{let n=new Date().toISOString(),a=e.toUpperCase(),o=i?` ${JJ(i)}`:"";process.stderr.write(`[${n}] [${a}] [${t}] ${r}${o}
|
|
340
340
|
`)},"defaultWriter"),$a=F$;function XJ(e){$a=e}jf(XJ,"configureLogWriter");function YJ(){$a=F$}jf(YJ,"resetLogWriter");var ja={info(e,t,r){$a("info",e,t,r)},warn(e,t,r){$a("warn",e,t,r)},error(e,t,r){$a("error",e,t,r)},debug(e,t,r){process.env.FJALL_DEBUG==="true"&&$a("debug",e,t,r)},trace(e,t,r){process.env.FJALL_TRACE==="true"&&$a("trace",e,t,r)},isDebugEnabled(){return process.env.FJALL_DEBUG==="true"}};var QJ=Object.defineProperty,m_=(e,t)=>QJ(e,"name",{value:t,configurable:!0}),f_=c.object({name:c.string(),type:c.enum(["apex","delegated"]),parentDomain:c.string().optional(),account:c.string().optional(),region:c.string().optional()}).strict(),h_=c.object({id:c.string().min(1),name:c.string().min(1).optional()}).strict(),Mf=c.object({activeTarget:c.string().optional(),domains:c.array(f_).optional(),capacityIdentity:Km.optional(),organisation:h_.optional()}).strict(),Hu=c.object({activeTarget:c.string().optional(),domains:c.array(f_).optional(),capacityIdentity:Km.optional(),organisation:h_.optional()});function Ma(e={}){return JSON.stringify(e,null,2)}m_(Ma,"serialiseRootConfig");var Ff=Mf.keyof().options;function g_(e,t,r){let i=t[r];i!==void 0&&(e[r]=i)}m_(g_,"copyDefinedKey");function Lf(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}m_(Lf,"domainEntriesEqual");var eX=Object.defineProperty,ws=(e,t)=>eX(e,"name",{value:t,configurable:!0});function Ju(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=Hu.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=Ff;for(let[a,o]of Object.entries(t))n.includes(a)||(i[a]=o);return{kind:"ok",disk:{known:r.data,foreign:i}}}ws(Ju,"readRootConfigForMerge");function L$(e,t,r){return JSON.stringify(e[r])!==JSON.stringify(t[r])}ws(L$,"sessionChangedKey");function U$(e,t,r){let i=t.domains,n=r.domains??[];if(i===void 0&&n.length===0)return e;let a=ws(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&&!Lf(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)||Lf(h,s.get(g))||d.push(h)}return d}ws(U$,"mergeDomains");function Xu(e,t,r){let i={...e.foreign,...e.known};for(let a of Ff)a!=="domains"&&L$(t,r,a)&&(t[a]===void 0?delete i[a]:g_(i,t,a));let n=U$(e.known.domains,t,r);return n!==void 0?i.domains=n:delete i.domains,i}ws(Xu,"mergeRootConfig");function z$(e,t,r={}){let i=Ju(e);return i.kind==="unmergeable"?{kind:"unmergeable",reason:i.reason}:i.kind==="absent"?{kind:"ok",content:Ma(t)}:{kind:"ok",content:Ma(Xu(i.disk,t,r))}}ws(z$,"mergeRootConfigContent");var tX=Object.defineProperty,rX=(e,t)=>tX(e,"name",{value:t,configurable:!0}),nX=10;var iX=c.object({activeTarget:c.string().optional()}),Uf=class e{static{rX(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<nX;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 ja.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=Mf.safeParse(u);if(d.success)a=d.data;else{let p=Hu.safeParse(u);a=p.success?p.data:{},o=!p.success,p.success?ja.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}):ja.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=Ma(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,Oa(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 Oa(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"?Oa(this.rootConfig):Oa(Xu(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 Ju(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,Ui,ju)}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=iX.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),xf(Nt.dirname(Nt.dirname(r)),[Sf,...Mu],{header:BA,marker:t$})}catch(i){return ln(new Error(`Failed to write ${r}: ${ae(ze(i))}`))}return this.localConfigCache=t,Oa(void 0)}static warnLegacyActiveTargetOnce(){e.warnedLegacyActiveTarget||(e.warnedLegacyActiveTarget=!0,ja.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 aX=Object.defineProperty,Bi=(e,t)=>aX(e,"name",{value:t,configurable:!0});function y_(e){let t;try{t=Uf.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"}}Bi(y_,"readProjectBinding");function v_(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}}}Bi(v_,"resolveBindingVerdict");function B$(e,t={}){return v_(y_(t.startDir),e,t.unresolvedReason)}Bi(B$,"checkProjectOrganisation");function Fa(e){return e.name!==void 0&&e.name!==""?`${e.name} (${e.id})`:e.id}Bi(Fa,"describeOrganisation");function G$(e,t,r){return`Refusing to ${e}: this project's fjall-config.json records organisation ${Fa(t)} as its home, but the credential in use belongs to ${Fa(r)}. Nothing was created, synthesised or deployed. Cure: authenticate as ${Fa(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.`}Bi(G$,"buildWrongOrganisationMessage");function V$(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.`}Bi(V$,"buildUnreadableConfigMessage");function W$(e,t){return`Could not confirm which organisation your credential belongs to (${t}). Proceeding \u2014 this project is bound to ${Fa(e)}, and a mismatch would not have been caught.`}Bi(W$,"buildUnverifiableNotice");function K$(e){return`This project is not bound to an organisation. Run 'fjall org bind' to pin it to ${Fa(e)} \u2014 afterwards, any command run here with another organisation's credential is refused instead of silently landing there.`}Bi(K$,"buildUnboundNotice");import{createHash as cX}from"node:crypto";var oX=Object.defineProperty,sX=(e,t)=>oX(e,"name",{value:t,configurable:!0});function Z$(e,t){return cX("sha256").update(`${e}${t}`).digest("hex")}sX(Z$,"credentialFingerprint");import*as Bf from"node:fs";var uX=Object.defineProperty,zf=(e,t)=>uX(e,"name",{value:t,configurable:!0}),q$="org-config-cache.json";function b_(){return ys(q$)}zf(b_,"orgConfigCachePath");function S_(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}zf(S_,"isObject");function E_(e){return S_(e)&&typeof e.organisationId=="string"&&e.organisationId!==""&&typeof e.organisationName=="string"}zf(E_,"isCachedCredentialIdentity");function H$(e){try{let t=b_();if(!Bf.existsSync(t))return null;let r=JSON.parse(Bf.readFileSync(t,"utf-8"));return!S_(r)||r.credentialFingerprint!==e?null:E_(r.identity)?r.identity:null}catch(t){return ja.debug("cachedCredentialIdentity","Cache read failed, treating as a miss",{error:ae(ze(t))}),null}}zf(H$,"readCachedCredentialIdentity");var lX=Object.defineProperty,dX=(e,t)=>lX(e,"name",{value:t,configurable:!0}),J$="https://fjall.io";function Gf(){let e=process.env.FJALL_API_URL;return e!==void 0&&e!==""?e:J$}dX(Gf,"resolveApiBaseUrl");var X$={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 mX=Object.defineProperty,fX=(e,t)=>mX(e,"name",{value:t,configurable:!0}),Nhe=`fjall-cli/${X$.version} node/${process.versions.node} ${hX()}/${gX()}`;var Y$=Gf(),Phe=c.looseObject({deviceCode:c.string(),userCode:c.string(),verificationUri:c.string(),expiresIn:c.number(),interval:c.number()}),Rhe=c.looseObject({status:c.string(),apiKey:c.string().optional(),organisationId:c.string().optional(),organisationName:c.string().optional(),email:c.string().optional()}),Ohe=c.looseObject({application:c.looseObject({id:c.string()})}),x_=c.looseObject({id:c.string(),name:c.string(),vpcCidr:c.string().nullable(),connectedAwsAccountId:c.string().nullable()}),$he=c.looseObject({applications:c.array(x_),nextCursor:c.string().optional()}),jhe=c.looseObject({application:x_}),Mhe=c.looseObject({applications:c.array(x_)}),Fhe=c.looseObject({application:c.looseObject({id:c.string(),name:c.string()})}),Lhe=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)}),Uhe=c.looseObject({id:c.string(),token:c.string(),tokenPrefix:c.string(),name:c.string(),scopes:c.array(c.string())}),yX=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()}),zhe=c.looseObject({tokens:c.array(yX)}),Bhe=c.looseObject({scopes:c.array(c.string()),expiresAt:c.string().optional()}),vX=c.looseObject({id:c.string(),awsAccountId:c.string(),accountName:c.string().nullable(),environment:c.string().nullable()}),Ghe=c.looseObject({accounts:c.array(vX)}),bX=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()}),SX=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()}),Vhe=c.looseObject({assets:c.array(bX),nextCursor:c.string().optional()}),Whe=c.looseObject({asset:SX}),EX=c.looseObject({id:c.string(),ruleId:c.string(),title:c.string(),severity:c.string(),status:c.string()}),Khe=c.looseObject({issues:c.array(EX)}),Zhe=c.record(c.string(),c.unknown()),qhe=c.union([c.array(c.record(c.string(),c.unknown())),c.record(c.string(),c.unknown())]),Hhe=c.record(c.string(),c.unknown()),Jhe=c.record(c.string(),c.unknown()),Xhe=c.record(c.string(),c.unknown()),Yhe=c.record(c.string(),c.unknown()),Qhe=c.looseObject({deployment:c.looseObject({id:c.string()}),minCliVersion:c.string().optional()});var xX=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(hf.strip())}),ege=c.object({releases:c.array(xX),currentReleaseId:c.string().nullable(),nextCursor:c.number().int().optional()}),AX=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()}),tge=c.object({deployments:c.array(AX)}),rge=c.object({cancelled:c.boolean(),message:c.string().nullish(),declined:c.boolean().nullish()}),nge=c.object({released:c.literal(!0),id:c.string().nullish()}),ige=c.looseObject({organisationId:c.string(),organisationName:c.string(),organisationSlug:c.string().min(1).optional()}),age=c.looseObject({status:c.string(),roleArn:c.string().optional(),accountId:c.string().optional(),phase:c.string().optional(),reason:c.string().optional()}),oge=c.looseObject({token:c.string()}),_X=c.looseObject({quickCreateUrl:c.string(),externalId:c.string()}),TX=c.looseObject({alreadyConnected:c.literal(!0),account:c.looseObject({awsAccountId:c.string(),accountName:c.string().nullable(),status:c.string()})}),sge=c.union([TX,_X]);function CX(e){return"alreadyConnected"in e&&e.alreadyConnected===!0}fX(CX,"isAlreadyConnected");var cge=c.looseObject({registered:c.boolean(),repository:c.looseObject({id:c.string()}).optional()});var IX=Object.defineProperty,DX=(e,t)=>IX(e,"name",{value:t,configurable:!0});function Yu(e=Y$){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).`}DX(Yu,"deployTokenMintGuidance");var Q$=[{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:[Yu(),"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:[Yu(),"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. ${Yu()}`]}];var Vf="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)",e1=[{command:"deployments list",match:w.unsupported,templates:[Vf]},{command:"deployments cancel",match:w.unsupported,templates:[Vf]},{command:"deployments force-release",match:w.unsupported,templates:[Vf]},{command:"dev list",match:w.unsupported,templates:[Vf]},{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 t1=["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"],r1=[{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:t1},{command:"domain create",match:w.success,templates:t1},{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 wX=Object.defineProperty,o1=(e,t)=>wX(e,"name",{value:t,configurable:!0}),n1="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",i1=["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"],a1=o1(e=>e.outcome==="success"&&e.nextCursor!==void 0,"isTruncatedPage"),s1=[{command:"assets list",match:o1(e=>a1(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",...i1]},{command:"assets list",match:a1,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",...i1]},{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",n1]},{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:[n1]},{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 kX={command:"*",match:w.error,templates:["Run `fjall <command> --help` for usage information"]},c1=[...O$,...$$,...M$,...Q$,...e1,...r1,...s1,kX];var NX=Object.defineProperty,PX=(e,t)=>NX(e,"name",{value:t,configurable:!0}),u1=["app","environment","region","profile","target","cluster","service","lambda","status","type"],La=["app","cluster","service","lambda"],RX=["status","type","region"],A_={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":La,"secrets get":La,"secrets list":La,"secrets delete":La,"secrets export":La,"secrets import":La,"secrets exec":La,"assets list":RX},OX=Math.max(...Object.keys(A_).map(e=>e.split(" ").length));function __(e){let t=e.trim().split(/\s+/).slice(1);for(let r=OX;r>=1;r--){let i=t.slice(0,r).join(" ");if(Object.hasOwn(A_,i))return A_[i]}return[]}PX(__,"resolvePreservableFlags");var $X=Object.defineProperty,Kf=(e,t)=>$X(e,"name",{value:t,configurable:!0});function T_(e){let t=e.replace(/[\u0000-\u001f\u007f`]/g,"");return/[^\w@%+=:,./-]/.test(t)?`'${t.replace(/'/g,"'\\''")}'`:t}Kf(T_,"shellEscape");function l1(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:T_(s))});return d1(n,r,i)}Kf(l1,"interpolateTemplate");var Wf=class{static{Kf(this,"SuggestionResolver")}command;flags;constructor(t,r){this.command=t,this.flags=r}resolve(t){let r=c1.find(i=>(i.command===this.command||i.command==="*")&&i.match(t));return r===void 0?[]:r.templates.map(i=>l1(i,t,this.flags))}};function d1(e,t,r=new Set){let i=/`(fjall[^`]*)`/.exec(e),n=i?.[1];if(i===null||n===void 0)return e;let a=__(n),o=[];for(let p of u1){if(!a.includes(p))continue;let h=t[p];h!==void 0&&h!==""&&!r.has(p)&&!n.includes(`--${p}`)&&o.push(`--${p} ${T_(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)}Kf(d1,"applyPreservedFlags");var jX=Object.defineProperty,Yn=(e,t)=>jX(e,"name",{value:t,configurable:!0});function Kr(e,t){if(t!==void 0&&ks(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 Zf(e){if(Array.isArray(e))return e.map(Zf);if(!ks(e))return e;let t={};for(let[r,i]of Object.entries(e))i!==void 0&&(t[r]=Zf(i));return t}Yn(Zf,"stripAbsent");function ks(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof Date)&&!(e instanceof RegExp)}Yn(ks,"isPlainRecord");function p1(e){let t=e?.verbatimFields;return t!==void 0&&t.length>0?new Set(t):void 0}Yn(p1,"toVerbatimKeys");function m1(e,t){return t===void 0||!ks(e)?!1:Object.keys(e).some(r=>t.has(r))}Yn(m1,"carriesVerbatimField");function f1(e,t){let r=e;for(let i of t.split(".")){if(!ks(r))return;r=r[i]}return r}Yn(f1,"resolveDotPath");function h1(e,t,r){let i=e.project(t),n={};for(let a of r)a in i&&(n[a]=i[a]);return n}Yn(h1,"projectSelectedFields");var Qu=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 Wf(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(JA+`
|
|
341
|
+
`,{encoding:"utf8"}),Re.renameSync(i,r),xf(Nt.dirname(Nt.dirname(r)),[Sf,...Mu],{header:BA,marker:t$})}catch(i){return ln(new Error(`Failed to write ${r}: ${ae(ze(i))}`))}return this.localConfigCache=t,Oa(void 0)}static warnLegacyActiveTargetOnce(){e.warnedLegacyActiveTarget||(e.warnedLegacyActiveTarget=!0,ja.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 aX=Object.defineProperty,Bi=(e,t)=>aX(e,"name",{value:t,configurable:!0});function y_(e){let t;try{t=Uf.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"}}Bi(y_,"readProjectBinding");function v_(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}}}Bi(v_,"resolveBindingVerdict");function B$(e,t={}){return v_(y_(t.startDir),e,t.unresolvedReason)}Bi(B$,"checkProjectOrganisation");function Fa(e){return e.name!==void 0&&e.name!==""?`${e.name} (${e.id})`:e.id}Bi(Fa,"describeOrganisation");function G$(e,t,r){return`Refusing to ${e}: this project's fjall-config.json records organisation ${Fa(t)} as its home, but the credential in use belongs to ${Fa(r)}. Nothing was created, synthesised or deployed. Cure: authenticate as ${Fa(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.`}Bi(G$,"buildWrongOrganisationMessage");function V$(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.`}Bi(V$,"buildUnreadableConfigMessage");function W$(e,t){return`Could not confirm which organisation your credential belongs to (${t}). Proceeding \u2014 this project is bound to ${Fa(e)}, and a mismatch would not have been caught.`}Bi(W$,"buildUnverifiableNotice");function K$(e){return`This project is not bound to an organisation. Run 'fjall org bind' to pin it to ${Fa(e)} \u2014 afterwards, any command run here with another organisation's credential is refused instead of silently landing there.`}Bi(K$,"buildUnboundNotice");import{createHash as cX}from"node:crypto";var oX=Object.defineProperty,sX=(e,t)=>oX(e,"name",{value:t,configurable:!0});function Z$(e,t){return cX("sha256").update(`${e}${t}`).digest("hex")}sX(Z$,"credentialFingerprint");import*as Bf from"node:fs";var uX=Object.defineProperty,zf=(e,t)=>uX(e,"name",{value:t,configurable:!0}),q$="org-config-cache.json";function b_(){return ys(q$)}zf(b_,"orgConfigCachePath");function S_(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}zf(S_,"isObject");function E_(e){return S_(e)&&typeof e.organisationId=="string"&&e.organisationId!==""&&typeof e.organisationName=="string"}zf(E_,"isCachedCredentialIdentity");function H$(e){try{let t=b_();if(!Bf.existsSync(t))return null;let r=JSON.parse(Bf.readFileSync(t,"utf-8"));return!S_(r)||r.credentialFingerprint!==e?null:E_(r.identity)?r.identity:null}catch(t){return ja.debug("cachedCredentialIdentity","Cache read failed, treating as a miss",{error:ae(ze(t))}),null}}zf(H$,"readCachedCredentialIdentity");var lX=Object.defineProperty,dX=(e,t)=>lX(e,"name",{value:t,configurable:!0}),J$="https://fjall.io";function Gf(){let e=process.env.FJALL_API_URL;return e!==void 0&&e!==""?e:J$}dX(Gf,"resolveApiBaseUrl");var X$={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 mX=Object.defineProperty,fX=(e,t)=>mX(e,"name",{value:t,configurable:!0}),Nhe=`fjall-cli/${X$.version} node/${process.versions.node} ${hX()}/${gX()}`;var Y$=Gf(),Phe=c.looseObject({deviceCode:c.string(),userCode:c.string(),verificationUri:c.string(),expiresIn:c.number(),interval:c.number()}),Rhe=c.looseObject({status:c.string(),apiKey:c.string().optional(),organisationId:c.string().optional(),organisationName:c.string().optional(),email:c.string().optional()}),Ohe=c.looseObject({application:c.looseObject({id:c.string()})}),x_=c.looseObject({id:c.string(),name:c.string(),vpcCidr:c.string().nullable(),connectedAwsAccountId:c.string().nullable()}),$he=c.looseObject({applications:c.array(x_),nextCursor:c.string().optional()}),jhe=c.looseObject({application:x_}),Mhe=c.looseObject({applications:c.array(x_)}),Fhe=c.looseObject({application:c.looseObject({id:c.string(),name:c.string()})}),Lhe=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)}),Uhe=c.looseObject({id:c.string(),token:c.string(),tokenPrefix:c.string(),name:c.string(),scopes:c.array(c.string())}),yX=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()}),zhe=c.looseObject({tokens:c.array(yX)}),Bhe=c.looseObject({scopes:c.array(c.string()),expiresAt:c.string().optional()}),vX=c.looseObject({id:c.string(),awsAccountId:c.string(),accountName:c.string().nullable(),environment:c.string().nullable()}),Ghe=c.looseObject({accounts:c.array(vX)}),bX=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()}),SX=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()}),Vhe=c.looseObject({assets:c.array(bX),nextCursor:c.string().optional()}),Whe=c.looseObject({asset:SX}),EX=c.looseObject({id:c.string(),ruleId:c.string(),title:c.string(),severity:c.string(),status:c.string()}),Khe=c.looseObject({issues:c.array(EX)}),Zhe=c.record(c.string(),c.unknown()),qhe=c.union([c.array(c.record(c.string(),c.unknown())),c.record(c.string(),c.unknown())]),Hhe=c.record(c.string(),c.unknown()),Jhe=c.record(c.string(),c.unknown()),Xhe=c.record(c.string(),c.unknown()),Yhe=c.record(c.string(),c.unknown()),Qhe=c.looseObject({deployment:c.looseObject({id:c.string()}),minCliVersion:c.string().optional()});var xX=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(hf.strip())}),ege=c.object({releases:c.array(xX),currentReleaseId:c.string().nullable(),nextCursor:c.number().int().optional()}),AX=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()}),tge=c.object({deployments:c.array(AX)}),rge=c.object({cancelled:c.boolean(),message:c.string().nullish(),declined:c.boolean().nullish()}),nge=c.object({released:c.literal(!0),id:c.string().nullish()}),ige=c.looseObject({organisationId:c.string(),organisationName:c.string(),organisationSlug:c.string().min(1).optional()}),age=c.looseObject({status:c.string(),roleArn:c.string().optional(),accountId:c.string().optional(),phase:c.string().optional(),reason:c.string().optional()}),oge=c.looseObject({token:c.string()}),_X=c.looseObject({quickCreateUrl:c.string(),externalId:c.string()}),TX=c.looseObject({alreadyConnected:c.literal(!0),account:c.looseObject({awsAccountId:c.string(),accountName:c.string().nullable(),status:c.string()})}),sge=c.union([TX,_X]);function CX(e){return"alreadyConnected"in e&&e.alreadyConnected===!0}fX(CX,"isAlreadyConnected");var cge=c.looseObject({registered:c.boolean(),repository:c.looseObject({id:c.string()}).optional()});var IX=Object.defineProperty,DX=(e,t)=>IX(e,"name",{value:t,configurable:!0});function Yu(e=Y$){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).`}DX(Yu,"deployTokenMintGuidance");var Q$=[{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:[Yu(),"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:[Yu(),"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. ${Yu()}`]}];var Vf="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)",e1=[{command:"deployments list",match:w.unsupported,templates:[Vf]},{command:"deployments cancel",match:w.unsupported,templates:[Vf]},{command:"deployments force-release",match:w.unsupported,templates:[Vf]},{command:"dev list",match:w.unsupported,templates:[Vf]},{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 t1=["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"],r1=[{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:t1},{command:"domain create",match:w.success,templates:t1},{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 wX=Object.defineProperty,o1=(e,t)=>wX(e,"name",{value:t,configurable:!0}),n1="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",i1=["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"],a1=o1(e=>e.outcome==="success"&&e.nextCursor!==void 0,"isTruncatedPage"),s1=[{command:"assets list",match:o1(e=>a1(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",...i1]},{command:"assets list",match:a1,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",...i1]},{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",n1]},{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:[n1]},{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 kX={command:"*",match:w.error,templates:["Run `fjall <command> --help` for usage information"]},c1=[...O$,...$$,...M$,...Q$,...e1,...r1,...s1,kX];var NX=Object.defineProperty,PX=(e,t)=>NX(e,"name",{value:t,configurable:!0}),u1=["app","environment","region","profile","target","cluster","service","lambda","status","type"],La=["app","cluster","service","lambda"],RX=["status","type","region"],A_={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":La,"secrets get":La,"secrets list":La,"secrets delete":La,"secrets export":La,"secrets import":La,"secrets exec":La,"assets list":RX},OX=Math.max(...Object.keys(A_).map(e=>e.split(" ").length));function __(e){let t=e.trim().split(/\s+/).slice(1);for(let r=OX;r>=1;r--){let i=t.slice(0,r).join(" ");if(Object.hasOwn(A_,i))return A_[i]}return[]}PX(__,"resolvePreservableFlags");var $X=Object.defineProperty,Kf=(e,t)=>$X(e,"name",{value:t,configurable:!0});function T_(e){let t=e.replace(/[\u0000-\u001f\u007f`]/g,"");return/[^\w@%+=:,./-]/.test(t)?`'${t.replace(/'/g,"'\\''")}'`:t}Kf(T_,"shellEscape");function l1(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:T_(s))});return d1(n,r,i)}Kf(l1,"interpolateTemplate");var Wf=class{static{Kf(this,"SuggestionResolver")}command;flags;constructor(t,r){this.command=t,this.flags=r}resolve(t){let r=c1.find(i=>(i.command===this.command||i.command==="*")&&i.match(t));return r===void 0?[]:r.templates.map(i=>l1(i,t,this.flags))}};function d1(e,t,r=new Set){let i=/`(fjall[^`]*)`/.exec(e),n=i?.[1];if(i===null||n===void 0)return e;let a=__(n),o=[];for(let p of u1){if(!a.includes(p))continue;let h=t[p];h!==void 0&&h!==""&&!r.has(p)&&!n.includes(`--${p}`)&&o.push(`--${p} ${T_(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)}Kf(d1,"applyPreservedFlags");var jX=Object.defineProperty,Yn=(e,t)=>jX(e,"name",{value:t,configurable:!0});function Kr(e,t){if(t!==void 0&&ks(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 Zf(e){if(Array.isArray(e))return e.map(Zf);if(!ks(e))return e;let t={};for(let[r,i]of Object.entries(e))i!==void 0&&(t[r]=Zf(i));return t}Yn(Zf,"stripAbsent");function ks(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof Date)&&!(e instanceof RegExp)}Yn(ks,"isPlainRecord");function p1(e){let t=e?.verbatimFields;return t!==void 0&&t.length>0?new Set(t):void 0}Yn(p1,"toVerbatimKeys");function m1(e,t){return t===void 0||!ks(e)?!1:Object.keys(e).some(r=>t.has(r))}Yn(m1,"carriesVerbatimField");function f1(e,t){let r=e;for(let i of t.split(".")){if(!ks(r))return;r=r[i]}return r}Yn(f1,"resolveDotPath");function h1(e,t,r){let i=e.project(t),n={};for(let a of r)a in i&&(n[a]=i[a]);return n}Yn(h1,"projectSelectedFields");var Qu=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 Wf(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(JA+`
|
|
342
342
|
`),this.hasWrittenBlock=!0,this.write(t))}renderResult(t,r){let i=p1(r?.schema),n=Kr(t,i),a=r?.schema!==void 0&&ks(n)?this.applySchema(n,r.schema):n,o=YA(a),s=this.resolveHelp(r?.suggestionContext),u=o+s+`
|
|
343
343
|
`;this.writeBlock((m1(a,i)?u:Nf(u,this.budget))+Is())}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=QA(n,{fields:o,project:Yn(d=>h1(r,d,o),"project")},{entity:i.entity,aggregates:i.aggregates===void 0?void 0:Kr(i.aggregates)}),u=this.resolveHelp(i.suggestionContext);this.writeBlock(Nf(s+u+`
|
|
344
344
|
`,this.budget)+Is())}renderEvent(t){let r=Kr(t),i=r_({...r,value:Zf(r.value)});this.writeBlock(i)}renderError(t,r){let i={...t,message:ae(t.message),...t.details!==void 0?{details:Kr(t.details)}:{}},n=e_(i),a=this.resolveHelp(r);this.writeBlock(n+a+`
|
|
@@ -351,7 +351,7 @@ ${JA}
|
|
|
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 c9,existsSync as u9,mkdirSync as l9,readdirSync as d9,statSync as p9,unlinkSync as m9}from"fs";import{join as $_}from"path";var Qn={trace:0,debug:1,info:2,warn:3,error:4},dn={MAX_FILE_SIZE:rl.MAX_FILE_SIZE,MAX_FILES:rl.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 a9=Object.defineProperty,o9=(e,t)=>a9(e,"name",{value:t,configurable:!0});function Os(){return ef()}o9(Os,"getDefaultLogDir");var s9=Object.defineProperty,I1=(e,t)=>s9(e,"name",{value:t,configurable:!0}),f9=/^[a-zA-Z0-9_-]+-\d{4}-\d{2}-\d{2}T[\d-]+Z\.jsonl$/,h9=6e4;function D1(e,t,r){try{let i=Date.now(),n=d9(e).filter(s=>f9.test(s)).map(s=>{let u=$_(e,s);try{let d=p9(u);return{path:u,mtimeMs:d.mtimeMs,size:d.size}}catch{return}}).filter(s=>s!==void 0&&i-s.mtimeMs>=h9);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{m9(s.path)}catch{}}}catch{}}I1(D1,"pruneOldDeploymentLogs");var nl=class{static{I1(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=Os(),a=$_(n,"deployments",r);u9(a)||l9(a,{recursive:!0}),D1(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=$_(a,s);try{this.logStream=c9(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 g9=Object.defineProperty,F_=(e,t)=>g9(e,"name",{value:t,configurable:!0});function M_(){let e=N_();return e==="agent"||e==="mcp"}F_(M_,"isStructuredOutputMode");function w1(){return As.isUIMode||As.isNonInteractive}F_(w1,"surfaceOwnsConsole");var Yf=class e{static{F_(this,"Logger")}static instance=null;config;debugEnabled;traceEnabled;minLevel;fileWriter;mainLogPath;debugLogPath;constructor(){let t=Os(),r=j_(t,"debug"),{maxFileSize:i,maxFiles:n}=O_();this.config={logDir:t,debugLogDir:r,maxFileSize:i,maxFiles:n,maxBufferSize:dn.MAX_BUFFER_SIZE,flushIntervalMs:dn.FLUSH_INTERVAL_MS},this.mainLogPath=j_(t,dn.LOG_FILENAME),this.debugLogPath=j_(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 Xf(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(M_()||w1()){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&&M_()&&(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 Ps(this,t)}forDeployment(t,r="deploy"){return new nl(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=Yf.getInstance();var y9=Object.defineProperty,$s=(e,t)=>y9(e,"name",{value:t,configurable:!0});function L_(e){return e.success===!0}$s(L_,"isSuccess");function U_(e){return e.success===!1}$s(U_,"isFailure");function V(e){return{success:!0,data:e}}$s(V,"success");function $(e){return{success:!1,error:e}}$s($,"failure");async function z_(e){try{let t=await e();return V(t)}catch(t){return $(Gr(t))}}$s(z_,"tryAsync");function B_(e){try{let t=e();return V(t)}catch(t){return $(Gr(t))}}$s(B_,"trySync");var v9=Object.defineProperty,b9=(e,t)=>v9(e,"name",{value:t,configurable:!0}),k1=/^[a-zA-Z][a-zA-Z0-9-]*$/,S9=Nu.source.replace(/^\^|\$$/g,""),he=Object.freeze({IDENTIFIER:k1,NEW_APP_NAME:/^[a-z][a-z0-9-]*$/,RESOURCE_NAME:/^[a-zA-Z][a-zA-Z0-9]*$/,ECS_SERVICE_NAME:k1,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(`^(?:/${S9})+$`),SECRET_NAME:uf,SSM_COMPONENT:Nu,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 G_(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}}b9(G_,"parseRateExpression");var N1=["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:cA,SSM_COMPONENT:lf,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 E9=Object.defineProperty,Sr=(e,t)=>E9(e,"name",{value:t,configurable:!0}),x9=["us-east-2","us-west-2","us-east-1","eu-west-1","eu-central-1","ap-southeast-1"],A9=Object.freeze(x9.flatMap(e=>{let t=fs(e);return t?[t]:[]})),Y_=Object.freeze(["us-east-2","us-west-2","us-east-1","eu-west-1","ap-southeast-1"]);function Qf(e){return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}Sr(Qf,"parseRegionList");function Q_(e){return Wn.includes(e)}Sr(Q_,"isValidRegion");function e0(e){return/^[a-z]{2}-[a-z]+-[1-9]$/.test(e)}Sr(e0,"isValidRegionFormat");function t0(e){if(!e)return Y_.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):Y_.slice(0,3)}Sr(t0,"getSuggestions");function r0(e){if(Q_(e))return!0;let t=t0(e);return e0(e)?`Unknown region. Try: ${t.join(", ")}`:`Invalid format. Try: ${t.join(", ")}`}Sr(r0,"validateRegion");function P1(e){if(!e||e.trim()==="")return!0;let t=Qf(e);for(let r of t){let i=r0(r);if(i!==!0)return i}return!0}Sr(P1,"validateRegionList");function n0(e,t){return e.filter(r=>r!==t)}Sr(n0,"filterDuplicateRegions");function i0(e){return{label:e.city,value:e.code,description:e.optIn?`${e.code} \u2014 opt-in required`:e.code}}Sr(i0,"toRegionOption");function R1(){return Ut.map(i0)}Sr(R1,"getRegionOptions");function O1(e){return Ut.filter(t=>t.code!==e).map(i0)}Sr(O1,"getRegionOptionsExcluding");function $1(e){let t=Ut.find(r=>r.code===e);return t?t.city:e}Sr($1,"getRegionName");function j1(e){return t=>{let r=Qf(t);return n0(r,e)}}Sr(j1,"createRegionFormatter");var eh="33.0.0";var th=["Aurora","Instance","GlobalAurora","ClickHouse"],js=["FARGATE","FARGATE_SPOT","EC2"],Zr=wu,rh=["tinkerer","lightweight","standard","resilient","enterprise"],a0="custom",il=[...rh,a0];var _9=Object.defineProperty,T9=(e,t)=>_9(e,"name",{value:t,configurable:!0}),ave=Object.freeze({RESOURCE_SUFFIXES:Object.freeze({storage:"Storage",database:"Database",cluster:"Cluster",function:"Function",instance:"Instance",compute:"Compute"})}),al=["ecs","lambda","ec2"],ol=Object.freeze({ECS:"ecs",LAMBDA:"lambda",EC2:"ec2"}),nh=["code","container"],ih=Object.freeze({CODE:"code",CONTAINER:"container"}),ah=["ARM_64","X86_64"],M1="ARM_64",sl=["NONE","AWS_IAM"],oh=["public","internal"],sh=["CPU","MEMORY"],za=["messaging","compute"],ch=["ARM","STANDARD"],o0=["Instance","Aurora"],Ms=["postgresql","mysql"],cl=["web","worker"],F1=["foundation","compliance","hardened"];var uh=["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"],L1=[0,1,5,10,15,30,60];function zt(e,t){return e.includes(t)}T9(zt,"constIncludes");var U1=1,z1=65535,lve=Object.freeze({postgresql:5432,mysql:3306}),B1=128,G1=10240,lh=1,dh=900,s0=1,c0=1e3,Fs=100,V1=100;var W1=3e3;var K1=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH"],Z1=["standard","assets","upload","website"],Ls=["AES256","KMS"];var C9=Object.defineProperty,ul=(e,t)=>C9(e,"name",{value:t,configurable:!0}),Bt=ul(e=>c.union([c.literal(!1),e]),"optionalOrDisabled"),Ba={check:ul(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"]}},ll=ul(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),H1=c.string().min(1,E.REQUIRED.BUCKET_NAME).max(63,E.MAX_LENGTH.BUCKET_NAME).regex(he.BUCKET_NAME,E.BUCKET_NAME),J1=c.string().min(1,E.REQUIRED.DATABASE_NAME).max(63,E.MAX_LENGTH.DATABASE_NAME).regex(he.DATABASE_NAME,E.DATABASE_NAME);function ph(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})}ul(ph,"identifierSchema");var ut=ph(E.MAX_LENGTH.APP_NAME),yve=ph(E.MAX_LENGTH.APP_NAME,he.NEW_APP_NAME,E.NEW_APP_NAME),Ga=c.number().int(E.PORT.INTEGER).min(U1,E.PORT.MIN).max(z1,E.PORT.MAX),St=c.object({key:c.string(),sourceText:c.string()}).strict(),I9=c.object({__identifier:c.string()}).strict(),D9=c.object({__expression:c.string()}).strict(),w9=c.object({__call:c.string()}).strict(),k9=c.union([I9,D9,w9]),N9=c.union([c.string(),c.number(),c.boolean(),k9]),Us=c.record(c.string().regex(he.ENV_VAR_NAME,E.ENV_VAR_NAME),N9),P9=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`."}),X1=c.record(c.string(),P9),vve=c.record(c.string(),c.unknown()),u0=c.enum(il).describe(`Application type must be one of: ${il.join(", ")}`),l0=c.enum(vr).describe(`OpenNext deployment pattern: ${vr.join(", ")}`),R9=c.enum(["before-imports","after-imports","after-app-init","after-tags","after-resource","end-of-file"]),O9=c.enum(["import","app-init","tags","database","compute","storage","network","messaging","cdn","pattern","vpc-peer","vpc-peer-accepter","cross-plan-connection","custom"]),Y1=c.object({sourceText:c.string(),position:R9,afterManagedResource:c.object({type:O9,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(),Q1=c.union([c.object({tier:c.enum(Zr)}).strict(),c.literal(!1)]),ej=c.union([c.object({instanceType:c.string().optional()}).strict(),c.literal(!1)]),$9=ph(E.MAX_LENGTH.ORGANISATION_NAME),j9=c.string().regex(he.EMAIL,E.EMAIL),q1=c.string().refine(e=>Wn.includes(e),{message:E.REGION}),bve=c.object({name:$9,email:j9,accountName:c.string().optional(),primaryRegion:q1.optional().default(ms),secondaryRegions:c.array(q1).optional(),security:c.enum(F1).optional(),force:c.boolean().optional()}).strict();function dl(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&&M_()&&(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 Ps(this,t)}forDeployment(t,r="deploy"){return new nl(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=Yf.getInstance();var y9=Object.defineProperty,$s=(e,t)=>y9(e,"name",{value:t,configurable:!0});function L_(e){return e.success===!0}$s(L_,"isSuccess");function U_(e){return e.success===!1}$s(U_,"isFailure");function V(e){return{success:!0,data:e}}$s(V,"success");function $(e){return{success:!1,error:e}}$s($,"failure");async function z_(e){try{let t=await e();return V(t)}catch(t){return $(Gr(t))}}$s(z_,"tryAsync");function B_(e){try{let t=e();return V(t)}catch(t){return $(Gr(t))}}$s(B_,"trySync");var v9=Object.defineProperty,b9=(e,t)=>v9(e,"name",{value:t,configurable:!0}),k1=/^[a-zA-Z][a-zA-Z0-9-]*$/,S9=Nu.source.replace(/^\^|\$$/g,""),he=Object.freeze({IDENTIFIER:k1,NEW_APP_NAME:/^[a-z][a-z0-9-]*$/,RESOURCE_NAME:/^[a-zA-Z][a-zA-Z0-9]*$/,ECS_SERVICE_NAME:k1,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(`^(?:/${S9})+$`),SECRET_NAME:uf,SSM_COMPONENT:Nu,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 G_(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}}b9(G_,"parseRateExpression");var N1=["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:cA,SSM_COMPONENT:lf,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 E9=Object.defineProperty,Sr=(e,t)=>E9(e,"name",{value:t,configurable:!0}),x9=["us-east-2","us-west-2","us-east-1","eu-west-1","eu-central-1","ap-southeast-1"],A9=Object.freeze(x9.flatMap(e=>{let t=fs(e);return t?[t]:[]})),Y_=Object.freeze(["us-east-2","us-west-2","us-east-1","eu-west-1","ap-southeast-1"]);function Qf(e){return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}Sr(Qf,"parseRegionList");function Q_(e){return Wn.includes(e)}Sr(Q_,"isValidRegion");function e0(e){return/^[a-z]{2}-[a-z]+-[1-9]$/.test(e)}Sr(e0,"isValidRegionFormat");function t0(e){if(!e)return Y_.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):Y_.slice(0,3)}Sr(t0,"getSuggestions");function r0(e){if(Q_(e))return!0;let t=t0(e);return e0(e)?`Unknown region. Try: ${t.join(", ")}`:`Invalid format. Try: ${t.join(", ")}`}Sr(r0,"validateRegion");function P1(e){if(!e||e.trim()==="")return!0;let t=Qf(e);for(let r of t){let i=r0(r);if(i!==!0)return i}return!0}Sr(P1,"validateRegionList");function n0(e,t){return e.filter(r=>r!==t)}Sr(n0,"filterDuplicateRegions");function i0(e){return{label:e.city,value:e.code,description:e.optIn?`${e.code} \u2014 opt-in required`:e.code}}Sr(i0,"toRegionOption");function R1(){return Ut.map(i0)}Sr(R1,"getRegionOptions");function O1(e){return Ut.filter(t=>t.code!==e).map(i0)}Sr(O1,"getRegionOptionsExcluding");function $1(e){let t=Ut.find(r=>r.code===e);return t?t.city:e}Sr($1,"getRegionName");function j1(e){return t=>{let r=Qf(t);return n0(r,e)}}Sr(j1,"createRegionFormatter");var eh="33.1.0";var th=["Aurora","Instance","GlobalAurora","ClickHouse"],js=["FARGATE","FARGATE_SPOT","EC2"],Zr=wu,rh=["tinkerer","lightweight","standard","resilient","enterprise"],a0="custom",il=[...rh,a0];var _9=Object.defineProperty,T9=(e,t)=>_9(e,"name",{value:t,configurable:!0}),ave=Object.freeze({RESOURCE_SUFFIXES:Object.freeze({storage:"Storage",database:"Database",cluster:"Cluster",function:"Function",instance:"Instance",compute:"Compute"})}),al=["ecs","lambda","ec2"],ol=Object.freeze({ECS:"ecs",LAMBDA:"lambda",EC2:"ec2"}),nh=["code","container"],ih=Object.freeze({CODE:"code",CONTAINER:"container"}),ah=["ARM_64","X86_64"],M1="ARM_64",sl=["NONE","AWS_IAM"],oh=["public","internal"],sh=["CPU","MEMORY"],za=["messaging","compute"],ch=["ARM","STANDARD"],o0=["Instance","Aurora"],Ms=["postgresql","mysql"],cl=["web","worker"],F1=["foundation","compliance","hardened"];var uh=["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"],L1=[0,1,5,10,15,30,60];function zt(e,t){return e.includes(t)}T9(zt,"constIncludes");var U1=1,z1=65535,lve=Object.freeze({postgresql:5432,mysql:3306}),B1=128,G1=10240,lh=1,dh=900,s0=1,c0=1e3,Fs=100,V1=100;var W1=3e3;var K1=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH"],Z1=["standard","assets","upload","website"],Ls=["AES256","KMS"];var C9=Object.defineProperty,ul=(e,t)=>C9(e,"name",{value:t,configurable:!0}),Bt=ul(e=>c.union([c.literal(!1),e]),"optionalOrDisabled"),Ba={check:ul(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"]}},ll=ul(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),H1=c.string().min(1,E.REQUIRED.BUCKET_NAME).max(63,E.MAX_LENGTH.BUCKET_NAME).regex(he.BUCKET_NAME,E.BUCKET_NAME),J1=c.string().min(1,E.REQUIRED.DATABASE_NAME).max(63,E.MAX_LENGTH.DATABASE_NAME).regex(he.DATABASE_NAME,E.DATABASE_NAME);function ph(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})}ul(ph,"identifierSchema");var ut=ph(E.MAX_LENGTH.APP_NAME),yve=ph(E.MAX_LENGTH.APP_NAME,he.NEW_APP_NAME,E.NEW_APP_NAME),Ga=c.number().int(E.PORT.INTEGER).min(U1,E.PORT.MIN).max(z1,E.PORT.MAX),St=c.object({key:c.string(),sourceText:c.string()}).strict(),I9=c.object({__identifier:c.string()}).strict(),D9=c.object({__expression:c.string()}).strict(),w9=c.object({__call:c.string()}).strict(),k9=c.union([I9,D9,w9]),N9=c.union([c.string(),c.number(),c.boolean(),k9]),Us=c.record(c.string().regex(he.ENV_VAR_NAME,E.ENV_VAR_NAME),N9),P9=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`."}),X1=c.record(c.string(),P9),vve=c.record(c.string(),c.unknown()),u0=c.enum(il).describe(`Application type must be one of: ${il.join(", ")}`),l0=c.enum(vr).describe(`OpenNext deployment pattern: ${vr.join(", ")}`),R9=c.enum(["before-imports","after-imports","after-app-init","after-tags","after-resource","end-of-file"]),O9=c.enum(["import","app-init","tags","database","compute","storage","network","messaging","cdn","pattern","vpc-peer","vpc-peer-accepter","cross-plan-connection","custom"]),Y1=c.object({sourceText:c.string(),position:R9,afterManagedResource:c.object({type:O9,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(),Q1=c.union([c.object({tier:c.enum(Zr)}).strict(),c.literal(!1)]),ej=c.union([c.object({instanceType:c.string().optional()}).strict(),c.literal(!1)]),$9=ph(E.MAX_LENGTH.ORGANISATION_NAME),j9=c.string().regex(he.EMAIL,E.EMAIL),q1=c.string().refine(e=>Wn.includes(e),{message:E.REGION}),bve=c.object({name:$9,email:j9,accountName:c.string().optional(),primaryRegion:q1.optional().default(ms),secondaryRegions:c.array(q1).optional(),security:c.enum(F1).optional(),force:c.boolean().optional()}).strict();function dl(e){return e.issues.map(t=>`${t.path.length>0?`${t.path.join(".")}: `:""}${t.message}`).join(`
|
|
355
355
|
`)}ul(dl,"getZodErrorMessage");var mh=c.number().min(1,E.ALARM.PERCENTAGE.MIN).max(100,E.ALARM.PERCENTAGE.MAX),d0=c.union([mh,c.literal(!1)]),M9=c.union([c.number().min(1,E.ALARM.RESPONSE_TIME_MS.MIN),c.literal(!1)]),F9=c.number().min(1,E.ALARM.FREE_STORAGE_GIB.MIN),tj=c.union([c.literal(!1),c.object({cpuThreshold:d0.optional(),memoryThreshold:d0.optional(),runningTasksMinimum:c.number().int().min(0).optional(),http5xxThreshold:d0.optional(),p99ResponseTimeThresholdMs:M9.optional()}).strict()]),rj=c.union([c.literal(!1),c.object({cpuThreshold:mh.optional(),freeStorageThresholdGiB:F9.optional(),connectionsThreshold:c.number().int().min(1).optional()}).strict()]),nj=c.union([c.literal(!1),c.object({errorRateThreshold:mh.optional(),durationThresholdPercent:mh.optional()}).strict()]);var Va=c.number().int(E.BACKUP_RETENTION.INTEGER).min(1,E.BACKUP_RETENTION.MIN).max(35,E.BACKUP_RETENTION.MAX),ij=c.number().int(E.CLICKHOUSE_STORAGE.INTEGER).min(100,E.CLICKHOUSE_STORAGE.MIN).max(16384,E.CLICKHOUSE_STORAGE.MAX),aj=c.number().int(E.CLICKHOUSE_IOPS.INTEGER).min(3e3,E.CLICKHOUSE_IOPS.MIN).max(8e4,E.CLICKHOUSE_IOPS.MAX),oj=c.number().int(E.CLICKHOUSE_THROUGHPUT.INTEGER).min(125,E.CLICKHOUSE_THROUGHPUT.MIN).max(2e3,E.CLICKHOUSE_THROUGHPUT.MAX),L9=c.enum(N1),sj=c.number().int(E.CLICKHOUSE_BACKUP_RETENTION.INTEGER).min(1,E.CLICKHOUSE_BACKUP_RETENTION.MIN).max(3650,E.CLICKHOUSE_BACKUP_RETENTION.MAX),pl=c.number().int(E.MONITORING_INTERVAL.INTEGER).refine(e=>zt(L1,e),{message:E.MONITORING_INTERVAL.VALUES}),hh=c.number().int(E.DATABASE.PORT.INTEGER).min(1024,E.DATABASE.PORT.MIN).max(65535,E.DATABASE.PORT.MAX),U9=c.enum(th).describe(`Database type must be one of: ${th.join(", ")}`),z9=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"),B9=c.object({instanceType:c.string().optional(),availabilityZone:c.string().optional()}).strict().describe("Read replica configuration"),G9=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"),gh=c.object({username:c.string().min(1,E.REQUIRED.USERNAME).max(63,E.USERNAME.MAX_LENGTH).optional(),secretRotation:G9.optional()}).strict().describe("Database credentials configuration"),yh=Bt(z9),vh=Bt(B9),V9=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"),ml=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"),W9=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(V9).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"),fl=Bt(W9),K9=c.object({awsManaged:c.literal(!0)}).strict(),Z9=c.object({useCMK:c.literal(!0)}).strict(),cj=c.union([K9,Z9]),q9=c.object({mode:c.enum(["standard","advanced"]).optional(),encryptionKey:cj.optional()}).strict().describe("Database Insights configuration"),bh=Bt(q9),Sh=c.object({storageKey:cj.optional()}).strict().describe("Encryption configuration (DESTRUCTIVE to change storageKey)"),hl=c.object({name:be,type:U9,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:bh.optional(),port:hh.optional(),deletionProtection:c.boolean().optional(),proxy:yh.optional(),credentials:gh.optional(),readReplica:vh.optional(),encryption:Sh.optional(),writer:ml.optional(),readers:fl.optional(),backupRetention:Va.optional(),preferredMaintenanceWindow:c.string().optional(),monitoringInterval:pl.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(Ms).optional(),engineExpression:c.string().optional(),variableName:c.string().optional(),extraProperties:c.array(St).optional(),alarms:rj.optional()}).strict(),Eh=c.object({appName:ut,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:bh.optional(),port:hh.optional(),proxy:yh.optional(),credentials:gh.optional(),encryption:Sh.optional(),deletionProtection:c.boolean().optional()}).strict(),uj={databaseType:c.literal("Instance"),instanceType:c.string().optional(),multiAz:c.boolean().optional(),readReplica:vh.optional(),publiclyAccessible:c.boolean().optional(),backupRetention:Va.optional(),allocatedStorage:c.number().optional(),snapshotIdentifier:c.string().optional(),snapshotUsername:c.string().optional()},lj={databaseType:c.literal("Aurora"),writer:ml.optional(),readers:fl.optional(),backupRetention:Va.optional(),preferredMaintenanceWindow:c.string().optional(),monitoringInterval:pl.optional(),snapshotIdentifier:c.string().optional(),snapshotUsername:c.string().optional()},dj={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:ml.optional(),readers:fl.optional(),backupRetention:Va.optional(),preferredMaintenanceWindow:c.string().optional(),monitoringInterval:pl.optional(),snapshotIdentifier:c.string().optional(),snapshotUsername:c.string().optional()},pj=c.object({appName:ut,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(),mj={databaseType:c.literal("ClickHouse"),instanceType:L9.optional(),storageGb:ij.optional(),iops:aj.optional(),throughputMbps:oj.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:sj.optional()},H9=Eh.extend(uj).strict(),J9=Eh.extend(lj).strict(),X9=Eh.extend(dj).strict(),Y9=pj.extend(mj).strict(),kve=c.discriminatedUnion("databaseType",[H9,J9,X9,Y9]),p0=Eh.extend({resourceName:be}).strict(),Q9=p0.extend(uj).strict(),e8=p0.extend(lj).strict(),t8=p0.extend(dj).strict(),r8=pj.extend({resourceName:be}).strict(),n8=r8.extend(mj).strict(),Nve=c.discriminatedUnion("databaseType",[Q9,e8,t8,n8]),Pve=c.object({appName:ut,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(),i8=["S","N","B"],fh=c.object({name:c.string(),type:c.enum(i8)}).strict(),fj=c.object({name:be,partitionKey:fh,sortKey:fh.optional(),globalSecondaryIndexes:c.array(c.object({indexName:c.string(),partitionKey:fh,sortKey:fh.optional()}).strict()).optional(),ttlAttribute:c.string().optional(),stream:c.boolean().optional(),variableName:c.string().optional(),extraProperties:c.array(St).optional()}).strict(),a8=c.object({mode:c.literal("s3")}).strict(),hj=c.object({name:be,type:c.literal("ClickHouse"),databaseName:J1,instanceType:c.string().optional(),storageGb:ij.optional(),iops:aj.optional(),throughputMbps:oj.optional(),coldTier:c.union([a8,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:sj.optional(),variableName:c.string().optional(),extraProperties:c.array(St).optional()}).strict();var o8=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"),gj=Bt(o8),m0=c.enum(["cloudwatch","s3"]),s8=c.object({destination:m0.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"),yj=Bt(s8),c8=c.object({s3:c.boolean().optional(),dynamodb:c.boolean().optional()}).strict().describe("Gateway VPC endpoints (FREE)"),u8=Bt(c8),l8=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)"),d8=Bt(l8),p8=c.object({gateway:u8.optional(),interface:d8.optional()}).strict().describe("VPC endpoints configuration"),vj=Bt(p8),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:gj.optional(),flowLogs:yj.optional(),vpcEndpoints:vj.optional(),cidrMask:c.number().int(E.CIDR_MASK.INTEGER).min(16,E.CIDR_MASK.MIN).max(28,E.CIDR_MASK.MAX).optional()}).strict(),bj=c.string().min(1,E.REQUIRED.NETWORK_NAME).max(50,E.MAX_LENGTH.NETWORK_NAME).regex(he.RESOURCE_NAME,E.RESOURCE_NAME),Sj=Wa.extend({name:bj}).strict(),Ej=Bt(Wa),Mve=c.object({appName:ut,networkName:bj.optional(),maxAzs:c.number().int(E.MAX_AZS.INTEGER).min(1,E.MAX_AZS.MIN).max(3,E.MAX_AZS.MAX).optional(),natGateways:gj.optional(),flowLogs:yj.optional(),vpcEndpoints:vj.optional()}).strict(),m8=he.CIDR,f0=c.string().regex(m8,E.CIDR),f8=c.object({kind:c.literal("database"),resource:c.string().min(1,E.REQUIRED.RESOURCE_REFERENCE),name:be,allowedFromCidrs:c.array(f0),access:c.enum(["read","write","readWrite"]).optional()}).strict(),h8=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(f0),port:Ga.optional()}).strict(),g8=c.discriminatedUnion("kind",[f8,h8]),xj=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:f0.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(),h0=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(g8).optional()}).strict();var xh=["storage","cdn","compute"],y8=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(),gl=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(Zr).optional(),versioned:c.boolean().optional(),encryption:c.enum(Ls).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(y8).optional(),stackPlacement:c.enum(xh).optional(),variableName:c.string().optional(),extraProperties:c.array(St).optional()}).strict().refine(e=>e.encryption!=="KMS"||!!e.kmsKeyArn,{message:E.KMS.KEY_REQUIRED}),Gve=c.object({appName:ut,bucketName:H1,nameProvidedByFlag:c.boolean().optional(),storagePreset:c.enum(Z1).optional(),publicReadAccess:c.boolean().optional(),websiteHosting:c.object({indexDocument:c.string(),errorDocument:c.string().optional()}).strict().optional(),backupVaultTier:c.enum(Zr).optional(),versioned:c.boolean().optional(),encryption:c.enum(Ls).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 g0=c.enum(["DESTROY","RETAIN"]),yl=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:g0.optional(),variableName:c.string().optional(),extraProperties:c.array(St).optional()}).strict();var Aj=c.object({type:c.literal("basic-auth"),username:c.string().min(1),password:c.string().min(1)}).strict(),vl=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),Aj]).optional(),extraProperties:c.array(St).optional()}).strict(),_j=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),Aj]).optional(),nameProvidedByFlag:c.boolean().optional()}).strict();var v8=Object.defineProperty,y0=(e,t)=>v8(e,"name",{value:t,configurable:!0}),b8=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 Gi(e){let t=e.split(".")[0]??"";return b8.has(t)?"ARM":"STANDARD"}y0(Gi,"getArchitectureForInstanceType");function Ah(e,t){let r=Gi(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}}y0(Ah,"validateArchitectureMatch");function Tj(e,t){return Gi(e)===t}y0(Tj,"isArchitectureCompatible");var S8=Object.defineProperty,_h=(e,t)=>S8(e,"name",{value:t,configurable:!0});var E8=1;var x8=/^[A-Za-z0-9_.-]+$/,A8=c.object({id:c.string().min(1,"buildSecret id cannot be empty").regex(x8,"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)"})}),_8=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(),_8).optional(),buildSecrets:c.array(A8).optional()}).strict(),tbe=pn.partial();function T8(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}}}_h(T8,"mergeDockerBuild");function v0(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}_h(v0,"isRecord");function Cj(e){if(!v0(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=v0(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}_h(Cj,"normaliseDockerBuild");function C8(e){if(e===void 0)return;let t=Cj(e);return t===void 0?void 0:JSON.stringify(t)}_h(C8,"dockerBuildFingerprint");var I8=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(),D8=c.object({type:c.enum(vr),name:c.string(),source:c.string()}).strict(),w8=c.object({repositoryName:c.string()}).strict(),k8=["x86_64","arm64"],N8=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(k8).optional()}).strict(),P8=c.object({templateHash:c.string(),synthTimestamp:c.string()}).strict(),R8=c.object({constructPath:c.string().max(512),group:c.string().max(128),resourceType:c.string().max(256)}).strict(),O8=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(),$8=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(),j8=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(),rbe=c.object({version:c.literal(E8),generatedAt:c.string(),appName:c.string(),services:c.array(I8),lambdas:c.array(N8),pattern:D8.optional(),ecr:w8.optional(),stacks:c.record(c.string(),P8),resourceMap:c.record(c.string(),R8).optional(),engineCompat:O8.optional(),identityAliases:c.array($8).optional(),residuals:c.array(j8).optional()}).strict();var M8=Object.defineProperty,F8=(e,t)=>M8(e,"name",{value:t,configurable:!0});function Dj(e){return!(e.image!==void 0&&e.docker!==void 0)}F8(Dj,"imageDockerMutexCheck");var wj=c.number().int(E.CAPACITY.MIN.INTEGER).min(s0,E.GENERATOR_CAPACITY.MIN.MIN).max(c0,E.GENERATOR_CAPACITY.MIN.MAX),kj=c.number().int(E.CAPACITY.MAX.INTEGER).min(s0,E.GENERATOR_CAPACITY.MAX.MIN).max(c0,E.GENERATOR_CAPACITY.MAX.MAX),zs=c.number().int(E.LAMBDA.MEMORY.INTEGER).min(B1,E.LAMBDA.MEMORY.MIN).max(G1,E.LAMBDA.MEMORY.MAX).refine(e=>e===128||e%64===0,E.LAMBDA.MEMORY.MULTIPLE),Nj=c.string().regex(he.LAMBDA_RUNTIME_IDENTIFIER,E.LAMBDA.RUNTIME),b0=c.number().int(E.CPU.INTEGER).min(256,E.CPU.MIN).max(4096,E.CPU.MAX),Ch=c.number().int(E.CAPACITY.DESIRED.INTEGER).min(0,E.CAPACITY.DESIRED.MIN).max(Fs,E.CAPACITY.DESIRED.MAX),bl=c.object({connectToDatabase:c.array(c.string()).optional()}).strict(),L8=c.object({minSize:c.number().int(E.CAPACITY.WARM_POOL.MIN_SIZE.INTEGER).min(0,E.CAPACITY.WARM_POOL.MIN_SIZE.MIN).max(V1,E.CAPACITY.WARM_POOL.MIN_SIZE.MAX).optional(),reuseOnScaleIn:c.boolean().optional()}).strict(),S0=c.object({instanceType:c.string().optional(),amiHardwareType:c.enum(ch).optional(),minCapacity:c.number().int(E.CAPACITY.MIN.INTEGER).min(0,E.CAPACITY.MIN.MIN_0).max(Fs,E.CAPACITY.MIN.MAX).optional(),maxCapacity:c.number().int(E.CAPACITY.MAX.INTEGER).min(1,E.CAPACITY.MAX.MIN_1).max(Fs,E.CAPACITY.MAX.MAX).optional(),memoryLimitMiB:ll(128).optional(),warmPool:L8.optional(),extraProperties:c.array(St).optional()}).strict().superRefine((e,t)=>{if(!e.instanceType||!e.amiHardwareType)return;let r=Ah(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"]})}),U8=c.enum(al).describe(`Compute type must be one of: ${al.join(", ")}`),E0=c.enum(js).describe(`ECS capacity provider must be one of: ${js.join(", ")}`),x0=c.string().refine(e=>zt(uh,e),{message:E.INSTANCE_TYPE}),Pj=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(),z8=c.object({name:c.string().min(1,E.REQUIRED.CONTAINER_NAME).optional(),image:c.string().optional(),port:Ga.optional(),environment:Us.optional(),secretsImport:X1.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(),Rj=c.string().min(1,E.REQUIRED.SERVICE_NAME).max(255,E.MAX_LENGTH.SERVICE_NAME).regex(he.ECS_SERVICE_NAME,E.ECS_SERVICE_NAME),Oj=c.object({domain:c.string().optional(),loadBalancer:c.union([c.literal(!1),c.enum(oh)]).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"),Th=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"),B8=c.object({desiredCount:Ch.optional(),minCapacity:c.number().int(E.CAPACITY.MIN.INTEGER).min(0,E.CAPACITY.MIN.MIN_0).max(Fs,E.CAPACITY.MIN.MAX).optional(),maxCapacity:c.number().int(E.CAPACITY.MAX.INTEGER).min(1,E.CAPACITY.MAX.MIN_1).max(Fs,E.CAPACITY.MAX.MAX).optional(),scalingType:c.enum(sh).optional()}).strict().refine(Ba.check,Ba.params).describe("ECS service scaling configuration"),$j=c.object({name:Rj,docker:pn.optional(),needsDatabaseConnection:c.boolean().optional(),needsStorageConnection:c.boolean().optional(),needsMessagingConnection:c.boolean().optional(),image:c.string().optional(),containers:c.array(z8).optional(),routing:c.union([Th,c.array(Th).min(1)]).optional(),serviceType:c.enum(cl).optional(),cpu:b0.optional(),memoryLimitMiB:ll(512).optional(),desiredCount:Ch.optional(),scaling:Bt(B8).optional(),capacityProvider:E0,ec2Config:S0.optional(),ssmSecretsPath:c.string().regex(he.SSM_PATH,E.SSM_PATH).optional(),extraProperties:c.array(St).optional(),alarms:tj.optional()}).strict().superRefine((e,t)=>{Dj(e)||t.addIssue({code:"custom",path:["docker"],message:E.IMAGE_DOCKER_MUTEX})}).describe("Configuration for a service in an ECS cluster"),Sl=c.object({name:be,type:U8,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:Oj.optional(),containerInsights:c.boolean().optional(),services:c.array($j).optional(),docker:pn.partial().optional(),deployment:c.enum(nh).optional(),codePath:c.string().optional(),timeout:c.number().int(E.LAMBDA.TIMEOUT.INTEGER).min(lh,E.LAMBDA.TIMEOUT.MIN).max(dh,E.LAMBDA.TIMEOUT.MAX).optional(),memory:zs.optional(),handler:c.string().optional(),runtime:Nj.optional(),environment:Us.optional(),secrets:Us.optional(),eventSources:c.array(Pj).optional(),functionUrl:c.object({authType:c.enum(sl)}).strict().optional(),description:c.string().optional(),scheduleExpression:c.string().optional(),scheduleStackPlacement:c.enum(za).optional(),architecture:c.enum(ah).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:nj.optional(),instanceType:x0.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&&Gi(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"]})}),dbe=c.object({appName:ut,clusterName:be,containerPort:Ga,nameProvidedByFlag:c.boolean().optional(),ecrRepository:c.string().optional(),capacityProvider:E0.optional(),useAppEcr:c.boolean().optional(),desiredCount:Ch.optional(),cpu:b0.optional(),memoryLimitMiB:ll(512).optional(),minCapacity:wj.optional(),maxCapacity:kj.optional(),ec2Config:S0.optional(),connectionConfig:bl.optional()}).strict().refine(Ba.check,Ba.params),pbe=c.object({appName:ut,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(lh,E.LAMBDA.TIMEOUT.MIN).max(dh,E.LAMBDA.TIMEOUT.MAX).optional(),memory:zs.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(K1)).optional(),corsCredentials:c.boolean().optional(),connectionConfig:bl.optional()}).strict(),mbe=c.object({appName:ut,instanceName:be,nameProvidedByFlag:c.boolean().optional(),instanceType:x0.optional(),enableSSH:c.boolean().optional(),minCapacity:wj.optional(),maxCapacity:kj.optional(),connectionConfig:bl.optional()}).strict().refine(Ba.check,Ba.params),fbe=c.object({appName:ut,clusterName:be,serviceName:Rj,capacityProvider:E0,containerPort:Ga.optional(),cpu:b0.optional(),memoryLimitMiB:ll(512).optional(),desiredCount:Ch.optional(),ec2Config:S0.optional(),routing:c.union([Th,c.array(Th).min(1)]).optional(),docker:pn.partial().optional(),nameProvidedByFlag:c.boolean().optional(),connectionConfig:bl.optional()}).strict(),A0=c.object({appName:ut,computeName:be,nameProvidedByFlag:c.boolean().optional(),connectionConfig:bl.optional()}).strict(),G8=A0.extend({type:c.literal("ecs"),cluster:Oj.optional(),services:c.array($j).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}),V8=A0.extend({type:c.literal("lambda"),timeout:c.number().int(E.LAMBDA.TIMEOUT.INTEGER).min(lh,E.LAMBDA.TIMEOUT.MIN).max(dh,E.LAMBDA.TIMEOUT.MAX).optional(),memory:zs.optional(),handler:c.string().optional(),runtime:Nj.optional(),environment:Us.optional(),secrets:Us.optional(),description:c.string().optional(),functionUrl:c.union([c.object({authType:c.enum(sl).optional()}).strict(),c.literal(!1)]).optional(),eventSources:c.array(Pj).optional()}).strict(),W8=A0.extend({type:c.literal("ec2"),instanceType:x0.optional(),enableSSH:c.boolean().optional(),keyName:c.string().optional(),userData:c.string().optional(),securityGroups:c.array(c.string()).optional()}).strict(),hbe=c.discriminatedUnion("type",[G8,V8,W8]),Ij=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(),jj=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(cl).optional(),docker:pn.partial().optional(),containerPort:Ga.optional(),needsDatabaseConnection:c.boolean().optional(),routing:c.union([Ij,c.array(Ij).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."}))}),gbe=c.object({appName:ut,instanceType:c.string().optional()}).strict();var _0=c.object({memorySize:zs.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(),Mj=c.object({type:c.enum(o0).optional(),databaseName:c.string().optional(),databaseEngine:c.enum(Ms).optional(),deletionProtection:c.boolean().optional(),backupRetention:Va.optional(),port:hh.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:vh.optional(),writer:ml.optional(),readers:fl.optional(),allowVpcAccess:c.boolean().optional(),monitoringInterval:pl.optional(),preferredMaintenanceWindow:c.string().optional(),databaseInsights:bh.optional(),proxy:yh.optional(),credentials:gh.optional(),encryption:Sh.optional(),snapshotIdentifier:c.string().optional(),snapshotUsername:c.string().optional()}).strict(),Fj=c.object({server:_0.optional(),imageOptimisation:_0.optional(),revalidation:_0.optional()}).strict(),T0=c.object({versioned:c.boolean().optional()}).strict(),Lj=c.object({assets:T0.optional(),cache:T0.optional(),media:T0.optional()}).strict(),K8=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(),Uj=c.object({revalidationQueue:K8.optional()}).strict(),zj=c.object({domainNames:c.array(c.string()).optional(),certificateArn:c.string().optional()}).strict(),Bj=c.record(c.string().regex(he.ENV_VAR_NAME,E.ENV_VAR_NAME),c.string()).optional(),C0=c.object({type:c.literal("payload"),name:c.string().min(1,E.REQUIRED.PATTERN_NAME),domain:c.string().optional(),database:Mj.optional(),compute:Fj.optional(),storage:Lj.optional(),messaging:Uj.optional(),cdn:zj.optional(),environment:Bj}).strict(),I0=c.object({type:c.literal("nextjs"),name:c.string().min(1,E.REQUIRED.PATTERN_NAME),domain:c.string().optional(),database:Mj.optional(),compute:Fj.optional(),storage:Lj.optional(),messaging:Uj.optional(),cdn:zj.optional(),environment:Bj}).strict(),D0=c.enum(Ou),Z8=c.object({command:c.string().min(1,E.REQUIRED.BUILD_COMMAND),outputDir:c.string().min(1,E.REQUIRED.OUTPUT_DIR)}).strict(),q8=c.object({maxAgeDays:c.number().optional(),includeSubdomains:c.boolean().optional(),preload:c.boolean().optional()}).strict(),H8=c.object({headers:c.boolean().optional(),contentSecurityPolicy:c.string().optional(),hsts:c.union([c.literal(!1),q8]).optional()}).strict(),J8=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(),X8=c.object({behaviours:c.array(c.unknown()).optional(),priceClass:c.enum($u).optional(),invalidateOnDeploy:c.boolean().optional()}).strict(),Y8=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(),El=c.object({type:c.literal("staticsite"),name:c.string().min(1,E.REQUIRED.PATTERN_NAME),source:c.string().min(1,E.REQUIRED.SOURCE),build:Z8,routing:D0.optional(),security:H8.optional(),domain:c.string().optional(),zoneName:c.string().optional(),hostedZoneId:c.string().optional(),forms:J8.optional(),cdn:X8.optional(),accessGate:Y8.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&&!vf(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.`})}),xl=c.discriminatedUnion("type",[C0,I0,El]),Gj=c.enum(["lightweight","standard","resilient","custom"]),Vj=c.object({type:c.enum(o0),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(),Wj=c.object({memorySize:zs.optional(),timeout:c.number().int(E.LAMBDA.TIMEOUT.INTEGER).min(1,E.LAMBDA.TIMEOUT.MIN).max(900,E.LAMBDA.TIMEOUT.MAX).optional()}).strict();var Kj=c.object({appName:ut,type:u0,pattern:l0.optional(),patternConfig:xl.optional(),owner:c.string().optional(),tags:c.record(c.string(),c.string()).optional(),vpcId:c.string().optional(),network:Wa.optional(),backup:Q1.optional(),tunnel:ej.optional(),additionalNetworks:c.array(Sj).optional(),database:c.array(hl),s3:c.array(gl),compute:c.array(Sl),dynamodb:c.array(fj).optional(),clickhouse:c.array(hj).optional(),sqs:c.array(yl).optional(),cdn:vl.optional(),customCodeBlocks:c.array(Y1).optional(),additionalManagedImports:c.array(c.object({moduleSpecifier:c.string(),namedImports:c.array(c.string()),defaultImport:c.string().optional()}).strict()).optional()}).strict(),jbe=c.object({name:ut,type:u0,pattern:l0.optional(),patternTier:Gj.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:D0.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:Vj.optional(),customCompute:Wj.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:Ej.optional(),services:c.array(jj).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"}))}),w0=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 Q8=["fjall-managed","external","external-manual"],zbe=c.enum(Q8);var Zj=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(),qj=c.object({name:c.string().min(1),path:c.string().min(1).optional()}).strict(),e5=c.union([c.object({managedPolicyArn:c.string().min(1)}).strict(),c.object({customerManagedPolicy:qj}).strict()]),t5=c.object({managedPolicies:c.array(c.string().min(1)).optional(),inlinePolicy:c.record(c.string(),c.unknown()).optional(),customerManagedPolicies:c.array(qj).optional(),permissionsBoundary:e5.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(),r5=c.object({description:c.string().optional()}).strict(),Ih=c.string().regex(he.EMAIL,E.EMAIL),k0={groups:c.record(c.string(),r5).optional(),permissionSets:c.record(c.string(),t5).optional(),memberships:c.record(c.string(),c.array(Ih)).optional(),resolutionVersion:c.number().int().min(1).optional(),defaultPermissionSets:c.boolean().optional()},n5=c.discriminatedUnion("source",[c.object({...k0,source:c.literal("fjall-managed"),users:c.record(Ih,Zj)}).strict(),c.object({...k0,source:c.literal("external")}).strict(),c.object({...k0,source:c.literal("external-manual"),users:c.record(Ih,Zj).optional()}).strict()]),N0=c.object({name:be,type:c.literal("organisation").optional(),organisationName:c.string().min(1).optional(),orgEmail:Ih.optional(),accounts:c.unknown().optional(),accountIds:c.record(c.string(),c.string()).optional(),identityCentre:c.union([n5,c.literal(!1)]).optional(),allowedRegions:c.array(c.string().min(1)).optional()}).strict();var i5=Object.defineProperty,a5=(e,t)=>i5(e,"name",{value:t,configurable:!0}),o5=[1,3,5,7,14,30,60,90,120,150,180,365,400,545,731,1827,3653],Dh=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(o5).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(),s5=Dh.refine(e=>e.agentMinInstances<=e.agentMaxInstances,{message:"agentMinInstances must be <= agentMaxInstances"});function c5(e){let t=s5.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}a5(c5,"validateBuildkiteProps");var u5=Object.defineProperty,Jj=(e,t)=>u5(e,"name",{value:t,configurable:!0});function Xj(e){return`FjallDeployBoundary${e}`}Jj(Xj,"deployBoundaryName");var l5="/fjall/";function Yj(e){return`FjallDeploy${e}`}Jj(Yj,"deployRoleName");var Hj=`arn:*:iam::*:policy/${Xj("*")}`,d5=[`arn:*:iam::*:role${l5}${Yj("*")}`,"arn:*:iam::*:role/cdk-*-cfn-exec-role-*"],P0={Sid:"FjallInheritAdministratorAccess",Effect:"Allow",Action:"*",Resource:"*"},Qj=[{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:d5,Condition:{ArnNotLike:{"iam:PermissionsBoundary":Hj}}},{Sid:"FjallDenyBoundaryPolicyTamper",Effect:"Deny",Action:["iam:CreatePolicy","iam:CreatePolicyVersion","iam:DeletePolicyVersion","iam:SetDefaultPolicyVersion","iam:DeletePolicy"],Resource:Hj},{Sid:"FjallDenyDisableKmsKey",Effect:"Deny",Action:["kms:DisableKey"],Resource:"*"}],eM=[...Qj,{Sid:"FjallDenyStandingHumanCredentials",Effect:"Deny",Action:["iam:CreateUser","iam:CreateLoginProfile","iam:CreateAccessKey","iam:CreateAccountAlias"],Resource:"*"},{Sid:"FjallDenyDisableConfigRecorder",Effect:"Deny",Action:["config:StopConfigurationRecorder"],Resource:"*"}],p5=[...eM,{Sid:"FjallDenyAccountPasswordPolicyTamper",Effect:"Deny",Action:["iam:UpdateAccountPasswordPolicy","iam:DeleteAccountPasswordPolicy"],Resource:"*"},{Sid:"FjallDenyDisableDefaultEbsEncryption",Effect:"Deny",Action:["ec2:DisableEbsEncryptionByDefault"],Resource:"*"}];var nSe={foundation:[P0,...Qj],compliance:[P0,...eM],hardened:[P0,...p5]};var m5=Object.defineProperty,lt=(e,t)=>m5(e,"name",{value:t,configurable:!0});var $0="sts.amazonaws.com";function f5(e){return`FjallDevDeploy${e}`}lt(f5,"devDeployRoleName");function h5(e){return`FjallDevProvisioner${e}`}lt(h5,"devProvisionerRoleName");function g5(e){return`FjallDevSyncWriter${e}`}lt(g5,"devSyncWriterRoleName");var y5="FjallDevBoundary";function tM(e){return`arn:aws:iam::${e}:policy/${y5}`}lt(tM,"devBoundaryPolicyArn");function rM(e){return`org:${e}:dev-provisioner`}lt(rM,"devProvisionerSubject");function nM(e){return`org:${e}:dev-sync`}lt(nM,"devSyncSubject");function R0(e,t){return`org:${e}:acct:${t}`}lt(R0,"deployAccountSubject");function O0(e){return`org:${e}:*`}lt(O0,"genericMachineSubject");var v5=["discovery","connection","org-setup","dev-substrate-setup"];function iM(e,t){return`org:${e}:${t}`}lt(iM,"serviceSubject");function b5(e){let{fjallOrgId:t,providerArn:r,issuerDomain:i,accountTier:n,accountId:a}=e,o=e.machineTrustMode??"expanded",s={[`${i}:aud`]:$0},u;if(o==="account-scoped"){if(n===void 0||!of(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=[R0(t,a)]}else a!==void 0?u=[O0(t),R0(t,a)]:u=O0(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`]:v5.map(d=>iM(t,d))}}}]}lt(b5,"buildNarrowedDeployTrustStatements");function S5(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`]:$0},StringLike:{[`${i}:sub`]:`org:${t}:dev:${n}:*`}}}]}lt(S5,"buildDevDeployTrustStatements");function j0(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`]:$0,[`${r}:sub`]:n}}}]}lt(j0,"buildServiceSubjectTrustStatements");function E5(e){return j0({...e,sid:"FjallDevProvisionerSubject",subject:rM(e.fjallOrgId)})}lt(E5,"buildDevProvisionerTrustStatements");function x5(e){return j0({...e,sid:"FjallDevSyncSubject",subject:nM(e.fjallOrgId)})}lt(x5,"buildDevSyncWriterTrustStatements");function A5({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/*`}]}lt(A5,"buildDevDeployPolicyStatements");function _5({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":tM(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"}}}]}lt(_5,"buildDevProvisionerPolicyStatements");function T5({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}}}]}lt(T5,"buildDevSyncWriterPolicyStatements");function C5({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}-*`}]}lt(C5,"buildDevBoundaryStatements");var I5=Object.defineProperty,tr=(e,t)=>I5(e,"name",{value:t,configurable:!0});function H(e){return JSON.stringify(e)}tr(H,"escapeStringLiteral");function Al(e){return e.map(H).join(", ")}tr(Al,"formatStringArray");var D5="import:SharedAlarmTopicArn";function Ka(e=" "){return`
|
|
@@ -615,7 +615,7 @@ ${a}`)}throw n}}Pg(uo,"convertToResourcePlan");var zte=Object.defineProperty,yc=
|
|
|
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}Rr(xz,"insertOrOrphanBlock");function jg(e,t,r){if(!t||t.length===0)return{content:e,success:!0};try{let i=ta(e),n=Kt(i),a=[],o=Ez(t),s=e;for(let u of o){let d=_z(i,n,u,r,a);s=xz(s,u,d,a)}return{content:s,success:!0,warnings:a.length>0?a:void 0}}catch(i){return En(i,e)}}Rr(jg,"injectCustomCodeBlocks");function Az(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 ${ra(t.afterManagedResource.type,t.afterManagedResource.name)} not found. Custom code may be orphaned.`),null)}Rr(Az,"findAfterResourcePosition");function _z(e,t,r,i,n){switch(r.position){case"before-imports":return 0;case"after-imports":return XC(t,"import")?.endPos??0;case"after-app-init":return Rg(t,"app-init")?.endPos??null;case"after-tags":return Rg(t,"tags")?.endPos??null;case"after-resource":return Az(t,r,i,n);case"end-of-file":return e.getEnd();default:return null}}Rr(_z,"findCustomCodeInsertPosition");function Tz(e,t,r){let i=$g(e,t),n=r.sourceText;return n=Og(i,n)+n,n.endsWith(`
|
|
617
617
|
`)||(n+=`
|
|
618
|
-
`),n}Rr(Tz,"formatCustomCodeForInsertion");function Cz(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)};Rr(t,"visit");let r=ta(e),i=[];return t(r),i.length>0?{valid:!1,errors:i}:{valid:!0}}catch(t){return{valid:!1,errors:[ze(t)]}}}Rr(Cz,"validateModifiedFile");import*as We from"typescript";var Sd=c.enum(["A","AAAA","CNAME","MX","TXT","NS","SRV","CAA"]),Vte=c.object({name:c.string(),type:Sd,ttl:c.number().optional(),value:c.string(),priority:c.number().optional(),weight:c.number().optional(),port:c.number().optional()}).strict(),Wte=c.object({subdomain:c.string(),targetAccount:c.string(),auto:c.boolean()}).strict(),Kte=c.object({domainName:c.string(),subjectAlternativeNames:c.array(c.string())}).strict(),q_e=c.object({origin:c.string(),ttl:c.number(),records:c.array(Vte),delegations:c.array(Wte),certificates:c.array(Kte)}).strict(),xn=Object.freeze({ORIGIN:"$ORIGIN",TTL:"$TTL",FJALL_DELEGATE:"$FJALL-DELEGATE",FJALL_CERT:"$FJALL-CERT"}),Iz="ALIAS ";var Dz=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()]),wz=Dz.options.map(e=>e.shape.kind.value),tI=c.enum(["A","AAAA"]),rI=c.enum(["route53","external-delegated","external-records"]),kz=c.enum(["zone","full"]),Mg=c.string().regex(/^[A-Za-z][A-Za-z0-9]*$/),Zte=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:Mg.optional()}).strict(),qte=c.object({kind:c.literal("alias"),type:tI,name:c.string(),target:Dz,id:Mg.optional()}).strict(),Hte=c.discriminatedUnion("kind",[Zte,qte]),Jte=c.object({domainName:c.string(),subjectAlternativeNames:c.array(c.string()).optional(),transparencyLogging:c.boolean().optional(),cloudFront:c.boolean().optional()}).strict(),Xte=c.object({subdomain:c.string(),toAccount:c.string(),auto:c.boolean().optional()}).strict(),nI=c.enum(["indexed","stable"]),X_e=c.object({zoneName:c.string(),registrar:rI,recordIds:nI.optional(),hostedZoneId:c.string().optional(),delegatedSubdomain:c.string().optional(),adoptedNameServers:c.array(c.string().min(1)).min(1).optional(),records:c.array(Hte),certificates:c.array(Jte),delegations:c.array(Xte)}).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 Yte=Object.defineProperty,Xe=(e,t)=>Yte(e,"name",{value:t,configurable:!0}),Rz=rI.options,Nz=kz.options,Pz=nI.options,Qte=Sd.options,ere=tI.options;function aI(e){let t=[],r=Xe(n=>{if(We.isNewExpression(n)&&Oz(n.expression)){let a=$z(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(aI,"findDomainConstructCall");function Oz(e){return We.isIdentifier(e)&&e.text==="Domain"}Xe(Oz,"isDomainIdentifier");function $z(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=jz(e);if(a===void 0)return;let o=Mz(e),s=We.isStringLiteral(i)?i.text:void 0;return{callExpression:e,containingStatement:a,propsObjectLiteral:n,domainVarId:o,scopeArgumentText:r.getText(),constructIdLiteral:s}}Xe($z,"buildMatch");function jz(e){let t=e;for(;t!==void 0;){if(We.isExpressionStatement(t)||We.isVariableStatement(t))return t;t=t.parent}}Xe(jz,"findContainingTopLevelStatement");function Mz(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(Mz,"extractDomainVarId");function Fz(e){switch(e.kind){case"registrar_required":return"'registrar' property is required";case"registrar_unsupported":return`'registrar' must be one of ${Rz.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(Fz,"errorMessage");var tre="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 oI(e){let t=ye(e),r=ce(t.registrar,Rz);if(r===void 0){let u=t.registrar;if(u===void 0)return $({kind:"registrar_required"});let d=typeof u=="string"?u:Lg(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,Pz);if(t.recordIds!==void 0&&n===void 0)return $({kind:"invalid_literal",field:"recordIds",reason:`must be one of ${Pz.map(u=>`'${u}'`).join(", ")}`});let a=zz(t.records);if(!a.success)return a;let o=Kz(t.certificates);if(!o.success)return o;if(t.delegations!==void 0)return $({kind:"removed_field",field:"delegations",cure:tre});let s={zoneName:i,recordIds:n,description:N(t.description),costAllocationEnvironment:N(t.costAllocationEnvironment),tags:Zz(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,Nz);return t.phase!==void 0&&g===void 0?$({kind:"invalid_literal",field:"phase",reason:`must be one of ${Nz.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(oI,"parseDomainProps");function Lz(e){return Fz(e)}Xe(Lz,"parseDomainErrorMessage");function Uz(e,t,r){let i=We.createSourceFile(t,e,We.ScriptTarget.Latest,!0,We.ScriptKind.TS),n=aI(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=oI(n.data.propsObjectLiteral);return a.success?V(a.data):$(new Error(`Domain '${r}': infrastructure.ts could not be parsed (${a.error.kind}).`))}Xe(Uz,"parseDomainInfrastructureSource");function zz(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(!q(i))return $({kind:"invalid_literal",field:`records[${r}]`,reason:"must be an object literal"});let n=Bz(i,r);if(!n.success)return n;t.push(n.data)}return V(t)}Xe(zz,"parseRecordsArray");function Bz(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||!Mg.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(!ere.some(d=>d===r))return $({kind:"invalid_literal",field:`records[${t}]`,reason:`alias records must have type 'A' or 'AAAA', got '${r}'`});let u=Vz(e.target);return V({kind:"alias",type:r,name:i,target:u,...n!==void 0?{id:n}:{}})}if(!Qte.some(u=>u===r))return $({kind:"invalid_literal",field:`records[${t}]`,reason:`unsupported record type '${r}'`});let a=Gz(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=Z(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(Bz,"parseRecord");function Gz(e){if(e===void 0)return;if(typeof e=="string")return e;let t=Je(e);if(t!==void 0)return t}Xe(Gz,"parseRecordValue");function Vz(e){if(Jr(e))return Wz(e);if(q(e)){let t=ce(e.kind,wz);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:Lg(e)}}Xe(Vz,"parseTarget");function Wz(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=Fg(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=iI(o,"dnsName"),u=iI(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(Wz,"resolveCallRefTarget");function Fg(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(Fg,"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 iI(e,t){let r=e.trim().replace(/^\{|\}$/g,""),i=Fg(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(iI,"extractObjectFieldString");function Kz(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(!q(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(Kz,"parseCertificatesArray");function Zz(e){if(e===void 0||!q(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(Zz,"parseStringRecord");function Lg(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=>Lg(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(Lg,"stringifyParsedValue");var hy=fa(Ar(),1);var rre=Object.defineProperty,po=(e,t)=>rre(e,"name",{value:t,configurable:!0}),Zt=Symbol("non-literal");function nre(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=li(i.key);if(n===void 0||i.value===void 0)continue;let a=Ug(i.value);a!==Zt&&(r[n]=a)}return{...r,...t}}po(nre,"buildMergedLiteral");function ire(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=li(r.key);i!==void 0&&t.push(i)}return t}po(ire,"collectPropertyKeys");function Ug(e){let t=e.value;switch(e.type){case"StringLiteral":return typeof t=="string"?t:Zt;case"NumericLiteral":return typeof t=="number"?t:Zt;case"BooleanLiteral":return typeof t=="boolean"?t:Zt;case"NullLiteral":return null;case"ArrayExpression":return qz(e);case"ObjectExpression":return Hz(e);default:return Zt}}po(Ug,"astToLiteral");function qz(e){let t=e.elements;if(!Array.isArray(t))return Zt;let r=[];for(let i of t){if(!Se(i))return Zt;let n=Ug(i);if(n===Zt)return Zt;r.push(n)}return r}po(qz,"arrayToLiteral");function Hz(e){let t=e.properties;if(!Array.isArray(t))return Zt;let r={};for(let i of t){if(!Se(i)||i.type!=="Property"&&i.type!=="ObjectProperty")return Zt;let n=li(i.key),a=i.value;if(n===void 0||a===void 0)return Zt;let o=Ug(a);if(o===Zt)return Zt;r[n]=o}return r}po(Hz,"objectToLiteral");function li(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(li,"readKeyName");function Se(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}po(Se,"isNodeShape");var s2=fa(o2(),1),Mne=Object.defineProperty,Eo=(e,t)=>Mne(e,"name",{value:t,configurable:!0}),c2="\uFEFF",ly=65279;function Fne(e,t){let r=Ld(t),i=l2(e),n=s2.print(e,{quote:i,lineTerminator:r,trailingComma:!0}).code,a=u2(n,t),o=t.charCodeAt(0)===ly,s=a.charCodeAt(0)===ly;return o&&!s?`${c2}${a}`:a}Eo(Fne,"printFile");var Lne=/^(#![^\n\r]*)((?:\r?\n)*)/;function u2(e,t){let r=t.charCodeAt(0)===ly?t.slice(1):t,i=Lne.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===""?Ld(t):a,"separatorOrFloor"),s=e.charCodeAt(0)===ly,u=s?c2:"",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(u2,"restoreShebangPrefix");function Ld(e){return e.includes(`\r
|
|
618
|
+
`),n}Rr(Tz,"formatCustomCodeForInsertion");function Cz(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)};Rr(t,"visit");let r=ta(e),i=[];return t(r),i.length>0?{valid:!1,errors:i}:{valid:!0}}catch(t){return{valid:!1,errors:[ze(t)]}}}Rr(Cz,"validateModifiedFile");import*as We from"typescript";var Sd=c.enum(["A","AAAA","CNAME","MX","TXT","NS","SRV","CAA"]),Vte=c.object({name:c.string(),type:Sd,ttl:c.number().optional(),value:c.string(),priority:c.number().optional(),weight:c.number().optional(),port:c.number().optional()}).strict(),Wte=c.object({subdomain:c.string(),targetAccount:c.string(),auto:c.boolean()}).strict(),Kte=c.object({domainName:c.string(),subjectAlternativeNames:c.array(c.string())}).strict(),J_e=c.object({origin:c.string(),ttl:c.number(),records:c.array(Vte),delegations:c.array(Wte),certificates:c.array(Kte)}).strict(),xn=Object.freeze({ORIGIN:"$ORIGIN",TTL:"$TTL",FJALL_DELEGATE:"$FJALL-DELEGATE",FJALL_CERT:"$FJALL-CERT"}),Iz="ALIAS ";var Dz=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()]),wz=Dz.options.map(e=>e.shape.kind.value),tI=c.enum(["A","AAAA"]),rI=c.enum(["route53","external-delegated","external-records"]),kz=c.enum(["zone","full"]),Mg=c.string().regex(/^[A-Za-z][A-Za-z0-9]*$/),Zte=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:Mg.optional()}).strict(),qte=c.object({kind:c.literal("alias"),type:tI,name:c.string(),target:Dz,id:Mg.optional()}).strict(),Hte=c.discriminatedUnion("kind",[Zte,qte]),Jte=c.object({domainName:c.string(),subjectAlternativeNames:c.array(c.string()).optional(),transparencyLogging:c.boolean().optional(),cloudFront:c.boolean().optional()}).strict(),Xte=c.object({subdomain:c.string(),toAccount:c.string(),auto:c.boolean().optional()}).strict(),nI=c.enum(["indexed","stable"]),Q_e=c.object({zoneName:c.string(),registrar:rI,recordIds:nI.optional(),hostedZoneId:c.string().optional(),delegatedSubdomain:c.string().optional(),adoptedNameServers:c.array(c.string().min(1)).min(1).optional(),records:c.array(Hte),certificates:c.array(Jte),delegations:c.array(Xte)}).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 Yte=Object.defineProperty,Xe=(e,t)=>Yte(e,"name",{value:t,configurable:!0}),Rz=rI.options,Nz=kz.options,Pz=nI.options,Qte=Sd.options,ere=tI.options;function aI(e){let t=[],r=Xe(n=>{if(We.isNewExpression(n)&&Oz(n.expression)){let a=$z(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(aI,"findDomainConstructCall");function Oz(e){return We.isIdentifier(e)&&e.text==="Domain"}Xe(Oz,"isDomainIdentifier");function $z(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=jz(e);if(a===void 0)return;let o=Mz(e),s=We.isStringLiteral(i)?i.text:void 0;return{callExpression:e,containingStatement:a,propsObjectLiteral:n,domainVarId:o,scopeArgumentText:r.getText(),constructIdLiteral:s}}Xe($z,"buildMatch");function jz(e){let t=e;for(;t!==void 0;){if(We.isExpressionStatement(t)||We.isVariableStatement(t))return t;t=t.parent}}Xe(jz,"findContainingTopLevelStatement");function Mz(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(Mz,"extractDomainVarId");function Fz(e){switch(e.kind){case"registrar_required":return"'registrar' property is required";case"registrar_unsupported":return`'registrar' must be one of ${Rz.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(Fz,"errorMessage");var tre="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 oI(e){let t=ye(e),r=ce(t.registrar,Rz);if(r===void 0){let u=t.registrar;if(u===void 0)return $({kind:"registrar_required"});let d=typeof u=="string"?u:Lg(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,Pz);if(t.recordIds!==void 0&&n===void 0)return $({kind:"invalid_literal",field:"recordIds",reason:`must be one of ${Pz.map(u=>`'${u}'`).join(", ")}`});let a=zz(t.records);if(!a.success)return a;let o=Kz(t.certificates);if(!o.success)return o;if(t.delegations!==void 0)return $({kind:"removed_field",field:"delegations",cure:tre});let s={zoneName:i,recordIds:n,description:N(t.description),costAllocationEnvironment:N(t.costAllocationEnvironment),tags:Zz(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,Nz);return t.phase!==void 0&&g===void 0?$({kind:"invalid_literal",field:"phase",reason:`must be one of ${Nz.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(oI,"parseDomainProps");function Lz(e){return Fz(e)}Xe(Lz,"parseDomainErrorMessage");function Uz(e,t,r){let i=We.createSourceFile(t,e,We.ScriptTarget.Latest,!0,We.ScriptKind.TS),n=aI(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=oI(n.data.propsObjectLiteral);return a.success?V(a.data):$(new Error(`Domain '${r}': infrastructure.ts could not be parsed (${a.error.kind}).`))}Xe(Uz,"parseDomainInfrastructureSource");function zz(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(!q(i))return $({kind:"invalid_literal",field:`records[${r}]`,reason:"must be an object literal"});let n=Bz(i,r);if(!n.success)return n;t.push(n.data)}return V(t)}Xe(zz,"parseRecordsArray");function Bz(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||!Mg.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(!ere.some(d=>d===r))return $({kind:"invalid_literal",field:`records[${t}]`,reason:`alias records must have type 'A' or 'AAAA', got '${r}'`});let u=Vz(e.target);return V({kind:"alias",type:r,name:i,target:u,...n!==void 0?{id:n}:{}})}if(!Qte.some(u=>u===r))return $({kind:"invalid_literal",field:`records[${t}]`,reason:`unsupported record type '${r}'`});let a=Gz(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=Z(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(Bz,"parseRecord");function Gz(e){if(e===void 0)return;if(typeof e=="string")return e;let t=Je(e);if(t!==void 0)return t}Xe(Gz,"parseRecordValue");function Vz(e){if(Jr(e))return Wz(e);if(q(e)){let t=ce(e.kind,wz);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:Lg(e)}}Xe(Vz,"parseTarget");function Wz(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=Fg(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=iI(o,"dnsName"),u=iI(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(Wz,"resolveCallRefTarget");function Fg(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(Fg,"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 iI(e,t){let r=e.trim().replace(/^\{|\}$/g,""),i=Fg(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(iI,"extractObjectFieldString");function Kz(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(!q(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(Kz,"parseCertificatesArray");function Zz(e){if(e===void 0||!q(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(Zz,"parseStringRecord");function Lg(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=>Lg(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(Lg,"stringifyParsedValue");var hy=fa(Ar(),1);var rre=Object.defineProperty,po=(e,t)=>rre(e,"name",{value:t,configurable:!0}),Zt=Symbol("non-literal");function nre(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=li(i.key);if(n===void 0||i.value===void 0)continue;let a=Ug(i.value);a!==Zt&&(r[n]=a)}return{...r,...t}}po(nre,"buildMergedLiteral");function ire(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=li(r.key);i!==void 0&&t.push(i)}return t}po(ire,"collectPropertyKeys");function Ug(e){let t=e.value;switch(e.type){case"StringLiteral":return typeof t=="string"?t:Zt;case"NumericLiteral":return typeof t=="number"?t:Zt;case"BooleanLiteral":return typeof t=="boolean"?t:Zt;case"NullLiteral":return null;case"ArrayExpression":return qz(e);case"ObjectExpression":return Hz(e);default:return Zt}}po(Ug,"astToLiteral");function qz(e){let t=e.elements;if(!Array.isArray(t))return Zt;let r=[];for(let i of t){if(!Se(i))return Zt;let n=Ug(i);if(n===Zt)return Zt;r.push(n)}return r}po(qz,"arrayToLiteral");function Hz(e){let t=e.properties;if(!Array.isArray(t))return Zt;let r={};for(let i of t){if(!Se(i)||i.type!=="Property"&&i.type!=="ObjectProperty")return Zt;let n=li(i.key),a=i.value;if(n===void 0||a===void 0)return Zt;let o=Ug(a);if(o===Zt)return Zt;r[n]=o}return r}po(Hz,"objectToLiteral");function li(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(li,"readKeyName");function Se(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}po(Se,"isNodeShape");var s2=fa(o2(),1),Mne=Object.defineProperty,Eo=(e,t)=>Mne(e,"name",{value:t,configurable:!0}),c2="\uFEFF",ly=65279;function Fne(e,t){let r=Ld(t),i=l2(e),n=s2.print(e,{quote:i,lineTerminator:r,trailingComma:!0}).code,a=u2(n,t),o=t.charCodeAt(0)===ly,s=a.charCodeAt(0)===ly;return o&&!s?`${c2}${a}`:a}Eo(Fne,"printFile");var Lne=/^(#![^\n\r]*)((?:\r?\n)*)/;function u2(e,t){let r=t.charCodeAt(0)===ly?t.slice(1):t,i=Lne.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===""?Ld(t):a,"separatorOrFloor"),s=e.charCodeAt(0)===ly,u=s?c2:"",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(u2,"restoreShebangPrefix");function Ld(e){return e.includes(`\r
|
|
619
619
|
`)?`\r
|
|
620
620
|
`:`
|
|
621
621
|
`}Eo(Ld,"detectLineTerminator");function l2(e){let t=0,r=0;return d2(e,i=>{if(i.type!=="StringLiteral"&&i.type!=="Literal")return;let n=i.extra;if(!Fd(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(l2,"detectQuoteStyle");function d2(e,t){let r=[e];for(;r.length>0;){let i=r.pop();if(!(!Fd(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)Fd(o)&&typeof o.type=="string"&&r.push(o);else Fd(a)&&typeof a.type=="string"&&r.push(a)}}}}Eo(d2,"visit");function Fd(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}Eo(Fd,"isRecord");var Une=Object.defineProperty,dy=(e,t)=>Une(e,"name",{value:t,configurable:!0});function Ht(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}dy(Ht,"isRecord");function zne(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}dy(zne,"extractProgramBody");function qI(e,t){return e.length===0?0:e.split(t).length}dy(qI,"countLines");function Bne(e,t){let r=Ld(e),i=qI(t,r)-qI(e,r);return i>=0?{added:i,removed:0}:{added:0,removed:-i}}dy(Bne,"computeLinesDelta");var Gne=Object.defineProperty,en=(e,t)=>Gne(e,"name",{value:t,configurable:!0});function Vne(e){let t=p2(e),r=m2(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:HI(a)},resolveStringArray(n){let a=i(n);if(a===void 0)return;let o=oa(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=HI(d);if(p===void 0)return;u.push(p)}return u},objectKeysOf:en(n=>py(n,i,new Set),"objectKeysOf")}}en(Vne,"buildModuleConstResolver");function HI(e){let t=oa(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(HI,"readStaticString");var Wne=new Set(["TSAsExpression","TSSatisfiesExpression","TSTypeAssertion","TSNonNullExpression","ParenthesizedExpression"]);function oa(e){let t=e;for(;Wne.has(t.type);){let r=t.expression;if(!Se(r))return t;t=r}return t}en(oa,"unwrapTsWrappers");function py(e,t,r){let i=oa(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:py(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=py(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=li(s);if(u===void 0)return;a.push(u)}return a}en(py,"objectKeysOfNode");function p2(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(p2,"countBindings");function m2(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(m2,"collectTopLevelConstInits");var Kne=Object.defineProperty,my=(e,t)=>Kne(e,"name",{value:t,configurable:!0});function Zne(e,t){return e.properties.find(r=>(r.type==="Property"||r.type==="ObjectProperty")&&r.shorthand!==!0&&r.computed!==!0&&li(r.key)===t)}my(Zne,"findPropertyByKey");function qne(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&&li(r.key)===t)}my(qne,"objectAbsenceIsProvable");function Hne(e,t){e.properties[e.properties.length-1]?.extra?.trailingComma===!0&&(t.extra={...t.extra??{},trailingComma:!0}),e.properties.push(t)}my(Hne,"pushPropertyPreservingComma");function fy(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)}}}}my(fy,"visit");var Jne=Object.defineProperty,xo=(e,t)=>Jne(e,"name",{value:t,configurable:!0});function XI(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;fy(h,l=>{l.type==="CallExpression"&&gy(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=YI(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)||!JI(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(gy(u,t.factory,r))return $({kind:"bare-factory-call"});if(!JI(u,t,r))return $({kind:"foreign-wrapper"});let d=Er(r);return Vi.has(d)?$({kind:"reserved-word",variableName:d}):h2(e,d)?$({kind:"name-conflict",variableName:d}):V({variableName:d,resourceName:r,statementIndex:n.statementIndex,wrap:{statementIndex:n.statementIndex,expression:u}})}xo(XI,"planBinding");function Xne(e,t){if(t.wrap===void 0)return;let{statementIndex:r,expression:i}=t.wrap,n=e[r],a=hy.builders.variableDeclaration("const",[hy.builders.variableDeclarator(hy.builders.identifier(t.variableName),i)]),o=n?.comments;o!==void 0&&(a.comments=o),e[r]=a}xo(Xne,"applyBinding");function gy(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(gy,"isFactoryBuildOf");function YI(e){if(e.type!=="ExportNamedDeclaration"&&e.type!=="ExportDefaultDeclaration")return e;let t=e.declaration;return Se(t)?t:void 0}xo(YI,"unwrapExportDeclaration");function f2(e){let t=oa(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(f2,"appMethodNameOf");function JI(e,t,r){let i=oa(e);if(f2(i)!==t.appMethod)return!1;let n=i.arguments;if(!Array.isArray(n))return!1;let a=n[0];return Se(a)?gy(oa(a),t.factory,r):!1}xo(JI,"isAppMethodWrap");function h2(e,t){for(let r of e){let i=YI(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(fy(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(h2,"moduleScopeDeclares");var Yne=Object.defineProperty,$c=(e,t)=>Yne(e,"name",{value:t,configurable:!0}),Qne={cdn:{default:["storage","compute"]},compute:{perKey:{connectedDatabase:["database"],connectedStorage:["storage"],connectedMessaging:["messaging"]}}};function eie(e,t,r={}){let i=Qne[e],n=[],a=$c((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=ii[l].emitWrapper?.appMethod;if(m===void 0)continue;let f=XI(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:$c((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:$c(()=>{let o=n;return n=[],o.map(s=>s.plan)},"takePendingWraps"),pendingDeclarations:$c(()=>n.map(({plan:o,planKey:s})=>({variableName:o.variableName,resourceName:o.resourceName,statementIndex:o.statementIndex,...s!==void 0&&{planKey:s}})),"pendingDeclarations")}}$c(eie,"createSiblingBindingResolution");function QI(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}}}$c(QI,"findPendingWrapCollision");var tie=Object.defineProperty,Mr=(e,t)=>tie(e,"name",{value:t,configurable:!0});function g2(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}}))}Mr(g2,"toUserServiceConfigs");function y2(e,t,r=!0,i,n){let a={appName:e,type:t,database:[],s3:[],compute:[]};if(t==="custom")return a;let o=t,s=oi[o];return{...a,database:v2(e,s,o,r,n),compute:x2(e,s,o,r,i),network:s.network,backup:s.backup}}Mr(y2,"planApplicationResources");function v2(e,t,r,i,n){let a=sC(r),o=t.database[a];return!i||o===null?[]:[{name:e,type:a,databaseName:Po(e),variableName:`${Er(e)}Database`,...o,...n?.snapshotIdentifier!==void 0&&{snapshotIdentifier:n.snapshotIdentifier},...n?.snapshotUsername!==void 0&&{snapshotUsername:n.snapshotUsername}}]}Mr(v2,"buildDatabasePlan");function b2(e,t){if(!(e===void 0&&t===void 0))return{scaling:{...e!==void 0&&{minCapacity:e},...t!==void 0&&{maxCapacity:t}}}}Mr(b2,"buildScalingConfig");function eD(e){let{minCapacity:t,maxCapacity:r,...i}=e;return{...i,...b2(t,r)}}Mr(eD,"planServiceFromTierPreset");function S2(e,t){let r=eD(e),i=t?.serviceType==="worker",n=t?.containerPort??W1,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}]}}Mr(S2,"buildServiceEntry");function E2(e,t){return t||e?.directAccess===!0?e:{...e,loadBalancer:!1}}Mr(E2,"resolveClusterConfig");function x2(e,t,r,i,n){let a=t.compute.ecs,o=(n&&n.length>0?cC(r,n):a.services.map((u,d)=>({...u,name:d===0?"api":`service-${d+1}`}))).map((u,d)=>S2(u,n?.[d])),s=o.some(u=>u.containers?.some(d=>d.port!==void 0));return[{name:e,type:ol.ECS,needsConnection:i,connectedDatabase:i?[e]:void 0,variableName:`${Er(e)}Compute`,cluster:E2(a.cluster,s),services:o}]}Mr(x2,"buildComputePlan");function A2(e){let t=[],r=0,i=Mr((a,o,s)=>{t.push({variableName:a,resourceName:o,statementIndex:r++,planKey:s})},"declare");for(let a of e.additionalNetworks??[])i(Er(a.name),a.name,"additionalNetworks");if(oc(e))return t;for(let a of e.database)zl(a,e)&&i(ke(a),a.name,"database");for(let a of e.clickhouse??[])Bl(a,e)&&i(ke(a),a.name,"clickhouse");for(let a of e.s3)Ql(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??[])ed(a,e)&&i(ke(a),a.name,"sqs");let n=sd(e);for(let a of e.compute)(n.has(a.name)||a.scheduleExpression!==void 0)&&i(ke(a),a.name,"compute");return t}Mr(A2,"collectPlannedDeclarations");function _2(e){let t=[],r=/^const\s+([A-Za-z_$][A-Za-z0-9_$]*)\s*=/gm,i=od(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}Mr(_2,"collectPreludeDeclarations");function jc(e,t){let r=A2(e),i=r.find(s=>Vi.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=QI([..._2(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(!oc(e)){let s=sg(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=[yg(e),od(e),gg(e)];if(oc(e))a.push(nd(e),ad(e));else{let s=sd(e);a.push(ad(e),Xh(e),Yh(e),ug(e),lg(e),dg(e),cg(e,s),vg(e))}let o=a.join("");if(e.customCodeBlocks&&e.customCodeBlocks.length>0){let s=jg(o,e.customCodeBlocks,t?.resourceMapping);return s.success?V(s.content):$(new Error(`Custom code injection failed: ${s.error??"unknown error"}`))}return V(o)}Mr(jc,"generateInfrastructureFromPlan");var rie=Object.defineProperty,Mc=(e,t)=>rie(e,"name",{value:t,configurable:!0}),nie=oC("standard");function T2(e){return xl.options.some(t=>t.shape?.type?.value===e)}Mc(T2,"isPatternConfigType");function C2(e,t,r){let{tier:i="standard",domain:n,database:a,compute:o,cdn:s,environment:u,tags:d}=r??{},p=Sg(i);if(!p&&i!=="custom")return $(new Error(`Invalid pattern tier: "${i}". Valid tiers are: ${[...ud,"custom"].join(", ")}`));if(!T2(t))return $(new Error(`Unsupported pattern type: ${t}`));let h=p?bg(i):null,g=k2(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:nie,backup:h?h.backup:!1,patternConfig:l,database:[],s3:[],compute:[],tags:d??{}})}Mc(C2,"planOpenNextResources");function I2(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}}}Mc(I2,"mergeDatabaseConfig");function D2(e,t){return{memorySize:e?.memorySize??t.compute.memorySize,timeout:e?.timeout??t.compute.timeout}}Mc(D2,"mergeComputeConfig");function w2(e){let{encryption:t,...r}=e;return{...r,...t&&{encryption:{storageKey:t}}}}Mc(w2,"toPatternDatabaseConfig");function k2(e,t,r){let{domain:i,database:n,compute:a,cdn:o,environment:s,tierPreset:u}=r,d=u?I2(n,u):n,p=u?D2(a,u):a,h={type:e,name:t,domain:i,database:d?w2(d):void 0,compute:p?{server:p}:void 0,cdn:o?{domainNames:o.domainNames,certificateArn:o.certificateArn}:void 0,environment:s},g=xl.safeParse(h);return g.success?V(g.data):$(new Error(`Invalid pattern config: ${g.error.message}`))}Mc(k2,"buildPatternConfig");var iie=Object.defineProperty,aie=(e,t)=>iie(e,"name",{value:t,configurable:!0});function N2(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=El.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}`))}aie(N2,"planStaticSiteResources");var oie=Object.defineProperty,yy=(e,t)=>oie(e,"name",{value:t,configurable:!0});function P2(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]}yy(P2,"parseServiceReference");function tD(e,t,r){r==="database"?(e.needsConnection=!0,e.connectedDatabase=[...new Set([...e.connectedDatabase??[],t])]):e.connectedStorage=[...new Set([...e.connectedStorage??[],t])]}yy(tD,"addResourceConnection");function vy(e,t,r,i){let n=new Set(t),a=[...new Set(t.map(P2))];for(let o of a){let s=e.compute.find(u=>u.name===o);if(s?.services){tD(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)}}}}yy(vy,"applyServiceConnections");function by(e,t,r,i){for(let n of e.compute)if(t.includes(n.name)&&(tD(n,r,i),n.services))for(let a of n.services)i==="database"?a.needsDatabaseConnection=!0:a.needsStorageConnection=!0}yy(by,"applyComputeConnections");var sie=Object.defineProperty,st=(e,t)=>sie(e,"name",{value:t,configurable:!0});function R2(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"}]}st(R2,"listAvailableResources");function Ud(e,t){if(nD(e,t.resourceName))return $(new Error(iD(t.resourceName)));switch(t.type){case"database":return O2(e,t);case"database:proxy":return $2(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 j2(e,t);case"tunnel":return M2(e);default:{let r=t;return $(new Error(`Unknown resource type: ${String(r)}`))}}}st(Ud,"validateResourceAddition");function O2(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)}st(O2,"validateDatabaseAddition");function $2(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)}st($2,"validateProxyAddition");function j2(e,t){if(e.cdn)return $(new Error("A CDN is already configured for this application. Remove the existing CDN first."));if(!rD(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(!rD(e,r.originRef))return $(new Error(`Behaviour origin '${r.originRef}' not found in plan.`))}return V(void 0)}st(j2,"validateCdnAddition");function M2(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)}st(M2,"validateTunnelAddition");function Sy(e,t){let r=Ud(e,t);if(!r.success)return r;switch(t.type){case"database":return F2(e,t);case"database:proxy":return L2(e,t);case"storage:s3":return U2(e,t);case"network":return z2(e,t);case"compute:ecs":return B2(e,t);case"compute:lambda":return G2(e,t);case"cdn":return V2(e,t);case"tunnel":return W2(e,t);default:{let i=t;return $(new Error(`Unknown resource type: ${String(i)}`))}}}st(Sy,"addResourceToPlan");function F2(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 aD(a,t.resourceName,"database",t),V(a)}st(F2,"addDatabase");function L2(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})}st(L2,"addProxy");function U2(e,t){let r=t.bucketName??t.resourceName.toLowerCase(),i=Qe(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 aD(s,i,"storage",t),V(s)}st(U2,"addS3");function z2(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}})}st(z2,"addNetwork");function B2(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]})}st(B2,"addEcsCompute");function G2(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]})}st(G2,"addLambdaCompute");function V2(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})}st(V2,"addCdn");function W2(e,t){let r=t.instanceType?{instanceType:t.instanceType}:{};return V({...e,tunnel:r})}st(W2,"addTunnel");function nD(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)}st(nD,"isResourceNameTaken");function iD(e){return`Resource name '${e}' is already used in this application.`}st(iD,"resourceNameTakenMessage");function rD(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)}st(rD,"resourceExistsInPlan");function aD(e,t,r,i){i.connectToCompute&&i.connectToCompute.length>0&&by(e,[...i.connectToCompute],t,r),i.connectToServices&&i.connectToServices.length>0&&vy(e,[...i.connectToServices],t,r)}st(aD,"applyConnections");var cie=Object.defineProperty,uie=(e,t)=>cie(e,"name",{value:t,configurable:!0});function K2(e,t,r){let i;try{i=ea(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=Ud(n,r);if(!a.success)return a;let o=Sy(n,r);if(!o.success)return o;let s=jc(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}`))}uie(K2,"generateResourceChange");var lie=Object.defineProperty,Ao=(e,t)=>lie(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}Ao(wn,"pickDefined");function Z2(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}}Ao(Z2,"buildRelationalResourcePlan");function q2(e){return`${e}Database`}Ao(q2,"defaultRelationalDatabaseName");function H2(e,t){return`Database name '${e}' already exists in ${t}. Please choose a different database name.`}Ao(H2,"duplicateDatabaseNameMessage");function J2(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:{}}}Ao(J2,"resolveProxyAddition");function X2(e,t){return{name:e,type:"ClickHouse",databaseName:t.databaseName,...wn(t,"instanceType","storageGb","iops","throughputMbps","coldTier","optimiseSchedule","backupSchedule","backupVerify","backupRetentionDays")}}Ao(X2,"buildClickHouseResourcePlan");function Y2(e,t,r){let i=t.storagePreset??"standard",n=Eg[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")}}Ao(Y2,"buildS3ResourcePlan");var die=Object.defineProperty,gi=(e,t)=>die(e,"name",{value:t,configurable:!0}),pie=new Set(Sd.options);function Q2(e){return pie.has(e.toUpperCase())}gi(Q2,"isRecordType");function e4(e){return e.endsWith(".")?e.slice(0,-1):e}gi(e4,"stripTrailingDot");function t4(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}gi(t4,"stripInlineComment");function r4(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(" ")}gi(r4,"parseTxtValue");function n4(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}}gi(n4,"parseDelegateDirective");function i4(e){if(e.length<2)return;let t=e[1],r=e.slice(2);return{domainName:t,subjectAlternativeNames:r}}gi(i4,"parseCertDirective");function a4(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}gi(a4,"tokenise");function o4(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(Q2(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=r4(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:`${Iz}${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]}}}gi(o4,"parseRecord");function s4(e){let t=e.split(`
|
|
@@ -821,4 +821,4 @@ ${dl(i.error)}`);return i.data}To(z4,"validateGeneratorOptions");function B4(e,t
|
|
|
821
821
|
`);return i}b3(Use,"selectResources");var da=fa(Cw(),1),zse=Object.defineProperty,My=(e,t)=>zse(e,"name",{value:t,configurable:!0});function S3(e){let t=[];for(let r of e.s3)t.push({name:r.name,description:"S3 Storage"});for(let r of e.compute)r.type==="lambda"?r.functionUrl&&t.push({name:r.name,description:"Lambda"}):r.type==="ecs"&&t.push({name:r.name,description:"ECS with ALB"});return t}My(S3,"collectAvailableOrigins");function ww(e,t){if(!t.some(r=>r.name===e)){let r=t.map(i=>i.name).join(", ");throw new Error(`Origin "${e}" not found in infrastructure. Available origins: ${r}`)}}My(ww,"validateOriginRef");async function E3(e,t){let r=S3(e);if(r.length===0)throw new Error("No available CDN origins found. Add an S3 bucket or compute resource with ALB/function URL first.");if(t.defaultOriginRef){if(ww(t.defaultOriginRef,r),t.behaviours)for(let s of t.behaviours)ww(s.originRef,r);return{defaultOriginRef:t.defaultOriginRef,behaviours:t.behaviours,...t.customDomain&&{customDomain:t.customDomain}}}if(t.nameProvidedByFlag)throw new Error("Default origin must be specified in non-interactive mode");let i;if(r.length===1)i=r[0].name,process.stdout.write(`
|
|
822
822
|
Auto-selected origin: ${i}
|
|
823
823
|
`);else if(i=(await(0,da.default)([{type:"select",name:"origin",message:"Select the default origin:",choices:r.map(s=>({title:`${s.name} (${s.description})`,value:s.name}))}])).origin,!i)throw new Error("Origin selection cancelled");let n,a=r.filter(s=>s.name!==i);if(a.length>0&&await Dw(a.length,"origin","Add path-based routing to another origin?","Add path-based routing to other origins?")){n=[];let s=!0;for(;s&&a.length>0;){let u=(await(0,da.default)([{type:"text",name:"pathPattern",message:"Path pattern (e.g., /static/*):"}])).pathPattern;if(!u)break;let d;if(a.length===1)d=a[0].name,process.stdout.write(` Auto-selected origin: ${d}
|
|
824
|
-
`);else if(d=(await(0,da.default)([{type:"select",name:"origin",message:"Origin for this path:",choices:a.map(h=>({title:`${h.name} (${h.description})`,value:h.name}))}])).origin,!d)break;let p=(await(0,da.default)([{type:"select",name:"cachePolicy",message:"Cache policy:",choices:[{title:"Caching Optimised",value:"CACHING_OPTIMIZED",description:"Best for static assets"},{title:"Caching Disabled",value:"CACHING_DISABLED",description:"Best for dynamic APIs"}]}])).cachePolicy;n.push({pathPattern:u,originRef:d,...p!==void 0&&{cachePolicy:p}}),s=(await(0,da.default)([{type:"confirm",name:"addMore",message:"Add another path route?",initial:!1}])).addMore}n.length===0&&(n=void 0)}let o;return(await(0,da.default)([{type:"confirm",name:"wantDomain",message:"Add a custom domain?",initial:!1}])).wantDomain&&(o=(await(0,da.default)([{type:"text",name:"domain",message:"Enter custom domain:"}])).domain||void 0),{defaultOriginRef:i,behaviours:n,...o!==void 0&&{customDomain:o}}}My(E3,"handleCdnOriginSelection");async function x3(e,t){await hD(e,_j,t,"CDN",async({validated:r,plan:i})=>{if(i.cdn)throw new Error("A CDN is already configured for this application. Remove the existing CDN first.");let n=await E3(i,r),a=r.name??`${Qe(r.appName)}Cdn`;return{...i,cdn:{name:a,defaultOriginRef:n.defaultOriginRef,...n.behaviours&&n.behaviours.length>0&&{behaviours:n.behaviours},...n.customDomain!==void 0&&{customDomain:n.customDomain},...r.certificateArn!==void 0&&{certificateArn:r.certificateArn},...r.domain!==void 0&&{domain:r.domain},...r.originHostname!==void 0&&{originHostname:r.originHostname},...r.accessGate!==void 0&&{accessGate:r.accessGate}}}})}My(x3,"cdnGenerator");var
|
|
824
|
+
`);else if(d=(await(0,da.default)([{type:"select",name:"origin",message:"Origin for this path:",choices:a.map(h=>({title:`${h.name} (${h.description})`,value:h.name}))}])).origin,!d)break;let p=(await(0,da.default)([{type:"select",name:"cachePolicy",message:"Cache policy:",choices:[{title:"Caching Optimised",value:"CACHING_OPTIMIZED",description:"Best for static assets"},{title:"Caching Disabled",value:"CACHING_DISABLED",description:"Best for dynamic APIs"}]}])).cachePolicy;n.push({pathPattern:u,originRef:d,...p!==void 0&&{cachePolicy:p}}),s=(await(0,da.default)([{type:"confirm",name:"addMore",message:"Add another path route?",initial:!1}])).addMore}n.length===0&&(n=void 0)}let o;return(await(0,da.default)([{type:"confirm",name:"wantDomain",message:"Add a custom domain?",initial:!1}])).wantDomain&&(o=(await(0,da.default)([{type:"text",name:"domain",message:"Enter custom domain:"}])).domain||void 0),{defaultOriginRef:i,behaviours:n,...o!==void 0&&{customDomain:o}}}My(E3,"handleCdnOriginSelection");async function x3(e,t){await hD(e,_j,t,"CDN",async({validated:r,plan:i})=>{if(i.cdn)throw new Error("A CDN is already configured for this application. Remove the existing CDN first.");let n=await E3(i,r),a=r.name??`${Qe(r.appName)}Cdn`;return{...i,cdn:{name:a,defaultOriginRef:n.defaultOriginRef,...n.behaviours&&n.behaviours.length>0&&{behaviours:n.behaviours},...n.customDomain!==void 0&&{customDomain:n.customDomain},...r.certificateArn!==void 0&&{certificateArn:r.certificateArn},...r.domain!==void 0&&{domain:r.domain},...r.originHostname!==void 0&&{originHostname:r.originHostname},...r.accessGate!==void 0&&{accessGate:r.accessGate}}}})}My(x3,"cdnGenerator");var WIe=x3;export{x3 as cdnGenerator,WIe as default};
|