@coalescesoftware/coa 7.46.0 → 7.46.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/coa.js CHANGED
@@ -9462,7 +9462,7 @@ Content-Type: `+c.contentType+`\r
9462
9462
  ${this.customData.serverResponse}`:this.message=this._baseMessage}};(function(r){r.UNKNOWN="unknown",r.OBJECT_NOT_FOUND="object-not-found",r.BUCKET_NOT_FOUND="bucket-not-found",r.PROJECT_NOT_FOUND="project-not-found",r.QUOTA_EXCEEDED="quota-exceeded",r.UNAUTHENTICATED="unauthenticated",r.UNAUTHORIZED="unauthorized",r.UNAUTHORIZED_APP="unauthorized-app",r.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",r.INVALID_CHECKSUM="invalid-checksum",r.CANCELED="canceled",r.INVALID_EVENT_NAME="invalid-event-name",r.INVALID_URL="invalid-url",r.INVALID_DEFAULT_BUCKET="invalid-default-bucket",r.NO_DEFAULT_BUCKET="no-default-bucket",r.CANNOT_SLICE_BLOB="cannot-slice-blob",r.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",r.NO_DOWNLOAD_URL="no-download-url",r.INVALID_ARGUMENT="invalid-argument",r.INVALID_ARGUMENT_COUNT="invalid-argument-count",r.APP_DELETED="app-deleted",r.INVALID_ROOT_OPERATION="invalid-root-operation",r.INVALID_FORMAT="invalid-format",r.INTERNAL_ERROR="internal-error",r.UNSUPPORTED_ENVIRONMENT="unsupported-environment"})(b2||(b2={}));fN=class r{constructor(t,n){this.bucket=t,this.path_=n}get path(){return this.path_}get isRoot(){return this.path.length===0}fullServerUrl(){let t=encodeURIComponent;return"/b/"+t(this.bucket)+"/o/"+t(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(t,n){let i;try{i=r.makeFromUrl(t,n)}catch{return new r(t,"")}if(i.path==="")return i;throw Glh(t)}static makeFromUrl(t,n){let i=null,o="([A-Za-z0-9.\\-_]+)";function s(D){D.path.charAt(D.path.length-1)==="/"&&(D.path_=D.path_.slice(0,-1))}let a="(/(.*))?$",u=new RegExp("^gs://"+o+a,"i"),p={bucket:1,path:3};function c(D){D.path_=decodeURIComponent(D.path)}let l="v[A-Za-z0-9_]+",d=n.replace(/[.]/g,"\\."),f="(/([^?#]*).*)?$",h=new RegExp(`^https?://${d}/${l}/b/${o}/o${f}`,"i"),m={bucket:1,path:3},E=n===fzc?"(?:storage.googleapis.com|storage.cloud.google.com)":n,C="([^?#]*)",T=new RegExp(`^https?://${E}/${o}/${C}`,"i"),R=[{regex:u,indices:p,postModify:s},{regex:h,indices:m,postModify:c},{regex:T,indices:{bucket:1,path:2},postModify:c}];for(let D=0;D<R.length;D++){let L=R[D],F=L.regex.exec(t);if(F){let U=F[L.indices.bucket],Q=F[L.indices.path];Q||(Q=""),i=new r(U,Q),L.postModify(i);break}}if(i==null)throw Qlh(t);return i}},EWo=class{constructor(t){this.promise_=Promise.reject(t)}getPromise(){return this.promise_}cancel(t=!1){}};(function(r){r[r.NO_ERROR=0]="NO_ERROR",r[r.NETWORK_ERROR=1]="NETWORK_ERROR",r[r.ABORT=2]="ABORT"})(V8e||(V8e={}));CWo=class{constructor(t,n,i,o,s,a,u,p,c,l,d,f=!0,h=!1){this.url_=t,this.method_=n,this.headers_=i,this.body_=o,this.successCodes_=s,this.additionalRetryCodes_=a,this.callback_=u,this.errorCallback_=p,this.timeout_=c,this.progressCallback_=l,this.connectionFactory_=d,this.retry=f,this.isUsingEmulator=h,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((m,E)=>{this.resolve_=m,this.reject_=E,this.start_()})}start_(){let t=(i,o)=>{if(o){i(!1,new xet(!1,null,!0));return}let s=this.connectionFactory_();this.pendingConnection_=s;let a=u=>{let p=u.loaded,c=u.lengthComputable?u.total:-1;this.progressCallback_!==null&&this.progressCallback_(p,c)};this.progressCallback_!==null&&s.addUploadProgressListener(a),s.send(this.url_,this.method_,this.isUsingEmulator,this.body_,this.headers_).then(()=>{this.progressCallback_!==null&&s.removeUploadProgressListener(a),this.pendingConnection_=null;let u=s.getErrorCode()===V8e.NO_ERROR,p=s.getStatus();if(!u||Ezc(p,this.additionalRetryCodes_)&&this.retry){let l=s.getErrorCode()===V8e.ABORT;i(!1,new xet(!1,null,l));return}let c=this.successCodes_.indexOf(p)!==-1;i(!0,new xet(c,s))})},n=(i,o)=>{let s=this.resolve_,a=this.reject_,u=o.connection;if(o.wasSuccessCode)try{let p=this.callback_(u,u.getResponse());Ylh(p)?s(p):s()}catch(p){a(p)}else if(u!==null){let p=RWo();p.serverResponse=u.getErrorText(),this.errorCallback_?a(this.errorCallback_(u,p)):a(p)}else if(o.canceled){let p=this.appDelete_?Azc():mzc();a(p)}else{let p=gzc();a(p)}};this.canceled_?n(!1,new xet(!1,null,!0)):this.backoffId_=Klh(t,n,this.timeout_)}getPromise(){return this.promise_}cancel(t){this.canceled_=!0,this.appDelete_=t||!1,this.backoffId_!==null&&$lh(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}},xet=class{constructor(t,n,i){this.wasSuccessCode=t,this.connection=n,this.canceled=!!i}};IL={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"},wPt=class{constructor(t,n){this.data=t,this.contentType=n||null}};BIr=class{constructor(t){this.base64=!1,this.contentType=null;let n=t.match(/^data:([^,]+)?,/);if(n===null)throw Pet(IL.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");let i=n[1]||null;i!=null&&(this.base64=pph(i,";base64"),this.contentType=this.base64?i.substring(0,i.length-7):i),this.rest=t.substring(t.indexOf(",")+1)}};Met=class r{constructor(t,n){let i=0,o="";azc(t)?(this.data_=t,i=t.size,o=t.type):t instanceof ArrayBuffer?(n?this.data_=new Uint8Array(t):(this.data_=new Uint8Array(t.byteLength),this.data_.set(new Uint8Array(t))),i=this.data_.length):t instanceof Uint8Array&&(n?this.data_=t:(this.data_=new Uint8Array(t.length),this.data_.set(t)),i=t.length),this.size_=i,this.type_=o}size(){return this.size_}type(){return this.type_}slice(t,n){if(azc(this.data_)){let i=this.data_,o=sph(i,t,n);return o===null?null:new r(o)}else{let i=new Uint8Array(this.data_.buffer,t,n-t);return new r(i,!0)}}static getBlob(...t){if(_Wo()){let n=t.map(i=>i instanceof r?i.data_:i);return new r(oph.apply(null,n))}else{let n=t.map(a=>qIr(a)?wWo(IL.RAW,a).data:a.data_),i=0;n.forEach(a=>{i+=a.byteLength});let o=new Uint8Array(i),s=0;return n.forEach(a=>{for(let u=0;u<a.length;u++)o[s++]=a[u]}),new r(o,!0)}}uploadData(){return this.data_}};nw=class{constructor(t,n,i,o){this.server=t,this.local=n||t,this.writable=!!i,this.xform=o||hph}},kIr=null;uzc="prefixes",czc="items";sU=class{constructor(t,n,i,o){this.url=t,this.method=n,this.handler=i,this.timeout=o,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}};Net=class{constructor(t,n,i,o){this.current=t,this.total=n,this.finalized=!!i,this.metadata=o||null}};lzc=256*1024;Ozc={STATE_CHANGED:"state_changed"},L4={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};vWo=class{constructor(t,n,i){if(Jlh(t)||n!=null||i!=null)this.next=t,this.error=n??void 0,this.complete=i??void 0;else{let s=t;this.next=s.next,this.error=s.error,this.complete=s.complete}}};pzc=null,LIr=class{constructor(){this.errorText_="",this.sent_=!1,this.errorCode_=V8e.NO_ERROR}async send(t,n,i,o,s){if(this.sent_)throw wet("cannot .send() more than once");this.sent_=!0;try{let a=await Dph(t,n,i,s,o);this.headers_=a.headers,this.statusCode_=a.status,this.errorCode_=V8e.NO_ERROR,this.body_=await a.arrayBuffer()}catch(a){this.errorText_=a?.message,this.statusCode_=0,this.errorCode_=V8e.NETWORK_ERROR}}getErrorCode(){if(this.errorCode_===void 0)throw wet("cannot .getErrorCode() before receiving response");return this.errorCode_}getStatus(){if(this.statusCode_===void 0)throw wet("cannot .getStatus() before receiving response");return this.statusCode_}getErrorText(){return this.errorText_}abort(){}getResponseHeader(t){if(!this.headers_)throw wet("cannot .getResponseHeader() before receiving response");return this.headers_.get(t)}addUploadProgressListener(t){}removeUploadProgressListener(t){}},TWo=class extends LIr{getResponse(){if(!this.body_)throw wet("cannot .getResponse() before receiving response");return Buffer.from(this.body_).toString("utf-8")}};IWo=class extends LIr{getResponse(){if(!this.body_)throw wet("cannot .getResponse() before sending");return this.body_}};xPt=class{isExponentialBackoffExpired(){return this.sleepTime>this.maxSleepTime}constructor(t,n,i=null){this._transferred=0,this._needToFetchStatus=!1,this._needToFetchMetadata=!1,this._observers=[],this._error=void 0,this._uploadUrl=void 0,this._request=void 0,this._chunkMultiplier=1,this._resolve=void 0,this._reject=void 0,this._ref=t,this._blob=n,this._metadata=i,this._mappings=FIr(),this._resumable=this._shouldDoResumable(this._blob),this._state="running",this._errorHandler=o=>{if(this._request=void 0,this._chunkMultiplier=1,o._codeEquals(b2.CANCELED))this._needToFetchStatus=!0,this.completeTransitions_();else{let s=this.isExponentialBackoffExpired();if(Ezc(o.status,[]))if(s)o=gzc();else{this.sleepTime=Math.max(this.sleepTime*2,Llh),this._needToFetchStatus=!0,this.completeTransitions_();return}this._error=o,this._transition("error")}},this._metadataErrorHandler=o=>{this._request=void 0,o._codeEquals(b2.CANCELED)?this.completeTransitions_():(this._error=o,this._transition("error"))},this.sleepTime=0,this.maxSleepTime=this._ref.storage.maxUploadRetryTime,this._promise=new Promise((o,s)=>{this._resolve=o,this._reject=s,this._start()}),this._promise.then(null,()=>{})}_makeProgressCallback(){let t=this._transferred;return n=>this._updateProgress(t+n)}_shouldDoResumable(t){return t.size()>256*1024}_start(){this._state==="running"&&this._request===void 0&&(this._resumable?this._uploadUrl===void 0?this._createResumable():this._needToFetchStatus?this._fetchStatus():this._needToFetchMetadata?this._fetchMetadata():this.pendingTimeout=setTimeout(()=>{this.pendingTimeout=void 0,this._continueUpload()},this.sleepTime):this._oneShotUpload())}_resolveToken(t){Promise.all([this._ref.storage._getAuthToken(),this._ref.storage._getAppCheckToken()]).then(([n,i])=>{switch(this._state){case"running":t(n,i);break;case"canceling":this._transition("canceled");break;case"pausing":this._transition("paused");break}})}_createResumable(){this._resolveToken((t,n)=>{let i=xph(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),o=this._ref.storage._makeRequest(i,vte,t,n);this._request=o,o.getPromise().then(s=>{this._request=void 0,this._uploadUrl=s,this._needToFetchStatus=!1,this.completeTransitions_()},this._errorHandler)})}_fetchStatus(){let t=this._uploadUrl;this._resolveToken((n,i)=>{let o=Pph(this._ref.storage,this._ref._location,t,this._blob),s=this._ref.storage._makeRequest(o,vte,n,i);this._request=s,s.getPromise().then(a=>{a=a,this._request=void 0,this._updateProgress(a.current),this._needToFetchStatus=!1,a.finalized&&(this._needToFetchMetadata=!0),this.completeTransitions_()},this._errorHandler)})}_continueUpload(){let t=lzc*this._chunkMultiplier,n=new Net(this._transferred,this._blob.size()),i=this._uploadUrl;this._resolveToken((o,s)=>{let a;try{a=Mph(this._ref._location,this._ref.storage,i,this._blob,t,this._mappings,n,this._makeProgressCallback())}catch(p){this._error=p,this._transition("error");return}let u=this._ref.storage._makeRequest(a,vte,o,s,!1);this._request=u,u.getPromise().then(p=>{this._increaseMultiplier(),this._request=void 0,this._updateProgress(p.current),p.finalized?(this._metadata=p.metadata,this._transition("success")):this.completeTransitions_()},this._errorHandler)})}_increaseMultiplier(){lzc*this._chunkMultiplier*2<32*1024*1024&&(this._chunkMultiplier*=2)}_fetchMetadata(){this._resolveToken((t,n)=>{let i=Izc(this._ref.storage,this._ref._location,this._mappings),o=this._ref.storage._makeRequest(i,vte,t,n);this._request=o,o.getPromise().then(s=>{this._request=void 0,this._metadata=s,this._transition("success")},this._metadataErrorHandler)})}_oneShotUpload(){this._resolveToken((t,n)=>{let i=wph(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),o=this._ref.storage._makeRequest(i,vte,t,n);this._request=o,o.getPromise().then(s=>{this._request=void 0,this._metadata=s,this._updateProgress(this._blob.size()),this._transition("success")},this._errorHandler)})}_updateProgress(t){let n=this._transferred;this._transferred=t,this._transferred!==n&&this._notifyObservers()}_transition(t){if(this._state!==t)switch(t){case"canceling":case"pausing":this._state=t,this._request!==void 0?this._request.cancel():this.pendingTimeout&&(clearTimeout(this.pendingTimeout),this.pendingTimeout=void 0,this.completeTransitions_());break;case"running":let n=this._state==="paused";this._state=t,n&&(this._notifyObservers(),this._start());break;case"paused":this._state=t,this._notifyObservers();break;case"canceled":this._error=mzc(),this._state=t,this._notifyObservers();break;case"error":this._state=t,this._notifyObservers();break;case"success":this._state=t,this._notifyObservers();break}}completeTransitions_(){switch(this._state){case"pausing":this._transition("paused");break;case"canceling":this._transition("canceled");break;case"running":this._start();break}}get snapshot(){let t=bWo(this._state);return{bytesTransferred:this._transferred,totalBytes:this._blob.size(),state:t,metadata:this._metadata,task:this,ref:this._ref}}on(t,n,i,o){let s=new vWo(n||void 0,i||void 0,o||void 0);return this._addObserver(s),()=>{this._removeObserver(s)}}then(t,n){return this._promise.then(t,n)}catch(t){return this.then(null,t)}_addObserver(t){this._observers.push(t),this._notifyObserver(t)}_removeObserver(t){let n=this._observers.indexOf(t);n!==-1&&this._observers.splice(n,1)}_notifyObservers(){this._finishPromise(),this._observers.slice().forEach(n=>{this._notifyObserver(n)})}_finishPromise(){if(this._resolve!==void 0){let t=!0;switch(bWo(this._state)){case L4.SUCCESS:_et(this._resolve.bind(null,this.snapshot))();break;case L4.CANCELED:case L4.ERROR:let n=this._reject;_et(n.bind(null,this._error))();break;default:t=!1;break}t&&(this._resolve=void 0,this._reject=void 0)}}_notifyObserver(t){switch(bWo(this._state)){case L4.RUNNING:case L4.PAUSED:t.next&&_et(t.next.bind(t,this.snapshot))();break;case L4.SUCCESS:t.complete&&_et(t.complete.bind(t))();break;case L4.CANCELED:case L4.ERROR:t.error&&_et(t.error.bind(t,this._error))();break;default:t.error&&_et(t.error.bind(t,this._error))()}}resume(){let t=this._state==="paused"||this._state==="pausing";return t&&this._transition("running"),t}pause(){let t=this._state==="running";return t&&this._transition("pausing"),t}cancel(){let t=this._state==="running"||this._state==="pausing";return t&&this._transition("canceling"),t}};Det=class r{constructor(t,n){this._service=t,n instanceof fN?this._location=n:this._location=fN.makeFromUrl(n,t.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(t,n){return new r(t,n)}get root(){let t=new fN(this._location.bucket,"");return this._newRef(this._service,t)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return vzc(this._location.path)}get storage(){return this._service}get parent(){let t=dph(this._location.path);if(t===null)return null;let n=new fN(this._location.bucket,t);return new r(this._service,n)}_throwIfRoot(t){if(this._location.path==="")throw OWo(t)}};PPt=class{constructor(t,n,i,o,s,a=!1){this.app=t,this._authProvider=n,this._appCheckProvider=i,this._url=o,this._firebaseVersion=s,this._isUsingEmulator=a,this._bucket=null,this._host=fzc,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=klh,this._maxUploadRetryTime=Blh,this._requests=new Set,o!=null?this._bucket=fN.makeFromBucketSpec(o,this._host):this._bucket=dzc(this._host,this.app.options)}get host(){return this._host}set host(t){this._host=t,this._url!=null?this._bucket=fN.makeFromBucketSpec(this._url,t):this._bucket=dzc(t,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(t){SWo("time",0,Number.POSITIVE_INFINITY,t),this._maxUploadRetryTime=t}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(t){SWo("time",0,Number.POSITIVE_INFINITY,t),this._maxOperationRetryTime=t}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;let t=this._authProvider.getImmediate({optional:!0});if(t){let n=await t.getToken();if(n!==null)return n.accessToken}return null}async _getAppCheckToken(){if(y2(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;let t=this._appCheckProvider.getImmediate({optional:!0});return t?(await t.getToken()).token:null}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach(t=>t.cancel()),this._requests.clear()),Promise.resolve()}_makeStorageReference(t){return new Det(this,t)}_makeRequest(t,n,i,o,s=!0){if(this._deleted)return new EWo(Azc());{let a=nph(t,this._appId,i,o,n,this._firebaseVersion,s,this._isUsingEmulator);return this._requests.add(a),a.getPromise().then(()=>this._requests.delete(a),()=>this._requests.delete(a)),a}}async makeRequestWithTokens(t,n){let[i,o]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(t,n,i,o).getPromise()}},Wph="@firebase/storage",Vph="0.13.14";Kph="storage";Yph()});function Uzc(r){return/^[A-Za-z]+:\/\//.test(r)}function edh(r,{instanceIdentifier:t}){let n=r.getProvider("app-compat").getImmediate(),i=r.getProvider("storage").getImmediate({identifier:t});return new GIr(n,i)}function tdh(r){let t={TaskState:L4,TaskEvent:Ozc,StringFormat:IL,Storage:GIr,Reference:$8e};r.INTERNAL.registerComponent(new gA(Zph,edh,"PUBLIC").setServiceProps(t).setMultipleInstances(!0)),r.registerVersion(Jph,Xph)}var Bet,jIr,QIr,$8e,GIr,Jph,Xph,Zph,jzc=z(()=>{N6e();NWo();hL();Bet=class{constructor(t,n,i){this._delegate=t,this.task=n,this.ref=i}get bytesTransferred(){return this._delegate.bytesTransferred}get metadata(){return this._delegate.metadata}get state(){return this._delegate.state}get totalBytes(){return this._delegate.totalBytes}};jIr=class{constructor(t,n){this._delegate=t,this._ref=n,this.cancel=this._delegate.cancel.bind(this._delegate),this.catch=this._delegate.catch.bind(this._delegate),this.pause=this._delegate.pause.bind(this._delegate),this.resume=this._delegate.resume.bind(this._delegate)}get snapshot(){return new Bet(this._delegate.snapshot,this,this._ref)}then(t,n){return this._delegate.then(i=>{if(t)return t(new Bet(i,this,this._ref))},n)}on(t,n,i,o){let s;return n&&(typeof n=="function"?s=a=>n(new Bet(a,this,this._ref)):s={next:n.next?a=>n.next(new Bet(a,this,this._ref)):void 0,complete:n.complete||void 0,error:n.error||void 0}),this._delegate.on(t,s,i||void 0,o||void 0)}},QIr=class{constructor(t,n){this._delegate=t,this._service=n}get prefixes(){return this._delegate.prefixes.map(t=>new $8e(t,this._service))}get items(){return this._delegate.items.map(t=>new $8e(t,this._service))}get nextPageToken(){return this._delegate.nextPageToken||null}};$8e=class r{constructor(t,n){this._delegate=t,this.storage=n}get name(){return this._delegate.name}get bucket(){return this._delegate.bucket}get fullPath(){return this._delegate.fullPath}toString(){return this._delegate.toString()}child(t){let n=Fzc(this._delegate,t);return new r(n,this.storage)}get root(){return new r(this._delegate.root,this.storage)}get parent(){let t=this._delegate.parent;return t==null?null:new r(t,this.storage)}put(t,n){return this._throwIfRoot("put"),new jIr(UIr(this._delegate,t,n),this)}putString(t,n=IL.RAW,i){this._throwIfRoot("putString");let o=wWo(n,t),s=Object.assign({},i);return s.contentType==null&&o.contentType!=null&&(s.contentType=o.contentType),new jIr(new xPt(this._delegate,new Met(o.data,!0),s),this)}listAll(){return Bzc(this._delegate).then(t=>new QIr(t,this.storage))}list(t){return kzc(this._delegate,t||void 0).then(n=>new QIr(n,this.storage))}getMetadata(){return Nzc(this._delegate)}updateMetadata(t){return Dzc(this._delegate,t)}getDownloadURL(){return Lzc(this._delegate)}delete(){return this._throwIfRoot("delete"),qzc(this._delegate)}_throwIfRoot(t){if(this._delegate._location.path==="")throw OWo(t)}};GIr=class{constructor(t,n){this.app=t,this._delegate=n}get maxOperationRetryTime(){return this._delegate.maxOperationRetryTime}get maxUploadRetryTime(){return this._delegate.maxUploadRetryTime}ref(t){if(Uzc(t))throw K8e("ref() expected a child path but got a URL, use refFromURL instead.");return new $8e(NPt(this._delegate,t),this)}refFromURL(t){if(!Uzc(t))throw K8e("refFromURL() expected a full URL but got a child path, use ref() instead.");try{fN.makeFromUrl(t,this._delegate.host)}catch{throw K8e("refFromUrl() expected a valid full URL but got an invalid one.")}return new $8e(NPt(this._delegate,t),this)}setMaxUploadRetryTime(t){this._delegate.maxUploadRetryTime=t}setMaxOperationRetryTime(t){this._delegate.maxOperationRetryTime=t}useEmulator(t,n,i={}){zzc(this._delegate,t,n,i)}};Jph="@firebase/storage-compat",Xph="0.3.24";Zph="storage-compat";tdh(uh)});var HIr=z(()=>{jzc()});var Qzc=z(()=>{IIr();q0e();w6();hL();M6e()});var Gzc=z(()=>{Qzc()});var rdh,ndh,oCe=z(()=>{N6e();N6e();rdh="firebase",ndh="11.10.0";uh.registerVersion(rdh,ndh,"app-compat")});var Hzc=z(()=>{FFo()});function sdh(){let r,t;return{promise:new Promise((n,i)=>{r=n,t=i}),resolve:r,reject:t}}function adh(r,t){return[...r,t]}function udh(r,t){return[...r.slice(0,t),...r.slice(t+1)]}function cdh(r,t){let n=r.indexOf(t);return n!==-1?udh(r,n):r}var Wzc,DWo,idh,odh,WIr,kWo=z(()=>{DWo=new WeakMap,idh=()=>{},odh=class sCe{constructor(t){this.subscribers=[],this.settlement=null,this[Wzc]="Unpromise",t instanceof Promise?this.promise=t:this.promise=new Promise(t),this.promise.then(n=>{let{subscribers:i}=this;this.subscribers=null,this.settlement={status:"fulfilled",value:n},i?.forEach(({resolve:o})=>{o(n)})}).catch(n=>{let{subscribers:i}=this;this.subscribers=null,this.settlement={status:"rejected",reason:n},i?.forEach(({reject:o})=>{o(n)})})}subscribe(){let t,n,{settlement:i}=this;if(i===null){if(this.subscribers===null)throw new Error("Unpromise settled but still has subscribers");let o=sdh();this.subscribers=adh(this.subscribers,o),t=o.promise,n=()=>{this.subscribers!==null&&(this.subscribers=cdh(this.subscribers,o))}}else{let{status:o}=i;o==="fulfilled"?t=Promise.resolve(i.value):t=Promise.reject(i.reason),n=idh}return Object.assign(t,{unsubscribe:n})}then(t,n){let i=this.subscribe(),{unsubscribe:o}=i;return Object.assign(i.then(t,n),{unsubscribe:o})}catch(t){let n=this.subscribe(),{unsubscribe:i}=n;return Object.assign(n.catch(t),{unsubscribe:i})}finally(t){let n=this.subscribe(),{unsubscribe:i}=n;return Object.assign(n.finally(t),{unsubscribe:i})}static proxy(t){let n=sCe.getSubscribablePromise(t);return typeof n<"u"?n:sCe.createSubscribablePromise(t)}static createSubscribablePromise(t){let n=new sCe(t);return DWo.set(t,n),DWo.set(n,n),n}static getSubscribablePromise(t){return DWo.get(t)}static resolve(t){return sCe.proxy(t).subscribe()}static async any(t){let n=t.map(sCe.resolve);try{return await Promise.any(n)}finally{n.forEach(({unsubscribe:i})=>{i()})}}static async race(t){let n=t.map(sCe.resolve);try{return await Promise.race(n)}finally{n.forEach(({unsubscribe:i})=>{i()})}}static async raceSingletons(t){let n=t.map(i=>sCe.proxy(i).then(()=>[i]));try{return await Promise.race(n)}finally{for(let i of n)i.unsubscribe()}}};Wzc=Symbol.toStringTag;WIr=odh});var Y8e,TR,ldh,Vzc=z(()=>{"use strict";kWo();ur();rTt();Y8e=class extends Ke{},TR=async(r,t,n)=>{let i=ldh(r),o=i.promise.then(()=>{throw new Y8e(t)});return await WIr.race([n,o]).finally(i.cancel)},ldh=r=>{let t=P_(),n=setTimeout(t.resolve,r),i=()=>clearTimeout(n);return{promise:t.promise,cancel:i}}});var ND2,Kzc=z(()=>{"use strict";ND2=global.setImmediate??setTimeout});var vfe=z(()=>{"use strict";Vzc();Kzc()});var xV,DPt=z(()=>{"use strict";xV=(()=>{let r=o=>{if(typeof window<"u"){let s=window[o];if(typeof s=="string"&&s)return s}return process.env[o]},t=r("FIREBASE_AUTH_EMULATOR_HOST"),n=r("FIRESTORE_EMULATOR_HOST"),i=r("FIREBASE_STORAGE_EMULATOR_HOST");if(!!t!=!!n||!!t!=!!i||!!n!=!!i)throw new Error(`Inconsistent Firebase emulator use! All three emulators must be used, or none! auth=${t} firestore=${n} storage=${i}`);return t&&n&&i?{auth:t.startsWith("http")?t:`http://${t}`,firestore:n,storage:i}:null})()});var pdh,$zc,Yzc=z(()=>{"use strict";Xr();ru();pdh=py({auth:bd(),firestore:bd(),storage:bd()}),$zc=Pr("FirebaseEmulatorInfo",pdh)});async function mdh(r,t){let n=uh.initializeApp(r,t);if(n.automaticDataCollectionEnabled=!1,kC()){let i=LWo(n);i._setSettings({...i._getSettings(),localCache:yIc({garbageCollector:mIc()})})}if(!hdh(n,!kC())&&!kC()&&Pbe(!1,"proxyFirestore")){let i=await qWo(r);kPt.info(`Using Firestore proxy host: ${i}`),n.firestore().settings({host:i})}}function Xzc(){return uh.app().options}var kPt,LWo,ddh,fdh,BWo,hdh,gdh,Jzc,qWo,ydh,Zzc,eUc,Tfe=z(()=>{"use strict";xIr();ete();DIr();HIr();Gzc();oCe();Hzc();Zzo();ur();vfe();Xt();ns();qp();DPt();Yzc();kPt=Ge("FIREBASE"),LWo=r=>r.firestore()._delegate,ddh=r=>r.storage()._delegate,fdh=r=>{let t=/^\w+:\/\//.test(r)?r:`http://${r}`;try{return new URL(t).hostname.replace(/^\[|\]$/g,"")}catch{return r}},BWo=r=>{let t=fdh(r);return t==="127.0.0.1"||t==="localhost"||t==="::1"},hdh=(r,t)=>{let n;if(xV)n=xV;else if("emulatorInfo"in r.options)n=$zc.assert(r.options.emulatorInfo);else return!1;f1().isTest&&(t=!1),BWo(n.firestore)&&BWo(n.storage)&&BWo(n.auth)&&(t=!1),kPt.info(`Using Firebase Auth emulator at ${n.auth}`),typeof window<"u"?H8e(lIr(r),n.auth,{disableWarnings:!0}):r.auth().useEmulator(n.auth),kPt.info(`Using Firestore emulator at ${n.firestore} over ${t?"https":"http"}`);let[i,o]=n.firestore.split(":");if(r.firestore().useEmulator(i,parseInt(o)),t){let u=LWo(r);u._setSettings({...u._getSettings(),ssl:!0})}if(typeof window<"u"){let u=LWo(r);u._setSettings({...u._getSettings(),experimentalForceLongPolling:!0,experimentalAutoDetectLongPolling:!1})}kPt.info(`Using Firebase Storage emulator at ${n.storage} over ${t?"https":"http"}`);let[s,a]=n.storage.split(":");return r.storage().useEmulator(s,parseInt(a)),t&&(ddh(r)._protocol="https"),!0},gdh="[DEFAULT]",Jzc=async(r,t)=>{uh.apps.find(n=>n.name===(t??gdh))||await mdh(r,t)};qWo=r=>{if(r.emulatorInfo)return`http://${r.emulatorInfo.firestore}`;let t=new URL(zWe());return Cd(t.protocol==="https:"&&(t.port==="443"||t.port==="")&&t.pathname==="/",`Unable to specify a firestore proxy host for backend URL ${t}. Only HTTPS with no port and no path is supported.`,"FIREBASE"),`${t.hostname}/firestore`};ydh=uh,Zzc=()=>ydh,eUc=r=>FWe()?Promise.resolve():r.delete().catch(t=>{kPt.error(`Error deleting firebase instance: ${t}`)})});var bdh,Let,tUc,VIr,rUc,nUc,iUc=z(()=>{"use strict";bHo();WC();qp();Tfe();bdh=new Set([408,429,500,502,503,504]),Let=class extends Error{constructor(n,i,o){super(n,o);this.isTransient=i;this.name="FirestoreRunQueryError"}isTransient},tUc=async(r,t)=>{try{return await r()}catch(n){let i=`Firestore runQuery ${t} failed: ${String(n)}`;throw new Let(i,n instanceof TypeError,{cause:n})}},VIr=r=>{if(r===void 0)return{};if(r.mapValue!==void 0){let t={};if(r.mapValue.fields!==void 0)for(let n of Object.keys(r.mapValue.fields))t[n]=VIr(r.mapValue.fields[n]);return t}return r.arrayValue!==void 0?r.arrayValue.values!==void 0?r.arrayValue.values.map(t=>VIr(t)):[]:r.hasOwnProperty("integerValue")?parseInt(r.integerValue):Object.values(r)[0]},rUc=async(r,t)=>{let n=Xzc(),i=n.emulatorInfo?`http://${n.emulatorInfo.firestore}`:"https://firestore.googleapis.com";!kC()&&Pbe(!1,"proxyFirestore")&&(i=`https://${await qWo(n)}`);let o=`projects/${n.projectId}/databases/(default)/documents/orgs/${r}/workspaces/${t}`;return{runQueryUrl:`${i}/v1beta1/${o}:runQuery`,documentsPath:o}},nUc=async(r,t,n)=>{let i=await qc.instance.getFirebaseIDToken(),o=await tUc(()=>fetch(r.runQueryUrl,{method:"POST",headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json"},body:JSON.stringify({structuredQuery:t})}),"request");if(!o.ok)throw new Let(`Firestore runQuery failed with ${o.status} ${o.statusText}`,bdh.has(o.status));if(!o.body)throw new Error("Firestore runQuery returned no response body");let s=new JSe({paths:["$.*"],keepStack:!1}),a=0,u;s.onError=c=>{u=c},s.onValue=({value:c})=>{let l=c?.document;l&&(a+=1,n(l))};let p=o.body.getReader();try{for(;;){let{done:c,value:l}=await tUc(()=>p.read(),"stream");if(c)break;if(l&&s.write(l),u)throw u}s.isEnded||s.end()}finally{p.releaseLock()}if(u)throw u;return a}});var KIr,FWo=z(()=>{"use strict";la();KIr=async r=>{let t=await r.macros.select();return lde(t,"id")}});var zWo,UWo,YIr,$Ir,Edh,Sdh,Cdh,vdh,Tdh,oUc,sUc,aUc,uUc,cUc,lUc,pUc,dUc=z(()=>{"use strict";la();WC();ns();Xt();SR();ER();hHo();U6();iUc();FWo();zWo=r=>{if(!r?.dropInvalidEntities)return{selectOptions:r,failedEntityIDs:new Set};let{onDataTransformError:t}=r,n=new Set;return{failedEntityIDs:n,selectOptions:{...r,onDataTransformError:(i,o)=>{n.add(i.slice(i.lastIndexOf("/")+1)),t?.(i,o)}}}},UWo=(r,t)=>r.id!==null&&r.id!==void 0&&!t.has(String(r.id)),YIr=async(r,t,n)=>{let{selectOptions:i,failedEntityIDs:o}=zWo(t),s=X2r,a={},u=0,p=0,c;for(;;){let l=await r.nodes.select({limit:s,startingFrom:c,orderBy:[]},i);p+=1;for(let d of l)t?.dropInvalidEntities&&!UWo(d,o)||(a[d.id]={operation:MGo(d)},u+=1);if(n?.({pageNumber:p,pageSize:l.length,nodeCount:u}),l.length<s)break;if(c=l[l.length-1].id,c==null)throw new Error("Cannot paginate nodes past an entity with no id")}return a},$Ir="[streamNodesViaRestApi]",Edh="streamNodesViaRestApi()",Sdh=4,Cdh=2,vdh=Ge("WORKSPACES"),Tdh=(r,t)=>({from:[{collectionId:"steps",allDescendants:!1}],orderBy:[{field:{fieldPath:"__name__"}}],limit:X2r,...t!==void 0&&{startAt:{values:[{referenceValue:`${r}/steps/${t}`}],before:!1}}}),oUc=async(r,t,n,i={})=>{let{fetchOptions:o,onPageFetched:s,monitor:a,logContext:u}=i,{selectOptions:p,failedEntityIDs:c}=zWo(o),l=n.workspace(t).nodes,d=await rUc(r,t),f=_=>a?.logMemorySnapshot(u??{orgID:r,workspaceID:t},_,Edh),h={},m=0,E=0,C,T=_=>{let R=_.name.slice(_.name.lastIndexOf("/")+1);C=R;let D=VIr({mapValue:{fields:_.fields}}),L=l.convertFromRestAPIStorage({...D,id:R},R,p);o?.dropInvalidEntities&&!UWo(L,c)||(h[R]={operation:MGo(L)},m+=1)};for(;;){f(`${$Ir} Page ${E+1} before request`);let _=C,R=0,D=await A0(()=>nUc(d,Tdh(d.documentsPath,C),L=>{R+=1,T(L)}),Sdh,vdh,u??{orgID:r,workspaceID:t},{retryStrategy:{name:"backoff",base:Cdh},checkError:L=>L instanceof Let&&L.isTransient?void 0:L,customErrorOnRetry:L=>[String(L)],customErrorOnFailure:L=>[String(L)],logOnRetry:`${$Ir} Retrying page ${E+1}`,retryLogLevel:"info",logOnFailure:`${$Ir} Page ${E+1} failed`,failureLogLevel:"error"});if(E+=1,f(`${$Ir} Page ${E} streamed (${R} documents, ${m} nodes)`),s?.({pageNumber:E,pageSize:R,nodeCount:m}),D<X2r)break;if(C===_)throw new Error("Cannot paginate nodes past a document with no name")}return h},sUc=async r=>{let t=await r.subgraphs.select();return CTr(lde(t,"id"))},aUc=async r=>{let t=await r.jobs.select();return lde(t,"id")},uUc=async(r,t)=>{let{selectOptions:n,failedEntityIDs:i}=zWo(t),o=await r.nodeTypes.select(void 0,n),s=t?.dropInvalidEntities?o.filter(a=>UWo(a,i)):o;return lde(s,"id")},cUc=async(r,t)=>{let n=await r.workspaceUsers.select();return{[t]:lde(n,"id")}},lUc=async r=>{let t=await r.installedPackages.select();return lde(t,"id")},pUc=async r=>{let t=await r.fetch();return{locations:aPt(t),defaultStorageMapping:t.defaultStorageMapping}}});var jWo=z(()=>{"use strict";Gqc();dUc()});var QWo,t82,fUc,JIr,XIr,hUc,ZIr,qet,gUc,PV=z(()=>{"use strict";ete();la();ur();zIc();cRc();pRc();Xt();WC();SPc();Xjo();ns();yA();so();xbe();Yu();z6();qm();EL();bTr();lte();ER();F6();Wd();E3();U6();Qqc();jWo();jWo();QWo=Ge("FIREBASE"),t82=Ge("GIT"),fUc=Ge("WORKSPACES"),JIr=r=>({...hUc({},{},{},{},B8e(r),r),defaultStorageMapping:null,locations:{},installedPackages:{}}),XIr=r=>hUc({},{},{},{},{},r),hUc=(r,t,n,i,o,s)=>({steps:r,folders:t,jobs:n,macros:i,stepTypes:o,platformKind:s}),ZIr=(r,t,n,i,o,s="repository")=>{let a="[getAllWorkspaceDataFromRepository]",u=t.id,p={orgID:u,workspaceID:r,...o};return A0(async()=>Wh(a,p,"WORKSPACES",async()=>{let l="getAllWorkspaceDataFromRepository()";n.logMemorySnapshot(p,`${a} Before workspace data loading`,l);let d=t.workspace(r),f=i?{ignoreDataTransformErrors:!0}:void 0,h=await pUc(d),[m,E,C,T,_]=await Promise.all([sUc(d),aUc(d),KIr(d),cUc(d,r),lUc(d)]);n.logMemorySnapshot(p,`${a} Small collections loaded`,l);let R=await uUc(d,f);n.logMemorySnapshot(p,`${a} Node types loaded`,l);let D=({pageNumber:U,nodeCount:Q})=>n.logMemorySnapshot(p,`${a} Nodes page ${U} loaded (${Q} nodes)`,l),L=s==="stream"?await oUc(u,r,t,{fetchOptions:f,onPageFetched:D,monitor:n,logContext:p}):await YIr(d,f,D),F={folders:m,jobs:E,macros:C,stepTypes:R,userConnections:T,locations:h.locations,installedPackages:_,steps:L};return n.logMemorySnapshot(p,`${a} Workspace data loading completed`,l),fUc.infoContext(p,`${a} Loaded workspace data - Steps: ${Object.keys(F.steps).length}, Step types: ${Object.keys(F.stepTypes).length}, Users: ${Object.keys(F.userConnections||{}).length}`),F},"info"),3,QWo,p,{retryStrategy:{name:"nowait"},logOnRetry:`${a} retrying`,logOnFailure:`${a} failed, exhausted allotted retry attempts`})},qet=async(r,t,n,i,o="repository")=>{let{steps:s,...a}=await ZIr(r,t,n,void 0,i,o);return{steps:ew(s),...a}},gUc=async(r,t,n,i)=>{let o=r.id,s=h6e(o,n,t);(i?.connectionKind==="snowflake"||i?.connectionKind===void 0)&&mg("CONNECTION",!!i&&mUc(i),{orgID:o,userID:t},"is valid user connection data on save"),QWo.appContext({orgID:o,userID:t,workspaceID:n},`Modifying user connection for user ${t} / team ${o} / workspace ${n}`,i);let a=jBo.parse({id:t,version:1,...GI(i,["createdAt","updatedAt","createdBy","updatedBy","id"])});try{await r.workspace(n).workspaceUser(t).save(a)}catch(u){if(u instanceof $u){QWo.infoContext({orgID:o,userID:t,workspaceID:n},"Failed to save workspace user entity. Creating one instead.",a,u),await r.workspace(n).workspaceUsers.createEntity(a);return}throw u}try{if(vxt.getInstance().isInitialized()&&!await r.workspace(n).isDevEnv()){let u=lRc(a);await vxt.getInstance().updateEnvironmentCredentials(n,u)}}catch(u){fUc.errorContext(s,"Issue with updating Scheduled Job credentials",u)}}});var yUc,Idh,Rdh,Odh,_dh,wdh,xdh,Pdh,Mdh,mUc,aCe,uCe,AUc=z(()=>{"use strict";ur();hA();Xt();fL();ru();PV();nEr();yUc=Ge("CONNECTION"),Idh=R4("UserConnectionType",vbc),Rdh=(r,t)=>Qh({snowflake:()=>Pdh(t),databricks:()=>xdh(t),fabric:()=>wdh(t),bigquery:()=>_dh(t)},r,"CreateDefaultUserConnection"),Odh=(r,t)=>({connectionType:r,connectionDetails:{userID:t,clientEmail:""},connectionKind:"bigquery"}),_dh=r=>Odh("ServiceAccount",r),wdh=(r,t="oauth")=>({connectionKind:"fabric",connectionType:t,connectionDetails:{userID:r,connectionString:""}}),xdh=r=>({connectionType:"Cloud",connectionDetails:{userID:r,path:""},connectionKind:"databricks"}),Pdh=r=>Mdh("Cloud",r,"",""),Mdh=(r,t,n,i)=>({connectionType:r,connectionDetails:{user:n,role:i,userID:t,warehouse:""},connectionKind:"snowflake"}),mUc=r=>Idh.is(r),aCe=async(r,t)=>{try{let n=await r.fetch({retryOptions:{attempts:3,tags:["[GetUserConnectionInfoByEnvironment]"],waitSeconds:60}}),i=oXe(n.connectionKind,n,{snowflake:o=>({connectionType:o.connectionType,connectionDetails:{user:o.connectionDetails?.user??"",userID:o.connectionDetails?.userID??"",role:o.connectionDetails?.role,warehouse:o.connectionDetails?.warehouse}}),databricks:o=>({connectionKind:"databricks",connectionType:o.connectionType,connectionDetails:{path:o.connectionDetails?.path??"",userID:o.connectionDetails?.userID??""}}),fabric:o=>({connectionKind:"fabric",connectionType:"oauth",connectionDetails:{connectionString:o.connectionDetails?.connectionString,userID:o.connectionDetails?.userID??""}}),bigquery:o=>({connectionKind:"bigquery",connectionType:o.connectionType,connectionDetails:{userID:o.connectionDetails?.userID??"",clientEmail:o.connectionDetails?.clientEmail??""}})},"GetUserConnectionInfoByEnvironment");return yUc.infoContext(t,"User Connection found,","kind:",i.connectionKind??"snowflake","type:",i.connectionType),i}catch(n){throw yUc.errorContext(t,"Error getting user connection info",n),n instanceof $u?new _i("Invalid Connection Information, environment or connection does not exist. Please check that the environmentID is valid, and contains a valid connection.",`environmentID: ${t.workspaceID}: ${n.detail||n.message}`):n}},uCe=async(r,t)=>{try{await r.fetch()}catch(n){if(n instanceof $u){let{id:i,parent:{id:o,parent:s}}=r,a=BEe(t,{snowflake:p=>p.snowflakeAuthType,databricks:p=>p.databricksAuthType,fabric:p=>p.fabricAuthType,bigquery:p=>p.bigQueryAuthType},"writeBasicUserConnectionIfNoneExists");if(a==="WorkspaceUserDefault")throw new Ke("Unexpected connection type 'WorkspaceUserDefault'");let u={...Rdh(t.platformKind??"snowflake",i),...a&&{connectionType:a}};await gUc(s,i,o,u)}else throw n}}});var BPt,eRr,bUc,EUc,tRr=z(()=>{"use strict";BPt=r=>typeof r=="object"&&r instanceof Error&&"code"in r&&(typeof r.code=="string"||typeof r.code=="number")&&"name"in r&&typeof r.name=="string",eRr=r=>BPt(r)&&(r.name==="NetworkError"||r.code===401001),bUc=r=>BPt(r)&&r.name==="RequestFailedError",EUc=r=>BPt(r)&&r.name==="OperationFailedError"});var Ndh,Ite,rRr,Ife,aU,LPt=z(()=>{"use strict";ur();tRr();eEr();Ndh=new Set(["42","22","23","0A","44"]),Ite=class extends xEe{constructor(t,n,i){super(t,n,i)}},rRr=class extends km{constructor(n){super("Could not identify the initial warehouse - possibly invalid credentials or warehouse");this.warehouse=n}warehouse;statusCode(){return 400}toTRunError(){let n=this.warehouse?`Tried to set a warehouse of ${this.warehouse}`:"Did not set a warehouse";return{error:{errorString:this.message,errorDetail:`${n} and snowflake did not indicate a warehouse was used, but it should have`}}}},Ife=class extends Ke{constructor(n){let i="Snowflake execution error",o;typeof n=="object"&&n instanceof Error&&(i=n.message||i,o=n.stack);super(i);this.coalesceCause=n;this.originalStack=o}coalesceCause;originalStack;statusCode(){switch(this.getSnowflakeErrorCode()){case"390189":case"390100":return 401;case"000604":return 499;case"001003":case"002040":default:return 422}}get fault(){let n=this.coalesceCause;return eRr(n)||bUc(n)?"transient":this.isUserCausedFailure()?"client":"system"}isUserCausedFailure(){switch(this.getSnowflakeErrorCode()){case"000604":case"390100":case"390189":case"001003":case"002040":case"002043":case"002003":return!0}let n=this.coalesceCause;return EUc(n)?Ndh.has(String(n.sqlState).slice(0,2)):!1}isCancel(){return this.getSnowflakeErrorCode()==="000604"}getSnowflakeErrorCode(){try{return this.coalesceCause.code??null}catch{return null}}getErrorDetail=()=>{if(this.coalesceCause.name==="OperationFailedError")try{let n=this.coalesceCause.data;if(n)return`name=${this.coalesceCause.name}, code=${this.coalesceCause.code}, data=${JSON.stringify(n)}`}catch{}if(this.coalesceCause.name==="NetworkError")try{let n=this.coalesceCause.coalesceCause;if(n&&n.message)return`name=${this.coalesceCause.name}, code=${this.coalesceCause.code}, cause=${n.message}`}catch{}try{return`name=${this.coalesceCause.name}, code=${this.coalesceCause.code}`}catch{}return""};getErrorData=()=>this.getSnowflakeErrorCode()==="390189"?{errorString:"Role not found or is invalid",errorDetail:this.coalesceCause.message}:{errorString:this.message,errorDetail:this.getErrorDetail()};toTRunError(){return{error:this.getErrorData()}}},aU=class extends Ife{constructor(n,i,o,s,a){super(n);this.options=i;this.requestID=o;this.queryID=s;this.warehouse=a}options;requestID;queryID;warehouse}});var CUc=z(()=>{"use strict";LPt()});var Rte,MV,vUc=z(()=>{"use strict";ur();yA();Yu();Rte=class extends Ke{constructor(n,i){let{errorString:o,errorDetail:s}=ma(i).error;super(o,s);this.query=n;this.coalesceCause=i}query;coalesceCause;isCancel(){return(this.getDatabricksErrorCause()?.includes("The session was closed or has expired")||this.getDatabricksErrorCause()?.includes("canceled"))??!1}getDatabricksErrorCause(){return this.message??null}statusCode(){return this.isCancel()?499:422}},MV=class extends xEe{constructor(t,n,i){super(t,n,i)}}});var TUc=z(()=>{"use strict";vUc()});var yA=z(()=>{"use strict";eEr();AUc();CUc();TUc();nEr()});var kdh,GWo,HWo=z(()=>{"use strict";Xt();qT();q6();tTr();kdh=Ge("STEPS"),GWo=(r,t,n)=>{let i={},o=new Set([t]),s=0,a=new Set,u=new Set([t]);try{for(;u.size>0;){s=s+1,a=u,u=new Set;for(let p of a){o.add(p);let c=n==="predecessors"?r.predecessors(p):r.successors(p);if(c)for(let l of c)i[s]||(i[s]=new Set),!o.has(l)&&(i[s].add(l),u.add(l))}}}catch(p){throw kdh.error(`getSuccessorsOrPredecessorsWithLevels threw an error when getting ${n} for step: ${t}. error:
