@coalescesoftware/coa 7.40.2 → 7.40.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/coa.js CHANGED
@@ -7874,7 +7874,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}};(function(r)
7874
7874
  `,p),p}return i}});var iJo=m((ATC,vAl)=>{"use strict";vAl.exports=CAl;function CAl(r,t,n){r instanceof RegExp&&(r=EAl(r,n)),t instanceof RegExp&&(t=EAl(t,n));var i=SAl(r,t,n);return i&&{start:i[0],end:i[1],pre:n.slice(0,i[0]),body:n.slice(i[0]+r.length,i[1]),post:n.slice(i[1]+t.length)}}function EAl(r,t){var n=t.match(r);return n?n[0]:null}CAl.range=SAl;function SAl(r,t,n){var i,o,s,a,u,p=n.indexOf(r),c=n.indexOf(t,p+1),l=p;if(p>=0&&c>0){if(r===t)return[p,c];for(i=[],s=n.length;l>=0&&!u;)l==p?(i.push(l),p=n.indexOf(r,l+1)):i.length==1?u=[i.pop(),c]:(o=i.pop(),o<s&&(s=o,a=c),c=n.indexOf(t,l+1)),l=p<c&&p>=0?p:c;i.length&&(u=[s,a])}return u}});var xAl=m((mTC,MAl)=>{var TAl=iJo();MAl.exports=Ej1;var _Al="\0SLASH"+Math.random()+"\0",IAl="\0OPEN"+Math.random()+"\0",sJo="\0CLOSE"+Math.random()+"\0",RAl="\0COMMA"+Math.random()+"\0",OAl="\0PERIOD"+Math.random()+"\0";function oJo(r){return parseInt(r,10)==r?parseInt(r,10):r.charCodeAt(0)}function yj1(r){return r.split("\\\\").join(_Al).split("\\{").join(IAl).split("\\}").join(sJo).split("\\,").join(RAl).split("\\.").join(OAl)}function bj1(r){return r.split(_Al).join("\\").split(IAl).join("{").split(sJo).join("}").split(RAl).join(",").split(OAl).join(".")}function wAl(r){if(!r)return[""];var t=[],n=TAl("{","}",r);if(!n)return r.split(",");var i=n.pre,o=n.body,s=n.post,a=i.split(",");a[a.length-1]+="{"+o+"}";var u=wAl(s);return s.length&&(a[a.length-1]+=u.shift(),a.push.apply(a,u)),t.push.apply(t,a),t}function Ej1(r){return r?(r.substr(0,2)==="{}"&&(r="\\{\\}"+r.substr(2)),M4t(yj1(r),!0).map(bj1)):[]}function Cj1(r){return"{"+r+"}"}function Sj1(r){return/^-?0\d/.test(r)}function vj1(r,t){return r<=t}function Tj1(r,t){return r>=t}function M4t(r,t){var n=[],i=TAl("{","}",r);if(!i)return[r];var o=i.pre,s=i.post.length?M4t(i.post,!1):[""];if(/\$$/.test(i.pre))for(var a=0;a<s.length;a++){var u=o+"{"+i.body+"}"+s[a];n.push(u)}else{var p=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),l=p||c,d=i.body.indexOf(",")>=0;if(!l&&!d)return i.post.match(/,.*\}/)?(r=i.pre+"{"+i.body+sJo+i.post,M4t(r)):[r];var f;if(l)f=i.body.split(/\.\./);else if(f=wAl(i.body),f.length===1&&(f=M4t(f[0],!1).map(Cj1),f.length===1))return s.map(function(K){return i.pre+f[0]+K});var h;if(l){var A=oJo(f[0]),E=oJo(f[1]),v=Math.max(f[0].length,f[1].length),T=f.length==3?Math.abs(oJo(f[2])):1,O=vj1,D=E<A;D&&(T*=-1,O=Tj1);var L=f.some(Sj1);h=[];for(var k=A;O(k,E);k+=T){var q;if(c)q=String.fromCharCode(k),q==="\\"&&(q="");else if(q=String(k),L){var G=v-q.length;if(G>0){var H=new Array(G+1).join("0");k<0?q="-"+H+q.slice(1):q=H+q}}h.push(q)}}else{h=[];for(var W=0;W<f.length;W++)h.push.apply(h,M4t(f[W],!1))}for(var W=0;W<h.length;W++)for(var a=0;a<s.length;a++){var u=o+h[W]+s[a];(!t||l||u)&&n.push(u)}}return n}});var LAl,P3,_j1,Ij1,Rj1,Oj1,wj1,Mj1,xj1,Pj1,Nj1,Dj1,Bj1,Lj1,kj1,qj1,Fj1,Uj1,zj1,Qj1,DAl,BAl,jj1,KRr,uJo,Gj1,uz,PAl,cJo,aJo,Hj1,Vj1,kAl,NAl,Wj1,Kj1,kCe,Yj1,qAl,Jj1,YRr,WRr,$j1,lJo,Xj1,Zj1,eG1,tG1,irt,x4t=V(()=>{LAl=gt(xAl(),1),P3=(r,t,n={})=>(YRr(t),!n.nocomment&&t.charAt(0)==="#"?!1:new irt(t,n).match(r)),_j1=/^\*+([^+@!?\*\[\(]*)$/,Ij1=r=>t=>!t.startsWith(".")&&t.endsWith(r),Rj1=r=>t=>t.endsWith(r),Oj1=r=>(r=r.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(r)),wj1=r=>(r=r.toLowerCase(),t=>t.toLowerCase().endsWith(r)),Mj1=/^\*+\.\*+$/,xj1=r=>!r.startsWith(".")&&r.includes("."),Pj1=r=>r!=="."&&r!==".."&&r.includes("."),Nj1=/^\.\*+$/,Dj1=r=>r!=="."&&r!==".."&&r.startsWith("."),Bj1=/^\*+$/,Lj1=r=>r.length!==0&&!r.startsWith("."),kj1=r=>r.length!==0&&r!=="."&&r!=="..",qj1=/^\?+([^+@!?\*\[\(]*)?$/,Fj1=([r,t=""])=>{let n=DAl([r]);return t?(t=t.toLowerCase(),i=>n(i)&&i.toLowerCase().endsWith(t)):n},Uj1=([r,t=""])=>{let n=BAl([r]);return t?(t=t.toLowerCase(),i=>n(i)&&i.toLowerCase().endsWith(t)):n},zj1=([r,t=""])=>{let n=BAl([r]);return t?i=>n(i)&&i.endsWith(t):n},Qj1=([r,t=""])=>{let n=DAl([r]);return t?i=>n(i)&&i.endsWith(t):n},DAl=([r])=>{let t=r.length;return n=>n.length===t&&!n.startsWith(".")},BAl=([r])=>{let t=r.length;return n=>n.length===t&&n!=="."&&n!==".."},jj1=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",KRr=jj1==="win32",uJo=KRr?{sep:"\\"}:{sep:"/"},Gj1=uJo.sep;P3.sep=Gj1;uz=Symbol("globstar **");P3.GLOBSTAR=uz;PAl={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},cJo="[^/]",aJo=cJo+"*?",Hj1="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Vj1="(?:(?!(?:\\/|^)\\.).)*?",kAl=r=>r.split("").reduce((t,n)=>(t[n]=!0,t),{}),NAl=kAl("().*{}+?[]^$\\!"),Wj1=kAl("[.("),Kj1=(r,t={})=>n=>P3(n,r,t);P3.filter=Kj1;kCe=(r,t={})=>Object.assign({},r,t),Yj1=r=>{if(!r||typeof r!="object"||!Object.keys(r).length)return P3;let t=P3;return Object.assign((i,o,s={})=>t(i,o,kCe(r,s)),{Minimatch:class extends t.Minimatch{constructor(o,s={}){super(o,kCe(r,s))}static defaults(o){return t.defaults(kCe(r,o)).Minimatch}},filter:(i,o={})=>t.filter(i,kCe(r,o)),defaults:i=>t.defaults(kCe(r,i)),makeRe:(i,o={})=>t.makeRe(i,kCe(r,o)),braceExpand:(i,o={})=>t.braceExpand(i,kCe(r,o)),match:(i,o,s={})=>t.match(i,o,kCe(r,s)),sep:t.sep,GLOBSTAR:uz})};P3.defaults=Yj1;qAl=(r,t={})=>(YRr(r),t.nobrace||!/\{(?:(?!\{).)*\}/.test(r)?[r]:(0,LAl.default)(r));P3.braceExpand=qAl;Jj1=1024*64,YRr=r=>{if(typeof r!="string")throw new TypeError("invalid pattern");if(r.length>Jj1)throw new TypeError("pattern is too long")},WRr=Symbol("subparse"),$j1=(r,t={})=>new irt(r,t).makeRe();P3.makeRe=$j1;lJo=(r,t,n={})=>{let i=new irt(t,n);return r=r.filter(o=>i.match(o)),i.options.nonull&&!r.length&&r.push(t),r};P3.match=lJo;Xj1=r=>r.replace(/\\(.)/g,"$1"),Zj1=r=>r.replace(/\\([^-\]])/g,"$1"),eG1=r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),tG1=r=>r.replace(/[[\]\\]/g,"\\$&"),irt=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;regexp;constructor(t,n={}){YRr(t),n=n||{},this.options=n,this.pattern=t,this.windowsPathsNoEscape=!!n.windowsPathsNoEscape||n.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!n.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!n.nonegate,this.comment=!1,this.empty=!1,this.partial=!!n.partial,this.globSet=[],this.globParts=[],this.set=[],this.make()}debug(...t){}make(){let t=this.pattern,n=this.options;if(!n.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=this.braceExpand(),n.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let i=this.globSet.map(s=>this.slashSplit(s));if(this.options.noglobstar)this.globParts=i;else{for(let s of i){let a;do{a=!1;for(let u=0;u<s.length-1;u++)s[u]==="*"&&s[u-1]==="**"&&(s[u]="**",s[u-1]="*",a=!0)}while(a)}this.globParts=i.map(s=>(s=s.reduce((a,u)=>{let p=a[a.length-1];return u==="**"&&p==="**"?a:u===".."&&p&&p!==".."&&p!=="."&&p!=="**"?(a.pop(),a):(a.push(u),a)},[]),s.length===0?[""]:s))}this.debug(this.pattern,this.globParts);let o=this.globParts.map((s,a,u)=>s.map(p=>this.parse(p)));if(this.debug(this.pattern,o),this.set=o.filter(s=>s.indexOf(!1)===-1),KRr)for(let s=0;s<this.set.length;s++){let a=this.set[s];a[0]===""&&a[1]===""&&this.globParts[s][2]==="?"&&typeof a[3]=="string"&&/^[a-z]:$/i.test(a[3])&&(a[2]="?")}this.debug(this.pattern,this.set)}parseNegate(){if(this.nonegate)return;let t=this.pattern,n=!1,i=0;for(let o=0;o<t.length&&t.charAt(o)==="!";o++)n=!n,i++;i&&(this.pattern=t.slice(i)),this.negate=n}matchOne(t,n,i=!1){let o=this.options;if(KRr){let A=t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]=="string"&&/^[a-z]:$/i.test(t[3]),E=n[0]===""&&n[1]===""&&n[2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3]);if(A&&E){let v=t[3],T=n[3];v.toLowerCase()===T.toLowerCase()&&(t[3]=T)}else if(E&&typeof t[0]=="string"){let v=n[3],T=t[0];v.toLowerCase()===T.toLowerCase()&&(n[3]=T,n=n.slice(3))}else if(A&&typeof n[0]=="string"){let v=t[3];v.toLowerCase()===n[0].toLowerCase()&&(n[0]=v,t=t.slice(3))}}this.debug("matchOne",this,{file:t,pattern:n}),this.debug("matchOne",t.length,n.length);for(var s=0,a=0,u=t.length,p=n.length;s<u&&a<p;s++,a++){this.debug("matchOne loop");var c=n[a],l=t[s];if(this.debug(n,c,l),c===!1)return!1;if(c===uz){this.debug("GLOBSTAR",[n,c,l]);var d=s,f=a+1;if(f===p){for(this.debug("** at the end");s<u;s++)if(t[s]==="."||t[s]===".."||!o.dot&&t[s].charAt(0)===".")return!1;return!0}for(;d<u;){var h=t[d];if(this.debug(`
7875
7875
  globstar while`,t,d,n,f,h),this.matchOne(t.slice(d),n.slice(f),i))return this.debug("globstar found match!",d,u,h),!0;if(h==="."||h===".."||!o.dot&&h.charAt(0)==="."){this.debug("dot detected!",t,d,n,f);break}this.debug("globstar swallow a segment, and continue"),d++}return!!(i&&(this.debug(`
7876
7876
  >>> no match, partial?`,t,d,n,f),d===u))}let A;if(typeof c=="string"?(A=l===c,this.debug("string match",c,l,A)):(A=c.test(l),this.debug("pattern match",c,l,A)),!A)return!1}if(s===u&&a===p)return!0;if(s===u)return i;if(a===p)return s===u-1&&t[s]==="";throw new Error("wtf?")}braceExpand(){return qAl(this.pattern,this.options)}parse(t,n){YRr(t);let i=this.options;if(t==="**")if(i.noglobstar)t="*";else return uz;if(t==="")return"";let o,s=null;n!==WRr&&((o=t.match(Bj1))?s=i.dot?kj1:Lj1:(o=t.match(_j1))?s=(i.nocase?i.dot?wj1:Oj1:i.dot?Rj1:Ij1)(o[1]):(o=t.match(qj1))?s=(i.nocase?i.dot?Uj1:Fj1:i.dot?zj1:Qj1)(o):(o=t.match(Mj1))?s=i.dot?Pj1:xj1:(o=t.match(Nj1))&&(s=Dj1));let a="",u=!1,p=!1,c=[],l=[],d=!1,f=!1,h=-1,A=-1,E,v,T,O=t.charAt(0)===".",D=i.dot||O,L=()=>O?"":D?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",k=W=>W.charAt(0)==="."?"":i.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",q=()=>{if(d){switch(d){case"*":a+=aJo,u=!0;break;case"?":a+=cJo,u=!0;break;default:a+="\\"+d;break}this.debug("clearStateChar %j %j",d,a),d=!1}};for(let W=0,K;W<t.length&&(K=t.charAt(W));W++){if(this.debug("%s %s %s %j",t,W,a,K),p){if(K==="/")return!1;NAl[K]&&(a+="\\"),a+=K,p=!1;continue}switch(K){case"/":return!1;case"\\":if(f&&t.charAt(W+1)==="-"){a+=K;continue}q(),p=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s %s %s %j <-- stateChar",t,W,a,K),f){this.debug(" in class"),K==="!"&&W===A+1&&(K="^"),a+=K;continue}this.debug("call clearStateChar %j",d),q(),d=K,i.noext&&q();continue;case"(":{if(f){a+="(";continue}if(!d){a+="\\(";continue}let F={type:d,start:W-1,reStart:a.length,open:PAl[d].open,close:PAl[d].close};this.debug(this.pattern," ",F),c.push(F),a+=F.open,F.start===0&&F.type!=="!"&&(O=!0,a+=k(t.slice(W+1))),this.debug("plType %j %j",d,a),d=!1;continue}case")":{let F=c[c.length-1];if(f||!F){a+="\\)";continue}c.pop(),q(),u=!0,v=F,a+=v.close,v.type==="!"&&l.push(Object.assign(v,{reEnd:a.length}));continue}case"|":{let F=c[c.length-1];if(f||!F){a+="\\|";continue}q(),a+="|",F.start===0&&F.type!=="!"&&(O=!0,a+=k(t.slice(W+1)));continue}case"[":if(q(),f){a+="\\"+K;continue}f=!0,A=W,h=a.length,a+=K;continue;case"]":if(W===A+1||!f){a+="\\"+K;continue}E=t.substring(A+1,W);try{RegExp("["+tG1(Zj1(E))+"]"),a+=K}catch{a=a.substring(0,h)+"(?:$.)"}u=!0,f=!1;continue;default:q(),NAl[K]&&!(K==="^"&&f)&&(a+="\\"),a+=K;break}}for(f&&(E=t.slice(A+1),T=this.parse(E,WRr),a=a.substring(0,h)+"\\["+T[0],u=u||T[1]),v=c.pop();v;v=c.pop()){let W;W=a.slice(v.reStart+v.open.length),this.debug(this.pattern,"setting tail",a,v),W=W.replace(/((?:\\{2}){0,64})(\\?)\|/g,(F,J,Y)=>(Y||(Y="\\"),J+J+Y+"|")),this.debug(`tail=%j
7877
- %s`,W,W,v,a);let K=v.type==="*"?aJo:v.type==="?"?cJo:"\\"+v.type;u=!0,a=a.slice(0,v.reStart)+K+"\\("+W}q(),p&&(a+="\\\\");let G=Wj1[a.charAt(0)];for(let W=l.length-1;W>-1;W--){let K=l[W],F=a.slice(0,K.reStart),J=a.slice(K.reStart,K.reEnd-8),Y=a.slice(K.reEnd),z=a.slice(K.reEnd-8,K.reEnd)+Y,Z=F.split(")").length,ee=F.split("(").length-Z,ne=Y;for(let te=0;te<ee;te++)ne=ne.replace(/\)[+*?]?/,"");Y=ne;let se=Y===""&&n!==WRr?"(?:$|\\/)":"";a=F+J+Y+se+z}if(a!==""&&u&&(a="(?=.)"+a),G&&(a=L()+a),n===WRr)return[a,u];if(i.nocase&&!u&&!i.nocaseMagicOnly&&(u=t.toUpperCase()!==t.toLowerCase()),!u)return Xj1(t);let H=i.nocase?"i":"";try{let W=s?{_glob:t,_src:a,test:s}:{_glob:t,_src:a};return Object.assign(new RegExp("^"+a+"$",H),W)}catch(W){return this.debug("invalid regexp",W),new RegExp("$.")}}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let n=this.options,i=n.noglobstar?aJo:n.dot?Hj1:Vj1,o=n.nocase?"i":"",s=t.map(a=>{let u=a.map(p=>typeof p=="string"?eG1(p):p===uz?uz:p._src);return u.forEach((p,c)=>{let l=u[c+1],d=u[c-1];p!==uz||d===uz||(d===void 0?l!==void 0&&l!==uz?u[c+1]="(?:\\/|"+i+"\\/)?"+l:u[c]=i:l===void 0?u[c-1]=d+"(?:\\/|"+i+")?":l!==uz&&(u[c-1]=d+"(?:\\/|\\/"+i+"\\/)"+l,u[c+1]=uz))}),u.filter(p=>p!==uz).join("/")}).join("|");s="^(?:"+s+")$",this.negate&&(s="^(?!"+s+").*$");try{this.regexp=new RegExp(s,o)}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):KRr&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,n=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&n)return!0;let i=this.options;uJo.sep!=="/"&&(t=t.split(uJo.sep).join("/"));let o=this.slashSplit(t);this.debug(this.pattern,"split",o);let s=this.set;this.debug(this.pattern,"set",s);let a=o[o.length-1];if(!a)for(let u=o.length-2;!a&&u>=0;u--)a=o[u];for(let u=0;u<s.length;u++){let p=s[u],c=o;if(i.matchBase&&p.length===1&&(c=[a]),this.matchOne(c,p,n))return i.flipNegate?!0:!this.negate}return i.flipNegate?!1:this.negate}static defaults(t){return P3.defaults(t).Minimatch}};P3.Minimatch=irt});var UAl,zAl,QAl,jAl,GAl,HAl,VAl,WAl,KAl,YAl,JAl,FAl,ort,$Al=V(()=>{"use strict";x4t();UAl=2,zAl=1,QAl=3,jAl=2,GAl=8,HAl=5,VAl=6,WAl=new RegExp(/([\+]?){([\s\S]+)}([\+](?![\+]))?\s*/g),KAl=new RegExp(/((\w+):\s*((?:["])((([^\"\+\r\n\[/\\]+))(?:["]))|(([^\"\ \+\r\n\[/\\]+))))/g),YAl=new RegExp(/((\w+):\s*(((?:["])(((?:[^"]|"")*))(?:["]))|(([^\"\ \+\r\n\[/\\]+))))/g),JAl=new RegExp(/((?:[^\+\ \r\n\[\\]|\\.|\[(?:[^\r\n\]\\]|\\.)*\])+)\s*/g),FAl="",ort=(r,t)=>{if(t==="*")return r.some(o=>o!=null&&String(o).length>0);let n=r.map(o=>o!=null?String(o).replace(/\//g,FAl):""),i=t.replace(/\//g,FAl);return!!lJo(n,i).length}});var srt,vTC,XAl,ZAl,eml,JRr,tml,$Rr=V(()=>{"use strict";Zr();Bo();Sd();k_();ar();nJo();$Al();srt=We("SEARCH"),vTC=M.object({include:M.string(),exclude:M.string(),enabled:M.boolean()}),XAl={name:{MatchFunction:ort,MatchList:r=>[r.operation.name]},location:{MatchFunction:ort,MatchList:r=>[r.operation.locationName]},nodeType:{MatchFunction:ort,MatchList:r=>[r.operation.sqlType]},subgraph:{MatchFunction:ort,MatchList:r=>[r?.id?.toString(),r.name]},nodeID:{MatchFunction:ort,MatchList:r=>[r]}},ZAl=r=>{let t=[];return r.forEach((n,i)=>{if(n==="+{"||n==="{"||n==="}"||n==="}+")return;let o=n,s=n.split(""),a=s[s.length-1],u=s[0];a!=="}"&&a!=="+"&&(o=o+r[i+1]),u!=="{"&&u!=="+"&&(o=r[i-1]+o),t.push(o)}),t},eml=(r,t,n,i=!1)=>{let{steps:o,graphInformation:s,allSubgraphs:a,allStepTypesYAML:u}=n,p={},c=KI()?Date.now():performance.now(),l=r;l||(l=t);let d=l.split(/(\}\+?)\s*(or|OR|\|\|)\s*(\+?\{)/).filter(A=>!(A==="OR"||A==="or"||A==="||")),f=ZAl(d);f.length||(f=[t]),srt.debug("got unions",f,"searchStringTouse",l,"defaultSearchString",t,"steps",o),f.forEach(A=>{let E=A.split(/(\}\+?)\s*(and|AND|\,)\s*(\+?\{)/).filter(L=>!(L==="AND"||L==="and"||L===",")),v=ZAl(E),T=[];v.forEach(L=>{let k={};srt.debug("Got intersection:",L);let q=[...L.matchAll(WAl)];if(srt.debug("Got matches:",L,q),!q[0])return;let G=q[0][UAl],H={prefix:q[0][zAl]||"",postfix:q[0][QAl]||""};if(G.indexOf(":")>-1){let F=i?YAl:KAl,J=[...G.trim().matchAll(F)],Y=i?VAl:HAl;J.forEach(z=>{let Z=z[jAl],ee=z[GAl]||z[Y];H[Z]=ee})}else{let J=[...G.trim().matchAll(JAl)][0];J&&(H.name=J[0])}BO(H);let W=H;srt.debug("Got groups ",L,W);let K=new Set;if(W.subgraph?Object.values(a).forEach(F=>{let J=XAl.subgraph,Y=J.MatchList(F);if(J.MatchFunction(Y,W.subgraph)){let{steps:Z}=F;Z.forEach(ee=>{K.add(ee.toString())})}else return}):K=new Set(Object.keys(o)),W.nodeType){let{nodeType:F}=W;if(!u[F]){let J=F;Object.entries(u).forEach(([Y,z])=>{z.name===F&&(J=Y)}),W.nodeType=J}}Object.keys(o).forEach(F=>{if(!W){srt.emerg("got an unexpected undefined value for match",l,W,L);return}let J=K.has(F);if(Object.entries(W).forEach(([Y,z])=>{let Z=o[F];if(Y==="nodeID"&&(Z=F),Y==="subgraph"){J=K.has(F);return}let ee=XAl[Y];if(ee){let ne=ee.MatchList(Z).filter(se=>se!=null);J=J&&ee.MatchFunction(ne,z)}}),J){if(k[F]=!0,W.prefix&&s){let Y=rJo(s,F,"predecessors");Object.values(Y).forEach(z=>[...z.keys()].forEach(Z=>k[Z]=!0))}if(W.postfix&&s){let Y=rJo(s,F,"successors");Object.values(Y).forEach(z=>[...z.keys()].forEach(Z=>k[Z]=!0))}}}),T.push(k)}),T.length||T.push({});let O={};Object.keys(o).forEach(L=>{O[L]=!0});let D=T.reduce((L,k)=>Object.fromEntries(JBc(L,k).map(q=>[q,!0])),O);p={...p,...D}});let h=KI()?Date.now():performance.now();return srt.debug("Time that search took: ",h-c),p},JRr=(r,t,n,i=!1)=>{let o=eml(`${r}`,"{ * }",n,i),s=eml(`${t}`,"!*",n,i),a=o;return Object.keys(s).forEach(u=>{delete a[u]}),{stepsResult:a}},tml=(r,t,n,i)=>{let o=[];return t.forEach(s=>{let a=i[s];if(a){let{name:u}=a,p=`{ subgraph: "${u}" }`;o.push(p)}}),r.forEach(s=>{let a=n[s];if(a){let{locationName:u,name:p}=a.operation,c=`{ location: "${u}" name: "${p}" }`;o.push(c)}}),o}});var nG1,rml,pJo,nml,XRr=V(()=>{"use strict";fo();ar();$Rr();nG1=We("JOBS"),rml=r=>!r?.hasOwnProperty("includeSelector")||!r?.hasOwnProperty("version"),pJo=(r,t,n)=>{let{steps:i,subgraphs:o,...s}=r,a={...s};if(a.hasOwnProperty("version")||(a.version=OZ),a.hasOwnProperty("includeSelector"))return a;a.includeSelector="",a.excludeSelector="";let u=new Set(i),p=new Set(o),d=tml([...u],[...p].map(f=>`${f}`),n,t).map(f=>`+${f}`).join(" OR ");return a.includeSelector=d,nG1.info("Upgrading job v1 to v2",r,a),a},nml=(r,t)=>{let{jobs:n,folders:i,steps:o}=r,s=n[t];return pJo(s,i,o)}});var PTC,iml,oml=V(()=>{"use strict";fr();gc();ar();Bde();PTC=We("PACKAGES_BACKEND"),iml=(r,t,n)=>{let i=yHo(t)??"",o=r?.config?.entities?.nodeTypes[i];return o||(n.error(`No config found for node type ${t}`),{isDisabled:!1,defaultStorageLocation:null})}});var art,iG1,oG1,ZRr=V(()=>{"use strict";qa();ar();b_r();oml();art=(r,t={})=>Object.values(r).map(n=>iG1(n)).reduce((n,i)=>{for(let[o,s]of Object.entries(i))n[o]=s;return n},t),iG1=r=>Object.fromEntries(Object.entries(r?.contents?.nodeTypes??{}).map(([t,n])=>{let{id:i,nodeType:o}=oG1(r.alias,t,r,n);return[i,o]})),oG1=(r,t,n,i)=>{let o=ful(r,t),{isDisabled:s,defaultStorageLocation:a}=iml(n,o,We("PACKAGES")),u={...ul(i),id:o,isDisabled:s};return u.metadata.defaultStorageLocation=a,{id:o,nodeType:u}}});var Jo,sG1,sml,aml,dJo,jTC,aG1,uml,uG1,cG1,eOr,fJo=V(()=>{"use strict";Jo=gt(CU());fo();kV();qbr();Ha();sG1=Jo.Record({type:Jo.Unknown,name:Jo.String}),sml=Jo.Record({locationName:Jo.String,nodeName:Jo.String}),aml=Jo.Record({sql:Jo.String,success:Jo.Boolean,rows:Jo.Array(Jo.Unknown),fields:Jo.Array(sG1),error:Jo.Union(Jo.Null,xbr).optional(),startTime:Jo.Unknown,endTime:Jo.Unknown,status:Jo.String,name:Jo.String,isRunning:Jo.Boolean,exportedRefs:Jo.Array(sml),invalidExportedRefs:Jo.Array(sml),queryResultSequence:Jo.Optional(Jo.Unknown),type:Jo.Union(Jo.Literal("sql"),Jo.Literal("sqlTest")).optional(),warehouse:Jo.String.nullable().optional(),queryID:Jo.String.nullable().optional()}),dJo=Jo.Record({name:Jo.String,queryResults:Jo.Array(aml),isRunning:Jo.Boolean,renderQueryResults:Jo.Optional(aml)}),jTC=Jo.Record({runExecutionSequenceID:Jo.Number,runResultVersion:Jo.Number,name:Jo.String,queryResultSequence:dJo,runState:Jo.String}),aG1=Jo.Record({dataResult:Jo.Unknown,name:Jo.String,queryResultSequence:dJo,runExecutionSequenceID:Jo.Number,runResultVersion:Jo.Number,runState:Jo.String,stepRunState:G$e(m8o)}),uml=wx("RunResultFirestoreValidator",aG1),uG1=Jo.Record({nodeID:Jo.String,queryResultSequence:dJo,runState:Jo.String,hasTestFailures:Jo.Boolean.optional()}),cG1=Jo.Record({runResults:Jo.Record({runStartTime:Jo.Unknown,runEndTime:Jo.Unknown,runFailureReason:Jo.Optional(Jo.String),runType:Jo.String,runStatus:Jo.String,runResults:Jo.Array(uG1),runID:Jo.Number,environmentID:Jo.String,snowflakeAccount:Jo.String.optional(),snowflakeWarehouse:Jo.String.optional(),jobID:Jo.Number.optional(),hasFailedTest:Jo.Boolean.optional(),runTimeParameters:Jo.Unknown.nullable(),includeNodesSelector:Jo.String.optional(),excludeNodesSelector:Jo.String.optional()})}),eOr=wx("TRunOutput",cG1)});var VTC,pG1,WTC,cml=V(()=>{"use strict";fo();qbr();VTC=G$e(A8o),pG1=["deploy","refresh","rerun","plan"],WTC=[...pG1,"devRun"]});var zBe,tOr=V(()=>{"use strict";qa();k_();ar();zBe=class{constructor(t,n,i,o){this.allNodes=t;this.renderResults=n;this.extraRefs=i;this.logContext=o;this.phasedRefUsage=n.map("phased ref usage",s=>s.map(a=>a.runDetails.ref_usage))}allNodes;renderResults;extraRefs;logContext;phasedRefUsage;buildPhase(t,n){let i="[DependencyBuilder.buildPhase()]",o=n.keys(),s=Object.keys(this.extraRefs),a=[...new Set([...o,...s])];if(We("PIPELINE").appContext(this.logContext,i,"Nodes present in both current-phase data AND extra non-phased (views & advanced deploy) data:",SCo([...o],s)),this.noDependenciesPhases.includes(t))return Object.fromEntries(a.map(u=>[u,[]]));{let u=this.getNodeRefsInPhase(t,a),p=new sBe(uE(this.allNodes,a));return Zv(u,(c,l)=>{let{nodeIDsToAdd:d}=zet(c,p);return[...new Set(d)].filter(f=>f!==l)})}}build(){return Object.fromEntries([...this.phasedRefUsage.entries()].map(([t,n])=>[t,this.buildPhase(t,n)]))}}});var r_C,hJo=V(()=>{"use strict";fr();ar();gc();r_C=We("DEBUG")});var lml=V(()=>{"use strict"});var rOr,gJo=V(()=>{"use strict";rOr=r=>{typeof r.stepCounter=="number"&&(r.stepCounter=`${r.stepCounter}`),typeof r.columnCounter=="number"&&(r.columnCounter=`${r.columnCounter}`)}});var qCe,Zs,AJo=V(()=>{"use strict";Ns();vU();qCe=new Date("1980-01-01T00:00:00.000Z"),Zs=(r,t,n)=>{let i=`${r}Entity`;return n||(n=ia(t)),{standard:Pr(i,n),strict:Pr(`${i} (strict)`,t)}}});var pml,dG1,dml,QBe,P4t,mJo,yJo,Ju,bJo,N3,EJo=V(()=>{"use strict";$m();AJo();Rde();pml=r=>{if(Array.isArray(r))for(let t=r.length-1;t>=0;t--)r[t]===void 0&&r.splice(t,1);if(r&&typeof r=="object")for(let t in r)r.hasOwnProperty(t)&&r[t]===void 0&&delete r[t];return[r,!1]},dG1=(r,t)=>{if(r&&typeof r=="object"){let n=r;if(n.toDate&&(!isNaN(n.seconds)&&!isNaN(n.nanoseconds)||!isNaN(n._seconds)&&!isNaN(n._nanoseconds))){let i=n.toDate();return i.getTime()===Tde.SENTINEL_DATE&&Ql().emerg(`Repository server timestamp sentinel value found in stored data at path ${t}`),[i,!0]}}return[r,!1]},dml=(r,t)=>r instanceof q6e?[t.getDeleteSentinel(),!0]:r instanceof Date&&r.getTime()===Tde.SENTINEL_DATE?[t.getServerTimestampSentinel(),!0]:[r,!1],QBe=(r,t,n)=>{let[i,o]=t(n,r);if(!o&&typeof i=="object"){if(Array.isArray(i))return i.map(s=>QBe(r,t,s));for(let s in i)i.hasOwnProperty(s)&&(i[s]=QBe(r,t,i[s]))}return i},P4t=class{fromStorage(t,n,i,o,s){try{return this.transformFromStorage(t,n,i,o,s)}catch(a){if(s?.onDataTransformError&&s.onDataTransformError(n,a),!s?.ignoreDataTransformErrors)throw Ql().debug(`Error transforming repository entity ${n} from storage: ${a}`),a}return i}toStorage(t,n,i,o,s){try{return this.transformToStorage(t,n,i,o,s)}catch(a){if(s?.onDataTransformError&&s.onDataTransformError(n,a),!s?.ignoreDataTransformErrors)throw Ql().debug(`Error transforming repository entity ${n} to storage ${a}`),a}return i}mergeToStorage(t,n,i,o,s){try{return this.mergeTransformToStorage(t,n,i,o,s)}catch(a){if(s?.onDataTransformError&&s.onDataTransformError(n,a),!s?.ignoreDataTransformErrors)throw Ql().debug(`Error merge transforming repository entity ${n} to storage ${a}`),a}return i}},mJo=class extends P4t{constructor(n=!1){super();this.preserveID=n}preserveID;transformFromStorage(n,i,o){return"id"in o?o.id!=n&&(Ql().error(`'id' property does not match doc id on doc at path ${i}; doc id: ${n}, value.id: ${o.id}`),o.id=n):o.id=n,"createdAt"in o||(o.createdAt=qCe),"updatedAt"in o||(o.updatedAt=qCe),QBe(i,dG1,o)}transformToStorage(n,i,o,s){return this.preserveID||delete o.id,QBe(i,a=>{let[u,p]=dml(a,s);return p?[u,!0]:pml(u)},o)}mergeTransformToStorage(n,i,o,s){return this.preserveID||delete o.id,QBe(i,a=>{let[u,p]=dml(a,s);return p?[u,!0]:pml(u)},o)}},yJo=class extends P4t{constructor(n){super();this.validators=n}validators;transformFromStorage(n,i,o,s,a){let u=this.getValidatorOptions(n,a?.validatorOptions);return a?.enableStrictValidation?this.validators.strict.assert(o,u):this.validators.standard.assert(o,u)}transformToStorage(n,i,o,s,a){let u=this.getValidatorOptions(n,a?.validatorOptions);return a?.enableStrictValidation?this.validators.strict.assert(o,u):this.validators.standard.assert(o,u)}mergeTransformToStorage(n,i,o,s,a){return o}getValidatorOptions(n,i,o=500){let s={...i,statusCode:o};return s.errorMessage||(s.errorMessage=a=>`Found ${a.failures.length} validation failure(s) for ${this.validators.standard.name} ${n}`),s}},Ju=(r,t,n)=>{let i=[new mJo(n),new yJo(r)];return t&&i.unshift(t),new bJo(...i)},bJo=class{transforms;constructor(...t){this.transforms=t}fromStorage(t,n,i,o,s){return this.transforms.reduce((a,u)=>u.fromStorage(t,n,a,o,s),i)}toStorage(t,n,i,o,s){return this.transforms.reduceRight((a,u)=>u.toStorage(t,n,a,o,s),i)}mergeToStorage(t,n,i,o,s){return this.transforms.reduceRight((a,u)=>u.mergeToStorage(t,n,a,o,s),i)}},N3=class extends P4t{transformToStorage(t,n,i){return i}mergeTransformToStorage(t,n,i){return i}}});var Rf=V(()=>{"use strict";EJo()});var fml,urt,mW,CJo,N4t,cz,FCe,vJo,fG1,hG1,hml,SJo,nOr,gml=V(()=>{"use strict";fo();ar();Rf();gJo();fml=r=>!!r&&typeof r=="object"&&!Array.isArray(r),urt=r=>fml(r)&&!(r instanceof Date)&&!(r instanceof RegExp),mW=r=>{if(typeof r=="string")return r;if(fml(r)&&r.constructor&&typeof r.constructor.name=="string")return`[class ${r.constructor.name}]`;if(r instanceof Date)return`[date ${r.toISOString()}]`;if(r instanceof RegExp)return`[regexp ${r.toString()}]`;if(typeof r=="function")return`[function ${r.name}]`;try{return JSON.stringify(r)}catch{return"Error: could not stringify unknown value"}},CJo=r=>r==null,N4t=(r,t,n,i)=>{t.filter((o,s)=>urt(o)?!0:(n.logError(`Invalid ${r} item detected at index ${s}: ${mW(o)}`),n.logPatch(`Removed invalid ${r} item at index ${s}`),!1)).forEach(i)},cz=(r,t,n)=>{r[t]=n},FCe=(r,t)=>{delete r[t]},vJo=(r,t,n)=>{let i=new SJo(r,We("FIREBASE"),t),{logError:o,logPatch:s,report:a}=i,u=()=>(a(),n);if(!urt(n))return u();let p=n;if([["locationName",!p.locationName&&typeof p.locationName!="string"||typeof p.locationName!="string"],["description",typeof p.description!="string"]].forEach(([c,l])=>{l&&(s(`Set non-string property ${c} from ${mW(p[c])} to ""`),cz(p,c,""))}),["dependencies","isDataVault","locationID"].forEach(c=>{c in p&&(s(`Removed deprecated field ${c}`),FCe(p,c))}),p.type==="sql")s("-- data.type is sql --"),fG1(r,p,i);else if(p.type==="sourceInput")s("-- data.type is sourceInput --"),hG1(r,p,i);else return o(`Data type is of invalid type ${mW(p.type)}`),u();return p.version!==IZ&&(s(`Set version ${mW(p.version)} to ${IZ}`),cz(p,"version",IZ)),u()},fG1=(r,t,n)=>{let{logError:i,logPatch:o}=n;if(t.isMultisource===void 0&&(o("Set missing isMultisource to false"),cz(t,"isMultisource",!1)),urt(t.metadata)){let s=t.metadata;if(s.appliedNodeTests===null&&(o("Set metadata.appliedNodeTests from null to []"),cz(s,"appliedNodeTests",[])),!Array.isArray(s.sourceMapping)||!s.sourceMapping.length){o("Set non-array or empty metadata.sourceMapping to [ basicMapping ]");let a;typeof t.name=="string"?a=t.name:(o("Data has no name value, setting sourceMapping.name to empty string"),a=""),cz(s,"sourceMapping",[{name:a,join:{joinCondition:""},dependencies:[],noLinkRefs:[],aliases:{}}])}else N4t("sourceMapping",s.sourceMapping,n,(a,u)=>{let p=a;if(typeof p.join=="string"){let c={joinCondition:""};o(`Setting invalid string value metadata.sourceMapping[${u}].join to object: ${mW(c)}`),cz(p,"join",c)}if(p.name===void 0){let c=p.join?.name??"";o(`Set missing metadata.sourceMapping[${u}].name to "${c}"`),cz(p,"name",c),c||i(`metadata.sourceMapping[${u}].name is an empty string`)}Array.isArray(p.dependencies)&&N4t("sourceMapping dependency",p.dependencies,n,(c,l)=>{let d=c;for(let f of["locationName","nodeName"])CJo(d[f])&&(o(`Set metadata.sourceMapping[${u}].dependencies[${l}].${f} from ${mW(d[f])} to ""`),cz(d,f,""))})});hml(r,s.columns,n)}if(t.config&&typeof t.config=="object")for(let[s,a]of Object.entries(t.config))a===null&&(o(`Removing null config property "${s}"`),FCe(t.config,s))},hG1=(r,t,n)=>{let{logPatch:i,logError:o}=n;if(t.dataset!==void 0&&(i("Removed deprecated v0 property dataset"),FCe(t,"dataset")),t.table!==void 0&&(t.table!==t.name&&o(`source data properties 'table' and 'name' are different for source node ${r}, table: ${t.table}, name: ${t.name}`),i("Removed deprecated v0 property table"),FCe(t,"table")),urt(t.metadata)){let s=t.metadata;Array.isArray(s.columns)&&(s.columns.length&&hml(r,s.columns,n),Object.keys(s).length>1&&(i(`Removed deprecated metadata properties, keeping only columns. Was: ${mW(s)}`),cz(t,"metadata",{columns:s.columns})))}},hml=(r,t,n)=>{let{logPatch:i}=n;Array.isArray(t)&&N4t("column",t,n,(o,s)=>{let a=o;if(["ghostRecordValue","descendedFrom","hashColumns","columnsForHash"].forEach(c=>{a.hasOwnProperty(c)&&(i(`Removed deprecated property '${c}' from metadata.columns[${s}]`),FCe(a,c))}),urt(a.hashDetails)){let c=a.hashDetails;c.hashType&&(i(`Removed deprecated property 'hashType' from metadata.columns[${s}].hashDetails`),FCe(c,"hashType")),c.hubHashes&&(i(`Removed deprecated property 'hubHashes' from metadata.columns[${s}].hashDetails`),FCe(c,"hubHashes"))}[["appliedColumnTests",a.appliedColumnTests===null],["config",a.config===null],["hashDetails",typeof a.hashDetails=="string"]].forEach(([c,l])=>{l&&(i(`Deleted metadata.columns[${s}].${c} with invalid value ${mW(a[c])}`),FCe(a,c))}),[["dataType",typeof a.dataType!="string"],["transform",a.transform===null]].forEach(([c,l])=>{l&&(i(`Set ${c} from ${mW(a[c])} to "" in metadata.columns[${s}]`),cz(a,c,""))});let u=a.hashedColumns;if(Array.isArray(u))for(let c of u)rOr(c);let p=a.columnReference;if(urt(p)){rOr(p);let c=p;CJo(c.stepCounter)&&(i(`Set metadata.columns[${s}].columnReference.stepCounter from ${mW(c.stepCounter)} to ${r}`),cz(c,"stepCounter",r))}Array.isArray(a.sourceColumnReferences)&&N4t("sourceColumnReference",a.sourceColumnReferences,n,(c,l)=>{let d=c;Array.isArray(d.columnReferences)&&N4t("columnReference",d.columnReferences,n,(f,h)=>{rOr(f);let A=f;CJo(A.stepCounter)&&(i(`Set invalid metadata.columns[${s}].sourceColumnReferences[${l}].columnReferences[${h}].stepCounter to "" from ${mW(r)}`),cz(A,"stepCounter",""))})})})},SJo=class{constructor(t,n,i){this.id=t;this.logger=n;this.path=i}id;logger;path;patchMessages=[];errorMessages=[];logPatch=t=>{this.patchMessages.push(t)};logError=t=>{this.errorMessages.push(t)};reportErrors=()=>{this.errorMessages.length&&this.logger.error(`Error patching node data with id ${this.id} at path ${this.path}`,this.errorMessages)};reportPatches=()=>{this.patchMessages.length&&this.logger.debug(`Patched node data with id ${this.id} at path ${this.path}`,this.patchMessages)};report=()=>{this.reportErrors(),this.reportPatches()}},nOr=class extends N3{transformFromStorage(t,n,i){return vJo(t,n,i)}}});var D4t=V(()=>{"use strict";lml();gJo();gml()});var Aml=V(()=>{"use strict"});var G_C,H_C,V_C,mml,yml,bml,UCe=V(()=>{"use strict";fr();cb();ar();hJo();Fet();Bo();ar();I2();lee();D4t();sCe();$Go();Aml();v6();C6();s9();gee();G_C=We("FIREBASE"),H_C=We("STEPS"),V_C=We("METADATA_OPERATIONS"),mml=(r,t)=>t[r].runState==="running",yml=r=>(ny("STEPS",!!r,`Error converting API refs: argument apiRefLinks is ${r}.`),r.map(t=>({locationName:t.location_name,nodeName:t.node_name}))),bml=r=>r?.deployEnabled??!0});var zCe,Eml=V(()=>{"use strict";UCe();tOr();zCe=class extends zBe{noDependenciesPhases=["deletedTable"];getNodeRefsInPhase(t,n){return Object.fromEntries(n.map(i=>{let o,s=this.extraRefs[i];s?o=[s]:o=this.phasedRefUsage.get(t,i);let a=o.map(({ref:u,ref_no_link:p})=>yml([...u,...p]));return[i,[].concat(...a)]}))}}});var crt,Cml=V(()=>{"use strict";qa();a9();tOr();crt=class extends zBe{noDependenciesPhases=[];getNodeRefsInPhase(t,n){let i=uE(this.allNodes,...n);return Zv(i,o=>{if(uCe(o.operation))return[];let{sourceMapping:s}=o.operation.metadata;if(!s?.length)return[];let a=s.map(({dependencies:u})=>u);return[].concat(...a)})}}});var TJo=V(()=>{"use strict";tOr();Eml();Cml()});var Sml=V(()=>{"use strict"});var B4t,vml=V(()=>{"use strict";AX();$m();B4t=async(r,t)=>{let{attempts:n,tags:i,waitSeconds:o}=t,s=Ql().child({retryOptions:{maxAttempts:n,waitSeconds:o},tags:["[withRetries]",...i]});g2(n>=2,`Retry attempts value must be at least '2', but was '${n}'`,s);try{let a=await r();return s.debug("Operation succeeded without retrying"),a}catch(a){s.error(`Operation initial attempt failed; retrying. Error: ${a}`);let u,p=n-1;do{p--,await new Promise(c=>setTimeout(c,o*(n-p)*1e3));try{let c=await r();return s.info(`Operation succeeded on retry (attempt ${n-p})`),c}catch(c){s.error(`Operation failed on retry (attempt ${n-p}). Error: ${c}`),u=c}}while(p);throw s.error("Exhausted all retry attempts; exiting"),u}}});var _Jo=V(()=>{"use strict";Sml();vml()});var E9,yG1,bG1,pIC,dIC,IJo=V(()=>{"use strict";E9=gt(CU()),yG1=E9.String,bG1=E9.Record({locationName:E9.String,database:E9.String,schema:E9.String}),pIC=E9.Dictionary(bG1,yG1),dIC=E9.Record({seconds:E9.Number,nanoseconds:E9.Number})});function lrt(r,t){let n=[];for(let i of r){let o=i.compiledSQL?Wet(i.compiledSQL):[];if(o.length===0)t&&n.push({name:t,sql:"",type:"sql",continueOnFailure:!1,parsedStage:null});else for(let s of o)n.push({name:s.name,sql:s.code,type:s.type,continueOnFailure:s.continueOnFailure,parsedStage:s})}return n}function iOr(r,t){return r==="deletedTable"&&t?Tml:EG1}var EG1,Tml,L4t=V(()=>{"use strict";I2();EG1="Making metadata updates",Tml="Deleting metadata for source input"});var yW,k4t=V(()=>{"use strict";fr();yW=class extends nt{constructor(n,i,o="system"){super(i,`Failed node ${n}: ${i}`);this.nodeID=n;this.fault=o}nodeID;fault}});var q4t=m((yIC,_ml)=>{var CG1="2.0.0",SG1=Number.MAX_SAFE_INTEGER||9007199254740991,vG1=16,TG1=250,_G1=["major","premajor","minor","preminor","patch","prepatch","prerelease"];_ml.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:vG1,MAX_SAFE_BUILD_LENGTH:TG1,MAX_SAFE_INTEGER:SG1,RELEASE_TYPES:_G1,SEMVER_SPEC_VERSION:CG1,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var F4t=m((bIC,Iml)=>{var IG1=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{};Iml.exports=IG1});var prt=m((c0e,Rml)=>{var{MAX_SAFE_COMPONENT_LENGTH:RJo,MAX_SAFE_BUILD_LENGTH:RG1,MAX_LENGTH:OG1}=q4t(),wG1=F4t();c0e=Rml.exports={};var MG1=c0e.re=[],xG1=c0e.safeRe=[],_a=c0e.src=[],Ia=c0e.t={},PG1=0,OJo="[a-zA-Z0-9-]",NG1=[["\\s",1],["\\d",OG1],[OJo,RG1]],DG1=r=>{for(let[t,n]of NG1)r=r.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return r},id=(r,t,n)=>{let i=DG1(t),o=PG1++;wG1(r,o,t),Ia[r]=o,_a[o]=t,MG1[o]=new RegExp(t,n?"g":void 0),xG1[o]=new RegExp(i,n?"g":void 0)};id("NUMERICIDENTIFIER","0|[1-9]\\d*");id("NUMERICIDENTIFIERLOOSE","\\d+");id("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${OJo}*`);id("MAINVERSION",`(${_a[Ia.NUMERICIDENTIFIER]})\\.(${_a[Ia.NUMERICIDENTIFIER]})\\.(${_a[Ia.NUMERICIDENTIFIER]})`);id("MAINVERSIONLOOSE",`(${_a[Ia.NUMERICIDENTIFIERLOOSE]})\\.(${_a[Ia.NUMERICIDENTIFIERLOOSE]})\\.(${_a[Ia.NUMERICIDENTIFIERLOOSE]})`);id("PRERELEASEIDENTIFIER",`(?:${_a[Ia.NUMERICIDENTIFIER]}|${_a[Ia.NONNUMERICIDENTIFIER]})`);id("PRERELEASEIDENTIFIERLOOSE",`(?:${_a[Ia.NUMERICIDENTIFIERLOOSE]}|${_a[Ia.NONNUMERICIDENTIFIER]})`);id("PRERELEASE",`(?:-(${_a[Ia.PRERELEASEIDENTIFIER]}(?:\\.${_a[Ia.PRERELEASEIDENTIFIER]})*))`);id("PRERELEASELOOSE",`(?:-?(${_a[Ia.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${_a[Ia.PRERELEASEIDENTIFIERLOOSE]})*))`);id("BUILDIDENTIFIER",`${OJo}+`);id("BUILD",`(?:\\+(${_a[Ia.BUILDIDENTIFIER]}(?:\\.${_a[Ia.BUILDIDENTIFIER]})*))`);id("FULLPLAIN",`v?${_a[Ia.MAINVERSION]}${_a[Ia.PRERELEASE]}?${_a[Ia.BUILD]}?`);id("FULL",`^${_a[Ia.FULLPLAIN]}$`);id("LOOSEPLAIN",`[v=\\s]*${_a[Ia.MAINVERSIONLOOSE]}${_a[Ia.PRERELEASELOOSE]}?${_a[Ia.BUILD]}?`);id("LOOSE",`^${_a[Ia.LOOSEPLAIN]}$`);id("GTLT","((?:<|>)?=?)");id("XRANGEIDENTIFIERLOOSE",`${_a[Ia.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);id("XRANGEIDENTIFIER",`${_a[Ia.NUMERICIDENTIFIER]}|x|X|\\*`);id("XRANGEPLAIN",`[v=\\s]*(${_a[Ia.XRANGEIDENTIFIER]})(?:\\.(${_a[Ia.XRANGEIDENTIFIER]})(?:\\.(${_a[Ia.XRANGEIDENTIFIER]})(?:${_a[Ia.PRERELEASE]})?${_a[Ia.BUILD]}?)?)?`);id("XRANGEPLAINLOOSE",`[v=\\s]*(${_a[Ia.XRANGEIDENTIFIERLOOSE]})(?:\\.(${_a[Ia.XRANGEIDENTIFIERLOOSE]})(?:\\.(${_a[Ia.XRANGEIDENTIFIERLOOSE]})(?:${_a[Ia.PRERELEASELOOSE]})?${_a[Ia.BUILD]}?)?)?`);id("XRANGE",`^${_a[Ia.GTLT]}\\s*${_a[Ia.XRANGEPLAIN]}$`);id("XRANGELOOSE",`^${_a[Ia.GTLT]}\\s*${_a[Ia.XRANGEPLAINLOOSE]}$`);id("COERCE",`(^|[^\\d])(\\d{1,${RJo}})(?:\\.(\\d{1,${RJo}}))?(?:\\.(\\d{1,${RJo}}))?(?:$|[^\\d])`);id("COERCERTL",_a[Ia.COERCE],!0);id("LONETILDE","(?:~>?)");id("TILDETRIM",`(\\s*)${_a[Ia.LONETILDE]}\\s+`,!0);c0e.tildeTrimReplace="$1~";id("TILDE",`^${_a[Ia.LONETILDE]}${_a[Ia.XRANGEPLAIN]}$`);id("TILDELOOSE",`^${_a[Ia.LONETILDE]}${_a[Ia.XRANGEPLAINLOOSE]}$`);id("LONECARET","(?:\\^)");id("CARETTRIM",`(\\s*)${_a[Ia.LONECARET]}\\s+`,!0);c0e.caretTrimReplace="$1^";id("CARET",`^${_a[Ia.LONECARET]}${_a[Ia.XRANGEPLAIN]}$`);id("CARETLOOSE",`^${_a[Ia.LONECARET]}${_a[Ia.XRANGEPLAINLOOSE]}$`);id("COMPARATORLOOSE",`^${_a[Ia.GTLT]}\\s*(${_a[Ia.LOOSEPLAIN]})$|^$`);id("COMPARATOR",`^${_a[Ia.GTLT]}\\s*(${_a[Ia.FULLPLAIN]})$|^$`);id("COMPARATORTRIM",`(\\s*)${_a[Ia.GTLT]}\\s*(${_a[Ia.LOOSEPLAIN]}|${_a[Ia.XRANGEPLAIN]})`,!0);c0e.comparatorTrimReplace="$1$2$3";id("HYPHENRANGE",`^\\s*(${_a[Ia.XRANGEPLAIN]})\\s+-\\s+(${_a[Ia.XRANGEPLAIN]})\\s*$`);id("HYPHENRANGELOOSE",`^\\s*(${_a[Ia.XRANGEPLAINLOOSE]})\\s+-\\s+(${_a[Ia.XRANGEPLAINLOOSE]})\\s*$`);id("STAR","(<|>)?=?\\s*\\*");id("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");id("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var oOr=m((EIC,Oml)=>{var BG1=Object.freeze({loose:!0}),LG1=Object.freeze({}),kG1=r=>r?typeof r!="object"?BG1:r:LG1;Oml.exports=kG1});var wJo=m((CIC,xml)=>{var wml=/^[0-9]+$/,Mml=(r,t)=>{let n=wml.test(r),i=wml.test(t);return n&&i&&(r=+r,t=+t),r===t?0:n&&!i?-1:i&&!n?1:r<t?-1:1},qG1=(r,t)=>Mml(t,r);xml.exports={compareIdentifiers:Mml,rcompareIdentifiers:qG1}});var Vx=m((SIC,Bml)=>{var sOr=F4t(),{MAX_LENGTH:Pml,MAX_SAFE_INTEGER:aOr}=q4t(),{safeRe:Nml,t:Dml}=prt(),FG1=oOr(),{compareIdentifiers:drt}=wJo(),MJo=class r{constructor(t,n){if(n=FG1(n),t instanceof r){if(t.loose===!!n.loose&&t.includePrerelease===!!n.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>Pml)throw new TypeError(`version is longer than ${Pml} characters`);sOr("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;let i=t.trim().match(n.loose?Nml[Dml.LOOSE]:Nml[Dml.FULL]);if(!i)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+i[1],this.minor=+i[2],this.patch=+i[3],this.major>aOr||this.major<0)throw new TypeError("Invalid major version");if(this.minor>aOr||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>aOr||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){let s=+o;if(s>=0&&s<aOr)return s}return o}):this.prerelease=[],this.build=i[5]?i[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(sOr("SemVer.compare",this.version,this.options,t),!(t instanceof r)){if(typeof t=="string"&&t===this.version)return 0;t=new r(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof r||(t=new r(t,this.options)),drt(this.major,t.major)||drt(this.minor,t.minor)||drt(this.patch,t.patch)}comparePre(t){if(t instanceof r||(t=new r(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let n=0;do{let i=this.prerelease[n],o=t.prerelease[n];if(sOr("prerelease compare",n,i,o),i===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(i===void 0)return-1;if(i===o)continue;return drt(i,o)}while(++n)}compareBuild(t){t instanceof r||(t=new r(t,this.options));let n=0;do{let i=this.build[n],o=t.build[n];if(sOr("prerelease compare",n,i,o),i===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(i===void 0)return-1;if(i===o)continue;return drt(i,o)}while(++n)}inc(t,n,i){switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",n,i);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",n,i);break;case"prepatch":this.prerelease.length=0,this.inc("patch",n,i),this.inc("pre",n,i);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",n,i),this.inc("pre",n,i);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let o=Number(i)?1:0;if(!n&&i===!1)throw new Error("invalid increment argument: identifier is empty");if(this.prerelease.length===0)this.prerelease=[o];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(n===this.prerelease.join(".")&&i===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(n){let s=[n,o];i===!1&&(s=[n]),drt(this.prerelease[0],n)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};Bml.exports=MJo});var jBe=m((vIC,kml)=>{var Lml=Vx(),UG1=(r,t,n=!1)=>{if(r instanceof Lml)return r;try{return new Lml(r,t)}catch(i){if(!n)return null;throw i}};kml.exports=UG1});var Fml=m((TIC,qml)=>{var zG1=jBe(),QG1=(r,t)=>{let n=zG1(r,t);return n?n.version:null};qml.exports=QG1});var zml=m((_IC,Uml)=>{var jG1=jBe(),GG1=(r,t)=>{let n=jG1(r.trim().replace(/^[=v]+/,""),t);return n?n.version:null};Uml.exports=GG1});var Gml=m((IIC,jml)=>{var Qml=Vx(),HG1=(r,t,n,i,o)=>{typeof n=="string"&&(o=i,i=n,n=void 0);try{return new Qml(r instanceof Qml?r.version:r,n).inc(t,i,o).version}catch{return null}};jml.exports=HG1});var Wml=m((RIC,Vml)=>{var Hml=jBe(),VG1=(r,t)=>{let n=Hml(r,null,!0),i=Hml(t,null,!0),o=n.compare(i);if(o===0)return null;let s=o>0,a=s?n:i,u=s?i:n,p=!!a.prerelease.length;if(!!u.prerelease.length&&!p)return!u.patch&&!u.minor?"major":a.patch?"patch":a.minor?"minor":"major";let l=p?"pre":"";return n.major!==i.major?l+"major":n.minor!==i.minor?l+"minor":n.patch!==i.patch?l+"patch":"prerelease"};Vml.exports=VG1});var Yml=m((OIC,Kml)=>{var WG1=Vx(),KG1=(r,t)=>new WG1(r,t).major;Kml.exports=KG1});var $ml=m((wIC,Jml)=>{var YG1=Vx(),JG1=(r,t)=>new YG1(r,t).minor;Jml.exports=JG1});var Zml=m((MIC,Xml)=>{var $G1=Vx(),XG1=(r,t)=>new $G1(r,t).patch;Xml.exports=XG1});var tyl=m((xIC,eyl)=>{var ZG1=jBe(),eH1=(r,t)=>{let n=ZG1(r,t);return n&&n.prerelease.length?n.prerelease:null};eyl.exports=eH1});var lz=m((PIC,nyl)=>{var ryl=Vx(),tH1=(r,t,n)=>new ryl(r,n).compare(new ryl(t,n));nyl.exports=tH1});var oyl=m((NIC,iyl)=>{var rH1=lz(),nH1=(r,t,n)=>rH1(t,r,n);iyl.exports=nH1});var ayl=m((DIC,syl)=>{var iH1=lz(),oH1=(r,t)=>iH1(r,t,!0);syl.exports=oH1});var uOr=m((BIC,cyl)=>{var uyl=Vx(),sH1=(r,t,n)=>{let i=new uyl(r,n),o=new uyl(t,n);return i.compare(o)||i.compareBuild(o)};cyl.exports=sH1});var pyl=m((LIC,lyl)=>{var aH1=uOr(),uH1=(r,t)=>r.sort((n,i)=>aH1(n,i,t));lyl.exports=uH1});var fyl=m((kIC,dyl)=>{var cH1=uOr(),lH1=(r,t)=>r.sort((n,i)=>cH1(i,n,t));dyl.exports=lH1});var U4t=m((qIC,hyl)=>{var pH1=lz(),dH1=(r,t,n)=>pH1(r,t,n)>0;hyl.exports=dH1});var cOr=m((FIC,gyl)=>{var fH1=lz(),hH1=(r,t,n)=>fH1(r,t,n)<0;gyl.exports=hH1});var xJo=m((UIC,Ayl)=>{var gH1=lz(),AH1=(r,t,n)=>gH1(r,t,n)===0;Ayl.exports=AH1});var PJo=m((zIC,myl)=>{var mH1=lz(),yH1=(r,t,n)=>mH1(r,t,n)!==0;myl.exports=yH1});var lOr=m((QIC,yyl)=>{var bH1=lz(),EH1=(r,t,n)=>bH1(r,t,n)>=0;yyl.exports=EH1});var pOr=m((jIC,byl)=>{var CH1=lz(),SH1=(r,t,n)=>CH1(r,t,n)<=0;byl.exports=SH1});var NJo=m((GIC,Eyl)=>{var vH1=xJo(),TH1=PJo(),_H1=U4t(),IH1=lOr(),RH1=cOr(),OH1=pOr(),wH1=(r,t,n,i)=>{switch(t){case"===":return typeof r=="object"&&(r=r.version),typeof n=="object"&&(n=n.version),r===n;case"!==":return typeof r=="object"&&(r=r.version),typeof n=="object"&&(n=n.version),r!==n;case"":case"=":case"==":return vH1(r,n,i);case"!=":return TH1(r,n,i);case">":return _H1(r,n,i);case">=":return IH1(r,n,i);case"<":return RH1(r,n,i);case"<=":return OH1(r,n,i);default:throw new TypeError(`Invalid operator: ${t}`)}};Eyl.exports=wH1});var Syl=m((HIC,Cyl)=>{var MH1=Vx(),xH1=jBe(),{safeRe:dOr,t:fOr}=prt(),PH1=(r,t)=>{if(r instanceof MH1)return r;if(typeof r=="number"&&(r=String(r)),typeof r!="string")return null;t=t||{};let n=null;if(!t.rtl)n=r.match(dOr[fOr.COERCE]);else{let i;for(;(i=dOr[fOr.COERCERTL].exec(r))&&(!n||n.index+n[0].length!==r.length);)(!n||i.index+i[0].length!==n.index+n[0].length)&&(n=i),dOr[fOr.COERCERTL].lastIndex=i.index+i[1].length+i[2].length;dOr[fOr.COERCERTL].lastIndex=-1}return n===null?null:xH1(`${n[2]}.${n[3]||"0"}.${n[4]||"0"}`,t)};Cyl.exports=PH1});var Tyl=m((VIC,vyl)=>{"use strict";vyl.exports=function(r){r.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}});var DJo=m((WIC,_yl)=>{"use strict";_yl.exports=f1;f1.Node=GBe;f1.create=f1;function f1(r){var t=this;if(t instanceof f1||(t=new f1),t.tail=null,t.head=null,t.length=0,r&&typeof r.forEach=="function")r.forEach(function(o){t.push(o)});else if(arguments.length>0)for(var n=0,i=arguments.length;n<i;n++)t.push(arguments[n]);return t}f1.prototype.removeNode=function(r){if(r.list!==this)throw new Error("removing node which does not belong to this list");var t=r.next,n=r.prev;return t&&(t.prev=n),n&&(n.next=t),r===this.head&&(this.head=t),r===this.tail&&(this.tail=n),r.list.length--,r.next=null,r.prev=null,r.list=null,t};f1.prototype.unshiftNode=function(r){if(r!==this.head){r.list&&r.list.removeNode(r);var t=this.head;r.list=this,r.next=t,t&&(t.prev=r),this.head=r,this.tail||(this.tail=r),this.length++}};f1.prototype.pushNode=function(r){if(r!==this.tail){r.list&&r.list.removeNode(r);var t=this.tail;r.list=this,r.prev=t,t&&(t.next=r),this.tail=r,this.head||(this.head=r),this.length++}};f1.prototype.push=function(){for(var r=0,t=arguments.length;r<t;r++)DH1(this,arguments[r]);return this.length};f1.prototype.unshift=function(){for(var r=0,t=arguments.length;r<t;r++)BH1(this,arguments[r]);return this.length};f1.prototype.pop=function(){if(this.tail){var r=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,r}};f1.prototype.shift=function(){if(this.head){var r=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,r}};f1.prototype.forEach=function(r,t){t=t||this;for(var n=this.head,i=0;n!==null;i++)r.call(t,n.value,i,this),n=n.next};f1.prototype.forEachReverse=function(r,t){t=t||this;for(var n=this.tail,i=this.length-1;n!==null;i--)r.call(t,n.value,i,this),n=n.prev};f1.prototype.get=function(r){for(var t=0,n=this.head;n!==null&&t<r;t++)n=n.next;if(t===r&&n!==null)return n.value};f1.prototype.getReverse=function(r){for(var t=0,n=this.tail;n!==null&&t<r;t++)n=n.prev;if(t===r&&n!==null)return n.value};f1.prototype.map=function(r,t){t=t||this;for(var n=new f1,i=this.head;i!==null;)n.push(r.call(t,i.value,this)),i=i.next;return n};f1.prototype.mapReverse=function(r,t){t=t||this;for(var n=new f1,i=this.tail;i!==null;)n.push(r.call(t,i.value,this)),i=i.prev;return n};f1.prototype.reduce=function(r,t){var n,i=this.head;if(arguments.length>1)n=t;else if(this.head)i=this.head.next,n=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var o=0;i!==null;o++)n=r(n,i.value,o),i=i.next;return n};f1.prototype.reduceReverse=function(r,t){var n,i=this.tail;if(arguments.length>1)n=t;else if(this.tail)i=this.tail.prev,n=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var o=this.length-1;i!==null;o--)n=r(n,i.value,o),i=i.prev;return n};f1.prototype.toArray=function(){for(var r=new Array(this.length),t=0,n=this.head;n!==null;t++)r[t]=n.value,n=n.next;return r};f1.prototype.toArrayReverse=function(){for(var r=new Array(this.length),t=0,n=this.tail;n!==null;t++)r[t]=n.value,n=n.prev;return r};f1.prototype.slice=function(r,t){t=t||this.length,t<0&&(t+=this.length),r=r||0,r<0&&(r+=this.length);var n=new f1;if(t<r||t<0)return n;r<0&&(r=0),t>this.length&&(t=this.length);for(var i=0,o=this.head;o!==null&&i<r;i++)o=o.next;for(;o!==null&&i<t;i++,o=o.next)n.push(o.value);return n};f1.prototype.sliceReverse=function(r,t){t=t||this.length,t<0&&(t+=this.length),r=r||0,r<0&&(r+=this.length);var n=new f1;if(t<r||t<0)return n;r<0&&(r=0),t>this.length&&(t=this.length);for(var i=this.length,o=this.tail;o!==null&&i>t;i--)o=o.prev;for(;o!==null&&i>r;i--,o=o.prev)n.push(o.value);return n};f1.prototype.splice=function(r,t,...n){r>this.length&&(r=this.length-1),r<0&&(r=this.length+r);for(var i=0,o=this.head;o!==null&&i<r;i++)o=o.next;for(var s=[],i=0;o&&i<t;i++)s.push(o.value),o=this.removeNode(o);o===null&&(o=this.tail),o!==this.head&&o!==this.tail&&(o=o.prev);for(var i=0;i<n.length;i++)o=NH1(this,o,n[i]);return s};f1.prototype.reverse=function(){for(var r=this.head,t=this.tail,n=r;n!==null;n=n.prev){var i=n.prev;n.prev=n.next,n.next=i}return this.head=t,this.tail=r,this};function NH1(r,t,n){var i=t===r.head?new GBe(n,null,t,r):new GBe(n,t,t.next,r);return i.next===null&&(r.tail=i),i.prev===null&&(r.head=i),r.length++,i}function DH1(r,t){r.tail=new GBe(t,r.tail,null,r),r.head||(r.head=r.tail),r.length++}function BH1(r,t){r.head=new GBe(t,null,r.head,r),r.tail||(r.tail=r.head),r.length++}function GBe(r,t,n,i){if(!(this instanceof GBe))return new GBe(r,t,n,i);this.list=i,this.value=r,t?(t.next=this,this.prev=t):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}try{Tyl()(f1)}catch{}});var j4t=m((KIC,wyl)=>{"use strict";var LH1=DJo(),HBe=Symbol("max"),p0e=Symbol("length"),frt=Symbol("lengthCalculator"),Q4t=Symbol("allowStale"),VBe=Symbol("maxAge"),l0e=Symbol("dispose"),Iyl=Symbol("noDisposeOnSet"),D3=Symbol("lruList"),bW=Symbol("cache"),Oyl=Symbol("updateAgeOnGet"),BJo=()=>1,kJo=class{constructor(t){if(typeof t=="number"&&(t={max:t}),t||(t={}),t.max&&(typeof t.max!="number"||t.max<0))throw new TypeError("max must be a non-negative number");let n=this[HBe]=t.max||1/0,i=t.length||BJo;if(this[frt]=typeof i!="function"?BJo:i,this[Q4t]=t.stale||!1,t.maxAge&&typeof t.maxAge!="number")throw new TypeError("maxAge must be a number");this[VBe]=t.maxAge||0,this[l0e]=t.dispose,this[Iyl]=t.noDisposeOnSet||!1,this[Oyl]=t.updateAgeOnGet||!1,this.reset()}set max(t){if(typeof t!="number"||t<0)throw new TypeError("max must be a non-negative number");this[HBe]=t||1/0,z4t(this)}get max(){return this[HBe]}set allowStale(t){this[Q4t]=!!t}get allowStale(){return this[Q4t]}set maxAge(t){if(typeof t!="number")throw new TypeError("maxAge must be a non-negative number");this[VBe]=t,z4t(this)}get maxAge(){return this[VBe]}set lengthCalculator(t){typeof t!="function"&&(t=BJo),t!==this[frt]&&(this[frt]=t,this[p0e]=0,this[D3].forEach(n=>{n.length=this[frt](n.value,n.key),this[p0e]+=n.length})),z4t(this)}get lengthCalculator(){return this[frt]}get length(){return this[p0e]}get itemCount(){return this[D3].length}rforEach(t,n){n=n||this;for(let i=this[D3].tail;i!==null;){let o=i.prev;Ryl(this,t,i,n),i=o}}forEach(t,n){n=n||this;for(let i=this[D3].head;i!==null;){let o=i.next;Ryl(this,t,i,n),i=o}}keys(){return this[D3].toArray().map(t=>t.key)}values(){return this[D3].toArray().map(t=>t.value)}reset(){this[l0e]&&this[D3]&&this[D3].length&&this[D3].forEach(t=>this[l0e](t.key,t.value)),this[bW]=new Map,this[D3]=new LH1,this[p0e]=0}dump(){return this[D3].map(t=>hOr(this,t)?!1:{k:t.key,v:t.value,e:t.now+(t.maxAge||0)}).toArray().filter(t=>t)}dumpLru(){return this[D3]}set(t,n,i){if(i=i||this[VBe],i&&typeof i!="number")throw new TypeError("maxAge must be a number");let o=i?Date.now():0,s=this[frt](n,t);if(this[bW].has(t)){if(s>this[HBe])return hrt(this,this[bW].get(t)),!1;let p=this[bW].get(t).value;return this[l0e]&&(this[Iyl]||this[l0e](t,p.value)),p.now=o,p.maxAge=i,p.value=n,this[p0e]+=s-p.length,p.length=s,this.get(t),z4t(this),!0}let a=new qJo(t,n,s,o,i);return a.length>this[HBe]?(this[l0e]&&this[l0e](t,n),!1):(this[p0e]+=a.length,this[D3].unshift(a),this[bW].set(t,this[D3].head),z4t(this),!0)}has(t){if(!this[bW].has(t))return!1;let n=this[bW].get(t).value;return!hOr(this,n)}get(t){return LJo(this,t,!0)}peek(t){return LJo(this,t,!1)}pop(){let t=this[D3].tail;return t?(hrt(this,t),t.value):null}del(t){hrt(this,this[bW].get(t))}load(t){this.reset();let n=Date.now();for(let i=t.length-1;i>=0;i--){let o=t[i],s=o.e||0;if(s===0)this.set(o.k,o.v);else{let a=s-n;a>0&&this.set(o.k,o.v,a)}}}prune(){this[bW].forEach((t,n)=>LJo(this,n,!1))}},LJo=(r,t,n)=>{let i=r[bW].get(t);if(i){let o=i.value;if(hOr(r,o)){if(hrt(r,i),!r[Q4t])return}else n&&(r[Oyl]&&(i.value.now=Date.now()),r[D3].unshiftNode(i));return o.value}},hOr=(r,t)=>{if(!t||!t.maxAge&&!r[VBe])return!1;let n=Date.now()-t.now;return t.maxAge?n>t.maxAge:r[VBe]&&n>r[VBe]},z4t=r=>{if(r[p0e]>r[HBe])for(let t=r[D3].tail;r[p0e]>r[HBe]&&t!==null;){let n=t.prev;hrt(r,t),t=n}},hrt=(r,t)=>{if(t){let n=t.value;r[l0e]&&r[l0e](n.key,n.value),r[p0e]-=n.length,r[bW].delete(n.key),r[D3].removeNode(t)}},qJo=class{constructor(t,n,i,o,s){this.key=t,this.value=n,this.length=i,this.now=o,this.maxAge=s||0}},Ryl=(r,t,n,i)=>{let o=n.value;hOr(r,o)&&(hrt(r,n),r[Q4t]||(o=void 0)),o&&t.call(i,o.value,o.key,r)};wyl.exports=kJo});var pz=m((YIC,Nyl)=>{var FJo=class r{constructor(t,n){if(n=qH1(n),t instanceof r)return t.loose===!!n.loose&&t.includePrerelease===!!n.includePrerelease?t:new r(t.raw,n);if(t instanceof UJo)return this.raw=t.value,this.set=[[t]],this.format(),this;if(this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease,this.raw=t.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(i=>this.parseRange(i.trim())).filter(i=>i.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let i=this.set[0];if(this.set=this.set.filter(o=>!xyl(o[0])),this.set.length===0)this.set=[i];else if(this.set.length>1){for(let o of this.set)if(o.length===1&&HH1(o[0])){this.set=[o];break}}}this.format()}format(){return this.range=this.set.map(t=>t.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(t){let i=((this.options.includePrerelease&&jH1)|(this.options.loose&&GH1))+":"+t,o=Myl.get(i);if(o)return o;let s=this.options.loose,a=s?P6[g4.HYPHENRANGELOOSE]:P6[g4.HYPHENRANGE];t=t.replace(a,tV1(this.options.includePrerelease)),Eb("hyphen replace",t),t=t.replace(P6[g4.COMPARATORTRIM],UH1),Eb("comparator trim",t),t=t.replace(P6[g4.TILDETRIM],zH1),Eb("tilde trim",t),t=t.replace(P6[g4.CARETTRIM],QH1),Eb("caret trim",t);let u=t.split(" ").map(d=>VH1(d,this.options)).join(" ").split(/\s+/).map(d=>eV1(d,this.options));s&&(u=u.filter(d=>(Eb("loose invalid filter",d,this.options),!!d.match(P6[g4.COMPARATORLOOSE])))),Eb("range list",u);let p=new Map,c=u.map(d=>new UJo(d,this.options));for(let d of c){if(xyl(d))return[d];p.set(d.value,d)}p.size>1&&p.has("")&&p.delete("");let l=[...p.values()];return Myl.set(i,l),l}intersects(t,n){if(!(t instanceof r))throw new TypeError("a Range is required");return this.set.some(i=>Pyl(i,n)&&t.set.some(o=>Pyl(o,n)&&i.every(s=>o.every(a=>s.intersects(a,n)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new FH1(t,this.options)}catch{return!1}for(let n=0;n<this.set.length;n++)if(rV1(this.set[n],t,this.options))return!0;return!1}};Nyl.exports=FJo;var kH1=j4t(),Myl=new kH1({max:1e3}),qH1=oOr(),UJo=G4t(),Eb=F4t(),FH1=Vx(),{safeRe:P6,t:g4,comparatorTrimReplace:UH1,tildeTrimReplace:zH1,caretTrimReplace:QH1}=prt(),{FLAG_INCLUDE_PRERELEASE:jH1,FLAG_LOOSE:GH1}=q4t(),xyl=r=>r.value==="<0.0.0-0",HH1=r=>r.value==="",Pyl=(r,t)=>{let n=!0,i=r.slice(),o=i.pop();for(;n&&i.length;)n=i.every(s=>o.intersects(s,t)),o=i.pop();return n},VH1=(r,t)=>(Eb("comp",r,t),r=YH1(r,t),Eb("caret",r),r=WH1(r,t),Eb("tildes",r),r=$H1(r,t),Eb("xrange",r),r=ZH1(r,t),Eb("stars",r),r),A4=r=>!r||r.toLowerCase()==="x"||r==="*",WH1=(r,t)=>r.trim().split(/\s+/).map(n=>KH1(n,t)).join(" "),KH1=(r,t)=>{let n=t.loose?P6[g4.TILDELOOSE]:P6[g4.TILDE];return r.replace(n,(i,o,s,a,u)=>{Eb("tilde",r,i,o,s,a,u);let p;return A4(o)?p="":A4(s)?p=`>=${o}.0.0 <${+o+1}.0.0-0`:A4(a)?p=`>=${o}.${s}.0 <${o}.${+s+1}.0-0`:u?(Eb("replaceTilde pr",u),p=`>=${o}.${s}.${a}-${u} <${o}.${+s+1}.0-0`):p=`>=${o}.${s}.${a} <${o}.${+s+1}.0-0`,Eb("tilde return",p),p})},YH1=(r,t)=>r.trim().split(/\s+/).map(n=>JH1(n,t)).join(" "),JH1=(r,t)=>{Eb("caret",r,t);let n=t.loose?P6[g4.CARETLOOSE]:P6[g4.CARET],i=t.includePrerelease?"-0":"";return r.replace(n,(o,s,a,u,p)=>{Eb("caret",r,o,s,a,u,p);let c;return A4(s)?c="":A4(a)?c=`>=${s}.0.0${i} <${+s+1}.0.0-0`:A4(u)?s==="0"?c=`>=${s}.${a}.0${i} <${s}.${+a+1}.0-0`:c=`>=${s}.${a}.0${i} <${+s+1}.0.0-0`:p?(Eb("replaceCaret pr",p),s==="0"?a==="0"?c=`>=${s}.${a}.${u}-${p} <${s}.${a}.${+u+1}-0`:c=`>=${s}.${a}.${u}-${p} <${s}.${+a+1}.0-0`:c=`>=${s}.${a}.${u}-${p} <${+s+1}.0.0-0`):(Eb("no pr"),s==="0"?a==="0"?c=`>=${s}.${a}.${u}${i} <${s}.${a}.${+u+1}-0`:c=`>=${s}.${a}.${u}${i} <${s}.${+a+1}.0-0`:c=`>=${s}.${a}.${u} <${+s+1}.0.0-0`),Eb("caret return",c),c})},$H1=(r,t)=>(Eb("replaceXRanges",r,t),r.split(/\s+/).map(n=>XH1(n,t)).join(" ")),XH1=(r,t)=>{r=r.trim();let n=t.loose?P6[g4.XRANGELOOSE]:P6[g4.XRANGE];return r.replace(n,(i,o,s,a,u,p)=>{Eb("xRange",r,i,o,s,a,u,p);let c=A4(s),l=c||A4(a),d=l||A4(u),f=d;return o==="="&&f&&(o=""),p=t.includePrerelease?"-0":"",c?o===">"||o==="<"?i="<0.0.0-0":i="*":o&&f?(l&&(a=0),u=0,o===">"?(o=">=",l?(s=+s+1,a=0,u=0):(a=+a+1,u=0)):o==="<="&&(o="<",l?s=+s+1:a=+a+1),o==="<"&&(p="-0"),i=`${o+s}.${a}.${u}${p}`):l?i=`>=${s}.0.0${p} <${+s+1}.0.0-0`:d&&(i=`>=${s}.${a}.0${p} <${s}.${+a+1}.0-0`),Eb("xRange return",i),i})},ZH1=(r,t)=>(Eb("replaceStars",r,t),r.trim().replace(P6[g4.STAR],"")),eV1=(r,t)=>(Eb("replaceGTE0",r,t),r.trim().replace(P6[t.includePrerelease?g4.GTE0PRE:g4.GTE0],"")),tV1=r=>(t,n,i,o,s,a,u,p,c,l,d,f,h)=>(A4(i)?n="":A4(o)?n=`>=${i}.0.0${r?"-0":""}`:A4(s)?n=`>=${i}.${o}.0${r?"-0":""}`:a?n=`>=${n}`:n=`>=${n}${r?"-0":""}`,A4(c)?p="":A4(l)?p=`<${+c+1}.0.0-0`:A4(d)?p=`<${c}.${+l+1}.0-0`:f?p=`<=${c}.${l}.${d}-${f}`:r?p=`<${c}.${l}.${+d+1}-0`:p=`<=${p}`,`${n} ${p}`.trim()),rV1=(r,t,n)=>{for(let i=0;i<r.length;i++)if(!r[i].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let i=0;i<r.length;i++)if(Eb(r[i].semver),r[i].semver!==UJo.ANY&&r[i].semver.prerelease.length>0){let o=r[i].semver;if(o.major===t.major&&o.minor===t.minor&&o.patch===t.patch)return!0}return!1}return!0}});var G4t=m((JIC,Fyl)=>{var H4t=Symbol("SemVer ANY"),jJo=class r{static get ANY(){return H4t}constructor(t,n){if(n=Dyl(n),t instanceof r){if(t.loose===!!n.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),QJo("comparator",t,n),this.options=n,this.loose=!!n.loose,this.parse(t),this.semver===H4t?this.value="":this.value=this.operator+this.semver.version,QJo("comp",this)}parse(t){let n=this.options.loose?Byl[Lyl.COMPARATORLOOSE]:Byl[Lyl.COMPARATOR],i=t.match(n);if(!i)throw new TypeError(`Invalid comparator: ${t}`);this.operator=i[1]!==void 0?i[1]:"",this.operator==="="&&(this.operator=""),i[2]?this.semver=new kyl(i[2],this.options.loose):this.semver=H4t}toString(){return this.value}test(t){if(QJo("Comparator.test",t,this.options.loose),this.semver===H4t||t===H4t)return!0;if(typeof t=="string")try{t=new kyl(t,this.options)}catch{return!1}return zJo(t,this.operator,this.semver,this.options)}intersects(t,n){if(!(t instanceof r))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new qyl(t.value,n).test(this.value):t.operator===""?t.value===""?!0:new qyl(this.value,n).test(t.semver):(n=Dyl(n),n.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!n.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||zJo(this.semver,"<",t.semver,n)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||zJo(this.semver,">",t.semver,n)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};Fyl.exports=jJo;var Dyl=oOr(),{safeRe:Byl,t:Lyl}=prt(),zJo=NJo(),QJo=F4t(),kyl=Vx(),qyl=pz()});var V4t=m(($IC,Uyl)=>{var nV1=pz(),iV1=(r,t,n)=>{try{t=new nV1(t,n)}catch{return!1}return t.test(r)};Uyl.exports=iV1});var Qyl=m((XIC,zyl)=>{var oV1=pz(),sV1=(r,t)=>new oV1(r,t).set.map(n=>n.map(i=>i.value).join(" ").trim().split(" "));zyl.exports=sV1});var Gyl=m((ZIC,jyl)=>{var aV1=Vx(),uV1=pz(),cV1=(r,t,n)=>{let i=null,o=null,s=null;try{s=new uV1(t,n)}catch{return null}return r.forEach(a=>{s.test(a)&&(!i||o.compare(a)===-1)&&(i=a,o=new aV1(i,n))}),i};jyl.exports=cV1});var Vyl=m((e3C,Hyl)=>{var lV1=Vx(),pV1=pz(),dV1=(r,t,n)=>{let i=null,o=null,s=null;try{s=new pV1(t,n)}catch{return null}return r.forEach(a=>{s.test(a)&&(!i||o.compare(a)===1)&&(i=a,o=new lV1(i,n))}),i};Hyl.exports=dV1});var Yyl=m((t3C,Kyl)=>{var GJo=Vx(),fV1=pz(),Wyl=U4t(),hV1=(r,t)=>{r=new fV1(r,t);let n=new GJo("0.0.0");if(r.test(n)||(n=new GJo("0.0.0-0"),r.test(n)))return n;n=null;for(let i=0;i<r.set.length;++i){let o=r.set[i],s=null;o.forEach(a=>{let u=new GJo(a.semver.version);switch(a.operator){case">":u.prerelease.length===0?u.patch++:u.prerelease.push(0),u.raw=u.format();case"":case">=":(!s||Wyl(u,s))&&(s=u);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),s&&(!n||Wyl(n,s))&&(n=s)}return n&&r.test(n)?n:null};Kyl.exports=hV1});var $yl=m((r3C,Jyl)=>{var gV1=pz(),AV1=(r,t)=>{try{return new gV1(r,t).range||"*"}catch{return null}};Jyl.exports=AV1});var gOr=m((n3C,tbl)=>{var mV1=Vx(),ebl=G4t(),{ANY:yV1}=ebl,bV1=pz(),EV1=V4t(),Xyl=U4t(),Zyl=cOr(),CV1=pOr(),SV1=lOr(),vV1=(r,t,n,i)=>{r=new mV1(r,i),t=new bV1(t,i);let o,s,a,u,p;switch(n){case">":o=Xyl,s=CV1,a=Zyl,u=">",p=">=";break;case"<":o=Zyl,s=SV1,a=Xyl,u="<",p="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(EV1(r,t,i))return!1;for(let c=0;c<t.set.length;++c){let l=t.set[c],d=null,f=null;if(l.forEach(h=>{h.semver===yV1&&(h=new ebl(">=0.0.0")),d=d||h,f=f||h,o(h.semver,d.semver,i)?d=h:a(h.semver,f.semver,i)&&(f=h)}),d.operator===u||d.operator===p||(!f.operator||f.operator===u)&&s(r,f.semver))return!1;if(f.operator===p&&a(r,f.semver))return!1}return!0};tbl.exports=vV1});var nbl=m((i3C,rbl)=>{var TV1=gOr(),_V1=(r,t,n)=>TV1(r,t,">",n);rbl.exports=_V1});var obl=m((o3C,ibl)=>{var IV1=gOr(),RV1=(r,t,n)=>IV1(r,t,"<",n);ibl.exports=RV1});var ubl=m((s3C,abl)=>{var sbl=pz(),OV1=(r,t,n)=>(r=new sbl(r,n),t=new sbl(t,n),r.intersects(t,n));abl.exports=OV1});var lbl=m((a3C,cbl)=>{var wV1=V4t(),MV1=lz();cbl.exports=(r,t,n)=>{let i=[],o=null,s=null,a=r.sort((l,d)=>MV1(l,d,n));for(let l of a)wV1(l,t,n)?(s=l,o||(o=l)):(s&&i.push([o,s]),s=null,o=null);o&&i.push([o,null]);let u=[];for(let[l,d]of i)l===d?u.push(l):!d&&l===a[0]?u.push("*"):d?l===a[0]?u.push(`<=${d}`):u.push(`${l} - ${d}`):u.push(`>=${l}`);let p=u.join(" || "),c=typeof t.raw=="string"?t.raw:String(t);return p.length<c.length?p:t}});var Abl=m((u3C,gbl)=>{var pbl=pz(),VJo=G4t(),{ANY:HJo}=VJo,W4t=V4t(),WJo=lz(),xV1=(r,t,n={})=>{if(r===t)return!0;r=new pbl(r,n),t=new pbl(t,n);let i=!1;e:for(let o of r.set){for(let s of t.set){let a=NV1(o,s,n);if(i=i||a!==null,a)continue e}if(i)return!1}return!0},PV1=[new VJo(">=0.0.0-0")],dbl=[new VJo(">=0.0.0")],NV1=(r,t,n)=>{if(r===t)return!0;if(r.length===1&&r[0].semver===HJo){if(t.length===1&&t[0].semver===HJo)return!0;n.includePrerelease?r=PV1:r=dbl}if(t.length===1&&t[0].semver===HJo){if(n.includePrerelease)return!0;t=dbl}let i=new Set,o,s;for(let h of r)h.operator===">"||h.operator===">="?o=fbl(o,h,n):h.operator==="<"||h.operator==="<="?s=hbl(s,h,n):i.add(h.semver);if(i.size>1)return null;let a;if(o&&s){if(a=WJo(o.semver,s.semver,n),a>0)return null;if(a===0&&(o.operator!==">="||s.operator!=="<="))return null}for(let h of i){if(o&&!W4t(h,String(o),n)||s&&!W4t(h,String(s),n))return null;for(let A of t)if(!W4t(h,String(A),n))return!1;return!0}let u,p,c,l,d=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1,f=o&&!n.includePrerelease&&o.semver.prerelease.length?o.semver:!1;d&&d.prerelease.length===1&&s.operator==="<"&&d.prerelease[0]===0&&(d=!1);for(let h of t){if(l=l||h.operator===">"||h.operator===">=",c=c||h.operator==="<"||h.operator==="<=",o){if(f&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===f.major&&h.semver.minor===f.minor&&h.semver.patch===f.patch&&(f=!1),h.operator===">"||h.operator===">="){if(u=fbl(o,h,n),u===h&&u!==o)return!1}else if(o.operator===">="&&!W4t(o.semver,String(h),n))return!1}if(s){if(d&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===d.major&&h.semver.minor===d.minor&&h.semver.patch===d.patch&&(d=!1),h.operator==="<"||h.operator==="<="){if(p=hbl(s,h,n),p===h&&p!==s)return!1}else if(s.operator==="<="&&!W4t(s.semver,String(h),n))return!1}if(!h.operator&&(s||o)&&a!==0)return!1}return!(o&&c&&!s&&a!==0||s&&l&&!o&&a!==0||f||d)},fbl=(r,t,n)=>{if(!r)return t;let i=WJo(r.semver,t.semver,n);return i>0?r:i<0||t.operator===">"&&r.operator===">="?t:r},hbl=(r,t,n)=>{if(!r)return t;let i=WJo(r.semver,t.semver,n);return i<0?r:i>0||t.operator==="<"&&r.operator==="<="?t:r};gbl.exports=xV1});var grt=m((c3C,bbl)=>{var KJo=prt(),mbl=q4t(),DV1=Vx(),ybl=wJo(),BV1=jBe(),LV1=Fml(),kV1=zml(),qV1=Gml(),FV1=Wml(),UV1=Yml(),zV1=$ml(),QV1=Zml(),jV1=tyl(),GV1=lz(),HV1=oyl(),VV1=ayl(),WV1=uOr(),KV1=pyl(),YV1=fyl(),JV1=U4t(),$V1=cOr(),XV1=xJo(),ZV1=PJo(),eW1=lOr(),tW1=pOr(),rW1=NJo(),nW1=Syl(),iW1=G4t(),oW1=pz(),sW1=V4t(),aW1=Qyl(),uW1=Gyl(),cW1=Vyl(),lW1=Yyl(),pW1=$yl(),dW1=gOr(),fW1=nbl(),hW1=obl(),gW1=ubl(),AW1=lbl(),mW1=Abl();bbl.exports={parse:BV1,valid:LV1,clean:kV1,inc:qV1,diff:FV1,major:UV1,minor:zV1,patch:QV1,prerelease:jV1,compare:GV1,rcompare:HV1,compareLoose:VV1,compareBuild:WV1,sort:KV1,rsort:YV1,gt:JV1,lt:$V1,eq:XV1,neq:ZV1,gte:eW1,lte:tW1,cmp:rW1,coerce:nW1,Comparator:iW1,Range:oW1,satisfies:sW1,toComparators:aW1,maxSatisfying:uW1,minSatisfying:cW1,minVersion:lW1,validRange:pW1,outside:dW1,gtr:fW1,ltr:hW1,intersects:gW1,simplifyRange:AW1,subset:mW1,SemVer:DV1,re:KJo.re,src:KJo.src,tokens:KJo.t,SEMVER_SPEC_VERSION:mbl.SEMVER_SPEC_VERSION,RELEASE_TYPES:mbl.RELEASE_TYPES,compareIdentifiers:ybl.compareIdentifiers,rcompareIdentifiers:ybl.rcompareIdentifiers}});var K4t,yW1,l3C,bW1,LC,Fee=V(()=>{"use strict";K4t=gt(CU()),yW1=gt(grt()),l3C=(0,K4t.Record)({version:K4t.String,hash:K4t.String}),bW1=()=>{let r="7.40.2",t="305d1b710a624175e9cb660632108f220d8d0591";return r&&t?{version:r,hash:t}:null},LC=bW1()});var QCe,Art,AOr=V(()=>{"use strict";fr();QCe=class extends nt{constructor(n){super(`Run ${n} canceled by user`);this.runID=n}runID;fault="client"},Art=class extends nt{constructor(n){super('Test failed with "continue on failure" set to false');this.result=n}result;fault="client"}});var Ebl,Cbl,WBe,Y4t,J4t,mOr,yOr=V(()=>{"use strict";ly();AOr();Ebl=(r,t,n)=>{switch(r){case"skipped":return"Skipped";case"error":return"Error";case"complete":switch(n){case"create":return t?"Validated":"Created";case"run":return t?"Validated":"DataLoaded";default:return"None"}default:return"None"}},Cbl=r=>typeof r=="object"&&r instanceof Art,WBe=r=>typeof r=="object"&&(r instanceof im||r instanceof QCe),Y4t=r=>typeof r=="object"&&r instanceof az&&r.isCancel(),J4t=r=>typeof r=="object"&&r instanceof qee&&r.isCancel(),mOr=r=>WBe(r)||Y4t(r)||J4t(r)});var Sbl,vbl,jCe,$4t=V(()=>{"use strict";fr();s0e();Bo();gc();ar();cm();R3();pNt();Xd();Fee();IJo();L4t();AOr();yOr();Sbl=5e5,vbl=500,jCe=class r{constructor(t,n,i,o,s){this.state=t;this.repository=n;this.logContext=i;this.operationType=o;this.analyticsCollector=s}state;repository;logContext;operationType;stepsInitialized=null;runResults={};flusher=null;wasCanceled=!1;nodeStageIndexTracker=new Map;analyticsCollector;get teamID(){return this.logContext.orgID}get runID(){return this.logContext.runID}get envID(){return this.logContext.workspaceID}GetLogContext=t=>({...this.logContext,nodeID:t});async runIsCanceled(){if(!this.repository)return!1;if(this.wasCanceled)return!0;try{let t=!!(await this.getRepositoryForRun().fetch({pendingWritesTimeoutMs:100})).runDetails.canceled;return t&&(this.wasCanceled=!0),t}catch(t){if(h2(t)){if(t instanceof FBe)return!1;if(t instanceof Vu)return!1}throw t}}async throwIfRunCanceled(){if(await this.runIsCanceled())throw new QCe(this.runID)}updateNodeLocalRunResult({stepID:t,isPreview:n,runExecutionSequenceID:i},o){let s=this.runResults[t];s?(s.runState=o,s.queryResultSequence.isRunning=o==="running",s.stepRunState=this.getStepRunState(o,n),i!==void 0&&(s.runExecutionSequenceID=i),(o==="canceled"||o==="skipped"||o==="error")&&s.queryResultSequence.queryResults.forEach(a=>{!a.isRunning&&a.status==="Queued"&&(a.status="Canceled")})):this.Logger.errorContext(this.GetLogContext(t),"EventHandler updateNodeLocalRunResult: missing expected local run result for node",t)}getBulkSkipHandler=()=>async t=>{if(!this.repository)return;let n=this.repository.batch(),i=this.getRepositoryForRun().runResults;for(let[o,s]of Object.entries(t))if(this.runResults[o]){let a=i.get(o);this.updateNodeLocalRunResult({stepID:o,isPreview:!1,runExecutionSequenceID:s},"skipped");let u={...r.truncateRunResult(this.runResults[o]),version:2};await n.save(a,u)}await n.commit()};getCancelNodeHandler=()=>async t=>{try{if(!this.repository)return;if(this.runResults[t]){this.updateNodeLocalRunResult({stepID:t,isPreview:!1},"canceled");let i=this.getRepositoryForRun().runResults.get(t),o={...r.truncateRunResult(this.runResults[t]),version:2};await i.save(o)}else this.Logger.errorContext(this.GetLogContext(t),"EventHandler getCancelNodeHandler: missing expected local run result for node",t)}catch(n){this.Logger.errorContext(this.logContext,`Error canceling node ${t}`,n)}};async repositoryUpdateRunStatus({expectedStatus:t,newStatus:n}){if(!this.repository)return;let i=this.getRepositoryForRun();try{let o=await i.fetch();Dh("RUNNER_BACKEND",t===o.runStatus,this.logContext,`EventHandler.repositoryUpdateRunStatus found unexpected run status - expected: ${t} / actual: ${o.runStatus}`)}catch(o){this.Logger.alertContext(this.logContext,"Error fetching runInfo",o)}await i.merge({runStatus:n})}async repositoryStampExecutorInfo(t){if(this.repository)try{await this.getRepositoryForRun().merge({platform:t,...LC?{softwareVersion:LC.version}:{}})}catch(n){this.Logger.errorContext(this.logContext,"[EventHandler.repositoryStampExecutorInfo] Error stamping executor info. Cannot update run document version/platform.",n)}}async repositoryUpdateRenderingProgress(t){if(this.repository)try{await this.getRepositoryForRun().merge({renderingProgress:{totalNodes:t.totalNodes,completedNodes:t.completedNodes}})}catch(n){this.Logger.errorContext(this.logContext,"[EventHandler.repositoryUpdateRenderingProgress] Error updating rendering progress. Cannot update run document renderingProgress.",n)}}getRepositoryRunsCollection(){if(!this.repository)throw new nt("No repository to get runs collection for!");let t=this.repository.orgs.get(this.logContext.orgID);return this.runLevel==="orgRuns"?t.runs:t.devRuns}getRepositoryForRun(){return this.getRepositoryRunsCollection().get(this.runID)}formatError=(t,n=null,i=null,o=!1)=>{let s=Ta(t.error).error,a="";return t.error&&typeof t.error=="object"&&!(t.error instanceof Error)&&"runDetails"in t.error&&typeof t.error.runDetails=="object"&&(a=t.error?.runDetails?.compiledSQL??""),t.templateString&&(a=t.templateString),{success:!1,error:{errorString:s.errorString??"",errorDetail:s.errorDetail??""},rows:[],fields:[],name:"",exportedRefs:[],invalidExportedRefs:[],status:o?"Canceled":"Failure",sql:a??"",startTime:t.startTime,endTime:new Date,isRunning:!1,type:"sql",queryID:n,warehouse:i}};populateRunResults(t,n){let i="[EventHandler.populateRunResults()]",o=t.length+1;for(let s of t){let u=k1(s,this.state.nodes,`${i} state.nodes`).operation.name;this.runResults[s]={name:u,runExecutionSequenceID:o,dataResult:null,runState:n,stepRunState:"None",queryResultSequence:{name:u,queryResults:[],isRunning:!1},runResultVersion:2}}}async bulkSetRunResults(t){if(!this.repository)return;let n=this.repository.batch(),i=this.getRepositoryForRun().runResults;for(let o of t){let s=this.runResults[o];if(!s)throw new nt(`Run result for node ${o} does not exist for run ${this.runID}`);let a={...s,name:s.queryResultSequence.name,runExecutionSequenceID:s.runExecutionSequenceID,version:2},u=i.get(o);await n.save(u,a)}await n.commit()}async initializeRunResults(t,n="queued"){this.stepsInitialized=[...t],this.populateRunResults(t,n),await this.bulkSetRunResults(t)}setFlusher(t){this.flusher=t,t.startTimer()}async disposeFlusher(){await this.flusher?.stopAndFlush()}async populatePlaceholderStages(t,n){let i=new Set,o=new Set(t.keys());for(let s of n){if(!o.has(s))continue;let a=t.getPhaseItems(s);for(let[u,p]of a.entries()){let c=k1(u,this.runResults,"populateQueuedStages: this.runResults"),l=this.state.nodes[u],d=l?o4(l,void 0):!1,f=lrt(p,this.getNameForStageWithoutSQL(s,d));for(let h of f)c.queryResultSequence.queryResults.push(this.createQueuedStage(h));f.length>0&&!i.has(u)&&(i.add(u),this.nodeStageIndexTracker.set(u,0))}}await this.bulkSetQueuedStageResults(i)}createQueuedStage({name:t,sql:n,type:i}){return{name:t,status:"Queued",success:!0,sql:n,rows:[],fields:[],startTime:new Date,endTime:new Date,isRunning:!1,exportedRefs:[],invalidExportedRefs:[],type:i}}async bulkSetQueuedStageResults(t){if(!this.repository)return;let n=this.repository.batch(),i=this.getRepositoryForRun().runResults;for(let o of t){let s=this.runResults[o];if(!s)continue;let a=i.get(o);await n.save(a,r.buildRunResultEntitySave(s))}await n.commit()}formatErrorToResult(t,n){let i=null,o=null;return typeof t.error=="object"&&(i=t.error.queryID||null,o=t.error.warehouse||null),{...this.formatError(t,i,o,n),name:t.stageName,stageExecutionStartTime:t.stageExecutionStartTime,stageExecutionEndTime:t.stageExecutionEndTime}}ensureHasQueryResult(t){if(Dh("DEPLOY",!!t.queryResult,this.GetLogContext(t.stepID),"query result should always be returned for stage execution"),!t.queryResult)throw new Error("Got an empty query result for stage execution")}updateStageResultAtTrackedIndex=(t,n)=>{let o=k1(t,this.runResults,"[EventHandler.setLastQueryResult()]").queryResultSequence.queryResults,s=this.getCurrentStageIndex(t);if(s<0||s>=o.length)throw this.Logger.errorContext(this.GetLogContext(t),"[EventHandler.setLastQueryResult] stage index out of bounds",{targetIndex:s,queryResultsLength:o.length,resultName:n.name}),new nt(`Stage index ${s} out of bounds (length: ${o.length}) for node ${t}`);o[s]=n};async dispatchQueryFailure(t,n){let i=this.formatErrorToResult(t,n),o=n?"client":A3(t.error)??"system";return HS(this.Logger,o,this.GetLogContext(t.stepID),"failed to execute run sql",n?"- canceled":"- errored",t.error,"stack: ",t.error.stack||"<none found>"),this.updateStageResultAtTrackedIndex(t.stepID,i),{error:i.error,fault:o}}getSingleStepData(t,n){let i=this.state.nodes[n];if(i)return i;let o=`(${this.runTypeName}) EventHandler: Could not get step data for step: ${n}`;throw this.Logger.errorContext(this.GetLogContext(n),o,n),new nt(o)}getUnrunSteps(){let t={},n=this.state.nodes,i=this.runResults;if(n&&this.stepsInitialized)for(let o of this.stepsInitialized){let s=i[o];if(s){let{runState:a}=s;(a==="waiting"||a==="queued")&&(n[o]?t[o]=0:this.Logger.alertContext(this.logContext,"Node ID from initialization not found in steps data",o))}else this.Logger.alertContext(this.logContext,"Node ID from initialization not found in run results",o)}return t}getStepContext=(t,n,i,o)=>{let s=this.getSingleStepData(t,n),{locationName:a}=s.operation,{database:u}=this.state.mappings[a]?.mappingDefinitions[this.state.currentWorkspace]??{},p=o4(s,void 0),c=s.operation.name;return{startTime:new Date,stepID:n,stepName:c,runExecutionSequenceID:i,phase:t,isPreview:o,isSource:p,database:u??""}};convertIQueryToCompletedQueryResult(t){return{...t,startTime:OUo(t.startTime),endTime:OUo(t.endTime)}}getCurrentStageIndex(t){let n=this.nodeStageIndexTracker.get(t);if(n===void 0)throw new nt(`[EventHandler.getCurrentStageIndex] Node ${t} not in stage tracker. Was populateQueuedStages called for this node?`);return n}advanceToNextStage(t){let n=this.getCurrentStageIndex(t);this.nodeStageIndexTracker.set(t,n+1)}getQueryResultForUpdateSuccess(t){return{...this.convertIQueryToCompletedQueryResult(t.queryResult),name:t.stageName,stageExecutionStartTime:t.stageExecutionStartTime,stageExecutionEndTime:t.stageExecutionEndTime}}getStepRunState(t,n){return Ebl(t,n,this.operationType)}async updateRunResult(t){if(!this.repository)return;let n=this.runResults[t];if(!n)throw new nt(`[EventHandler.updateRunResult()] run result for node ${t} does not exist for run ${this.runID}`);if(this.flusher)this.flusher.markDirty(t);else{let i=r.buildRunResultEntitySave(n);this.Logger.debugContext(this.GetLogContext(t),"updating run result",i),await this.getRepositoryForRun().runResults.get(t).save(i)}}isFinalRunForStep(t){return!0}async beforePhaseExecution(t,n){}async afterPhaseExecution(t){}async beforeStepExecution(t){this.runResults[t.stepID]&&(this.runResults[t.stepID].runExecutionSequenceID=t.runExecutionSequenceID),this.updateNodeLocalRunResult(t,"running"),await this.updateRunResult(t.stepID)}async afterFinalRunSuccessForNode(t){return Promise.resolve()}async afterStepExecutionSuccess(t){this.isFinalRunForStep(t)?(this.updateNodeLocalRunResult(t,"complete"),await this.afterFinalRunSuccessForNode(t)):this.updateNodeLocalRunResult(t,"waiting"),await this.updateRunResult(t.stepID)}async afterStepExecutionFailure(t){let n=await this.isCoalesceInitiatedCancel(t.error);this.markUnexecutedStagesAsCanceled(t.stepID),this.updateNodeLocalRunResult(t,n?"canceled":"error");try{this.flusher?await this.flusher.flushOne(t.stepID):await this.updateRunResult(t.stepID)}catch(i){this.Logger.emergContext(this.GetLogContext(t.stepID),`Error in firebaseUpdateStepResult for stepCounter:${t.stepID}:`,i)}}markUnexecutedStagesAsCanceled(t){let n=this.runResults[t];if(n)for(let i of n.queryResultSequence.queryResults)"status"in i&&i.status==="Queued"&&(i.status="Canceled")}sanityCheckContext(t){if(!t.stageType)throw this.Logger.emergContext(this.logContext,`No stage type on this ${this.runTypeName}!`,t),new Error(`Internal critical error: no stage type on this ${this.runTypeName}!`)}async beforeStageExecution(t){this.sanityCheckContext(t);let n=this.runResults[t.stepID];if(n){let i=n.queryResultSequence.queryResults,o=this.getCurrentStageIndex(t.stepID),s=i[o];if(!s||!("status"in s)||s.status!=="Queued"){let a=s&&"status"in s?s.status:"no-status";throw new nt(`[EventHandler.beforeStageExecution] Expected queued placeholder at index ${o} for node ${t.stepID}, but found: ${s?`status=${a}`:"undefined"}`)}s.status="Running",s.startTime=new Date,s.endTime=s.startTime,await this.updateRunResult(t.stepID)}}async updateRunWithHeartbeat(t){await this.getRepositoryForRun().updateHeartbeat(t)}async afterStageExecutionSuccess(t){let n="[EventHandler.afterStageExecutionSuccess()]";if(this.sanityCheckContext(t),!t.queryResult){let i="Got an empty query result for stage execution - query result should always be returned!";throw this.Logger.alertContext(this.GetLogContext(t.stepID),n,i),new nt(i)}if(t.stageExecutionStartTime&&t.stageExecutionEndTime){let i=t.stageExecutionEndTime.getTime()-t.stageExecutionStartTime.getTime();this.analyticsCollector.addQueryTiming(t.stepID,t.stageName,i,!0,t.stageExecutionStartTime)}if(lNt(t.queryResult)&&!t.queryResult.success){await this.updateRunWithHeartbeat({hasTestFailures:!0});let i=this.runResults[t.stepID];i&&(i.hasTestFailures=!0)}this.updateStageResultAtTrackedIndex(t.stepID,this.getQueryResultForUpdateSuccess(t)),await this.updateRunResult(t.stepID),this.advanceToNextStage(t.stepID)}async afterStageExecutionFailure(t){if(this.sanityCheckContext(t),t.stageExecutionStartTime&&t.stageExecutionEndTime){let o=t.stageExecutionEndTime.getTime()-t.stageExecutionStartTime.getTime();this.analyticsCollector.addQueryTiming(t.stepID,t.stageName,o,!1,t.stageExecutionStartTime)}let n=await this.isCoalesceInitiatedCancel(t.error),i=await this.dispatchQueryFailure(t,n);throw this.flusher?await this.flusher.flushOne(t.stepID):await this.updateRunResult(t.stepID),this.advanceToNextStage(t.stepID),n?t.error:i}async isCoalesceInitiatedCancel(t){return WBe(t)?!0:Y4t(t)?this.runIsCanceled():J4t(t)?this.runIsCanceled():!1}static truncateQueryResult(t,n=Sbl,i=vbl){let o=t.sql,s=t.rows,a,u;if(o){let p=new TextEncoder,c=new TextDecoder("utf8"),l=p.encode(o);if(l.length>n){let d=c.decode(l.slice(0,n));d.slice(-1)==="\uFFFD"&&(d=d.slice(0,-1)),a=`${d}...data truncated`}}return s?.length>i&&(u=s.slice(0,i),u.push({values:[`${s.length-i} rows truncated`]})),a||u?{...t,sql:a??o,rows:u??s}:t}static buildRunResultEntitySave(t){return{...r.truncateRunResult(t),name:t.queryResultSequence.name,runExecutionSequenceID:t.runExecutionSequenceID,version:2}}static truncateRunResult(t){let n=(t.dataResult?.sql?1:0)+(t.queryResultSequence?.renderQueryResults?.sql?1:0)+(t.queryResultSequence?.queryResults?.length??0),i=(t.dataResult?.rows?.length?1:0)+(t.queryResultSequence?.renderQueryResults?.rows?.length?1:0)+(t.queryResultSequence?.queryResults?.reduce((p,c)=>p+c?.rows?.length?1:0,0)??0);if(n===0&&i===0)return t;let o=Math.trunc(Sbl/n)-100,s=vbl/(i??1),a={...t};t.dataResult?.sql&&(a.dataResult=r.truncateQueryResult(t.dataResult,o,s)??null);let u=t.queryResultSequence;return u&&(a.queryResultSequence={...u,queryResults:u.queryResults?.map(p=>r.truncateQueryResult(p,o,s))},u.renderQueryResults&&(a.queryResultSequence.renderQueryResults=r.truncateQueryResult(u.renderQueryResults,o,s))),a}}});var X4t,Tbl=V(()=>{"use strict";qa();Bo();gc();v6();L4t();k4t();$4t();X4t=class extends jCe{constructor(n,i,o,s,a){super(n,i,o,"create",a);this.phasedNodeData=s}phasedNodeData;getNameForStageWithoutSQL=(n,i)=>iOr(n,i);getNodeDataForUpdate=n=>{let i=this.getSingleStepData(n.phase,n.stepID),o=i.operation.locationName,s=JU(this.state.mappings,this.envID),a=this.GetLogContext(n.stepID),u;try{let p=s?.[o]?.database??i.operation.database,c=s?.[o]?.schema??i.operation.schema;return u={...i.operation,metadata:{...i.operation.metadata,columns:i.operation.metadata.columns.map(l=>({...l}))},database:p,schema:c,version:1,id:n.stepID,deployEnabled:!0},this.Logger.infoContext(a,"newStepData:",u,"stepCounter:",n.stepID),u8c("(Logging Only) Compare locations from context and workspace",a,()=>{let l=JU(this.state.mappings||{},this.state.currentWorkspace);Dh("DEPLOY",sye(l[o],s[o]),a,`Location data for location ${o} for node ${i.operation.name} with id ${n.stepID} differs between data from context and data from workspace.`,"locationsFromWorkspace:",l,"locationsFromContext:",s)}),u}catch(p){let c=u?u.name:i.operation.name,l=`Error attempting to update the database/schema on deployed nodeID ${n.stepID}: ${c}`;throw this.Logger.emergContext(a,l,"locations:",s,"error:",p),new yW(n.stepID,l)}};async updateEnvironmentNodeMetadata(n){if(!this.repository)return;let i=this.repository.org(this.teamID).workspace(+this.envID).nodes.get(n.stepID);if(n.phase==="deletedTable")n.stepID in this.phasedNodeData.addedTable||await i.delete();else{let o=this.getNodeDataForUpdate(n);await i.save(o)}}isFinalRunForStep(n){let i=[];return n.phase==="deletedTable"&&(i.push(this.phasedNodeData.alteredTable),i.push(this.phasedNodeData.addedTable)),n.phase==="alteredTable"&&i.push(this.phasedNodeData.addedTable),!i.some(o=>n.stepID in o)}async afterFinalRunSuccessForNode(n){try{await this.updateEnvironmentNodeMetadata(n)}catch(i){let o=this.GetLogContext(n.stepID);this.Logger.errorContext(o,"Error updating node metadata -- nodeID:",n.stepID,"error:",i);let s=F$e(i),a="unknown location";try{a=this.getSingleStepData(n.phase,n.stepID).operation.locationName}catch(u){this.Logger.errorContext(o,`Error getting location name for node ${n.stepName} (${n.stepID}):`,u)}throw new yW(n.stepID,`Failed to update node metadata for ${n.stepName} (${a}): ${s}`)}}}});var _bl,bOr,YJo=V(()=>{"use strict";fr();_bl=(r,t)=>{let n=new Set(t);return n.delete(r),Array.from(n)},bOr=async(r,t,n)=>{if(!t)throw new nt(`Cannot get deploy run info since workspace ${r} has no currently running jobs`);if(t.length)return(await n.selectInBatches("id","in",t,[["runType","==","deploy"],["runStatus","==","running"]]))[0]}});var EOr,Ibl=V(()=>{"use strict";EOr="No SQL to execute"});var Z4t=V(()=>{"use strict";YJo();Ibl()});var eDt,Rbl=V(()=>{"use strict";Z4t();$4t();eDt=class extends jCe{constructor(t,n,i,o){super(t,n,i,"run",o)}async initializeRunResults(t){await super.initializeRunResults(t,"waiting")}getNameForStageWithoutSQL=()=>EOr}});var Obl=V(()=>{"use strict"});var COr,JJo=V(()=>{"use strict";COr=class{constructor(t,n,i,o,s,a,u){this.repository=t;this.getRunRepository=n;this.buildEntitySave=i;this.runResults=o;this.logger=s;this.logContext=a;this.flushIntervalMs=u?.flushIntervalMs??3e3,this.flushThreshold=u?.flushThreshold??50}repository;getRunRepository;buildEntitySave;runResults;logger;logContext;dirtyNodes=new Set;timer=null;activeFlush=null;flushedDuringBatch=new Set;flushIntervalMs;flushThreshold;totalFlushes=0;totalNodeWrites=0;totalImmediateWrites=0;timerFlushes=0;thresholdFlushes=0;slowCommits=0;tag="[RunResultFlusher]";markDirty(t){this.dirtyNodes.add(t),this.dirtyNodes.size>=this.flushThreshold&&this.flush("threshold").catch(n=>{this.logger.errorContext(this.logContext,`${this.tag} threshold-triggered flush error`,n)})}async flush(t="dispose"){if(this.activeFlush||this.dirtyNodes.size===0){this.logger.debugContext(this.logContext,`${this.tag} flush skipped (activeFlush=${!!this.activeFlush}, dirtySetEmpty=${this.dirtyNodes.size===0}, trigger=${t})`);return}let n=new Set(this.dirtyNodes);this.dirtyNodes.clear(),this.activeFlush=this.doFlush(n,t);try{await this.activeFlush}finally{this.activeFlush=null}}async doFlush(t,n){try{let i=this.repository.batch();for(let a of t){let u=this.runResults[a];if(!u){this.logger.warnContext(this.logContext,`${this.tag} node ${a} no longer has a run result, skipping write`);continue}let p=this.buildEntitySave(u),c=this.getRunRepository().runResults.get(a);await i.save(c,p)}let o=Date.now();await i.commit();let s=Date.now()-o;if(this.flushedDuringBatch.size>0){let a=this.getRunRepository().runResults;for(let u of this.flushedDuringBatch)if(t.has(u)){let p=this.runResults[u];p&&await a.get(u).save(this.buildEntitySave(p))}this.flushedDuringBatch.clear()}this.totalFlushes++,this.totalNodeWrites+=t.size,n==="timer"&&this.timerFlushes++,n==="threshold"&&this.thresholdFlushes++,s>=2e3&&(this.slowCommits++,this.logger.warnContext(this.logContext,`${this.tag} slow commit: ${s}ms for ${t.size} nodes (possible write stream pressure)`)),this.logger.debugContext(this.logContext,`${this.tag} flushed ${t.size} run results in ${s}ms (${n}, threshold=${this.flushThreshold}, interval=${this.flushIntervalMs}ms)`)}catch(i){for(let o of t)this.dirtyNodes.add(o);throw this.logger.errorContext(this.logContext,`${this.tag} flush failed, ${t.size} nodes re-queued`,i),i}}async flushOne(t){this.dirtyNodes.delete(t);let n=this.runResults[t];if(!n){this.logger.warnContext(this.logContext,`${this.tag} node ${t} no longer has a run result, skipping write (flushOne)`);return}this.activeFlush&&this.flushedDuringBatch.add(t);let i=this.buildEntitySave(n);await this.getRunRepository().runResults.get(t).save(i),this.totalImmediateWrites++}startTimer(){this.timer||(this.timer=setInterval(()=>{this.flush("timer").catch(t=>{this.logger.errorContext(this.logContext,`${this.tag} timer-triggered flush error`,t)})},this.flushIntervalMs))}async stopAndFlush(){this.timer&&(clearInterval(this.timer),this.timer=null);try{if(this.activeFlush)try{await this.activeFlush}catch(t){this.logger.errorContext(this.logContext,`${this.tag} error waiting for in-flight flush (stopAndFlush)`,t)}this.logger.infoContext(this.logContext,`${this.tag} draining remaining dirty nodes (stopAndFlush)`),await this.flush("dispose")}catch(t){this.logger.errorContext(this.logContext,`${this.tag} error stopping and flushing (stopAndFlush)`,t)}finally{this.logger.infoContext(this.logContext,`${this.tag} done \u2014 ${this.totalFlushes} flushes (${this.thresholdFlushes} threshold, ${this.timerFlushes} timer, ${this.slowCommits} slow), ${this.totalNodeWrites} batched writes, ${this.totalImmediateWrites} immediate writes (threshold=${this.flushThreshold}, interval=${this.flushIntervalMs}ms)`)}}}});var SOr,vOr,TOr,_Or,GCe=V(()=>{"use strict";ar();IJo();Tbl();Rbl();yOr();AOr();$4t();Obl();JJo();yOr();SOr=class extends X4t{constructor(t,n,i,o,s){super(t,n,i,o,s)}get Logger(){return We("DEPLOY")}get runTypeName(){return"Deploy"}get runLevel(){return"orgRuns"}},vOr=class extends eDt{get Logger(){return We("RUNNER")}get runTypeName(){return"Refresh"}get runLevel(){return"orgRuns"}afterStepExecutionSuccess=async t=>{await super.afterStepExecutionSuccess(t),this.repository&&super.isFinalRunForStep(t)&&!t.isSource&&await this.repository.org(this.logContext.orgID).workspace(this.logContext.workspaceID).nodeLastRefreshed(t.stepID).save({lastRefreshed:new Date().toISOString()})};getQueryResultForUpdateSuccess=t=>({...super.getQueryResultForUpdateSuccess(t),type:t.stageType});async dispatchQueryFailure(t,n){if(Cbl(t.error)){let i=t.error,o=this.getCurrentStageIndex(t.stepID);t.stepID in this.runResults&&(this.runResults[t.stepID].queryResultSequence.queryResults[o]=this.convertIQueryToCompletedQueryResult(i.result));let s=this.runResults[t.stepID];return s&&(s.hasTestFailures=!0),await this.updateRunWithHeartbeat({hasTestFailures:!0}),{error:{errorString:t.error.message,errorDetail:t.error.message},fault:"client"}}else return super.dispatchQueryFailure(t,n)}},TOr=class extends X4t{get Logger(){return We("RUNNER")}get runTypeName(){return"Dev Run"}get runLevel(){return"devRuns"}},_Or=class extends eDt{get Logger(){return We("RUNNER")}get runTypeName(){return"Dev Run"}get runLevel(){return"devRuns"}}});var KBe,YBe,JBe=V(()=>{"use strict";KBe=["deletedTable","alteredTable","addedTable"],YBe=["refresh"]});var IOr,tDt,ROr,wbl,Mbl,SW1,vW1,TW1,_W1,xbl,mrt,OOr,$Jo,d0e,f0e=V(()=>{"use strict";qa();cb();fo();ar();MHo();ZYo();IOr=`{%- macro get_value_by_column_attribute(column_attribute, value="name") -%}
7877
+ %s`,W,W,v,a);let K=v.type==="*"?aJo:v.type==="?"?cJo:"\\"+v.type;u=!0,a=a.slice(0,v.reStart)+K+"\\("+W}q(),p&&(a+="\\\\");let G=Wj1[a.charAt(0)];for(let W=l.length-1;W>-1;W--){let K=l[W],F=a.slice(0,K.reStart),J=a.slice(K.reStart,K.reEnd-8),Y=a.slice(K.reEnd),z=a.slice(K.reEnd-8,K.reEnd)+Y,Z=F.split(")").length,ee=F.split("(").length-Z,ne=Y;for(let te=0;te<ee;te++)ne=ne.replace(/\)[+*?]?/,"");Y=ne;let se=Y===""&&n!==WRr?"(?:$|\\/)":"";a=F+J+Y+se+z}if(a!==""&&u&&(a="(?=.)"+a),G&&(a=L()+a),n===WRr)return[a,u];if(i.nocase&&!u&&!i.nocaseMagicOnly&&(u=t.toUpperCase()!==t.toLowerCase()),!u)return Xj1(t);let H=i.nocase?"i":"";try{let W=s?{_glob:t,_src:a,test:s}:{_glob:t,_src:a};return Object.assign(new RegExp("^"+a+"$",H),W)}catch(W){return this.debug("invalid regexp",W),new RegExp("$.")}}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let n=this.options,i=n.noglobstar?aJo:n.dot?Hj1:Vj1,o=n.nocase?"i":"",s=t.map(a=>{let u=a.map(p=>typeof p=="string"?eG1(p):p===uz?uz:p._src);return u.forEach((p,c)=>{let l=u[c+1],d=u[c-1];p!==uz||d===uz||(d===void 0?l!==void 0&&l!==uz?u[c+1]="(?:\\/|"+i+"\\/)?"+l:u[c]=i:l===void 0?u[c-1]=d+"(?:\\/|"+i+")?":l!==uz&&(u[c-1]=d+"(?:\\/|\\/"+i+"\\/)"+l,u[c+1]=uz))}),u.filter(p=>p!==uz).join("/")}).join("|");s="^(?:"+s+")$",this.negate&&(s="^(?!"+s+").*$");try{this.regexp=new RegExp(s,o)}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):KRr&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,n=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&n)return!0;let i=this.options;uJo.sep!=="/"&&(t=t.split(uJo.sep).join("/"));let o=this.slashSplit(t);this.debug(this.pattern,"split",o);let s=this.set;this.debug(this.pattern,"set",s);let a=o[o.length-1];if(!a)for(let u=o.length-2;!a&&u>=0;u--)a=o[u];for(let u=0;u<s.length;u++){let p=s[u],c=o;if(i.matchBase&&p.length===1&&(c=[a]),this.matchOne(c,p,n))return i.flipNegate?!0:!this.negate}return i.flipNegate?!1:this.negate}static defaults(t){return P3.defaults(t).Minimatch}};P3.Minimatch=irt});var UAl,zAl,QAl,jAl,GAl,HAl,VAl,WAl,KAl,YAl,JAl,FAl,ort,$Al=V(()=>{"use strict";x4t();UAl=2,zAl=1,QAl=3,jAl=2,GAl=8,HAl=5,VAl=6,WAl=new RegExp(/([\+]?){([\s\S]+)}([\+](?![\+]))?\s*/g),KAl=new RegExp(/((\w+):\s*((?:["])((([^\"\+\r\n\[/\\]+))(?:["]))|(([^\"\ \+\r\n\[/\\]+))))/g),YAl=new RegExp(/((\w+):\s*(((?:["])(((?:[^"]|"")*))(?:["]))|(([^\"\ \+\r\n\[/\\]+))))/g),JAl=new RegExp(/((?:[^\+\ \r\n\[\\]|\\.|\[(?:[^\r\n\]\\]|\\.)*\])+)\s*/g),FAl="",ort=(r,t)=>{if(t==="*")return r.some(o=>o!=null&&String(o).length>0);let n=r.map(o=>o!=null?String(o).replace(/\//g,FAl):""),i=t.replace(/\//g,FAl);return!!lJo(n,i).length}});var srt,vTC,XAl,ZAl,eml,JRr,tml,$Rr=V(()=>{"use strict";Zr();Bo();Sd();k_();ar();nJo();$Al();srt=We("SEARCH"),vTC=M.object({include:M.string(),exclude:M.string(),enabled:M.boolean()}),XAl={name:{MatchFunction:ort,MatchList:r=>[r.operation.name]},location:{MatchFunction:ort,MatchList:r=>[r.operation.locationName]},nodeType:{MatchFunction:ort,MatchList:r=>[r.operation.sqlType]},subgraph:{MatchFunction:ort,MatchList:r=>[r?.id?.toString(),r.name]},nodeID:{MatchFunction:ort,MatchList:r=>[r]}},ZAl=r=>{let t=[];return r.forEach((n,i)=>{if(n==="+{"||n==="{"||n==="}"||n==="}+")return;let o=n,s=n.split(""),a=s[s.length-1],u=s[0];a!=="}"&&a!=="+"&&(o=o+r[i+1]),u!=="{"&&u!=="+"&&(o=r[i-1]+o),t.push(o)}),t},eml=(r,t,n,i=!1)=>{let{steps:o,graphInformation:s,allSubgraphs:a,allStepTypesYAML:u}=n,p={},c=KI()?Date.now():performance.now(),l=r;l||(l=t);let d=l.split(/(\}\+?)\s*(or|OR|\|\|)\s*(\+?\{)/).filter(A=>!(A==="OR"||A==="or"||A==="||")),f=ZAl(d);f.length||(f=[t]),srt.debug("got unions",f,"searchStringTouse",l,"defaultSearchString",t,"steps",o),f.forEach(A=>{let E=A.split(/(\}\+?)\s*(and|AND|\,)\s*(\+?\{)/).filter(L=>!(L==="AND"||L==="and"||L===",")),v=ZAl(E),T=[];v.forEach(L=>{let k={};srt.debug("Got intersection:",L);let q=[...L.matchAll(WAl)];if(srt.debug("Got matches:",L,q),!q[0])return;let G=q[0][UAl],H={prefix:q[0][zAl]||"",postfix:q[0][QAl]||""};if(G.indexOf(":")>-1){let F=i?YAl:KAl,J=[...G.trim().matchAll(F)],Y=i?VAl:HAl;J.forEach(z=>{let Z=z[jAl],ee=z[GAl]||z[Y];H[Z]=ee})}else{let J=[...G.trim().matchAll(JAl)][0];J&&(H.name=J[0])}BO(H);let W=H;srt.debug("Got groups ",L,W);let K=new Set;if(W.subgraph?Object.values(a).forEach(F=>{let J=XAl.subgraph,Y=J.MatchList(F);if(J.MatchFunction(Y,W.subgraph)){let{steps:Z}=F;Z.forEach(ee=>{K.add(ee.toString())})}else return}):K=new Set(Object.keys(o)),W.nodeType){let{nodeType:F}=W;if(!u[F]){let J=F;Object.entries(u).forEach(([Y,z])=>{z.name===F&&(J=Y)}),W.nodeType=J}}Object.keys(o).forEach(F=>{if(!W){srt.emerg("got an unexpected undefined value for match",l,W,L);return}let J=K.has(F);if(Object.entries(W).forEach(([Y,z])=>{let Z=o[F];if(Y==="nodeID"&&(Z=F),Y==="subgraph"){J=K.has(F);return}let ee=XAl[Y];if(ee){let ne=ee.MatchList(Z).filter(se=>se!=null);J=J&&ee.MatchFunction(ne,z)}}),J){if(k[F]=!0,W.prefix&&s){let Y=rJo(s,F,"predecessors");Object.values(Y).forEach(z=>[...z.keys()].forEach(Z=>k[Z]=!0))}if(W.postfix&&s){let Y=rJo(s,F,"successors");Object.values(Y).forEach(z=>[...z.keys()].forEach(Z=>k[Z]=!0))}}}),T.push(k)}),T.length||T.push({});let O={};Object.keys(o).forEach(L=>{O[L]=!0});let D=T.reduce((L,k)=>Object.fromEntries(JBc(L,k).map(q=>[q,!0])),O);p={...p,...D}});let h=KI()?Date.now():performance.now();return srt.debug("Time that search took: ",h-c),p},JRr=(r,t,n,i=!1)=>{let o=eml(`${r}`,"{ * }",n,i),s=eml(`${t}`,"!*",n,i),a=o;return Object.keys(s).forEach(u=>{delete a[u]}),{stepsResult:a}},tml=(r,t,n,i)=>{let o=[];return t.forEach(s=>{let a=i[s];if(a){let{name:u}=a,p=`{ subgraph: "${u}" }`;o.push(p)}}),r.forEach(s=>{let a=n[s];if(a){let{locationName:u,name:p}=a.operation,c=`{ location: "${u}" name: "${p}" }`;o.push(c)}}),o}});var nG1,rml,pJo,nml,XRr=V(()=>{"use strict";fo();ar();$Rr();nG1=We("JOBS"),rml=r=>!r?.hasOwnProperty("includeSelector")||!r?.hasOwnProperty("version"),pJo=(r,t,n)=>{let{steps:i,subgraphs:o,...s}=r,a={...s};if(a.hasOwnProperty("version")||(a.version=OZ),a.hasOwnProperty("includeSelector"))return a;a.includeSelector="",a.excludeSelector="";let u=new Set(i),p=new Set(o),d=tml([...u],[...p].map(f=>`${f}`),n,t).map(f=>`+${f}`).join(" OR ");return a.includeSelector=d,nG1.info("Upgrading job v1 to v2",r,a),a},nml=(r,t)=>{let{jobs:n,folders:i,steps:o}=r,s=n[t];return pJo(s,i,o)}});var PTC,iml,oml=V(()=>{"use strict";fr();gc();ar();Bde();PTC=We("PACKAGES_BACKEND"),iml=(r,t,n)=>{let i=yHo(t)??"",o=r?.config?.entities?.nodeTypes[i];return o||(n.error(`No config found for node type ${t}`),{isDisabled:!1,defaultStorageLocation:null})}});var art,iG1,oG1,ZRr=V(()=>{"use strict";qa();ar();b_r();oml();art=(r,t={})=>Object.values(r).map(n=>iG1(n)).reduce((n,i)=>{for(let[o,s]of Object.entries(i))n[o]=s;return n},t),iG1=r=>Object.fromEntries(Object.entries(r?.contents?.nodeTypes??{}).map(([t,n])=>{let{id:i,nodeType:o}=oG1(r.alias,t,r,n);return[i,o]})),oG1=(r,t,n,i)=>{let o=ful(r,t),{isDisabled:s,defaultStorageLocation:a}=iml(n,o,We("PACKAGES")),u={...ul(i),id:o,isDisabled:s};return u.metadata.defaultStorageLocation=a,{id:o,nodeType:u}}});var Jo,sG1,sml,aml,dJo,jTC,aG1,uml,uG1,cG1,eOr,fJo=V(()=>{"use strict";Jo=gt(CU());fo();kV();qbr();Ha();sG1=Jo.Record({type:Jo.Unknown,name:Jo.String}),sml=Jo.Record({locationName:Jo.String,nodeName:Jo.String}),aml=Jo.Record({sql:Jo.String,success:Jo.Boolean,rows:Jo.Array(Jo.Unknown),fields:Jo.Array(sG1),error:Jo.Union(Jo.Null,xbr).optional(),startTime:Jo.Unknown,endTime:Jo.Unknown,status:Jo.String,name:Jo.String,isRunning:Jo.Boolean,exportedRefs:Jo.Array(sml),invalidExportedRefs:Jo.Array(sml),queryResultSequence:Jo.Optional(Jo.Unknown),type:Jo.Union(Jo.Literal("sql"),Jo.Literal("sqlTest")).optional(),warehouse:Jo.String.nullable().optional(),queryID:Jo.String.nullable().optional()}),dJo=Jo.Record({name:Jo.String,queryResults:Jo.Array(aml),isRunning:Jo.Boolean,renderQueryResults:Jo.Optional(aml)}),jTC=Jo.Record({runExecutionSequenceID:Jo.Number,runResultVersion:Jo.Number,name:Jo.String,queryResultSequence:dJo,runState:Jo.String}),aG1=Jo.Record({dataResult:Jo.Unknown,name:Jo.String,queryResultSequence:dJo,runExecutionSequenceID:Jo.Number,runResultVersion:Jo.Number,runState:Jo.String,stepRunState:G$e(m8o)}),uml=wx("RunResultFirestoreValidator",aG1),uG1=Jo.Record({nodeID:Jo.String,queryResultSequence:dJo,runState:Jo.String,hasTestFailures:Jo.Boolean.optional()}),cG1=Jo.Record({runResults:Jo.Record({runStartTime:Jo.Unknown,runEndTime:Jo.Unknown,runFailureReason:Jo.Optional(Jo.String),runType:Jo.String,runStatus:Jo.String,runResults:Jo.Array(uG1),runID:Jo.Number,environmentID:Jo.String,snowflakeAccount:Jo.String.optional(),snowflakeWarehouse:Jo.String.optional(),jobID:Jo.Number.optional(),hasFailedTest:Jo.Boolean.optional(),runTimeParameters:Jo.Unknown.nullable(),includeNodesSelector:Jo.String.optional(),excludeNodesSelector:Jo.String.optional()})}),eOr=wx("TRunOutput",cG1)});var VTC,pG1,WTC,cml=V(()=>{"use strict";fo();qbr();VTC=G$e(A8o),pG1=["deploy","refresh","rerun","plan"],WTC=[...pG1,"devRun"]});var zBe,tOr=V(()=>{"use strict";qa();k_();ar();zBe=class{constructor(t,n,i,o){this.allNodes=t;this.renderResults=n;this.extraRefs=i;this.logContext=o;this.phasedRefUsage=n.map("phased ref usage",s=>s.map(a=>a.runDetails.ref_usage))}allNodes;renderResults;extraRefs;logContext;phasedRefUsage;buildPhase(t,n){let i="[DependencyBuilder.buildPhase()]",o=n.keys(),s=Object.keys(this.extraRefs),a=[...new Set([...o,...s])];if(We("PIPELINE").appContext(this.logContext,i,"Nodes present in both current-phase data AND extra non-phased (views & advanced deploy) data:",SCo([...o],s)),this.noDependenciesPhases.includes(t))return Object.fromEntries(a.map(u=>[u,[]]));{let u=this.getNodeRefsInPhase(t,a),p=new sBe(uE(this.allNodes,a));return Zv(u,(c,l)=>{let{nodeIDsToAdd:d}=zet(c,p);return[...new Set(d)].filter(f=>f!==l)})}}build(){return Object.fromEntries([...this.phasedRefUsage.entries()].map(([t,n])=>[t,this.buildPhase(t,n)]))}}});var r_C,hJo=V(()=>{"use strict";fr();ar();gc();r_C=We("DEBUG")});var lml=V(()=>{"use strict"});var rOr,gJo=V(()=>{"use strict";rOr=r=>{typeof r.stepCounter=="number"&&(r.stepCounter=`${r.stepCounter}`),typeof r.columnCounter=="number"&&(r.columnCounter=`${r.columnCounter}`)}});var qCe,Zs,AJo=V(()=>{"use strict";Ns();vU();qCe=new Date("1980-01-01T00:00:00.000Z"),Zs=(r,t,n)=>{let i=`${r}Entity`;return n||(n=ia(t)),{standard:Pr(i,n),strict:Pr(`${i} (strict)`,t)}}});var pml,dG1,dml,QBe,P4t,mJo,yJo,Ju,bJo,N3,EJo=V(()=>{"use strict";$m();AJo();Rde();pml=r=>{if(Array.isArray(r))for(let t=r.length-1;t>=0;t--)r[t]===void 0&&r.splice(t,1);if(r&&typeof r=="object")for(let t in r)r.hasOwnProperty(t)&&r[t]===void 0&&delete r[t];return[r,!1]},dG1=(r,t)=>{if(r&&typeof r=="object"){let n=r;if(n.toDate&&(!isNaN(n.seconds)&&!isNaN(n.nanoseconds)||!isNaN(n._seconds)&&!isNaN(n._nanoseconds))){let i=n.toDate();return i.getTime()===Tde.SENTINEL_DATE&&Ql().emerg(`Repository server timestamp sentinel value found in stored data at path ${t}`),[i,!0]}}return[r,!1]},dml=(r,t)=>r instanceof q6e?[t.getDeleteSentinel(),!0]:r instanceof Date&&r.getTime()===Tde.SENTINEL_DATE?[t.getServerTimestampSentinel(),!0]:[r,!1],QBe=(r,t,n)=>{let[i,o]=t(n,r);if(!o&&typeof i=="object"){if(Array.isArray(i))return i.map(s=>QBe(r,t,s));for(let s in i)i.hasOwnProperty(s)&&(i[s]=QBe(r,t,i[s]))}return i},P4t=class{fromStorage(t,n,i,o,s){try{return this.transformFromStorage(t,n,i,o,s)}catch(a){if(s?.onDataTransformError&&s.onDataTransformError(n,a),!s?.ignoreDataTransformErrors)throw Ql().debug(`Error transforming repository entity ${n} from storage: ${a}`),a}return i}toStorage(t,n,i,o,s){try{return this.transformToStorage(t,n,i,o,s)}catch(a){if(s?.onDataTransformError&&s.onDataTransformError(n,a),!s?.ignoreDataTransformErrors)throw Ql().debug(`Error transforming repository entity ${n} to storage ${a}`),a}return i}mergeToStorage(t,n,i,o,s){try{return this.mergeTransformToStorage(t,n,i,o,s)}catch(a){if(s?.onDataTransformError&&s.onDataTransformError(n,a),!s?.ignoreDataTransformErrors)throw Ql().debug(`Error merge transforming repository entity ${n} to storage ${a}`),a}return i}},mJo=class extends P4t{constructor(n=!1){super();this.preserveID=n}preserveID;transformFromStorage(n,i,o){return"id"in o?o.id!=n&&(Ql().error(`'id' property does not match doc id on doc at path ${i}; doc id: ${n}, value.id: ${o.id}`),o.id=n):o.id=n,"createdAt"in o||(o.createdAt=qCe),"updatedAt"in o||(o.updatedAt=qCe),QBe(i,dG1,o)}transformToStorage(n,i,o,s){return this.preserveID||delete o.id,QBe(i,a=>{let[u,p]=dml(a,s);return p?[u,!0]:pml(u)},o)}mergeTransformToStorage(n,i,o,s){return this.preserveID||delete o.id,QBe(i,a=>{let[u,p]=dml(a,s);return p?[u,!0]:pml(u)},o)}},yJo=class extends P4t{constructor(n){super();this.validators=n}validators;transformFromStorage(n,i,o,s,a){let u=this.getValidatorOptions(n,a?.validatorOptions);return a?.enableStrictValidation?this.validators.strict.assert(o,u):this.validators.standard.assert(o,u)}transformToStorage(n,i,o,s,a){let u=this.getValidatorOptions(n,a?.validatorOptions);return a?.enableStrictValidation?this.validators.strict.assert(o,u):this.validators.standard.assert(o,u)}mergeTransformToStorage(n,i,o,s,a){return o}getValidatorOptions(n,i,o=500){let s={...i,statusCode:o};return s.errorMessage||(s.errorMessage=a=>`Found ${a.failures.length} validation failure(s) for ${this.validators.standard.name} ${n}`),s}},Ju=(r,t,n)=>{let i=[new mJo(n),new yJo(r)];return t&&i.unshift(t),new bJo(...i)},bJo=class{transforms;constructor(...t){this.transforms=t}fromStorage(t,n,i,o,s){return this.transforms.reduce((a,u)=>u.fromStorage(t,n,a,o,s),i)}toStorage(t,n,i,o,s){return this.transforms.reduceRight((a,u)=>u.toStorage(t,n,a,o,s),i)}mergeToStorage(t,n,i,o,s){return this.transforms.reduceRight((a,u)=>u.mergeToStorage(t,n,a,o,s),i)}},N3=class extends P4t{transformToStorage(t,n,i){return i}mergeTransformToStorage(t,n,i){return i}}});var Rf=V(()=>{"use strict";EJo()});var fml,urt,mW,CJo,N4t,cz,FCe,vJo,fG1,hG1,hml,SJo,nOr,gml=V(()=>{"use strict";fo();ar();Rf();gJo();fml=r=>!!r&&typeof r=="object"&&!Array.isArray(r),urt=r=>fml(r)&&!(r instanceof Date)&&!(r instanceof RegExp),mW=r=>{if(typeof r=="string")return r;if(fml(r)&&r.constructor&&typeof r.constructor.name=="string")return`[class ${r.constructor.name}]`;if(r instanceof Date)return`[date ${r.toISOString()}]`;if(r instanceof RegExp)return`[regexp ${r.toString()}]`;if(typeof r=="function")return`[function ${r.name}]`;try{return JSON.stringify(r)}catch{return"Error: could not stringify unknown value"}},CJo=r=>r==null,N4t=(r,t,n,i)=>{t.filter((o,s)=>urt(o)?!0:(n.logError(`Invalid ${r} item detected at index ${s}: ${mW(o)}`),n.logPatch(`Removed invalid ${r} item at index ${s}`),!1)).forEach(i)},cz=(r,t,n)=>{r[t]=n},FCe=(r,t)=>{delete r[t]},vJo=(r,t,n)=>{let i=new SJo(r,We("FIREBASE"),t),{logError:o,logPatch:s,report:a}=i,u=()=>(a(),n);if(!urt(n))return u();let p=n;if([["locationName",!p.locationName&&typeof p.locationName!="string"||typeof p.locationName!="string"],["description",typeof p.description!="string"]].forEach(([c,l])=>{l&&(s(`Set non-string property ${c} from ${mW(p[c])} to ""`),cz(p,c,""))}),["dependencies","isDataVault","locationID"].forEach(c=>{c in p&&(s(`Removed deprecated field ${c}`),FCe(p,c))}),p.type==="sql")s("-- data.type is sql --"),fG1(r,p,i);else if(p.type==="sourceInput")s("-- data.type is sourceInput --"),hG1(r,p,i);else return o(`Data type is of invalid type ${mW(p.type)}`),u();return p.version!==IZ&&(s(`Set version ${mW(p.version)} to ${IZ}`),cz(p,"version",IZ)),u()},fG1=(r,t,n)=>{let{logError:i,logPatch:o}=n;if(t.isMultisource===void 0&&(o("Set missing isMultisource to false"),cz(t,"isMultisource",!1)),urt(t.metadata)){let s=t.metadata;if(s.appliedNodeTests===null&&(o("Set metadata.appliedNodeTests from null to []"),cz(s,"appliedNodeTests",[])),!Array.isArray(s.sourceMapping)||!s.sourceMapping.length){o("Set non-array or empty metadata.sourceMapping to [ basicMapping ]");let a;typeof t.name=="string"?a=t.name:(o("Data has no name value, setting sourceMapping.name to empty string"),a=""),cz(s,"sourceMapping",[{name:a,join:{joinCondition:""},dependencies:[],noLinkRefs:[],aliases:{}}])}else N4t("sourceMapping",s.sourceMapping,n,(a,u)=>{let p=a;if(typeof p.join=="string"){let c={joinCondition:""};o(`Setting invalid string value metadata.sourceMapping[${u}].join to object: ${mW(c)}`),cz(p,"join",c)}if(p.name===void 0){let c=p.join?.name??"";o(`Set missing metadata.sourceMapping[${u}].name to "${c}"`),cz(p,"name",c),c||i(`metadata.sourceMapping[${u}].name is an empty string`)}Array.isArray(p.dependencies)&&N4t("sourceMapping dependency",p.dependencies,n,(c,l)=>{let d=c;for(let f of["locationName","nodeName"])CJo(d[f])&&(o(`Set metadata.sourceMapping[${u}].dependencies[${l}].${f} from ${mW(d[f])} to ""`),cz(d,f,""))})});hml(r,s.columns,n)}if(t.config&&typeof t.config=="object")for(let[s,a]of Object.entries(t.config))a===null&&(o(`Removing null config property "${s}"`),FCe(t.config,s))},hG1=(r,t,n)=>{let{logPatch:i,logError:o}=n;if(t.dataset!==void 0&&(i("Removed deprecated v0 property dataset"),FCe(t,"dataset")),t.table!==void 0&&(t.table!==t.name&&o(`source data properties 'table' and 'name' are different for source node ${r}, table: ${t.table}, name: ${t.name}`),i("Removed deprecated v0 property table"),FCe(t,"table")),urt(t.metadata)){let s=t.metadata;Array.isArray(s.columns)&&(s.columns.length&&hml(r,s.columns,n),Object.keys(s).length>1&&(i(`Removed deprecated metadata properties, keeping only columns. Was: ${mW(s)}`),cz(t,"metadata",{columns:s.columns})))}},hml=(r,t,n)=>{let{logPatch:i}=n;Array.isArray(t)&&N4t("column",t,n,(o,s)=>{let a=o;if(["ghostRecordValue","descendedFrom","hashColumns","columnsForHash"].forEach(c=>{a.hasOwnProperty(c)&&(i(`Removed deprecated property '${c}' from metadata.columns[${s}]`),FCe(a,c))}),urt(a.hashDetails)){let c=a.hashDetails;c.hashType&&(i(`Removed deprecated property 'hashType' from metadata.columns[${s}].hashDetails`),FCe(c,"hashType")),c.hubHashes&&(i(`Removed deprecated property 'hubHashes' from metadata.columns[${s}].hashDetails`),FCe(c,"hubHashes"))}[["appliedColumnTests",a.appliedColumnTests===null],["config",a.config===null],["hashDetails",typeof a.hashDetails=="string"]].forEach(([c,l])=>{l&&(i(`Deleted metadata.columns[${s}].${c} with invalid value ${mW(a[c])}`),FCe(a,c))}),[["dataType",typeof a.dataType!="string"],["transform",a.transform===null]].forEach(([c,l])=>{l&&(i(`Set ${c} from ${mW(a[c])} to "" in metadata.columns[${s}]`),cz(a,c,""))});let u=a.hashedColumns;if(Array.isArray(u))for(let c of u)rOr(c);let p=a.columnReference;if(urt(p)){rOr(p);let c=p;CJo(c.stepCounter)&&(i(`Set metadata.columns[${s}].columnReference.stepCounter from ${mW(c.stepCounter)} to ${r}`),cz(c,"stepCounter",r))}Array.isArray(a.sourceColumnReferences)&&N4t("sourceColumnReference",a.sourceColumnReferences,n,(c,l)=>{let d=c;Array.isArray(d.columnReferences)&&N4t("columnReference",d.columnReferences,n,(f,h)=>{rOr(f);let A=f;CJo(A.stepCounter)&&(i(`Set invalid metadata.columns[${s}].sourceColumnReferences[${l}].columnReferences[${h}].stepCounter to "" from ${mW(r)}`),cz(A,"stepCounter",""))})})})},SJo=class{constructor(t,n,i){this.id=t;this.logger=n;this.path=i}id;logger;path;patchMessages=[];errorMessages=[];logPatch=t=>{this.patchMessages.push(t)};logError=t=>{this.errorMessages.push(t)};reportErrors=()=>{this.errorMessages.length&&this.logger.error(`Error patching node data with id ${this.id} at path ${this.path}`,this.errorMessages)};reportPatches=()=>{this.patchMessages.length&&this.logger.debug(`Patched node data with id ${this.id} at path ${this.path}`,this.patchMessages)};report=()=>{this.reportErrors(),this.reportPatches()}},nOr=class extends N3{transformFromStorage(t,n,i){return vJo(t,n,i)}}});var D4t=V(()=>{"use strict";lml();gJo();gml()});var Aml=V(()=>{"use strict"});var G_C,H_C,V_C,mml,yml,bml,UCe=V(()=>{"use strict";fr();cb();ar();hJo();Fet();Bo();ar();I2();lee();D4t();sCe();$Go();Aml();v6();C6();s9();gee();G_C=We("FIREBASE"),H_C=We("STEPS"),V_C=We("METADATA_OPERATIONS"),mml=(r,t)=>t[r].runState==="running",yml=r=>(ny("STEPS",!!r,`Error converting API refs: argument apiRefLinks is ${r}.`),r.map(t=>({locationName:t.location_name,nodeName:t.node_name}))),bml=r=>r?.deployEnabled??!0});var zCe,Eml=V(()=>{"use strict";UCe();tOr();zCe=class extends zBe{noDependenciesPhases=["deletedTable"];getNodeRefsInPhase(t,n){return Object.fromEntries(n.map(i=>{let o,s=this.extraRefs[i];s?o=[s]:o=this.phasedRefUsage.get(t,i);let a=o.map(({ref:u,ref_no_link:p})=>yml([...u,...p]));return[i,[].concat(...a)]}))}}});var crt,Cml=V(()=>{"use strict";qa();a9();tOr();crt=class extends zBe{noDependenciesPhases=[];getNodeRefsInPhase(t,n){let i=uE(this.allNodes,...n);return Zv(i,o=>{if(uCe(o.operation))return[];let{sourceMapping:s}=o.operation.metadata;if(!s?.length)return[];let a=s.map(({dependencies:u})=>u);return[].concat(...a)})}}});var TJo=V(()=>{"use strict";tOr();Eml();Cml()});var Sml=V(()=>{"use strict"});var B4t,vml=V(()=>{"use strict";AX();$m();B4t=async(r,t)=>{let{attempts:n,tags:i,waitSeconds:o}=t,s=Ql().child({retryOptions:{maxAttempts:n,waitSeconds:o},tags:["[withRetries]",...i]});g2(n>=2,`Retry attempts value must be at least '2', but was '${n}'`,s);try{let a=await r();return s.debug("Operation succeeded without retrying"),a}catch(a){s.error(`Operation initial attempt failed; retrying. Error: ${a}`);let u,p=n-1;do{p--,await new Promise(c=>setTimeout(c,o*(n-p)*1e3));try{let c=await r();return s.info(`Operation succeeded on retry (attempt ${n-p})`),c}catch(c){s.error(`Operation failed on retry (attempt ${n-p}). Error: ${c}`),u=c}}while(p);throw s.error("Exhausted all retry attempts; exiting"),u}}});var _Jo=V(()=>{"use strict";Sml();vml()});var E9,yG1,bG1,pIC,dIC,IJo=V(()=>{"use strict";E9=gt(CU()),yG1=E9.String,bG1=E9.Record({locationName:E9.String,database:E9.String,schema:E9.String}),pIC=E9.Dictionary(bG1,yG1),dIC=E9.Record({seconds:E9.Number,nanoseconds:E9.Number})});function lrt(r,t){let n=[];for(let i of r){let o=i.compiledSQL?Wet(i.compiledSQL):[];if(o.length===0)t&&n.push({name:t,sql:"",type:"sql",continueOnFailure:!1,parsedStage:null});else for(let s of o)n.push({name:s.name,sql:s.code,type:s.type,continueOnFailure:s.continueOnFailure,parsedStage:s})}return n}function iOr(r,t){return r==="deletedTable"&&t?Tml:EG1}var EG1,Tml,L4t=V(()=>{"use strict";I2();EG1="Making metadata updates",Tml="Deleting metadata for source input"});var yW,k4t=V(()=>{"use strict";fr();yW=class extends nt{constructor(n,i,o="system"){super(i,`Failed node ${n}: ${i}`);this.nodeID=n;this.fault=o}nodeID;fault}});var q4t=m((yIC,_ml)=>{var CG1="2.0.0",SG1=Number.MAX_SAFE_INTEGER||9007199254740991,vG1=16,TG1=250,_G1=["major","premajor","minor","preminor","patch","prepatch","prerelease"];_ml.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:vG1,MAX_SAFE_BUILD_LENGTH:TG1,MAX_SAFE_INTEGER:SG1,RELEASE_TYPES:_G1,SEMVER_SPEC_VERSION:CG1,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var F4t=m((bIC,Iml)=>{var IG1=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{};Iml.exports=IG1});var prt=m((c0e,Rml)=>{var{MAX_SAFE_COMPONENT_LENGTH:RJo,MAX_SAFE_BUILD_LENGTH:RG1,MAX_LENGTH:OG1}=q4t(),wG1=F4t();c0e=Rml.exports={};var MG1=c0e.re=[],xG1=c0e.safeRe=[],_a=c0e.src=[],Ia=c0e.t={},PG1=0,OJo="[a-zA-Z0-9-]",NG1=[["\\s",1],["\\d",OG1],[OJo,RG1]],DG1=r=>{for(let[t,n]of NG1)r=r.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return r},id=(r,t,n)=>{let i=DG1(t),o=PG1++;wG1(r,o,t),Ia[r]=o,_a[o]=t,MG1[o]=new RegExp(t,n?"g":void 0),xG1[o]=new RegExp(i,n?"g":void 0)};id("NUMERICIDENTIFIER","0|[1-9]\\d*");id("NUMERICIDENTIFIERLOOSE","\\d+");id("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${OJo}*`);id("MAINVERSION",`(${_a[Ia.NUMERICIDENTIFIER]})\\.(${_a[Ia.NUMERICIDENTIFIER]})\\.(${_a[Ia.NUMERICIDENTIFIER]})`);id("MAINVERSIONLOOSE",`(${_a[Ia.NUMERICIDENTIFIERLOOSE]})\\.(${_a[Ia.NUMERICIDENTIFIERLOOSE]})\\.(${_a[Ia.NUMERICIDENTIFIERLOOSE]})`);id("PRERELEASEIDENTIFIER",`(?:${_a[Ia.NUMERICIDENTIFIER]}|${_a[Ia.NONNUMERICIDENTIFIER]})`);id("PRERELEASEIDENTIFIERLOOSE",`(?:${_a[Ia.NUMERICIDENTIFIERLOOSE]}|${_a[Ia.NONNUMERICIDENTIFIER]})`);id("PRERELEASE",`(?:-(${_a[Ia.PRERELEASEIDENTIFIER]}(?:\\.${_a[Ia.PRERELEASEIDENTIFIER]})*))`);id("PRERELEASELOOSE",`(?:-?(${_a[Ia.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${_a[Ia.PRERELEASEIDENTIFIERLOOSE]})*))`);id("BUILDIDENTIFIER",`${OJo}+`);id("BUILD",`(?:\\+(${_a[Ia.BUILDIDENTIFIER]}(?:\\.${_a[Ia.BUILDIDENTIFIER]})*))`);id("FULLPLAIN",`v?${_a[Ia.MAINVERSION]}${_a[Ia.PRERELEASE]}?${_a[Ia.BUILD]}?`);id("FULL",`^${_a[Ia.FULLPLAIN]}$`);id("LOOSEPLAIN",`[v=\\s]*${_a[Ia.MAINVERSIONLOOSE]}${_a[Ia.PRERELEASELOOSE]}?${_a[Ia.BUILD]}?`);id("LOOSE",`^${_a[Ia.LOOSEPLAIN]}$`);id("GTLT","((?:<|>)?=?)");id("XRANGEIDENTIFIERLOOSE",`${_a[Ia.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);id("XRANGEIDENTIFIER",`${_a[Ia.NUMERICIDENTIFIER]}|x|X|\\*`);id("XRANGEPLAIN",`[v=\\s]*(${_a[Ia.XRANGEIDENTIFIER]})(?:\\.(${_a[Ia.XRANGEIDENTIFIER]})(?:\\.(${_a[Ia.XRANGEIDENTIFIER]})(?:${_a[Ia.PRERELEASE]})?${_a[Ia.BUILD]}?)?)?`);id("XRANGEPLAINLOOSE",`[v=\\s]*(${_a[Ia.XRANGEIDENTIFIERLOOSE]})(?:\\.(${_a[Ia.XRANGEIDENTIFIERLOOSE]})(?:\\.(${_a[Ia.XRANGEIDENTIFIERLOOSE]})(?:${_a[Ia.PRERELEASELOOSE]})?${_a[Ia.BUILD]}?)?)?`);id("XRANGE",`^${_a[Ia.GTLT]}\\s*${_a[Ia.XRANGEPLAIN]}$`);id("XRANGELOOSE",`^${_a[Ia.GTLT]}\\s*${_a[Ia.XRANGEPLAINLOOSE]}$`);id("COERCE",`(^|[^\\d])(\\d{1,${RJo}})(?:\\.(\\d{1,${RJo}}))?(?:\\.(\\d{1,${RJo}}))?(?:$|[^\\d])`);id("COERCERTL",_a[Ia.COERCE],!0);id("LONETILDE","(?:~>?)");id("TILDETRIM",`(\\s*)${_a[Ia.LONETILDE]}\\s+`,!0);c0e.tildeTrimReplace="$1~";id("TILDE",`^${_a[Ia.LONETILDE]}${_a[Ia.XRANGEPLAIN]}$`);id("TILDELOOSE",`^${_a[Ia.LONETILDE]}${_a[Ia.XRANGEPLAINLOOSE]}$`);id("LONECARET","(?:\\^)");id("CARETTRIM",`(\\s*)${_a[Ia.LONECARET]}\\s+`,!0);c0e.caretTrimReplace="$1^";id("CARET",`^${_a[Ia.LONECARET]}${_a[Ia.XRANGEPLAIN]}$`);id("CARETLOOSE",`^${_a[Ia.LONECARET]}${_a[Ia.XRANGEPLAINLOOSE]}$`);id("COMPARATORLOOSE",`^${_a[Ia.GTLT]}\\s*(${_a[Ia.LOOSEPLAIN]})$|^$`);id("COMPARATOR",`^${_a[Ia.GTLT]}\\s*(${_a[Ia.FULLPLAIN]})$|^$`);id("COMPARATORTRIM",`(\\s*)${_a[Ia.GTLT]}\\s*(${_a[Ia.LOOSEPLAIN]}|${_a[Ia.XRANGEPLAIN]})`,!0);c0e.comparatorTrimReplace="$1$2$3";id("HYPHENRANGE",`^\\s*(${_a[Ia.XRANGEPLAIN]})\\s+-\\s+(${_a[Ia.XRANGEPLAIN]})\\s*$`);id("HYPHENRANGELOOSE",`^\\s*(${_a[Ia.XRANGEPLAINLOOSE]})\\s+-\\s+(${_a[Ia.XRANGEPLAINLOOSE]})\\s*$`);id("STAR","(<|>)?=?\\s*\\*");id("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");id("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var oOr=m((EIC,Oml)=>{var BG1=Object.freeze({loose:!0}),LG1=Object.freeze({}),kG1=r=>r?typeof r!="object"?BG1:r:LG1;Oml.exports=kG1});var wJo=m((CIC,xml)=>{var wml=/^[0-9]+$/,Mml=(r,t)=>{let n=wml.test(r),i=wml.test(t);return n&&i&&(r=+r,t=+t),r===t?0:n&&!i?-1:i&&!n?1:r<t?-1:1},qG1=(r,t)=>Mml(t,r);xml.exports={compareIdentifiers:Mml,rcompareIdentifiers:qG1}});var Vx=m((SIC,Bml)=>{var sOr=F4t(),{MAX_LENGTH:Pml,MAX_SAFE_INTEGER:aOr}=q4t(),{safeRe:Nml,t:Dml}=prt(),FG1=oOr(),{compareIdentifiers:drt}=wJo(),MJo=class r{constructor(t,n){if(n=FG1(n),t instanceof r){if(t.loose===!!n.loose&&t.includePrerelease===!!n.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>Pml)throw new TypeError(`version is longer than ${Pml} characters`);sOr("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;let i=t.trim().match(n.loose?Nml[Dml.LOOSE]:Nml[Dml.FULL]);if(!i)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+i[1],this.minor=+i[2],this.patch=+i[3],this.major>aOr||this.major<0)throw new TypeError("Invalid major version");if(this.minor>aOr||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>aOr||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){let s=+o;if(s>=0&&s<aOr)return s}return o}):this.prerelease=[],this.build=i[5]?i[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(sOr("SemVer.compare",this.version,this.options,t),!(t instanceof r)){if(typeof t=="string"&&t===this.version)return 0;t=new r(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof r||(t=new r(t,this.options)),drt(this.major,t.major)||drt(this.minor,t.minor)||drt(this.patch,t.patch)}comparePre(t){if(t instanceof r||(t=new r(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let n=0;do{let i=this.prerelease[n],o=t.prerelease[n];if(sOr("prerelease compare",n,i,o),i===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(i===void 0)return-1;if(i===o)continue;return drt(i,o)}while(++n)}compareBuild(t){t instanceof r||(t=new r(t,this.options));let n=0;do{let i=this.build[n],o=t.build[n];if(sOr("prerelease compare",n,i,o),i===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(i===void 0)return-1;if(i===o)continue;return drt(i,o)}while(++n)}inc(t,n,i){switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",n,i);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",n,i);break;case"prepatch":this.prerelease.length=0,this.inc("patch",n,i),this.inc("pre",n,i);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",n,i),this.inc("pre",n,i);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let o=Number(i)?1:0;if(!n&&i===!1)throw new Error("invalid increment argument: identifier is empty");if(this.prerelease.length===0)this.prerelease=[o];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(n===this.prerelease.join(".")&&i===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(n){let s=[n,o];i===!1&&(s=[n]),drt(this.prerelease[0],n)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};Bml.exports=MJo});var jBe=m((vIC,kml)=>{var Lml=Vx(),UG1=(r,t,n=!1)=>{if(r instanceof Lml)return r;try{return new Lml(r,t)}catch(i){if(!n)return null;throw i}};kml.exports=UG1});var Fml=m((TIC,qml)=>{var zG1=jBe(),QG1=(r,t)=>{let n=zG1(r,t);return n?n.version:null};qml.exports=QG1});var zml=m((_IC,Uml)=>{var jG1=jBe(),GG1=(r,t)=>{let n=jG1(r.trim().replace(/^[=v]+/,""),t);return n?n.version:null};Uml.exports=GG1});var Gml=m((IIC,jml)=>{var Qml=Vx(),HG1=(r,t,n,i,o)=>{typeof n=="string"&&(o=i,i=n,n=void 0);try{return new Qml(r instanceof Qml?r.version:r,n).inc(t,i,o).version}catch{return null}};jml.exports=HG1});var Wml=m((RIC,Vml)=>{var Hml=jBe(),VG1=(r,t)=>{let n=Hml(r,null,!0),i=Hml(t,null,!0),o=n.compare(i);if(o===0)return null;let s=o>0,a=s?n:i,u=s?i:n,p=!!a.prerelease.length;if(!!u.prerelease.length&&!p)return!u.patch&&!u.minor?"major":a.patch?"patch":a.minor?"minor":"major";let l=p?"pre":"";return n.major!==i.major?l+"major":n.minor!==i.minor?l+"minor":n.patch!==i.patch?l+"patch":"prerelease"};Vml.exports=VG1});var Yml=m((OIC,Kml)=>{var WG1=Vx(),KG1=(r,t)=>new WG1(r,t).major;Kml.exports=KG1});var $ml=m((wIC,Jml)=>{var YG1=Vx(),JG1=(r,t)=>new YG1(r,t).minor;Jml.exports=JG1});var Zml=m((MIC,Xml)=>{var $G1=Vx(),XG1=(r,t)=>new $G1(r,t).patch;Xml.exports=XG1});var tyl=m((xIC,eyl)=>{var ZG1=jBe(),eH1=(r,t)=>{let n=ZG1(r,t);return n&&n.prerelease.length?n.prerelease:null};eyl.exports=eH1});var lz=m((PIC,nyl)=>{var ryl=Vx(),tH1=(r,t,n)=>new ryl(r,n).compare(new ryl(t,n));nyl.exports=tH1});var oyl=m((NIC,iyl)=>{var rH1=lz(),nH1=(r,t,n)=>rH1(t,r,n);iyl.exports=nH1});var ayl=m((DIC,syl)=>{var iH1=lz(),oH1=(r,t)=>iH1(r,t,!0);syl.exports=oH1});var uOr=m((BIC,cyl)=>{var uyl=Vx(),sH1=(r,t,n)=>{let i=new uyl(r,n),o=new uyl(t,n);return i.compare(o)||i.compareBuild(o)};cyl.exports=sH1});var pyl=m((LIC,lyl)=>{var aH1=uOr(),uH1=(r,t)=>r.sort((n,i)=>aH1(n,i,t));lyl.exports=uH1});var fyl=m((kIC,dyl)=>{var cH1=uOr(),lH1=(r,t)=>r.sort((n,i)=>cH1(i,n,t));dyl.exports=lH1});var U4t=m((qIC,hyl)=>{var pH1=lz(),dH1=(r,t,n)=>pH1(r,t,n)>0;hyl.exports=dH1});var cOr=m((FIC,gyl)=>{var fH1=lz(),hH1=(r,t,n)=>fH1(r,t,n)<0;gyl.exports=hH1});var xJo=m((UIC,Ayl)=>{var gH1=lz(),AH1=(r,t,n)=>gH1(r,t,n)===0;Ayl.exports=AH1});var PJo=m((zIC,myl)=>{var mH1=lz(),yH1=(r,t,n)=>mH1(r,t,n)!==0;myl.exports=yH1});var lOr=m((QIC,yyl)=>{var bH1=lz(),EH1=(r,t,n)=>bH1(r,t,n)>=0;yyl.exports=EH1});var pOr=m((jIC,byl)=>{var CH1=lz(),SH1=(r,t,n)=>CH1(r,t,n)<=0;byl.exports=SH1});var NJo=m((GIC,Eyl)=>{var vH1=xJo(),TH1=PJo(),_H1=U4t(),IH1=lOr(),RH1=cOr(),OH1=pOr(),wH1=(r,t,n,i)=>{switch(t){case"===":return typeof r=="object"&&(r=r.version),typeof n=="object"&&(n=n.version),r===n;case"!==":return typeof r=="object"&&(r=r.version),typeof n=="object"&&(n=n.version),r!==n;case"":case"=":case"==":return vH1(r,n,i);case"!=":return TH1(r,n,i);case">":return _H1(r,n,i);case">=":return IH1(r,n,i);case"<":return RH1(r,n,i);case"<=":return OH1(r,n,i);default:throw new TypeError(`Invalid operator: ${t}`)}};Eyl.exports=wH1});var Syl=m((HIC,Cyl)=>{var MH1=Vx(),xH1=jBe(),{safeRe:dOr,t:fOr}=prt(),PH1=(r,t)=>{if(r instanceof MH1)return r;if(typeof r=="number"&&(r=String(r)),typeof r!="string")return null;t=t||{};let n=null;if(!t.rtl)n=r.match(dOr[fOr.COERCE]);else{let i;for(;(i=dOr[fOr.COERCERTL].exec(r))&&(!n||n.index+n[0].length!==r.length);)(!n||i.index+i[0].length!==n.index+n[0].length)&&(n=i),dOr[fOr.COERCERTL].lastIndex=i.index+i[1].length+i[2].length;dOr[fOr.COERCERTL].lastIndex=-1}return n===null?null:xH1(`${n[2]}.${n[3]||"0"}.${n[4]||"0"}`,t)};Cyl.exports=PH1});var Tyl=m((VIC,vyl)=>{"use strict";vyl.exports=function(r){r.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}});var DJo=m((WIC,_yl)=>{"use strict";_yl.exports=f1;f1.Node=GBe;f1.create=f1;function f1(r){var t=this;if(t instanceof f1||(t=new f1),t.tail=null,t.head=null,t.length=0,r&&typeof r.forEach=="function")r.forEach(function(o){t.push(o)});else if(arguments.length>0)for(var n=0,i=arguments.length;n<i;n++)t.push(arguments[n]);return t}f1.prototype.removeNode=function(r){if(r.list!==this)throw new Error("removing node which does not belong to this list");var t=r.next,n=r.prev;return t&&(t.prev=n),n&&(n.next=t),r===this.head&&(this.head=t),r===this.tail&&(this.tail=n),r.list.length--,r.next=null,r.prev=null,r.list=null,t};f1.prototype.unshiftNode=function(r){if(r!==this.head){r.list&&r.list.removeNode(r);var t=this.head;r.list=this,r.next=t,t&&(t.prev=r),this.head=r,this.tail||(this.tail=r),this.length++}};f1.prototype.pushNode=function(r){if(r!==this.tail){r.list&&r.list.removeNode(r);var t=this.tail;r.list=this,r.prev=t,t&&(t.next=r),this.tail=r,this.head||(this.head=r),this.length++}};f1.prototype.push=function(){for(var r=0,t=arguments.length;r<t;r++)DH1(this,arguments[r]);return this.length};f1.prototype.unshift=function(){for(var r=0,t=arguments.length;r<t;r++)BH1(this,arguments[r]);return this.length};f1.prototype.pop=function(){if(this.tail){var r=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,r}};f1.prototype.shift=function(){if(this.head){var r=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,r}};f1.prototype.forEach=function(r,t){t=t||this;for(var n=this.head,i=0;n!==null;i++)r.call(t,n.value,i,this),n=n.next};f1.prototype.forEachReverse=function(r,t){t=t||this;for(var n=this.tail,i=this.length-1;n!==null;i--)r.call(t,n.value,i,this),n=n.prev};f1.prototype.get=function(r){for(var t=0,n=this.head;n!==null&&t<r;t++)n=n.next;if(t===r&&n!==null)return n.value};f1.prototype.getReverse=function(r){for(var t=0,n=this.tail;n!==null&&t<r;t++)n=n.prev;if(t===r&&n!==null)return n.value};f1.prototype.map=function(r,t){t=t||this;for(var n=new f1,i=this.head;i!==null;)n.push(r.call(t,i.value,this)),i=i.next;return n};f1.prototype.mapReverse=function(r,t){t=t||this;for(var n=new f1,i=this.tail;i!==null;)n.push(r.call(t,i.value,this)),i=i.prev;return n};f1.prototype.reduce=function(r,t){var n,i=this.head;if(arguments.length>1)n=t;else if(this.head)i=this.head.next,n=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var o=0;i!==null;o++)n=r(n,i.value,o),i=i.next;return n};f1.prototype.reduceReverse=function(r,t){var n,i=this.tail;if(arguments.length>1)n=t;else if(this.tail)i=this.tail.prev,n=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var o=this.length-1;i!==null;o--)n=r(n,i.value,o),i=i.prev;return n};f1.prototype.toArray=function(){for(var r=new Array(this.length),t=0,n=this.head;n!==null;t++)r[t]=n.value,n=n.next;return r};f1.prototype.toArrayReverse=function(){for(var r=new Array(this.length),t=0,n=this.tail;n!==null;t++)r[t]=n.value,n=n.prev;return r};f1.prototype.slice=function(r,t){t=t||this.length,t<0&&(t+=this.length),r=r||0,r<0&&(r+=this.length);var n=new f1;if(t<r||t<0)return n;r<0&&(r=0),t>this.length&&(t=this.length);for(var i=0,o=this.head;o!==null&&i<r;i++)o=o.next;for(;o!==null&&i<t;i++,o=o.next)n.push(o.value);return n};f1.prototype.sliceReverse=function(r,t){t=t||this.length,t<0&&(t+=this.length),r=r||0,r<0&&(r+=this.length);var n=new f1;if(t<r||t<0)return n;r<0&&(r=0),t>this.length&&(t=this.length);for(var i=this.length,o=this.tail;o!==null&&i>t;i--)o=o.prev;for(;o!==null&&i>r;i--,o=o.prev)n.push(o.value);return n};f1.prototype.splice=function(r,t,...n){r>this.length&&(r=this.length-1),r<0&&(r=this.length+r);for(var i=0,o=this.head;o!==null&&i<r;i++)o=o.next;for(var s=[],i=0;o&&i<t;i++)s.push(o.value),o=this.removeNode(o);o===null&&(o=this.tail),o!==this.head&&o!==this.tail&&(o=o.prev);for(var i=0;i<n.length;i++)o=NH1(this,o,n[i]);return s};f1.prototype.reverse=function(){for(var r=this.head,t=this.tail,n=r;n!==null;n=n.prev){var i=n.prev;n.prev=n.next,n.next=i}return this.head=t,this.tail=r,this};function NH1(r,t,n){var i=t===r.head?new GBe(n,null,t,r):new GBe(n,t,t.next,r);return i.next===null&&(r.tail=i),i.prev===null&&(r.head=i),r.length++,i}function DH1(r,t){r.tail=new GBe(t,r.tail,null,r),r.head||(r.head=r.tail),r.length++}function BH1(r,t){r.head=new GBe(t,null,r.head,r),r.tail||(r.tail=r.head),r.length++}function GBe(r,t,n,i){if(!(this instanceof GBe))return new GBe(r,t,n,i);this.list=i,this.value=r,t?(t.next=this,this.prev=t):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}try{Tyl()(f1)}catch{}});var j4t=m((KIC,wyl)=>{"use strict";var LH1=DJo(),HBe=Symbol("max"),p0e=Symbol("length"),frt=Symbol("lengthCalculator"),Q4t=Symbol("allowStale"),VBe=Symbol("maxAge"),l0e=Symbol("dispose"),Iyl=Symbol("noDisposeOnSet"),D3=Symbol("lruList"),bW=Symbol("cache"),Oyl=Symbol("updateAgeOnGet"),BJo=()=>1,kJo=class{constructor(t){if(typeof t=="number"&&(t={max:t}),t||(t={}),t.max&&(typeof t.max!="number"||t.max<0))throw new TypeError("max must be a non-negative number");let n=this[HBe]=t.max||1/0,i=t.length||BJo;if(this[frt]=typeof i!="function"?BJo:i,this[Q4t]=t.stale||!1,t.maxAge&&typeof t.maxAge!="number")throw new TypeError("maxAge must be a number");this[VBe]=t.maxAge||0,this[l0e]=t.dispose,this[Iyl]=t.noDisposeOnSet||!1,this[Oyl]=t.updateAgeOnGet||!1,this.reset()}set max(t){if(typeof t!="number"||t<0)throw new TypeError("max must be a non-negative number");this[HBe]=t||1/0,z4t(this)}get max(){return this[HBe]}set allowStale(t){this[Q4t]=!!t}get allowStale(){return this[Q4t]}set maxAge(t){if(typeof t!="number")throw new TypeError("maxAge must be a non-negative number");this[VBe]=t,z4t(this)}get maxAge(){return this[VBe]}set lengthCalculator(t){typeof t!="function"&&(t=BJo),t!==this[frt]&&(this[frt]=t,this[p0e]=0,this[D3].forEach(n=>{n.length=this[frt](n.value,n.key),this[p0e]+=n.length})),z4t(this)}get lengthCalculator(){return this[frt]}get length(){return this[p0e]}get itemCount(){return this[D3].length}rforEach(t,n){n=n||this;for(let i=this[D3].tail;i!==null;){let o=i.prev;Ryl(this,t,i,n),i=o}}forEach(t,n){n=n||this;for(let i=this[D3].head;i!==null;){let o=i.next;Ryl(this,t,i,n),i=o}}keys(){return this[D3].toArray().map(t=>t.key)}values(){return this[D3].toArray().map(t=>t.value)}reset(){this[l0e]&&this[D3]&&this[D3].length&&this[D3].forEach(t=>this[l0e](t.key,t.value)),this[bW]=new Map,this[D3]=new LH1,this[p0e]=0}dump(){return this[D3].map(t=>hOr(this,t)?!1:{k:t.key,v:t.value,e:t.now+(t.maxAge||0)}).toArray().filter(t=>t)}dumpLru(){return this[D3]}set(t,n,i){if(i=i||this[VBe],i&&typeof i!="number")throw new TypeError("maxAge must be a number");let o=i?Date.now():0,s=this[frt](n,t);if(this[bW].has(t)){if(s>this[HBe])return hrt(this,this[bW].get(t)),!1;let p=this[bW].get(t).value;return this[l0e]&&(this[Iyl]||this[l0e](t,p.value)),p.now=o,p.maxAge=i,p.value=n,this[p0e]+=s-p.length,p.length=s,this.get(t),z4t(this),!0}let a=new qJo(t,n,s,o,i);return a.length>this[HBe]?(this[l0e]&&this[l0e](t,n),!1):(this[p0e]+=a.length,this[D3].unshift(a),this[bW].set(t,this[D3].head),z4t(this),!0)}has(t){if(!this[bW].has(t))return!1;let n=this[bW].get(t).value;return!hOr(this,n)}get(t){return LJo(this,t,!0)}peek(t){return LJo(this,t,!1)}pop(){let t=this[D3].tail;return t?(hrt(this,t),t.value):null}del(t){hrt(this,this[bW].get(t))}load(t){this.reset();let n=Date.now();for(let i=t.length-1;i>=0;i--){let o=t[i],s=o.e||0;if(s===0)this.set(o.k,o.v);else{let a=s-n;a>0&&this.set(o.k,o.v,a)}}}prune(){this[bW].forEach((t,n)=>LJo(this,n,!1))}},LJo=(r,t,n)=>{let i=r[bW].get(t);if(i){let o=i.value;if(hOr(r,o)){if(hrt(r,i),!r[Q4t])return}else n&&(r[Oyl]&&(i.value.now=Date.now()),r[D3].unshiftNode(i));return o.value}},hOr=(r,t)=>{if(!t||!t.maxAge&&!r[VBe])return!1;let n=Date.now()-t.now;return t.maxAge?n>t.maxAge:r[VBe]&&n>r[VBe]},z4t=r=>{if(r[p0e]>r[HBe])for(let t=r[D3].tail;r[p0e]>r[HBe]&&t!==null;){let n=t.prev;hrt(r,t),t=n}},hrt=(r,t)=>{if(t){let n=t.value;r[l0e]&&r[l0e](n.key,n.value),r[p0e]-=n.length,r[bW].delete(n.key),r[D3].removeNode(t)}},qJo=class{constructor(t,n,i,o,s){this.key=t,this.value=n,this.length=i,this.now=o,this.maxAge=s||0}},Ryl=(r,t,n,i)=>{let o=n.value;hOr(r,o)&&(hrt(r,n),r[Q4t]||(o=void 0)),o&&t.call(i,o.value,o.key,r)};wyl.exports=kJo});var pz=m((YIC,Nyl)=>{var FJo=class r{constructor(t,n){if(n=qH1(n),t instanceof r)return t.loose===!!n.loose&&t.includePrerelease===!!n.includePrerelease?t:new r(t.raw,n);if(t instanceof UJo)return this.raw=t.value,this.set=[[t]],this.format(),this;if(this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease,this.raw=t.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(i=>this.parseRange(i.trim())).filter(i=>i.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let i=this.set[0];if(this.set=this.set.filter(o=>!xyl(o[0])),this.set.length===0)this.set=[i];else if(this.set.length>1){for(let o of this.set)if(o.length===1&&HH1(o[0])){this.set=[o];break}}}this.format()}format(){return this.range=this.set.map(t=>t.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(t){let i=((this.options.includePrerelease&&jH1)|(this.options.loose&&GH1))+":"+t,o=Myl.get(i);if(o)return o;let s=this.options.loose,a=s?P6[g4.HYPHENRANGELOOSE]:P6[g4.HYPHENRANGE];t=t.replace(a,tV1(this.options.includePrerelease)),Eb("hyphen replace",t),t=t.replace(P6[g4.COMPARATORTRIM],UH1),Eb("comparator trim",t),t=t.replace(P6[g4.TILDETRIM],zH1),Eb("tilde trim",t),t=t.replace(P6[g4.CARETTRIM],QH1),Eb("caret trim",t);let u=t.split(" ").map(d=>VH1(d,this.options)).join(" ").split(/\s+/).map(d=>eV1(d,this.options));s&&(u=u.filter(d=>(Eb("loose invalid filter",d,this.options),!!d.match(P6[g4.COMPARATORLOOSE])))),Eb("range list",u);let p=new Map,c=u.map(d=>new UJo(d,this.options));for(let d of c){if(xyl(d))return[d];p.set(d.value,d)}p.size>1&&p.has("")&&p.delete("");let l=[...p.values()];return Myl.set(i,l),l}intersects(t,n){if(!(t instanceof r))throw new TypeError("a Range is required");return this.set.some(i=>Pyl(i,n)&&t.set.some(o=>Pyl(o,n)&&i.every(s=>o.every(a=>s.intersects(a,n)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new FH1(t,this.options)}catch{return!1}for(let n=0;n<this.set.length;n++)if(rV1(this.set[n],t,this.options))return!0;return!1}};Nyl.exports=FJo;var kH1=j4t(),Myl=new kH1({max:1e3}),qH1=oOr(),UJo=G4t(),Eb=F4t(),FH1=Vx(),{safeRe:P6,t:g4,comparatorTrimReplace:UH1,tildeTrimReplace:zH1,caretTrimReplace:QH1}=prt(),{FLAG_INCLUDE_PRERELEASE:jH1,FLAG_LOOSE:GH1}=q4t(),xyl=r=>r.value==="<0.0.0-0",HH1=r=>r.value==="",Pyl=(r,t)=>{let n=!0,i=r.slice(),o=i.pop();for(;n&&i.length;)n=i.every(s=>o.intersects(s,t)),o=i.pop();return n},VH1=(r,t)=>(Eb("comp",r,t),r=YH1(r,t),Eb("caret",r),r=WH1(r,t),Eb("tildes",r),r=$H1(r,t),Eb("xrange",r),r=ZH1(r,t),Eb("stars",r),r),A4=r=>!r||r.toLowerCase()==="x"||r==="*",WH1=(r,t)=>r.trim().split(/\s+/).map(n=>KH1(n,t)).join(" "),KH1=(r,t)=>{let n=t.loose?P6[g4.TILDELOOSE]:P6[g4.TILDE];return r.replace(n,(i,o,s,a,u)=>{Eb("tilde",r,i,o,s,a,u);let p;return A4(o)?p="":A4(s)?p=`>=${o}.0.0 <${+o+1}.0.0-0`:A4(a)?p=`>=${o}.${s}.0 <${o}.${+s+1}.0-0`:u?(Eb("replaceTilde pr",u),p=`>=${o}.${s}.${a}-${u} <${o}.${+s+1}.0-0`):p=`>=${o}.${s}.${a} <${o}.${+s+1}.0-0`,Eb("tilde return",p),p})},YH1=(r,t)=>r.trim().split(/\s+/).map(n=>JH1(n,t)).join(" "),JH1=(r,t)=>{Eb("caret",r,t);let n=t.loose?P6[g4.CARETLOOSE]:P6[g4.CARET],i=t.includePrerelease?"-0":"";return r.replace(n,(o,s,a,u,p)=>{Eb("caret",r,o,s,a,u,p);let c;return A4(s)?c="":A4(a)?c=`>=${s}.0.0${i} <${+s+1}.0.0-0`:A4(u)?s==="0"?c=`>=${s}.${a}.0${i} <${s}.${+a+1}.0-0`:c=`>=${s}.${a}.0${i} <${+s+1}.0.0-0`:p?(Eb("replaceCaret pr",p),s==="0"?a==="0"?c=`>=${s}.${a}.${u}-${p} <${s}.${a}.${+u+1}-0`:c=`>=${s}.${a}.${u}-${p} <${s}.${+a+1}.0-0`:c=`>=${s}.${a}.${u}-${p} <${+s+1}.0.0-0`):(Eb("no pr"),s==="0"?a==="0"?c=`>=${s}.${a}.${u}${i} <${s}.${a}.${+u+1}-0`:c=`>=${s}.${a}.${u}${i} <${s}.${+a+1}.0-0`:c=`>=${s}.${a}.${u} <${+s+1}.0.0-0`),Eb("caret return",c),c})},$H1=(r,t)=>(Eb("replaceXRanges",r,t),r.split(/\s+/).map(n=>XH1(n,t)).join(" ")),XH1=(r,t)=>{r=r.trim();let n=t.loose?P6[g4.XRANGELOOSE]:P6[g4.XRANGE];return r.replace(n,(i,o,s,a,u,p)=>{Eb("xRange",r,i,o,s,a,u,p);let c=A4(s),l=c||A4(a),d=l||A4(u),f=d;return o==="="&&f&&(o=""),p=t.includePrerelease?"-0":"",c?o===">"||o==="<"?i="<0.0.0-0":i="*":o&&f?(l&&(a=0),u=0,o===">"?(o=">=",l?(s=+s+1,a=0,u=0):(a=+a+1,u=0)):o==="<="&&(o="<",l?s=+s+1:a=+a+1),o==="<"&&(p="-0"),i=`${o+s}.${a}.${u}${p}`):l?i=`>=${s}.0.0${p} <${+s+1}.0.0-0`:d&&(i=`>=${s}.${a}.0${p} <${s}.${+a+1}.0-0`),Eb("xRange return",i),i})},ZH1=(r,t)=>(Eb("replaceStars",r,t),r.trim().replace(P6[g4.STAR],"")),eV1=(r,t)=>(Eb("replaceGTE0",r,t),r.trim().replace(P6[t.includePrerelease?g4.GTE0PRE:g4.GTE0],"")),tV1=r=>(t,n,i,o,s,a,u,p,c,l,d,f,h)=>(A4(i)?n="":A4(o)?n=`>=${i}.0.0${r?"-0":""}`:A4(s)?n=`>=${i}.${o}.0${r?"-0":""}`:a?n=`>=${n}`:n=`>=${n}${r?"-0":""}`,A4(c)?p="":A4(l)?p=`<${+c+1}.0.0-0`:A4(d)?p=`<${c}.${+l+1}.0-0`:f?p=`<=${c}.${l}.${d}-${f}`:r?p=`<${c}.${l}.${+d+1}-0`:p=`<=${p}`,`${n} ${p}`.trim()),rV1=(r,t,n)=>{for(let i=0;i<r.length;i++)if(!r[i].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let i=0;i<r.length;i++)if(Eb(r[i].semver),r[i].semver!==UJo.ANY&&r[i].semver.prerelease.length>0){let o=r[i].semver;if(o.major===t.major&&o.minor===t.minor&&o.patch===t.patch)return!0}return!1}return!0}});var G4t=m((JIC,Fyl)=>{var H4t=Symbol("SemVer ANY"),jJo=class r{static get ANY(){return H4t}constructor(t,n){if(n=Dyl(n),t instanceof r){if(t.loose===!!n.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),QJo("comparator",t,n),this.options=n,this.loose=!!n.loose,this.parse(t),this.semver===H4t?this.value="":this.value=this.operator+this.semver.version,QJo("comp",this)}parse(t){let n=this.options.loose?Byl[Lyl.COMPARATORLOOSE]:Byl[Lyl.COMPARATOR],i=t.match(n);if(!i)throw new TypeError(`Invalid comparator: ${t}`);this.operator=i[1]!==void 0?i[1]:"",this.operator==="="&&(this.operator=""),i[2]?this.semver=new kyl(i[2],this.options.loose):this.semver=H4t}toString(){return this.value}test(t){if(QJo("Comparator.test",t,this.options.loose),this.semver===H4t||t===H4t)return!0;if(typeof t=="string")try{t=new kyl(t,this.options)}catch{return!1}return zJo(t,this.operator,this.semver,this.options)}intersects(t,n){if(!(t instanceof r))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new qyl(t.value,n).test(this.value):t.operator===""?t.value===""?!0:new qyl(this.value,n).test(t.semver):(n=Dyl(n),n.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!n.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||zJo(this.semver,"<",t.semver,n)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||zJo(this.semver,">",t.semver,n)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};Fyl.exports=jJo;var Dyl=oOr(),{safeRe:Byl,t:Lyl}=prt(),zJo=NJo(),QJo=F4t(),kyl=Vx(),qyl=pz()});var V4t=m(($IC,Uyl)=>{var nV1=pz(),iV1=(r,t,n)=>{try{t=new nV1(t,n)}catch{return!1}return t.test(r)};Uyl.exports=iV1});var Qyl=m((XIC,zyl)=>{var oV1=pz(),sV1=(r,t)=>new oV1(r,t).set.map(n=>n.map(i=>i.value).join(" ").trim().split(" "));zyl.exports=sV1});var Gyl=m((ZIC,jyl)=>{var aV1=Vx(),uV1=pz(),cV1=(r,t,n)=>{let i=null,o=null,s=null;try{s=new uV1(t,n)}catch{return null}return r.forEach(a=>{s.test(a)&&(!i||o.compare(a)===-1)&&(i=a,o=new aV1(i,n))}),i};jyl.exports=cV1});var Vyl=m((e3C,Hyl)=>{var lV1=Vx(),pV1=pz(),dV1=(r,t,n)=>{let i=null,o=null,s=null;try{s=new pV1(t,n)}catch{return null}return r.forEach(a=>{s.test(a)&&(!i||o.compare(a)===1)&&(i=a,o=new lV1(i,n))}),i};Hyl.exports=dV1});var Yyl=m((t3C,Kyl)=>{var GJo=Vx(),fV1=pz(),Wyl=U4t(),hV1=(r,t)=>{r=new fV1(r,t);let n=new GJo("0.0.0");if(r.test(n)||(n=new GJo("0.0.0-0"),r.test(n)))return n;n=null;for(let i=0;i<r.set.length;++i){let o=r.set[i],s=null;o.forEach(a=>{let u=new GJo(a.semver.version);switch(a.operator){case">":u.prerelease.length===0?u.patch++:u.prerelease.push(0),u.raw=u.format();case"":case">=":(!s||Wyl(u,s))&&(s=u);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),s&&(!n||Wyl(n,s))&&(n=s)}return n&&r.test(n)?n:null};Kyl.exports=hV1});var $yl=m((r3C,Jyl)=>{var gV1=pz(),AV1=(r,t)=>{try{return new gV1(r,t).range||"*"}catch{return null}};Jyl.exports=AV1});var gOr=m((n3C,tbl)=>{var mV1=Vx(),ebl=G4t(),{ANY:yV1}=ebl,bV1=pz(),EV1=V4t(),Xyl=U4t(),Zyl=cOr(),CV1=pOr(),SV1=lOr(),vV1=(r,t,n,i)=>{r=new mV1(r,i),t=new bV1(t,i);let o,s,a,u,p;switch(n){case">":o=Xyl,s=CV1,a=Zyl,u=">",p=">=";break;case"<":o=Zyl,s=SV1,a=Xyl,u="<",p="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(EV1(r,t,i))return!1;for(let c=0;c<t.set.length;++c){let l=t.set[c],d=null,f=null;if(l.forEach(h=>{h.semver===yV1&&(h=new ebl(">=0.0.0")),d=d||h,f=f||h,o(h.semver,d.semver,i)?d=h:a(h.semver,f.semver,i)&&(f=h)}),d.operator===u||d.operator===p||(!f.operator||f.operator===u)&&s(r,f.semver))return!1;if(f.operator===p&&a(r,f.semver))return!1}return!0};tbl.exports=vV1});var nbl=m((i3C,rbl)=>{var TV1=gOr(),_V1=(r,t,n)=>TV1(r,t,">",n);rbl.exports=_V1});var obl=m((o3C,ibl)=>{var IV1=gOr(),RV1=(r,t,n)=>IV1(r,t,"<",n);ibl.exports=RV1});var ubl=m((s3C,abl)=>{var sbl=pz(),OV1=(r,t,n)=>(r=new sbl(r,n),t=new sbl(t,n),r.intersects(t,n));abl.exports=OV1});var lbl=m((a3C,cbl)=>{var wV1=V4t(),MV1=lz();cbl.exports=(r,t,n)=>{let i=[],o=null,s=null,a=r.sort((l,d)=>MV1(l,d,n));for(let l of a)wV1(l,t,n)?(s=l,o||(o=l)):(s&&i.push([o,s]),s=null,o=null);o&&i.push([o,null]);let u=[];for(let[l,d]of i)l===d?u.push(l):!d&&l===a[0]?u.push("*"):d?l===a[0]?u.push(`<=${d}`):u.push(`${l} - ${d}`):u.push(`>=${l}`);let p=u.join(" || "),c=typeof t.raw=="string"?t.raw:String(t);return p.length<c.length?p:t}});var Abl=m((u3C,gbl)=>{var pbl=pz(),VJo=G4t(),{ANY:HJo}=VJo,W4t=V4t(),WJo=lz(),xV1=(r,t,n={})=>{if(r===t)return!0;r=new pbl(r,n),t=new pbl(t,n);let i=!1;e:for(let o of r.set){for(let s of t.set){let a=NV1(o,s,n);if(i=i||a!==null,a)continue e}if(i)return!1}return!0},PV1=[new VJo(">=0.0.0-0")],dbl=[new VJo(">=0.0.0")],NV1=(r,t,n)=>{if(r===t)return!0;if(r.length===1&&r[0].semver===HJo){if(t.length===1&&t[0].semver===HJo)return!0;n.includePrerelease?r=PV1:r=dbl}if(t.length===1&&t[0].semver===HJo){if(n.includePrerelease)return!0;t=dbl}let i=new Set,o,s;for(let h of r)h.operator===">"||h.operator===">="?o=fbl(o,h,n):h.operator==="<"||h.operator==="<="?s=hbl(s,h,n):i.add(h.semver);if(i.size>1)return null;let a;if(o&&s){if(a=WJo(o.semver,s.semver,n),a>0)return null;if(a===0&&(o.operator!==">="||s.operator!=="<="))return null}for(let h of i){if(o&&!W4t(h,String(o),n)||s&&!W4t(h,String(s),n))return null;for(let A of t)if(!W4t(h,String(A),n))return!1;return!0}let u,p,c,l,d=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1,f=o&&!n.includePrerelease&&o.semver.prerelease.length?o.semver:!1;d&&d.prerelease.length===1&&s.operator==="<"&&d.prerelease[0]===0&&(d=!1);for(let h of t){if(l=l||h.operator===">"||h.operator===">=",c=c||h.operator==="<"||h.operator==="<=",o){if(f&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===f.major&&h.semver.minor===f.minor&&h.semver.patch===f.patch&&(f=!1),h.operator===">"||h.operator===">="){if(u=fbl(o,h,n),u===h&&u!==o)return!1}else if(o.operator===">="&&!W4t(o.semver,String(h),n))return!1}if(s){if(d&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===d.major&&h.semver.minor===d.minor&&h.semver.patch===d.patch&&(d=!1),h.operator==="<"||h.operator==="<="){if(p=hbl(s,h,n),p===h&&p!==s)return!1}else if(s.operator==="<="&&!W4t(s.semver,String(h),n))return!1}if(!h.operator&&(s||o)&&a!==0)return!1}return!(o&&c&&!s&&a!==0||s&&l&&!o&&a!==0||f||d)},fbl=(r,t,n)=>{if(!r)return t;let i=WJo(r.semver,t.semver,n);return i>0?r:i<0||t.operator===">"&&r.operator===">="?t:r},hbl=(r,t,n)=>{if(!r)return t;let i=WJo(r.semver,t.semver,n);return i<0?r:i>0||t.operator==="<"&&r.operator==="<="?t:r};gbl.exports=xV1});var grt=m((c3C,bbl)=>{var KJo=prt(),mbl=q4t(),DV1=Vx(),ybl=wJo(),BV1=jBe(),LV1=Fml(),kV1=zml(),qV1=Gml(),FV1=Wml(),UV1=Yml(),zV1=$ml(),QV1=Zml(),jV1=tyl(),GV1=lz(),HV1=oyl(),VV1=ayl(),WV1=uOr(),KV1=pyl(),YV1=fyl(),JV1=U4t(),$V1=cOr(),XV1=xJo(),ZV1=PJo(),eW1=lOr(),tW1=pOr(),rW1=NJo(),nW1=Syl(),iW1=G4t(),oW1=pz(),sW1=V4t(),aW1=Qyl(),uW1=Gyl(),cW1=Vyl(),lW1=Yyl(),pW1=$yl(),dW1=gOr(),fW1=nbl(),hW1=obl(),gW1=ubl(),AW1=lbl(),mW1=Abl();bbl.exports={parse:BV1,valid:LV1,clean:kV1,inc:qV1,diff:FV1,major:UV1,minor:zV1,patch:QV1,prerelease:jV1,compare:GV1,rcompare:HV1,compareLoose:VV1,compareBuild:WV1,sort:KV1,rsort:YV1,gt:JV1,lt:$V1,eq:XV1,neq:ZV1,gte:eW1,lte:tW1,cmp:rW1,coerce:nW1,Comparator:iW1,Range:oW1,satisfies:sW1,toComparators:aW1,maxSatisfying:uW1,minSatisfying:cW1,minVersion:lW1,validRange:pW1,outside:dW1,gtr:fW1,ltr:hW1,intersects:gW1,simplifyRange:AW1,subset:mW1,SemVer:DV1,re:KJo.re,src:KJo.src,tokens:KJo.t,SEMVER_SPEC_VERSION:mbl.SEMVER_SPEC_VERSION,RELEASE_TYPES:mbl.RELEASE_TYPES,compareIdentifiers:ybl.compareIdentifiers,rcompareIdentifiers:ybl.rcompareIdentifiers}});var K4t,yW1,l3C,bW1,LC,Fee=V(()=>{"use strict";K4t=gt(CU()),yW1=gt(grt()),l3C=(0,K4t.Record)({version:K4t.String,hash:K4t.String}),bW1=()=>{let r="7.40.3",t="0229acbeb21b64ac3e70e0bf9ca477ac219c82f9";return r&&t?{version:r,hash:t}:null},LC=bW1()});var QCe,Art,AOr=V(()=>{"use strict";fr();QCe=class extends nt{constructor(n){super(`Run ${n} canceled by user`);this.runID=n}runID;fault="client"},Art=class extends nt{constructor(n){super('Test failed with "continue on failure" set to false');this.result=n}result;fault="client"}});var Ebl,Cbl,WBe,Y4t,J4t,mOr,yOr=V(()=>{"use strict";ly();AOr();Ebl=(r,t,n)=>{switch(r){case"skipped":return"Skipped";case"error":return"Error";case"complete":switch(n){case"create":return t?"Validated":"Created";case"run":return t?"Validated":"DataLoaded";default:return"None"}default:return"None"}},Cbl=r=>typeof r=="object"&&r instanceof Art,WBe=r=>typeof r=="object"&&(r instanceof im||r instanceof QCe),Y4t=r=>typeof r=="object"&&r instanceof az&&r.isCancel(),J4t=r=>typeof r=="object"&&r instanceof qee&&r.isCancel(),mOr=r=>WBe(r)||Y4t(r)||J4t(r)});var Sbl,vbl,jCe,$4t=V(()=>{"use strict";fr();s0e();Bo();gc();ar();cm();R3();pNt();Xd();Fee();IJo();L4t();AOr();yOr();Sbl=5e5,vbl=500,jCe=class r{constructor(t,n,i,o,s){this.state=t;this.repository=n;this.logContext=i;this.operationType=o;this.analyticsCollector=s}state;repository;logContext;operationType;stepsInitialized=null;runResults={};flusher=null;wasCanceled=!1;nodeStageIndexTracker=new Map;analyticsCollector;get teamID(){return this.logContext.orgID}get runID(){return this.logContext.runID}get envID(){return this.logContext.workspaceID}GetLogContext=t=>({...this.logContext,nodeID:t});async runIsCanceled(){if(!this.repository)return!1;if(this.wasCanceled)return!0;try{let t=!!(await this.getRepositoryForRun().fetch({pendingWritesTimeoutMs:100})).runDetails.canceled;return t&&(this.wasCanceled=!0),t}catch(t){if(h2(t)){if(t instanceof FBe)return!1;if(t instanceof Vu)return!1}throw t}}async throwIfRunCanceled(){if(await this.runIsCanceled())throw new QCe(this.runID)}updateNodeLocalRunResult({stepID:t,isPreview:n,runExecutionSequenceID:i},o){let s=this.runResults[t];s?(s.runState=o,s.queryResultSequence.isRunning=o==="running",s.stepRunState=this.getStepRunState(o,n),i!==void 0&&(s.runExecutionSequenceID=i),(o==="canceled"||o==="skipped"||o==="error")&&s.queryResultSequence.queryResults.forEach(a=>{!a.isRunning&&a.status==="Queued"&&(a.status="Canceled")})):this.Logger.errorContext(this.GetLogContext(t),"EventHandler updateNodeLocalRunResult: missing expected local run result for node",t)}getBulkSkipHandler=()=>async t=>{if(!this.repository)return;let n=this.repository.batch(),i=this.getRepositoryForRun().runResults;for(let[o,s]of Object.entries(t))if(this.runResults[o]){let a=i.get(o);this.updateNodeLocalRunResult({stepID:o,isPreview:!1,runExecutionSequenceID:s},"skipped");let u={...r.truncateRunResult(this.runResults[o]),version:2};await n.save(a,u)}await n.commit()};getCancelNodeHandler=()=>async t=>{try{if(!this.repository)return;if(this.runResults[t]){this.updateNodeLocalRunResult({stepID:t,isPreview:!1},"canceled");let i=this.getRepositoryForRun().runResults.get(t),o={...r.truncateRunResult(this.runResults[t]),version:2};await i.save(o)}else this.Logger.errorContext(this.GetLogContext(t),"EventHandler getCancelNodeHandler: missing expected local run result for node",t)}catch(n){this.Logger.errorContext(this.logContext,`Error canceling node ${t}`,n)}};async repositoryUpdateRunStatus({expectedStatus:t,newStatus:n}){if(!this.repository)return;let i=this.getRepositoryForRun();try{let o=await i.fetch();Dh("RUNNER_BACKEND",t===o.runStatus,this.logContext,`EventHandler.repositoryUpdateRunStatus found unexpected run status - expected: ${t} / actual: ${o.runStatus}`)}catch(o){this.Logger.alertContext(this.logContext,"Error fetching runInfo",o)}await i.merge({runStatus:n})}async repositoryStampExecutorInfo(t){if(this.repository)try{await this.getRepositoryForRun().merge({platform:t,...LC?{softwareVersion:LC.version}:{}})}catch(n){this.Logger.errorContext(this.logContext,"[EventHandler.repositoryStampExecutorInfo] Error stamping executor info. Cannot update run document version/platform.",n)}}async repositoryUpdateRenderingProgress(t){if(this.repository)try{await this.getRepositoryForRun().merge({renderingProgress:{totalNodes:t.totalNodes,completedNodes:t.completedNodes}})}catch(n){this.Logger.errorContext(this.logContext,"[EventHandler.repositoryUpdateRenderingProgress] Error updating rendering progress. Cannot update run document renderingProgress.",n)}}getRepositoryRunsCollection(){if(!this.repository)throw new nt("No repository to get runs collection for!");let t=this.repository.orgs.get(this.logContext.orgID);return this.runLevel==="orgRuns"?t.runs:t.devRuns}getRepositoryForRun(){return this.getRepositoryRunsCollection().get(this.runID)}formatError=(t,n=null,i=null,o=!1)=>{let s=Ta(t.error).error,a="";return t.error&&typeof t.error=="object"&&!(t.error instanceof Error)&&"runDetails"in t.error&&typeof t.error.runDetails=="object"&&(a=t.error?.runDetails?.compiledSQL??""),t.templateString&&(a=t.templateString),{success:!1,error:{errorString:s.errorString??"",errorDetail:s.errorDetail??""},rows:[],fields:[],name:"",exportedRefs:[],invalidExportedRefs:[],status:o?"Canceled":"Failure",sql:a??"",startTime:t.startTime,endTime:new Date,isRunning:!1,type:"sql",queryID:n,warehouse:i}};populateRunResults(t,n){let i="[EventHandler.populateRunResults()]",o=t.length+1;for(let s of t){let u=k1(s,this.state.nodes,`${i} state.nodes`).operation.name;this.runResults[s]={name:u,runExecutionSequenceID:o,dataResult:null,runState:n,stepRunState:"None",queryResultSequence:{name:u,queryResults:[],isRunning:!1},runResultVersion:2}}}async bulkSetRunResults(t){if(!this.repository)return;let n=this.repository.batch(),i=this.getRepositoryForRun().runResults;for(let o of t){let s=this.runResults[o];if(!s)throw new nt(`Run result for node ${o} does not exist for run ${this.runID}`);let a={...s,name:s.queryResultSequence.name,runExecutionSequenceID:s.runExecutionSequenceID,version:2},u=i.get(o);await n.save(u,a)}await n.commit()}async initializeRunResults(t,n="queued"){this.stepsInitialized=[...t],this.populateRunResults(t,n),await this.bulkSetRunResults(t)}setFlusher(t){this.flusher=t,t.startTimer()}async disposeFlusher(){await this.flusher?.stopAndFlush()}async populatePlaceholderStages(t,n){let i=new Set,o=new Set(t.keys());for(let s of n){if(!o.has(s))continue;let a=t.getPhaseItems(s);for(let[u,p]of a.entries()){let c=k1(u,this.runResults,"populateQueuedStages: this.runResults"),l=this.state.nodes[u],d=l?o4(l,void 0):!1,f=lrt(p,this.getNameForStageWithoutSQL(s,d));for(let h of f)c.queryResultSequence.queryResults.push(this.createQueuedStage(h));f.length>0&&!i.has(u)&&(i.add(u),this.nodeStageIndexTracker.set(u,0))}}await this.bulkSetQueuedStageResults(i)}createQueuedStage({name:t,sql:n,type:i}){return{name:t,status:"Queued",success:!0,sql:n,rows:[],fields:[],startTime:new Date,endTime:new Date,isRunning:!1,exportedRefs:[],invalidExportedRefs:[],type:i}}async bulkSetQueuedStageResults(t){if(!this.repository)return;let n=this.repository.batch(),i=this.getRepositoryForRun().runResults;for(let o of t){let s=this.runResults[o];if(!s)continue;let a=i.get(o);await n.save(a,r.buildRunResultEntitySave(s))}await n.commit()}formatErrorToResult(t,n){let i=null,o=null;return typeof t.error=="object"&&(i=t.error.queryID||null,o=t.error.warehouse||null),{...this.formatError(t,i,o,n),name:t.stageName,stageExecutionStartTime:t.stageExecutionStartTime,stageExecutionEndTime:t.stageExecutionEndTime}}ensureHasQueryResult(t){if(Dh("DEPLOY",!!t.queryResult,this.GetLogContext(t.stepID),"query result should always be returned for stage execution"),!t.queryResult)throw new Error("Got an empty query result for stage execution")}updateStageResultAtTrackedIndex=(t,n)=>{let o=k1(t,this.runResults,"[EventHandler.setLastQueryResult()]").queryResultSequence.queryResults,s=this.getCurrentStageIndex(t);if(s<0||s>=o.length)throw this.Logger.errorContext(this.GetLogContext(t),"[EventHandler.setLastQueryResult] stage index out of bounds",{targetIndex:s,queryResultsLength:o.length,resultName:n.name}),new nt(`Stage index ${s} out of bounds (length: ${o.length}) for node ${t}`);o[s]=n};async dispatchQueryFailure(t,n){let i=this.formatErrorToResult(t,n),o=n?"client":A3(t.error)??"system";return HS(this.Logger,o,this.GetLogContext(t.stepID),"failed to execute run sql",n?"- canceled":"- errored",t.error,"stack: ",t.error.stack||"<none found>"),this.updateStageResultAtTrackedIndex(t.stepID,i),{error:i.error,fault:o}}getSingleStepData(t,n){let i=this.state.nodes[n];if(i)return i;let o=`(${this.runTypeName}) EventHandler: Could not get step data for step: ${n}`;throw this.Logger.errorContext(this.GetLogContext(n),o,n),new nt(o)}getUnrunSteps(){let t={},n=this.state.nodes,i=this.runResults;if(n&&this.stepsInitialized)for(let o of this.stepsInitialized){let s=i[o];if(s){let{runState:a}=s;(a==="waiting"||a==="queued")&&(n[o]?t[o]=0:this.Logger.alertContext(this.logContext,"Node ID from initialization not found in steps data",o))}else this.Logger.alertContext(this.logContext,"Node ID from initialization not found in run results",o)}return t}getStepContext=(t,n,i,o)=>{let s=this.getSingleStepData(t,n),{locationName:a}=s.operation,{database:u}=this.state.mappings[a]?.mappingDefinitions[this.state.currentWorkspace]??{},p=o4(s,void 0),c=s.operation.name;return{startTime:new Date,stepID:n,stepName:c,runExecutionSequenceID:i,phase:t,isPreview:o,isSource:p,database:u??""}};convertIQueryToCompletedQueryResult(t){return{...t,startTime:OUo(t.startTime),endTime:OUo(t.endTime)}}getCurrentStageIndex(t){let n=this.nodeStageIndexTracker.get(t);if(n===void 0)throw new nt(`[EventHandler.getCurrentStageIndex] Node ${t} not in stage tracker. Was populateQueuedStages called for this node?`);return n}advanceToNextStage(t){let n=this.getCurrentStageIndex(t);this.nodeStageIndexTracker.set(t,n+1)}getQueryResultForUpdateSuccess(t){return{...this.convertIQueryToCompletedQueryResult(t.queryResult),name:t.stageName,stageExecutionStartTime:t.stageExecutionStartTime,stageExecutionEndTime:t.stageExecutionEndTime}}getStepRunState(t,n){return Ebl(t,n,this.operationType)}async updateRunResult(t){if(!this.repository)return;let n=this.runResults[t];if(!n)throw new nt(`[EventHandler.updateRunResult()] run result for node ${t} does not exist for run ${this.runID}`);if(this.flusher)this.flusher.markDirty(t);else{let i=r.buildRunResultEntitySave(n);this.Logger.debugContext(this.GetLogContext(t),"updating run result",i),await this.getRepositoryForRun().runResults.get(t).save(i)}}isFinalRunForStep(t){return!0}async beforePhaseExecution(t,n){}async afterPhaseExecution(t){}async beforeStepExecution(t){this.runResults[t.stepID]&&(this.runResults[t.stepID].runExecutionSequenceID=t.runExecutionSequenceID),this.updateNodeLocalRunResult(t,"running"),await this.updateRunResult(t.stepID)}async afterFinalRunSuccessForNode(t){return Promise.resolve()}async afterStepExecutionSuccess(t){this.isFinalRunForStep(t)?(this.updateNodeLocalRunResult(t,"complete"),await this.afterFinalRunSuccessForNode(t)):this.updateNodeLocalRunResult(t,"waiting"),await this.updateRunResult(t.stepID)}async afterStepExecutionFailure(t){let n=await this.isCoalesceInitiatedCancel(t.error);this.markUnexecutedStagesAsCanceled(t.stepID),this.updateNodeLocalRunResult(t,n?"canceled":"error");try{this.flusher?await this.flusher.flushOne(t.stepID):await this.updateRunResult(t.stepID)}catch(i){this.Logger.emergContext(this.GetLogContext(t.stepID),`Error in firebaseUpdateStepResult for stepCounter:${t.stepID}:`,i)}}markUnexecutedStagesAsCanceled(t){let n=this.runResults[t];if(n)for(let i of n.queryResultSequence.queryResults)"status"in i&&i.status==="Queued"&&(i.status="Canceled")}sanityCheckContext(t){if(!t.stageType)throw this.Logger.emergContext(this.logContext,`No stage type on this ${this.runTypeName}!`,t),new Error(`Internal critical error: no stage type on this ${this.runTypeName}!`)}async beforeStageExecution(t){this.sanityCheckContext(t);let n=this.runResults[t.stepID];if(n){let i=n.queryResultSequence.queryResults,o=this.getCurrentStageIndex(t.stepID),s=i[o];if(!s||!("status"in s)||s.status!=="Queued"){let a=s&&"status"in s?s.status:"no-status";throw new nt(`[EventHandler.beforeStageExecution] Expected queued placeholder at index ${o} for node ${t.stepID}, but found: ${s?`status=${a}`:"undefined"}`)}s.status="Running",s.startTime=new Date,s.endTime=s.startTime,await this.updateRunResult(t.stepID)}}async updateRunWithHeartbeat(t){await this.getRepositoryForRun().updateHeartbeat(t)}async afterStageExecutionSuccess(t){let n="[EventHandler.afterStageExecutionSuccess()]";if(this.sanityCheckContext(t),!t.queryResult){let i="Got an empty query result for stage execution - query result should always be returned!";throw this.Logger.alertContext(this.GetLogContext(t.stepID),n,i),new nt(i)}if(t.stageExecutionStartTime&&t.stageExecutionEndTime){let i=t.stageExecutionEndTime.getTime()-t.stageExecutionStartTime.getTime();this.analyticsCollector.addQueryTiming(t.stepID,t.stageName,i,!0,t.stageExecutionStartTime)}if(lNt(t.queryResult)&&!t.queryResult.success){await this.updateRunWithHeartbeat({hasTestFailures:!0});let i=this.runResults[t.stepID];i&&(i.hasTestFailures=!0)}this.updateStageResultAtTrackedIndex(t.stepID,this.getQueryResultForUpdateSuccess(t)),await this.updateRunResult(t.stepID),this.advanceToNextStage(t.stepID)}async afterStageExecutionFailure(t){if(this.sanityCheckContext(t),t.stageExecutionStartTime&&t.stageExecutionEndTime){let o=t.stageExecutionEndTime.getTime()-t.stageExecutionStartTime.getTime();this.analyticsCollector.addQueryTiming(t.stepID,t.stageName,o,!1,t.stageExecutionStartTime)}let n=await this.isCoalesceInitiatedCancel(t.error),i=await this.dispatchQueryFailure(t,n);throw this.flusher?await this.flusher.flushOne(t.stepID):await this.updateRunResult(t.stepID),this.advanceToNextStage(t.stepID),n?t.error:i}async isCoalesceInitiatedCancel(t){return WBe(t)?!0:Y4t(t)?this.runIsCanceled():J4t(t)?this.runIsCanceled():!1}static truncateQueryResult(t,n=Sbl,i=vbl){let o=t.sql,s=t.rows,a,u;if(o){let p=new TextEncoder,c=new TextDecoder("utf8"),l=p.encode(o);if(l.length>n){let d=c.decode(l.slice(0,n));d.slice(-1)==="\uFFFD"&&(d=d.slice(0,-1)),a=`${d}...data truncated`}}return s?.length>i&&(u=s.slice(0,i),u.push({values:[`${s.length-i} rows truncated`]})),a||u?{...t,sql:a??o,rows:u??s}:t}static buildRunResultEntitySave(t){return{...r.truncateRunResult(t),name:t.queryResultSequence.name,runExecutionSequenceID:t.runExecutionSequenceID,version:2}}static truncateRunResult(t){let n=(t.dataResult?.sql?1:0)+(t.queryResultSequence?.renderQueryResults?.sql?1:0)+(t.queryResultSequence?.queryResults?.length??0),i=(t.dataResult?.rows?.length?1:0)+(t.queryResultSequence?.renderQueryResults?.rows?.length?1:0)+(t.queryResultSequence?.queryResults?.reduce((p,c)=>p+c?.rows?.length?1:0,0)??0);if(n===0&&i===0)return t;let o=Math.trunc(Sbl/n)-100,s=vbl/(i??1),a={...t};t.dataResult?.sql&&(a.dataResult=r.truncateQueryResult(t.dataResult,o,s)??null);let u=t.queryResultSequence;return u&&(a.queryResultSequence={...u,queryResults:u.queryResults?.map(p=>r.truncateQueryResult(p,o,s))},u.renderQueryResults&&(a.queryResultSequence.renderQueryResults=r.truncateQueryResult(u.renderQueryResults,o,s))),a}}});var X4t,Tbl=V(()=>{"use strict";qa();Bo();gc();v6();L4t();k4t();$4t();X4t=class extends jCe{constructor(n,i,o,s,a){super(n,i,o,"create",a);this.phasedNodeData=s}phasedNodeData;getNameForStageWithoutSQL=(n,i)=>iOr(n,i);getNodeDataForUpdate=n=>{let i=this.getSingleStepData(n.phase,n.stepID),o=i.operation.locationName,s=JU(this.state.mappings,this.envID),a=this.GetLogContext(n.stepID),u;try{let p=s?.[o]?.database??i.operation.database,c=s?.[o]?.schema??i.operation.schema;return u={...i.operation,metadata:{...i.operation.metadata,columns:i.operation.metadata.columns.map(l=>({...l}))},database:p,schema:c,version:1,id:n.stepID,deployEnabled:!0},this.Logger.infoContext(a,"newStepData:",u,"stepCounter:",n.stepID),u8c("(Logging Only) Compare locations from context and workspace",a,()=>{let l=JU(this.state.mappings||{},this.state.currentWorkspace);Dh("DEPLOY",sye(l[o],s[o]),a,`Location data for location ${o} for node ${i.operation.name} with id ${n.stepID} differs between data from context and data from workspace.`,"locationsFromWorkspace:",l,"locationsFromContext:",s)}),u}catch(p){let c=u?u.name:i.operation.name,l=`Error attempting to update the database/schema on deployed nodeID ${n.stepID}: ${c}`;throw this.Logger.emergContext(a,l,"locations:",s,"error:",p),new yW(n.stepID,l)}};async updateEnvironmentNodeMetadata(n){if(!this.repository)return;let i=this.repository.org(this.teamID).workspace(+this.envID).nodes.get(n.stepID);if(n.phase==="deletedTable")n.stepID in this.phasedNodeData.addedTable||await i.delete();else{let o=this.getNodeDataForUpdate(n);await i.save(o)}}isFinalRunForStep(n){let i=[];return n.phase==="deletedTable"&&(i.push(this.phasedNodeData.alteredTable),i.push(this.phasedNodeData.addedTable)),n.phase==="alteredTable"&&i.push(this.phasedNodeData.addedTable),!i.some(o=>n.stepID in o)}async afterFinalRunSuccessForNode(n){try{await this.updateEnvironmentNodeMetadata(n)}catch(i){let o=this.GetLogContext(n.stepID);this.Logger.errorContext(o,"Error updating node metadata -- nodeID:",n.stepID,"error:",i);let s=F$e(i),a="unknown location";try{a=this.getSingleStepData(n.phase,n.stepID).operation.locationName}catch(u){this.Logger.errorContext(o,`Error getting location name for node ${n.stepName} (${n.stepID}):`,u)}throw new yW(n.stepID,`Failed to update node metadata for ${n.stepName} (${a}): ${s}`)}}}});var _bl,bOr,YJo=V(()=>{"use strict";fr();_bl=(r,t)=>{let n=new Set(t);return n.delete(r),Array.from(n)},bOr=async(r,t,n)=>{if(!t)throw new nt(`Cannot get deploy run info since workspace ${r} has no currently running jobs`);if(t.length)return(await n.selectInBatches("id","in",t,[["runType","==","deploy"],["runStatus","==","running"]]))[0]}});var EOr,Ibl=V(()=>{"use strict";EOr="No SQL to execute"});var Z4t=V(()=>{"use strict";YJo();Ibl()});var eDt,Rbl=V(()=>{"use strict";Z4t();$4t();eDt=class extends jCe{constructor(t,n,i,o){super(t,n,i,"run",o)}async initializeRunResults(t){await super.initializeRunResults(t,"waiting")}getNameForStageWithoutSQL=()=>EOr}});var Obl=V(()=>{"use strict"});var COr,JJo=V(()=>{"use strict";COr=class{constructor(t,n,i,o,s,a,u){this.repository=t;this.getRunRepository=n;this.buildEntitySave=i;this.runResults=o;this.logger=s;this.logContext=a;this.flushIntervalMs=u?.flushIntervalMs??3e3,this.flushThreshold=u?.flushThreshold??50}repository;getRunRepository;buildEntitySave;runResults;logger;logContext;dirtyNodes=new Set;timer=null;activeFlush=null;flushedDuringBatch=new Set;flushIntervalMs;flushThreshold;totalFlushes=0;totalNodeWrites=0;totalImmediateWrites=0;timerFlushes=0;thresholdFlushes=0;slowCommits=0;tag="[RunResultFlusher]";markDirty(t){this.dirtyNodes.add(t),this.dirtyNodes.size>=this.flushThreshold&&this.flush("threshold").catch(n=>{this.logger.errorContext(this.logContext,`${this.tag} threshold-triggered flush error`,n)})}async flush(t="dispose"){if(this.activeFlush||this.dirtyNodes.size===0){this.logger.debugContext(this.logContext,`${this.tag} flush skipped (activeFlush=${!!this.activeFlush}, dirtySetEmpty=${this.dirtyNodes.size===0}, trigger=${t})`);return}let n=new Set(this.dirtyNodes);this.dirtyNodes.clear(),this.activeFlush=this.doFlush(n,t);try{await this.activeFlush}finally{this.activeFlush=null}}async doFlush(t,n){try{let i=this.repository.batch();for(let a of t){let u=this.runResults[a];if(!u){this.logger.warnContext(this.logContext,`${this.tag} node ${a} no longer has a run result, skipping write`);continue}let p=this.buildEntitySave(u),c=this.getRunRepository().runResults.get(a);await i.save(c,p)}let o=Date.now();await i.commit();let s=Date.now()-o;if(this.flushedDuringBatch.size>0){let a=this.getRunRepository().runResults;for(let u of this.flushedDuringBatch)if(t.has(u)){let p=this.runResults[u];p&&await a.get(u).save(this.buildEntitySave(p))}this.flushedDuringBatch.clear()}this.totalFlushes++,this.totalNodeWrites+=t.size,n==="timer"&&this.timerFlushes++,n==="threshold"&&this.thresholdFlushes++,s>=2e3&&(this.slowCommits++,this.logger.warnContext(this.logContext,`${this.tag} slow commit: ${s}ms for ${t.size} nodes (possible write stream pressure)`)),this.logger.debugContext(this.logContext,`${this.tag} flushed ${t.size} run results in ${s}ms (${n}, threshold=${this.flushThreshold}, interval=${this.flushIntervalMs}ms)`)}catch(i){for(let o of t)this.dirtyNodes.add(o);throw this.logger.errorContext(this.logContext,`${this.tag} flush failed, ${t.size} nodes re-queued`,i),i}}async flushOne(t){this.dirtyNodes.delete(t);let n=this.runResults[t];if(!n){this.logger.warnContext(this.logContext,`${this.tag} node ${t} no longer has a run result, skipping write (flushOne)`);return}this.activeFlush&&this.flushedDuringBatch.add(t);let i=this.buildEntitySave(n);await this.getRunRepository().runResults.get(t).save(i),this.totalImmediateWrites++}startTimer(){this.timer||(this.timer=setInterval(()=>{this.flush("timer").catch(t=>{this.logger.errorContext(this.logContext,`${this.tag} timer-triggered flush error`,t)})},this.flushIntervalMs))}async stopAndFlush(){this.timer&&(clearInterval(this.timer),this.timer=null);try{if(this.activeFlush)try{await this.activeFlush}catch(t){this.logger.errorContext(this.logContext,`${this.tag} error waiting for in-flight flush (stopAndFlush)`,t)}this.logger.infoContext(this.logContext,`${this.tag} draining remaining dirty nodes (stopAndFlush)`),await this.flush("dispose")}catch(t){this.logger.errorContext(this.logContext,`${this.tag} error stopping and flushing (stopAndFlush)`,t)}finally{this.logger.infoContext(this.logContext,`${this.tag} done \u2014 ${this.totalFlushes} flushes (${this.thresholdFlushes} threshold, ${this.timerFlushes} timer, ${this.slowCommits} slow), ${this.totalNodeWrites} batched writes, ${this.totalImmediateWrites} immediate writes (threshold=${this.flushThreshold}, interval=${this.flushIntervalMs}ms)`)}}}});var SOr,vOr,TOr,_Or,GCe=V(()=>{"use strict";ar();IJo();Tbl();Rbl();yOr();AOr();$4t();Obl();JJo();yOr();SOr=class extends X4t{constructor(t,n,i,o,s){super(t,n,i,o,s)}get Logger(){return We("DEPLOY")}get runTypeName(){return"Deploy"}get runLevel(){return"orgRuns"}},vOr=class extends eDt{get Logger(){return We("RUNNER")}get runTypeName(){return"Refresh"}get runLevel(){return"orgRuns"}afterStepExecutionSuccess=async t=>{await super.afterStepExecutionSuccess(t),this.repository&&super.isFinalRunForStep(t)&&!t.isSource&&await this.repository.org(this.logContext.orgID).workspace(this.logContext.workspaceID).nodeLastRefreshed(t.stepID).save({lastRefreshed:new Date().toISOString()})};getQueryResultForUpdateSuccess=t=>({...super.getQueryResultForUpdateSuccess(t),type:t.stageType});async dispatchQueryFailure(t,n){if(Cbl(t.error)){let i=t.error,o=this.getCurrentStageIndex(t.stepID);t.stepID in this.runResults&&(this.runResults[t.stepID].queryResultSequence.queryResults[o]=this.convertIQueryToCompletedQueryResult(i.result));let s=this.runResults[t.stepID];return s&&(s.hasTestFailures=!0),await this.updateRunWithHeartbeat({hasTestFailures:!0}),{error:{errorString:t.error.message,errorDetail:t.error.message},fault:"client"}}else return super.dispatchQueryFailure(t,n)}},TOr=class extends X4t{get Logger(){return We("RUNNER")}get runTypeName(){return"Dev Run"}get runLevel(){return"devRuns"}},_Or=class extends eDt{get Logger(){return We("RUNNER")}get runTypeName(){return"Dev Run"}get runLevel(){return"devRuns"}}});var KBe,YBe,JBe=V(()=>{"use strict";KBe=["deletedTable","alteredTable","addedTable"],YBe=["refresh"]});var IOr,tDt,ROr,wbl,Mbl,SW1,vW1,TW1,_W1,xbl,mrt,OOr,$Jo,d0e,f0e=V(()=>{"use strict";qa();cb();fo();ar();MHo();ZYo();IOr=`{%- macro get_value_by_column_attribute(column_attribute, value="name") -%}
7878
7878
  {%- set filtered_columns_by_attribute = columns | selectattr(column_attribute) | list -%}
7879
7879
  {%- if filtered_columns_by_attribute | length > 0 -%}
7880
7880
  {{- (filtered_columns_by_attribute | first)[value] -}}