fjall 3.10.0 → 3.11.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.
@@ -1,29 +1,29 @@
1
1
  import { createRequire as __fjcreateRequire } from "module";
2
2
  const require = __fjcreateRequire(import.meta.url);
3
3
 
4
- var Fw=Object.create;var Jl=Object.defineProperty;var Bw=Object.getOwnPropertyDescriptor;var Vw=Object.getOwnPropertyNames;var Zw=Object.getPrototypeOf,Gw=Object.prototype.hasOwnProperty;var ts=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var I=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},$t=(e,t)=>{for(var n in t)Jl(e,n,{get:t[n],enumerable:!0})},Ww=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Vw(t))!Gw.call(e,r)&&r!==n&&Jl(e,r,{get:()=>t[r],enumerable:!(i=Bw(t,r))||i.enumerable});return e};var Hw=(e,t,n)=>(n=e!=null?Fw(Zw(e)):{},Ww(t||!e||!e.__esModule?Jl(n,"default",{value:e,enumerable:!0}):n,e));var oe=I((TX,uP)=>{"use strict";var{FORCE_COLOR:M4,NODE_DISABLE_COLORS:j4,TERM:z4}=process.env,H={enabled:!j4&&z4!=="dumb"&&M4!=="0",reset:ee(0,0),bold:ee(1,22),dim:ee(2,22),italic:ee(3,23),underline:ee(4,24),inverse:ee(7,27),hidden:ee(8,28),strikethrough:ee(9,29),black:ee(30,39),red:ee(31,39),green:ee(32,39),yellow:ee(33,39),blue:ee(34,39),magenta:ee(35,39),cyan:ee(36,39),white:ee(37,39),gray:ee(90,39),grey:ee(90,39),bgBlack:ee(40,49),bgRed:ee(41,49),bgGreen:ee(42,49),bgYellow:ee(43,49),bgBlue:ee(44,49),bgMagenta:ee(45,49),bgCyan:ee(46,49),bgWhite:ee(47,49)};function cP(e,t){let n=0,i,r="",o="";for(;n<e.length;n++)i=e[n],r+=i.open,o+=i.close,t.includes(i.close)&&(t=t.replace(i.rgx,i.close+i.open));return r+t+o}function L4(e,t){let n={has:e,keys:t};return n.reset=H.reset.bind(n),n.bold=H.bold.bind(n),n.dim=H.dim.bind(n),n.italic=H.italic.bind(n),n.underline=H.underline.bind(n),n.inverse=H.inverse.bind(n),n.hidden=H.hidden.bind(n),n.strikethrough=H.strikethrough.bind(n),n.black=H.black.bind(n),n.red=H.red.bind(n),n.green=H.green.bind(n),n.yellow=H.yellow.bind(n),n.blue=H.blue.bind(n),n.magenta=H.magenta.bind(n),n.cyan=H.cyan.bind(n),n.white=H.white.bind(n),n.gray=H.gray.bind(n),n.grey=H.grey.bind(n),n.bgBlack=H.bgBlack.bind(n),n.bgRed=H.bgRed.bind(n),n.bgGreen=H.bgGreen.bind(n),n.bgYellow=H.bgYellow.bind(n),n.bgBlue=H.bgBlue.bind(n),n.bgMagenta=H.bgMagenta.bind(n),n.bgCyan=H.bgCyan.bind(n),n.bgWhite=H.bgWhite.bind(n),n}function ee(e,t){let n={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(n)),i===void 0?this:H.enabled?cP(this.keys,i+""):i+""):i===void 0?L4([e],[n]):H.enabled?cP([n],i+""):i+""}}uP.exports=H});var dP=I((RX,lP)=>{"use strict";lP.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 Ml=I((PX,mP)=>{"use strict";mP.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("|"),n=new RegExp(t,"g");return typeof e=="string"?e.replace(n,""):e}});var ae=I((CX,pP)=>{"use strict";var ay={to(e,t){return t?`\x1B[${t+1};${e+1}H`:`\x1B[${e+1}G`},move(e,t){let n="";return e<0?n+=`\x1B[${-e}D`:e>0&&(n+=`\x1B[${e}C`),t<0?n+=`\x1B[${-t}A`:t>0&&(n+=`\x1B[${t}B`),n},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"},U4={up:(e=1)=>"\x1B[S".repeat(e),down:(e=1)=>"\x1B[T".repeat(e)},F4={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 n=0;n<e;n++)t+=this.line+(n<e-1?ay.up():"");return e&&(t+=ay.left),t}};pP.exports={cursor:ay,scroll:U4,erase:F4,beep:"\x07"}});var bP=I((NX,vP)=>{"use strict";function B4(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=V4(e))||t&&e&&typeof e.length=="number"){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(l){throw l},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
5
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,c;return{s:function(){n=n.call(e)},n:function(){var l=n.next();return o=l.done,l},e:function(l){a=!0,c=l},f:function(){try{!o&&n.return!=null&&n.return()}finally{if(a)throw c}}}}function V4(e,t){if(e){if(typeof e=="string")return fP(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fP(e,t)}}function fP(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}var Z4=Ml(),hP=ae(),gP=hP.erase,G4=hP.cursor,W4=e=>[...Z4(e)].length;vP.exports=function(e,t){if(!t)return gP.line+G4.to(0);let n=0,i=e.split(/\r?\n/);var r=B4(i),o;try{for(r.s();!(o=r.n()).done;){let a=o.value;n+=1+Math.floor(Math.max(W4(a)-1,0)/t)}}catch(a){r.e(a)}finally{r.f()}return gP.lines(n)}});var sy=I((wX,yP)=>{"use strict";var Za={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},H4={arrowUp:Za.arrowUp,arrowDown:Za.arrowDown,arrowLeft:Za.arrowLeft,arrowRight:Za.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},q4=process.platform==="win32"?H4:Za;yP.exports=q4});var _P=I((kX,SP)=>{"use strict";var Xi=oe(),An=sy(),cy=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}`}}),K4=e=>cy[e]||cy.default,Ga=Object.freeze({aborted:Xi.red(An.cross),done:Xi.green(An.tick),exited:Xi.yellow(An.cross),default:Xi.cyan("?")}),Y4=(e,t,n)=>t?Ga.aborted:n?Ga.exited:e?Ga.done:Ga.default,X4=e=>Xi.gray(e?An.ellipsis:An.pointerSmall),J4=(e,t)=>Xi.gray(e?t?An.pointerSmall:"+":An.line);SP.exports={styles:cy,render:K4,symbols:Ga,symbol:Y4,delimiter:X4,item:J4}});var xP=I((OX,EP)=>{"use strict";var Q4=Ml();EP.exports=function(e,t){let n=String(Q4(e)||"").split(/\r?\n/);return t?n.map(i=>Math.ceil(i.length/t)).reduce((i,r)=>i+r):n.length}});var IP=I((DX,AP)=>{"use strict";AP.exports=(e,t={})=>{let n=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",i=t.width;return(e||"").split(/\r?\n/g).map(r=>r.split(/\s+/g).reduce((o,a)=>(a.length+n.length>=i||o[o.length-1].length+a.length+1<i?o[o.length-1]+=` ${a}`:o.push(`${n}${a}`),o),[n]).join(`
4
+ var Fw=Object.create;var Jl=Object.defineProperty;var Bw=Object.getOwnPropertyDescriptor;var Vw=Object.getOwnPropertyNames;var Zw=Object.getPrototypeOf,Gw=Object.prototype.hasOwnProperty;var ts=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var I=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},$t=(e,t)=>{for(var n in t)Jl(e,n,{get:t[n],enumerable:!0})},Ww=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Vw(t))!Gw.call(e,r)&&r!==n&&Jl(e,r,{get:()=>t[r],enumerable:!(i=Bw(t,r))||i.enumerable});return e};var Hw=(e,t,n)=>(n=e!=null?Fw(Zw(e)):{},Ww(t||!e||!e.__esModule?Jl(n,"default",{value:e,enumerable:!0}):n,e));var oe=I((RX,uP)=>{"use strict";var{FORCE_COLOR:j4,NODE_DISABLE_COLORS:z4,TERM:L4}=process.env,H={enabled:!z4&&L4!=="dumb"&&j4!=="0",reset:ee(0,0),bold:ee(1,22),dim:ee(2,22),italic:ee(3,23),underline:ee(4,24),inverse:ee(7,27),hidden:ee(8,28),strikethrough:ee(9,29),black:ee(30,39),red:ee(31,39),green:ee(32,39),yellow:ee(33,39),blue:ee(34,39),magenta:ee(35,39),cyan:ee(36,39),white:ee(37,39),gray:ee(90,39),grey:ee(90,39),bgBlack:ee(40,49),bgRed:ee(41,49),bgGreen:ee(42,49),bgYellow:ee(43,49),bgBlue:ee(44,49),bgMagenta:ee(45,49),bgCyan:ee(46,49),bgWhite:ee(47,49)};function cP(e,t){let n=0,i,r="",o="";for(;n<e.length;n++)i=e[n],r+=i.open,o+=i.close,t.includes(i.close)&&(t=t.replace(i.rgx,i.close+i.open));return r+t+o}function U4(e,t){let n={has:e,keys:t};return n.reset=H.reset.bind(n),n.bold=H.bold.bind(n),n.dim=H.dim.bind(n),n.italic=H.italic.bind(n),n.underline=H.underline.bind(n),n.inverse=H.inverse.bind(n),n.hidden=H.hidden.bind(n),n.strikethrough=H.strikethrough.bind(n),n.black=H.black.bind(n),n.red=H.red.bind(n),n.green=H.green.bind(n),n.yellow=H.yellow.bind(n),n.blue=H.blue.bind(n),n.magenta=H.magenta.bind(n),n.cyan=H.cyan.bind(n),n.white=H.white.bind(n),n.gray=H.gray.bind(n),n.grey=H.grey.bind(n),n.bgBlack=H.bgBlack.bind(n),n.bgRed=H.bgRed.bind(n),n.bgGreen=H.bgGreen.bind(n),n.bgYellow=H.bgYellow.bind(n),n.bgBlue=H.bgBlue.bind(n),n.bgMagenta=H.bgMagenta.bind(n),n.bgCyan=H.bgCyan.bind(n),n.bgWhite=H.bgWhite.bind(n),n}function ee(e,t){let n={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(n)),i===void 0?this:H.enabled?cP(this.keys,i+""):i+""):i===void 0?U4([e],[n]):H.enabled?cP([n],i+""):i+""}}uP.exports=H});var dP=I((PX,lP)=>{"use strict";lP.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 Ml=I((CX,mP)=>{"use strict";mP.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("|"),n=new RegExp(t,"g");return typeof e=="string"?e.replace(n,""):e}});var ae=I((NX,pP)=>{"use strict";var ay={to(e,t){return t?`\x1B[${t+1};${e+1}H`:`\x1B[${e+1}G`},move(e,t){let n="";return e<0?n+=`\x1B[${-e}D`:e>0&&(n+=`\x1B[${e}C`),t<0?n+=`\x1B[${-t}A`:t>0&&(n+=`\x1B[${t}B`),n},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"},F4={up:(e=1)=>"\x1B[S".repeat(e),down:(e=1)=>"\x1B[T".repeat(e)},B4={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 n=0;n<e;n++)t+=this.line+(n<e-1?ay.up():"");return e&&(t+=ay.left),t}};pP.exports={cursor:ay,scroll:F4,erase:B4,beep:"\x07"}});var bP=I((wX,vP)=>{"use strict";function V4(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Z4(e))||t&&e&&typeof e.length=="number"){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(l){throw l},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
5
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,c;return{s:function(){n=n.call(e)},n:function(){var l=n.next();return o=l.done,l},e:function(l){a=!0,c=l},f:function(){try{!o&&n.return!=null&&n.return()}finally{if(a)throw c}}}}function Z4(e,t){if(e){if(typeof e=="string")return fP(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fP(e,t)}}function fP(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}var G4=Ml(),hP=ae(),gP=hP.erase,W4=hP.cursor,H4=e=>[...G4(e)].length;vP.exports=function(e,t){if(!t)return gP.line+W4.to(0);let n=0,i=e.split(/\r?\n/);var r=V4(i),o;try{for(r.s();!(o=r.n()).done;){let a=o.value;n+=1+Math.floor(Math.max(H4(a)-1,0)/t)}}catch(a){r.e(a)}finally{r.f()}return gP.lines(n)}});var sy=I((kX,yP)=>{"use strict";var Za={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},q4={arrowUp:Za.arrowUp,arrowDown:Za.arrowDown,arrowLeft:Za.arrowLeft,arrowRight:Za.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},K4=process.platform==="win32"?q4:Za;yP.exports=K4});var _P=I((OX,SP)=>{"use strict";var Xi=oe(),An=sy(),cy=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}`}}),Y4=e=>cy[e]||cy.default,Ga=Object.freeze({aborted:Xi.red(An.cross),done:Xi.green(An.tick),exited:Xi.yellow(An.cross),default:Xi.cyan("?")}),X4=(e,t,n)=>t?Ga.aborted:n?Ga.exited:e?Ga.done:Ga.default,J4=e=>Xi.gray(e?An.ellipsis:An.pointerSmall),Q4=(e,t)=>Xi.gray(e?t?An.pointerSmall:"+":An.line);SP.exports={styles:cy,render:Y4,symbols:Ga,symbol:X4,delimiter:J4,item:Q4}});var xP=I((DX,EP)=>{"use strict";var e2=Ml();EP.exports=function(e,t){let n=String(e2(e)||"").split(/\r?\n/);return t?n.map(i=>Math.ceil(i.length/t)).reduce((i,r)=>i+r):n.length}});var IP=I((MX,AP)=>{"use strict";AP.exports=(e,t={})=>{let n=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",i=t.width;return(e||"").split(/\r?\n/g).map(r=>r.split(/\s+/g).reduce((o,a)=>(a.length+n.length>=i||o[o.length-1].length+a.length+1<i?o[o.length-1]+=` ${a}`:o.push(`${n}${a}`),o),[n]).join(`
6
6
  `)).join(`
7
- `)}});var TP=I((MX,$P)=>{"use strict";$P.exports=(e,t,n)=>{n=n||t;let i=Math.min(t-n,e-Math.floor(n/2));i<0&&(i=0);let r=Math.min(i+n,t);return{startIndex:i,endIndex:r}}});var At=I((jX,RP)=>{"use strict";RP.exports={action:dP(),clear:bP(),style:_P(),strip:Ml(),figures:sy(),lines:xP(),wrap:IP(),entriesToDisplay:TP()}});var sr=I((zX,NP)=>{"use strict";var PP=ts("readline"),e2=At(),t2=e2.action,r2=ts("events"),CP=ae(),n2=CP.beep,i2=CP.cursor,o2=oe(),uy=class extends r2{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 n=PP.createInterface({input:this.in,escapeCodeTimeout:50});PP.emitKeypressEvents(this.in,n),this.in.isTTY&&this.in.setRawMode(!0);let i=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,r=(o,a)=>{let c=t2(a,i);c===!1?this._&&this._(o,a):typeof this[c]=="function"?this[c](a):this.bell()};this.close=()=>{this.out.write(i2.show),this.in.removeListener("keypress",r),this.in.isTTY&&this.in.setRawMode(!1),n.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",r)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(n2)}render(){this.onRender(o2),this.firstRender&&(this.firstRender=!1)}};NP.exports=uy});var MP=I((LX,DP)=>{"use strict";function wP(e,t,n,i,r,o,a){try{var c=e[o](a),u=c.value}catch(l){n(l);return}c.done?t(u):Promise.resolve(u).then(i,r)}function kP(e){return function(){var t=this,n=arguments;return new Promise(function(i,r){var o=e.apply(t,n);function a(u){wP(o,i,r,a,c,"next",u)}function c(u){wP(o,i,r,a,c,"throw",u)}a(void 0)})}}var jl=oe(),a2=sr(),OP=ae(),s2=OP.erase,Wa=OP.cursor,zl=At(),ly=zl.style,dy=zl.clear,c2=zl.lines,u2=zl.figures,my=class extends a2{constructor(t={}){super(t),this.transform=ly.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=dy("",this.out.columns),this.render()}set value(t){!t&&this.initial?(this.placeholder=!0,this.rendered=jl.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(`
7
+ `)}});var TP=I((jX,$P)=>{"use strict";$P.exports=(e,t,n)=>{n=n||t;let i=Math.min(t-n,e-Math.floor(n/2));i<0&&(i=0);let r=Math.min(i+n,t);return{startIndex:i,endIndex:r}}});var At=I((zX,RP)=>{"use strict";RP.exports={action:dP(),clear:bP(),style:_P(),strip:Ml(),figures:sy(),lines:xP(),wrap:IP(),entriesToDisplay:TP()}});var sr=I((LX,NP)=>{"use strict";var PP=ts("readline"),t2=At(),r2=t2.action,n2=ts("events"),CP=ae(),i2=CP.beep,o2=CP.cursor,a2=oe(),uy=class extends n2{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 n=PP.createInterface({input:this.in,escapeCodeTimeout:50});PP.emitKeypressEvents(this.in,n),this.in.isTTY&&this.in.setRawMode(!0);let i=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,r=(o,a)=>{let c=r2(a,i);c===!1?this._&&this._(o,a):typeof this[c]=="function"?this[c](a):this.bell()};this.close=()=>{this.out.write(o2.show),this.in.removeListener("keypress",r),this.in.isTTY&&this.in.setRawMode(!1),n.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",r)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(i2)}render(){this.onRender(a2),this.firstRender&&(this.firstRender=!1)}};NP.exports=uy});var MP=I((UX,DP)=>{"use strict";function wP(e,t,n,i,r,o,a){try{var c=e[o](a),u=c.value}catch(l){n(l);return}c.done?t(u):Promise.resolve(u).then(i,r)}function kP(e){return function(){var t=this,n=arguments;return new Promise(function(i,r){var o=e.apply(t,n);function a(u){wP(o,i,r,a,c,"next",u)}function c(u){wP(o,i,r,a,c,"throw",u)}a(void 0)})}}var jl=oe(),s2=sr(),OP=ae(),c2=OP.erase,Wa=OP.cursor,zl=At(),ly=zl.style,dy=zl.clear,u2=zl.lines,l2=zl.figures,my=class extends s2{constructor(t={}){super(t),this.transform=ly.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=dy("",this.out.columns),this.render()}set value(t){!t&&this.initial?(this.placeholder=!0,this.rendered=jl.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(`
8
8
  `),this.close()}validate(){var t=this;return kP(function*(){let n=yield t.validator(t.value);typeof n=="string"&&(t.errorMsg=n,n=!1),t.error=!n})()}submit(){var t=this;return kP(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(`
9
- `),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,n){let i=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor);this.value=`${i}${t}${r}`,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),n=this.value.slice(this.cursor);this.value=`${t}${n}`,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),n=this.value.slice(this.cursor+1);this.value=`${t}${n}`,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(Wa.down(c2(this.outputError,this.out.columns)-1)+dy(this.outputError,this.out.columns)),this.out.write(dy(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[ly.symbol(this.done,this.aborted),jl.bold(this.msg),ly.delimiter(this.done),this.red?jl.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
9
+ `),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,n){let i=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor);this.value=`${i}${t}${r}`,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),n=this.value.slice(this.cursor);this.value=`${t}${n}`,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),n=this.value.slice(this.cursor+1);this.value=`${t}${n}`,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(Wa.down(u2(this.outputError,this.out.columns)-1)+dy(this.outputError,this.out.columns)),this.out.write(dy(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[ly.symbol(this.done,this.aborted),jl.bold(this.msg),ly.delimiter(this.done),this.red?jl.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
10
10
  `).reduce((t,n,i)=>t+`
11
- ${i?" ":u2.pointerSmall} ${jl.red().italic(n)}`,"")),this.out.write(s2.line+Wa.to(0)+this.outputText+Wa.save+this.outputError+Wa.restore+Wa.move(this.cursorOffset,0)))}};DP.exports=my});var UP=I((UX,LP)=>{"use strict";var cr=oe(),l2=sr(),Ha=At(),jP=Ha.style,zP=Ha.clear,Ll=Ha.figures,d2=Ha.wrap,m2=Ha.entriesToDisplay,p2=ae(),f2=p2.cursor,py=class extends l2{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((n,i)=>(typeof n=="string"&&(n={title:n,value:i}),{title:n&&(n.title||n.value||n),value:n&&(n.value===void 0?i:n.value),description:n&&n.description,selected:n&&n.selected,disabled:n&&n.disabled})),this.optionsPerPage=t.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=zP("",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(`
11
+ ${i?" ":l2.pointerSmall} ${jl.red().italic(n)}`,"")),this.out.write(c2.line+Wa.to(0)+this.outputText+Wa.save+this.outputError+Wa.restore+Wa.move(this.cursorOffset,0)))}};DP.exports=my});var UP=I((FX,LP)=>{"use strict";var cr=oe(),d2=sr(),Ha=At(),jP=Ha.style,zP=Ha.clear,Ll=Ha.figures,m2=Ha.wrap,p2=Ha.entriesToDisplay,f2=ae(),g2=f2.cursor,py=class extends d2{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((n,i)=>(typeof n=="string"&&(n={title:n,value:i}),{title:n&&(n.title||n.value||n),value:n&&(n.value===void 0?i:n.value),description:n&&n.description,selected:n&&n.selected,disabled:n&&n.disabled})),this.optionsPerPage=t.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=zP("",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(`
12
12
  `),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
13
- `),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,n){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(f2.hide):this.out.write(zP(this.outputText,this.out.columns)),super.render();let t=m2(this.cursor,this.choices.length,this.optionsPerPage),n=t.startIndex,i=t.endIndex;if(this.outputText=[jP.symbol(this.done,this.aborted),cr.bold(this.msg),jP.delimiter(!1),this.done?this.selection.title:this.selection.disabled?cr.yellow(this.warn):cr.gray(this.hint)].join(" "),!this.done){this.outputText+=`
13
+ `),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,n){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(g2.hide):this.out.write(zP(this.outputText,this.out.columns)),super.render();let t=p2(this.cursor,this.choices.length,this.optionsPerPage),n=t.startIndex,i=t.endIndex;if(this.outputText=[jP.symbol(this.done,this.aborted),cr.bold(this.msg),jP.delimiter(!1),this.done?this.selection.title:this.selection.disabled?cr.yellow(this.warn):cr.gray(this.hint)].join(" "),!this.done){this.outputText+=`
14
14
  `;for(let r=n;r<i;r++){let o,a,c="",u=this.choices[r];r===n&&n>0?a=Ll.arrowUp:r===i-1&&i<this.choices.length?a=Ll.arrowDown:a=" ",u.disabled?(o=this.cursor===r?cr.gray().underline(u.title):cr.strikethrough().gray(u.title),a=(this.cursor===r?cr.bold().gray(Ll.pointer)+" ":" ")+a):(o=this.cursor===r?cr.cyan().underline(u.title):u.title,a=(this.cursor===r?cr.cyan(Ll.pointer)+" ":" ")+a,u.description&&this.cursor===r&&(c=` - ${u.description}`,(a.length+o.length+c.length>=this.out.columns||u.description.split(/\r?\n/).length>1)&&(c=`
15
- `+d2(u.description,{margin:3,width:this.out.columns})))),this.outputText+=`${a} ${o}${cr.gray(c)}
16
- `}}this.out.write(this.outputText)}};LP.exports=py});var WP=I((FX,GP)=>{"use strict";var Ul=oe(),g2=sr(),VP=At(),FP=VP.style,h2=VP.clear,ZP=ae(),BP=ZP.cursor,v2=ZP.erase,fy=class extends g2{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(`
15
+ `+m2(u.description,{margin:3,width:this.out.columns})))),this.outputText+=`${a} ${o}${cr.gray(c)}
16
+ `}}this.out.write(this.outputText)}};LP.exports=py});var WP=I((BX,GP)=>{"use strict";var Ul=oe(),h2=sr(),VP=At(),FP=VP.style,v2=VP.clear,ZP=ae(),BP=ZP.cursor,b2=ZP.erase,fy=class extends h2{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(`
17
17
  `),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
18
- `),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,n){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(BP.hide):this.out.write(h2(this.outputText,this.out.columns)),super.render(),this.outputText=[FP.symbol(this.done,this.aborted),Ul.bold(this.msg),FP.delimiter(this.done),this.value?this.inactive:Ul.cyan().underline(this.inactive),Ul.gray("/"),this.value?Ul.cyan().underline(this.active):this.active].join(" "),this.out.write(v2.line+BP.to(0)+this.outputText))}};GP.exports=fy});var Bt=I((BX,HP)=>{"use strict";var gy=class e{constructor({token:t,date:n,parts:i,locales:r}){this.token=t,this.date=n||new Date,this.parts=i||[this],this.locales=r||{}}up(){}down(){}next(){let t=this.parts.indexOf(this);return this.parts.find((n,i)=>i>t&&n instanceof e)}setTo(t){}prev(){let t=[].concat(this.parts).reverse(),n=t.indexOf(this);return t.find((i,r)=>r>n&&i instanceof e)}toString(){return String(this.date)}};HP.exports=gy});var KP=I((VX,qP)=>{"use strict";var b2=Bt(),hy=class extends b2{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}};qP.exports=hy});var XP=I((ZX,YP)=>{"use strict";var y2=Bt(),S2=e=>(e=e%10,e===1?"st":e===2?"nd":e===3?"rd":"th"),vy=class extends y2{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(),n=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+S2(t):this.token==="d"?n+1:this.token==="ddd"?this.locales.weekdaysShort[n]:this.token==="dddd"?this.locales.weekdays[n]:t}};YP.exports=vy});var QP=I((GX,JP)=>{"use strict";var _2=Bt(),by=class extends _2{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}};JP.exports=by});var tC=I((WX,eC)=>{"use strict";var E2=Bt(),yy=class extends E2{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)}};eC.exports=yy});var nC=I((HX,rC)=>{"use strict";var x2=Bt(),Sy=class extends x2{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}};rC.exports=Sy});var oC=I((qX,iC)=>{"use strict";var A2=Bt(),_y=class extends A2{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(),n=this.token.length;return n===2?String(t+1).padStart(2,"0"):n===3?this.locales.monthsShort[t]:n===4?this.locales.months[t]:String(t+1)}};iC.exports=_y});var sC=I((KX,aC)=>{"use strict";var I2=Bt(),Ey=class extends I2{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}};aC.exports=Ey});var uC=I((YX,cC)=>{"use strict";var $2=Bt(),xy=class extends $2{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}};cC.exports=xy});var dC=I((XX,lC)=>{"use strict";lC.exports={DatePart:Bt(),Meridiem:KP(),Day:XP(),Hours:QP(),Milliseconds:tC(),Minutes:nC(),Month:oC(),Seconds:sC(),Year:uC()}});var _C=I((JX,SC)=>{"use strict";function mC(e,t,n,i,r,o,a){try{var c=e[o](a),u=c.value}catch(l){n(l);return}c.done?t(u):Promise.resolve(u).then(i,r)}function pC(e){return function(){var t=this,n=arguments;return new Promise(function(i,r){var o=e.apply(t,n);function a(u){mC(o,i,r,a,c,"next",u)}function c(u){mC(o,i,r,a,c,"throw",u)}a(void 0)})}}var Ay=oe(),T2=sr(),$y=At(),fC=$y.style,gC=$y.clear,R2=$y.figures,yC=ae(),P2=yC.erase,hC=yC.cursor,ur=dC(),vC=ur.DatePart,C2=ur.Meridiem,N2=ur.Day,w2=ur.Hours,k2=ur.Milliseconds,O2=ur.Minutes,D2=ur.Month,M2=ur.Seconds,j2=ur.Year,z2=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,bC={1:({token:e})=>e.replace(/\\(.)/g,"$1"),2:e=>new N2(e),3:e=>new D2(e),4:e=>new j2(e),5:e=>new C2(e),6:e=>new w2(e),7:e=>new O2(e),8:e=>new M2(e),9:e=>new k2(e)},L2={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(",")},Iy=class extends T2{constructor(t={}){super(t),this.msg=t.message,this.cursor=0,this.typed="",this.locales=Object.assign(L2,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=gC("",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 n;for(this.parts=[];n=z2.exec(t);){let r=n.shift(),o=n.findIndex(a=>a!=null);this.parts.push(o in bC?bC[o]({token:n[o]||r,date:this.date,parts:this.parts,locales:this.locales}):n[o]||r)}let i=this.parts.reduce((r,o)=>(typeof o=="string"&&typeof r[r.length-1]=="string"?r[r.length-1]+=o:r.push(o),r),[]);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 vC)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
18
+ `),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,n){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(BP.hide):this.out.write(v2(this.outputText,this.out.columns)),super.render(),this.outputText=[FP.symbol(this.done,this.aborted),Ul.bold(this.msg),FP.delimiter(this.done),this.value?this.inactive:Ul.cyan().underline(this.inactive),Ul.gray("/"),this.value?Ul.cyan().underline(this.active):this.active].join(" "),this.out.write(b2.line+BP.to(0)+this.outputText))}};GP.exports=fy});var Bt=I((VX,HP)=>{"use strict";var gy=class e{constructor({token:t,date:n,parts:i,locales:r}){this.token=t,this.date=n||new Date,this.parts=i||[this],this.locales=r||{}}up(){}down(){}next(){let t=this.parts.indexOf(this);return this.parts.find((n,i)=>i>t&&n instanceof e)}setTo(t){}prev(){let t=[].concat(this.parts).reverse(),n=t.indexOf(this);return t.find((i,r)=>r>n&&i instanceof e)}toString(){return String(this.date)}};HP.exports=gy});var KP=I((ZX,qP)=>{"use strict";var y2=Bt(),hy=class extends y2{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}};qP.exports=hy});var XP=I((GX,YP)=>{"use strict";var S2=Bt(),_2=e=>(e=e%10,e===1?"st":e===2?"nd":e===3?"rd":"th"),vy=class extends S2{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(),n=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+_2(t):this.token==="d"?n+1:this.token==="ddd"?this.locales.weekdaysShort[n]:this.token==="dddd"?this.locales.weekdays[n]:t}};YP.exports=vy});var QP=I((WX,JP)=>{"use strict";var E2=Bt(),by=class extends E2{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}};JP.exports=by});var tC=I((HX,eC)=>{"use strict";var x2=Bt(),yy=class extends x2{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)}};eC.exports=yy});var nC=I((qX,rC)=>{"use strict";var A2=Bt(),Sy=class extends A2{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}};rC.exports=Sy});var oC=I((KX,iC)=>{"use strict";var I2=Bt(),_y=class extends I2{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(),n=this.token.length;return n===2?String(t+1).padStart(2,"0"):n===3?this.locales.monthsShort[t]:n===4?this.locales.months[t]:String(t+1)}};iC.exports=_y});var sC=I((YX,aC)=>{"use strict";var $2=Bt(),Ey=class extends $2{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}};aC.exports=Ey});var uC=I((XX,cC)=>{"use strict";var T2=Bt(),xy=class extends T2{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}};cC.exports=xy});var dC=I((JX,lC)=>{"use strict";lC.exports={DatePart:Bt(),Meridiem:KP(),Day:XP(),Hours:QP(),Milliseconds:tC(),Minutes:nC(),Month:oC(),Seconds:sC(),Year:uC()}});var _C=I((QX,SC)=>{"use strict";function mC(e,t,n,i,r,o,a){try{var c=e[o](a),u=c.value}catch(l){n(l);return}c.done?t(u):Promise.resolve(u).then(i,r)}function pC(e){return function(){var t=this,n=arguments;return new Promise(function(i,r){var o=e.apply(t,n);function a(u){mC(o,i,r,a,c,"next",u)}function c(u){mC(o,i,r,a,c,"throw",u)}a(void 0)})}}var Ay=oe(),R2=sr(),$y=At(),fC=$y.style,gC=$y.clear,P2=$y.figures,yC=ae(),C2=yC.erase,hC=yC.cursor,ur=dC(),vC=ur.DatePart,N2=ur.Meridiem,w2=ur.Day,k2=ur.Hours,O2=ur.Milliseconds,D2=ur.Minutes,M2=ur.Month,j2=ur.Seconds,z2=ur.Year,L2=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,bC={1:({token:e})=>e.replace(/\\(.)/g,"$1"),2:e=>new w2(e),3:e=>new M2(e),4:e=>new z2(e),5:e=>new N2(e),6:e=>new k2(e),7:e=>new D2(e),8:e=>new j2(e),9:e=>new O2(e)},U2={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(",")},Iy=class extends R2{constructor(t={}){super(t),this.msg=t.message,this.cursor=0,this.typed="",this.locales=Object.assign(U2,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=gC("",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 n;for(this.parts=[];n=L2.exec(t);){let r=n.shift(),o=n.findIndex(a=>a!=null);this.parts.push(o in bC?bC[o]({token:n[o]||r,date:this.date,parts:this.parts,locales:this.locales}):n[o]||r)}let i=this.parts.reduce((r,o)=>(typeof o=="string"&&typeof r[r.length-1]=="string"?r[r.length-1]+=o:r.push(o),r),[]);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 vC)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
19
19
  `),this.close()}validate(){var t=this;return pC(function*(){let n=yield t.validator(t.value);typeof n=="string"&&(t.errorMsg=n,n=!1),t.error=!n})()}submit(){var t=this;return pC(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(`
20
20
  `),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(n=>n instanceof vC)),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(hC.hide):this.out.write(gC(this.outputText,this.out.columns)),super.render(),this.outputText=[fC.symbol(this.done,this.aborted),Ay.bold(this.msg),fC.delimiter(!1),this.parts.reduce((t,n,i)=>t.concat(i===this.cursor&&!this.done?Ay.cyan().underline(n.toString()):n),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
21
21
  `).reduce((t,n,i)=>t+`
22
- ${i?" ":R2.pointerSmall} ${Ay.red().italic(n)}`,"")),this.out.write(P2.line+hC.to(0)+this.outputText))}};SC.exports=Iy});var RC=I((QX,TC)=>{"use strict";function EC(e,t,n,i,r,o,a){try{var c=e[o](a),u=c.value}catch(l){n(l);return}c.done?t(u):Promise.resolve(u).then(i,r)}function xC(e){return function(){var t=this,n=arguments;return new Promise(function(i,r){var o=e.apply(t,n);function a(u){EC(o,i,r,a,c,"next",u)}function c(u){EC(o,i,r,a,c,"throw",u)}a(void 0)})}}var Fl=oe(),U2=sr(),$C=ae(),Bl=$C.cursor,F2=$C.erase,Vl=At(),Ty=Vl.style,B2=Vl.figures,AC=Vl.clear,V2=Vl.lines,Z2=/[0-9]/,Ry=e=>e!==void 0,IC=(e,t)=>{let n=Math.pow(10,t);return Math.round(e*n)/n},Py=class extends U2{constructor(t={}){super(t),this.transform=Ty.render(t.style),this.msg=t.message,this.initial=Ry(t.initial)?t.initial:"",this.float=!!t.float,this.round=t.round||2,this.inc=t.increment||1,this.min=Ry(t.min)?t.min:-1/0,this.max=Ry(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=Fl.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${IC(t,this.round)}`),this._value=IC(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||Z2.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(`
22
+ ${i?" ":P2.pointerSmall} ${Ay.red().italic(n)}`,"")),this.out.write(C2.line+hC.to(0)+this.outputText))}};SC.exports=Iy});var RC=I((eJ,TC)=>{"use strict";function EC(e,t,n,i,r,o,a){try{var c=e[o](a),u=c.value}catch(l){n(l);return}c.done?t(u):Promise.resolve(u).then(i,r)}function xC(e){return function(){var t=this,n=arguments;return new Promise(function(i,r){var o=e.apply(t,n);function a(u){EC(o,i,r,a,c,"next",u)}function c(u){EC(o,i,r,a,c,"throw",u)}a(void 0)})}}var Fl=oe(),F2=sr(),$C=ae(),Bl=$C.cursor,B2=$C.erase,Vl=At(),Ty=Vl.style,V2=Vl.figures,AC=Vl.clear,Z2=Vl.lines,G2=/[0-9]/,Ry=e=>e!==void 0,IC=(e,t)=>{let n=Math.pow(10,t);return Math.round(e*n)/n},Py=class extends F2{constructor(t={}){super(t),this.transform=Ty.render(t.style),this.msg=t.message,this.initial=Ry(t.initial)?t.initial:"",this.float=!!t.float,this.round=t.round||2,this.inc=t.increment||1,this.min=Ry(t.min)?t.min:-1/0,this.max=Ry(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=Fl.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${IC(t,this.round)}`),this._value=IC(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||G2.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(`
23
23
  `),this.close()}validate(){var t=this;return xC(function*(){let n=yield t.validator(t.value);typeof n=="string"&&(t.errorMsg=n,n=!1),t.error=!n})()}submit(){var t=this;return xC(function*(){if(yield t.validate(),t.error){t.color="red",t.fire(),t.render();return}let n=t.value;t.value=n!==""?n:t.initial,t.done=!0,t.aborted=!1,t.error=!1,t.fire(),t.render(),t.out.write(`
24
- `),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,n){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(Bl.down(V2(this.outputError,this.out.columns)-1)+AC(this.outputError,this.out.columns)),this.out.write(AC(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Ty.symbol(this.done,this.aborted),Fl.bold(this.msg),Ty.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Fl[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
24
+ `),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,n){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(Bl.down(Z2(this.outputError,this.out.columns)-1)+AC(this.outputError,this.out.columns)),this.out.write(AC(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Ty.symbol(this.done,this.aborted),Fl.bold(this.msg),Ty.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Fl[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
25
25
  `).reduce((t,n,i)=>t+`
26
- ${i?" ":B2.pointerSmall} ${Fl.red().italic(n)}`,"")),this.out.write(F2.line+Bl.to(0)+this.outputText+Bl.save+this.outputError+Bl.restore))}};TC.exports=Py});var Ny=I((eJ,NC)=>{"use strict";var Vt=oe(),G2=ae(),W2=G2.cursor,H2=sr(),qa=At(),PC=qa.clear,zr=qa.figures,CC=qa.style,q2=qa.wrap,K2=qa.entriesToDisplay,Cy=class extends H2{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((n,i)=>(typeof n=="string"&&(n={title:n,value:i}),{title:n&&(n.title||n.value||n),description:n&&n.description,value:n&&(n.value===void 0?i:n.value),selected:n&&n.selected,disabled:n&&n.disabled})),this.clear=PC("",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(`
26
+ ${i?" ":V2.pointerSmall} ${Fl.red().italic(n)}`,"")),this.out.write(B2.line+Bl.to(0)+this.outputText+Bl.save+this.outputError+Bl.restore))}};TC.exports=Py});var Ny=I((tJ,NC)=>{"use strict";var Vt=oe(),W2=ae(),H2=W2.cursor,q2=sr(),qa=At(),PC=qa.clear,zr=qa.figures,CC=qa.style,K2=qa.wrap,Y2=qa.entriesToDisplay,Cy=class extends q2{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((n,i)=>(typeof n=="string"&&(n={title:n,value:i}),{title:n&&(n.title||n.value||n),description:n&&n.description,value:n&&(n.value===void 0?i:n.value),selected:n&&n.selected,disabled:n&&n.disabled})),this.clear=PC("",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(`
27
27
  `),this.close()}submit(){let t=this.value.filter(n=>n.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(`
28
28
  `),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(n=>n.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(n=>!n.disabled).forEach(n=>n.selected=t),this.render()}_(t,n){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:`
29
29
  Instructions:
@@ -31,15 +31,15 @@ Instructions:
31
31
  ${zr.arrowLeft}/${zr.arrowRight}/[space]: Toggle selection
32
32
  `+(this.maxChoices===void 0?` a: Toggle all
33
33
  `:"")+" enter/return: Complete answer":""}renderOption(t,n,i,r){let o=(n.selected?Vt.green(zr.radioOn):zr.radioOff)+" "+r+" ",a,c;return n.disabled?a=t===i?Vt.gray().underline(n.title):Vt.strikethrough().gray(n.title):(a=t===i?Vt.cyan().underline(n.title):n.title,t===i&&n.description&&(c=` - ${n.description}`,(o.length+a.length+c.length>=this.out.columns||n.description.split(/\r?\n/).length>1)&&(c=`
34
- `+q2(n.description,{margin:o.length,width:this.out.columns})))),o+a+Vt.gray(c||"")}paginateOptions(t){if(t.length===0)return Vt.red("No matches for this query.");let n=K2(this.cursor,t.length,this.optionsPerPage),i=n.startIndex,r=n.endIndex,o,a=[];for(let c=i;c<r;c++)c===i&&i>0?o=zr.arrowUp:c===r-1&&r<t.length?o=zr.arrowDown:o=" ",a.push(this.renderOption(this.cursor,t[c],c,o));return`
34
+ `+K2(n.description,{margin:o.length,width:this.out.columns})))),o+a+Vt.gray(c||"")}paginateOptions(t){if(t.length===0)return Vt.red("No matches for this query.");let n=Y2(this.cursor,t.length,this.optionsPerPage),i=n.startIndex,r=n.endIndex,o,a=[];for(let c=i;c<r;c++)c===i&&i>0?o=zr.arrowUp:c===r-1&&r<t.length?o=zr.arrowDown:o=" ",a.push(this.renderOption(this.cursor,t[c],c,o));return`
35
35
  `+a.join(`
36
- `)}renderOptions(t){return this.done?"":this.paginateOptions(t)}renderDoneOrInstructions(){if(this.done)return this.value.filter(n=>n.selected).map(n=>n.title).join(", ");let t=[Vt.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(Vt.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(W2.hide),super.render();let t=[CC.symbol(this.done,this.aborted),Vt.bold(this.msg),CC.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=Vt.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=PC(t,this.out.columns)}};NC.exports=Cy});var zC=I((tJ,jC)=>{"use strict";function wC(e,t,n,i,r,o,a){try{var c=e[o](a),u=c.value}catch(l){n(l);return}c.done?t(u):Promise.resolve(u).then(i,r)}function Y2(e){return function(){var t=this,n=arguments;return new Promise(function(i,r){var o=e.apply(t,n);function a(u){wC(o,i,r,a,c,"next",u)}function c(u){wC(o,i,r,a,c,"throw",u)}a(void 0)})}}var Ka=oe(),X2=sr(),MC=ae(),J2=MC.erase,kC=MC.cursor,Ya=At(),wy=Ya.style,OC=Ya.clear,ky=Ya.figures,Q2=Ya.wrap,e6=Ya.entriesToDisplay,DC=(e,t)=>e[t]&&(e[t].value||e[t].title||e[t]),t6=(e,t)=>e[t]&&(e[t].title||e[t].value||e[t]),r6=(e,t)=>{let n=e.findIndex(i=>i.value===t||i.title===t);return n>-1?n:void 0},Oy=class extends X2{constructor(t={}){super(t),this.msg=t.message,this.suggest=t.suggest,this.choices=t.choices,this.initial=typeof t.initial=="number"?t.initial:r6(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=wy.render(t.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=OC("",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=DC(this.suggestions,t):this.value=this.fallback.value,this.fire()}complete(t){var n=this;return Y2(function*(){let i=n.completing=n.suggest(n.input,n.choices),r=yield i;if(n.completing!==i)return;n.suggestions=r.map((a,c,u)=>({title:t6(u,c),value:DC(u,c),description:a.description})),n.completing=!1;let o=Math.max(r.length-1,0);n.moveSelect(Math.min(o,n.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(`
36
+ `)}renderOptions(t){return this.done?"":this.paginateOptions(t)}renderDoneOrInstructions(){if(this.done)return this.value.filter(n=>n.selected).map(n=>n.title).join(", ");let t=[Vt.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(Vt.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(H2.hide),super.render();let t=[CC.symbol(this.done,this.aborted),Vt.bold(this.msg),CC.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=Vt.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=PC(t,this.out.columns)}};NC.exports=Cy});var zC=I((rJ,jC)=>{"use strict";function wC(e,t,n,i,r,o,a){try{var c=e[o](a),u=c.value}catch(l){n(l);return}c.done?t(u):Promise.resolve(u).then(i,r)}function X2(e){return function(){var t=this,n=arguments;return new Promise(function(i,r){var o=e.apply(t,n);function a(u){wC(o,i,r,a,c,"next",u)}function c(u){wC(o,i,r,a,c,"throw",u)}a(void 0)})}}var Ka=oe(),J2=sr(),MC=ae(),Q2=MC.erase,kC=MC.cursor,Ya=At(),wy=Ya.style,OC=Ya.clear,ky=Ya.figures,e6=Ya.wrap,t6=Ya.entriesToDisplay,DC=(e,t)=>e[t]&&(e[t].value||e[t].title||e[t]),r6=(e,t)=>e[t]&&(e[t].title||e[t].value||e[t]),n6=(e,t)=>{let n=e.findIndex(i=>i.value===t||i.title===t);return n>-1?n:void 0},Oy=class extends J2{constructor(t={}){super(t),this.msg=t.message,this.suggest=t.suggest,this.choices=t.choices,this.initial=typeof t.initial=="number"?t.initial:n6(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=wy.render(t.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=OC("",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=DC(this.suggestions,t):this.value=this.fallback.value,this.fire()}complete(t){var n=this;return X2(function*(){let i=n.completing=n.suggest(n.input,n.choices),r=yield i;if(n.completing!==i)return;n.suggestions=r.map((a,c,u)=>({title:r6(u,c),value:DC(u,c),description:a.description})),n.completing=!1;let o=Math.max(r.length-1,0);n.moveSelect(Math.min(o,n.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(`
37
37
  `),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
38
38
  `),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
39
39
  `),this.close()}_(t,n){let i=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor);this.input=`${i}${t}${r}`,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),n=this.input.slice(this.cursor);this.input=`${t}${n}`,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),n=this.input.slice(this.cursor+1);this.input=`${t}${n}`,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,n,i,r){let o,a=i?ky.arrowUp:r?ky.arrowDown:" ",c=n?Ka.cyan().underline(t.title):t.title;return a=(n?Ka.cyan(ky.pointer)+" ":" ")+a,t.description&&(o=` - ${t.description}`,(a.length+c.length+o.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(o=`
40
- `+Q2(t.description,{margin:3,width:this.out.columns}))),a+" "+c+Ka.gray(o||"")}render(){if(this.closed)return;this.firstRender?this.out.write(kC.hide):this.out.write(OC(this.outputText,this.out.columns)),super.render();let t=e6(this.select,this.choices.length,this.limit),n=t.startIndex,i=t.endIndex;if(this.outputText=[wy.symbol(this.done,this.aborted,this.exited),Ka.bold(this.msg),wy.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 r=this.suggestions.slice(n,i).map((o,a)=>this.renderOption(o,this.select===a+n,a===0&&n>0,a+n===i-1&&i<this.choices.length)).join(`
40
+ `+e6(t.description,{margin:3,width:this.out.columns}))),a+" "+c+Ka.gray(o||"")}render(){if(this.closed)return;this.firstRender?this.out.write(kC.hide):this.out.write(OC(this.outputText,this.out.columns)),super.render();let t=t6(this.select,this.choices.length,this.limit),n=t.startIndex,i=t.endIndex;if(this.outputText=[wy.symbol(this.done,this.aborted,this.exited),Ka.bold(this.msg),wy.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 r=this.suggestions.slice(n,i).map((o,a)=>this.renderOption(o,this.select===a+n,a===0&&n>0,a+n===i-1&&i<this.choices.length)).join(`
41
41
  `);this.outputText+=`
42
- `+(r||Ka.gray(this.fallback.title))}this.out.write(J2.line+kC.to(0)+this.outputText)}};jC.exports=Oy});var BC=I((rJ,FC)=>{"use strict";var lr=oe(),n6=ae(),i6=n6.cursor,o6=Ny(),My=At(),LC=My.clear,UC=My.style,Ji=My.figures,Dy=class extends o6{constructor(t={}){t.overrideRender=!0,super(t),this.inputValue="",this.clear=LC("",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 n=this.filteredOptions.findIndex(i=>i===t);this.cursor=n<0?0:n,this.render()}handleSpaceToggle(){let t=this.filteredOptions[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(n=>n.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}handleInputChange(t){this.inputValue=this.inputValue+t,this.updateFilteredOptions()}_(t,n){t===" "?this.handleSpaceToggle():this.handleInputChange(t)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
42
+ `+(r||Ka.gray(this.fallback.title))}this.out.write(Q2.line+kC.to(0)+this.outputText)}};jC.exports=Oy});var BC=I((nJ,FC)=>{"use strict";var lr=oe(),i6=ae(),o6=i6.cursor,a6=Ny(),My=At(),LC=My.clear,UC=My.style,Ji=My.figures,Dy=class extends a6{constructor(t={}){t.overrideRender=!0,super(t),this.inputValue="",this.clear=LC("",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 n=this.filteredOptions.findIndex(i=>i===t);this.cursor=n<0?0:n,this.render()}handleSpaceToggle(){let t=this.filteredOptions[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(n=>n.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}handleInputChange(t){this.inputValue=this.inputValue+t,this.updateFilteredOptions()}_(t,n){t===" "?this.handleSpaceToggle():this.handleInputChange(t)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
43
43
  Instructions:
44
44
  ${Ji.arrowUp}/${Ji.arrowDown}: Highlight option
45
45
  ${Ji.arrowLeft}/${Ji.arrowRight}/[space]: Toggle selection
@@ -47,31 +47,31 @@ Instructions:
47
47
  enter/return: Complete answer
48
48
  `:""}renderCurrentInput(){return`
49
49
  Filtered results for: ${this.inputValue?this.inputValue:lr.gray("Enter something to filter")}
50
- `}renderOption(t,n,i){let r;return n.disabled?r=t===i?lr.gray().underline(n.title):lr.strikethrough().gray(n.title):r=t===i?lr.cyan().underline(n.title):n.title,(n.selected?lr.green(Ji.radioOn):Ji.radioOff)+" "+r}renderDoneOrInstructions(){if(this.done)return this.value.filter(n=>n.selected).map(n=>n.title).join(", ");let t=[lr.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(lr.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(i6.hide),super.render();let t=[UC.symbol(this.done,this.aborted),lr.bold(this.msg),UC.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=lr.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=LC(t,this.out.columns)}};FC.exports=Dy});var KC=I((nJ,qC)=>{"use strict";var VC=oe(),a6=sr(),WC=At(),ZC=WC.style,s6=WC.clear,HC=ae(),c6=HC.erase,GC=HC.cursor,jy=class extends a6{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(`
50
+ `}renderOption(t,n,i){let r;return n.disabled?r=t===i?lr.gray().underline(n.title):lr.strikethrough().gray(n.title):r=t===i?lr.cyan().underline(n.title):n.title,(n.selected?lr.green(Ji.radioOn):Ji.radioOff)+" "+r}renderDoneOrInstructions(){if(this.done)return this.value.filter(n=>n.selected).map(n=>n.title).join(", ");let t=[lr.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(lr.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(o6.hide),super.render();let t=[UC.symbol(this.done,this.aborted),lr.bold(this.msg),UC.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=lr.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=LC(t,this.out.columns)}};FC.exports=Dy});var KC=I((iJ,qC)=>{"use strict";var VC=oe(),s6=sr(),WC=At(),ZC=WC.style,c6=WC.clear,HC=ae(),u6=HC.erase,GC=HC.cursor,jy=class extends s6{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(`
51
51
  `),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
52
- `),this.close()}_(t,n){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(GC.hide):this.out.write(s6(this.outputText,this.out.columns)),super.render(),this.outputText=[ZC.symbol(this.done,this.aborted),VC.bold(this.msg),ZC.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:VC.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(c6.line+GC.to(0)+this.outputText))}};qC.exports=jy});var XC=I((iJ,YC)=>{"use strict";YC.exports={TextPrompt:MP(),SelectPrompt:UP(),TogglePrompt:WP(),DatePrompt:_C(),NumberPrompt:RC(),MultiselectPrompt:Ny(),AutocompletePrompt:zC(),AutocompleteMultiselectPrompt:BC(),ConfirmPrompt:KC()}});var QC=I(JC=>{"use strict";var Ye=JC,u6=XC(),Zl=e=>e;function Zt(e,t,n={}){return new Promise((i,r)=>{let o=new u6[e](t),a=n.onAbort||Zl,c=n.onSubmit||Zl,u=n.onExit||Zl;o.on("state",t.onState||Zl),o.on("submit",l=>i(c(l))),o.on("exit",l=>i(u(l))),o.on("abort",l=>r(a(l)))})}Ye.text=e=>Zt("TextPrompt",e);Ye.password=e=>(e.style="password",Ye.text(e));Ye.invisible=e=>(e.style="invisible",Ye.text(e));Ye.number=e=>Zt("NumberPrompt",e);Ye.date=e=>Zt("DatePrompt",e);Ye.confirm=e=>Zt("ConfirmPrompt",e);Ye.list=e=>{let t=e.separator||",";return Zt("TextPrompt",e,{onSubmit:n=>n.split(t).map(i=>i.trim())})};Ye.toggle=e=>Zt("TogglePrompt",e);Ye.select=e=>Zt("SelectPrompt",e);Ye.multiselect=e=>{e.choices=[].concat(e.choices||[]);let t=n=>n.filter(i=>i.selected).map(i=>i.value);return Zt("MultiselectPrompt",e,{onAbort:t,onSubmit:t})};Ye.autocompleteMultiselect=e=>{e.choices=[].concat(e.choices||[]);let t=n=>n.filter(i=>i.selected).map(i=>i.value);return Zt("AutocompleteMultiselectPrompt",e,{onAbort:t,onSubmit:t})};var l6=(e,t)=>Promise.resolve(t.filter(n=>n.title.slice(0,e.length).toLowerCase()===e.toLowerCase()));Ye.autocomplete=e=>(e.suggest=e.suggest||l6,e.choices=[].concat(e.choices||[]),Zt("AutocompletePrompt",e))});var sN=I((aJ,aN)=>{"use strict";function eN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function tN(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?eN(Object(n),!0).forEach(function(i){d6(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):eN(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function d6(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m6(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=p6(e))||t&&e&&typeof e.length=="number"){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(l){throw l},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
53
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,c;return{s:function(){n=n.call(e)},n:function(){var l=n.next();return o=l.done,l},e:function(l){a=!0,c=l},f:function(){try{!o&&n.return!=null&&n.return()}finally{if(a)throw c}}}}function p6(e,t){if(e){if(typeof e=="string")return rN(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return rN(e,t)}}function rN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function nN(e,t,n,i,r,o,a){try{var c=e[o](a),u=c.value}catch(l){n(l);return}c.done?t(u):Promise.resolve(u).then(i,r)}function iN(e){return function(){var t=this,n=arguments;return new Promise(function(i,r){var o=e.apply(t,n);function a(u){nN(o,i,r,a,c,"next",u)}function c(u){nN(o,i,r,a,c,"throw",u)}a(void 0)})}}var zy=QC(),f6=["suggest","format","onState","validate","onRender","type"],oN=()=>{};function Lr(){return Ly.apply(this,arguments)}function Ly(){return Ly=iN(function*(e=[],{onSubmit:t=oN,onCancel:n=oN}={}){let i={},r=Lr._override||{};e=[].concat(e);let o,a,c,u,l,m,p=(function(){var z=iN(function*(Se,fr,we=!1){if(!(!we&&Se.validate&&Se.validate(fr)!==!0))return Se.format?yield Se.format(fr,i):fr});return function(fr,we){return z.apply(this,arguments)}})();var g=m6(e),v;try{for(g.s();!(v=g.n()).done;){a=v.value;var A=a;if(u=A.name,l=A.type,typeof l=="function"&&(l=yield l(o,tN({},i),a),a.type=l),!!l){for(let z in a){if(f6.includes(z))continue;let Se=a[z];a[z]=typeof Se=="function"?yield Se(o,tN({},i),m):Se}if(m=a,typeof a.message!="string")throw new Error("prompt message is required");var Y=a;if(u=Y.name,l=Y.type,zy[l]===void 0)throw new Error(`prompt type (${l}) is not defined`);if(r[a.name]!==void 0&&(o=yield p(a,r[a.name]),o!==void 0)){i[u]=o;continue}try{o=Lr._injected?g6(Lr._injected,a.initial):yield zy[l](a),i[u]=o=yield p(a,o,!0),c=yield t(a,o,i)}catch{c=!(yield n(a,i))}if(c)return i}}}catch(z){g.e(z)}finally{g.f()}return i}),Ly.apply(this,arguments)}function g6(e,t){let n=e.shift();if(n instanceof Error)throw n;return n===void 0?t:n}function h6(e){Lr._injected=(Lr._injected||[]).concat(e)}function v6(e){Lr._override=Object.assign({},e)}aN.exports=Object.assign(Lr,{prompt:Lr,prompts:zy,inject:h6,override:v6})});var uN=I((sJ,cN)=>{"use strict";cN.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 Gl=I((cJ,lN)=>{"use strict";lN.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("|"),n=new RegExp(t,"g");return typeof e=="string"?e.replace(n,""):e}});var pN=I((uJ,mN)=>{"use strict";var b6=Gl(),{erase:dN,cursor:y6}=ae(),S6=e=>[...b6(e)].length;mN.exports=function(e,t){if(!t)return dN.line+y6.to(0);let n=0,i=e.split(/\r?\n/);for(let r of i)n+=1+Math.floor(Math.max(S6(r)-1,0)/t);return dN.lines(n)}});var Uy=I((lJ,fN)=>{"use strict";var Xa={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},_6={arrowUp:Xa.arrowUp,arrowDown:Xa.arrowDown,arrowLeft:Xa.arrowLeft,arrowRight:Xa.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},E6=process.platform==="win32"?_6:Xa;fN.exports=E6});var hN=I((dJ,gN)=>{"use strict";var Qi=oe(),In=Uy(),Fy=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}`}}),x6=e=>Fy[e]||Fy.default,Ja=Object.freeze({aborted:Qi.red(In.cross),done:Qi.green(In.tick),exited:Qi.yellow(In.cross),default:Qi.cyan("?")}),A6=(e,t,n)=>t?Ja.aborted:n?Ja.exited:e?Ja.done:Ja.default,I6=e=>Qi.gray(e?In.ellipsis:In.pointerSmall),$6=(e,t)=>Qi.gray(e?t?In.pointerSmall:"+":In.line);gN.exports={styles:Fy,render:x6,symbols:Ja,symbol:A6,delimiter:I6,item:$6}});var bN=I((mJ,vN)=>{"use strict";var T6=Gl();vN.exports=function(e,t){let n=String(T6(e)||"").split(/\r?\n/);return t?n.map(i=>Math.ceil(i.length/t)).reduce((i,r)=>i+r):n.length}});var SN=I((pJ,yN)=>{"use strict";yN.exports=(e,t={})=>{let n=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",i=t.width;return(e||"").split(/\r?\n/g).map(r=>r.split(/\s+/g).reduce((o,a)=>(a.length+n.length>=i||o[o.length-1].length+a.length+1<i?o[o.length-1]+=` ${a}`:o.push(`${n}${a}`),o),[n]).join(`
52
+ `),this.close()}_(t,n){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(GC.hide):this.out.write(c6(this.outputText,this.out.columns)),super.render(),this.outputText=[ZC.symbol(this.done,this.aborted),VC.bold(this.msg),ZC.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:VC.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(u6.line+GC.to(0)+this.outputText))}};qC.exports=jy});var XC=I((oJ,YC)=>{"use strict";YC.exports={TextPrompt:MP(),SelectPrompt:UP(),TogglePrompt:WP(),DatePrompt:_C(),NumberPrompt:RC(),MultiselectPrompt:Ny(),AutocompletePrompt:zC(),AutocompleteMultiselectPrompt:BC(),ConfirmPrompt:KC()}});var QC=I(JC=>{"use strict";var Ye=JC,l6=XC(),Zl=e=>e;function Zt(e,t,n={}){return new Promise((i,r)=>{let o=new l6[e](t),a=n.onAbort||Zl,c=n.onSubmit||Zl,u=n.onExit||Zl;o.on("state",t.onState||Zl),o.on("submit",l=>i(c(l))),o.on("exit",l=>i(u(l))),o.on("abort",l=>r(a(l)))})}Ye.text=e=>Zt("TextPrompt",e);Ye.password=e=>(e.style="password",Ye.text(e));Ye.invisible=e=>(e.style="invisible",Ye.text(e));Ye.number=e=>Zt("NumberPrompt",e);Ye.date=e=>Zt("DatePrompt",e);Ye.confirm=e=>Zt("ConfirmPrompt",e);Ye.list=e=>{let t=e.separator||",";return Zt("TextPrompt",e,{onSubmit:n=>n.split(t).map(i=>i.trim())})};Ye.toggle=e=>Zt("TogglePrompt",e);Ye.select=e=>Zt("SelectPrompt",e);Ye.multiselect=e=>{e.choices=[].concat(e.choices||[]);let t=n=>n.filter(i=>i.selected).map(i=>i.value);return Zt("MultiselectPrompt",e,{onAbort:t,onSubmit:t})};Ye.autocompleteMultiselect=e=>{e.choices=[].concat(e.choices||[]);let t=n=>n.filter(i=>i.selected).map(i=>i.value);return Zt("AutocompleteMultiselectPrompt",e,{onAbort:t,onSubmit:t})};var d6=(e,t)=>Promise.resolve(t.filter(n=>n.title.slice(0,e.length).toLowerCase()===e.toLowerCase()));Ye.autocomplete=e=>(e.suggest=e.suggest||d6,e.choices=[].concat(e.choices||[]),Zt("AutocompletePrompt",e))});var sN=I((sJ,aN)=>{"use strict";function eN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function tN(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?eN(Object(n),!0).forEach(function(i){m6(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):eN(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function m6(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p6(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=f6(e))||t&&e&&typeof e.length=="number"){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(l){throw l},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
53
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,c;return{s:function(){n=n.call(e)},n:function(){var l=n.next();return o=l.done,l},e:function(l){a=!0,c=l},f:function(){try{!o&&n.return!=null&&n.return()}finally{if(a)throw c}}}}function f6(e,t){if(e){if(typeof e=="string")return rN(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return rN(e,t)}}function rN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function nN(e,t,n,i,r,o,a){try{var c=e[o](a),u=c.value}catch(l){n(l);return}c.done?t(u):Promise.resolve(u).then(i,r)}function iN(e){return function(){var t=this,n=arguments;return new Promise(function(i,r){var o=e.apply(t,n);function a(u){nN(o,i,r,a,c,"next",u)}function c(u){nN(o,i,r,a,c,"throw",u)}a(void 0)})}}var zy=QC(),g6=["suggest","format","onState","validate","onRender","type"],oN=()=>{};function Lr(){return Ly.apply(this,arguments)}function Ly(){return Ly=iN(function*(e=[],{onSubmit:t=oN,onCancel:n=oN}={}){let i={},r=Lr._override||{};e=[].concat(e);let o,a,c,u,l,m,p=(function(){var z=iN(function*(Se,fr,we=!1){if(!(!we&&Se.validate&&Se.validate(fr)!==!0))return Se.format?yield Se.format(fr,i):fr});return function(fr,we){return z.apply(this,arguments)}})();var g=p6(e),v;try{for(g.s();!(v=g.n()).done;){a=v.value;var A=a;if(u=A.name,l=A.type,typeof l=="function"&&(l=yield l(o,tN({},i),a),a.type=l),!!l){for(let z in a){if(g6.includes(z))continue;let Se=a[z];a[z]=typeof Se=="function"?yield Se(o,tN({},i),m):Se}if(m=a,typeof a.message!="string")throw new Error("prompt message is required");var Y=a;if(u=Y.name,l=Y.type,zy[l]===void 0)throw new Error(`prompt type (${l}) is not defined`);if(r[a.name]!==void 0&&(o=yield p(a,r[a.name]),o!==void 0)){i[u]=o;continue}try{o=Lr._injected?h6(Lr._injected,a.initial):yield zy[l](a),i[u]=o=yield p(a,o,!0),c=yield t(a,o,i)}catch{c=!(yield n(a,i))}if(c)return i}}}catch(z){g.e(z)}finally{g.f()}return i}),Ly.apply(this,arguments)}function h6(e,t){let n=e.shift();if(n instanceof Error)throw n;return n===void 0?t:n}function v6(e){Lr._injected=(Lr._injected||[]).concat(e)}function b6(e){Lr._override=Object.assign({},e)}aN.exports=Object.assign(Lr,{prompt:Lr,prompts:zy,inject:v6,override:b6})});var uN=I((cJ,cN)=>{"use strict";cN.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 Gl=I((uJ,lN)=>{"use strict";lN.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("|"),n=new RegExp(t,"g");return typeof e=="string"?e.replace(n,""):e}});var pN=I((lJ,mN)=>{"use strict";var y6=Gl(),{erase:dN,cursor:S6}=ae(),_6=e=>[...y6(e)].length;mN.exports=function(e,t){if(!t)return dN.line+S6.to(0);let n=0,i=e.split(/\r?\n/);for(let r of i)n+=1+Math.floor(Math.max(_6(r)-1,0)/t);return dN.lines(n)}});var Uy=I((dJ,fN)=>{"use strict";var Xa={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},E6={arrowUp:Xa.arrowUp,arrowDown:Xa.arrowDown,arrowLeft:Xa.arrowLeft,arrowRight:Xa.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},x6=process.platform==="win32"?E6:Xa;fN.exports=x6});var hN=I((mJ,gN)=>{"use strict";var Qi=oe(),In=Uy(),Fy=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}`}}),A6=e=>Fy[e]||Fy.default,Ja=Object.freeze({aborted:Qi.red(In.cross),done:Qi.green(In.tick),exited:Qi.yellow(In.cross),default:Qi.cyan("?")}),I6=(e,t,n)=>t?Ja.aborted:n?Ja.exited:e?Ja.done:Ja.default,$6=e=>Qi.gray(e?In.ellipsis:In.pointerSmall),T6=(e,t)=>Qi.gray(e?t?In.pointerSmall:"+":In.line);gN.exports={styles:Fy,render:A6,symbols:Ja,symbol:I6,delimiter:$6,item:T6}});var bN=I((pJ,vN)=>{"use strict";var R6=Gl();vN.exports=function(e,t){let n=String(R6(e)||"").split(/\r?\n/);return t?n.map(i=>Math.ceil(i.length/t)).reduce((i,r)=>i+r):n.length}});var SN=I((fJ,yN)=>{"use strict";yN.exports=(e,t={})=>{let n=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",i=t.width;return(e||"").split(/\r?\n/g).map(r=>r.split(/\s+/g).reduce((o,a)=>(a.length+n.length>=i||o[o.length-1].length+a.length+1<i?o[o.length-1]+=` ${a}`:o.push(`${n}${a}`),o),[n]).join(`
54
54
  `)).join(`
55
- `)}});var EN=I((fJ,_N)=>{"use strict";_N.exports=(e,t,n)=>{n=n||t;let i=Math.min(t-n,e-Math.floor(n/2));i<0&&(i=0);let r=Math.min(i+n,t);return{startIndex:i,endIndex:r}}});var It=I((gJ,xN)=>{"use strict";xN.exports={action:uN(),clear:pN(),style:hN(),strip:Gl(),figures:Uy(),lines:bN(),wrap:SN(),entriesToDisplay:EN()}});var dr=I((hJ,IN)=>{"use strict";var AN=ts("readline"),{action:R6}=It(),P6=ts("events"),{beep:C6,cursor:N6}=ae(),w6=oe(),By=class extends P6{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 n=AN.createInterface({input:this.in,escapeCodeTimeout:50});AN.emitKeypressEvents(this.in,n),this.in.isTTY&&this.in.setRawMode(!0);let i=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,r=(o,a)=>{let c=R6(a,i);c===!1?this._&&this._(o,a):typeof this[c]=="function"?this[c](a):this.bell()};this.close=()=>{this.out.write(N6.show),this.in.removeListener("keypress",r),this.in.isTTY&&this.in.setRawMode(!1),n.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",r)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(C6)}render(){this.onRender(w6),this.firstRender&&(this.firstRender=!1)}};IN.exports=By});var TN=I((vJ,$N)=>{var Wl=oe(),k6=dr(),{erase:O6,cursor:Qa}=ae(),{style:Vy,clear:Zy,lines:D6,figures:M6}=It(),Gy=class extends k6{constructor(t={}){super(t),this.transform=Vy.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=Zy("",this.out.columns),this.render()}set value(t){!t&&this.initial?(this.placeholder=!0,this.rendered=Wl.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(`
55
+ `)}});var EN=I((gJ,_N)=>{"use strict";_N.exports=(e,t,n)=>{n=n||t;let i=Math.min(t-n,e-Math.floor(n/2));i<0&&(i=0);let r=Math.min(i+n,t);return{startIndex:i,endIndex:r}}});var It=I((hJ,xN)=>{"use strict";xN.exports={action:uN(),clear:pN(),style:hN(),strip:Gl(),figures:Uy(),lines:bN(),wrap:SN(),entriesToDisplay:EN()}});var dr=I((vJ,IN)=>{"use strict";var AN=ts("readline"),{action:P6}=It(),C6=ts("events"),{beep:N6,cursor:w6}=ae(),k6=oe(),By=class extends C6{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 n=AN.createInterface({input:this.in,escapeCodeTimeout:50});AN.emitKeypressEvents(this.in,n),this.in.isTTY&&this.in.setRawMode(!0);let i=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,r=(o,a)=>{let c=P6(a,i);c===!1?this._&&this._(o,a):typeof this[c]=="function"?this[c](a):this.bell()};this.close=()=>{this.out.write(w6.show),this.in.removeListener("keypress",r),this.in.isTTY&&this.in.setRawMode(!1),n.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",r)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(N6)}render(){this.onRender(k6),this.firstRender&&(this.firstRender=!1)}};IN.exports=By});var TN=I((bJ,$N)=>{var Wl=oe(),O6=dr(),{erase:D6,cursor:Qa}=ae(),{style:Vy,clear:Zy,lines:M6,figures:j6}=It(),Gy=class extends O6{constructor(t={}){super(t),this.transform=Vy.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=Zy("",this.out.columns),this.render()}set value(t){!t&&this.initial?(this.placeholder=!0,this.rendered=Wl.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(`
56
56
  `),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(`
57
- `),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,n){let i=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor);this.value=`${i}${t}${r}`,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),n=this.value.slice(this.cursor);this.value=`${t}${n}`,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),n=this.value.slice(this.cursor+1);this.value=`${t}${n}`,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(Qa.down(D6(this.outputError,this.out.columns)-1)+Zy(this.outputError,this.out.columns)),this.out.write(Zy(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Vy.symbol(this.done,this.aborted),Wl.bold(this.msg),Vy.delimiter(this.done),this.red?Wl.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
57
+ `),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,n){let i=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor);this.value=`${i}${t}${r}`,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),n=this.value.slice(this.cursor);this.value=`${t}${n}`,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),n=this.value.slice(this.cursor+1);this.value=`${t}${n}`,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(Qa.down(M6(this.outputError,this.out.columns)-1)+Zy(this.outputError,this.out.columns)),this.out.write(Zy(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Vy.symbol(this.done,this.aborted),Wl.bold(this.msg),Vy.delimiter(this.done),this.red?Wl.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
58
58
  `).reduce((t,n,i)=>t+`
59
- ${i?" ":M6.pointerSmall} ${Wl.red().italic(n)}`,"")),this.out.write(O6.line+Qa.to(0)+this.outputText+Qa.save+this.outputError+Qa.restore+Qa.move(this.cursorOffset,0)))}};$N.exports=Gy});var NN=I((bJ,CN)=>{"use strict";var mr=oe(),j6=dr(),{style:RN,clear:PN,figures:Hl,wrap:z6,entriesToDisplay:L6}=It(),{cursor:U6}=ae(),Wy=class extends j6{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((n,i)=>(typeof n=="string"&&(n={title:n,value:i}),{title:n&&(n.title||n.value||n),value:n&&(n.value===void 0?i:n.value),description:n&&n.description,selected:n&&n.selected,disabled:n&&n.disabled})),this.optionsPerPage=t.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=PN("",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(`
59
+ ${i?" ":j6.pointerSmall} ${Wl.red().italic(n)}`,"")),this.out.write(D6.line+Qa.to(0)+this.outputText+Qa.save+this.outputError+Qa.restore+Qa.move(this.cursorOffset,0)))}};$N.exports=Gy});var NN=I((yJ,CN)=>{"use strict";var mr=oe(),z6=dr(),{style:RN,clear:PN,figures:Hl,wrap:L6,entriesToDisplay:U6}=It(),{cursor:F6}=ae(),Wy=class extends z6{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((n,i)=>(typeof n=="string"&&(n={title:n,value:i}),{title:n&&(n.title||n.value||n),value:n&&(n.value===void 0?i:n.value),description:n&&n.description,selected:n&&n.selected,disabled:n&&n.disabled})),this.optionsPerPage=t.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=PN("",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(`
60
60
  `),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
61
- `),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,n){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(U6.hide):this.out.write(PN(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:n}=L6(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[RN.symbol(this.done,this.aborted),mr.bold(this.msg),RN.delimiter(!1),this.done?this.selection.title:this.selection.disabled?mr.yellow(this.warn):mr.gray(this.hint)].join(" "),!this.done){this.outputText+=`
61
+ `),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,n){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(F6.hide):this.out.write(PN(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:n}=U6(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[RN.symbol(this.done,this.aborted),mr.bold(this.msg),RN.delimiter(!1),this.done?this.selection.title:this.selection.disabled?mr.yellow(this.warn):mr.gray(this.hint)].join(" "),!this.done){this.outputText+=`
62
62
  `;for(let i=t;i<n;i++){let r,o,a="",c=this.choices[i];i===t&&t>0?o=Hl.arrowUp:i===n-1&&n<this.choices.length?o=Hl.arrowDown:o=" ",c.disabled?(r=this.cursor===i?mr.gray().underline(c.title):mr.strikethrough().gray(c.title),o=(this.cursor===i?mr.bold().gray(Hl.pointer)+" ":" ")+o):(r=this.cursor===i?mr.cyan().underline(c.title):c.title,o=(this.cursor===i?mr.cyan(Hl.pointer)+" ":" ")+o,c.description&&this.cursor===i&&(a=` - ${c.description}`,(o.length+r.length+a.length>=this.out.columns||c.description.split(/\r?\n/).length>1)&&(a=`
63
- `+z6(c.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${r}${mr.gray(a)}
64
- `}}this.out.write(this.outputText)}};CN.exports=Wy});var DN=I((yJ,ON)=>{var ql=oe(),F6=dr(),{style:wN,clear:B6}=It(),{cursor:kN,erase:V6}=ae(),Hy=class extends F6{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(`
63
+ `+L6(c.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${r}${mr.gray(a)}
64
+ `}}this.out.write(this.outputText)}};CN.exports=Wy});var DN=I((SJ,ON)=>{var ql=oe(),B6=dr(),{style:wN,clear:V6}=It(),{cursor:kN,erase:Z6}=ae(),Hy=class extends B6{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(`
65
65
  `),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
66
- `),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,n){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(kN.hide):this.out.write(B6(this.outputText,this.out.columns)),super.render(),this.outputText=[wN.symbol(this.done,this.aborted),ql.bold(this.msg),wN.delimiter(this.done),this.value?this.inactive:ql.cyan().underline(this.inactive),ql.gray("/"),this.value?ql.cyan().underline(this.active):this.active].join(" "),this.out.write(V6.line+kN.to(0)+this.outputText))}};ON.exports=Hy});var Gt=I((SJ,MN)=>{"use strict";var qy=class e{constructor({token:t,date:n,parts:i,locales:r}){this.token=t,this.date=n||new Date,this.parts=i||[this],this.locales=r||{}}up(){}down(){}next(){let t=this.parts.indexOf(this);return this.parts.find((n,i)=>i>t&&n instanceof e)}setTo(t){}prev(){let t=[].concat(this.parts).reverse(),n=t.indexOf(this);return t.find((i,r)=>r>n&&i instanceof e)}toString(){return String(this.date)}};MN.exports=qy});var zN=I((_J,jN)=>{"use strict";var Z6=Gt(),Ky=class extends Z6{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}};jN.exports=Ky});var UN=I((EJ,LN)=>{"use strict";var G6=Gt(),W6=e=>(e=e%10,e===1?"st":e===2?"nd":e===3?"rd":"th"),Yy=class extends G6{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(),n=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+W6(t):this.token==="d"?n+1:this.token==="ddd"?this.locales.weekdaysShort[n]:this.token==="dddd"?this.locales.weekdays[n]:t}};LN.exports=Yy});var BN=I((xJ,FN)=>{"use strict";var H6=Gt(),Xy=class extends H6{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}};FN.exports=Xy});var ZN=I((AJ,VN)=>{"use strict";var q6=Gt(),Jy=class extends q6{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)}};VN.exports=Jy});var WN=I((IJ,GN)=>{"use strict";var K6=Gt(),Qy=class extends K6{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}};GN.exports=Qy});var qN=I(($J,HN)=>{"use strict";var Y6=Gt(),eS=class extends Y6{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(),n=this.token.length;return n===2?String(t+1).padStart(2,"0"):n===3?this.locales.monthsShort[t]:n===4?this.locales.months[t]:String(t+1)}};HN.exports=eS});var YN=I((TJ,KN)=>{"use strict";var X6=Gt(),tS=class extends X6{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}};KN.exports=tS});var JN=I((RJ,XN)=>{"use strict";var J6=Gt(),rS=class extends J6{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}};XN.exports=rS});var ew=I((PJ,QN)=>{"use strict";QN.exports={DatePart:Gt(),Meridiem:zN(),Day:UN(),Hours:BN(),Milliseconds:ZN(),Minutes:WN(),Month:qN(),Seconds:YN(),Year:JN()}});var sw=I((CJ,aw)=>{"use strict";var nS=oe(),Q6=dr(),{style:tw,clear:rw,figures:eF}=It(),{erase:tF,cursor:nw}=ae(),{DatePart:iw,Meridiem:rF,Day:nF,Hours:iF,Milliseconds:oF,Minutes:aF,Month:sF,Seconds:cF,Year:uF}=ew(),lF=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,ow={1:({token:e})=>e.replace(/\\(.)/g,"$1"),2:e=>new nF(e),3:e=>new sF(e),4:e=>new uF(e),5:e=>new rF(e),6:e=>new iF(e),7:e=>new aF(e),8:e=>new cF(e),9:e=>new oF(e)},dF={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(",")},iS=class extends Q6{constructor(t={}){super(t),this.msg=t.message,this.cursor=0,this.typed="",this.locales=Object.assign(dF,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=rw("",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 n;for(this.parts=[];n=lF.exec(t);){let r=n.shift(),o=n.findIndex(a=>a!=null);this.parts.push(o in ow?ow[o]({token:n[o]||r,date:this.date,parts:this.parts,locales:this.locales}):n[o]||r)}let i=this.parts.reduce((r,o)=>(typeof o=="string"&&typeof r[r.length-1]=="string"?r[r.length-1]+=o:r.push(o),r),[]);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 iw)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
66
+ `),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,n){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(kN.hide):this.out.write(V6(this.outputText,this.out.columns)),super.render(),this.outputText=[wN.symbol(this.done,this.aborted),ql.bold(this.msg),wN.delimiter(this.done),this.value?this.inactive:ql.cyan().underline(this.inactive),ql.gray("/"),this.value?ql.cyan().underline(this.active):this.active].join(" "),this.out.write(Z6.line+kN.to(0)+this.outputText))}};ON.exports=Hy});var Gt=I((_J,MN)=>{"use strict";var qy=class e{constructor({token:t,date:n,parts:i,locales:r}){this.token=t,this.date=n||new Date,this.parts=i||[this],this.locales=r||{}}up(){}down(){}next(){let t=this.parts.indexOf(this);return this.parts.find((n,i)=>i>t&&n instanceof e)}setTo(t){}prev(){let t=[].concat(this.parts).reverse(),n=t.indexOf(this);return t.find((i,r)=>r>n&&i instanceof e)}toString(){return String(this.date)}};MN.exports=qy});var zN=I((EJ,jN)=>{"use strict";var G6=Gt(),Ky=class extends G6{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}};jN.exports=Ky});var UN=I((xJ,LN)=>{"use strict";var W6=Gt(),H6=e=>(e=e%10,e===1?"st":e===2?"nd":e===3?"rd":"th"),Yy=class extends W6{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(),n=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+H6(t):this.token==="d"?n+1:this.token==="ddd"?this.locales.weekdaysShort[n]:this.token==="dddd"?this.locales.weekdays[n]:t}};LN.exports=Yy});var BN=I((AJ,FN)=>{"use strict";var q6=Gt(),Xy=class extends q6{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}};FN.exports=Xy});var ZN=I((IJ,VN)=>{"use strict";var K6=Gt(),Jy=class extends K6{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)}};VN.exports=Jy});var WN=I(($J,GN)=>{"use strict";var Y6=Gt(),Qy=class extends Y6{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}};GN.exports=Qy});var qN=I((TJ,HN)=>{"use strict";var X6=Gt(),eS=class extends X6{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(),n=this.token.length;return n===2?String(t+1).padStart(2,"0"):n===3?this.locales.monthsShort[t]:n===4?this.locales.months[t]:String(t+1)}};HN.exports=eS});var YN=I((RJ,KN)=>{"use strict";var J6=Gt(),tS=class extends J6{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}};KN.exports=tS});var JN=I((PJ,XN)=>{"use strict";var Q6=Gt(),rS=class extends Q6{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}};XN.exports=rS});var ew=I((CJ,QN)=>{"use strict";QN.exports={DatePart:Gt(),Meridiem:zN(),Day:UN(),Hours:BN(),Milliseconds:ZN(),Minutes:WN(),Month:qN(),Seconds:YN(),Year:JN()}});var sw=I((NJ,aw)=>{"use strict";var nS=oe(),eF=dr(),{style:tw,clear:rw,figures:tF}=It(),{erase:rF,cursor:nw}=ae(),{DatePart:iw,Meridiem:nF,Day:iF,Hours:oF,Milliseconds:aF,Minutes:sF,Month:cF,Seconds:uF,Year:lF}=ew(),dF=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,ow={1:({token:e})=>e.replace(/\\(.)/g,"$1"),2:e=>new iF(e),3:e=>new cF(e),4:e=>new lF(e),5:e=>new nF(e),6:e=>new oF(e),7:e=>new sF(e),8:e=>new uF(e),9:e=>new aF(e)},mF={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(",")},iS=class extends eF{constructor(t={}){super(t),this.msg=t.message,this.cursor=0,this.typed="",this.locales=Object.assign(mF,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=rw("",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 n;for(this.parts=[];n=dF.exec(t);){let r=n.shift(),o=n.findIndex(a=>a!=null);this.parts.push(o in ow?ow[o]({token:n[o]||r,date:this.date,parts:this.parts,locales:this.locales}):n[o]||r)}let i=this.parts.reduce((r,o)=>(typeof o=="string"&&typeof r[r.length-1]=="string"?r[r.length-1]+=o:r.push(o),r),[]);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 iw)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
67
67
  `),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(`
68
68
  `),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(n=>n instanceof iw)),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(nw.hide):this.out.write(rw(this.outputText,this.out.columns)),super.render(),this.outputText=[tw.symbol(this.done,this.aborted),nS.bold(this.msg),tw.delimiter(!1),this.parts.reduce((t,n,i)=>t.concat(i===this.cursor&&!this.done?nS.cyan().underline(n.toString()):n),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
69
69
  `).reduce((t,n,i)=>t+`
70
- ${i?" ":eF.pointerSmall} ${nS.red().italic(n)}`,"")),this.out.write(tF.line+nw.to(0)+this.outputText))}};aw.exports=iS});var dw=I((NJ,lw)=>{var Kl=oe(),mF=dr(),{cursor:Yl,erase:pF}=ae(),{style:oS,figures:fF,clear:cw,lines:gF}=It(),hF=/[0-9]/,aS=e=>e!==void 0,uw=(e,t)=>{let n=Math.pow(10,t);return Math.round(e*n)/n},sS=class extends mF{constructor(t={}){super(t),this.transform=oS.render(t.style),this.msg=t.message,this.initial=aS(t.initial)?t.initial:"",this.float=!!t.float,this.round=t.round||2,this.inc=t.increment||1,this.min=aS(t.min)?t.min:-1/0,this.max=aS(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=Kl.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${uw(t,this.round)}`),this._value=uw(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||hF.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(`
70
+ ${i?" ":tF.pointerSmall} ${nS.red().italic(n)}`,"")),this.out.write(rF.line+nw.to(0)+this.outputText))}};aw.exports=iS});var dw=I((wJ,lw)=>{var Kl=oe(),pF=dr(),{cursor:Yl,erase:fF}=ae(),{style:oS,figures:gF,clear:cw,lines:hF}=It(),vF=/[0-9]/,aS=e=>e!==void 0,uw=(e,t)=>{let n=Math.pow(10,t);return Math.round(e*n)/n},sS=class extends pF{constructor(t={}){super(t),this.transform=oS.render(t.style),this.msg=t.message,this.initial=aS(t.initial)?t.initial:"",this.float=!!t.float,this.round=t.round||2,this.inc=t.increment||1,this.min=aS(t.min)?t.min:-1/0,this.max=aS(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=Kl.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${uw(t,this.round)}`),this._value=uw(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||vF.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(`
71
71
  `),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(`
72
- `),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,n){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(Yl.down(gF(this.outputError,this.out.columns)-1)+cw(this.outputError,this.out.columns)),this.out.write(cw(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[oS.symbol(this.done,this.aborted),Kl.bold(this.msg),oS.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Kl[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
72
+ `),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,n){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(Yl.down(hF(this.outputError,this.out.columns)-1)+cw(this.outputError,this.out.columns)),this.out.write(cw(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[oS.symbol(this.done,this.aborted),Kl.bold(this.msg),oS.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Kl[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
73
73
  `).reduce((t,n,i)=>t+`
74
- ${i?" ":fF.pointerSmall} ${Kl.red().italic(n)}`,"")),this.out.write(pF.line+Yl.to(0)+this.outputText+Yl.save+this.outputError+Yl.restore))}};lw.exports=sS});var uS=I((wJ,fw)=>{"use strict";var Wt=oe(),{cursor:vF}=ae(),bF=dr(),{clear:mw,figures:Ur,style:pw,wrap:yF,entriesToDisplay:SF}=It(),cS=class extends bF{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((n,i)=>(typeof n=="string"&&(n={title:n,value:i}),{title:n&&(n.title||n.value||n),description:n&&n.description,value:n&&(n.value===void 0?i:n.value),selected:n&&n.selected,disabled:n&&n.disabled})),this.clear=mw("",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(`
74
+ ${i?" ":gF.pointerSmall} ${Kl.red().italic(n)}`,"")),this.out.write(fF.line+Yl.to(0)+this.outputText+Yl.save+this.outputError+Yl.restore))}};lw.exports=sS});var uS=I((kJ,fw)=>{"use strict";var Wt=oe(),{cursor:bF}=ae(),yF=dr(),{clear:mw,figures:Ur,style:pw,wrap:SF,entriesToDisplay:_F}=It(),cS=class extends yF{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((n,i)=>(typeof n=="string"&&(n={title:n,value:i}),{title:n&&(n.title||n.value||n),description:n&&n.description,value:n&&(n.value===void 0?i:n.value),selected:n&&n.selected,disabled:n&&n.disabled})),this.clear=mw("",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(`
75
75
  `),this.close()}submit(){let t=this.value.filter(n=>n.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(`
76
76
  `),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(n=>n.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(n=>!n.disabled).forEach(n=>n.selected=t),this.render()}_(t,n){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:`
77
77
  Instructions:
@@ -79,15 +79,15 @@ Instructions:
79
79
  ${Ur.arrowLeft}/${Ur.arrowRight}/[space]: Toggle selection
80
80
  `+(this.maxChoices===void 0?` a: Toggle all
81
81
  `:"")+" enter/return: Complete answer":""}renderOption(t,n,i,r){let o=(n.selected?Wt.green(Ur.radioOn):Ur.radioOff)+" "+r+" ",a,c;return n.disabled?a=t===i?Wt.gray().underline(n.title):Wt.strikethrough().gray(n.title):(a=t===i?Wt.cyan().underline(n.title):n.title,t===i&&n.description&&(c=` - ${n.description}`,(o.length+a.length+c.length>=this.out.columns||n.description.split(/\r?\n/).length>1)&&(c=`
82
- `+yF(n.description,{margin:o.length,width:this.out.columns})))),o+a+Wt.gray(c||"")}paginateOptions(t){if(t.length===0)return Wt.red("No matches for this query.");let{startIndex:n,endIndex:i}=SF(this.cursor,t.length,this.optionsPerPage),r,o=[];for(let a=n;a<i;a++)a===n&&n>0?r=Ur.arrowUp:a===i-1&&i<t.length?r=Ur.arrowDown:r=" ",o.push(this.renderOption(this.cursor,t[a],a,r));return`
82
+ `+SF(n.description,{margin:o.length,width:this.out.columns})))),o+a+Wt.gray(c||"")}paginateOptions(t){if(t.length===0)return Wt.red("No matches for this query.");let{startIndex:n,endIndex:i}=_F(this.cursor,t.length,this.optionsPerPage),r,o=[];for(let a=n;a<i;a++)a===n&&n>0?r=Ur.arrowUp:a===i-1&&i<t.length?r=Ur.arrowDown:r=" ",o.push(this.renderOption(this.cursor,t[a],a,r));return`
83
83
  `+o.join(`
84
- `)}renderOptions(t){return this.done?"":this.paginateOptions(t)}renderDoneOrInstructions(){if(this.done)return this.value.filter(n=>n.selected).map(n=>n.title).join(", ");let t=[Wt.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(Wt.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(vF.hide),super.render();let t=[pw.symbol(this.done,this.aborted),Wt.bold(this.msg),pw.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=Wt.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=mw(t,this.out.columns)}};fw.exports=cS});var yw=I((kJ,bw)=>{"use strict";var es=oe(),_F=dr(),{erase:EF,cursor:gw}=ae(),{style:lS,clear:hw,figures:dS,wrap:xF,entriesToDisplay:AF}=It(),vw=(e,t)=>e[t]&&(e[t].value||e[t].title||e[t]),IF=(e,t)=>e[t]&&(e[t].title||e[t].value||e[t]),$F=(e,t)=>{let n=e.findIndex(i=>i.value===t||i.title===t);return n>-1?n:void 0},mS=class extends _F{constructor(t={}){super(t),this.msg=t.message,this.suggest=t.suggest,this.choices=t.choices,this.initial=typeof t.initial=="number"?t.initial:$F(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=lS.render(t.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=hw("",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=vw(this.suggestions,t):this.value=this.fallback.value,this.fire()}async complete(t){let n=this.completing=this.suggest(this.input,this.choices),i=await n;if(this.completing!==n)return;this.suggestions=i.map((o,a,c)=>({title:IF(c,a),value:vw(c,a),description:o.description})),this.completing=!1;let r=Math.max(i.length-1,0);this.moveSelect(Math.min(r,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(`
84
+ `)}renderOptions(t){return this.done?"":this.paginateOptions(t)}renderDoneOrInstructions(){if(this.done)return this.value.filter(n=>n.selected).map(n=>n.title).join(", ");let t=[Wt.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(Wt.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(bF.hide),super.render();let t=[pw.symbol(this.done,this.aborted),Wt.bold(this.msg),pw.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=Wt.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=mw(t,this.out.columns)}};fw.exports=cS});var yw=I((OJ,bw)=>{"use strict";var es=oe(),EF=dr(),{erase:xF,cursor:gw}=ae(),{style:lS,clear:hw,figures:dS,wrap:AF,entriesToDisplay:IF}=It(),vw=(e,t)=>e[t]&&(e[t].value||e[t].title||e[t]),$F=(e,t)=>e[t]&&(e[t].title||e[t].value||e[t]),TF=(e,t)=>{let n=e.findIndex(i=>i.value===t||i.title===t);return n>-1?n:void 0},mS=class extends EF{constructor(t={}){super(t),this.msg=t.message,this.suggest=t.suggest,this.choices=t.choices,this.initial=typeof t.initial=="number"?t.initial:TF(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=lS.render(t.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=hw("",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=vw(this.suggestions,t):this.value=this.fallback.value,this.fire()}async complete(t){let n=this.completing=this.suggest(this.input,this.choices),i=await n;if(this.completing!==n)return;this.suggestions=i.map((o,a,c)=>({title:$F(c,a),value:vw(c,a),description:o.description})),this.completing=!1;let r=Math.max(i.length-1,0);this.moveSelect(Math.min(r,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(`
85
85
  `),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
86
86
  `),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
87
87
  `),this.close()}_(t,n){let i=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor);this.input=`${i}${t}${r}`,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),n=this.input.slice(this.cursor);this.input=`${t}${n}`,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),n=this.input.slice(this.cursor+1);this.input=`${t}${n}`,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,n,i,r){let o,a=i?dS.arrowUp:r?dS.arrowDown:" ",c=n?es.cyan().underline(t.title):t.title;return a=(n?es.cyan(dS.pointer)+" ":" ")+a,t.description&&(o=` - ${t.description}`,(a.length+c.length+o.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(o=`
88
- `+xF(t.description,{margin:3,width:this.out.columns}))),a+" "+c+es.gray(o||"")}render(){if(this.closed)return;this.firstRender?this.out.write(gw.hide):this.out.write(hw(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:n}=AF(this.select,this.choices.length,this.limit);if(this.outputText=[lS.symbol(this.done,this.aborted,this.exited),es.bold(this.msg),lS.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,n).map((r,o)=>this.renderOption(r,this.select===o+t,o===0&&t>0,o+t===n-1&&n<this.choices.length)).join(`
88
+ `+AF(t.description,{margin:3,width:this.out.columns}))),a+" "+c+es.gray(o||"")}render(){if(this.closed)return;this.firstRender?this.out.write(gw.hide):this.out.write(hw(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:n}=IF(this.select,this.choices.length,this.limit);if(this.outputText=[lS.symbol(this.done,this.aborted,this.exited),es.bold(this.msg),lS.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,n).map((r,o)=>this.renderOption(r,this.select===o+t,o===0&&t>0,o+t===n-1&&n<this.choices.length)).join(`
89
89
  `);this.outputText+=`
90
- `+(i||es.gray(this.fallback.title))}this.out.write(EF.line+gw.to(0)+this.outputText)}};bw.exports=mS});var xw=I((OJ,Ew)=>{"use strict";var pr=oe(),{cursor:TF}=ae(),RF=uS(),{clear:Sw,style:_w,figures:eo}=It(),pS=class extends RF{constructor(t={}){t.overrideRender=!0,super(t),this.inputValue="",this.clear=Sw("",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 n=this.filteredOptions.findIndex(i=>i===t);this.cursor=n<0?0:n,this.render()}handleSpaceToggle(){let t=this.filteredOptions[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(n=>n.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}handleInputChange(t){this.inputValue=this.inputValue+t,this.updateFilteredOptions()}_(t,n){t===" "?this.handleSpaceToggle():this.handleInputChange(t)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
90
+ `+(i||es.gray(this.fallback.title))}this.out.write(xF.line+gw.to(0)+this.outputText)}};bw.exports=mS});var xw=I((DJ,Ew)=>{"use strict";var pr=oe(),{cursor:RF}=ae(),PF=uS(),{clear:Sw,style:_w,figures:eo}=It(),pS=class extends PF{constructor(t={}){t.overrideRender=!0,super(t),this.inputValue="",this.clear=Sw("",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 n=this.filteredOptions.findIndex(i=>i===t);this.cursor=n<0?0:n,this.render()}handleSpaceToggle(){let t=this.filteredOptions[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(n=>n.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}handleInputChange(t){this.inputValue=this.inputValue+t,this.updateFilteredOptions()}_(t,n){t===" "?this.handleSpaceToggle():this.handleInputChange(t)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
91
91
  Instructions:
92
92
  ${eo.arrowUp}/${eo.arrowDown}: Highlight option
93
93
  ${eo.arrowLeft}/${eo.arrowRight}/[space]: Toggle selection
@@ -95,9 +95,9 @@ Instructions:
95
95
  enter/return: Complete answer
96
96
  `:""}renderCurrentInput(){return`
97
97
  Filtered results for: ${this.inputValue?this.inputValue:pr.gray("Enter something to filter")}
98
- `}renderOption(t,n,i){let r;return n.disabled?r=t===i?pr.gray().underline(n.title):pr.strikethrough().gray(n.title):r=t===i?pr.cyan().underline(n.title):n.title,(n.selected?pr.green(eo.radioOn):eo.radioOff)+" "+r}renderDoneOrInstructions(){if(this.done)return this.value.filter(n=>n.selected).map(n=>n.title).join(", ");let t=[pr.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(pr.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(TF.hide),super.render();let t=[_w.symbol(this.done,this.aborted),pr.bold(this.msg),_w.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=pr.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=Sw(t,this.out.columns)}};Ew.exports=pS});var Rw=I((DJ,Tw)=>{var Aw=oe(),PF=dr(),{style:Iw,clear:CF}=It(),{erase:NF,cursor:$w}=ae(),fS=class extends PF{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(`
98
+ `}renderOption(t,n,i){let r;return n.disabled?r=t===i?pr.gray().underline(n.title):pr.strikethrough().gray(n.title):r=t===i?pr.cyan().underline(n.title):n.title,(n.selected?pr.green(eo.radioOn):eo.radioOff)+" "+r}renderDoneOrInstructions(){if(this.done)return this.value.filter(n=>n.selected).map(n=>n.title).join(", ");let t=[pr.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(pr.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(RF.hide),super.render();let t=[_w.symbol(this.done,this.aborted),pr.bold(this.msg),_w.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=pr.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=Sw(t,this.out.columns)}};Ew.exports=pS});var Rw=I((MJ,Tw)=>{var Aw=oe(),CF=dr(),{style:Iw,clear:NF}=It(),{erase:wF,cursor:$w}=ae(),fS=class extends CF{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(`
99
99
  `),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
100
- `),this.close()}_(t,n){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($w.hide):this.out.write(CF(this.outputText,this.out.columns)),super.render(),this.outputText=[Iw.symbol(this.done,this.aborted),Aw.bold(this.msg),Iw.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Aw.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(NF.line+$w.to(0)+this.outputText))}};Tw.exports=fS});var Cw=I((MJ,Pw)=>{"use strict";Pw.exports={TextPrompt:TN(),SelectPrompt:NN(),TogglePrompt:DN(),DatePrompt:sw(),NumberPrompt:dw(),MultiselectPrompt:uS(),AutocompletePrompt:yw(),AutocompleteMultiselectPrompt:xw(),ConfirmPrompt:Rw()}});var ww=I(Nw=>{"use strict";var Xe=Nw,wF=Cw(),Xl=e=>e;function Ht(e,t,n={}){return new Promise((i,r)=>{let o=new wF[e](t),a=n.onAbort||Xl,c=n.onSubmit||Xl,u=n.onExit||Xl;o.on("state",t.onState||Xl),o.on("submit",l=>i(c(l))),o.on("exit",l=>i(u(l))),o.on("abort",l=>r(a(l)))})}Xe.text=e=>Ht("TextPrompt",e);Xe.password=e=>(e.style="password",Xe.text(e));Xe.invisible=e=>(e.style="invisible",Xe.text(e));Xe.number=e=>Ht("NumberPrompt",e);Xe.date=e=>Ht("DatePrompt",e);Xe.confirm=e=>Ht("ConfirmPrompt",e);Xe.list=e=>{let t=e.separator||",";return Ht("TextPrompt",e,{onSubmit:n=>n.split(t).map(i=>i.trim())})};Xe.toggle=e=>Ht("TogglePrompt",e);Xe.select=e=>Ht("SelectPrompt",e);Xe.multiselect=e=>{e.choices=[].concat(e.choices||[]);let t=n=>n.filter(i=>i.selected).map(i=>i.value);return Ht("MultiselectPrompt",e,{onAbort:t,onSubmit:t})};Xe.autocompleteMultiselect=e=>{e.choices=[].concat(e.choices||[]);let t=n=>n.filter(i=>i.selected).map(i=>i.value);return Ht("AutocompleteMultiselectPrompt",e,{onAbort:t,onSubmit:t})};var kF=(e,t)=>Promise.resolve(t.filter(n=>n.title.slice(0,e.length).toLowerCase()===e.toLowerCase()));Xe.autocomplete=e=>(e.suggest=e.suggest||kF,e.choices=[].concat(e.choices||[]),Ht("AutocompletePrompt",e))});var Dw=I((zJ,Ow)=>{"use strict";var gS=ww(),OF=["suggest","format","onState","validate","onRender","type"],kw=()=>{};async function Fr(e=[],{onSubmit:t=kw,onCancel:n=kw}={}){let i={},r=Fr._override||{};e=[].concat(e);let o,a,c,u,l,m,p=async(g,v,A=!1)=>{if(!(!A&&g.validate&&g.validate(v)!==!0))return g.format?await g.format(v,i):v};for(a of e)if({name:u,type:l}=a,typeof l=="function"&&(l=await l(o,{...i},a),a.type=l),!!l){for(let g in a){if(OF.includes(g))continue;let v=a[g];a[g]=typeof v=="function"?await v(o,{...i},m):v}if(m=a,typeof a.message!="string")throw new Error("prompt message is required");if({name:u,type:l}=a,gS[l]===void 0)throw new Error(`prompt type (${l}) is not defined`);if(r[a.name]!==void 0&&(o=await p(a,r[a.name]),o!==void 0)){i[u]=o;continue}try{o=Fr._injected?DF(Fr._injected,a.initial):await gS[l](a),i[u]=o=await p(a,o,!0),c=await t(a,o,i)}catch{c=!await n(a,i)}if(c)return i}return i}function DF(e,t){let n=e.shift();if(n instanceof Error)throw n;return n===void 0?t:n}function MF(e){Fr._injected=(Fr._injected||[]).concat(e)}function jF(e){Fr._override=Object.assign({},e)}Ow.exports=Object.assign(Fr,{prompt:Fr,prompts:gS,inject:MF,override:jF})});var jw=I((LJ,Mw)=>{function zF(e){e=(Array.isArray(e)?e:e.split(".")).map(Number);let t=0,n=process.versions.node.split(".").map(Number);for(;t<e.length;t++){if(n[t]>e[t])return!1;if(e[t]>n[t])return!0}return!1}Mw.exports=zF("8.6.0")?sN():Dw()});import{join as ht,dirname as _S,normalize as Kw}from"node:path";import{readFileSync as Yw,existsSync as Xw}from"node:fs";var qw=Object.defineProperty,ke=(e,t)=>qw(e,"name",{value:t,configurable:!0}),Br="fjall";function Vr(e,t){let n=Kw(e);if(n.includes("..")||n.startsWith("/"))throw new Error(`Invalid ${t}: path traversal is not allowed`)}ke(Vr,"assertNoTraversal");function Jw(){return Br}ke(Jw,"getFjallPath");function Qw(e){let t=_S(e);return _S(t)||"."}ke(Qw,"getProjectRoot");function ES(e){if(!Xw(e))throw new Error(`Infrastructure file not found: ${e}`);let t=Yw(e,"utf-8").match(/const\s+appName\s*=\s*["']([^"']+)["']/);if(!t||!t[1])throw new Error(`Could not find appName in infrastructure file: ${e}. Expected format: const appName = "yourAppName";`);return t[1]}ke(ES,"getAppNameFromInfrastructure");function ek(e){let t=ht(e,ed);return ES(t)}ke(ek,"getAppName");function qt(e){return Vr(e,"app name"),ht(Br,e,ed)}ke(qt,"getInfrastructurePath");function tk(e){return Vr(e,"app name"),ht(Br,e)}ke(tk,"getAppPath");function rk(e){return Vr(e,"component name"),ht(Br,e)}ke(rk,"getOrganisationComponentPath");function nk(e){return Vr(e,"deployment type"),ht(Br,e,"logs")}ke(nk,"getDeploymentLogsPath");function ik(e){return Vr(e,"deployment type"),ht(Br,e,"logs","cloudformation")}ke(ik,"getCloudFormationLogsPath");function xS(){return ht(Br,"domains")}ke(xS,"getDomainsDir");function Ql(e){return Vr(e,"domain name"),ht(xS(),e)}ke(Ql,"getDomainComponentPath");function ok(e){return ht(Ql(e),ed)}ke(ok,"getDomainInfrastructurePath");function ak(e){return ht(Ql(e),sk)}ke(ak,"getDomainZoneFilePath");var ed="infrastructure.ts",sk="zone.bind",ck="cdk.out";function uk(e){return ht(e,ck)}ke(uk,"getCdkOutPath");var lk=Object.defineProperty,Tn=(e,t)=>lk(e,"name",{value:t,configurable:!0});function td(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}Tn(td,"escapeRegExp");function AS(e,t,n){let i=qt(t),r=e.read(i)?.toString();return r?new RegExp(`["']${td(n)}["']`).test(r):!1}Tn(AS,"resourceExists");function rd(e,t,n){let i=qt(t);if(!e.read(i)?.toString())throw new Error(`Infrastructure file not found for ${t}`);if(AS(e,t,n))throw new Error(`Resource name '${n}' already exists in ${t}. Please choose a different name or remove the existing resource first.`)}Tn(rd,"assertResourceNameUnique");function dk(e,t,n){let i=qt(t),r=e.read(i)?.toString();if(!r)return 0;let o={database:/DatabaseFactory\.build\(/g,compute:/ComputeFactory\.build\(/g,lambda:/type:\s*["']lambda["']/g,ecs:/type:\s*["']ecs["']/g,ec2:/type:\s*["']ec2["']/g}[n];if(!o)return 0;let a=r.match(o);return a?a.length:0}Tn(dk,"countResourcesOfType");function mk(e,t){let n=qt(t),i=e.read(n)?.toString();if(!i)return[];let r=[],o=i.matchAll(/ComputeFactory\.build\(["']([^"']+)["'],\s*\{([^}]*?)\}/gs);for(let a of o){let c=a[1],u=a[2],l="ecs";u.includes('type: "lambda"')?l="lambda":u.includes('type: "ec2"')&&(l="ec2");let m=u.includes("connections:"),p=[];if(m){let g=u.match(/connections:\s*\[([^\]]+)\]/);if(g){let v=g[1].match(/\w+/g)??[];p.push(...v)}}r.push({name:c,type:l,hasConnections:m,connectedResources:p})}return r}Tn(mk,"detectComputeResources");function pk(e,t,n){let i=qt(t),r=e.read(i)?.toString();return r?new RegExp(`databaseName:\\s*["']${td(n)}["']`).test(r):!1}Tn(pk,"databaseExists");import*as Yi from"fs";import*as tP from"path";var fk=Object.defineProperty,gr=(e,t)=>fk(e,"name",{value:t,configurable:!0});function $e(e){return e.replace(/[-_](.)/g,(t,n)=>n.toUpperCase()).replace(/^./,t=>t.toUpperCase())}gr($e,"toPascalCase");function Tt(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()}gr(Tt,"toKebab");function Rn(e){return Tt(e).replace(/-/g,"_")}gr(Rn,"toValidDatabaseName");function IS(e){return Tt(e).replace(/-/g,"_").toUpperCase()}gr(IS,"toScreamingSnake");function $S(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}gr($S,"capitalise");function TS(e){return e.split(".").join("")}gr(TS,"getSafeZoneName");function Zr(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}gr(Zr,"accountConstructKey");function RS(e){let t=e.replace(new RegExp("\\P{ASCII}","gu"),"");return Zr(t)===Zr(e)&&Zr(e)!==""}gr(RS,"hasAsciiStableConstructKey");var gk=Object.defineProperty,rs=(e,t)=>gk(e,"name",{value:t,configurable:!0});function ns(e){return`${$e(e.split(".").join(""))}Domain`}rs(ns,"getDomainStackName");function PS(e){return`${e}UsEast1Certificates`}rs(PS,"getDomainUsEast1CertificatesStackName");function nd(e){let t=e.replace(/\./g,"-");return{hostedZoneId:`${t}-hosted-zone-id`,certificateArn:`${t}-certificate-arn`,usEast1CertificateArn:`${t}-us-east-1-certificate-arn`,delegationRoleArn:`${t}-delegation-role-arn`,nameservers:`${t}-nameservers`}}rs(nd,"getDomainExportNames");function CS(e){return typeof e.hostedZoneId=="string"}rs(CS,"isManagedDomainBinding");var hk=Object.defineProperty,vk=(e,t)=>hk(e,"name",{value:t,configurable:!0});function NS(e){return`${$e(e)}ImageTag`}vk(NS,"imageTagParameterName");var bk=Object.defineProperty,yk=(e,t)=>bk(e,"name",{value:t,configurable:!0});function wS(e){let t=new Map;for(let n of e){let i=Zr(n);if(i==="")return{kind:"empty-construct-key",name:n};let r=t.get(i);if(r!==void 0)return{kind:"duplicate-construct-key",name:n,existingName:r,constructKey:i};t.set(i,n)}return null}yk(wS,"findAccountNameCollision");var Sk=Object.defineProperty,to=(e,t)=>Sk(e,"name",{value:t,configurable:!0}),Pn="us-east-2";var it=Object.freeze([{code:"us-east-2",name:"US East",city:"Ohio",country:"USA",optIn:!1},{code:"us-west-2",name:"US West",city:"Oregon",country:"USA",optIn:!1},{code:"us-east-1",name:"US East",city:"N. Virginia",country:"USA",optIn:!1},{code:"eu-west-1",name:"EU West",city:"Ireland",country:"Ireland",optIn:!1},{code:"eu-central-1",name:"EU Central",city:"Frankfurt",country:"Germany",optIn:!1},{code:"ap-southeast-1",name:"Asia Pacific",city:"Singapore",country:"Singapore",optIn:!1},{code:"ap-northeast-1",name:"Asia Pacific",city:"Tokyo",country:"Japan",optIn:!1},{code:"ap-southeast-2",name:"Asia Pacific",city:"Sydney",country:"Australia",optIn:!1},{code:"us-west-1",name:"US West",city:"N. California",country:"USA",optIn:!1},{code:"ca-central-1",name:"Canada",city:"Central",country:"Canada",optIn:!1},{code:"af-south-1",name:"Africa",city:"Cape Town",country:"South Africa",optIn:!0},{code:"ap-east-1",name:"Asia Pacific",city:"Hong Kong",country:"Hong Kong",optIn:!0},{code:"ap-northeast-2",name:"Asia Pacific",city:"Seoul",country:"South Korea",optIn:!1},{code:"ap-northeast-3",name:"Asia Pacific",city:"Osaka",country:"Japan",optIn:!1},{code:"ap-south-1",name:"Asia Pacific",city:"Mumbai",country:"India",optIn:!1},{code:"ap-south-2",name:"Asia Pacific",city:"Hyderabad",country:"India",optIn:!0},{code:"ap-southeast-3",name:"Asia Pacific",city:"Jakarta",country:"Indonesia",optIn:!0},{code:"ap-southeast-4",name:"Asia Pacific",city:"Melbourne",country:"Australia",optIn:!0},{code:"eu-central-2",name:"EU Central",city:"Zurich",country:"Switzerland",optIn:!0},{code:"eu-north-1",name:"EU North",city:"Stockholm",country:"Sweden",optIn:!1},{code:"eu-south-1",name:"EU South",city:"Milan",country:"Italy",optIn:!0},{code:"eu-south-2",name:"EU South",city:"Spain",country:"Spain",optIn:!0},{code:"eu-west-2",name:"EU West",city:"London",country:"UK",optIn:!1},{code:"eu-west-3",name:"EU West",city:"Paris",country:"France",optIn:!1},{code:"me-central-1",name:"Middle East",city:"UAE",country:"UAE",optIn:!0},{code:"me-south-1",name:"Middle East",city:"Bahrain",country:"Bahrain",optIn:!0},{code:"sa-east-1",name:"South America",city:"S\xE3o Paulo",country:"Brazil",optIn:!1},{code:"ap-southeast-5",name:"Asia Pacific",city:"Kuala Lumpur",country:"Malaysia",optIn:!0},{code:"ap-southeast-6",name:"Asia Pacific",city:"Auckland",country:"New Zealand",optIn:!0},{code:"ap-southeast-7",name:"Asia Pacific",city:"Bangkok",country:"Thailand",optIn:!0},{code:"ap-east-2",name:"Asia Pacific",city:"Taipei",country:"Taiwan",optIn:!0},{code:"ca-west-1",name:"Canada West",city:"Calgary",country:"Canada",optIn:!0},{code:"il-central-1",name:"Israel",city:"Tel Aviv",country:"Israel",optIn:!0},{code:"mx-central-1",name:"Mexico",city:"Central",country:"Mexico",optIn:!0}]),Kt=Object.freeze(it.map(e=>e.code)),is=new Set(it.filter(e=>e.optIn).map(e=>e.code));function os(e){return`${e} is an opt-in region: it must be enabled in the AWS account (Account settings \u2192 Regions) before deployment will succeed.`}to(os,"optInRegionWarning");function Cn(e){return it.find(t=>t.code===e)}to(Cn,"getRegionInfo");function Nn(e){let t=e.split("-");return t.length===3&&t[0]&&t[1]&&t[2]?`${t[0]}${t[1][0]}${t[2]}`:e}to(Nn,"abbreviateRegion");var _k=Object.freeze({"Europe/London":"eu-west-2","Europe/Jersey":"eu-west-2","Europe/Guernsey":"eu-west-2","Europe/Isle_of_Man":"eu-west-2","Europe/Dublin":"eu-west-1","Europe/Paris":"eu-west-3","Europe/Berlin":"eu-central-1","Europe/Amsterdam":"eu-central-1","Europe/Brussels":"eu-central-1","Europe/Luxembourg":"eu-central-1","Europe/Vienna":"eu-central-1","Europe/Prague":"eu-central-1","Europe/Warsaw":"eu-central-1","Europe/Budapest":"eu-central-1","Europe/Zurich":"eu-central-2","Europe/Stockholm":"eu-north-1","Europe/Oslo":"eu-north-1","Europe/Copenhagen":"eu-north-1","Europe/Helsinki":"eu-north-1","Europe/Tallinn":"eu-north-1","Europe/Riga":"eu-north-1","Europe/Vilnius":"eu-north-1","Europe/Rome":"eu-south-1","Europe/Malta":"eu-south-1","Europe/Athens":"eu-south-1","Europe/Madrid":"eu-south-2","Europe/Lisbon":"eu-south-2","America/New_York":"us-east-1","America/Detroit":"us-east-1","America/Toronto":"ca-central-1","America/Montreal":"ca-central-1","America/Halifax":"ca-central-1","America/Winnipeg":"ca-central-1","America/Chicago":"us-east-2","America/Indiana/Indianapolis":"us-east-2","America/Mexico_City":"us-east-2","America/Denver":"us-west-2","America/Phoenix":"us-west-2","America/Edmonton":"us-west-2","America/Vancouver":"us-west-2","America/Los_Angeles":"us-west-1","America/Tijuana":"us-west-1","America/Sao_Paulo":"sa-east-1","America/Argentina/Buenos_Aires":"sa-east-1","America/Santiago":"sa-east-1","America/Montevideo":"sa-east-1","America/Lima":"sa-east-1","America/Bogota":"us-east-1","Asia/Tokyo":"ap-northeast-1","Asia/Seoul":"ap-northeast-2","Asia/Hong_Kong":"ap-east-1","Asia/Shanghai":"ap-east-1","Asia/Taipei":"ap-east-1","Asia/Macau":"ap-east-1","Asia/Singapore":"ap-southeast-1","Asia/Kuala_Lumpur":"ap-southeast-1","Asia/Bangkok":"ap-southeast-1","Asia/Ho_Chi_Minh":"ap-southeast-1","Asia/Manila":"ap-southeast-1","Asia/Jakarta":"ap-southeast-3","Asia/Kolkata":"ap-south-1","Asia/Calcutta":"ap-south-1","Asia/Karachi":"ap-south-1","Asia/Dhaka":"ap-south-1","Asia/Colombo":"ap-south-1","Asia/Dubai":"me-central-1","Asia/Muscat":"me-central-1","Asia/Qatar":"me-south-1","Asia/Bahrain":"me-south-1","Asia/Riyadh":"me-south-1","Asia/Kuwait":"me-south-1","Asia/Jerusalem":"me-south-1","Australia/Sydney":"ap-southeast-2","Australia/Brisbane":"ap-southeast-2","Australia/Canberra":"ap-southeast-2","Australia/Melbourne":"ap-southeast-4","Australia/Hobart":"ap-southeast-4","Australia/Adelaide":"ap-southeast-4","Pacific/Auckland":"ap-southeast-2","Pacific/Honolulu":"us-west-1","Africa/Johannesburg":"af-south-1","Africa/Casablanca":"eu-south-2","Africa/Cairo":"me-south-1","Indian/Maldives":"ap-south-1"}),Ek=Object.freeze({Europe:"eu-central-1",America:"us-east-1",Asia:"ap-southeast-1",Australia:"ap-southeast-2",Pacific:"ap-southeast-2",Africa:"af-south-1",Atlantic:"eu-west-1",Indian:"ap-south-1"}),xk=Object.freeze({"af-south-1":"eu-west-1","ap-east-1":"ap-southeast-1","ap-southeast-3":"ap-southeast-1","ap-southeast-4":"ap-southeast-2","eu-central-2":"eu-central-1","eu-south-1":"eu-central-1","eu-south-2":"eu-west-3","me-central-1":"ap-south-1","me-south-1":"ap-south-1"});function id(e){return is.has(e)?xk[e]??Pn:e}to(id,"toDeployableRegion");function as(e){if(!e)return;let t=_k[e];if(t!==void 0)return id(t);let n=e.split("/")[0];if(n===void 0)return;let i=Ek[n];return i===void 0?void 0:id(i)}to(as,"suggestRegionForTimezone");var Ak=Object.defineProperty,ro=(e,t)=>Ak(e,"name",{value:t,configurable:!0});function ss(e){return Tt(e).replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}ro(ss,"slugifyAccountName");function kS(e,t){let n=ss(e),i=ss(t);return n===""?i:i===""?n:`${n}-${i}`}ro(kS,"defaultConnectedAccountName");function OS(e,t){let n=ss(t);return n===""?e:`${e}-${n}`}ro(OS,"suffixedAccountName");var DS=new Set(it.map(e=>Nn(e.code)));function MS(e){let t=e.toLowerCase().split(/[-\s_]+/).filter(i=>i.length>0),n=t[t.length-1];if(n!==void 0&&DS.has(n))return n}ro(MS,"findTrailingRegionShortCode");function jS(e){return`Account name must not end with a region code ("-${e}") \u2014 the region is added automatically when deploying. Remove the "-${e}" suffix.`}ro(jS,"regionSuffixRejectionMessage");var Ik=Object.defineProperty,wn=(e,t)=>Ik(e,"name",{value:t,configurable:!0});function vt(e){return e instanceof Error?e:new Error(String(e))}wn(vt,"normaliseError");function Rt(e){return e instanceof Error?e.message:typeof e=="string"?e:e&&typeof e=="object"&&"message"in e?String(e.message):"An unknown error occurred"}wn(Rt,"getErrorMessage");function cs(e,t){return!e||typeof e!="object"?!1:"code"in e&&e.code===t}wn(cs,"hasErrorCode");function no(e){if(!(!e||typeof e!="object")&&"code"in e&&typeof e.code=="string")return e.code}wn(no,"getErrorCode");function us(e){return e instanceof Error?e.stack:void 0}wn(us,"getErrorStack");function ls(e){let t=Rt(e),n=no(e);return n&&n!=="UNKNOWN_ERROR"?`[${n}] ${t}`:t}wn(ls,"formatErrorString");var $k=Object.defineProperty,Tk=(e,t)=>$k(e,"name",{value:t,configurable:!0});function zS(e){let t,n=!1;return()=>(n||(t=e(),n=!0),t)}Tk(zS,"singleton");var Rk=Object.defineProperty,od=(e,t)=>Rk(e,"name",{value:t,configurable:!0}),LS=new Set(["NODE_OPTIONS","NODE_PATH","NODE_EXTRA_CA_CERTS","NODE_DEBUG","NODE_PRESERVE_SYMLINKS","LD_PRELOAD","LD_LIBRARY_PATH","LD_AUDIT","LD_BIND_NOW","DYLD_INSERT_LIBRARIES","DYLD_LIBRARY_PATH","DYLD_FRAMEWORK_PATH","PYTHONPATH","PYTHONSTARTUP","PERL5LIB","PERL5OPT","RUBYLIB","RUBYOPT","HOME","XDG_CONFIG_HOME","AWS_SHARED_CREDENTIALS_FILE","AWS_CONFIG_FILE","SHELL","BASH_ENV","ENV","ZDOTDIR"]);function US(e){return Object.fromEntries(Object.entries(e).filter(([t])=>!LS.has(t.toUpperCase())))}od(US,"filterDangerousEnvVars");var Pk=/(fjall_(?:ak|dk)_)[A-Z2-7]{16}\.[A-Z2-7]{40}/g;function kn(e){return e.replace(/-----BEGIN [A-Z ]*PRIVATE KEY-----(?:[^"\\]|\\[\\nrt"])*?-----END [A-Z ]*PRIVATE KEY-----/g,"-----BEGIN [REDACTED] PRIVATE KEY-----...-----END [REDACTED] PRIVATE KEY-----").replace(/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/g,"-----BEGIN [REDACTED] PRIVATE KEY-----...-----END [REDACTED] PRIVATE KEY-----").replace(/(\w+:\/\/[^:]+:)[^@]+(@)/gi,"$1***$2").replace(/(?<![a-zA-Z])(password|passwd|secret|api[_-]?key|token|auth|credential)([=:])["']?[^\s"']+/gi,"$1$2***").replace(/\b(ghu_|ghs_|ghp_|gho_|github_pat_)[A-Za-z0-9_]+/g,"$1***").replace(/\b(sk|rk)_(live|test)_[A-Za-z0-9]{8,}/g,"$1_$2_***").replace(/\bwhsec_[A-Za-z0-9]{8,}/g,"whsec_***").replace(/(?<=Authorization:\s*Bearer\s+)[A-Za-z0-9._~+/=-]+/gi,"***").replace(/\b(AKIA|ASIA)[A-Z0-9]{12,}\b/g,"$1***").replace(/(?<=aws_secret_access_key\s*=\s*["']?|SecretAccessKey[=:]\s*|"(aws)?secretAccessKey":\s*"|"aws_secret_access_key":\s*")[A-Za-z0-9/+=]{40,}/gi,"***").replace(/(?<="(aws)?sessionToken":\s*"|"aws_session_token":\s*")[^"]+/gi,"***").replace(/(?<=aws_session_token\s*[=:]\s*["']?|SessionToken[=:]\s*["']?)[^\s"']+/gi,"***").replace(/(?<="(internal[Aa]piKey|fjallCallbackToken)":\s*")[^"]+/g,"***").replace(Pk,"$1***")}od(kn,"maskSensitiveOutput");function FS(e){let t=[],n="",i=!1,r=!1,o=!1,a=!1;for(let c of e){if(o){n+=c,o=!1;continue}if(c==="\\"&&!i){o=!0;continue}if(c==="'"&&!r){i=!i,a=!0;continue}if(c==='"'&&!i){r=!r,a=!0;continue}if(c===" "&&!i&&!r){(n||a)&&(t.push(n),n="",a=!1);continue}n+=c}if(i||r)throw new Error(`Unbalanced ${i?"single":"double"} quote in command: ${e.slice(0,80)}`);if(o)throw new Error(`Trailing backslash in command: ${e.slice(0,80)}`);return(n||a)&&t.push(n),t}od(FS,"parseShellArgs");var Ck=Object.defineProperty,Nk=(e,t)=>Ck(e,"name",{value:t,configurable:!0}),wk=Nk(e=>new Promise(t=>setTimeout(t,e)),"sleep");var kk=Object.defineProperty,BS=(e,t)=>kk(e,"name",{value:t,configurable:!0});async function VS(e,t,n){let i=new Array(e.length);if(e.length===0)return i;let r=Math.max(1,Math.min(t,e.length)),o=0,a=BS(async()=>{for(;o<e.length;){let c=o++;try{let u=await n(e[c],c);i[c]={status:"fulfilled",value:u}}catch(u){i[c]={status:"rejected",reason:u}}}},"worker");return await Promise.all(Array.from({length:r},()=>a())),i}BS(VS,"mapSettledWithConcurrency");var s={};$t(s,{$brand:()=>sd,$input:()=>Rp,$output:()=>Tp,NEVER:()=>ad,TimePrecision:()=>wp,ZodAny:()=>Eg,ZodArray:()=>$g,ZodBase64:()=>jc,ZodBase64URL:()=>zc,ZodBigInt:()=>li,ZodBigIntFormat:()=>Fc,ZodBoolean:()=>ui,ZodCIDRv4:()=>Dc,ZodCIDRv6:()=>Mc,ZodCUID:()=>Rc,ZodCUID2:()=>Pc,ZodCatch:()=>qg,ZodCodec:()=>Mo,ZodCustom:()=>jo,ZodCustomStringFormat:()=>si,ZodDate:()=>No,ZodDefault:()=>Bg,ZodDiscriminatedUnion:()=>Rg,ZodE164:()=>Lc,ZodEmail:()=>Ic,ZodEmoji:()=>$c,ZodEnum:()=>oi,ZodError:()=>l1,ZodExactOptional:()=>Lg,ZodFile:()=>jg,ZodFirstPartyTypeKind:()=>sh,ZodFunction:()=>ih,ZodGUID:()=>$o,ZodIPv4:()=>kc,ZodIPv6:()=>Oc,ZodISODate:()=>yc,ZodISODateTime:()=>bc,ZodISODuration:()=>_c,ZodISOTime:()=>Sc,ZodIntersection:()=>Pg,ZodIssueCode:()=>m1,ZodJWT:()=>Uc,ZodKSUID:()=>wc,ZodLazy:()=>th,ZodLiteral:()=>Mg,ZodMAC:()=>gg,ZodMap:()=>Og,ZodNaN:()=>Yg,ZodNanoID:()=>Tc,ZodNever:()=>Ag,ZodNonOptional:()=>Hc,ZodNull:()=>Sg,ZodNullable:()=>Fg,ZodNumber:()=>ci,ZodNumberFormat:()=>Qr,ZodObject:()=>ko,ZodOptional:()=>Wc,ZodPipe:()=>Do,ZodPrefault:()=>Zg,ZodPreprocess:()=>Xg,ZodPromise:()=>nh,ZodReadonly:()=>Jg,ZodRealError:()=>Ze,ZodRecord:()=>ii,ZodSet:()=>Dg,ZodString:()=>ai,ZodStringFormat:()=>K,ZodSuccess:()=>Hg,ZodSymbol:()=>bg,ZodTemplateLiteral:()=>eh,ZodTransform:()=>zg,ZodTuple:()=>Ng,ZodType:()=>w,ZodULID:()=>Cc,ZodURL:()=>Co,ZodUUID:()=>wt,ZodUndefined:()=>yg,ZodUnion:()=>Oo,ZodUnknown:()=>xg,ZodVoid:()=>Ig,ZodXID:()=>Nc,ZodXor:()=>Tg,_ZodString:()=>Ac,_default:()=>Vg,_function:()=>Nx,any:()=>cx,array:()=>wo,base64:()=>GE,base64url:()=>WE,bigint:()=>nx,boolean:()=>vg,catch:()=>Kg,check:()=>wx,cidrv4:()=>VE,cidrv6:()=>ZE,clone:()=>Oe,codec:()=>Tx,coerce:()=>ch,config:()=>se,core:()=>Jt,cuid:()=>DE,cuid2:()=>ME,custom:()=>kx,date:()=>lx,decode:()=>cg,decodeAsync:()=>lg,describe:()=>Ox,discriminatedUnion:()=>hx,e164:()=>HE,email:()=>IE,emoji:()=>kE,encode:()=>sg,encodeAsync:()=>ug,endsWith:()=>qn,enum:()=>Zc,exactOptional:()=>Ug,file:()=>xx,flattenError:()=>mo,float32:()=>QE,float64:()=>ex,formatError:()=>po,fromJSONSchema:()=>Fx,function:()=>Nx,getErrorMap:()=>f1,globalRegistry:()=>_e,gt:()=>Ct,gte:()=>Me,guid:()=>$E,hash:()=>JE,hex:()=>XE,hostname:()=>YE,httpUrl:()=>wE,includes:()=>Wn,instanceof:()=>Mx,int:()=>Ec,int32:()=>tx,int64:()=>ix,intersection:()=>Cg,invertCodec:()=>Rx,ipv4:()=>UE,ipv6:()=>BE,iso:()=>ni,json:()=>zx,jwt:()=>qE,keyof:()=>dx,ksuid:()=>LE,lazy:()=>rh,length:()=>Xr,literal:()=>Ex,locales:()=>_o,looseObject:()=>fx,looseRecord:()=>bx,lowercase:()=>Zn,lt:()=>Pt,lte:()=>Qe,mac:()=>FE,map:()=>yx,maxLength:()=>Yr,maxSize:()=>Er,meta:()=>Dx,mime:()=>Kn,minLength:()=>Xt,minSize:()=>Nt,multipleOf:()=>_r,nan:()=>$x,nanoid:()=>OE,nativeEnum:()=>_x,negative:()=>cc,never:()=>Bc,nonnegative:()=>lc,nonoptional:()=>Wg,nonpositive:()=>uc,normalize:()=>Yn,null:()=>_g,nullable:()=>Ro,nullish:()=>Ax,number:()=>hg,object:()=>mx,optional:()=>To,overwrite:()=>yt,parse:()=>ng,parseAsync:()=>ig,partialRecord:()=>vx,pipe:()=>xc,positive:()=>sc,prefault:()=>Gg,preprocess:()=>Lx,prettifyError:()=>Sd,promise:()=>Cx,property:()=>dc,readonly:()=>Qg,record:()=>kg,refine:()=>oh,regex:()=>Vn,regexes:()=>Je,registry:()=>Us,safeDecode:()=>mg,safeDecodeAsync:()=>fg,safeEncode:()=>dg,safeEncodeAsync:()=>pg,safeParse:()=>og,safeParseAsync:()=>ag,set:()=>Sx,setErrorMap:()=>p1,size:()=>Kr,slugify:()=>ei,startsWith:()=>Hn,strictObject:()=>px,string:()=>Io,stringFormat:()=>KE,stringbool:()=>jx,success:()=>Ix,superRefine:()=>ah,symbol:()=>ax,templateLiteral:()=>Px,toJSONSchema:()=>gc,toLowerCase:()=>Jn,toUpperCase:()=>Qn,transform:()=>Gc,treeifyError:()=>yd,trim:()=>Xn,tuple:()=>wg,uint32:()=>rx,uint64:()=>ox,ulid:()=>jE,undefined:()=>sx,union:()=>Vc,unknown:()=>Jr,uppercase:()=>Gn,url:()=>NE,util:()=>_,uuid:()=>TE,uuidv4:()=>RE,uuidv6:()=>PE,uuidv7:()=>CE,void:()=>ux,xid:()=>zE,xor:()=>gx});var Jt={};$t(Jt,{$ZodAny:()=>Km,$ZodArray:()=>ep,$ZodAsyncError:()=>bt,$ZodBase64:()=>Lm,$ZodBase64URL:()=>Um,$ZodBigInt:()=>ws,$ZodBigIntFormat:()=>Gm,$ZodBoolean:()=>vo,$ZodCIDRv4:()=>Mm,$ZodCIDRv6:()=>jm,$ZodCUID:()=>Am,$ZodCUID2:()=>Im,$ZodCatch:()=>bp,$ZodCheck:()=>X,$ZodCheckBigIntFormat:()=>em,$ZodCheckEndsWith:()=>mm,$ZodCheckGreaterThan:()=>$s,$ZodCheckIncludes:()=>lm,$ZodCheckLengthEquals:()=>am,$ZodCheckLessThan:()=>Is,$ZodCheckLowerCase:()=>cm,$ZodCheckMaxLength:()=>im,$ZodCheckMaxSize:()=>tm,$ZodCheckMimeType:()=>fm,$ZodCheckMinLength:()=>om,$ZodCheckMinSize:()=>rm,$ZodCheckMultipleOf:()=>Jd,$ZodCheckNumberFormat:()=>Qd,$ZodCheckOverwrite:()=>gm,$ZodCheckProperty:()=>pm,$ZodCheckRegex:()=>sm,$ZodCheckSizeEquals:()=>nm,$ZodCheckStartsWith:()=>dm,$ZodCheckStringFormat:()=>Fn,$ZodCheckUpperCase:()=>um,$ZodCodec:()=>yo,$ZodCustom:()=>$p,$ZodCustomStringFormat:()=>Vm,$ZodDate:()=>Qm,$ZodDefault:()=>fp,$ZodDiscriminatedUnion:()=>np,$ZodE164:()=>Fm,$ZodEmail:()=>Sm,$ZodEmoji:()=>Em,$ZodEncodeError:()=>hr,$ZodEnum:()=>cp,$ZodError:()=>lo,$ZodExactOptional:()=>mp,$ZodFile:()=>lp,$ZodFunction:()=>xp,$ZodGUID:()=>bm,$ZodIPv4:()=>km,$ZodIPv6:()=>Om,$ZodISODate:()=>Cm,$ZodISODateTime:()=>Pm,$ZodISODuration:()=>wm,$ZodISOTime:()=>Nm,$ZodIntersection:()=>ip,$ZodJWT:()=>Bm,$ZodKSUID:()=>Rm,$ZodLazy:()=>Ip,$ZodLiteral:()=>up,$ZodMAC:()=>Dm,$ZodMap:()=>ap,$ZodNaN:()=>yp,$ZodNanoID:()=>xm,$ZodNever:()=>Xm,$ZodNonOptional:()=>hp,$ZodNull:()=>qm,$ZodNullable:()=>pp,$ZodNumber:()=>Ns,$ZodNumberFormat:()=>Zm,$ZodObject:()=>S_,$ZodObjectJIT:()=>tp,$ZodOptional:()=>Os,$ZodPipe:()=>Ds,$ZodPrefault:()=>gp,$ZodPreprocess:()=>Sp,$ZodPromise:()=>Ap,$ZodReadonly:()=>_p,$ZodRealError:()=>Ve,$ZodRecord:()=>op,$ZodRegistry:()=>Ls,$ZodSet:()=>sp,$ZodString:()=>qr,$ZodStringFormat:()=>q,$ZodSuccess:()=>vp,$ZodSymbol:()=>Wm,$ZodTemplateLiteral:()=>Ep,$ZodTransform:()=>dp,$ZodTuple:()=>ks,$ZodType:()=>N,$ZodULID:()=>$m,$ZodURL:()=>_m,$ZodUUID:()=>ym,$ZodUndefined:()=>Hm,$ZodUnion:()=>bo,$ZodUnknown:()=>Ym,$ZodVoid:()=>Jm,$ZodXID:()=>Tm,$ZodXor:()=>rp,$brand:()=>sd,$constructor:()=>f,$input:()=>Rp,$output:()=>Tp,Doc:()=>ho,JSONSchema:()=>EE,JSONSchemaGenerator:()=>hc,NEVER:()=>ad,TimePrecision:()=>wp,_any:()=>Qp,_array:()=>sf,_base64:()=>nc,_base64url:()=>ic,_bigint:()=>Wp,_boolean:()=>Zp,_catch:()=>r1,_check:()=>_E,_cidrv4:()=>tc,_cidrv6:()=>rc,_coercedBigint:()=>Hp,_coercedBoolean:()=>Gp,_coercedDate:()=>of,_coercedNumber:()=>zp,_coercedString:()=>Cp,_cuid:()=>qs,_cuid2:()=>Ks,_custom:()=>uf,_date:()=>nf,_decode:()=>hs,_decodeAsync:()=>bs,_default:()=>QD,_discriminatedUnion:()=>FD,_e164:()=>oc,_email:()=>Fs,_emoji:()=>Ws,_encode:()=>gs,_encodeAsync:()=>vs,_endsWith:()=>qn,_enum:()=>HD,_file:()=>cf,_float32:()=>Up,_float64:()=>Fp,_gt:()=>Ct,_gte:()=>Me,_guid:()=>Eo,_includes:()=>Wn,_int:()=>Lp,_int32:()=>Bp,_int64:()=>qp,_intersection:()=>BD,_ipv4:()=>Qs,_ipv6:()=>ec,_isoDate:()=>Op,_isoDateTime:()=>kp,_isoDuration:()=>Mp,_isoTime:()=>Dp,_jwt:()=>ac,_ksuid:()=>Js,_lazy:()=>a1,_length:()=>Xr,_literal:()=>KD,_lowercase:()=>Zn,_lt:()=>Pt,_lte:()=>Qe,_mac:()=>Np,_map:()=>GD,_max:()=>Qe,_maxLength:()=>Yr,_maxSize:()=>Er,_mime:()=>Kn,_min:()=>Me,_minLength:()=>Xt,_minSize:()=>Nt,_multipleOf:()=>_r,_nan:()=>af,_nanoid:()=>Hs,_nativeEnum:()=>qD,_negative:()=>cc,_never:()=>tf,_nonnegative:()=>lc,_nonoptional:()=>e1,_nonpositive:()=>uc,_normalize:()=>Yn,_null:()=>Jp,_nullable:()=>JD,_number:()=>jp,_optional:()=>XD,_overwrite:()=>yt,_parse:()=>jn,_parseAsync:()=>zn,_pipe:()=>n1,_positive:()=>sc,_promise:()=>s1,_property:()=>dc,_readonly:()=>i1,_record:()=>ZD,_refine:()=>lf,_regex:()=>Vn,_safeDecode:()=>Ss,_safeDecodeAsync:()=>Es,_safeEncode:()=>ys,_safeEncodeAsync:()=>_s,_safeParse:()=>Ln,_safeParseAsync:()=>Un,_set:()=>WD,_size:()=>Kr,_slugify:()=>ei,_startsWith:()=>Hn,_string:()=>Pp,_stringFormat:()=>ti,_stringbool:()=>ff,_success:()=>t1,_superRefine:()=>df,_symbol:()=>Yp,_templateLiteral:()=>o1,_toLowerCase:()=>Jn,_toUpperCase:()=>Qn,_transform:()=>YD,_trim:()=>Xn,_tuple:()=>VD,_uint32:()=>Vp,_uint64:()=>Kp,_ulid:()=>Ys,_undefined:()=>Xp,_union:()=>LD,_unknown:()=>ef,_uppercase:()=>Gn,_url:()=>xo,_uuid:()=>Bs,_uuidv4:()=>Vs,_uuidv6:()=>Zs,_uuidv7:()=>Gs,_void:()=>rf,_xid:()=>Xs,_xor:()=>UD,clone:()=>Oe,config:()=>se,createStandardJSONSchemaMethod:()=>ri,createToJSONSchemaMethod:()=>gf,decode:()=>sO,decodeAsync:()=>uO,describe:()=>mf,encode:()=>aO,encodeAsync:()=>cO,extractDefs:()=>Ar,finalize:()=>Ir,flattenError:()=>mo,formatError:()=>po,globalConfig:()=>Gr,globalRegistry:()=>_e,initializeContext:()=>xr,isValidBase64:()=>zm,isValidBase64URL:()=>h_,isValidJWT:()=>v_,locales:()=>_o,meta:()=>pf,parse:()=>ps,parseAsync:()=>fs,prettifyError:()=>Sd,process:()=>Z,regexes:()=>Je,registry:()=>Us,safeDecode:()=>dO,safeDecodeAsync:()=>pO,safeEncode:()=>lO,safeEncodeAsync:()=>mO,safeParse:()=>_d,safeParseAsync:()=>Ed,toDotPath:()=>KS,toJSONSchema:()=>gc,treeifyError:()=>yd,util:()=>_,version:()=>hm});var ZS,ad=Object.freeze({status:"aborted"});function f(e,t,n){function i(c,u){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:u,constr:a,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,u);let l=a.prototype,m=Object.keys(l);for(let p=0;p<m.length;p++){let g=m[p];g in c||(c[g]=l[g].bind(c))}}let r=n?.Parent??Object;class o extends r{}Object.defineProperty(o,"name",{value:e});function a(c){var u;let l=n?.Parent?new o:this;i(l,c),(u=l._zod).deferred??(u.deferred=[]);for(let m of l._zod.deferred)m();return l}return Object.defineProperty(a,"init",{value:i}),Object.defineProperty(a,Symbol.hasInstance,{value:c=>n?.Parent&&c instanceof n.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}var sd=Symbol("zod_brand"),bt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},hr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(ZS=globalThis).__zod_globalConfig??(ZS.__zod_globalConfig={});var Gr=globalThis.__zod_globalConfig;function se(e){return e&&Object.assign(Gr,e),Gr}var _={};$t(_,{BIGINT_FORMAT_RANGES:()=>vd,Class:()=>ud,NUMBER_FORMAT_RANGES:()=>hd,aborted:()=>Sr,allowsEval:()=>md,assert:()=>zk,assertEqual:()=>Ok,assertIs:()=>Mk,assertNever:()=>jk,assertNotEqual:()=>Dk,assignProp:()=>br,base64ToUint8Array:()=>WS,base64urlToUint8Array:()=>tO,cached:()=>Dn,captureStackTrace:()=>ms,cleanEnum:()=>eO,cleanRegex:()=>ao,clone:()=>Oe,cloneDef:()=>Uk,createTransparentProxy:()=>Wk,defineLazy:()=>M,esc:()=>ds,escapeRegex:()=>ot,explicitlyAborted:()=>bd,extend:()=>Kk,finalizeIssue:()=>De,floatSafeRemainder:()=>ld,getElementAtPath:()=>Fk,getEnumValues:()=>oo,getLengthableOrigin:()=>uo,getParsedType:()=>Gk,getSizableOrigin:()=>co,hexToUint8Array:()=>nO,isObject:()=>Wr,isPlainObject:()=>yr,issue:()=>Mn,joinValues:()=>h,jsonStringifyReplacer:()=>On,merge:()=>Xk,mergeDefs:()=>Yt,normalizeParams:()=>E,nullish:()=>vr,numKeys:()=>Zk,objectClone:()=>Lk,omit:()=>qk,optionalKeys:()=>gd,parsedType:()=>S,partial:()=>Jk,pick:()=>Hk,prefixIssues:()=>Be,primitiveTypes:()=>fd,promiseAllObject:()=>Bk,propertyKeyTypes:()=>so,randomString:()=>Vk,required:()=>Qk,safeExtend:()=>Yk,shallowClone:()=>pd,slugify:()=>dd,stringifyPrimitive:()=>y,uint8ArrayToBase64:()=>HS,uint8ArrayToBase64url:()=>rO,uint8ArrayToHex:()=>iO,unwrapMessage:()=>io});function Ok(e){return e}function Dk(e){return e}function Mk(e){}function jk(e){throw new Error("Unexpected value in exhaustive check")}function zk(e){}function oo(e){let t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,r])=>t.indexOf(+i)===-1).map(([i,r])=>r)}function h(e,t="|"){return e.map(n=>y(n)).join(t)}function On(e,t){return typeof t=="bigint"?t.toString():t}function Dn(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw new Error("cached value already set")}}}function vr(e){return e==null}function ao(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function ld(e,t){let n=e/t,i=Math.round(n),r=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-i)<r?0:n-i}var GS=Symbol("evaluating");function M(e,t,n){let i;Object.defineProperty(e,t,{get(){if(i!==GS)return i===void 0&&(i=GS,i=n()),i},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function Lk(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function br(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Yt(...e){let t={};for(let n of e){let i=Object.getOwnPropertyDescriptors(n);Object.assign(t,i)}return Object.defineProperties({},t)}function Uk(e){return Yt(e._zod.def)}function Fk(e,t){return t?t.reduce((n,i)=>n?.[i],e):e}function Bk(e){let t=Object.keys(e),n=t.map(i=>e[i]);return Promise.all(n).then(i=>{let r={};for(let o=0;o<t.length;o++)r[t[o]]=i[o];return r})}function Vk(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let i=0;i<e;i++)n+=t[Math.floor(Math.random()*t.length)];return n}function ds(e){return JSON.stringify(e)}function dd(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ms="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Wr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var md=Dn(()=>{if(Gr.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function yr(e){if(Wr(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(Wr(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function pd(e){return yr(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Zk(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}var Gk=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}`)}},so=new Set(["string","number","symbol"]),fd=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ot(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Oe(e,t,n){let i=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(i._zod.parent=e),i}function E(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 Wk(e){let t;return new Proxy({},{get(n,i,r){return t??(t=e()),Reflect.get(t,i,r)},set(n,i,r,o){return t??(t=e()),Reflect.set(t,i,r,o)},has(n,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(n,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(n,i,r){return t??(t=e()),Reflect.defineProperty(t,i,r)}})}function y(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function gd(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var hd={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]},vd={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Hk(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o=Yt(e._zod.def,{get shape(){let a={};for(let c in t){if(!(c in n.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&(a[c]=n.shape[c])}return br(this,"shape",a),a},checks:[]});return Oe(e,o)}function qk(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=Yt(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let c in t){if(!(c in n.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&delete a[c]}return br(this,"shape",a),a},checks:[]});return Oe(e,o)}function Kk(e,t){if(!yr(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let o=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(o,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let r=Yt(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return br(this,"shape",o),o}});return Oe(e,r)}function Yk(e,t){if(!yr(t))throw new Error("Invalid input to safeExtend: expected a plain object");let n=Yt(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return br(this,"shape",i),i}});return Oe(e,n)}function Xk(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n=Yt(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t._zod.def.shape};return br(this,"shape",i),i},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Oe(e,n)}function Jk(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=Yt(t._zod.def,{get shape(){let c=t._zod.def.shape,u={...c};if(n)for(let l in n){if(!(l in c))throw new Error(`Unrecognized key: "${l}"`);n[l]&&(u[l]=e?new e({type:"optional",innerType:c[l]}):c[l])}else for(let l in c)u[l]=e?new e({type:"optional",innerType:c[l]}):c[l];return br(this,"shape",u),u},checks:[]});return Oe(t,a)}function Qk(e,t,n){let i=Yt(t._zod.def,{get shape(){let r=t._zod.def.shape,o={...r};if(n)for(let a in n){if(!(a in o))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(o[a]=new e({type:"nonoptional",innerType:r[a]}))}else for(let a in r)o[a]=new e({type:"nonoptional",innerType:r[a]});return br(this,"shape",o),o}});return Oe(t,i)}function Sr(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function bd(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Be(e,t){return t.map(n=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(e),n})}function io(e){return typeof e=="string"?e:e?.message}function De(e,t,n){let i=e.message?e.message:io(e.inst?._zod.def?.error?.(e))??io(t?.error?.(e))??io(n.customError?.(e))??io(n.localeError?.(e))??"Invalid input",{inst:r,continue:o,input:a,...c}=e;return c.path??(c.path=[]),c.message=i,t?.reportInput&&(c.input=a),c}function co(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function uo(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function S(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 n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function Mn(...e){let[t,n,i]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:i}:{...t}}function eO(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function WS(e){let t=atob(e),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n}function HS(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function tO(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return WS(t+n)}function rO(e){return HS(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function nO(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let i=0;i<t.length;i+=2)n[i/2]=Number.parseInt(t.slice(i,i+2),16);return n}function iO(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var ud=class{constructor(...t){}};var qS=(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,On,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},lo=f("$ZodError",qS),Ve=f("$ZodError",qS,{Parent:Error});function mo(e,t=n=>n.message){let n={},i=[];for(let r of e.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r))):i.push(t(r));return{formErrors:i,fieldErrors:n}}function po(e,t=n=>n.message){let n={_errors:[]},i=(r,o=[])=>{for(let a of r.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(c=>i({issues:c},[...o,...a.path]));else if(a.code==="invalid_key")i({issues:a.issues},[...o,...a.path]);else if(a.code==="invalid_element")i({issues:a.issues},[...o,...a.path]);else{let c=[...o,...a.path];if(c.length===0)n._errors.push(t(a));else{let u=n,l=0;for(;l<c.length;){let m=c[l];l===c.length-1?(u[m]=u[m]||{_errors:[]},u[m]._errors.push(t(a))):u[m]=u[m]||{_errors:[]},u=u[m],l++}}}};return i(e),n}function yd(e,t=n=>n.message){let n={errors:[]},i=(r,o=[])=>{var a,c;for(let u of r.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(l=>i({issues:l},[...o,...u.path]));else if(u.code==="invalid_key")i({issues:u.issues},[...o,...u.path]);else if(u.code==="invalid_element")i({issues:u.issues},[...o,...u.path]);else{let l=[...o,...u.path];if(l.length===0){n.errors.push(t(u));continue}let m=n,p=0;for(;p<l.length;){let g=l[p],v=p===l.length-1;typeof g=="string"?(m.properties??(m.properties={}),(a=m.properties)[g]??(a[g]={errors:[]}),m=m.properties[g]):(m.items??(m.items=[]),(c=m.items)[g]??(c[g]={errors:[]}),m=m.items[g]),v&&m.errors.push(t(u)),p++}}};return i(e),n}function KS(e){let t=[],n=e.map(i=>typeof i=="object"?i.key:i);for(let i of n)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 Sd(e){let t=[],n=[...e.issues].sort((i,r)=>(i.path??[]).length-(r.path??[]).length);for(let i of n)t.push(`\u2716 ${i.message}`),i.path?.length&&t.push(` \u2192 at ${KS(i.path)}`);return t.join(`
100
+ `),this.close()}_(t,n){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($w.hide):this.out.write(NF(this.outputText,this.out.columns)),super.render(),this.outputText=[Iw.symbol(this.done,this.aborted),Aw.bold(this.msg),Iw.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Aw.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(wF.line+$w.to(0)+this.outputText))}};Tw.exports=fS});var Cw=I((jJ,Pw)=>{"use strict";Pw.exports={TextPrompt:TN(),SelectPrompt:NN(),TogglePrompt:DN(),DatePrompt:sw(),NumberPrompt:dw(),MultiselectPrompt:uS(),AutocompletePrompt:yw(),AutocompleteMultiselectPrompt:xw(),ConfirmPrompt:Rw()}});var ww=I(Nw=>{"use strict";var Xe=Nw,kF=Cw(),Xl=e=>e;function Ht(e,t,n={}){return new Promise((i,r)=>{let o=new kF[e](t),a=n.onAbort||Xl,c=n.onSubmit||Xl,u=n.onExit||Xl;o.on("state",t.onState||Xl),o.on("submit",l=>i(c(l))),o.on("exit",l=>i(u(l))),o.on("abort",l=>r(a(l)))})}Xe.text=e=>Ht("TextPrompt",e);Xe.password=e=>(e.style="password",Xe.text(e));Xe.invisible=e=>(e.style="invisible",Xe.text(e));Xe.number=e=>Ht("NumberPrompt",e);Xe.date=e=>Ht("DatePrompt",e);Xe.confirm=e=>Ht("ConfirmPrompt",e);Xe.list=e=>{let t=e.separator||",";return Ht("TextPrompt",e,{onSubmit:n=>n.split(t).map(i=>i.trim())})};Xe.toggle=e=>Ht("TogglePrompt",e);Xe.select=e=>Ht("SelectPrompt",e);Xe.multiselect=e=>{e.choices=[].concat(e.choices||[]);let t=n=>n.filter(i=>i.selected).map(i=>i.value);return Ht("MultiselectPrompt",e,{onAbort:t,onSubmit:t})};Xe.autocompleteMultiselect=e=>{e.choices=[].concat(e.choices||[]);let t=n=>n.filter(i=>i.selected).map(i=>i.value);return Ht("AutocompleteMultiselectPrompt",e,{onAbort:t,onSubmit:t})};var OF=(e,t)=>Promise.resolve(t.filter(n=>n.title.slice(0,e.length).toLowerCase()===e.toLowerCase()));Xe.autocomplete=e=>(e.suggest=e.suggest||OF,e.choices=[].concat(e.choices||[]),Ht("AutocompletePrompt",e))});var Dw=I((LJ,Ow)=>{"use strict";var gS=ww(),DF=["suggest","format","onState","validate","onRender","type"],kw=()=>{};async function Fr(e=[],{onSubmit:t=kw,onCancel:n=kw}={}){let i={},r=Fr._override||{};e=[].concat(e);let o,a,c,u,l,m,p=async(g,v,A=!1)=>{if(!(!A&&g.validate&&g.validate(v)!==!0))return g.format?await g.format(v,i):v};for(a of e)if({name:u,type:l}=a,typeof l=="function"&&(l=await l(o,{...i},a),a.type=l),!!l){for(let g in a){if(DF.includes(g))continue;let v=a[g];a[g]=typeof v=="function"?await v(o,{...i},m):v}if(m=a,typeof a.message!="string")throw new Error("prompt message is required");if({name:u,type:l}=a,gS[l]===void 0)throw new Error(`prompt type (${l}) is not defined`);if(r[a.name]!==void 0&&(o=await p(a,r[a.name]),o!==void 0)){i[u]=o;continue}try{o=Fr._injected?MF(Fr._injected,a.initial):await gS[l](a),i[u]=o=await p(a,o,!0),c=await t(a,o,i)}catch{c=!await n(a,i)}if(c)return i}return i}function MF(e,t){let n=e.shift();if(n instanceof Error)throw n;return n===void 0?t:n}function jF(e){Fr._injected=(Fr._injected||[]).concat(e)}function zF(e){Fr._override=Object.assign({},e)}Ow.exports=Object.assign(Fr,{prompt:Fr,prompts:gS,inject:jF,override:zF})});var jw=I((UJ,Mw)=>{function LF(e){e=(Array.isArray(e)?e:e.split(".")).map(Number);let t=0,n=process.versions.node.split(".").map(Number);for(;t<e.length;t++){if(n[t]>e[t])return!1;if(e[t]>n[t])return!0}return!1}Mw.exports=LF("8.6.0")?sN():Dw()});import{join as ht,dirname as _S,normalize as Kw}from"node:path";import{readFileSync as Yw,existsSync as Xw}from"node:fs";var qw=Object.defineProperty,ke=(e,t)=>qw(e,"name",{value:t,configurable:!0}),Br="fjall";function Vr(e,t){let n=Kw(e);if(n.includes("..")||n.startsWith("/"))throw new Error(`Invalid ${t}: path traversal is not allowed`)}ke(Vr,"assertNoTraversal");function Jw(){return Br}ke(Jw,"getFjallPath");function Qw(e){let t=_S(e);return _S(t)||"."}ke(Qw,"getProjectRoot");function ES(e){if(!Xw(e))throw new Error(`Infrastructure file not found: ${e}`);let t=Yw(e,"utf-8").match(/const\s+appName\s*=\s*["']([^"']+)["']/);if(!t||!t[1])throw new Error(`Could not find appName in infrastructure file: ${e}. Expected format: const appName = "yourAppName";`);return t[1]}ke(ES,"getAppNameFromInfrastructure");function ek(e){let t=ht(e,ed);return ES(t)}ke(ek,"getAppName");function qt(e){return Vr(e,"app name"),ht(Br,e,ed)}ke(qt,"getInfrastructurePath");function tk(e){return Vr(e,"app name"),ht(Br,e)}ke(tk,"getAppPath");function rk(e){return Vr(e,"component name"),ht(Br,e)}ke(rk,"getOrganisationComponentPath");function nk(e){return Vr(e,"deployment type"),ht(Br,e,"logs")}ke(nk,"getDeploymentLogsPath");function ik(e){return Vr(e,"deployment type"),ht(Br,e,"logs","cloudformation")}ke(ik,"getCloudFormationLogsPath");function xS(){return ht(Br,"domains")}ke(xS,"getDomainsDir");function Ql(e){return Vr(e,"domain name"),ht(xS(),e)}ke(Ql,"getDomainComponentPath");function ok(e){return ht(Ql(e),ed)}ke(ok,"getDomainInfrastructurePath");function ak(e){return ht(Ql(e),sk)}ke(ak,"getDomainZoneFilePath");var ed="infrastructure.ts",sk="zone.bind",ck="cdk.out";function uk(e){return ht(e,ck)}ke(uk,"getCdkOutPath");var lk=Object.defineProperty,Tn=(e,t)=>lk(e,"name",{value:t,configurable:!0});function td(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}Tn(td,"escapeRegExp");function AS(e,t,n){let i=qt(t),r=e.read(i)?.toString();return r?new RegExp(`["']${td(n)}["']`).test(r):!1}Tn(AS,"resourceExists");function rd(e,t,n){let i=qt(t);if(!e.read(i)?.toString())throw new Error(`Infrastructure file not found for ${t}`);if(AS(e,t,n))throw new Error(`Resource name '${n}' already exists in ${t}. Please choose a different name or remove the existing resource first.`)}Tn(rd,"assertResourceNameUnique");function dk(e,t,n){let i=qt(t),r=e.read(i)?.toString();if(!r)return 0;let o={database:/DatabaseFactory\.build\(/g,compute:/ComputeFactory\.build\(/g,lambda:/type:\s*["']lambda["']/g,ecs:/type:\s*["']ecs["']/g,ec2:/type:\s*["']ec2["']/g}[n];if(!o)return 0;let a=r.match(o);return a?a.length:0}Tn(dk,"countResourcesOfType");function mk(e,t){let n=qt(t),i=e.read(n)?.toString();if(!i)return[];let r=[],o=i.matchAll(/ComputeFactory\.build\(["']([^"']+)["'],\s*\{([^}]*?)\}/gs);for(let a of o){let c=a[1],u=a[2],l="ecs";u.includes('type: "lambda"')?l="lambda":u.includes('type: "ec2"')&&(l="ec2");let m=u.includes("connections:"),p=[];if(m){let g=u.match(/connections:\s*\[([^\]]+)\]/);if(g){let v=g[1].match(/\w+/g)??[];p.push(...v)}}r.push({name:c,type:l,hasConnections:m,connectedResources:p})}return r}Tn(mk,"detectComputeResources");function pk(e,t,n){let i=qt(t),r=e.read(i)?.toString();return r?new RegExp(`databaseName:\\s*["']${td(n)}["']`).test(r):!1}Tn(pk,"databaseExists");import*as Yi from"fs";import*as tP from"path";var fk=Object.defineProperty,gr=(e,t)=>fk(e,"name",{value:t,configurable:!0});function $e(e){return e.replace(/[-_](.)/g,(t,n)=>n.toUpperCase()).replace(/^./,t=>t.toUpperCase())}gr($e,"toPascalCase");function Tt(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()}gr(Tt,"toKebab");function Rn(e){return Tt(e).replace(/-/g,"_")}gr(Rn,"toValidDatabaseName");function IS(e){return Tt(e).replace(/-/g,"_").toUpperCase()}gr(IS,"toScreamingSnake");function $S(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}gr($S,"capitalise");function TS(e){return e.split(".").join("")}gr(TS,"getSafeZoneName");function Zr(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}gr(Zr,"accountConstructKey");function RS(e){let t=e.replace(new RegExp("\\P{ASCII}","gu"),"");return Zr(t)===Zr(e)&&Zr(e)!==""}gr(RS,"hasAsciiStableConstructKey");var gk=Object.defineProperty,rs=(e,t)=>gk(e,"name",{value:t,configurable:!0});function ns(e){return`${$e(e.split(".").join(""))}Domain`}rs(ns,"getDomainStackName");function PS(e){return`${e}UsEast1Certificates`}rs(PS,"getDomainUsEast1CertificatesStackName");function nd(e){let t=e.replace(/\./g,"-");return{hostedZoneId:`${t}-hosted-zone-id`,certificateArn:`${t}-certificate-arn`,usEast1CertificateArn:`${t}-us-east-1-certificate-arn`,delegationRoleArn:`${t}-delegation-role-arn`,nameservers:`${t}-nameservers`}}rs(nd,"getDomainExportNames");function CS(e){return typeof e.hostedZoneId=="string"}rs(CS,"isManagedDomainBinding");var hk=Object.defineProperty,vk=(e,t)=>hk(e,"name",{value:t,configurable:!0});function NS(e){return`${$e(e)}ImageTag`}vk(NS,"imageTagParameterName");var bk=Object.defineProperty,yk=(e,t)=>bk(e,"name",{value:t,configurable:!0});function wS(e){let t=new Map;for(let n of e){let i=Zr(n);if(i==="")return{kind:"empty-construct-key",name:n};let r=t.get(i);if(r!==void 0)return{kind:"duplicate-construct-key",name:n,existingName:r,constructKey:i};t.set(i,n)}return null}yk(wS,"findAccountNameCollision");var Sk=Object.defineProperty,to=(e,t)=>Sk(e,"name",{value:t,configurable:!0}),Pn="us-east-2";var it=Object.freeze([{code:"us-east-2",name:"US East",city:"Ohio",country:"USA",optIn:!1},{code:"us-west-2",name:"US West",city:"Oregon",country:"USA",optIn:!1},{code:"us-east-1",name:"US East",city:"N. Virginia",country:"USA",optIn:!1},{code:"eu-west-1",name:"EU West",city:"Ireland",country:"Ireland",optIn:!1},{code:"eu-central-1",name:"EU Central",city:"Frankfurt",country:"Germany",optIn:!1},{code:"ap-southeast-1",name:"Asia Pacific",city:"Singapore",country:"Singapore",optIn:!1},{code:"ap-northeast-1",name:"Asia Pacific",city:"Tokyo",country:"Japan",optIn:!1},{code:"ap-southeast-2",name:"Asia Pacific",city:"Sydney",country:"Australia",optIn:!1},{code:"us-west-1",name:"US West",city:"N. California",country:"USA",optIn:!1},{code:"ca-central-1",name:"Canada",city:"Central",country:"Canada",optIn:!1},{code:"af-south-1",name:"Africa",city:"Cape Town",country:"South Africa",optIn:!0},{code:"ap-east-1",name:"Asia Pacific",city:"Hong Kong",country:"Hong Kong",optIn:!0},{code:"ap-northeast-2",name:"Asia Pacific",city:"Seoul",country:"South Korea",optIn:!1},{code:"ap-northeast-3",name:"Asia Pacific",city:"Osaka",country:"Japan",optIn:!1},{code:"ap-south-1",name:"Asia Pacific",city:"Mumbai",country:"India",optIn:!1},{code:"ap-south-2",name:"Asia Pacific",city:"Hyderabad",country:"India",optIn:!0},{code:"ap-southeast-3",name:"Asia Pacific",city:"Jakarta",country:"Indonesia",optIn:!0},{code:"ap-southeast-4",name:"Asia Pacific",city:"Melbourne",country:"Australia",optIn:!0},{code:"eu-central-2",name:"EU Central",city:"Zurich",country:"Switzerland",optIn:!0},{code:"eu-north-1",name:"EU North",city:"Stockholm",country:"Sweden",optIn:!1},{code:"eu-south-1",name:"EU South",city:"Milan",country:"Italy",optIn:!0},{code:"eu-south-2",name:"EU South",city:"Spain",country:"Spain",optIn:!0},{code:"eu-west-2",name:"EU West",city:"London",country:"UK",optIn:!1},{code:"eu-west-3",name:"EU West",city:"Paris",country:"France",optIn:!1},{code:"me-central-1",name:"Middle East",city:"UAE",country:"UAE",optIn:!0},{code:"me-south-1",name:"Middle East",city:"Bahrain",country:"Bahrain",optIn:!0},{code:"sa-east-1",name:"South America",city:"S\xE3o Paulo",country:"Brazil",optIn:!1},{code:"ap-southeast-5",name:"Asia Pacific",city:"Kuala Lumpur",country:"Malaysia",optIn:!0},{code:"ap-southeast-6",name:"Asia Pacific",city:"Auckland",country:"New Zealand",optIn:!0},{code:"ap-southeast-7",name:"Asia Pacific",city:"Bangkok",country:"Thailand",optIn:!0},{code:"ap-east-2",name:"Asia Pacific",city:"Taipei",country:"Taiwan",optIn:!0},{code:"ca-west-1",name:"Canada West",city:"Calgary",country:"Canada",optIn:!0},{code:"il-central-1",name:"Israel",city:"Tel Aviv",country:"Israel",optIn:!0},{code:"mx-central-1",name:"Mexico",city:"Central",country:"Mexico",optIn:!0}]),Kt=Object.freeze(it.map(e=>e.code)),is=new Set(it.filter(e=>e.optIn).map(e=>e.code));function os(e){return`${e} is an opt-in region: it must be enabled in the AWS account (Account settings \u2192 Regions) before deployment will succeed.`}to(os,"optInRegionWarning");function Cn(e){return it.find(t=>t.code===e)}to(Cn,"getRegionInfo");function Nn(e){let t=e.split("-");return t.length===3&&t[0]&&t[1]&&t[2]?`${t[0]}${t[1][0]}${t[2]}`:e}to(Nn,"abbreviateRegion");var _k=Object.freeze({"Europe/London":"eu-west-2","Europe/Jersey":"eu-west-2","Europe/Guernsey":"eu-west-2","Europe/Isle_of_Man":"eu-west-2","Europe/Dublin":"eu-west-1","Europe/Paris":"eu-west-3","Europe/Berlin":"eu-central-1","Europe/Amsterdam":"eu-central-1","Europe/Brussels":"eu-central-1","Europe/Luxembourg":"eu-central-1","Europe/Vienna":"eu-central-1","Europe/Prague":"eu-central-1","Europe/Warsaw":"eu-central-1","Europe/Budapest":"eu-central-1","Europe/Zurich":"eu-central-2","Europe/Stockholm":"eu-north-1","Europe/Oslo":"eu-north-1","Europe/Copenhagen":"eu-north-1","Europe/Helsinki":"eu-north-1","Europe/Tallinn":"eu-north-1","Europe/Riga":"eu-north-1","Europe/Vilnius":"eu-north-1","Europe/Rome":"eu-south-1","Europe/Malta":"eu-south-1","Europe/Athens":"eu-south-1","Europe/Madrid":"eu-south-2","Europe/Lisbon":"eu-south-2","America/New_York":"us-east-1","America/Detroit":"us-east-1","America/Toronto":"ca-central-1","America/Montreal":"ca-central-1","America/Halifax":"ca-central-1","America/Winnipeg":"ca-central-1","America/Chicago":"us-east-2","America/Indiana/Indianapolis":"us-east-2","America/Mexico_City":"us-east-2","America/Denver":"us-west-2","America/Phoenix":"us-west-2","America/Edmonton":"us-west-2","America/Vancouver":"us-west-2","America/Los_Angeles":"us-west-1","America/Tijuana":"us-west-1","America/Sao_Paulo":"sa-east-1","America/Argentina/Buenos_Aires":"sa-east-1","America/Santiago":"sa-east-1","America/Montevideo":"sa-east-1","America/Lima":"sa-east-1","America/Bogota":"us-east-1","Asia/Tokyo":"ap-northeast-1","Asia/Seoul":"ap-northeast-2","Asia/Hong_Kong":"ap-east-1","Asia/Shanghai":"ap-east-1","Asia/Taipei":"ap-east-1","Asia/Macau":"ap-east-1","Asia/Singapore":"ap-southeast-1","Asia/Kuala_Lumpur":"ap-southeast-1","Asia/Bangkok":"ap-southeast-1","Asia/Ho_Chi_Minh":"ap-southeast-1","Asia/Manila":"ap-southeast-1","Asia/Jakarta":"ap-southeast-3","Asia/Kolkata":"ap-south-1","Asia/Calcutta":"ap-south-1","Asia/Karachi":"ap-south-1","Asia/Dhaka":"ap-south-1","Asia/Colombo":"ap-south-1","Asia/Dubai":"me-central-1","Asia/Muscat":"me-central-1","Asia/Qatar":"me-south-1","Asia/Bahrain":"me-south-1","Asia/Riyadh":"me-south-1","Asia/Kuwait":"me-south-1","Asia/Jerusalem":"me-south-1","Australia/Sydney":"ap-southeast-2","Australia/Brisbane":"ap-southeast-2","Australia/Canberra":"ap-southeast-2","Australia/Melbourne":"ap-southeast-4","Australia/Hobart":"ap-southeast-4","Australia/Adelaide":"ap-southeast-4","Pacific/Auckland":"ap-southeast-2","Pacific/Honolulu":"us-west-1","Africa/Johannesburg":"af-south-1","Africa/Casablanca":"eu-south-2","Africa/Cairo":"me-south-1","Indian/Maldives":"ap-south-1"}),Ek=Object.freeze({Europe:"eu-central-1",America:"us-east-1",Asia:"ap-southeast-1",Australia:"ap-southeast-2",Pacific:"ap-southeast-2",Africa:"af-south-1",Atlantic:"eu-west-1",Indian:"ap-south-1"}),xk=Object.freeze({"af-south-1":"eu-west-1","ap-east-1":"ap-southeast-1","ap-southeast-3":"ap-southeast-1","ap-southeast-4":"ap-southeast-2","eu-central-2":"eu-central-1","eu-south-1":"eu-central-1","eu-south-2":"eu-west-3","me-central-1":"ap-south-1","me-south-1":"ap-south-1"});function id(e){return is.has(e)?xk[e]??Pn:e}to(id,"toDeployableRegion");function as(e){if(!e)return;let t=_k[e];if(t!==void 0)return id(t);let n=e.split("/")[0];if(n===void 0)return;let i=Ek[n];return i===void 0?void 0:id(i)}to(as,"suggestRegionForTimezone");var Ak=Object.defineProperty,ro=(e,t)=>Ak(e,"name",{value:t,configurable:!0});function ss(e){return Tt(e).replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}ro(ss,"slugifyAccountName");function kS(e,t){let n=ss(e),i=ss(t);return n===""?i:i===""?n:`${n}-${i}`}ro(kS,"defaultConnectedAccountName");function OS(e,t){let n=ss(t);return n===""?e:`${e}-${n}`}ro(OS,"suffixedAccountName");var DS=new Set(it.map(e=>Nn(e.code)));function MS(e){let t=e.toLowerCase().split(/[-\s_]+/).filter(i=>i.length>0),n=t[t.length-1];if(n!==void 0&&DS.has(n))return n}ro(MS,"findTrailingRegionShortCode");function jS(e){return`Account name must not end with a region code ("-${e}") \u2014 the region is added automatically when deploying. Remove the "-${e}" suffix.`}ro(jS,"regionSuffixRejectionMessage");var Ik=Object.defineProperty,wn=(e,t)=>Ik(e,"name",{value:t,configurable:!0});function vt(e){return e instanceof Error?e:new Error(String(e))}wn(vt,"normaliseError");function Rt(e){return e instanceof Error?e.message:typeof e=="string"?e:e&&typeof e=="object"&&"message"in e?String(e.message):"An unknown error occurred"}wn(Rt,"getErrorMessage");function cs(e,t){return!e||typeof e!="object"?!1:"code"in e&&e.code===t}wn(cs,"hasErrorCode");function no(e){if(!(!e||typeof e!="object")&&"code"in e&&typeof e.code=="string")return e.code}wn(no,"getErrorCode");function us(e){return e instanceof Error?e.stack:void 0}wn(us,"getErrorStack");function ls(e){let t=Rt(e),n=no(e);return n&&n!=="UNKNOWN_ERROR"?`[${n}] ${t}`:t}wn(ls,"formatErrorString");var $k=Object.defineProperty,Tk=(e,t)=>$k(e,"name",{value:t,configurable:!0});function zS(e){let t,n=!1;return()=>(n||(t=e(),n=!0),t)}Tk(zS,"singleton");var Rk=Object.defineProperty,od=(e,t)=>Rk(e,"name",{value:t,configurable:!0}),LS=new Set(["NODE_OPTIONS","NODE_PATH","NODE_EXTRA_CA_CERTS","NODE_DEBUG","NODE_PRESERVE_SYMLINKS","LD_PRELOAD","LD_LIBRARY_PATH","LD_AUDIT","LD_BIND_NOW","DYLD_INSERT_LIBRARIES","DYLD_LIBRARY_PATH","DYLD_FRAMEWORK_PATH","PYTHONPATH","PYTHONSTARTUP","PERL5LIB","PERL5OPT","RUBYLIB","RUBYOPT","HOME","XDG_CONFIG_HOME","AWS_SHARED_CREDENTIALS_FILE","AWS_CONFIG_FILE","SHELL","BASH_ENV","ENV","ZDOTDIR"]);function US(e){return Object.fromEntries(Object.entries(e).filter(([t])=>!LS.has(t.toUpperCase())))}od(US,"filterDangerousEnvVars");var Pk=/(fjall_(?:ak|dk)_)[A-Z2-7]{16}\.[A-Z2-7]{40}/g;function kn(e){return e.replace(/-----BEGIN [A-Z ]*PRIVATE KEY-----(?:[^"\\]|\\[\\nrt"])*?-----END [A-Z ]*PRIVATE KEY-----/g,"-----BEGIN [REDACTED] PRIVATE KEY-----...-----END [REDACTED] PRIVATE KEY-----").replace(/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/g,"-----BEGIN [REDACTED] PRIVATE KEY-----...-----END [REDACTED] PRIVATE KEY-----").replace(/(\w+:\/\/[^:]+:)[^@]+(@)/gi,"$1***$2").replace(/(?<![a-zA-Z])(password|passwd|secret|api[_-]?key|token|auth|credential)([=:])["']?[^\s"']+/gi,"$1$2***").replace(/\b(ghu_|ghs_|ghp_|gho_|github_pat_)[A-Za-z0-9_]+/g,"$1***").replace(/\b(sk|rk)_(live|test)_[A-Za-z0-9]{8,}/g,"$1_$2_***").replace(/\bwhsec_[A-Za-z0-9]{8,}/g,"whsec_***").replace(/(?<=Authorization:\s*Bearer\s+)[A-Za-z0-9._~+/=-]+/gi,"***").replace(/\b(AKIA|ASIA)[A-Z0-9]{12,}\b/g,"$1***").replace(/(?<=aws_secret_access_key\s*=\s*["']?|SecretAccessKey[=:]\s*|"(aws)?secretAccessKey":\s*"|"aws_secret_access_key":\s*")[A-Za-z0-9/+=]{40,}/gi,"***").replace(/(?<="(aws)?sessionToken":\s*"|"aws_session_token":\s*")[^"]+/gi,"***").replace(/(?<=aws_session_token\s*[=:]\s*["']?|SessionToken[=:]\s*["']?)[^\s"']+/gi,"***").replace(/(?<="(internal[Aa]piKey|fjallCallbackToken)":\s*")[^"]+/g,"***").replace(Pk,"$1***")}od(kn,"maskSensitiveOutput");function FS(e){let t=[],n="",i=!1,r=!1,o=!1,a=!1;for(let c of e){if(o){n+=c,o=!1;continue}if(c==="\\"&&!i){o=!0;continue}if(c==="'"&&!r){i=!i,a=!0;continue}if(c==='"'&&!i){r=!r,a=!0;continue}if(c===" "&&!i&&!r){(n||a)&&(t.push(n),n="",a=!1);continue}n+=c}if(i||r)throw new Error(`Unbalanced ${i?"single":"double"} quote in command: ${e.slice(0,80)}`);if(o)throw new Error(`Trailing backslash in command: ${e.slice(0,80)}`);return(n||a)&&t.push(n),t}od(FS,"parseShellArgs");var Ck=Object.defineProperty,Nk=(e,t)=>Ck(e,"name",{value:t,configurable:!0}),wk=Nk(e=>new Promise(t=>setTimeout(t,e)),"sleep");var kk=Object.defineProperty,BS=(e,t)=>kk(e,"name",{value:t,configurable:!0});async function VS(e,t,n){let i=new Array(e.length);if(e.length===0)return i;let r=Math.max(1,Math.min(t,e.length)),o=0,a=BS(async()=>{for(;o<e.length;){let c=o++;try{let u=await n(e[c],c);i[c]={status:"fulfilled",value:u}}catch(u){i[c]={status:"rejected",reason:u}}}},"worker");return await Promise.all(Array.from({length:r},()=>a())),i}BS(VS,"mapSettledWithConcurrency");var s={};$t(s,{$brand:()=>sd,$input:()=>Rp,$output:()=>Tp,NEVER:()=>ad,TimePrecision:()=>wp,ZodAny:()=>Eg,ZodArray:()=>$g,ZodBase64:()=>jc,ZodBase64URL:()=>zc,ZodBigInt:()=>li,ZodBigIntFormat:()=>Fc,ZodBoolean:()=>ui,ZodCIDRv4:()=>Dc,ZodCIDRv6:()=>Mc,ZodCUID:()=>Rc,ZodCUID2:()=>Pc,ZodCatch:()=>qg,ZodCodec:()=>Mo,ZodCustom:()=>jo,ZodCustomStringFormat:()=>si,ZodDate:()=>No,ZodDefault:()=>Bg,ZodDiscriminatedUnion:()=>Rg,ZodE164:()=>Lc,ZodEmail:()=>Ic,ZodEmoji:()=>$c,ZodEnum:()=>oi,ZodError:()=>l1,ZodExactOptional:()=>Lg,ZodFile:()=>jg,ZodFirstPartyTypeKind:()=>sh,ZodFunction:()=>ih,ZodGUID:()=>$o,ZodIPv4:()=>kc,ZodIPv6:()=>Oc,ZodISODate:()=>yc,ZodISODateTime:()=>bc,ZodISODuration:()=>_c,ZodISOTime:()=>Sc,ZodIntersection:()=>Pg,ZodIssueCode:()=>m1,ZodJWT:()=>Uc,ZodKSUID:()=>wc,ZodLazy:()=>th,ZodLiteral:()=>Mg,ZodMAC:()=>gg,ZodMap:()=>Og,ZodNaN:()=>Yg,ZodNanoID:()=>Tc,ZodNever:()=>Ag,ZodNonOptional:()=>Hc,ZodNull:()=>Sg,ZodNullable:()=>Fg,ZodNumber:()=>ci,ZodNumberFormat:()=>Qr,ZodObject:()=>ko,ZodOptional:()=>Wc,ZodPipe:()=>Do,ZodPrefault:()=>Zg,ZodPreprocess:()=>Xg,ZodPromise:()=>nh,ZodReadonly:()=>Jg,ZodRealError:()=>Ze,ZodRecord:()=>ii,ZodSet:()=>Dg,ZodString:()=>ai,ZodStringFormat:()=>K,ZodSuccess:()=>Hg,ZodSymbol:()=>bg,ZodTemplateLiteral:()=>eh,ZodTransform:()=>zg,ZodTuple:()=>Ng,ZodType:()=>w,ZodULID:()=>Cc,ZodURL:()=>Co,ZodUUID:()=>wt,ZodUndefined:()=>yg,ZodUnion:()=>Oo,ZodUnknown:()=>xg,ZodVoid:()=>Ig,ZodXID:()=>Nc,ZodXor:()=>Tg,_ZodString:()=>Ac,_default:()=>Vg,_function:()=>Nx,any:()=>cx,array:()=>wo,base64:()=>GE,base64url:()=>WE,bigint:()=>nx,boolean:()=>vg,catch:()=>Kg,check:()=>wx,cidrv4:()=>VE,cidrv6:()=>ZE,clone:()=>Oe,codec:()=>Tx,coerce:()=>ch,config:()=>se,core:()=>Jt,cuid:()=>DE,cuid2:()=>ME,custom:()=>kx,date:()=>lx,decode:()=>cg,decodeAsync:()=>lg,describe:()=>Ox,discriminatedUnion:()=>hx,e164:()=>HE,email:()=>IE,emoji:()=>kE,encode:()=>sg,encodeAsync:()=>ug,endsWith:()=>qn,enum:()=>Zc,exactOptional:()=>Ug,file:()=>xx,flattenError:()=>mo,float32:()=>QE,float64:()=>ex,formatError:()=>po,fromJSONSchema:()=>Fx,function:()=>Nx,getErrorMap:()=>f1,globalRegistry:()=>_e,gt:()=>Ct,gte:()=>Me,guid:()=>$E,hash:()=>JE,hex:()=>XE,hostname:()=>YE,httpUrl:()=>wE,includes:()=>Wn,instanceof:()=>Mx,int:()=>Ec,int32:()=>tx,int64:()=>ix,intersection:()=>Cg,invertCodec:()=>Rx,ipv4:()=>UE,ipv6:()=>BE,iso:()=>ni,json:()=>zx,jwt:()=>qE,keyof:()=>dx,ksuid:()=>LE,lazy:()=>rh,length:()=>Xr,literal:()=>Ex,locales:()=>_o,looseObject:()=>fx,looseRecord:()=>bx,lowercase:()=>Zn,lt:()=>Pt,lte:()=>Qe,mac:()=>FE,map:()=>yx,maxLength:()=>Yr,maxSize:()=>Er,meta:()=>Dx,mime:()=>Kn,minLength:()=>Xt,minSize:()=>Nt,multipleOf:()=>_r,nan:()=>$x,nanoid:()=>OE,nativeEnum:()=>_x,negative:()=>cc,never:()=>Bc,nonnegative:()=>lc,nonoptional:()=>Wg,nonpositive:()=>uc,normalize:()=>Yn,null:()=>_g,nullable:()=>Ro,nullish:()=>Ax,number:()=>hg,object:()=>mx,optional:()=>To,overwrite:()=>yt,parse:()=>ng,parseAsync:()=>ig,partialRecord:()=>vx,pipe:()=>xc,positive:()=>sc,prefault:()=>Gg,preprocess:()=>Lx,prettifyError:()=>Sd,promise:()=>Cx,property:()=>dc,readonly:()=>Qg,record:()=>kg,refine:()=>oh,regex:()=>Vn,regexes:()=>Je,registry:()=>Us,safeDecode:()=>mg,safeDecodeAsync:()=>fg,safeEncode:()=>dg,safeEncodeAsync:()=>pg,safeParse:()=>og,safeParseAsync:()=>ag,set:()=>Sx,setErrorMap:()=>p1,size:()=>Kr,slugify:()=>ei,startsWith:()=>Hn,strictObject:()=>px,string:()=>Io,stringFormat:()=>KE,stringbool:()=>jx,success:()=>Ix,superRefine:()=>ah,symbol:()=>ax,templateLiteral:()=>Px,toJSONSchema:()=>gc,toLowerCase:()=>Jn,toUpperCase:()=>Qn,transform:()=>Gc,treeifyError:()=>yd,trim:()=>Xn,tuple:()=>wg,uint32:()=>rx,uint64:()=>ox,ulid:()=>jE,undefined:()=>sx,union:()=>Vc,unknown:()=>Jr,uppercase:()=>Gn,url:()=>NE,util:()=>_,uuid:()=>TE,uuidv4:()=>RE,uuidv6:()=>PE,uuidv7:()=>CE,void:()=>ux,xid:()=>zE,xor:()=>gx});var Jt={};$t(Jt,{$ZodAny:()=>Km,$ZodArray:()=>ep,$ZodAsyncError:()=>bt,$ZodBase64:()=>Lm,$ZodBase64URL:()=>Um,$ZodBigInt:()=>ws,$ZodBigIntFormat:()=>Gm,$ZodBoolean:()=>vo,$ZodCIDRv4:()=>Mm,$ZodCIDRv6:()=>jm,$ZodCUID:()=>Am,$ZodCUID2:()=>Im,$ZodCatch:()=>bp,$ZodCheck:()=>X,$ZodCheckBigIntFormat:()=>em,$ZodCheckEndsWith:()=>mm,$ZodCheckGreaterThan:()=>$s,$ZodCheckIncludes:()=>lm,$ZodCheckLengthEquals:()=>am,$ZodCheckLessThan:()=>Is,$ZodCheckLowerCase:()=>cm,$ZodCheckMaxLength:()=>im,$ZodCheckMaxSize:()=>tm,$ZodCheckMimeType:()=>fm,$ZodCheckMinLength:()=>om,$ZodCheckMinSize:()=>rm,$ZodCheckMultipleOf:()=>Jd,$ZodCheckNumberFormat:()=>Qd,$ZodCheckOverwrite:()=>gm,$ZodCheckProperty:()=>pm,$ZodCheckRegex:()=>sm,$ZodCheckSizeEquals:()=>nm,$ZodCheckStartsWith:()=>dm,$ZodCheckStringFormat:()=>Fn,$ZodCheckUpperCase:()=>um,$ZodCodec:()=>yo,$ZodCustom:()=>$p,$ZodCustomStringFormat:()=>Vm,$ZodDate:()=>Qm,$ZodDefault:()=>fp,$ZodDiscriminatedUnion:()=>np,$ZodE164:()=>Fm,$ZodEmail:()=>Sm,$ZodEmoji:()=>Em,$ZodEncodeError:()=>hr,$ZodEnum:()=>cp,$ZodError:()=>lo,$ZodExactOptional:()=>mp,$ZodFile:()=>lp,$ZodFunction:()=>xp,$ZodGUID:()=>bm,$ZodIPv4:()=>km,$ZodIPv6:()=>Om,$ZodISODate:()=>Cm,$ZodISODateTime:()=>Pm,$ZodISODuration:()=>wm,$ZodISOTime:()=>Nm,$ZodIntersection:()=>ip,$ZodJWT:()=>Bm,$ZodKSUID:()=>Rm,$ZodLazy:()=>Ip,$ZodLiteral:()=>up,$ZodMAC:()=>Dm,$ZodMap:()=>ap,$ZodNaN:()=>yp,$ZodNanoID:()=>xm,$ZodNever:()=>Xm,$ZodNonOptional:()=>hp,$ZodNull:()=>qm,$ZodNullable:()=>pp,$ZodNumber:()=>Ns,$ZodNumberFormat:()=>Zm,$ZodObject:()=>S_,$ZodObjectJIT:()=>tp,$ZodOptional:()=>Os,$ZodPipe:()=>Ds,$ZodPrefault:()=>gp,$ZodPreprocess:()=>Sp,$ZodPromise:()=>Ap,$ZodReadonly:()=>_p,$ZodRealError:()=>Ve,$ZodRecord:()=>op,$ZodRegistry:()=>Ls,$ZodSet:()=>sp,$ZodString:()=>qr,$ZodStringFormat:()=>q,$ZodSuccess:()=>vp,$ZodSymbol:()=>Wm,$ZodTemplateLiteral:()=>Ep,$ZodTransform:()=>dp,$ZodTuple:()=>ks,$ZodType:()=>N,$ZodULID:()=>$m,$ZodURL:()=>_m,$ZodUUID:()=>ym,$ZodUndefined:()=>Hm,$ZodUnion:()=>bo,$ZodUnknown:()=>Ym,$ZodVoid:()=>Jm,$ZodXID:()=>Tm,$ZodXor:()=>rp,$brand:()=>sd,$constructor:()=>f,$input:()=>Rp,$output:()=>Tp,Doc:()=>ho,JSONSchema:()=>EE,JSONSchemaGenerator:()=>hc,NEVER:()=>ad,TimePrecision:()=>wp,_any:()=>Qp,_array:()=>sf,_base64:()=>nc,_base64url:()=>ic,_bigint:()=>Wp,_boolean:()=>Zp,_catch:()=>r1,_check:()=>_E,_cidrv4:()=>tc,_cidrv6:()=>rc,_coercedBigint:()=>Hp,_coercedBoolean:()=>Gp,_coercedDate:()=>of,_coercedNumber:()=>zp,_coercedString:()=>Cp,_cuid:()=>qs,_cuid2:()=>Ks,_custom:()=>uf,_date:()=>nf,_decode:()=>hs,_decodeAsync:()=>bs,_default:()=>QD,_discriminatedUnion:()=>FD,_e164:()=>oc,_email:()=>Fs,_emoji:()=>Ws,_encode:()=>gs,_encodeAsync:()=>vs,_endsWith:()=>qn,_enum:()=>HD,_file:()=>cf,_float32:()=>Up,_float64:()=>Fp,_gt:()=>Ct,_gte:()=>Me,_guid:()=>Eo,_includes:()=>Wn,_int:()=>Lp,_int32:()=>Bp,_int64:()=>qp,_intersection:()=>BD,_ipv4:()=>Qs,_ipv6:()=>ec,_isoDate:()=>Op,_isoDateTime:()=>kp,_isoDuration:()=>Mp,_isoTime:()=>Dp,_jwt:()=>ac,_ksuid:()=>Js,_lazy:()=>a1,_length:()=>Xr,_literal:()=>KD,_lowercase:()=>Zn,_lt:()=>Pt,_lte:()=>Qe,_mac:()=>Np,_map:()=>GD,_max:()=>Qe,_maxLength:()=>Yr,_maxSize:()=>Er,_mime:()=>Kn,_min:()=>Me,_minLength:()=>Xt,_minSize:()=>Nt,_multipleOf:()=>_r,_nan:()=>af,_nanoid:()=>Hs,_nativeEnum:()=>qD,_negative:()=>cc,_never:()=>tf,_nonnegative:()=>lc,_nonoptional:()=>e1,_nonpositive:()=>uc,_normalize:()=>Yn,_null:()=>Jp,_nullable:()=>JD,_number:()=>jp,_optional:()=>XD,_overwrite:()=>yt,_parse:()=>jn,_parseAsync:()=>zn,_pipe:()=>n1,_positive:()=>sc,_promise:()=>s1,_property:()=>dc,_readonly:()=>i1,_record:()=>ZD,_refine:()=>lf,_regex:()=>Vn,_safeDecode:()=>Ss,_safeDecodeAsync:()=>Es,_safeEncode:()=>ys,_safeEncodeAsync:()=>_s,_safeParse:()=>Ln,_safeParseAsync:()=>Un,_set:()=>WD,_size:()=>Kr,_slugify:()=>ei,_startsWith:()=>Hn,_string:()=>Pp,_stringFormat:()=>ti,_stringbool:()=>ff,_success:()=>t1,_superRefine:()=>df,_symbol:()=>Yp,_templateLiteral:()=>o1,_toLowerCase:()=>Jn,_toUpperCase:()=>Qn,_transform:()=>YD,_trim:()=>Xn,_tuple:()=>VD,_uint32:()=>Vp,_uint64:()=>Kp,_ulid:()=>Ys,_undefined:()=>Xp,_union:()=>LD,_unknown:()=>ef,_uppercase:()=>Gn,_url:()=>xo,_uuid:()=>Bs,_uuidv4:()=>Vs,_uuidv6:()=>Zs,_uuidv7:()=>Gs,_void:()=>rf,_xid:()=>Xs,_xor:()=>UD,clone:()=>Oe,config:()=>se,createStandardJSONSchemaMethod:()=>ri,createToJSONSchemaMethod:()=>gf,decode:()=>sO,decodeAsync:()=>uO,describe:()=>mf,encode:()=>aO,encodeAsync:()=>cO,extractDefs:()=>Ar,finalize:()=>Ir,flattenError:()=>mo,formatError:()=>po,globalConfig:()=>Gr,globalRegistry:()=>_e,initializeContext:()=>xr,isValidBase64:()=>zm,isValidBase64URL:()=>h_,isValidJWT:()=>v_,locales:()=>_o,meta:()=>pf,parse:()=>ps,parseAsync:()=>fs,prettifyError:()=>Sd,process:()=>Z,regexes:()=>Je,registry:()=>Us,safeDecode:()=>dO,safeDecodeAsync:()=>pO,safeEncode:()=>lO,safeEncodeAsync:()=>mO,safeParse:()=>_d,safeParseAsync:()=>Ed,toDotPath:()=>KS,toJSONSchema:()=>gc,treeifyError:()=>yd,util:()=>_,version:()=>hm});var ZS,ad=Object.freeze({status:"aborted"});function f(e,t,n){function i(c,u){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:u,constr:a,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,u);let l=a.prototype,m=Object.keys(l);for(let p=0;p<m.length;p++){let g=m[p];g in c||(c[g]=l[g].bind(c))}}let r=n?.Parent??Object;class o extends r{}Object.defineProperty(o,"name",{value:e});function a(c){var u;let l=n?.Parent?new o:this;i(l,c),(u=l._zod).deferred??(u.deferred=[]);for(let m of l._zod.deferred)m();return l}return Object.defineProperty(a,"init",{value:i}),Object.defineProperty(a,Symbol.hasInstance,{value:c=>n?.Parent&&c instanceof n.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}var sd=Symbol("zod_brand"),bt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},hr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(ZS=globalThis).__zod_globalConfig??(ZS.__zod_globalConfig={});var Gr=globalThis.__zod_globalConfig;function se(e){return e&&Object.assign(Gr,e),Gr}var _={};$t(_,{BIGINT_FORMAT_RANGES:()=>vd,Class:()=>ud,NUMBER_FORMAT_RANGES:()=>hd,aborted:()=>Sr,allowsEval:()=>md,assert:()=>zk,assertEqual:()=>Ok,assertIs:()=>Mk,assertNever:()=>jk,assertNotEqual:()=>Dk,assignProp:()=>br,base64ToUint8Array:()=>WS,base64urlToUint8Array:()=>tO,cached:()=>Dn,captureStackTrace:()=>ms,cleanEnum:()=>eO,cleanRegex:()=>ao,clone:()=>Oe,cloneDef:()=>Uk,createTransparentProxy:()=>Wk,defineLazy:()=>M,esc:()=>ds,escapeRegex:()=>ot,explicitlyAborted:()=>bd,extend:()=>Kk,finalizeIssue:()=>De,floatSafeRemainder:()=>ld,getElementAtPath:()=>Fk,getEnumValues:()=>oo,getLengthableOrigin:()=>uo,getParsedType:()=>Gk,getSizableOrigin:()=>co,hexToUint8Array:()=>nO,isObject:()=>Wr,isPlainObject:()=>yr,issue:()=>Mn,joinValues:()=>h,jsonStringifyReplacer:()=>On,merge:()=>Xk,mergeDefs:()=>Yt,normalizeParams:()=>E,nullish:()=>vr,numKeys:()=>Zk,objectClone:()=>Lk,omit:()=>qk,optionalKeys:()=>gd,parsedType:()=>S,partial:()=>Jk,pick:()=>Hk,prefixIssues:()=>Be,primitiveTypes:()=>fd,promiseAllObject:()=>Bk,propertyKeyTypes:()=>so,randomString:()=>Vk,required:()=>Qk,safeExtend:()=>Yk,shallowClone:()=>pd,slugify:()=>dd,stringifyPrimitive:()=>y,uint8ArrayToBase64:()=>HS,uint8ArrayToBase64url:()=>rO,uint8ArrayToHex:()=>iO,unwrapMessage:()=>io});function Ok(e){return e}function Dk(e){return e}function Mk(e){}function jk(e){throw new Error("Unexpected value in exhaustive check")}function zk(e){}function oo(e){let t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,r])=>t.indexOf(+i)===-1).map(([i,r])=>r)}function h(e,t="|"){return e.map(n=>y(n)).join(t)}function On(e,t){return typeof t=="bigint"?t.toString():t}function Dn(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw new Error("cached value already set")}}}function vr(e){return e==null}function ao(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function ld(e,t){let n=e/t,i=Math.round(n),r=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-i)<r?0:n-i}var GS=Symbol("evaluating");function M(e,t,n){let i;Object.defineProperty(e,t,{get(){if(i!==GS)return i===void 0&&(i=GS,i=n()),i},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function Lk(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function br(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Yt(...e){let t={};for(let n of e){let i=Object.getOwnPropertyDescriptors(n);Object.assign(t,i)}return Object.defineProperties({},t)}function Uk(e){return Yt(e._zod.def)}function Fk(e,t){return t?t.reduce((n,i)=>n?.[i],e):e}function Bk(e){let t=Object.keys(e),n=t.map(i=>e[i]);return Promise.all(n).then(i=>{let r={};for(let o=0;o<t.length;o++)r[t[o]]=i[o];return r})}function Vk(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let i=0;i<e;i++)n+=t[Math.floor(Math.random()*t.length)];return n}function ds(e){return JSON.stringify(e)}function dd(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ms="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Wr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var md=Dn(()=>{if(Gr.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function yr(e){if(Wr(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(Wr(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function pd(e){return yr(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Zk(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}var Gk=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}`)}},so=new Set(["string","number","symbol"]),fd=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ot(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Oe(e,t,n){let i=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(i._zod.parent=e),i}function E(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 Wk(e){let t;return new Proxy({},{get(n,i,r){return t??(t=e()),Reflect.get(t,i,r)},set(n,i,r,o){return t??(t=e()),Reflect.set(t,i,r,o)},has(n,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(n,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(n,i,r){return t??(t=e()),Reflect.defineProperty(t,i,r)}})}function y(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function gd(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var hd={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]},vd={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Hk(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o=Yt(e._zod.def,{get shape(){let a={};for(let c in t){if(!(c in n.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&(a[c]=n.shape[c])}return br(this,"shape",a),a},checks:[]});return Oe(e,o)}function qk(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=Yt(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let c in t){if(!(c in n.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&delete a[c]}return br(this,"shape",a),a},checks:[]});return Oe(e,o)}function Kk(e,t){if(!yr(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let o=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(o,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let r=Yt(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return br(this,"shape",o),o}});return Oe(e,r)}function Yk(e,t){if(!yr(t))throw new Error("Invalid input to safeExtend: expected a plain object");let n=Yt(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return br(this,"shape",i),i}});return Oe(e,n)}function Xk(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n=Yt(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t._zod.def.shape};return br(this,"shape",i),i},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Oe(e,n)}function Jk(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=Yt(t._zod.def,{get shape(){let c=t._zod.def.shape,u={...c};if(n)for(let l in n){if(!(l in c))throw new Error(`Unrecognized key: "${l}"`);n[l]&&(u[l]=e?new e({type:"optional",innerType:c[l]}):c[l])}else for(let l in c)u[l]=e?new e({type:"optional",innerType:c[l]}):c[l];return br(this,"shape",u),u},checks:[]});return Oe(t,a)}function Qk(e,t,n){let i=Yt(t._zod.def,{get shape(){let r=t._zod.def.shape,o={...r};if(n)for(let a in n){if(!(a in o))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(o[a]=new e({type:"nonoptional",innerType:r[a]}))}else for(let a in r)o[a]=new e({type:"nonoptional",innerType:r[a]});return br(this,"shape",o),o}});return Oe(t,i)}function Sr(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function bd(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Be(e,t){return t.map(n=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(e),n})}function io(e){return typeof e=="string"?e:e?.message}function De(e,t,n){let i=e.message?e.message:io(e.inst?._zod.def?.error?.(e))??io(t?.error?.(e))??io(n.customError?.(e))??io(n.localeError?.(e))??"Invalid input",{inst:r,continue:o,input:a,...c}=e;return c.path??(c.path=[]),c.message=i,t?.reportInput&&(c.input=a),c}function co(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function uo(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function S(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 n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function Mn(...e){let[t,n,i]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:i}:{...t}}function eO(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function WS(e){let t=atob(e),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n}function HS(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function tO(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return WS(t+n)}function rO(e){return HS(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function nO(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let i=0;i<t.length;i+=2)n[i/2]=Number.parseInt(t.slice(i,i+2),16);return n}function iO(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var ud=class{constructor(...t){}};var qS=(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,On,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},lo=f("$ZodError",qS),Ve=f("$ZodError",qS,{Parent:Error});function mo(e,t=n=>n.message){let n={},i=[];for(let r of e.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r))):i.push(t(r));return{formErrors:i,fieldErrors:n}}function po(e,t=n=>n.message){let n={_errors:[]},i=(r,o=[])=>{for(let a of r.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(c=>i({issues:c},[...o,...a.path]));else if(a.code==="invalid_key")i({issues:a.issues},[...o,...a.path]);else if(a.code==="invalid_element")i({issues:a.issues},[...o,...a.path]);else{let c=[...o,...a.path];if(c.length===0)n._errors.push(t(a));else{let u=n,l=0;for(;l<c.length;){let m=c[l];l===c.length-1?(u[m]=u[m]||{_errors:[]},u[m]._errors.push(t(a))):u[m]=u[m]||{_errors:[]},u=u[m],l++}}}};return i(e),n}function yd(e,t=n=>n.message){let n={errors:[]},i=(r,o=[])=>{var a,c;for(let u of r.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(l=>i({issues:l},[...o,...u.path]));else if(u.code==="invalid_key")i({issues:u.issues},[...o,...u.path]);else if(u.code==="invalid_element")i({issues:u.issues},[...o,...u.path]);else{let l=[...o,...u.path];if(l.length===0){n.errors.push(t(u));continue}let m=n,p=0;for(;p<l.length;){let g=l[p],v=p===l.length-1;typeof g=="string"?(m.properties??(m.properties={}),(a=m.properties)[g]??(a[g]={errors:[]}),m=m.properties[g]):(m.items??(m.items=[]),(c=m.items)[g]??(c[g]={errors:[]}),m=m.items[g]),v&&m.errors.push(t(u)),p++}}};return i(e),n}function KS(e){let t=[],n=e.map(i=>typeof i=="object"?i.key:i);for(let i of n)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 Sd(e){let t=[],n=[...e.issues].sort((i,r)=>(i.path??[]).length-(r.path??[]).length);for(let i of n)t.push(`\u2716 ${i.message}`),i.path?.length&&t.push(` \u2192 at ${KS(i.path)}`);return t.join(`
101
101
  `)}var jn=e=>(t,n,i,r)=>{let o=i?{...i,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise)throw new bt;if(a.issues.length){let c=new(r?.Err??e)(a.issues.map(u=>De(u,o,se())));throw ms(c,r?.callee),c}return a.value},ps=jn(Ve),zn=e=>async(t,n,i,r)=>{let o=i?{...i,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(r?.Err??e)(a.issues.map(u=>De(u,o,se())));throw ms(c,r?.callee),c}return a.value},fs=zn(Ve),Ln=e=>(t,n,i)=>{let r=i?{...i,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},r);if(o instanceof Promise)throw new bt;return o.issues.length?{success:!1,error:new(e??lo)(o.issues.map(a=>De(a,r,se())))}:{success:!0,data:o.value}},_d=Ln(Ve),Un=e=>async(t,n,i)=>{let r=i?{...i,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},r);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(a=>De(a,r,se())))}:{success:!0,data:o.value}},Ed=Un(Ve),gs=e=>(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return jn(e)(t,n,r)},aO=gs(Ve),hs=e=>(t,n,i)=>jn(e)(t,n,i),sO=hs(Ve),vs=e=>async(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return zn(e)(t,n,r)},cO=vs(Ve),bs=e=>async(t,n,i)=>zn(e)(t,n,i),uO=bs(Ve),ys=e=>(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return Ln(e)(t,n,r)},lO=ys(Ve),Ss=e=>(t,n,i)=>Ln(e)(t,n,i),dO=Ss(Ve),_s=e=>async(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return Un(e)(t,n,r)},mO=_s(Ve),Es=e=>async(t,n,i)=>Un(e)(t,n,i),pO=Es(Ve);var Je={};$t(Je,{base64:()=>zd,base64url:()=>xs,bigint:()=>Gd,boolean:()=>Hd,browserEmail:()=>_O,cidrv4:()=>Md,cidrv6:()=>jd,cuid:()=>xd,cuid2:()=>Ad,date:()=>Fd,datetime:()=>Vd,domain:()=>AO,duration:()=>Pd,e164:()=>Ud,email:()=>Nd,emoji:()=>wd,extendedDuration:()=>fO,guid:()=>Cd,hex:()=>IO,hostname:()=>xO,html5Email:()=>bO,httpProtocol:()=>Ld,idnEmail:()=>SO,integer:()=>Wd,ipv4:()=>kd,ipv6:()=>Od,ksuid:()=>Td,lowercase:()=>Yd,mac:()=>Dd,md5_base64:()=>TO,md5_base64url:()=>RO,md5_hex:()=>$O,nanoid:()=>Rd,null:()=>qd,number:()=>As,rfc5322Email:()=>yO,sha1_base64:()=>CO,sha1_base64url:()=>NO,sha1_hex:()=>PO,sha256_base64:()=>kO,sha256_base64url:()=>OO,sha256_hex:()=>wO,sha384_base64:()=>MO,sha384_base64url:()=>jO,sha384_hex:()=>DO,sha512_base64:()=>LO,sha512_base64url:()=>UO,sha512_hex:()=>zO,string:()=>Zd,time:()=>Bd,ulid:()=>Id,undefined:()=>Kd,unicodeEmail:()=>YS,uppercase:()=>Xd,uuid:()=>Hr,uuid4:()=>gO,uuid6:()=>hO,uuid7:()=>vO,xid:()=>$d});var xd=/^[cC][0-9a-z]{6,}$/,Ad=/^[0-9a-z]+$/,Id=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,$d=/^[0-9a-vA-V]{20}$/,Td=/^[A-Za-z0-9]{27}$/,Rd=/^[a-zA-Z0-9_-]{21}$/,Pd=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,fO=/^[-+]?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)?)??$/,Cd=/^([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})$/,Hr=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)$/,gO=Hr(4),hO=Hr(6),vO=Hr(7),Nd=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,bO=/^[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])?)*$/,yO=/^(([^<>()\[\]\\.,;:\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,}))$/,YS=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,SO=YS,_O=/^[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])?)*$/,EO="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function wd(){return new RegExp(EO,"u")}var kd=/^(?:(?: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])$/,Od=/^(([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}|:))$/,Dd=e=>{let t=ot(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Md=/^((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])$/,jd=/^(([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])$/,zd=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,xs=/^[A-Za-z0-9_-]*$/,xO=/^(?=.{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])?)*\.?$/,AO=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Ld=/^https?$/,Ud=/^\+[1-9]\d{6,14}$/,XS="(?:(?:\\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])))",Fd=new RegExp(`^${XS}$`);function JS(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 Bd(e){return new RegExp(`^${JS(e)}$`)}function Vd(e){let t=JS({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let i=`${t}(?:${n.join("|")})`;return new RegExp(`^${XS}T(?:${i})$`)}var Zd=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Gd=/^-?\d+n?$/,Wd=/^-?\d+$/,As=/^-?\d+(?:\.\d+)?$/,Hd=/^(?:true|false)$/i,qd=/^null$/i;var Kd=/^undefined$/i;var Yd=/^[^A-Z]*$/,Xd=/^[^a-z]*$/,IO=/^[0-9a-fA-F]*$/;function fo(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function go(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var $O=/^[0-9a-fA-F]{32}$/,TO=fo(22,"=="),RO=go(22),PO=/^[0-9a-fA-F]{40}$/,CO=fo(27,"="),NO=go(27),wO=/^[0-9a-fA-F]{64}$/,kO=fo(43,"="),OO=go(43),DO=/^[0-9a-fA-F]{96}$/,MO=fo(64,""),jO=go(64),zO=/^[0-9a-fA-F]{128}$/,LO=fo(86,"=="),UO=go(86);var X=f("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),e_={number:"number",bigint:"bigint",object:"date"},Is=f("$ZodCheckLessThan",(e,t)=>{X.init(e,t);let n=e_[typeof t.value];e._zod.onattach.push(i=>{let r=i._zod.bag,o=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value<=t.value:i.value<t.value)||i.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),$s=f("$ZodCheckGreaterThan",(e,t)=>{X.init(e,t);let n=e_[typeof t.value];e._zod.onattach.push(i=>{let r=i._zod.bag,o=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Jd=f("$ZodCheckMultipleOf",(e,t)=>{X.init(e,t),e._zod.onattach.push(n=>{var i;(i=n._zod.bag).multipleOf??(i.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):ld(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Qd=f("$ZodCheckNumberFormat",(e,t)=>{X.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),i=n?"int":"number",[r,o]=hd[t.format];e._zod.onattach.push(a=>{let c=a._zod.bag;c.format=t.format,c.minimum=r,c.maximum=o,n&&(c.pattern=Wd)}),e._zod.check=a=>{let c=a.value;if(n){if(!Number.isInteger(c)){a.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?a.issues.push({input:c,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}):a.issues.push({input:c,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}}c<r&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),c>o&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),em=f("$ZodCheckBigIntFormat",(e,t)=>{X.init(e,t);let[n,i]=vd[t.format];e._zod.onattach.push(r=>{let o=r._zod.bag;o.format=t.format,o.minimum=n,o.maximum=i}),e._zod.check=r=>{let o=r.value;o<n&&r.issues.push({origin:"bigint",input:o,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),o>i&&r.issues.push({origin:"bigint",input:o,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),tm=f("$ZodCheckMaxSize",(e,t)=>{var n;X.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!vr(r)&&r.size!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(i._zod.bag.maximum=t.maximum)}),e._zod.check=i=>{let r=i.value;r.size<=t.maximum||i.issues.push({origin:co(r),code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),rm=f("$ZodCheckMinSize",(e,t)=>{var n;X.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!vr(r)&&r.size!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(i._zod.bag.minimum=t.minimum)}),e._zod.check=i=>{let r=i.value;r.size>=t.minimum||i.issues.push({origin:co(r),code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),nm=f("$ZodCheckSizeEquals",(e,t)=>{var n;X.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!vr(r)&&r.size!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag;r.minimum=t.size,r.maximum=t.size,r.size=t.size}),e._zod.check=i=>{let r=i.value,o=r.size;if(o===t.size)return;let a=o>t.size;i.issues.push({origin:co(r),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),im=f("$ZodCheckMaxLength",(e,t)=>{var n;X.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!vr(r)&&r.length!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(i._zod.bag.maximum=t.maximum)}),e._zod.check=i=>{let r=i.value;if(r.length<=t.maximum)return;let a=uo(r);i.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),om=f("$ZodCheckMinLength",(e,t)=>{var n;X.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!vr(r)&&r.length!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(i._zod.bag.minimum=t.minimum)}),e._zod.check=i=>{let r=i.value;if(r.length>=t.minimum)return;let a=uo(r);i.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),am=f("$ZodCheckLengthEquals",(e,t)=>{var n;X.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!vr(r)&&r.length!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=i=>{let r=i.value,o=r.length;if(o===t.length)return;let a=uo(r),c=o>t.length;i.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),Fn=f("$ZodCheckStringFormat",(e,t)=>{var n,i;X.init(e,t),e._zod.onattach.push(r=>{let o=r._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),sm=f("$ZodCheckRegex",(e,t)=>{Fn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),cm=f("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Yd),Fn.init(e,t)}),um=f("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Xd),Fn.init(e,t)}),lm=f("$ZodCheckIncludes",(e,t)=>{X.init(e,t);let n=ot(t.includes),i=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=i,e._zod.onattach.push(r=>{let o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(i)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),dm=f("$ZodCheckStartsWith",(e,t)=>{X.init(e,t);let n=new RegExp(`^${ot(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(i=>{let r=i._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),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})}}),mm=f("$ZodCheckEndsWith",(e,t)=>{X.init(e,t);let n=new RegExp(`.*${ot(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(i=>{let r=i._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),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 QS(e,t,n){e.issues.length&&t.issues.push(...Be(n,e.issues))}var pm=f("$ZodCheckProperty",(e,t)=>{X.init(e,t),e._zod.check=n=>{let i=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(i instanceof Promise)return i.then(r=>QS(r,n,t.property));QS(i,n,t.property)}}),fm=f("$ZodCheckMimeType",(e,t)=>{X.init(e,t);let n=new Set(t.mime);e._zod.onattach.push(i=>{i._zod.bag.mime=t.mime}),e._zod.check=i=>{n.has(i.value.type)||i.issues.push({code:"invalid_value",values:t.mime,input:i.value.type,inst:e,continue:!t.abort})}}),gm=f("$ZodCheckOverwrite",(e,t)=>{X.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});var ho=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(`
102
102
  `).filter(a=>a),r=Math.min(...i.map(a=>a.length-a.trimStart().length)),o=i.map(a=>a.slice(r)).map(a=>" ".repeat(this.indent*2)+a);for(let a of o)this.content.push(a)}compile(){let t=Function,n=this?.args,r=[...(this?.content??[""]).map(o=>` ${o}`)];return new t(...n,r.join(`
103
103
  `))}};var hm={major:4,minor:4,patch:3};var N=f("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=hm;let i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(let r of i)for(let o of r._zod.onattach)o(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let r=(a,c,u)=>{let l=Sr(a),m;for(let p of c){if(p._zod.def.when){if(bd(a)||!p._zod.def.when(a))continue}else if(l)continue;let g=a.issues.length,v=p._zod.check(a);if(v instanceof Promise&&u?.async===!1)throw new bt;if(m||v instanceof Promise)m=(m??Promise.resolve()).then(async()=>{await v,a.issues.length!==g&&(l||(l=Sr(a,g)))});else{if(a.issues.length===g)continue;l||(l=Sr(a,g))}}return m?m.then(()=>a):a},o=(a,c,u)=>{if(Sr(a))return a.aborted=!0,a;let l=r(c,i,u);if(l instanceof Promise){if(u.async===!1)throw new bt;return l.then(m=>e._zod.parse(m,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return l instanceof Promise?l.then(m=>o(m,a,c)):o(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new bt;return u.then(l=>r(l,i,c))}return r(u,i,c)}}M(e,"~standard",()=>({validate:r=>{try{let o=_d(e,r);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return Ed(e,r).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),qr=f("$ZodString",(e,t)=>{N.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Zd(e._zod.bag),e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),q=f("$ZodStringFormat",(e,t)=>{Fn.init(e,t),qr.init(e,t)}),bm=f("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Cd),q.init(e,t)}),ym=f("$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=Hr(i))}else t.pattern??(t.pattern=Hr());q.init(e,t)}),Sm=f("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Nd),q.init(e,t)}),_m=f("$ZodURL",(e,t)=>{q.init(e,t),e._zod.check=n=>{try{let i=n.value.trim();if(!t.normalize&&t.protocol?.source===Ld.source&&!/^https?:\/\//i.test(i)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}let r=new URL(i);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(r.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=r.href:n.value=i;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Em=f("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=wd()),q.init(e,t)}),xm=f("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Rd),q.init(e,t)}),Am=f("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=xd),q.init(e,t)}),Im=f("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ad),q.init(e,t)}),$m=f("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Id),q.init(e,t)}),Tm=f("$ZodXID",(e,t)=>{t.pattern??(t.pattern=$d),q.init(e,t)}),Rm=f("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Td),q.init(e,t)}),Pm=f("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Vd(t)),q.init(e,t)}),Cm=f("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Fd),q.init(e,t)}),Nm=f("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Bd(t)),q.init(e,t)}),wm=f("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Pd),q.init(e,t)}),km=f("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=kd),q.init(e,t),e._zod.bag.format="ipv4"}),Om=f("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Od),q.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),Dm=f("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Dd(t.delimiter)),q.init(e,t),e._zod.bag.format="mac"}),Mm=f("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Md),q.init(e,t)}),jm=f("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=jd),q.init(e,t),e._zod.check=n=>{let i=n.value.split("/");try{if(i.length!==2)throw new Error;let[r,o]=i;if(!o)throw new Error;let a=Number(o);if(`${a}`!==o)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function zm(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Lm=f("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=zd),q.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{zm(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function h_(e){if(!xs.test(e))return!1;let t=e.replace(/[-_]/g,i=>i==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return zm(n)}var Um=f("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=xs),q.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{h_(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Fm=f("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ud),q.init(e,t)});function v_(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[i]=n;if(!i)return!1;let r=JSON.parse(atob(i));return!("typ"in r&&r?.typ!=="JWT"||!r.alg||t&&(!("alg"in r)||r.alg!==t))}catch{return!1}}var Bm=f("$ZodJWT",(e,t)=>{q.init(e,t),e._zod.check=n=>{v_(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Vm=f("$ZodCustomStringFormat",(e,t)=>{q.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:"invalid_format",format:t.format,input:n.value,inst:e,continue:!t.abort})}}),Ns=f("$ZodNumber",(e,t)=>{N.init(e,t),e._zod.pattern=e._zod.bag.pattern??As,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let r=n.value;if(typeof r=="number"&&!Number.isNaN(r)&&Number.isFinite(r))return n;let o=typeof r=="number"?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...o?{received:o}:{}}),n}}),Zm=f("$ZodNumberFormat",(e,t)=>{Qd.init(e,t),Ns.init(e,t)}),vo=f("$ZodBoolean",(e,t)=>{N.init(e,t),e._zod.pattern=Hd,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=!!n.value}catch{}let r=n.value;return typeof r=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}}),ws=f("$ZodBigInt",(e,t)=>{N.init(e,t),e._zod.pattern=Gd,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}}),Gm=f("$ZodBigIntFormat",(e,t)=>{em.init(e,t),ws.init(e,t)}),Wm=f("$ZodSymbol",(e,t)=>{N.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;return typeof r=="symbol"||n.issues.push({expected:"symbol",code:"invalid_type",input:r,inst:e}),n}}),Hm=f("$ZodUndefined",(e,t)=>{N.init(e,t),e._zod.pattern=Kd,e._zod.values=new Set([void 0]),e._zod.parse=(n,i)=>{let r=n.value;return typeof r>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:e}),n}}),qm=f("$ZodNull",(e,t)=>{N.init(e,t),e._zod.pattern=qd,e._zod.values=new Set([null]),e._zod.parse=(n,i)=>{let r=n.value;return r===null||n.issues.push({expected:"null",code:"invalid_type",input:r,inst:e}),n}}),Km=f("$ZodAny",(e,t)=>{N.init(e,t),e._zod.parse=n=>n}),Ym=f("$ZodUnknown",(e,t)=>{N.init(e,t),e._zod.parse=n=>n}),Xm=f("$ZodNever",(e,t)=>{N.init(e,t),e._zod.parse=(n,i)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),Jm=f("$ZodVoid",(e,t)=>{N.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;return typeof r>"u"||n.issues.push({expected:"void",code:"invalid_type",input:r,inst:e}),n}}),Qm=f("$ZodDate",(e,t)=>{N.init(e,t),e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let r=n.value,o=r instanceof Date;return o&&!Number.isNaN(r.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:r,...o?{received:"Invalid Date"}:{},inst:e}),n}});function r_(e,t,n){e.issues.length&&t.issues.push(...Be(n,e.issues)),t.value[n]=e.value}var ep=f("$ZodArray",(e,t)=>{N.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),n;n.value=Array(r.length);let o=[];for(let a=0;a<r.length;a++){let c=r[a],u=t.element._zod.run({value:c,issues:[]},i);u instanceof Promise?o.push(u.then(l=>r_(l,n,a))):r_(u,n,a)}return o.length?Promise.all(o).then(()=>n):n}});function Cs(e,t,n,i,r,o){let a=n in i;if(e.issues.length){if(r&&o&&!a)return;t.issues.push(...Be(n,e.issues))}if(!a&&!r){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?a&&(t.value[n]=void 0):t.value[n]=e.value}function b_(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 n=gd(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function y_(e,t,n,i,r,o){let a=[],c=r.keySet,u=r.catchall._zod,l=u.def.type,m=u.optin==="optional",p=u.optout==="optional";for(let g in t){if(g==="__proto__"||c.has(g))continue;if(l==="never"){a.push(g);continue}let v=u.run({value:t[g],issues:[]},i);v instanceof Promise?e.push(v.then(A=>Cs(A,n,g,t,m,p))):Cs(v,n,g,t,m,p)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}var S_=f("$ZodObject",(e,t)=>{if(N.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let c=t.shape;Object.defineProperty(t,"shape",{get:()=>{let u={...c};return Object.defineProperty(t,"shape",{value:u}),u}})}let i=Dn(()=>b_(t));M(e._zod,"propValues",()=>{let c=t.shape,u={};for(let l in c){let m=c[l]._zod;if(m.values){u[l]??(u[l]=new Set);for(let p of m.values)u[l].add(p)}}return u});let r=Wr,o=t.catchall,a;e._zod.parse=(c,u)=>{a??(a=i.value);let l=c.value;if(!r(l))return c.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),c;c.value={};let m=[],p=a.shape;for(let g of a.keys){let v=p[g],A=v._zod.optin==="optional",Y=v._zod.optout==="optional",z=v._zod.run({value:l[g],issues:[]},u);z instanceof Promise?m.push(z.then(Se=>Cs(Se,c,g,l,A,Y))):Cs(z,c,g,l,A,Y)}return o?y_(m,l,c,u,i.value,e):m.length?Promise.all(m).then(()=>c):c}}),tp=f("$ZodObjectJIT",(e,t)=>{S_.init(e,t);let n=e._zod.parse,i=Dn(()=>b_(t)),r=g=>{let v=new ho(["shape","payload","ctx"]),A=i.value,Y=we=>{let te=ds(we);return`shape[${te}]._zod.run({ value: input[${te}], issues: [] }, ctx)`};v.write("const input = payload.value;");let z=Object.create(null),Se=0;for(let we of A.keys)z[we]=`key_${Se++}`;v.write("const newResult = {};");for(let we of A.keys){let te=z[we],pe=ds(we),$n=g[we],SS=$n?._zod?.optin==="optional",Uw=$n?._zod?.optout==="optional";v.write(`const ${te} = ${Y(we)};`),SS&&Uw?v.write(`
@@ -163,12 +163,12 @@ Filtered results for: ${this.inputValue?this.inputValue:pr.gray("Enter something
163
163
 
164
164
  Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let c=a[1];if(t===a[0]){o(a);continue}if(e.external){let l=e.external.registry.get(a[0])?.id;if(t!==a[0]&&l){o(a);continue}}if(e.metadataRegistry.get(a[0])?.id){o(a);continue}if(c.cycle){o(a);continue}if(c.count>1&&e.reused==="ref"){o(a);continue}}}function Ir(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=c=>{let u=e.seen.get(c);if(u.ref===null)return;let l=u.def??u.schema,m={...l},p=u.ref;if(u.ref=null,p){i(p);let v=e.seen.get(p),A=v.schema;if(A.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(A)):Object.assign(l,A),Object.assign(l,m),c._zod.parent===p)for(let z in l)z==="$ref"||z==="allOf"||z in m||delete l[z];if(A.$ref&&v.def)for(let z in l)z==="$ref"||z==="allOf"||z in v.def&&JSON.stringify(l[z])===JSON.stringify(v.def[z])&&delete l[z]}let g=c._zod.parent;if(g&&g!==p){i(g);let v=e.seen.get(g);if(v?.schema.$ref&&(l.$ref=v.schema.$ref,v.def))for(let A in l)A==="$ref"||A==="allOf"||A in v.def&&JSON.stringify(l[A])===JSON.stringify(v.def[A])&&delete l[A]}e.override({zodSchema:c,jsonSchema:l,path:u.path??[]})};for(let c of[...e.seen.entries()].reverse())i(c[0]);let r={};if(e.target==="draft-2020-12"?r.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?r.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?r.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");r.$id=e.external.uri(c)}Object.assign(r,n.def??n.schema);let o=e.metadataRegistry.get(t)?.id;o!==void 0&&r.id===o&&delete r.id;let a=e.external?.defs??{};for(let c of e.seen.entries()){let u=c[1];u.def&&u.defId&&(u.def.id===u.defId&&delete u.def.id,a[u.defId]=u.def)}e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?r.$defs=a:r.definitions=a);try{let c=JSON.parse(JSON.stringify(r));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:ri(t,"input",e.processors),output:ri(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function je(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return je(i.element,n);if(i.type==="set")return je(i.valueType,n);if(i.type==="lazy")return je(i.getter(),n);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault")return je(i.innerType,n);if(i.type==="intersection")return je(i.left,n)||je(i.right,n);if(i.type==="record"||i.type==="map")return je(i.keyType,n)||je(i.valueType,n);if(i.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:je(i.in,n)||je(i.out,n);if(i.type==="object"){for(let r in i.shape)if(je(i.shape[r],n))return!0;return!1}if(i.type==="union"){for(let r of i.options)if(je(r,n))return!0;return!1}if(i.type==="tuple"){for(let r of i.items)if(je(r,n))return!0;return!!(i.rest&&je(i.rest,n))}return!1}var gf=(e,t={})=>n=>{let i=xr({...n,processors:t});return Z(e,i),Ar(i,e),Ir(i,e)},ri=(e,t,n={})=>i=>{let{libraryOptions:r,target:o}=i??{},a=xr({...r??{},target:o,io:t,processors:n});return Z(e,a),Ar(a,e),Ir(a,e)};var c1={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},hf=(e,t,n,i)=>{let r=n;r.type="string";let{minimum:o,maximum:a,format:c,patterns:u,contentEncoding:l}=e._zod.bag;if(typeof o=="number"&&(r.minLength=o),typeof a=="number"&&(r.maxLength=a),c&&(r.format=c1[c]??c,r.format===""&&delete r.format,c==="time"&&delete r.format),l&&(r.contentEncoding=l),u&&u.size>0){let m=[...u];m.length===1?r.pattern=m[0].source:m.length>1&&(r.allOf=[...m.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},vf=(e,t,n,i)=>{let r=n,{minimum:o,maximum:a,format:c,multipleOf:u,exclusiveMaximum:l,exclusiveMinimum:m}=e._zod.bag;typeof c=="string"&&c.includes("int")?r.type="integer":r.type="number";let p=typeof m=="number"&&m>=(o??Number.NEGATIVE_INFINITY),g=typeof l=="number"&&l<=(a??Number.POSITIVE_INFINITY),v=t.target==="draft-04"||t.target==="openapi-3.0";p?v?(r.minimum=m,r.exclusiveMinimum=!0):r.exclusiveMinimum=m:typeof o=="number"&&(r.minimum=o),g?v?(r.maximum=l,r.exclusiveMaximum=!0):r.exclusiveMaximum=l:typeof a=="number"&&(r.maximum=a),typeof u=="number"&&(r.multipleOf=u)},bf=(e,t,n,i)=>{n.type="boolean"},yf=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Sf=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},_f=(e,t,n,i)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},Ef=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},xf=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},Af=(e,t,n,i)=>{n.not={}},If=(e,t,n,i)=>{},$f=(e,t,n,i)=>{},Tf=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},Rf=(e,t,n,i)=>{let r=e._zod.def,o=oo(r.entries);o.every(a=>typeof a=="number")&&(n.type="number"),o.every(a=>typeof a=="string")&&(n.type="string"),n.enum=o},Pf=(e,t,n,i)=>{let r=e._zod.def,o=[];for(let a of r.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(a))}else o.push(a);if(o.length!==0)if(o.length===1){let a=o[0];n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[a]:n.const=a}else o.every(a=>typeof a=="number")&&(n.type="number"),o.every(a=>typeof a=="string")&&(n.type="string"),o.every(a=>typeof a=="boolean")&&(n.type="boolean"),o.every(a=>a===null)&&(n.type="null"),n.enum=o},Cf=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Nf=(e,t,n,i)=>{let r=n,o=e._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");r.type="string",r.pattern=o.source},wf=(e,t,n,i)=>{let r=n,o={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:c,mime:u}=e._zod.bag;a!==void 0&&(o.minLength=a),c!==void 0&&(o.maxLength=c),u?u.length===1?(o.contentMediaType=u[0],Object.assign(r,o)):(Object.assign(r,o),r.anyOf=u.map(l=>({contentMediaType:l}))):Object.assign(r,o)},kf=(e,t,n,i)=>{n.type="boolean"},Of=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Df=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Mf=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},jf=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},zf=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Lf=(e,t,n,i)=>{let r=n,o=e._zod.def,{minimum:a,maximum:c}=e._zod.bag;typeof a=="number"&&(r.minItems=a),typeof c=="number"&&(r.maxItems=c),r.type="array",r.items=Z(o.element,t,{...i,path:[...i.path,"items"]})},Uf=(e,t,n,i)=>{let r=n,o=e._zod.def;r.type="object",r.properties={};let a=o.shape;for(let l in a)r.properties[l]=Z(a[l],t,{...i,path:[...i.path,"properties",l]});let c=new Set(Object.keys(a)),u=new Set([...c].filter(l=>{let m=o.shape[l]._zod;return t.io==="input"?m.optin===void 0:m.optout===void 0}));u.size>0&&(r.required=Array.from(u)),o.catchall?._zod.def.type==="never"?r.additionalProperties=!1:o.catchall?o.catchall&&(r.additionalProperties=Z(o.catchall,t,{...i,path:[...i.path,"additionalProperties"]})):t.io==="output"&&(r.additionalProperties=!1)},pc=(e,t,n,i)=>{let r=e._zod.def,o=r.inclusive===!1,a=r.options.map((c,u)=>Z(c,t,{...i,path:[...i.path,o?"oneOf":"anyOf",u]}));o?n.oneOf=a:n.anyOf=a},Ff=(e,t,n,i)=>{let r=e._zod.def,o=Z(r.left,t,{...i,path:[...i.path,"allOf",0]}),a=Z(r.right,t,{...i,path:[...i.path,"allOf",1]}),c=l=>"allOf"in l&&Object.keys(l).length===1,u=[...c(o)?o.allOf:[o],...c(a)?a.allOf:[a]];n.allOf=u},Bf=(e,t,n,i)=>{let r=n,o=e._zod.def;r.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",u=o.items.map((g,v)=>Z(g,t,{...i,path:[...i.path,a,v]})),l=o.rest?Z(o.rest,t,{...i,path:[...i.path,c,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null;t.target==="draft-2020-12"?(r.prefixItems=u,l&&(r.items=l)):t.target==="openapi-3.0"?(r.items={anyOf:u},l&&r.items.anyOf.push(l),r.minItems=u.length,l||(r.maxItems=u.length)):(r.items=u,l&&(r.additionalItems=l));let{minimum:m,maximum:p}=e._zod.bag;typeof m=="number"&&(r.minItems=m),typeof p=="number"&&(r.maxItems=p)},Vf=(e,t,n,i)=>{let r=n,o=e._zod.def;r.type="object";let a=o.keyType,u=a._zod.bag?.patterns;if(o.mode==="loose"&&u&&u.size>0){let m=Z(o.valueType,t,{...i,path:[...i.path,"patternProperties","*"]});r.patternProperties={};for(let p of u)r.patternProperties[p.source]=m}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(r.propertyNames=Z(o.keyType,t,{...i,path:[...i.path,"propertyNames"]})),r.additionalProperties=Z(o.valueType,t,{...i,path:[...i.path,"additionalProperties"]});let l=a._zod.values;if(l){let m=[...l].filter(p=>typeof p=="string"||typeof p=="number");m.length>0&&(r.required=m)}},Zf=(e,t,n,i)=>{let r=e._zod.def,o=Z(r.innerType,t,i),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=r.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]},Gf=(e,t,n,i)=>{let r=e._zod.def;Z(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType},Wf=(e,t,n,i)=>{let r=e._zod.def;Z(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType,n.default=JSON.parse(JSON.stringify(r.defaultValue))},Hf=(e,t,n,i)=>{let r=e._zod.def;Z(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(r.defaultValue)))},qf=(e,t,n,i)=>{let r=e._zod.def;Z(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType;let a;try{a=r.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a},Kf=(e,t,n,i)=>{let r=e._zod.def,o=r.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?o?r.out:r.in:r.out;Z(a,t,i);let c=t.seen.get(e);c.ref=a},Yf=(e,t,n,i)=>{let r=e._zod.def;Z(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType,n.readOnly=!0},Xf=(e,t,n,i)=>{let r=e._zod.def;Z(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType},fc=(e,t,n,i)=>{let r=e._zod.def;Z(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType},Jf=(e,t,n,i)=>{let r=e._zod.innerType;Z(r,t,i);let o=t.seen.get(e);o.ref=r},mc={string:hf,number:vf,boolean:bf,bigint:yf,symbol:Sf,null:_f,undefined:Ef,void:xf,never:Af,any:If,unknown:$f,date:Tf,enum:Rf,literal:Pf,nan:Cf,template_literal:Nf,file:wf,success:kf,custom:Of,function:Df,transform:Mf,map:jf,set:zf,array:Lf,object:Uf,union:pc,intersection:Ff,tuple:Bf,record:Vf,nullable:Zf,nonoptional:Gf,default:Wf,prefault:Hf,catch:qf,pipe:Kf,readonly:Yf,promise:Xf,optional:fc,lazy:Jf};function gc(e,t){if("_idmap"in e){let i=e,r=xr({...t,processors:mc}),o={};for(let u of i._idmap.entries()){let[l,m]=u;Z(m,r)}let a={},c={registry:i,uri:t?.uri,defs:o};r.external=c;for(let u of i._idmap.entries()){let[l,m]=u;Ar(r,m),a[l]=Ir(r,m)}if(Object.keys(o).length>0){let u=r.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[u]:o}}return{schemas:a}}let n=xr({...t,processors:mc});return Z(e,n),Ar(n,e),Ir(n,e)}var hc=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let n=t?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=xr({processors:mc,target:n,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,n={path:[],schemaPath:[]}){return Z(t,this.ctx,n)}emit(t,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),Ar(this.ctx,t);let i=Ir(this.ctx,t),{"~standard":r,...o}=i;return o}};var EE={};var Ao={};$t(Ao,{ZodAny:()=>Eg,ZodArray:()=>$g,ZodBase64:()=>jc,ZodBase64URL:()=>zc,ZodBigInt:()=>li,ZodBigIntFormat:()=>Fc,ZodBoolean:()=>ui,ZodCIDRv4:()=>Dc,ZodCIDRv6:()=>Mc,ZodCUID:()=>Rc,ZodCUID2:()=>Pc,ZodCatch:()=>qg,ZodCodec:()=>Mo,ZodCustom:()=>jo,ZodCustomStringFormat:()=>si,ZodDate:()=>No,ZodDefault:()=>Bg,ZodDiscriminatedUnion:()=>Rg,ZodE164:()=>Lc,ZodEmail:()=>Ic,ZodEmoji:()=>$c,ZodEnum:()=>oi,ZodExactOptional:()=>Lg,ZodFile:()=>jg,ZodFunction:()=>ih,ZodGUID:()=>$o,ZodIPv4:()=>kc,ZodIPv6:()=>Oc,ZodIntersection:()=>Pg,ZodJWT:()=>Uc,ZodKSUID:()=>wc,ZodLazy:()=>th,ZodLiteral:()=>Mg,ZodMAC:()=>gg,ZodMap:()=>Og,ZodNaN:()=>Yg,ZodNanoID:()=>Tc,ZodNever:()=>Ag,ZodNonOptional:()=>Hc,ZodNull:()=>Sg,ZodNullable:()=>Fg,ZodNumber:()=>ci,ZodNumberFormat:()=>Qr,ZodObject:()=>ko,ZodOptional:()=>Wc,ZodPipe:()=>Do,ZodPrefault:()=>Zg,ZodPreprocess:()=>Xg,ZodPromise:()=>nh,ZodReadonly:()=>Jg,ZodRecord:()=>ii,ZodSet:()=>Dg,ZodString:()=>ai,ZodStringFormat:()=>K,ZodSuccess:()=>Hg,ZodSymbol:()=>bg,ZodTemplateLiteral:()=>eh,ZodTransform:()=>zg,ZodTuple:()=>Ng,ZodType:()=>w,ZodULID:()=>Cc,ZodURL:()=>Co,ZodUUID:()=>wt,ZodUndefined:()=>yg,ZodUnion:()=>Oo,ZodUnknown:()=>xg,ZodVoid:()=>Ig,ZodXID:()=>Nc,ZodXor:()=>Tg,_ZodString:()=>Ac,_default:()=>Vg,_function:()=>Nx,any:()=>cx,array:()=>wo,base64:()=>GE,base64url:()=>WE,bigint:()=>nx,boolean:()=>vg,catch:()=>Kg,check:()=>wx,cidrv4:()=>VE,cidrv6:()=>ZE,codec:()=>Tx,cuid:()=>DE,cuid2:()=>ME,custom:()=>kx,date:()=>lx,describe:()=>Ox,discriminatedUnion:()=>hx,e164:()=>HE,email:()=>IE,emoji:()=>kE,enum:()=>Zc,exactOptional:()=>Ug,file:()=>xx,float32:()=>QE,float64:()=>ex,function:()=>Nx,guid:()=>$E,hash:()=>JE,hex:()=>XE,hostname:()=>YE,httpUrl:()=>wE,instanceof:()=>Mx,int:()=>Ec,int32:()=>tx,int64:()=>ix,intersection:()=>Cg,invertCodec:()=>Rx,ipv4:()=>UE,ipv6:()=>BE,json:()=>zx,jwt:()=>qE,keyof:()=>dx,ksuid:()=>LE,lazy:()=>rh,literal:()=>Ex,looseObject:()=>fx,looseRecord:()=>bx,mac:()=>FE,map:()=>yx,meta:()=>Dx,nan:()=>$x,nanoid:()=>OE,nativeEnum:()=>_x,never:()=>Bc,nonoptional:()=>Wg,null:()=>_g,nullable:()=>Ro,nullish:()=>Ax,number:()=>hg,object:()=>mx,optional:()=>To,partialRecord:()=>vx,pipe:()=>xc,prefault:()=>Gg,preprocess:()=>Lx,promise:()=>Cx,readonly:()=>Qg,record:()=>kg,refine:()=>oh,set:()=>Sx,strictObject:()=>px,string:()=>Io,stringFormat:()=>KE,stringbool:()=>jx,success:()=>Ix,superRefine:()=>ah,symbol:()=>ax,templateLiteral:()=>Px,transform:()=>Gc,tuple:()=>wg,uint32:()=>rx,uint64:()=>ox,ulid:()=>jE,undefined:()=>sx,union:()=>Vc,unknown:()=>Jr,url:()=>NE,uuid:()=>TE,uuidv4:()=>RE,uuidv6:()=>PE,uuidv7:()=>CE,void:()=>ux,xid:()=>zE,xor:()=>gx});var vc={};$t(vc,{endsWith:()=>qn,gt:()=>Ct,gte:()=>Me,includes:()=>Wn,length:()=>Xr,lowercase:()=>Zn,lt:()=>Pt,lte:()=>Qe,maxLength:()=>Yr,maxSize:()=>Er,mime:()=>Kn,minLength:()=>Xt,minSize:()=>Nt,multipleOf:()=>_r,negative:()=>cc,nonnegative:()=>lc,nonpositive:()=>uc,normalize:()=>Yn,overwrite:()=>yt,positive:()=>sc,property:()=>dc,regex:()=>Vn,size:()=>Kr,slugify:()=>ei,startsWith:()=>Hn,toLowerCase:()=>Jn,toUpperCase:()=>Qn,trim:()=>Xn,uppercase:()=>Gn});var ni={};$t(ni,{ZodISODate:()=>yc,ZodISODateTime:()=>bc,ZodISODuration:()=>_c,ZodISOTime:()=>Sc,date:()=>eg,datetime:()=>Qf,duration:()=>rg,time:()=>tg});var bc=f("ZodISODateTime",(e,t)=>{Pm.init(e,t),K.init(e,t)});function Qf(e){return kp(bc,e)}var yc=f("ZodISODate",(e,t)=>{Cm.init(e,t),K.init(e,t)});function eg(e){return Op(yc,e)}var Sc=f("ZodISOTime",(e,t)=>{Nm.init(e,t),K.init(e,t)});function tg(e){return Dp(Sc,e)}var _c=f("ZodISODuration",(e,t)=>{wm.init(e,t),K.init(e,t)});function rg(e){return Mp(_c,e)}var xE=(e,t)=>{lo.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>po(e,n)},flatten:{value:n=>mo(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,On,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,On,2)}},isEmpty:{get(){return e.issues.length===0}}})},l1=f("ZodError",xE),Ze=f("ZodError",xE,{Parent:Error});var ng=jn(Ze),ig=zn(Ze),og=Ln(Ze),ag=Un(Ze),sg=gs(Ze),cg=hs(Ze),ug=vs(Ze),lg=bs(Ze),dg=ys(Ze),mg=Ss(Ze),pg=_s(Ze),fg=Es(Ze);var AE=new WeakMap;function Po(e,t,n){let i=Object.getPrototypeOf(e),r=AE.get(i);if(r||(r=new Set,AE.set(i,r)),!r.has(t)){r.add(t);for(let o in n){let a=n[o];Object.defineProperty(i,o,{configurable:!0,enumerable:!1,get(){let c=a.bind(this);return Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:c}),c},set(c){Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:c})}})}}}var w=f("ZodType",(e,t)=>(N.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ri(e,"input"),output:ri(e,"output")}}),e.toJSONSchema=gf(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,i)=>ng(e,n,i,{callee:e.parse}),e.safeParse=(n,i)=>og(e,n,i),e.parseAsync=async(n,i)=>ig(e,n,i,{callee:e.parseAsync}),e.safeParseAsync=async(n,i)=>ag(e,n,i),e.spa=e.safeParseAsync,e.encode=(n,i)=>sg(e,n,i),e.decode=(n,i)=>cg(e,n,i),e.encodeAsync=async(n,i)=>ug(e,n,i),e.decodeAsync=async(n,i)=>lg(e,n,i),e.safeEncode=(n,i)=>dg(e,n,i),e.safeDecode=(n,i)=>mg(e,n,i),e.safeEncodeAsync=async(n,i)=>pg(e,n,i),e.safeDecodeAsync=async(n,i)=>fg(e,n,i),Po(e,"ZodType",{check(...n){let i=this.def;return this.clone(_.mergeDefs(i,{checks:[...i.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,i){return Oe(this,n,i)},brand(){return this},register(n,i){return n.add(this,i),this},refine(n,i){return this.check(oh(n,i))},superRefine(n,i){return this.check(ah(n,i))},overwrite(n){return this.check(yt(n))},optional(){return To(this)},exactOptional(){return Ug(this)},nullable(){return Ro(this)},nullish(){return To(Ro(this))},nonoptional(n){return Wg(this,n)},array(){return wo(this)},or(n){return Vc([this,n])},and(n){return Cg(this,n)},transform(n){return xc(this,Gc(n))},default(n){return Vg(this,n)},prefault(n){return Gg(this,n)},catch(n){return Kg(this,n)},pipe(n){return xc(this,n)},readonly(){return Qg(this)},describe(n){let i=this.clone();return _e.add(i,{description:n}),i},meta(...n){if(n.length===0)return _e.get(this);let i=this.clone();return _e.add(i,n[0]),i},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return _e.get(e)?.description},configurable:!0}),e)),Ac=f("_ZodString",(e,t)=>{qr.init(e,t),w.init(e,t),e._zod.processJSONSchema=(i,r,o)=>hf(e,i,r,o);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Po(e,"_ZodString",{regex(...i){return this.check(Vn(...i))},includes(...i){return this.check(Wn(...i))},startsWith(...i){return this.check(Hn(...i))},endsWith(...i){return this.check(qn(...i))},min(...i){return this.check(Xt(...i))},max(...i){return this.check(Yr(...i))},length(...i){return this.check(Xr(...i))},nonempty(...i){return this.check(Xt(1,...i))},lowercase(i){return this.check(Zn(i))},uppercase(i){return this.check(Gn(i))},trim(){return this.check(Xn())},normalize(...i){return this.check(Yn(...i))},toLowerCase(){return this.check(Jn())},toUpperCase(){return this.check(Qn())},slugify(){return this.check(ei())}})}),ai=f("ZodString",(e,t)=>{qr.init(e,t),Ac.init(e,t),e.email=n=>e.check(Fs(Ic,n)),e.url=n=>e.check(xo(Co,n)),e.jwt=n=>e.check(ac(Uc,n)),e.emoji=n=>e.check(Ws($c,n)),e.guid=n=>e.check(Eo($o,n)),e.uuid=n=>e.check(Bs(wt,n)),e.uuidv4=n=>e.check(Vs(wt,n)),e.uuidv6=n=>e.check(Zs(wt,n)),e.uuidv7=n=>e.check(Gs(wt,n)),e.nanoid=n=>e.check(Hs(Tc,n)),e.guid=n=>e.check(Eo($o,n)),e.cuid=n=>e.check(qs(Rc,n)),e.cuid2=n=>e.check(Ks(Pc,n)),e.ulid=n=>e.check(Ys(Cc,n)),e.base64=n=>e.check(nc(jc,n)),e.base64url=n=>e.check(ic(zc,n)),e.xid=n=>e.check(Xs(Nc,n)),e.ksuid=n=>e.check(Js(wc,n)),e.ipv4=n=>e.check(Qs(kc,n)),e.ipv6=n=>e.check(ec(Oc,n)),e.cidrv4=n=>e.check(tc(Dc,n)),e.cidrv6=n=>e.check(rc(Mc,n)),e.e164=n=>e.check(oc(Lc,n)),e.datetime=n=>e.check(Qf(n)),e.date=n=>e.check(eg(n)),e.time=n=>e.check(tg(n)),e.duration=n=>e.check(rg(n))});function Io(e){return Pp(ai,e)}var K=f("ZodStringFormat",(e,t)=>{q.init(e,t),Ac.init(e,t)}),Ic=f("ZodEmail",(e,t)=>{Sm.init(e,t),K.init(e,t)});function IE(e){return Fs(Ic,e)}var $o=f("ZodGUID",(e,t)=>{bm.init(e,t),K.init(e,t)});function $E(e){return Eo($o,e)}var wt=f("ZodUUID",(e,t)=>{ym.init(e,t),K.init(e,t)});function TE(e){return Bs(wt,e)}function RE(e){return Vs(wt,e)}function PE(e){return Zs(wt,e)}function CE(e){return Gs(wt,e)}var Co=f("ZodURL",(e,t)=>{_m.init(e,t),K.init(e,t)});function NE(e){return xo(Co,e)}function wE(e){return xo(Co,{protocol:Je.httpProtocol,hostname:Je.domain,..._.normalizeParams(e)})}var $c=f("ZodEmoji",(e,t)=>{Em.init(e,t),K.init(e,t)});function kE(e){return Ws($c,e)}var Tc=f("ZodNanoID",(e,t)=>{xm.init(e,t),K.init(e,t)});function OE(e){return Hs(Tc,e)}var Rc=f("ZodCUID",(e,t)=>{Am.init(e,t),K.init(e,t)});function DE(e){return qs(Rc,e)}var Pc=f("ZodCUID2",(e,t)=>{Im.init(e,t),K.init(e,t)});function ME(e){return Ks(Pc,e)}var Cc=f("ZodULID",(e,t)=>{$m.init(e,t),K.init(e,t)});function jE(e){return Ys(Cc,e)}var Nc=f("ZodXID",(e,t)=>{Tm.init(e,t),K.init(e,t)});function zE(e){return Xs(Nc,e)}var wc=f("ZodKSUID",(e,t)=>{Rm.init(e,t),K.init(e,t)});function LE(e){return Js(wc,e)}var kc=f("ZodIPv4",(e,t)=>{km.init(e,t),K.init(e,t)});function UE(e){return Qs(kc,e)}var gg=f("ZodMAC",(e,t)=>{Dm.init(e,t),K.init(e,t)});function FE(e){return Np(gg,e)}var Oc=f("ZodIPv6",(e,t)=>{Om.init(e,t),K.init(e,t)});function BE(e){return ec(Oc,e)}var Dc=f("ZodCIDRv4",(e,t)=>{Mm.init(e,t),K.init(e,t)});function VE(e){return tc(Dc,e)}var Mc=f("ZodCIDRv6",(e,t)=>{jm.init(e,t),K.init(e,t)});function ZE(e){return rc(Mc,e)}var jc=f("ZodBase64",(e,t)=>{Lm.init(e,t),K.init(e,t)});function GE(e){return nc(jc,e)}var zc=f("ZodBase64URL",(e,t)=>{Um.init(e,t),K.init(e,t)});function WE(e){return ic(zc,e)}var Lc=f("ZodE164",(e,t)=>{Fm.init(e,t),K.init(e,t)});function HE(e){return oc(Lc,e)}var Uc=f("ZodJWT",(e,t)=>{Bm.init(e,t),K.init(e,t)});function qE(e){return ac(Uc,e)}var si=f("ZodCustomStringFormat",(e,t)=>{Vm.init(e,t),K.init(e,t)});function KE(e,t,n={}){return ti(si,e,t,n)}function YE(e){return ti(si,"hostname",Je.hostname,e)}function XE(e){return ti(si,"hex",Je.hex,e)}function JE(e,t){let n=t?.enc??"hex",i=`${e}_${n}`,r=Je[i];if(!r)throw new Error(`Unrecognized hash format: ${i}`);return ti(si,i,r,t)}var ci=f("ZodNumber",(e,t)=>{Ns.init(e,t),w.init(e,t),e._zod.processJSONSchema=(i,r,o)=>vf(e,i,r,o),Po(e,"ZodNumber",{gt(i,r){return this.check(Ct(i,r))},gte(i,r){return this.check(Me(i,r))},min(i,r){return this.check(Me(i,r))},lt(i,r){return this.check(Pt(i,r))},lte(i,r){return this.check(Qe(i,r))},max(i,r){return this.check(Qe(i,r))},int(i){return this.check(Ec(i))},safe(i){return this.check(Ec(i))},positive(i){return this.check(Ct(0,i))},nonnegative(i){return this.check(Me(0,i))},negative(i){return this.check(Pt(0,i))},nonpositive(i){return this.check(Qe(0,i))},multipleOf(i,r){return this.check(_r(i,r))},step(i,r){return this.check(_r(i,r))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function hg(e){return jp(ci,e)}var Qr=f("ZodNumberFormat",(e,t)=>{Zm.init(e,t),ci.init(e,t)});function Ec(e){return Lp(Qr,e)}function QE(e){return Up(Qr,e)}function ex(e){return Fp(Qr,e)}function tx(e){return Bp(Qr,e)}function rx(e){return Vp(Qr,e)}var ui=f("ZodBoolean",(e,t)=>{vo.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>bf(e,n,i,r)});function vg(e){return Zp(ui,e)}var li=f("ZodBigInt",(e,t)=>{ws.init(e,t),w.init(e,t),e._zod.processJSONSchema=(i,r,o)=>yf(e,i,r,o),e.gte=(i,r)=>e.check(Me(i,r)),e.min=(i,r)=>e.check(Me(i,r)),e.gt=(i,r)=>e.check(Ct(i,r)),e.gte=(i,r)=>e.check(Me(i,r)),e.min=(i,r)=>e.check(Me(i,r)),e.lt=(i,r)=>e.check(Pt(i,r)),e.lte=(i,r)=>e.check(Qe(i,r)),e.max=(i,r)=>e.check(Qe(i,r)),e.positive=i=>e.check(Ct(BigInt(0),i)),e.negative=i=>e.check(Pt(BigInt(0),i)),e.nonpositive=i=>e.check(Qe(BigInt(0),i)),e.nonnegative=i=>e.check(Me(BigInt(0),i)),e.multipleOf=(i,r)=>e.check(_r(i,r));let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});function nx(e){return Wp(li,e)}var Fc=f("ZodBigIntFormat",(e,t)=>{Gm.init(e,t),li.init(e,t)});function ix(e){return qp(Fc,e)}function ox(e){return Kp(Fc,e)}var bg=f("ZodSymbol",(e,t)=>{Wm.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Sf(e,n,i,r)});function ax(e){return Yp(bg,e)}var yg=f("ZodUndefined",(e,t)=>{Hm.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Ef(e,n,i,r)});function sx(e){return Xp(yg,e)}var Sg=f("ZodNull",(e,t)=>{qm.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>_f(e,n,i,r)});function _g(e){return Jp(Sg,e)}var Eg=f("ZodAny",(e,t)=>{Km.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>If(e,n,i,r)});function cx(){return Qp(Eg)}var xg=f("ZodUnknown",(e,t)=>{Ym.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>$f(e,n,i,r)});function Jr(){return ef(xg)}var Ag=f("ZodNever",(e,t)=>{Xm.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Af(e,n,i,r)});function Bc(e){return tf(Ag,e)}var Ig=f("ZodVoid",(e,t)=>{Jm.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xf(e,n,i,r)});function ux(e){return rf(Ig,e)}var No=f("ZodDate",(e,t)=>{Qm.init(e,t),w.init(e,t),e._zod.processJSONSchema=(i,r,o)=>Tf(e,i,r,o),e.min=(i,r)=>e.check(Me(i,r)),e.max=(i,r)=>e.check(Qe(i,r));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function lx(e){return nf(No,e)}var $g=f("ZodArray",(e,t)=>{ep.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Lf(e,n,i,r),e.element=t.element,Po(e,"ZodArray",{min(n,i){return this.check(Xt(n,i))},nonempty(n){return this.check(Xt(1,n))},max(n,i){return this.check(Yr(n,i))},length(n,i){return this.check(Xr(n,i))},unwrap(){return this.element}})});function wo(e,t){return sf($g,e,t)}function dx(e){let t=e._zod.def.shape;return Zc(Object.keys(t))}var ko=f("ZodObject",(e,t)=>{tp.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Uf(e,n,i,r),_.defineLazy(e,"shape",()=>t.shape),Po(e,"ZodObject",{keyof(){return Zc(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:Jr()})},loose(){return this.clone({...this._zod.def,catchall:Jr()})},strict(){return this.clone({...this._zod.def,catchall:Bc()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return _.extend(this,n)},safeExtend(n){return _.safeExtend(this,n)},merge(n){return _.merge(this,n)},pick(n){return _.pick(this,n)},omit(n){return _.omit(this,n)},partial(...n){return _.partial(Wc,this,n[0])},required(...n){return _.required(Hc,this,n[0])}})});function mx(e,t){let n={type:"object",shape:e??{},..._.normalizeParams(t)};return new ko(n)}function px(e,t){return new ko({type:"object",shape:e,catchall:Bc(),..._.normalizeParams(t)})}function fx(e,t){return new ko({type:"object",shape:e,catchall:Jr(),..._.normalizeParams(t)})}var Oo=f("ZodUnion",(e,t)=>{bo.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>pc(e,n,i,r),e.options=t.options});function Vc(e,t){return new Oo({type:"union",options:e,..._.normalizeParams(t)})}var Tg=f("ZodXor",(e,t)=>{Oo.init(e,t),rp.init(e,t),e._zod.processJSONSchema=(n,i,r)=>pc(e,n,i,r),e.options=t.options});function gx(e,t){return new Tg({type:"union",options:e,inclusive:!1,..._.normalizeParams(t)})}var Rg=f("ZodDiscriminatedUnion",(e,t)=>{Oo.init(e,t),np.init(e,t)});function hx(e,t,n){return new Rg({type:"union",options:t,discriminator:e,..._.normalizeParams(n)})}var Pg=f("ZodIntersection",(e,t)=>{ip.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Ff(e,n,i,r)});function Cg(e,t){return new Pg({type:"intersection",left:e,right:t})}var Ng=f("ZodTuple",(e,t)=>{ks.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Bf(e,n,i,r),e.rest=n=>e.clone({...e._zod.def,rest:n})});function wg(e,t,n){let i=t instanceof N,r=i?n:t,o=i?t:null;return new Ng({type:"tuple",items:e,rest:o,..._.normalizeParams(r)})}var ii=f("ZodRecord",(e,t)=>{op.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Vf(e,n,i,r),e.keyType=t.keyType,e.valueType=t.valueType});function kg(e,t,n){return!t||!t._zod?new ii({type:"record",keyType:Io(),valueType:e,..._.normalizeParams(t)}):new ii({type:"record",keyType:e,valueType:t,..._.normalizeParams(n)})}function vx(e,t,n){let i=Oe(e);return i._zod.values=void 0,new ii({type:"record",keyType:i,valueType:t,..._.normalizeParams(n)})}function bx(e,t,n){return new ii({type:"record",keyType:e,valueType:t,mode:"loose",..._.normalizeParams(n)})}var Og=f("ZodMap",(e,t)=>{ap.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>jf(e,n,i,r),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...n)=>e.check(Nt(...n)),e.nonempty=n=>e.check(Nt(1,n)),e.max=(...n)=>e.check(Er(...n)),e.size=(...n)=>e.check(Kr(...n))});function yx(e,t,n){return new Og({type:"map",keyType:e,valueType:t,..._.normalizeParams(n)})}var Dg=f("ZodSet",(e,t)=>{sp.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>zf(e,n,i,r),e.min=(...n)=>e.check(Nt(...n)),e.nonempty=n=>e.check(Nt(1,n)),e.max=(...n)=>e.check(Er(...n)),e.size=(...n)=>e.check(Kr(...n))});function Sx(e,t){return new Dg({type:"set",valueType:e,..._.normalizeParams(t)})}var oi=f("ZodEnum",(e,t)=>{cp.init(e,t),w.init(e,t),e._zod.processJSONSchema=(i,r,o)=>Rf(e,i,r,o),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(i,r)=>{let o={};for(let a of i)if(n.has(a))o[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new oi({...t,checks:[],..._.normalizeParams(r),entries:o})},e.exclude=(i,r)=>{let o={...t.entries};for(let a of i)if(n.has(a))delete o[a];else throw new Error(`Key ${a} not found in enum`);return new oi({...t,checks:[],..._.normalizeParams(r),entries:o})}});function Zc(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new oi({type:"enum",entries:n,..._.normalizeParams(t)})}function _x(e,t){return new oi({type:"enum",entries:e,..._.normalizeParams(t)})}var Mg=f("ZodLiteral",(e,t)=>{up.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Pf(e,n,i,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Ex(e,t){return new Mg({type:"literal",values:Array.isArray(e)?e:[e],..._.normalizeParams(t)})}var jg=f("ZodFile",(e,t)=>{lp.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>wf(e,n,i,r),e.min=(n,i)=>e.check(Nt(n,i)),e.max=(n,i)=>e.check(Er(n,i)),e.mime=(n,i)=>e.check(Kn(Array.isArray(n)?n:[n],i))});function xx(e){return cf(jg,e)}var zg=f("ZodTransform",(e,t)=>{dp.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Mf(e,n,i,r),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new hr(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(_.issue(o,n.value,t));else{let a=o;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=e),n.issues.push(_.issue(a))}};let r=t.transform(n.value,n);return r instanceof Promise?r.then(o=>(n.value=o,n.fallback=!0,n)):(n.value=r,n.fallback=!0,n)}});function Gc(e){return new zg({type:"transform",transform:e})}var Wc=f("ZodOptional",(e,t)=>{Os.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>fc(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function To(e){return new Wc({type:"optional",innerType:e})}var Lg=f("ZodExactOptional",(e,t)=>{mp.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>fc(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function Ug(e){return new Lg({type:"optional",innerType:e})}var Fg=f("ZodNullable",(e,t)=>{pp.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Zf(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function Ro(e){return new Fg({type:"nullable",innerType:e})}function Ax(e){return To(Ro(e))}var Bg=f("ZodDefault",(e,t)=>{fp.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Wf(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Vg(e,t){return new Bg({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():_.shallowClone(t)}})}var Zg=f("ZodPrefault",(e,t)=>{gp.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Hf(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function Gg(e,t){return new Zg({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():_.shallowClone(t)}})}var Hc=f("ZodNonOptional",(e,t)=>{hp.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Gf(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function Wg(e,t){return new Hc({type:"nonoptional",innerType:e,..._.normalizeParams(t)})}var Hg=f("ZodSuccess",(e,t)=>{vp.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>kf(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function Ix(e){return new Hg({type:"success",innerType:e})}var qg=f("ZodCatch",(e,t)=>{bp.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>qf(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Kg(e,t){return new qg({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var Yg=f("ZodNaN",(e,t)=>{yp.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Cf(e,n,i,r)});function $x(e){return af(Yg,e)}var Do=f("ZodPipe",(e,t)=>{Ds.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Kf(e,n,i,r),e.in=t.in,e.out=t.out});function xc(e,t){return new Do({type:"pipe",in:e,out:t})}var Mo=f("ZodCodec",(e,t)=>{Do.init(e,t),yo.init(e,t)});function Tx(e,t,n){return new Mo({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function Rx(e){let t=e._zod.def;return new Mo({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var Xg=f("ZodPreprocess",(e,t)=>{Do.init(e,t),Sp.init(e,t)}),Jg=f("ZodReadonly",(e,t)=>{_p.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Yf(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function Qg(e){return new Jg({type:"readonly",innerType:e})}var eh=f("ZodTemplateLiteral",(e,t)=>{Ep.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Nf(e,n,i,r)});function Px(e,t){return new eh({type:"template_literal",parts:e,..._.normalizeParams(t)})}var th=f("ZodLazy",(e,t)=>{Ip.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Jf(e,n,i,r),e.unwrap=()=>e._zod.def.getter()});function rh(e){return new th({type:"lazy",getter:e})}var nh=f("ZodPromise",(e,t)=>{Ap.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Xf(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function Cx(e){return new nh({type:"promise",innerType:e})}var ih=f("ZodFunction",(e,t)=>{xp.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Df(e,n,i,r)});function Nx(e){return new ih({type:"function",input:Array.isArray(e?.input)?wg(e?.input):e?.input??wo(Jr()),output:e?.output??Jr()})}var jo=f("ZodCustom",(e,t)=>{$p.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Of(e,n,i,r)});function wx(e){let t=new X({check:"custom"});return t._zod.check=e,t}function kx(e,t){return uf(jo,e??(()=>!0),t)}function oh(e,t={}){return lf(jo,e,t)}function ah(e,t){return df(e,t)}var Ox=mf,Dx=pf;function Mx(e,t={}){let n=new jo({type:"custom",check:"custom",fn:i=>i instanceof e,abort:!0,..._.normalizeParams(t)});return n._zod.bag.Class=e,n._zod.check=i=>{i.value instanceof e||i.issues.push({code:"invalid_type",expected:e.name,input:i.value,inst:n,path:[...n._zod.def.path??[]]})},n}var jx=(...e)=>ff({Codec:Mo,Boolean:ui,String:ai},...e);function zx(e){let t=rh(()=>Vc([Io(e),hg(),vg(),_g(),wo(t),kg(Io(),t)]));return t}function Lx(e,t){return new Xg({type:"pipe",in:Gc(e),out:t})}var m1={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function p1(e){se({customError:e})}function f1(){return se().customError}var sh;sh||(sh={});var x={...Ao,...vc,iso:ni},g1=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function h1(e,t){let n=e.$schema;return n==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":n==="http://json-schema.org/draft-07/schema#"?"draft-7":n==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function v1(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;let i=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===i){let r=n[1];if(!r||!t.defs[r])throw new Error(`Reference not found: ${e}`);return t.defs[r]}throw new Error(`Reference not found: ${e}`)}function Ux(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return x.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let r=e.$ref;if(t.refs.has(r))return t.refs.get(r);if(t.processing.has(r))return x.lazy(()=>{if(!t.refs.has(r))throw new Error(`Circular reference not resolved: ${r}`);return t.refs.get(r)});t.processing.add(r);let o=v1(r,t),a=Te(o,t);return t.refs.set(r,a),t.processing.delete(r),a}if(e.enum!==void 0){let r=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&r.length===1&&r[0]===null)return x.null();if(r.length===0)return x.never();if(r.length===1)return x.literal(r[0]);if(r.every(a=>typeof a=="string"))return x.enum(r);let o=r.map(a=>x.literal(a));return o.length<2?o[0]:x.union([o[0],o[1],...o.slice(2)])}if(e.const!==void 0)return x.literal(e.const);let n=e.type;if(Array.isArray(n)){let r=n.map(o=>{let a={...e,type:o};return Ux(a,t)});return r.length===0?x.never():r.length===1?r[0]:x.union(r)}if(!n)return x.any();let i;switch(n){case"string":{let r=x.string();if(e.format){let o=e.format;o==="email"?r=r.check(x.email()):o==="uri"||o==="uri-reference"?r=r.check(x.url()):o==="uuid"||o==="guid"?r=r.check(x.uuid()):o==="date-time"?r=r.check(x.iso.datetime()):o==="date"?r=r.check(x.iso.date()):o==="time"?r=r.check(x.iso.time()):o==="duration"?r=r.check(x.iso.duration()):o==="ipv4"?r=r.check(x.ipv4()):o==="ipv6"?r=r.check(x.ipv6()):o==="mac"?r=r.check(x.mac()):o==="cidr"?r=r.check(x.cidrv4()):o==="cidr-v6"?r=r.check(x.cidrv6()):o==="base64"?r=r.check(x.base64()):o==="base64url"?r=r.check(x.base64url()):o==="e164"?r=r.check(x.e164()):o==="jwt"?r=r.check(x.jwt()):o==="emoji"?r=r.check(x.emoji()):o==="nanoid"?r=r.check(x.nanoid()):o==="cuid"?r=r.check(x.cuid()):o==="cuid2"?r=r.check(x.cuid2()):o==="ulid"?r=r.check(x.ulid()):o==="xid"?r=r.check(x.xid()):o==="ksuid"&&(r=r.check(x.ksuid()))}typeof e.minLength=="number"&&(r=r.min(e.minLength)),typeof e.maxLength=="number"&&(r=r.max(e.maxLength)),e.pattern&&(r=r.regex(new RegExp(e.pattern))),i=r;break}case"number":case"integer":{let r=n==="integer"?x.number().int():x.number();typeof e.minimum=="number"&&(r=r.min(e.minimum)),typeof e.maximum=="number"&&(r=r.max(e.maximum)),typeof e.exclusiveMinimum=="number"?r=r.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(r=r.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?r=r.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(r=r.lt(e.maximum)),typeof e.multipleOf=="number"&&(r=r.multipleOf(e.multipleOf)),i=r;break}case"boolean":{i=x.boolean();break}case"null":{i=x.null();break}case"object":{let r={},o=e.properties||{},a=new Set(e.required||[]);for(let[u,l]of Object.entries(o)){let m=Te(l,t);r[u]=a.has(u)?m:m.optional()}if(e.propertyNames){let u=Te(e.propertyNames,t),l=e.additionalProperties&&typeof e.additionalProperties=="object"?Te(e.additionalProperties,t):x.any();if(Object.keys(r).length===0){i=x.record(u,l);break}let m=x.object(r).passthrough(),p=x.looseRecord(u,l);i=x.intersection(m,p);break}if(e.patternProperties){let u=e.patternProperties,l=Object.keys(u),m=[];for(let g of l){let v=Te(u[g],t),A=x.string().regex(new RegExp(g));m.push(x.looseRecord(A,v))}let p=[];if(Object.keys(r).length>0&&p.push(x.object(r).passthrough()),p.push(...m),p.length===0)i=x.object({}).passthrough();else if(p.length===1)i=p[0];else{let g=x.intersection(p[0],p[1]);for(let v=2;v<p.length;v++)g=x.intersection(g,p[v]);i=g}break}let c=x.object(r);e.additionalProperties===!1?i=c.strict():typeof e.additionalProperties=="object"?i=c.catchall(Te(e.additionalProperties,t)):i=c.passthrough();break}case"array":{let r=e.prefixItems,o=e.items;if(r&&Array.isArray(r)){let a=r.map(u=>Te(u,t)),c=o&&typeof o=="object"&&!Array.isArray(o)?Te(o,t):void 0;c?i=x.tuple(a).rest(c):i=x.tuple(a),typeof e.minItems=="number"&&(i=i.check(x.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(x.maxLength(e.maxItems)))}else if(Array.isArray(o)){let a=o.map(u=>Te(u,t)),c=e.additionalItems&&typeof e.additionalItems=="object"?Te(e.additionalItems,t):void 0;c?i=x.tuple(a).rest(c):i=x.tuple(a),typeof e.minItems=="number"&&(i=i.check(x.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(x.maxLength(e.maxItems)))}else if(o!==void 0){let a=Te(o,t),c=x.array(a);typeof e.minItems=="number"&&(c=c.min(e.minItems)),typeof e.maxItems=="number"&&(c=c.max(e.maxItems)),i=c}else i=x.array(x.any());break}default:throw new Error(`Unsupported type: ${n}`)}return i}function Te(e,t){if(typeof e=="boolean")return e?x.any():x.never();let n=Ux(e,t),i=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let c=e.anyOf.map(l=>Te(l,t)),u=x.union(c);n=i?x.intersection(n,u):u}if(e.oneOf&&Array.isArray(e.oneOf)){let c=e.oneOf.map(l=>Te(l,t)),u=x.xor(c);n=i?x.intersection(n,u):u}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=i?n:x.any();else{let c=i?n:Te(e.allOf[0],t),u=i?0:1;for(let l=u;l<e.allOf.length;l++)c=x.intersection(c,Te(e.allOf[l],t));n=c}e.nullable===!0&&t.version==="openapi-3.0"&&(n=x.nullable(n)),e.readOnly===!0&&(n=x.readonly(n)),e.default!==void 0&&(n=n.default(e.default));let r={},o=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let c of o)c in e&&(r[c]=e[c]);let a=["contentEncoding","contentMediaType","contentSchema"];for(let c of a)c in e&&(r[c]=e[c]);for(let c of Object.keys(e))g1.has(c)||(r[c]=e[c]);return Object.keys(r).length>0&&t.registry.add(n,r),e.description&&(n=n.describe(e.description)),n}function Fx(e,t){if(typeof e=="boolean")return e?x.any():x.never();let n;try{n=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let i=h1(n,t?.defaultTarget),r=n.$defs||n.definitions||{},o={version:i,defs:r,refs:new Map,processing:new Set,rootSchema:n,registry:t?.registry??_e};return Te(n,o)}var ch={};$t(ch,{bigint:()=>_1,boolean:()=>S1,date:()=>E1,number:()=>y1,string:()=>b1});function b1(e){return Cp(ai,e)}function y1(e){return zp(ci,e)}function S1(e){return Gp(ui,e)}function _1(e){return Hp(li,e)}function E1(e){return of(No,e)}se(Ms());var x1=Object.defineProperty,di=(e,t)=>x1(e,"name",{value:t,configurable:!0}),uh=["production","staging","development","platform","compliance"],Bx={production:"Production",staging:"Staging",development:"Development",platform:"Platform",compliance:"Compliance"},A1=new Set(uh);function Kc(e){return A1.has(e)}di(Kc,"isAccountStage");var zo={ROOT:"root",PLATFORM:"platform"},I1=[...uh,zo.ROOT];function Vx(e){return Kc(e)?Bx[e]:e.charAt(0).toUpperCase()+e.slice(1)}di(Vx,"getEnvironmentLabel");var Zx=["organisation","platform","account"],$1=s.enum(Zx),qc={ORGANISATION:"organisation",PLATFORM:"platform",ACCOUNT:"account"},T1={[qc.ORGANISATION]:!0,[qc.PLATFORM]:!0,[qc.ACCOUNT]:!0},R1=new Set(Object.keys(T1));function Gx(e){return R1.has(e)}di(Gx,"isAccountTier");function lh(e){return e===zo.ROOT?"organisation":e===zo.PLATFORM?"platform":"account"}di(lh,"environmentToTier");function Wx(e){return e==null||e===""||e===zo.ROOT?null:Kc(e)?e:null}di(Wx,"stageFromWireEnvironment");function Lo(e){return e.tier??lh(e.environment)}di(Lo,"accountTier");var P1=Object.defineProperty,Uo=(e,t)=>P1(e,"name",{value:t,configurable:!0});var Hx=Object.freeze({"AWS::IAM::Role":"security","AWS::IAM::Policy":"security","AWS::IAM::OIDCProvider":"security","AWS::EC2::SecurityGroup":"security","AWS::KMS::Key":"security","AWS::KMS::Alias":"security","AWS::EC2::VPC":"network","AWS::EC2::Subnet":"network","AWS::EC2::InternetGateway":"network","AWS::EC2::NatGateway":"network","AWS::EC2::RouteTable":"network","AWS::EC2::Route":"network","AWS::EC2::VPCGatewayAttachment":"network","AWS::EC2::SubnetRouteTableAssociation":"network","AWS::EC2::EIP":"network","AWS::ECS::Cluster":"compute","AWS::ECS::Service":"compute","AWS::ECS::TaskDefinition":"compute","AWS::Lambda::Function":"compute","AWS::ElasticLoadBalancingV2::LoadBalancer":"compute","AWS::ElasticLoadBalancingV2::TargetGroup":"compute","AWS::ElasticLoadBalancingV2::Listener":"compute","AWS::ElasticLoadBalancingV2::ListenerRule":"compute","AWS::RDS::DBInstance":"database","AWS::RDS::DBCluster":"database","AWS::SecretsManager::Secret":"database","AWS::S3::Bucket":"storage","AWS::S3::BucketPolicy":"storage","AWS::CloudTrail::Trail":"monitoring","AWS::CloudWatch::Alarm":"monitoring","AWS::Logs::LogGroup":"monitoring","AWS::Events::EventBus":"events","AWS::Events::Rule":"events","AWS::ECR::Repository":"registry","AWS::CodeBuild::Project":"registry","AWS::Route53::RecordSet":"dns","AWS::CertificateManager::Certificate":"dns","AWS::CloudFront::Distribution":"dns","AWS::Backup::BackupVault":"backup","AWS::Backup::BackupPlan":"backup","AWS::Backup::BackupSelection":"backup","AWS::SSO::PermissionSet":"identity","AWS::SSO::Assignment":"identity","AWS::Organizations::Account":"identity","AWS::CDK::Metadata":"compute","AWS::CloudFormation::CustomResource":"compute","AWS::CloudFormation::WaitCondition":"compute","AWS::CloudFormation::WaitConditionHandle":"compute"}),dh=new Set;function qx(e){if(!e)return"compute";if(e.startsWith("Custom::"))return Hx[e]??"compute";let t=Hx[e];return t||dh.add(e),t??"compute"}Uo(qx,"categoriseResource");function C1(){return new Set(dh)}Uo(C1,"getUnmappedResourceTypes");function N1(){dh.clear()}Uo(N1,"clearUnmappedResourceTypes");var w1=Object.freeze({"AWS::EC2::NatGateway":120,"AWS::RDS::DBInstance":300,"AWS::RDS::DBCluster":300,"AWS::CloudFront::Distribution":300,"AWS::ECS::Service":180,"AWS::ElasticLoadBalancingV2::LoadBalancer":60,"AWS::EC2::SecurityGroup":10,"AWS::IAM::Role":15,"AWS::IAM::Policy":15,"AWS::IAM::OIDCProvider":10,"AWS::S3::Bucket":10,"AWS::S3::BucketPolicy":5,"AWS::Lambda::Function":30,"AWS::EC2::VPC":15,"AWS::EC2::Subnet":15,"AWS::EC2::InternetGateway":10,"AWS::EC2::RouteTable":5,"AWS::EC2::Route":5,"AWS::EC2::VPCGatewayAttachment":10,"AWS::EC2::SubnetRouteTableAssociation":5,"AWS::EC2::EIP":10,"AWS::ECS::Cluster":15,"AWS::ECS::TaskDefinition":10,"AWS::ElasticLoadBalancingV2::TargetGroup":10,"AWS::ElasticLoadBalancingV2::Listener":10,"AWS::ElasticLoadBalancingV2::ListenerRule":5,"AWS::SecretsManager::Secret":10,"AWS::Logs::LogGroup":5,"AWS::CloudWatch::Alarm":10,"AWS::CloudTrail::Trail":15,"AWS::Events::EventBus":5,"AWS::Events::Rule":5,"AWS::ECR::Repository":10,"AWS::Route53::RecordSet":30,"AWS::CertificateManager::Certificate":60,"AWS::KMS::Key":15,"AWS::KMS::Alias":5,"AWS::Backup::BackupVault":10,"AWS::Backup::BackupPlan":10,"AWS::Backup::BackupSelection":10,"AWS::SSO::PermissionSet":15,"AWS::SSO::Assignment":10,"AWS::Organizations::Account":60}),k1=30;function Kx(e){return w1[e]??k1}Uo(Kx,"getExpectedDuration");var O1=Object.freeze({"AWS::Lambda::Function":"Lambda Function","AWS::IAM::Role":"IAM Role","AWS::IAM::Policy":"IAM Policy","AWS::S3::Bucket":"S3 Bucket","AWS::DynamoDB::Table":"DynamoDB Table","AWS::EC2::Instance":"EC2 Instance","AWS::EC2::SecurityGroup":"Security Group","AWS::EC2::VPC":"VPC","AWS::EC2::Subnet":"Subnet","AWS::EC2::InternetGateway":"Internet Gateway","AWS::EC2::RouteTable":"Route Table","AWS::EC2::Route":"Route","AWS::ECS::Cluster":"ECS Cluster","AWS::ECS::Service":"ECS Service","AWS::ECS::TaskDefinition":"Task Definition","AWS::ElasticLoadBalancingV2::LoadBalancer":"Load Balancer","AWS::ElasticLoadBalancingV2::TargetGroup":"Target Group","AWS::ElasticLoadBalancingV2::Listener":"Listener","AWS::CloudFormation::Stack":"CloudFormation Stack","AWS::CDK::Metadata":"CDK Metadata","Custom::CDKBucketDeployment":"Bucket Deployment","AWS::SSM::Parameter":"SSM Parameter","AWS::CloudWatch::Alarm":"CloudWatch Alarm","AWS::Logs::LogGroup":"Log Group","AWS::ApiGateway::RestApi":"API Gateway","AWS::ApiGateway::Deployment":"API Deployment","AWS::ApiGateway::Stage":"API Stage","AWS::ApiGateway::Method":"API Method","AWS::ApiGateway::Resource":"API Resource","AWS::CloudFront::Distribution":"CloudFront Distribution","AWS::Route53::RecordSet":"Route53 Record","AWS::RDS::DBInstance":"RDS Instance","AWS::RDS::DBCluster":"RDS Cluster","AWS::SQS::Queue":"SQS Queue","AWS::SNS::Topic":"SNS Topic","AWS::Events::Rule":"EventBridge Rule","AWS::StepFunctions::StateMachine":"Step Function","AWS::EC2::NatGateway":"NAT Gateway","AWS::EC2::EIP":"Elastic IP","AWS::EC2::VPCGatewayAttachment":"Gateway Attachment","AWS::EC2::SubnetRouteTableAssociation":"Route Association","AWS::CloudTrail::Trail":"CloudTrail","AWS::IAM::OIDCProvider":"OIDC Provider","AWS::Events::EventBus":"Event Bus","AWS::Backup::BackupVault":"Backup Vault","AWS::Backup::BackupPlan":"Backup Plan","AWS::Backup::BackupSelection":"Backup Selection","AWS::SecretsManager::Secret":"Secret","AWS::KMS::Key":"KMS Key","AWS::KMS::Alias":"KMS Alias","AWS::ECR::Repository":"ECR Repository","AWS::CertificateManager::Certificate":"Certificate","AWS::ElasticLoadBalancingV2::ListenerRule":"Listener Rule","AWS::EC2::IPAM":"IPAM","AWS::EC2::IPAMPool":"IPAM Pool","AWS::EC2::IPAMPoolCidr":"IPAM Pool CIDR","Custom::ram":"RAM","Custom::ipamDelegateAdmin":"IPAM Delegate Admin","Custom::CostAllocationTags":"Cost Allocation Tags","Custom::ActivateOrganisationsAccess":"Activate Organisations Access","Custom::Organizations_TagResource":"Organisations Tag Resource","AWS::CloudFormation::CustomResource":"Custom Resource","AWS::CloudFormation::WaitCondition":"Wait Condition","AWS::CloudFormation::WaitConditionHandle":"Wait Condition Handle","AWS::SSO::PermissionSet":"SSO Permission Set","AWS::SSO::Assignment":"SSO Assignment","AWS::Organizations::Account":"Organisations Account","AWS::S3::BucketPolicy":"S3 Bucket Policy","AWS::CodeBuild::Project":"CodeBuild Project"});function Yx(e){return O1[e]||e.split("::").pop()||e}Uo(Yx,"getFriendlyResourceType");var D1=Object.defineProperty,M1=(e,t)=>D1(e,"name",{value:t,configurable:!0}),j1={"github.com":"github","gitlab.com":"gitlab","bitbucket.org":"bitbucket"},z1=/^https?:\/\/([^/]+)\/(.+?)\/([^/.]+?)(?:\.git)?$/,L1=/^git@([^:]+):(.+?)\/([^/.]+?)(?:\.git)?$/,U1=/^ssh:\/\/[^@]+@([^:/]+)(?::\d+)?\/(.+?)\/([^/.]+?)(?:\.git)?$/;function Xx(e){if(!e)return null;let t=e.replace(/^(https?:\/\/)[^@]+@/,"$1"),n=t.match(z1)??t.match(L1)??e.match(U1);if(!n)return null;let[,i,r,o]=n;return!i||!r||!o?null:{provider:j1[i]??"other",owner:r,repo:o,host:i}}M1(Xx,"parseGitRemoteUrl");var mh=["read","write","deploy","secrets:read","secrets:write","destroy","admin","applications:read","applications:deploy","deploy:oidc:mint"],Jx={read:"user",write:"user",deploy:"user","secrets:read":"user","secrets:write":"user",destroy:"user",admin:"admin","applications:read":"user","applications:deploy":"user","deploy:oidc:mint":"machine"},F1=mh.filter(e=>Jx[e]==="machine"),B1=mh.filter(e=>Jx[e]==="user");var V1=Object.defineProperty,mi=(e,t)=>V1(e,"name",{value:t,configurable:!0}),Xc=/^[a-zA-Z_][a-zA-Z0-9._-]*$/,ph="Secret name must start with a letter or underscore and contain only letters, numbers, underscores, hyphens, or periods",Fo=/^[a-zA-Z][a-zA-Z0-9._-]*$/,Jc="Must start with a letter and contain only letters, numbers, periods, hyphens, or underscores";var Yc=s.string().regex(Fo,Jc),Qx=s.object({app:Yc.describe("Application name"),cluster:Yc.optional().describe("Cluster name"),service:Yc.optional().describe("Service name"),lambda:Yc.optional().describe("Lambda function name")}).strict().refine(e=>!(e.service&&!e.cluster),{message:"Cluster is required when service is specified"}).refine(e=>!(e.lambda&&(e.cluster||e.service)),{message:"Lambda is mutually exclusive with cluster and service"}).refine(e=>e.cluster!=="lambda",{message:'The cluster name "lambda" is reserved for lambda-scoped parameter paths'});function fh(e){let t=[e.app];return e.lambda?t.push("lambda",e.lambda):(e.cluster&&t.push(e.cluster),e.service&&e.cluster&&t.push(e.service)),t}mi(fh,"buildNamespaceParts");function gh(e,t){let n=fh(e);return t&&n.push(t),"/"+n.join("/")}mi(gh,"buildParameterPath");function hh(e){let t=e.split("/").filter(Boolean);if(t.length<2)return null;let n=t[t.length-1]??"",i={app:t[0]??""};return t.length>=4&&t[1]==="lambda"?i.lambda=t[2]:t.length>=3&&(i.cluster=t[1],t.length>=4&&(i.service=t[2])),{namespace:i,name:n}}mi(hh,"parseParameterPath");function eA(e){let t=hh(e);return t?Qx.safeParse(t.namespace).success&&gh(t.namespace,t.name)===e:!1}mi(eA,"isManageablePath");function tA(e){let t={};for(let n of e.split(`
165
165
  `)){let i=n.trim();if(!i||i.startsWith("#"))continue;let r=i.replace(/^export\s+/,""),o=r.indexOf("=");if(o===-1)continue;let a=r.slice(0,o).trim();if(!Xc.test(a))continue;let c=r.slice(o+1);c.length>=2&&c.startsWith('"')&&c.endsWith('"')?t[a]=c.slice(1,-1).replace(/\\([\\"$`nr])/g,(u,l)=>l==="n"?`
166
- `:l==="r"?"\r":l):c.length>=2&&c.startsWith("'")&&c.endsWith("'")?t[a]=c.slice(1,-1):t[a]=c}return t}mi(tA,"parseDotEnv");function rA(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\$/g,"\\$").replace(/`/g,"\\`").replace(/\n/g,"\\n").replace(/\r/g,"\\r")}mi(rA,"escapeDotEnvValue");var nA=s.object({awsAccountId:s.string(),accountName:s.string().nullable(),status:s.string(),role:s.string(),roleArn:s.string(),environment:s.string().optional(),connectedAt:s.string()}),Z1=s.object({accounts:s.array(nA)});var G1=Object.defineProperty,en=(e,t)=>G1(e,"name",{value:t,configurable:!0});function vh(e){let t=[e.primaryRegion,...e.secondaryRegions??[],e.disasterRecoveryRegion].filter(n=>n!==void 0);return[...new Set(t)]}en(vh,"deriveRegionsFromOrgConfig");function bh(e){return e.environment??Lo(e)}en(bh,"environmentOrTier");function yh(e,t){return`${e.toLowerCase()}-${Nn(t)}`}en(yh,"generateTargetName");function Sh(e,t){let n=[];for(let i of e){if(Lo(i)==="organisation")continue;let r=bh(i);for(let o of t)n.push({name:yh(i.name,o),accountName:i.name,accountId:i.id,environment:r,region:o})}return n.sort((i,r)=>{let o=i.environment.localeCompare(r.environment);if(o!==0)return o;let a=i.accountName.localeCompare(r.accountName);return a!==0?a:i.region.localeCompare(r.region)})}en(Sh,"deriveTargets");function iA(e){return Sh(e.providerAccounts,vh(e))}en(iA,"deriveAllTargets");function W1(e,t){if(t.length===0)return e;let n=new Set([e.primaryRegion,e.disasterRecoveryRegion].filter(Boolean)),i=t.filter(r=>!n.has(r));return{...e,secondaryRegions:i.length>0?i:void 0}}en(W1,"mergeSecondaryRegions");function oA(e,t){return e.find(n=>n.name===t)}en(oA,"findTarget");var H1=Object.defineProperty,q1=(e,t)=>H1(e,"name",{value:t,configurable:!0});function aA(e,t){if(t!==void 0){if(t.trim()==="")throw new Error("buildAppConfigPath: container must be a non-empty string");return`${t}/fjall/${e}`}return`fjall/${e}`}q1(aA,"buildAppConfigPath");var K1=Object.defineProperty,pi=(e,t)=>K1(e,"name",{value:t,configurable:!0}),_h="infrastructure.ts",Eh="fjall";function sA(e,t){let n=t?.excludedPathPrefixes,i=t?.excludedPathSegments,r=[];for(let o of e){if(!xh(o.path)||n&&uA(o.path,n)||i&&lA(o.path,i))continue;let a=Ah(o.path);a!==null&&r.push({configPath:cA(o.path),boundaryPath:a})}return r}pi(sA,"findInfrastructurePaths");function xh(e){return e===_h||e.endsWith(`/${_h}`)}pi(xh,"isInfrastructureFile");function Ah(e){let t=e.split("/");for(let n=0;n<t.length-1;n++)if(t[n]===Eh)return t.slice(0,n+1).join("/");return null}pi(Ah,"findBoundaryPath");function cA(e){return e.slice(0,-`/${_h}`.length)}pi(cA,"toConfigDir");function uA(e,t){for(let n of t)if(e.startsWith(n))return!0;return!1}pi(uA,"hasExcludedPrefix");function lA(e,t){let n=e.split("/");for(let i=0;i<n.length-1;i++)if(t.has(n[i]))return!0;return!1}pi(lA,"hasExcludedSegment");var Y1=Object.defineProperty,Ih=(e,t)=>Y1(e,"name",{value:t,configurable:!0});function dA(e){if(e.length===0)return null;let t=[];for(let i of e){let r=mA(i.boundaryPath);if(r===null)return null;t.push(r)}let n=pA(t);return n.length===0?null:n.join("/")}Ih(dA,"inferContainerFromCandidates");function mA(e){let t=e.split("/").filter(i=>i.length>0);if(t.length===0||t[t.length-1]!==Eh)return null;let n=t.slice(0,t.length-1);return n.length===0?null:n}Ih(mA,"extractContainer");function pA(e){if(e.length===0)return[];let[t,...n]=e,i=[];for(let r=0;r<t.length;r+=1){let o=t[r];for(let a of n)if(a[r]!==o)return i;i.push(o)}return i}Ih(pA,"longestCommonPrefix");var X1=Object.defineProperty,fA=(e,t)=>X1(e,"name",{value:t,configurable:!0}),gA=["fjall","organisation","platform","account"];function hA(e){return gA.includes(e.toLowerCase())}fA(hA,"isReservedAppName");var vA="-cache";function bA(e){return Tt(e).endsWith(vA)}fA(bA,"hasReservedAppNameSuffix");var J1=Object.defineProperty,$h=(e,t)=>J1(e,"name",{value:t,configurable:!0});function SA(e){return{success:!0,data:e}}$h(SA,"success");function Bo(e){return{success:!1,error:e}}$h(Bo,"failure");var yA="sha256:",Qc=12,Q1=new RegExp(`-sha-[0-9a-f]{${Qc}}$`);function _A(e,t,n){if(!e.startsWith(yA))return Bo(new Error(`expected sha256:... digest, got ${e.slice(0,32)}`));let i=e.slice(yA.length);if(i.length<Qc)return Bo(new Error(`digest hex payload too short (need >=${Qc} chars, got ${i.length})`));let r=t.trim();if(r==="")return Bo(new Error("serviceName must be a non-empty string"));let o;if(n!==void 0){let u=n.trim();if(u==="")return Bo(new Error("target, when supplied, must be a non-empty string; omit the argument instead"));o=u.toLowerCase()}let a=i.slice(0,Qc).toLowerCase(),c=o!==void 0?`${r.toLowerCase()}-${o}`:r.toLowerCase();return SA(`${c}-sha-${a}`)}$h(_A,"deriveContentHashTag");var eM=Object.defineProperty,tM=(e,t)=>eM(e,"name",{value:t,configurable:!0}),EA=["full","code-only","rollback","restart"],rM=s.enum(EA),xA=/^[a-zA-Z0-9._-]+$/,AA=s.string().min(1).max(128).regex(xA),IA=s.object({serviceName:s.string().min(1),imageTag:AA,imageDigest:s.string().min(1).optional(),imageUri:s.string().min(1),ecrRepositoryArn:s.string().min(1).optional(),taskDefinitionArn:s.string().min(1).optional(),previousTaskDefinitionArn:s.string().min(1).optional(),functionArn:s.string().min(1).optional(),publishedVersion:s.string().min(1).optional()}).strict(),nM=s.array(IA);function $A(e,t){return`${e}${t}`}tM($A,"artefactOutputKey");var iM=Object.defineProperty,TA=(e,t)=>iM(e,"name",{value:t,configurable:!0}),kt=["payload","nextjs","staticsite"],Th=new Set(kt);function Rh(e){return typeof e=="string"&&Th.has(e)}TA(Rh,"isPatternType");var fi={payload:{label:"Payload CMS",constructIdSuffix:"Payload",artefact:"opennext-lambda",stackPlacement:"compute",deployable:!0},nextjs:{label:"Next.js",constructIdSuffix:"Nextjs",artefact:"opennext-lambda",stackPlacement:"compute",deployable:!1},staticsite:{label:"Static site",constructIdSuffix:"StaticSite",artefact:"static-assets",stackPlacement:"cdn",deployable:!0}},RA=kt.filter(e=>fi[e].deployable),Ph=kt.filter(e=>fi[e].artefact==="opennext-lambda"),oM=new Set(Ph);function Ch(e){return e!=null&&oM.has(e)}TA(Ch,"isOpenNextPatternType");var Vo=["multipage","spa"];var aM=Object.defineProperty,Nh=(e,t)=>aM(e,"name",{value:t,configurable:!0}),PA="noreply";function CA(e){return`${PA}@${e}`}Nh(CA,"defaultFormsFromAddress");function NA(e){return`https://${e}`}Nh(NA,"defaultFormsCorsOrigin");function eu(e,t){let n=e.split("@");if(n.length!==2)return!1;let[i,r]=n;return i===void 0||i===""||r===void 0?!1:r.toLowerCase()===t.toLowerCase()}Nh(eu,"isAddressAtDomain");var wA=2;var sM=s.object({devDomain:s.string().min(1),hostedZoneId:s.string().min(1).optional(),parentDomain:s.string().min(1).optional(),parentDelegationRoleArn:s.string().min(1).optional()}).strict().superRefine((e,t)=>{if(e.hostedZoneId!==void 0){e.parentDomain!==void 0&&t.addIssue({code:"custom",path:["parentDomain"],message:"hostedZoneId (adopt mode) is mutually exclusive with parentDomain \u2014 the adopted zone was already delegated; omit parentDomain"}),e.parentDelegationRoleArn!==void 0&&t.addIssue({code:"custom",path:["parentDelegationRoleArn"],message:"hostedZoneId (adopt mode) is mutually exclusive with parentDelegationRoleArn \u2014 the adopted zone was already delegated; omit parentDelegationRoleArn"});return}e.parentDelegationRoleArn!==void 0&&e.parentDomain===void 0&&t.addIssue({code:"custom",path:["parentDomain"],message:"parentDelegationRoleArn requires parentDomain \u2014 set parentDomain to the parent zone the DelegationRole belongs to"}),e.parentDomain!==void 0&&!e.devDomain.endsWith(`.${e.parentDomain}`)&&t.addIssue({code:"custom",path:["parentDomain"],message:"parentDomain must be a proper DNS suffix of devDomain \u2014 devDomain must end with `.<parentDomain>`"})}),kA={appId:s.string().min(1),appKebab:s.string().min(1),engineVersion:s.string().min(1).optional(),adoptSlotEcr:s.boolean().optional(),phase:s.enum(["zone","full"]).optional(),domain:sM.optional()},cM=s.object(kA).strict(),uM=s.object({...kA,version:s.literal(wA),appName:s.string().min(1)}).strict().refine(e=>e.appName===`fjall-dev-${e.appKebab}`,{message:"appName must equal `fjall-dev-${appKebab}` (single-source identity)",path:["appName"]});import{existsSync as II,mkdirSync as Yj,statSync as Xj,appendFileSync as Jj}from"fs";import{join as $I}from"path";import{join as cv}from"path";var dM=Object.defineProperty,OA=(e,t)=>dM(e,"name",{value:t,configurable:!0});function DA(e){return e.mode==="cli"}OA(DA,"isCLIMode");function MA(e){return e.mode==="ink"}OA(MA,"isInkMode");var jA=(e=0)=>t=>`\x1B[${t+e}m`,zA=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,LA=(e=0)=>(t,n,i)=>`\x1B[${38+e};2;${t};${n};${i}m`,re={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},L3=Object.keys(re.modifier),mM=Object.keys(re.color),pM=Object.keys(re.bgColor),U3=[...mM,...pM];function fM(){let e=new Map;for(let[t,n]of Object.entries(re)){for(let[i,r]of Object.entries(n))re[i]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},n[i]=re[i],e.set(r[0],r[1]);Object.defineProperty(re,t,{value:n,enumerable:!1})}return Object.defineProperty(re,"codes",{value:e,enumerable:!1}),re.color.close="\x1B[39m",re.bgColor.close="\x1B[49m",re.color.ansi=jA(),re.color.ansi256=zA(),re.color.ansi16m=LA(),re.bgColor.ansi=jA(10),re.bgColor.ansi256=zA(10),re.bgColor.ansi16m=LA(10),Object.defineProperties(re,{rgbToAnsi256:{value(t,n,i){return t===n&&n===i?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(i/255*5)},enumerable:!1},hexToRgb:{value(t){let n=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!n)return[0,0,0];let[i]=n;i.length===3&&(i=[...i].map(o=>o+o).join(""));let r=Number.parseInt(i,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:t=>re.rgbToAnsi256(...re.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let n,i,r;if(t>=232)n=((t-232)*10+8)/255,i=n,r=n;else{t-=16;let c=t%36;n=Math.floor(t/36)/5,i=Math.floor(c/6)/5,r=c%6/5}let o=Math.max(n,i,r)*2;if(o===0)return 30;let a=30+(Math.round(r)<<2|Math.round(i)<<1|Math.round(n));return o===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(t,n,i)=>re.ansi256ToAnsi(re.rgbToAnsi256(t,n,i)),enumerable:!1},hexToAnsi:{value:t=>re.ansi256ToAnsi(re.hexToAnsi256(t)),enumerable:!1}}),re}var gM=fM(),St=gM;import wh from"node:process";import hM from"node:os";import UA from"node:tty";function at(e,t=globalThis.Deno?globalThis.Deno.args:wh.argv){let n=e.startsWith("-")?"":e.length===1?"-":"--",i=t.indexOf(n+e),r=t.indexOf("--");return i!==-1&&(r===-1||i<r)}var{env:ne}=wh,tu;at("no-color")||at("no-colors")||at("color=false")||at("color=never")?tu=0:(at("color")||at("colors")||at("color=true")||at("color=always"))&&(tu=1);function vM(){if("FORCE_COLOR"in ne)return ne.FORCE_COLOR==="true"?1:ne.FORCE_COLOR==="false"?0:ne.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(ne.FORCE_COLOR,10),3)}function bM(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function yM(e,{streamIsTTY:t,sniffFlags:n=!0}={}){let i=vM();i!==void 0&&(tu=i);let r=n?tu:i;if(r===0)return 0;if(n){if(at("color=16m")||at("color=full")||at("color=truecolor"))return 3;if(at("color=256"))return 2}if("TF_BUILD"in ne&&"AGENT_NAME"in ne)return 1;if(e&&!t&&r===void 0)return 0;let o=r||0;if(ne.TERM==="dumb")return o;if(wh.platform==="win32"){let a=hM.release().split(".");return Number(a[0])>=10&&Number(a[2])>=10586?Number(a[2])>=14931?3:2:1}if("CI"in ne)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(a=>a in ne)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(a=>a in ne)||ne.CI_NAME==="codeship"?1:o;if("TEAMCITY_VERSION"in ne)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(ne.TEAMCITY_VERSION)?1:0;if(ne.COLORTERM==="truecolor"||ne.TERM==="xterm-kitty"||ne.TERM==="xterm-ghostty"||ne.TERM==="wezterm")return 3;if("TERM_PROGRAM"in ne){let a=Number.parseInt((ne.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(ne.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(ne.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(ne.TERM)||"COLORTERM"in ne?1:o}function FA(e,t={}){let n=yM(e,{streamIsTTY:e&&e.isTTY,...t});return bM(n)}var SM={stdout:FA({isTTY:UA.isatty(1)}),stderr:FA({isTTY:UA.isatty(2)})},BA=SM;function VA(e,t,n){let i=e.indexOf(t);if(i===-1)return e;let r=t.length,o=0,a="";do a+=e.slice(o,i)+t+n,o=i+r,i=e.indexOf(t,o);while(i!==-1);return a+=e.slice(o),a}function ZA(e,t,n,i){let r=0,o="";do{let a=e[i-1]==="\r";o+=e.slice(r,a?i-1:i)+t+(a?`\r
166
+ `:l==="r"?"\r":l):c.length>=2&&c.startsWith("'")&&c.endsWith("'")?t[a]=c.slice(1,-1):t[a]=c}return t}mi(tA,"parseDotEnv");function rA(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\$/g,"\\$").replace(/`/g,"\\`").replace(/\n/g,"\\n").replace(/\r/g,"\\r")}mi(rA,"escapeDotEnvValue");var nA=s.object({awsAccountId:s.string(),accountName:s.string().nullable(),status:s.string(),role:s.string(),roleArn:s.string(),environment:s.string().optional(),connectedAt:s.string()}),Z1=s.object({accounts:s.array(nA)});var G1=Object.defineProperty,en=(e,t)=>G1(e,"name",{value:t,configurable:!0});function vh(e){let t=[e.primaryRegion,...e.secondaryRegions??[],e.disasterRecoveryRegion].filter(n=>n!==void 0);return[...new Set(t)]}en(vh,"deriveRegionsFromOrgConfig");function bh(e){return e.environment??Lo(e)}en(bh,"environmentOrTier");function yh(e,t){return`${e.toLowerCase()}-${Nn(t)}`}en(yh,"generateTargetName");function Sh(e,t){let n=[];for(let i of e){if(Lo(i)==="organisation")continue;let r=bh(i);for(let o of t)n.push({name:yh(i.name,o),accountName:i.name,accountId:i.id,environment:r,region:o})}return n.sort((i,r)=>{let o=i.environment.localeCompare(r.environment);if(o!==0)return o;let a=i.accountName.localeCompare(r.accountName);return a!==0?a:i.region.localeCompare(r.region)})}en(Sh,"deriveTargets");function iA(e){return Sh(e.providerAccounts,vh(e))}en(iA,"deriveAllTargets");function W1(e,t){if(t.length===0)return e;let n=new Set([e.primaryRegion,e.disasterRecoveryRegion].filter(Boolean)),i=t.filter(r=>!n.has(r));return{...e,secondaryRegions:i.length>0?i:void 0}}en(W1,"mergeSecondaryRegions");function oA(e,t){return e.find(n=>n.name===t)}en(oA,"findTarget");var H1=Object.defineProperty,q1=(e,t)=>H1(e,"name",{value:t,configurable:!0});function aA(e,t){if(t!==void 0){if(t.trim()==="")throw new Error("buildAppConfigPath: container must be a non-empty string");return`${t}/fjall/${e}`}return`fjall/${e}`}q1(aA,"buildAppConfigPath");var K1=Object.defineProperty,pi=(e,t)=>K1(e,"name",{value:t,configurable:!0}),_h="infrastructure.ts",Eh="fjall";function sA(e,t){let n=t?.excludedPathPrefixes,i=t?.excludedPathSegments,r=[];for(let o of e){if(!xh(o.path)||n&&uA(o.path,n)||i&&lA(o.path,i))continue;let a=Ah(o.path);a!==null&&r.push({configPath:cA(o.path),boundaryPath:a})}return r}pi(sA,"findInfrastructurePaths");function xh(e){return e===_h||e.endsWith(`/${_h}`)}pi(xh,"isInfrastructureFile");function Ah(e){let t=e.split("/");for(let n=0;n<t.length-1;n++)if(t[n]===Eh)return t.slice(0,n+1).join("/");return null}pi(Ah,"findBoundaryPath");function cA(e){return e.slice(0,-`/${_h}`.length)}pi(cA,"toConfigDir");function uA(e,t){for(let n of t)if(e.startsWith(n))return!0;return!1}pi(uA,"hasExcludedPrefix");function lA(e,t){let n=e.split("/");for(let i=0;i<n.length-1;i++)if(t.has(n[i]))return!0;return!1}pi(lA,"hasExcludedSegment");var Y1=Object.defineProperty,Ih=(e,t)=>Y1(e,"name",{value:t,configurable:!0});function dA(e){if(e.length===0)return null;let t=[];for(let i of e){let r=mA(i.boundaryPath);if(r===null)return null;t.push(r)}let n=pA(t);return n.length===0?null:n.join("/")}Ih(dA,"inferContainerFromCandidates");function mA(e){let t=e.split("/").filter(i=>i.length>0);if(t.length===0||t[t.length-1]!==Eh)return null;let n=t.slice(0,t.length-1);return n.length===0?null:n}Ih(mA,"extractContainer");function pA(e){if(e.length===0)return[];let[t,...n]=e,i=[];for(let r=0;r<t.length;r+=1){let o=t[r];for(let a of n)if(a[r]!==o)return i;i.push(o)}return i}Ih(pA,"longestCommonPrefix");var X1=Object.defineProperty,fA=(e,t)=>X1(e,"name",{value:t,configurable:!0}),gA=["fjall","organisation","platform","account"];function hA(e){return gA.includes(e.toLowerCase())}fA(hA,"isReservedAppName");var vA="-cache";function bA(e){return Tt(e).endsWith(vA)}fA(bA,"hasReservedAppNameSuffix");var J1=Object.defineProperty,$h=(e,t)=>J1(e,"name",{value:t,configurable:!0});function SA(e){return{success:!0,data:e}}$h(SA,"success");function Bo(e){return{success:!1,error:e}}$h(Bo,"failure");var yA="sha256:",Qc=12,Q1=new RegExp(`-sha-[0-9a-f]{${Qc}}$`);function _A(e,t,n){if(!e.startsWith(yA))return Bo(new Error(`expected sha256:... digest, got ${e.slice(0,32)}`));let i=e.slice(yA.length);if(i.length<Qc)return Bo(new Error(`digest hex payload too short (need >=${Qc} chars, got ${i.length})`));let r=t.trim();if(r==="")return Bo(new Error("serviceName must be a non-empty string"));let o;if(n!==void 0){let u=n.trim();if(u==="")return Bo(new Error("target, when supplied, must be a non-empty string; omit the argument instead"));o=u.toLowerCase()}let a=i.slice(0,Qc).toLowerCase(),c=o!==void 0?`${r.toLowerCase()}-${o}`:r.toLowerCase();return SA(`${c}-sha-${a}`)}$h(_A,"deriveContentHashTag");var eM=Object.defineProperty,tM=(e,t)=>eM(e,"name",{value:t,configurable:!0}),EA=["full","code-only","rollback","restart"],rM=s.enum(EA),xA=/^[a-zA-Z0-9._-]+$/,AA=s.string().min(1).max(128).regex(xA),IA=s.object({serviceName:s.string().min(1),imageTag:AA,imageDigest:s.string().min(1).optional(),imageUri:s.string().min(1),ecrRepositoryArn:s.string().min(1).optional(),taskDefinitionArn:s.string().min(1).optional(),previousTaskDefinitionArn:s.string().min(1).optional(),functionArn:s.string().min(1).optional(),publishedVersion:s.string().min(1).optional()}).strict(),nM=s.array(IA);function $A(e,t){return`${e}${t}`}tM($A,"artefactOutputKey");var iM=Object.defineProperty,TA=(e,t)=>iM(e,"name",{value:t,configurable:!0}),kt=["payload","nextjs","staticsite"],Th=new Set(kt);function Rh(e){return typeof e=="string"&&Th.has(e)}TA(Rh,"isPatternType");var fi={payload:{label:"Payload CMS",constructIdSuffix:"Payload",artefact:"opennext-lambda",stackPlacement:"compute",deployable:!0},nextjs:{label:"Next.js",constructIdSuffix:"Nextjs",artefact:"opennext-lambda",stackPlacement:"compute",deployable:!1},staticsite:{label:"Static site",constructIdSuffix:"StaticSite",artefact:"static-assets",stackPlacement:"cdn",deployable:!0}},RA=kt.filter(e=>fi[e].deployable),Ph=kt.filter(e=>fi[e].artefact==="opennext-lambda"),oM=new Set(Ph);function Ch(e){return e!=null&&oM.has(e)}TA(Ch,"isOpenNextPatternType");var Vo=["multipage","spa"];var aM=Object.defineProperty,Nh=(e,t)=>aM(e,"name",{value:t,configurable:!0}),PA="noreply";function CA(e){return`${PA}@${e}`}Nh(CA,"defaultFormsFromAddress");function NA(e){return`https://${e}`}Nh(NA,"defaultFormsCorsOrigin");function eu(e,t){let n=e.split("@");if(n.length!==2)return!1;let[i,r]=n;return i===void 0||i===""||r===void 0?!1:r.toLowerCase()===t.toLowerCase()}Nh(eu,"isAddressAtDomain");var wA=2;var sM=s.object({devDomain:s.string().min(1),hostedZoneId:s.string().min(1).optional(),parentDomain:s.string().min(1).optional(),parentDelegationRoleArn:s.string().min(1).optional()}).strict().superRefine((e,t)=>{if(e.hostedZoneId!==void 0){e.parentDomain!==void 0&&t.addIssue({code:"custom",path:["parentDomain"],message:"hostedZoneId (adopt mode) is mutually exclusive with parentDomain \u2014 the adopted zone was already delegated; omit parentDomain"}),e.parentDelegationRoleArn!==void 0&&t.addIssue({code:"custom",path:["parentDelegationRoleArn"],message:"hostedZoneId (adopt mode) is mutually exclusive with parentDelegationRoleArn \u2014 the adopted zone was already delegated; omit parentDelegationRoleArn"});return}e.parentDelegationRoleArn!==void 0&&e.parentDomain===void 0&&t.addIssue({code:"custom",path:["parentDomain"],message:"parentDelegationRoleArn requires parentDomain \u2014 set parentDomain to the parent zone the DelegationRole belongs to"}),e.parentDomain!==void 0&&!e.devDomain.endsWith(`.${e.parentDomain}`)&&t.addIssue({code:"custom",path:["parentDomain"],message:"parentDomain must be a proper DNS suffix of devDomain \u2014 devDomain must end with `.<parentDomain>`"})}),kA={appId:s.string().min(1),appKebab:s.string().min(1),engineVersion:s.string().min(1).optional(),adoptSlotEcr:s.boolean().optional(),phase:s.enum(["zone","full"]).optional(),domain:sM.optional()},cM=s.object(kA).strict(),uM=s.object({...kA,version:s.literal(wA),appName:s.string().min(1)}).strict().refine(e=>e.appName===`fjall-dev-${e.appKebab}`,{message:"appName must equal `fjall-dev-${appKebab}` (single-source identity)",path:["appName"]});import{existsSync as II,mkdirSync as Yj,statSync as Xj,appendFileSync as Jj}from"fs";import{join as $I}from"path";import{join as cv}from"path";var dM=Object.defineProperty,OA=(e,t)=>dM(e,"name",{value:t,configurable:!0});function DA(e){return e.mode==="cli"}OA(DA,"isCLIMode");function MA(e){return e.mode==="ink"}OA(MA,"isInkMode");var jA=(e=0)=>t=>`\x1B[${t+e}m`,zA=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,LA=(e=0)=>(t,n,i)=>`\x1B[${38+e};2;${t};${n};${i}m`,re={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},U3=Object.keys(re.modifier),mM=Object.keys(re.color),pM=Object.keys(re.bgColor),F3=[...mM,...pM];function fM(){let e=new Map;for(let[t,n]of Object.entries(re)){for(let[i,r]of Object.entries(n))re[i]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},n[i]=re[i],e.set(r[0],r[1]);Object.defineProperty(re,t,{value:n,enumerable:!1})}return Object.defineProperty(re,"codes",{value:e,enumerable:!1}),re.color.close="\x1B[39m",re.bgColor.close="\x1B[49m",re.color.ansi=jA(),re.color.ansi256=zA(),re.color.ansi16m=LA(),re.bgColor.ansi=jA(10),re.bgColor.ansi256=zA(10),re.bgColor.ansi16m=LA(10),Object.defineProperties(re,{rgbToAnsi256:{value(t,n,i){return t===n&&n===i?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(i/255*5)},enumerable:!1},hexToRgb:{value(t){let n=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!n)return[0,0,0];let[i]=n;i.length===3&&(i=[...i].map(o=>o+o).join(""));let r=Number.parseInt(i,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:t=>re.rgbToAnsi256(...re.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let n,i,r;if(t>=232)n=((t-232)*10+8)/255,i=n,r=n;else{t-=16;let c=t%36;n=Math.floor(t/36)/5,i=Math.floor(c/6)/5,r=c%6/5}let o=Math.max(n,i,r)*2;if(o===0)return 30;let a=30+(Math.round(r)<<2|Math.round(i)<<1|Math.round(n));return o===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(t,n,i)=>re.ansi256ToAnsi(re.rgbToAnsi256(t,n,i)),enumerable:!1},hexToAnsi:{value:t=>re.ansi256ToAnsi(re.hexToAnsi256(t)),enumerable:!1}}),re}var gM=fM(),St=gM;import wh from"node:process";import hM from"node:os";import UA from"node:tty";function at(e,t=globalThis.Deno?globalThis.Deno.args:wh.argv){let n=e.startsWith("-")?"":e.length===1?"-":"--",i=t.indexOf(n+e),r=t.indexOf("--");return i!==-1&&(r===-1||i<r)}var{env:ne}=wh,tu;at("no-color")||at("no-colors")||at("color=false")||at("color=never")?tu=0:(at("color")||at("colors")||at("color=true")||at("color=always"))&&(tu=1);function vM(){if("FORCE_COLOR"in ne)return ne.FORCE_COLOR==="true"?1:ne.FORCE_COLOR==="false"?0:ne.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(ne.FORCE_COLOR,10),3)}function bM(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function yM(e,{streamIsTTY:t,sniffFlags:n=!0}={}){let i=vM();i!==void 0&&(tu=i);let r=n?tu:i;if(r===0)return 0;if(n){if(at("color=16m")||at("color=full")||at("color=truecolor"))return 3;if(at("color=256"))return 2}if("TF_BUILD"in ne&&"AGENT_NAME"in ne)return 1;if(e&&!t&&r===void 0)return 0;let o=r||0;if(ne.TERM==="dumb")return o;if(wh.platform==="win32"){let a=hM.release().split(".");return Number(a[0])>=10&&Number(a[2])>=10586?Number(a[2])>=14931?3:2:1}if("CI"in ne)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(a=>a in ne)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(a=>a in ne)||ne.CI_NAME==="codeship"?1:o;if("TEAMCITY_VERSION"in ne)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(ne.TEAMCITY_VERSION)?1:0;if(ne.COLORTERM==="truecolor"||ne.TERM==="xterm-kitty"||ne.TERM==="xterm-ghostty"||ne.TERM==="wezterm")return 3;if("TERM_PROGRAM"in ne){let a=Number.parseInt((ne.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(ne.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(ne.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(ne.TERM)||"COLORTERM"in ne?1:o}function FA(e,t={}){let n=yM(e,{streamIsTTY:e&&e.isTTY,...t});return bM(n)}var SM={stdout:FA({isTTY:UA.isatty(1)}),stderr:FA({isTTY:UA.isatty(2)})},BA=SM;function VA(e,t,n){let i=e.indexOf(t);if(i===-1)return e;let r=t.length,o=0,a="";do a+=e.slice(o,i)+t+n,o=i+r,i=e.indexOf(t,o);while(i!==-1);return a+=e.slice(o),a}function ZA(e,t,n,i){let r=0,o="";do{let a=e[i-1]==="\r";o+=e.slice(r,a?i-1:i)+t+(a?`\r
167
167
  `:`
168
168
  `)+n,r=i+1,i=e.indexOf(`
169
169
  `,r)}while(i!==-1);return o+=e.slice(r),o}var{stdout:GA,stderr:WA}=BA,kh=Symbol("GENERATOR"),gi=Symbol("STYLER"),Zo=Symbol("IS_EMPTY"),HA=["ansi","ansi","ansi256","ansi16m"],hi=Object.create(null),_M=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let n=GA?GA.level:0;e.level=t.level===void 0?n:t.level};var EM=e=>{let t=(...n)=>n.join(" ");return _M(t,e),Object.setPrototypeOf(t,Go.prototype),t};function Go(e){return EM(e)}Object.setPrototypeOf(Go.prototype,Function.prototype);for(let[e,t]of Object.entries(St))hi[e]={get(){let n=ru(this,Dh(t.open,t.close,this[gi]),this[Zo]);return Object.defineProperty(this,e,{value:n}),n}};hi.visible={get(){let e=ru(this,this[gi],!0);return Object.defineProperty(this,"visible",{value:e}),e}};var Oh=(e,t,n,...i)=>e==="rgb"?t==="ansi16m"?St[n].ansi16m(...i):t==="ansi256"?St[n].ansi256(St.rgbToAnsi256(...i)):St[n].ansi(St.rgbToAnsi(...i)):e==="hex"?Oh("rgb",t,n,...St.hexToRgb(...i)):St[n][e](...i),xM=["rgb","hex","ansi256"];for(let e of xM){hi[e]={get(){let{level:n}=this;return function(...i){let r=Dh(Oh(e,HA[n],"color",...i),St.color.close,this[gi]);return ru(this,r,this[Zo])}}};let t="bg"+e[0].toUpperCase()+e.slice(1);hi[t]={get(){let{level:n}=this;return function(...i){let r=Dh(Oh(e,HA[n],"bgColor",...i),St.bgColor.close,this[gi]);return ru(this,r,this[Zo])}}}}var AM=Object.defineProperties(()=>{},{...hi,level:{enumerable:!0,get(){return this[kh].level},set(e){this[kh].level=e}}}),Dh=(e,t,n)=>{let i,r;return n===void 0?(i=e,r=t):(i=n.openAll+e,r=t+n.closeAll),{open:e,close:t,openAll:i,closeAll:r,parent:n}},ru=(e,t,n)=>{let i=(...r)=>IM(i,r.length===1?""+r[0]:r.join(" "));return Object.setPrototypeOf(i,AM),i[kh]=e,i[gi]=t,i[Zo]=n,i},IM=(e,t)=>{if(e.level<=0||!t)return e[Zo]?"":t;let n=e[gi];if(n===void 0)return t;let{openAll:i,closeAll:r}=n;if(t.includes("\x1B"))for(;n!==void 0;)t=VA(t,n.close,n.open),n=n.parent;let o=t.indexOf(`
170
- `);return o!==-1&&(t=ZA(t,r,i,o)),i+t+r};Object.defineProperties(Go.prototype,hi);var $M=Go(),Y3=Go({level:WA?WA.level:0});var Ee=$M;import Yo from"node:process";import{stripVTControlCharacters as fj}from"node:util";import QA from"node:process";import au from"node:process";var TM=(e,t,n,i)=>{if(n==="length"||n==="prototype"||n==="arguments"||n==="caller")return;let r=Object.getOwnPropertyDescriptor(e,n),o=Object.getOwnPropertyDescriptor(t,n);!RM(r,o)&&i||Object.defineProperty(e,n,o)},RM=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},PM=(e,t)=>{let n=Object.getPrototypeOf(t);n!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,n)},CM=(e,t)=>`/* Wrapped ${e}*/
171
- ${t}`,NM=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),wM=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),kM=(e,t,n)=>{let i=n===""?"":`with ${n.trim()}() `,r=CM.bind(null,i,t.toString());Object.defineProperty(r,"name",wM);let{writable:o,enumerable:a,configurable:c}=NM;Object.defineProperty(e,"toString",{value:r,writable:o,enumerable:a,configurable:c})};function Mh(e,t,{ignoreNonConfigurable:n=!1}={}){let{name:i}=e;for(let r of Reflect.ownKeys(t))TM(e,t,r,n);return PM(e,t),kM(e,t,i),e}var nu=new WeakMap,qA=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let n,i=0,r=e.displayName||e.name||"<anonymous>",o=function(...a){if(nu.set(o,++i),i===1)n=e.apply(this,a),e=void 0;else if(t.throw===!0)throw new Error(`Function \`${r}\` can only be called once`);return n};return Mh(o,e),nu.set(o,i),o};qA.callCount=e=>{if(!nu.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return nu.get(e)};var KA=qA;var tn=[];tn.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&tn.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&tn.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var iu=e=>!!e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function",jh=Symbol.for("signal-exit emitter"),zh=globalThis,OM=Object.defineProperty.bind(Object),Lh=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(zh[jh])return zh[jh];OM(zh,jh,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,n){this.listeners[t].push(n)}removeListener(t,n){let i=this.listeners[t],r=i.indexOf(n);r!==-1&&(r===0&&i.length===1?i.length=0:i.splice(r,1))}emit(t,n,i){if(this.emitted[t])return!1;this.emitted[t]=!0;let r=!1;for(let o of this.listeners[t])r=o(n,i)===!0||r;return t==="exit"&&(r=this.emit("afterExit",n,i)||r),r}},ou=class{},DM=e=>({onExit(t,n){return e.onExit(t,n)},load(){return e.load()},unload(){return e.unload()}}),Uh=class extends ou{onExit(){return()=>{}}load(){}unload(){}},Fh=class extends ou{#o=Bh.platform==="win32"?"SIGINT":"SIGHUP";#n=new Lh;#r;#e;#i;#t={};#a=!1;constructor(t){super(),this.#r=t,this.#t={};for(let n of tn)this.#t[n]=()=>{let i=this.#r.listeners(n),{count:r}=this.#n,o=t;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(r+=o.__signal_exit_emitter__.count),i.length===r){this.unload();let a=this.#n.emit("exit",null,n),c=n==="SIGHUP"?this.#o:n;a||t.kill(t.pid,c)}};this.#i=t.reallyExit,this.#e=t.emit}onExit(t,n){if(!iu(this.#r))return()=>{};this.#a===!1&&this.load();let i=n?.alwaysLast?"afterExit":"exit";return this.#n.on(i,t),()=>{this.#n.removeListener(i,t),this.#n.listeners.exit.length===0&&this.#n.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#a){this.#a=!0,this.#n.count+=1;for(let t of tn)try{let n=this.#t[t];n&&this.#r.on(t,n)}catch{}this.#r.emit=(t,...n)=>this.#d(t,...n),this.#r.reallyExit=t=>this.#c(t)}}unload(){this.#a&&(this.#a=!1,tn.forEach(t=>{let n=this.#t[t];if(!n)throw new Error("Listener not defined for signal: "+t);try{this.#r.removeListener(t,n)}catch{}}),this.#r.emit=this.#e,this.#r.reallyExit=this.#i,this.#n.count-=1)}#c(t){return iu(this.#r)?(this.#r.exitCode=t||0,this.#n.emit("exit",this.#r.exitCode,null),this.#i.call(this.#r,this.#r.exitCode)):0}#d(t,...n){let i=this.#e;if(t==="exit"&&iu(this.#r)){typeof n[0]=="number"&&(this.#r.exitCode=n[0]);let r=i.call(this.#r,t,...n);return this.#n.emit("exit",this.#r.exitCode,null),r}else return i.call(this.#r,t,...n)}},Bh=globalThis.process,{onExit:YA,load:n9,unload:i9}=DM(iu(Bh)?new Fh(Bh):new Uh);var XA=au.stderr.isTTY?au.stderr:au.stdout.isTTY?au.stdout:void 0,MM=XA?KA(()=>{YA(()=>{XA.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},JA=MM;var su=!1,vi={};vi.show=(e=QA.stderr)=>{e.isTTY&&(su=!1,e.write("\x1B[?25h"))};vi.hide=(e=QA.stderr)=>{e.isTTY&&(JA(),su=!0,e.write("\x1B[?25l"))};vi.toggle=(e,t)=>{e!==void 0&&(su=e),su?vi.show(t):vi.hide(t)};var Vh=vi;var Zh={dots:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]},dots2:{interval:80,frames:["\u28FE","\u28FD","\u28FB","\u28BF","\u287F","\u28DF","\u28EF","\u28F7"]},dots3:{interval:80,frames:["\u280B","\u2819","\u281A","\u281E","\u2816","\u2826","\u2834","\u2832","\u2833","\u2813"]},dots4:{interval:80,frames:["\u2804","\u2806","\u2807","\u280B","\u2819","\u2838","\u2830","\u2820","\u2830","\u2838","\u2819","\u280B","\u2807","\u2806"]},dots5:{interval:80,frames:["\u280B","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B"]},dots6:{interval:80,frames:["\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2834","\u2832","\u2812","\u2802","\u2802","\u2812","\u281A","\u2819","\u2809","\u2801"]},dots7:{interval:80,frames:["\u2808","\u2809","\u280B","\u2813","\u2812","\u2810","\u2810","\u2812","\u2816","\u2826","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808"]},dots8:{interval:80,frames:["\u2801","\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808","\u2808"]},dots9:{interval:80,frames:["\u28B9","\u28BA","\u28BC","\u28F8","\u28C7","\u2867","\u2857","\u284F"]},dots10:{interval:80,frames:["\u2884","\u2882","\u2881","\u2841","\u2848","\u2850","\u2860"]},dots11:{interval:100,frames:["\u2801","\u2802","\u2804","\u2840","\u2880","\u2820","\u2810","\u2808"]},dots12:{interval:80,frames:["\u2880\u2800","\u2840\u2800","\u2804\u2800","\u2882\u2800","\u2842\u2800","\u2805\u2800","\u2883\u2800","\u2843\u2800","\u280D\u2800","\u288B\u2800","\u284B\u2800","\u280D\u2801","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2888\u2829","\u2840\u2899","\u2804\u2859","\u2882\u2829","\u2842\u2898","\u2805\u2858","\u2883\u2828","\u2843\u2890","\u280D\u2850","\u288B\u2820","\u284B\u2880","\u280D\u2841","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2808\u2829","\u2800\u2899","\u2800\u2859","\u2800\u2829","\u2800\u2898","\u2800\u2858","\u2800\u2828","\u2800\u2890","\u2800\u2850","\u2800\u2820","\u2800\u2880","\u2800\u2840"]},dots13:{interval:80,frames:["\u28FC","\u28F9","\u28BB","\u283F","\u285F","\u28CF","\u28E7","\u28F6"]},dots14:{interval:80,frames:["\u2809\u2809","\u2808\u2819","\u2800\u2839","\u2800\u28B8","\u2800\u28F0","\u2880\u28E0","\u28C0\u28C0","\u28C4\u2840","\u28C6\u2800","\u2847\u2800","\u280F\u2800","\u280B\u2801"]},dots8Bit:{interval:80,frames:["\u2800","\u2801","\u2802","\u2803","\u2804","\u2805","\u2806","\u2807","\u2840","\u2841","\u2842","\u2843","\u2844","\u2845","\u2846","\u2847","\u2808","\u2809","\u280A","\u280B","\u280C","\u280D","\u280E","\u280F","\u2848","\u2849","\u284A","\u284B","\u284C","\u284D","\u284E","\u284F","\u2810","\u2811","\u2812","\u2813","\u2814","\u2815","\u2816","\u2817","\u2850","\u2851","\u2852","\u2853","\u2854","\u2855","\u2856","\u2857","\u2818","\u2819","\u281A","\u281B","\u281C","\u281D","\u281E","\u281F","\u2858","\u2859","\u285A","\u285B","\u285C","\u285D","\u285E","\u285F","\u2820","\u2821","\u2822","\u2823","\u2824","\u2825","\u2826","\u2827","\u2860","\u2861","\u2862","\u2863","\u2864","\u2865","\u2866","\u2867","\u2828","\u2829","\u282A","\u282B","\u282C","\u282D","\u282E","\u282F","\u2868","\u2869","\u286A","\u286B","\u286C","\u286D","\u286E","\u286F","\u2830","\u2831","\u2832","\u2833","\u2834","\u2835","\u2836","\u2837","\u2870","\u2871","\u2872","\u2873","\u2874","\u2875","\u2876","\u2877","\u2838","\u2839","\u283A","\u283B","\u283C","\u283D","\u283E","\u283F","\u2878","\u2879","\u287A","\u287B","\u287C","\u287D","\u287E","\u287F","\u2880","\u2881","\u2882","\u2883","\u2884","\u2885","\u2886","\u2887","\u28C0","\u28C1","\u28C2","\u28C3","\u28C4","\u28C5","\u28C6","\u28C7","\u2888","\u2889","\u288A","\u288B","\u288C","\u288D","\u288E","\u288F","\u28C8","\u28C9","\u28CA","\u28CB","\u28CC","\u28CD","\u28CE","\u28CF","\u2890","\u2891","\u2892","\u2893","\u2894","\u2895","\u2896","\u2897","\u28D0","\u28D1","\u28D2","\u28D3","\u28D4","\u28D5","\u28D6","\u28D7","\u2898","\u2899","\u289A","\u289B","\u289C","\u289D","\u289E","\u289F","\u28D8","\u28D9","\u28DA","\u28DB","\u28DC","\u28DD","\u28DE","\u28DF","\u28A0","\u28A1","\u28A2","\u28A3","\u28A4","\u28A5","\u28A6","\u28A7","\u28E0","\u28E1","\u28E2","\u28E3","\u28E4","\u28E5","\u28E6","\u28E7","\u28A8","\u28A9","\u28AA","\u28AB","\u28AC","\u28AD","\u28AE","\u28AF","\u28E8","\u28E9","\u28EA","\u28EB","\u28EC","\u28ED","\u28EE","\u28EF","\u28B0","\u28B1","\u28B2","\u28B3","\u28B4","\u28B5","\u28B6","\u28B7","\u28F0","\u28F1","\u28F2","\u28F3","\u28F4","\u28F5","\u28F6","\u28F7","\u28B8","\u28B9","\u28BA","\u28BB","\u28BC","\u28BD","\u28BE","\u28BF","\u28F8","\u28F9","\u28FA","\u28FB","\u28FC","\u28FD","\u28FE","\u28FF"]},dotsCircle:{interval:80,frames:["\u288E ","\u280E\u2801","\u280A\u2811","\u2808\u2831"," \u2871","\u2880\u2870","\u2884\u2860","\u2886\u2840"]},sand:{interval:80,frames:["\u2801","\u2802","\u2804","\u2840","\u2848","\u2850","\u2860","\u28C0","\u28C1","\u28C2","\u28C4","\u28CC","\u28D4","\u28E4","\u28E5","\u28E6","\u28EE","\u28F6","\u28F7","\u28FF","\u287F","\u283F","\u289F","\u281F","\u285B","\u281B","\u282B","\u288B","\u280B","\u280D","\u2849","\u2809","\u2811","\u2821","\u2881"]},line:{interval:130,frames:["-","\\","|","/"]},line2:{interval:100,frames:["\u2802","-","\u2013","\u2014","\u2013","-"]},rollingLine:{interval:80,frames:["/ "," - "," \\ "," |"," |"," \\ "," - ","/ "]},pipe:{interval:100,frames:["\u2524","\u2518","\u2534","\u2514","\u251C","\u250C","\u252C","\u2510"]},simpleDots:{interval:400,frames:[". ",".. ","..."," "]},simpleDotsScrolling:{interval:200,frames:[". ",".. ","..."," .."," ."," "]},star:{interval:70,frames:["\u2736","\u2738","\u2739","\u273A","\u2739","\u2737"]},star2:{interval:80,frames:["+","x","*"]},flip:{interval:70,frames:["_","_","_","-","`","`","'","\xB4","-","_","_","_"]},hamburger:{interval:100,frames:["\u2631","\u2632","\u2634"]},growVertical:{interval:120,frames:["\u2581","\u2583","\u2584","\u2585","\u2586","\u2587","\u2586","\u2585","\u2584","\u2583"]},growHorizontal:{interval:120,frames:["\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589","\u258A","\u258B","\u258C","\u258D","\u258E"]},balloon:{interval:140,frames:[" ",".","o","O","@","*"," "]},balloon2:{interval:120,frames:[".","o","O","\xB0","O","o","."]},noise:{interval:100,frames:["\u2593","\u2592","\u2591"]},bounce:{interval:120,frames:["\u2801","\u2802","\u2804","\u2802"]},boxBounce:{interval:120,frames:["\u2596","\u2598","\u259D","\u2597"]},boxBounce2:{interval:100,frames:["\u258C","\u2580","\u2590","\u2584"]},triangle:{interval:50,frames:["\u25E2","\u25E3","\u25E4","\u25E5"]},binary:{interval:80,frames:["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},arc:{interval:100,frames:["\u25DC","\u25E0","\u25DD","\u25DE","\u25E1","\u25DF"]},circle:{interval:120,frames:["\u25E1","\u2299","\u25E0"]},squareCorners:{interval:180,frames:["\u25F0","\u25F3","\u25F2","\u25F1"]},circleQuarters:{interval:120,frames:["\u25F4","\u25F7","\u25F6","\u25F5"]},circleHalves:{interval:50,frames:["\u25D0","\u25D3","\u25D1","\u25D2"]},squish:{interval:100,frames:["\u256B","\u256A"]},toggle:{interval:250,frames:["\u22B6","\u22B7"]},toggle2:{interval:80,frames:["\u25AB","\u25AA"]},toggle3:{interval:120,frames:["\u25A1","\u25A0"]},toggle4:{interval:100,frames:["\u25A0","\u25A1","\u25AA","\u25AB"]},toggle5:{interval:100,frames:["\u25AE","\u25AF"]},toggle6:{interval:300,frames:["\u101D","\u1040"]},toggle7:{interval:80,frames:["\u29BE","\u29BF"]},toggle8:{interval:100,frames:["\u25CD","\u25CC"]},toggle9:{interval:100,frames:["\u25C9","\u25CE"]},toggle10:{interval:100,frames:["\u3282","\u3280","\u3281"]},toggle11:{interval:50,frames:["\u29C7","\u29C6"]},toggle12:{interval:120,frames:["\u2617","\u2616"]},toggle13:{interval:80,frames:["=","*","-"]},arrow:{interval:100,frames:["\u2190","\u2196","\u2191","\u2197","\u2192","\u2198","\u2193","\u2199"]},arrow2:{interval:80,frames:["\u2B06\uFE0F ","\u2197\uFE0F ","\u27A1\uFE0F ","\u2198\uFE0F ","\u2B07\uFE0F ","\u2199\uFE0F ","\u2B05\uFE0F ","\u2196\uFE0F "]},arrow3:{interval:120,frames:["\u25B9\u25B9\u25B9\u25B9\u25B9","\u25B8\u25B9\u25B9\u25B9\u25B9","\u25B9\u25B8\u25B9\u25B9\u25B9","\u25B9\u25B9\u25B8\u25B9\u25B9","\u25B9\u25B9\u25B9\u25B8\u25B9","\u25B9\u25B9\u25B9\u25B9\u25B8"]},bouncingBar:{interval:80,frames:["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},bouncingBall:{interval:80,frames:["( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF)","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","(\u25CF )"]},smiley:{interval:200,frames:["\u{1F604} ","\u{1F61D} "]},monkey:{interval:300,frames:["\u{1F648} ","\u{1F648} ","\u{1F649} ","\u{1F64A} "]},hearts:{interval:100,frames:["\u{1F49B} ","\u{1F499} ","\u{1F49C} ","\u{1F49A} ","\u{1F497} "]},clock:{interval:100,frames:["\u{1F55B} ","\u{1F550} ","\u{1F551} ","\u{1F552} ","\u{1F553} ","\u{1F554} ","\u{1F555} ","\u{1F556} ","\u{1F557} ","\u{1F558} ","\u{1F559} ","\u{1F55A} "]},earth:{interval:180,frames:["\u{1F30D} ","\u{1F30E} ","\u{1F30F} "]},material:{interval:17,frames:["\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581"]},moon:{interval:80,frames:["\u{1F311} ","\u{1F312} ","\u{1F313} ","\u{1F314} ","\u{1F315} ","\u{1F316} ","\u{1F317} ","\u{1F318} "]},runner:{interval:140,frames:["\u{1F6B6} ","\u{1F3C3} "]},pong:{interval:80,frames:["\u2590\u2802 \u258C","\u2590\u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802\u258C","\u2590 \u2820\u258C","\u2590 \u2840\u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590\u2820 \u258C"]},shark:{interval:120,frames:["\u2590|\\____________\u258C","\u2590_|\\___________\u258C","\u2590__|\\__________\u258C","\u2590___|\\_________\u258C","\u2590____|\\________\u258C","\u2590_____|\\_______\u258C","\u2590______|\\______\u258C","\u2590_______|\\_____\u258C","\u2590________|\\____\u258C","\u2590_________|\\___\u258C","\u2590__________|\\__\u258C","\u2590___________|\\_\u258C","\u2590____________|\\\u258C","\u2590____________/|\u258C","\u2590___________/|_\u258C","\u2590__________/|__\u258C","\u2590_________/|___\u258C","\u2590________/|____\u258C","\u2590_______/|_____\u258C","\u2590______/|______\u258C","\u2590_____/|_______\u258C","\u2590____/|________\u258C","\u2590___/|_________\u258C","\u2590__/|__________\u258C","\u2590_/|___________\u258C","\u2590/|____________\u258C"]},dqpb:{interval:100,frames:["d","q","p","b"]},weather:{interval:100,frames:["\u2600\uFE0F ","\u2600\uFE0F ","\u2600\uFE0F ","\u{1F324} ","\u26C5\uFE0F ","\u{1F325} ","\u2601\uFE0F ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u26C8 ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u2601\uFE0F ","\u{1F325} ","\u26C5\uFE0F ","\u{1F324} ","\u2600\uFE0F ","\u2600\uFE0F "]},christmas:{interval:400,frames:["\u{1F332}","\u{1F384}"]},grenade:{interval:80,frames:["\u060C ","\u2032 "," \xB4 "," \u203E "," \u2E0C"," \u2E0A"," |"," \u204E"," \u2055"," \u0DF4 "," \u2053"," "," "," "]},point:{interval:125,frames:["\u2219\u2219\u2219","\u25CF\u2219\u2219","\u2219\u25CF\u2219","\u2219\u2219\u25CF","\u2219\u2219\u2219"]},layer:{interval:150,frames:["-","=","\u2261"]},betaWave:{interval:80,frames:["\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1"]},fingerDance:{interval:160,frames:["\u{1F918} ","\u{1F91F} ","\u{1F596} ","\u270B ","\u{1F91A} ","\u{1F446} "]},fistBump:{interval:80,frames:["\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u3000\u{1F91C}\u3000\u3000\u{1F91B}\u3000 ","\u3000\u3000\u{1F91C}\u{1F91B}\u3000\u3000 ","\u3000\u{1F91C}\u2728\u{1F91B}\u3000\u3000 ","\u{1F91C}\u3000\u2728\u3000\u{1F91B}\u3000 "]},soccerHeader:{interval:80,frames:[" \u{1F9D1}\u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F\u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} "]},mindblown:{interval:160,frames:["\u{1F610} ","\u{1F610} ","\u{1F62E} ","\u{1F62E} ","\u{1F626} ","\u{1F626} ","\u{1F627} ","\u{1F627} ","\u{1F92F} ","\u{1F4A5} ","\u2728 ","\u3000 ","\u3000 ","\u3000 "]},speaker:{interval:160,frames:["\u{1F508} ","\u{1F509} ","\u{1F50A} ","\u{1F509} "]},orangePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} "]},bluePulse:{interval:100,frames:["\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},orangeBluePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} ","\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},timeTravel:{interval:100,frames:["\u{1F55B} ","\u{1F55A} ","\u{1F559} ","\u{1F558} ","\u{1F557} ","\u{1F556} ","\u{1F555} ","\u{1F554} ","\u{1F553} ","\u{1F552} ","\u{1F551} ","\u{1F550} "]},aesthetic:{interval:80,frames:["\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1"]},dwarfFortress:{interval:80,frames:[" \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A \u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A \xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A \xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\u2593\xA3 "," \u263A\u2593\xA3 "," \u263A\u2592\xA3 "," \u263A\u2592\xA3 "," \u263A\u2591\xA3 "," \u263A\u2591\xA3 "," \u263A \xA3 "," \u263A\xA3 "," \u263A\xA3 "," \u263A\u2593 "," \u263A\u2593 "," \u263A\u2592 "," \u263A\u2592 "," \u263A\u2591 "," \u263A\u2591 "," \u263A "," \u263A &"," \u263A \u263C&"," \u263A \u263C &"," \u263A\u263C &"," \u263A\u263C & "," \u203C & "," \u263A & "," \u203C & "," \u263A & "," \u203C & "," \u263A & ","\u203C & "," & "," & "," & \u2591 "," & \u2592 "," & \u2593 "," & \xA3 "," & \u2591\xA3 "," & \u2592\xA3 "," & \u2593\xA3 "," & \xA3\xA3 "," & \u2591\xA3\xA3 "," & \u2592\xA3\xA3 ","& \u2593\xA3\xA3 ","& \xA3\xA3\xA3 "," \u2591\xA3\xA3\xA3 "," \u2592\xA3\xA3\xA3 "," \u2593\xA3\xA3\xA3 "," \u2588\xA3\xA3\xA3 "," \u2591\u2588\xA3\xA3\xA3 "," \u2592\u2588\xA3\xA3\xA3 "," \u2593\u2588\xA3\xA3\xA3 "," \u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "]},fish:{interval:80,frames:["~~~~~~~~~~~~~~~~~~~~","> ~~~~~~~~~~~~~~~~~~","\xBA> ~~~~~~~~~~~~~~~~~","(\xBA> ~~~~~~~~~~~~~~~~","((\xBA> ~~~~~~~~~~~~~~~","<((\xBA> ~~~~~~~~~~~~~~","><((\xBA> ~~~~~~~~~~~~~"," ><((\xBA> ~~~~~~~~~~~~","~ ><((\xBA> ~~~~~~~~~~~","~~ <>((\xBA> ~~~~~~~~~~","~~~ ><((\xBA> ~~~~~~~~~","~~~~ <>((\xBA> ~~~~~~~~","~~~~~ ><((\xBA> ~~~~~~~","~~~~~~ <>((\xBA> ~~~~~~","~~~~~~~ ><((\xBA> ~~~~~","~~~~~~~~ <>((\xBA> ~~~~","~~~~~~~~~ ><((\xBA> ~~~","~~~~~~~~~~ <>((\xBA> ~~","~~~~~~~~~~~ ><((\xBA> ~","~~~~~~~~~~~~ <>((\xBA> ","~~~~~~~~~~~~~ ><((\xBA>","~~~~~~~~~~~~~~ <>((\xBA","~~~~~~~~~~~~~~~ ><((","~~~~~~~~~~~~~~~~ <>(","~~~~~~~~~~~~~~~~~ ><","~~~~~~~~~~~~~~~~~~ <","~~~~~~~~~~~~~~~~~~~~"]}};var Wo=Zh,g9=Object.keys(Zh);var rn={};$t(rn,{error:()=>VM,info:()=>UM,success:()=>FM,warning:()=>BM});import zM from"node:tty";var LM=zM?.WriteStream?.prototype?.hasColors?.()??!1,k=(e,t)=>{if(!LM)return r=>r;let n=`\x1B[${e}m`,i=`\x1B[${t}m`;return r=>{let o=r+"",a=o.indexOf(i);if(a===-1)return n+o+i;let c=n,u=0,m=(t===22?i:"")+n;for(;a!==-1;)c+=o.slice(u,a)+m,u=a+i.length,a=o.indexOf(i,u);return c+=o.slice(u)+i,c}},b9=k(0,0),y9=k(1,22),S9=k(2,22),_9=k(3,23),E9=k(4,24),x9=k(53,55),A9=k(7,27),I9=k(8,28),$9=k(9,29),T9=k(30,39),eI=k(31,39),tI=k(32,39),rI=k(33,39),nI=k(34,39),R9=k(35,39),P9=k(36,39),C9=k(37,39),N9=k(90,39),w9=k(40,49),k9=k(41,49),O9=k(42,49),D9=k(43,49),M9=k(44,49),j9=k(45,49),z9=k(46,49),L9=k(47,49),U9=k(100,49),F9=k(91,39),B9=k(92,39),V9=k(93,39),Z9=k(94,39),G9=k(95,39),W9=k(96,39),H9=k(97,39),q9=k(101,49),K9=k(102,49),Y9=k(103,49),X9=k(104,49),J9=k(105,49),Q9=k(106,49),eW=k(107,49);import iI from"node:process";function Ho(){let{env:e}=iI,{TERM:t,TERM_PROGRAM:n}=e;return iI.platform!=="win32"?t!=="linux":!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask==="{cmd::Cmder}"||n==="Terminus-Sublime"||n==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var cu=Ho(),UM=nI(cu?"\u2139":"i"),FM=tI(cu?"\u2714":"\u221A"),BM=rI(cu?"\u26A0":"\u203C"),VM=eI(cu?"\u2716":"\xD7");function Gh({onlyFirst:e=!1}={}){let r="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(r,e?void 0:"g")}var ZM=Gh();function Wh(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(ZM,"")}var uu=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],lu=[12288,12288,65281,65376,65504,65510],Hh=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],qh=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],qo=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141];var du=(e,t)=>{let n=0,i=Math.floor(e.length/2)-1;for(;n<=i;){let r=Math.floor((n+i)/2),o=r*2;if(t<e[o])i=r-1;else if(t>e[o+1])n=r+1;else return!0}return!1};var GM=uu[0],WM=uu.at(-1),HM=lu[0],qM=lu.at(-1),fW=Hh[0],gW=Hh.at(-1),hW=qh[0],vW=qh.at(-1),KM=qo[0],YM=qo.at(-1),oI=19968,[XM,JM]=QM(qo);function QM(e){let t=e[0],n=e[1];for(let i=0;i<e.length;i+=2){let r=e[i],o=e[i+1];if(oI>=r&&oI<=o)return[r,o];o-r>n-t&&(t=r,n=o)}return[t,n]}var aI=e=>e<GM||e>WM?!1:du(uu,e),sI=e=>e<HM||e>qM?!1:du(lu,e);var cI=e=>e>=XM&&e<=JM?!0:e<KM||e>YM?!1:du(qo,e);function ej(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function Ko(e,{ambiguousAsWide:t=!1}={}){return ej(e),sI(e)||cI(e)||t&&aI(e)?2:1}var tj=new Intl.Segmenter,uI=new RegExp("^(?:\\p{Default_Ignorable_Code_Point}|\\p{Control}|\\p{Format}|\\p{Mark}|\\p{Surrogate})+$","v"),rj=new RegExp("^[\\p{Default_Ignorable_Code_Point}\\p{Control}\\p{Format}\\p{Mark}\\p{Surrogate}]+","v"),nj=new RegExp("^\\p{RGI_Emoji}$","v"),ij=/^[\d#*]\u20E3$/,oj=new RegExp("\\p{Extended_Pictographic}","gu");function aj(e){if(e.length>50)return!1;if(ij.test(e))return!0;if(e.includes("\u200D")){let t=e.match(oj);return t!==null&&t.length>=2}return!1}function sj(e){return e.replace(rj,"")}function cj(e){return uI.test(e)}function lI(e){return e>=4352&&e<=4447||e>=43360&&e<=43388}function dI(e){return e>=4448&&e<=4519||e>=55216&&e<=55238}function mI(e){return e>=4520&&e<=4607||e>=55243&&e<=55291}function uj(e){return lI(e)||dI(e)||mI(e)}function lj(e,t){let n=[];for(let r of e)uI.test(r)||n.push(r.codePointAt(0));if(n.length===0)return;let i=0;for(let r=0;r<n.length;r++){let o=n[r];if(!uj(o)){if(i===0)return;for(let a=r;a<n.length;a++)i+=Ko(n[a],t);return i}if(lI(o)&&dI(n[r+1])){i+=2,r+=mI(n[r+2])?2:1;continue}i+=Ko(o,t)}return i}function dj(e,t){let n=0,i=!0;for(let r of e){if(i){i=!1;continue}r>="\uFF00"&&r<="\uFFEF"&&(n+=Ko(r.codePointAt(0),t))}return n}function Kh(e,t={}){if(typeof e!="string"||e.length===0)return 0;let{ambiguousIsNarrow:n=!0,countAnsiEscapeCodes:i=!1}=t,r=e;if(!i&&(r.includes("\x1B")||r.includes("\x9B"))&&(r=Wh(r)),r.length===0)return 0;if(/^[\u0020-\u007E]*$/.test(r))return r.length;let o=0,a={ambiguousAsWide:!n};for(let{segment:c}of tj.segment(r)){if(cj(c))continue;if(nj.test(c)||aj(c)){o+=2;continue}let u=sj(c),l=lj(u,a);if(l!==void 0){o+=l;continue}let m=u.codePointAt(0);o+=Ko(m,a),o+=dj(u,a)}return o}function Yh({stream:e=process.stdout}={}){return!!(e&&e.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}import mu from"node:process";var mj=3,Xh=class{#o=0;#n;#r=!1;#e=!1;#i=t=>{if(!t?.length)return;(typeof t=="string"?t.codePointAt(0):t[0])===mj&&mu.kill(mu.pid,"SIGINT")};start(){this.#o++,this.#o===1&&this.#t()}stop(){this.#o!==0&&--this.#o===0&&this.#a()}#t(){let{stdin:t}=mu;if(mu.platform==="win32"||!t?.isTTY||typeof t.setRawMode!="function"){this.#n=void 0;return}this.#n=t,this.#r=t.isPaused(),this.#e=!!t.isRaw,t.setRawMode(!0),t.prependListener("data",this.#i),this.#r&&t.resume()}#a(){if(!this.#n)return;let t=this.#n;t.off("data",this.#i),t.isTTY&&t.setRawMode?.(this.#e),this.#r&&t.pause(),this.#n=void 0,this.#r=!1,this.#e=!1}},pj=new Xh,Jh=Object.freeze(pj);var gj=200,hj="\x1B[?2026h",vj="\x1B[?2026l",pu=new Map,bj=new Set(["black","red","green","yellow","blue","magenta","cyan","white","gray"]),Qh=class{#o=0;#n=-1;#r=0;#e;#i;#t;#a;#c=new Map;#d=!1;#u;#s;#p=!1;#m;#l(t){this.#d=!0;try{return t()}finally{this.#d=!1}}#g(){this.isSpinning&&this.render()}#_(t,n){if(t==null)return"";if(typeof t=="string")return t;if(Buffer.isBuffer(t)||ArrayBuffer.isView(t)){let i=typeof n=="string"&&n&&n!=="buffer"?n:"utf8";return Buffer.from(t).toString(i)}return String(t)}#E(t){if(!t)return!1;let n=t.at(-1);return n===`
170
+ `);return o!==-1&&(t=ZA(t,r,i,o)),i+t+r};Object.defineProperties(Go.prototype,hi);var $M=Go(),X3=Go({level:WA?WA.level:0});var Ee=$M;import Yo from"node:process";import{stripVTControlCharacters as fj}from"node:util";import QA from"node:process";import au from"node:process";var TM=(e,t,n,i)=>{if(n==="length"||n==="prototype"||n==="arguments"||n==="caller")return;let r=Object.getOwnPropertyDescriptor(e,n),o=Object.getOwnPropertyDescriptor(t,n);!RM(r,o)&&i||Object.defineProperty(e,n,o)},RM=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},PM=(e,t)=>{let n=Object.getPrototypeOf(t);n!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,n)},CM=(e,t)=>`/* Wrapped ${e}*/
171
+ ${t}`,NM=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),wM=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),kM=(e,t,n)=>{let i=n===""?"":`with ${n.trim()}() `,r=CM.bind(null,i,t.toString());Object.defineProperty(r,"name",wM);let{writable:o,enumerable:a,configurable:c}=NM;Object.defineProperty(e,"toString",{value:r,writable:o,enumerable:a,configurable:c})};function Mh(e,t,{ignoreNonConfigurable:n=!1}={}){let{name:i}=e;for(let r of Reflect.ownKeys(t))TM(e,t,r,n);return PM(e,t),kM(e,t,i),e}var nu=new WeakMap,qA=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let n,i=0,r=e.displayName||e.name||"<anonymous>",o=function(...a){if(nu.set(o,++i),i===1)n=e.apply(this,a),e=void 0;else if(t.throw===!0)throw new Error(`Function \`${r}\` can only be called once`);return n};return Mh(o,e),nu.set(o,i),o};qA.callCount=e=>{if(!nu.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return nu.get(e)};var KA=qA;var tn=[];tn.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&tn.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&tn.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var iu=e=>!!e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function",jh=Symbol.for("signal-exit emitter"),zh=globalThis,OM=Object.defineProperty.bind(Object),Lh=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(zh[jh])return zh[jh];OM(zh,jh,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,n){this.listeners[t].push(n)}removeListener(t,n){let i=this.listeners[t],r=i.indexOf(n);r!==-1&&(r===0&&i.length===1?i.length=0:i.splice(r,1))}emit(t,n,i){if(this.emitted[t])return!1;this.emitted[t]=!0;let r=!1;for(let o of this.listeners[t])r=o(n,i)===!0||r;return t==="exit"&&(r=this.emit("afterExit",n,i)||r),r}},ou=class{},DM=e=>({onExit(t,n){return e.onExit(t,n)},load(){return e.load()},unload(){return e.unload()}}),Uh=class extends ou{onExit(){return()=>{}}load(){}unload(){}},Fh=class extends ou{#o=Bh.platform==="win32"?"SIGINT":"SIGHUP";#n=new Lh;#r;#e;#i;#t={};#a=!1;constructor(t){super(),this.#r=t,this.#t={};for(let n of tn)this.#t[n]=()=>{let i=this.#r.listeners(n),{count:r}=this.#n,o=t;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(r+=o.__signal_exit_emitter__.count),i.length===r){this.unload();let a=this.#n.emit("exit",null,n),c=n==="SIGHUP"?this.#o:n;a||t.kill(t.pid,c)}};this.#i=t.reallyExit,this.#e=t.emit}onExit(t,n){if(!iu(this.#r))return()=>{};this.#a===!1&&this.load();let i=n?.alwaysLast?"afterExit":"exit";return this.#n.on(i,t),()=>{this.#n.removeListener(i,t),this.#n.listeners.exit.length===0&&this.#n.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#a){this.#a=!0,this.#n.count+=1;for(let t of tn)try{let n=this.#t[t];n&&this.#r.on(t,n)}catch{}this.#r.emit=(t,...n)=>this.#d(t,...n),this.#r.reallyExit=t=>this.#c(t)}}unload(){this.#a&&(this.#a=!1,tn.forEach(t=>{let n=this.#t[t];if(!n)throw new Error("Listener not defined for signal: "+t);try{this.#r.removeListener(t,n)}catch{}}),this.#r.emit=this.#e,this.#r.reallyExit=this.#i,this.#n.count-=1)}#c(t){return iu(this.#r)?(this.#r.exitCode=t||0,this.#n.emit("exit",this.#r.exitCode,null),this.#i.call(this.#r,this.#r.exitCode)):0}#d(t,...n){let i=this.#e;if(t==="exit"&&iu(this.#r)){typeof n[0]=="number"&&(this.#r.exitCode=n[0]);let r=i.call(this.#r,t,...n);return this.#n.emit("exit",this.#r.exitCode,null),r}else return i.call(this.#r,t,...n)}},Bh=globalThis.process,{onExit:YA,load:i9,unload:o9}=DM(iu(Bh)?new Fh(Bh):new Uh);var XA=au.stderr.isTTY?au.stderr:au.stdout.isTTY?au.stdout:void 0,MM=XA?KA(()=>{YA(()=>{XA.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},JA=MM;var su=!1,vi={};vi.show=(e=QA.stderr)=>{e.isTTY&&(su=!1,e.write("\x1B[?25h"))};vi.hide=(e=QA.stderr)=>{e.isTTY&&(JA(),su=!0,e.write("\x1B[?25l"))};vi.toggle=(e,t)=>{e!==void 0&&(su=e),su?vi.show(t):vi.hide(t)};var Vh=vi;var Zh={dots:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]},dots2:{interval:80,frames:["\u28FE","\u28FD","\u28FB","\u28BF","\u287F","\u28DF","\u28EF","\u28F7"]},dots3:{interval:80,frames:["\u280B","\u2819","\u281A","\u281E","\u2816","\u2826","\u2834","\u2832","\u2833","\u2813"]},dots4:{interval:80,frames:["\u2804","\u2806","\u2807","\u280B","\u2819","\u2838","\u2830","\u2820","\u2830","\u2838","\u2819","\u280B","\u2807","\u2806"]},dots5:{interval:80,frames:["\u280B","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B"]},dots6:{interval:80,frames:["\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2834","\u2832","\u2812","\u2802","\u2802","\u2812","\u281A","\u2819","\u2809","\u2801"]},dots7:{interval:80,frames:["\u2808","\u2809","\u280B","\u2813","\u2812","\u2810","\u2810","\u2812","\u2816","\u2826","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808"]},dots8:{interval:80,frames:["\u2801","\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808","\u2808"]},dots9:{interval:80,frames:["\u28B9","\u28BA","\u28BC","\u28F8","\u28C7","\u2867","\u2857","\u284F"]},dots10:{interval:80,frames:["\u2884","\u2882","\u2881","\u2841","\u2848","\u2850","\u2860"]},dots11:{interval:100,frames:["\u2801","\u2802","\u2804","\u2840","\u2880","\u2820","\u2810","\u2808"]},dots12:{interval:80,frames:["\u2880\u2800","\u2840\u2800","\u2804\u2800","\u2882\u2800","\u2842\u2800","\u2805\u2800","\u2883\u2800","\u2843\u2800","\u280D\u2800","\u288B\u2800","\u284B\u2800","\u280D\u2801","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2888\u2829","\u2840\u2899","\u2804\u2859","\u2882\u2829","\u2842\u2898","\u2805\u2858","\u2883\u2828","\u2843\u2890","\u280D\u2850","\u288B\u2820","\u284B\u2880","\u280D\u2841","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2808\u2829","\u2800\u2899","\u2800\u2859","\u2800\u2829","\u2800\u2898","\u2800\u2858","\u2800\u2828","\u2800\u2890","\u2800\u2850","\u2800\u2820","\u2800\u2880","\u2800\u2840"]},dots13:{interval:80,frames:["\u28FC","\u28F9","\u28BB","\u283F","\u285F","\u28CF","\u28E7","\u28F6"]},dots14:{interval:80,frames:["\u2809\u2809","\u2808\u2819","\u2800\u2839","\u2800\u28B8","\u2800\u28F0","\u2880\u28E0","\u28C0\u28C0","\u28C4\u2840","\u28C6\u2800","\u2847\u2800","\u280F\u2800","\u280B\u2801"]},dots8Bit:{interval:80,frames:["\u2800","\u2801","\u2802","\u2803","\u2804","\u2805","\u2806","\u2807","\u2840","\u2841","\u2842","\u2843","\u2844","\u2845","\u2846","\u2847","\u2808","\u2809","\u280A","\u280B","\u280C","\u280D","\u280E","\u280F","\u2848","\u2849","\u284A","\u284B","\u284C","\u284D","\u284E","\u284F","\u2810","\u2811","\u2812","\u2813","\u2814","\u2815","\u2816","\u2817","\u2850","\u2851","\u2852","\u2853","\u2854","\u2855","\u2856","\u2857","\u2818","\u2819","\u281A","\u281B","\u281C","\u281D","\u281E","\u281F","\u2858","\u2859","\u285A","\u285B","\u285C","\u285D","\u285E","\u285F","\u2820","\u2821","\u2822","\u2823","\u2824","\u2825","\u2826","\u2827","\u2860","\u2861","\u2862","\u2863","\u2864","\u2865","\u2866","\u2867","\u2828","\u2829","\u282A","\u282B","\u282C","\u282D","\u282E","\u282F","\u2868","\u2869","\u286A","\u286B","\u286C","\u286D","\u286E","\u286F","\u2830","\u2831","\u2832","\u2833","\u2834","\u2835","\u2836","\u2837","\u2870","\u2871","\u2872","\u2873","\u2874","\u2875","\u2876","\u2877","\u2838","\u2839","\u283A","\u283B","\u283C","\u283D","\u283E","\u283F","\u2878","\u2879","\u287A","\u287B","\u287C","\u287D","\u287E","\u287F","\u2880","\u2881","\u2882","\u2883","\u2884","\u2885","\u2886","\u2887","\u28C0","\u28C1","\u28C2","\u28C3","\u28C4","\u28C5","\u28C6","\u28C7","\u2888","\u2889","\u288A","\u288B","\u288C","\u288D","\u288E","\u288F","\u28C8","\u28C9","\u28CA","\u28CB","\u28CC","\u28CD","\u28CE","\u28CF","\u2890","\u2891","\u2892","\u2893","\u2894","\u2895","\u2896","\u2897","\u28D0","\u28D1","\u28D2","\u28D3","\u28D4","\u28D5","\u28D6","\u28D7","\u2898","\u2899","\u289A","\u289B","\u289C","\u289D","\u289E","\u289F","\u28D8","\u28D9","\u28DA","\u28DB","\u28DC","\u28DD","\u28DE","\u28DF","\u28A0","\u28A1","\u28A2","\u28A3","\u28A4","\u28A5","\u28A6","\u28A7","\u28E0","\u28E1","\u28E2","\u28E3","\u28E4","\u28E5","\u28E6","\u28E7","\u28A8","\u28A9","\u28AA","\u28AB","\u28AC","\u28AD","\u28AE","\u28AF","\u28E8","\u28E9","\u28EA","\u28EB","\u28EC","\u28ED","\u28EE","\u28EF","\u28B0","\u28B1","\u28B2","\u28B3","\u28B4","\u28B5","\u28B6","\u28B7","\u28F0","\u28F1","\u28F2","\u28F3","\u28F4","\u28F5","\u28F6","\u28F7","\u28B8","\u28B9","\u28BA","\u28BB","\u28BC","\u28BD","\u28BE","\u28BF","\u28F8","\u28F9","\u28FA","\u28FB","\u28FC","\u28FD","\u28FE","\u28FF"]},dotsCircle:{interval:80,frames:["\u288E ","\u280E\u2801","\u280A\u2811","\u2808\u2831"," \u2871","\u2880\u2870","\u2884\u2860","\u2886\u2840"]},sand:{interval:80,frames:["\u2801","\u2802","\u2804","\u2840","\u2848","\u2850","\u2860","\u28C0","\u28C1","\u28C2","\u28C4","\u28CC","\u28D4","\u28E4","\u28E5","\u28E6","\u28EE","\u28F6","\u28F7","\u28FF","\u287F","\u283F","\u289F","\u281F","\u285B","\u281B","\u282B","\u288B","\u280B","\u280D","\u2849","\u2809","\u2811","\u2821","\u2881"]},line:{interval:130,frames:["-","\\","|","/"]},line2:{interval:100,frames:["\u2802","-","\u2013","\u2014","\u2013","-"]},rollingLine:{interval:80,frames:["/ "," - "," \\ "," |"," |"," \\ "," - ","/ "]},pipe:{interval:100,frames:["\u2524","\u2518","\u2534","\u2514","\u251C","\u250C","\u252C","\u2510"]},simpleDots:{interval:400,frames:[". ",".. ","..."," "]},simpleDotsScrolling:{interval:200,frames:[". ",".. ","..."," .."," ."," "]},star:{interval:70,frames:["\u2736","\u2738","\u2739","\u273A","\u2739","\u2737"]},star2:{interval:80,frames:["+","x","*"]},flip:{interval:70,frames:["_","_","_","-","`","`","'","\xB4","-","_","_","_"]},hamburger:{interval:100,frames:["\u2631","\u2632","\u2634"]},growVertical:{interval:120,frames:["\u2581","\u2583","\u2584","\u2585","\u2586","\u2587","\u2586","\u2585","\u2584","\u2583"]},growHorizontal:{interval:120,frames:["\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589","\u258A","\u258B","\u258C","\u258D","\u258E"]},balloon:{interval:140,frames:[" ",".","o","O","@","*"," "]},balloon2:{interval:120,frames:[".","o","O","\xB0","O","o","."]},noise:{interval:100,frames:["\u2593","\u2592","\u2591"]},bounce:{interval:120,frames:["\u2801","\u2802","\u2804","\u2802"]},boxBounce:{interval:120,frames:["\u2596","\u2598","\u259D","\u2597"]},boxBounce2:{interval:100,frames:["\u258C","\u2580","\u2590","\u2584"]},triangle:{interval:50,frames:["\u25E2","\u25E3","\u25E4","\u25E5"]},binary:{interval:80,frames:["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},arc:{interval:100,frames:["\u25DC","\u25E0","\u25DD","\u25DE","\u25E1","\u25DF"]},circle:{interval:120,frames:["\u25E1","\u2299","\u25E0"]},squareCorners:{interval:180,frames:["\u25F0","\u25F3","\u25F2","\u25F1"]},circleQuarters:{interval:120,frames:["\u25F4","\u25F7","\u25F6","\u25F5"]},circleHalves:{interval:50,frames:["\u25D0","\u25D3","\u25D1","\u25D2"]},squish:{interval:100,frames:["\u256B","\u256A"]},toggle:{interval:250,frames:["\u22B6","\u22B7"]},toggle2:{interval:80,frames:["\u25AB","\u25AA"]},toggle3:{interval:120,frames:["\u25A1","\u25A0"]},toggle4:{interval:100,frames:["\u25A0","\u25A1","\u25AA","\u25AB"]},toggle5:{interval:100,frames:["\u25AE","\u25AF"]},toggle6:{interval:300,frames:["\u101D","\u1040"]},toggle7:{interval:80,frames:["\u29BE","\u29BF"]},toggle8:{interval:100,frames:["\u25CD","\u25CC"]},toggle9:{interval:100,frames:["\u25C9","\u25CE"]},toggle10:{interval:100,frames:["\u3282","\u3280","\u3281"]},toggle11:{interval:50,frames:["\u29C7","\u29C6"]},toggle12:{interval:120,frames:["\u2617","\u2616"]},toggle13:{interval:80,frames:["=","*","-"]},arrow:{interval:100,frames:["\u2190","\u2196","\u2191","\u2197","\u2192","\u2198","\u2193","\u2199"]},arrow2:{interval:80,frames:["\u2B06\uFE0F ","\u2197\uFE0F ","\u27A1\uFE0F ","\u2198\uFE0F ","\u2B07\uFE0F ","\u2199\uFE0F ","\u2B05\uFE0F ","\u2196\uFE0F "]},arrow3:{interval:120,frames:["\u25B9\u25B9\u25B9\u25B9\u25B9","\u25B8\u25B9\u25B9\u25B9\u25B9","\u25B9\u25B8\u25B9\u25B9\u25B9","\u25B9\u25B9\u25B8\u25B9\u25B9","\u25B9\u25B9\u25B9\u25B8\u25B9","\u25B9\u25B9\u25B9\u25B9\u25B8"]},bouncingBar:{interval:80,frames:["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},bouncingBall:{interval:80,frames:["( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF)","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","(\u25CF )"]},smiley:{interval:200,frames:["\u{1F604} ","\u{1F61D} "]},monkey:{interval:300,frames:["\u{1F648} ","\u{1F648} ","\u{1F649} ","\u{1F64A} "]},hearts:{interval:100,frames:["\u{1F49B} ","\u{1F499} ","\u{1F49C} ","\u{1F49A} ","\u{1F497} "]},clock:{interval:100,frames:["\u{1F55B} ","\u{1F550} ","\u{1F551} ","\u{1F552} ","\u{1F553} ","\u{1F554} ","\u{1F555} ","\u{1F556} ","\u{1F557} ","\u{1F558} ","\u{1F559} ","\u{1F55A} "]},earth:{interval:180,frames:["\u{1F30D} ","\u{1F30E} ","\u{1F30F} "]},material:{interval:17,frames:["\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581"]},moon:{interval:80,frames:["\u{1F311} ","\u{1F312} ","\u{1F313} ","\u{1F314} ","\u{1F315} ","\u{1F316} ","\u{1F317} ","\u{1F318} "]},runner:{interval:140,frames:["\u{1F6B6} ","\u{1F3C3} "]},pong:{interval:80,frames:["\u2590\u2802 \u258C","\u2590\u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802\u258C","\u2590 \u2820\u258C","\u2590 \u2840\u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590\u2820 \u258C"]},shark:{interval:120,frames:["\u2590|\\____________\u258C","\u2590_|\\___________\u258C","\u2590__|\\__________\u258C","\u2590___|\\_________\u258C","\u2590____|\\________\u258C","\u2590_____|\\_______\u258C","\u2590______|\\______\u258C","\u2590_______|\\_____\u258C","\u2590________|\\____\u258C","\u2590_________|\\___\u258C","\u2590__________|\\__\u258C","\u2590___________|\\_\u258C","\u2590____________|\\\u258C","\u2590____________/|\u258C","\u2590___________/|_\u258C","\u2590__________/|__\u258C","\u2590_________/|___\u258C","\u2590________/|____\u258C","\u2590_______/|_____\u258C","\u2590______/|______\u258C","\u2590_____/|_______\u258C","\u2590____/|________\u258C","\u2590___/|_________\u258C","\u2590__/|__________\u258C","\u2590_/|___________\u258C","\u2590/|____________\u258C"]},dqpb:{interval:100,frames:["d","q","p","b"]},weather:{interval:100,frames:["\u2600\uFE0F ","\u2600\uFE0F ","\u2600\uFE0F ","\u{1F324} ","\u26C5\uFE0F ","\u{1F325} ","\u2601\uFE0F ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u26C8 ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u2601\uFE0F ","\u{1F325} ","\u26C5\uFE0F ","\u{1F324} ","\u2600\uFE0F ","\u2600\uFE0F "]},christmas:{interval:400,frames:["\u{1F332}","\u{1F384}"]},grenade:{interval:80,frames:["\u060C ","\u2032 "," \xB4 "," \u203E "," \u2E0C"," \u2E0A"," |"," \u204E"," \u2055"," \u0DF4 "," \u2053"," "," "," "]},point:{interval:125,frames:["\u2219\u2219\u2219","\u25CF\u2219\u2219","\u2219\u25CF\u2219","\u2219\u2219\u25CF","\u2219\u2219\u2219"]},layer:{interval:150,frames:["-","=","\u2261"]},betaWave:{interval:80,frames:["\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1"]},fingerDance:{interval:160,frames:["\u{1F918} ","\u{1F91F} ","\u{1F596} ","\u270B ","\u{1F91A} ","\u{1F446} "]},fistBump:{interval:80,frames:["\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u3000\u{1F91C}\u3000\u3000\u{1F91B}\u3000 ","\u3000\u3000\u{1F91C}\u{1F91B}\u3000\u3000 ","\u3000\u{1F91C}\u2728\u{1F91B}\u3000\u3000 ","\u{1F91C}\u3000\u2728\u3000\u{1F91B}\u3000 "]},soccerHeader:{interval:80,frames:[" \u{1F9D1}\u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F\u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} "]},mindblown:{interval:160,frames:["\u{1F610} ","\u{1F610} ","\u{1F62E} ","\u{1F62E} ","\u{1F626} ","\u{1F626} ","\u{1F627} ","\u{1F627} ","\u{1F92F} ","\u{1F4A5} ","\u2728 ","\u3000 ","\u3000 ","\u3000 "]},speaker:{interval:160,frames:["\u{1F508} ","\u{1F509} ","\u{1F50A} ","\u{1F509} "]},orangePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} "]},bluePulse:{interval:100,frames:["\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},orangeBluePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} ","\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},timeTravel:{interval:100,frames:["\u{1F55B} ","\u{1F55A} ","\u{1F559} ","\u{1F558} ","\u{1F557} ","\u{1F556} ","\u{1F555} ","\u{1F554} ","\u{1F553} ","\u{1F552} ","\u{1F551} ","\u{1F550} "]},aesthetic:{interval:80,frames:["\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1"]},dwarfFortress:{interval:80,frames:[" \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A \u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A \xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A \xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\u2593\xA3 "," \u263A\u2593\xA3 "," \u263A\u2592\xA3 "," \u263A\u2592\xA3 "," \u263A\u2591\xA3 "," \u263A\u2591\xA3 "," \u263A \xA3 "," \u263A\xA3 "," \u263A\xA3 "," \u263A\u2593 "," \u263A\u2593 "," \u263A\u2592 "," \u263A\u2592 "," \u263A\u2591 "," \u263A\u2591 "," \u263A "," \u263A &"," \u263A \u263C&"," \u263A \u263C &"," \u263A\u263C &"," \u263A\u263C & "," \u203C & "," \u263A & "," \u203C & "," \u263A & "," \u203C & "," \u263A & ","\u203C & "," & "," & "," & \u2591 "," & \u2592 "," & \u2593 "," & \xA3 "," & \u2591\xA3 "," & \u2592\xA3 "," & \u2593\xA3 "," & \xA3\xA3 "," & \u2591\xA3\xA3 "," & \u2592\xA3\xA3 ","& \u2593\xA3\xA3 ","& \xA3\xA3\xA3 "," \u2591\xA3\xA3\xA3 "," \u2592\xA3\xA3\xA3 "," \u2593\xA3\xA3\xA3 "," \u2588\xA3\xA3\xA3 "," \u2591\u2588\xA3\xA3\xA3 "," \u2592\u2588\xA3\xA3\xA3 "," \u2593\u2588\xA3\xA3\xA3 "," \u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "]},fish:{interval:80,frames:["~~~~~~~~~~~~~~~~~~~~","> ~~~~~~~~~~~~~~~~~~","\xBA> ~~~~~~~~~~~~~~~~~","(\xBA> ~~~~~~~~~~~~~~~~","((\xBA> ~~~~~~~~~~~~~~~","<((\xBA> ~~~~~~~~~~~~~~","><((\xBA> ~~~~~~~~~~~~~"," ><((\xBA> ~~~~~~~~~~~~","~ ><((\xBA> ~~~~~~~~~~~","~~ <>((\xBA> ~~~~~~~~~~","~~~ ><((\xBA> ~~~~~~~~~","~~~~ <>((\xBA> ~~~~~~~~","~~~~~ ><((\xBA> ~~~~~~~","~~~~~~ <>((\xBA> ~~~~~~","~~~~~~~ ><((\xBA> ~~~~~","~~~~~~~~ <>((\xBA> ~~~~","~~~~~~~~~ ><((\xBA> ~~~","~~~~~~~~~~ <>((\xBA> ~~","~~~~~~~~~~~ ><((\xBA> ~","~~~~~~~~~~~~ <>((\xBA> ","~~~~~~~~~~~~~ ><((\xBA>","~~~~~~~~~~~~~~ <>((\xBA","~~~~~~~~~~~~~~~ ><((","~~~~~~~~~~~~~~~~ <>(","~~~~~~~~~~~~~~~~~ ><","~~~~~~~~~~~~~~~~~~ <","~~~~~~~~~~~~~~~~~~~~"]}};var Wo=Zh,h9=Object.keys(Zh);var rn={};$t(rn,{error:()=>VM,info:()=>UM,success:()=>FM,warning:()=>BM});import zM from"node:tty";var LM=zM?.WriteStream?.prototype?.hasColors?.()??!1,k=(e,t)=>{if(!LM)return r=>r;let n=`\x1B[${e}m`,i=`\x1B[${t}m`;return r=>{let o=r+"",a=o.indexOf(i);if(a===-1)return n+o+i;let c=n,u=0,m=(t===22?i:"")+n;for(;a!==-1;)c+=o.slice(u,a)+m,u=a+i.length,a=o.indexOf(i,u);return c+=o.slice(u)+i,c}},y9=k(0,0),S9=k(1,22),_9=k(2,22),E9=k(3,23),x9=k(4,24),A9=k(53,55),I9=k(7,27),$9=k(8,28),T9=k(9,29),R9=k(30,39),eI=k(31,39),tI=k(32,39),rI=k(33,39),nI=k(34,39),P9=k(35,39),C9=k(36,39),N9=k(37,39),w9=k(90,39),k9=k(40,49),O9=k(41,49),D9=k(42,49),M9=k(43,49),j9=k(44,49),z9=k(45,49),L9=k(46,49),U9=k(47,49),F9=k(100,49),B9=k(91,39),V9=k(92,39),Z9=k(93,39),G9=k(94,39),W9=k(95,39),H9=k(96,39),q9=k(97,39),K9=k(101,49),Y9=k(102,49),X9=k(103,49),J9=k(104,49),Q9=k(105,49),eW=k(106,49),tW=k(107,49);import iI from"node:process";function Ho(){let{env:e}=iI,{TERM:t,TERM_PROGRAM:n}=e;return iI.platform!=="win32"?t!=="linux":!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask==="{cmd::Cmder}"||n==="Terminus-Sublime"||n==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var cu=Ho(),UM=nI(cu?"\u2139":"i"),FM=tI(cu?"\u2714":"\u221A"),BM=rI(cu?"\u26A0":"\u203C"),VM=eI(cu?"\u2716":"\xD7");function Gh({onlyFirst:e=!1}={}){let r="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(r,e?void 0:"g")}var ZM=Gh();function Wh(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(ZM,"")}var uu=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],lu=[12288,12288,65281,65376,65504,65510],Hh=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],qh=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],qo=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141];var du=(e,t)=>{let n=0,i=Math.floor(e.length/2)-1;for(;n<=i;){let r=Math.floor((n+i)/2),o=r*2;if(t<e[o])i=r-1;else if(t>e[o+1])n=r+1;else return!0}return!1};var GM=uu[0],WM=uu.at(-1),HM=lu[0],qM=lu.at(-1),gW=Hh[0],hW=Hh.at(-1),vW=qh[0],bW=qh.at(-1),KM=qo[0],YM=qo.at(-1),oI=19968,[XM,JM]=QM(qo);function QM(e){let t=e[0],n=e[1];for(let i=0;i<e.length;i+=2){let r=e[i],o=e[i+1];if(oI>=r&&oI<=o)return[r,o];o-r>n-t&&(t=r,n=o)}return[t,n]}var aI=e=>e<GM||e>WM?!1:du(uu,e),sI=e=>e<HM||e>qM?!1:du(lu,e);var cI=e=>e>=XM&&e<=JM?!0:e<KM||e>YM?!1:du(qo,e);function ej(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function Ko(e,{ambiguousAsWide:t=!1}={}){return ej(e),sI(e)||cI(e)||t&&aI(e)?2:1}var tj=new Intl.Segmenter,uI=new RegExp("^(?:\\p{Default_Ignorable_Code_Point}|\\p{Control}|\\p{Format}|\\p{Mark}|\\p{Surrogate})+$","v"),rj=new RegExp("^[\\p{Default_Ignorable_Code_Point}\\p{Control}\\p{Format}\\p{Mark}\\p{Surrogate}]+","v"),nj=new RegExp("^\\p{RGI_Emoji}$","v"),ij=/^[\d#*]\u20E3$/,oj=new RegExp("\\p{Extended_Pictographic}","gu");function aj(e){if(e.length>50)return!1;if(ij.test(e))return!0;if(e.includes("\u200D")){let t=e.match(oj);return t!==null&&t.length>=2}return!1}function sj(e){return e.replace(rj,"")}function cj(e){return uI.test(e)}function lI(e){return e>=4352&&e<=4447||e>=43360&&e<=43388}function dI(e){return e>=4448&&e<=4519||e>=55216&&e<=55238}function mI(e){return e>=4520&&e<=4607||e>=55243&&e<=55291}function uj(e){return lI(e)||dI(e)||mI(e)}function lj(e,t){let n=[];for(let r of e)uI.test(r)||n.push(r.codePointAt(0));if(n.length===0)return;let i=0;for(let r=0;r<n.length;r++){let o=n[r];if(!uj(o)){if(i===0)return;for(let a=r;a<n.length;a++)i+=Ko(n[a],t);return i}if(lI(o)&&dI(n[r+1])){i+=2,r+=mI(n[r+2])?2:1;continue}i+=Ko(o,t)}return i}function dj(e,t){let n=0,i=!0;for(let r of e){if(i){i=!1;continue}r>="\uFF00"&&r<="\uFFEF"&&(n+=Ko(r.codePointAt(0),t))}return n}function Kh(e,t={}){if(typeof e!="string"||e.length===0)return 0;let{ambiguousIsNarrow:n=!0,countAnsiEscapeCodes:i=!1}=t,r=e;if(!i&&(r.includes("\x1B")||r.includes("\x9B"))&&(r=Wh(r)),r.length===0)return 0;if(/^[\u0020-\u007E]*$/.test(r))return r.length;let o=0,a={ambiguousAsWide:!n};for(let{segment:c}of tj.segment(r)){if(cj(c))continue;if(nj.test(c)||aj(c)){o+=2;continue}let u=sj(c),l=lj(u,a);if(l!==void 0){o+=l;continue}let m=u.codePointAt(0);o+=Ko(m,a),o+=dj(u,a)}return o}function Yh({stream:e=process.stdout}={}){return!!(e&&e.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}import mu from"node:process";var mj=3,Xh=class{#o=0;#n;#r=!1;#e=!1;#i=t=>{if(!t?.length)return;(typeof t=="string"?t.codePointAt(0):t[0])===mj&&mu.kill(mu.pid,"SIGINT")};start(){this.#o++,this.#o===1&&this.#t()}stop(){this.#o!==0&&--this.#o===0&&this.#a()}#t(){let{stdin:t}=mu;if(mu.platform==="win32"||!t?.isTTY||typeof t.setRawMode!="function"){this.#n=void 0;return}this.#n=t,this.#r=t.isPaused(),this.#e=!!t.isRaw,t.setRawMode(!0),t.prependListener("data",this.#i),this.#r&&t.resume()}#a(){if(!this.#n)return;let t=this.#n;t.off("data",this.#i),t.isTTY&&t.setRawMode?.(this.#e),this.#r&&t.pause(),this.#n=void 0,this.#r=!1,this.#e=!1}},pj=new Xh,Jh=Object.freeze(pj);var gj=200,hj="\x1B[?2026h",vj="\x1B[?2026l",pu=new Map,bj=new Set(["black","red","green","yellow","blue","magenta","cyan","white","gray"]),Qh=class{#o=0;#n=-1;#r=0;#e;#i;#t;#a;#c=new Map;#d=!1;#u;#s;#p=!1;#m;#l(t){this.#d=!0;try{return t()}finally{this.#d=!1}}#g(){this.isSpinning&&this.render()}#_(t,n){if(t==null)return"";if(typeof t=="string")return t;if(Buffer.isBuffer(t)||ArrayBuffer.isView(t)){let i=typeof n=="string"&&n&&n!=="buffer"?n:"utf8";return Buffer.from(t).toString(i)}return String(t)}#E(t){if(!t)return!1;let n=t.at(-1);return n===`
172
172
  `||n==="\r"}#x(){this.#s||(this.#s=setTimeout(()=>{this.#s=void 0,this.isSpinning&&this.#g()},gj),typeof this.#s?.unref=="function"&&this.#s.unref())}#h(){this.#s&&(clearTimeout(this.#s),this.#s=void 0)}#v(t,n,i,r){let o=this.#y(i," "),c=typeof n=="string"?(t?" ":"")+n:"",u=this.#S(r," ");return o+t+c+u}constructor(t){if(typeof t=="string"&&(t={text:t}),this.#e={color:"cyan",stream:Yo.stderr,discardStdin:!0,hideCursor:!0,...t},this.color=this.#e.color,this.#t=this.#e.stream,typeof this.#e.isEnabled!="boolean"&&(this.#e.isEnabled=Yh({stream:this.#t})),typeof this.#e.isSilent!="boolean"&&(this.#e.isSilent=!1),this.#e.interval!==void 0&&!(Number.isInteger(this.#e.interval)&&this.#e.interval>0))throw new Error("The `interval` option must be a positive integer");let n=this.#e.interval;this.spinner=this.#e.spinner,this.#e.interval=n,this.text=this.#e.text,this.prefixText=this.#e.prefixText,this.suffixText=this.#e.suffixText,this.indent=this.#e.indent,Yo.env.NODE_ENV==="test"&&(this._stream=this.#t,this._isEnabled=this.#e.isEnabled,Object.defineProperty(this,"_linesToClear",{get(){return this.#o},set(i){this.#o=i}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#n}}),Object.defineProperty(this,"_lineCount",{get(){let i=this.#t.columns??80,r=typeof this.#e.prefixText=="function"?"":this.#e.prefixText,o=typeof this.#e.suffixText=="function"?"":this.#e.suffixText,a=typeof r=="string"&&r!==""?r+" ":"",c=typeof o=="string"&&o!==""?" "+o:"",l=" ".repeat(this.#e.indent)+a+"-"+(typeof this.#e.text=="string"?" "+this.#e.text:"")+c;return this.#f(l,i)}}))}get indent(){return this.#e.indent}set indent(t=0){if(!(t>=0&&Number.isInteger(t)))throw new Error("The `indent` option must be an integer from 0 and up");this.#e.indent=t}get interval(){return this.#e.interval??this.#i.interval??100}get spinner(){return this.#i}set spinner(t){if(this.#n=-1,this.#e.interval=void 0,typeof t=="object"){if(!Array.isArray(t.frames)||t.frames.length===0||t.frames.some(n=>typeof n!="string"))throw new Error("The given spinner must have a non-empty `frames` array of strings");if(t.interval!==void 0&&!(Number.isInteger(t.interval)&&t.interval>0))throw new Error("`spinner.interval` must be a positive integer if provided");this.#i=t}else if(!Ho())this.#i=Wo.line;else if(t===void 0)this.#i=Wo.dots;else if(t!=="default"&&Wo[t])this.#i=Wo[t];else throw new Error(`There is no built-in spinner named '${t}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#e.text}set text(t=""){this.#e.text=t}get prefixText(){return this.#e.prefixText}set prefixText(t=""){this.#e.prefixText=t}get suffixText(){return this.#e.suffixText}set suffixText(t=""){this.#e.suffixText=t}get isSpinning(){return this.#a!==void 0}#b(t,n,i=!1){let r=typeof t=="function"?t():t;return typeof r=="string"&&r!==""?i?n+r:r+n:""}#y(t=this.#e.prefixText,n=" "){return this.#b(t,n,!1)}#S(t=this.#e.suffixText,n=" "){return this.#b(t,n,!0)}#f(t,n){let i=0;for(let r of fj(t).split(`
173
173
  `))i+=Math.max(1,Math.ceil(Kh(r)/n));return i}get color(){return this.#m}set color(t){if(t!==void 0&&t!==!1&&!bj.has(t))throw new Error("The `color` option must be a valid color or `false` to disable");this.#m=t}get isEnabled(){return this.#e.isEnabled&&!this.#e.isSilent}set isEnabled(t){if(typeof t!="boolean")throw new TypeError("The `isEnabled` option must be a boolean");this.#e.isEnabled=t}get isSilent(){return this.#e.isSilent}set isSilent(t){if(typeof t!="boolean")throw new TypeError("The `isSilent` option must be a boolean");this.#e.isSilent=t}frame(){let t=Date.now();(this.#n===-1||t-this.#r>=this.interval)&&(this.#n=(this.#n+1)%this.#i.frames.length,this.#r=t);let{frames:n}=this.#i,i=n[this.#n];this.#m&&(i=Ee[this.#m](i));let r=this.#y(this.#e.prefixText," "),o=typeof this.text=="string"?" "+this.text:"",a=this.#S(this.#e.suffixText," ");return r+i+o+a}clear(){return!this.isEnabled||!this.#t.isTTY?this:(this.#l(()=>{this.#t.cursorTo(0);for(let t=0;t<this.#o;t++)t>0&&this.#t.moveCursor(0,-1),this.#t.clearLine(1);this.#e.indent&&this.#t.cursorTo(this.#e.indent)}),this.#o=0,this)}#A(t){if(!t||this.#c.has(t)||!t.isTTY||typeof t.write!="function")return;pu.has(t)&&console.warn("[ora] Multiple concurrent spinners detected. This may cause visual corruption. Use one spinner at a time.");let n=t.write;this.#c.set(t,n),pu.set(t,this),t.write=(i,r,o)=>this.#T(t,n,i,r,o)}#I(){if(!this.isEnabled||this.#c.size>0)return;let t=new Set([this.#t,Yo.stdout,Yo.stderr]);for(let n of t)this.#A(n)}#$(){for(let[t,n]of this.#c)t.write=n,pu.get(t)===this&&pu.delete(t);this.#c.clear()}#T(t,n,i,r,o){if(typeof r=="function"&&(o=r,r=void 0),this.#d)return n.call(t,i,r,o);this.clear();let a=this.#_(i,r),c=this.#E(a),u=n.call(t,i,r,o);return c?this.#h():a.length>0&&this.#x(),this.isSpinning&&!this.#s&&this.render(),u}render(){if(!this.isEnabled||this.#u||this.#s)return this;let t=this.#t.isTTY,n=!1;try{t&&(this.#l(()=>this.#t.write(hj)),n=!0),this.clear();let i=this.frame(),r=this.#t.columns??80,o=this.#f(i,r),a=this.#t.rows;if(a&&a>1&&o>a){let u=i.split(`
174
174
  `),l=a-1;i=[...u.slice(0,l),"... (content truncated to fit terminal)"].join(`
@@ -184,16 +184,16 @@ ${Ee.hex("#D9622E").bold(`--- ${e} ---`)}`),F&&F.start())}Ge(xj,"step");function
184
184
  `);return{buffer:[],stream:r}}flush(){let t=this.flushBuffer(this.buffer,this.mainLogStream,this.mainLogPath);this.buffer=t.buffer,this.mainLogStream=t.stream;let n=this.flushBuffer(this.debugBuffer,this.debugLogStream,this.debugLogPath);this.debugBuffer=n.buffer,this.debugLogStream=n.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(n=>new Promise(i=>{n.end(()=>i())}))),this.isClosing=!1}};import{createWriteStream as Vj,existsSync as Zj,mkdirSync as Gj}from"fs";import{join as AI}from"path";var on={trace:0,debug:1,info:2,warn:3,error:4},We={MAX_FILE_SIZE:10*1024*1024,MAX_FILES:5,MAX_BUFFER_SIZE:100,FLUSH_INTERVAL_MS:500,LOG_FILENAME:"fjall.jsonl",DEBUG_LOG_FILENAME:"fjall-debug.jsonl"};import{join as Lj}from"path";import{homedir as Uj}from"os";var jj=Object.defineProperty,zj=(e,t)=>jj(e,"name",{value:t,configurable:!0});function $r(){let e=process.env.FJALL_LOG_DIR;return e!==void 0&&e!==""?e:Lj(Uj(),".fjall","logs")}zj($r,"getDefaultLogDir");var Fj=Object.defineProperty,Bj=(e,t)=>Fj(e,"name",{value:t,configurable:!0}),ea=class{static{Bj(this,"DeploymentLoggerImpl")}mainLogger;appName;operationType;logStream=null;logPath;deploymentId;buffer=[];flushInterval=null;isClosing=!1;maxBufferSize=We.MAX_BUFFER_SIZE;constructor(t,n,i){this.mainLogger=t,this.appName=n,this.operationType=i,this.deploymentId=`${i}-${Date.now()}`;let r=$r(),o=AI(r,"deployments",n);Zj(o)||Gj(o,{recursive:!0});let a=new Date().toISOString().replace(/[:.]/g,"-"),c=`${i}-${a}.jsonl`;this.logPath=AI(o,c);try{this.logStream=Vj(this.logPath,{flags:"a"}),this.flushInterval=setInterval(()=>this.flush(),We.FLUSH_INTERVAL_MS),this.info("DeploymentLogger","Deployment logging initialised",{appName:n,operationType:i,deploymentId:this.deploymentId,logPath:this.logPath})}catch{}}log(t,n,i,r,o,a){if(this.isClosing)return;let c={timestamp:new Date().toISOString(),level:t,component:n,message:i,correlationId:this.deploymentId,...r&&Object.keys(r).length>0&&{data:r},...o&&{stackName:o},...a&&{phase:a}};this.buffer.push(c),this.mainLogger.logWithCorrelation(t,n,i,this.deploymentId,r,o,a),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)+`
185
185
  `);this.buffer=[]}}info(t,n,i){this.log("info",t,n,i)}warn(t,n,i){this.log("warn",t,n,i)}error(t,n,i){this.log("error",t,n,i)}debug(t,n,i){this.log("debug",t,n,i)}stackEvent(t,n,i,r){this.log("info","StackDeployment",i,r,t,n)}dockerEvent(t,n){this.log("info","DockerOperation",t,{percentage:n})}ecsEvent(t,n,i){this.log("info","ECSDeployment",t,{percentage:n,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 Wj=Object.defineProperty,Hj=(e,t)=>Wj(e,"name",{value:t,configurable:!0}),Su=class e{static{Hj(this,"Logger")}static instance=null;config;debugEnabled;traceEnabled;minLevel;fileWriter;mainLogPath;debugLogPath;constructor(){let t=$r(),n=cv(t,"debug"),i=this.parseEnvInt("FJALL_LOG_MAX_SIZE",We.MAX_FILE_SIZE),r=this.parseEnvInt("FJALL_LOG_MAX_FILES",We.MAX_FILES);this.config={logDir:t,debugLogDir:n,maxFileSize:i,maxFiles:r,maxBufferSize:We.MAX_BUFFER_SIZE,flushIntervalMs:We.FLUSH_INTERVAL_MS},this.mainLogPath=cv(t,We.LOG_FILENAME),this.debugLogPath=cv(n,We.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 o=process.env.FJALL_LOG_LEVEL?.toLowerCase();o&&o in on?this.minLevel=o:this.traceEnabled?this.minLevel="trace":this.debugEnabled?this.minLevel="debug":this.minLevel="info",this.fileWriter=new yu(this.config,this.mainLogPath,this.debugLogPath,this.debugEnabled)}parseEnvInt(t,n){let i=process.env[t];if(i){let r=parseInt(i,10);if(!isNaN(r)&&r>0)return r}return n}static getInstance(){return e.instance||(e.instance=new e),e.instance}shouldLog(t){return on[t]>=on[this.minLevel]}createEntry(t,n,i,r,o,a,c){return{timestamp:new Date().toISOString(),level:t,component:n,message:i,...o&&{correlationId:o},...r&&Object.keys(r).length>0&&{data:r},...a&&{stackName:a},...c&&{phase:c}}}log(t,n,i,r,o,a,c){if(!this.shouldLog(t))return;let u=this.createEntry(t,n,i,r,o,a,c),l=t==="debug"||t==="trace";this.fileWriter.write(u,l),this.writeConsole(u)}writeConsole(t){if(he.shouldSuppressOutput||he.isNonInteractive){this.debugEnabled&&this.writeDebugMirror(t);return}let n=this.getConsolePrefix(t.level),i=`[${t.component}]`,r=`${n} ${i} ${t.message}`;t.level==="error"?console.error(r):t.level==="warn"?console.warn(r):console.log(r)}writeDebugMirror(t){let n=this.getConsolePrefix(t.level),i=`[${t.component}]`,r="";if(t.data&&Object.keys(t.data).length>0)try{r=` ${JSON.stringify(t.data)}`}catch{r=" [unserialisable data]"}let o=`${n} ${i} ${t.message}${r}`;process.stderr.write(`${kn(o)}
186
186
  `)}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,n,i){this.log("error",t,n,i)}warn(t,n,i){this.log("warn",t,n,i)}info(t,n,i){this.log("info",t,n,i)}debug(t,n,i){this.log("debug",t,n,i)}trace(t,n,i){this.log("trace",t,n,i)}isDebugEnabled(){return this.debugEnabled}isTraceEnabled(){return this.traceEnabled}enableDebug(){this.debugEnabled=!0,on[this.minLevel]>on.debug&&(this.minLevel="debug"),this.fileWriter.setDebugEnabled(!0),this.fileWriter.isInitialised&&this.fileWriter.initialiseDebugStream()}withCorrelation(t){return new bi(this,t)}forDeployment(t,n="deploy"){return new ea(this,t,n)}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,n,i,r,o,a,c){this.log(t,n,i,o,r,a,c)}static reset(){e.instance&&(e.instance.close(),e.instance=null)}};var qj=Object.defineProperty,Kj=(e,t)=>qj(e,"name",{value:t,configurable:!0}),bu=Su.getInstance();function Qj(e){let t=$r(),n=$I(t,"debug"),i=$I(n,We.DEBUG_LOG_FILENAME);try{II(n)||Yj(n,{recursive:!0}),II(i)&&Xj(i).size>We.MAX_FILE_SIZE&&new yi({maxFiles:We.MAX_FILES}).rotate(i);let r={timestamp:new Date().toISOString(),level:"debug",component:"Emergency",message:e};Jj(i,JSON.stringify(r)+`
187
- `)}catch{}}Kj(Qj,"writeDebugSync");var ez=Object.defineProperty,Si=(e,t)=>ez(e,"name",{value:t,configurable:!0});function uv(e){return e.success===!0}Si(uv,"isSuccess");function lv(e){return e.success===!1}Si(lv,"isFailure");function C(e){return{success:!0,data:e}}Si(C,"success");function $(e){return{success:!1,error:e}}Si($,"failure");async function dv(e){try{let t=await e();return C(t)}catch(t){return $(vt(t))}}Si(dv,"tryAsync");function mv(e){try{let t=e();return C(t)}catch(t){return $(vt(t))}}Si(mv,"trySync");var tz=Object.defineProperty,rz=(e,t)=>tz(e,"name",{value:t,configurable:!0}),TI=/^[a-zA-Z][a-zA-Z0-9-]*$/,nz=Fo.source.replace(/^\^|\$$/g,""),L=Object.freeze({IDENTIFIER:TI,NEW_APP_NAME:/^[a-z][a-z0-9-]*$/,RESOURCE_NAME:/^[a-zA-Z][a-zA-Z0-9]*$/,ECS_SERVICE_NAME:TI,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(`^(?:/${nz})+$`),SECRET_NAME:Xc,SSM_COMPONENT:Fo,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 pv(e){let t=/^rate\((\d+) (minute|minutes|hour|hours|day|days)\)$/.exec(e);if(!t)return;let n=t[1],i=t[2];if(n===void 0||i===void 0)return;let r=parseInt(n,10);if(!Number.isFinite(r)||r<1)return;let o=i==="minute"||i==="hour"||i==="day";if(!(o&&r!==1)&&!(!o&&r===1))return i==="minute"||i==="minutes"?{everyMs:r*6e4}:i==="hour"||i==="hours"?{everyMs:r*60*6e4}:{everyMs:r*24*60*6e4}}rz(pv,"parseRateExpression");var d=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:ph,SSM_COMPONENT:Jc,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"},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"}},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"},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"}},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 iz=Object.defineProperty,st=(e,t)=>iz(e,"name",{value:t,configurable:!0}),oz=["us-east-2","us-west-2","us-east-1","eu-west-1","eu-central-1","ap-southeast-1"],az=Object.freeze(oz.flatMap(e=>{let t=Cn(e);return t?[t]:[]})),fv=Object.freeze(["us-east-2","us-west-2","us-east-1","eu-west-1","ap-southeast-1"]);function _u(e){return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}st(_u,"parseRegionList");function gv(e){return Kt.includes(e)}st(gv,"isValidRegion");function hv(e){return/^[a-z]{2}-[a-z]+-[1-9]$/.test(e)}st(hv,"isValidRegionFormat");function vv(e){if(!e)return fv.slice(0,3);let t=e.toLowerCase().split("-"),n=t[0],i=t.length>1?t[1]:"",r=[];return n&&i&&(r=Kt.filter(o=>o.startsWith(`${n}-${i}`))),r.length===0&&n&&(r=Kt.filter(o=>o.startsWith(`${n}-`))),r.length>0?r.slice(0,3):fv.slice(0,3)}st(vv,"getSuggestions");function bv(e){if(gv(e))return!0;let t=vv(e);return hv(e)?`Unknown region. Try: ${t.join(", ")}`:`Invalid format. Try: ${t.join(", ")}`}st(bv,"validateRegion");function RI(e){if(!e||e.trim()==="")return!0;let t=_u(e);for(let n of t){let i=bv(n);if(i!==!0)return i}return!0}st(RI,"validateRegionList");function yv(e,t){return e.filter(n=>n!==t)}st(yv,"filterDuplicateRegions");function Sv(e){return{label:e.city,value:e.code,description:e.optIn?`${e.code} \u2014 opt-in required`:e.code}}st(Sv,"toRegionOption");function PI(){return it.map(Sv)}st(PI,"getRegionOptions");function CI(e){return it.filter(t=>t.code!==e).map(Sv)}st(CI,"getRegionOptionsExcluding");function NI(e){let t=it.find(n=>n.code===e);return t?t.city:e}st(NI,"getRegionName");function wI(e){return t=>{let n=_u(t);return yv(n,e)}}st(wI,"createRegionFormatter");var Eu="3.10.0";var xu=["Aurora","Instance","GlobalAurora","ClickHouse"],_i=["FARGATE","FARGATE_SPOT","EC2"],_t=["standard","resilient","enterprise"],Au=["tinkerer","lightweight","standard","resilient","enterprise"],_v="custom",ta=[...Au,_v];var sz=Object.defineProperty,cz=(e,t)=>sz(e,"name",{value:t,configurable:!0}),t5=Object.freeze({RESOURCE_SUFFIXES:Object.freeze({storage:"Storage",database:"Database",cluster:"Cluster",function:"Function",instance:"Instance",compute:"Compute"})}),ra=["ecs","lambda","ec2"],Ei=Object.freeze({ECS:"ecs",LAMBDA:"lambda",EC2:"ec2"}),Iu=["code","container"],na=Object.freeze({CODE:"code",CONTAINER:"container"}),$u=["ARM_64","X86_64"],kI="ARM_64",ia=["NONE","AWS_IAM"],Tu=["public","internal"],Ru=["CPU","MEMORY"],Pu=["ARM","STANDARD"],Ev=["Instance","Aurora"],xi=["postgresql","mysql"],OI=["foundation","compliance","hardened"];var Cu=["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"],DI=[0,1,5,10,15,30,60];function ct(e,t){return e.includes(t)}cz(ct,"constIncludes");var MI=1,jI=65535,a5=Object.freeze({postgresql:5432,mysql:3306}),zI=128,LI=10240,Nu=1,wu=900,xv=1,Av=1e3,Ai=100,UI=100;var FI=3e3;var BI=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH"],VI=["standard","assets","upload","website"],Ii=["AES256","KMS"];var uz=Object.defineProperty,oa=(e,t)=>uz(e,"name",{value:t,configurable:!0}),He=oa(e=>s.union([s.literal(!1),e]),"optionalOrDisabled"),an={check:oa(e=>e.minCapacity!==void 0&&e.maxCapacity!==void 0?e.minCapacity<=e.maxCapacity:!0,"check"),params:{message:d.CAPACITY_CONSTRAINT.MIN_LTE_MAX,path:["maxCapacity"]}},aa=oa(e=>s.number().int(d.MEMORY_LIMIT.INTEGER).min(e,e===128?d.MEMORY_LIMIT.MIN_128:d.MEMORY_LIMIT.MIN_512).max(30720,d.MEMORY_LIMIT.MAX),"memoryLimitMiBSchema"),V=s.string().min(1,d.REQUIRED.RESOURCE_NAME).max(63,d.MAX_LENGTH.RESOURCE_NAME).regex(L.RESOURCE_NAME,d.RESOURCE_NAME),GI=s.string().min(1,d.REQUIRED.BUCKET_NAME).max(63,d.MAX_LENGTH.BUCKET_NAME).regex(L.BUCKET_NAME,d.BUCKET_NAME),WI=s.string().min(1,d.REQUIRED.DATABASE_NAME).max(63,d.MAX_LENGTH.DATABASE_NAME).regex(L.DATABASE_NAME,d.DATABASE_NAME);function ku(e,t=L.IDENTIFIER,n=d.IDENTIFIER){return s.string().min(2,d.IDENTIFIER_MIN_LENGTH).max(50,e).regex(t,n).refine(i=>!i.endsWith("-"),{message:d.IDENTIFIER_NO_TRAILING_HYPHEN}).refine(i=>!i.includes("--"),{message:d.IDENTIFIER_NO_CONSECUTIVE_HYPHENS})}oa(ku,"identifierSchema");var ve=ku(d.MAX_LENGTH.APP_NAME),p5=ku(d.MAX_LENGTH.APP_NAME,L.NEW_APP_NAME,d.NEW_APP_NAME),sn=s.number().int(d.PORT.INTEGER).min(MI,d.PORT.MIN).max(jI,d.PORT.MAX),Re=s.object({key:s.string(),sourceText:s.string()}).strict(),lz=s.object({__identifier:s.string()}).strict(),dz=s.object({__expression:s.string()}).strict(),mz=s.object({__call:s.string()}).strict(),pz=s.union([lz,dz,mz]),fz=s.union([s.string(),s.number(),s.boolean(),pz]),$i=s.record(s.string().regex(L.ENV_VAR_NAME,d.ENV_VAR_NAME),fz),gz=s.object({id:s.string(),name:s.string().optional(),arn:s.string().optional(),field:s.string().optional()}).strict().refine(e=>e.name!==void 0!=(e.arn!==void 0),{message:"secretsImport requires exactly one of `name` or `arn`."}),HI=s.record(s.string(),gz),f5=s.record(s.string(),s.unknown()),Iv=s.enum(ta).describe(`Application type must be one of: ${ta.join(", ")}`),$v=s.enum(kt).describe(`OpenNext deployment pattern: ${kt.join(", ")}`),hz=s.enum(["before-imports","after-imports","after-app-init","after-tags","after-resource","end-of-file"]),vz=s.enum(["import","app-init","tags","database","compute","storage","network","messaging","cdn","pattern","vpc-peer","vpc-peer-accepter","cross-plan-connection","custom"]),qI=s.object({sourceText:s.string(),position:hz,afterManagedResource:s.object({type:vz,name:s.string().optional()}).strict().optional(),originalLine:s.number().int().optional(),leadingComments:s.array(s.string()).optional(),orphaned:s.boolean().optional(),orphanedComment:s.string().optional()}).strict(),KI=s.union([s.object({tier:s.enum(_t)}).strict(),s.literal(!1)]),YI=s.union([s.object({instanceType:s.string().optional()}).strict(),s.literal(!1)]),bz=ku(d.MAX_LENGTH.ORGANISATION_NAME),yz=s.string().regex(L.EMAIL,d.EMAIL),ZI=s.string().refine(e=>Kt.includes(e),{message:d.REGION}),g5=s.object({name:bz,email:yz,accountName:s.string().optional(),primaryRegion:ZI.optional().default(Pn),secondaryRegions:s.array(ZI).optional(),security:s.enum(OI).optional(),force:s.boolean().optional()}).strict();function sa(e){return e.issues.map(t=>`${t.path.length>0?`${t.path.join(".")}: `:""}${t.message}`).join(`
188
- `)}oa(sa,"getZodErrorMessage");var Ti=s.number().min(1,d.ALARM.PERCENTAGE.MIN).max(100,d.ALARM.PERCENTAGE.MAX),Sz=s.number().min(1,d.ALARM.FREE_STORAGE_GIB.MIN),XI=s.union([s.literal(!1),s.object({cpuThreshold:Ti.optional(),memoryThreshold:Ti.optional(),runningTasksMinimum:s.number().int().min(0).optional(),http5xxThreshold:Ti.optional()}).strict()]),JI=s.union([s.literal(!1),s.object({cpuThreshold:Ti.optional(),freeStorageThresholdGiB:Sz.optional(),connectionsThreshold:s.number().int().min(1).optional()}).strict()]),QI=s.union([s.literal(!1),s.object({errorRateThreshold:Ti.optional(),durationThresholdPercent:Ti.optional()}).strict()]);var Qt=s.number().int(d.BACKUP_RETENTION.INTEGER).min(1,d.BACKUP_RETENTION.MIN).max(35,d.BACKUP_RETENTION.MAX),ca=s.number().int(d.MONITORING_INTERVAL.INTEGER).refine(e=>ct(DI,e),{message:d.MONITORING_INTERVAL.VALUES}),Du=s.number().int(d.DATABASE.PORT.INTEGER).min(1024,d.DATABASE.PORT.MIN).max(65535,d.DATABASE.PORT.MAX),_z=s.enum(xu).describe(`Database type must be one of: ${xu.join(", ")}`),Ez=s.object({maxConnections:s.number().int(d.MAX_CONNECTIONS.INTEGER).min(1,d.MAX_CONNECTIONS.MIN).max(100,d.MAX_CONNECTIONS.MAX).optional(),maxIdleConnections:s.number().int(d.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.INTEGER).min(0,d.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MIN).max(100,d.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MAX).optional(),connectionBorrowTimeout:s.number().int(d.PROXY_CONFIG.BORROW_TIMEOUT.INTEGER).min(1,d.PROXY_CONFIG.BORROW_TIMEOUT.MIN).max(3600,d.PROXY_CONFIG.BORROW_TIMEOUT.MAX).optional(),requireTLS:s.boolean().optional()}).strict().describe("RDS Proxy configuration"),xz=s.object({instanceType:s.string().optional(),availabilityZone:s.string().optional()}).strict().describe("Read replica configuration"),Az=s.object({automaticallyAfterDays:s.number().int(d.ROTATION.INTEGER).min(1,d.ROTATION.MIN).max(365,d.ROTATION.MAX).optional()}).strict().describe("Secret rotation configuration"),Mu=s.object({username:s.string().min(1,d.REQUIRED.USERNAME).max(63,d.USERNAME.MAX_LENGTH).optional(),secretRotation:Az.optional()}).strict().describe("Database credentials configuration"),ju=He(Ez),zu=He(xz),Iz=s.object({scaleWithWriter:s.boolean().optional(),enableDatabaseInsights:s.boolean().optional(),identifierSuffix:s.string().min(1,d.IDENTIFIER_SUFFIX.REQUIRED).max(50,d.IDENTIFIER_SUFFIX.MAX_LENGTH).optional(),availabilityZone:s.string().optional()}).strict().describe("Configuration for a single Aurora reader instance"),ua=s.object({enableDatabaseInsights:s.boolean().optional(),identifierSuffix:s.string().min(1,d.IDENTIFIER_SUFFIX.REQUIRED).max(50,d.IDENTIFIER_SUFFIX.MAX_LENGTH).optional(),availabilityZone:s.string().optional()}).strict().describe("Configuration for Aurora writer instance"),$z=s.object({count:s.number().int(d.READER.COUNT.INTEGER).min(0,d.READER.COUNT.MIN).max(15,d.READER.COUNT.MAX).optional(),instances:s.array(Iz).max(15,d.READER_INSTANCES.MAX).optional(),defaultEnableDatabaseInsights:s.boolean().optional()}).strict().refine(e=>!(e.count!==void 0&&e.instances!==void 0),{message:d.READER_INSTANCES.COUNT_OR_INSTANCES,path:["count"]}).describe("Aurora readers configuration"),la=He($z),Tz=s.object({awsManaged:s.literal(!0)}).strict(),Rz=s.object({useCMK:s.literal(!0)}).strict(),e$=s.union([Tz,Rz]),Pz=s.object({mode:s.enum(["standard","advanced"]).optional(),encryptionKey:e$.optional()}).strict().describe("Database Insights configuration"),Lu=He(Pz),Uu=s.object({storageKey:e$.optional()}).strict().describe("Encryption configuration (DESTRUCTIVE to change storageKey)"),t$=s.object({name:V,type:_z,databaseName:s.string().min(1,d.REQUIRED.DATABASE_NAME),instanceType:s.string().optional(),allocatedStorage:s.number().optional(),multiAz:s.boolean().optional(),publiclyAccessible:s.boolean().optional(),databaseInsights:Lu.optional(),port:Du.optional(),deletionProtection:s.boolean().optional(),proxy:ju.optional(),credentials:Mu.optional(),readReplica:zu.optional(),encryption:Uu.optional(),writer:ua.optional(),readers:la.optional(),backupRetention:Qt.optional(),preferredMaintenanceWindow:s.string().optional(),monitoringInterval:ca.optional(),primaryRegion:s.string().optional(),secondaryRegions:s.array(s.string()).optional(),globalClusterIdentifier:s.string().optional(),enableGlobalWriteForwarding:s.boolean().optional(),snapshotIdentifier:s.string().optional(),snapshotUsername:s.string().optional(),databaseEngine:s.enum(xi).optional(),engineExpression:s.string().optional(),variableName:s.string().optional(),extraProperties:s.array(Re).optional(),alarms:JI.optional()}).strict(),Fu=s.object({appName:ve,nameProvidedByFlag:s.boolean().optional(),databaseName:s.string().min(1,d.REQUIRED.DATABASE_NAME).max(63,d.MAX_LENGTH.DATABASE_NAME).regex(L.DATABASE_NAME,d.DATABASE_NAME),resourceName:V.optional(),connectionConfig:s.object({connectToCompute:s.array(s.string()).optional(),connectToServices:s.array(s.string()).optional()}).strict().optional(),databaseInsights:Lu.optional(),port:Du.optional(),proxy:ju.optional(),credentials:Mu.optional(),encryption:Uu.optional(),deletionProtection:s.boolean().optional()}).strict(),r$={databaseType:s.literal("Instance"),instanceType:s.string().optional(),multiAz:s.boolean().optional(),readReplica:zu.optional(),publiclyAccessible:s.boolean().optional(),backupRetention:Qt.optional(),allocatedStorage:s.number().optional(),snapshotIdentifier:s.string().optional(),snapshotUsername:s.string().optional()},n$={databaseType:s.literal("Aurora"),writer:ua.optional(),readers:la.optional(),backupRetention:Qt.optional(),preferredMaintenanceWindow:s.string().optional(),monitoringInterval:ca.optional(),snapshotIdentifier:s.string().optional(),snapshotUsername:s.string().optional()},i$={databaseType:s.literal("GlobalAurora"),primaryRegion:s.string().min(1,d.GLOBAL_AURORA.PRIMARY_REGION_REQUIRED),secondaryRegions:s.array(s.string()).optional(),globalClusterIdentifier:s.string().optional(),enableGlobalWriteForwarding:s.boolean().optional(),writer:ua.optional(),readers:la.optional(),backupRetention:Qt.optional(),preferredMaintenanceWindow:s.string().optional(),monitoringInterval:ca.optional(),snapshotIdentifier:s.string().optional(),snapshotUsername:s.string().optional()},o$=s.object({appName:ve,nameProvidedByFlag:s.boolean().optional(),databaseName:s.string().min(1,d.REQUIRED.DATABASE_NAME).max(63,d.MAX_LENGTH.DATABASE_NAME).regex(L.DATABASE_NAME,d.DATABASE_NAME),resourceName:V.optional(),connectionConfig:s.object({connectToCompute:s.array(s.string()).optional(),connectToServices:s.array(s.string()).optional()}).strict().optional()}).strict(),a$={databaseType:s.literal("ClickHouse"),instanceType:s.string().optional(),coldTier:s.union([s.object({mode:s.literal("s3")}).strict(),s.literal(!1)]).optional(),optimiseSchedule:s.union([s.string(),s.literal(!1)]).optional(),backupSchedule:s.union([s.string(),s.literal(!1)]).optional(),backupRetentionDays:Qt.optional()},Cz=Fu.extend(r$).strict(),Nz=Fu.extend(n$).strict(),wz=Fu.extend(i$).strict(),kz=o$.extend(a$).strict(),I5=s.discriminatedUnion("databaseType",[Cz,Nz,wz,kz]),Tv=Fu.extend({resourceName:V}).strict(),Oz=Tv.extend(r$).strict(),Dz=Tv.extend(n$).strict(),Mz=Tv.extend(i$).strict(),jz=o$.extend({resourceName:V}).strict(),zz=jz.extend(a$).strict(),$5=s.discriminatedUnion("databaseType",[Oz,Dz,Mz,zz]),T5=s.object({appName:ve,databaseName:s.string().min(1,d.REQUIRED.DATABASE_NAME),maxConnections:s.number().int(d.MAX_CONNECTIONS.INTEGER).min(1,d.MAX_CONNECTIONS.MIN).max(100,d.MAX_CONNECTIONS.MAX).optional(),maxIdleConnections:s.number().int(d.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.INTEGER).min(0,d.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MIN).max(100,d.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MAX).optional(),connectionBorrowTimeout:s.number().int(d.PROXY_CONFIG.BORROW_TIMEOUT.INTEGER).min(1,d.PROXY_CONFIG.BORROW_TIMEOUT.MIN).max(3600,d.PROXY_CONFIG.BORROW_TIMEOUT.MAX).optional(),requireTLS:s.boolean().optional(),nameProvidedByFlag:s.boolean().optional()}).strict(),Lz=["S","N","B"],Ou=s.object({name:s.string(),type:s.enum(Lz)}).strict(),s$=s.object({name:V,partitionKey:Ou,sortKey:Ou.optional(),globalSecondaryIndexes:s.array(s.object({indexName:s.string(),partitionKey:Ou,sortKey:Ou.optional()}).strict()).optional(),ttlAttribute:s.string().optional(),stream:s.boolean().optional(),variableName:s.string().optional(),extraProperties:s.array(Re).optional()}).strict(),Uz=s.object({mode:s.literal("s3")}).strict(),c$=s.object({name:V,type:s.literal("ClickHouse"),databaseName:WI,instanceType:s.string().optional(),coldTier:s.union([Uz,s.literal(!1)]).optional(),optimiseSchedule:s.union([s.string(),s.literal(!1)]).optional(),backupSchedule:s.union([s.string(),s.literal(!1)]).optional(),backupRetentionDays:Qt.optional(),variableName:s.string().optional(),extraProperties:s.array(Re).optional()}).strict();var Fz=s.object({count:s.number().int(d.NAT_GATEWAY.INTEGER).min(0,d.NAT_GATEWAY.MIN).max(3,d.NAT_GATEWAY.MAX).optional()}).strict().describe("NAT gateway configuration"),u$=He(Fz),Rv=s.enum(["cloudwatch","s3"]),Bz=s.object({destination:Rv.optional(),retentionDays:s.number().int(d.RETENTION_DAYS.INTEGER).min(1,d.RETENTION_DAYS.MIN).max(365,d.RETENTION_DAYS.MAX).optional(),trafficType:s.enum(["ALL","ACCEPT","REJECT"]).optional()}).strict().describe("VPC flow log configuration"),l$=He(Bz),Vz=s.object({s3:s.boolean().optional(),dynamodb:s.boolean().optional()}).strict().describe("Gateway VPC endpoints (FREE)"),Zz=He(Vz),Gz=s.object({ecr:s.boolean().optional(),secretsManager:s.boolean().optional(),kms:s.boolean().optional(),cloudwatchLogs:s.boolean().optional(),ssm:s.boolean().optional(),sts:s.boolean().optional()}).strict().describe("Interface VPC endpoints (cost per hour)"),Wz=He(Gz),Hz=s.object({gateway:Zz.optional(),interface:Wz.optional()}).strict().describe("VPC endpoints configuration"),d$=He(Hz),Bu=s.object({maxAzs:s.number().int(d.MAX_AZS.INTEGER).min(1,d.MAX_AZS.MIN).max(3,d.MAX_AZS.MAX).optional(),natGateways:u$.optional(),flowLogs:l$.optional(),vpcEndpoints:d$.optional(),cidrMask:s.number().int(d.CIDR_MASK.INTEGER).min(16,d.CIDR_MASK.MIN).max(28,d.CIDR_MASK.MAX).optional()}).strict(),m$=s.string().min(1,d.REQUIRED.NETWORK_NAME).max(50,d.MAX_LENGTH.NETWORK_NAME).regex(L.RESOURCE_NAME,d.RESOURCE_NAME),p$=Bu.extend({name:m$}).strict(),f$=He(Bu),w5=s.object({appName:ve,networkName:m$.optional(),maxAzs:s.number().int(d.MAX_AZS.INTEGER).min(1,d.MAX_AZS.MIN).max(3,d.MAX_AZS.MAX).optional(),natGateways:u$.optional(),flowLogs:l$.optional(),vpcEndpoints:d$.optional()}).strict(),qz=L.CIDR,Pv=s.string().regex(qz,d.CIDR),Kz=s.object({kind:s.literal("database"),resource:s.string().min(1,d.REQUIRED.RESOURCE_REFERENCE),name:V,allowedFromCidrs:s.array(Pv),access:s.enum(["read","write","readWrite"]).optional()}).strict(),Yz=s.object({kind:s.literal("ecsService"),resource:s.string().min(1,d.REQUIRED.RESOURCE_REFERENCE),serviceName:s.string().min(1,d.REQUIRED.SERVICE_NAME),name:V,allowedFromCidrs:s.array(Pv),port:sn.optional()}).strict(),Xz=s.discriminatedUnion("kind",[Kz,Yz]),k5=s.object({name:V,peerAppName:s.string().min(1,d.REQUIRED.APP_NAME),peerAccountId:s.string().regex(L.AWS_ACCOUNT_ID,d.AWS_ACCOUNT_ID),peerRegion:s.string().min(1,d.VPC_PEER.REGION_REQUIRED).optional(),peerVpcId:s.string().regex(L.VPC_ID,d.VPC_ID).optional(),peerVpcCidr:Pv.optional(),peerRoleArn:s.string().regex(L.ROLE_ARN,d.ROLE_ARN).optional(),peerRouteTableIds:s.array(s.string().min(1,d.VPC_PEER.ROUTE_TABLE_ID_REQUIRED)).optional(),localVpcName:s.string().min(1,d.REQUIRED.NETWORK_NAME).optional(),enableDnsResolution:s.boolean().optional()}).strict(),O5=s.object({name:V,requesterAccountIds:s.array(s.string().regex(L.AWS_ACCOUNT_ID,d.AWS_ACCOUNT_ID)).min(1,d.VPC_PEER.MIN_REQUESTER_ACCOUNTS),localVpcName:s.string().min(1,d.REQUIRED.NETWORK_NAME).optional(),publishToSsm:s.boolean().optional(),exposedResources:s.array(Xz).optional()}).strict();var Vu=["storage","cdn","compute"],Jz=s.object({sid:s.string().optional(),effect:s.enum(["Allow","Deny"]),principals:s.array(s.string()),actions:s.array(s.string()),resources:s.array(s.string()).optional(),conditions:s.record(s.string(),s.record(s.string(),s.union([s.string(),s.array(s.string())]))).optional()}).strict(),g$=s.object({name:V,bucketName:s.string().optional(),publicReadAccess:s.boolean().optional(),websiteHosting:s.object({indexDocument:s.string(),errorDocument:s.string().optional()}).strict().optional(),backupVaultTier:s.enum(_t).optional(),versioned:s.boolean().optional(),encryption:s.enum(Ii).optional(),kmsKeyArn:s.string().optional(),cors:s.array(s.object({allowedOrigins:s.array(s.string()),allowedMethods:s.array(s.string()),allowedHeaders:s.array(s.string()).optional(),exposedHeaders:s.array(s.string()).optional(),maxAge:s.number().optional()}).strict()).optional(),deployment:s.object({source:s.string(),prune:s.boolean().optional(),cacheControl:s.object({maxAge:s.number().optional(),immutable:s.boolean().optional()}).strict().optional()}).strict().optional(),retain:s.boolean().optional(),resourcePolicyStatements:s.array(Jz).optional(),stackPlacement:s.enum(Vu).optional(),variableName:s.string().optional(),extraProperties:s.array(Re).optional()}).strict().refine(e=>e.encryption!=="KMS"||!!e.kmsKeyArn,{message:d.KMS.KEY_REQUIRED}),h$=s.object({appName:ve,bucketName:GI,nameProvidedByFlag:s.boolean().optional(),storagePreset:s.enum(VI).optional(),publicReadAccess:s.boolean().optional(),websiteHosting:s.object({indexDocument:s.string(),errorDocument:s.string().optional()}).strict().optional(),backupVaultTier:s.enum(_t).optional(),versioned:s.boolean().optional(),encryption:s.enum(Ii).optional(),kmsKeyArn:s.string().optional(),cors:s.array(s.object({allowedOrigins:s.array(s.string()),allowedMethods:s.array(s.string()),allowedHeaders:s.array(s.string()).optional(),exposedHeaders:s.array(s.string()).optional(),maxAge:s.number().optional()}).strict()).optional(),connectionConfig:s.object({connectToCompute:s.array(s.string()).optional(),connectToServices:s.array(s.string()).optional()}).strict().optional()}).strict().refine(e=>e.encryption!=="KMS"||!!e.kmsKeyArn,{message:d.KMS.KEY_REQUIRED,path:["kmsKeyArn"]});var Cv=s.enum(["DESTROY","RETAIN"]),v$=s.object({name:V,queueType:s.enum(["standard","fifo"]).default("standard"),visibilityTimeout:s.number().int(d.SQS.VISIBILITY_TIMEOUT.INTEGER).min(0,d.SQS.VISIBILITY_TIMEOUT.MIN).max(43200,d.SQS.VISIBILITY_TIMEOUT.MAX).optional(),retentionPeriod:s.number().int(d.SQS.RETENTION_PERIOD.INTEGER).min(60,d.SQS.RETENTION_PERIOD.MIN).max(1209600,d.SQS.RETENTION_PERIOD.MAX).optional(),contentBasedDeduplication:s.boolean().optional(),removalPolicy:Cv.optional(),variableName:s.string().optional(),extraProperties:s.array(Re).optional()}).strict();var b$=s.object({type:s.literal("basic-auth"),username:s.string().min(1),password:s.string().min(1)}).strict(),y$=s.object({name:V,defaultOriginRef:s.string(),behaviours:s.array(s.object({pathPattern:s.string(),originRef:s.string(),cachePolicy:s.enum(["CACHING_OPTIMIZED","CACHING_DISABLED"]).optional()}).strict()).optional(),customDomain:s.string().optional(),certificateArn:s.string().optional(),accessGate:s.union([s.literal(!1),b$]).optional(),extraProperties:s.array(Re).optional()}).strict(),H5=s.object({appName:s.string(),name:V.optional(),defaultOriginRef:s.string(),behaviours:s.array(s.object({pathPattern:s.string(),originRef:s.string(),cachePolicy:s.enum(["CACHING_OPTIMIZED","CACHING_DISABLED"]).optional()}).strict()).optional(),customDomain:s.string().optional(),certificateArn:s.string().optional(),accessGate:s.union([s.literal(!1),b$]).optional(),nameProvidedByFlag:s.boolean().optional()}).strict();var Qz=Object.defineProperty,Nv=(e,t)=>Qz(e,"name",{value:t,configurable:!0}),eL=new Set(["t4g","c6g","c6gd","c6gn","c7g","c7gd","c7gn","r6g","r6gd","r7g","r7gd","m6g","m6gd","m7g","m7gd","a1","x2gd","im4gn","is4gen","i4g","hpc7g"]);function Ri(e){let t=e.split(".")[0]??"";return eL.has(t)?"ARM":"STANDARD"}Nv(Ri,"getArchitectureForInstanceType");function Zu(e,t){let n=Ri(e);return n!==t?{valid:!1,message:`Instance type '${e}' requires ${n} architecture, but '${t}' AMI was specified. Use a ${n==="ARM"?"Graviton instance (t4g, c6g, r6g, m6g, etc.)":"Intel/AMD instance (t3, c5, r5, m5, etc.)"} instead.`}:{valid:!0}}Nv(Zu,"validateArchitectureMatch");function S$(e,t){return Ri(e)===t}Nv(S$,"isArchitectureCompatible");var tL=Object.defineProperty,Gu=(e,t)=>tL(e,"name",{value:t,configurable:!0});var rL=1,nL=/^[A-Za-z0-9_.-]+$/,iL=s.object({id:s.string().min(1,"buildSecret id cannot be empty").regex(nL,"buildSecret id may contain only letters, digits, '_', '.', and '-' (no comma, '=', or whitespace, which would break the buildx --secret argv)"),ssm:s.string().min(1,"ssm parameter name cannot be empty").optional(),secretsManager:s.object({name:s.string().min(1,"secret name cannot be empty").optional(),arn:s.string().min(1,"secret arn cannot be empty").optional(),field:s.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:s.string().min(1,"env variable name cannot be empty").optional()}).strict().superRefine((e,t)=>{[e.ssm,e.secretsManager,e.env].filter(n=>n!==void 0).length!==1&&t.addIssue({code:s.ZodIssueCode.custom,message:"buildSecret requires exactly one source (ssm, secretsManager, or env)"})}),oL=s.union([s.string(),s.object({ssm:s.string().min(1,"ssm parameter name cannot be empty").optional(),secretsManager:s.object({name:s.string().min(1,"secret name cannot be empty").optional(),arn:s.string().min(1,"secret arn cannot be empty").optional(),field:s.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:s.string().min(1,"env variable name cannot be empty").optional(),acknowledgePublic:s.boolean().optional()}).strict().superRefine((e,t)=>{[e.ssm,e.secretsManager,e.env].filter(n=>n!==void 0).length!==1&&t.addIssue({code:s.ZodIssueCode.custom,message:"buildArg value requires exactly one source (ssm, secretsManager, or env)"})})]),Ot=s.object({path:s.string(),context:s.string().min(1,"context cannot be empty").optional(),target:s.string().min(1,"target cannot be empty").optional(),buildArgs:s.record(s.string(),oL).optional(),buildSecrets:s.array(iL).optional()}).strict(),J5=Ot.partial();function aL(e,t){if(t===void 0)return e;let n=t.context??e.context,i=t.target??e.target,r=t.buildArgs??e.buildArgs,o=t.buildSecrets??e.buildSecrets;return{path:t.path??e.path,...n!==void 0&&{context:n},...i!==void 0&&{target:i},...r!==void 0&&{buildArgs:r},...o!==void 0&&{buildSecrets:o}}}Gu(aL,"mergeDockerBuild");function wv(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}Gu(wv,"isRecord");function _$(e){if(!wv(e)||typeof e.path!="string"||e.path.length===0)return;let t=typeof e.context=="string"&&e.context.length>0?e.context:void 0,n=typeof e.target=="string"&&e.target.length>0?e.target:void 0,i=wv(e.buildArgs)&&Object.keys(e.buildArgs).length>0?e.buildArgs:void 0,r=Array.isArray(e.buildSecrets)&&e.buildSecrets.length>0?e.buildSecrets:void 0,o={path:e.path,...t!==void 0&&{context:t},...n!==void 0&&{target:n},...i!==void 0&&{buildArgs:i},...r!==void 0&&{buildSecrets:r}},a=Ot.safeParse(o);return a.success?a.data:void 0}Gu(_$,"normaliseDockerBuild");function sL(e){if(e===void 0)return;let t=_$(e);return t===void 0?void 0:JSON.stringify(t)}Gu(sL,"dockerBuildFingerprint");var cL=s.object({name:s.string(),clusterName:s.string().optional(),docker:Ot.optional(),containerPort:s.number().optional(),secrets:s.array(s.string()).optional(),ssmSecretsPath:s.string().optional(),importedSecretNames:s.array(s.string()).optional()}).strict(),uL=s.object({type:s.enum(kt),name:s.string(),source:s.string()}).strict(),lL=s.object({repositoryName:s.string()}).strict(),dL=s.object({name:s.string(),secrets:s.array(s.string()).optional(),ssmSecretsPath:s.string().optional(),importedSecretNames:s.array(s.string()).optional(),docker:Ot.optional(),imageKey:s.string().optional()}).strict(),mL=s.object({templateHash:s.string(),synthTimestamp:s.string()}).strict(),pL=s.object({constructPath:s.string().max(512),group:s.string().max(128),resourceType:s.string().max(256)}).strict(),Q5=s.object({version:s.literal(rL),generatedAt:s.string(),appName:s.string(),services:s.array(cL),lambdas:s.array(dL),pattern:uL.optional(),ecr:lL.optional(),stacks:s.record(s.string(),mL),resourceMap:s.record(s.string(),pL).optional()}).strict();var fL=Object.defineProperty,gL=(e,t)=>fL(e,"name",{value:t,configurable:!0});function x$(e){return!(e.image!==void 0&&e.docker!==void 0)}gL(x$,"imageDockerMutexCheck");var A$=s.number().int(d.CAPACITY.MIN.INTEGER).min(xv,d.GENERATOR_CAPACITY.MIN.MIN).max(Av,d.GENERATOR_CAPACITY.MIN.MAX),I$=s.number().int(d.CAPACITY.MAX.INTEGER).min(xv,d.GENERATOR_CAPACITY.MAX.MIN).max(Av,d.GENERATOR_CAPACITY.MAX.MAX),Pi=s.number().int(d.LAMBDA.MEMORY.INTEGER).min(zI,d.LAMBDA.MEMORY.MIN).max(LI,d.LAMBDA.MEMORY.MAX).refine(e=>e===128||e%64===0,d.LAMBDA.MEMORY.MULTIPLE),$$=s.string().regex(L.LAMBDA_RUNTIME_IDENTIFIER,d.LAMBDA.RUNTIME),kv=s.number().int(d.CPU.INTEGER).min(256,d.CPU.MIN).max(4096,d.CPU.MAX),Hu=s.number().int(d.CAPACITY.DESIRED.INTEGER).min(0,d.CAPACITY.DESIRED.MIN).max(Ai,d.CAPACITY.DESIRED.MAX),da=s.object({connectToDatabase:s.array(s.string()).optional()}).strict(),hL=s.object({minSize:s.number().int(d.CAPACITY.WARM_POOL.MIN_SIZE.INTEGER).min(0,d.CAPACITY.WARM_POOL.MIN_SIZE.MIN).max(UI,d.CAPACITY.WARM_POOL.MIN_SIZE.MAX).optional(),reuseOnScaleIn:s.boolean().optional()}).strict(),Ov=s.object({instanceType:s.string().optional(),amiHardwareType:s.enum(Pu).optional(),minCapacity:s.number().int(d.CAPACITY.MIN.INTEGER).min(0,d.CAPACITY.MIN.MIN_0).max(Ai,d.CAPACITY.MIN.MAX).optional(),maxCapacity:s.number().int(d.CAPACITY.MAX.INTEGER).min(1,d.CAPACITY.MAX.MIN_1).max(Ai,d.CAPACITY.MAX.MAX).optional(),memoryLimitMiB:aa(128).optional(),warmPool:hL.optional(),extraProperties:s.array(Re).optional()}).strict().superRefine((e,t)=>{if(!e.instanceType||!e.amiHardwareType)return;let n=Zu(e.instanceType,e.amiHardwareType);n.valid||t.addIssue({code:"custom",message:n.message??d.ARCHITECTURE_MISMATCH,path:["instanceType"]})}).superRefine((e,t)=>{e.minCapacity===0&&!e.warmPool&&t.addIssue({code:"custom",message:d.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:d.CAPACITY.WARM_POOL.MIN_SIZE_EXCEEDS_MAX_CAPACITY,path:["warmPool","minSize"]})}),vL=s.enum(ra).describe(`Compute type must be one of: ${ra.join(", ")}`),Dv=s.enum(_i).describe(`ECS capacity provider must be one of: ${_i.join(", ")}`),Mv=s.string().refine(e=>ct(Cu,e),{message:d.INSTANCE_TYPE}),T$=s.object({sourceType:s.enum(["sqs","dynamodb","eventbridge"]),sourceRef:s.string().describe("Name of the source resource"),batchSize:s.number().int(d.BATCH_SIZE.INTEGER).min(1,d.BATCH_SIZE.MIN).max(1e4,d.BATCH_SIZE.MAX).optional(),startingPosition:s.enum(["TRIM_HORIZON","LATEST"]).optional(),maxBatchingWindow:s.number().int(d.BATCHING_WINDOW.INTEGER).min(0,d.BATCHING_WINDOW.MIN).max(300,d.BATCHING_WINDOW.MAX).optional(),reportBatchItemFailures:s.boolean().optional()}).strict(),bL=s.object({name:s.string().min(1,d.REQUIRED.CONTAINER_NAME).optional(),image:s.string().optional(),port:sn.optional(),environment:$i.optional(),secretsImport:HI.optional(),command:s.array(s.string()).optional(),entryPoint:s.array(s.string()).optional(),essential:s.boolean().optional(),healthCheck:s.object({command:s.array(s.string()),interval:s.number().int(d.HEALTH_CHECK.INTERVAL.INTEGER).min(5,d.HEALTH_CHECK.INTERVAL.MIN).max(300,d.HEALTH_CHECK.INTERVAL.MAX).optional(),timeout:s.number().int(d.HEALTH_CHECK.TIMEOUT.INTEGER).min(2,d.HEALTH_CHECK.TIMEOUT.MIN).max(60,d.HEALTH_CHECK.TIMEOUT.MAX).optional(),retries:s.number().int(d.HEALTH_CHECK.RETRIES.INTEGER).min(1,d.HEALTH_CHECK.RETRIES.MIN).max(10,d.HEALTH_CHECK.RETRIES.MAX).optional(),startPeriod:s.number().int(d.HEALTH_CHECK.START_PERIOD.INTEGER).min(0,d.HEALTH_CHECK.START_PERIOD.MIN).max(300,d.HEALTH_CHECK.START_PERIOD.MAX).optional()}).strict().optional(),ssmSecrets:s.array(s.string().regex(L.SECRET_NAME,d.SECRET_NAME)).optional(),extraProperties:s.array(Re).optional()}).strict(),R$=s.string().min(1,d.REQUIRED.SERVICE_NAME).max(255,d.MAX_LENGTH.SERVICE_NAME).regex(L.ECS_SERVICE_NAME,d.ECS_SERVICE_NAME),P$=s.object({domain:s.string().optional(),loadBalancer:s.union([s.literal(!1),s.enum(Tu)]).optional(),directAccess:s.boolean().optional(),extraProperties:s.array(Re).optional()}).strict().refine(e=>!(e.directAccess&&e.domain),{message:d.DIRECT_ACCESS.NO_DOMAIN,path:["directAccess"]}).refine(e=>!(e.directAccess&&typeof e.loadBalancer=="string"),{message:d.DIRECT_ACCESS.NO_LOAD_BALANCER}).describe("Cluster-level configuration"),Wu=s.object({path:s.string().optional(),host:s.string().optional(),priority:s.number().int(d.PRIORITY.INTEGER).min(1,d.PRIORITY.MIN).max(5e4,d.PRIORITY.MAX).optional(),healthCheckPath:s.string().optional()}).strict().describe("Path/host-based routing configuration"),yL=s.object({desiredCount:Hu.optional(),minCapacity:s.number().int(d.CAPACITY.MIN.INTEGER).min(0,d.CAPACITY.MIN.MIN_0).max(Ai,d.CAPACITY.MIN.MAX).optional(),maxCapacity:s.number().int(d.CAPACITY.MAX.INTEGER).min(1,d.CAPACITY.MAX.MIN_1).max(Ai,d.CAPACITY.MAX.MAX).optional(),scalingType:s.enum(Ru).optional()}).strict().refine(an.check,an.params).describe("ECS service scaling configuration"),C$=s.object({name:R$,docker:Ot.optional(),needsDatabaseConnection:s.boolean().optional(),needsStorageConnection:s.boolean().optional(),needsMessagingConnection:s.boolean().optional(),image:s.string().optional(),containers:s.array(bL).optional(),routing:s.union([Wu,s.array(Wu).min(1)]).optional(),cpu:kv.optional(),memoryLimitMiB:aa(512).optional(),desiredCount:Hu.optional(),scaling:He(yL).optional(),capacityProvider:Dv,ec2Config:Ov.optional(),ssmSecretsPath:s.string().regex(L.SSM_PATH,d.SSM_PATH).optional(),extraProperties:s.array(Re).optional(),alarms:XI.optional()}).strict().superRefine((e,t)=>{x$(e)||t.addIssue({code:"custom",path:["docker"],message:d.IMAGE_DOCKER_MUTEX})}).describe("Configuration for a service in an ECS cluster"),N$=s.object({name:V,type:vL,needsConnection:s.boolean(),connectedDatabase:s.array(s.string()).optional(),connectedStorage:s.array(s.string()).optional(),connectedMessaging:s.array(s.string()).optional(),cluster:P$.optional(),services:s.array(C$).optional(),docker:Ot.partial().optional(),deployment:s.enum(Iu).optional(),codePath:s.string().optional(),timeout:s.number().int(d.LAMBDA.TIMEOUT.INTEGER).min(Nu,d.LAMBDA.TIMEOUT.MIN).max(wu,d.LAMBDA.TIMEOUT.MAX).optional(),memory:Pi.optional(),handler:s.string().optional(),runtime:$$.optional(),environment:$i.optional(),secrets:$i.optional(),eventSources:s.array(T$).optional(),functionUrl:s.object({authType:s.enum(ia)}).strict().optional(),description:s.string().optional(),scheduleExpression:s.string().optional(),architecture:s.enum($u).optional(),ephemeralStorageSize:s.number().int(d.EPHEMERAL_STORAGE.INTEGER).min(512,d.EPHEMERAL_STORAGE.MIN).max(10240,d.EPHEMERAL_STORAGE.MAX).optional(),functionName:s.string().optional(),ssmSecrets:s.array(s.string()).optional(),ssmSecretsPath:s.string().optional(),alarms:QI.optional(),instanceType:Mv.optional(),enableSSH:s.boolean().optional(),keyName:s.string().optional(),userData:s.string().optional(),securityGroups:s.array(s.string()).optional(),variableName:s.string().optional(),extraProperties:s.array(Re).optional()}).strict().superRefine((e,t)=>{if(e.type==="ecs"&&e.services)for(let n=0;n<e.services.length;n++){let i=e.services[n];i?.ec2Config?.instanceType&&!i.ec2Config.amiHardwareType&&Ri(i.ec2Config.instanceType)!=="ARM"&&t.addIssue({code:"custom",message:`Service '${i.name??n}' 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",n,"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"]})}),cH=s.object({appName:ve,clusterName:V,containerPort:sn,nameProvidedByFlag:s.boolean().optional(),ecrRepository:s.string().optional(),capacityProvider:Dv.optional(),useAppEcr:s.boolean().optional(),desiredCount:Hu.optional(),cpu:kv.optional(),memoryLimitMiB:aa(512).optional(),minCapacity:A$.optional(),maxCapacity:I$.optional(),ec2Config:Ov.optional(),connectionConfig:da.optional()}).strict().refine(an.check,an.params),uH=s.object({appName:ve,functionName:V,nameProvidedByFlag:s.boolean().optional(),lambdaType:s.enum(["basic","web","custom"]).optional(),ecrRepository:s.string().optional(),timeout:s.number().int(d.LAMBDA.TIMEOUT.INTEGER).min(Nu,d.LAMBDA.TIMEOUT.MIN).max(wu,d.LAMBDA.TIMEOUT.MAX).optional(),memory:Pi.optional(),enableFunctionUrl:s.boolean().optional(),description:s.string().optional(),enableCors:s.boolean().optional(),corsOrigins:s.string().optional(),corsHeaders:s.string().optional(),corsMethods:s.array(s.enum(BI)).optional(),corsCredentials:s.boolean().optional(),connectionConfig:da.optional()}).strict(),lH=s.object({appName:ve,instanceName:V,nameProvidedByFlag:s.boolean().optional(),instanceType:Mv.optional(),enableSSH:s.boolean().optional(),minCapacity:A$.optional(),maxCapacity:I$.optional(),connectionConfig:da.optional()}).strict().refine(an.check,an.params),dH=s.object({appName:ve,clusterName:V,serviceName:R$,capacityProvider:Dv,containerPort:sn.optional(),cpu:kv.optional(),memoryLimitMiB:aa(512).optional(),desiredCount:Hu.optional(),ec2Config:Ov.optional(),routing:s.union([Wu,s.array(Wu).min(1)]).optional(),docker:Ot.partial().optional(),nameProvidedByFlag:s.boolean().optional(),connectionConfig:da.optional()}).strict(),jv=s.object({appName:ve,computeName:V,nameProvidedByFlag:s.boolean().optional(),connectionConfig:da.optional()}).strict(),SL=jv.extend({type:s.literal("ecs"),cluster:P$.optional(),services:s.array(C$).min(1,d.SERVICE.MIN_REQUIRED),docker:Ot.partial().optional()}).strict().refine(e=>{let t=e.services.filter(n=>n.containers?.some(i=>i.port));return t.length>1?t.every(n=>(Array.isArray(n.routing)?n.routing:n.routing?[n.routing]:[]).some(i=>i.path||i.host)):!0},{message:d.SERVICE.ROUTING_REQUIRED}).refine(e=>{let t=e.services.map(n=>n.name);return new Set(t).size===t.length},{message:d.SERVICE.UNIQUE_WITHIN_CLUSTER}),_L=jv.extend({type:s.literal("lambda"),timeout:s.number().int(d.LAMBDA.TIMEOUT.INTEGER).min(Nu,d.LAMBDA.TIMEOUT.MIN).max(wu,d.LAMBDA.TIMEOUT.MAX).optional(),memory:Pi.optional(),handler:s.string().optional(),runtime:$$.optional(),environment:$i.optional(),secrets:$i.optional(),description:s.string().optional(),functionUrl:s.union([s.object({authType:s.enum(ia).optional()}).strict(),s.literal(!1)]).optional(),eventSources:s.array(T$).optional()}).strict(),EL=jv.extend({type:s.literal("ec2"),instanceType:Mv.optional(),enableSSH:s.boolean().optional(),keyName:s.string().optional(),userData:s.string().optional(),securityGroups:s.array(s.string()).optional()}).strict(),mH=s.discriminatedUnion("type",[SL,_L,EL]),E$=s.object({path:s.string().min(1,d.REQUIRED.ROUTING_PATH),priority:s.number().int(d.PRIORITY.INTEGER).min(1,d.PRIORITY.MIN).max(5e4,d.PRIORITY.MAX).optional()}).strict(),w$=s.object({name:s.string().min(1,d.REQUIRED.SERVICE_NAME).max(255,d.MAX_LENGTH.SERVICE_NAME).regex(L.RESOURCE_NAME,d.RESOURCE_NAME),serviceType:s.enum(["web","worker"]).optional(),docker:Ot.partial().optional(),containerPort:sn.optional(),needsDatabaseConnection:s.boolean().optional(),routing:s.union([E$,s.array(E$).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."}))}),pH=s.object({appName:ve,instanceType:s.string().optional()}).strict();var zv=s.object({memorySize:Pi.optional(),timeout:s.number().int(d.LAMBDA.TIMEOUT.INTEGER).min(1,d.LAMBDA.TIMEOUT.MIN).max(900,d.LAMBDA.TIMEOUT.MAX).optional(),ephemeralStorageSize:s.number().int(d.EPHEMERAL_STORAGE.INTEGER).min(512,d.EPHEMERAL_STORAGE.MIN).max(10240,d.EPHEMERAL_STORAGE.MAX).optional()}).strict(),k$=s.object({type:s.enum(Ev).optional(),databaseName:s.string().optional(),databaseEngine:s.enum(xi).optional(),deletionProtection:s.boolean().optional(),backupRetention:Qt.optional(),port:Du.optional(),publiclyAccessible:s.boolean().optional(),allowedIpCidr:s.string().optional(),instanceType:s.string().optional(),allocatedStorage:s.number().int(d.ALLOCATED_STORAGE.INTEGER).min(20,d.ALLOCATED_STORAGE.MIN).max(65536,d.ALLOCATED_STORAGE.MAX).optional(),multiAz:s.boolean().optional(),readReplica:zu.optional(),writer:ua.optional(),readers:la.optional(),allowVpcAccess:s.boolean().optional(),monitoringInterval:ca.optional(),preferredMaintenanceWindow:s.string().optional(),databaseInsights:Lu.optional(),proxy:ju.optional(),credentials:Mu.optional(),encryption:Uu.optional(),snapshotIdentifier:s.string().optional(),snapshotUsername:s.string().optional()}).strict(),O$=s.object({server:zv.optional(),imageOptimisation:zv.optional(),revalidation:zv.optional()}).strict(),Lv=s.object({versioned:s.boolean().optional()}).strict(),D$=s.object({assets:Lv.optional(),cache:Lv.optional(),media:Lv.optional()}).strict(),xL=s.object({visibilityTimeout:s.number().int(d.SQS.VISIBILITY_TIMEOUT.INTEGER).min(0,d.SQS.VISIBILITY_TIMEOUT.MIN).max(43200,d.SQS.VISIBILITY_TIMEOUT.MAX).optional(),messageRetentionPeriod:s.number().int(d.SQS.RETENTION_PERIOD.INTEGER).min(60,d.SQS.RETENTION_PERIOD.MIN).max(1209600,d.SQS.RETENTION_PERIOD.MAX).optional(),maxMessageSize:s.number().int(d.MAX_MESSAGE_SIZE.INTEGER).min(1024,d.MAX_MESSAGE_SIZE.MIN).max(262144,d.MAX_MESSAGE_SIZE.MAX).optional(),deadLetterQueue:s.union([s.literal(!1),s.object({enabled:s.boolean().optional(),maxReceiveCount:s.number().int(d.DLQ.MAX_RECEIVE_COUNT.INTEGER).min(1,d.DLQ.MAX_RECEIVE_COUNT.MIN).max(1e3,d.DLQ.MAX_RECEIVE_COUNT.MAX).optional()}).strict()]).optional()}).strict(),M$=s.object({revalidationQueue:xL.optional()}).strict(),j$=s.object({domainNames:s.array(s.string()).optional(),certificateArn:s.string().optional()}).strict(),z$=s.record(s.string().regex(L.ENV_VAR_NAME,d.ENV_VAR_NAME),s.string()).optional(),AL=s.object({type:s.literal("payload"),name:s.string().min(1,d.REQUIRED.PATTERN_NAME),domain:s.string().optional(),database:k$.optional(),compute:O$.optional(),storage:D$.optional(),messaging:M$.optional(),cdn:j$.optional(),environment:z$}).strict(),IL=s.object({type:s.literal("nextjs"),name:s.string().min(1,d.REQUIRED.PATTERN_NAME),domain:s.string().optional(),database:k$.optional(),compute:O$.optional(),storage:D$.optional(),messaging:M$.optional(),cdn:j$.optional(),environment:z$}).strict(),Uv=s.enum(Vo),$L=s.object({command:s.string().min(1,d.REQUIRED.BUILD_COMMAND),outputDir:s.string().min(1,d.REQUIRED.OUTPUT_DIR)}).strict(),TL=s.object({headers:s.boolean().optional(),contentSecurityPolicy:s.string().optional()}).strict(),RL=s.object({to:s.string().min(1,d.REQUIRED.FORMS_TO).regex(L.EMAIL,d.EMAIL),from:s.string().regex(L.EMAIL,d.EMAIL).optional(),corsOrigin:s.string().regex(L.HTTP_ORIGIN,"corsOrigin must be an exact origin such as https://example.com (no path, no trailing slash)").optional(),maxConcurrency:s.number().int().min(1).max(100).optional()}).strict(),PL=s.object({behaviours:s.array(s.unknown()).optional()}).strict(),Fv=s.object({type:s.literal("staticsite"),name:s.string().min(1,d.REQUIRED.PATTERN_NAME),source:s.string().min(1,d.REQUIRED.SOURCE),build:$L,routing:Uv.optional(),security:TL.optional(),domain:s.string().optional(),forms:RL.optional(),cdn:PL.optional()}).strict().superRefine((e,t)=>{if(e.forms===void 0)return;let n=e.domain;if(n===void 0||n===""){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&&!eu(i,n)&&t.addIssue({code:"custom",path:["forms","from"],message:`forms.from must be an address at ${n} (the verified SES identity) \u2014 for example noreply@${n}. Use forms.to for the recipient.`})}),ma=s.discriminatedUnion("type",[AL,IL,Fv]),L$=s.enum(["lightweight","standard","resilient","custom"]),U$=s.object({type:s.enum(Ev),instanceType:s.string().optional(),backupRetention:Qt.optional(),deletionProtection:s.boolean().optional(),encryption:s.union([s.object({useCMK:s.literal(!0)}).strict(),s.literal(!1)]).optional()}).strict(),F$=s.object({memorySize:Pi.optional(),timeout:s.number().int(d.LAMBDA.TIMEOUT.INTEGER).min(1,d.LAMBDA.TIMEOUT.MIN).max(900,d.LAMBDA.TIMEOUT.MAX).optional()}).strict();var B$=s.object({appName:ve,type:Iv,pattern:$v.optional(),patternConfig:ma.optional(),owner:s.string().optional(),tags:s.record(s.string(),s.string()).optional(),vpcId:s.string().optional(),network:Bu.optional(),backup:KI.optional(),tunnel:YI.optional(),additionalNetworks:s.array(p$).optional(),database:s.array(t$),s3:s.array(g$),compute:s.array(N$),dynamodb:s.array(s$).optional(),clickhouse:s.array(c$).optional(),sqs:s.array(v$).optional(),cdn:y$.optional(),customCodeBlocks:s.array(qI).optional(),additionalManagedImports:s.array(s.object({moduleSpecifier:s.string(),namedImports:s.array(s.string()),defaultImport:s.string().optional()}).strict()).optional()}).strict(),kH=s.object({name:ve,type:Iv,pattern:$v.optional(),patternTier:L$.optional(),patternDomain:s.string().optional(),source:s.string().min(1,d.REQUIRED.SOURCE).optional(),buildCommand:s.string().min(1,d.REQUIRED.BUILD_COMMAND).optional(),outputDir:s.string().min(1,d.REQUIRED.OUTPUT_DIR).optional(),routing:Uv.optional(),formsTo:s.string().min(1,d.REQUIRED.FORMS_TO).regex(L.EMAIL,d.EMAIL).optional(),corsOrigin:s.string().regex(L.HTTP_ORIGIN,"corsOrigin must be an exact origin such as https://example.com (no path, no trailing slash)").optional(),customDatabase:U$.optional(),customCompute:F$.optional(),region:s.string().optional(),owner:s.string().optional(),includeDatabase:s.boolean().optional(),databaseName:s.string().min(1,d.DATABASE.NAME.REQUIRED).max(63,d.DATABASE.NAME.MAX_LENGTH).optional(),vpcId:s.string().optional(),network:f$.optional(),services:s.array(w$).optional(),snapshotIdentifier:s.string().optional(),snapshotUsername:s.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"}))}),OH=s.object({name:V,localResource:s.string().min(1),remoteApp:s.string().min(1),remoteResource:s.string().min(1),permission:s.enum(["read","write","read-write"]),remoteArn:s.string().optional()}).strict();var CL=["fjall-managed","external","external-manual"],LH=s.enum(CL);var V$=s.object({givenName:s.string().min(1),familyName:s.string().min(1),displayName:s.string().min(1).optional(),expires:s.string().min(1).optional()}).strict(),Z$=s.object({name:s.string().min(1),path:s.string().min(1).optional()}).strict(),NL=s.union([s.object({managedPolicyArn:s.string().min(1)}).strict(),s.object({customerManagedPolicy:Z$}).strict()]),wL=s.object({managedPolicies:s.array(s.string().min(1)).optional(),inlinePolicy:s.record(s.string(),s.unknown()).optional(),customerManagedPolicies:s.array(Z$).optional(),permissionsBoundary:NL.optional(),sessionDuration:s.string().min(1).optional(),description:s.string().optional(),accounts:s.union([s.array(s.string().min(1)),s.literal("all")]).optional(),includeManagementAccount:s.boolean().optional(),groups:s.array(s.string().min(1)).optional()}).strict(),kL=s.object({description:s.string().optional()}).strict(),qu=s.string().regex(L.EMAIL,d.EMAIL),Bv={groups:s.record(s.string(),kL).optional(),permissionSets:s.record(s.string(),wL).optional(),memberships:s.record(s.string(),s.array(qu)).optional(),resolutionVersion:s.number().int().min(1).optional(),defaultPermissionSets:s.boolean().optional()},OL=s.discriminatedUnion("source",[s.object({...Bv,source:s.literal("fjall-managed"),users:s.record(qu,V$)}).strict(),s.object({...Bv,source:s.literal("external")}).strict(),s.object({...Bv,source:s.literal("external-manual"),users:s.record(qu,V$).optional()}).strict()]),UH=s.object({name:V,type:s.literal("organisation").optional(),organisationName:s.string().min(1).optional(),orgEmail:qu.optional(),accounts:s.unknown().optional(),accountIds:s.record(s.string(),s.string()).optional(),identityCentre:s.union([OL,s.literal(!1)]).optional(),allowedRegions:s.array(s.string().min(1)).optional()}).strict();var DL=Object.defineProperty,ML=(e,t)=>DL(e,"name",{value:t,configurable:!0}),jL=[1,3,5,7,14,30,60,90,120,150,180,365,400,545,731,1827,3653],zL=s.object({buildkiteQueue:s.string().min(1,"buildkiteQueue cannot be empty").max(100).regex(/^[a-zA-Z0-9-_]+$/,"buildkiteQueue must be alphanumeric with hyphens/underscores"),buildkiteOrgSlug:s.string().min(1,"buildkiteOrgSlug cannot be empty").max(100).regex(/^[a-z0-9-]+$/,"buildkiteOrgSlug must be a lowercase Buildkite organisation slug"),agentTokenSsmParameterName:s.string().min(2).regex(/^\//,"agentTokenSsmParameterName must be a full path (leading /)").optional(),agentTokenKmsKeyArn:s.string().min(1).optional(),fjallApiKeySsmParameterName:s.string().min(2).regex(/^\//,"fjallApiKeySsmParameterName must be a full path (leading /)").optional(),instanceType:s.string().min(1).default("c8g.xlarge"),agentVolumeSizeGib:s.number().int().min(20).max(1e3).default(250),agentMinInstances:s.number().int().min(0).default(0),agentMaxInstances:s.number().int().min(1).default(2),agentsPerInstance:s.number().int().min(1).default(1),spotCapacityPercentage:s.number().int().min(0).max(100).default(0),scaleInIdlePeriodSeconds:s.number().int().min(60).default(600),disconnectAfterUptimeSeconds:s.number().int().min(3600).default(86400),maxInstanceLifetimeDays:s.number().int().min(1).max(365).default(7),terminateInstanceAfterJob:s.boolean().default(!1),purgeBuildsOnDiskFull:s.boolean().default(!0),terminateInstanceOnDiskFull:s.boolean().default(!1),logRetentionDays:s.number().int().min(1).default(30),agentLogRetentionDays:s.literal(jL).default(7),buildkiteAgentRelease:s.enum(["stable","beta","edge"]).default("stable"),buildkiteAgentTags:s.string().default(""),buildkiteAgentTimestampLines:s.boolean().default(!1),buildkiteAgentExperiments:s.string().default(""),buildkiteAgentTracingBackend:s.enum(["","datadog","opentelemetry"]).default(""),buildkiteAgentCancelGracePeriodSeconds:s.number().int().min(10).default(60),enableSecretsPlugin:s.boolean().default(!0),enableEcrPlugin:s.boolean().default(!1),enableDockerLoginPlugin:s.boolean().default(!1),enableDockerUserNamespaceRemap:s.boolean().default(!0),enableDockerExperimental:s.boolean().default(!1),dockerNetworkingProtocol:s.enum(["ipv4","dualstack"]).default("ipv4"),enableInstanceStorage:s.boolean().default(!1),mountTmpfsAtTmp:s.boolean().default(!0),buildkiteAgentEnableGitMirrors:s.boolean().default(!1),bootstrapScriptUrl:s.string().default(""),agentEnvFileUrl:s.string().default(""),scalerEventSchedulePeriod:s.string().min(1).default("1 minute"),scalerMinPollInterval:s.string().min(1).default("10s"),scaleOutFactor:s.string().min(1).default("1.0"),scaleOutWaitingForJobs:s.boolean().default(!1),rolePermissionsBoundaryArn:s.string().min(1).optional(),alarmSnsTopicArn:s.string().min(1).optional(),applicationId:s.string().min(1).optional(),costAllocationEnvironment:s.string().min(1).optional(),costAllocationOwner:s.string().min(1).optional()}).strict(),LL=zL.refine(e=>e.agentMinInstances<=e.agentMaxInstances,{message:"agentMinInstances must be <= agentMaxInstances"});function UL(e){let t=LL.safeParse(e);if(!t.success){let n=t.error.issues.map(i=>` - ${i.path.join(".")||"(root)"}: ${i.message}`).join(`
187
+ `)}catch{}}Kj(Qj,"writeDebugSync");var ez=Object.defineProperty,Si=(e,t)=>ez(e,"name",{value:t,configurable:!0});function uv(e){return e.success===!0}Si(uv,"isSuccess");function lv(e){return e.success===!1}Si(lv,"isFailure");function C(e){return{success:!0,data:e}}Si(C,"success");function $(e){return{success:!1,error:e}}Si($,"failure");async function dv(e){try{let t=await e();return C(t)}catch(t){return $(vt(t))}}Si(dv,"tryAsync");function mv(e){try{let t=e();return C(t)}catch(t){return $(vt(t))}}Si(mv,"trySync");var tz=Object.defineProperty,rz=(e,t)=>tz(e,"name",{value:t,configurable:!0}),TI=/^[a-zA-Z][a-zA-Z0-9-]*$/,nz=Fo.source.replace(/^\^|\$$/g,""),L=Object.freeze({IDENTIFIER:TI,NEW_APP_NAME:/^[a-z][a-z0-9-]*$/,RESOURCE_NAME:/^[a-zA-Z][a-zA-Z0-9]*$/,ECS_SERVICE_NAME:TI,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(`^(?:/${nz})+$`),SECRET_NAME:Xc,SSM_COMPONENT:Fo,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 pv(e){let t=/^rate\((\d+) (minute|minutes|hour|hours|day|days)\)$/.exec(e);if(!t)return;let n=t[1],i=t[2];if(n===void 0||i===void 0)return;let r=parseInt(n,10);if(!Number.isFinite(r)||r<1)return;let o=i==="minute"||i==="hour"||i==="day";if(!(o&&r!==1)&&!(!o&&r===1))return i==="minute"||i==="minutes"?{everyMs:r*6e4}:i==="hour"||i==="hours"?{everyMs:r*60*6e4}:{everyMs:r*24*60*6e4}}rz(pv,"parseRateExpression");var d=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:ph,SSM_COMPONENT:Jc,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"},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"}},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"},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"}},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 iz=Object.defineProperty,st=(e,t)=>iz(e,"name",{value:t,configurable:!0}),oz=["us-east-2","us-west-2","us-east-1","eu-west-1","eu-central-1","ap-southeast-1"],az=Object.freeze(oz.flatMap(e=>{let t=Cn(e);return t?[t]:[]})),fv=Object.freeze(["us-east-2","us-west-2","us-east-1","eu-west-1","ap-southeast-1"]);function _u(e){return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}st(_u,"parseRegionList");function gv(e){return Kt.includes(e)}st(gv,"isValidRegion");function hv(e){return/^[a-z]{2}-[a-z]+-[1-9]$/.test(e)}st(hv,"isValidRegionFormat");function vv(e){if(!e)return fv.slice(0,3);let t=e.toLowerCase().split("-"),n=t[0],i=t.length>1?t[1]:"",r=[];return n&&i&&(r=Kt.filter(o=>o.startsWith(`${n}-${i}`))),r.length===0&&n&&(r=Kt.filter(o=>o.startsWith(`${n}-`))),r.length>0?r.slice(0,3):fv.slice(0,3)}st(vv,"getSuggestions");function bv(e){if(gv(e))return!0;let t=vv(e);return hv(e)?`Unknown region. Try: ${t.join(", ")}`:`Invalid format. Try: ${t.join(", ")}`}st(bv,"validateRegion");function RI(e){if(!e||e.trim()==="")return!0;let t=_u(e);for(let n of t){let i=bv(n);if(i!==!0)return i}return!0}st(RI,"validateRegionList");function yv(e,t){return e.filter(n=>n!==t)}st(yv,"filterDuplicateRegions");function Sv(e){return{label:e.city,value:e.code,description:e.optIn?`${e.code} \u2014 opt-in required`:e.code}}st(Sv,"toRegionOption");function PI(){return it.map(Sv)}st(PI,"getRegionOptions");function CI(e){return it.filter(t=>t.code!==e).map(Sv)}st(CI,"getRegionOptionsExcluding");function NI(e){let t=it.find(n=>n.code===e);return t?t.city:e}st(NI,"getRegionName");function wI(e){return t=>{let n=_u(t);return yv(n,e)}}st(wI,"createRegionFormatter");var Eu="3.11.0";var xu=["Aurora","Instance","GlobalAurora","ClickHouse"],_i=["FARGATE","FARGATE_SPOT","EC2"],_t=["standard","resilient","enterprise"],Au=["tinkerer","lightweight","standard","resilient","enterprise"],_v="custom",ta=[...Au,_v];var sz=Object.defineProperty,cz=(e,t)=>sz(e,"name",{value:t,configurable:!0}),r5=Object.freeze({RESOURCE_SUFFIXES:Object.freeze({storage:"Storage",database:"Database",cluster:"Cluster",function:"Function",instance:"Instance",compute:"Compute"})}),ra=["ecs","lambda","ec2"],Ei=Object.freeze({ECS:"ecs",LAMBDA:"lambda",EC2:"ec2"}),Iu=["code","container"],na=Object.freeze({CODE:"code",CONTAINER:"container"}),$u=["ARM_64","X86_64"],kI="ARM_64",ia=["NONE","AWS_IAM"],Tu=["public","internal"],Ru=["CPU","MEMORY"],Pu=["ARM","STANDARD"],Ev=["Instance","Aurora"],xi=["postgresql","mysql"],OI=["foundation","compliance","hardened"];var Cu=["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"],DI=[0,1,5,10,15,30,60];function ct(e,t){return e.includes(t)}cz(ct,"constIncludes");var MI=1,jI=65535,s5=Object.freeze({postgresql:5432,mysql:3306}),zI=128,LI=10240,Nu=1,wu=900,xv=1,Av=1e3,Ai=100,UI=100;var FI=3e3;var BI=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH"],VI=["standard","assets","upload","website"],Ii=["AES256","KMS"];var uz=Object.defineProperty,oa=(e,t)=>uz(e,"name",{value:t,configurable:!0}),He=oa(e=>s.union([s.literal(!1),e]),"optionalOrDisabled"),an={check:oa(e=>e.minCapacity!==void 0&&e.maxCapacity!==void 0?e.minCapacity<=e.maxCapacity:!0,"check"),params:{message:d.CAPACITY_CONSTRAINT.MIN_LTE_MAX,path:["maxCapacity"]}},aa=oa(e=>s.number().int(d.MEMORY_LIMIT.INTEGER).min(e,e===128?d.MEMORY_LIMIT.MIN_128:d.MEMORY_LIMIT.MIN_512).max(30720,d.MEMORY_LIMIT.MAX),"memoryLimitMiBSchema"),V=s.string().min(1,d.REQUIRED.RESOURCE_NAME).max(63,d.MAX_LENGTH.RESOURCE_NAME).regex(L.RESOURCE_NAME,d.RESOURCE_NAME),GI=s.string().min(1,d.REQUIRED.BUCKET_NAME).max(63,d.MAX_LENGTH.BUCKET_NAME).regex(L.BUCKET_NAME,d.BUCKET_NAME),WI=s.string().min(1,d.REQUIRED.DATABASE_NAME).max(63,d.MAX_LENGTH.DATABASE_NAME).regex(L.DATABASE_NAME,d.DATABASE_NAME);function ku(e,t=L.IDENTIFIER,n=d.IDENTIFIER){return s.string().min(2,d.IDENTIFIER_MIN_LENGTH).max(50,e).regex(t,n).refine(i=>!i.endsWith("-"),{message:d.IDENTIFIER_NO_TRAILING_HYPHEN}).refine(i=>!i.includes("--"),{message:d.IDENTIFIER_NO_CONSECUTIVE_HYPHENS})}oa(ku,"identifierSchema");var ve=ku(d.MAX_LENGTH.APP_NAME),f5=ku(d.MAX_LENGTH.APP_NAME,L.NEW_APP_NAME,d.NEW_APP_NAME),sn=s.number().int(d.PORT.INTEGER).min(MI,d.PORT.MIN).max(jI,d.PORT.MAX),Re=s.object({key:s.string(),sourceText:s.string()}).strict(),lz=s.object({__identifier:s.string()}).strict(),dz=s.object({__expression:s.string()}).strict(),mz=s.object({__call:s.string()}).strict(),pz=s.union([lz,dz,mz]),fz=s.union([s.string(),s.number(),s.boolean(),pz]),$i=s.record(s.string().regex(L.ENV_VAR_NAME,d.ENV_VAR_NAME),fz),gz=s.object({id:s.string(),name:s.string().optional(),arn:s.string().optional(),field:s.string().optional()}).strict().refine(e=>e.name!==void 0!=(e.arn!==void 0),{message:"secretsImport requires exactly one of `name` or `arn`."}),HI=s.record(s.string(),gz),g5=s.record(s.string(),s.unknown()),Iv=s.enum(ta).describe(`Application type must be one of: ${ta.join(", ")}`),$v=s.enum(kt).describe(`OpenNext deployment pattern: ${kt.join(", ")}`),hz=s.enum(["before-imports","after-imports","after-app-init","after-tags","after-resource","end-of-file"]),vz=s.enum(["import","app-init","tags","database","compute","storage","network","messaging","cdn","pattern","vpc-peer","vpc-peer-accepter","cross-plan-connection","custom"]),qI=s.object({sourceText:s.string(),position:hz,afterManagedResource:s.object({type:vz,name:s.string().optional()}).strict().optional(),originalLine:s.number().int().optional(),leadingComments:s.array(s.string()).optional(),orphaned:s.boolean().optional(),orphanedComment:s.string().optional()}).strict(),KI=s.union([s.object({tier:s.enum(_t)}).strict(),s.literal(!1)]),YI=s.union([s.object({instanceType:s.string().optional()}).strict(),s.literal(!1)]),bz=ku(d.MAX_LENGTH.ORGANISATION_NAME),yz=s.string().regex(L.EMAIL,d.EMAIL),ZI=s.string().refine(e=>Kt.includes(e),{message:d.REGION}),h5=s.object({name:bz,email:yz,accountName:s.string().optional(),primaryRegion:ZI.optional().default(Pn),secondaryRegions:s.array(ZI).optional(),security:s.enum(OI).optional(),force:s.boolean().optional()}).strict();function sa(e){return e.issues.map(t=>`${t.path.length>0?`${t.path.join(".")}: `:""}${t.message}`).join(`
188
+ `)}oa(sa,"getZodErrorMessage");var Ti=s.number().min(1,d.ALARM.PERCENTAGE.MIN).max(100,d.ALARM.PERCENTAGE.MAX),Sz=s.number().min(1,d.ALARM.FREE_STORAGE_GIB.MIN),XI=s.union([s.literal(!1),s.object({cpuThreshold:Ti.optional(),memoryThreshold:Ti.optional(),runningTasksMinimum:s.number().int().min(0).optional(),http5xxThreshold:Ti.optional()}).strict()]),JI=s.union([s.literal(!1),s.object({cpuThreshold:Ti.optional(),freeStorageThresholdGiB:Sz.optional(),connectionsThreshold:s.number().int().min(1).optional()}).strict()]),QI=s.union([s.literal(!1),s.object({errorRateThreshold:Ti.optional(),durationThresholdPercent:Ti.optional()}).strict()]);var Qt=s.number().int(d.BACKUP_RETENTION.INTEGER).min(1,d.BACKUP_RETENTION.MIN).max(35,d.BACKUP_RETENTION.MAX),ca=s.number().int(d.MONITORING_INTERVAL.INTEGER).refine(e=>ct(DI,e),{message:d.MONITORING_INTERVAL.VALUES}),Du=s.number().int(d.DATABASE.PORT.INTEGER).min(1024,d.DATABASE.PORT.MIN).max(65535,d.DATABASE.PORT.MAX),_z=s.enum(xu).describe(`Database type must be one of: ${xu.join(", ")}`),Ez=s.object({maxConnections:s.number().int(d.MAX_CONNECTIONS.INTEGER).min(1,d.MAX_CONNECTIONS.MIN).max(100,d.MAX_CONNECTIONS.MAX).optional(),maxIdleConnections:s.number().int(d.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.INTEGER).min(0,d.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MIN).max(100,d.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MAX).optional(),connectionBorrowTimeout:s.number().int(d.PROXY_CONFIG.BORROW_TIMEOUT.INTEGER).min(1,d.PROXY_CONFIG.BORROW_TIMEOUT.MIN).max(3600,d.PROXY_CONFIG.BORROW_TIMEOUT.MAX).optional(),requireTLS:s.boolean().optional()}).strict().describe("RDS Proxy configuration"),xz=s.object({instanceType:s.string().optional(),availabilityZone:s.string().optional()}).strict().describe("Read replica configuration"),Az=s.object({automaticallyAfterDays:s.number().int(d.ROTATION.INTEGER).min(1,d.ROTATION.MIN).max(365,d.ROTATION.MAX).optional()}).strict().describe("Secret rotation configuration"),Mu=s.object({username:s.string().min(1,d.REQUIRED.USERNAME).max(63,d.USERNAME.MAX_LENGTH).optional(),secretRotation:Az.optional()}).strict().describe("Database credentials configuration"),ju=He(Ez),zu=He(xz),Iz=s.object({scaleWithWriter:s.boolean().optional(),enableDatabaseInsights:s.boolean().optional(),identifierSuffix:s.string().min(1,d.IDENTIFIER_SUFFIX.REQUIRED).max(50,d.IDENTIFIER_SUFFIX.MAX_LENGTH).optional(),availabilityZone:s.string().optional()}).strict().describe("Configuration for a single Aurora reader instance"),ua=s.object({enableDatabaseInsights:s.boolean().optional(),identifierSuffix:s.string().min(1,d.IDENTIFIER_SUFFIX.REQUIRED).max(50,d.IDENTIFIER_SUFFIX.MAX_LENGTH).optional(),availabilityZone:s.string().optional()}).strict().describe("Configuration for Aurora writer instance"),$z=s.object({count:s.number().int(d.READER.COUNT.INTEGER).min(0,d.READER.COUNT.MIN).max(15,d.READER.COUNT.MAX).optional(),instances:s.array(Iz).max(15,d.READER_INSTANCES.MAX).optional(),defaultEnableDatabaseInsights:s.boolean().optional()}).strict().refine(e=>!(e.count!==void 0&&e.instances!==void 0),{message:d.READER_INSTANCES.COUNT_OR_INSTANCES,path:["count"]}).describe("Aurora readers configuration"),la=He($z),Tz=s.object({awsManaged:s.literal(!0)}).strict(),Rz=s.object({useCMK:s.literal(!0)}).strict(),e$=s.union([Tz,Rz]),Pz=s.object({mode:s.enum(["standard","advanced"]).optional(),encryptionKey:e$.optional()}).strict().describe("Database Insights configuration"),Lu=He(Pz),Uu=s.object({storageKey:e$.optional()}).strict().describe("Encryption configuration (DESTRUCTIVE to change storageKey)"),t$=s.object({name:V,type:_z,databaseName:s.string().min(1,d.REQUIRED.DATABASE_NAME),instanceType:s.string().optional(),allocatedStorage:s.number().optional(),multiAz:s.boolean().optional(),publiclyAccessible:s.boolean().optional(),databaseInsights:Lu.optional(),port:Du.optional(),deletionProtection:s.boolean().optional(),proxy:ju.optional(),credentials:Mu.optional(),readReplica:zu.optional(),encryption:Uu.optional(),writer:ua.optional(),readers:la.optional(),backupRetention:Qt.optional(),preferredMaintenanceWindow:s.string().optional(),monitoringInterval:ca.optional(),primaryRegion:s.string().optional(),secondaryRegions:s.array(s.string()).optional(),globalClusterIdentifier:s.string().optional(),enableGlobalWriteForwarding:s.boolean().optional(),snapshotIdentifier:s.string().optional(),snapshotUsername:s.string().optional(),databaseEngine:s.enum(xi).optional(),engineExpression:s.string().optional(),variableName:s.string().optional(),extraProperties:s.array(Re).optional(),alarms:JI.optional()}).strict(),Fu=s.object({appName:ve,nameProvidedByFlag:s.boolean().optional(),databaseName:s.string().min(1,d.REQUIRED.DATABASE_NAME).max(63,d.MAX_LENGTH.DATABASE_NAME).regex(L.DATABASE_NAME,d.DATABASE_NAME),resourceName:V.optional(),connectionConfig:s.object({connectToCompute:s.array(s.string()).optional(),connectToServices:s.array(s.string()).optional()}).strict().optional(),databaseInsights:Lu.optional(),port:Du.optional(),proxy:ju.optional(),credentials:Mu.optional(),encryption:Uu.optional(),deletionProtection:s.boolean().optional()}).strict(),r$={databaseType:s.literal("Instance"),instanceType:s.string().optional(),multiAz:s.boolean().optional(),readReplica:zu.optional(),publiclyAccessible:s.boolean().optional(),backupRetention:Qt.optional(),allocatedStorage:s.number().optional(),snapshotIdentifier:s.string().optional(),snapshotUsername:s.string().optional()},n$={databaseType:s.literal("Aurora"),writer:ua.optional(),readers:la.optional(),backupRetention:Qt.optional(),preferredMaintenanceWindow:s.string().optional(),monitoringInterval:ca.optional(),snapshotIdentifier:s.string().optional(),snapshotUsername:s.string().optional()},i$={databaseType:s.literal("GlobalAurora"),primaryRegion:s.string().min(1,d.GLOBAL_AURORA.PRIMARY_REGION_REQUIRED),secondaryRegions:s.array(s.string()).optional(),globalClusterIdentifier:s.string().optional(),enableGlobalWriteForwarding:s.boolean().optional(),writer:ua.optional(),readers:la.optional(),backupRetention:Qt.optional(),preferredMaintenanceWindow:s.string().optional(),monitoringInterval:ca.optional(),snapshotIdentifier:s.string().optional(),snapshotUsername:s.string().optional()},o$=s.object({appName:ve,nameProvidedByFlag:s.boolean().optional(),databaseName:s.string().min(1,d.REQUIRED.DATABASE_NAME).max(63,d.MAX_LENGTH.DATABASE_NAME).regex(L.DATABASE_NAME,d.DATABASE_NAME),resourceName:V.optional(),connectionConfig:s.object({connectToCompute:s.array(s.string()).optional(),connectToServices:s.array(s.string()).optional()}).strict().optional()}).strict(),a$={databaseType:s.literal("ClickHouse"),instanceType:s.string().optional(),coldTier:s.union([s.object({mode:s.literal("s3")}).strict(),s.literal(!1)]).optional(),optimiseSchedule:s.union([s.string(),s.literal(!1)]).optional(),backupSchedule:s.union([s.string(),s.literal(!1)]).optional(),backupRetentionDays:Qt.optional()},Cz=Fu.extend(r$).strict(),Nz=Fu.extend(n$).strict(),wz=Fu.extend(i$).strict(),kz=o$.extend(a$).strict(),$5=s.discriminatedUnion("databaseType",[Cz,Nz,wz,kz]),Tv=Fu.extend({resourceName:V}).strict(),Oz=Tv.extend(r$).strict(),Dz=Tv.extend(n$).strict(),Mz=Tv.extend(i$).strict(),jz=o$.extend({resourceName:V}).strict(),zz=jz.extend(a$).strict(),T5=s.discriminatedUnion("databaseType",[Oz,Dz,Mz,zz]),R5=s.object({appName:ve,databaseName:s.string().min(1,d.REQUIRED.DATABASE_NAME),maxConnections:s.number().int(d.MAX_CONNECTIONS.INTEGER).min(1,d.MAX_CONNECTIONS.MIN).max(100,d.MAX_CONNECTIONS.MAX).optional(),maxIdleConnections:s.number().int(d.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.INTEGER).min(0,d.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MIN).max(100,d.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MAX).optional(),connectionBorrowTimeout:s.number().int(d.PROXY_CONFIG.BORROW_TIMEOUT.INTEGER).min(1,d.PROXY_CONFIG.BORROW_TIMEOUT.MIN).max(3600,d.PROXY_CONFIG.BORROW_TIMEOUT.MAX).optional(),requireTLS:s.boolean().optional(),nameProvidedByFlag:s.boolean().optional()}).strict(),Lz=["S","N","B"],Ou=s.object({name:s.string(),type:s.enum(Lz)}).strict(),s$=s.object({name:V,partitionKey:Ou,sortKey:Ou.optional(),globalSecondaryIndexes:s.array(s.object({indexName:s.string(),partitionKey:Ou,sortKey:Ou.optional()}).strict()).optional(),ttlAttribute:s.string().optional(),stream:s.boolean().optional(),variableName:s.string().optional(),extraProperties:s.array(Re).optional()}).strict(),Uz=s.object({mode:s.literal("s3")}).strict(),c$=s.object({name:V,type:s.literal("ClickHouse"),databaseName:WI,instanceType:s.string().optional(),coldTier:s.union([Uz,s.literal(!1)]).optional(),optimiseSchedule:s.union([s.string(),s.literal(!1)]).optional(),backupSchedule:s.union([s.string(),s.literal(!1)]).optional(),backupRetentionDays:Qt.optional(),variableName:s.string().optional(),extraProperties:s.array(Re).optional()}).strict();var Fz=s.object({count:s.number().int(d.NAT_GATEWAY.INTEGER).min(0,d.NAT_GATEWAY.MIN).max(3,d.NAT_GATEWAY.MAX).optional()}).strict().describe("NAT gateway configuration"),u$=He(Fz),Rv=s.enum(["cloudwatch","s3"]),Bz=s.object({destination:Rv.optional(),retentionDays:s.number().int(d.RETENTION_DAYS.INTEGER).min(1,d.RETENTION_DAYS.MIN).max(365,d.RETENTION_DAYS.MAX).optional(),trafficType:s.enum(["ALL","ACCEPT","REJECT"]).optional()}).strict().describe("VPC flow log configuration"),l$=He(Bz),Vz=s.object({s3:s.boolean().optional(),dynamodb:s.boolean().optional()}).strict().describe("Gateway VPC endpoints (FREE)"),Zz=He(Vz),Gz=s.object({ecr:s.boolean().optional(),secretsManager:s.boolean().optional(),kms:s.boolean().optional(),cloudwatchLogs:s.boolean().optional(),ssm:s.boolean().optional(),sts:s.boolean().optional()}).strict().describe("Interface VPC endpoints (cost per hour)"),Wz=He(Gz),Hz=s.object({gateway:Zz.optional(),interface:Wz.optional()}).strict().describe("VPC endpoints configuration"),d$=He(Hz),Bu=s.object({maxAzs:s.number().int(d.MAX_AZS.INTEGER).min(1,d.MAX_AZS.MIN).max(3,d.MAX_AZS.MAX).optional(),natGateways:u$.optional(),flowLogs:l$.optional(),vpcEndpoints:d$.optional(),cidrMask:s.number().int(d.CIDR_MASK.INTEGER).min(16,d.CIDR_MASK.MIN).max(28,d.CIDR_MASK.MAX).optional()}).strict(),m$=s.string().min(1,d.REQUIRED.NETWORK_NAME).max(50,d.MAX_LENGTH.NETWORK_NAME).regex(L.RESOURCE_NAME,d.RESOURCE_NAME),p$=Bu.extend({name:m$}).strict(),f$=He(Bu),k5=s.object({appName:ve,networkName:m$.optional(),maxAzs:s.number().int(d.MAX_AZS.INTEGER).min(1,d.MAX_AZS.MIN).max(3,d.MAX_AZS.MAX).optional(),natGateways:u$.optional(),flowLogs:l$.optional(),vpcEndpoints:d$.optional()}).strict(),qz=L.CIDR,Pv=s.string().regex(qz,d.CIDR),Kz=s.object({kind:s.literal("database"),resource:s.string().min(1,d.REQUIRED.RESOURCE_REFERENCE),name:V,allowedFromCidrs:s.array(Pv),access:s.enum(["read","write","readWrite"]).optional()}).strict(),Yz=s.object({kind:s.literal("ecsService"),resource:s.string().min(1,d.REQUIRED.RESOURCE_REFERENCE),serviceName:s.string().min(1,d.REQUIRED.SERVICE_NAME),name:V,allowedFromCidrs:s.array(Pv),port:sn.optional()}).strict(),Xz=s.discriminatedUnion("kind",[Kz,Yz]),O5=s.object({name:V,peerAppName:s.string().min(1,d.REQUIRED.APP_NAME),peerAccountId:s.string().regex(L.AWS_ACCOUNT_ID,d.AWS_ACCOUNT_ID),peerRegion:s.string().min(1,d.VPC_PEER.REGION_REQUIRED).optional(),peerVpcId:s.string().regex(L.VPC_ID,d.VPC_ID).optional(),peerVpcCidr:Pv.optional(),peerRoleArn:s.string().regex(L.ROLE_ARN,d.ROLE_ARN).optional(),peerRouteTableIds:s.array(s.string().min(1,d.VPC_PEER.ROUTE_TABLE_ID_REQUIRED)).optional(),localVpcName:s.string().min(1,d.REQUIRED.NETWORK_NAME).optional(),enableDnsResolution:s.boolean().optional()}).strict(),D5=s.object({name:V,requesterAccountIds:s.array(s.string().regex(L.AWS_ACCOUNT_ID,d.AWS_ACCOUNT_ID)).min(1,d.VPC_PEER.MIN_REQUESTER_ACCOUNTS),localVpcName:s.string().min(1,d.REQUIRED.NETWORK_NAME).optional(),publishToSsm:s.boolean().optional(),exposedResources:s.array(Xz).optional()}).strict();var Vu=["storage","cdn","compute"],Jz=s.object({sid:s.string().optional(),effect:s.enum(["Allow","Deny"]),principals:s.array(s.string()),actions:s.array(s.string()),resources:s.array(s.string()).optional(),conditions:s.record(s.string(),s.record(s.string(),s.union([s.string(),s.array(s.string())]))).optional()}).strict(),g$=s.object({name:V,bucketName:s.string().optional(),publicReadAccess:s.boolean().optional(),websiteHosting:s.object({indexDocument:s.string(),errorDocument:s.string().optional()}).strict().optional(),backupVaultTier:s.enum(_t).optional(),versioned:s.boolean().optional(),encryption:s.enum(Ii).optional(),kmsKeyArn:s.string().optional(),cors:s.array(s.object({allowedOrigins:s.array(s.string()),allowedMethods:s.array(s.string()),allowedHeaders:s.array(s.string()).optional(),exposedHeaders:s.array(s.string()).optional(),maxAge:s.number().optional()}).strict()).optional(),deployment:s.object({source:s.string(),prune:s.boolean().optional(),cacheControl:s.object({maxAge:s.number().optional(),immutable:s.boolean().optional()}).strict().optional()}).strict().optional(),retain:s.boolean().optional(),resourcePolicyStatements:s.array(Jz).optional(),stackPlacement:s.enum(Vu).optional(),variableName:s.string().optional(),extraProperties:s.array(Re).optional()}).strict().refine(e=>e.encryption!=="KMS"||!!e.kmsKeyArn,{message:d.KMS.KEY_REQUIRED}),h$=s.object({appName:ve,bucketName:GI,nameProvidedByFlag:s.boolean().optional(),storagePreset:s.enum(VI).optional(),publicReadAccess:s.boolean().optional(),websiteHosting:s.object({indexDocument:s.string(),errorDocument:s.string().optional()}).strict().optional(),backupVaultTier:s.enum(_t).optional(),versioned:s.boolean().optional(),encryption:s.enum(Ii).optional(),kmsKeyArn:s.string().optional(),cors:s.array(s.object({allowedOrigins:s.array(s.string()),allowedMethods:s.array(s.string()),allowedHeaders:s.array(s.string()).optional(),exposedHeaders:s.array(s.string()).optional(),maxAge:s.number().optional()}).strict()).optional(),connectionConfig:s.object({connectToCompute:s.array(s.string()).optional(),connectToServices:s.array(s.string()).optional()}).strict().optional()}).strict().refine(e=>e.encryption!=="KMS"||!!e.kmsKeyArn,{message:d.KMS.KEY_REQUIRED,path:["kmsKeyArn"]});var Cv=s.enum(["DESTROY","RETAIN"]),v$=s.object({name:V,queueType:s.enum(["standard","fifo"]).default("standard"),visibilityTimeout:s.number().int(d.SQS.VISIBILITY_TIMEOUT.INTEGER).min(0,d.SQS.VISIBILITY_TIMEOUT.MIN).max(43200,d.SQS.VISIBILITY_TIMEOUT.MAX).optional(),retentionPeriod:s.number().int(d.SQS.RETENTION_PERIOD.INTEGER).min(60,d.SQS.RETENTION_PERIOD.MIN).max(1209600,d.SQS.RETENTION_PERIOD.MAX).optional(),contentBasedDeduplication:s.boolean().optional(),removalPolicy:Cv.optional(),variableName:s.string().optional(),extraProperties:s.array(Re).optional()}).strict();var b$=s.object({type:s.literal("basic-auth"),username:s.string().min(1),password:s.string().min(1)}).strict(),y$=s.object({name:V,defaultOriginRef:s.string(),behaviours:s.array(s.object({pathPattern:s.string(),originRef:s.string(),cachePolicy:s.enum(["CACHING_OPTIMIZED","CACHING_DISABLED"]).optional()}).strict()).optional(),customDomain:s.string().optional(),certificateArn:s.string().optional(),accessGate:s.union([s.literal(!1),b$]).optional(),extraProperties:s.array(Re).optional()}).strict(),q5=s.object({appName:s.string(),name:V.optional(),defaultOriginRef:s.string(),behaviours:s.array(s.object({pathPattern:s.string(),originRef:s.string(),cachePolicy:s.enum(["CACHING_OPTIMIZED","CACHING_DISABLED"]).optional()}).strict()).optional(),customDomain:s.string().optional(),certificateArn:s.string().optional(),accessGate:s.union([s.literal(!1),b$]).optional(),nameProvidedByFlag:s.boolean().optional()}).strict();var Qz=Object.defineProperty,Nv=(e,t)=>Qz(e,"name",{value:t,configurable:!0}),eL=new Set(["t4g","c6g","c6gd","c6gn","c7g","c7gd","c7gn","r6g","r6gd","r7g","r7gd","m6g","m6gd","m7g","m7gd","a1","x2gd","im4gn","is4gen","i4g","hpc7g"]);function Ri(e){let t=e.split(".")[0]??"";return eL.has(t)?"ARM":"STANDARD"}Nv(Ri,"getArchitectureForInstanceType");function Zu(e,t){let n=Ri(e);return n!==t?{valid:!1,message:`Instance type '${e}' requires ${n} architecture, but '${t}' AMI was specified. Use a ${n==="ARM"?"Graviton instance (t4g, c6g, r6g, m6g, etc.)":"Intel/AMD instance (t3, c5, r5, m5, etc.)"} instead.`}:{valid:!0}}Nv(Zu,"validateArchitectureMatch");function S$(e,t){return Ri(e)===t}Nv(S$,"isArchitectureCompatible");var tL=Object.defineProperty,Gu=(e,t)=>tL(e,"name",{value:t,configurable:!0});var rL=1,nL=/^[A-Za-z0-9_.-]+$/,iL=s.object({id:s.string().min(1,"buildSecret id cannot be empty").regex(nL,"buildSecret id may contain only letters, digits, '_', '.', and '-' (no comma, '=', or whitespace, which would break the buildx --secret argv)"),ssm:s.string().min(1,"ssm parameter name cannot be empty").optional(),secretsManager:s.object({name:s.string().min(1,"secret name cannot be empty").optional(),arn:s.string().min(1,"secret arn cannot be empty").optional(),field:s.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:s.string().min(1,"env variable name cannot be empty").optional()}).strict().superRefine((e,t)=>{[e.ssm,e.secretsManager,e.env].filter(n=>n!==void 0).length!==1&&t.addIssue({code:s.ZodIssueCode.custom,message:"buildSecret requires exactly one source (ssm, secretsManager, or env)"})}),oL=s.union([s.string(),s.object({ssm:s.string().min(1,"ssm parameter name cannot be empty").optional(),secretsManager:s.object({name:s.string().min(1,"secret name cannot be empty").optional(),arn:s.string().min(1,"secret arn cannot be empty").optional(),field:s.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:s.string().min(1,"env variable name cannot be empty").optional(),acknowledgePublic:s.boolean().optional()}).strict().superRefine((e,t)=>{[e.ssm,e.secretsManager,e.env].filter(n=>n!==void 0).length!==1&&t.addIssue({code:s.ZodIssueCode.custom,message:"buildArg value requires exactly one source (ssm, secretsManager, or env)"})})]),Ot=s.object({path:s.string(),context:s.string().min(1,"context cannot be empty").optional(),target:s.string().min(1,"target cannot be empty").optional(),buildArgs:s.record(s.string(),oL).optional(),buildSecrets:s.array(iL).optional()}).strict(),Q5=Ot.partial();function aL(e,t){if(t===void 0)return e;let n=t.context??e.context,i=t.target??e.target,r=t.buildArgs??e.buildArgs,o=t.buildSecrets??e.buildSecrets;return{path:t.path??e.path,...n!==void 0&&{context:n},...i!==void 0&&{target:i},...r!==void 0&&{buildArgs:r},...o!==void 0&&{buildSecrets:o}}}Gu(aL,"mergeDockerBuild");function wv(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}Gu(wv,"isRecord");function _$(e){if(!wv(e)||typeof e.path!="string"||e.path.length===0)return;let t=typeof e.context=="string"&&e.context.length>0?e.context:void 0,n=typeof e.target=="string"&&e.target.length>0?e.target:void 0,i=wv(e.buildArgs)&&Object.keys(e.buildArgs).length>0?e.buildArgs:void 0,r=Array.isArray(e.buildSecrets)&&e.buildSecrets.length>0?e.buildSecrets:void 0,o={path:e.path,...t!==void 0&&{context:t},...n!==void 0&&{target:n},...i!==void 0&&{buildArgs:i},...r!==void 0&&{buildSecrets:r}},a=Ot.safeParse(o);return a.success?a.data:void 0}Gu(_$,"normaliseDockerBuild");function sL(e){if(e===void 0)return;let t=_$(e);return t===void 0?void 0:JSON.stringify(t)}Gu(sL,"dockerBuildFingerprint");var cL=s.object({name:s.string(),clusterName:s.string().optional(),docker:Ot.optional(),containerPort:s.number().optional(),secrets:s.array(s.string()).optional(),ssmSecretsPath:s.string().optional(),importedSecretNames:s.array(s.string()).optional()}).strict(),uL=s.object({type:s.enum(kt),name:s.string(),source:s.string()}).strict(),lL=s.object({repositoryName:s.string()}).strict(),dL=["x86_64","arm64"],mL=s.object({name:s.string(),secrets:s.array(s.string()).optional(),ssmSecretsPath:s.string().optional(),importedSecretNames:s.array(s.string()).optional(),docker:Ot.optional(),imageKey:s.string().optional(),architecture:s.enum(dL).optional()}).strict(),pL=s.object({templateHash:s.string(),synthTimestamp:s.string()}).strict(),fL=s.object({constructPath:s.string().max(512),group:s.string().max(128),resourceType:s.string().max(256)}).strict(),eH=s.object({version:s.literal(rL),generatedAt:s.string(),appName:s.string(),services:s.array(cL),lambdas:s.array(mL),pattern:uL.optional(),ecr:lL.optional(),stacks:s.record(s.string(),pL),resourceMap:s.record(s.string(),fL).optional()}).strict();var gL=Object.defineProperty,hL=(e,t)=>gL(e,"name",{value:t,configurable:!0});function x$(e){return!(e.image!==void 0&&e.docker!==void 0)}hL(x$,"imageDockerMutexCheck");var A$=s.number().int(d.CAPACITY.MIN.INTEGER).min(xv,d.GENERATOR_CAPACITY.MIN.MIN).max(Av,d.GENERATOR_CAPACITY.MIN.MAX),I$=s.number().int(d.CAPACITY.MAX.INTEGER).min(xv,d.GENERATOR_CAPACITY.MAX.MIN).max(Av,d.GENERATOR_CAPACITY.MAX.MAX),Pi=s.number().int(d.LAMBDA.MEMORY.INTEGER).min(zI,d.LAMBDA.MEMORY.MIN).max(LI,d.LAMBDA.MEMORY.MAX).refine(e=>e===128||e%64===0,d.LAMBDA.MEMORY.MULTIPLE),$$=s.string().regex(L.LAMBDA_RUNTIME_IDENTIFIER,d.LAMBDA.RUNTIME),kv=s.number().int(d.CPU.INTEGER).min(256,d.CPU.MIN).max(4096,d.CPU.MAX),Hu=s.number().int(d.CAPACITY.DESIRED.INTEGER).min(0,d.CAPACITY.DESIRED.MIN).max(Ai,d.CAPACITY.DESIRED.MAX),da=s.object({connectToDatabase:s.array(s.string()).optional()}).strict(),vL=s.object({minSize:s.number().int(d.CAPACITY.WARM_POOL.MIN_SIZE.INTEGER).min(0,d.CAPACITY.WARM_POOL.MIN_SIZE.MIN).max(UI,d.CAPACITY.WARM_POOL.MIN_SIZE.MAX).optional(),reuseOnScaleIn:s.boolean().optional()}).strict(),Ov=s.object({instanceType:s.string().optional(),amiHardwareType:s.enum(Pu).optional(),minCapacity:s.number().int(d.CAPACITY.MIN.INTEGER).min(0,d.CAPACITY.MIN.MIN_0).max(Ai,d.CAPACITY.MIN.MAX).optional(),maxCapacity:s.number().int(d.CAPACITY.MAX.INTEGER).min(1,d.CAPACITY.MAX.MIN_1).max(Ai,d.CAPACITY.MAX.MAX).optional(),memoryLimitMiB:aa(128).optional(),warmPool:vL.optional(),extraProperties:s.array(Re).optional()}).strict().superRefine((e,t)=>{if(!e.instanceType||!e.amiHardwareType)return;let n=Zu(e.instanceType,e.amiHardwareType);n.valid||t.addIssue({code:"custom",message:n.message??d.ARCHITECTURE_MISMATCH,path:["instanceType"]})}).superRefine((e,t)=>{e.minCapacity===0&&!e.warmPool&&t.addIssue({code:"custom",message:d.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:d.CAPACITY.WARM_POOL.MIN_SIZE_EXCEEDS_MAX_CAPACITY,path:["warmPool","minSize"]})}),bL=s.enum(ra).describe(`Compute type must be one of: ${ra.join(", ")}`),Dv=s.enum(_i).describe(`ECS capacity provider must be one of: ${_i.join(", ")}`),Mv=s.string().refine(e=>ct(Cu,e),{message:d.INSTANCE_TYPE}),T$=s.object({sourceType:s.enum(["sqs","dynamodb","eventbridge"]),sourceRef:s.string().describe("Name of the source resource"),batchSize:s.number().int(d.BATCH_SIZE.INTEGER).min(1,d.BATCH_SIZE.MIN).max(1e4,d.BATCH_SIZE.MAX).optional(),startingPosition:s.enum(["TRIM_HORIZON","LATEST"]).optional(),maxBatchingWindow:s.number().int(d.BATCHING_WINDOW.INTEGER).min(0,d.BATCHING_WINDOW.MIN).max(300,d.BATCHING_WINDOW.MAX).optional(),reportBatchItemFailures:s.boolean().optional()}).strict(),yL=s.object({name:s.string().min(1,d.REQUIRED.CONTAINER_NAME).optional(),image:s.string().optional(),port:sn.optional(),environment:$i.optional(),secretsImport:HI.optional(),command:s.array(s.string()).optional(),entryPoint:s.array(s.string()).optional(),essential:s.boolean().optional(),healthCheck:s.object({command:s.array(s.string()),interval:s.number().int(d.HEALTH_CHECK.INTERVAL.INTEGER).min(5,d.HEALTH_CHECK.INTERVAL.MIN).max(300,d.HEALTH_CHECK.INTERVAL.MAX).optional(),timeout:s.number().int(d.HEALTH_CHECK.TIMEOUT.INTEGER).min(2,d.HEALTH_CHECK.TIMEOUT.MIN).max(60,d.HEALTH_CHECK.TIMEOUT.MAX).optional(),retries:s.number().int(d.HEALTH_CHECK.RETRIES.INTEGER).min(1,d.HEALTH_CHECK.RETRIES.MIN).max(10,d.HEALTH_CHECK.RETRIES.MAX).optional(),startPeriod:s.number().int(d.HEALTH_CHECK.START_PERIOD.INTEGER).min(0,d.HEALTH_CHECK.START_PERIOD.MIN).max(300,d.HEALTH_CHECK.START_PERIOD.MAX).optional()}).strict().optional(),ssmSecrets:s.array(s.string().regex(L.SECRET_NAME,d.SECRET_NAME)).optional(),extraProperties:s.array(Re).optional()}).strict(),R$=s.string().min(1,d.REQUIRED.SERVICE_NAME).max(255,d.MAX_LENGTH.SERVICE_NAME).regex(L.ECS_SERVICE_NAME,d.ECS_SERVICE_NAME),P$=s.object({domain:s.string().optional(),loadBalancer:s.union([s.literal(!1),s.enum(Tu)]).optional(),directAccess:s.boolean().optional(),extraProperties:s.array(Re).optional()}).strict().refine(e=>!(e.directAccess&&e.domain),{message:d.DIRECT_ACCESS.NO_DOMAIN,path:["directAccess"]}).refine(e=>!(e.directAccess&&typeof e.loadBalancer=="string"),{message:d.DIRECT_ACCESS.NO_LOAD_BALANCER}).describe("Cluster-level configuration"),Wu=s.object({path:s.string().optional(),host:s.string().optional(),priority:s.number().int(d.PRIORITY.INTEGER).min(1,d.PRIORITY.MIN).max(5e4,d.PRIORITY.MAX).optional(),healthCheckPath:s.string().optional()}).strict().describe("Path/host-based routing configuration"),SL=s.object({desiredCount:Hu.optional(),minCapacity:s.number().int(d.CAPACITY.MIN.INTEGER).min(0,d.CAPACITY.MIN.MIN_0).max(Ai,d.CAPACITY.MIN.MAX).optional(),maxCapacity:s.number().int(d.CAPACITY.MAX.INTEGER).min(1,d.CAPACITY.MAX.MIN_1).max(Ai,d.CAPACITY.MAX.MAX).optional(),scalingType:s.enum(Ru).optional()}).strict().refine(an.check,an.params).describe("ECS service scaling configuration"),C$=s.object({name:R$,docker:Ot.optional(),needsDatabaseConnection:s.boolean().optional(),needsStorageConnection:s.boolean().optional(),needsMessagingConnection:s.boolean().optional(),image:s.string().optional(),containers:s.array(yL).optional(),routing:s.union([Wu,s.array(Wu).min(1)]).optional(),cpu:kv.optional(),memoryLimitMiB:aa(512).optional(),desiredCount:Hu.optional(),scaling:He(SL).optional(),capacityProvider:Dv,ec2Config:Ov.optional(),ssmSecretsPath:s.string().regex(L.SSM_PATH,d.SSM_PATH).optional(),extraProperties:s.array(Re).optional(),alarms:XI.optional()}).strict().superRefine((e,t)=>{x$(e)||t.addIssue({code:"custom",path:["docker"],message:d.IMAGE_DOCKER_MUTEX})}).describe("Configuration for a service in an ECS cluster"),N$=s.object({name:V,type:bL,needsConnection:s.boolean(),connectedDatabase:s.array(s.string()).optional(),connectedStorage:s.array(s.string()).optional(),connectedMessaging:s.array(s.string()).optional(),cluster:P$.optional(),services:s.array(C$).optional(),docker:Ot.partial().optional(),deployment:s.enum(Iu).optional(),codePath:s.string().optional(),timeout:s.number().int(d.LAMBDA.TIMEOUT.INTEGER).min(Nu,d.LAMBDA.TIMEOUT.MIN).max(wu,d.LAMBDA.TIMEOUT.MAX).optional(),memory:Pi.optional(),handler:s.string().optional(),runtime:$$.optional(),environment:$i.optional(),secrets:$i.optional(),eventSources:s.array(T$).optional(),functionUrl:s.object({authType:s.enum(ia)}).strict().optional(),description:s.string().optional(),scheduleExpression:s.string().optional(),architecture:s.enum($u).optional(),ephemeralStorageSize:s.number().int(d.EPHEMERAL_STORAGE.INTEGER).min(512,d.EPHEMERAL_STORAGE.MIN).max(10240,d.EPHEMERAL_STORAGE.MAX).optional(),functionName:s.string().optional(),ssmSecrets:s.array(s.string()).optional(),ssmSecretsPath:s.string().optional(),alarms:QI.optional(),instanceType:Mv.optional(),enableSSH:s.boolean().optional(),keyName:s.string().optional(),userData:s.string().optional(),securityGroups:s.array(s.string()).optional(),variableName:s.string().optional(),extraProperties:s.array(Re).optional()}).strict().superRefine((e,t)=>{if(e.type==="ecs"&&e.services)for(let n=0;n<e.services.length;n++){let i=e.services[n];i?.ec2Config?.instanceType&&!i.ec2Config.amiHardwareType&&Ri(i.ec2Config.instanceType)!=="ARM"&&t.addIssue({code:"custom",message:`Service '${i.name??n}' 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",n,"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"]})}),uH=s.object({appName:ve,clusterName:V,containerPort:sn,nameProvidedByFlag:s.boolean().optional(),ecrRepository:s.string().optional(),capacityProvider:Dv.optional(),useAppEcr:s.boolean().optional(),desiredCount:Hu.optional(),cpu:kv.optional(),memoryLimitMiB:aa(512).optional(),minCapacity:A$.optional(),maxCapacity:I$.optional(),ec2Config:Ov.optional(),connectionConfig:da.optional()}).strict().refine(an.check,an.params),lH=s.object({appName:ve,functionName:V,nameProvidedByFlag:s.boolean().optional(),lambdaType:s.enum(["basic","web","custom"]).optional(),ecrRepository:s.string().optional(),timeout:s.number().int(d.LAMBDA.TIMEOUT.INTEGER).min(Nu,d.LAMBDA.TIMEOUT.MIN).max(wu,d.LAMBDA.TIMEOUT.MAX).optional(),memory:Pi.optional(),enableFunctionUrl:s.boolean().optional(),description:s.string().optional(),enableCors:s.boolean().optional(),corsOrigins:s.string().optional(),corsHeaders:s.string().optional(),corsMethods:s.array(s.enum(BI)).optional(),corsCredentials:s.boolean().optional(),connectionConfig:da.optional()}).strict(),dH=s.object({appName:ve,instanceName:V,nameProvidedByFlag:s.boolean().optional(),instanceType:Mv.optional(),enableSSH:s.boolean().optional(),minCapacity:A$.optional(),maxCapacity:I$.optional(),connectionConfig:da.optional()}).strict().refine(an.check,an.params),mH=s.object({appName:ve,clusterName:V,serviceName:R$,capacityProvider:Dv,containerPort:sn.optional(),cpu:kv.optional(),memoryLimitMiB:aa(512).optional(),desiredCount:Hu.optional(),ec2Config:Ov.optional(),routing:s.union([Wu,s.array(Wu).min(1)]).optional(),docker:Ot.partial().optional(),nameProvidedByFlag:s.boolean().optional(),connectionConfig:da.optional()}).strict(),jv=s.object({appName:ve,computeName:V,nameProvidedByFlag:s.boolean().optional(),connectionConfig:da.optional()}).strict(),_L=jv.extend({type:s.literal("ecs"),cluster:P$.optional(),services:s.array(C$).min(1,d.SERVICE.MIN_REQUIRED),docker:Ot.partial().optional()}).strict().refine(e=>{let t=e.services.filter(n=>n.containers?.some(i=>i.port));return t.length>1?t.every(n=>(Array.isArray(n.routing)?n.routing:n.routing?[n.routing]:[]).some(i=>i.path||i.host)):!0},{message:d.SERVICE.ROUTING_REQUIRED}).refine(e=>{let t=e.services.map(n=>n.name);return new Set(t).size===t.length},{message:d.SERVICE.UNIQUE_WITHIN_CLUSTER}),EL=jv.extend({type:s.literal("lambda"),timeout:s.number().int(d.LAMBDA.TIMEOUT.INTEGER).min(Nu,d.LAMBDA.TIMEOUT.MIN).max(wu,d.LAMBDA.TIMEOUT.MAX).optional(),memory:Pi.optional(),handler:s.string().optional(),runtime:$$.optional(),environment:$i.optional(),secrets:$i.optional(),description:s.string().optional(),functionUrl:s.union([s.object({authType:s.enum(ia).optional()}).strict(),s.literal(!1)]).optional(),eventSources:s.array(T$).optional()}).strict(),xL=jv.extend({type:s.literal("ec2"),instanceType:Mv.optional(),enableSSH:s.boolean().optional(),keyName:s.string().optional(),userData:s.string().optional(),securityGroups:s.array(s.string()).optional()}).strict(),pH=s.discriminatedUnion("type",[_L,EL,xL]),E$=s.object({path:s.string().min(1,d.REQUIRED.ROUTING_PATH),priority:s.number().int(d.PRIORITY.INTEGER).min(1,d.PRIORITY.MIN).max(5e4,d.PRIORITY.MAX).optional()}).strict(),w$=s.object({name:s.string().min(1,d.REQUIRED.SERVICE_NAME).max(255,d.MAX_LENGTH.SERVICE_NAME).regex(L.RESOURCE_NAME,d.RESOURCE_NAME),serviceType:s.enum(["web","worker"]).optional(),docker:Ot.partial().optional(),containerPort:sn.optional(),needsDatabaseConnection:s.boolean().optional(),routing:s.union([E$,s.array(E$).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."}))}),fH=s.object({appName:ve,instanceType:s.string().optional()}).strict();var zv=s.object({memorySize:Pi.optional(),timeout:s.number().int(d.LAMBDA.TIMEOUT.INTEGER).min(1,d.LAMBDA.TIMEOUT.MIN).max(900,d.LAMBDA.TIMEOUT.MAX).optional(),ephemeralStorageSize:s.number().int(d.EPHEMERAL_STORAGE.INTEGER).min(512,d.EPHEMERAL_STORAGE.MIN).max(10240,d.EPHEMERAL_STORAGE.MAX).optional()}).strict(),k$=s.object({type:s.enum(Ev).optional(),databaseName:s.string().optional(),databaseEngine:s.enum(xi).optional(),deletionProtection:s.boolean().optional(),backupRetention:Qt.optional(),port:Du.optional(),publiclyAccessible:s.boolean().optional(),allowedIpCidr:s.string().optional(),instanceType:s.string().optional(),allocatedStorage:s.number().int(d.ALLOCATED_STORAGE.INTEGER).min(20,d.ALLOCATED_STORAGE.MIN).max(65536,d.ALLOCATED_STORAGE.MAX).optional(),multiAz:s.boolean().optional(),readReplica:zu.optional(),writer:ua.optional(),readers:la.optional(),allowVpcAccess:s.boolean().optional(),monitoringInterval:ca.optional(),preferredMaintenanceWindow:s.string().optional(),databaseInsights:Lu.optional(),proxy:ju.optional(),credentials:Mu.optional(),encryption:Uu.optional(),snapshotIdentifier:s.string().optional(),snapshotUsername:s.string().optional()}).strict(),O$=s.object({server:zv.optional(),imageOptimisation:zv.optional(),revalidation:zv.optional()}).strict(),Lv=s.object({versioned:s.boolean().optional()}).strict(),D$=s.object({assets:Lv.optional(),cache:Lv.optional(),media:Lv.optional()}).strict(),AL=s.object({visibilityTimeout:s.number().int(d.SQS.VISIBILITY_TIMEOUT.INTEGER).min(0,d.SQS.VISIBILITY_TIMEOUT.MIN).max(43200,d.SQS.VISIBILITY_TIMEOUT.MAX).optional(),messageRetentionPeriod:s.number().int(d.SQS.RETENTION_PERIOD.INTEGER).min(60,d.SQS.RETENTION_PERIOD.MIN).max(1209600,d.SQS.RETENTION_PERIOD.MAX).optional(),maxMessageSize:s.number().int(d.MAX_MESSAGE_SIZE.INTEGER).min(1024,d.MAX_MESSAGE_SIZE.MIN).max(262144,d.MAX_MESSAGE_SIZE.MAX).optional(),deadLetterQueue:s.union([s.literal(!1),s.object({enabled:s.boolean().optional(),maxReceiveCount:s.number().int(d.DLQ.MAX_RECEIVE_COUNT.INTEGER).min(1,d.DLQ.MAX_RECEIVE_COUNT.MIN).max(1e3,d.DLQ.MAX_RECEIVE_COUNT.MAX).optional()}).strict()]).optional()}).strict(),M$=s.object({revalidationQueue:AL.optional()}).strict(),j$=s.object({domainNames:s.array(s.string()).optional(),certificateArn:s.string().optional()}).strict(),z$=s.record(s.string().regex(L.ENV_VAR_NAME,d.ENV_VAR_NAME),s.string()).optional(),IL=s.object({type:s.literal("payload"),name:s.string().min(1,d.REQUIRED.PATTERN_NAME),domain:s.string().optional(),database:k$.optional(),compute:O$.optional(),storage:D$.optional(),messaging:M$.optional(),cdn:j$.optional(),environment:z$}).strict(),$L=s.object({type:s.literal("nextjs"),name:s.string().min(1,d.REQUIRED.PATTERN_NAME),domain:s.string().optional(),database:k$.optional(),compute:O$.optional(),storage:D$.optional(),messaging:M$.optional(),cdn:j$.optional(),environment:z$}).strict(),Uv=s.enum(Vo),TL=s.object({command:s.string().min(1,d.REQUIRED.BUILD_COMMAND),outputDir:s.string().min(1,d.REQUIRED.OUTPUT_DIR)}).strict(),RL=s.object({headers:s.boolean().optional(),contentSecurityPolicy:s.string().optional()}).strict(),PL=s.object({to:s.string().min(1,d.REQUIRED.FORMS_TO).regex(L.EMAIL,d.EMAIL),from:s.string().regex(L.EMAIL,d.EMAIL).optional(),corsOrigin:s.string().regex(L.HTTP_ORIGIN,"corsOrigin must be an exact origin such as https://example.com (no path, no trailing slash)").optional(),maxConcurrency:s.number().int().min(1).max(100).optional()}).strict(),CL=s.object({behaviours:s.array(s.unknown()).optional()}).strict(),Fv=s.object({type:s.literal("staticsite"),name:s.string().min(1,d.REQUIRED.PATTERN_NAME),source:s.string().min(1,d.REQUIRED.SOURCE),build:TL,routing:Uv.optional(),security:RL.optional(),domain:s.string().optional(),forms:PL.optional(),cdn:CL.optional()}).strict().superRefine((e,t)=>{if(e.forms===void 0)return;let n=e.domain;if(n===void 0||n===""){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&&!eu(i,n)&&t.addIssue({code:"custom",path:["forms","from"],message:`forms.from must be an address at ${n} (the verified SES identity) \u2014 for example noreply@${n}. Use forms.to for the recipient.`})}),ma=s.discriminatedUnion("type",[IL,$L,Fv]),L$=s.enum(["lightweight","standard","resilient","custom"]),U$=s.object({type:s.enum(Ev),instanceType:s.string().optional(),backupRetention:Qt.optional(),deletionProtection:s.boolean().optional(),encryption:s.union([s.object({useCMK:s.literal(!0)}).strict(),s.literal(!1)]).optional()}).strict(),F$=s.object({memorySize:Pi.optional(),timeout:s.number().int(d.LAMBDA.TIMEOUT.INTEGER).min(1,d.LAMBDA.TIMEOUT.MIN).max(900,d.LAMBDA.TIMEOUT.MAX).optional()}).strict();var B$=s.object({appName:ve,type:Iv,pattern:$v.optional(),patternConfig:ma.optional(),owner:s.string().optional(),tags:s.record(s.string(),s.string()).optional(),vpcId:s.string().optional(),network:Bu.optional(),backup:KI.optional(),tunnel:YI.optional(),additionalNetworks:s.array(p$).optional(),database:s.array(t$),s3:s.array(g$),compute:s.array(N$),dynamodb:s.array(s$).optional(),clickhouse:s.array(c$).optional(),sqs:s.array(v$).optional(),cdn:y$.optional(),customCodeBlocks:s.array(qI).optional(),additionalManagedImports:s.array(s.object({moduleSpecifier:s.string(),namedImports:s.array(s.string()),defaultImport:s.string().optional()}).strict()).optional()}).strict(),OH=s.object({name:ve,type:Iv,pattern:$v.optional(),patternTier:L$.optional(),patternDomain:s.string().optional(),source:s.string().min(1,d.REQUIRED.SOURCE).optional(),buildCommand:s.string().min(1,d.REQUIRED.BUILD_COMMAND).optional(),outputDir:s.string().min(1,d.REQUIRED.OUTPUT_DIR).optional(),routing:Uv.optional(),formsTo:s.string().min(1,d.REQUIRED.FORMS_TO).regex(L.EMAIL,d.EMAIL).optional(),corsOrigin:s.string().regex(L.HTTP_ORIGIN,"corsOrigin must be an exact origin such as https://example.com (no path, no trailing slash)").optional(),customDatabase:U$.optional(),customCompute:F$.optional(),region:s.string().optional(),owner:s.string().optional(),includeDatabase:s.boolean().optional(),databaseName:s.string().min(1,d.DATABASE.NAME.REQUIRED).max(63,d.DATABASE.NAME.MAX_LENGTH).optional(),vpcId:s.string().optional(),network:f$.optional(),services:s.array(w$).optional(),snapshotIdentifier:s.string().optional(),snapshotUsername:s.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"}))}),DH=s.object({name:V,localResource:s.string().min(1),remoteApp:s.string().min(1),remoteResource:s.string().min(1),permission:s.enum(["read","write","read-write"]),remoteArn:s.string().optional()}).strict();var NL=["fjall-managed","external","external-manual"],UH=s.enum(NL);var V$=s.object({givenName:s.string().min(1),familyName:s.string().min(1),displayName:s.string().min(1).optional(),expires:s.string().min(1).optional()}).strict(),Z$=s.object({name:s.string().min(1),path:s.string().min(1).optional()}).strict(),wL=s.union([s.object({managedPolicyArn:s.string().min(1)}).strict(),s.object({customerManagedPolicy:Z$}).strict()]),kL=s.object({managedPolicies:s.array(s.string().min(1)).optional(),inlinePolicy:s.record(s.string(),s.unknown()).optional(),customerManagedPolicies:s.array(Z$).optional(),permissionsBoundary:wL.optional(),sessionDuration:s.string().min(1).optional(),description:s.string().optional(),accounts:s.union([s.array(s.string().min(1)),s.literal("all")]).optional(),includeManagementAccount:s.boolean().optional(),groups:s.array(s.string().min(1)).optional()}).strict(),OL=s.object({description:s.string().optional()}).strict(),qu=s.string().regex(L.EMAIL,d.EMAIL),Bv={groups:s.record(s.string(),OL).optional(),permissionSets:s.record(s.string(),kL).optional(),memberships:s.record(s.string(),s.array(qu)).optional(),resolutionVersion:s.number().int().min(1).optional(),defaultPermissionSets:s.boolean().optional()},DL=s.discriminatedUnion("source",[s.object({...Bv,source:s.literal("fjall-managed"),users:s.record(qu,V$)}).strict(),s.object({...Bv,source:s.literal("external")}).strict(),s.object({...Bv,source:s.literal("external-manual"),users:s.record(qu,V$).optional()}).strict()]),FH=s.object({name:V,type:s.literal("organisation").optional(),organisationName:s.string().min(1).optional(),orgEmail:qu.optional(),accounts:s.unknown().optional(),accountIds:s.record(s.string(),s.string()).optional(),identityCentre:s.union([DL,s.literal(!1)]).optional(),allowedRegions:s.array(s.string().min(1)).optional()}).strict();var ML=Object.defineProperty,jL=(e,t)=>ML(e,"name",{value:t,configurable:!0}),zL=[1,3,5,7,14,30,60,90,120,150,180,365,400,545,731,1827,3653],LL=s.object({buildkiteQueue:s.string().min(1,"buildkiteQueue cannot be empty").max(100).regex(/^[a-zA-Z0-9-_]+$/,"buildkiteQueue must be alphanumeric with hyphens/underscores"),buildkiteOrgSlug:s.string().min(1,"buildkiteOrgSlug cannot be empty").max(100).regex(/^[a-z0-9-]+$/,"buildkiteOrgSlug must be a lowercase Buildkite organisation slug"),agentTokenSsmParameterName:s.string().min(2).regex(/^\//,"agentTokenSsmParameterName must be a full path (leading /)").optional(),agentTokenKmsKeyArn:s.string().min(1).optional(),fjallApiKeySsmParameterName:s.string().min(2).regex(/^\//,"fjallApiKeySsmParameterName must be a full path (leading /)").optional(),instanceType:s.string().min(1).default("c8g.xlarge"),agentVolumeSizeGib:s.number().int().min(20).max(1e3).default(250),agentMinInstances:s.number().int().min(0).default(0),agentMaxInstances:s.number().int().min(1).default(2),agentsPerInstance:s.number().int().min(1).default(1),spotCapacityPercentage:s.number().int().min(0).max(100).default(0),scaleInIdlePeriodSeconds:s.number().int().min(60).default(600),disconnectAfterUptimeSeconds:s.number().int().min(3600).default(86400),maxInstanceLifetimeDays:s.number().int().min(1).max(365).default(7),terminateInstanceAfterJob:s.boolean().default(!1),purgeBuildsOnDiskFull:s.boolean().default(!0),terminateInstanceOnDiskFull:s.boolean().default(!1),logRetentionDays:s.number().int().min(1).default(30),agentLogRetentionDays:s.literal(zL).default(7),buildkiteAgentRelease:s.enum(["stable","beta","edge"]).default("stable"),buildkiteAgentTags:s.string().default(""),buildkiteAgentTimestampLines:s.boolean().default(!1),buildkiteAgentExperiments:s.string().default(""),buildkiteAgentTracingBackend:s.enum(["","datadog","opentelemetry"]).default(""),buildkiteAgentCancelGracePeriodSeconds:s.number().int().min(10).default(60),enableSecretsPlugin:s.boolean().default(!0),enableEcrPlugin:s.boolean().default(!1),enableDockerLoginPlugin:s.boolean().default(!1),enableDockerUserNamespaceRemap:s.boolean().default(!0),enableDockerExperimental:s.boolean().default(!1),dockerNetworkingProtocol:s.enum(["ipv4","dualstack"]).default("ipv4"),enableInstanceStorage:s.boolean().default(!1),mountTmpfsAtTmp:s.boolean().default(!0),buildkiteAgentEnableGitMirrors:s.boolean().default(!1),bootstrapScriptUrl:s.string().default(""),agentEnvFileUrl:s.string().default(""),scalerEventSchedulePeriod:s.string().min(1).default("1 minute"),scalerMinPollInterval:s.string().min(1).default("10s"),scaleOutFactor:s.string().min(1).default("1.0"),scaleOutWaitingForJobs:s.boolean().default(!1),rolePermissionsBoundaryArn:s.string().min(1).optional(),alarmSnsTopicArn:s.string().min(1).optional(),applicationId:s.string().min(1).optional(),costAllocationEnvironment:s.string().min(1).optional(),costAllocationOwner:s.string().min(1).optional()}).strict(),UL=LL.refine(e=>e.agentMinInstances<=e.agentMaxInstances,{message:"agentMinInstances must be <= agentMaxInstances"});function FL(e){let t=UL.safeParse(e);if(!t.success){let n=t.error.issues.map(i=>` - ${i.path.join(".")||"(root)"}: ${i.message}`).join(`
189
189
  `);throw new Error(`Buildkite: invalid props:
190
- ${n}`)}return t.data}ML(UL,"validateBuildkiteProps");var FL=Object.defineProperty,BL=(e,t)=>FL(e,"name",{value:t,configurable:!0});function VL(e){return`FjallDeployBoundary${e}`}BL(VL,"deployBoundaryName");var Vv={Sid:"FjallInheritAdministratorAccess",Effect:"Allow",Action:"*",Resource:"*"},G$=[{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:"FjallDenyDisableKmsKey",Effect:"Deny",Action:["kms:DisableKey"],Resource:"*"}],W$=[...G$,{Sid:"FjallDenyStandingHumanCredentials",Effect:"Deny",Action:["iam:CreateUser","iam:CreateLoginProfile","iam:CreateAccessKey","iam:CreateAccountAlias"],Resource:"*"},{Sid:"FjallDenyDisableConfigRecorder",Effect:"Deny",Action:["config:StopConfigurationRecorder"],Resource:"*"}],ZL=[...W$,{Sid:"FjallDenyAccountPasswordPolicyTamper",Effect:"Deny",Action:["iam:UpdateAccountPasswordPolicy","iam:DeleteAccountPasswordPolicy"],Resource:"*"},{Sid:"FjallDenyDisableDefaultEbsEncryption",Effect:"Deny",Action:["ec2:DisableEbsEncryptionByDefault"],Resource:"*"}],rq={foundation:[Vv,...G$],compliance:[Vv,...W$],hardened:[Vv,...ZL]};var GL=Object.defineProperty,ze=(e,t)=>GL(e,"name",{value:t,configurable:!0});var Zv="sts.amazonaws.com";function WL(e){return`FjallDevDeploy${e}`}ze(WL,"devDeployRoleName");function HL(e){return`FjallDevProvisioner${e}`}ze(HL,"devProvisionerRoleName");function qL(e){return`FjallDevSyncWriter${e}`}ze(qL,"devSyncWriterRoleName");var KL="FjallDevBoundary";function H$(e){return`arn:aws:iam::${e}:policy/${KL}`}ze(H$,"devBoundaryPolicyArn");function q$(e){return`org:${e}:dev-provisioner`}ze(q$,"devProvisionerSubject");function K$(e){return`org:${e}:dev-sync`}ze(K$,"devSyncSubject");function YL(e){let{fjallOrgId:t,providerArn:n,issuerDomain:i}=e,r={[`${i}:aud`]:Zv};return[{Sid:"FjallMachineSubject",Effect:"Allow",Principal:{Federated:n},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:{...r,[`${i}:sub`]:`org:${t}:*`}}},{Sid:"FjallUserSubjects",Effect:"Allow",Principal:{Federated:n},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:r,StringLike:{[`${i}:sub`]:`org:${t}:user:*`}}},{Sid:"FjallServiceSubjects",Effect:"Allow",Principal:{Federated:n},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:{...r,[`${i}:sub`]:[`org:${t}:discovery`,`org:${t}:connection`,`org:${t}:org-setup`,`org:${t}:dev-substrate-setup`]}}}]}ze(YL,"buildNarrowedDeployTrustStatements");function XL(e){let{fjallOrgId:t,providerArn:n,issuerDomain:i,accountId:r}=e;return[{Sid:"FjallDevSubjectsThisAccount",Effect:"Allow",Principal:{Federated:n},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:{[`${i}:aud`]:Zv},StringLike:{[`${i}:sub`]:`org:${t}:dev:${r}:*`}}}]}ze(XL,"buildDevDeployTrustStatements");function Gv(e){let{providerArn:t,issuerDomain:n,sid:i,subject:r}=e;return[{Sid:i,Effect:"Allow",Principal:{Federated:t},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:{[`${n}:aud`]:Zv,[`${n}:sub`]:r}}}]}ze(Gv,"buildServiceSubjectTrustStatements");function JL(e){return Gv({...e,sid:"FjallDevProvisionerSubject",subject:q$(e.fjallOrgId)})}ze(JL,"buildDevProvisionerTrustStatements");function QL(e){return Gv({...e,sid:"FjallDevSyncSubject",subject:K$(e.fjallOrgId)})}ze(QL,"buildDevSyncWriterTrustStatements");function eU({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/*`}]}ze(eU,"buildDevDeployPolicyStatements");function tU({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":H$(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"}}}]}ze(tU,"buildDevProvisionerPolicyStatements");function rU({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}}}]}ze(rU,"buildDevSyncWriterPolicyStatements");function nU({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}-*`}]}ze(nU,"buildDevBoundaryStatements");var iU=Object.defineProperty,Et=(e,t)=>iU(e,"name",{value:t,configurable:!0});function T(e){return JSON.stringify(e)}Et(T,"escapeStringLiteral");function cn(e){return e.map(T).join(", ")}Et(cn,"formatStringArray");var oU="import:SharedAlarmTopicArn";function un(e=" "){return`
191
- ${e}...(getConfig().environment === "production" ? { alertsTopic: ${T(oU)} } : {}),`}Et(un,"emitProductionAlertsTopicSpread");function Wv(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.__identifier=="string"||typeof t.__expression=="string"||typeof t.__call=="string"}Et(Wv,"isSpecialValue");function er(e){return e.replace(/[^a-zA-Z0-9]/g," ").split(" ").map((t,n)=>n===0?t.charAt(0).toLowerCase()+t.slice(1):t.charAt(0).toUpperCase()+t.slice(1)).join("")}Et(er,"toVariableName");function ie(e){return e.variableName??er(e.name)}Et(ie,"getVariableName");function pa(e,t){for(let n of e.database)if(n.name===t&&n.variableName)return n.variableName;for(let n of e.s3)if(n.name===t&&n.variableName)return n.variableName;for(let n of e.compute)if(n.name===t&&n.variableName)return n.variableName;for(let n of e.dynamodb??[])if(n.name===t&&n.variableName)return n.variableName;for(let n of e.sqs??[])if(n.name===t&&n.variableName)return n.variableName;return er(t)}Et(pa,"resolveResourceVariable");function Y$(e){let t=Object.entries(e);return t.length===0?!0:t.length>1?!1:t.every(([,n])=>typeof n=="string"||typeof n=="number"||typeof n=="boolean"||n===null)}Et(Y$,"isSimpleObject");function G(e,t=" "){if(e==null)return"undefined";if(typeof e=="string")return JSON.stringify(e);if(typeof e=="number"||typeof e=="boolean")return String(e);if(Wv(e)){if("__identifier"in e)return e.__identifier;if("__expression"in e)return e.__expression;if("__call"in e)return e.__call}if(Array.isArray(e))return`[${e.map(n=>G(n,t)).join(", ")}]`;if(typeof e=="object"){let n=Object.entries(e).filter(([,o])=>o!==void 0);if(Y$(e)){let o=n.map(([a,c])=>`${a}: ${G(c,t)}`).join(", ");return o?`{ ${o} }`:"{}"}let i=t+" ",r=n.map(([o,a])=>`${i}${o}: ${G(a,i)}`).join(`,
190
+ ${n}`)}return t.data}jL(FL,"validateBuildkiteProps");var BL=Object.defineProperty,VL=(e,t)=>BL(e,"name",{value:t,configurable:!0});function ZL(e){return`FjallDeployBoundary${e}`}VL(ZL,"deployBoundaryName");var Vv={Sid:"FjallInheritAdministratorAccess",Effect:"Allow",Action:"*",Resource:"*"},G$=[{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:"FjallDenyDisableKmsKey",Effect:"Deny",Action:["kms:DisableKey"],Resource:"*"}],W$=[...G$,{Sid:"FjallDenyStandingHumanCredentials",Effect:"Deny",Action:["iam:CreateUser","iam:CreateLoginProfile","iam:CreateAccessKey","iam:CreateAccountAlias"],Resource:"*"},{Sid:"FjallDenyDisableConfigRecorder",Effect:"Deny",Action:["config:StopConfigurationRecorder"],Resource:"*"}],GL=[...W$,{Sid:"FjallDenyAccountPasswordPolicyTamper",Effect:"Deny",Action:["iam:UpdateAccountPasswordPolicy","iam:DeleteAccountPasswordPolicy"],Resource:"*"},{Sid:"FjallDenyDisableDefaultEbsEncryption",Effect:"Deny",Action:["ec2:DisableEbsEncryptionByDefault"],Resource:"*"}],nq={foundation:[Vv,...G$],compliance:[Vv,...W$],hardened:[Vv,...GL]};var WL=Object.defineProperty,ze=(e,t)=>WL(e,"name",{value:t,configurable:!0});var Zv="sts.amazonaws.com";function HL(e){return`FjallDevDeploy${e}`}ze(HL,"devDeployRoleName");function qL(e){return`FjallDevProvisioner${e}`}ze(qL,"devProvisionerRoleName");function KL(e){return`FjallDevSyncWriter${e}`}ze(KL,"devSyncWriterRoleName");var YL="FjallDevBoundary";function H$(e){return`arn:aws:iam::${e}:policy/${YL}`}ze(H$,"devBoundaryPolicyArn");function q$(e){return`org:${e}:dev-provisioner`}ze(q$,"devProvisionerSubject");function K$(e){return`org:${e}:dev-sync`}ze(K$,"devSyncSubject");function XL(e){let{fjallOrgId:t,providerArn:n,issuerDomain:i}=e,r={[`${i}:aud`]:Zv};return[{Sid:"FjallMachineSubject",Effect:"Allow",Principal:{Federated:n},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:{...r,[`${i}:sub`]:`org:${t}:*`}}},{Sid:"FjallUserSubjects",Effect:"Allow",Principal:{Federated:n},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:r,StringLike:{[`${i}:sub`]:`org:${t}:user:*`}}},{Sid:"FjallServiceSubjects",Effect:"Allow",Principal:{Federated:n},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:{...r,[`${i}:sub`]:[`org:${t}:discovery`,`org:${t}:connection`,`org:${t}:org-setup`,`org:${t}:dev-substrate-setup`]}}}]}ze(XL,"buildNarrowedDeployTrustStatements");function JL(e){let{fjallOrgId:t,providerArn:n,issuerDomain:i,accountId:r}=e;return[{Sid:"FjallDevSubjectsThisAccount",Effect:"Allow",Principal:{Federated:n},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:{[`${i}:aud`]:Zv},StringLike:{[`${i}:sub`]:`org:${t}:dev:${r}:*`}}}]}ze(JL,"buildDevDeployTrustStatements");function Gv(e){let{providerArn:t,issuerDomain:n,sid:i,subject:r}=e;return[{Sid:i,Effect:"Allow",Principal:{Federated:t},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:{[`${n}:aud`]:Zv,[`${n}:sub`]:r}}}]}ze(Gv,"buildServiceSubjectTrustStatements");function QL(e){return Gv({...e,sid:"FjallDevProvisionerSubject",subject:q$(e.fjallOrgId)})}ze(QL,"buildDevProvisionerTrustStatements");function eU(e){return Gv({...e,sid:"FjallDevSyncSubject",subject:K$(e.fjallOrgId)})}ze(eU,"buildDevSyncWriterTrustStatements");function tU({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/*`}]}ze(tU,"buildDevDeployPolicyStatements");function rU({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":H$(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"}}}]}ze(rU,"buildDevProvisionerPolicyStatements");function nU({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}}}]}ze(nU,"buildDevSyncWriterPolicyStatements");function iU({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}-*`}]}ze(iU,"buildDevBoundaryStatements");var oU=Object.defineProperty,Et=(e,t)=>oU(e,"name",{value:t,configurable:!0});function T(e){return JSON.stringify(e)}Et(T,"escapeStringLiteral");function cn(e){return e.map(T).join(", ")}Et(cn,"formatStringArray");var aU="import:SharedAlarmTopicArn";function un(e=" "){return`
191
+ ${e}...(getConfig().environment === "production" ? { alertsTopic: ${T(aU)} } : {}),`}Et(un,"emitProductionAlertsTopicSpread");function Wv(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.__identifier=="string"||typeof t.__expression=="string"||typeof t.__call=="string"}Et(Wv,"isSpecialValue");function er(e){return e.replace(/[^a-zA-Z0-9]/g," ").split(" ").map((t,n)=>n===0?t.charAt(0).toLowerCase()+t.slice(1):t.charAt(0).toUpperCase()+t.slice(1)).join("")}Et(er,"toVariableName");function ie(e){return e.variableName??er(e.name)}Et(ie,"getVariableName");function pa(e,t){for(let n of e.database)if(n.name===t&&n.variableName)return n.variableName;for(let n of e.s3)if(n.name===t&&n.variableName)return n.variableName;for(let n of e.compute)if(n.name===t&&n.variableName)return n.variableName;for(let n of e.dynamodb??[])if(n.name===t&&n.variableName)return n.variableName;for(let n of e.sqs??[])if(n.name===t&&n.variableName)return n.variableName;return er(t)}Et(pa,"resolveResourceVariable");function Y$(e){let t=Object.entries(e);return t.length===0?!0:t.length>1?!1:t.every(([,n])=>typeof n=="string"||typeof n=="number"||typeof n=="boolean"||n===null)}Et(Y$,"isSimpleObject");function G(e,t=" "){if(e==null)return"undefined";if(typeof e=="string")return JSON.stringify(e);if(typeof e=="number"||typeof e=="boolean")return String(e);if(Wv(e)){if("__identifier"in e)return e.__identifier;if("__expression"in e)return e.__expression;if("__call"in e)return e.__call}if(Array.isArray(e))return`[${e.map(n=>G(n,t)).join(", ")}]`;if(typeof e=="object"){let n=Object.entries(e).filter(([,o])=>o!==void 0);if(Y$(e)){let o=n.map(([a,c])=>`${a}: ${G(c,t)}`).join(", ");return o?`{ ${o} }`:"{}"}let i=t+" ",r=n.map(([o,a])=>`${i}${o}: ${G(a,i)}`).join(`,
192
192
  `);return r?`{
193
193
  ${r}
194
194
  ${t}}`:"{}"}return JSON.stringify(e)}Et(G,"formatValue");function O(e,t,n,i="raw"){if(!e)return"";let r;switch(i){case"string":r=T(String(n));break;case"object":r=G(n);break;case"boolean-or-object":r=n===!1?"false":G(n);break;default:r=String(n)}return`
195
195
  ${t}: ${r},`}Et(O,"buildProperty");function fe(e,t=" "){return e?.length?e.map(n=>`
196
- ${t}${n.key}: ${n.sourceText},`).join(""):""}Et(fe,"emitExtraProperties");var aU=Object.defineProperty,Le=(e,t)=>aU(e,"name",{value:t,configurable:!0}),le=Object.freeze({HOST:"DATABASE_HOST",PORT:"DATABASE_PORT",NAME:"DATABASE_NAME",SSL:"DATABASE_SSL",USERNAME:"DATABASE_USERNAME",PASSWORD:"DATABASE_PASSWORD"}),fa=Object.freeze({USERNAME:"username",PASSWORD:"password"});function ln(e,t){let n=t.connectedDatabase;return n?.length?e.database.filter(i=>n.includes(i.name)):[]}Le(ln,"getConnectedDatabases");function ga(e,t){return`${e}.getCredentials().getImport(${T(t)})`}Le(ga,"getCredentialExpression");function ha(e){let t=[],n=Le((i,r,o)=>{t.push({key:i,expression:r,isSecret:o})},"addEntry");if(e.length===1){let i=ie(e[0]);n(le.HOST,`${i}.getHostEndpoint()`,!1),n(le.PORT,`${i}.getHostPort()`,!1),n(le.NAME,`${i}.getDatabaseName()`,!1),n(le.SSL,'"true"',!1),n(le.USERNAME,ga(i,fa.USERNAME),!0),n(le.PASSWORD,ga(i,fa.PASSWORD),!0)}else for(let[i,r]of e.entries()){let o=ie(r),a=i===0?"":`_${i+1}`;n(`${le.HOST}${a}`,`${o}.getHostEndpoint()`,!1),n(`${le.PORT}${a}`,`${o}.getHostPort()`,!1),n(`${le.NAME}${a}`,`${o}.getDatabaseName()`,!1),n(`${le.SSL}${a}`,'"true"',!1),n(`${le.USERNAME}${a}`,ga(o,fa.USERNAME),!0),n(`${le.PASSWORD}${a}`,ga(o,fa.PASSWORD),!0)}return t}Le(ha,"generateDatabaseEnvVarEntries");function X$(e){return`connections: [${e.map(t=>ie(t)).join(", ")}],`}Le(X$,"formatConnectionsCode");function Ku(e){return e.expression==='"true"'?"true":{__expression:e.expression}}Le(Ku,"toDatabaseEnvVarValue");function Yu(e,t){let n={},i={};if(!t.needsConnection||!t.connectedDatabase?.length)return{env:n,secrets:i};let r=ln(e,t),o=ha(r);for(let a of o){let c=Ku(a);a.isSecret?i[a.key]={__expression:a.expression}:n[a.key]=c}return{env:n,secrets:i}}Le(Yu,"buildDatabaseEnvVars");function J$(e){let t="";return t+=O(e.port!==void 0,"port",e.port),t+=O(e.deletionProtection!==void 0,"deletionProtection",e.deletionProtection),t+=O(e.snapshotIdentifier!==void 0,"snapshotIdentifier",e.snapshotIdentifier,"string"),t+=O(e.snapshotUsername!==void 0,"snapshotUsername",e.snapshotUsername,"string"),t+=O(e.monitoringInterval!==void 0,"monitoringInterval",e.monitoringInterval),t}Le(J$,"generateDatabaseSharedProps");function Q$(e){if(e.type!=="Instance")return"";let t="";return t+=O(e.instanceType!==void 0,"instanceType",e.instanceType,"string"),t+=O(e.allocatedStorage!==void 0,"allocatedStorage",e.allocatedStorage),t+=O(e.multiAz!==void 0,"multiAz",e.multiAz),t+=O(e.publiclyAccessible!==void 0,"publiclyAccessible",e.publiclyAccessible),t+=O(e.encryption!==void 0,"encryption",e.encryption,"object"),t+=O(e.databaseInsights!==void 0,"databaseInsights",e.databaseInsights,"boolean-or-object"),t+=O(e.proxy!==void 0,"proxy",e.proxy,"boolean-or-object"),t+=O(e.readReplica!==void 0,"readReplica",e.readReplica,"boolean-or-object"),t+=O(e.credentials!==void 0,"credentials",e.credentials,"object"),t+=O(e.backupRetention!==void 0,"backupRetention",e.backupRetention),t}Le(Q$,"generateDatabaseInstanceProps");function eT(e){if(e.type!=="Aurora"&&e.type!=="GlobalAurora")return"";let t="";return t+=O(e.encryption!==void 0,"encryption",e.encryption,"object"),t+=O(e.databaseInsights!==void 0,"databaseInsights",e.databaseInsights,"boolean-or-object"),t+=O(e.proxy!==void 0,"proxy",e.proxy,"boolean-or-object"),t+=O(e.credentials!==void 0,"credentials",e.credentials,"object"),t+=O(e.writer!==void 0,"writer",e.writer,"object"),t+=O(e.readers!==void 0,"readers",e.readers,"boolean-or-object"),t+=O(e.backupRetention!==void 0,"backupRetention",e.backupRetention),t+=O(e.preferredMaintenanceWindow!==void 0,"preferredMaintenanceWindow",e.preferredMaintenanceWindow,"string"),t}Le(eT,"generateDatabaseAuroraProps");function tT(e){if(e.type!=="GlobalAurora")return"";let t="";return t+=O(e.primaryRegion!==void 0,"primaryRegion",e.primaryRegion,"string"),e.secondaryRegions!==void 0&&e.secondaryRegions.length>0&&(t+=`
196
+ ${t}${n.key}: ${n.sourceText},`).join(""):""}Et(fe,"emitExtraProperties");var sU=Object.defineProperty,Le=(e,t)=>sU(e,"name",{value:t,configurable:!0}),le=Object.freeze({HOST:"DATABASE_HOST",PORT:"DATABASE_PORT",NAME:"DATABASE_NAME",SSL:"DATABASE_SSL",USERNAME:"DATABASE_USERNAME",PASSWORD:"DATABASE_PASSWORD"}),fa=Object.freeze({USERNAME:"username",PASSWORD:"password"});function ln(e,t){let n=t.connectedDatabase;return n?.length?e.database.filter(i=>n.includes(i.name)):[]}Le(ln,"getConnectedDatabases");function ga(e,t){return`${e}.getCredentials().getImport(${T(t)})`}Le(ga,"getCredentialExpression");function ha(e){let t=[],n=Le((i,r,o)=>{t.push({key:i,expression:r,isSecret:o})},"addEntry");if(e.length===1){let i=ie(e[0]);n(le.HOST,`${i}.getHostEndpoint()`,!1),n(le.PORT,`${i}.getHostPort()`,!1),n(le.NAME,`${i}.getDatabaseName()`,!1),n(le.SSL,'"true"',!1),n(le.USERNAME,ga(i,fa.USERNAME),!0),n(le.PASSWORD,ga(i,fa.PASSWORD),!0)}else for(let[i,r]of e.entries()){let o=ie(r),a=i===0?"":`_${i+1}`;n(`${le.HOST}${a}`,`${o}.getHostEndpoint()`,!1),n(`${le.PORT}${a}`,`${o}.getHostPort()`,!1),n(`${le.NAME}${a}`,`${o}.getDatabaseName()`,!1),n(`${le.SSL}${a}`,'"true"',!1),n(`${le.USERNAME}${a}`,ga(o,fa.USERNAME),!0),n(`${le.PASSWORD}${a}`,ga(o,fa.PASSWORD),!0)}return t}Le(ha,"generateDatabaseEnvVarEntries");function X$(e){return`connections: [${e.map(t=>ie(t)).join(", ")}],`}Le(X$,"formatConnectionsCode");function Ku(e){return e.expression==='"true"'?"true":{__expression:e.expression}}Le(Ku,"toDatabaseEnvVarValue");function Yu(e,t){let n={},i={};if(!t.needsConnection||!t.connectedDatabase?.length)return{env:n,secrets:i};let r=ln(e,t),o=ha(r);for(let a of o){let c=Ku(a);a.isSecret?i[a.key]={__expression:a.expression}:n[a.key]=c}return{env:n,secrets:i}}Le(Yu,"buildDatabaseEnvVars");function J$(e){let t="";return t+=O(e.port!==void 0,"port",e.port),t+=O(e.deletionProtection!==void 0,"deletionProtection",e.deletionProtection),t+=O(e.snapshotIdentifier!==void 0,"snapshotIdentifier",e.snapshotIdentifier,"string"),t+=O(e.snapshotUsername!==void 0,"snapshotUsername",e.snapshotUsername,"string"),t+=O(e.monitoringInterval!==void 0,"monitoringInterval",e.monitoringInterval),t}Le(J$,"generateDatabaseSharedProps");function Q$(e){if(e.type!=="Instance")return"";let t="";return t+=O(e.instanceType!==void 0,"instanceType",e.instanceType,"string"),t+=O(e.allocatedStorage!==void 0,"allocatedStorage",e.allocatedStorage),t+=O(e.multiAz!==void 0,"multiAz",e.multiAz),t+=O(e.publiclyAccessible!==void 0,"publiclyAccessible",e.publiclyAccessible),t+=O(e.encryption!==void 0,"encryption",e.encryption,"object"),t+=O(e.databaseInsights!==void 0,"databaseInsights",e.databaseInsights,"boolean-or-object"),t+=O(e.proxy!==void 0,"proxy",e.proxy,"boolean-or-object"),t+=O(e.readReplica!==void 0,"readReplica",e.readReplica,"boolean-or-object"),t+=O(e.credentials!==void 0,"credentials",e.credentials,"object"),t+=O(e.backupRetention!==void 0,"backupRetention",e.backupRetention),t}Le(Q$,"generateDatabaseInstanceProps");function eT(e){if(e.type!=="Aurora"&&e.type!=="GlobalAurora")return"";let t="";return t+=O(e.encryption!==void 0,"encryption",e.encryption,"object"),t+=O(e.databaseInsights!==void 0,"databaseInsights",e.databaseInsights,"boolean-or-object"),t+=O(e.proxy!==void 0,"proxy",e.proxy,"boolean-or-object"),t+=O(e.credentials!==void 0,"credentials",e.credentials,"object"),t+=O(e.writer!==void 0,"writer",e.writer,"object"),t+=O(e.readers!==void 0,"readers",e.readers,"boolean-or-object"),t+=O(e.backupRetention!==void 0,"backupRetention",e.backupRetention),t+=O(e.preferredMaintenanceWindow!==void 0,"preferredMaintenanceWindow",e.preferredMaintenanceWindow,"string"),t}Le(eT,"generateDatabaseAuroraProps");function tT(e){if(e.type!=="GlobalAurora")return"";let t="";return t+=O(e.primaryRegion!==void 0,"primaryRegion",e.primaryRegion,"string"),e.secondaryRegions!==void 0&&e.secondaryRegions.length>0&&(t+=`
197
197
  secondaryRegions: [${cn(e.secondaryRegions)}],`),t+=O(e.globalClusterIdentifier!==void 0,"globalClusterIdentifier",e.globalClusterIdentifier,"string"),t+=O(e.enableGlobalWriteForwarding!==void 0,"enableGlobalWriteForwarding",e.enableGlobalWriteForwarding),t}Le(tT,"generateDatabaseGlobalAuroraProps");function Hv(e,t){return t.compute.some(n=>n.needsConnection&&n.connectedDatabase?.includes(e.name))}Le(Hv,"databaseNeedsVariable");function Xu(e){if(e.database.length===0)return"";let t="";for(let n=0;n<e.database.length;n++){let i=e.database[n],r=ie(i),o=Hv(i,e),a=n>0,c=o?`const ${r} = `:"";t+=`${a?`
198
198
  `:""}${c}app.addDatabase(
199
199
  DatabaseFactory.build(${T(i.name)}, {
@@ -218,10 +218,10 @@ ${t}${n.key}: ${n.sourceText},`).join(""):""}Et(fe,"emitExtraProperties");var aU
218
218
  backupRetentionDays: ${i.backupRetentionDays},`),t+=fe(i.extraProperties),t+=`
219
219
  })
220
220
  );
221
- `}return t}Le(Ju,"generateClickHouseCode");function rT(e,t){return t.compute.some(n=>n.connectedDatabase?.includes(e.name))}Le(rT,"clickhouseNeedsVariable");var sU=Object.defineProperty,Qu=(e,t)=>sU(e,"name",{value:t,configurable:!0}),va=Object.freeze({NAME:"BUCKET_NAME"});function dn(e,t){let{connectedStorage:n}=t;return n?.length?e.s3.filter(i=>n.includes(i.name)):[]}Qu(dn,"getConnectedStorage");function ba(e){let t=[];if(e.length===1){let n=e[0];if(!n)return t;let i=ie(n);t.push({key:va.NAME,expression:`${i}.getBucketName()`})}else for(let[n,i]of e.entries()){let r=ie(i),o=n===0?"":`_${n+1}`;t.push({key:`${va.NAME}${o}`,expression:`${r}.getBucketName()`})}return t}Qu(ba,"generateStorageEnvVarEntries");function el(e,t){let n={},i={};if(!t.connectedStorage?.length)return{env:n,secrets:i};let r=dn(e,t),o=ba(r);for(let a of o)n[a.key]={__expression:a.expression};return{env:n,secrets:i}}Qu(el,"buildStorageEnvVars");function Ci(e,t,n=[]){let i=e.map(a=>ie(a)),r=t.map(a=>ie(a)),o=n.map(a=>ie(a));return`connections: [${[...i,...r,...o].join(", ")}],`}Qu(Ci,"formatAllConnectionsCode");var cU=Object.defineProperty,qv=(e,t)=>cU(e,"name",{value:t,configurable:!0}),Tr=Object.freeze({URL:"QUEUE_URL",ARN:"QUEUE_ARN"});function mn(e,t){let{connectedMessaging:n}=t;return n?.length?(e.sqs??[]).filter(i=>n.includes(i.name)):[]}qv(mn,"getConnectedMessaging");function ya(e){let t=[];if(e.length===1){let n=e[0];if(!n)return t;let i=ie(n);t.push({key:Tr.URL,expression:`${i}.getQueueUrl()`}),t.push({key:Tr.ARN,expression:`${i}.getQueueArn()`})}else for(let[n,i]of e.entries()){let r=ie(i),o=n===0?"":`_${n+1}`;t.push({key:`${Tr.URL}${o}`,expression:`${r}.getQueueUrl()`}),t.push({key:`${Tr.ARN}${o}`,expression:`${r}.getQueueArn()`})}return t}qv(ya,"generateMessagingEnvVarEntries");function tl(e,t){let n={},i={};if(!t.connectedMessaging?.length)return{env:n,secrets:i};let r=mn(e,t),o=ya(r);for(let a of o)n[a.key]={__expression:a.expression};return{env:n,secrets:i}}qv(tl,"buildMessagingEnvVars");var uU=Object.defineProperty,Ni=(e,t)=>uU(e,"name",{value:t,configurable:!0});function pn(e){return!!(e.needsConnection&&e.connectedDatabase?.length)}Ni(pn,"computeHasDatabaseConnections");function fn(e){return!!e.connectedStorage?.length}Ni(fn,"computeHasStorageConnections");function gn(e){return!!e.connectedMessaging?.length}Ni(gn,"computeHasMessagingConnections");function Sa(e){return pn(e)||fn(e)||gn(e)}Ni(Sa,"computeHasConnections");var _a={ENVIRONMENT:{__expression:"getConfig().environment"}};function wi(e,t){return Object.entries(e).map(([n,i])=>`${t}${n}: ${G(i)},`).join(`
221
+ `}return t}Le(Ju,"generateClickHouseCode");function rT(e,t){return t.compute.some(n=>n.connectedDatabase?.includes(e.name))}Le(rT,"clickhouseNeedsVariable");var cU=Object.defineProperty,Qu=(e,t)=>cU(e,"name",{value:t,configurable:!0}),va=Object.freeze({NAME:"BUCKET_NAME"});function dn(e,t){let{connectedStorage:n}=t;return n?.length?e.s3.filter(i=>n.includes(i.name)):[]}Qu(dn,"getConnectedStorage");function ba(e){let t=[];if(e.length===1){let n=e[0];if(!n)return t;let i=ie(n);t.push({key:va.NAME,expression:`${i}.getBucketName()`})}else for(let[n,i]of e.entries()){let r=ie(i),o=n===0?"":`_${n+1}`;t.push({key:`${va.NAME}${o}`,expression:`${r}.getBucketName()`})}return t}Qu(ba,"generateStorageEnvVarEntries");function el(e,t){let n={},i={};if(!t.connectedStorage?.length)return{env:n,secrets:i};let r=dn(e,t),o=ba(r);for(let a of o)n[a.key]={__expression:a.expression};return{env:n,secrets:i}}Qu(el,"buildStorageEnvVars");function Ci(e,t,n=[]){let i=e.map(a=>ie(a)),r=t.map(a=>ie(a)),o=n.map(a=>ie(a));return`connections: [${[...i,...r,...o].join(", ")}],`}Qu(Ci,"formatAllConnectionsCode");var uU=Object.defineProperty,qv=(e,t)=>uU(e,"name",{value:t,configurable:!0}),Tr=Object.freeze({URL:"QUEUE_URL",ARN:"QUEUE_ARN"});function mn(e,t){let{connectedMessaging:n}=t;return n?.length?(e.sqs??[]).filter(i=>n.includes(i.name)):[]}qv(mn,"getConnectedMessaging");function ya(e){let t=[];if(e.length===1){let n=e[0];if(!n)return t;let i=ie(n);t.push({key:Tr.URL,expression:`${i}.getQueueUrl()`}),t.push({key:Tr.ARN,expression:`${i}.getQueueArn()`})}else for(let[n,i]of e.entries()){let r=ie(i),o=n===0?"":`_${n+1}`;t.push({key:`${Tr.URL}${o}`,expression:`${r}.getQueueUrl()`}),t.push({key:`${Tr.ARN}${o}`,expression:`${r}.getQueueArn()`})}return t}qv(ya,"generateMessagingEnvVarEntries");function tl(e,t){let n={},i={};if(!t.connectedMessaging?.length)return{env:n,secrets:i};let r=mn(e,t),o=ya(r);for(let a of o)n[a.key]={__expression:a.expression};return{env:n,secrets:i}}qv(tl,"buildMessagingEnvVars");var lU=Object.defineProperty,Ni=(e,t)=>lU(e,"name",{value:t,configurable:!0});function pn(e){return!!(e.needsConnection&&e.connectedDatabase?.length)}Ni(pn,"computeHasDatabaseConnections");function fn(e){return!!e.connectedStorage?.length}Ni(fn,"computeHasStorageConnections");function gn(e){return!!e.connectedMessaging?.length}Ni(gn,"computeHasMessagingConnections");function Sa(e){return pn(e)||fn(e)||gn(e)}Ni(Sa,"computeHasConnections");var _a={ENVIRONMENT:{__expression:"getConfig().environment"}};function wi(e,t){return Object.entries(e).map(([n,i])=>`${t}${n}: ${G(i)},`).join(`
222
222
  `)}Ni(wi,"formatEnvBlock");function ki(e,t,n){return e.length<=1?`{ ${e[0]??""} }`:`{${e.map(i=>`
223
223
  ${n}${i},`).join("")}
224
- ${t}}`}Ni(ki,"formatCompactOrExpandedObject");var lU=Object.defineProperty,nT=(e,t)=>lU(e,"name",{value:t,configurable:!0});function Ea(e){let t="";if(e.deployment===na.CODE&&e.codePath?(t+=`
224
+ ${t}}`}Ni(ki,"formatCompactOrExpandedObject");var dU=Object.defineProperty,nT=(e,t)=>dU(e,"name",{value:t,configurable:!0});function Ea(e){let t="";if(e.deployment===na.CODE&&e.codePath?(t+=`
225
225
  deployment: "${na.CODE}",
226
226
  code: Code.fromAsset(${T(e.codePath)}),`,e.handler&&(t+=`
227
227
  handler: ${T(e.handler)},`),e.runtime&&(t+=`
@@ -246,10 +246,10 @@ ${wi(n," ")}
246
246
  environment: {`;for(let[p,g]of Object.entries(u))m+=`
247
247
  ${p}: ${G(g)},`;m+=`
248
248
  },`}return m+=`
249
- ${Ci(o,a,c)}`,m}nT(xa,"generateLambdaConnectionsCode");var dU=Object.defineProperty,mU=(e,t)=>dU(e,"name",{value:t,configurable:!0});function Aa(e){let t="";return e.instanceType&&(t+=`
249
+ ${Ci(o,a,c)}`,m}nT(xa,"generateLambdaConnectionsCode");var mU=Object.defineProperty,pU=(e,t)=>mU(e,"name",{value:t,configurable:!0});function Aa(e){let t="";return e.instanceType&&(t+=`
250
250
  instanceType: ${T(e.instanceType)},`),e.enableSSH!==void 0&&(t+=e.enableSSH?`
251
251
  ssh: {},`:`
252
- ssh: false,`),t+=fe(e.extraProperties),t}mU(Aa,"generateEc2Code");var pU=Object.defineProperty,Dt=(e,t)=>pU(e,"name",{value:t,configurable:!0});function iT(e){let t=[];if(e.instanceType!==void 0&&t.push(`instanceType: ${T(e.instanceType)}`),e.amiHardwareType!==void 0&&t.push(`amiHardwareType: ${T(e.amiHardwareType)}`),e.minCapacity!==void 0&&t.push(`minCapacity: ${e.minCapacity}`),e.maxCapacity!==void 0&&t.push(`maxCapacity: ${e.maxCapacity}`),e.memoryLimitMiB!==void 0&&t.push(`memoryLimitMiB: ${e.memoryLimitMiB}`),e.warmPool!==void 0&&t.push(`warmPool: ${G(e.warmPool," ")}`),e.extraProperties?.length)for(let n of e.extraProperties)t.push(`${n.key}: ${n.sourceText}`);return`
252
+ ssh: false,`),t+=fe(e.extraProperties),t}pU(Aa,"generateEc2Code");var fU=Object.defineProperty,Dt=(e,t)=>fU(e,"name",{value:t,configurable:!0});function iT(e){let t=[];if(e.instanceType!==void 0&&t.push(`instanceType: ${T(e.instanceType)}`),e.amiHardwareType!==void 0&&t.push(`amiHardwareType: ${T(e.amiHardwareType)}`),e.minCapacity!==void 0&&t.push(`minCapacity: ${e.minCapacity}`),e.maxCapacity!==void 0&&t.push(`maxCapacity: ${e.maxCapacity}`),e.memoryLimitMiB!==void 0&&t.push(`memoryLimitMiB: ${e.memoryLimitMiB}`),e.warmPool!==void 0&&t.push(`warmPool: ${G(e.warmPool," ")}`),e.extraProperties?.length)for(let n of e.extraProperties)t.push(`${n.key}: ${n.sourceText}`);return`
253
253
  ec2Config: ${ki(t," "," ")},`}Dt(iT,"generateEcsServiceEc2ConfigCode");function oT(e){if(!e.cluster)return"";let t=[];if(e.cluster.directAccess&&t.push("directAccess: true"),e.cluster.domain&&t.push(`domain: ${T(e.cluster.domain)}`),e.cluster.loadBalancer!==void 0&&t.push(e.cluster.loadBalancer===!1?"loadBalancer: false":`loadBalancer: ${T(e.cluster.loadBalancer)}`),e.cluster.extraProperties?.length)for(let n of e.cluster.extraProperties)t.push(`${n.key}: ${n.sourceText}`);return`
254
254
  cluster: ${ki(t," "," ")},`}Dt(oT,"generateEcsClusterCode");function aT(e,t,n,i,r,o){let a="";e.name&&(a+=`
255
255
  name: ${T(e.name)},`),e.image&&(a+=`
@@ -290,14 +290,14 @@ ${wi(m," ")}
290
290
  ecrRepository: app.getDefaultContainerRegistry(),`;if(c+=oT(e),e.services?.length){c+=`
291
291
  services: [{`;for(let u=0;u<e.services.length;u++){let l=e.services[u];l&&(u>0&&(c+=`
292
292
  }, {`),c+=lT({service:l,isFirstService:u===0,hasConnections:n,dbEnvVars:r,storageEnvVars:o,messagingEnvVars:a,baseEnvVars:i,plan:t,compute:e}))}c+=`
293
- }],`}return c+=fe(e.extraProperties),c+=un(),c}Dt(Ia,"generateEcsCode");var fU=Object.defineProperty,gU=(e,t)=>fU(e,"name",{value:t,configurable:!0});function rl(e,t){if(e.compute.length===0)return"";let n="";for(let i=0;i<e.compute.length;i++){let r=e.compute[i],o=t.has(r.name)||r.scheduleExpression!==void 0,a=ie(r),c=e.database.length>0||e.s3.length>0||i>0,u=o?`const ${a} = `:"";switch(n+=`${c?`
293
+ }],`}return c+=fe(e.extraProperties),c+=un(),c}Dt(Ia,"generateEcsCode");var gU=Object.defineProperty,hU=(e,t)=>gU(e,"name",{value:t,configurable:!0});function rl(e,t){if(e.compute.length===0)return"";let n="";for(let i=0;i<e.compute.length;i++){let r=e.compute[i],o=t.has(r.name)||r.scheduleExpression!==void 0,a=ie(r),c=e.database.length>0||e.s3.length>0||i>0,u=o?`const ${a} = `:"";switch(n+=`${c?`
294
294
  `:""}${u}app.addCompute(
295
295
  ComputeFactory.build(${T(r.name)}, {
296
296
  type: ${T(r.type)},`,r.type){case"lambda":n+=Ea(r),n+=xa(r,e);break;case"ec2":n+=Aa(r);break;case"ecs":n+=Ia(r,e);break;default:{let l=r.type;throw new Error(`Unhandled compute type: ${String(l)}`)}}n+=`
297
297
  })
298
298
  );
299
299
  `,r.scheduleExpression!==void 0&&(n+=`app.addSchedule(${T(`${r.name}Schedule`)}, { schedule: ${T(r.scheduleExpression)}, target: ${a} });
300
- `)}return n}gU(rl,"generateComputeCode");var hU=Object.defineProperty,Oi=(e,t)=>hU(e,"name",{value:t,configurable:!0});function dT(e){let t="";return t+=O(e.bucketName!==void 0,"bucketName",e.bucketName,"string"),t+=O(e.stackPlacement!==void 0&&e.stackPlacement!=="storage","stackPlacement",e.stackPlacement,"string"),t+=O(e.publicReadAccess===!0,"publicReadAccess",!0),t+=O(e.websiteHosting!==void 0,"websiteHosting",e.websiteHosting,"object"),t+=O(e.backupVaultTier!==void 0,"backupVaultTier",e.backupVaultTier,"string"),t+=O(e.versioned!==void 0,"versioned",e.versioned),t+=O(e.encryption!==void 0,"encryption",e.encryption,"string"),t+=O(e.kmsKeyArn!==void 0,"kmsKeyArn",e.kmsKeyArn,"string"),t+=O(e.cors!==void 0&&e.cors.length>0,"cors",e.cors,"object"),t+=O(e.deployment!==void 0,"deployment",e.deployment,"object"),t+=O(e.retain===!0,"retain",!0),t}Oi(dT,"generateS3BucketProps");function Yv(e,t){return!!(t.compute.some(n=>n.connectedStorage?.includes(e.name))||t.cdn&&(t.cdn.defaultOriginRef===e.name||t.cdn.behaviours?.some(n=>n.originRef===e.name)))}Oi(Yv,"s3NeedsVariable");function nl(e){if(e.s3.length===0)return"";let t="";for(let n=0;n<e.s3.length;n++){let i=e.s3[n],r=ie(i),o=Yv(i,e),a=e.database.length>0||n>0?`
300
+ `)}return n}hU(rl,"generateComputeCode");var vU=Object.defineProperty,Oi=(e,t)=>vU(e,"name",{value:t,configurable:!0});function dT(e){let t="";return t+=O(e.bucketName!==void 0,"bucketName",e.bucketName,"string"),t+=O(e.stackPlacement!==void 0&&e.stackPlacement!=="storage","stackPlacement",e.stackPlacement,"string"),t+=O(e.publicReadAccess===!0,"publicReadAccess",!0),t+=O(e.websiteHosting!==void 0,"websiteHosting",e.websiteHosting,"object"),t+=O(e.backupVaultTier!==void 0,"backupVaultTier",e.backupVaultTier,"string"),t+=O(e.versioned!==void 0,"versioned",e.versioned),t+=O(e.encryption!==void 0,"encryption",e.encryption,"string"),t+=O(e.kmsKeyArn!==void 0,"kmsKeyArn",e.kmsKeyArn,"string"),t+=O(e.cors!==void 0&&e.cors.length>0,"cors",e.cors,"object"),t+=O(e.deployment!==void 0,"deployment",e.deployment,"object"),t+=O(e.retain===!0,"retain",!0),t}Oi(dT,"generateS3BucketProps");function Yv(e,t){return!!(t.compute.some(n=>n.connectedStorage?.includes(e.name))||t.cdn&&(t.cdn.defaultOriginRef===e.name||t.cdn.behaviours?.some(n=>n.originRef===e.name)))}Oi(Yv,"s3NeedsVariable");function nl(e){if(e.s3.length===0)return"";let t="";for(let n=0;n<e.s3.length;n++){let i=e.s3[n],r=ie(i),o=Yv(i,e),a=e.database.length>0||n>0?`
301
301
  `:"",c=dT(i),u=o?`const ${r} = `:"",l=fe(i.extraProperties);c||l?t+=`${a}${u}app.addStorage(
302
302
  StorageFactory.build(${T(i.name)}, {${c}${l}
303
303
  })
@@ -346,7 +346,7 @@ ${r}app.addMessaging(
346
346
  removalPolicy: ${T(n.removalPolicy)}`),t+=",",t+=fe(n.extraProperties),t+=un(),t+=`
347
347
  })
348
348
  );
349
- `}return t}Oi(ol,"generateSQSCode");var vU=Object.defineProperty,lt=(e,t)=>vU(e,"name",{value:t,configurable:!0}),jt=Object.freeze({database:{type:"Instance",backupRetention:7,deletionProtection:!0},compute:{server:{memorySize:1536,timeout:30},imageOptimisation:{memorySize:1536,timeout:30},revalidation:{memorySize:768,timeout:300}}});function hn(e,t,n){return t===void 0?"":`
349
+ `}return t}Oi(ol,"generateSQSCode");var bU=Object.defineProperty,lt=(e,t)=>bU(e,"name",{value:t,configurable:!0}),jt=Object.freeze({database:{type:"Instance",backupRetention:7,deletionProtection:!0},compute:{server:{memorySize:1536,timeout:30},imageOptimisation:{memorySize:1536,timeout:30},revalidation:{memorySize:768,timeout:300}}});function hn(e,t,n){return t===void 0?"":`
350
350
  ${n}${e}: ${t},`}lt(hn,"emitScalar");function Mt(e,t,n){return t===void 0?"":`
351
351
  ${n}${e}: ${JSON.stringify(t)},`}lt(Mt,"emitStringField");function $a(e,t,n){return t===void 0?"":t===!1?`
352
352
  ${n}${e}: false,`:`
@@ -379,11 +379,11 @@ ${t}domain: ${JSON.stringify(e.domain)},`),n+=ut("forms",e.forms,t),n+=ut("cdn",
379
379
  })
380
380
  );
381
381
 
382
- `,n}lt(Ta,"generatePatternCodeWithComments");var bU=Object.defineProperty,tr=(e,t)=>bU(e,"name",{value:t,configurable:!0}),Ra="fjall:costAllocation:owner",yU="engineering";function yT(e){return typeof e=="object"&&e!==null&&Object.keys(e).length===0}tr(yT,"isEmptyObject");function Jv(e){let t={...e};return yT(t.flowLogs)&&delete t.flowLogs,t}tr(Jv,"cleanNetworkConfig");function Pa(e){if(!e.additionalNetworks||e.additionalNetworks.length===0)return"";let t="";for(let n of e.additionalNetworks){let i=er(n.name),r={};n.maxAzs!==void 0&&(r.maxAzs=n.maxAzs),n.natGateways!==void 0&&(r.natGateways=n.natGateways),n.flowLogs!==void 0&&(r.flowLogs=n.flowLogs),n.vpcEndpoints!==void 0&&(r.vpcEndpoints=n.vpcEndpoints);let o=Jv(r);t+=`const ${i} = app.addNetwork(
382
+ `,n}lt(Ta,"generatePatternCodeWithComments");var yU=Object.defineProperty,tr=(e,t)=>yU(e,"name",{value:t,configurable:!0}),Ra="fjall:costAllocation:owner",SU="engineering";function yT(e){return typeof e=="object"&&e!==null&&Object.keys(e).length===0}tr(yT,"isEmptyObject");function Jv(e){let t={...e};return yT(t.flowLogs)&&delete t.flowLogs,t}tr(Jv,"cleanNetworkConfig");function Pa(e){if(!e.additionalNetworks||e.additionalNetworks.length===0)return"";let t="";for(let n of e.additionalNetworks){let i=er(n.name),r={};n.maxAzs!==void 0&&(r.maxAzs=n.maxAzs),n.natGateways!==void 0&&(r.natGateways=n.natGateways),n.flowLogs!==void 0&&(r.flowLogs=n.flowLogs),n.vpcEndpoints!==void 0&&(r.vpcEndpoints=n.vpcEndpoints);let o=Jv(r);t+=`const ${i} = app.addNetwork(
383
383
  NetworkFactory.build("${n.name}", ${G(o," ")})
384
384
  );
385
385
 
386
- `}return t}tr(Pa,"generateNetworkCode");function al(e){let t={};return e.tags&&Object.keys(e.tags).length>0&&Object.assign(t,e.tags),t[Ra]||(t[Ra]=e.owner||yU),`app.addTags({
386
+ `}return t}tr(Pa,"generateNetworkCode");function al(e){let t={};return e.tags&&Object.keys(e.tags).length>0&&Object.assign(t,e.tags),t[Ra]||(t[Ra]=e.owner||SU),`app.addTags({
387
387
  ${Object.entries(t).map(([n,i])=>` "${n}": "${i}"`).join(`,
388
388
  `)}
389
389
  });
@@ -425,10 +425,10 @@ app.addCdn(
425
425
  accessGate: ${G(e.cdn.accessGate," ")}`),n+=fe(e.cdn.extraProperties),n+=`
426
426
  })
427
427
  );
428
- `,n}tr(ul,"generateCDNCode");function ll(e){let t=new Set;if(e.cdn&&(e.cdn.defaultOriginRef&&t.add(e.cdn.defaultOriginRef),e.cdn.behaviours))for(let n of e.cdn.behaviours)t.add(n.originRef);return t}tr(ll,"collectCdnReferencedResources");function dl(e){return e.patternConfig!==void 0}tr(dl,"usesPatternApproach");var SU=Object.defineProperty,vn=(e,t)=>SU(e,"name",{value:t,configurable:!0}),Ca="service",Qv="0 4 * * ? *",eb="0 5 * * ? *",rr=Object.freeze({tinkerer:{displayName:"Tinkerer",description:"Free tier eligible, minimal cost for experimentation",database:{Instance:{instanceType:"t4g.micro",multiAz:!1,proxy:!1,readReplica:!1,publiclyAccessible:!0},Aurora:null,GlobalAurora:null,ClickHouse:null},compute:{ecs:{services:[{name:Ca,capacityProvider:"EC2",desiredCount:1,minCapacity:1,maxCapacity:1,ec2Config:{instanceType:"t4g.micro",amiHardwareType:"ARM",minCapacity:1,maxCapacity:1,memoryLimitMiB:400}}],cluster:{directAccess:!0}},lambda:{timeout:30,memory:128}},network:{maxAzs:2,natGateways:!1,flowLogs:!1},backup:!1},lightweight:{displayName:"Lightweight",description:"Streamlined single-AZ deployment for cost efficiency",database:{Instance:{instanceType:"t4g.small",multiAz:!1},Aurora:{readers:!1},GlobalAurora:null,ClickHouse:null},compute:{ecs:{services:[{name:Ca,capacityProvider:"FARGATE_SPOT",cpu:256,memoryLimitMiB:512,desiredCount:1,minCapacity:1,maxCapacity:3}]},lambda:{timeout:30,memory:256}},network:{maxAzs:2,natGateways:{count:1},flowLogs:!1},backup:!1},standard:{displayName:"Standard",description:"Production-ready with sensible defaults",database:{Instance:{instanceType:"t4g.large"},Aurora:{readers:{count:1}},GlobalAurora:{readers:{count:1}},ClickHouse:{instanceType:"t4g.medium",coldTier:{mode:"s3"},optimiseSchedule:Qv,backupSchedule:eb,backupRetentionDays:14}},compute:{ecs:{services:[{name:Ca,capacityProvider:"FARGATE",cpu:512,memoryLimitMiB:1024,desiredCount:2,minCapacity:2,maxCapacity:5}]},lambda:{timeout:60,memory:256}},network:{maxAzs:3,natGateways:{count:1},flowLogs:{},vpcEndpoints:{interface:{ecr:!0}}},backup:!1},resilient:{displayName:"Resilient",description:"High availability with enhanced monitoring and scaling",database:{Instance:{instanceType:"r7g.large",encryption:{storageKey:{useCMK:!0}},databaseInsights:{mode:"advanced",encryptionKey:{useCMK:!0}},proxy:{requireTLS:!0}},Aurora:{readers:{count:2},encryption:{storageKey:{useCMK:!0}},databaseInsights:{mode:"advanced",encryptionKey:{useCMK:!0}},proxy:{requireTLS:!0},backupRetention:30},GlobalAurora:{readers:{count:2},encryption:{storageKey:{useCMK:!0}},databaseInsights:{mode:"advanced",encryptionKey:{useCMK:!0}},proxy:{requireTLS:!0},backupRetention:30,enableGlobalWriteForwarding:!0},ClickHouse:{instanceType:"m6g.large",coldTier:{mode:"s3"},optimiseSchedule:Qv,backupSchedule:eb,backupRetentionDays:14}},compute:{ecs:{services:[{name:Ca,capacityProvider:"FARGATE",cpu:1024,memoryLimitMiB:2048,desiredCount:4,minCapacity:4,maxCapacity:20}]},lambda:{timeout:120,memory:512}},network:{maxAzs:3,natGateways:{count:3},flowLogs:{retentionDays:90},vpcEndpoints:{interface:{ecr:!0,secretsManager:!0}}},backup:{tier:"resilient"}},enterprise:{displayName:"Enterprise",description:"Maximum capability with all features enabled",database:{Instance:{instanceType:"r7g.xlarge",encryption:{storageKey:{useCMK:!0}},databaseInsights:{mode:"advanced",encryptionKey:{useCMK:!0}},proxy:{requireTLS:!0},readReplica:{}},Aurora:{readers:{count:2},encryption:{storageKey:{useCMK:!0}},databaseInsights:{mode:"advanced",encryptionKey:{useCMK:!0}},proxy:{requireTLS:!0},backupRetention:35},GlobalAurora:{readers:{count:2},encryption:{storageKey:{useCMK:!0}},databaseInsights:{mode:"advanced",encryptionKey:{useCMK:!0}},proxy:{requireTLS:!0},backupRetention:35,enableGlobalWriteForwarding:!0},ClickHouse:{instanceType:"m6g.xlarge",coldTier:{mode:"s3"},optimiseSchedule:Qv,backupSchedule:eb,backupRetentionDays:30}},compute:{ecs:{services:[{name:Ca,capacityProvider:"FARGATE",cpu:2048,memoryLimitMiB:4096,desiredCount:6,minCapacity:6,maxCapacity:100}]},lambda:{timeout:300,memory:1024}},network:{maxAzs:3,natGateways:{count:3},flowLogs:{destination:"s3",retentionDays:365},vpcEndpoints:{interface:{ecr:!0,secretsManager:!0,kms:!0,cloudwatchLogs:!0}}},backup:{tier:"enterprise"}}});function _U(e,t){return rr[e].database[t]}vn(_U,"getDatabasePreset");function EU(e){return rr[e].compute.ecs}vn(EU,"getEcsPreset");function tb(e){return rr[e].network}vn(tb,"getNetworkPreset");function ST(e){return Au.filter(t=>rr[t].database[e]!==null)}vn(ST,"getAvailableTiersForDatabase");function xU(e){return ST(e).map(t=>({label:rr[t].displayName,value:t,description:rr[t].description}))}vn(xU,"getTierOptionsForDatabase");function rb(e){switch(e){case"tinkerer":case"lightweight":case"standard":return"Instance";case"resilient":case"enterprise":return"Aurora"}}vn(rb,"getDefaultDatabaseTypeForTier");function nb(e,t){let n=rr[e].compute.ecs,i=n.services[0],r=!n.cluster?.directAccess&&n.cluster?.loadBalancer!==!1,o=t.filter(c=>c.serviceType!=="worker").length,a=t.findIndex(c=>c.serviceType!=="worker");return t.map((c,u)=>{let l=u===a,m=c.serviceType==="worker",p;return r&&!m&&(c.routing?p=c.routing:o>1&&(p={path:l?"/*":`/${c.name.toLowerCase()}/*`,...l?{}:{priority:100+u}})),{name:c.name,capacityProvider:i.capacityProvider,ec2Config:i.ec2Config,cpu:i.cpu,memoryLimitMiB:i.memoryLimitMiB,desiredCount:i.desiredCount,minCapacity:i.minCapacity,maxCapacity:i.maxCapacity,routing:p}})}vn(nb,"applyTierDefaultsToServices");var AU=Object.defineProperty,ib=(e,t)=>AU(e,"name",{value:t,configurable:!0}),Na=["lightweight","standard","resilient"],IU=[...Na,"custom"],Rr=Object.freeze({lightweight:{displayName:"Lightweight",description:"Cost-effective \xB7 Instance DB, minimal Lambda",database:{type:"Instance",instanceType:"t4g.small",backupRetention:7,deletionProtection:!1},compute:{memorySize:512,timeout:30},network:{maxAzs:2,natGateways:{count:1},flowLogs:!1},backup:!1},standard:{displayName:"Standard",description:"Production-ready \xB7 Instance DB, balanced Lambda",database:{type:"Instance",instanceType:"t4g.large",backupRetention:14,deletionProtection:!0},compute:{memorySize:1536,timeout:60},network:{maxAzs:3,natGateways:{count:1},flowLogs:{}},backup:{tier:"standard"}},resilient:{displayName:"Resilient",description:"High-availability \xB7 Aurora V2, KMS encryption",database:{type:"Aurora",backupRetention:30,deletionProtection:!0,encryption:{useCMK:!0}},compute:{memorySize:2048,timeout:120},network:{maxAzs:3,natGateways:{count:3},flowLogs:{retentionDays:90}},backup:{tier:"resilient"}}});function ml(e){return Rr[e]}ib(ml,"getPatternTierPreset");function _T(){return[{label:Rr.standard.displayName,value:"standard",description:Rr.standard.description},{label:Rr.lightweight.displayName,value:"lightweight",description:Rr.lightweight.description},{label:Rr.resilient.displayName,value:"resilient",description:Rr.resilient.description},{label:"Custom",value:"custom",description:"Full control \xB7 Configure everything"}]}ib(_T,"getPatternTierOptions");var $U=new Set(Na);function pl(e){return $U.has(e)}ib(pl,"isPatternTierName");var TU=Object.defineProperty,ET=(e,t)=>TU(e,"name",{value:t,configurable:!0}),fl=Object.freeze({standard:{},assets:{versioned:!0,deployment:{source:"./assets"}},upload:{versioned:!0,cors:[{allowedOrigins:["*"],allowedMethods:["GET","PUT","POST"]}]},website:{publicReadAccess:!0,websiteHosting:{indexDocument:"index.html",errorDocument:"error.html"}}});function xT(e){return{...fl[e]}}ET(xT,"getStoragePreset");function AT(){return[{label:"Standard",value:"standard"},{label:"Assets",value:"assets"},{label:"Upload",value:"upload"},{label:"Website Hosting",value:"website"}]}ET(AT,"getStoragePresetOptions");import*as ge from"typescript";import*as D from"typescript";var RU=Object.defineProperty,Di=(e,t)=>RU(e,"name",{value:t,configurable:!0});function B(e){let t={};for(let n of e.properties){if(!D.isPropertyAssignment(n))continue;let i=D.isIdentifier(n.name)||D.isStringLiteral(n.name)?n.name.text:void 0;i!==void 0&&(t[i]=Pr(n.initializer))}return t}Di(B,"parseObjectLiteral");function Pr(e){if(D.isStringLiteral(e))return e.text;if(D.isNumericLiteral(e))return Number(e.text);if(e.kind===D.SyntaxKind.TrueKeyword)return!0;if(e.kind===D.SyntaxKind.FalseKeyword)return!1;if(D.isArrayLiteralExpression(e))return e.elements.map(t=>Pr(t));if(D.isObjectLiteralExpression(e))return B(e);if(D.isIdentifier(e))return{__identifier:e.text};if(D.isPropertyAccessExpression(e))return{__expression:e.getText()};if(D.isCallExpression(e))return{__call:e.getText()};if(D.isBinaryExpression(e)&&e.operatorToken.kind===D.SyntaxKind.BarBarToken){let t=Pr(e.left),n=Pr(e.right);return typeof n=="string"?n:t}else if(D.isConditionalExpression(e)){let t=Pr(e.whenTrue),n=Pr(e.whenFalse);return typeof n=="string"||typeof n=="number"?n:t}else if(D.isTemplateExpression(e)||D.isNoSubstitutionTemplateLiteral(e))return{__expression:e.getText()};return{__unknown:e.getText()}}Di(Pr,"evaluateExpression");function wa(e,t){return et(e,n=>{if(D.isVariableStatement(n)){for(let i of n.declarationList.declarations)if(D.isIdentifier(i.name)&&i.name.text===t&&i.initializer){if(D.isStringLiteral(i.initializer))return i.initializer.text;if(D.isObjectLiteralExpression(i.initializer)){let r=B(i.initializer);return JSON.stringify(r)}}}})}Di(wa,"findVariableValue");function ob(e,t){return et(e,n=>{if(D.isVariableStatement(n)){for(let i of n.declarationList.declarations)if(D.isIdentifier(i.name)&&i.name.text===t&&i.initializer&&D.isObjectLiteralExpression(i.initializer))return B(i.initializer)}})}Di(ob,"findObjectDeclaration");function ka(e,t){if(!D.isIdentifier(t.expression))return;let n=ob(e,t.expression.text),i=t.name.text;if(n&&n[i]!==void 0)return String(n[i])}Di(ka,"evaluatePropertyAccess");function gl(e,t){let n=t.head.text;for(let i of t.templateSpans){if(D.isIdentifier(i.expression)){let r=wa(e,i.expression.text);if(r)n+=r;else return t.getText(e).replace(/^`|`$/g,"")}else if(D.isPropertyAccessExpression(i.expression)){let r=ka(e,i.expression);if(r)n+=r;else return t.getText(e).replace(/^`|`$/g,"")}else return t.getText(e).replace(/^`|`$/g,"");n+=i.literal.text}return n}Di(gl,"resolveTemplateLiteral");var PU=Object.defineProperty,J=(e,t)=>PU(e,"name",{value:t,configurable:!0});function dt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}J(dt,"isPlainObject");function nr(e){return dt(e)&&"__identifier"in e}J(nr,"isIdentifierRef");function Cr(e){return dt(e)&&"__expression"in e}J(Cr,"isExpressionRef");function xt(e){return dt(e)&&"__call"in e}J(xt,"isCallRef");function P(e){return dt(e)&&!("__identifier"in e)&&!("__expression"in e)&&!("__call"in e)&&!("__unknown"in e)}J(P,"isParsedObject");function b(e){return typeof e=="string"?e:void 0}J(b,"asString");function R(e){return typeof e=="number"?e:void 0}J(R,"asNumber");function j(e){return typeof e=="boolean"?e:void 0}J(j,"asBoolean");function ue(e){if(!Array.isArray(e))return;let t=[];for(let n of e)typeof n=="string"&&t.push(n);return t.length>0?t:void 0}J(ue,"asStringArray");function U(e,t){let n=b(e);if(n!==void 0)return ct(t,n)?n:void 0}J(U,"asStringUnion");function qe(e){let t={};for(let[n,i]of Object.entries(e))i!==void 0&&(t[n]=i);return t}J(qe,"omitUndefined");function hl(e){if(e===null)return"null";if(e===void 0)return"undefined";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(hl).join(", ")}]`;if(!dt(e))return String(e);if(nr(e))return e.__identifier;if(Cr(e))return e.__expression;if(xt(e))return e.__call;if("__unknown"in e&&typeof e.__unknown=="string")return e.__unknown;let t=Object.entries(e);return t.length===0?"{}":`{ ${t.map(([n,i])=>`${n}: ${hl(i)}`).join(", ")} }`}J(hl,"parsedValueToSourceText");function ce(e,t){let n=[];for(let[i,r]of Object.entries(e))t.has(i)||r===void 0||n.push({key:i,sourceText:hl(r)});return n}J(ce,"captureExtraProperties");function Nr(e,t){return ge.isPropertyAssignment(e)&&ge.isIdentifier(e.name)&&e.name.text===t}J(Nr,"isNamedProperty");function zt(e){return ge.isCallExpression(e)&&ge.isPropertyAccessExpression(e.expression)&&e.expression.name.text==="getApp"&&ge.isIdentifier(e.expression.expression)&&e.expression.expression.text==="App"}J(zt,"isAppGetAppCall");function xe(e,t){let{expression:n}=e;return ge.isPropertyAccessExpression(n)&&n.name.text===t&&e.arguments.length>0}J(xe,"isFactoryMethodCall");function et(e,t){let n,i=J(r=>{n===void 0&&(n=t(r),n===void 0&&ge.forEachChild(r,i))},"visit");return i(e),n}J(et,"findFirstInAst");function Pe(e,t){let n=[],i=J(r=>{let o=t(r);o!==null&&n.push(o),ge.forEachChild(r,i)},"visit");return i(e),n}J(Pe,"collectFromAst");function Ue(e,t){return ge.isCallExpression(e)&&ge.isPropertyAccessExpression(e.expression)&&e.expression.name.text==="build"&&ge.isIdentifier(e.expression.expression)&&e.expression.expression.text===t}J(Ue,"isFactoryBuildCall");function tt(e){let t=e.parent;if(ge.isVariableDeclaration(t)&&ge.isIdentifier(t.name))return t.name.text}J(tt,"extractVariableName");var mt=J(()=>e=>e,"typed");function Mi(e){if(e!=null){if(e===!1)return!1;if(typeof e=="object"&&!Array.isArray(e))return e}}J(Mi,"asObjectOrFalse");function ir(e,t){return e===!1?!1:P(e)?t(e):void 0}J(ir,"parseBooleanOrConfig");function Ce(e,t){return P(e)?t(e):void 0}J(Ce,"parseOptionalConfig");function pt(e,t,n){let i=e[t];return P(i)?n(i):void 0}J(pt,"extractSubConfig");import*as W from"typescript";import*as ji from"typescript";var CU=Object.defineProperty,rt=(e,t)=>CU(e,"name",{value:t,configurable:!0});function Oa(e){return e!==void 0&&dt(e)}rt(Oa,"isEnvironmentRecord");function IT(e){if(!P(e))return;let t={};for(let[n,i]of Object.entries(e))if(P(i)){let r=b(i.id),o=b(i.name);r&&o&&(t[n]={id:r,name:o,field:b(i.field)})}return Object.keys(t).length>0?t:void 0}rt(IT,"parseContainerSecretsImport");function $T(e){if(!P(e))return;let t=ue(e.command);if(!(!t||t.length===0))return{command:t,interval:R(e.interval),timeout:R(e.timeout),retries:R(e.retries),startPeriod:R(e.startPeriod)}}rt($T,"parseContainerHealthCheck");function TT(e){let t=ce(e,new Set(["name","image","port","environment","essential","command","entryPoint","secretsImport","secrets","healthCheck"]));return{name:b(e.name),image:b(e.image),port:R(e.port),environment:Oa(e.environment)?e.environment:void 0,essential:j(e.essential),command:ue(e.command),entryPoint:ue(e.entryPoint),secretsImport:IT(e.secretsImport),ssmSecrets:ue(e.secrets),healthCheck:$T(e.healthCheck),extraProperties:t.length>0?t:void 0}}rt(TT,"parseServiceContainer");function RT(e){if(Array.isArray(e))return e.filter(P).map(t=>({path:b(t.path),host:b(t.host),priority:R(t.priority),healthCheckPath:b(t.healthCheckPath)}));if(P(e))return{path:b(e.path),host:b(e.host),priority:R(e.priority),healthCheckPath:b(e.healthCheckPath)}}rt(RT,"parseServiceRouting");function PT(e){if(e===!1)return!1;if(P(e))return{minCapacity:R(e.minCapacity),maxCapacity:R(e.maxCapacity),desiredCount:R(e.desiredCount),scalingType:U(e.scalingType,Ru)}}rt(PT,"parseServiceScaling");var NU=new Set(["instanceType","amiHardwareType","minCapacity","maxCapacity","memoryLimitMiB","warmPool"]);function CT(e){if(!P(e))return;let t=e.warmPool,n=P(t)?{minSize:R(t.minSize),reuseOnScaleIn:j(t.reuseOnScaleIn)}:void 0,i=ce(e,NU);return{instanceType:b(e.instanceType),amiHardwareType:U(e.amiHardwareType,Pu),minCapacity:R(e.minCapacity),maxCapacity:R(e.maxCapacity),memoryLimitMiB:R(e.memoryLimitMiB),warmPool:n,extraProperties:i.length>0?i:void 0}}rt(CT,"parseServiceEc2Config");var wU=new Set(["domain","loadBalancer","directAccess"]);function ab(e){if(!P(e))return;let t=e.loadBalancer,n=ce(e,wU);return{domain:b(e.domain),loadBalancer:t===!1?!1:U(t,Tu),directAccess:j(e.directAccess),...n.length>0&&{extraProperties:n}}}rt(ab,"extractClusterConfig");function sb(e){let t=e.containers,n=Array.isArray(t)?t.filter(P).map(TT):void 0,i=ce(e,new Set(["name","image","docker","ssmSecretsPath","containers","routing","connections","cpu","memoryLimitMiB","desiredCount","scaling","capacityProvider","ec2Config"]));return{name:b(e.name)??"",image:b(e.image),docker:NT(e.docker),ssmSecretsPath:b(e.ssmSecretsPath),containers:n,routing:RT(e.routing),cpu:R(e.cpu),memoryLimitMiB:R(e.memoryLimitMiB),desiredCount:R(e.desiredCount),scaling:PT(e.scaling),capacityProvider:U(e.capacityProvider,_i)??"FARGATE",ec2Config:CT(e.ec2Config),...i.length>0&&{extraProperties:i}}}rt(sb,"parseEcsService");function NT(e){if(!P(e))return;let t=b(e.path);if(t===void 0)return;let n=b(e.context),i=b(e.target);return{path:t,...n!==void 0&&{context:n},...i!==void 0&&{target:i}}}rt(NT,"parseServiceDocker");function Da(e,t){let n=b(e);if(n)return n;if(Cr(e)&&e.__expression.startsWith(t+"."))return e.__expression.slice(t.length+1)}rt(Da,"extractEnumString");function cb(e){return xt(e)?e.__call.match(/\(\s*"([^"]+)"\s*\)/)?.[1]:void 0}rt(cb,"extractCallStringArg");function Ne(e,t,n){n!==void 0&&(e[t]=n)}rt(Ne,"assignIfDefined");var kU=Object.defineProperty,vl=(e,t)=>kU(e,"name",{value:t,configurable:!0}),OU=10;function ub(e,t){return Array.isArray(e)?e.filter(nr).map(n=>t.find(i=>i.variableName===n.__identifier)).filter(n=>n!==void 0).map(n=>n.resourceName):[]}vl(ub,"resolveConnectedDatabaseNames");function lb(e,t){return Array.isArray(e)?e.filter(nr).map(n=>t.find(i=>i.variableName===n.__identifier)).filter(n=>n!==void 0).map(n=>n.resourceName):[]}vl(lb,"resolveConnectedStorageNames");function db(e,t,n){if(!Array.isArray(t)||t.length===0)return;let i=t[0];if(!P(i))return;let r=i.containers;if(!Array.isArray(r)||r.length===0)return;let o=r[0];if(!P(o)||!P(o.environment))return;let a=o.environment;(a.DATABASE_HOST||a.DATABASE_PORT||a.DATABASE_NAME)&&(e.needsConnection=!0,n.length>0&&(e.connectedDatabase??[]).length===0&&(e.connectedDatabase=[n[0].name]));for(let c=1;c<=OU;c++)(a[`DATABASE_HOST_${c}`]||a[`DATABASE_PORT_${c}`]||a[`DATABASE_NAME_${c}`])&&(e.needsConnection=!0)}vl(db,"inferDatabaseConnectionsFromEnv");function mb(e,t,n){if(!Array.isArray(t)||t.length===0)return;let i=t[0];if(!P(i))return;let r=i.containers;if(!Array.isArray(r)||r.length===0)return;let o=r[0];!P(o)||!P(o.environment)||o.environment.BUCKET_NAME&&n.length>0&&(e.connectedStorage??[]).length===0&&(e.connectedStorage=[n[0].name])}vl(mb,"inferStorageConnectionsFromEnv");var DU=Object.defineProperty,or=(e,t)=>DU(e,"name",{value:t,configurable:!0});function wT(e){if(e.arguments.length<2)return null;let t=e.arguments[0],n=e.arguments[1];if(!ji.isStringLiteral(t)||!ji.isObjectLiteralExpression(n))return null;let i=t.text,r=B(n);return{resourceName:i,type:b(r.type)??"ecs",config:r,node:e}}or(wT,"extractComputeResource");function bl(e){return Pe(e,t=>{if(!ji.isCallExpression(t)||!xe(t,"addCompute"))return null;let n=t.arguments[0];if(!Ue(n,"ComputeFactory"))return null;let i=wT(n);if(i){let r=tt(t);r&&(i.variableName=r)}return i})}or(bl,"findComputeResources");function yl(e,t,n){let i=ce(e.config,n);i.length>0&&(t.extraProperties=i)}or(yl,"applyExtras");function kT(e,t){let n=e.config.docker;if(P(n)){let o=b(n.path),a=b(n.context),c=b(n.target);(o!==void 0||a!==void 0||c!==void 0)&&(t.docker={...o!==void 0&&{path:o},...a!==void 0&&{context:a},...c!==void 0&&{target:c}})}let i=e.config.cluster;i!==void 0&&(t.cluster=ab(i));let r=e.config.services;r!==void 0&&Array.isArray(r)&&(t.services=r.filter(o=>P(o)).map(sb)),yl(e,t,new Set(["type","ecrRepository","docker","cluster","services","connections"]))}or(kT,"convertEcsCompute");function OT(e,t){if(Ne(t,"deployment",U(e.config.deployment,Iu)),Ne(t,"timeout",R(e.config.timeout)),Ne(t,"memory",R(e.config.memorySize)??R(e.config.memory)),Ne(t,"handler",b(e.config.handler)),Ne(t,"runtime",Da(e.config.runtime,"Runtime")),Oa(e.config.environment)&&(t.environment=e.config.environment),Oa(e.config.secrets))t.secrets=e.config.secrets;else{let r=ue(e.config.secrets);r&&(t.ssmSecrets=r)}let n=e.config.functionUrl;if(P(n)){let r=U(Da(n.authType,"FunctionUrlAuthType"),ia);r!==void 0&&(t.functionUrl={authType:r})}let i=e.config.code;if(i!==void 0){let r=cb(i);r&&(t.codePath=r)}Ne(t,"description",b(e.config.lambdaDescription)),Ne(t,"architecture",U(Da(e.config.architecture,"Architecture"),$u)),Ne(t,"ephemeralStorageSize",R(e.config.ephemeralStorageSize)),Ne(t,"functionName",b(e.config.functionName)),Ne(t,"ssmSecretsPath",b(e.config.ssmSecretsPath)),yl(e,t,new Set(["type","deployment","timeout","memorySize","memory","handler","runtime","environment","secrets","functionUrl","code","connections","ecrRepository","containerSecretsImport","lambdaDescription","architecture","ephemeralStorageSize","functionName","ssmSecretsPath"]))}or(OT,"convertLambdaCompute");function DT(e,t){Ne(t,"instanceType",U(e.config.instanceType,Cu));let n=e.config.ssh;n===!1?t.enableSSH=!1:n!==void 0&&P(n)?t.enableSSH=!0:Ne(t,"enableSSH",j(e.config.enableSSH)),Ne(t,"keyName",b(e.config.keyName)),Ne(t,"userData",b(e.config.userData)),e.config.securityGroups!==void 0&&(t.securityGroups=ue(e.config.securityGroups)),yl(e,t,new Set(["type","instanceType","ssh","enableSSH","keyName","userData","securityGroups","connections"]))}or(DT,"convertEc2Compute");function MT(e,t,n,i){let r=t.config.connections;if(!r&&Array.isArray(t.config.services)){let c=t.config.services[0];P(c)&&(r=c.connections)}if(!r)return;let o=ub(r,n);o.length>0&&(e.needsConnection=!0,e.connectedDatabase=o);let a=lb(r,i);a.length>0&&(e.connectedStorage=a)}or(MT,"applyConnectionConfig");function jT(e,t){({ecs:kT,lambda:OT,ec2:DT})[e.type]?.(t,e)}or(jT,"applyTypeSpecificConfig");function pb(e,t,n,i){return e.map(r=>{let o=U(r.config.type,ra)??"ecs",a={name:r.resourceName,type:o,needsConnection:!1,connectedDatabase:[],...r.variableName&&{variableName:r.variableName}};return MT(a,r,t,n),jT(a,r),db(a,r.config.services,i.database),mb(a,r.config.services,i.s3),a})}or(pb,"convertComputeResources");import*as ft from"typescript";var MU=Object.defineProperty,jU=(e,t)=>MU(e,"name",{value:t,configurable:!0});function Sl(e){return Pe(e,t=>{if(!ft.isCallExpression(t)||!xe(t,"addSchedule")||t.arguments.length<2)return null;let n=t.arguments[0],i=t.arguments[1];if(!ft.isStringLiteral(n)||!ft.isObjectLiteralExpression(i))return null;let r=B(i),o=b(r.schedule);if(o===void 0)return null;let a=i.properties.find(c=>ft.isPropertyAssignment(c)&&ft.isIdentifier(c.name)&&c.name.text==="target");return!a||!ft.isPropertyAssignment(a)||!ft.isIdentifier(a.initializer)?null:{id:n.text,schedule:o,targetVariableName:a.initializer.text}})}jU(Sl,"findSchedules");import*as Q from"typescript";import*as Fe from"typescript";var zU=Object.defineProperty,Ma=(e,t)=>zU(e,"name",{value:t,configurable:!0}),fb=new Set(["S3Bucket"]);function zT(e,t,n){let i=Fe.isIdentifier(e.name)?e.name.text:"";if(t.arguments&&t.arguments.length>=2){let r=t.arguments[1],o=Fe.isStringLiteral(r)?r.text:"",a=t.arguments.length>=3?t.arguments[2]:void 0,c=a&&Fe.isObjectLiteralExpression(a)?B(a):{};return{variableName:i,resourceName:o,bucketClass:n,config:c,node:e}}return null}Ma(zT,"extractS3Resource");function LT(e,t){if(t.arguments.length<2)return null;let n=t.arguments[0],i=t.arguments[1];if(!Fe.isStringLiteral(n)||!Fe.isObjectLiteralExpression(i))return null;let r=B(i);return{variableName:tt(e)??"",resourceName:n.text,bucketClass:"StorageFactory",config:r,node:e}}Ma(LT,"extractS3FactoryResource");function gb(e){return Pe(e,t=>{if(!Fe.isVariableDeclaration(t)||!t.initializer||!Fe.isNewExpression(t.initializer))return null;let n=t.initializer;if(!Fe.isIdentifier(n.expression))return null;let i=n.expression.text;return fb.has(i)?zT(t,n,i):null})}Ma(gb,"findS3Resources");function hb(e){return Pe(e,t=>{if(!Fe.isCallExpression(t)||!xe(t,"addStorage"))return null;let n=t.arguments[0];return Ue(n,"StorageFactory")?LT(t,n):null})}Ma(hb,"findS3FactoryResources");function vb(e){return e.map(t=>({name:t.resourceName,...b(t.config.bucketName)&&{bucketName:b(t.config.bucketName)},...j(t.config.publicReadAccess)===!0&&{publicReadAccess:!0},...P(t.config.websiteHosting)&&(()=>{let n=t.config.websiteHosting;return{websiteHosting:{indexDocument:b(n.indexDocument)??"index.html",...b(n.errorDocument)&&{errorDocument:b(n.errorDocument)}}}})(),...U(t.config.backupVaultTier,_t)&&{backupVaultTier:U(t.config.backupVaultTier,_t)},...j(t.config.versioned)!==void 0&&{versioned:j(t.config.versioned)},...U(t.config.encryption,Ii)&&{encryption:U(t.config.encryption,Ii)},...b(t.config.kmsKeyArn)&&{kmsKeyArn:b(t.config.kmsKeyArn)},...Array.isArray(t.config.cors)&&t.config.cors.length>0&&{cors:t.config.cors.filter(P).map(n=>({allowedOrigins:Array.isArray(n.allowedOrigins)?n.allowedOrigins.filter(i=>typeof i=="string"):[],allowedMethods:Array.isArray(n.allowedMethods)?n.allowedMethods.filter(i=>typeof i=="string"):[]}))},...P(t.config.deployment)&&(()=>{let n=t.config.deployment;return{deployment:{source:b(n.source)??"",...j(n.prune)!==void 0&&{prune:j(n.prune)},...P(n.cacheControl)&&(()=>{let i=n.cacheControl;return{cacheControl:{...R(i.maxAge)!==void 0&&{maxAge:R(i.maxAge)},...j(i.immutable)!==void 0&&{immutable:j(i.immutable)}}}})()}}})(),...U(t.config.stackPlacement,Vu)&&{stackPlacement:U(t.config.stackPlacement,Vu)},...t.variableName&&{variableName:t.variableName},...(()=>{let n=new Set(["bucketName","publicReadAccess","websiteHosting","backupVaultTier","versioned","encryption","kmsKeyArn","cors","deployment","stackPlacement"]),i=ce(t.config,n);return i.length>0?{extraProperties:i}:{}})()}))}Ma(vb,"convertS3Resources");var LU=Object.defineProperty,bn=(e,t)=>LU(e,"name",{value:t,configurable:!0}),UT=new Set(["App","Architecture","DatabaseFactory","StorageFactory","ComputeFactory","getConfig","MessagingFactory","CdnFactory","Code","Runtime","FunctionUrlAuthType","NetworkFactory","PatternFactory","VpcPeerFactory","VpcPeerAccepterFactory","CrossPlanConnectionFactory"]);function _l(e){return!!(e.startsWith("@fjall/")||e==="aws-cdk-lib"||e.startsWith("aws-cdk-lib/")||e==="constructs")}bn(_l,"isManagedModuleSpecifier");function Ke(e){let t=[];for(let n of e.statements){let i=n.getFullStart(),r=n.getEnd();if(Q.isImportDeclaration(n)){t.push({type:"import",node:n,startPos:i,endPos:r,isManaged:FT(n)});continue}if(Q.isVariableStatement(n)){t.push(BT(n,i,r));continue}if(Q.isExpressionStatement(n)){t.push(VT(n,i,r));continue}t.push({type:"custom",node:n,startPos:i,endPos:r,isManaged:!1})}return t}bn(Ke,"classifyStatements");function FT(e){return Q.isStringLiteral(e.moduleSpecifier)?_l(e.moduleSpecifier.text):!1}bn(FT,"isManagedImport");function BT(e,t,n){for(let i of e.declarationList.declarations)if(i.initializer){if(zt(i.initializer))return{type:"app-init",node:e,resourceName:Q.isIdentifier(i.name)?i.name.text:void 0,startPos:t,endPos:n,isManaged:!0};if(Q.isIdentifier(i.name)&&i.name.text==="appName"&&Q.isStringLiteral(i.initializer))return{type:"app-init",node:e,startPos:t,endPos:n,isManaged:!0};if(Q.isNewExpression(i.initializer)){let r=i.initializer;if(Q.isIdentifier(r.expression)){let o=r.expression.text;if(fb.has(o)){let a=r.arguments&&r.arguments.length>=2&&Q.isStringLiteral(r.arguments[1])?r.arguments[1].text:void 0;return{type:"storage",node:e,resourceName:a,startPos:t,endPos:n,isManaged:!0}}}}if(Q.isCallExpression(i.initializer)){let r=bb(i.initializer,e,t,n);if(r.type!=="custom")return r}}return{type:"custom",node:e,startPos:t,endPos:n,isManaged:!1}}bn(BT,"classifyVariableStatement");function VT(e,t,n){let i=e.expression;return Q.isCallExpression(i)?bb(i,e,t,n):{type:"custom",node:e,startPos:t,endPos:n,isManaged:!1}}bn(VT,"classifyExpressionStatement");function bb(e,t,n,i){let r=e.expression;if(Q.isPropertyAccessExpression(r)&&Q.isIdentifier(r.expression)){let o=r.name.text;if(o==="addTags")return{type:"tags",node:t,startPos:n,endPos:i,isManaged:!0};let a={addDatabase:{type:"database",factory:"DatabaseFactory"},addCompute:{type:"compute",factory:"ComputeFactory"},addNetwork:{type:"network",factory:"NetworkFactory"},addMessaging:{type:"messaging",factory:"MessagingFactory"},addCdn:{type:"cdn",factory:"CdnFactory"},addPattern:{type:"pattern",factory:"PatternFactory"},addStorage:{type:"storage",factory:"StorageFactory"},addVpcPeer:{type:"vpc-peer",factory:"VpcPeerFactory"},addVpcPeerAccepter:{type:"vpc-peer-accepter",factory:"VpcPeerAccepterFactory"}}[o];if(a){let c=ZT(e,a.factory);return{type:a.type,node:t,resourceName:c,startPos:n,endPos:i,isManaged:!0}}}return{type:"custom",node:t,startPos:n,endPos:i,isManaged:!1}}bn(bb,"classifyCallExpression");function ZT(e,t){if(e.arguments.length===0)return;let n=e.arguments[0];if(!Q.isCallExpression(n))return;let i=n.expression;if(!Q.isPropertyAccessExpression(i)||i.name.text!=="build"||!Q.isIdentifier(i.expression)||i.expression.text!==t||n.arguments.length===0)return;let r=n.arguments[0];if(Q.isStringLiteral(r))return r.text}bn(ZT,"extractResourceNameFromFactoryCall");import*as GT from"typescript";var UU=Object.defineProperty,yn=(e,t)=>UU(e,"name",{value:t,configurable:!0}),FU={import:"after-imports","app-init":"after-app-init",tags:"after-tags"};function WT(e){if(!e)return{position:"before-imports"};let t=FU[e.type];return t?{position:t}:{position:"after-resource",afterManagedResource:{type:e.type,name:e.resourceName}}}yn(WT,"determineCustomBlockPosition");function ja(e,t){let n=t??Ke(e),i=[],r=e.getFullText(),o=null;for(let a of n)if(a.type==="custom"&&!a.isManaged){let{position:c,afterManagedResource:u}=WT(o),l=HT(r,a.node),m=qT(r,a.node),p=e.getLineAndCharacterOfPosition(a.node.getStart());i.push({sourceText:l,position:c,afterManagedResource:u,originalLine:p.line+1,leadingComments:m.length>0?m:void 0})}else a.isManaged&&(o=a);return i}yn(ja,"extractCustomCodeBlocks");function HT(e,t){let n=t.getFullStart(),i=t.getEnd(),r=e.slice(n,i).split(`
428
+ `,n}tr(ul,"generateCDNCode");function ll(e){let t=new Set;if(e.cdn&&(e.cdn.defaultOriginRef&&t.add(e.cdn.defaultOriginRef),e.cdn.behaviours))for(let n of e.cdn.behaviours)t.add(n.originRef);return t}tr(ll,"collectCdnReferencedResources");function dl(e){return e.patternConfig!==void 0}tr(dl,"usesPatternApproach");var _U=Object.defineProperty,vn=(e,t)=>_U(e,"name",{value:t,configurable:!0}),Ca="service",Qv="0 4 * * ? *",eb="0 5 * * ? *",rr=Object.freeze({tinkerer:{displayName:"Tinkerer",description:"Free tier eligible, minimal cost for experimentation",database:{Instance:{instanceType:"t4g.micro",multiAz:!1,proxy:!1,readReplica:!1,publiclyAccessible:!0},Aurora:null,GlobalAurora:null,ClickHouse:null},compute:{ecs:{services:[{name:Ca,capacityProvider:"EC2",desiredCount:1,minCapacity:1,maxCapacity:1,ec2Config:{instanceType:"t4g.micro",amiHardwareType:"ARM",minCapacity:1,maxCapacity:1,memoryLimitMiB:400}}],cluster:{directAccess:!0}},lambda:{timeout:30,memory:128}},network:{maxAzs:2,natGateways:!1,flowLogs:!1},backup:!1},lightweight:{displayName:"Lightweight",description:"Streamlined single-AZ deployment for cost efficiency",database:{Instance:{instanceType:"t4g.small",multiAz:!1},Aurora:{readers:!1},GlobalAurora:null,ClickHouse:null},compute:{ecs:{services:[{name:Ca,capacityProvider:"FARGATE_SPOT",cpu:256,memoryLimitMiB:512,desiredCount:1,minCapacity:1,maxCapacity:3}]},lambda:{timeout:30,memory:256}},network:{maxAzs:2,natGateways:{count:1},flowLogs:!1},backup:!1},standard:{displayName:"Standard",description:"Production-ready with sensible defaults",database:{Instance:{instanceType:"t4g.large"},Aurora:{readers:{count:1}},GlobalAurora:{readers:{count:1}},ClickHouse:{instanceType:"t4g.medium",coldTier:{mode:"s3"},optimiseSchedule:Qv,backupSchedule:eb,backupRetentionDays:14}},compute:{ecs:{services:[{name:Ca,capacityProvider:"FARGATE",cpu:512,memoryLimitMiB:1024,desiredCount:2,minCapacity:2,maxCapacity:5}]},lambda:{timeout:60,memory:256}},network:{maxAzs:3,natGateways:{count:1},flowLogs:{},vpcEndpoints:{interface:{ecr:!0}}},backup:!1},resilient:{displayName:"Resilient",description:"High availability with enhanced monitoring and scaling",database:{Instance:{instanceType:"r7g.large",encryption:{storageKey:{useCMK:!0}},databaseInsights:{mode:"advanced",encryptionKey:{useCMK:!0}},proxy:{requireTLS:!0}},Aurora:{readers:{count:2},encryption:{storageKey:{useCMK:!0}},databaseInsights:{mode:"advanced",encryptionKey:{useCMK:!0}},proxy:{requireTLS:!0},backupRetention:30},GlobalAurora:{readers:{count:2},encryption:{storageKey:{useCMK:!0}},databaseInsights:{mode:"advanced",encryptionKey:{useCMK:!0}},proxy:{requireTLS:!0},backupRetention:30,enableGlobalWriteForwarding:!0},ClickHouse:{instanceType:"m6g.large",coldTier:{mode:"s3"},optimiseSchedule:Qv,backupSchedule:eb,backupRetentionDays:14}},compute:{ecs:{services:[{name:Ca,capacityProvider:"FARGATE",cpu:1024,memoryLimitMiB:2048,desiredCount:4,minCapacity:4,maxCapacity:20}]},lambda:{timeout:120,memory:512}},network:{maxAzs:3,natGateways:{count:3},flowLogs:{retentionDays:90},vpcEndpoints:{interface:{ecr:!0,secretsManager:!0}}},backup:{tier:"resilient"}},enterprise:{displayName:"Enterprise",description:"Maximum capability with all features enabled",database:{Instance:{instanceType:"r7g.xlarge",encryption:{storageKey:{useCMK:!0}},databaseInsights:{mode:"advanced",encryptionKey:{useCMK:!0}},proxy:{requireTLS:!0},readReplica:{}},Aurora:{readers:{count:2},encryption:{storageKey:{useCMK:!0}},databaseInsights:{mode:"advanced",encryptionKey:{useCMK:!0}},proxy:{requireTLS:!0},backupRetention:35},GlobalAurora:{readers:{count:2},encryption:{storageKey:{useCMK:!0}},databaseInsights:{mode:"advanced",encryptionKey:{useCMK:!0}},proxy:{requireTLS:!0},backupRetention:35,enableGlobalWriteForwarding:!0},ClickHouse:{instanceType:"m6g.xlarge",coldTier:{mode:"s3"},optimiseSchedule:Qv,backupSchedule:eb,backupRetentionDays:30}},compute:{ecs:{services:[{name:Ca,capacityProvider:"FARGATE",cpu:2048,memoryLimitMiB:4096,desiredCount:6,minCapacity:6,maxCapacity:100}]},lambda:{timeout:300,memory:1024}},network:{maxAzs:3,natGateways:{count:3},flowLogs:{destination:"s3",retentionDays:365},vpcEndpoints:{interface:{ecr:!0,secretsManager:!0,kms:!0,cloudwatchLogs:!0}}},backup:{tier:"enterprise"}}});function EU(e,t){return rr[e].database[t]}vn(EU,"getDatabasePreset");function xU(e){return rr[e].compute.ecs}vn(xU,"getEcsPreset");function tb(e){return rr[e].network}vn(tb,"getNetworkPreset");function ST(e){return Au.filter(t=>rr[t].database[e]!==null)}vn(ST,"getAvailableTiersForDatabase");function AU(e){return ST(e).map(t=>({label:rr[t].displayName,value:t,description:rr[t].description}))}vn(AU,"getTierOptionsForDatabase");function rb(e){switch(e){case"tinkerer":case"lightweight":case"standard":return"Instance";case"resilient":case"enterprise":return"Aurora"}}vn(rb,"getDefaultDatabaseTypeForTier");function nb(e,t){let n=rr[e].compute.ecs,i=n.services[0],r=!n.cluster?.directAccess&&n.cluster?.loadBalancer!==!1,o=t.filter(c=>c.serviceType!=="worker").length,a=t.findIndex(c=>c.serviceType!=="worker");return t.map((c,u)=>{let l=u===a,m=c.serviceType==="worker",p;return r&&!m&&(c.routing?p=c.routing:o>1&&(p={path:l?"/*":`/${c.name.toLowerCase()}/*`,...l?{}:{priority:100+u}})),{name:c.name,capacityProvider:i.capacityProvider,ec2Config:i.ec2Config,cpu:i.cpu,memoryLimitMiB:i.memoryLimitMiB,desiredCount:i.desiredCount,minCapacity:i.minCapacity,maxCapacity:i.maxCapacity,routing:p}})}vn(nb,"applyTierDefaultsToServices");var IU=Object.defineProperty,ib=(e,t)=>IU(e,"name",{value:t,configurable:!0}),Na=["lightweight","standard","resilient"],$U=[...Na,"custom"],Rr=Object.freeze({lightweight:{displayName:"Lightweight",description:"Cost-effective \xB7 Instance DB, minimal Lambda",database:{type:"Instance",instanceType:"t4g.small",backupRetention:7,deletionProtection:!1},compute:{memorySize:512,timeout:30},network:{maxAzs:2,natGateways:{count:1},flowLogs:!1},backup:!1},standard:{displayName:"Standard",description:"Production-ready \xB7 Instance DB, balanced Lambda",database:{type:"Instance",instanceType:"t4g.large",backupRetention:14,deletionProtection:!0},compute:{memorySize:1536,timeout:60},network:{maxAzs:3,natGateways:{count:1},flowLogs:{}},backup:{tier:"standard"}},resilient:{displayName:"Resilient",description:"High-availability \xB7 Aurora V2, KMS encryption",database:{type:"Aurora",backupRetention:30,deletionProtection:!0,encryption:{useCMK:!0}},compute:{memorySize:2048,timeout:120},network:{maxAzs:3,natGateways:{count:3},flowLogs:{retentionDays:90}},backup:{tier:"resilient"}}});function ml(e){return Rr[e]}ib(ml,"getPatternTierPreset");function _T(){return[{label:Rr.standard.displayName,value:"standard",description:Rr.standard.description},{label:Rr.lightweight.displayName,value:"lightweight",description:Rr.lightweight.description},{label:Rr.resilient.displayName,value:"resilient",description:Rr.resilient.description},{label:"Custom",value:"custom",description:"Full control \xB7 Configure everything"}]}ib(_T,"getPatternTierOptions");var TU=new Set(Na);function pl(e){return TU.has(e)}ib(pl,"isPatternTierName");var RU=Object.defineProperty,ET=(e,t)=>RU(e,"name",{value:t,configurable:!0}),fl=Object.freeze({standard:{},assets:{versioned:!0,deployment:{source:"./assets"}},upload:{versioned:!0,cors:[{allowedOrigins:["*"],allowedMethods:["GET","PUT","POST"]}]},website:{publicReadAccess:!0,websiteHosting:{indexDocument:"index.html",errorDocument:"error.html"}}});function xT(e){return{...fl[e]}}ET(xT,"getStoragePreset");function AT(){return[{label:"Standard",value:"standard"},{label:"Assets",value:"assets"},{label:"Upload",value:"upload"},{label:"Website Hosting",value:"website"}]}ET(AT,"getStoragePresetOptions");import*as ge from"typescript";import*as D from"typescript";var PU=Object.defineProperty,Di=(e,t)=>PU(e,"name",{value:t,configurable:!0});function B(e){let t={};for(let n of e.properties){if(!D.isPropertyAssignment(n))continue;let i=D.isIdentifier(n.name)||D.isStringLiteral(n.name)?n.name.text:void 0;i!==void 0&&(t[i]=Pr(n.initializer))}return t}Di(B,"parseObjectLiteral");function Pr(e){if(D.isStringLiteral(e))return e.text;if(D.isNumericLiteral(e))return Number(e.text);if(e.kind===D.SyntaxKind.TrueKeyword)return!0;if(e.kind===D.SyntaxKind.FalseKeyword)return!1;if(D.isArrayLiteralExpression(e))return e.elements.map(t=>Pr(t));if(D.isObjectLiteralExpression(e))return B(e);if(D.isIdentifier(e))return{__identifier:e.text};if(D.isPropertyAccessExpression(e))return{__expression:e.getText()};if(D.isCallExpression(e))return{__call:e.getText()};if(D.isBinaryExpression(e)&&e.operatorToken.kind===D.SyntaxKind.BarBarToken){let t=Pr(e.left),n=Pr(e.right);return typeof n=="string"?n:t}else if(D.isConditionalExpression(e)){let t=Pr(e.whenTrue),n=Pr(e.whenFalse);return typeof n=="string"||typeof n=="number"?n:t}else if(D.isTemplateExpression(e)||D.isNoSubstitutionTemplateLiteral(e))return{__expression:e.getText()};return{__unknown:e.getText()}}Di(Pr,"evaluateExpression");function wa(e,t){return et(e,n=>{if(D.isVariableStatement(n)){for(let i of n.declarationList.declarations)if(D.isIdentifier(i.name)&&i.name.text===t&&i.initializer){if(D.isStringLiteral(i.initializer))return i.initializer.text;if(D.isObjectLiteralExpression(i.initializer)){let r=B(i.initializer);return JSON.stringify(r)}}}})}Di(wa,"findVariableValue");function ob(e,t){return et(e,n=>{if(D.isVariableStatement(n)){for(let i of n.declarationList.declarations)if(D.isIdentifier(i.name)&&i.name.text===t&&i.initializer&&D.isObjectLiteralExpression(i.initializer))return B(i.initializer)}})}Di(ob,"findObjectDeclaration");function ka(e,t){if(!D.isIdentifier(t.expression))return;let n=ob(e,t.expression.text),i=t.name.text;if(n&&n[i]!==void 0)return String(n[i])}Di(ka,"evaluatePropertyAccess");function gl(e,t){let n=t.head.text;for(let i of t.templateSpans){if(D.isIdentifier(i.expression)){let r=wa(e,i.expression.text);if(r)n+=r;else return t.getText(e).replace(/^`|`$/g,"")}else if(D.isPropertyAccessExpression(i.expression)){let r=ka(e,i.expression);if(r)n+=r;else return t.getText(e).replace(/^`|`$/g,"")}else return t.getText(e).replace(/^`|`$/g,"");n+=i.literal.text}return n}Di(gl,"resolveTemplateLiteral");var CU=Object.defineProperty,J=(e,t)=>CU(e,"name",{value:t,configurable:!0});function dt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}J(dt,"isPlainObject");function nr(e){return dt(e)&&"__identifier"in e}J(nr,"isIdentifierRef");function Cr(e){return dt(e)&&"__expression"in e}J(Cr,"isExpressionRef");function xt(e){return dt(e)&&"__call"in e}J(xt,"isCallRef");function P(e){return dt(e)&&!("__identifier"in e)&&!("__expression"in e)&&!("__call"in e)&&!("__unknown"in e)}J(P,"isParsedObject");function b(e){return typeof e=="string"?e:void 0}J(b,"asString");function R(e){return typeof e=="number"?e:void 0}J(R,"asNumber");function j(e){return typeof e=="boolean"?e:void 0}J(j,"asBoolean");function ue(e){if(!Array.isArray(e))return;let t=[];for(let n of e)typeof n=="string"&&t.push(n);return t.length>0?t:void 0}J(ue,"asStringArray");function U(e,t){let n=b(e);if(n!==void 0)return ct(t,n)?n:void 0}J(U,"asStringUnion");function qe(e){let t={};for(let[n,i]of Object.entries(e))i!==void 0&&(t[n]=i);return t}J(qe,"omitUndefined");function hl(e){if(e===null)return"null";if(e===void 0)return"undefined";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(hl).join(", ")}]`;if(!dt(e))return String(e);if(nr(e))return e.__identifier;if(Cr(e))return e.__expression;if(xt(e))return e.__call;if("__unknown"in e&&typeof e.__unknown=="string")return e.__unknown;let t=Object.entries(e);return t.length===0?"{}":`{ ${t.map(([n,i])=>`${n}: ${hl(i)}`).join(", ")} }`}J(hl,"parsedValueToSourceText");function ce(e,t){let n=[];for(let[i,r]of Object.entries(e))t.has(i)||r===void 0||n.push({key:i,sourceText:hl(r)});return n}J(ce,"captureExtraProperties");function Nr(e,t){return ge.isPropertyAssignment(e)&&ge.isIdentifier(e.name)&&e.name.text===t}J(Nr,"isNamedProperty");function zt(e){return ge.isCallExpression(e)&&ge.isPropertyAccessExpression(e.expression)&&e.expression.name.text==="getApp"&&ge.isIdentifier(e.expression.expression)&&e.expression.expression.text==="App"}J(zt,"isAppGetAppCall");function xe(e,t){let{expression:n}=e;return ge.isPropertyAccessExpression(n)&&n.name.text===t&&e.arguments.length>0}J(xe,"isFactoryMethodCall");function et(e,t){let n,i=J(r=>{n===void 0&&(n=t(r),n===void 0&&ge.forEachChild(r,i))},"visit");return i(e),n}J(et,"findFirstInAst");function Pe(e,t){let n=[],i=J(r=>{let o=t(r);o!==null&&n.push(o),ge.forEachChild(r,i)},"visit");return i(e),n}J(Pe,"collectFromAst");function Ue(e,t){return ge.isCallExpression(e)&&ge.isPropertyAccessExpression(e.expression)&&e.expression.name.text==="build"&&ge.isIdentifier(e.expression.expression)&&e.expression.expression.text===t}J(Ue,"isFactoryBuildCall");function tt(e){let t=e.parent;if(ge.isVariableDeclaration(t)&&ge.isIdentifier(t.name))return t.name.text}J(tt,"extractVariableName");var mt=J(()=>e=>e,"typed");function Mi(e){if(e!=null){if(e===!1)return!1;if(typeof e=="object"&&!Array.isArray(e))return e}}J(Mi,"asObjectOrFalse");function ir(e,t){return e===!1?!1:P(e)?t(e):void 0}J(ir,"parseBooleanOrConfig");function Ce(e,t){return P(e)?t(e):void 0}J(Ce,"parseOptionalConfig");function pt(e,t,n){let i=e[t];return P(i)?n(i):void 0}J(pt,"extractSubConfig");import*as W from"typescript";import*as ji from"typescript";var NU=Object.defineProperty,rt=(e,t)=>NU(e,"name",{value:t,configurable:!0});function Oa(e){return e!==void 0&&dt(e)}rt(Oa,"isEnvironmentRecord");function IT(e){if(!P(e))return;let t={};for(let[n,i]of Object.entries(e))if(P(i)){let r=b(i.id),o=b(i.name);r&&o&&(t[n]={id:r,name:o,field:b(i.field)})}return Object.keys(t).length>0?t:void 0}rt(IT,"parseContainerSecretsImport");function $T(e){if(!P(e))return;let t=ue(e.command);if(!(!t||t.length===0))return{command:t,interval:R(e.interval),timeout:R(e.timeout),retries:R(e.retries),startPeriod:R(e.startPeriod)}}rt($T,"parseContainerHealthCheck");function TT(e){let t=ce(e,new Set(["name","image","port","environment","essential","command","entryPoint","secretsImport","secrets","healthCheck"]));return{name:b(e.name),image:b(e.image),port:R(e.port),environment:Oa(e.environment)?e.environment:void 0,essential:j(e.essential),command:ue(e.command),entryPoint:ue(e.entryPoint),secretsImport:IT(e.secretsImport),ssmSecrets:ue(e.secrets),healthCheck:$T(e.healthCheck),extraProperties:t.length>0?t:void 0}}rt(TT,"parseServiceContainer");function RT(e){if(Array.isArray(e))return e.filter(P).map(t=>({path:b(t.path),host:b(t.host),priority:R(t.priority),healthCheckPath:b(t.healthCheckPath)}));if(P(e))return{path:b(e.path),host:b(e.host),priority:R(e.priority),healthCheckPath:b(e.healthCheckPath)}}rt(RT,"parseServiceRouting");function PT(e){if(e===!1)return!1;if(P(e))return{minCapacity:R(e.minCapacity),maxCapacity:R(e.maxCapacity),desiredCount:R(e.desiredCount),scalingType:U(e.scalingType,Ru)}}rt(PT,"parseServiceScaling");var wU=new Set(["instanceType","amiHardwareType","minCapacity","maxCapacity","memoryLimitMiB","warmPool"]);function CT(e){if(!P(e))return;let t=e.warmPool,n=P(t)?{minSize:R(t.minSize),reuseOnScaleIn:j(t.reuseOnScaleIn)}:void 0,i=ce(e,wU);return{instanceType:b(e.instanceType),amiHardwareType:U(e.amiHardwareType,Pu),minCapacity:R(e.minCapacity),maxCapacity:R(e.maxCapacity),memoryLimitMiB:R(e.memoryLimitMiB),warmPool:n,extraProperties:i.length>0?i:void 0}}rt(CT,"parseServiceEc2Config");var kU=new Set(["domain","loadBalancer","directAccess"]);function ab(e){if(!P(e))return;let t=e.loadBalancer,n=ce(e,kU);return{domain:b(e.domain),loadBalancer:t===!1?!1:U(t,Tu),directAccess:j(e.directAccess),...n.length>0&&{extraProperties:n}}}rt(ab,"extractClusterConfig");function sb(e){let t=e.containers,n=Array.isArray(t)?t.filter(P).map(TT):void 0,i=ce(e,new Set(["name","image","docker","ssmSecretsPath","containers","routing","connections","cpu","memoryLimitMiB","desiredCount","scaling","capacityProvider","ec2Config"]));return{name:b(e.name)??"",image:b(e.image),docker:NT(e.docker),ssmSecretsPath:b(e.ssmSecretsPath),containers:n,routing:RT(e.routing),cpu:R(e.cpu),memoryLimitMiB:R(e.memoryLimitMiB),desiredCount:R(e.desiredCount),scaling:PT(e.scaling),capacityProvider:U(e.capacityProvider,_i)??"FARGATE",ec2Config:CT(e.ec2Config),...i.length>0&&{extraProperties:i}}}rt(sb,"parseEcsService");function NT(e){if(!P(e))return;let t=b(e.path);if(t===void 0)return;let n=b(e.context),i=b(e.target);return{path:t,...n!==void 0&&{context:n},...i!==void 0&&{target:i}}}rt(NT,"parseServiceDocker");function Da(e,t){let n=b(e);if(n)return n;if(Cr(e)&&e.__expression.startsWith(t+"."))return e.__expression.slice(t.length+1)}rt(Da,"extractEnumString");function cb(e){return xt(e)?e.__call.match(/\(\s*"([^"]+)"\s*\)/)?.[1]:void 0}rt(cb,"extractCallStringArg");function Ne(e,t,n){n!==void 0&&(e[t]=n)}rt(Ne,"assignIfDefined");var OU=Object.defineProperty,vl=(e,t)=>OU(e,"name",{value:t,configurable:!0}),DU=10;function ub(e,t){return Array.isArray(e)?e.filter(nr).map(n=>t.find(i=>i.variableName===n.__identifier)).filter(n=>n!==void 0).map(n=>n.resourceName):[]}vl(ub,"resolveConnectedDatabaseNames");function lb(e,t){return Array.isArray(e)?e.filter(nr).map(n=>t.find(i=>i.variableName===n.__identifier)).filter(n=>n!==void 0).map(n=>n.resourceName):[]}vl(lb,"resolveConnectedStorageNames");function db(e,t,n){if(!Array.isArray(t)||t.length===0)return;let i=t[0];if(!P(i))return;let r=i.containers;if(!Array.isArray(r)||r.length===0)return;let o=r[0];if(!P(o)||!P(o.environment))return;let a=o.environment;(a.DATABASE_HOST||a.DATABASE_PORT||a.DATABASE_NAME)&&(e.needsConnection=!0,n.length>0&&(e.connectedDatabase??[]).length===0&&(e.connectedDatabase=[n[0].name]));for(let c=1;c<=DU;c++)(a[`DATABASE_HOST_${c}`]||a[`DATABASE_PORT_${c}`]||a[`DATABASE_NAME_${c}`])&&(e.needsConnection=!0)}vl(db,"inferDatabaseConnectionsFromEnv");function mb(e,t,n){if(!Array.isArray(t)||t.length===0)return;let i=t[0];if(!P(i))return;let r=i.containers;if(!Array.isArray(r)||r.length===0)return;let o=r[0];!P(o)||!P(o.environment)||o.environment.BUCKET_NAME&&n.length>0&&(e.connectedStorage??[]).length===0&&(e.connectedStorage=[n[0].name])}vl(mb,"inferStorageConnectionsFromEnv");var MU=Object.defineProperty,or=(e,t)=>MU(e,"name",{value:t,configurable:!0});function wT(e){if(e.arguments.length<2)return null;let t=e.arguments[0],n=e.arguments[1];if(!ji.isStringLiteral(t)||!ji.isObjectLiteralExpression(n))return null;let i=t.text,r=B(n);return{resourceName:i,type:b(r.type)??"ecs",config:r,node:e}}or(wT,"extractComputeResource");function bl(e){return Pe(e,t=>{if(!ji.isCallExpression(t)||!xe(t,"addCompute"))return null;let n=t.arguments[0];if(!Ue(n,"ComputeFactory"))return null;let i=wT(n);if(i){let r=tt(t);r&&(i.variableName=r)}return i})}or(bl,"findComputeResources");function yl(e,t,n){let i=ce(e.config,n);i.length>0&&(t.extraProperties=i)}or(yl,"applyExtras");function kT(e,t){let n=e.config.docker;if(P(n)){let o=b(n.path),a=b(n.context),c=b(n.target);(o!==void 0||a!==void 0||c!==void 0)&&(t.docker={...o!==void 0&&{path:o},...a!==void 0&&{context:a},...c!==void 0&&{target:c}})}let i=e.config.cluster;i!==void 0&&(t.cluster=ab(i));let r=e.config.services;r!==void 0&&Array.isArray(r)&&(t.services=r.filter(o=>P(o)).map(sb)),yl(e,t,new Set(["type","ecrRepository","docker","cluster","services","connections"]))}or(kT,"convertEcsCompute");function OT(e,t){if(Ne(t,"deployment",U(e.config.deployment,Iu)),Ne(t,"timeout",R(e.config.timeout)),Ne(t,"memory",R(e.config.memorySize)??R(e.config.memory)),Ne(t,"handler",b(e.config.handler)),Ne(t,"runtime",Da(e.config.runtime,"Runtime")),Oa(e.config.environment)&&(t.environment=e.config.environment),Oa(e.config.secrets))t.secrets=e.config.secrets;else{let r=ue(e.config.secrets);r&&(t.ssmSecrets=r)}let n=e.config.functionUrl;if(P(n)){let r=U(Da(n.authType,"FunctionUrlAuthType"),ia);r!==void 0&&(t.functionUrl={authType:r})}let i=e.config.code;if(i!==void 0){let r=cb(i);r&&(t.codePath=r)}Ne(t,"description",b(e.config.lambdaDescription)),Ne(t,"architecture",U(Da(e.config.architecture,"Architecture"),$u)),Ne(t,"ephemeralStorageSize",R(e.config.ephemeralStorageSize)),Ne(t,"functionName",b(e.config.functionName)),Ne(t,"ssmSecretsPath",b(e.config.ssmSecretsPath)),yl(e,t,new Set(["type","deployment","timeout","memorySize","memory","handler","runtime","environment","secrets","functionUrl","code","connections","ecrRepository","containerSecretsImport","lambdaDescription","architecture","ephemeralStorageSize","functionName","ssmSecretsPath"]))}or(OT,"convertLambdaCompute");function DT(e,t){Ne(t,"instanceType",U(e.config.instanceType,Cu));let n=e.config.ssh;n===!1?t.enableSSH=!1:n!==void 0&&P(n)?t.enableSSH=!0:Ne(t,"enableSSH",j(e.config.enableSSH)),Ne(t,"keyName",b(e.config.keyName)),Ne(t,"userData",b(e.config.userData)),e.config.securityGroups!==void 0&&(t.securityGroups=ue(e.config.securityGroups)),yl(e,t,new Set(["type","instanceType","ssh","enableSSH","keyName","userData","securityGroups","connections"]))}or(DT,"convertEc2Compute");function MT(e,t,n,i){let r=t.config.connections;if(!r&&Array.isArray(t.config.services)){let c=t.config.services[0];P(c)&&(r=c.connections)}if(!r)return;let o=ub(r,n);o.length>0&&(e.needsConnection=!0,e.connectedDatabase=o);let a=lb(r,i);a.length>0&&(e.connectedStorage=a)}or(MT,"applyConnectionConfig");function jT(e,t){({ecs:kT,lambda:OT,ec2:DT})[e.type]?.(t,e)}or(jT,"applyTypeSpecificConfig");function pb(e,t,n,i){return e.map(r=>{let o=U(r.config.type,ra)??"ecs",a={name:r.resourceName,type:o,needsConnection:!1,connectedDatabase:[],...r.variableName&&{variableName:r.variableName}};return MT(a,r,t,n),jT(a,r),db(a,r.config.services,i.database),mb(a,r.config.services,i.s3),a})}or(pb,"convertComputeResources");import*as ft from"typescript";var jU=Object.defineProperty,zU=(e,t)=>jU(e,"name",{value:t,configurable:!0});function Sl(e){return Pe(e,t=>{if(!ft.isCallExpression(t)||!xe(t,"addSchedule")||t.arguments.length<2)return null;let n=t.arguments[0],i=t.arguments[1];if(!ft.isStringLiteral(n)||!ft.isObjectLiteralExpression(i))return null;let r=B(i),o=b(r.schedule);if(o===void 0)return null;let a=i.properties.find(c=>ft.isPropertyAssignment(c)&&ft.isIdentifier(c.name)&&c.name.text==="target");return!a||!ft.isPropertyAssignment(a)||!ft.isIdentifier(a.initializer)?null:{id:n.text,schedule:o,targetVariableName:a.initializer.text}})}zU(Sl,"findSchedules");import*as Q from"typescript";import*as Fe from"typescript";var LU=Object.defineProperty,Ma=(e,t)=>LU(e,"name",{value:t,configurable:!0}),fb=new Set(["S3Bucket"]);function zT(e,t,n){let i=Fe.isIdentifier(e.name)?e.name.text:"";if(t.arguments&&t.arguments.length>=2){let r=t.arguments[1],o=Fe.isStringLiteral(r)?r.text:"",a=t.arguments.length>=3?t.arguments[2]:void 0,c=a&&Fe.isObjectLiteralExpression(a)?B(a):{};return{variableName:i,resourceName:o,bucketClass:n,config:c,node:e}}return null}Ma(zT,"extractS3Resource");function LT(e,t){if(t.arguments.length<2)return null;let n=t.arguments[0],i=t.arguments[1];if(!Fe.isStringLiteral(n)||!Fe.isObjectLiteralExpression(i))return null;let r=B(i);return{variableName:tt(e)??"",resourceName:n.text,bucketClass:"StorageFactory",config:r,node:e}}Ma(LT,"extractS3FactoryResource");function gb(e){return Pe(e,t=>{if(!Fe.isVariableDeclaration(t)||!t.initializer||!Fe.isNewExpression(t.initializer))return null;let n=t.initializer;if(!Fe.isIdentifier(n.expression))return null;let i=n.expression.text;return fb.has(i)?zT(t,n,i):null})}Ma(gb,"findS3Resources");function hb(e){return Pe(e,t=>{if(!Fe.isCallExpression(t)||!xe(t,"addStorage"))return null;let n=t.arguments[0];return Ue(n,"StorageFactory")?LT(t,n):null})}Ma(hb,"findS3FactoryResources");function vb(e){return e.map(t=>({name:t.resourceName,...b(t.config.bucketName)&&{bucketName:b(t.config.bucketName)},...j(t.config.publicReadAccess)===!0&&{publicReadAccess:!0},...P(t.config.websiteHosting)&&(()=>{let n=t.config.websiteHosting;return{websiteHosting:{indexDocument:b(n.indexDocument)??"index.html",...b(n.errorDocument)&&{errorDocument:b(n.errorDocument)}}}})(),...U(t.config.backupVaultTier,_t)&&{backupVaultTier:U(t.config.backupVaultTier,_t)},...j(t.config.versioned)!==void 0&&{versioned:j(t.config.versioned)},...U(t.config.encryption,Ii)&&{encryption:U(t.config.encryption,Ii)},...b(t.config.kmsKeyArn)&&{kmsKeyArn:b(t.config.kmsKeyArn)},...Array.isArray(t.config.cors)&&t.config.cors.length>0&&{cors:t.config.cors.filter(P).map(n=>({allowedOrigins:Array.isArray(n.allowedOrigins)?n.allowedOrigins.filter(i=>typeof i=="string"):[],allowedMethods:Array.isArray(n.allowedMethods)?n.allowedMethods.filter(i=>typeof i=="string"):[]}))},...P(t.config.deployment)&&(()=>{let n=t.config.deployment;return{deployment:{source:b(n.source)??"",...j(n.prune)!==void 0&&{prune:j(n.prune)},...P(n.cacheControl)&&(()=>{let i=n.cacheControl;return{cacheControl:{...R(i.maxAge)!==void 0&&{maxAge:R(i.maxAge)},...j(i.immutable)!==void 0&&{immutable:j(i.immutable)}}}})()}}})(),...U(t.config.stackPlacement,Vu)&&{stackPlacement:U(t.config.stackPlacement,Vu)},...t.variableName&&{variableName:t.variableName},...(()=>{let n=new Set(["bucketName","publicReadAccess","websiteHosting","backupVaultTier","versioned","encryption","kmsKeyArn","cors","deployment","stackPlacement"]),i=ce(t.config,n);return i.length>0?{extraProperties:i}:{}})()}))}Ma(vb,"convertS3Resources");var UU=Object.defineProperty,bn=(e,t)=>UU(e,"name",{value:t,configurable:!0}),UT=new Set(["App","Architecture","DatabaseFactory","StorageFactory","ComputeFactory","getConfig","MessagingFactory","CdnFactory","Code","Runtime","FunctionUrlAuthType","NetworkFactory","PatternFactory","VpcPeerFactory","VpcPeerAccepterFactory","CrossPlanConnectionFactory"]);function _l(e){return!!(e.startsWith("@fjall/")||e==="aws-cdk-lib"||e.startsWith("aws-cdk-lib/")||e==="constructs")}bn(_l,"isManagedModuleSpecifier");function Ke(e){let t=[];for(let n of e.statements){let i=n.getFullStart(),r=n.getEnd();if(Q.isImportDeclaration(n)){t.push({type:"import",node:n,startPos:i,endPos:r,isManaged:FT(n)});continue}if(Q.isVariableStatement(n)){t.push(BT(n,i,r));continue}if(Q.isExpressionStatement(n)){t.push(VT(n,i,r));continue}t.push({type:"custom",node:n,startPos:i,endPos:r,isManaged:!1})}return t}bn(Ke,"classifyStatements");function FT(e){return Q.isStringLiteral(e.moduleSpecifier)?_l(e.moduleSpecifier.text):!1}bn(FT,"isManagedImport");function BT(e,t,n){for(let i of e.declarationList.declarations)if(i.initializer){if(zt(i.initializer))return{type:"app-init",node:e,resourceName:Q.isIdentifier(i.name)?i.name.text:void 0,startPos:t,endPos:n,isManaged:!0};if(Q.isIdentifier(i.name)&&i.name.text==="appName"&&Q.isStringLiteral(i.initializer))return{type:"app-init",node:e,startPos:t,endPos:n,isManaged:!0};if(Q.isNewExpression(i.initializer)){let r=i.initializer;if(Q.isIdentifier(r.expression)){let o=r.expression.text;if(fb.has(o)){let a=r.arguments&&r.arguments.length>=2&&Q.isStringLiteral(r.arguments[1])?r.arguments[1].text:void 0;return{type:"storage",node:e,resourceName:a,startPos:t,endPos:n,isManaged:!0}}}}if(Q.isCallExpression(i.initializer)){let r=bb(i.initializer,e,t,n);if(r.type!=="custom")return r}}return{type:"custom",node:e,startPos:t,endPos:n,isManaged:!1}}bn(BT,"classifyVariableStatement");function VT(e,t,n){let i=e.expression;return Q.isCallExpression(i)?bb(i,e,t,n):{type:"custom",node:e,startPos:t,endPos:n,isManaged:!1}}bn(VT,"classifyExpressionStatement");function bb(e,t,n,i){let r=e.expression;if(Q.isPropertyAccessExpression(r)&&Q.isIdentifier(r.expression)){let o=r.name.text;if(o==="addTags")return{type:"tags",node:t,startPos:n,endPos:i,isManaged:!0};let a={addDatabase:{type:"database",factory:"DatabaseFactory"},addCompute:{type:"compute",factory:"ComputeFactory"},addNetwork:{type:"network",factory:"NetworkFactory"},addMessaging:{type:"messaging",factory:"MessagingFactory"},addCdn:{type:"cdn",factory:"CdnFactory"},addPattern:{type:"pattern",factory:"PatternFactory"},addStorage:{type:"storage",factory:"StorageFactory"},addVpcPeer:{type:"vpc-peer",factory:"VpcPeerFactory"},addVpcPeerAccepter:{type:"vpc-peer-accepter",factory:"VpcPeerAccepterFactory"}}[o];if(a){let c=ZT(e,a.factory);return{type:a.type,node:t,resourceName:c,startPos:n,endPos:i,isManaged:!0}}}return{type:"custom",node:t,startPos:n,endPos:i,isManaged:!1}}bn(bb,"classifyCallExpression");function ZT(e,t){if(e.arguments.length===0)return;let n=e.arguments[0];if(!Q.isCallExpression(n))return;let i=n.expression;if(!Q.isPropertyAccessExpression(i)||i.name.text!=="build"||!Q.isIdentifier(i.expression)||i.expression.text!==t||n.arguments.length===0)return;let r=n.arguments[0];if(Q.isStringLiteral(r))return r.text}bn(ZT,"extractResourceNameFromFactoryCall");import*as GT from"typescript";var FU=Object.defineProperty,yn=(e,t)=>FU(e,"name",{value:t,configurable:!0}),BU={import:"after-imports","app-init":"after-app-init",tags:"after-tags"};function WT(e){if(!e)return{position:"before-imports"};let t=BU[e.type];return t?{position:t}:{position:"after-resource",afterManagedResource:{type:e.type,name:e.resourceName}}}yn(WT,"determineCustomBlockPosition");function ja(e,t){let n=t??Ke(e),i=[],r=e.getFullText(),o=null;for(let a of n)if(a.type==="custom"&&!a.isManaged){let{position:c,afterManagedResource:u}=WT(o),l=HT(r,a.node),m=qT(r,a.node),p=e.getLineAndCharacterOfPosition(a.node.getStart());i.push({sourceText:l,position:c,afterManagedResource:u,originalLine:p.line+1,leadingComments:m.length>0?m:void 0})}else a.isManaged&&(o=a);return i}yn(ja,"extractCustomCodeBlocks");function HT(e,t){let n=t.getFullStart(),i=t.getEnd(),r=e.slice(n,i).split(`
429
429
  `),o=r.findIndex(a=>a.trim()!=="");return r.slice(o===-1?0:o).join(`
430
- `)}yn(HT,"getStatementTextWithComments");function qT(e,t){let n=[],i=GT.getLeadingCommentRanges(e,t.getFullStart());if(i)for(let r of i){let o=e.slice(r.pos,r.end);n.push(o)}return n}yn(qT,"extractLeadingComments");function zi(e,t,n,i){let r=i??Ke(e);for(let o of r)if(o.type===t&&o.resourceName===n)return{startPos:o.startPos,endPos:o.endPos,node:o.node};return null}yn(zi,"findManagedResourcePosition");function yb(e,t,n){let i=n??Ke(e),r=null;for(let o of i)o.type===t&&o.isManaged&&(r=o);return r}yn(yb,"getLastManagedStatementOfType");function Sb(e,t){let n=t??Ke(e),i={import:[],"app-init":[],tags:[],database:[],compute:[],storage:[],network:[],messaging:[],cdn:[],pattern:[],"vpc-peer":[],"vpc-peer-accepter":[],"cross-plan-connection":[],custom:[]};for(let r of n)i[r.type].push(r);return i}yn(Sb,"getManagedResourcesByType");import*as ar from"typescript";import*as La from"typescript";var BU=Object.defineProperty,_b=(e,t)=>BU(e,"name",{value:t,configurable:!0}),VU=["S","N","B"];function za(e){if(!P(e))return;let t=b(e.name),n=U(e.type,VU);if(!(!t||!n))return{name:t,type:n}}_b(za,"parseDynamoDBKey");function Eb(e){let t=e.node;if(!La.isCallExpression(t))return null;let n=t.arguments[0];if(!La.isCallExpression(n)||n.arguments.length<2)return null;let i=n.arguments[1];if(!La.isObjectLiteralExpression(i))return null;let r=B(i),o=za(r.partitionKey);if(!o)return null;let a={resourceName:e.resourceName,partitionKey:o,node:e.node};e.variableName&&(a.variableName=e.variableName);let c=za(r.sortKey);if(c&&(a.sortKey=c),Array.isArray(r.globalSecondaryIndexes)){let p=r.globalSecondaryIndexes.filter(P).map(g=>{let v=za(g.partitionKey);if(!v)return null;let A=b(g.indexName);if(!A)return null;let Y={indexName:A,partitionKey:v},z=za(g.sortKey);return z&&(Y.sortKey=z),Y}).filter(g=>g!==null);p.length>0&&(a.globalSecondaryIndexes=p)}let u=b(r.ttlAttribute);u&&(a.ttlAttribute=u);let l=j(r.stream);l!==void 0&&(a.stream=l);let m=ce(r,new Set(["type","databaseName","partitionKey","sortKey","globalSecondaryIndexes","ttlAttribute","stream"]));return m.length>0&&(a.extraProperties=m),a}_b(Eb,"extractDynamoDBFields");function El(e){if(e.length!==0)return e.map(t=>({name:t.resourceName,partitionKey:t.partitionKey,...qe({sortKey:t.sortKey,globalSecondaryIndexes:t.globalSecondaryIndexes,ttlAttribute:t.ttlAttribute,stream:t.stream,variableName:t.variableName,extraProperties:t.extraProperties})}))}_b(El,"convertDynamoDBResources");import*as Ua from"typescript";var ZU=Object.defineProperty,KT=(e,t)=>ZU(e,"name",{value:t,configurable:!0}),GU=new Set(["type","databaseName","instanceType","coldTier","optimiseSchedule","backupSchedule","backupRetentionDays"]);function xb(e){let t=e.node;if(!Ua.isCallExpression(t))return null;let n=t.arguments[0];if(!Ua.isCallExpression(n)||n.arguments.length<2)return null;let i=n.arguments[1];if(!Ua.isObjectLiteralExpression(i))return null;let r=B(i),o={resourceName:e.resourceName,databaseName:e.databaseName,node:e.node};e.variableName&&(o.variableName=e.variableName);let a=b(r.instanceType);a&&(o.instanceType=a);let c=r.coldTier;c===!1?o.coldTier=!1:P(c)&&b(c.mode)==="s3"&&(o.coldTier={mode:"s3"});let u=r.optimiseSchedule;if(u===!1)o.optimiseSchedule=!1;else{let g=b(u);g&&(o.optimiseSchedule=g)}let l=r.backupSchedule;if(l===!1)o.backupSchedule=!1;else{let g=b(l);g&&(o.backupSchedule=g)}let m=R(r.backupRetentionDays);m!==void 0&&(o.backupRetentionDays=m);let p=ce(r,GU);return p.length>0&&(o.extraProperties=p),o}KT(xb,"extractClickHouseFields");function xl(e){if(e.length!==0)return e.map(t=>({name:t.resourceName,type:"ClickHouse",databaseName:t.databaseName,...qe({instanceType:t.instanceType,coldTier:t.coldTier,optimiseSchedule:t.optimiseSchedule,backupSchedule:t.backupSchedule,backupRetentionDays:t.backupRetentionDays,variableName:t.variableName,extraProperties:t.extraProperties})}))}KT(xl,"convertClickHouseResources");var WU=Object.defineProperty,Li=(e,t)=>WU(e,"name",{value:t,configurable:!0});function YT(e){let t=b(e.databaseEngine);if(t!==void 0&&ct(xi,t))return t;let n=e.engine;if(xt(n)){let i=String(n.__call);if(i.includes("postgres")||i.includes("auroraPostgres"))return"postgresql";if(i.includes("mysql")||i.includes("auroraMysql"))return"mysql"}}Li(YT,"extractDatabaseEngine");function XT(e){let t=e.engine;if(xt(t))return String(t.__call)}Li(XT,"extractEngineExpression");var HU=new Set(["type","databaseName","databaseEngine","engine","vpc","port","deletionProtection","instanceType","multiAz","publiclyAccessible","enableSecretRotation","encryption","databaseInsights","proxy","readReplica","credentials","writer","readers","backupRetention","preferredMaintenanceWindow","primaryRegion","secondaryRegions","globalClusterIdentifier","enableGlobalWriteForwarding","snapshotIdentifier","allocatedStorage","monitoringInterval","snapshotUsername"]);function JT(e,t,n){if(n.arguments.length<2)return null;let i=n.arguments[0],r=n.arguments[1];if(!ar.isStringLiteral(i)&&!ar.isTemplateExpression(i))return null;let o=ar.isStringLiteral(i)?i.text:gl(e,i);if(!ar.isObjectLiteralExpression(r))return null;let a=B(r),c={resourceName:o,type:b(a.type)??"",databaseName:b(a.databaseName)??"",databaseEngine:YT(a),engineExpression:XT(a),port:R(a.port),deletionProtection:j(a.deletionProtection),instanceType:b(a.instanceType),multiAz:j(a.multiAz),publiclyAccessible:j(a.publiclyAccessible),enableSecretRotation:j(a.enableSecretRotation),encryption:Ce(a.encryption,mt()),databaseInsights:ir(a.databaseInsights,mt()),proxy:ir(a.proxy,mt()),readReplica:ir(a.readReplica,mt()),credentials:Ce(a.credentials,mt()),writer:Ce(a.writer,mt()),readers:ir(a.readers,mt()),backupRetention:R(a.backupRetention),preferredMaintenanceWindow:b(a.preferredMaintenanceWindow),primaryRegion:b(a.primaryRegion),secondaryRegions:ue(a.secondaryRegions),globalClusterIdentifier:b(a.globalClusterIdentifier),enableGlobalWriteForwarding:j(a.enableGlobalWriteForwarding),allocatedStorage:R(a.allocatedStorage),monitoringInterval:R(a.monitoringInterval),snapshotIdentifier:b(a.snapshotIdentifier),snapshotUsername:b(a.snapshotUsername),node:t},u=tt(t);u&&(c.variableName=u);let l=ce(a,HU);return l.length>0&&(c.extraProperties=l),c}Li(JT,"extractDatabaseResource");function Ab(e){return Pe(e,t=>{if(!ar.isCallExpression(t)||!xe(t,"addDatabase"))return null;let n=t.arguments[0];return Ue(n,"DatabaseFactory")?JT(e,t,n):null})}Li(Ab,"findDatabaseResources");function Ib(e){let t=[],n=[],i=[];for(let r of e)if(r.type==="DynamoDB"){let o=Eb(r);o&&n.push(o)}else if(r.type==="ClickHouse"){let o=xb(r);o&&i.push(o)}else t.push(r);return{databases:t,dynamodb:n,clickhouse:i}}Li(Ib,"splitDatabaseResources");var qU=["Instance","Aurora","GlobalAurora"];function $b(e){return e.filter(t=>t.type!=="DynamoDB").map(t=>({name:t.resourceName,type:ct(qU,t.type)?t.type:"Instance",databaseName:t.databaseName,...qe({port:t.port,deletionProtection:t.deletionProtection,instanceType:t.instanceType,multiAz:t.multiAz,publiclyAccessible:t.publiclyAccessible,enableSecretRotation:t.enableSecretRotation,encryption:t.encryption,databaseInsights:t.databaseInsights,proxy:t.proxy,readReplica:t.readReplica,credentials:t.credentials,writer:t.writer,readers:t.readers,backupRetention:t.backupRetention,preferredMaintenanceWindow:t.preferredMaintenanceWindow,primaryRegion:t.primaryRegion,secondaryRegions:t.secondaryRegions,globalClusterIdentifier:t.globalClusterIdentifier,enableGlobalWriteForwarding:t.enableGlobalWriteForwarding,allocatedStorage:t.allocatedStorage,monitoringInterval:t.monitoringInterval,variableName:t.variableName,databaseEngine:t.databaseEngine,engineExpression:t.engineExpression,extraProperties:t.extraProperties})}))}Li($b,"convertDatabaseResources");import*as Fi from"typescript";var KU=Object.defineProperty,Ui=(e,t)=>KU(e,"name",{value:t,configurable:!0});function QT(e,t){if(t.arguments.length<2)return null;let n=t.arguments[0],i=t.arguments[1];if(!Fi.isStringLiteral(n)||!Fi.isObjectLiteralExpression(i))return null;let r=B(i),o={resourceName:n.text,queueType:b(r.queueType)??"standard",visibilityTimeout:R(r.visibilityTimeout),retentionPeriod:R(r.messageRetentionPeriod),contentBasedDeduplication:j(r.contentBasedDeduplication),removalPolicy:b(r.removalPolicy),node:e},a=tt(e);a&&(o.variableName=a);let c=ce(r,new Set(["type","queueType","visibilityTimeout","messageRetentionPeriod","contentBasedDeduplication","removalPolicy"]));return c.length>0&&(o.extraProperties=c),o}Ui(QT,"extractSQSResource");function Tb(e){if(e!=null){if(e===!1)return!1;if(P(e))return qe({enabled:j(e.enabled),maxReceiveCount:R(e.maxReceiveCount)})}}Ui(Tb,"parseDeadLetterQueueConfig");function Rb(e){return Pe(e,t=>{if(!Fi.isCallExpression(t)||!xe(t,"addMessaging"))return null;let n=t.arguments[0];return Ue(n,"MessagingFactory")?QT(t,n):null})}Ui(Rb,"findSQSResources");function Pb(e){if(e.length!==0)return e.map(t=>({name:t.resourceName,queueType:t.queueType==="fifo"?"fifo":"standard",...qe({visibilityTimeout:t.visibilityTimeout,retentionPeriod:t.retentionPeriod,contentBasedDeduplication:t.contentBasedDeduplication,removalPolicy:t0(t.removalPolicy),variableName:t.variableName,extraProperties:t.extraProperties})}))}Ui(Pb,"convertSQSResources");var YU=new Set(Cv.options);function e0(e){return YU.has(e)}Ui(e0,"isSqsRemovalPolicy");function t0(e){return e!==void 0&&e0(e)?e:void 0}Ui(t0,"toSqsRemovalPolicy");import*as Bi from"typescript";var XU=Object.defineProperty,Fa=(e,t)=>XU(e,"name",{value:t,configurable:!0});function n0(e){if(e.arguments.length<2)return null;let t=e.arguments[0],n=e.arguments[1];return!Bi.isStringLiteral(t)||!Bi.isObjectLiteralExpression(n)?null:{resourceName:t.text,config:B(n),node:e}}Fa(n0,"extractCDNResource");function i0(e,t,n){let i=t.find(o=>o.variableName===e);if(i)return i.resourceName;let r=n.find(o=>o.variableName===e||o.resourceName.charAt(0).toLowerCase()+o.resourceName.slice(1)===e);return r?r.resourceName:e}Fa(i0,"resolveOriginIdentifier");var r0=["CACHING_OPTIMIZED","CACHING_DISABLED"];function Cb(e){return et(e,t=>{if(!Bi.isCallExpression(t)||!xe(t,"addCdn"))return;let n=t.arguments[0];if(Ue(n,"CdnFactory"))return n0(n)??void 0})}Fa(Cb,"findCDNResource");function Nb(e,t,n){if(!e)return;let i=e,r=i.config,o=Fa(p=>nr(p)?i0(p.__identifier,t,n):b(p)??"","resolveOrigin"),a=o(r.origin),c={name:i.resourceName,defaultOriginRef:a};if(Array.isArray(r.behaviours)){let p=r.behaviours.filter(P).map(g=>({pathPattern:b(g.pathPattern)??"",originRef:o(g.origin),...U(g.cachePolicy,r0)!==void 0&&{cachePolicy:U(g.cachePolicy,r0)}}));p.length>0&&(c.behaviours=p)}let u=b(r.customDomain);if(u)c.customDomain=u;else{let p=ue(r.domainNames);p&&p.length>0&&(c.customDomain=p[0])}let l=b(r.certificateArn);if(l&&(c.certificateArn=l),r.accessGate!==void 0){if(r.accessGate===!1)c.accessGate=!1;else if(P(r.accessGate)){let p=r.accessGate,g=b(p.type),v=b(p.username),A=b(p.password);g==="basic-auth"&&v&&A&&(c.accessGate={type:"basic-auth",username:v,password:A})}}let m=ce(r,new Set(["originType","origin","behaviours","customDomain","domainNames","certificateArn","accessGate"]));return m.length>0&&(c.extraProperties=m),c}Fa(Nb,"convertCDNResource");import*as de from"typescript";var JU=Object.defineProperty,nt=(e,t)=>JU(e,"name",{value:t,configurable:!0}),QU=new Set(Rv.options);function o0(e){if(e!==void 0)return QU.has(e)?e:void 0}nt(o0,"asFlowLogDestination");function wb(e){return{maxAzs:R(e.maxAzs),natGateways:ir(e.natGateways,t=>({count:R(t.count)})),flowLogs:ir(e.flowLogs,t=>({destination:b(t.destination),retentionDays:R(t.retentionDays)})),vpcEndpoints:P(e.vpcEndpoints)?e.vpcEndpoints:void 0}}nt(wb,"parseNetworkConfigFields");function a0(e,t){if(t.arguments.length<2)return null;let n=t.arguments[0],i=t.arguments[1];if(!de.isStringLiteral(n))return null;let r=n.text,o=de.isObjectLiteralExpression(i)?B(i):{},a=wb(o),c={name:r,config:qe({...a}),node:e},u=tt(e);return u&&(c.variableName=u),c}nt(a0,"extractNetworkResource");function kb(e){return et(e,t=>{if(!zt(t)||t.arguments.length<=1)return;let n=t.arguments[1];if(de.isObjectLiteralExpression(n)){for(let i of n.properties)if(Nr(i,"network")&&de.isObjectLiteralExpression(i.initializer)){for(let r of i.initializer.properties)if(Nr(r,"useExisting")&&de.isStringLiteral(r.initializer))return r.initializer.text}}})}nt(kb,"findVpcId");function Ob(e){return et(e,t=>{if(!zt(t)||t.arguments.length<=1)return;let n=t.arguments[1];if(de.isObjectLiteralExpression(n)){for(let i of n.properties)if(Nr(i,"network")){if(i.initializer.kind===de.SyntaxKind.FalseKeyword)return;if(de.isObjectLiteralExpression(i.initializer)&&!i.initializer.properties.some(r=>Nr(r,"useExisting"))){let r=B(i.initializer);return wb(r)}}}})}nt(Ob,"findNetworkConfig");function Db(e){return et(e,t=>{if(!zt(t)||t.arguments.length<=1)return;let n=t.arguments[1];if(de.isObjectLiteralExpression(n)){for(let i of n.properties)if(Nr(i,"backup")){if(i.initializer.kind===de.SyntaxKind.FalseKeyword)return!1;if(de.isObjectLiteralExpression(i.initializer)){let r=B(i.initializer),o=b(r.tier);if(o)return{tier:o}}}}})}nt(Db,"findBackupConfig");function Mb(e){return et(e,t=>{if(!zt(t)||t.arguments.length<=1)return;let n=t.arguments[1];if(de.isObjectLiteralExpression(n)){for(let i of n.properties)if(Nr(i,"tunnel")){if(i.initializer.kind===de.SyntaxKind.FalseKeyword)return!1;if(i.initializer.kind===de.SyntaxKind.TrueKeyword)return!0;if(de.isObjectLiteralExpression(i.initializer)){let r=B(i.initializer),o=b(r.instanceType);return o?{instanceType:o}:{}}}}})}nt(Mb,"findTunnelConfig");function jb(e){return Pe(e,t=>{if(!de.isCallExpression(t)||!xe(t,"addNetwork"))return null;let n=t.arguments[0];return Ue(n,"NetworkFactory")?a0(t,n):null})}nt(jb,"findNetworkResources");function zb(e){let t=e.flowLogs;return{...qe({maxAzs:e.maxAzs,natGateways:e.natGateways,vpcEndpoints:e.vpcEndpoints}),...t!==void 0&&{flowLogs:t===!1?!1:qe({destination:o0(t.destination),retentionDays:t.retentionDays})}}}nt(zb,"buildNetworkFields");function Lb(e){if(e)return zb(e)}nt(Lb,"convertNetworkConfig");function Ub(e){if(e===void 0)return;if(e===!1)return!1;let t=e.tier;if(ct(_t,t))return{tier:t}}nt(Ub,"convertBackupConfig");function Fb(e){if(e===void 0)return;if(e===!1)return!1;if(e===!0)return{};let t={};return e.instanceType&&(t.instanceType=e.instanceType),t}nt(Fb,"convertTunnelConfig");function Bb(e){if(!(!e||e.length===0))return e.map(t=>({name:t.name,...zb(t.config)}))}nt(Bb,"convertAdditionalNetworks");import*as Vi from"typescript";var e4=Object.defineProperty,be=(e,t)=>e4(e,"name",{value:t,configurable:!0}),t4=["Instance","Aurora"],r4=["postgresql","mysql"];function Al(e){if(!P(e))return;let t={...e.memorySize!==void 0&&{memorySize:R(e.memorySize)},...e.timeout!==void 0&&{timeout:R(e.timeout)},...e.ephemeralStorageSize!==void 0&&{ephemeralStorageSize:R(e.ephemeralStorageSize)}};return Object.keys(t).length>0?t:void 0}be(Al,"parseLambdaConfig");function s0(e){return pt(e,"database",t=>({type:U(t.type,t4),databaseName:b(t.databaseName),databaseEngine:U(t.databaseEngine,r4),deletionProtection:j(t.deletionProtection),backupRetention:R(t.backupRetention),port:R(t.port),publiclyAccessible:j(t.publiclyAccessible),allowedIpCidr:b(t.allowedIpCidr),instanceType:b(t.instanceType),allocatedStorage:R(t.allocatedStorage),multiAz:j(t.multiAz),allowVpcAccess:j(t.allowVpcAccess),monitoringInterval:R(t.monitoringInterval),preferredMaintenanceWindow:b(t.preferredMaintenanceWindow),snapshotIdentifier:b(t.snapshotIdentifier),snapshotUsername:b(t.snapshotUsername),readReplica:Mi(t.readReplica),writer:Ce(t.writer,mt()),readers:Mi(t.readers),databaseInsights:Mi(t.databaseInsights),proxy:Mi(t.proxy),credentials:Ce(t.credentials,mt()),encryption:Ce(t.encryption,mt())}))}be(s0,"extractPatternDatabaseConfig");function c0(e){return pt(e,"compute",t=>({server:Ce(t.server,Al),imageOptimisation:Ce(t.imageOptimisation,Al),revalidation:Ce(t.revalidation,Al)}))}be(c0,"extractPatternComputeConfig");function u0(e){let t=be(n=>({versioned:j(n.versioned)}),"parseVersionedConfig");return pt(e,"storage",n=>({assets:Ce(n.assets,t),cache:Ce(n.cache,t),media:Ce(n.media,t)}))}be(u0,"extractPatternStorageConfig");function l0(e){return pt(e,"messaging",t=>({revalidationQueue:Ce(t.revalidationQueue,n=>({visibilityTimeout:R(n.visibilityTimeout),messageRetentionPeriod:R(n.messageRetentionPeriod),maxMessageSize:R(n.maxMessageSize),deadLetterQueue:Tb(n.deadLetterQueue)}))}))}be(l0,"extractPatternMessagingConfig");function d0(e){return pt(e,"cdn",t=>({domainNames:ue(t.domainNames),certificateArn:b(t.certificateArn)}))}be(d0,"extractPatternCdnConfig");function m0(e){return pt(e,"environment",t=>{let n=Object.fromEntries(Object.entries(t).filter(i=>typeof i[1]=="string"));return Object.keys(n).length>0?n:void 0})}be(m0,"extractPatternEnvironmentConfig");function p0(e,t){let n=f0(e);return{name:t,source:b(e.source),build:pt(e,"build",i=>({command:b(i.command),outputDir:b(i.outputDir)})),routing:U(e.routing,Vo),security:pt(e,"security",i=>({headers:j(i.headers),contentSecurityPolicy:b(i.contentSecurityPolicy)})),domain:b(e.domain),forms:pt(e,"forms",i=>({to:b(i.to),from:b(i.from),corsOrigin:b(i.corsOrigin),maxConcurrency:R(i.maxConcurrency)})),cdn:pt(e,"cdn",i=>({behaviours:Array.isArray(i.behaviours)?i.behaviours:void 0})),...n.length>0&&{unreadableFields:n}}}be(p0,"extractStaticSiteConfig");function Vb(e){return dt(e)&&("__identifier"in e||"__expression"in e||"__call"in e||"__unknown"in e)}be(Vb,"isUnreadableRef");function f0(e){let t=[],n=be((r,o)=>{Vb(r)&&t.push(o)},"check");n(e.source,"source"),n(e.routing,"routing"),n(e.domain,"domain");let i=[[e.build,"build",["command","outputDir"]],[e.security,"security",["headers","contentSecurityPolicy"]],[e.forms,"forms",["to","from","corsOrigin","maxConcurrency"]],[e.cdn,"cdn",["behaviours"]]];for(let[r,o,a]of i)if(Vb(r))t.push(o);else if(P(r))for(let c of a)n(r[c],`${o}.${c}`);return t}be(f0,"collectUnreadableStaticSiteFields");function wr(e){return e!==void 0&&e!==""}be(wr,"isReadable");function Il(e,t){return new Error(`Static-site pattern '${e}' in infrastructure.ts: Fjall could not read ${t.join(", ")} as inline literal(s). Fjall reads these fields out of the file and writes them back, so they must be written inline (source: "./site"), not as a variable or an expression.`)}be(Il,"unreadableStaticSiteFields");function g0(e,t){let n=t.to;if(!wr(n))throw Il(e,["forms.to"]);return{to:n,...t.from!==void 0&&{from:t.from},...t.corsOrigin!==void 0&&{corsOrigin:t.corsOrigin},...t.maxConcurrency!==void 0&&{maxConcurrency:t.maxConcurrency}}}be(g0,"readStaticSiteForms");function h0(e,t){if(e.arguments.length<2)return null;let n=e.arguments[0],i=e.arguments[1];if(!Vi.isStringLiteral(n)||!Vi.isObjectLiteralExpression(i))return null;let r=n.text,o=B(i),a=o.type,c=tt(t),u=b(o.name);return u?a==="payload"||a==="nextjs"?{variableName:c,constructId:r,type:a,config:{name:u,domain:b(o.domain),database:s0(o),compute:c0(o),storage:u0(o),messaging:l0(o),cdn:d0(o),environment:m0(o)},node:e}:a==="staticsite"?{variableName:c,constructId:r,type:"staticsite",config:p0(o,u),node:e}:null:null}be(h0,"extractPatternResource");function Zb(e){return Pe(e,t=>{if(!Vi.isCallExpression(t)||!xe(t,"addPattern"))return null;let n=t.arguments[0];return Ue(n,"PatternFactory")?h0(n,t):null})}be(Zb,"findPatternResources");function Gb(e,t){if(!t||t.length===0)return;let n=t[0];if(e.pattern=n.type,n.type==="staticsite"){let{config:r}=n,o=r.source,a=r.build?.command,c=r.build?.outputDir;if(r.unreadableFields!==void 0)throw Il(r.name,r.unreadableFields);if(!wr(o)||!wr(a)||!wr(c)){let u=[];throw wr(o)||u.push("source"),wr(a)||u.push("build.command"),wr(c)||u.push("build.outputDir"),Il(r.name,u)}e.patternConfig={type:"staticsite",name:r.name,source:o,build:{command:a,outputDir:c},routing:r.routing,security:r.security,domain:r.domain,...r.forms!==void 0&&{forms:g0(r.name,r.forms)},cdn:r.cdn};return}let{config:i}=n;e.patternConfig={type:n.type,name:i.name,domain:i.domain,database:i.database,compute:i.compute,storage:i.storage,messaging:i.messaging,cdn:i.cdn,environment:i.environment}}be(Gb,"applyPatternConfig");var n4=Object.defineProperty,$l=(e,t)=>n4(e,"name",{value:t,configurable:!0});function v0(e,t){for(let n of t){let i=e.compute.find(r=>r.variableName===n.targetVariableName);i!==void 0&&i.type==="lambda"&&(i.scheduleExpression=n.schedule)}}$l(v0,"applyScheduleBackfill");function b0(e,t){Object.keys(t).length>0&&(e.tags={...t}),t[Ra]&&(e.owner=t[Ra])}$l(b0,"applyTagsAndOwner");function y0(e){let t=[];for(let n of e)if(_l(n.moduleSpecifier))if(n.moduleSpecifier==="@fjall/components-infrastructure"||n.moduleSpecifier==="@fjall/infrastructure"){let i=n.namedImports.filter(r=>!UT.has(r));i.length>0&&t.push({moduleSpecifier:n.moduleSpecifier,namedImports:i,defaultImport:n.defaultImport})}else(n.namedImports.length>0||n.defaultImport)&&t.push(n);return t.length>0?t:void 0}$l(y0,"computeAdditionalManagedImports");function Sn(e,t,n){let i={appName:t,type:"standard",database:[],s3:[],compute:[]};if(Gb(i,e.patternResources),e.vpcId&&(i.vpcId=e.vpcId),i.network=Lb(e.network),i.backup=Ub(e.backup),i.tunnel=Fb(e.tunnel),i.additionalNetworks=Bb(e.networkResources),b0(i,e.tags),i.database=$b(e.databaseResources),i.dynamodb=El(e.dynamodbResources),i.clickhouse=xl(e.clickhouseResources),i.sqs=Pb(e.sqsResources),i.cdn=Nb(e.cdnResource,e.s3Resources,e.computeResources),i.s3=vb(e.s3Resources),i.compute=pb(e.computeResources,e.databaseResources,e.s3Resources,i),v0(i,e.schedules),i.additionalManagedImports=y0(e.imports),n?.skipValidation)return i;try{return B$.parse(i)}catch(r){if(r instanceof s.ZodError){let o=sa(r);throw new Error(`Invalid infrastructure configuration:
431
- ${o}`)}throw r}}$l(Sn,"convertToResourcePlan");var i4=Object.defineProperty,Zi=(e,t)=>i4(e,"name",{value:t,configurable:!0});function kr(e,t){let n=W.createSourceFile("infrastructure.ts",e,W.ScriptTarget.Latest,!0,W.ScriptKind.TS),i=S0(n),{appVariableName:r,appName:o}=E0(n),a=kb(n),c=Ob(n),u=Db(n),l=Mb(n),m=jb(n),p=Ab(n),{databases:g,dynamodb:v,clickhouse:A}=Ib(p),Y=Rb(n),z=Cb(n),Se=[...gb(n),...hb(n)],fr=bl(n),we=Sl(n),te=Zb(n),pe=x0(n),$n={sourceFile:n,imports:i,appVariableName:r,appName:o,vpcId:a,network:c,backup:u,tunnel:l,networkResources:m,databaseResources:g,dynamodbResources:v,clickhouseResources:A,sqsResources:Y,cdnResource:z,s3Resources:Se,computeResources:fr,schedules:we,patternResources:te,tags:pe};return t?.extractCustomCode&&($n.customCodeBlocks=ja(n),$n.classifiedStatements=Ke(n)),$n}Zi(kr,"parseInfrastructure");function S0(e){let t=[];return W.forEachChild(e,n=>{if(W.isImportDeclaration(n)){if(!W.isStringLiteral(n.moduleSpecifier))return;let i={moduleSpecifier:n.moduleSpecifier.text,namedImports:[]};n.importClause&&(n.importClause.name&&(i.defaultImport=n.importClause.name.text),n.importClause.namedBindings&&W.isNamedImports(n.importClause.namedBindings)&&(i.namedImports=n.importClause.namedBindings.elements.map(r=>r.name.text))),t.push(i)}}),t}Zi(S0,"extractImports");function _0(e,t){return W.isStringLiteral(t)?t.text:W.isIdentifier(t)?wa(e,t.text)??"":W.isPropertyAccessExpression(t)?ka(e,t)??"":""}Zi(_0,"resolveAppName");function E0(e){return et(e,t=>{if(W.isVariableStatement(t))for(let n of t.declarationList.declarations){if(!n.initializer||!zt(n.initializer))continue;let i=W.isIdentifier(n.name)?n.name.text:"",r=n.initializer.arguments.length>0?_0(e,n.initializer.arguments[0]):"";return{appVariableName:i,appName:r}}})??{appVariableName:"",appName:""}}Zi(E0,"findAppVariable");function x0(e){let t={};function n(i){if(W.isCallExpression(i)&&W.isPropertyAccessExpression(i.expression)&&i.expression.name.text==="addTags"&&W.isIdentifier(i.expression.expression)&&i.arguments.length>0){let r=i.arguments[0];if(W.isObjectLiteralExpression(r)){let o=B(r);for(let[a,c]of Object.entries(o))typeof c=="string"?t[a]=c:Cr(c)&&(t[a]="default-value")}}W.forEachChild(i,n)}return Zi(n,"visit"),n(e),t}Zi(x0,"extractTags");import*as Gi from"typescript";var o4=Object.defineProperty,Ae=(e,t)=>o4(e,"name",{value:t,configurable:!0});function Wi(e,t,n){return e.slice(0,t)+n+e.slice(t)}Ae(Wi,"insertAtPosition");function Tl(e,t){return e.find(n=>n.type===t)}Ae(Tl,"findClassification");function Wb(e,t){return e.filter(n=>n.type===t).pop()}Ae(Wb,"findLastClassification");function Or(e){return Gi.createSourceFile("infrastructure.ts",e,Gi.ScriptTarget.Latest,!0,Gi.ScriptKind.TS)}Ae(Or,"parseSourceFile");function Rl(e,t){return e.endsWith(`
430
+ `)}yn(HT,"getStatementTextWithComments");function qT(e,t){let n=[],i=GT.getLeadingCommentRanges(e,t.getFullStart());if(i)for(let r of i){let o=e.slice(r.pos,r.end);n.push(o)}return n}yn(qT,"extractLeadingComments");function zi(e,t,n,i){let r=i??Ke(e);for(let o of r)if(o.type===t&&o.resourceName===n)return{startPos:o.startPos,endPos:o.endPos,node:o.node};return null}yn(zi,"findManagedResourcePosition");function yb(e,t,n){let i=n??Ke(e),r=null;for(let o of i)o.type===t&&o.isManaged&&(r=o);return r}yn(yb,"getLastManagedStatementOfType");function Sb(e,t){let n=t??Ke(e),i={import:[],"app-init":[],tags:[],database:[],compute:[],storage:[],network:[],messaging:[],cdn:[],pattern:[],"vpc-peer":[],"vpc-peer-accepter":[],"cross-plan-connection":[],custom:[]};for(let r of n)i[r.type].push(r);return i}yn(Sb,"getManagedResourcesByType");import*as ar from"typescript";import*as La from"typescript";var VU=Object.defineProperty,_b=(e,t)=>VU(e,"name",{value:t,configurable:!0}),ZU=["S","N","B"];function za(e){if(!P(e))return;let t=b(e.name),n=U(e.type,ZU);if(!(!t||!n))return{name:t,type:n}}_b(za,"parseDynamoDBKey");function Eb(e){let t=e.node;if(!La.isCallExpression(t))return null;let n=t.arguments[0];if(!La.isCallExpression(n)||n.arguments.length<2)return null;let i=n.arguments[1];if(!La.isObjectLiteralExpression(i))return null;let r=B(i),o=za(r.partitionKey);if(!o)return null;let a={resourceName:e.resourceName,partitionKey:o,node:e.node};e.variableName&&(a.variableName=e.variableName);let c=za(r.sortKey);if(c&&(a.sortKey=c),Array.isArray(r.globalSecondaryIndexes)){let p=r.globalSecondaryIndexes.filter(P).map(g=>{let v=za(g.partitionKey);if(!v)return null;let A=b(g.indexName);if(!A)return null;let Y={indexName:A,partitionKey:v},z=za(g.sortKey);return z&&(Y.sortKey=z),Y}).filter(g=>g!==null);p.length>0&&(a.globalSecondaryIndexes=p)}let u=b(r.ttlAttribute);u&&(a.ttlAttribute=u);let l=j(r.stream);l!==void 0&&(a.stream=l);let m=ce(r,new Set(["type","databaseName","partitionKey","sortKey","globalSecondaryIndexes","ttlAttribute","stream"]));return m.length>0&&(a.extraProperties=m),a}_b(Eb,"extractDynamoDBFields");function El(e){if(e.length!==0)return e.map(t=>({name:t.resourceName,partitionKey:t.partitionKey,...qe({sortKey:t.sortKey,globalSecondaryIndexes:t.globalSecondaryIndexes,ttlAttribute:t.ttlAttribute,stream:t.stream,variableName:t.variableName,extraProperties:t.extraProperties})}))}_b(El,"convertDynamoDBResources");import*as Ua from"typescript";var GU=Object.defineProperty,KT=(e,t)=>GU(e,"name",{value:t,configurable:!0}),WU=new Set(["type","databaseName","instanceType","coldTier","optimiseSchedule","backupSchedule","backupRetentionDays"]);function xb(e){let t=e.node;if(!Ua.isCallExpression(t))return null;let n=t.arguments[0];if(!Ua.isCallExpression(n)||n.arguments.length<2)return null;let i=n.arguments[1];if(!Ua.isObjectLiteralExpression(i))return null;let r=B(i),o={resourceName:e.resourceName,databaseName:e.databaseName,node:e.node};e.variableName&&(o.variableName=e.variableName);let a=b(r.instanceType);a&&(o.instanceType=a);let c=r.coldTier;c===!1?o.coldTier=!1:P(c)&&b(c.mode)==="s3"&&(o.coldTier={mode:"s3"});let u=r.optimiseSchedule;if(u===!1)o.optimiseSchedule=!1;else{let g=b(u);g&&(o.optimiseSchedule=g)}let l=r.backupSchedule;if(l===!1)o.backupSchedule=!1;else{let g=b(l);g&&(o.backupSchedule=g)}let m=R(r.backupRetentionDays);m!==void 0&&(o.backupRetentionDays=m);let p=ce(r,WU);return p.length>0&&(o.extraProperties=p),o}KT(xb,"extractClickHouseFields");function xl(e){if(e.length!==0)return e.map(t=>({name:t.resourceName,type:"ClickHouse",databaseName:t.databaseName,...qe({instanceType:t.instanceType,coldTier:t.coldTier,optimiseSchedule:t.optimiseSchedule,backupSchedule:t.backupSchedule,backupRetentionDays:t.backupRetentionDays,variableName:t.variableName,extraProperties:t.extraProperties})}))}KT(xl,"convertClickHouseResources");var HU=Object.defineProperty,Li=(e,t)=>HU(e,"name",{value:t,configurable:!0});function YT(e){let t=b(e.databaseEngine);if(t!==void 0&&ct(xi,t))return t;let n=e.engine;if(xt(n)){let i=String(n.__call);if(i.includes("postgres")||i.includes("auroraPostgres"))return"postgresql";if(i.includes("mysql")||i.includes("auroraMysql"))return"mysql"}}Li(YT,"extractDatabaseEngine");function XT(e){let t=e.engine;if(xt(t))return String(t.__call)}Li(XT,"extractEngineExpression");var qU=new Set(["type","databaseName","databaseEngine","engine","vpc","port","deletionProtection","instanceType","multiAz","publiclyAccessible","enableSecretRotation","encryption","databaseInsights","proxy","readReplica","credentials","writer","readers","backupRetention","preferredMaintenanceWindow","primaryRegion","secondaryRegions","globalClusterIdentifier","enableGlobalWriteForwarding","snapshotIdentifier","allocatedStorage","monitoringInterval","snapshotUsername"]);function JT(e,t,n){if(n.arguments.length<2)return null;let i=n.arguments[0],r=n.arguments[1];if(!ar.isStringLiteral(i)&&!ar.isTemplateExpression(i))return null;let o=ar.isStringLiteral(i)?i.text:gl(e,i);if(!ar.isObjectLiteralExpression(r))return null;let a=B(r),c={resourceName:o,type:b(a.type)??"",databaseName:b(a.databaseName)??"",databaseEngine:YT(a),engineExpression:XT(a),port:R(a.port),deletionProtection:j(a.deletionProtection),instanceType:b(a.instanceType),multiAz:j(a.multiAz),publiclyAccessible:j(a.publiclyAccessible),enableSecretRotation:j(a.enableSecretRotation),encryption:Ce(a.encryption,mt()),databaseInsights:ir(a.databaseInsights,mt()),proxy:ir(a.proxy,mt()),readReplica:ir(a.readReplica,mt()),credentials:Ce(a.credentials,mt()),writer:Ce(a.writer,mt()),readers:ir(a.readers,mt()),backupRetention:R(a.backupRetention),preferredMaintenanceWindow:b(a.preferredMaintenanceWindow),primaryRegion:b(a.primaryRegion),secondaryRegions:ue(a.secondaryRegions),globalClusterIdentifier:b(a.globalClusterIdentifier),enableGlobalWriteForwarding:j(a.enableGlobalWriteForwarding),allocatedStorage:R(a.allocatedStorage),monitoringInterval:R(a.monitoringInterval),snapshotIdentifier:b(a.snapshotIdentifier),snapshotUsername:b(a.snapshotUsername),node:t},u=tt(t);u&&(c.variableName=u);let l=ce(a,qU);return l.length>0&&(c.extraProperties=l),c}Li(JT,"extractDatabaseResource");function Ab(e){return Pe(e,t=>{if(!ar.isCallExpression(t)||!xe(t,"addDatabase"))return null;let n=t.arguments[0];return Ue(n,"DatabaseFactory")?JT(e,t,n):null})}Li(Ab,"findDatabaseResources");function Ib(e){let t=[],n=[],i=[];for(let r of e)if(r.type==="DynamoDB"){let o=Eb(r);o&&n.push(o)}else if(r.type==="ClickHouse"){let o=xb(r);o&&i.push(o)}else t.push(r);return{databases:t,dynamodb:n,clickhouse:i}}Li(Ib,"splitDatabaseResources");var KU=["Instance","Aurora","GlobalAurora"];function $b(e){return e.filter(t=>t.type!=="DynamoDB").map(t=>({name:t.resourceName,type:ct(KU,t.type)?t.type:"Instance",databaseName:t.databaseName,...qe({port:t.port,deletionProtection:t.deletionProtection,instanceType:t.instanceType,multiAz:t.multiAz,publiclyAccessible:t.publiclyAccessible,enableSecretRotation:t.enableSecretRotation,encryption:t.encryption,databaseInsights:t.databaseInsights,proxy:t.proxy,readReplica:t.readReplica,credentials:t.credentials,writer:t.writer,readers:t.readers,backupRetention:t.backupRetention,preferredMaintenanceWindow:t.preferredMaintenanceWindow,primaryRegion:t.primaryRegion,secondaryRegions:t.secondaryRegions,globalClusterIdentifier:t.globalClusterIdentifier,enableGlobalWriteForwarding:t.enableGlobalWriteForwarding,allocatedStorage:t.allocatedStorage,monitoringInterval:t.monitoringInterval,variableName:t.variableName,databaseEngine:t.databaseEngine,engineExpression:t.engineExpression,extraProperties:t.extraProperties})}))}Li($b,"convertDatabaseResources");import*as Fi from"typescript";var YU=Object.defineProperty,Ui=(e,t)=>YU(e,"name",{value:t,configurable:!0});function QT(e,t){if(t.arguments.length<2)return null;let n=t.arguments[0],i=t.arguments[1];if(!Fi.isStringLiteral(n)||!Fi.isObjectLiteralExpression(i))return null;let r=B(i),o={resourceName:n.text,queueType:b(r.queueType)??"standard",visibilityTimeout:R(r.visibilityTimeout),retentionPeriod:R(r.messageRetentionPeriod),contentBasedDeduplication:j(r.contentBasedDeduplication),removalPolicy:b(r.removalPolicy),node:e},a=tt(e);a&&(o.variableName=a);let c=ce(r,new Set(["type","queueType","visibilityTimeout","messageRetentionPeriod","contentBasedDeduplication","removalPolicy"]));return c.length>0&&(o.extraProperties=c),o}Ui(QT,"extractSQSResource");function Tb(e){if(e!=null){if(e===!1)return!1;if(P(e))return qe({enabled:j(e.enabled),maxReceiveCount:R(e.maxReceiveCount)})}}Ui(Tb,"parseDeadLetterQueueConfig");function Rb(e){return Pe(e,t=>{if(!Fi.isCallExpression(t)||!xe(t,"addMessaging"))return null;let n=t.arguments[0];return Ue(n,"MessagingFactory")?QT(t,n):null})}Ui(Rb,"findSQSResources");function Pb(e){if(e.length!==0)return e.map(t=>({name:t.resourceName,queueType:t.queueType==="fifo"?"fifo":"standard",...qe({visibilityTimeout:t.visibilityTimeout,retentionPeriod:t.retentionPeriod,contentBasedDeduplication:t.contentBasedDeduplication,removalPolicy:t0(t.removalPolicy),variableName:t.variableName,extraProperties:t.extraProperties})}))}Ui(Pb,"convertSQSResources");var XU=new Set(Cv.options);function e0(e){return XU.has(e)}Ui(e0,"isSqsRemovalPolicy");function t0(e){return e!==void 0&&e0(e)?e:void 0}Ui(t0,"toSqsRemovalPolicy");import*as Bi from"typescript";var JU=Object.defineProperty,Fa=(e,t)=>JU(e,"name",{value:t,configurable:!0});function n0(e){if(e.arguments.length<2)return null;let t=e.arguments[0],n=e.arguments[1];return!Bi.isStringLiteral(t)||!Bi.isObjectLiteralExpression(n)?null:{resourceName:t.text,config:B(n),node:e}}Fa(n0,"extractCDNResource");function i0(e,t,n){let i=t.find(o=>o.variableName===e);if(i)return i.resourceName;let r=n.find(o=>o.variableName===e||o.resourceName.charAt(0).toLowerCase()+o.resourceName.slice(1)===e);return r?r.resourceName:e}Fa(i0,"resolveOriginIdentifier");var r0=["CACHING_OPTIMIZED","CACHING_DISABLED"];function Cb(e){return et(e,t=>{if(!Bi.isCallExpression(t)||!xe(t,"addCdn"))return;let n=t.arguments[0];if(Ue(n,"CdnFactory"))return n0(n)??void 0})}Fa(Cb,"findCDNResource");function Nb(e,t,n){if(!e)return;let i=e,r=i.config,o=Fa(p=>nr(p)?i0(p.__identifier,t,n):b(p)??"","resolveOrigin"),a=o(r.origin),c={name:i.resourceName,defaultOriginRef:a};if(Array.isArray(r.behaviours)){let p=r.behaviours.filter(P).map(g=>({pathPattern:b(g.pathPattern)??"",originRef:o(g.origin),...U(g.cachePolicy,r0)!==void 0&&{cachePolicy:U(g.cachePolicy,r0)}}));p.length>0&&(c.behaviours=p)}let u=b(r.customDomain);if(u)c.customDomain=u;else{let p=ue(r.domainNames);p&&p.length>0&&(c.customDomain=p[0])}let l=b(r.certificateArn);if(l&&(c.certificateArn=l),r.accessGate!==void 0){if(r.accessGate===!1)c.accessGate=!1;else if(P(r.accessGate)){let p=r.accessGate,g=b(p.type),v=b(p.username),A=b(p.password);g==="basic-auth"&&v&&A&&(c.accessGate={type:"basic-auth",username:v,password:A})}}let m=ce(r,new Set(["originType","origin","behaviours","customDomain","domainNames","certificateArn","accessGate"]));return m.length>0&&(c.extraProperties=m),c}Fa(Nb,"convertCDNResource");import*as de from"typescript";var QU=Object.defineProperty,nt=(e,t)=>QU(e,"name",{value:t,configurable:!0}),e4=new Set(Rv.options);function o0(e){if(e!==void 0)return e4.has(e)?e:void 0}nt(o0,"asFlowLogDestination");function wb(e){return{maxAzs:R(e.maxAzs),natGateways:ir(e.natGateways,t=>({count:R(t.count)})),flowLogs:ir(e.flowLogs,t=>({destination:b(t.destination),retentionDays:R(t.retentionDays)})),vpcEndpoints:P(e.vpcEndpoints)?e.vpcEndpoints:void 0}}nt(wb,"parseNetworkConfigFields");function a0(e,t){if(t.arguments.length<2)return null;let n=t.arguments[0],i=t.arguments[1];if(!de.isStringLiteral(n))return null;let r=n.text,o=de.isObjectLiteralExpression(i)?B(i):{},a=wb(o),c={name:r,config:qe({...a}),node:e},u=tt(e);return u&&(c.variableName=u),c}nt(a0,"extractNetworkResource");function kb(e){return et(e,t=>{if(!zt(t)||t.arguments.length<=1)return;let n=t.arguments[1];if(de.isObjectLiteralExpression(n)){for(let i of n.properties)if(Nr(i,"network")&&de.isObjectLiteralExpression(i.initializer)){for(let r of i.initializer.properties)if(Nr(r,"useExisting")&&de.isStringLiteral(r.initializer))return r.initializer.text}}})}nt(kb,"findVpcId");function Ob(e){return et(e,t=>{if(!zt(t)||t.arguments.length<=1)return;let n=t.arguments[1];if(de.isObjectLiteralExpression(n)){for(let i of n.properties)if(Nr(i,"network")){if(i.initializer.kind===de.SyntaxKind.FalseKeyword)return;if(de.isObjectLiteralExpression(i.initializer)&&!i.initializer.properties.some(r=>Nr(r,"useExisting"))){let r=B(i.initializer);return wb(r)}}}})}nt(Ob,"findNetworkConfig");function Db(e){return et(e,t=>{if(!zt(t)||t.arguments.length<=1)return;let n=t.arguments[1];if(de.isObjectLiteralExpression(n)){for(let i of n.properties)if(Nr(i,"backup")){if(i.initializer.kind===de.SyntaxKind.FalseKeyword)return!1;if(de.isObjectLiteralExpression(i.initializer)){let r=B(i.initializer),o=b(r.tier);if(o)return{tier:o}}}}})}nt(Db,"findBackupConfig");function Mb(e){return et(e,t=>{if(!zt(t)||t.arguments.length<=1)return;let n=t.arguments[1];if(de.isObjectLiteralExpression(n)){for(let i of n.properties)if(Nr(i,"tunnel")){if(i.initializer.kind===de.SyntaxKind.FalseKeyword)return!1;if(i.initializer.kind===de.SyntaxKind.TrueKeyword)return!0;if(de.isObjectLiteralExpression(i.initializer)){let r=B(i.initializer),o=b(r.instanceType);return o?{instanceType:o}:{}}}}})}nt(Mb,"findTunnelConfig");function jb(e){return Pe(e,t=>{if(!de.isCallExpression(t)||!xe(t,"addNetwork"))return null;let n=t.arguments[0];return Ue(n,"NetworkFactory")?a0(t,n):null})}nt(jb,"findNetworkResources");function zb(e){let t=e.flowLogs;return{...qe({maxAzs:e.maxAzs,natGateways:e.natGateways,vpcEndpoints:e.vpcEndpoints}),...t!==void 0&&{flowLogs:t===!1?!1:qe({destination:o0(t.destination),retentionDays:t.retentionDays})}}}nt(zb,"buildNetworkFields");function Lb(e){if(e)return zb(e)}nt(Lb,"convertNetworkConfig");function Ub(e){if(e===void 0)return;if(e===!1)return!1;let t=e.tier;if(ct(_t,t))return{tier:t}}nt(Ub,"convertBackupConfig");function Fb(e){if(e===void 0)return;if(e===!1)return!1;if(e===!0)return{};let t={};return e.instanceType&&(t.instanceType=e.instanceType),t}nt(Fb,"convertTunnelConfig");function Bb(e){if(!(!e||e.length===0))return e.map(t=>({name:t.name,...zb(t.config)}))}nt(Bb,"convertAdditionalNetworks");import*as Vi from"typescript";var t4=Object.defineProperty,be=(e,t)=>t4(e,"name",{value:t,configurable:!0}),r4=["Instance","Aurora"],n4=["postgresql","mysql"];function Al(e){if(!P(e))return;let t={...e.memorySize!==void 0&&{memorySize:R(e.memorySize)},...e.timeout!==void 0&&{timeout:R(e.timeout)},...e.ephemeralStorageSize!==void 0&&{ephemeralStorageSize:R(e.ephemeralStorageSize)}};return Object.keys(t).length>0?t:void 0}be(Al,"parseLambdaConfig");function s0(e){return pt(e,"database",t=>({type:U(t.type,r4),databaseName:b(t.databaseName),databaseEngine:U(t.databaseEngine,n4),deletionProtection:j(t.deletionProtection),backupRetention:R(t.backupRetention),port:R(t.port),publiclyAccessible:j(t.publiclyAccessible),allowedIpCidr:b(t.allowedIpCidr),instanceType:b(t.instanceType),allocatedStorage:R(t.allocatedStorage),multiAz:j(t.multiAz),allowVpcAccess:j(t.allowVpcAccess),monitoringInterval:R(t.monitoringInterval),preferredMaintenanceWindow:b(t.preferredMaintenanceWindow),snapshotIdentifier:b(t.snapshotIdentifier),snapshotUsername:b(t.snapshotUsername),readReplica:Mi(t.readReplica),writer:Ce(t.writer,mt()),readers:Mi(t.readers),databaseInsights:Mi(t.databaseInsights),proxy:Mi(t.proxy),credentials:Ce(t.credentials,mt()),encryption:Ce(t.encryption,mt())}))}be(s0,"extractPatternDatabaseConfig");function c0(e){return pt(e,"compute",t=>({server:Ce(t.server,Al),imageOptimisation:Ce(t.imageOptimisation,Al),revalidation:Ce(t.revalidation,Al)}))}be(c0,"extractPatternComputeConfig");function u0(e){let t=be(n=>({versioned:j(n.versioned)}),"parseVersionedConfig");return pt(e,"storage",n=>({assets:Ce(n.assets,t),cache:Ce(n.cache,t),media:Ce(n.media,t)}))}be(u0,"extractPatternStorageConfig");function l0(e){return pt(e,"messaging",t=>({revalidationQueue:Ce(t.revalidationQueue,n=>({visibilityTimeout:R(n.visibilityTimeout),messageRetentionPeriod:R(n.messageRetentionPeriod),maxMessageSize:R(n.maxMessageSize),deadLetterQueue:Tb(n.deadLetterQueue)}))}))}be(l0,"extractPatternMessagingConfig");function d0(e){return pt(e,"cdn",t=>({domainNames:ue(t.domainNames),certificateArn:b(t.certificateArn)}))}be(d0,"extractPatternCdnConfig");function m0(e){return pt(e,"environment",t=>{let n=Object.fromEntries(Object.entries(t).filter(i=>typeof i[1]=="string"));return Object.keys(n).length>0?n:void 0})}be(m0,"extractPatternEnvironmentConfig");function p0(e,t){let n=f0(e);return{name:t,source:b(e.source),build:pt(e,"build",i=>({command:b(i.command),outputDir:b(i.outputDir)})),routing:U(e.routing,Vo),security:pt(e,"security",i=>({headers:j(i.headers),contentSecurityPolicy:b(i.contentSecurityPolicy)})),domain:b(e.domain),forms:pt(e,"forms",i=>({to:b(i.to),from:b(i.from),corsOrigin:b(i.corsOrigin),maxConcurrency:R(i.maxConcurrency)})),cdn:pt(e,"cdn",i=>({behaviours:Array.isArray(i.behaviours)?i.behaviours:void 0})),...n.length>0&&{unreadableFields:n}}}be(p0,"extractStaticSiteConfig");function Vb(e){return dt(e)&&("__identifier"in e||"__expression"in e||"__call"in e||"__unknown"in e)}be(Vb,"isUnreadableRef");function f0(e){let t=[],n=be((r,o)=>{Vb(r)&&t.push(o)},"check");n(e.source,"source"),n(e.routing,"routing"),n(e.domain,"domain");let i=[[e.build,"build",["command","outputDir"]],[e.security,"security",["headers","contentSecurityPolicy"]],[e.forms,"forms",["to","from","corsOrigin","maxConcurrency"]],[e.cdn,"cdn",["behaviours"]]];for(let[r,o,a]of i)if(Vb(r))t.push(o);else if(P(r))for(let c of a)n(r[c],`${o}.${c}`);return t}be(f0,"collectUnreadableStaticSiteFields");function wr(e){return e!==void 0&&e!==""}be(wr,"isReadable");function Il(e,t){return new Error(`Static-site pattern '${e}' in infrastructure.ts: Fjall could not read ${t.join(", ")} as inline literal(s). Fjall reads these fields out of the file and writes them back, so they must be written inline (source: "./site"), not as a variable or an expression.`)}be(Il,"unreadableStaticSiteFields");function g0(e,t){let n=t.to;if(!wr(n))throw Il(e,["forms.to"]);return{to:n,...t.from!==void 0&&{from:t.from},...t.corsOrigin!==void 0&&{corsOrigin:t.corsOrigin},...t.maxConcurrency!==void 0&&{maxConcurrency:t.maxConcurrency}}}be(g0,"readStaticSiteForms");function h0(e,t){if(e.arguments.length<2)return null;let n=e.arguments[0],i=e.arguments[1];if(!Vi.isStringLiteral(n)||!Vi.isObjectLiteralExpression(i))return null;let r=n.text,o=B(i),a=o.type,c=tt(t),u=b(o.name);return u?a==="payload"||a==="nextjs"?{variableName:c,constructId:r,type:a,config:{name:u,domain:b(o.domain),database:s0(o),compute:c0(o),storage:u0(o),messaging:l0(o),cdn:d0(o),environment:m0(o)},node:e}:a==="staticsite"?{variableName:c,constructId:r,type:"staticsite",config:p0(o,u),node:e}:null:null}be(h0,"extractPatternResource");function Zb(e){return Pe(e,t=>{if(!Vi.isCallExpression(t)||!xe(t,"addPattern"))return null;let n=t.arguments[0];return Ue(n,"PatternFactory")?h0(n,t):null})}be(Zb,"findPatternResources");function Gb(e,t){if(!t||t.length===0)return;let n=t[0];if(e.pattern=n.type,n.type==="staticsite"){let{config:r}=n,o=r.source,a=r.build?.command,c=r.build?.outputDir;if(r.unreadableFields!==void 0)throw Il(r.name,r.unreadableFields);if(!wr(o)||!wr(a)||!wr(c)){let u=[];throw wr(o)||u.push("source"),wr(a)||u.push("build.command"),wr(c)||u.push("build.outputDir"),Il(r.name,u)}e.patternConfig={type:"staticsite",name:r.name,source:o,build:{command:a,outputDir:c},routing:r.routing,security:r.security,domain:r.domain,...r.forms!==void 0&&{forms:g0(r.name,r.forms)},cdn:r.cdn};return}let{config:i}=n;e.patternConfig={type:n.type,name:i.name,domain:i.domain,database:i.database,compute:i.compute,storage:i.storage,messaging:i.messaging,cdn:i.cdn,environment:i.environment}}be(Gb,"applyPatternConfig");var i4=Object.defineProperty,$l=(e,t)=>i4(e,"name",{value:t,configurable:!0});function v0(e,t){for(let n of t){let i=e.compute.find(r=>r.variableName===n.targetVariableName);i!==void 0&&i.type==="lambda"&&(i.scheduleExpression=n.schedule)}}$l(v0,"applyScheduleBackfill");function b0(e,t){Object.keys(t).length>0&&(e.tags={...t}),t[Ra]&&(e.owner=t[Ra])}$l(b0,"applyTagsAndOwner");function y0(e){let t=[];for(let n of e)if(_l(n.moduleSpecifier))if(n.moduleSpecifier==="@fjall/components-infrastructure"||n.moduleSpecifier==="@fjall/infrastructure"){let i=n.namedImports.filter(r=>!UT.has(r));i.length>0&&t.push({moduleSpecifier:n.moduleSpecifier,namedImports:i,defaultImport:n.defaultImport})}else(n.namedImports.length>0||n.defaultImport)&&t.push(n);return t.length>0?t:void 0}$l(y0,"computeAdditionalManagedImports");function Sn(e,t,n){let i={appName:t,type:"standard",database:[],s3:[],compute:[]};if(Gb(i,e.patternResources),e.vpcId&&(i.vpcId=e.vpcId),i.network=Lb(e.network),i.backup=Ub(e.backup),i.tunnel=Fb(e.tunnel),i.additionalNetworks=Bb(e.networkResources),b0(i,e.tags),i.database=$b(e.databaseResources),i.dynamodb=El(e.dynamodbResources),i.clickhouse=xl(e.clickhouseResources),i.sqs=Pb(e.sqsResources),i.cdn=Nb(e.cdnResource,e.s3Resources,e.computeResources),i.s3=vb(e.s3Resources),i.compute=pb(e.computeResources,e.databaseResources,e.s3Resources,i),v0(i,e.schedules),i.additionalManagedImports=y0(e.imports),n?.skipValidation)return i;try{return B$.parse(i)}catch(r){if(r instanceof s.ZodError){let o=sa(r);throw new Error(`Invalid infrastructure configuration:
431
+ ${o}`)}throw r}}$l(Sn,"convertToResourcePlan");var o4=Object.defineProperty,Zi=(e,t)=>o4(e,"name",{value:t,configurable:!0});function kr(e,t){let n=W.createSourceFile("infrastructure.ts",e,W.ScriptTarget.Latest,!0,W.ScriptKind.TS),i=S0(n),{appVariableName:r,appName:o}=E0(n),a=kb(n),c=Ob(n),u=Db(n),l=Mb(n),m=jb(n),p=Ab(n),{databases:g,dynamodb:v,clickhouse:A}=Ib(p),Y=Rb(n),z=Cb(n),Se=[...gb(n),...hb(n)],fr=bl(n),we=Sl(n),te=Zb(n),pe=x0(n),$n={sourceFile:n,imports:i,appVariableName:r,appName:o,vpcId:a,network:c,backup:u,tunnel:l,networkResources:m,databaseResources:g,dynamodbResources:v,clickhouseResources:A,sqsResources:Y,cdnResource:z,s3Resources:Se,computeResources:fr,schedules:we,patternResources:te,tags:pe};return t?.extractCustomCode&&($n.customCodeBlocks=ja(n),$n.classifiedStatements=Ke(n)),$n}Zi(kr,"parseInfrastructure");function S0(e){let t=[];return W.forEachChild(e,n=>{if(W.isImportDeclaration(n)){if(!W.isStringLiteral(n.moduleSpecifier))return;let i={moduleSpecifier:n.moduleSpecifier.text,namedImports:[]};n.importClause&&(n.importClause.name&&(i.defaultImport=n.importClause.name.text),n.importClause.namedBindings&&W.isNamedImports(n.importClause.namedBindings)&&(i.namedImports=n.importClause.namedBindings.elements.map(r=>r.name.text))),t.push(i)}}),t}Zi(S0,"extractImports");function _0(e,t){return W.isStringLiteral(t)?t.text:W.isIdentifier(t)?wa(e,t.text)??"":W.isPropertyAccessExpression(t)?ka(e,t)??"":""}Zi(_0,"resolveAppName");function E0(e){return et(e,t=>{if(W.isVariableStatement(t))for(let n of t.declarationList.declarations){if(!n.initializer||!zt(n.initializer))continue;let i=W.isIdentifier(n.name)?n.name.text:"",r=n.initializer.arguments.length>0?_0(e,n.initializer.arguments[0]):"";return{appVariableName:i,appName:r}}})??{appVariableName:"",appName:""}}Zi(E0,"findAppVariable");function x0(e){let t={};function n(i){if(W.isCallExpression(i)&&W.isPropertyAccessExpression(i.expression)&&i.expression.name.text==="addTags"&&W.isIdentifier(i.expression.expression)&&i.arguments.length>0){let r=i.arguments[0];if(W.isObjectLiteralExpression(r)){let o=B(r);for(let[a,c]of Object.entries(o))typeof c=="string"?t[a]=c:Cr(c)&&(t[a]="default-value")}}W.forEachChild(i,n)}return Zi(n,"visit"),n(e),t}Zi(x0,"extractTags");import*as Gi from"typescript";var a4=Object.defineProperty,Ae=(e,t)=>a4(e,"name",{value:t,configurable:!0});function Wi(e,t,n){return e.slice(0,t)+n+e.slice(t)}Ae(Wi,"insertAtPosition");function Tl(e,t){return e.find(n=>n.type===t)}Ae(Tl,"findClassification");function Wb(e,t){return e.filter(n=>n.type===t).pop()}Ae(Wb,"findLastClassification");function Or(e){return Gi.createSourceFile("infrastructure.ts",e,Gi.ScriptTarget.Latest,!0,Gi.ScriptKind.TS)}Ae(Or,"parseSourceFile");function Rl(e,t){return e.endsWith(`
432
432
 
433
433
  `)||t.startsWith(`
434
434
  `)?"":e.endsWith(`
@@ -439,17 +439,17 @@ ${o}`)}throw r}}$l(Sn,"convertToResourcePlan");var i4=Object.defineProperty,Zi=(
439
439
  `)?"":`
440
440
  `;return o+n+a}Ae($0,"formatCodeForInsertion");function T0(e,t){let{resourceType:n,resourceName:i,newCode:r}=t;try{let o=Or(e),a=Hb(o,e,n,i);if(qb(a))return a;let c=a,u=c.node.getFullStart(),l=c.endPos,m=e.slice(u,c.node.getStart()),p=R0(m);return{content:e.slice(0,u)+p+r+e.slice(l),success:!0}}catch(o){return Lt(o,e)}}Ae(T0,"updateResourceSurgically");function R0(e){let t=e.match(/^[\s]*[\n\r]+[\s]*/);return t?t[0]:""}Ae(R0,"extractLeadingWhitespace");function P0(e,t,n,i){let r=e,o=0;for(let a of t){let c=`// [ORPHANED: was after ${Dr(n,i)}]
441
441
  `,u=a.sourceText.trim(),l=r.indexOf(u,o);l!==-1&&(r=Wi(r,l,c),o=l+c.length+u.length)}return r}Ae(P0,"insertOrphanMarkers");function C0(e,t){let{resourceType:n,resourceName:i,orphanHandling:r}=t,o=[];try{let a=Or(e),c=Hb(a,e,n,i);if(qb(c))return c;let u=c,l=(kr(e,{extractCustomCode:!0}).customCodeBlocks??[]).filter(A=>A.position==="after-resource"&&A.afterManagedResource?.type===n&&A.afterManagedResource?.name===i);if(l.length>0)if(r==="preserve-with-warning")o.push(`Custom code after ${Dr(n,i)} will be orphaned. Added // [ORPHANED] marker comment.`);else return Lt(new Error(`Orphan handling "${r}" is not yet implemented`),e);let m=u.node.getFullStart(),p=u.endPos,g=e[p]===`
442
- `?p+1:p,v=e.slice(0,m)+e.slice(g);return l.length>0&&r==="preserve-with-warning"&&(v=P0(v,l,n,i)),{content:v,success:!0,warnings:o.length>0?o:void 0}}catch(a){return Lt(a,e)}}Ae(C0,"removeResourceSurgically");import*as _n from"typescript";var a4=Object.defineProperty,gt=(e,t)=>a4(e,"name",{value:t,configurable:!0});function O0(e,t){try{let n=Or(e),i=new Set;for(let c of n.statements)_n.isImportDeclaration(c)&&i.add(c.getText(n).trim());let r=[];for(let c of t){let u=c.trim();[...i].some(l=>M0(l,u))||r.push(u)}if(r.length===0)return{content:e,success:!0};let o=n.statements.filter(_n.isImportDeclaration).at(-1)?.getEnd()??0,a=`
442
+ `?p+1:p,v=e.slice(0,m)+e.slice(g);return l.length>0&&r==="preserve-with-warning"&&(v=P0(v,l,n,i)),{content:v,success:!0,warnings:o.length>0?o:void 0}}catch(a){return Lt(a,e)}}Ae(C0,"removeResourceSurgically");import*as _n from"typescript";var s4=Object.defineProperty,gt=(e,t)=>s4(e,"name",{value:t,configurable:!0});function O0(e,t){try{let n=Or(e),i=new Set;for(let c of n.statements)_n.isImportDeclaration(c)&&i.add(c.getText(n).trim());let r=[];for(let c of t){let u=c.trim();[...i].some(l=>M0(l,u))||r.push(u)}if(r.length===0)return{content:e,success:!0};let o=n.statements.filter(_n.isImportDeclaration).at(-1)?.getEnd()??0,a=`
443
443
  `+r.join(`
444
444
  `);return{content:Wi(e,o,a),success:!0}}catch(n){return Lt(n,e)}}gt(O0,"ensureImports");function Kb(e){return new Set(e.split(",").map(t=>t.trim()).filter(Boolean))}gt(Kb,"parseNamedImports");function D0(e,t){let n=Kb(e),i=Kb(t);for(let r of i)if(!n.has(r))return!1;return!0}gt(D0,"existingImportCoversRequired");function M0(e,t){let n=e.match(N0),i=t.match(N0);if(!n||!i||n[1]!==i[1])return!1;let r=e.match(w0),o=t.match(w0);return r&&o?D0(r[1],o[1]):!!r==!!o}gt(M0,"importsAreEquivalent");var N0=/from\s+["']([^"']+)["']/,w0=/\{([^}]+)\}/,k0={"before-imports":0,"after-imports":1,"after-app-init":2,"after-tags":3,"after-resource":4,"end-of-file":5};function j0(e){return[...e].sort((t,n)=>{let i=k0[n.position]-k0[t.position];return i!==0?i:(n.originalLine??0)-(t.originalLine??0)})}gt(j0,"sortCustomBlocksForInsertion");function z0(e,t,n,i){if(n!==null){let o=F0(e,n,t);return Wi(e,n,o)}let r=t.afterManagedResource?`// [ORPHANED: was after ${Dr(t.afterManagedResource.type,t.afterManagedResource.name)}]
445
445
  `:`// [ORPHANED]
446
446
  `;return i.push(`Custom code from line ${t.originalLine} could not be positioned. Added at end of file.`),e+`
447
447
  `+r+t.sourceText}gt(z0,"insertOrOrphanBlock");function Cl(e,t,n){if(!t||t.length===0)return{content:e,success:!0};try{let i=Or(e),r=Ke(i),o=[],a=j0(t),c=e;for(let u of a){let l=U0(i,r,u,n,o);c=z0(c,u,l,o)}return{content:c,success:!0,warnings:o.length>0?o:void 0}}catch(i){return Lt(i,e)}}gt(Cl,"injectCustomCodeBlocks");function L0(e,t,n,i){if(!t.afterManagedResource)return null;let r=t.afterManagedResource,o=(r.name&&n?.get(r.name))??r.name,a=e.find(u=>u.type===r.type&&u.resourceName===o);if(a)return a.endPos;let c=e.filter(u=>u.type===r.type&&u.isManaged);return c.length===1?c[0].endPos:(i&&i.push(`Resource ${Dr(t.afterManagedResource.type,t.afterManagedResource.name)} not found. Custom code may be orphaned.`),null)}gt(L0,"findAfterResourcePosition");function U0(e,t,n,i,r){switch(n.position){case"before-imports":return 0;case"after-imports":return Wb(t,"import")?.endPos??0;case"after-app-init":return Tl(t,"app-init")?.endPos??null;case"after-tags":return Tl(t,"tags")?.endPos??null;case"after-resource":return L0(t,n,i,r);case"end-of-file":return e.getEnd();default:return null}}gt(U0,"findCustomCodeInsertPosition");function F0(e,t,n){let i=Pl(e,t),r=n.sourceText;return r=Rl(i,r)+r,r.endsWith(`
448
448
  `)||(r+=`
449
- `),r}gt(F0,"formatCustomCodeForInsertion");function B0(e){try{let t=function(r){r.kind===_n.SyntaxKind.Unknown&&i.push("Unknown node found in AST - possible parse error"),_n.forEachChild(r,t)};gt(t,"visit");let n=Or(e),i=[];return t(n),i.length>0?{valid:!1,errors:i}:{valid:!0}}catch(t){return{valid:!1,errors:[Rt(t)]}}}gt(B0,"validateModifiedFile");import*as Ie from"typescript";var Ba=s.enum(["A","AAAA","CNAME","MX","TXT","NS","SRV","CAA"]),s4=s.object({name:s.string(),type:Ba,ttl:s.number().optional(),value:s.string(),priority:s.number().optional(),weight:s.number().optional(),port:s.number().optional()}).strict(),c4=s.object({subdomain:s.string(),targetAccount:s.string(),auto:s.boolean()}).strict(),u4=s.object({domainName:s.string(),subjectAlternativeNames:s.array(s.string())}).strict(),JK=s.object({origin:s.string(),ttl:s.number(),records:s.array(s4),delegations:s.array(c4),certificates:s.array(u4)}).strict(),Ut=Object.freeze({ORIGIN:"$ORIGIN",TTL:"$TTL",FJALL_DELEGATE:"$FJALL-DELEGATE",FJALL_CERT:"$FJALL-CERT"}),Nl="ALIAS ";var V0=s.discriminatedUnion("kind",[s.object({kind:s.literal("ecs"),appName:s.string()}).strict(),s.object({kind:s.literal("cdn"),appName:s.string()}).strict(),s.object({kind:s.literal("bucket"),bucketName:s.string()}).strict(),s.object({kind:s.literal("custom"),dnsName:s.string(),hostedZoneId:s.string()}).strict()]),Z0=V0.options.map(e=>e.shape.kind.value),Yb=s.enum(["A","AAAA"]),Xb=s.enum(["route53","external-delegated","external-records"]),G0=s.enum(["zone","full"]),l4=s.object({kind:s.literal("standard"),type:s.enum(["A","AAAA","CNAME","MX","TXT","NS","SRV","CAA"]),name:s.string(),value:s.union([s.string(),s.array(s.string())]),ttl:s.number().int().positive().optional()}).strict(),d4=s.object({kind:s.literal("alias"),type:Yb,name:s.string(),target:V0}).strict(),m4=s.discriminatedUnion("kind",[l4,d4]),p4=s.object({domainName:s.string(),subjectAlternativeNames:s.array(s.string()).optional(),transparencyLogging:s.boolean().optional(),cloudFront:s.boolean().optional()}).strict(),f4=s.object({subdomain:s.string(),toAccount:s.string(),auto:s.boolean().optional()}).strict(),tY=s.object({zoneName:s.string(),registrar:Xb,hostedZoneId:s.string().optional(),delegatedSubdomain:s.string().optional(),adoptedNameServers:s.array(s.string().min(1)).min(1).optional(),records:s.array(m4),certificates:s.array(p4),delegations:s.array(f4)}).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 g4=Object.defineProperty,me=(e,t)=>g4(e,"name",{value:t,configurable:!0}),H0=Xb.options,W0=G0.options,h4=Ba.options,v4=Yb.options;function q0(e){let t=[],n=me(r=>{if(Ie.isNewExpression(r)&&K0(r.expression)){let o=Y0(r);o!==void 0&&t.push(o)}Ie.forEachChild(r,n)},"visit");if(n(e),t.length===0)return C(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?C(i):C(void 0)}me(q0,"findDomainConstructCall");function K0(e){return Ie.isIdentifier(e)&&e.text==="Domain"}me(K0,"isDomainIdentifier");function Y0(e){let t=e.arguments;if(!t||t.length<3)return;let n=t[0],i=t[1],r=t[2];if(!n||!i||!r||!Ie.isObjectLiteralExpression(r))return;let o=X0(e);if(o===void 0)return;let a=J0(e),c=Ie.isStringLiteral(i)?i.text:void 0;return{callExpression:e,containingStatement:o,propsObjectLiteral:r,domainVarId:a,scopeArgumentText:n.getText(),constructIdLiteral:c}}me(Y0,"buildMatch");function X0(e){let t=e;for(;t!==void 0;){if(Ie.isExpressionStatement(t)||Ie.isVariableStatement(t))return t;t=t.parent}}me(X0,"findContainingTopLevelStatement");function J0(e){let t=e.parent;for(;t!==void 0;){if(Ie.isVariableDeclaration(t)&&Ie.isIdentifier(t.name)&&t.initializer===e)return t.name.text;t=t.parent}}me(J0,"extractDomainVarId");function Q0(e){switch(e.kind){case"registrar_required":return"'registrar' property is required";case"registrar_unsupported":return`'registrar' must be one of ${H0.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}`}}me(Q0,"errorMessage");var b4="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 eR(e){let t=B(e),n=U(t.registrar,H0);if(n===void 0){let c=t.registrar;if(c===void 0)return $({kind:"registrar_required"});let u=typeof c=="string"?c:kl(c);return $({kind:"registrar_unsupported",value:u})}let i=b(t.zoneName);if(i===void 0)return $({kind:"missing_field",field:"zoneName"});let r=rR(t.records);if(!r.success)return r;let o=sR(t.certificates);if(!o.success)return o;if(t.delegations!==void 0)return $({kind:"removed_field",field:"delegations",cure:b4});let a={zoneName:i,description:b(t.description),costAllocationEnvironment:b(t.costAllocationEnvironment),tags:cR(t.tags),records:r.data,certificates:o.data};switch(n){case"route53":return C({...a,registrar:n,hostedZoneId:b(t.hostedZoneId)});case"external-delegated":{let c=b(t.delegatedSubdomain);if(c===void 0)return $({kind:"missing_field",field:"delegatedSubdomain"});let u=b(t.hostedZoneId);if(t.hostedZoneId!==void 0&&u===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 l=ue(t.adoptedNameServers);if(t.adoptedNameServers!==void 0&&l===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(u===void 0!=(l===void 0))return $({kind:"invalid_literal",field:u===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 m=b(t.parentDelegationRoleArn);if(t.parentDelegationRoleArn!==void 0&&m===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 p=U(t.phase,W0);return t.phase!==void 0&&p===void 0?$({kind:"invalid_literal",field:"phase",reason:`must be one of ${W0.map(g=>`'${g}'`).join(", ")}`}):C({...a,registrar:n,delegatedSubdomain:c,hostedZoneId:u,adoptedNameServers:l,parentDelegationRoleArn:m,phase:p})}case"external-records":return C({...a,registrar:n})}}me(eR,"parseDomainProps");function tR(e){return Q0(e)}me(tR,"parseDomainErrorMessage");function rR(e){if(e===void 0)return C([]);if(!Array.isArray(e))return $({kind:"invalid_literal",field:"records",reason:"must be an array"});let t=[];for(let n=0;n<e.length;n++){let i=e[n];if(!P(i))return $({kind:"invalid_literal",field:`records[${n}]`,reason:"must be an object literal"});let r=nR(i,n);if(!r.success)return r;t.push(r.data)}return C(t)}me(rR,"parseRecordsArray");function nR(e,t){let n=b(e.type),i=b(e.name);if(n===void 0)return $({kind:"missing_field",field:`records[${t}].type`});if(i===void 0)return $({kind:"missing_field",field:`records[${t}].name`});if(e.target!==void 0){if(!v4.some(u=>u===n))return $({kind:"invalid_literal",field:`records[${t}]`,reason:`alias records must have type 'A' or 'AAAA', got '${n}'`});let c=oR(e.target);return C({kind:"alias",type:n,name:i,target:c})}if(!h4.some(c=>c===n))return $({kind:"invalid_literal",field:`records[${t}]`,reason:`unsupported record type '${n}'`});let r=iR(e.value);if(r===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=R(e.ttl),a={kind:"standard",type:n,name:i,value:r,...o!==void 0?{ttl:o}:{}};return C(a)}me(nR,"parseRecord");function iR(e){if(e===void 0)return;if(typeof e=="string")return e;let t=ue(e);if(t!==void 0)return t}me(iR,"parseRecordValue");function oR(e){if(xt(e))return aR(e);if(P(e)){let t=U(e.kind,Z0);if(t==="ecs"||t==="cdn"){let n=b(e.appName);if(n!==void 0)return{kind:t,appName:n}}if(t==="bucket"){let n=b(e.bucketName);if(n!==void 0)return{kind:t,bucketName:n}}if(t==="custom"){let n=b(e.dnsName),i=b(e.hostedZoneId);if(n!==void 0&&i!==void 0)return{kind:t,dnsName:n,hostedZoneId:i}}}return{kind:"unresolved",sourceText:kl(e)}}me(oR,"parseTarget");function aR(e){let t=e.__call.trim(),n=t.match(/^([A-Za-z_][\w$]*)\s*\(([\s\S]*)\)\s*$/);if(!n)return{kind:"unresolved",sourceText:t};let i=n[1],r=n[2]??"",o=wl(r);switch(i){case"fjallApp":{let a=En(o,0);return a===void 0?{kind:"dynamic",sourceText:t}:{kind:"ecs",appName:a}}case"fjallCdn":{let a=En(o,0);return a===void 0?{kind:"dynamic",sourceText:t}:{kind:"cdn",appName:a}}case"fjallBucket":{let a=En(o,0);return a===void 0?{kind:"dynamic",sourceText:t}:{kind:"bucket",bucketName:a}}case"aliasTo":{if(o.length>=2){let a=En(o,0),c=En(o,1);return a!==void 0&&c!==void 0?{kind:"custom",dnsName:a,hostedZoneId:c}:{kind:"dynamic",sourceText:t}}if(o.length===1){let a=o[0]?.trim()??"",c=Jb(a,"dnsName"),u=Jb(a,"hostedZoneId");return c!==void 0&&u!==void 0?{kind:"custom",dnsName:c,hostedZoneId:u}:{kind:"dynamic",sourceText:t}}return{kind:"unresolved",sourceText:t}}default:return{kind:"unresolved",sourceText:t}}}me(aR,"resolveCallRefTarget");function wl(e){let t=[],n=0,i=null,r="";for(let a=0;a<e.length;a++){let c=e[a];if(i!==null){if(r+=c,c==="\\"&&a+1<e.length){let u=e[a+1];u!==void 0&&(r+=u,a+=1);continue}c===i&&(i=null);continue}if(c==='"'||c==="'"||c==="`"){i=c,r+=c;continue}if(c==="("||c==="{"||c==="["){n+=1,r+=c;continue}if(c===")"||c==="}"||c==="]"){n-=1,r+=c;continue}if(c===","&&n===0){t.push(r.trim()),r="";continue}r+=c}let o=r.trim();return o.length>0&&t.push(o),t}me(wl,"splitTopLevelArgs");function En(e,t){let n=e[t];if(n===void 0)return;let i=n.trim();if(i.length<2)return;let r=i[0],o=i[i.length-1];if(r===o&&!(r!=='"'&&r!=="'"&&r!=="`"))return i.slice(1,-1)}me(En,"extractStringLiteralArg");function Jb(e,t){let n=e.trim().replace(/^\{|\}$/g,""),i=wl(n);for(let r of i){let o=r.indexOf(":");if(o<0||r.slice(0,o).trim().replace(/["'`]/g,"")!==t)continue;let a=r.slice(o+1).trim();return En([a],0)}}me(Jb,"extractObjectFieldString");function sR(e){if(e===void 0)return C([]);if(!Array.isArray(e))return $({kind:"invalid_literal",field:"certificates",reason:"must be an array"});let t=[];for(let n=0;n<e.length;n++){let i=e[n];if(typeof i=="string"){t.push({domainName:i});continue}if(!P(i))return $({kind:"invalid_literal",field:`certificates[${n}]`,reason:"must be a string or object literal"});let r=b(i.domainName);if(r===void 0)return $({kind:"missing_field",field:`certificates[${n}].domainName`});let o=ue(i.subjectAlternativeNames),a=j(i.transparencyLogging),c=j(i.cloudFront);if(i.cloudFront!==void 0&&c===void 0)return $({kind:"invalid_literal",field:`certificates[${n}].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:r,...o!==void 0?{subjectAlternativeNames:o}:{},...a!==void 0?{transparencyLogging:a}:{},...c!==void 0?{cloudFront:c}:{}})}return C(t)}me(sR,"parseCertificatesArray");function cR(e){if(e===void 0||!P(e))return;let t={};for(let[n,i]of Object.entries(e)){let r=b(i);r!==void 0&&(t[n]=r)}return Object.keys(t).length===0?void 0:t}me(cR,"parseStringRecord");function kl(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=>kl(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)}me(kl,"stringifyParsedValue");var y4=Object.defineProperty,Mr=(e,t)=>y4(e,"name",{value:t,configurable:!0});function uR(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(uR,"toUserServiceConfigs");function lR(e,t,n=!0,i,r){let o={appName:e,type:t,database:[],s3:[],compute:[]};if(t==="custom")return o;let a=t,c=rr[a];return{...o,database:dR(e,c,a,n,r),compute:gR(e,c,a,n,i),network:c.network,backup:c.backup}}Mr(lR,"planApplicationResources");function dR(e,t,n,i,r){let o=rb(n),a=t.database[o];return!i||a===null?[]:[{name:e,type:o,databaseName:Rn(e),variableName:`${er(e)}Database`,...a,...r?.snapshotIdentifier!==void 0&&{snapshotIdentifier:r.snapshotIdentifier},...r?.snapshotUsername!==void 0&&{snapshotUsername:r.snapshotUsername}}]}Mr(dR,"buildDatabasePlan");function mR(e,t){if(!(e===void 0&&t===void 0))return{scaling:{...e!==void 0&&{minCapacity:e},...t!==void 0&&{maxCapacity:t}}}}Mr(mR,"buildScalingConfig");function pR(e,t){let{minCapacity:n,maxCapacity:i,...r}=e,o=t?.serviceType==="worker",a=t?.containerPort??FI,c=t?.docker;return{...r,...c?.path!==void 0&&{docker:{path:c.path,...c.context!==void 0&&{context:c.context},...c.target!==void 0&&{target:c.target}}},...t?.needsDatabaseConnection!==void 0&&{needsDatabaseConnection:t.needsDatabaseConnection},containers:o?[{}]:[{port:a}],...mR(n,i)}}Mr(pR,"buildServiceEntry");function fR(e,t){return t||e?.directAccess===!0?e:{...e,loadBalancer:!1}}Mr(fR,"resolveClusterConfig");function gR(e,t,n,i,r){let o=t.compute.ecs,a=(r&&r.length>0?nb(n,r):o.services.map((u,l)=>({...u,name:l===0?"api":`service-${l+1}`}))).map((u,l)=>pR(u,r?.[l])),c=a.some(u=>u.containers?.some(l=>l.port!==void 0));return[{name:e,type:Ei.ECS,needsConnection:i,connectedDatabase:i?[e]:void 0,variableName:`${er(e)}Compute`,cluster:fR(o.cluster,c),services:a}]}Mr(gR,"buildComputePlan");function Hi(e,t){let n=[cl(e),sl(e),al(e)];if(dl(e))n.push(Ta(e),Pa(e));else{let r=ll(e);n.push(Pa(e),Xu(e),Ju(e),nl(e),il(e),ol(e),rl(e,r),ul(e))}let i=n.join("");if(e.customCodeBlocks&&e.customCodeBlocks.length>0){let r=Cl(i,e.customCodeBlocks,t?.resourceMapping);return r.success?C(r.content):$(new Error(`Custom code injection failed: ${r.error??"unknown error"}`))}return C(i)}Mr(Hi,"generateInfrastructureFromPlan");var S4=Object.defineProperty,qi=(e,t)=>S4(e,"name",{value:t,configurable:!0}),_4=tb("standard");function hR(e){return ma.options.some(t=>t.shape?.type?.value===e)}qi(hR,"isPatternConfigType");function vR(e,t,n){let{tier:i="standard",domain:r,database:o,compute:a,cdn:c,environment:u,tags:l}=n??{},m=pl(i);if(!m&&i!=="custom")return $(new Error(`Invalid pattern tier: "${i}". Valid tiers are: ${[...Na,"custom"].join(", ")}`));if(!hR(t))return $(new Error(`Unsupported pattern type: ${t}`));let p=m?ml(i):null,g=_R(t,e,{domain:r,database:o,compute:a,cdn:c,environment:u,tierPreset:p});if(!g.success)return g;let v=g.data;return C({appName:e,type:"standard",pattern:t,network:p?p.network:_4,backup:p?p.backup:!1,patternConfig:v,database:[],s3:[],compute:[],tags:l??{}})}qi(vR,"planOpenNextResources");function bR(e,t){return{type:e?.type??t.database.type,instanceType:e?.instanceType??t.database.instanceType,backupRetention:e?.backupRetention??t.database.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}}}qi(bR,"mergeDatabaseConfig");function yR(e,t){return{memorySize:e?.memorySize??t.compute.memorySize,timeout:e?.timeout??t.compute.timeout}}qi(yR,"mergeComputeConfig");function SR(e){let{encryption:t,...n}=e;return{...n,...t&&{encryption:{storageKey:t}}}}qi(SR,"toPatternDatabaseConfig");function _R(e,t,n){let{domain:i,database:r,compute:o,cdn:a,environment:c,tierPreset:u}=n,l=u?bR(r,u):r,m=u?yR(o,u):o,p={type:e,name:t,domain:i,database:l?SR(l):void 0,compute:m?{server:m}:void 0,cdn:a?{domainNames:a.domainNames,certificateArn:a.certificateArn}:void 0,environment:c},g=ma.safeParse(p);return g.success?C(g.data):$(new Error(`Invalid pattern config: ${g.error.message}`))}qi(_R,"buildPatternConfig");var E4=Object.defineProperty,x4=(e,t)=>E4(e,"name",{value:t,configurable:!0});function ER(e,t){let n={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=Fv.safeParse(n);return i.success?C({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}`))}x4(ER,"planStaticSiteResources");var A4=Object.defineProperty,Ol=(e,t)=>A4(e,"name",{value:t,configurable:!0});function xR(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]}Ol(xR,"parseServiceReference");function Qb(e,t,n){n==="database"?(e.needsConnection=!0,e.connectedDatabase=[...new Set([...e.connectedDatabase??[],t])]):e.connectedStorage=[...new Set([...e.connectedStorage??[],t])]}Ol(Qb,"addResourceConnection");function Ki(e,t,n,i){let r=new Set(t),o=[...new Set(t.map(xR))];for(let a of o){let c=e.compute.find(u=>u.name===a);if(c?.services){Qb(c,n,i);for(let u of c.services){let l=`${a}/${u.name}`;r.has(l)&&(i==="database"?u.needsDatabaseConnection=!0:u.needsStorageConnection=!0)}}}}Ol(Ki,"applyServiceConnections");function xn(e,t,n,i){for(let r of e.compute)if(t.includes(r.name)&&(Qb(r,n,i),r.services))for(let o of r.services)i==="database"?o.needsDatabaseConnection=!0:o.needsStorageConnection=!0}Ol(xn,"applyComputeConnections");var I4=Object.defineProperty,ye=(e,t)=>I4(e,"name",{value:t,configurable:!0});function AR(e){let t=e.database.length>0,n=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:!n,reason:n?"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"}]}ye(AR,"listAvailableResources");function Va(e,t){if(jR(e,t.resourceName))return $(new Error(`Resource name '${t.resourceName}' is already used in this application.`));switch(t.type){case"database":return IR(e,t);case"database:proxy":return $R(e,t);case"storage:s3":return C(void 0);case"network":return C(void 0);case"compute:ecs":return!t.services||t.services.length===0?$(new Error("ECS compute requires at least one service.")):C(void 0);case"compute:lambda":return C(void 0);case"cdn":return TR(e,t);case"tunnel":return RR(e);default:{let n=t;return $(new Error(`Unknown resource type: ${String(n)}`))}}}ye(Va,"validateResourceAddition");function IR(e,t){let n=t.databaseName??t.resourceName.toLowerCase();return e.database.some(i=>i.databaseName===n)?$(new Error(`Database name '${n}' already exists. Choose a different database name.`)):t.databaseType==="GlobalAurora"&&!t.primaryRegion?$(new Error("GlobalAurora databases require a primaryRegion.")):C(void 0)}ye(IR,"validateDatabaseAddition");function $R(e,t){let n=e.database.find(i=>i.name===t.targetDatabase||i.databaseName===t.targetDatabase);if(!n){let i=e.database.map(r=>r.name).join(", ")||"none";return $(new Error(`Database '${t.targetDatabase}' not found. Available databases: ${i}`))}return n.proxy!==void 0&&n.proxy!==!1?$(new Error(`Database '${n.name}' already has RDS Proxy enabled.`)):C(void 0)}ye($R,"validateProxyAddition");function TR(e,t){if(e.cdn)return $(new Error("A CDN is already configured for this application. Remove the existing CDN first."));if(!ey(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 n of t.behaviours)if(!ey(e,n.originRef))return $(new Error(`Behaviour origin '${n.originRef}' not found in plan.`))}return C(void 0)}ye(TR,"validateCdnAddition");function RR(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.")):C(void 0)}ye(RR,"validateTunnelAddition");function Dl(e,t){let n=Va(e,t);if(!n.success)return n;switch(t.type){case"database":return PR(e,t);case"database:proxy":return CR(e,t);case"storage:s3":return NR(e,t);case"network":return wR(e,t);case"compute:ecs":return kR(e,t);case"compute:lambda":return OR(e,t);case"cdn":return DR(e,t);case"tunnel":return MR(e,t);default:{let i=t;return $(new Error(`Unknown resource type: ${String(i)}`))}}}ye(Dl,"addResourceToPlan");function PR(e,t){let n=t.databaseName??t.resourceName.toLowerCase(),i={name:t.resourceName,type:t.databaseType,databaseName:n},r;switch(t.databaseType){case"Instance":r={...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":r={...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":r={...i,primaryRegion:t.primaryRegion,...t.secondaryRegions!==void 0?{secondaryRegions:t.secondaryRegions}:{}};break;default:{let a=t.databaseType;return $(new Error(`Unknown database type: ${String(a)}`))}}let o={...e,database:[...e.database,r]};return ty(o,t.resourceName,"database",t),C(o)}ye(PR,"addDatabase");function CR(e,t){let n=e.database.map(o=>({...o})),i=n.find(o=>o.name===t.targetDatabase||o.databaseName===t.targetDatabase);if(!i)return $(new Error(`Database '${t.targetDatabase}' not found.`));let r={};return t.maxConnections!==void 0&&(r.maxConnections=t.maxConnections),t.maxIdleConnections!==void 0&&(r.maxIdleConnections=t.maxIdleConnections),t.connectionBorrowTimeout!==void 0&&(r.connectionBorrowTimeout=t.connectionBorrowTimeout),t.requireTLS!==void 0&&(r.requireTLS=t.requireTLS),i.proxy=Object.keys(r).length>0?r:{},C({...e,database:n})}ye(CR,"addProxy");function NR(e,t){let n=t.bucketName??t.resourceName.toLowerCase(),i=$e(n),r=e.s3.length,o=r===0?"":`${r+1}`,a={name:i,bucketName:n,variableName:`bucket${o}`,...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"}}:{}},c={...e,s3:[...e.s3,a]};return ty(c,i,"storage",t),C(c)}ye(NR,"addS3");function wR(e,t){let n={};if(t.maxAzs!==void 0&&(n.maxAzs=t.maxAzs),t.natGateways!==void 0&&(n.natGateways=t.natGateways),t.flowLogs!==void 0&&(n.flowLogs=t.flowLogs),t.vpcEndpoints!==void 0&&(n.vpcEndpoints=t.vpcEndpoints),t.networkName){let i={name:t.networkName,...n};return C({...e,additionalNetworks:[...e.additionalNetworks??[],i]})}return C({...e,network:{...e.network??{},...n}})}ye(wR,"addNetwork");function kR(e,t){let n=t.connectedDatabase??[],i={name:t.resourceName,type:"ecs",needsConnection:n.length>0,connectedDatabase:n,...t.loadBalancer!==void 0?{cluster:{loadBalancer:t.loadBalancer}}:{},services:t.services.map(r=>({name:r.name,capacityProvider:r.capacityProvider??"FARGATE",...r.port!==void 0?{containers:[{port:r.port}]}:{},...r.cpu!==void 0?{cpu:r.cpu}:{},...r.memory!==void 0?{memoryLimitMiB:r.memory}:{}})),...t.docker!==void 0&&{docker:t.docker}};return C({...e,compute:[...e.compute,i]})}ye(kR,"addEcsCompute");function OR(e,t){let n=t.connectedDatabase??[],i={name:t.resourceName,type:"lambda",needsConnection:n.length>0,connectedDatabase:n,...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 C({...e,compute:[...e.compute,i]})}ye(OR,"addLambdaCompute");function DR(e,t){let n={name:t.resourceName,defaultOriginRef:t.defaultOriginRef,...t.customDomain!==void 0?{customDomain:t.customDomain}:{},...t.certificateArn!==void 0?{certificateArn:t.certificateArn}:{},...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 C({...e,cdn:n})}ye(DR,"addCdn");function MR(e,t){let n=t.instanceType?{instanceType:t.instanceType}:{};return C({...e,tunnel:n})}ye(MR,"addTunnel");function jR(e,t){let n=[...e.database.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)];return e.cdn&&n.push(e.cdn.name),n.includes(t)}ye(jR,"isResourceNameTaken");function ey(e,t){return e.database.some(n=>n.name===t)||e.s3.some(n=>n.name===t)||e.compute.some(n=>n.name===t)||(e.dynamodb??[]).some(n=>n.name===t)||(e.sqs??[]).some(n=>n.name===t)}ye(ey,"resourceExistsInPlan");function ty(e,t,n,i){i.connectToCompute&&i.connectToCompute.length>0&&xn(e,[...i.connectToCompute],t,n),i.connectToServices&&i.connectToServices.length>0&&Ki(e,[...i.connectToServices],t,n)}ye(ty,"applyConnections");var $4=Object.defineProperty,T4=(e,t)=>$4(e,"name",{value:t,configurable:!0});function zR(e,t,n){let i;try{i=kr(e,{extractCustomCode:!0})}catch(u){return $(new Error(`Failed to parse infrastructure.ts: ${u instanceof Error?u.message:String(u)}`))}let r;try{r=Sn(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&&(r.customCodeBlocks=i.customCodeBlocks);let o=Va(r,n);if(!o.success)return o;let a=Dl(r,n);if(!a.success)return a;let c=Hi(a.data);return c.success?C({originalContent:e,modifiedContent:c.data,addedResource:{type:n.type,name:n.resourceName}}):$(new Error(`Code generation failed: ${c.error.message}`))}T4(zR,"generateResourceChange");var R4=Object.defineProperty,Ft=(e,t)=>R4(e,"name",{value:t,configurable:!0}),P4=new Set(Ba.options);function LR(e){return P4.has(e.toUpperCase())}Ft(LR,"isRecordType");function UR(e){return e.endsWith(".")?e.slice(0,-1):e}Ft(UR,"stripTrailingDot");function FR(e){let t=!1;for(let n=0;n<e.length;n++)if(e[n]==='"')t=!t;else if(e[n]===";"&&!t)return e.slice(0,n).trimEnd();return e}Ft(FR,"stripInlineComment");function BR(e,t){let n=e.slice(t).join(" "),i=[],r="",o=!1;for(let a of n)a==='"'?(o&&(i.push(r),r=""),o=!o):o&&(r+=a);return i.join(" ")}Ft(BR,"parseTxtValue");function VR(e){let t=/;\s*auto\s*$/.test(e),n=e.replace(/;\s*auto\s*$/,"").trim().match(/^\$FJALL-DELEGATE\s+(\S+)\s+TO\s+(\S+)$/i);if(n)return{subdomain:n[1],targetAccount:n[2],auto:t}}Ft(VR,"parseDelegateDirective");function ZR(e){if(e.length<2)return;let t=e[1],n=e.slice(2);return{domainName:t,subjectAlternativeNames:n}}Ft(ZR,"parseCertDirective");function GR(e){let t=[],n="",i=!1;for(let r of e)r==='"'?(i=!i,n+=r):/\s/.test(r)&&!i?n.length>0&&(t.push(n),n=""):n+=r;return n.length>0&&t.push(n),t}Ft(GR,"tokenise");function WR(e){if(e.length<2)return;let t=0,n=e[t++],i,r;for(;t<e.length&&r===void 0;){let a=e[t].toUpperCase();if(a==="IN")t++;else if(LR(a))r=a,t++;else if(/^\d+$/.test(e[t]))i=parseInt(e[t],10),t++;else return}if(!r)return;let o=e.slice(t);switch(r){case"MX":{if(o.length<2)return;let a=parseInt(o[0],10),c=o.slice(1).join(" ");return{name:n,type:r,ttl:i,value:c,priority:a}}case"SRV":{if(o.length<4)return;let a=parseInt(o[0],10),c=parseInt(o[1],10),u=parseInt(o[2],10),l=o[3];return{name:n,type:r,ttl:i,value:l,priority:a,weight:c,port:u}}case"TXT":{let a=BR(e,t);return{name:n,type:r,ttl:i,value:a}}case"CAA":{let a=o.join(" ");return{name:n,type:r,ttl:i,value:a}}case"A":{if(o.length===0)return;if(o[0].toUpperCase()==="ALIAS"){if(o.length<2)return;let a=o.slice(1).join(" ");return{name:n,type:r,ttl:i,value:`${Nl}${a}`}}return{name:n,type:r,ttl:i,value:o[0]}}default:return o.length===0?void 0:{name:n,type:r,ttl:i,value:o[0]}}}Ft(WR,"parseRecord");function HR(e){let t=e.split(`
450
- `),n,i=300,r=[],o=[],a=[];for(let c of t){let u=c.trim();if(u===""||u.startsWith(";"))continue;if(u.toUpperCase().startsWith(Ut.FJALL_DELEGATE)){let v=VR(u);v&&o.push(v);continue}let l=FR(u);if(l==="")continue;let m=GR(l);if(m.length===0)continue;let p=m[0].toUpperCase();if(p===Ut.ORIGIN){if(m.length<2)continue;n=UR(m[1]);continue}if(p===Ut.TTL){if(m.length<2)continue;i=parseInt(m[1],10);continue}if(p===Ut.FJALL_CERT){let v=ZR(m);v&&a.push(v);continue}let g=WR(m);g&&r.push(g)}return n?C({origin:n,ttl:i,records:r,delegations:o,certificates:a}):$(new Error("Missing $ORIGIN directive"))}Ft(HR,"parseZoneFile");function qR(e,t){if(!e.startsWith("fjall:"))return;let n=e.split(":");if(n.length<3)return;let i=n[1],r=n[2],o=`${i}:${r}`;return t.get(o)??t.get(e)}Ft(qR,"resolveAlias");var C4=Object.defineProperty,ry=(e,t)=>C4(e,"name",{value:t,configurable:!0});function KR(e,t){return e.length>=t?e:e+" ".repeat(t-e.length)}ry(KR,"padRight");function YR(e,t){let n=KR(e.name,24),i=e.ttl!==void 0&&e.ttl!==t?`${e.ttl} `:"";switch(e.type){case"MX":return`${n} ${i}IN MX ${e.priority??10} ${e.value}`;case"SRV":return`${n} ${i}IN SRV ${e.priority??0} ${e.weight??0} ${e.port??0} ${e.value}`;case"TXT":return`${n} ${i}IN TXT "${e.value}"`;case"CAA":return`${n} ${i}IN CAA ${e.value}`;default:return e.type==="A"&&e.value.startsWith(Nl)?`${n} ${i}IN A ${e.value}`:`${n} ${i}IN ${e.type} ${e.value}`}}ry(YR,"formatRecord");function XR(e){let t=[];if(t.push("; zone.bind \u2014 managed by fjall"),t.push(`${Ut.ORIGIN} ${e.origin}.`),t.push(`${Ut.TTL} ${e.ttl}`),t.push(""),e.certificates.length>0){for(let n of e.certificates){let i=[n.domainName,...n.subjectAlternativeNames];t.push(`${Ut.FJALL_CERT} ${i.join(" ")}`)}t.push("")}if(e.delegations.length>0){for(let n of e.delegations){let i=n.auto?" ; auto":"";t.push(`${Ut.FJALL_DELEGATE} ${n.subdomain} TO ${n.targetAccount}${i}`)}t.push("")}for(let n of e.records)t.push(YR(n,e.ttl));return t.join(`
449
+ `),r}gt(F0,"formatCustomCodeForInsertion");function B0(e){try{let t=function(r){r.kind===_n.SyntaxKind.Unknown&&i.push("Unknown node found in AST - possible parse error"),_n.forEachChild(r,t)};gt(t,"visit");let n=Or(e),i=[];return t(n),i.length>0?{valid:!1,errors:i}:{valid:!0}}catch(t){return{valid:!1,errors:[Rt(t)]}}}gt(B0,"validateModifiedFile");import*as Ie from"typescript";var Ba=s.enum(["A","AAAA","CNAME","MX","TXT","NS","SRV","CAA"]),c4=s.object({name:s.string(),type:Ba,ttl:s.number().optional(),value:s.string(),priority:s.number().optional(),weight:s.number().optional(),port:s.number().optional()}).strict(),u4=s.object({subdomain:s.string(),targetAccount:s.string(),auto:s.boolean()}).strict(),l4=s.object({domainName:s.string(),subjectAlternativeNames:s.array(s.string())}).strict(),QK=s.object({origin:s.string(),ttl:s.number(),records:s.array(c4),delegations:s.array(u4),certificates:s.array(l4)}).strict(),Ut=Object.freeze({ORIGIN:"$ORIGIN",TTL:"$TTL",FJALL_DELEGATE:"$FJALL-DELEGATE",FJALL_CERT:"$FJALL-CERT"}),Nl="ALIAS ";var V0=s.discriminatedUnion("kind",[s.object({kind:s.literal("ecs"),appName:s.string()}).strict(),s.object({kind:s.literal("cdn"),appName:s.string()}).strict(),s.object({kind:s.literal("bucket"),bucketName:s.string()}).strict(),s.object({kind:s.literal("custom"),dnsName:s.string(),hostedZoneId:s.string()}).strict()]),Z0=V0.options.map(e=>e.shape.kind.value),Yb=s.enum(["A","AAAA"]),Xb=s.enum(["route53","external-delegated","external-records"]),G0=s.enum(["zone","full"]),d4=s.object({kind:s.literal("standard"),type:s.enum(["A","AAAA","CNAME","MX","TXT","NS","SRV","CAA"]),name:s.string(),value:s.union([s.string(),s.array(s.string())]),ttl:s.number().int().positive().optional()}).strict(),m4=s.object({kind:s.literal("alias"),type:Yb,name:s.string(),target:V0}).strict(),p4=s.discriminatedUnion("kind",[d4,m4]),f4=s.object({domainName:s.string(),subjectAlternativeNames:s.array(s.string()).optional(),transparencyLogging:s.boolean().optional(),cloudFront:s.boolean().optional()}).strict(),g4=s.object({subdomain:s.string(),toAccount:s.string(),auto:s.boolean().optional()}).strict(),rY=s.object({zoneName:s.string(),registrar:Xb,hostedZoneId:s.string().optional(),delegatedSubdomain:s.string().optional(),adoptedNameServers:s.array(s.string().min(1)).min(1).optional(),records:s.array(p4),certificates:s.array(f4),delegations:s.array(g4)}).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 h4=Object.defineProperty,me=(e,t)=>h4(e,"name",{value:t,configurable:!0}),H0=Xb.options,W0=G0.options,v4=Ba.options,b4=Yb.options;function q0(e){let t=[],n=me(r=>{if(Ie.isNewExpression(r)&&K0(r.expression)){let o=Y0(r);o!==void 0&&t.push(o)}Ie.forEachChild(r,n)},"visit");if(n(e),t.length===0)return C(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?C(i):C(void 0)}me(q0,"findDomainConstructCall");function K0(e){return Ie.isIdentifier(e)&&e.text==="Domain"}me(K0,"isDomainIdentifier");function Y0(e){let t=e.arguments;if(!t||t.length<3)return;let n=t[0],i=t[1],r=t[2];if(!n||!i||!r||!Ie.isObjectLiteralExpression(r))return;let o=X0(e);if(o===void 0)return;let a=J0(e),c=Ie.isStringLiteral(i)?i.text:void 0;return{callExpression:e,containingStatement:o,propsObjectLiteral:r,domainVarId:a,scopeArgumentText:n.getText(),constructIdLiteral:c}}me(Y0,"buildMatch");function X0(e){let t=e;for(;t!==void 0;){if(Ie.isExpressionStatement(t)||Ie.isVariableStatement(t))return t;t=t.parent}}me(X0,"findContainingTopLevelStatement");function J0(e){let t=e.parent;for(;t!==void 0;){if(Ie.isVariableDeclaration(t)&&Ie.isIdentifier(t.name)&&t.initializer===e)return t.name.text;t=t.parent}}me(J0,"extractDomainVarId");function Q0(e){switch(e.kind){case"registrar_required":return"'registrar' property is required";case"registrar_unsupported":return`'registrar' must be one of ${H0.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}`}}me(Q0,"errorMessage");var y4="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 eR(e){let t=B(e),n=U(t.registrar,H0);if(n===void 0){let c=t.registrar;if(c===void 0)return $({kind:"registrar_required"});let u=typeof c=="string"?c:kl(c);return $({kind:"registrar_unsupported",value:u})}let i=b(t.zoneName);if(i===void 0)return $({kind:"missing_field",field:"zoneName"});let r=rR(t.records);if(!r.success)return r;let o=sR(t.certificates);if(!o.success)return o;if(t.delegations!==void 0)return $({kind:"removed_field",field:"delegations",cure:y4});let a={zoneName:i,description:b(t.description),costAllocationEnvironment:b(t.costAllocationEnvironment),tags:cR(t.tags),records:r.data,certificates:o.data};switch(n){case"route53":return C({...a,registrar:n,hostedZoneId:b(t.hostedZoneId)});case"external-delegated":{let c=b(t.delegatedSubdomain);if(c===void 0)return $({kind:"missing_field",field:"delegatedSubdomain"});let u=b(t.hostedZoneId);if(t.hostedZoneId!==void 0&&u===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 l=ue(t.adoptedNameServers);if(t.adoptedNameServers!==void 0&&l===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(u===void 0!=(l===void 0))return $({kind:"invalid_literal",field:u===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 m=b(t.parentDelegationRoleArn);if(t.parentDelegationRoleArn!==void 0&&m===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 p=U(t.phase,W0);return t.phase!==void 0&&p===void 0?$({kind:"invalid_literal",field:"phase",reason:`must be one of ${W0.map(g=>`'${g}'`).join(", ")}`}):C({...a,registrar:n,delegatedSubdomain:c,hostedZoneId:u,adoptedNameServers:l,parentDelegationRoleArn:m,phase:p})}case"external-records":return C({...a,registrar:n})}}me(eR,"parseDomainProps");function tR(e){return Q0(e)}me(tR,"parseDomainErrorMessage");function rR(e){if(e===void 0)return C([]);if(!Array.isArray(e))return $({kind:"invalid_literal",field:"records",reason:"must be an array"});let t=[];for(let n=0;n<e.length;n++){let i=e[n];if(!P(i))return $({kind:"invalid_literal",field:`records[${n}]`,reason:"must be an object literal"});let r=nR(i,n);if(!r.success)return r;t.push(r.data)}return C(t)}me(rR,"parseRecordsArray");function nR(e,t){let n=b(e.type),i=b(e.name);if(n===void 0)return $({kind:"missing_field",field:`records[${t}].type`});if(i===void 0)return $({kind:"missing_field",field:`records[${t}].name`});if(e.target!==void 0){if(!b4.some(u=>u===n))return $({kind:"invalid_literal",field:`records[${t}]`,reason:`alias records must have type 'A' or 'AAAA', got '${n}'`});let c=oR(e.target);return C({kind:"alias",type:n,name:i,target:c})}if(!v4.some(c=>c===n))return $({kind:"invalid_literal",field:`records[${t}]`,reason:`unsupported record type '${n}'`});let r=iR(e.value);if(r===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=R(e.ttl),a={kind:"standard",type:n,name:i,value:r,...o!==void 0?{ttl:o}:{}};return C(a)}me(nR,"parseRecord");function iR(e){if(e===void 0)return;if(typeof e=="string")return e;let t=ue(e);if(t!==void 0)return t}me(iR,"parseRecordValue");function oR(e){if(xt(e))return aR(e);if(P(e)){let t=U(e.kind,Z0);if(t==="ecs"||t==="cdn"){let n=b(e.appName);if(n!==void 0)return{kind:t,appName:n}}if(t==="bucket"){let n=b(e.bucketName);if(n!==void 0)return{kind:t,bucketName:n}}if(t==="custom"){let n=b(e.dnsName),i=b(e.hostedZoneId);if(n!==void 0&&i!==void 0)return{kind:t,dnsName:n,hostedZoneId:i}}}return{kind:"unresolved",sourceText:kl(e)}}me(oR,"parseTarget");function aR(e){let t=e.__call.trim(),n=t.match(/^([A-Za-z_][\w$]*)\s*\(([\s\S]*)\)\s*$/);if(!n)return{kind:"unresolved",sourceText:t};let i=n[1],r=n[2]??"",o=wl(r);switch(i){case"fjallApp":{let a=En(o,0);return a===void 0?{kind:"dynamic",sourceText:t}:{kind:"ecs",appName:a}}case"fjallCdn":{let a=En(o,0);return a===void 0?{kind:"dynamic",sourceText:t}:{kind:"cdn",appName:a}}case"fjallBucket":{let a=En(o,0);return a===void 0?{kind:"dynamic",sourceText:t}:{kind:"bucket",bucketName:a}}case"aliasTo":{if(o.length>=2){let a=En(o,0),c=En(o,1);return a!==void 0&&c!==void 0?{kind:"custom",dnsName:a,hostedZoneId:c}:{kind:"dynamic",sourceText:t}}if(o.length===1){let a=o[0]?.trim()??"",c=Jb(a,"dnsName"),u=Jb(a,"hostedZoneId");return c!==void 0&&u!==void 0?{kind:"custom",dnsName:c,hostedZoneId:u}:{kind:"dynamic",sourceText:t}}return{kind:"unresolved",sourceText:t}}default:return{kind:"unresolved",sourceText:t}}}me(aR,"resolveCallRefTarget");function wl(e){let t=[],n=0,i=null,r="";for(let a=0;a<e.length;a++){let c=e[a];if(i!==null){if(r+=c,c==="\\"&&a+1<e.length){let u=e[a+1];u!==void 0&&(r+=u,a+=1);continue}c===i&&(i=null);continue}if(c==='"'||c==="'"||c==="`"){i=c,r+=c;continue}if(c==="("||c==="{"||c==="["){n+=1,r+=c;continue}if(c===")"||c==="}"||c==="]"){n-=1,r+=c;continue}if(c===","&&n===0){t.push(r.trim()),r="";continue}r+=c}let o=r.trim();return o.length>0&&t.push(o),t}me(wl,"splitTopLevelArgs");function En(e,t){let n=e[t];if(n===void 0)return;let i=n.trim();if(i.length<2)return;let r=i[0],o=i[i.length-1];if(r===o&&!(r!=='"'&&r!=="'"&&r!=="`"))return i.slice(1,-1)}me(En,"extractStringLiteralArg");function Jb(e,t){let n=e.trim().replace(/^\{|\}$/g,""),i=wl(n);for(let r of i){let o=r.indexOf(":");if(o<0||r.slice(0,o).trim().replace(/["'`]/g,"")!==t)continue;let a=r.slice(o+1).trim();return En([a],0)}}me(Jb,"extractObjectFieldString");function sR(e){if(e===void 0)return C([]);if(!Array.isArray(e))return $({kind:"invalid_literal",field:"certificates",reason:"must be an array"});let t=[];for(let n=0;n<e.length;n++){let i=e[n];if(typeof i=="string"){t.push({domainName:i});continue}if(!P(i))return $({kind:"invalid_literal",field:`certificates[${n}]`,reason:"must be a string or object literal"});let r=b(i.domainName);if(r===void 0)return $({kind:"missing_field",field:`certificates[${n}].domainName`});let o=ue(i.subjectAlternativeNames),a=j(i.transparencyLogging),c=j(i.cloudFront);if(i.cloudFront!==void 0&&c===void 0)return $({kind:"invalid_literal",field:`certificates[${n}].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:r,...o!==void 0?{subjectAlternativeNames:o}:{},...a!==void 0?{transparencyLogging:a}:{},...c!==void 0?{cloudFront:c}:{}})}return C(t)}me(sR,"parseCertificatesArray");function cR(e){if(e===void 0||!P(e))return;let t={};for(let[n,i]of Object.entries(e)){let r=b(i);r!==void 0&&(t[n]=r)}return Object.keys(t).length===0?void 0:t}me(cR,"parseStringRecord");function kl(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=>kl(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)}me(kl,"stringifyParsedValue");var S4=Object.defineProperty,Mr=(e,t)=>S4(e,"name",{value:t,configurable:!0});function uR(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(uR,"toUserServiceConfigs");function lR(e,t,n=!0,i,r){let o={appName:e,type:t,database:[],s3:[],compute:[]};if(t==="custom")return o;let a=t,c=rr[a];return{...o,database:dR(e,c,a,n,r),compute:gR(e,c,a,n,i),network:c.network,backup:c.backup}}Mr(lR,"planApplicationResources");function dR(e,t,n,i,r){let o=rb(n),a=t.database[o];return!i||a===null?[]:[{name:e,type:o,databaseName:Rn(e),variableName:`${er(e)}Database`,...a,...r?.snapshotIdentifier!==void 0&&{snapshotIdentifier:r.snapshotIdentifier},...r?.snapshotUsername!==void 0&&{snapshotUsername:r.snapshotUsername}}]}Mr(dR,"buildDatabasePlan");function mR(e,t){if(!(e===void 0&&t===void 0))return{scaling:{...e!==void 0&&{minCapacity:e},...t!==void 0&&{maxCapacity:t}}}}Mr(mR,"buildScalingConfig");function pR(e,t){let{minCapacity:n,maxCapacity:i,...r}=e,o=t?.serviceType==="worker",a=t?.containerPort??FI,c=t?.docker;return{...r,...c?.path!==void 0&&{docker:{path:c.path,...c.context!==void 0&&{context:c.context},...c.target!==void 0&&{target:c.target}}},...t?.needsDatabaseConnection!==void 0&&{needsDatabaseConnection:t.needsDatabaseConnection},containers:o?[{}]:[{port:a}],...mR(n,i)}}Mr(pR,"buildServiceEntry");function fR(e,t){return t||e?.directAccess===!0?e:{...e,loadBalancer:!1}}Mr(fR,"resolveClusterConfig");function gR(e,t,n,i,r){let o=t.compute.ecs,a=(r&&r.length>0?nb(n,r):o.services.map((u,l)=>({...u,name:l===0?"api":`service-${l+1}`}))).map((u,l)=>pR(u,r?.[l])),c=a.some(u=>u.containers?.some(l=>l.port!==void 0));return[{name:e,type:Ei.ECS,needsConnection:i,connectedDatabase:i?[e]:void 0,variableName:`${er(e)}Compute`,cluster:fR(o.cluster,c),services:a}]}Mr(gR,"buildComputePlan");function Hi(e,t){let n=[cl(e),sl(e),al(e)];if(dl(e))n.push(Ta(e),Pa(e));else{let r=ll(e);n.push(Pa(e),Xu(e),Ju(e),nl(e),il(e),ol(e),rl(e,r),ul(e))}let i=n.join("");if(e.customCodeBlocks&&e.customCodeBlocks.length>0){let r=Cl(i,e.customCodeBlocks,t?.resourceMapping);return r.success?C(r.content):$(new Error(`Custom code injection failed: ${r.error??"unknown error"}`))}return C(i)}Mr(Hi,"generateInfrastructureFromPlan");var _4=Object.defineProperty,qi=(e,t)=>_4(e,"name",{value:t,configurable:!0}),E4=tb("standard");function hR(e){return ma.options.some(t=>t.shape?.type?.value===e)}qi(hR,"isPatternConfigType");function vR(e,t,n){let{tier:i="standard",domain:r,database:o,compute:a,cdn:c,environment:u,tags:l}=n??{},m=pl(i);if(!m&&i!=="custom")return $(new Error(`Invalid pattern tier: "${i}". Valid tiers are: ${[...Na,"custom"].join(", ")}`));if(!hR(t))return $(new Error(`Unsupported pattern type: ${t}`));let p=m?ml(i):null,g=_R(t,e,{domain:r,database:o,compute:a,cdn:c,environment:u,tierPreset:p});if(!g.success)return g;let v=g.data;return C({appName:e,type:"standard",pattern:t,network:p?p.network:E4,backup:p?p.backup:!1,patternConfig:v,database:[],s3:[],compute:[],tags:l??{}})}qi(vR,"planOpenNextResources");function bR(e,t){return{type:e?.type??t.database.type,instanceType:e?.instanceType??t.database.instanceType,backupRetention:e?.backupRetention??t.database.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}}}qi(bR,"mergeDatabaseConfig");function yR(e,t){return{memorySize:e?.memorySize??t.compute.memorySize,timeout:e?.timeout??t.compute.timeout}}qi(yR,"mergeComputeConfig");function SR(e){let{encryption:t,...n}=e;return{...n,...t&&{encryption:{storageKey:t}}}}qi(SR,"toPatternDatabaseConfig");function _R(e,t,n){let{domain:i,database:r,compute:o,cdn:a,environment:c,tierPreset:u}=n,l=u?bR(r,u):r,m=u?yR(o,u):o,p={type:e,name:t,domain:i,database:l?SR(l):void 0,compute:m?{server:m}:void 0,cdn:a?{domainNames:a.domainNames,certificateArn:a.certificateArn}:void 0,environment:c},g=ma.safeParse(p);return g.success?C(g.data):$(new Error(`Invalid pattern config: ${g.error.message}`))}qi(_R,"buildPatternConfig");var x4=Object.defineProperty,A4=(e,t)=>x4(e,"name",{value:t,configurable:!0});function ER(e,t){let n={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=Fv.safeParse(n);return i.success?C({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}`))}A4(ER,"planStaticSiteResources");var I4=Object.defineProperty,Ol=(e,t)=>I4(e,"name",{value:t,configurable:!0});function xR(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]}Ol(xR,"parseServiceReference");function Qb(e,t,n){n==="database"?(e.needsConnection=!0,e.connectedDatabase=[...new Set([...e.connectedDatabase??[],t])]):e.connectedStorage=[...new Set([...e.connectedStorage??[],t])]}Ol(Qb,"addResourceConnection");function Ki(e,t,n,i){let r=new Set(t),o=[...new Set(t.map(xR))];for(let a of o){let c=e.compute.find(u=>u.name===a);if(c?.services){Qb(c,n,i);for(let u of c.services){let l=`${a}/${u.name}`;r.has(l)&&(i==="database"?u.needsDatabaseConnection=!0:u.needsStorageConnection=!0)}}}}Ol(Ki,"applyServiceConnections");function xn(e,t,n,i){for(let r of e.compute)if(t.includes(r.name)&&(Qb(r,n,i),r.services))for(let o of r.services)i==="database"?o.needsDatabaseConnection=!0:o.needsStorageConnection=!0}Ol(xn,"applyComputeConnections");var $4=Object.defineProperty,ye=(e,t)=>$4(e,"name",{value:t,configurable:!0});function AR(e){let t=e.database.length>0,n=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:!n,reason:n?"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"}]}ye(AR,"listAvailableResources");function Va(e,t){if(jR(e,t.resourceName))return $(new Error(`Resource name '${t.resourceName}' is already used in this application.`));switch(t.type){case"database":return IR(e,t);case"database:proxy":return $R(e,t);case"storage:s3":return C(void 0);case"network":return C(void 0);case"compute:ecs":return!t.services||t.services.length===0?$(new Error("ECS compute requires at least one service.")):C(void 0);case"compute:lambda":return C(void 0);case"cdn":return TR(e,t);case"tunnel":return RR(e);default:{let n=t;return $(new Error(`Unknown resource type: ${String(n)}`))}}}ye(Va,"validateResourceAddition");function IR(e,t){let n=t.databaseName??t.resourceName.toLowerCase();return e.database.some(i=>i.databaseName===n)?$(new Error(`Database name '${n}' already exists. Choose a different database name.`)):t.databaseType==="GlobalAurora"&&!t.primaryRegion?$(new Error("GlobalAurora databases require a primaryRegion.")):C(void 0)}ye(IR,"validateDatabaseAddition");function $R(e,t){let n=e.database.find(i=>i.name===t.targetDatabase||i.databaseName===t.targetDatabase);if(!n){let i=e.database.map(r=>r.name).join(", ")||"none";return $(new Error(`Database '${t.targetDatabase}' not found. Available databases: ${i}`))}return n.proxy!==void 0&&n.proxy!==!1?$(new Error(`Database '${n.name}' already has RDS Proxy enabled.`)):C(void 0)}ye($R,"validateProxyAddition");function TR(e,t){if(e.cdn)return $(new Error("A CDN is already configured for this application. Remove the existing CDN first."));if(!ey(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 n of t.behaviours)if(!ey(e,n.originRef))return $(new Error(`Behaviour origin '${n.originRef}' not found in plan.`))}return C(void 0)}ye(TR,"validateCdnAddition");function RR(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.")):C(void 0)}ye(RR,"validateTunnelAddition");function Dl(e,t){let n=Va(e,t);if(!n.success)return n;switch(t.type){case"database":return PR(e,t);case"database:proxy":return CR(e,t);case"storage:s3":return NR(e,t);case"network":return wR(e,t);case"compute:ecs":return kR(e,t);case"compute:lambda":return OR(e,t);case"cdn":return DR(e,t);case"tunnel":return MR(e,t);default:{let i=t;return $(new Error(`Unknown resource type: ${String(i)}`))}}}ye(Dl,"addResourceToPlan");function PR(e,t){let n=t.databaseName??t.resourceName.toLowerCase(),i={name:t.resourceName,type:t.databaseType,databaseName:n},r;switch(t.databaseType){case"Instance":r={...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":r={...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":r={...i,primaryRegion:t.primaryRegion,...t.secondaryRegions!==void 0?{secondaryRegions:t.secondaryRegions}:{}};break;default:{let a=t.databaseType;return $(new Error(`Unknown database type: ${String(a)}`))}}let o={...e,database:[...e.database,r]};return ty(o,t.resourceName,"database",t),C(o)}ye(PR,"addDatabase");function CR(e,t){let n=e.database.map(o=>({...o})),i=n.find(o=>o.name===t.targetDatabase||o.databaseName===t.targetDatabase);if(!i)return $(new Error(`Database '${t.targetDatabase}' not found.`));let r={};return t.maxConnections!==void 0&&(r.maxConnections=t.maxConnections),t.maxIdleConnections!==void 0&&(r.maxIdleConnections=t.maxIdleConnections),t.connectionBorrowTimeout!==void 0&&(r.connectionBorrowTimeout=t.connectionBorrowTimeout),t.requireTLS!==void 0&&(r.requireTLS=t.requireTLS),i.proxy=Object.keys(r).length>0?r:{},C({...e,database:n})}ye(CR,"addProxy");function NR(e,t){let n=t.bucketName??t.resourceName.toLowerCase(),i=$e(n),r=e.s3.length,o=r===0?"":`${r+1}`,a={name:i,bucketName:n,variableName:`bucket${o}`,...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"}}:{}},c={...e,s3:[...e.s3,a]};return ty(c,i,"storage",t),C(c)}ye(NR,"addS3");function wR(e,t){let n={};if(t.maxAzs!==void 0&&(n.maxAzs=t.maxAzs),t.natGateways!==void 0&&(n.natGateways=t.natGateways),t.flowLogs!==void 0&&(n.flowLogs=t.flowLogs),t.vpcEndpoints!==void 0&&(n.vpcEndpoints=t.vpcEndpoints),t.networkName){let i={name:t.networkName,...n};return C({...e,additionalNetworks:[...e.additionalNetworks??[],i]})}return C({...e,network:{...e.network??{},...n}})}ye(wR,"addNetwork");function kR(e,t){let n=t.connectedDatabase??[],i={name:t.resourceName,type:"ecs",needsConnection:n.length>0,connectedDatabase:n,...t.loadBalancer!==void 0?{cluster:{loadBalancer:t.loadBalancer}}:{},services:t.services.map(r=>({name:r.name,capacityProvider:r.capacityProvider??"FARGATE",...r.port!==void 0?{containers:[{port:r.port}]}:{},...r.cpu!==void 0?{cpu:r.cpu}:{},...r.memory!==void 0?{memoryLimitMiB:r.memory}:{}})),...t.docker!==void 0&&{docker:t.docker}};return C({...e,compute:[...e.compute,i]})}ye(kR,"addEcsCompute");function OR(e,t){let n=t.connectedDatabase??[],i={name:t.resourceName,type:"lambda",needsConnection:n.length>0,connectedDatabase:n,...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 C({...e,compute:[...e.compute,i]})}ye(OR,"addLambdaCompute");function DR(e,t){let n={name:t.resourceName,defaultOriginRef:t.defaultOriginRef,...t.customDomain!==void 0?{customDomain:t.customDomain}:{},...t.certificateArn!==void 0?{certificateArn:t.certificateArn}:{},...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 C({...e,cdn:n})}ye(DR,"addCdn");function MR(e,t){let n=t.instanceType?{instanceType:t.instanceType}:{};return C({...e,tunnel:n})}ye(MR,"addTunnel");function jR(e,t){let n=[...e.database.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)];return e.cdn&&n.push(e.cdn.name),n.includes(t)}ye(jR,"isResourceNameTaken");function ey(e,t){return e.database.some(n=>n.name===t)||e.s3.some(n=>n.name===t)||e.compute.some(n=>n.name===t)||(e.dynamodb??[]).some(n=>n.name===t)||(e.sqs??[]).some(n=>n.name===t)}ye(ey,"resourceExistsInPlan");function ty(e,t,n,i){i.connectToCompute&&i.connectToCompute.length>0&&xn(e,[...i.connectToCompute],t,n),i.connectToServices&&i.connectToServices.length>0&&Ki(e,[...i.connectToServices],t,n)}ye(ty,"applyConnections");var T4=Object.defineProperty,R4=(e,t)=>T4(e,"name",{value:t,configurable:!0});function zR(e,t,n){let i;try{i=kr(e,{extractCustomCode:!0})}catch(u){return $(new Error(`Failed to parse infrastructure.ts: ${u instanceof Error?u.message:String(u)}`))}let r;try{r=Sn(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&&(r.customCodeBlocks=i.customCodeBlocks);let o=Va(r,n);if(!o.success)return o;let a=Dl(r,n);if(!a.success)return a;let c=Hi(a.data);return c.success?C({originalContent:e,modifiedContent:c.data,addedResource:{type:n.type,name:n.resourceName}}):$(new Error(`Code generation failed: ${c.error.message}`))}R4(zR,"generateResourceChange");var P4=Object.defineProperty,Ft=(e,t)=>P4(e,"name",{value:t,configurable:!0}),C4=new Set(Ba.options);function LR(e){return C4.has(e.toUpperCase())}Ft(LR,"isRecordType");function UR(e){return e.endsWith(".")?e.slice(0,-1):e}Ft(UR,"stripTrailingDot");function FR(e){let t=!1;for(let n=0;n<e.length;n++)if(e[n]==='"')t=!t;else if(e[n]===";"&&!t)return e.slice(0,n).trimEnd();return e}Ft(FR,"stripInlineComment");function BR(e,t){let n=e.slice(t).join(" "),i=[],r="",o=!1;for(let a of n)a==='"'?(o&&(i.push(r),r=""),o=!o):o&&(r+=a);return i.join(" ")}Ft(BR,"parseTxtValue");function VR(e){let t=/;\s*auto\s*$/.test(e),n=e.replace(/;\s*auto\s*$/,"").trim().match(/^\$FJALL-DELEGATE\s+(\S+)\s+TO\s+(\S+)$/i);if(n)return{subdomain:n[1],targetAccount:n[2],auto:t}}Ft(VR,"parseDelegateDirective");function ZR(e){if(e.length<2)return;let t=e[1],n=e.slice(2);return{domainName:t,subjectAlternativeNames:n}}Ft(ZR,"parseCertDirective");function GR(e){let t=[],n="",i=!1;for(let r of e)r==='"'?(i=!i,n+=r):/\s/.test(r)&&!i?n.length>0&&(t.push(n),n=""):n+=r;return n.length>0&&t.push(n),t}Ft(GR,"tokenise");function WR(e){if(e.length<2)return;let t=0,n=e[t++],i,r;for(;t<e.length&&r===void 0;){let a=e[t].toUpperCase();if(a==="IN")t++;else if(LR(a))r=a,t++;else if(/^\d+$/.test(e[t]))i=parseInt(e[t],10),t++;else return}if(!r)return;let o=e.slice(t);switch(r){case"MX":{if(o.length<2)return;let a=parseInt(o[0],10),c=o.slice(1).join(" ");return{name:n,type:r,ttl:i,value:c,priority:a}}case"SRV":{if(o.length<4)return;let a=parseInt(o[0],10),c=parseInt(o[1],10),u=parseInt(o[2],10),l=o[3];return{name:n,type:r,ttl:i,value:l,priority:a,weight:c,port:u}}case"TXT":{let a=BR(e,t);return{name:n,type:r,ttl:i,value:a}}case"CAA":{let a=o.join(" ");return{name:n,type:r,ttl:i,value:a}}case"A":{if(o.length===0)return;if(o[0].toUpperCase()==="ALIAS"){if(o.length<2)return;let a=o.slice(1).join(" ");return{name:n,type:r,ttl:i,value:`${Nl}${a}`}}return{name:n,type:r,ttl:i,value:o[0]}}default:return o.length===0?void 0:{name:n,type:r,ttl:i,value:o[0]}}}Ft(WR,"parseRecord");function HR(e){let t=e.split(`
450
+ `),n,i=300,r=[],o=[],a=[];for(let c of t){let u=c.trim();if(u===""||u.startsWith(";"))continue;if(u.toUpperCase().startsWith(Ut.FJALL_DELEGATE)){let v=VR(u);v&&o.push(v);continue}let l=FR(u);if(l==="")continue;let m=GR(l);if(m.length===0)continue;let p=m[0].toUpperCase();if(p===Ut.ORIGIN){if(m.length<2)continue;n=UR(m[1]);continue}if(p===Ut.TTL){if(m.length<2)continue;i=parseInt(m[1],10);continue}if(p===Ut.FJALL_CERT){let v=ZR(m);v&&a.push(v);continue}let g=WR(m);g&&r.push(g)}return n?C({origin:n,ttl:i,records:r,delegations:o,certificates:a}):$(new Error("Missing $ORIGIN directive"))}Ft(HR,"parseZoneFile");function qR(e,t){if(!e.startsWith("fjall:"))return;let n=e.split(":");if(n.length<3)return;let i=n[1],r=n[2],o=`${i}:${r}`;return t.get(o)??t.get(e)}Ft(qR,"resolveAlias");var N4=Object.defineProperty,ry=(e,t)=>N4(e,"name",{value:t,configurable:!0});function KR(e,t){return e.length>=t?e:e+" ".repeat(t-e.length)}ry(KR,"padRight");function YR(e,t){let n=KR(e.name,24),i=e.ttl!==void 0&&e.ttl!==t?`${e.ttl} `:"";switch(e.type){case"MX":return`${n} ${i}IN MX ${e.priority??10} ${e.value}`;case"SRV":return`${n} ${i}IN SRV ${e.priority??0} ${e.weight??0} ${e.port??0} ${e.value}`;case"TXT":return`${n} ${i}IN TXT "${e.value}"`;case"CAA":return`${n} ${i}IN CAA ${e.value}`;default:return e.type==="A"&&e.value.startsWith(Nl)?`${n} ${i}IN A ${e.value}`:`${n} ${i}IN ${e.type} ${e.value}`}}ry(YR,"formatRecord");function XR(e){let t=[];if(t.push("; zone.bind \u2014 managed by fjall"),t.push(`${Ut.ORIGIN} ${e.origin}.`),t.push(`${Ut.TTL} ${e.ttl}`),t.push(""),e.certificates.length>0){for(let n of e.certificates){let i=[n.domainName,...n.subjectAlternativeNames];t.push(`${Ut.FJALL_CERT} ${i.join(" ")}`)}t.push("")}if(e.delegations.length>0){for(let n of e.delegations){let i=n.auto?" ; auto":"";t.push(`${Ut.FJALL_DELEGATE} ${n.subdomain} TO ${n.targetAccount}${i}`)}t.push("")}for(let n of e.records)t.push(YR(n,e.ttl));return t.join(`
451
451
  `)+`
452
- `}ry(XR,"generateZoneFile");var N4=Object.defineProperty,ny=(e,t)=>N4(e,"name",{value:t,configurable:!0});function JR(e){let{domainName:t,hostedZoneId:n,records:i=[]}=e,r=`fjall/domains/${t}`;return[{path:`${r}/infrastructure.ts`,content:QR({domainName:t,records:i,hostedZoneId:n})},{path:`${r}/package.json`,content:eP(t)},{path:`${r}/tsconfig.json`,content:k4},{path:`${r}/cdk.json`,content:O4},{path:`${r}/.gitignore`,content:w4}]}ny(JR,"generateDomainFiles");function QR(e){let{domainName:t,records:n,hostedZoneId:i}=e,r=$e(t.split(".").join("")),o=ns(t),a=n.map(l=>{let m=l.ttl!==void 0?`, ttl: ${l.ttl}`:"";return` { type: ${JSON.stringify(l.type)}, name: ${JSON.stringify(l.name)}, value: ${JSON.stringify(l.value)}${m} },`}),c=a.length>0?`[
452
+ `}ry(XR,"generateZoneFile");var w4=Object.defineProperty,ny=(e,t)=>w4(e,"name",{value:t,configurable:!0});function JR(e){let{domainName:t,hostedZoneId:n,records:i=[]}=e,r=`fjall/domains/${t}`;return[{path:`${r}/infrastructure.ts`,content:QR({domainName:t,records:i,hostedZoneId:n})},{path:`${r}/package.json`,content:eP(t)},{path:`${r}/tsconfig.json`,content:O4},{path:`${r}/cdk.json`,content:D4},{path:`${r}/.gitignore`,content:k4}]}ny(JR,"generateDomainFiles");function QR(e){let{domainName:t,records:n,hostedZoneId:i}=e,r=$e(t.split(".").join("")),o=ns(t),a=n.map(l=>{let m=l.ttl!==void 0?`, ttl: ${l.ttl}`:"";return` { type: ${JSON.stringify(l.type)}, name: ${JSON.stringify(l.name)}, value: ${JSON.stringify(l.value)}${m} },`}),c=a.length>0?`[
453
453
  ${a.join(`
454
454
  `)}
455
455
  ]`:"[]",u=i?` hostedZoneId: ${JSON.stringify(i)},
@@ -476,7 +476,7 @@ ${u} certificates: [
476
476
  records: ${c},
477
477
  });
478
478
  `}ny(QR,"generateDefaultInfrastructureTs");function eP(e){return JSON.stringify({name:`domain-${e}`,version:Eu,scripts:{},devDependencies:{"@types/node":"20.4.9","ts-node":"^10.9.1",typescript:"~5.1.6"},dependencies:{"@fjall/components-infrastructure":`^${Eu}`,"aws-cdk-lib":"^2.260.0",constructs:"^10.6.0"}},null,2)+`
479
- `}ny(eP,"generateDomainPackageJson");var w4=`node_modules/
479
+ `}ny(eP,"generateDomainPackageJson");var k4=`node_modules/
480
480
  cdk.out/
481
481
  *.d.ts
482
482
  *.js
@@ -484,12 +484,12 @@ cdk.out/
484
484
  .fjall-state*.json.tmp
485
485
  .deploy-state.json
486
486
  .deploy-state.json.tmp
487
- `,k4=JSON.stringify({compilerOptions:{target:"ES2020",module:"commonjs",lib:["es2020","dom"],declaration:!0,strict:!0,noImplicitAny:!0,strictNullChecks:!0,noImplicitThis:!0,alwaysStrict:!0,noUnusedLocals:!1,noUnusedParameters:!1,noImplicitReturns:!0,noFallthroughCasesInSwitch:!1,inlineSourceMap:!0,inlineSources:!0,experimentalDecorators:!0,strictPropertyInitialization:!1,typeRoots:["./node_modules/@types"]},exclude:["node_modules","cdk.out"]},null,2)+`
488
- `,O4=JSON.stringify({app:"npx ts-node --prefer-ts-exts --transpile-only infrastructure.ts",assetMetadata:!1,pathMetadata:!1,versionReporting:!1,watch:{include:["**"],exclude:["README.md","cdk*.json","**/*.d.ts","**/*.js","tsconfig.json","package*.json","yarn.lock","node_modules","test"]},context:{"@aws-cdk/aws-lambda:recognizeLayerVersion":!0,"@aws-cdk/core:checkSecretUsage":!0,"@aws-cdk/core:target-partitions":["aws","aws-cn"],"@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver":!0,"@aws-cdk/aws-ec2:uniqueImdsv2TemplateName":!0,"@aws-cdk/aws-ecs:arnFormatIncludesClusterName":!0,"@aws-cdk/aws-iam:minimizePolicies":!0,"@aws-cdk/core:validateSnapshotRemovalPolicy":!0,"@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName":!0,"@aws-cdk/aws-s3:createDefaultLoggingPolicy":!0,"@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption":!0,"@aws-cdk/aws-apigateway:disableCloudWatchRole":!0,"@aws-cdk/core:enablePartitionLiterals":!0,"@aws-cdk/aws-events:eventsTargetQueueSameAccount":!0,"@aws-cdk/aws-iam:standardizedServicePrincipals":!0,"@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker":!0,"@aws-cdk/aws-iam:importedRoleStackSafeDefaultPolicyName":!0,"@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy":!0,"@aws-cdk/aws-route53-patters:useCertificate":!0,"@aws-cdk/customresources:installLatestAwsSdkDefault":!1,"@aws-cdk/aws-rds:databaseProxyUniqueResourceName":!0,"@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup":!0,"@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId":!0,"@aws-cdk/aws-ec2:launchTemplateDefaultUserData":!0,"@aws-cdk/aws-secretsmanager:useAttachedSecretResourcePolicyForSecretTargetAttachments":!0,"@aws-cdk/aws-redshift:columnId":!0,"@aws-cdk/aws-stepfunctions-tasks:enableEmrServicePolicyV2":!0,"@aws-cdk/aws-ec2:restrictDefaultSecurityGroup":!0,"@aws-cdk/aws-apigateway:requestValidatorUniqueId":!0,"@aws-cdk/aws-kms:aliasNameRef":!0,"@aws-cdk/aws-autoscaling:generateLaunchTemplateInsteadOfLaunchConfig":!0,"@aws-cdk/core:includePrefixInUniqueNameGeneration":!0,"@aws-cdk/aws-opensearchservice:enableOpensearchMultiAzWithStandby":!0}},null,2)+`
489
- `;var D4=Object.defineProperty,jr=(e,t)=>D4(e,"name",{value:t,configurable:!0});function rP(e,t,n){let i=e.root?tP.join(e.root,t):t;try{if(Yi.existsSync(i)){let r=`${i}.bak`,o=`${r}.tmp`;Yi.writeFileSync(o,n),Yi.renameSync(o,r)}return C(void 0)}catch(r){let o=vt(r);return bu.warn("Generator",`Failed to create backup of ${t}`,{error:kn(o.message)}),$(o)}}jr(rP,"createInfrastructureBackup");function iy(e,...t){let n={};for(let i of t)e[i]!==void 0&&(n[i]=e[i]);return n}jr(iy,"pickDefined");function nP(e,t){try{let n=kr(e,{extractCustomCode:!0}),i=Sn(n,t,{skipValidation:!0});return n.customCodeBlocks?.length&&(i.customCodeBlocks=n.customCodeBlocks),C({parsed:n,plan:i})}catch(n){return $(vt(n))}}jr(nP,"parseAndBuildPlan");function iP(e,t){let n=nP(e,t);if(!n.success)throw new Error(`Failed to parse infrastructure: ${n.error.message}`,{cause:n.error});return n.data}jr(iP,"parseAndBuildPlanOrThrow");function oP(e,t,n){let i=e.safeParse(t);if(!i.success)throw new Error(`Invalid ${n} generator options:
490
- ${sa(i.error)}`);return i.data}jr(oP,"validateGeneratorOptions");function aP(e,t){let n=qt(t),i=e.read(n)?.toString();if(!i)throw new Error(`App '${t}' not found. Expected infrastructure.ts at: ${n}`);return{path:n,content:i}}jr(aP,"readInfrastructureOrThrow");async function oy(e,t,n,i,r){let o=oP(t,n,i),{path:a,content:c}=aP(e,o.appName),{plan:u}=iP(c,o.appName),l=await r({tree:e,validated:o,plan:u,infrastructurePath:a,content:c}),m=sP(e,a,c,l);if(!m.success)throw new Error(m.error.message,{cause:m.error})}jr(oy,"withInfrastructurePlan");function sP(e,t,n,i){let r=Hi(i);if(!r.success)return $(r.error);let o=rP(e,t,n);return o.success?(e.write(t,r.data),C(void 0)):$(new Error(`Failed to create backup: ${o.error.message}`))}jr(sP,"generateAndWriteInfrastructure");var hS=Hw(jw(),1),LF=Object.defineProperty,zw=(e,t)=>LF(e,"name",{value:t,configurable:!0});async function vS(e,t,n,i){let r=`Connect to existing ${t}?`,o=`Found ${e} ${t}s. Configure connections?`,a=e===1?n??r:i?.replace("{count}",String(e))??o,c=await(0,hS.default)([{type:"confirm",name:"shouldConnect",message:a,initial:!0}]);return c?c.shouldConnect:!1}zw(vS,"promptForConnection");async function bS(e,t,n){if(e.length===1)return process.stdout.write(`
487
+ `,O4=JSON.stringify({compilerOptions:{target:"ES2020",module:"commonjs",lib:["es2020","dom"],declaration:!0,strict:!0,noImplicitAny:!0,strictNullChecks:!0,noImplicitThis:!0,alwaysStrict:!0,noUnusedLocals:!1,noUnusedParameters:!1,noImplicitReturns:!0,noFallthroughCasesInSwitch:!1,inlineSourceMap:!0,inlineSources:!0,experimentalDecorators:!0,strictPropertyInitialization:!1,typeRoots:["./node_modules/@types"]},exclude:["node_modules","cdk.out"]},null,2)+`
488
+ `,D4=JSON.stringify({app:"npx ts-node --prefer-ts-exts --transpile-only infrastructure.ts",assetMetadata:!1,pathMetadata:!1,versionReporting:!1,watch:{include:["**"],exclude:["README.md","cdk*.json","**/*.d.ts","**/*.js","tsconfig.json","package*.json","yarn.lock","node_modules","test"]},context:{"@aws-cdk/aws-lambda:recognizeLayerVersion":!0,"@aws-cdk/core:checkSecretUsage":!0,"@aws-cdk/core:target-partitions":["aws","aws-cn"],"@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver":!0,"@aws-cdk/aws-ec2:uniqueImdsv2TemplateName":!0,"@aws-cdk/aws-ecs:arnFormatIncludesClusterName":!0,"@aws-cdk/aws-iam:minimizePolicies":!0,"@aws-cdk/core:validateSnapshotRemovalPolicy":!0,"@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName":!0,"@aws-cdk/aws-s3:createDefaultLoggingPolicy":!0,"@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption":!0,"@aws-cdk/aws-apigateway:disableCloudWatchRole":!0,"@aws-cdk/core:enablePartitionLiterals":!0,"@aws-cdk/aws-events:eventsTargetQueueSameAccount":!0,"@aws-cdk/aws-iam:standardizedServicePrincipals":!0,"@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker":!0,"@aws-cdk/aws-iam:importedRoleStackSafeDefaultPolicyName":!0,"@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy":!0,"@aws-cdk/aws-route53-patters:useCertificate":!0,"@aws-cdk/customresources:installLatestAwsSdkDefault":!1,"@aws-cdk/aws-rds:databaseProxyUniqueResourceName":!0,"@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup":!0,"@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId":!0,"@aws-cdk/aws-ec2:launchTemplateDefaultUserData":!0,"@aws-cdk/aws-secretsmanager:useAttachedSecretResourcePolicyForSecretTargetAttachments":!0,"@aws-cdk/aws-redshift:columnId":!0,"@aws-cdk/aws-stepfunctions-tasks:enableEmrServicePolicyV2":!0,"@aws-cdk/aws-ec2:restrictDefaultSecurityGroup":!0,"@aws-cdk/aws-apigateway:requestValidatorUniqueId":!0,"@aws-cdk/aws-kms:aliasNameRef":!0,"@aws-cdk/aws-autoscaling:generateLaunchTemplateInsteadOfLaunchConfig":!0,"@aws-cdk/core:includePrefixInUniqueNameGeneration":!0,"@aws-cdk/aws-opensearchservice:enableOpensearchMultiAzWithStandby":!0}},null,2)+`
489
+ `;var M4=Object.defineProperty,jr=(e,t)=>M4(e,"name",{value:t,configurable:!0});function rP(e,t,n){let i=e.root?tP.join(e.root,t):t;try{if(Yi.existsSync(i)){let r=`${i}.bak`,o=`${r}.tmp`;Yi.writeFileSync(o,n),Yi.renameSync(o,r)}return C(void 0)}catch(r){let o=vt(r);return bu.warn("Generator",`Failed to create backup of ${t}`,{error:kn(o.message)}),$(o)}}jr(rP,"createInfrastructureBackup");function iy(e,...t){let n={};for(let i of t)e[i]!==void 0&&(n[i]=e[i]);return n}jr(iy,"pickDefined");function nP(e,t){try{let n=kr(e,{extractCustomCode:!0}),i=Sn(n,t,{skipValidation:!0});return n.customCodeBlocks?.length&&(i.customCodeBlocks=n.customCodeBlocks),C({parsed:n,plan:i})}catch(n){return $(vt(n))}}jr(nP,"parseAndBuildPlan");function iP(e,t){let n=nP(e,t);if(!n.success)throw new Error(`Failed to parse infrastructure: ${n.error.message}`,{cause:n.error});return n.data}jr(iP,"parseAndBuildPlanOrThrow");function oP(e,t,n){let i=e.safeParse(t);if(!i.success)throw new Error(`Invalid ${n} generator options:
490
+ ${sa(i.error)}`);return i.data}jr(oP,"validateGeneratorOptions");function aP(e,t){let n=qt(t),i=e.read(n)?.toString();if(!i)throw new Error(`App '${t}' not found. Expected infrastructure.ts at: ${n}`);return{path:n,content:i}}jr(aP,"readInfrastructureOrThrow");async function oy(e,t,n,i,r){let o=oP(t,n,i),{path:a,content:c}=aP(e,o.appName),{plan:u}=iP(c,o.appName),l=await r({tree:e,validated:o,plan:u,infrastructurePath:a,content:c}),m=sP(e,a,c,l);if(!m.success)throw new Error(m.error.message,{cause:m.error})}jr(oy,"withInfrastructurePlan");function sP(e,t,n,i){let r=Hi(i);if(!r.success)return $(r.error);let o=rP(e,t,n);return o.success?(e.write(t,r.data),C(void 0)):$(new Error(`Failed to create backup: ${o.error.message}`))}jr(sP,"generateAndWriteInfrastructure");var hS=Hw(jw(),1),UF=Object.defineProperty,zw=(e,t)=>UF(e,"name",{value:t,configurable:!0});async function vS(e,t,n,i){let r=`Connect to existing ${t}?`,o=`Found ${e} ${t}s. Configure connections?`,a=e===1?n??r:i?.replace("{count}",String(e))??o,c=await(0,hS.default)([{type:"confirm",name:"shouldConnect",message:a,initial:!0}]);return c?c.shouldConnect:!1}zw(vS,"promptForConnection");async function bS(e,t,n){if(e.length===1)return process.stdout.write(`
491
491
  Auto-selected: ${e[0].name}
492
492
  `),[e[0].name];let i=[];for(;i.length===0;)i=(await(0,hS.default)([{type:"multiselect",name:"selected",message:t,choices:e.map(r=>({title:r.name,value:r.name,description:n?.(r),selected:!1}))}]))?.selected||[],i.length===0&&process.stdout.write(`
493
493
  Please select at least one resource
494
494
 
495
- `);return i}zw(bS,"selectResources");var UF=Object.defineProperty,FF=(e,t)=>UF(e,"name",{value:t,configurable:!0});async function yS(e,t,n,i,r){if(e.compute.length===0)return;if(t.connectionConfig){let{connectToCompute:a=[],connectToServices:c=[]}=t.connectionConfig;c.length>0&&Ki(e,c,n,i),a.length>0&&xn(e,a,n,i);return}if(t.nameProvidedByFlag||!await vS(e.compute.length,"compute resource",r.singularPrompt,r.pluralPrompt))return;let o=await bS(e.compute,"Select compute resources to connect:",a=>a.type.toUpperCase());o.length>0&&xn(e,o,n,i)}FF(yS,"handleResourceConnections");var BF=Object.defineProperty,VF=(e,t)=>BF(e,"name",{value:t,configurable:!0});async function Lw(e,t){await oy(e,h$,t,"S3",async({tree:n,validated:i,plan:r})=>{let o=$e(i.bucketName);rd(n,i.appName,o);let a=i.storagePreset??"standard",c=fl[a],u=r.s3.length,l=u===0?"":`${u+1}`,m={name:o,bucketName:i.bucketName,variableName:`bucket${l}`,...c,...iy(i,"publicReadAccess","websiteHosting","backupVaultTier","versioned","encryption","kmsKeyArn","cors")},p={...r,s3:[...r.s3,m]};return await yS(p,i,o,"storage",{singularPrompt:"Found an existing compute resource. Connect this bucket to it?",pluralPrompt:"Found {count} compute resources. Connect this bucket to them?"}),p})}VF(Lw,"s3Generator");var qJ=Lw;export{qJ as default,Lw as s3Generator};
495
+ `);return i}zw(bS,"selectResources");var FF=Object.defineProperty,BF=(e,t)=>FF(e,"name",{value:t,configurable:!0});async function yS(e,t,n,i,r){if(e.compute.length===0)return;if(t.connectionConfig){let{connectToCompute:a=[],connectToServices:c=[]}=t.connectionConfig;c.length>0&&Ki(e,c,n,i),a.length>0&&xn(e,a,n,i);return}if(t.nameProvidedByFlag||!await vS(e.compute.length,"compute resource",r.singularPrompt,r.pluralPrompt))return;let o=await bS(e.compute,"Select compute resources to connect:",a=>a.type.toUpperCase());o.length>0&&xn(e,o,n,i)}BF(yS,"handleResourceConnections");var VF=Object.defineProperty,ZF=(e,t)=>VF(e,"name",{value:t,configurable:!0});async function Lw(e,t){await oy(e,h$,t,"S3",async({tree:n,validated:i,plan:r})=>{let o=$e(i.bucketName);rd(n,i.appName,o);let a=i.storagePreset??"standard",c=fl[a],u=r.s3.length,l=u===0?"":`${u+1}`,m={name:o,bucketName:i.bucketName,variableName:`bucket${l}`,...c,...iy(i,"publicReadAccess","websiteHosting","backupVaultTier","versioned","encryption","kmsKeyArn","cors")},p={...r,s3:[...r.s3,m]};return await yS(p,i,o,"storage",{singularPrompt:"Found an existing compute resource. Connect this bucket to it?",pluralPrompt:"Found {count} compute resources. Connect this bucket to them?"}),p})}ZF(Lw,"s3Generator");var KJ=Lw;export{KJ as default,Lw as s3Generator};