9463
9463
 
9464
9464
  `,p),p}return i}});var wUc=A((L82,_Uc)=>{"use strict";_Uc.exports=RUc;function RUc(r,t,n){r instanceof RegExp&&(r=IUc(r,n)),t instanceof RegExp&&(t=IUc(t,n));var i=OUc(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 IUc(r,t){var n=t.match(r);return n?n[0]:null}RUc.range=OUc;function OUc(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 LUc=A((q82,BUc)=>{var xUc=wUc();BUc.exports=zdh;var PUc="\0SLASH"+Math.random()+"\0",MUc="\0OPEN"+Math.random()+"\0",KWo="\0CLOSE"+Math.random()+"\0",NUc="\0COMMA"+Math.random()+"\0",DUc="\0PERIOD"+Math.random()+"\0",Bdh=1e5,Ldh=4e6;function WWo(r){return parseInt(r,10)==r?parseInt(r,10):r.charCodeAt(0)}function qdh(r){return r.split("\\\\").join(PUc).split("\\{").join(MUc).split("\\}").join(KWo).split("\\,").join(NUc).split("\\.").join(DUc)}function Fdh(r){return r.split(PUc).join("\\").split(MUc).join("{").split(KWo).join("}").split(NUc).join(",").split(DUc).join(".")}function kUc(r){if(!r)return[""];var t=[],n=xUc("{","}",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=kUc(s);return s.length&&(a[a.length-1]+=u.shift(),a.push.apply(a,u)),t.push.apply(t,a),t}function zdh(r,t){if(!r)return[];t=t||{};var n=t.max==null?Bdh:t.max,i=t.maxLength==null?Ldh:t.maxLength;return r.substr(0,2)==="{}"&&(r="\\{\\}"+r.substr(2)),VWo(qdh(r),n,i,!0).map(Fdh)}function Udh(r){return"{"+r+"}"}function jdh(r){return/^-?0\d/.test(r)}function Qdh(r,t){return r<=t}function Gdh(r,t){return r>=t}function qPt(r,t,n,i,o,s){for(var a=[],u=0,p=0;p<r.length;p++)for(var c=0;c<n.length;c++){if(a.length>=i)return a;var l=r[p]+t+n[c];if(!(s&&!l)){if(u+l.length>o)return a;a.push(l),u+=l.length}}return a}function Hdh(r,t,n,i){var o=r.split(/\.\./),s=[];if(o[0]===void 0||o[1]===void 0)return s;var a=WWo(o[0]),u=WWo(o[1]),p=Math.max(o[0].length,o[1].length),c=o.length===3&&o[2]!==void 0?Math.max(Math.abs(WWo(o[2])),1):1,l=Qdh,d=u<a;d&&(c*=-1,l=Gdh);for(var f=o.some(jdh),h=0,m=a;l(m,u)&&s.length<n;m+=c){var E;if(t)E=String.fromCharCode(m),E==="\\"&&(E="");else if(E=String(m),f){var C=p-E.length;if(C>0){var T=new Array(C+1).join("0");m<0?E="-"+T+E.slice(1):E=T+E}}if(h+E.length>i)break;s.push(E),h+=E.length}return s}function VWo(r,t,n,i){for(var o=[""],s=!1,a=!0;;){let D=xUc("{","}",r);if(!D)return qPt(o,r,[""],t,n,s);let L=D.pre;if(/\$$/.test(L)){if(o=qPt(o,L+"{"+D.body+"}",[""],t,n,s&&!D.post.length),a=!1,!D.post.length)break;r=D.post;continue}var u=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(D.body),p=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(D.body),c=u||p,l=D.body.indexOf(",")>=0;if(!c&&!l){if(D.post.match(/,(?!,).*\}/)){r=D.pre+"{"+D.body+KWo+D.post,i=!0;continue}return qPt(o,L+"{"+D.body+"}"+D.post,[""],t,n,s)}a&&(s=i&&!c,a=!1);var d;if(c)d=Hdh(D.body,p,t,n);else{var f=kUc(D.body);if(f.length===1&&f[0]!==void 0&&(f=VWo(f[0],t,n,!1).map(Udh),f.length===1)){if(o=qPt(o,L+f[0],[""],t,n,s&&!D.post.length),!D.post.length)break;r=D.post;continue}for(var h=s&&!D.post.length&&!L,m=0;h&&m<o.length;m++)o[m]&&(h=!1);d=[];var E=0;e:for(var C=0;C<f.length;C++)for(var T=VWo(f[C],t,n,!1),_=0;_<T.length;_++){var R=T[_];if(!(h&&!R)){if(d.length>=t||E+R.length>n)break e;d.push(R),E+=R.length}}}if(o=qPt(o,L,d,t,n,s&&!D.post.length),!D.post.length)break;r=D.post}return o}});var jUc,IR,Wdh,Vdh,Kdh,$dh,Ydh,Jdh,Xdh,Zdh,e0h,t0h,r0h,n0h,i0h,o0h,s0h,a0h,u0h,c0h,zUc,UUc,l0h,iRr,YWo,p0h,q4,qUc,JWo,$Wo,d0h,f0h,QUc,FUc,h0h,g0h,cCe,m0h,GUc,y0h,oRr,nRr,A0h,XWo,b0h,E0h,S0h,C0h,Fet,FPt=z(()=>{jUc=Nt(LUc(),1),IR=(r,t,n={})=>(oRr(t),!n.nocomment&&t.charAt(0)==="#"?!1:new Fet(t,n).match(r)),Wdh=/^\*+([^+@!?\*\[\(]*)$/,Vdh=r=>t=>!t.startsWith(".")&&t.endsWith(r),Kdh=r=>t=>t.endsWith(r),$dh=r=>(r=r.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(r)),Ydh=r=>(r=r.toLowerCase(),t=>t.toLowerCase().endsWith(r)),Jdh=/^\*+\.\*+$/,Xdh=r=>!r.startsWith(".")&&r.includes("."),Zdh=r=>r!=="."&&r!==".."&&r.includes("."),e0h=/^\.\*+$/,t0h=r=>r!=="."&&r!==".."&&r.startsWith("."),r0h=/^\*+$/,n0h=r=>r.length!==0&&!r.startsWith("."),i0h=r=>r.length!==0&&r!=="."&&r!=="..",o0h=/^\?+([^+@!?\*\[\(]*)?$/,s0h=([r,t=""])=>{let n=zUc([r]);return t?(t=t.toLowerCase(),i=>n(i)&&i.toLowerCase().endsWith(t)):n},a0h=([r,t=""])=>{let n=UUc([r]);return t?(t=t.toLowerCase(),i=>n(i)&&i.toLowerCase().endsWith(t)):n},u0h=([r,t=""])=>{let n=UUc([r]);return t?i=>n(i)&&i.endsWith(t):n},c0h=([r,t=""])=>{let n=zUc([r]);return t?i=>n(i)&&i.endsWith(t):n},zUc=([r])=>{let t=r.length;return n=>n.length===t&&!n.startsWith(".")},UUc=([r])=>{let t=r.length;return n=>n.length===t&&n!=="."&&n!==".."},l0h=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",iRr=l0h==="win32",YWo=iRr?{sep:"\\"}:{sep:"/"},p0h=YWo.sep;IR.sep=p0h;q4=Symbol("globstar **");IR.GLOBSTAR=q4;qUc={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},JWo="[^/]",$Wo=JWo+"*?",d0h="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",f0h="(?:(?!(?:\\/|^)\\.).)*?",QUc=r=>r.split("").reduce((t,n)=>(t[n]=!0,t),{}),FUc=QUc("().*{}+?[]^$\\!"),h0h=QUc("[.("),g0h=(r,t={})=>n=>IR(n,r,t);IR.filter=g0h;cCe=(r,t={})=>Object.assign({},r,t),m0h=r=>{if(!r||typeof r!="object"||!Object.keys(r).length)return IR;let t=IR;return Object.assign((i,o,s={})=>t(i,o,cCe(r,s)),{Minimatch:class extends t.Minimatch{constructor(o,s={}){super(o,cCe(r,s))}static defaults(o){return t.defaults(cCe(r,o)).Minimatch}},filter:(i,o={})=>t.filter(i,cCe(r,o)),defaults:i=>t.defaults(cCe(r,i)),makeRe:(i,o={})=>t.makeRe(i,cCe(r,o)),braceExpand:(i,o={})=>t.braceExpand(i,cCe(r,o)),match:(i,o,s={})=>t.match(i,o,cCe(r,s)),sep:t.sep,GLOBSTAR:q4})};IR.defaults=m0h;GUc=(r,t={})=>(oRr(r),t.nobrace||!/\{(?:(?!\{).)*\}/.test(r)?[r]:(0,jUc.default)(r));IR.braceExpand=GUc;y0h=1024*64,oRr=r=>{if(typeof r!="string")throw new TypeError("invalid pattern");if(r.length>y0h)throw new TypeError("pattern is too long")},nRr=Symbol("subparse"),A0h=(r,t={})=>new Fet(r,t).makeRe();IR.makeRe=A0h;XWo=(r,t,n={})=>{let i=new Fet(t,n);return r=r.filter(o=>i.match(o)),i.options.nonull&&!r.length&&r.push(t),r};IR.match=XWo;b0h=r=>r.replace(/\\(.)/g,"$1"),E0h=r=>r.replace(/\\([^-\]])/g,"$1"),S0h=r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),C0h=r=>r.replace(/[[\]\\]/g,"\\$&"),Fet=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;regexp;maxGlobstarRecursion;constructor(t,n={}){oRr(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.maxGlobstarRecursion=n.maxGlobstarRecursion!==void 0?n.maxGlobstarRecursion:200,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),iRr)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){if(iRr){let o=t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]=="string"&&/^[a-z]:$/i.test(t[3]),s=n[0]===""&&n[1]===""&&n[2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3]);if(o&&s){let a=t[3],u=n[3];a.toLowerCase()===u.toLowerCase()&&(t[3]=u)}else if(s&&typeof t[0]=="string"){let a=n[3],u=t[0];a.toLowerCase()===u.toLowerCase()&&(n[3]=u,n=n.slice(3))}else if(o&&typeof n[0]=="string"){let a=t[3];a.toLowerCase()===n[0].toLowerCase()&&(n[0]=a,t=t.slice(3))}}return n.indexOf(q4)!==-1?this._matchGlobstar(t,n,i,0,0):this._matchOne(t,n,i,0,0)}_matchGlobstar(t,n,i,o,s){let a=-1;for(let _=s;_<n.length;_++)if(n[_]===q4){a=_;break}let u=-1;for(let _=n.length-1;_>=0;_--)if(n[_]===q4){u=_;break}let p=n.slice(s,a),c=i?n.slice(a+1):n.slice(a+1,u),l=i?[]:n.slice(u+1);if(p.length){let _=t.slice(o,o+p.length);if(!this._matchOne(_,p,i,0,0))return!1;o+=p.length}let d=0;if(l.length){if(l.length+o>t.length)return!1;let _=t.length-l.length;if(this._matchOne(t,l,i,_,0))d=l.length;else{if(t[t.length-1]!==""||o+l.length===t.length||!this._matchOne(t,l,i,_-1,0))return!1;d=l.length+1}}if(!c.length){let _=!!d;for(let R=o;R<t.length-d;R++){let D=String(t[R]);if(_=!0,D==="."||D===".."||!this.options.dot&&D.startsWith("."))return!1}return i||_}let f=[[[],0]],h=f[0],m=0,E=[0];for(let _ of c)_===q4?(E.push(m),h=[[],0],f.push(h)):(h[0].push(_),m++);let C=f.length-1,T=t.length-d;for(let _ of f)_[1]=T-(E[C--]+_[0].length);return!!this._matchGlobStarBodySections(t,f,o,0,i,0,!!d)}_matchGlobStarBodySections(t,n,i,o,s,a,u){let p=n[o];if(!p){for(let d=i;d<t.length;d++){u=!0;let f=t[d];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1}return u}let[c,l]=p;for(;i<=l;){if(this._matchOne(t.slice(0,i+c.length),c,s,i,0)&&a<this.maxGlobstarRecursion){let h=this._matchGlobStarBodySections(t,n,i+c.length,o+1,s,a+1,u);if(h!==!1)return h}let f=t[i];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1;i++}return s||null}_matchOne(t,n,i,o,s){let a,u,p,c;for(a=o,u=s,p=t.length,c=n.length;a<p&&u<c;a++,u++){this.debug("matchOne loop");let l=n[u],d=t[a];if(this.debug(n,l,d),l===!1||l===q4)return!1;let f;if(typeof l=="string"?(f=d===l,this.debug("string match",l,d,f)):(f=l.test(d),this.debug("pattern match",l,d,f)),!f)return!1}if(a===p&&u===c)return!0;if(a===p)return i;if(u===c)return a===p-1&&t[a]==="";throw new Error("wtf?")}braceExpand(){return GUc(this.pattern,this.options)}parse(t,n){oRr(t);let i=this.options;if(t==="**")if(i.noglobstar)t="*";else return q4;if(t==="")return"";let o,s=null;n!==nRr&&((o=t.match(r0h))?s=i.dot?i0h:n0h:(o=t.match(Wdh))?s=(i.nocase?i.dot?Ydh:$dh:i.dot?Kdh:Vdh)(o[1]):(o=t.match(o0h))?s=(i.nocase?i.dot?a0h:s0h:i.dot?u0h:c0h)(o):(o=t.match(Jdh))?s=i.dot?Zdh:Xdh:(o=t.match(e0h))&&(s=t0h));let a="",u=!1,p=!1,c=[],l=[],d=!1,f=!1,h=-1,m=-1,E,C,T,_=t.charAt(0)===".",R=i.dot||_,D=()=>_?"":R?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",L=H=>H.charAt(0)==="."?"":i.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",F=()=>{if(d){switch(d){case"*":a+=$Wo,u=!0;break;case"?":a+=JWo,u=!0;break;default:a+="\\"+d;break}this.debug("clearStateChar %j %j",d,a),d=!1}};for(let H=0,V;H<t.length&&(V=t.charAt(H));H++){if(this.debug("%s %s %s %j",t,H,a,V),p){if(V==="/")return!1;FUc[V]&&(a+="\\"),a+=V,p=!1;continue}switch(V){case"/":return!1;case"\\":if(f&&t.charAt(H+1)==="-"){a+=V;continue}F(),p=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s %s %s %j <-- stateChar",t,H,a,V),f){this.debug(" in class"),V==="!"&&H===m+1&&(V="^"),a+=V;continue}if(V==="*"&&d==="*")continue;this.debug("call clearStateChar %j",d),F(),d=V,i.noext&&F();continue;case"(":{if(f){a+="(";continue}if(!d){a+="\\(";continue}let q={type:d,start:H-1,reStart:a.length,open:qUc[d].open,close:qUc[d].close};this.debug(this.pattern," ",q),c.push(q),a+=q.open,q.start===0&&q.type!=="!"&&(_=!0,a+=L(t.slice(H+1))),this.debug("plType %j %j",d,a),d=!1;continue}case")":{let q=c[c.length-1];if(f||!q){a+="\\)";continue}c.pop(),F(),u=!0,C=q,a+=C.close,C.type==="!"&&l.push(Object.assign(C,{reEnd:a.length}));continue}case"|":{let q=c[c.length-1];if(f||!q){a+="\\|";continue}F(),a+="|",q.start===0&&q.type!=="!"&&(_=!0,a+=L(t.slice(H+1)));continue}case"[":if(F(),f){a+="\\"+V;continue}f=!0,m=H,h=a.length,a+=V;continue;case"]":if(H===m+1||!f){a+="\\"+V;continue}E=t.substring(m+1,H);try{RegExp("["+C0h(E0h(E))+"]"),a+=V}catch{a=a.substring(0,h)+"(?:$.)"}u=!0,f=!1;continue;default:F(),FUc[V]&&!(V==="^"&&f)&&(a+="\\"),a+=V;break}}for(f&&(E=t.slice(m+1),T=this.parse(E,nRr),a=a.substring(0,h)+"\\["+T[0],u=u||T[1]),C=c.pop();C;C=c.pop()){let H;H=a.slice(C.reStart+C.open.length),this.debug(this.pattern,"setting tail",a,C),H=H.replace(/((?:\\{2}){0,64})(\\?)\|/g,(q,K,Y)=>(Y||(Y="\\"),K+K+Y+"|")),this.debug(`tail=%j
9465
- %s`,H,H,C,a);let V=C.type==="*"?$Wo:C.type==="?"?JWo:"\\"+C.type;u=!0,a=a.slice(0,C.reStart)+V+"\\("+H}F(),p&&(a+="\\\\");let U=h0h[a.charAt(0)];for(let H=l.length-1;H>-1;H--){let V=l[H],q=a.slice(0,V.reStart),K=a.slice(V.reStart,V.reEnd-8),Y=a.slice(V.reEnd),Z=a.slice(V.reEnd-8,V.reEnd)+Y,se=q.split(")").length,oe=q.split("(").length-se,pe=Y;for(let re=0;re<oe;re++)pe=pe.replace(/\)[+*?]?/,"");Y=pe;let ge=Y===""&&n!==nRr?"(?:$|\\/)":"";a=q+K+Y+ge+Z}if(a!==""&&u&&(a="(?=.)"+a),U&&(a=D()+a),n===nRr)return[a,u];if(i.nocase&&!u&&!i.nocaseMagicOnly&&(u=t.toUpperCase()!==t.toLowerCase()),!u)return b0h(t);let Q=i.nocase?"i":"";try{let H=s?{_glob:t,_src:a,test:s}:{_glob:t,_src:a};return Object.assign(new RegExp("^"+a+"$",Q),H)}catch(H){return this.debug("invalid regexp",H),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?$Wo:n.dot?d0h:f0h,o=n.nocase?"i":"",s=t.map(a=>{let u=a.map(p=>typeof p=="string"?S0h(p):p===q4?q4:p._src);return u.forEach((p,c)=>{let l=u[c+1],d=u[c-1];p!==q4||d===q4||(d===void 0?l!==void 0&&l!==q4?u[c+1]="(?:\\/|"+i+"\\/)?"+l:u[c]=i:l===void 0?u[c-1]=d+"(?:\\/|"+i+")?":l!==q4&&(u[c-1]=d+"(?:\\/|\\/"+i+"\\/)"+l,u[c+1]=q4))}),u.filter(p=>p!==q4).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("/"):iRr&&/^\/\/[^\/]+/.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;YWo.sep!=="/"&&(t=t.split(YWo.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 IR.defaults(t).Minimatch}};IR.Minimatch=Fet});var WUc,VUc,KUc,$Uc,YUc,JUc,XUc,ZUc,ejc,tjc,rjc,HUc,zet,njc=z(()=>{"use strict";FPt();WUc=2,VUc=1,KUc=3,$Uc=2,YUc=8,JUc=5,XUc=6,ZUc=new RegExp(/([\+]?){([\s\S]+)}([\+](?![\+]))?\s*/g),ejc=new RegExp(/((\w+):\s*((?:["])((([^\"\+\r\n\[/\\]+))(?:["]))|(([^\"\ \+\r\n\[/\\]+))))/g),tjc=new RegExp(/((\w+):\s*(((?:["])(((?:[^"]|"")*))(?:["]))|(([^\"\ \+\r\n\[/\\]+))))/g),rjc=new RegExp(/((?:[^\+\ \r\n\[\\]|\\.|\[(?:[^\r\n\]\\]|\\.)*\])+)\s*/g),HUc="",zet=(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,HUc):""),i=t.replace(/\//g,HUc);return!!XWo(n,i).length}});var Uet,G82,ijc,ojc,sjc,sRr,ajc,aRr=z(()=>{"use strict";Xr();ns();qp();qT();Xt();HWo();njc();Uet=Ge("SEARCH"),G82=x.object({include:x.string(),exclude:x.string(),enabled:x.boolean()}),ijc={name:{MatchFunction:zet,MatchList:r=>[r.operation.name]},location:{MatchFunction:zet,MatchList:r=>[r.operation.locationName]},nodeType:{MatchFunction:zet,MatchList:r=>[r.operation.sqlType]},subgraph:{MatchFunction:zet,MatchList:r=>[r?.id?.toString(),r.name]},nodeID:{MatchFunction:zet,MatchList:r=>[r]}},ojc=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},sjc=(r,t,n,i=!1)=>{let{steps:o,graphInformation:s,allSubgraphs:a,allStepTypesYAML:u}=n,p={},c=kC()?Date.now():performance.now(),l=r;l||(l=t);let d=l.split(/(\}\+?)\s*(or|OR|\|\|)\s*(\+?\{)/).filter(m=>!(m==="OR"||m==="or"||m==="||")),f=ojc(d);f.length||(f=[t]),Uet.debug("got unions",f,"searchStringTouse",l,"defaultSearchString",t,"steps",o),f.forEach(m=>{let E=m.split(/(\}\+?)\s*(and|AND|\,)\s*(\+?\{)/).filter(D=>!(D==="AND"||D==="and"||D===",")),C=ojc(E),T=[];C.forEach(D=>{let L={};Uet.debug("Got intersection:",D);let F=[...D.matchAll(ZUc)];if(Uet.debug("Got matches:",D,F),!F[0])return;let U=F[0][WUc],Q={prefix:F[0][VUc]||"",postfix:F[0][KUc]||""};if(U.indexOf(":")>-1){let q=i?tjc:ejc,K=[...U.trim().matchAll(q)],Y=i?XUc:JUc;K.forEach(Z=>{let se=Z[$Uc],oe=Z[YUc]||Z[Y];Q[se]=oe})}else{let K=[...U.trim().matchAll(rjc)][0];K&&(Q.name=K[0])}O4(Q);let H=Q;Uet.debug("Got groups ",D,H);let V=new Set;if(H.subgraph?Object.values(a).forEach(q=>{let K=ijc.subgraph,Y=K.MatchList(q);if(K.MatchFunction(Y,H.subgraph)){let{steps:se}=q;se.forEach(oe=>{V.add(oe.toString())})}else return}):V=new Set(Object.keys(o)),H.nodeType){let{nodeType:q}=H;if(!u[q]){let K=q;Object.entries(u).forEach(([Y,Z])=>{Z.name===q&&(K=Y)}),H.nodeType=K}}Object.keys(o).forEach(q=>{if(!H){Uet.emerg("got an unexpected undefined value for match",l,H,D);return}let K=V.has(q);if(Object.entries(H).forEach(([Y,Z])=>{let se=o[q];if(Y==="nodeID"&&(se=q),Y==="subgraph"){K=V.has(q);return}let oe=ijc[Y];if(oe){let pe=oe.MatchList(se).filter(ge=>ge!=null);K=K&&oe.MatchFunction(pe,Z)}}),K){if(L[q]=!0,H.prefix&&s){let Y=GWo(s,q,"predecessors");Object.values(Y).forEach(Z=>[...Z.keys()].forEach(se=>L[se]=!0))}if(H.postfix&&s){let Y=GWo(s,q,"successors");Object.values(Y).forEach(Z=>[...Z.keys()].forEach(se=>L[se]=!0))}}}),T.push(L)}),T.length||T.push({});let _={};Object.keys(o).forEach(D=>{_[D]=!0});let R=T.reduce((D,L)=>Object.fromEntries(obc(D,L).map(F=>[F,!0])),_);p={...p,...R}});let h=kC()?Date.now():performance.now();return Uet.debug("Time that search took: ",h-c),p},sRr=(r,t,n,i=!1)=>{let o=sjc(`${r}`,"{ * }",n,i),s=sjc(`${t}`,"!*",n,i),a=o;return Object.keys(s).forEach(u=>{delete a[u]}),{stepsResult:a}},ajc=(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 T0h,ujc,ZWo,cjc,uRr=z(()=>{"use strict";so();Xt();aRr();T0h=Ge("JOBS"),ujc=r=>!r?.hasOwnProperty("includeSelector")||!r?.hasOwnProperty("version"),ZWo=(r,t,n)=>{let{steps:i,subgraphs:o,...s}=r,a={...s};if(a.hasOwnProperty("version")||(a.version=zee),a.hasOwnProperty("includeSelector"))return a;a.includeSelector="",a.excludeSelector="";let u=new Set(i),p=new Set(o),d=ajc([...u],[...p].map(f=>`${f}`),n,t).map(f=>`+${f}`).join(" OR ");return a.includeSelector=d,T0h.info("Upgrading job v1 to v2",r,a),a},cjc=(r,t)=>{let{jobs:n,folders:i,steps:o}=r,s=n[t];return ZWo(s,i,o)}});var Z82,ljc,pjc=z(()=>{"use strict";ur();Yu();Xt();cfe();Z82=Ge("PACKAGES_BACKEND"),ljc=(r,t,n)=>{let i=qGo(t)??"",o=r?.config?.entities?.nodeTypes[i];return o||(n.error(`No config found for node type ${t}`),{isDisabled:!1,defaultStorageLocation:null})}});var lCe,I0h,R0h,zPt=z(()=>{"use strict";la();Xt();N8e();pjc();lCe=(r,t={})=>Object.values(r).map(n=>I0h(n)).reduce((n,i)=>{for(let[o,s]of Object.entries(i))n[o]=s;return n},t),I0h=r=>Object.fromEntries(Object.entries(r?.contents?.nodeTypes??{}).map(([t,n])=>{let{id:i,nodeType:o}=R0h(r.alias,t,r,n);return[i,o]})),R0h=(r,t,n,i)=>{let o=J3r(r,t),{isDisabled:s,defaultStorageLocation:a}=ljc(n,o,Ge("PACKAGES")),u={...xc(i),id:o,isDisabled:s};return u.metadata.defaultStorageLocation=a,{id:o,nodeType:u}}});var Ho,O0h,djc,fjc,eVo,l92,_0h,hjc,w0h,x0h,cRr,tVo=z(()=>{"use strict";Ho=Nt(cV());so();sL();rEr();ru();O0h=Ho.Record({type:Ho.Unknown,name:Ho.String}),djc=Ho.Record({locationName:Ho.String,nodeName:Ho.String}),fjc=Ho.Record({sql:Ho.String,success:Ho.Boolean,rows:Ho.Array(Ho.Unknown),fields:Ho.Array(O0h),error:Ho.Union(Ho.Null,K2r).optional(),startTime:Ho.Unknown,endTime:Ho.Unknown,status:Ho.String,name:Ho.String,isRunning:Ho.Boolean,exportedRefs:Ho.Array(djc),invalidExportedRefs:Ho.Array(djc),queryResultSequence:Ho.Optional(Ho.Unknown),type:Ho.Union(Ho.Literal("sql"),Ho.Literal("sqlTest")).optional(),warehouse:Ho.String.nullable().optional(),queryID:Ho.String.nullable().optional(),failingRowCount:Ho.Number.optional(),continueOnFailure:Ho.Boolean.optional()}),eVo=Ho.Record({name:Ho.String,queryResults:Ho.Array(fjc),isRunning:Ho.Boolean,renderQueryResults:Ho.Optional(fjc)}),l92=Ho.Record({runExecutionSequenceID:Ho.Number,runResultVersion:Ho.Number,name:Ho.String,queryResultSequence:eVo,runState:Ho.String}),_0h=Ho.Record({dataResult:Ho.Unknown,name:Ho.String,queryResultSequence:eVo,runExecutionSequenceID:Ho.Number,runResultVersion:Ho.Number,runState:Ho.String,stepRunState:UJe(qBo)}),hjc=R4("RunResultFirestoreValidator",_0h),w0h=Ho.Record({nodeID:Ho.String,queryResultSequence:eVo,runState:Ho.String,hasTestFailures:Ho.Boolean.optional()}),x0h=Ho.Record({runResults:Ho.Record({runStartTime:Ho.Unknown,runEndTime:Ho.Unknown,runFailureReason:Ho.Optional(Ho.String),runType:Ho.String,runStatus:Ho.String,runResults:Ho.Array(w0h),runID:Ho.Number,environmentID:Ho.String,snowflakeAccount:Ho.String.optional(),snowflakeWarehouse:Ho.String.optional(),jobID:Ho.Number.optional(),hasFailedTest:Ho.Boolean.optional(),runTimeParameters:Ho.Unknown.nullable(),includeNodesSelector:Ho.String.optional(),excludeNodesSelector:Ho.String.optional()})}),cRr=R4("TRunOutput",x0h)});var f92,gjc=z(()=>{"use strict";so();rEr();f92=UJe(LBo)});var J8e,lRr=z(()=>{"use strict";la();qT();Xt();J8e=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(Ge("PIPELINE").appContext(this.logContext,i,"Nodes present in both current-phase data AND extra non-phased (views & advanced deploy) data:",dvo([...o],s)),this.noDependenciesPhases.includes(t))return Object.fromEntries(a.map(u=>[u,[]]));{let u=this.getNodeRefsInPhase(t,a),p=new F8e(pS(this.allNodes,a));return lS(u,(c,l)=>{let{nodeIDsToAdd:d}=fet(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 C92,rVo=z(()=>{"use strict";ur();Xt();Yu();C92=Ge("DEBUG")});var mjc=z(()=>{"use strict"});var pRr,nVo=z(()=>{"use strict";pRr=r=>{typeof r.stepCounter=="number"&&(r.stepCounter=`${r.stepCounter}`),typeof r.columnCounter=="number"&&(r.columnCounter=`${r.columnCounter}`)}});var pCe,Xs,iVo=z(()=>{"use strict";xs();qz();pCe=new Date("1980-01-01T00:00:00.000Z"),Xs=(r,t,n)=>{let i=`${r}Entity`;return n||(n=ia(t)),{standard:Pr(i,n),strict:Pr(`${i} (strict)`,t)}}});var yjc,M0h,Ajc,X8e,UPt,oVo,sVo,Ju,aVo,RR,uVo=z(()=>{"use strict";uA();iVo();efe();yjc=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]},M0h=(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()===J0e.SENTINEL_DATE&&Kl().emerg(`Repository server timestamp sentinel value found in stored data at path ${t}`),[i,!0]}}return[r,!1]},Ajc=(r,t)=>r instanceof g8e?[t.getDeleteSentinel(),!0]:r instanceof Date&&r.getTime()===J0e.SENTINEL_DATE?[t.getServerTimestampSentinel(),!0]:[r,!1],X8e=(r,t,n)=>{let[i,o]=t(n,r);if(!o&&typeof i=="object"){if(Array.isArray(i))return i.map(s=>X8e(r,t,s));for(let s in i)i.hasOwnProperty(s)&&(i[s]=X8e(r,t,i[s]))}return i},UPt=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 Kl().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 Kl().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 Kl().debug(`Error merge transforming repository entity ${n} to storage ${a}`),a}return i}},oVo=class extends UPt{constructor(n=!1){super();this.preserveID=n}preserveID;transformFromStorage(n,i,o){return"id"in o?o.id!=n&&(Kl().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=pCe),"updatedAt"in o||(o.updatedAt=pCe),X8e(i,M0h,o)}transformToStorage(n,i,o,s){return this.preserveID||delete o.id,X8e(i,a=>{let[u,p]=Ajc(a,s);return p?[u,!0]:yjc(u)},o)}mergeTransformToStorage(n,i,o,s){return this.preserveID||delete o.id,X8e(i,a=>{let[u,p]=Ajc(a,s);return p?[u,!0]:yjc(u)},o)}},sVo=class extends UPt{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 oVo(n),new sVo(r)];return t&&i.unshift(t),new aVo(...i)},aVo=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)}},RR=class extends UPt{transformToStorage(t,n,i){return i}mergeTransformToStorage(t,n,i){return i}}});var xf=z(()=>{"use strict";uVo()});var bjc,jet,NV,cVo,jPt,uU,dCe,pVo,N0h,D0h,Ejc,lVo,dRr,Sjc=z(()=>{"use strict";so();Xt();xf();nVo();bjc=r=>!!r&&typeof r=="object"&&!Array.isArray(r),jet=r=>bjc(r)&&!(r instanceof Date)&&!(r instanceof RegExp),NV=r=>{if(typeof r=="string")return r;if(bjc(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"}},cVo=r=>r==null,jPt=(r,t,n,i)=>{t.filter((o,s)=>jet(o)?!0:(n.logError(`Invalid ${r} item detected at index ${s}: ${NV(o)}`),n.logPatch(`Removed invalid ${r} item at index ${s}`),!1)).forEach(i)},uU=(r,t,n)=>{r[t]=n},dCe=(r,t)=>{delete r[t]},pVo=(r,t,n)=>{let i=new lVo(r,Ge("FIREBASE"),t),{logError:o,logPatch:s,report:a}=i,u=()=>(a(),n);if(!jet(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 ${NV(p[c])} to ""`),uU(p,c,""))}),["dependencies","isDataVault","locationID"].forEach(c=>{c in p&&(s(`Removed deprecated field ${c}`),dCe(p,c))}),p.type==="sql")s("-- data.type is sql --"),N0h(r,p,i);else if(p.type==="sourceInput")s("-- data.type is sourceInput --"),D0h(r,p,i);else return o(`Data type is of invalid type ${NV(p.type)}`),u();return p.version!==qee&&(s(`Set version ${NV(p.version)} to ${qee}`),uU(p,"version",qee)),u()},N0h=(r,t,n)=>{let{logError:i,logPatch:o}=n;if(t.isMultisource===void 0&&(o("Set missing isMultisource to false"),uU(t,"isMultisource",!1)),jet(t.metadata)){let s=t.metadata;if(s.appliedNodeTests===null&&(o("Set metadata.appliedNodeTests from null to []"),uU(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=""),uU(s,"sourceMapping",[{name:a,join:{joinCondition:""},dependencies:[],noLinkRefs:[],aliases:{}}])}else jPt("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: ${NV(c)}`),uU(p,"join",c)}if(p.name===void 0){let c=p.join?.name??"";o(`Set missing metadata.sourceMapping[${u}].name to "${c}"`),uU(p,"name",c),c||i(`metadata.sourceMapping[${u}].name is an empty string`)}Array.isArray(p.dependencies)&&jPt("sourceMapping dependency",p.dependencies,n,(c,l)=>{let d=c;for(let f of["locationName","nodeName"])cVo(d[f])&&(o(`Set metadata.sourceMapping[${u}].dependencies[${l}].${f} from ${NV(d[f])} to ""`),uU(d,f,""))})});Ejc(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}"`),dCe(t.config,s))},D0h=(r,t,n)=>{let{logPatch:i,logError:o}=n;if(t.dataset!==void 0&&(i("Removed deprecated v0 property dataset"),dCe(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"),dCe(t,"table")),jet(t.metadata)){let s=t.metadata;Array.isArray(s.columns)&&(s.columns.length&&Ejc(r,s.columns,n),Object.keys(s).length>1&&(i(`Removed deprecated metadata properties, keeping only columns. Was: ${NV(s)}`),uU(t,"metadata",{columns:s.columns})))}},Ejc=(r,t,n)=>{let{logPatch:i}=n;Array.isArray(t)&&jPt("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}]`),dCe(a,c))}),jet(a.hashDetails)){let c=a.hashDetails;c.hashType&&(i(`Removed deprecated property 'hashType' from metadata.columns[${s}].hashDetails`),dCe(c,"hashType")),c.hubHashes&&(i(`Removed deprecated property 'hubHashes' from metadata.columns[${s}].hashDetails`),dCe(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 ${NV(a[c])}`),dCe(a,c))}),[["dataType",typeof a.dataType!="string"],["transform",a.transform===null]].forEach(([c,l])=>{l&&(i(`Set ${c} from ${NV(a[c])} to "" in metadata.columns[${s}]`),uU(a,c,""))});let u=a.hashedColumns;if(Array.isArray(u))for(let c of u)pRr(c);let p=a.columnReference;if(jet(p)){pRr(p);let c=p;cVo(c.stepCounter)&&(i(`Set metadata.columns[${s}].columnReference.stepCounter from ${NV(c.stepCounter)} to ${r}`),uU(c,"stepCounter",r))}Array.isArray(a.sourceColumnReferences)&&jPt("sourceColumnReference",a.sourceColumnReferences,n,(c,l)=>{let d=c;Array.isArray(d.columnReferences)&&jPt("columnReference",d.columnReferences,n,(f,h)=>{pRr(f);let m=f;cVo(m.stepCounter)&&(i(`Set invalid metadata.columns[${s}].sourceColumnReferences[${l}].columnReferences[${h}].stepCounter to "" from ${NV(r)}`),uU(m,"stepCounter",""))})})})},lVo=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()}},dRr=class extends RR{transformFromStorage(t,n,i){return pVo(t,n,i)}}});var QPt=z(()=>{"use strict";mjc();nVo();Sjc()});var Cjc=z(()=>{"use strict"});var pk2,dk2,fk2,vjc,Tjc,Ijc,fCe=z(()=>{"use strict";ur();hA();Xt();rVo();net();ns();Xt();qm();lte();QPt();jSe();wGo();Cjc();U6();q6();k4();ufe();pk2=Ge("FIREBASE"),dk2=Ge("STEPS"),fk2=Ge("METADATA_OPERATIONS"),vjc=(r,t)=>t[r].runState==="running",Tjc=r=>(bb("STEPS",!!r,`Error converting API refs: argument apiRefLinks is ${r}.`),r.map(t=>({locationName:t.location_name,nodeName:t.node_name}))),Ijc=r=>r?.deployEnabled??!0});var Z8e,Rjc=z(()=>{"use strict";fCe();lRr();Z8e=class extends J8e{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})=>Tjc([...u,...p]));return[i,[].concat(...a)]}))}}});var GPt,Ojc=z(()=>{"use strict";la();F6();lRr();GPt=class extends J8e{noDependenciesPhases=[];getNodeRefsInPhase(t,n){let i=pS(this.allNodes,...n);return lS(i,o=>{if(WSe(o.operation))return[];let{sourceMapping:s}=o.operation.metadata;if(!s?.length)return[];let a=s.map(({dependencies:u})=>u);return[].concat(...a)})}}});var dVo=z(()=>{"use strict";lRr();Rjc();Ojc()});var _jc=z(()=>{"use strict"});var HPt,wjc=z(()=>{"use strict";eZ();uA();HPt=async(r,t)=>{let{attempts:n,tags:i,waitSeconds:o}=t,s=Kl().child({retryOptions:{maxAttempts:n,waitSeconds:o},tags:["[withRetries]",...i]});EE(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 fVo=z(()=>{"use strict";_jc();wjc()});function Qet(r,t){let n=[];for(let i of r){let o=i.compiledSQL?det(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 fRr(r,t){return r==="deletedTable"&&t?xjc:q0h}var q0h,xjc,WPt=z(()=>{"use strict";qm();q0h="Making metadata updates",xjc="Deleting metadata for source input"});var DV,VPt=z(()=>{"use strict";ur();DV=class extends Ke{constructor(n,i,o="system"){super(i,`Failed node ${n}: ${i}`);this.nodeID=n;this.fault=o}nodeID;fault}});var KPt=A((Bk2,Pjc)=>{var F0h="2.0.0",z0h=Number.MAX_SAFE_INTEGER||9007199254740991,U0h=16,j0h=250,Q0h=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Pjc.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:U0h,MAX_SAFE_BUILD_LENGTH:j0h,MAX_SAFE_INTEGER:z0h,RELEASE_TYPES:Q0h,SEMVER_SPEC_VERSION:F0h,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var $Pt=A((Lk2,Mjc)=>{var G0h=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{};Mjc.exports=G0h});var Get=A((Rfe,Njc)=>{var{MAX_SAFE_COMPONENT_LENGTH:hVo,MAX_SAFE_BUILD_LENGTH:H0h,MAX_LENGTH:W0h}=KPt(),V0h=$Pt();Rfe=Njc.exports={};var K0h=Rfe.re=[],$0h=Rfe.safeRe=[],_a=Rfe.src=[],wa=Rfe.t={},Y0h=0,gVo="[a-zA-Z0-9-]",J0h=[["\\s",1],["\\d",W0h],[gVo,H0h]],X0h=r=>{for(let[t,n]of J0h)r=r.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return r},rd=(r,t,n)=>{let i=X0h(t),o=Y0h++;V0h(r,o,t),wa[r]=o,_a[o]=t,K0h[o]=new RegExp(t,n?"g":void 0),$0h[o]=new RegExp(i,n?"g":void 0)};rd("NUMERICIDENTIFIER","0|[1-9]\\d*");rd("NUMERICIDENTIFIERLOOSE","\\d+");rd("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${gVo}*`);rd("MAINVERSION",`(${_a[wa.NUMERICIDENTIFIER]})\\.(${_a[wa.NUMERICIDENTIFIER]})\\.(${_a[wa.NUMERICIDENTIFIER]})`);rd("MAINVERSIONLOOSE",`(${_a[wa.NUMERICIDENTIFIERLOOSE]})\\.(${_a[wa.NUMERICIDENTIFIERLOOSE]})\\.(${_a[wa.NUMERICIDENTIFIERLOOSE]})`);rd("PRERELEASEIDENTIFIER",`(?:${_a[wa.NUMERICIDENTIFIER]}|${_a[wa.NONNUMERICIDENTIFIER]})`);rd("PRERELEASEIDENTIFIERLOOSE",`(?:${_a[wa.NUMERICIDENTIFIERLOOSE]}|${_a[wa.NONNUMERICIDENTIFIER]})`);rd("PRERELEASE",`(?:-(${_a[wa.PRERELEASEIDENTIFIER]}(?:\\.${_a[wa.PRERELEASEIDENTIFIER]})*))`);rd("PRERELEASELOOSE",`(?:-?(${_a[wa.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${_a[wa.PRERELEASEIDENTIFIERLOOSE]})*))`);rd("BUILDIDENTIFIER",`${gVo}+`);rd("BUILD",`(?:\\+(${_a[wa.BUILDIDENTIFIER]}(?:\\.${_a[wa.BUILDIDENTIFIER]})*))`);rd("FULLPLAIN",`v?${_a[wa.MAINVERSION]}${_a[wa.PRERELEASE]}?${_a[wa.BUILD]}?`);rd("FULL",`^${_a[wa.FULLPLAIN]}$`);rd("LOOSEPLAIN",`[v=\\s]*${_a[wa.MAINVERSIONLOOSE]}${_a[wa.PRERELEASELOOSE]}?${_a[wa.BUILD]}?`);rd("LOOSE",`^${_a[wa.LOOSEPLAIN]}$`);rd("GTLT","((?:<|>)?=?)");rd("XRANGEIDENTIFIERLOOSE",`${_a[wa.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);rd("XRANGEIDENTIFIER",`${_a[wa.NUMERICIDENTIFIER]}|x|X|\\*`);rd("XRANGEPLAIN",`[v=\\s]*(${_a[wa.XRANGEIDENTIFIER]})(?:\\.(${_a[wa.XRANGEIDENTIFIER]})(?:\\.(${_a[wa.XRANGEIDENTIFIER]})(?:${_a[wa.PRERELEASE]})?${_a[wa.BUILD]}?)?)?`);rd("XRANGEPLAINLOOSE",`[v=\\s]*(${_a[wa.XRANGEIDENTIFIERLOOSE]})(?:\\.(${_a[wa.XRANGEIDENTIFIERLOOSE]})(?:\\.(${_a[wa.XRANGEIDENTIFIERLOOSE]})(?:${_a[wa.PRERELEASELOOSE]})?${_a[wa.BUILD]}?)?)?`);rd("XRANGE",`^${_a[wa.GTLT]}\\s*${_a[wa.XRANGEPLAIN]}$`);rd("XRANGELOOSE",`^${_a[wa.GTLT]}\\s*${_a[wa.XRANGEPLAINLOOSE]}$`);rd("COERCE",`(^|[^\\d])(\\d{1,${hVo}})(?:\\.(\\d{1,${hVo}}))?(?:\\.(\\d{1,${hVo}}))?(?:$|[^\\d])`);rd("COERCERTL",_a[wa.COERCE],!0);rd("LONETILDE","(?:~>?)");rd("TILDETRIM",`(\\s*)${_a[wa.LONETILDE]}\\s+`,!0);Rfe.tildeTrimReplace="$1~";rd("TILDE",`^${_a[wa.LONETILDE]}${_a[wa.XRANGEPLAIN]}$`);rd("TILDELOOSE",`^${_a[wa.LONETILDE]}${_a[wa.XRANGEPLAINLOOSE]}$`);rd("LONECARET","(?:\\^)");rd("CARETTRIM",`(\\s*)${_a[wa.LONECARET]}\\s+`,!0);Rfe.caretTrimReplace="$1^";rd("CARET",`^${_a[wa.LONECARET]}${_a[wa.XRANGEPLAIN]}$`);rd("CARETLOOSE",`^${_a[wa.LONECARET]}${_a[wa.XRANGEPLAINLOOSE]}$`);rd("COMPARATORLOOSE",`^${_a[wa.GTLT]}\\s*(${_a[wa.LOOSEPLAIN]})$|^$`);rd("COMPARATOR",`^${_a[wa.GTLT]}\\s*(${_a[wa.FULLPLAIN]})$|^$`);rd("COMPARATORTRIM",`(\\s*)${_a[wa.GTLT]}\\s*(${_a[wa.LOOSEPLAIN]}|${_a[wa.XRANGEPLAIN]})`,!0);Rfe.comparatorTrimReplace="$1$2$3";rd("HYPHENRANGE",`^\\s*(${_a[wa.XRANGEPLAIN]})\\s+-\\s+(${_a[wa.XRANGEPLAIN]})\\s*$`);rd("HYPHENRANGELOOSE",`^\\s*(${_a[wa.XRANGEPLAINLOOSE]})\\s+-\\s+(${_a[wa.XRANGEPLAINLOOSE]})\\s*$`);rd("STAR","(<|>)?=?\\s*\\*");rd("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");rd("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var hRr=A((qk2,Djc)=>{var Z0h=Object.freeze({loose:!0}),efh=Object.freeze({}),tfh=r=>r?typeof r!="object"?Z0h:r:efh;Djc.exports=tfh});var mVo=A((Fk2,Ljc)=>{var kjc=/^[0-9]+$/,Bjc=(r,t)=>{let n=kjc.test(r),i=kjc.test(t);return n&&i&&(r=+r,t=+t),r===t?0:n&&!i?-1:i&&!n?1:r<t?-1:1},rfh=(r,t)=>Bjc(t,r);Ljc.exports={compareIdentifiers:Bjc,rcompareIdentifiers:rfh}});var F4=A((zk2,Ujc)=>{var gRr=$Pt(),{MAX_LENGTH:qjc,MAX_SAFE_INTEGER:mRr}=KPt(),{safeRe:Fjc,t:zjc}=Get(),nfh=hRr(),{compareIdentifiers:Het}=mVo(),yVo=class r{constructor(t,n){if(n=nfh(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>qjc)throw new TypeError(`version is longer than ${qjc} characters`);gRr("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;let i=t.trim().match(n.loose?Fjc[zjc.LOOSE]:Fjc[zjc.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>mRr||this.major<0)throw new TypeError("Invalid major version");if(this.minor>mRr||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>mRr||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<mRr)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(gRr("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)),Het(this.major,t.major)||Het(this.minor,t.minor)||Het(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(gRr("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 Het(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(gRr("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 Het(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]),Het(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}};Ujc.exports=yVo});var e9e=A((Uk2,Qjc)=>{var jjc=F4(),ifh=(r,t,n=!1)=>{if(r instanceof jjc)return r;try{return new jjc(r,t)}catch(i){if(!n)return null;throw i}};Qjc.exports=ifh});var Hjc=A((jk2,Gjc)=>{var ofh=e9e(),sfh=(r,t)=>{let n=ofh(r,t);return n?n.version:null};Gjc.exports=sfh});var Vjc=A((Qk2,Wjc)=>{var afh=e9e(),ufh=(r,t)=>{let n=afh(r.trim().replace(/^[=v]+/,""),t);return n?n.version:null};Wjc.exports=ufh});var Yjc=A((Gk2,$jc)=>{var Kjc=F4(),cfh=(r,t,n,i,o)=>{typeof n=="string"&&(o=i,i=n,n=void 0);try{return new Kjc(r instanceof Kjc?r.version:r,n).inc(t,i,o).version}catch{return null}};$jc.exports=cfh});var Zjc=A((Hk2,Xjc)=>{var Jjc=e9e(),lfh=(r,t)=>{let n=Jjc(r,null,!0),i=Jjc(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"};Xjc.exports=lfh});var tQc=A((Wk2,eQc)=>{var pfh=F4(),dfh=(r,t)=>new pfh(r,t).major;eQc.exports=dfh});var nQc=A((Vk2,rQc)=>{var ffh=F4(),hfh=(r,t)=>new ffh(r,t).minor;rQc.exports=hfh});var oQc=A((Kk2,iQc)=>{var gfh=F4(),mfh=(r,t)=>new gfh(r,t).patch;iQc.exports=mfh});var aQc=A(($k2,sQc)=>{var yfh=e9e(),Afh=(r,t)=>{let n=yfh(r,t);return n&&n.prerelease.length?n.prerelease:null};sQc.exports=Afh});var cU=A((Yk2,cQc)=>{var uQc=F4(),bfh=(r,t,n)=>new uQc(r,n).compare(new uQc(t,n));cQc.exports=bfh});var pQc=A((Jk2,lQc)=>{var Efh=cU(),Sfh=(r,t,n)=>Efh(t,r,n);lQc.exports=Sfh});var fQc=A((Xk2,dQc)=>{var Cfh=cU(),vfh=(r,t)=>Cfh(r,t,!0);dQc.exports=vfh});var yRr=A((Zk2,gQc)=>{var hQc=F4(),Tfh=(r,t,n)=>{let i=new hQc(r,n),o=new hQc(t,n);return i.compare(o)||i.compareBuild(o)};gQc.exports=Tfh});var yQc=A((eB2,mQc)=>{var Ifh=yRr(),Rfh=(r,t)=>r.sort((n,i)=>Ifh(n,i,t));mQc.exports=Rfh});var bQc=A((tB2,AQc)=>{var Ofh=yRr(),_fh=(r,t)=>r.sort((n,i)=>Ofh(i,n,t));AQc.exports=_fh});var YPt=A((rB2,EQc)=>{var wfh=cU(),xfh=(r,t,n)=>wfh(r,t,n)>0;EQc.exports=xfh});var ARr=A((nB2,SQc)=>{var Pfh=cU(),Mfh=(r,t,n)=>Pfh(r,t,n)<0;SQc.exports=Mfh});var AVo=A((iB2,CQc)=>{var Nfh=cU(),Dfh=(r,t,n)=>Nfh(r,t,n)===0;CQc.exports=Dfh});var bVo=A((oB2,vQc)=>{var kfh=cU(),Bfh=(r,t,n)=>kfh(r,t,n)!==0;vQc.exports=Bfh});var bRr=A((sB2,TQc)=>{var Lfh=cU(),qfh=(r,t,n)=>Lfh(r,t,n)>=0;TQc.exports=qfh});var ERr=A((aB2,IQc)=>{var Ffh=cU(),zfh=(r,t,n)=>Ffh(r,t,n)<=0;IQc.exports=zfh});var EVo=A((uB2,RQc)=>{var Ufh=AVo(),jfh=bVo(),Qfh=YPt(),Gfh=bRr(),Hfh=ARr(),Wfh=ERr(),Vfh=(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 Ufh(r,n,i);case"!=":return jfh(r,n,i);case">":return Qfh(r,n,i);case">=":return Gfh(r,n,i);case"<":return Hfh(r,n,i);case"<=":return Wfh(r,n,i);default:throw new TypeError(`Invalid operator: ${t}`)}};RQc.exports=Vfh});var _Qc=A((cB2,OQc)=>{var Kfh=F4(),$fh=e9e(),{safeRe:SRr,t:CRr}=Get(),Yfh=(r,t)=>{if(r instanceof Kfh)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(SRr[CRr.COERCE]);else{let i;for(;(i=SRr[CRr.COERCERTL].exec(r))&&(!n||n.index+n[0].length!==r.length);)(!n||i.index+i[0].length!==n.index+n[0].length)&&(n=i),SRr[CRr.COERCERTL].lastIndex=i.index+i[1].length+i[2].length;SRr[CRr.COERCERTL].lastIndex=-1}return n===null?null:$fh(`${n[2]}.${n[3]||"0"}.${n[4]||"0"}`,t)};OQc.exports=Yfh});var xQc=A((lB2,wQc)=>{"use strict";wQc.exports=function(r){r.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}});var SVo=A((pB2,PQc)=>{"use strict";PQc.exports=m1;m1.Node=t9e;m1.create=m1;function m1(r){var t=this;if(t instanceof m1||(t=new m1),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}m1.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};m1.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++}};m1.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++}};m1.prototype.push=function(){for(var r=0,t=arguments.length;r<t;r++)Xfh(this,arguments[r]);return this.length};m1.prototype.unshift=function(){for(var r=0,t=arguments.length;r<t;r++)Zfh(this,arguments[r]);return this.length};m1.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}};m1.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}};m1.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};m1.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};m1.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};m1.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};m1.prototype.map=function(r,t){t=t||this;for(var n=new m1,i=this.head;i!==null;)n.push(r.call(t,i.value,this)),i=i.next;return n};m1.prototype.mapReverse=function(r,t){t=t||this;for(var n=new m1,i=this.tail;i!==null;)n.push(r.call(t,i.value,this)),i=i.prev;return n};m1.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};m1.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};m1.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};m1.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};m1.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 m1;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};m1.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 m1;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};m1.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=Jfh(this,o,n[i]);return s};m1.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 Jfh(r,t,n){var i=t===r.head?new t9e(n,null,t,r):new t9e(n,t,t.next,r);return i.next===null&&(r.tail=i),i.prev===null&&(r.head=i),r.length++,i}function Xfh(r,t){r.tail=new t9e(t,r.tail,null,r),r.head||(r.head=r.tail),r.length++}function Zfh(r,t){r.head=new t9e(t,null,r.head,r),r.tail||(r.tail=r.head),r.length++}function t9e(r,t,n,i){if(!(this instanceof t9e))return new t9e(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{xQc()(m1)}catch{}});var ZPt=A((dB2,kQc)=>{"use strict";var ehh=SVo(),r9e=Symbol("max"),_fe=Symbol("length"),Wet=Symbol("lengthCalculator"),XPt=Symbol("allowStale"),n9e=Symbol("maxAge"),Ofe=Symbol("dispose"),MQc=Symbol("noDisposeOnSet"),OR=Symbol("lruList"),kV=Symbol("cache"),DQc=Symbol("updateAgeOnGet"),CVo=()=>1,TVo=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[r9e]=t.max||1/0,i=t.length||CVo;if(this[Wet]=typeof i!="function"?CVo:i,this[XPt]=t.stale||!1,t.maxAge&&typeof t.maxAge!="number")throw new TypeError("maxAge must be a number");this[n9e]=t.maxAge||0,this[Ofe]=t.dispose,this[MQc]=t.noDisposeOnSet||!1,this[DQc]=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[r9e]=t||1/0,JPt(this)}get max(){return this[r9e]}set allowStale(t){this[XPt]=!!t}get allowStale(){return this[XPt]}set maxAge(t){if(typeof t!="number")throw new TypeError("maxAge must be a non-negative number");this[n9e]=t,JPt(this)}get maxAge(){return this[n9e]}set lengthCalculator(t){typeof t!="function"&&(t=CVo),t!==this[Wet]&&(this[Wet]=t,this[_fe]=0,this[OR].forEach(n=>{n.length=this[Wet](n.value,n.key),this[_fe]+=n.length})),JPt(this)}get lengthCalculator(){return this[Wet]}get length(){return this[_fe]}get itemCount(){return this[OR].length}rforEach(t,n){n=n||this;for(let i=this[OR].tail;i!==null;){let o=i.prev;NQc(this,t,i,n),i=o}}forEach(t,n){n=n||this;for(let i=this[OR].head;i!==null;){let o=i.next;NQc(this,t,i,n),i=o}}keys(){return this[OR].toArray().map(t=>t.key)}values(){return this[OR].toArray().map(t=>t.value)}reset(){this[Ofe]&&this[OR]&&this[OR].length&&this[OR].forEach(t=>this[Ofe](t.key,t.value)),this[kV]=new Map,this[OR]=new ehh,this[_fe]=0}dump(){return this[OR].map(t=>vRr(this,t)?!1:{k:t.key,v:t.value,e:t.now+(t.maxAge||0)}).toArray().filter(t=>t)}dumpLru(){return this[OR]}set(t,n,i){if(i=i||this[n9e],i&&typeof i!="number")throw new TypeError("maxAge must be a number");let o=i?Date.now():0,s=this[Wet](n,t);if(this[kV].has(t)){if(s>this[r9e])return Vet(this,this[kV].get(t)),!1;let p=this[kV].get(t).value;return this[Ofe]&&(this[MQc]||this[Ofe](t,p.value)),p.now=o,p.maxAge=i,p.value=n,this[_fe]+=s-p.length,p.length=s,this.get(t),JPt(this),!0}let a=new IVo(t,n,s,o,i);return a.length>this[r9e]?(this[Ofe]&&this[Ofe](t,n),!1):(this[_fe]+=a.length,this[OR].unshift(a),this[kV].set(t,this[OR].head),JPt(this),!0)}has(t){if(!this[kV].has(t))return!1;let n=this[kV].get(t).value;return!vRr(this,n)}get(t){return vVo(this,t,!0)}peek(t){return vVo(this,t,!1)}pop(){let t=this[OR].tail;return t?(Vet(this,t),t.value):null}del(t){Vet(this,this[kV].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[kV].forEach((t,n)=>vVo(this,n,!1))}},vVo=(r,t,n)=>{let i=r[kV].get(t);if(i){let o=i.value;if(vRr(r,o)){if(Vet(r,i),!r[XPt])return}else n&&(r[DQc]&&(i.value.now=Date.now()),r[OR].unshiftNode(i));return o.value}},vRr=(r,t)=>{if(!t||!t.maxAge&&!r[n9e])return!1;let n=Date.now()-t.now;return t.maxAge?n>t.maxAge:r[n9e]&&n>r[n9e]},JPt=r=>{if(r[_fe]>r[r9e])for(let t=r[OR].tail;r[_fe]>r[r9e]&&t!==null;){let n=t.prev;Vet(r,t),t=n}},Vet=(r,t)=>{if(t){let n=t.value;r[Ofe]&&r[Ofe](n.key,n.value),r[_fe]-=n.length,r[kV].delete(n.key),r[OR].removeNode(t)}},IVo=class{constructor(t,n,i,o,s){this.key=t,this.value=n,this.length=i,this.now=o,this.maxAge=s||0}},NQc=(r,t,n,i)=>{let o=n.value;vRr(r,o)&&(Vet(r,n),r[XPt]||(o=void 0)),o&&t.call(i,o.value,o.key,r)};kQc.exports=TVo});var lU=A((fB2,FQc)=>{var RVo=class r{constructor(t,n){if(n=rhh(n),t instanceof r)return t.loose===!!n.loose&&t.includePrerelease===!!n.includePrerelease?t:new r(t.raw,n);if(t instanceof OVo)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=>!LQc(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&&chh(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&&ahh)|(this.options.loose&&uhh))+":"+t,o=BQc.get(i);if(o)return o;let s=this.options.loose,a=s?H6[hN.HYPHENRANGELOOSE]:H6[hN.HYPHENRANGE];t=t.replace(a,bhh(this.options.includePrerelease)),Ib("hyphen replace",t),t=t.replace(H6[hN.COMPARATORTRIM],ihh),Ib("comparator trim",t),t=t.replace(H6[hN.TILDETRIM],ohh),Ib("tilde trim",t),t=t.replace(H6[hN.CARETTRIM],shh),Ib("caret trim",t);let u=t.split(" ").map(d=>lhh(d,this.options)).join(" ").split(/\s+/).map(d=>Ahh(d,this.options));s&&(u=u.filter(d=>(Ib("loose invalid filter",d,this.options),!!d.match(H6[hN.COMPARATORLOOSE])))),Ib("range list",u);let p=new Map,c=u.map(d=>new OVo(d,this.options));for(let d of c){if(LQc(d))return[d];p.set(d.value,d)}p.size>1&&p.has("")&&p.delete("");let l=[...p.values()];return BQc.set(i,l),l}intersects(t,n){if(!(t instanceof r))throw new TypeError("a Range is required");return this.set.some(i=>qQc(i,n)&&t.set.some(o=>qQc(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 nhh(t,this.options)}catch{return!1}for(let n=0;n<this.set.length;n++)if(Ehh(this.set[n],t,this.options))return!0;return!1}};FQc.exports=RVo;var thh=ZPt(),BQc=new thh({max:1e3}),rhh=hRr(),OVo=eMt(),Ib=$Pt(),nhh=F4(),{safeRe:H6,t:hN,comparatorTrimReplace:ihh,tildeTrimReplace:ohh,caretTrimReplace:shh}=Get(),{FLAG_INCLUDE_PRERELEASE:ahh,FLAG_LOOSE:uhh}=KPt(),LQc=r=>r.value==="<0.0.0-0",chh=r=>r.value==="",qQc=(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},lhh=(r,t)=>(Ib("comp",r,t),r=fhh(r,t),Ib("caret",r),r=phh(r,t),Ib("tildes",r),r=ghh(r,t),Ib("xrange",r),r=yhh(r,t),Ib("stars",r),r),gN=r=>!r||r.toLowerCase()==="x"||r==="*",phh=(r,t)=>r.trim().split(/\s+/).map(n=>dhh(n,t)).join(" "),dhh=(r,t)=>{let n=t.loose?H6[hN.TILDELOOSE]:H6[hN.TILDE];return r.replace(n,(i,o,s,a,u)=>{Ib("tilde",r,i,o,s,a,u);let p;return gN(o)?p="":gN(s)?p=`>=${o}.0.0 <${+o+1}.0.0-0`:gN(a)?p=`>=${o}.${s}.0 <${o}.${+s+1}.0-0`:u?(Ib("replaceTilde pr",u),p=`>=${o}.${s}.${a}-${u} <${o}.${+s+1}.0-0`):p=`>=${o}.${s}.${a} <${o}.${+s+1}.0-0`,Ib("tilde return",p),p})},fhh=(r,t)=>r.trim().split(/\s+/).map(n=>hhh(n,t)).join(" "),hhh=(r,t)=>{Ib("caret",r,t);let n=t.loose?H6[hN.CARETLOOSE]:H6[hN.CARET],i=t.includePrerelease?"-0":"";return r.replace(n,(o,s,a,u,p)=>{Ib("caret",r,o,s,a,u,p);let c;return gN(s)?c="":gN(a)?c=`>=${s}.0.0${i} <${+s+1}.0.0-0`:gN(u)?s==="0"?c=`>=${s}.${a}.0${i} <${s}.${+a+1}.0-0`:c=`>=${s}.${a}.0${i} <${+s+1}.0.0-0`:p?(Ib("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`):(Ib("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`),Ib("caret return",c),c})},ghh=(r,t)=>(Ib("replaceXRanges",r,t),r.split(/\s+/).map(n=>mhh(n,t)).join(" ")),mhh=(r,t)=>{r=r.trim();let n=t.loose?H6[hN.XRANGELOOSE]:H6[hN.XRANGE];return r.replace(n,(i,o,s,a,u,p)=>{Ib("xRange",r,i,o,s,a,u,p);let c=gN(s),l=c||gN(a),d=l||gN(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`),Ib("xRange return",i),i})},yhh=(r,t)=>(Ib("replaceStars",r,t),r.trim().replace(H6[hN.STAR],"")),Ahh=(r,t)=>(Ib("replaceGTE0",r,t),r.trim().replace(H6[t.includePrerelease?hN.GTE0PRE:hN.GTE0],"")),bhh=r=>(t,n,i,o,s,a,u,p,c,l,d,f,h)=>(gN(i)?n="":gN(o)?n=`>=${i}.0.0${r?"-0":""}`:gN(s)?n=`>=${i}.${o}.0${r?"-0":""}`:a?n=`>=${n}`:n=`>=${n}${r?"-0":""}`,gN(c)?p="":gN(l)?p=`<${+c+1}.0.0-0`:gN(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()),Ehh=(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(Ib(r[i].semver),r[i].semver!==OVo.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 eMt=A((hB2,HQc)=>{var tMt=Symbol("SemVer ANY"),xVo=class r{static get ANY(){return tMt}constructor(t,n){if(n=zQc(n),t instanceof r){if(t.loose===!!n.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),wVo("comparator",t,n),this.options=n,this.loose=!!n.loose,this.parse(t),this.semver===tMt?this.value="":this.value=this.operator+this.semver.version,wVo("comp",this)}parse(t){let n=this.options.loose?UQc[jQc.COMPARATORLOOSE]:UQc[jQc.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 QQc(i[2],this.options.loose):this.semver=tMt}toString(){return this.value}test(t){if(wVo("Comparator.test",t,this.options.loose),this.semver===tMt||t===tMt)return!0;if(typeof t=="string")try{t=new QQc(t,this.options)}catch{return!1}return _Vo(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 GQc(t.value,n).test(this.value):t.operator===""?t.value===""?!0:new GQc(this.value,n).test(t.semver):(n=zQc(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("=")||_Vo(this.semver,"<",t.semver,n)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||_Vo(this.semver,">",t.semver,n)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};HQc.exports=xVo;var zQc=hRr(),{safeRe:UQc,t:jQc}=Get(),_Vo=EVo(),wVo=$Pt(),QQc=F4(),GQc=lU()});var rMt=A((gB2,WQc)=>{var Shh=lU(),Chh=(r,t,n)=>{try{t=new Shh(t,n)}catch{return!1}return t.test(r)};WQc.exports=Chh});var KQc=A((mB2,VQc)=>{var vhh=lU(),Thh=(r,t)=>new vhh(r,t).set.map(n=>n.map(i=>i.value).join(" ").trim().split(" "));VQc.exports=Thh});var YQc=A((yB2,$Qc)=>{var Ihh=F4(),Rhh=lU(),Ohh=(r,t,n)=>{let i=null,o=null,s=null;try{s=new Rhh(t,n)}catch{return null}return r.forEach(a=>{s.test(a)&&(!i||o.compare(a)===-1)&&(i=a,o=new Ihh(i,n))}),i};$Qc.exports=Ohh});var XQc=A((AB2,JQc)=>{var _hh=F4(),whh=lU(),xhh=(r,t,n)=>{let i=null,o=null,s=null;try{s=new whh(t,n)}catch{return null}return r.forEach(a=>{s.test(a)&&(!i||o.compare(a)===1)&&(i=a,o=new _hh(i,n))}),i};JQc.exports=xhh});var tGc=A((bB2,eGc)=>{var PVo=F4(),Phh=lU(),ZQc=YPt(),Mhh=(r,t)=>{r=new Phh(r,t);let n=new PVo("0.0.0");if(r.test(n)||(n=new PVo("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 PVo(a.semver.version);switch(a.operator){case">":u.prerelease.length===0?u.patch++:u.prerelease.push(0),u.raw=u.format();case"":case">=":(!s||ZQc(u,s))&&(s=u);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),s&&(!n||ZQc(n,s))&&(n=s)}return n&&r.test(n)?n:null};eGc.exports=Mhh});var nGc=A((EB2,rGc)=>{var Nhh=lU(),Dhh=(r,t)=>{try{return new Nhh(r,t).range||"*"}catch{return null}};rGc.exports=Dhh});var TRr=A((SB2,aGc)=>{var khh=F4(),sGc=eMt(),{ANY:Bhh}=sGc,Lhh=lU(),qhh=rMt(),iGc=YPt(),oGc=ARr(),Fhh=ERr(),zhh=bRr(),Uhh=(r,t,n,i)=>{r=new khh(r,i),t=new Lhh(t,i);let o,s,a,u,p;switch(n){case">":o=iGc,s=Fhh,a=oGc,u=">",p=">=";break;case"<":o=oGc,s=zhh,a=iGc,u="<",p="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(qhh(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===Bhh&&(h=new sGc(">=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};aGc.exports=Uhh});var cGc=A((CB2,uGc)=>{var jhh=TRr(),Qhh=(r,t,n)=>jhh(r,t,">",n);uGc.exports=Qhh});var pGc=A((vB2,lGc)=>{var Ghh=TRr(),Hhh=(r,t,n)=>Ghh(r,t,"<",n);lGc.exports=Hhh});var hGc=A((TB2,fGc)=>{var dGc=lU(),Whh=(r,t,n)=>(r=new dGc(r,n),t=new dGc(t,n),r.intersects(t,n));fGc.exports=Whh});var mGc=A((IB2,gGc)=>{var Vhh=rMt(),Khh=cU();gGc.exports=(r,t,n)=>{let i=[],o=null,s=null,a=r.sort((l,d)=>Khh(l,d,n));for(let l of a)Vhh(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 CGc=A((RB2,SGc)=>{var yGc=lU(),NVo=eMt(),{ANY:MVo}=NVo,nMt=rMt(),DVo=cU(),$hh=(r,t,n={})=>{if(r===t)return!0;r=new yGc(r,n),t=new yGc(t,n);let i=!1;e:for(let o of r.set){for(let s of t.set){let a=Jhh(o,s,n);if(i=i||a!==null,a)continue e}if(i)return!1}return!0},Yhh=[new NVo(">=0.0.0-0")],AGc=[new NVo(">=0.0.0")],Jhh=(r,t,n)=>{if(r===t)return!0;if(r.length===1&&r[0].semver===MVo){if(t.length===1&&t[0].semver===MVo)return!0;n.includePrerelease?r=Yhh:r=AGc}if(t.length===1&&t[0].semver===MVo){if(n.includePrerelease)return!0;t=AGc}let i=new Set,o,s;for(let h of r)h.operator===">"||h.operator===">="?o=bGc(o,h,n):h.operator==="<"||h.operator==="<="?s=EGc(s,h,n):i.add(h.semver);if(i.size>1)return null;let a;if(o&&s){if(a=DVo(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&&!nMt(h,String(o),n)||s&&!nMt(h,String(s),n))return null;for(let m of t)if(!nMt(h,String(m),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=bGc(o,h,n),u===h&&u!==o)return!1}else if(o.operator===">="&&!nMt(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=EGc(s,h,n),p===h&&p!==s)return!1}else if(s.operator==="<="&&!nMt(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)},bGc=(r,t,n)=>{if(!r)return t;let i=DVo(r.semver,t.semver,n);return i>0?r:i<0||t.operator===">"&&r.operator===">="?t:r},EGc=(r,t,n)=>{if(!r)return t;let i=DVo(r.semver,t.semver,n);return i<0?r:i>0||t.operator==="<"&&r.operator==="<="?t:r};SGc.exports=$hh});var i9e=A((OB2,IGc)=>{var kVo=Get(),vGc=KPt(),Xhh=F4(),TGc=mVo(),Zhh=e9e(),e1h=Hjc(),t1h=Vjc(),r1h=Yjc(),n1h=Zjc(),i1h=tQc(),o1h=nQc(),s1h=oQc(),a1h=aQc(),u1h=cU(),c1h=pQc(),l1h=fQc(),p1h=yRr(),d1h=yQc(),f1h=bQc(),h1h=YPt(),g1h=ARr(),m1h=AVo(),y1h=bVo(),A1h=bRr(),b1h=ERr(),E1h=EVo(),S1h=_Qc(),C1h=eMt(),v1h=lU(),T1h=rMt(),I1h=KQc(),R1h=YQc(),O1h=XQc(),_1h=tGc(),w1h=nGc(),x1h=TRr(),P1h=cGc(),M1h=pGc(),N1h=hGc(),D1h=mGc(),k1h=CGc();IGc.exports={parse:Zhh,valid:e1h,clean:t1h,inc:r1h,diff:n1h,major:i1h,minor:o1h,patch:s1h,prerelease:a1h,compare:u1h,rcompare:c1h,compareLoose:l1h,compareBuild:p1h,sort:d1h,rsort:f1h,gt:h1h,lt:g1h,eq:m1h,neq:y1h,gte:A1h,lte:b1h,cmp:E1h,coerce:S1h,Comparator:C1h,Range:v1h,satisfies:T1h,toComparators:I1h,maxSatisfying:R1h,minSatisfying:O1h,minVersion:_1h,validRange:w1h,outside:x1h,gtr:P1h,ltr:M1h,intersects:N1h,simplifyRange:D1h,subset:k1h,SemVer:Xhh,re:kVo.re,src:kVo.src,tokens:kVo.t,SEMVER_SPEC_VERSION:vGc.SEMVER_SPEC_VERSION,RELEASE_TYPES:vGc.RELEASE_TYPES,compareIdentifiers:TGc.compareIdentifiers,rcompareIdentifiers:TGc.rcompareIdentifiers}});var iMt,B1h,_B2,L1h,IS,Ote=z(()=>{"use strict";iMt=Nt(cV()),B1h=Nt(i9e()),_B2=(0,iMt.Record)({version:iMt.String,hash:iMt.String}),L1h=()=>{let r="7.46.0",t="73f84b9cde56015d1693db94100d9c1ade9aac5e";return r&&t?{version:r,hash:t}:null},IS=L1h()});var hCe,Ket,IRr=z(()=>{"use strict";ur();hCe=class extends Ke{constructor(n){super(`Run ${n} canceled by user`);this.runID=n}runID;fault="client"},Ket=class extends Ke{constructor(n){super('Test failed with "continue on failure" set to false');this.result=n}result;fault="client"}});var RRr,ORr,_Rr,BVo,RGc,OGc,o9e,oMt,sMt,wRr,$et=z(()=>{"use strict";yA();IRr();RRr=5e5,ORr=(r,t=RRr)=>{if(r.length*3<=t)return r;let n=new TextEncoder().encode(r);if(n.length<=t)return r;let i=new TextDecoder("utf8").decode(n.slice(0,t));return i.slice(-1)==="\uFFFD"&&(i=i.slice(0,-1)),`${i}...data truncated`},_Rr=r=>"status"in r&&r.status!=="Queued",BVo=r=>r==="complete"||r==="error"||r==="canceled"||r==="skipped",RGc=(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"}},OGc=r=>typeof r=="object"&&r instanceof Ket,o9e=r=>typeof r=="object"&&(r instanceof Ey||r instanceof hCe),oMt=r=>typeof r=="object"&&r instanceof aU&&r.isCancel(),sMt=r=>typeof r=="object"&&r instanceof Rte&&r.isCancel(),wRr=r=>o9e(r)||oMt(r)||sMt(r)});var _Gc,gCe,aMt=z(()=>{"use strict";ur();vfe();ns();Yu();Xt();vy();SR();VSe();Wd();Ote();WPt();IRr();$et();_Gc=500,gCe=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;runEventPublisher=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});setRunEventPublisher(t){this.runEventPublisher=t}publishNodeExecuted(t){let n=this.runResults[t],i=this.state.nodes[t];this.runEventPublisher&&n&&i&&this.runEventPublisher.nodeExecuted(t,i.operation,n)}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(NC(t)){if(t instanceof Y8e)return!1;if(t instanceof $u)return!1}throw t}}async throwIfRunCanceled(){if(await this.runIsCanceled())throw new hCe(this.runID)}updateNodeLocalRunResult({stepID:t,isPreview:n,runExecutionSequenceID:i},o){let s=this.runResults[t];if(s){let a=s.runState;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(u=>{!u.isRunning&&(u.status==="Queued"||u.status==="Running")&&(u.status="Canceled")}),BVo(o)&&!BVo(a)&&this.publishNodeExecuted(t)}else 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();mg("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,...IS?{softwareVersion:IS.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 Ke("No repository to get runs collection for!");return this.repository.orgs.get(this.logContext.orgID).runs}getRepositoryForRun(){return this.getRepositoryRunsCollection().get(this.runID)}formatError=(t,n=null,i=null,o=!1)=>{let s=ma(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=L1(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 Ke(`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=L1(u,this.runResults,"populateQueuedStages: this.runResults"),l=this.state.nodes[u],d=l?lN(l,void 0):!1,f=Qet(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,continueOnFailure:o}){return{name:t,continueOnFailure:o,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,type:t.stageType??"sql",stageExecutionStartTime:t.stageExecutionStartTime,stageExecutionEndTime:t.stageExecutionEndTime,continueOnFailure:t.continueOnFailure}}ensureHasQueryResult(t){if(mg("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=L1(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 Ke(`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":mR(t.error)??"system";return UC(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 Ke(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=lN(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:Sxt(t.startTime),endTime:Sxt(t.endTime)}}getCurrentStageIndex(t){let n=this.nodeStageIndexTracker.get(t);if(n===void 0)throw new Ke(`[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,continueOnFailure:t.continueOnFailure}}getStepRunState(t,n){return RGc(t,n,this.operationType)}async updateRunResult(t){if(!this.repository)return;let n=this.runResults[t];if(!n)throw new Ke(`[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 Ke(`[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 Ke(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(fTr(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 o9e(t)?!0:oMt(t)?this.runIsCanceled():sMt(t)?this.runIsCanceled():!1}static truncateQueryResult(t,n=RRr,i=_Gc){let o=t.sql,s=t.rows,a,u;if(o){let p=ORr(o,n);p!==o&&(a=p)}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(RRr/n)-100,s=_Gc/(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 xRr,wGc=z(()=>{"use strict";la();ns();Yu();U6();WPt();VPt();aMt();xRr=class extends gCe{constructor(n,i,o,s,a){super(n,i,o,"create",a);this.phasedNodeData=s}phasedNodeData;getNameForStageWithoutSQL=(n,i)=>fRr(n,i);getNodeDataForUpdate=n=>{let i=this.getSingleStepData(n.phase,n.stepID),o=i.operation.locationName,s=nU(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),mbc("(Logging Only) Compare locations from context and workspace",a,()=>{let l=nU(this.state.mappings||{},this.state.currentWorkspace);mg("DEPLOY",zF(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 DV(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=BJe(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 DV(n.stepID,`Failed to update node metadata for ${n.stepName} (${a}): ${s}`)}this.publishNodeDeployState(n)}publishNodeDeployState(n){let i=this.state.nodes[n.stepID];!this.runEventPublisher||!i||(n.phase==="deletedTable"?this.runEventPublisher.nodeRemoved(n.stepID,i.operation):this.runEventPublisher.nodeDeployed(n.stepID,i.operation))}}});var xGc,PRr,LVo=z(()=>{"use strict";ur();xGc=(r,t)=>{let n=new Set(t);return n.delete(r),Array.from(n)},PRr=async(r,t,n)=>{if(!t)throw new Ke(`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 MRr,PGc=z(()=>{"use strict";MRr="No SQL to execute"});var uMt=z(()=>{"use strict";LVo();PGc()});var NRr,MGc=z(()=>{"use strict";uMt();aMt();NRr=class extends gCe{constructor(t,n,i,o){super(t,n,i,"run",o)}async initializeRunResults(t){await super.initializeRunResults(t,"waiting")}getNameForStageWithoutSQL=()=>MRr}});var NGc=z(()=>{"use strict"});var DRr,qVo=z(()=>{"use strict";DRr=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 kRr,BRr,mCe=z(()=>{"use strict";Xt();wGc();MGc();$et();IRr();aMt();NGc();qVo();$et();kRr=class extends xRr{constructor(t,n,i,o,s){super(t,n,i,o,s)}get Logger(){return Ge("DEPLOY")}get runTypeName(){return"Deploy"}},BRr=class extends NRr{get Logger(){return Ge("RUNNER")}get runTypeName(){return"Refresh"}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(OGc(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),stageExecutionStartTime:t.stageExecutionStartTime,stageExecutionEndTime:t.stageExecutionEndTime,continueOnFailure:t.continueOnFailure});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)}}});var Yet,Jet,s9e=z(()=>{"use strict";Yet=["deletedTable","alteredTable","addedTable"],Jet=["refresh"]});var LRr,cMt,qRr,DGc,kGc,F1h,z1h,U1h,j1h,BGc,Xet,FRr,FVo,wfe,xfe=z(()=>{"use strict";la();hA();so();Xt();iHo();FWo();LRr=`{%- macro get_value_by_column_attribute(column_attribute, value="name") -%}
9465
+ %s`,H,H,C,a);let V=C.type==="*"?$Wo:C.type==="?"?JWo:"\\"+C.type;u=!0,a=a.slice(0,C.reStart)+V+"\\("+H}F(),p&&(a+="\\\\");let U=h0h[a.charAt(0)];for(let H=l.length-1;H>-1;H--){let V=l[H],q=a.slice(0,V.reStart),K=a.slice(V.reStart,V.reEnd-8),Y=a.slice(V.reEnd),Z=a.slice(V.reEnd-8,V.reEnd)+Y,se=q.split(")").length,oe=q.split("(").length-se,pe=Y;for(let re=0;re<oe;re++)pe=pe.replace(/\)[+*?]?/,"");Y=pe;let ge=Y===""&&n!==nRr?"(?:$|\\/)":"";a=q+K+Y+ge+Z}if(a!==""&&u&&(a="(?=.)"+a),U&&(a=D()+a),n===nRr)return[a,u];if(i.nocase&&!u&&!i.nocaseMagicOnly&&(u=t.toUpperCase()!==t.toLowerCase()),!u)return b0h(t);let Q=i.nocase?"i":"";try{let H=s?{_glob:t,_src:a,test:s}:{_glob:t,_src:a};return Object.assign(new RegExp("^"+a+"$",Q),H)}catch(H){return this.debug("invalid regexp",H),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?$Wo:n.dot?d0h:f0h,o=n.nocase?"i":"",s=t.map(a=>{let u=a.map(p=>typeof p=="string"?S0h(p):p===q4?q4:p._src);return u.forEach((p,c)=>{let l=u[c+1],d=u[c-1];p!==q4||d===q4||(d===void 0?l!==void 0&&l!==q4?u[c+1]="(?:\\/|"+i+"\\/)?"+l:u[c]=i:l===void 0?u[c-1]=d+"(?:\\/|"+i+")?":l!==q4&&(u[c-1]=d+"(?:\\/|\\/"+i+"\\/)"+l,u[c+1]=q4))}),u.filter(p=>p!==q4).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("/"):iRr&&/^\/\/[^\/]+/.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;YWo.sep!=="/"&&(t=t.split(YWo.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 IR.defaults(t).Minimatch}};IR.Minimatch=Fet});var WUc,VUc,KUc,$Uc,YUc,JUc,XUc,ZUc,ejc,tjc,rjc,HUc,zet,njc=z(()=>{"use strict";FPt();WUc=2,VUc=1,KUc=3,$Uc=2,YUc=8,JUc=5,XUc=6,ZUc=new RegExp(/([\+]?){([\s\S]+)}([\+](?![\+]))?\s*/g),ejc=new RegExp(/((\w+):\s*((?:["])((([^\"\+\r\n\[/\\]+))(?:["]))|(([^\"\ \+\r\n\[/\\]+))))/g),tjc=new RegExp(/((\w+):\s*(((?:["])(((?:[^"]|"")*))(?:["]))|(([^\"\ \+\r\n\[/\\]+))))/g),rjc=new RegExp(/((?:[^\+\ \r\n\[\\]|\\.|\[(?:[^\r\n\]\\]|\\.)*\])+)\s*/g),HUc="",zet=(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,HUc):""),i=t.replace(/\//g,HUc);return!!XWo(n,i).length}});var Uet,G82,ijc,ojc,sjc,sRr,ajc,aRr=z(()=>{"use strict";Xr();ns();qp();qT();Xt();HWo();njc();Uet=Ge("SEARCH"),G82=x.object({include:x.string(),exclude:x.string(),enabled:x.boolean()}),ijc={name:{MatchFunction:zet,MatchList:r=>[r.operation.name]},location:{MatchFunction:zet,MatchList:r=>[r.operation.locationName]},nodeType:{MatchFunction:zet,MatchList:r=>[r.operation.sqlType]},subgraph:{MatchFunction:zet,MatchList:r=>[r?.id?.toString(),r.name]},nodeID:{MatchFunction:zet,MatchList:r=>[r]}},ojc=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},sjc=(r,t,n,i=!1)=>{let{steps:o,graphInformation:s,allSubgraphs:a,allStepTypesYAML:u}=n,p={},c=kC()?Date.now():performance.now(),l=r;l||(l=t);let d=l.split(/(\}\+?)\s*(or|OR|\|\|)\s*(\+?\{)/).filter(m=>!(m==="OR"||m==="or"||m==="||")),f=ojc(d);f.length||(f=[t]),Uet.debug("got unions",f,"searchStringTouse",l,"defaultSearchString",t,"steps",o),f.forEach(m=>{let E=m.split(/(\}\+?)\s*(and|AND|\,)\s*(\+?\{)/).filter(D=>!(D==="AND"||D==="and"||D===",")),C=ojc(E),T=[];C.forEach(D=>{let L={};Uet.debug("Got intersection:",D);let F=[...D.matchAll(ZUc)];if(Uet.debug("Got matches:",D,F),!F[0])return;let U=F[0][WUc],Q={prefix:F[0][VUc]||"",postfix:F[0][KUc]||""};if(U.indexOf(":")>-1){let q=i?tjc:ejc,K=[...U.trim().matchAll(q)],Y=i?XUc:JUc;K.forEach(Z=>{let se=Z[$Uc],oe=Z[YUc]||Z[Y];Q[se]=oe})}else{let K=[...U.trim().matchAll(rjc)][0];K&&(Q.name=K[0])}O4(Q);let H=Q;Uet.debug("Got groups ",D,H);let V=new Set;if(H.subgraph?Object.values(a).forEach(q=>{let K=ijc.subgraph,Y=K.MatchList(q);if(K.MatchFunction(Y,H.subgraph)){let{steps:se}=q;se.forEach(oe=>{V.add(oe.toString())})}else return}):V=new Set(Object.keys(o)),H.nodeType){let{nodeType:q}=H;if(!u[q]){let K=q;Object.entries(u).forEach(([Y,Z])=>{Z.name===q&&(K=Y)}),H.nodeType=K}}Object.keys(o).forEach(q=>{if(!H){Uet.emerg("got an unexpected undefined value for match",l,H,D);return}let K=V.has(q);if(Object.entries(H).forEach(([Y,Z])=>{let se=o[q];if(Y==="nodeID"&&(se=q),Y==="subgraph"){K=V.has(q);return}let oe=ijc[Y];if(oe){let pe=oe.MatchList(se).filter(ge=>ge!=null);K=K&&oe.MatchFunction(pe,Z)}}),K){if(L[q]=!0,H.prefix&&s){let Y=GWo(s,q,"predecessors");Object.values(Y).forEach(Z=>[...Z.keys()].forEach(se=>L[se]=!0))}if(H.postfix&&s){let Y=GWo(s,q,"successors");Object.values(Y).forEach(Z=>[...Z.keys()].forEach(se=>L[se]=!0))}}}),T.push(L)}),T.length||T.push({});let _={};Object.keys(o).forEach(D=>{_[D]=!0});let R=T.reduce((D,L)=>Object.fromEntries(obc(D,L).map(F=>[F,!0])),_);p={...p,...R}});let h=kC()?Date.now():performance.now();return Uet.debug("Time that search took: ",h-c),p},sRr=(r,t,n,i=!1)=>{let o=sjc(`${r}`,"{ * }",n,i),s=sjc(`${t}`,"!*",n,i),a=o;return Object.keys(s).forEach(u=>{delete a[u]}),{stepsResult:a}},ajc=(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 T0h,ujc,ZWo,cjc,uRr=z(()=>{"use strict";so();Xt();aRr();T0h=Ge("JOBS"),ujc=r=>!r?.hasOwnProperty("includeSelector")||!r?.hasOwnProperty("version"),ZWo=(r,t,n)=>{let{steps:i,subgraphs:o,...s}=r,a={...s};if(a.hasOwnProperty("version")||(a.version=zee),a.hasOwnProperty("includeSelector"))return a;a.includeSelector="",a.excludeSelector="";let u=new Set(i),p=new Set(o),d=ajc([...u],[...p].map(f=>`${f}`),n,t).map(f=>`+${f}`).join(" OR ");return a.includeSelector=d,T0h.info("Upgrading job v1 to v2",r,a),a},cjc=(r,t)=>{let{jobs:n,folders:i,steps:o}=r,s=n[t];return ZWo(s,i,o)}});var Z82,ljc,pjc=z(()=>{"use strict";ur();Yu();Xt();cfe();Z82=Ge("PACKAGES_BACKEND"),ljc=(r,t,n)=>{let i=qGo(t)??"",o=r?.config?.entities?.nodeTypes[i];return o||(n.error(`No config found for node type ${t}`),{isDisabled:!1,defaultStorageLocation:null})}});var lCe,I0h,R0h,zPt=z(()=>{"use strict";la();Xt();N8e();pjc();lCe=(r,t={})=>Object.values(r).map(n=>I0h(n)).reduce((n,i)=>{for(let[o,s]of Object.entries(i))n[o]=s;return n},t),I0h=r=>Object.fromEntries(Object.entries(r?.contents?.nodeTypes??{}).map(([t,n])=>{let{id:i,nodeType:o}=R0h(r.alias,t,r,n);return[i,o]})),R0h=(r,t,n,i)=>{let o=J3r(r,t),{isDisabled:s,defaultStorageLocation:a}=ljc(n,o,Ge("PACKAGES")),u={...xc(i),id:o,isDisabled:s};return u.metadata.defaultStorageLocation=a,{id:o,nodeType:u}}});var Ho,O0h,djc,fjc,eVo,l92,_0h,hjc,w0h,x0h,cRr,tVo=z(()=>{"use strict";Ho=Nt(cV());so();sL();rEr();ru();O0h=Ho.Record({type:Ho.Unknown,name:Ho.String}),djc=Ho.Record({locationName:Ho.String,nodeName:Ho.String}),fjc=Ho.Record({sql:Ho.String,success:Ho.Boolean,rows:Ho.Array(Ho.Unknown),fields:Ho.Array(O0h),error:Ho.Union(Ho.Null,K2r).optional(),startTime:Ho.Unknown,endTime:Ho.Unknown,status:Ho.String,name:Ho.String,isRunning:Ho.Boolean,exportedRefs:Ho.Array(djc),invalidExportedRefs:Ho.Array(djc),queryResultSequence:Ho.Optional(Ho.Unknown),type:Ho.Union(Ho.Literal("sql"),Ho.Literal("sqlTest")).optional(),warehouse:Ho.String.nullable().optional(),queryID:Ho.String.nullable().optional(),failingRowCount:Ho.Number.optional(),continueOnFailure:Ho.Boolean.optional()}),eVo=Ho.Record({name:Ho.String,queryResults:Ho.Array(fjc),isRunning:Ho.Boolean,renderQueryResults:Ho.Optional(fjc)}),l92=Ho.Record({runExecutionSequenceID:Ho.Number,runResultVersion:Ho.Number,name:Ho.String,queryResultSequence:eVo,runState:Ho.String}),_0h=Ho.Record({dataResult:Ho.Unknown,name:Ho.String,queryResultSequence:eVo,runExecutionSequenceID:Ho.Number,runResultVersion:Ho.Number,runState:Ho.String,stepRunState:UJe(qBo)}),hjc=R4("RunResultFirestoreValidator",_0h),w0h=Ho.Record({nodeID:Ho.String,queryResultSequence:eVo,runState:Ho.String,hasTestFailures:Ho.Boolean.optional()}),x0h=Ho.Record({runResults:Ho.Record({runStartTime:Ho.Unknown,runEndTime:Ho.Unknown,runFailureReason:Ho.Optional(Ho.String),runType:Ho.String,runStatus:Ho.String,runResults:Ho.Array(w0h),runID:Ho.Number,environmentID:Ho.String,snowflakeAccount:Ho.String.optional(),snowflakeWarehouse:Ho.String.optional(),jobID:Ho.Number.optional(),hasFailedTest:Ho.Boolean.optional(),runTimeParameters:Ho.Unknown.nullable(),includeNodesSelector:Ho.String.optional(),excludeNodesSelector:Ho.String.optional()})}),cRr=R4("TRunOutput",x0h)});var f92,gjc=z(()=>{"use strict";so();rEr();f92=UJe(LBo)});var J8e,lRr=z(()=>{"use strict";la();qT();Xt();J8e=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(Ge("PIPELINE").appContext(this.logContext,i,"Nodes present in both current-phase data AND extra non-phased (views & advanced deploy) data:",dvo([...o],s)),this.noDependenciesPhases.includes(t))return Object.fromEntries(a.map(u=>[u,[]]));{let u=this.getNodeRefsInPhase(t,a),p=new F8e(pS(this.allNodes,a));return lS(u,(c,l)=>{let{nodeIDsToAdd:d}=fet(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 C92,rVo=z(()=>{"use strict";ur();Xt();Yu();C92=Ge("DEBUG")});var mjc=z(()=>{"use strict"});var pRr,nVo=z(()=>{"use strict";pRr=r=>{typeof r.stepCounter=="number"&&(r.stepCounter=`${r.stepCounter}`),typeof r.columnCounter=="number"&&(r.columnCounter=`${r.columnCounter}`)}});var pCe,Xs,iVo=z(()=>{"use strict";xs();qz();pCe=new Date("1980-01-01T00:00:00.000Z"),Xs=(r,t,n)=>{let i=`${r}Entity`;return n||(n=ia(t)),{standard:Pr(i,n),strict:Pr(`${i} (strict)`,t)}}});var yjc,M0h,Ajc,X8e,UPt,oVo,sVo,Ju,aVo,RR,uVo=z(()=>{"use strict";uA();iVo();efe();yjc=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]},M0h=(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()===J0e.SENTINEL_DATE&&Kl().emerg(`Repository server timestamp sentinel value found in stored data at path ${t}`),[i,!0]}}return[r,!1]},Ajc=(r,t)=>r instanceof g8e?[t.getDeleteSentinel(),!0]:r instanceof Date&&r.getTime()===J0e.SENTINEL_DATE?[t.getServerTimestampSentinel(),!0]:[r,!1],X8e=(r,t,n)=>{let[i,o]=t(n,r);if(!o&&typeof i=="object"){if(Array.isArray(i))return i.map(s=>X8e(r,t,s));for(let s in i)i.hasOwnProperty(s)&&(i[s]=X8e(r,t,i[s]))}return i},UPt=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 Kl().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 Kl().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 Kl().debug(`Error merge transforming repository entity ${n} to storage ${a}`),a}return i}},oVo=class extends UPt{constructor(n=!1){super();this.preserveID=n}preserveID;transformFromStorage(n,i,o){return"id"in o?o.id!=n&&(Kl().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=pCe),"updatedAt"in o||(o.updatedAt=pCe),X8e(i,M0h,o)}transformToStorage(n,i,o,s){return this.preserveID||delete o.id,X8e(i,a=>{let[u,p]=Ajc(a,s);return p?[u,!0]:yjc(u)},o)}mergeTransformToStorage(n,i,o,s){return this.preserveID||delete o.id,X8e(i,a=>{let[u,p]=Ajc(a,s);return p?[u,!0]:yjc(u)},o)}},sVo=class extends UPt{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 oVo(n),new sVo(r)];return t&&i.unshift(t),new aVo(...i)},aVo=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)}},RR=class extends UPt{transformToStorage(t,n,i){return i}mergeTransformToStorage(t,n,i){return i}}});var xf=z(()=>{"use strict";uVo()});var bjc,jet,NV,cVo,jPt,uU,dCe,pVo,N0h,D0h,Ejc,lVo,dRr,Sjc=z(()=>{"use strict";so();Xt();xf();nVo();bjc=r=>!!r&&typeof r=="object"&&!Array.isArray(r),jet=r=>bjc(r)&&!(r instanceof Date)&&!(r instanceof RegExp),NV=r=>{if(typeof r=="string")return r;if(bjc(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"}},cVo=r=>r==null,jPt=(r,t,n,i)=>{t.filter((o,s)=>jet(o)?!0:(n.logError(`Invalid ${r} item detected at index ${s}: ${NV(o)}`),n.logPatch(`Removed invalid ${r} item at index ${s}`),!1)).forEach(i)},uU=(r,t,n)=>{r[t]=n},dCe=(r,t)=>{delete r[t]},pVo=(r,t,n)=>{let i=new lVo(r,Ge("FIREBASE"),t),{logError:o,logPatch:s,report:a}=i,u=()=>(a(),n);if(!jet(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 ${NV(p[c])} to ""`),uU(p,c,""))}),["dependencies","isDataVault","locationID"].forEach(c=>{c in p&&(s(`Removed deprecated field ${c}`),dCe(p,c))}),p.type==="sql")s("-- data.type is sql --"),N0h(r,p,i);else if(p.type==="sourceInput")s("-- data.type is sourceInput --"),D0h(r,p,i);else return o(`Data type is of invalid type ${NV(p.type)}`),u();return p.version!==qee&&(s(`Set version ${NV(p.version)} to ${qee}`),uU(p,"version",qee)),u()},N0h=(r,t,n)=>{let{logError:i,logPatch:o}=n;if(t.isMultisource===void 0&&(o("Set missing isMultisource to false"),uU(t,"isMultisource",!1)),jet(t.metadata)){let s=t.metadata;if(s.appliedNodeTests===null&&(o("Set metadata.appliedNodeTests from null to []"),uU(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=""),uU(s,"sourceMapping",[{name:a,join:{joinCondition:""},dependencies:[],noLinkRefs:[],aliases:{}}])}else jPt("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: ${NV(c)}`),uU(p,"join",c)}if(p.name===void 0){let c=p.join?.name??"";o(`Set missing metadata.sourceMapping[${u}].name to "${c}"`),uU(p,"name",c),c||i(`metadata.sourceMapping[${u}].name is an empty string`)}Array.isArray(p.dependencies)&&jPt("sourceMapping dependency",p.dependencies,n,(c,l)=>{let d=c;for(let f of["locationName","nodeName"])cVo(d[f])&&(o(`Set metadata.sourceMapping[${u}].dependencies[${l}].${f} from ${NV(d[f])} to ""`),uU(d,f,""))})});Ejc(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}"`),dCe(t.config,s))},D0h=(r,t,n)=>{let{logPatch:i,logError:o}=n;if(t.dataset!==void 0&&(i("Removed deprecated v0 property dataset"),dCe(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"),dCe(t,"table")),jet(t.metadata)){let s=t.metadata;Array.isArray(s.columns)&&(s.columns.length&&Ejc(r,s.columns,n),Object.keys(s).length>1&&(i(`Removed deprecated metadata properties, keeping only columns. Was: ${NV(s)}`),uU(t,"metadata",{columns:s.columns})))}},Ejc=(r,t,n)=>{let{logPatch:i}=n;Array.isArray(t)&&jPt("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}]`),dCe(a,c))}),jet(a.hashDetails)){let c=a.hashDetails;c.hashType&&(i(`Removed deprecated property 'hashType' from metadata.columns[${s}].hashDetails`),dCe(c,"hashType")),c.hubHashes&&(i(`Removed deprecated property 'hubHashes' from metadata.columns[${s}].hashDetails`),dCe(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 ${NV(a[c])}`),dCe(a,c))}),[["dataType",typeof a.dataType!="string"],["transform",a.transform===null]].forEach(([c,l])=>{l&&(i(`Set ${c} from ${NV(a[c])} to "" in metadata.columns[${s}]`),uU(a,c,""))});let u=a.hashedColumns;if(Array.isArray(u))for(let c of u)pRr(c);let p=a.columnReference;if(jet(p)){pRr(p);let c=p;cVo(c.stepCounter)&&(i(`Set metadata.columns[${s}].columnReference.stepCounter from ${NV(c.stepCounter)} to ${r}`),uU(c,"stepCounter",r))}Array.isArray(a.sourceColumnReferences)&&jPt("sourceColumnReference",a.sourceColumnReferences,n,(c,l)=>{let d=c;Array.isArray(d.columnReferences)&&jPt("columnReference",d.columnReferences,n,(f,h)=>{pRr(f);let m=f;cVo(m.stepCounter)&&(i(`Set invalid metadata.columns[${s}].sourceColumnReferences[${l}].columnReferences[${h}].stepCounter to "" from ${NV(r)}`),uU(m,"stepCounter",""))})})})},lVo=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()}},dRr=class extends RR{transformFromStorage(t,n,i){return pVo(t,n,i)}}});var QPt=z(()=>{"use strict";mjc();nVo();Sjc()});var Cjc=z(()=>{"use strict"});var pk2,dk2,fk2,vjc,Tjc,Ijc,fCe=z(()=>{"use strict";ur();hA();Xt();rVo();net();ns();Xt();qm();lte();QPt();jSe();wGo();Cjc();U6();q6();k4();ufe();pk2=Ge("FIREBASE"),dk2=Ge("STEPS"),fk2=Ge("METADATA_OPERATIONS"),vjc=(r,t)=>t[r].runState==="running",Tjc=r=>(bb("STEPS",!!r,`Error converting API refs: argument apiRefLinks is ${r}.`),r.map(t=>({locationName:t.location_name,nodeName:t.node_name}))),Ijc=r=>r?.deployEnabled??!0});var Z8e,Rjc=z(()=>{"use strict";fCe();lRr();Z8e=class extends J8e{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})=>Tjc([...u,...p]));return[i,[].concat(...a)]}))}}});var GPt,Ojc=z(()=>{"use strict";la();F6();lRr();GPt=class extends J8e{noDependenciesPhases=[];getNodeRefsInPhase(t,n){let i=pS(this.allNodes,...n);return lS(i,o=>{if(WSe(o.operation))return[];let{sourceMapping:s}=o.operation.metadata;if(!s?.length)return[];let a=s.map(({dependencies:u})=>u);return[].concat(...a)})}}});var dVo=z(()=>{"use strict";lRr();Rjc();Ojc()});var _jc=z(()=>{"use strict"});var HPt,wjc=z(()=>{"use strict";eZ();uA();HPt=async(r,t)=>{let{attempts:n,tags:i,waitSeconds:o}=t,s=Kl().child({retryOptions:{maxAttempts:n,waitSeconds:o},tags:["[withRetries]",...i]});EE(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 fVo=z(()=>{"use strict";_jc();wjc()});function Qet(r,t){let n=[];for(let i of r){let o=i.compiledSQL?det(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 fRr(r,t){return r==="deletedTable"&&t?xjc:q0h}var q0h,xjc,WPt=z(()=>{"use strict";qm();q0h="Making metadata updates",xjc="Deleting metadata for source input"});var DV,VPt=z(()=>{"use strict";ur();DV=class extends Ke{constructor(n,i,o="system"){super(i,`Failed node ${n}: ${i}`);this.nodeID=n;this.fault=o}nodeID;fault}});var KPt=A((Bk2,Pjc)=>{var F0h="2.0.0",z0h=Number.MAX_SAFE_INTEGER||9007199254740991,U0h=16,j0h=250,Q0h=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Pjc.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:U0h,MAX_SAFE_BUILD_LENGTH:j0h,MAX_SAFE_INTEGER:z0h,RELEASE_TYPES:Q0h,SEMVER_SPEC_VERSION:F0h,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var $Pt=A((Lk2,Mjc)=>{var G0h=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{};Mjc.exports=G0h});var Get=A((Rfe,Njc)=>{var{MAX_SAFE_COMPONENT_LENGTH:hVo,MAX_SAFE_BUILD_LENGTH:H0h,MAX_LENGTH:W0h}=KPt(),V0h=$Pt();Rfe=Njc.exports={};var K0h=Rfe.re=[],$0h=Rfe.safeRe=[],_a=Rfe.src=[],wa=Rfe.t={},Y0h=0,gVo="[a-zA-Z0-9-]",J0h=[["\\s",1],["\\d",W0h],[gVo,H0h]],X0h=r=>{for(let[t,n]of J0h)r=r.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return r},rd=(r,t,n)=>{let i=X0h(t),o=Y0h++;V0h(r,o,t),wa[r]=o,_a[o]=t,K0h[o]=new RegExp(t,n?"g":void 0),$0h[o]=new RegExp(i,n?"g":void 0)};rd("NUMERICIDENTIFIER","0|[1-9]\\d*");rd("NUMERICIDENTIFIERLOOSE","\\d+");rd("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${gVo}*`);rd("MAINVERSION",`(${_a[wa.NUMERICIDENTIFIER]})\\.(${_a[wa.NUMERICIDENTIFIER]})\\.(${_a[wa.NUMERICIDENTIFIER]})`);rd("MAINVERSIONLOOSE",`(${_a[wa.NUMERICIDENTIFIERLOOSE]})\\.(${_a[wa.NUMERICIDENTIFIERLOOSE]})\\.(${_a[wa.NUMERICIDENTIFIERLOOSE]})`);rd("PRERELEASEIDENTIFIER",`(?:${_a[wa.NUMERICIDENTIFIER]}|${_a[wa.NONNUMERICIDENTIFIER]})`);rd("PRERELEASEIDENTIFIERLOOSE",`(?:${_a[wa.NUMERICIDENTIFIERLOOSE]}|${_a[wa.NONNUMERICIDENTIFIER]})`);rd("PRERELEASE",`(?:-(${_a[wa.PRERELEASEIDENTIFIER]}(?:\\.${_a[wa.PRERELEASEIDENTIFIER]})*))`);rd("PRERELEASELOOSE",`(?:-?(${_a[wa.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${_a[wa.PRERELEASEIDENTIFIERLOOSE]})*))`);rd("BUILDIDENTIFIER",`${gVo}+`);rd("BUILD",`(?:\\+(${_a[wa.BUILDIDENTIFIER]}(?:\\.${_a[wa.BUILDIDENTIFIER]})*))`);rd("FULLPLAIN",`v?${_a[wa.MAINVERSION]}${_a[wa.PRERELEASE]}?${_a[wa.BUILD]}?`);rd("FULL",`^${_a[wa.FULLPLAIN]}$`);rd("LOOSEPLAIN",`[v=\\s]*${_a[wa.MAINVERSIONLOOSE]}${_a[wa.PRERELEASELOOSE]}?${_a[wa.BUILD]}?`);rd("LOOSE",`^${_a[wa.LOOSEPLAIN]}$`);rd("GTLT","((?:<|>)?=?)");rd("XRANGEIDENTIFIERLOOSE",`${_a[wa.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);rd("XRANGEIDENTIFIER",`${_a[wa.NUMERICIDENTIFIER]}|x|X|\\*`);rd("XRANGEPLAIN",`[v=\\s]*(${_a[wa.XRANGEIDENTIFIER]})(?:\\.(${_a[wa.XRANGEIDENTIFIER]})(?:\\.(${_a[wa.XRANGEIDENTIFIER]})(?:${_a[wa.PRERELEASE]})?${_a[wa.BUILD]}?)?)?`);rd("XRANGEPLAINLOOSE",`[v=\\s]*(${_a[wa.XRANGEIDENTIFIERLOOSE]})(?:\\.(${_a[wa.XRANGEIDENTIFIERLOOSE]})(?:\\.(${_a[wa.XRANGEIDENTIFIERLOOSE]})(?:${_a[wa.PRERELEASELOOSE]})?${_a[wa.BUILD]}?)?)?`);rd("XRANGE",`^${_a[wa.GTLT]}\\s*${_a[wa.XRANGEPLAIN]}$`);rd("XRANGELOOSE",`^${_a[wa.GTLT]}\\s*${_a[wa.XRANGEPLAINLOOSE]}$`);rd("COERCE",`(^|[^\\d])(\\d{1,${hVo}})(?:\\.(\\d{1,${hVo}}))?(?:\\.(\\d{1,${hVo}}))?(?:$|[^\\d])`);rd("COERCERTL",_a[wa.COERCE],!0);rd("LONETILDE","(?:~>?)");rd("TILDETRIM",`(\\s*)${_a[wa.LONETILDE]}\\s+`,!0);Rfe.tildeTrimReplace="$1~";rd("TILDE",`^${_a[wa.LONETILDE]}${_a[wa.XRANGEPLAIN]}$`);rd("TILDELOOSE",`^${_a[wa.LONETILDE]}${_a[wa.XRANGEPLAINLOOSE]}$`);rd("LONECARET","(?:\\^)");rd("CARETTRIM",`(\\s*)${_a[wa.LONECARET]}\\s+`,!0);Rfe.caretTrimReplace="$1^";rd("CARET",`^${_a[wa.LONECARET]}${_a[wa.XRANGEPLAIN]}$`);rd("CARETLOOSE",`^${_a[wa.LONECARET]}${_a[wa.XRANGEPLAINLOOSE]}$`);rd("COMPARATORLOOSE",`^${_a[wa.GTLT]}\\s*(${_a[wa.LOOSEPLAIN]})$|^$`);rd("COMPARATOR",`^${_a[wa.GTLT]}\\s*(${_a[wa.FULLPLAIN]})$|^$`);rd("COMPARATORTRIM",`(\\s*)${_a[wa.GTLT]}\\s*(${_a[wa.LOOSEPLAIN]}|${_a[wa.XRANGEPLAIN]})`,!0);Rfe.comparatorTrimReplace="$1$2$3";rd("HYPHENRANGE",`^\\s*(${_a[wa.XRANGEPLAIN]})\\s+-\\s+(${_a[wa.XRANGEPLAIN]})\\s*$`);rd("HYPHENRANGELOOSE",`^\\s*(${_a[wa.XRANGEPLAINLOOSE]})\\s+-\\s+(${_a[wa.XRANGEPLAINLOOSE]})\\s*$`);rd("STAR","(<|>)?=?\\s*\\*");rd("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");rd("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var hRr=A((qk2,Djc)=>{var Z0h=Object.freeze({loose:!0}),efh=Object.freeze({}),tfh=r=>r?typeof r!="object"?Z0h:r:efh;Djc.exports=tfh});var mVo=A((Fk2,Ljc)=>{var kjc=/^[0-9]+$/,Bjc=(r,t)=>{let n=kjc.test(r),i=kjc.test(t);return n&&i&&(r=+r,t=+t),r===t?0:n&&!i?-1:i&&!n?1:r<t?-1:1},rfh=(r,t)=>Bjc(t,r);Ljc.exports={compareIdentifiers:Bjc,rcompareIdentifiers:rfh}});var F4=A((zk2,Ujc)=>{var gRr=$Pt(),{MAX_LENGTH:qjc,MAX_SAFE_INTEGER:mRr}=KPt(),{safeRe:Fjc,t:zjc}=Get(),nfh=hRr(),{compareIdentifiers:Het}=mVo(),yVo=class r{constructor(t,n){if(n=nfh(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>qjc)throw new TypeError(`version is longer than ${qjc} characters`);gRr("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;let i=t.trim().match(n.loose?Fjc[zjc.LOOSE]:Fjc[zjc.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>mRr||this.major<0)throw new TypeError("Invalid major version");if(this.minor>mRr||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>mRr||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<mRr)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(gRr("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)),Het(this.major,t.major)||Het(this.minor,t.minor)||Het(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(gRr("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 Het(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(gRr("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 Het(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]),Het(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}};Ujc.exports=yVo});var e9e=A((Uk2,Qjc)=>{var jjc=F4(),ifh=(r,t,n=!1)=>{if(r instanceof jjc)return r;try{return new jjc(r,t)}catch(i){if(!n)return null;throw i}};Qjc.exports=ifh});var Hjc=A((jk2,Gjc)=>{var ofh=e9e(),sfh=(r,t)=>{let n=ofh(r,t);return n?n.version:null};Gjc.exports=sfh});var Vjc=A((Qk2,Wjc)=>{var afh=e9e(),ufh=(r,t)=>{let n=afh(r.trim().replace(/^[=v]+/,""),t);return n?n.version:null};Wjc.exports=ufh});var Yjc=A((Gk2,$jc)=>{var Kjc=F4(),cfh=(r,t,n,i,o)=>{typeof n=="string"&&(o=i,i=n,n=void 0);try{return new Kjc(r instanceof Kjc?r.version:r,n).inc(t,i,o).version}catch{return null}};$jc.exports=cfh});var Zjc=A((Hk2,Xjc)=>{var Jjc=e9e(),lfh=(r,t)=>{let n=Jjc(r,null,!0),i=Jjc(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"};Xjc.exports=lfh});var tQc=A((Wk2,eQc)=>{var pfh=F4(),dfh=(r,t)=>new pfh(r,t).major;eQc.exports=dfh});var nQc=A((Vk2,rQc)=>{var ffh=F4(),hfh=(r,t)=>new ffh(r,t).minor;rQc.exports=hfh});var oQc=A((Kk2,iQc)=>{var gfh=F4(),mfh=(r,t)=>new gfh(r,t).patch;iQc.exports=mfh});var aQc=A(($k2,sQc)=>{var yfh=e9e(),Afh=(r,t)=>{let n=yfh(r,t);return n&&n.prerelease.length?n.prerelease:null};sQc.exports=Afh});var cU=A((Yk2,cQc)=>{var uQc=F4(),bfh=(r,t,n)=>new uQc(r,n).compare(new uQc(t,n));cQc.exports=bfh});var pQc=A((Jk2,lQc)=>{var Efh=cU(),Sfh=(r,t,n)=>Efh(t,r,n);lQc.exports=Sfh});var fQc=A((Xk2,dQc)=>{var Cfh=cU(),vfh=(r,t)=>Cfh(r,t,!0);dQc.exports=vfh});var yRr=A((Zk2,gQc)=>{var hQc=F4(),Tfh=(r,t,n)=>{let i=new hQc(r,n),o=new hQc(t,n);return i.compare(o)||i.compareBuild(o)};gQc.exports=Tfh});var yQc=A((eB2,mQc)=>{var Ifh=yRr(),Rfh=(r,t)=>r.sort((n,i)=>Ifh(n,i,t));mQc.exports=Rfh});var bQc=A((tB2,AQc)=>{var Ofh=yRr(),_fh=(r,t)=>r.sort((n,i)=>Ofh(i,n,t));AQc.exports=_fh});var YPt=A((rB2,EQc)=>{var wfh=cU(),xfh=(r,t,n)=>wfh(r,t,n)>0;EQc.exports=xfh});var ARr=A((nB2,SQc)=>{var Pfh=cU(),Mfh=(r,t,n)=>Pfh(r,t,n)<0;SQc.exports=Mfh});var AVo=A((iB2,CQc)=>{var Nfh=cU(),Dfh=(r,t,n)=>Nfh(r,t,n)===0;CQc.exports=Dfh});var bVo=A((oB2,vQc)=>{var kfh=cU(),Bfh=(r,t,n)=>kfh(r,t,n)!==0;vQc.exports=Bfh});var bRr=A((sB2,TQc)=>{var Lfh=cU(),qfh=(r,t,n)=>Lfh(r,t,n)>=0;TQc.exports=qfh});var ERr=A((aB2,IQc)=>{var Ffh=cU(),zfh=(r,t,n)=>Ffh(r,t,n)<=0;IQc.exports=zfh});var EVo=A((uB2,RQc)=>{var Ufh=AVo(),jfh=bVo(),Qfh=YPt(),Gfh=bRr(),Hfh=ARr(),Wfh=ERr(),Vfh=(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 Ufh(r,n,i);case"!=":return jfh(r,n,i);case">":return Qfh(r,n,i);case">=":return Gfh(r,n,i);case"<":return Hfh(r,n,i);case"<=":return Wfh(r,n,i);default:throw new TypeError(`Invalid operator: ${t}`)}};RQc.exports=Vfh});var _Qc=A((cB2,OQc)=>{var Kfh=F4(),$fh=e9e(),{safeRe:SRr,t:CRr}=Get(),Yfh=(r,t)=>{if(r instanceof Kfh)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(SRr[CRr.COERCE]);else{let i;for(;(i=SRr[CRr.COERCERTL].exec(r))&&(!n||n.index+n[0].length!==r.length);)(!n||i.index+i[0].length!==n.index+n[0].length)&&(n=i),SRr[CRr.COERCERTL].lastIndex=i.index+i[1].length+i[2].length;SRr[CRr.COERCERTL].lastIndex=-1}return n===null?null:$fh(`${n[2]}.${n[3]||"0"}.${n[4]||"0"}`,t)};OQc.exports=Yfh});var xQc=A((lB2,wQc)=>{"use strict";wQc.exports=function(r){r.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}});var SVo=A((pB2,PQc)=>{"use strict";PQc.exports=m1;m1.Node=t9e;m1.create=m1;function m1(r){var t=this;if(t instanceof m1||(t=new m1),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}m1.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};m1.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++}};m1.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++}};m1.prototype.push=function(){for(var r=0,t=arguments.length;r<t;r++)Xfh(this,arguments[r]);return this.length};m1.prototype.unshift=function(){for(var r=0,t=arguments.length;r<t;r++)Zfh(this,arguments[r]);return this.length};m1.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}};m1.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}};m1.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};m1.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};m1.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};m1.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};m1.prototype.map=function(r,t){t=t||this;for(var n=new m1,i=this.head;i!==null;)n.push(r.call(t,i.value,this)),i=i.next;return n};m1.prototype.mapReverse=function(r,t){t=t||this;for(var n=new m1,i=this.tail;i!==null;)n.push(r.call(t,i.value,this)),i=i.prev;return n};m1.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};m1.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};m1.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};m1.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};m1.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 m1;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};m1.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 m1;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};m1.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=Jfh(this,o,n[i]);return s};m1.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 Jfh(r,t,n){var i=t===r.head?new t9e(n,null,t,r):new t9e(n,t,t.next,r);return i.next===null&&(r.tail=i),i.prev===null&&(r.head=i),r.length++,i}function Xfh(r,t){r.tail=new t9e(t,r.tail,null,r),r.head||(r.head=r.tail),r.length++}function Zfh(r,t){r.head=new t9e(t,null,r.head,r),r.tail||(r.tail=r.head),r.length++}function t9e(r,t,n,i){if(!(this instanceof t9e))return new t9e(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{xQc()(m1)}catch{}});var ZPt=A((dB2,kQc)=>{"use strict";var ehh=SVo(),r9e=Symbol("max"),_fe=Symbol("length"),Wet=Symbol("lengthCalculator"),XPt=Symbol("allowStale"),n9e=Symbol("maxAge"),Ofe=Symbol("dispose"),MQc=Symbol("noDisposeOnSet"),OR=Symbol("lruList"),kV=Symbol("cache"),DQc=Symbol("updateAgeOnGet"),CVo=()=>1,TVo=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[r9e]=t.max||1/0,i=t.length||CVo;if(this[Wet]=typeof i!="function"?CVo:i,this[XPt]=t.stale||!1,t.maxAge&&typeof t.maxAge!="number")throw new TypeError("maxAge must be a number");this[n9e]=t.maxAge||0,this[Ofe]=t.dispose,this[MQc]=t.noDisposeOnSet||!1,this[DQc]=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[r9e]=t||1/0,JPt(this)}get max(){return this[r9e]}set allowStale(t){this[XPt]=!!t}get allowStale(){return this[XPt]}set maxAge(t){if(typeof t!="number")throw new TypeError("maxAge must be a non-negative number");this[n9e]=t,JPt(this)}get maxAge(){return this[n9e]}set lengthCalculator(t){typeof t!="function"&&(t=CVo),t!==this[Wet]&&(this[Wet]=t,this[_fe]=0,this[OR].forEach(n=>{n.length=this[Wet](n.value,n.key),this[_fe]+=n.length})),JPt(this)}get lengthCalculator(){return this[Wet]}get length(){return this[_fe]}get itemCount(){return this[OR].length}rforEach(t,n){n=n||this;for(let i=this[OR].tail;i!==null;){let o=i.prev;NQc(this,t,i,n),i=o}}forEach(t,n){n=n||this;for(let i=this[OR].head;i!==null;){let o=i.next;NQc(this,t,i,n),i=o}}keys(){return this[OR].toArray().map(t=>t.key)}values(){return this[OR].toArray().map(t=>t.value)}reset(){this[Ofe]&&this[OR]&&this[OR].length&&this[OR].forEach(t=>this[Ofe](t.key,t.value)),this[kV]=new Map,this[OR]=new ehh,this[_fe]=0}dump(){return this[OR].map(t=>vRr(this,t)?!1:{k:t.key,v:t.value,e:t.now+(t.maxAge||0)}).toArray().filter(t=>t)}dumpLru(){return this[OR]}set(t,n,i){if(i=i||this[n9e],i&&typeof i!="number")throw new TypeError("maxAge must be a number");let o=i?Date.now():0,s=this[Wet](n,t);if(this[kV].has(t)){if(s>this[r9e])return Vet(this,this[kV].get(t)),!1;let p=this[kV].get(t).value;return this[Ofe]&&(this[MQc]||this[Ofe](t,p.value)),p.now=o,p.maxAge=i,p.value=n,this[_fe]+=s-p.length,p.length=s,this.get(t),JPt(this),!0}let a=new IVo(t,n,s,o,i);return a.length>this[r9e]?(this[Ofe]&&this[Ofe](t,n),!1):(this[_fe]+=a.length,this[OR].unshift(a),this[kV].set(t,this[OR].head),JPt(this),!0)}has(t){if(!this[kV].has(t))return!1;let n=this[kV].get(t).value;return!vRr(this,n)}get(t){return vVo(this,t,!0)}peek(t){return vVo(this,t,!1)}pop(){let t=this[OR].tail;return t?(Vet(this,t),t.value):null}del(t){Vet(this,this[kV].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[kV].forEach((t,n)=>vVo(this,n,!1))}},vVo=(r,t,n)=>{let i=r[kV].get(t);if(i){let o=i.value;if(vRr(r,o)){if(Vet(r,i),!r[XPt])return}else n&&(r[DQc]&&(i.value.now=Date.now()),r[OR].unshiftNode(i));return o.value}},vRr=(r,t)=>{if(!t||!t.maxAge&&!r[n9e])return!1;let n=Date.now()-t.now;return t.maxAge?n>t.maxAge:r[n9e]&&n>r[n9e]},JPt=r=>{if(r[_fe]>r[r9e])for(let t=r[OR].tail;r[_fe]>r[r9e]&&t!==null;){let n=t.prev;Vet(r,t),t=n}},Vet=(r,t)=>{if(t){let n=t.value;r[Ofe]&&r[Ofe](n.key,n.value),r[_fe]-=n.length,r[kV].delete(n.key),r[OR].removeNode(t)}},IVo=class{constructor(t,n,i,o,s){this.key=t,this.value=n,this.length=i,this.now=o,this.maxAge=s||0}},NQc=(r,t,n,i)=>{let o=n.value;vRr(r,o)&&(Vet(r,n),r[XPt]||(o=void 0)),o&&t.call(i,o.value,o.key,r)};kQc.exports=TVo});var lU=A((fB2,FQc)=>{var RVo=class r{constructor(t,n){if(n=rhh(n),t instanceof r)return t.loose===!!n.loose&&t.includePrerelease===!!n.includePrerelease?t:new r(t.raw,n);if(t instanceof OVo)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=>!LQc(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&&chh(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&&ahh)|(this.options.loose&&uhh))+":"+t,o=BQc.get(i);if(o)return o;let s=this.options.loose,a=s?H6[hN.HYPHENRANGELOOSE]:H6[hN.HYPHENRANGE];t=t.replace(a,bhh(this.options.includePrerelease)),Ib("hyphen replace",t),t=t.replace(H6[hN.COMPARATORTRIM],ihh),Ib("comparator trim",t),t=t.replace(H6[hN.TILDETRIM],ohh),Ib("tilde trim",t),t=t.replace(H6[hN.CARETTRIM],shh),Ib("caret trim",t);let u=t.split(" ").map(d=>lhh(d,this.options)).join(" ").split(/\s+/).map(d=>Ahh(d,this.options));s&&(u=u.filter(d=>(Ib("loose invalid filter",d,this.options),!!d.match(H6[hN.COMPARATORLOOSE])))),Ib("range list",u);let p=new Map,c=u.map(d=>new OVo(d,this.options));for(let d of c){if(LQc(d))return[d];p.set(d.value,d)}p.size>1&&p.has("")&&p.delete("");let l=[...p.values()];return BQc.set(i,l),l}intersects(t,n){if(!(t instanceof r))throw new TypeError("a Range is required");return this.set.some(i=>qQc(i,n)&&t.set.some(o=>qQc(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 nhh(t,this.options)}catch{return!1}for(let n=0;n<this.set.length;n++)if(Ehh(this.set[n],t,this.options))return!0;return!1}};FQc.exports=RVo;var thh=ZPt(),BQc=new thh({max:1e3}),rhh=hRr(),OVo=eMt(),Ib=$Pt(),nhh=F4(),{safeRe:H6,t:hN,comparatorTrimReplace:ihh,tildeTrimReplace:ohh,caretTrimReplace:shh}=Get(),{FLAG_INCLUDE_PRERELEASE:ahh,FLAG_LOOSE:uhh}=KPt(),LQc=r=>r.value==="<0.0.0-0",chh=r=>r.value==="",qQc=(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},lhh=(r,t)=>(Ib("comp",r,t),r=fhh(r,t),Ib("caret",r),r=phh(r,t),Ib("tildes",r),r=ghh(r,t),Ib("xrange",r),r=yhh(r,t),Ib("stars",r),r),gN=r=>!r||r.toLowerCase()==="x"||r==="*",phh=(r,t)=>r.trim().split(/\s+/).map(n=>dhh(n,t)).join(" "),dhh=(r,t)=>{let n=t.loose?H6[hN.TILDELOOSE]:H6[hN.TILDE];return r.replace(n,(i,o,s,a,u)=>{Ib("tilde",r,i,o,s,a,u);let p;return gN(o)?p="":gN(s)?p=`>=${o}.0.0 <${+o+1}.0.0-0`:gN(a)?p=`>=${o}.${s}.0 <${o}.${+s+1}.0-0`:u?(Ib("replaceTilde pr",u),p=`>=${o}.${s}.${a}-${u} <${o}.${+s+1}.0-0`):p=`>=${o}.${s}.${a} <${o}.${+s+1}.0-0`,Ib("tilde return",p),p})},fhh=(r,t)=>r.trim().split(/\s+/).map(n=>hhh(n,t)).join(" "),hhh=(r,t)=>{Ib("caret",r,t);let n=t.loose?H6[hN.CARETLOOSE]:H6[hN.CARET],i=t.includePrerelease?"-0":"";return r.replace(n,(o,s,a,u,p)=>{Ib("caret",r,o,s,a,u,p);let c;return gN(s)?c="":gN(a)?c=`>=${s}.0.0${i} <${+s+1}.0.0-0`:gN(u)?s==="0"?c=`>=${s}.${a}.0${i} <${s}.${+a+1}.0-0`:c=`>=${s}.${a}.0${i} <${+s+1}.0.0-0`:p?(Ib("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`):(Ib("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`),Ib("caret return",c),c})},ghh=(r,t)=>(Ib("replaceXRanges",r,t),r.split(/\s+/).map(n=>mhh(n,t)).join(" ")),mhh=(r,t)=>{r=r.trim();let n=t.loose?H6[hN.XRANGELOOSE]:H6[hN.XRANGE];return r.replace(n,(i,o,s,a,u,p)=>{Ib("xRange",r,i,o,s,a,u,p);let c=gN(s),l=c||gN(a),d=l||gN(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`),Ib("xRange return",i),i})},yhh=(r,t)=>(Ib("replaceStars",r,t),r.trim().replace(H6[hN.STAR],"")),Ahh=(r,t)=>(Ib("replaceGTE0",r,t),r.trim().replace(H6[t.includePrerelease?hN.GTE0PRE:hN.GTE0],"")),bhh=r=>(t,n,i,o,s,a,u,p,c,l,d,f,h)=>(gN(i)?n="":gN(o)?n=`>=${i}.0.0${r?"-0":""}`:gN(s)?n=`>=${i}.${o}.0${r?"-0":""}`:a?n=`>=${n}`:n=`>=${n}${r?"-0":""}`,gN(c)?p="":gN(l)?p=`<${+c+1}.0.0-0`:gN(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()),Ehh=(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(Ib(r[i].semver),r[i].semver!==OVo.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 eMt=A((hB2,HQc)=>{var tMt=Symbol("SemVer ANY"),xVo=class r{static get ANY(){return tMt}constructor(t,n){if(n=zQc(n),t instanceof r){if(t.loose===!!n.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),wVo("comparator",t,n),this.options=n,this.loose=!!n.loose,this.parse(t),this.semver===tMt?this.value="":this.value=this.operator+this.semver.version,wVo("comp",this)}parse(t){let n=this.options.loose?UQc[jQc.COMPARATORLOOSE]:UQc[jQc.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 QQc(i[2],this.options.loose):this.semver=tMt}toString(){return this.value}test(t){if(wVo("Comparator.test",t,this.options.loose),this.semver===tMt||t===tMt)return!0;if(typeof t=="string")try{t=new QQc(t,this.options)}catch{return!1}return _Vo(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 GQc(t.value,n).test(this.value):t.operator===""?t.value===""?!0:new GQc(this.value,n).test(t.semver):(n=zQc(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("=")||_Vo(this.semver,"<",t.semver,n)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||_Vo(this.semver,">",t.semver,n)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};HQc.exports=xVo;var zQc=hRr(),{safeRe:UQc,t:jQc}=Get(),_Vo=EVo(),wVo=$Pt(),QQc=F4(),GQc=lU()});var rMt=A((gB2,WQc)=>{var Shh=lU(),Chh=(r,t,n)=>{try{t=new Shh(t,n)}catch{return!1}return t.test(r)};WQc.exports=Chh});var KQc=A((mB2,VQc)=>{var vhh=lU(),Thh=(r,t)=>new vhh(r,t).set.map(n=>n.map(i=>i.value).join(" ").trim().split(" "));VQc.exports=Thh});var YQc=A((yB2,$Qc)=>{var Ihh=F4(),Rhh=lU(),Ohh=(r,t,n)=>{let i=null,o=null,s=null;try{s=new Rhh(t,n)}catch{return null}return r.forEach(a=>{s.test(a)&&(!i||o.compare(a)===-1)&&(i=a,o=new Ihh(i,n))}),i};$Qc.exports=Ohh});var XQc=A((AB2,JQc)=>{var _hh=F4(),whh=lU(),xhh=(r,t,n)=>{let i=null,o=null,s=null;try{s=new whh(t,n)}catch{return null}return r.forEach(a=>{s.test(a)&&(!i||o.compare(a)===1)&&(i=a,o=new _hh(i,n))}),i};JQc.exports=xhh});var tGc=A((bB2,eGc)=>{var PVo=F4(),Phh=lU(),ZQc=YPt(),Mhh=(r,t)=>{r=new Phh(r,t);let n=new PVo("0.0.0");if(r.test(n)||(n=new PVo("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 PVo(a.semver.version);switch(a.operator){case">":u.prerelease.length===0?u.patch++:u.prerelease.push(0),u.raw=u.format();case"":case">=":(!s||ZQc(u,s))&&(s=u);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),s&&(!n||ZQc(n,s))&&(n=s)}return n&&r.test(n)?n:null};eGc.exports=Mhh});var nGc=A((EB2,rGc)=>{var Nhh=lU(),Dhh=(r,t)=>{try{return new Nhh(r,t).range||"*"}catch{return null}};rGc.exports=Dhh});var TRr=A((SB2,aGc)=>{var khh=F4(),sGc=eMt(),{ANY:Bhh}=sGc,Lhh=lU(),qhh=rMt(),iGc=YPt(),oGc=ARr(),Fhh=ERr(),zhh=bRr(),Uhh=(r,t,n,i)=>{r=new khh(r,i),t=new Lhh(t,i);let o,s,a,u,p;switch(n){case">":o=iGc,s=Fhh,a=oGc,u=">",p=">=";break;case"<":o=oGc,s=zhh,a=iGc,u="<",p="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(qhh(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===Bhh&&(h=new sGc(">=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};aGc.exports=Uhh});var cGc=A((CB2,uGc)=>{var jhh=TRr(),Qhh=(r,t,n)=>jhh(r,t,">",n);uGc.exports=Qhh});var pGc=A((vB2,lGc)=>{var Ghh=TRr(),Hhh=(r,t,n)=>Ghh(r,t,"<",n);lGc.exports=Hhh});var hGc=A((TB2,fGc)=>{var dGc=lU(),Whh=(r,t,n)=>(r=new dGc(r,n),t=new dGc(t,n),r.intersects(t,n));fGc.exports=Whh});var mGc=A((IB2,gGc)=>{var Vhh=rMt(),Khh=cU();gGc.exports=(r,t,n)=>{let i=[],o=null,s=null,a=r.sort((l,d)=>Khh(l,d,n));for(let l of a)Vhh(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 CGc=A((RB2,SGc)=>{var yGc=lU(),NVo=eMt(),{ANY:MVo}=NVo,nMt=rMt(),DVo=cU(),$hh=(r,t,n={})=>{if(r===t)return!0;r=new yGc(r,n),t=new yGc(t,n);let i=!1;e:for(let o of r.set){for(let s of t.set){let a=Jhh(o,s,n);if(i=i||a!==null,a)continue e}if(i)return!1}return!0},Yhh=[new NVo(">=0.0.0-0")],AGc=[new NVo(">=0.0.0")],Jhh=(r,t,n)=>{if(r===t)return!0;if(r.length===1&&r[0].semver===MVo){if(t.length===1&&t[0].semver===MVo)return!0;n.includePrerelease?r=Yhh:r=AGc}if(t.length===1&&t[0].semver===MVo){if(n.includePrerelease)return!0;t=AGc}let i=new Set,o,s;for(let h of r)h.operator===">"||h.operator===">="?o=bGc(o,h,n):h.operator==="<"||h.operator==="<="?s=EGc(s,h,n):i.add(h.semver);if(i.size>1)return null;let a;if(o&&s){if(a=DVo(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&&!nMt(h,String(o),n)||s&&!nMt(h,String(s),n))return null;for(let m of t)if(!nMt(h,String(m),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=bGc(o,h,n),u===h&&u!==o)return!1}else if(o.operator===">="&&!nMt(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=EGc(s,h,n),p===h&&p!==s)return!1}else if(s.operator==="<="&&!nMt(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)},bGc=(r,t,n)=>{if(!r)return t;let i=DVo(r.semver,t.semver,n);return i>0?r:i<0||t.operator===">"&&r.operator===">="?t:r},EGc=(r,t,n)=>{if(!r)return t;let i=DVo(r.semver,t.semver,n);return i<0?r:i>0||t.operator==="<"&&r.operator==="<="?t:r};SGc.exports=$hh});var i9e=A((OB2,IGc)=>{var kVo=Get(),vGc=KPt(),Xhh=F4(),TGc=mVo(),Zhh=e9e(),e1h=Hjc(),t1h=Vjc(),r1h=Yjc(),n1h=Zjc(),i1h=tQc(),o1h=nQc(),s1h=oQc(),a1h=aQc(),u1h=cU(),c1h=pQc(),l1h=fQc(),p1h=yRr(),d1h=yQc(),f1h=bQc(),h1h=YPt(),g1h=ARr(),m1h=AVo(),y1h=bVo(),A1h=bRr(),b1h=ERr(),E1h=EVo(),S1h=_Qc(),C1h=eMt(),v1h=lU(),T1h=rMt(),I1h=KQc(),R1h=YQc(),O1h=XQc(),_1h=tGc(),w1h=nGc(),x1h=TRr(),P1h=cGc(),M1h=pGc(),N1h=hGc(),D1h=mGc(),k1h=CGc();IGc.exports={parse:Zhh,valid:e1h,clean:t1h,inc:r1h,diff:n1h,major:i1h,minor:o1h,patch:s1h,prerelease:a1h,compare:u1h,rcompare:c1h,compareLoose:l1h,compareBuild:p1h,sort:d1h,rsort:f1h,gt:h1h,lt:g1h,eq:m1h,neq:y1h,gte:A1h,lte:b1h,cmp:E1h,coerce:S1h,Comparator:C1h,Range:v1h,satisfies:T1h,toComparators:I1h,maxSatisfying:R1h,minSatisfying:O1h,minVersion:_1h,validRange:w1h,outside:x1h,gtr:P1h,ltr:M1h,intersects:N1h,simplifyRange:D1h,subset:k1h,SemVer:Xhh,re:kVo.re,src:kVo.src,tokens:kVo.t,SEMVER_SPEC_VERSION:vGc.SEMVER_SPEC_VERSION,RELEASE_TYPES:vGc.RELEASE_TYPES,compareIdentifiers:TGc.compareIdentifiers,rcompareIdentifiers:TGc.rcompareIdentifiers}});var iMt,B1h,_B2,L1h,IS,Ote=z(()=>{"use strict";iMt=Nt(cV()),B1h=Nt(i9e()),_B2=(0,iMt.Record)({version:iMt.String,hash:iMt.String}),L1h=()=>{let r="7.46.1",t="c0f5fa4b31a112da45fc99e695226c62279135e3";return r&&t?{version:r,hash:t}:null},IS=L1h()});var hCe,Ket,IRr=z(()=>{"use strict";ur();hCe=class extends Ke{constructor(n){super(`Run ${n} canceled by user`);this.runID=n}runID;fault="client"},Ket=class extends Ke{constructor(n){super('Test failed with "continue on failure" set to false');this.result=n}result;fault="client"}});var RRr,ORr,_Rr,BVo,RGc,OGc,o9e,oMt,sMt,wRr,$et=z(()=>{"use strict";yA();IRr();RRr=5e5,ORr=(r,t=RRr)=>{if(r.length*3<=t)return r;let n=new TextEncoder().encode(r);if(n.length<=t)return r;let i=new TextDecoder("utf8").decode(n.slice(0,t));return i.slice(-1)==="\uFFFD"&&(i=i.slice(0,-1)),`${i}...data truncated`},_Rr=r=>"status"in r&&r.status!=="Queued",BVo=r=>r==="complete"||r==="error"||r==="canceled"||r==="skipped",RGc=(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"}},OGc=r=>typeof r=="object"&&r instanceof Ket,o9e=r=>typeof r=="object"&&(r instanceof Ey||r instanceof hCe),oMt=r=>typeof r=="object"&&r instanceof aU&&r.isCancel(),sMt=r=>typeof r=="object"&&r instanceof Rte&&r.isCancel(),wRr=r=>o9e(r)||oMt(r)||sMt(r)});var _Gc,gCe,aMt=z(()=>{"use strict";ur();vfe();ns();Yu();Xt();vy();SR();VSe();Wd();Ote();WPt();IRr();$et();_Gc=500,gCe=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;runEventPublisher=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});setRunEventPublisher(t){this.runEventPublisher=t}publishNodeExecuted(t){let n=this.runResults[t],i=this.state.nodes[t];this.runEventPublisher&&n&&i&&this.runEventPublisher.nodeExecuted(t,i.operation,n)}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(NC(t)){if(t instanceof Y8e)return!1;if(t instanceof $u)return!1}throw t}}async throwIfRunCanceled(){if(await this.runIsCanceled())throw new hCe(this.runID)}updateNodeLocalRunResult({stepID:t,isPreview:n,runExecutionSequenceID:i},o){let s=this.runResults[t];if(s){let a=s.runState;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(u=>{!u.isRunning&&(u.status==="Queued"||u.status==="Running")&&(u.status="Canceled")}),BVo(o)&&!BVo(a)&&this.publishNodeExecuted(t)}else 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();mg("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,...IS?{softwareVersion:IS.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 Ke("No repository to get runs collection for!");return this.repository.orgs.get(this.logContext.orgID).runs}getRepositoryForRun(){return this.getRepositoryRunsCollection().get(this.runID)}formatError=(t,n=null,i=null,o=!1)=>{let s=ma(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=L1(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 Ke(`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=L1(u,this.runResults,"populateQueuedStages: this.runResults"),l=this.state.nodes[u],d=l?lN(l,void 0):!1,f=Qet(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,continueOnFailure:o}){return{name:t,continueOnFailure:o,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,type:t.stageType??"sql",stageExecutionStartTime:t.stageExecutionStartTime,stageExecutionEndTime:t.stageExecutionEndTime,continueOnFailure:t.continueOnFailure}}ensureHasQueryResult(t){if(mg("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=L1(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 Ke(`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":mR(t.error)??"system";return UC(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 Ke(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=lN(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:Sxt(t.startTime),endTime:Sxt(t.endTime)}}getCurrentStageIndex(t){let n=this.nodeStageIndexTracker.get(t);if(n===void 0)throw new Ke(`[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,continueOnFailure:t.continueOnFailure}}getStepRunState(t,n){return RGc(t,n,this.operationType)}async updateRunResult(t){if(!this.repository)return;let n=this.runResults[t];if(!n)throw new Ke(`[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 Ke(`[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 Ke(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(fTr(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 o9e(t)?!0:oMt(t)?this.runIsCanceled():sMt(t)?this.runIsCanceled():!1}static truncateQueryResult(t,n=RRr,i=_Gc){let o=t.sql,s=t.rows,a,u;if(o){let p=ORr(o,n);p!==o&&(a=p)}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(RRr/n)-100,s=_Gc/(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 xRr,wGc=z(()=>{"use strict";la();ns();Yu();U6();WPt();VPt();aMt();xRr=class extends gCe{constructor(n,i,o,s,a){super(n,i,o,"create",a);this.phasedNodeData=s}phasedNodeData;getNameForStageWithoutSQL=(n,i)=>fRr(n,i);getNodeDataForUpdate=n=>{let i=this.getSingleStepData(n.phase,n.stepID),o=i.operation.locationName,s=nU(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),mbc("(Logging Only) Compare locations from context and workspace",a,()=>{let l=nU(this.state.mappings||{},this.state.currentWorkspace);mg("DEPLOY",zF(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 DV(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=BJe(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 DV(n.stepID,`Failed to update node metadata for ${n.stepName} (${a}): ${s}`)}this.publishNodeDeployState(n)}publishNodeDeployState(n){let i=this.state.nodes[n.stepID];!this.runEventPublisher||!i||(n.phase==="deletedTable"?this.runEventPublisher.nodeRemoved(n.stepID,i.operation):this.runEventPublisher.nodeDeployed(n.stepID,i.operation))}}});var xGc,PRr,LVo=z(()=>{"use strict";ur();xGc=(r,t)=>{let n=new Set(t);return n.delete(r),Array.from(n)},PRr=async(r,t,n)=>{if(!t)throw new Ke(`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 MRr,PGc=z(()=>{"use strict";MRr="No SQL to execute"});var uMt=z(()=>{"use strict";LVo();PGc()});var NRr,MGc=z(()=>{"use strict";uMt();aMt();NRr=class extends gCe{constructor(t,n,i,o){super(t,n,i,"run",o)}async initializeRunResults(t){await super.initializeRunResults(t,"waiting")}getNameForStageWithoutSQL=()=>MRr}});var NGc=z(()=>{"use strict"});var DRr,qVo=z(()=>{"use strict";DRr=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 kRr,BRr,mCe=z(()=>{"use strict";Xt();wGc();MGc();$et();IRr();aMt();NGc();qVo();$et();kRr=class extends xRr{constructor(t,n,i,o,s){super(t,n,i,o,s)}get Logger(){return Ge("DEPLOY")}get runTypeName(){return"Deploy"}},BRr=class extends NRr{get Logger(){return Ge("RUNNER")}get runTypeName(){return"Refresh"}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(OGc(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),stageExecutionStartTime:t.stageExecutionStartTime,stageExecutionEndTime:t.stageExecutionEndTime,continueOnFailure:t.continueOnFailure});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)}}});var Yet,Jet,s9e=z(()=>{"use strict";Yet=["deletedTable","alteredTable","addedTable"],Jet=["refresh"]});var LRr,cMt,qRr,DGc,kGc,F1h,z1h,U1h,j1h,BGc,Xet,FRr,FVo,wfe,xfe=z(()=>{"use strict";la();hA();so();Xt();iHo();FWo();LRr=`{%- macro get_value_by_column_attribute(column_attribute, value="name") -%}
9466
9466
  {%- set filtered_columns_by_attribute = columns | selectattr(column_attribute) | list -%}
9467
9467
  {%- if filtered_columns_by_attribute | length > 0 -%}
9468
9468
  {{- (filtered_columns_by_attribute | first)[value] -}}
@@ -12086,7 +12086,7 @@ ${i.map(s=>`- ${s}`).join(`
12086
12086
  `)};var Z9t=class{stop=[];warn=[];addIssue(t,n){this[t].push(n)}addIssues(t,n={}){for(let i of["stop","warn"])for(let o of t[i])this.addIssue(i,o);if(n.shouldThrow&&r9r(this))throw new p3e(this)}foldWarnIssues(t,n={}){if(!t)return;let i=u=>[u.title,u.workspaceState??"",...u.messages].join(`
12087
12087
  `),o=new Set(t.warn.map(i)),s=this.warn.filter(u=>!o.has(i(u)));s.length&&Ge("PLAN").alertContext(n,"[DeployIssueTracker.foldWarnIssues] plan-borne issues lack warn issues the tracker holds \u2014 the issues round-trip dropped something; keeping the tracker's copies:",s);let a=new Set(this.warn.map(i));for(let u of t.warn)a.has(i(u))||this.addIssue("warn",u)}async monitor(t,n){try{let i=await n();return Bal(this,t),i}catch(i){if(Ge("PLAN").errorContext(t,"[DeployIssueTracker.monitor] error:",i instanceof Ke?i.toFormattedStringWithCodeAndStack():$2r(i)),i instanceof p3e)throw i;let o;if(i instanceof Ke||O0e(i)){let{error:{errorString:s,errorDetail:a}}=ma(i);o=a&&a!==s?`${s}
12088
12088
 
12089
- ${a}`:s}else o=ma(i).error.errorString;throw this.addIssue("stop",{title:"Errors Detected",subtitle:"These errors must be addressed before proceeding.",messages:[o]}),new p3e(n9r(this,t))}}};var a5h="Missing Database or Schema",Fal=r=>{let[t,...n]=r;if(!t)return[];let i=o=>{let s=o.nodeNames.length?` Affected nodes: ${o.nodeNames.join(", ")}.`:"",a=o.errorText?` Underlying error: ${o.errorText}`:"";return`"${o.database}.${o.schema}" (location "${o.locationName}") could not be found in the target environment.${s}${a}`};return[{title:a5h,subtitle:"The database or schema for these nodes could not be found in the target environment. The plan was generated without warehouse information for them, so operations against these locations may fail at run time.",messages:[i(t),...n.map(i)]}]};la();hA();so();c3e();$nt();U6();E3();var zas=(r,t)=>{if(r.status==="failure"){t.push(...r.diagnostics);return}return r.value},Ual=(r,t)=>({status:"failure",diagnostics:[{...r,message:t}]}),jal=r=>{let t=r.stepTypes;try{let n=r.installedPackages??{};if(Object.keys(n).length>0){let i=xc(n),o={steps:{},folders:{},jobs:{},macros:{},stepTypes:xc(r.stepTypes),installedPackages:i};t=$he(o,i).stepTypes}}catch(n){return Ual({capability:"nodeTypes",stage:"packageExpansion",code:"packageExpansionFailed"},n instanceof Error?n.message:"Installed package entities could not be expanded.")}return{status:"success",value:t}};var u5h=(r,t,n)=>{let i=t[r];if(!i||!i.mappingDefinitions||!i.mappingDefinitions[n])return{state:"missing"};let o=qqc(i,n,r),s=[o.database.trim()?void 0:"database",o.schema.trim()?void 0:"schema"].filter(a=>a!==void 0);return s.length>0?{state:"invalid",database:o.database,schema:o.schema,missingFields:s}:{state:"resolved",database:o.database,schema:o.schema}},Qal=(r,t)=>{let n=Object.fromEntries(Object.keys(t).map(i=>[i,u5h(i,t,r)]));return{mappingKey:r,locations:n}};var Gal=(r,t)=>{try{let n=l3(r),i=QU(t,n);return{status:"success",value:{platformKind:n,capabilities:{sqlNodesEnabled:i}}}}catch(n){return Ual({capability:"platformProfile",stage:"platformProfile",code:"invalid"},n instanceof Error?n.message:"The workspace platform could not be resolved.")}};var i9r=r=>{let t=[],n=zas(jal(r.workspaceData),t),i=zas(Gal(r.platformKind,r.featureFlags),t),o={nodes:r.workspaceData.steps,nodeTypes:n,jobs:r.workspaceData.jobs,subgraphs:r.workspaceData.folders,environmentBinding:Qal(r.workspaceID,r.workspaceData.locations??{}),runtimeParameters:r.runtimeParameters,platformProfile:i,...r.extra};return{snapshot:{workspaceID:r.workspaceID,capabilities:o},diagnostics:t}};var Hal=r=>{let t=[];for(let[n,i]of Object.entries(r.steps)){let o=i.operation.locationName||"",s=i.operation.database||"",a=i.operation.schema||"";if(o&&s&&a)continue;let u=[o?void 0:"locationName",s?void 0:"database",a?void 0:"schema"].filter(p=>p!==void 0);t.push({nodeId:n,nodeName:i.operation.name,locationName:o,database:s,schema:a,missingFields:u})}return t},c5h={isFeatureEnabled:(r,t)=>t??!1},l5h=r=>{if(r!==void 0)return[...r.entries()].map(([t,n])=>({nodeId:t,message:n}))},Wal=r=>{let t=r.jobSchedules?.map(({id:n,name:i,environmentId:o,jobId:s})=>({id:n,name:i,environmentId:o,jobId:s}));return i9r({workspaceID:r.workspaceID,workspaceData:r.workspaceData,platformKind:r.platformKind,featureFlags:c5h,runtimeParameters:r.runtimeParameters,extra:{jobSchedules:t,hydrationDiagnostics:l5h(r.sqlParseErrors),annotationDiagnostics:r.annotationDiagnostics,nodeLocationDiagnostics:r.nodeLocationDiagnostics}})};ur();var xK=[{operation:"deploy",outcome:"blocked"}],o9r=[{operation:"deploy",outcome:"warned"}],p5h=[{operation:"deploy",outcome:"warned"},{operation:"run",outcome:"warned"}],Cre=[],vre={sourceNodeMissing:{scope:"workspaceDefinition",impacts:Cre},sourceColumnMissing:{scope:"workspaceDefinition",impacts:Cre},namedDependencyUnresolved:{scope:"workspaceDefinition",impacts:o9r},columnSourceDependencyMissing:{scope:"workspaceDefinition",impacts:Cre},storageMappingInvalid:{scope:"environmentBinding",impacts:xK},assignedStorageLocationMissing:{scope:"environmentBinding",impacts:xK},nodeTypeDefaultStorageLocationMissing:{scope:"environmentBinding",impacts:Cre},invalidNodeType:{scope:"workspaceDefinition",impacts:xK},missingNodeType:{scope:"workspaceDefinition",impacts:xK},annotationInvalid:{scope:"workspaceDefinition",impacts:xK},annotationNameUnknown:{scope:"workspaceDefinition",impacts:o9r},nodeStorageLocationUnassigned:{scope:"workspaceDefinition",impacts:xK},nodePhysicalLocationDataMissing:{scope:"environmentBinding",impacts:xK},emptyColumnName:{scope:"workspaceDefinition",impacts:xK},invalidParameterReference:{scope:"workspaceDefinition",impacts:o9r},uppercaseNodeName:{scope:"workspaceDefinition",impacts:xK},duplicateNodeLogicalName:{scope:"workspaceDefinition",impacts:Cre},duplicateNodePhysicalTarget:{scope:"environmentBinding",impacts:Cre},duplicateSubgraphName:{scope:"workspaceDefinition",impacts:Cre},duplicateJobName:{scope:"workspaceDefinition",impacts:Cre},circularDependency:{scope:"workspaceDefinition",impacts:p5h},dataTypeMismatch:{scope:"workspaceDefinition",impacts:Cre},storageLocationsMissing:{scope:"environmentBinding",impacts:xK},deprecatedSqlInputMode:{scope:"workspaceDefinition",impacts:Cre},deletedJobSchedule:{scope:"environmentBinding",impacts:o9r},sqlNodeParseError:{scope:"workspaceDefinition",impacts:xK}},s9r=(r,t)=>vre[r].impacts.find(n=>n.operation===t),ekt=(r,t)=>s9r(r,t)?.outcome==="blocked",Val=r=>Object.hasOwn(vre,r),a9r=Object.keys(vre).filter(Val);var Kal=r=>{switch(r.kind){case"environmentBinding":return`environmentBinding:${r.mappingKey}`;case"node":return`node:${r.nodeId}`;case"column":return`column:${r.nodeId}:${r.columnId}`;case"nodeType":return`nodeType:${r.nodeTypeId}`;case"job":return`job:${r.jobId}`;case"subgraph":return`subgraph:${r.subgraphId}`;case"storageLocation":return`storageLocation:${r.locationName}`}},tkt=(r,t)=>`${r}:${Kal(t)}`,Tre=(r,t)=>r<t?-1:r>t?1:0,d5h=(r,t)=>t!==null&&typeof t=="object"&&!Array.isArray(t)?Object.fromEntries(Object.entries(t).sort(([n],[i])=>Tre(n,i))):t,Uas=r=>JSON.stringify(r,d5h);var rkt=r=>{let t=new Map;for(let n of r){let i=t.get(n.conditionId)??[];i.push(n),t.set(n.conditionId,i)}return t},jas=r=>{let t=new Map;for(let n of r)t.set(n.conditionId,(t.get(n.conditionId)??0)+1);return[...t.entries()].map(([n,i])=>({conditionId:n,occurrenceCount:i}))},Z4=(r,t)=>r.filter(n=>n.conditionId===t);QSe();F6();var nkt=r=>r.columnReference.columnCounter.toString(),YL=(r,t)=>({kind:"node",nodeId:r,nodeName:t.operation.name,locationName:t.operation.locationName||void 0}),ikt=(r,t,n)=>({kind:"column",nodeId:r,columnId:nkt(n),nodeName:t.operation.name,columnName:n.name});var $al=r=>{let t=ew(r),n=[];for(let[i,o]of Object.entries(t))for(let s of o.operation.metadata.columns)s.name.trim()||n.push({conditionId:"emptyColumnName",target:ikt(i,o,s),detail:{rawName:s.name}});return n},Yal=r=>{let t=ew(r),n=new Map;for(let[o,s]of Object.entries(t))n.set(o,new Map(s.operation.metadata.columns.map(a=>[nkt(a),{name:a.name,dataType:a.dataType||""}])));let i=[];for(let[o,s]of Object.entries(t))if(!lN(s,void 0))for(let a of s.operation.metadata.columns){let u=a.dataType||"";for(let p of a.sourceColumnReferences??[]){if(p.transform?.trim()||p.columnReferences.length!==1)continue;let c=p.columnReferences[0],l=c.stepCounter.toString(),d=c.columnCounter.toString();if(l==="0"||d==="0")continue;let f=t[l],h=n.get(l)?.get(d);!f||!h||!h.dataType||!u||h.dataType.toUpperCase()!==u.toUpperCase()&&i.push({conditionId:"dataTypeMismatch",target:ikt(o,s,a),detail:{sourceStepId:l,sourceNodeName:f.operation.name,sourceColumnId:d,sourceColumnName:h.name,sourceDataType:h.dataType,targetDataType:u}})}}return i};var Jal=(r,t,n)=>{let i=[];for(let o of t)o.environmentId!==n||String(o.jobId)in r||i.push({conditionId:"deletedJobSchedule",target:{kind:"environmentBinding",mappingKey:n},detail:{scheduleId:o.id,scheduleName:o.name,jobId:o.jobId,environmentId:o.environmentId}});return i},Xal=r=>r.map(t=>({conditionId:"sqlNodeParseError",target:{kind:"node",nodeId:t.nodeId},detail:{message:t.message}})),f5h={reservedValue:"annotationInvalid",unknownName:"annotationNameUnknown"},Zal=(r,t)=>r.flatMap(n=>{let i=t[n.nodeId];return i?[{conditionId:f5h[n.kind],target:YL(n.nodeId,i),detail:{annotationKey:n.annotationKey,message:n.message,...n.columnName===void 0?{}:{columnName:n.columnName}}}]:[]}),eul=r=>r.map(t=>({conditionId:"nodePhysicalLocationDataMissing",target:{kind:"node",nodeId:t.nodeId,nodeName:t.nodeName,locationName:t.locationName||void 0},detail:{locationName:t.locationName,database:t.database,schema:t.schema,missingFields:t.missingFields}}));F6();var h5h=20,u9r=(r,t)=>{let n=[];for(let i of r)if(i!==t){if(n.length===h5h)break;n.push(i)}return{peerIds:n,peerCount:r.length-1}},tul=r=>JSON.stringify(r),rul=r=>{let t=new Map;for(let[n,i]of r){let o=t.get(i);o?o.push(n):t.set(i,[n])}return t},nul=(r,t)=>{let n=ew(r),i=new Map;for(let[s,a]of Object.entries(n)){let u=t==="databricks"?a.operation.name.toLowerCase():a.operation.name,p=a.operation.locationName||"",c=tul([u,p]),l=i.get(c);l||(l={nodeIds:[],normalizedName:u,locationName:p},i.set(c,l)),l.nodeIds.push(s)}let o=[];for(let s of i.values()){if(s.nodeIds.length<=1)continue;let a=[...s.nodeIds].sort();for(let u of s.nodeIds){let p=n[u],{peerIds:c,peerCount:l}=u9r(a,u);o.push({conditionId:"duplicateNodeLogicalName",target:YL(u,p),detail:{normalizedName:s.normalizedName,locationName:s.locationName,peerNodeIds:c,peerCount:l}})}}return o},iul=(r,t,n)=>{let i=ew(r),o=new Map;for(let[a,u]of Object.entries(i)){let p=n==="databricks"?u.operation.name.toLowerCase():u.operation.name,c=u.operation.locationName||"",l=t.locations[c];if(l?.state!=="resolved")continue;let d=tul([p,l.database,l.schema]),f=o.get(d);f||(f={nodeIds:[],locationNames:new Set,normalizedName:p,database:l.database,schema:l.schema},o.set(d,f)),f.nodeIds.push(a),f.locationNames.add(c)}let s=[];for(let a of o.values()){if(a.nodeIds.length<=1||a.locationNames.size<=1)continue;let u=[...a.nodeIds].sort();for(let p of a.nodeIds){let c=i[p],{peerIds:l,peerCount:d}=u9r(u,p);s.push({conditionId:"duplicateNodePhysicalTarget",target:YL(p,c),detail:{normalizedName:a.normalizedName,database:a.database,schema:a.schema,locationNames:[...a.locationNames].sort(),peerNodeIds:l,peerCount:d}})}}return s},oul=r=>{let t=rul(Object.entries(r??{}).map(([i,o])=>[i,o.name])),n=[];for(let[i,o]of t){if(o.length<=1)continue;let s=[...o].sort();for(let a of o){let{peerIds:u,peerCount:p}=u9r(s,a);n.push({conditionId:"duplicateSubgraphName",target:{kind:"subgraph",subgraphId:a,subgraphName:i},detail:{name:i,peerIds:u,peerCount:p}})}}return n},sul=r=>{let t=rul(Object.entries(r??{}).map(([i,o])=>[i,o.name])),n=[];for(let[i,o]of t){if(o.length<=1)continue;let s=[...o].sort();for(let a of o){let{peerIds:u,peerCount:p}=u9r(s,a);n.push({conditionId:"duplicateJobName",target:{kind:"job",jobId:a,jobName:i},detail:{name:i,peerIds:u,peerCount:p}})}}return n};F6();var aul=(r,t)=>{if(t!=="databricks")return[];let n=ew(r),i=[];for(let[o,s]of Object.entries(n)){let a=s.operation.name,u=a.toLowerCase();a!==u&&i.push({conditionId:"uppercaseNodeName",target:YL(o,s),detail:{actualName:a,normalizedName:u,platformKind:"databricks"}})}return i};qm();cfe();F6();var uul=r=>{let t=[];for(let[n,i]of Object.entries(r)){let o=ZGo(i.name,i.metadata.nodeMetadataSpec).errorString||void 0,s=oTr(i);s&&o===void 0||t.push({conditionId:"invalidNodeType",target:{kind:"nodeType",nodeTypeId:n,nodeTypeName:i.name},detail:{isMetadataValid:s,parseError:o}})}return t},cul=(r,t)=>{let n=ew(r),i=[];for(let[o,s]of Object.entries(n)){let a=s.operation.sqlType||null;a&&t[a]||i.push({conditionId:"missingNodeType",target:YL(o,s),detail:{requestedNodeTypeId:a}})}return i},lul=(r,t)=>{if(!t.capabilities.sqlNodesEnabled)return[];let n=pN(r),i=M7c(n),o=rqc(i),s=[];for(let[a,u]of Object.entries(o))nqc(u)&&s.push({conditionId:"deprecatedSqlInputMode",target:{kind:"nodeType",nodeTypeId:a,nodeTypeName:u.name},detail:{nodeTypeVersion:u.version,inputMode:"sql",platformKind:t.platformKind,origin:tU(a)==="v1"?"package":"custom"}});return s};QSe();F6();var g5h=/\{\{[\s\S]*?\}\}|\{%[\s\S]*?%\}/g,m5h=/\bparameters\.([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\b|\bparameters\['([^']+)'\]|\bparameters\["([^"]+)"\]/g,Qas=r=>{let t=new Set;for(let[n]of r.matchAll(g5h))for(let i of n.matchAll(m5h)){let o=i[1]||i[2]||i[3];o&&t.add(o)}return t},y5h=(r,t)=>{let n=r;for(let i of t.split(".")){if(n==null||typeof n!="object"||!Object.hasOwn(n,i))return!1;n=Reflect.get(n,i)}return!0},pul=(r,t,n)=>{let i=ew(r),o=[],s=new Map,a=c=>{let l=s.get(c);if(l)return l;let d=t[c]?.metadata.templates,f={create:[...Qas(d?.create?.templateString??"")],run:[...Qas(d?.run?.templateString??"")]};return s.set(c,f),f},u=(c,l,d,f)=>{for(let h of d)y5h(n,h)||o.push({conditionId:"invalidParameterReference",target:YL(c,l),detail:{path:h,context:f}})},p=(c,l,d,f)=>{d&&u(c,l,Qas(d),f)};for(let[c,l]of Object.entries(i)){let d=l.operation.sqlType,f=a(d);if(u(c,l,f.create,{kind:"nodeTypeTemplate",nodeTypeId:d,template:"create"}),u(c,l,f.run,{kind:"nodeTypeTemplate",nodeTypeId:d,template:"run"}),!b0(l,void 0))continue;for(let E of l.operation.metadata.sourceMapping)p(c,l,E.join?.joinCondition,{kind:"sourceMapping",sourceMappingName:E.name,field:"join"}),p(c,l,E.customSQL?.customSQL,{kind:"sourceMapping",sourceMappingName:E.name,field:"customSql"});p(c,l,l.operation.metadata.cteString,{kind:"cte"});for(let E of l.operation.metadata.columns)for(let[C,T]of(E.sourceColumnReferences??[]).entries())p(c,l,T.transform,{kind:"columnTransform",columnId:nkt(E),sourceReferenceIndex:C});let h=l.operation.config?.preSQL,m=l.operation.config?.postSQL;p(c,l,typeof h=="string"?h:void 0,{kind:"preSql"}),p(c,l,typeof m=="string"?m:void 0,{kind:"postSql"})}return o};var Gas=r=>`${r.locationName}\0${r.nodeName}`,dul=r=>Gas({locationName:r.node.operation.locationName,nodeName:r.node.operation.name}),A5h=(r,t)=>{let n=dul(t);return r.dependencyKeys.has(n)},b5h=r=>r.sourceStepId==="0"||r.sourceColumnId==="0",ful=r=>{let t=new Map,n=new Map,i=[],o=[],s=new Set;for(let[u,p]of Object.entries(r)){if(u==="scratch")continue;let c={nodeId:u,node:p,columnIds:new Set(p.operation.metadata.columns.map(l=>l.columnReference.columnCounter.toString())),sourceMappings:p.operation.type==="sql"?p.operation.metadata.sourceMapping:[],dependencyKeys:new Set};for(let l of c.columnIds)s.add(l);for(let l of c.sourceMappings)for(let d of[...l.dependencies??[],...l.noLinkRefs??[]])c.dependencyKeys.add(Gas(d));t.set(u,c),n.set(dul(c),c);for(let l of p.operation.metadata.columns)for(let[d,f]of(l.sourceColumnReferences??[]).entries())for(let[h,m]of f.columnReferences.entries())i.push({target:c,column:l,sourceReferenceIndex:d,referenceIndex:h,sourceStepId:m.stepCounter.toString(),sourceColumnId:m.columnCounter.toString(),isTransformed:!!f.transform?.trim()});for(let l of c.sourceMappings)for(let d of[...l.dependencies??[],...l.noLinkRefs??[]])o.push({target:c,sourceMappingName:l.name,dependency:d})}let a=[];for(let u of o)n.has(Gas(u.dependency))||a.push({conditionId:"namedDependencyUnresolved",target:YL(u.target.nodeId,u.target.node),detail:{nodeName:u.dependency.nodeName,locationName:u.dependency.locationName,sourceMappingName:u.sourceMappingName}});for(let u of i){if(b5h(u))continue;let p=ikt(u.target.nodeId,u.target.node,u.column),c=t.get(u.sourceStepId);if(!c){a.push({conditionId:"sourceNodeMissing",target:p,detail:{sourceStepId:u.sourceStepId,sourceColumnId:u.sourceColumnId,sourceReferenceIndex:u.sourceReferenceIndex,referenceIndex:u.referenceIndex,isTransformed:u.isTransformed,isSourceColumnInWorkspace:s.has(u.sourceColumnId)}});continue}c.columnIds.has(u.sourceColumnId)||a.push({conditionId:"sourceColumnMissing",target:p,detail:{sourceStepId:u.sourceStepId,sourceNodeName:c.node.operation.name,sourceColumnId:u.sourceColumnId,sourceReferenceIndex:u.sourceReferenceIndex,referenceIndex:u.referenceIndex,isTransformed:u.isTransformed,isSourceColumnInWorkspace:s.has(u.sourceColumnId)}}),!(u.isTransformed||A5h(u.target,c))&&a.push({conditionId:"columnSourceDependencyMissing",target:p,detail:{sourceStepId:u.sourceStepId,sourceNodeName:c.node.operation.name,sourceLocationName:c.node.operation.locationName}})}return a};F6();var E5h=r=>{let t={database:0,schema:1};return[...r].sort((n,i)=>t[n]-t[i])},S5h=(r,t,n)=>{if(n.state==="resolved")return;let i=n.state==="invalid"?n.database:"",o=n.state==="invalid"?n.schema:"",s=n.state==="invalid"?E5h(n.missingFields):["database","schema"];return{conditionId:"storageMappingInvalid",target:{kind:"storageLocation",locationName:t},detail:{mappingKey:r.mappingKey,database:i,schema:o,missingFields:s}}},hul=r=>{let t=[],n=Object.entries(r.locations).sort(([i],[o])=>Tre(i,o));n.length===0&&t.push({conditionId:"storageLocationsMissing",target:{kind:"environmentBinding",mappingKey:r.mappingKey}});for(let[i,o]of n){let s=S5h(r,i,o);s&&t.push(s)}return t},gul=r=>{let t=[],n=Object.entries(ew(r)).sort(([i],[o])=>Tre(i,o));for(let[i,o]of n)o.operation.locationName.trim()===""&&t.push({conditionId:"nodeStorageLocationUnassigned",target:{kind:"node",nodeId:i,nodeName:o.operation.name}});return t},mul=(r,t)=>{let n=[],i=Object.entries(ew(r)).sort(([o],[s])=>Tre(o,s));for(let[o,s]of i){let a=s.operation.locationName;a.trim()!==""&&!(a in t.locations)&&n.push({conditionId:"assignedStorageLocationMissing",target:{kind:"node",nodeId:o,nodeName:s.operation.name,locationName:a},detail:{assignedLocationName:a}})}return n},yul=(r,t)=>{let n=[],i=Object.entries(r).sort(([o],[s])=>Tre(o,s));for(let[o,s]of i){let a=s.metadata?.defaultStorageLocation;!a||a in t.locations||n.push({conditionId:"nodeTypeDefaultStorageLocationMissing",target:{kind:"nodeType",nodeTypeId:o,nodeTypeName:s.name},detail:{configuredLocationName:a}})}return n};var Aul=(r,t)=>r.capabilities[t]!==void 0,aBe=(r,t)=>{let n=r.capabilities[t];if(n===void 0)throw new Error(`Condition analysis requires the ${t} capability.`);return n};var Ire=(r,t,n)=>({conditionIds:r,requires:[t],collect:i=>n(aBe(i,t),i.workspaceID)}),Yhe=(r,t,n,i)=>({conditionIds:r,requires:[t,n],collect:o=>i(aBe(o,t),aBe(o,n),o.workspaceID)}),bul=(r,t,n,i,o)=>({conditionIds:r,requires:[t,n,i],collect:s=>o(aBe(s,t),aBe(s,n),aBe(s,i),s.workspaceID)}),Has=[Ire(["sourceNodeMissing","sourceColumnMissing","namedDependencyUnresolved","columnSourceDependencyMissing"],"nodes",ful),Ire(["storageMappingInvalid","storageLocationsMissing"],"environmentBinding",hul),Yhe(["assignedStorageLocationMissing"],"nodes","environmentBinding",mul),Yhe(["nodeTypeDefaultStorageLocationMissing"],"nodeTypes","environmentBinding",yul),Ire(["invalidNodeType"],"nodeTypes",uul),Yhe(["missingNodeType"],"nodes","nodeTypes",cul),Ire(["nodeStorageLocationUnassigned"],"nodes",gul),Yhe(["nodePhysicalLocationDataMissing"],"environmentBinding","nodeLocationDiagnostics",(r,t)=>eul(t)),Ire(["emptyColumnName"],"nodes",$al),bul(["invalidParameterReference"],"nodes","nodeTypes","runtimeParameters",pul),Yhe(["uppercaseNodeName"],"nodes","platformProfile",(r,t)=>aul(r,t.platformKind)),Yhe(["duplicateNodeLogicalName"],"nodes","platformProfile",(r,t)=>nul(r,t.platformKind)),bul(["duplicateNodePhysicalTarget"],"nodes","environmentBinding","platformProfile",(r,t,n)=>iul(r,t,n.platformKind)),Ire(["duplicateSubgraphName"],"subgraphs",oul),Ire(["duplicateJobName"],"jobs",sul),Ire(["circularDependency"],"nodes",()=>[]),Ire(["dataTypeMismatch"],"nodes",Yal),Yhe(["deprecatedSqlInputMode"],"nodeTypes","platformProfile",lul),Yhe(["deletedJobSchedule"],"jobs","jobSchedules",Jal),Ire(["sqlNodeParseError"],"hydrationDiagnostics",Xal),Yhe(["annotationInvalid","annotationNameUnknown"],"annotationDiagnostics","nodes",Zal)],Eul=r=>{let t=Has.find(n=>n.conditionIds.includes(r));if(!t)throw new Error(`No analysis is registered for condition ${r}.`);return t};var C5h=r=>r?a9r.filter(t=>r.has(t)):a9r,v5h=(r,t)=>Eul(t).requires.filter(n=>!Aul(r,n)),T5h=r=>r instanceof Error?r.message:String(r),I5h=(r,t,n)=>{let i=new Map;for(let o of r){let s=tkt(o.conditionId,o.target),a=i.get(s);if(a||(a={conditionId:o.conditionId,target:o.target,detailsByKey:new Map},i.set(s,a)),o.detail===void 0)continue;let u=Uas(o.detail);a.detailsByKey.has(u)||a.detailsByKey.set(u,o.detail)}return[...i.values()].map(o=>({conditionId:o.conditionId,target:o.target,details:[...o.detailsByKey.entries()].sort(([s],[a])=>Tre(s,a)).map(([,s])=>s),scope:t,impacts:n}))};function R5h(r,t){return t.flatMap(n=>{let i=vre[n];return I5h(r.get(n)??[],i.scope,i.impacts)}).sort((n,i)=>Tre(tkt(n.conditionId,n.target),tkt(i.conditionId,i.target)))}function*O5h(r,t){let n=[],i=[],o=[],s=new Map;for(let u of C5h(t)){let p=v5h(r,u);if(p.length>0){i.push({conditionId:u,missingCapabilities:p});continue}n.push(u)}for(let u of Has){let p=n.filter(l=>u.conditionIds.includes(l));if(p.length===0)continue;yield;let c;try{c=u.collect(r)}catch(l){o.push(...p.map(d=>({conditionId:d,error:T5h(l),cause:l})));continue}for(let l of c){if(!p.includes(l.conditionId))continue;let d=s.get(l.conditionId)??[];d.push(l),s.set(l.conditionId,d)}}let a={evaluated:n,skipped:i};return{occurrences:R5h(s,n),coverage:a,errors:o}}function okt(r,t){let n=O5h(r,t),i=n.next();for(;!i.done;)i=n.next();return i.value}var uBe=r=>r?` (${r})`:"",_5h=(r,t)=>`${r??"undefined"}${uBe(t)}`,Sul=(r,t)=>{let n=new Map,i=new Map,o=new Set;for(let u of r)switch(u.conditionId){case"storageMappingInvalid":{let p=u.details[0];n.set(u.target.locationName,p);break}case"assignedStorageLocationMissing":i.set(u.target.nodeId,u.target.locationName??u.details[0].assignedLocationName);break;case"nodeStorageLocationUnassigned":o.add(u.target.nodeId);break;default:break}let s=t.capabilities.nodes;if(!s)return[];let a=[];for(let[u,p]of Object.entries(s)){let c=p.operation.name,l=p.operation.locationName||"";if(o.has(u)){a.push(`Node ${c} is configured to use the Storage Location , but the Storage Location does not exist for this Environment.`);continue}let d=n.get(l);if(d){let h=d.schema.trim(),m=d.database.trim();a.push(`Node ${c} is configured to use the Storage Location ${l}, but the Mapping of the Storage Location has an invalid schema or database value. Schema: ${h||"N/A"}, Database: ${m||"N/A"}.`);continue}let f=i.get(u);f!==void 0&&a.push(`Node ${c} is configured to use the Storage Location ${f}, but the Storage Location does not exist for this Environment.`)}return a},w5h=(r,t,n)=>{switch(t.kind){case"nodeTypeTemplate":return`Node type "${n.capabilities.nodeTypes?.[t.nodeTypeId]?.name||t.nodeTypeId}" templates`;case"sourceMapping":{let i=n.capabilities.nodes?.[r.target.nodeId],o=i?.operation.type==="sql"&&i.operation.metadata.sourceMapping.length>1;return`${t.field==="join"?"Join":"Custom SQL"}${o?` in '${t.sourceMappingName}'`:""}`}case"cte":return"CTE string";case"columnTransform":{let i=n.capabilities.nodes?.[r.target.nodeId],o=i?.operation.metadata.columns.find(a=>a.columnReference.columnCounter.toString()===t.columnId),s=i?.operation.type==="sql"&&i.operation.metadata.sourceMapping.length>1;return`Column "${o?.name??t.columnId}" transform${s?` (source ${t.sourceReferenceIndex})`:""}`}case"preSql":return"PRE-SQL";case"postSql":return"POST-SQL"}},Cul=(r,t,n)=>{switch(r){case"storageMappingInvalid":return Z4(t,r).map(i=>{let o=i.details[0],s=o.schema.trim(),a=o.database.trim();return`Storage Location ${i.target.locationName} has an invalid schema or database value. Schema: "${s||"N/A"}", Database: "${a||"N/A"}".`});case"storageLocationsMissing":return["No storage locations found."];case"nodePhysicalLocationDataMissing":return Z4(t,r).map(i=>{let o=i.details[0];return`Node ${i.target.nodeName} is missing required location data. Location: ${o.locationName||"N/A"}, Database: ${o.database||"N/A"}, Schema: ${o.schema||"N/A"}.`});case"invalidNodeType":return Z4(t,r).map(i=>{let o=i.details[0];return`${i.target.nodeTypeName||`Node type with ID: ${i.target.nodeTypeId}`} is in an invalid state. ${o.parseError??""}`});case"missingNodeType":return Z4(t,r).map(i=>{let o=i.details[0].requestedNodeTypeId??"undefined";return`Node ${i.target.nodeName}${uBe(i.target.locationName)} is using a Node Type that doesn\u2019t exist. Invalid Node Type: ${o}.`});case"emptyColumnName":{let i=new Map;for(let o of Z4(t,r)){let s=n.capabilities.nodes?.[o.target.nodeId],a=i.get(o.target.nodeId)??{nodeName:o.target.nodeName,locationName:s?.operation.locationName,columns:[]};a.columns.push(o.target.columnId),i.set(o.target.nodeId,a)}return[...i.values()].map(({nodeName:o,locationName:s,columns:a})=>{let u=a.length===1?"column":"columns";return`Node ${o}${uBe(s)} has ${a.length} ${u} with empty names. Empty column IDs:
12089
+ ${a}`:s}else o=ma(i).error.errorString;throw this.addIssue("stop",{title:"Errors Detected",subtitle:"These errors must be addressed before proceeding.",messages:[o]}),new p3e(n9r(this,t))}}};var a5h="Missing Database or Schema",Fal=r=>{let[t,...n]=r;if(!t)return[];let i=o=>{let s=o.nodeNames.length?` Affected nodes: ${o.nodeNames.join(", ")}.`:"",a=o.errorText?` Underlying error: ${o.errorText}`:"";return`"${o.database}.${o.schema}" (location "${o.locationName}") could not be found in the target environment.${s}${a}`};return[{title:a5h,subtitle:"The database or schema for these nodes could not be found in the target environment. The plan was generated without warehouse information for them, so operations against these locations may fail at run time.",messages:[i(t),...n.map(i)]}]};la();hA();so();c3e();$nt();U6();E3();var zas=(r,t)=>{if(r.status==="failure"){t.push(...r.diagnostics);return}return r.value},Ual=(r,t)=>({status:"failure",diagnostics:[{...r,message:t}]}),jal=r=>{let t=r.stepTypes;try{let n=r.installedPackages??{};if(Object.keys(n).length>0){let i=xc(n),o={steps:{},folders:{},jobs:{},macros:{},stepTypes:xc(r.stepTypes),installedPackages:i};t=$he(o,i).stepTypes}}catch(n){return Ual({capability:"nodeTypes",stage:"packageExpansion",code:"packageExpansionFailed"},n instanceof Error?n.message:"Installed package entities could not be expanded.")}return{status:"success",value:t}};var u5h=(r,t,n)=>{let i=t[r];if(!i||!i.mappingDefinitions||!i.mappingDefinitions[n])return{state:"missing"};let o=qqc(i,n,r),s=[o.database.trim()?void 0:"database",o.schema.trim()?void 0:"schema"].filter(a=>a!==void 0);return s.length>0?{state:"invalid",database:o.database,schema:o.schema,missingFields:s}:{state:"resolved",database:o.database,schema:o.schema}},Qal=(r,t)=>{let n=Object.fromEntries(Object.keys(t).map(i=>[i,u5h(i,t,r)]));return{mappingKey:r,locations:n}};var Gal=(r,t)=>{try{let n=l3(r),i=QU(t,n);return{status:"success",value:{platformKind:n,capabilities:{sqlNodesEnabled:i}}}}catch(n){return Ual({capability:"platformProfile",stage:"platformProfile",code:"invalid"},n instanceof Error?n.message:"The workspace platform could not be resolved.")}};var i9r=r=>{let t=[],n=zas(jal(r.workspaceData),t),i=zas(Gal(r.platformKind,r.featureFlags),t),o={nodes:r.workspaceData.steps,nodeTypes:n,jobs:r.workspaceData.jobs,subgraphs:r.workspaceData.folders,environmentBinding:Qal(r.workspaceID,r.workspaceData.locations??{}),runtimeParameters:r.runtimeParameters,platformProfile:i,...r.extra};return{snapshot:{workspaceID:r.workspaceID,capabilities:o},diagnostics:t}};var Hal=r=>{let t=[];for(let[n,i]of Object.entries(r.steps)){let o=i.operation.locationName||"",s=i.operation.database||"",a=i.operation.schema||"";if(o&&s&&a)continue;let u=[o?void 0:"locationName",s?void 0:"database",a?void 0:"schema"].filter(p=>p!==void 0);t.push({nodeId:n,nodeName:i.operation.name,locationName:o,database:s,schema:a,missingFields:u})}return t},c5h={isFeatureEnabled:(r,t)=>t??!1},l5h=r=>{if(r!==void 0)return[...r.entries()].map(([t,n])=>({nodeId:t,message:n}))},Wal=r=>{let t=r.jobSchedules?.map(({id:n,name:i,environmentId:o,jobId:s})=>({id:n,name:i,environmentId:o,jobId:s}));return i9r({workspaceID:r.workspaceID,workspaceData:r.workspaceData,platformKind:r.platformKind,featureFlags:c5h,runtimeParameters:r.runtimeParameters,extra:{jobSchedules:t,hydrationDiagnostics:l5h(r.sqlParseErrors),annotationDiagnostics:r.annotationDiagnostics,nodeLocationDiagnostics:r.nodeLocationDiagnostics}})};ur();var xK=[{operation:"deploy",outcome:"blocked"}],o9r=[{operation:"deploy",outcome:"warned"}],p5h=[{operation:"deploy",outcome:"warned"},{operation:"run",outcome:"warned"}],Cre=[],vre={sourceNodeMissing:{scope:"workspaceDefinition",impacts:Cre},sourceColumnMissing:{scope:"workspaceDefinition",impacts:Cre},namedDependencyUnresolved:{scope:"workspaceDefinition",impacts:o9r},columnSourceDependencyMissing:{scope:"workspaceDefinition",impacts:Cre},storageMappingInvalid:{scope:"environmentBinding",impacts:xK},assignedStorageLocationMissing:{scope:"environmentBinding",impacts:xK},nodeTypeDefaultStorageLocationMissing:{scope:"environmentBinding",impacts:Cre},invalidNodeType:{scope:"workspaceDefinition",impacts:xK},missingNodeType:{scope:"workspaceDefinition",impacts:xK},annotationInvalid:{scope:"workspaceDefinition",impacts:xK},annotationNameUnknown:{scope:"workspaceDefinition",impacts:o9r},nodeStorageLocationUnassigned:{scope:"workspaceDefinition",impacts:xK},nodePhysicalLocationDataMissing:{scope:"environmentBinding",impacts:xK},emptyColumnName:{scope:"workspaceDefinition",impacts:xK},invalidParameterReference:{scope:"workspaceDefinition",impacts:o9r},uppercaseNodeName:{scope:"workspaceDefinition",impacts:xK},duplicateNodeLogicalName:{scope:"workspaceDefinition",impacts:Cre},duplicateNodePhysicalTarget:{scope:"environmentBinding",impacts:Cre},duplicateSubgraphName:{scope:"workspaceDefinition",impacts:Cre},duplicateJobName:{scope:"workspaceDefinition",impacts:Cre},circularDependency:{scope:"workspaceDefinition",impacts:p5h},dataTypeMismatch:{scope:"workspaceDefinition",impacts:Cre},storageLocationsMissing:{scope:"environmentBinding",impacts:xK},deprecatedSqlInputMode:{scope:"workspaceDefinition",impacts:Cre},deletedJobSchedule:{scope:"environmentBinding",impacts:o9r},sqlNodeParseError:{scope:"workspaceDefinition",impacts:xK}},s9r=(r,t)=>vre[r].impacts.find(n=>n.operation===t),ekt=(r,t)=>s9r(r,t)?.outcome==="blocked",Val=r=>Object.hasOwn(vre,r),a9r=Object.keys(vre).filter(Val);var Kal=r=>{switch(r.kind){case"environmentBinding":return`environmentBinding:${r.mappingKey}`;case"node":return`node:${r.nodeId}`;case"column":return`column:${r.nodeId}:${r.columnId}`;case"nodeType":return`nodeType:${r.nodeTypeId}`;case"job":return`job:${r.jobId}`;case"subgraph":return`subgraph:${r.subgraphId}`;case"storageLocation":return`storageLocation:${r.locationName}`}},tkt=(r,t)=>`${r}:${Kal(t)}`,Tre=(r,t)=>r<t?-1:r>t?1:0,d5h=(r,t)=>t!==null&&typeof t=="object"&&!Array.isArray(t)?Object.fromEntries(Object.entries(t).sort(([n],[i])=>Tre(n,i))):t,Uas=r=>JSON.stringify(r,d5h);var rkt=r=>{let t=new Map;for(let n of r){let i=t.get(n.conditionId)??[];i.push(n),t.set(n.conditionId,i)}return t},jas=r=>{let t=new Map;for(let n of r)t.set(n.conditionId,(t.get(n.conditionId)??0)+1);return[...t.entries()].map(([n,i])=>({conditionId:n,occurrenceCount:i}))},Z4=(r,t)=>r.filter(n=>n.conditionId===t);QSe();F6();var nkt=r=>r.columnReference.columnCounter.toString(),YL=(r,t)=>({kind:"node",nodeId:r,nodeName:t.operation.name,locationName:t.operation.locationName||void 0}),ikt=(r,t,n)=>({kind:"column",nodeId:r,columnId:nkt(n),nodeName:t.operation.name,columnName:n.name});var $al=r=>{let t=ew(r),n=[];for(let[i,o]of Object.entries(t))for(let s of o.operation.metadata.columns)s.name.trim()||n.push({conditionId:"emptyColumnName",target:ikt(i,o,s),detail:{rawName:s.name}});return n},Yal=r=>{let t=ew(r),n=new Map;for(let[o,s]of Object.entries(t))n.set(o,new Map(s.operation.metadata.columns.map(a=>[nkt(a),{name:a.name,dataType:a.dataType||""}])));let i=[];for(let[o,s]of Object.entries(t))if(!lN(s,void 0))for(let a of s.operation.metadata.columns){let u=a.dataType||"";for(let p of a.sourceColumnReferences??[]){if(p.transform?.trim()||p.columnReferences.length!==1)continue;let c=p.columnReferences[0],l=c.stepCounter.toString(),d=c.columnCounter.toString();if(l==="0"||d==="0")continue;let f=t[l],h=n.get(l)?.get(d);!f||!h||!h.dataType||!u||h.dataType.toUpperCase()!==u.toUpperCase()&&i.push({conditionId:"dataTypeMismatch",target:ikt(o,s,a),detail:{sourceStepId:l,sourceNodeName:f.operation.name,sourceColumnId:d,sourceColumnName:h.name,sourceDataType:h.dataType,targetDataType:u}})}}return i};var Jal=(r,t,n)=>{let i=[];for(let o of t)o.environmentId!==n||String(o.jobId)in r||i.push({conditionId:"deletedJobSchedule",target:{kind:"environmentBinding",mappingKey:n},detail:{scheduleId:o.id,scheduleName:o.name,jobId:o.jobId,environmentId:o.environmentId}});return i},Xal=r=>r.map(t=>({conditionId:"sqlNodeParseError",target:{kind:"node",nodeId:t.nodeId},detail:{message:t.message}})),f5h={reservedValue:"annotationInvalid",unknownName:"annotationNameUnknown"},Zal=(r,t)=>r.flatMap(n=>{let i=t[n.nodeId];return i?[{conditionId:f5h[n.kind],target:YL(n.nodeId,i),detail:{annotationKey:n.annotationKey,message:n.message,...n.columnName===void 0?{}:{columnName:n.columnName}}}]:[]}),eul=r=>r.map(t=>({conditionId:"nodePhysicalLocationDataMissing",target:{kind:"node",nodeId:t.nodeId,nodeName:t.nodeName,locationName:t.locationName||void 0},detail:{locationName:t.locationName,database:t.database,schema:t.schema,missingFields:t.missingFields}}));F6();var h5h=20,u9r=(r,t)=>{let n=[];for(let i of r)if(i!==t){if(n.length===h5h)break;n.push(i)}return{peerIds:n,peerCount:r.length-1}},tul=r=>JSON.stringify(r),rul=r=>{let t=new Map;for(let[n,i]of r){let o=t.get(i);o?o.push(n):t.set(i,[n])}return t},nul=(r,t)=>{let n=ew(r),i=new Map;for(let[s,a]of Object.entries(n)){let u=t==="databricks"?a.operation.name.toLowerCase():a.operation.name,p=a.operation.locationName||"",c=tul([u,p]),l=i.get(c);l||(l={nodeIds:[],normalizedName:u,locationName:p},i.set(c,l)),l.nodeIds.push(s)}let o=[];for(let s of i.values()){if(s.nodeIds.length<=1)continue;let a=[...s.nodeIds].sort();for(let u of s.nodeIds){let p=n[u],{peerIds:c,peerCount:l}=u9r(a,u);o.push({conditionId:"duplicateNodeLogicalName",target:YL(u,p),detail:{normalizedName:s.normalizedName,locationName:s.locationName,peerNodeIds:c,peerCount:l}})}}return o},iul=(r,t,n)=>{let i=ew(r),o=new Map;for(let[a,u]of Object.entries(i)){let p=n==="databricks"?u.operation.name.toLowerCase():u.operation.name,c=u.operation.locationName||"",l=t.locations[c];if(l?.state!=="resolved")continue;let d=tul([p,l.database,l.schema]),f=o.get(d);f||(f={nodeIds:[],locationNames:new Set,normalizedName:p,database:l.database,schema:l.schema},o.set(d,f)),f.nodeIds.push(a),f.locationNames.add(c)}let s=[];for(let a of o.values()){if(a.nodeIds.length<=1||a.locationNames.size<=1)continue;let u=[...a.nodeIds].sort();for(let p of a.nodeIds){let c=i[p],{peerIds:l,peerCount:d}=u9r(u,p);s.push({conditionId:"duplicateNodePhysicalTarget",target:YL(p,c),detail:{normalizedName:a.normalizedName,database:a.database,schema:a.schema,locationNames:[...a.locationNames].sort(),peerNodeIds:l,peerCount:d}})}}return s},oul=r=>{let t=rul(Object.entries(r??{}).map(([i,o])=>[i,o.name])),n=[];for(let[i,o]of t){if(o.length<=1)continue;let s=[...o].sort();for(let a of o){let{peerIds:u,peerCount:p}=u9r(s,a);n.push({conditionId:"duplicateSubgraphName",target:{kind:"subgraph",subgraphId:a,subgraphName:i},detail:{name:i,peerIds:u,peerCount:p}})}}return n},sul=r=>{let t=rul(Object.entries(r??{}).map(([i,o])=>[i,o.name])),n=[];for(let[i,o]of t){if(o.length<=1)continue;let s=[...o].sort();for(let a of o){let{peerIds:u,peerCount:p}=u9r(s,a);n.push({conditionId:"duplicateJobName",target:{kind:"job",jobId:a,jobName:i},detail:{name:i,peerIds:u,peerCount:p}})}}return n};F6();var aul=(r,t)=>{if(t!=="databricks")return[];let n=ew(r),i=[];for(let[o,s]of Object.entries(n)){let a=s.operation.name,u=a.toLowerCase();a!==u&&i.push({conditionId:"uppercaseNodeName",target:YL(o,s),detail:{actualName:a,normalizedName:u,platformKind:"databricks"}})}return i};qm();cfe();F6();var uul=r=>{let t=[];for(let[n,i]of Object.entries(r)){let o=ZGo(i.name,i.metadata.nodeMetadataSpec).errorString||void 0,s=oTr(i);s&&o===void 0||t.push({conditionId:"invalidNodeType",target:{kind:"nodeType",nodeTypeId:n,nodeTypeName:i.name},detail:{isMetadataValid:s,parseError:o}})}return t},cul=(r,t)=>{let n=ew(r),i=[];for(let[o,s]of Object.entries(n)){let a=s.operation.sqlType||null;a&&t[a]||i.push({conditionId:"missingNodeType",target:YL(o,s),detail:{requestedNodeTypeId:a}})}return i},lul=(r,t)=>{if(!t.capabilities.sqlNodesEnabled)return[];let n=pN(r),i=M7c(n),o=rqc(i),s=[];for(let[a,u]of Object.entries(o))nqc(u)&&s.push({conditionId:"deprecatedSqlInputMode",target:{kind:"nodeType",nodeTypeId:a,nodeTypeName:u.name},detail:{nodeTypeVersion:u.version,inputMode:"sql",platformKind:t.platformKind,origin:tU(a)==="v1"?"package":"custom"}});return s};QSe();F6();var g5h=/\{\{[\s\S]*?\}\}|\{%[\s\S]*?%\}/g,m5h=/\bparameters\.([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\b|\bparameters\['([^']+)'\]|\bparameters\["([^"]+)"\]/g,Qas=r=>{let t=new Set;for(let[n]of r.matchAll(g5h))for(let i of n.matchAll(m5h)){let o=i[1]||i[2]||i[3];o&&t.add(o)}return t},y5h=(r,t)=>{let n=r;for(let i of t.split(".")){if(n==null||typeof n!="object"||!Object.hasOwn(n,i))return!1;n=Reflect.get(n,i)}return!0},pul=(r,t,n)=>{let i=ew(r),o=[],s=new Map,a=c=>{let l=s.get(c);if(l)return l;let d=t[c]?.metadata.templates,f={create:[...Qas(d?.create?.templateString??"")],run:[...Qas(d?.run?.templateString??"")]};return s.set(c,f),f},u=(c,l,d,f)=>{for(let h of d)y5h(n,h)||o.push({conditionId:"invalidParameterReference",target:YL(c,l),detail:{path:h,context:f}})},p=(c,l,d,f)=>{d&&u(c,l,Qas(d),f)};for(let[c,l]of Object.entries(i)){let d=l.operation.sqlType,f=a(d);if(u(c,l,f.create,{kind:"nodeTypeTemplate",nodeTypeId:d,template:"create"}),u(c,l,f.run,{kind:"nodeTypeTemplate",nodeTypeId:d,template:"run"}),!b0(l,void 0))continue;for(let E of l.operation.metadata.sourceMapping)p(c,l,E.join?.joinCondition,{kind:"sourceMapping",sourceMappingName:E.name,field:"join"}),p(c,l,E.customSQL?.customSQL,{kind:"sourceMapping",sourceMappingName:E.name,field:"customSql"});p(c,l,l.operation.metadata.cteString,{kind:"cte"});for(let E of l.operation.metadata.columns)for(let[C,T]of(E.sourceColumnReferences??[]).entries())p(c,l,T.transform,{kind:"columnTransform",columnId:nkt(E),sourceReferenceIndex:C});let h=l.operation.config?.preSQL,m=l.operation.config?.postSQL;p(c,l,typeof h=="string"?h:void 0,{kind:"preSql"}),p(c,l,typeof m=="string"?m:void 0,{kind:"postSql"})}return o};var Gas=r=>`${r.locationName}\0${r.nodeName}`,dul=r=>Gas({locationName:r.node.operation.locationName,nodeName:r.node.operation.name}),A5h=(r,t)=>{let n=dul(t);return r.dependencyKeys.has(n)},b5h=r=>r.sourceStepId==="0"||r.sourceColumnId==="0",ful=r=>{let t=new Map,n=new Map,i=[],o=[],s=new Set;for(let[u,p]of Object.entries(r)){if(u==="scratch")continue;let c={nodeId:u,node:p,columnIds:new Set(p.operation.metadata.columns.map(l=>l.columnReference.columnCounter.toString())),sourceMappings:p.operation.type==="sql"?p.operation.metadata.sourceMapping:[],dependencyKeys:new Set};for(let l of c.columnIds)s.add(l);for(let l of c.sourceMappings)for(let d of[...l.dependencies??[],...l.noLinkRefs??[]])c.dependencyKeys.add(Gas(d));t.set(u,c),n.set(dul(c),c);for(let l of p.operation.metadata.columns)for(let[d,f]of(l.sourceColumnReferences??[]).entries())for(let[h,m]of f.columnReferences.entries())i.push({target:c,column:l,sourceReferenceIndex:d,referenceIndex:h,sourceStepId:m.stepCounter.toString(),sourceColumnId:m.columnCounter.toString(),isTransformed:!!f.transform?.trim()});for(let l of c.sourceMappings)for(let d of l.dependencies??[])o.push({target:c,sourceMappingName:l.name,dependency:d})}let a=[];for(let u of o)n.has(Gas(u.dependency))||a.push({conditionId:"namedDependencyUnresolved",target:YL(u.target.nodeId,u.target.node),detail:{nodeName:u.dependency.nodeName,locationName:u.dependency.locationName,sourceMappingName:u.sourceMappingName}});for(let u of i){if(b5h(u))continue;let p=ikt(u.target.nodeId,u.target.node,u.column),c=t.get(u.sourceStepId);if(!c){a.push({conditionId:"sourceNodeMissing",target:p,detail:{sourceStepId:u.sourceStepId,sourceColumnId:u.sourceColumnId,sourceReferenceIndex:u.sourceReferenceIndex,referenceIndex:u.referenceIndex,isTransformed:u.isTransformed,isSourceColumnInWorkspace:s.has(u.sourceColumnId)}});continue}c.columnIds.has(u.sourceColumnId)||a.push({conditionId:"sourceColumnMissing",target:p,detail:{sourceStepId:u.sourceStepId,sourceNodeName:c.node.operation.name,sourceColumnId:u.sourceColumnId,sourceReferenceIndex:u.sourceReferenceIndex,referenceIndex:u.referenceIndex,isTransformed:u.isTransformed,isSourceColumnInWorkspace:s.has(u.sourceColumnId)}}),!(u.isTransformed||A5h(u.target,c))&&a.push({conditionId:"columnSourceDependencyMissing",target:p,detail:{sourceStepId:u.sourceStepId,sourceNodeName:c.node.operation.name,sourceLocationName:c.node.operation.locationName}})}return a};F6();var E5h=r=>{let t={database:0,schema:1};return[...r].sort((n,i)=>t[n]-t[i])},S5h=(r,t,n)=>{if(n.state==="resolved")return;let i=n.state==="invalid"?n.database:"",o=n.state==="invalid"?n.schema:"",s=n.state==="invalid"?E5h(n.missingFields):["database","schema"];return{conditionId:"storageMappingInvalid",target:{kind:"storageLocation",locationName:t},detail:{mappingKey:r.mappingKey,database:i,schema:o,missingFields:s}}},hul=r=>{let t=[],n=Object.entries(r.locations).sort(([i],[o])=>Tre(i,o));n.length===0&&t.push({conditionId:"storageLocationsMissing",target:{kind:"environmentBinding",mappingKey:r.mappingKey}});for(let[i,o]of n){let s=S5h(r,i,o);s&&t.push(s)}return t},gul=r=>{let t=[],n=Object.entries(ew(r)).sort(([i],[o])=>Tre(i,o));for(let[i,o]of n)o.operation.locationName.trim()===""&&t.push({conditionId:"nodeStorageLocationUnassigned",target:{kind:"node",nodeId:i,nodeName:o.operation.name}});return t},mul=(r,t)=>{let n=[],i=Object.entries(ew(r)).sort(([o],[s])=>Tre(o,s));for(let[o,s]of i){let a=s.operation.locationName;a.trim()!==""&&!(a in t.locations)&&n.push({conditionId:"assignedStorageLocationMissing",target:{kind:"node",nodeId:o,nodeName:s.operation.name,locationName:a},detail:{assignedLocationName:a}})}return n},yul=(r,t)=>{let n=[],i=Object.entries(r).sort(([o],[s])=>Tre(o,s));for(let[o,s]of i){let a=s.metadata?.defaultStorageLocation;!a||a in t.locations||n.push({conditionId:"nodeTypeDefaultStorageLocationMissing",target:{kind:"nodeType",nodeTypeId:o,nodeTypeName:s.name},detail:{configuredLocationName:a}})}return n};var Aul=(r,t)=>r.capabilities[t]!==void 0,aBe=(r,t)=>{let n=r.capabilities[t];if(n===void 0)throw new Error(`Condition analysis requires the ${t} capability.`);return n};var Ire=(r,t,n)=>({conditionIds:r,requires:[t],collect:i=>n(aBe(i,t),i.workspaceID)}),Yhe=(r,t,n,i)=>({conditionIds:r,requires:[t,n],collect:o=>i(aBe(o,t),aBe(o,n),o.workspaceID)}),bul=(r,t,n,i,o)=>({conditionIds:r,requires:[t,n,i],collect:s=>o(aBe(s,t),aBe(s,n),aBe(s,i),s.workspaceID)}),Has=[Ire(["sourceNodeMissing","sourceColumnMissing","namedDependencyUnresolved","columnSourceDependencyMissing"],"nodes",ful),Ire(["storageMappingInvalid","storageLocationsMissing"],"environmentBinding",hul),Yhe(["assignedStorageLocationMissing"],"nodes","environmentBinding",mul),Yhe(["nodeTypeDefaultStorageLocationMissing"],"nodeTypes","environmentBinding",yul),Ire(["invalidNodeType"],"nodeTypes",uul),Yhe(["missingNodeType"],"nodes","nodeTypes",cul),Ire(["nodeStorageLocationUnassigned"],"nodes",gul),Yhe(["nodePhysicalLocationDataMissing"],"environmentBinding","nodeLocationDiagnostics",(r,t)=>eul(t)),Ire(["emptyColumnName"],"nodes",$al),bul(["invalidParameterReference"],"nodes","nodeTypes","runtimeParameters",pul),Yhe(["uppercaseNodeName"],"nodes","platformProfile",(r,t)=>aul(r,t.platformKind)),Yhe(["duplicateNodeLogicalName"],"nodes","platformProfile",(r,t)=>nul(r,t.platformKind)),bul(["duplicateNodePhysicalTarget"],"nodes","environmentBinding","platformProfile",(r,t,n)=>iul(r,t,n.platformKind)),Ire(["duplicateSubgraphName"],"subgraphs",oul),Ire(["duplicateJobName"],"jobs",sul),Ire(["circularDependency"],"nodes",()=>[]),Ire(["dataTypeMismatch"],"nodes",Yal),Yhe(["deprecatedSqlInputMode"],"nodeTypes","platformProfile",lul),Yhe(["deletedJobSchedule"],"jobs","jobSchedules",Jal),Ire(["sqlNodeParseError"],"hydrationDiagnostics",Xal),Yhe(["annotationInvalid","annotationNameUnknown"],"annotationDiagnostics","nodes",Zal)],Eul=r=>{let t=Has.find(n=>n.conditionIds.includes(r));if(!t)throw new Error(`No analysis is registered for condition ${r}.`);return t};var C5h=r=>r?a9r.filter(t=>r.has(t)):a9r,v5h=(r,t)=>Eul(t).requires.filter(n=>!Aul(r,n)),T5h=r=>r instanceof Error?r.message:String(r),I5h=(r,t,n)=>{let i=new Map;for(let o of r){let s=tkt(o.conditionId,o.target),a=i.get(s);if(a||(a={conditionId:o.conditionId,target:o.target,detailsByKey:new Map},i.set(s,a)),o.detail===void 0)continue;let u=Uas(o.detail);a.detailsByKey.has(u)||a.detailsByKey.set(u,o.detail)}return[...i.values()].map(o=>({conditionId:o.conditionId,target:o.target,details:[...o.detailsByKey.entries()].sort(([s],[a])=>Tre(s,a)).map(([,s])=>s),scope:t,impacts:n}))};function R5h(r,t){return t.flatMap(n=>{let i=vre[n];return I5h(r.get(n)??[],i.scope,i.impacts)}).sort((n,i)=>Tre(tkt(n.conditionId,n.target),tkt(i.conditionId,i.target)))}function*O5h(r,t){let n=[],i=[],o=[],s=new Map;for(let u of C5h(t)){let p=v5h(r,u);if(p.length>0){i.push({conditionId:u,missingCapabilities:p});continue}n.push(u)}for(let u of Has){let p=n.filter(l=>u.conditionIds.includes(l));if(p.length===0)continue;yield;let c;try{c=u.collect(r)}catch(l){o.push(...p.map(d=>({conditionId:d,error:T5h(l),cause:l})));continue}for(let l of c){if(!p.includes(l.conditionId))continue;let d=s.get(l.conditionId)??[];d.push(l),s.set(l.conditionId,d)}}let a={evaluated:n,skipped:i};return{occurrences:R5h(s,n),coverage:a,errors:o}}function okt(r,t){let n=O5h(r,t),i=n.next();for(;!i.done;)i=n.next();return i.value}var uBe=r=>r?` (${r})`:"",_5h=(r,t)=>`${r??"undefined"}${uBe(t)}`,Sul=(r,t)=>{let n=new Map,i=new Map,o=new Set;for(let u of r)switch(u.conditionId){case"storageMappingInvalid":{let p=u.details[0];n.set(u.target.locationName,p);break}case"assignedStorageLocationMissing":i.set(u.target.nodeId,u.target.locationName??u.details[0].assignedLocationName);break;case"nodeStorageLocationUnassigned":o.add(u.target.nodeId);break;default:break}let s=t.capabilities.nodes;if(!s)return[];let a=[];for(let[u,p]of Object.entries(s)){let c=p.operation.name,l=p.operation.locationName||"";if(o.has(u)){a.push(`Node ${c} is configured to use the Storage Location , but the Storage Location does not exist for this Environment.`);continue}let d=n.get(l);if(d){let h=d.schema.trim(),m=d.database.trim();a.push(`Node ${c} is configured to use the Storage Location ${l}, but the Mapping of the Storage Location has an invalid schema or database value. Schema: ${h||"N/A"}, Database: ${m||"N/A"}.`);continue}let f=i.get(u);f!==void 0&&a.push(`Node ${c} is configured to use the Storage Location ${f}, but the Storage Location does not exist for this Environment.`)}return a},w5h=(r,t,n)=>{switch(t.kind){case"nodeTypeTemplate":return`Node type "${n.capabilities.nodeTypes?.[t.nodeTypeId]?.name||t.nodeTypeId}" templates`;case"sourceMapping":{let i=n.capabilities.nodes?.[r.target.nodeId],o=i?.operation.type==="sql"&&i.operation.metadata.sourceMapping.length>1;return`${t.field==="join"?"Join":"Custom SQL"}${o?` in '${t.sourceMappingName}'`:""}`}case"cte":return"CTE string";case"columnTransform":{let i=n.capabilities.nodes?.[r.target.nodeId],o=i?.operation.metadata.columns.find(a=>a.columnReference.columnCounter.toString()===t.columnId),s=i?.operation.type==="sql"&&i.operation.metadata.sourceMapping.length>1;return`Column "${o?.name??t.columnId}" transform${s?` (source ${t.sourceReferenceIndex})`:""}`}case"preSql":return"PRE-SQL";case"postSql":return"POST-SQL"}},Cul=(r,t,n)=>{switch(r){case"storageMappingInvalid":return Z4(t,r).map(i=>{let o=i.details[0],s=o.schema.trim(),a=o.database.trim();return`Storage Location ${i.target.locationName} has an invalid schema or database value. Schema: "${s||"N/A"}", Database: "${a||"N/A"}".`});case"storageLocationsMissing":return["No storage locations found."];case"nodePhysicalLocationDataMissing":return Z4(t,r).map(i=>{let o=i.details[0];return`Node ${i.target.nodeName} is missing required location data. Location: ${o.locationName||"N/A"}, Database: ${o.database||"N/A"}, Schema: ${o.schema||"N/A"}.`});case"invalidNodeType":return Z4(t,r).map(i=>{let o=i.details[0];return`${i.target.nodeTypeName||`Node type with ID: ${i.target.nodeTypeId}`} is in an invalid state. ${o.parseError??""}`});case"missingNodeType":return Z4(t,r).map(i=>{let o=i.details[0].requestedNodeTypeId??"undefined";return`Node ${i.target.nodeName}${uBe(i.target.locationName)} is using a Node Type that doesn\u2019t exist. Invalid Node Type: ${o}.`});case"emptyColumnName":{let i=new Map;for(let o of Z4(t,r)){let s=n.capabilities.nodes?.[o.target.nodeId],a=i.get(o.target.nodeId)??{nodeName:o.target.nodeName,locationName:s?.operation.locationName,columns:[]};a.columns.push(o.target.columnId),i.set(o.target.nodeId,a)}return[...i.values()].map(({nodeName:o,locationName:s,columns:a})=>{let u=a.length===1?"column":"columns";return`Node ${o}${uBe(s)} has ${a.length} ${u} with empty names. Empty column IDs:
12090
12090
  ${a.join(`
12091
12091
  `)}`})}case"uppercaseNodeName":return Z4(t,r).map(i=>{let o=i.details[0];return`Node ${o.actualName} (${i.target.locationName??""}) contains uppercase characters. Rename to "${o.normalizedName}" or another lowercase name.`});case"namedDependencyUnresolved":return Z4(t,r).map(i=>_5h(i.target.nodeName,i.target.locationName));case"invalidParameterReference":{let i=new Map;for(let o of Z4(t,r)){let s=i.get(o.target.nodeId)??{nodeName:o.target.nodeName,locationName:o.target.locationName,refs:new Map};for(let a of o.details){let u=w5h(o,a.context,n),p=s.refs.get(u)??[];p.includes(a.path)||p.push(a.path),s.refs.set(u,p)}i.set(o.target.nodeId,s)}return[...i.values()].map(({nodeName:o,locationName:s,refs:a})=>{let u=[...a.entries()].map(([p,c])=>` - ${p}: ${c.join(", ")}`);return`Node ${o}${uBe(s)} references undefined parameters:
12092
12092
  ${u.join(`