@coalescesoftware/coa 7.17.0 → 7.17.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
@@ -176,7 +176,7 @@ Content-Type: `+u.contentType+`\r
176
176
  ${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"})(ef||(ef={}));PC=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 PVa(t)}static makeFromUrl(t,n){let i=null,o="([A-Za-z0-9.\\-_]+)";function s(R){R.path.charAt(R.path.length-1)==="/"&&(R.path_=R.path_.slice(0,-1))}let a="(/(.*))?$",l=new RegExp("^gs://"+o+a,"i"),c={bucket:1,path:3};function u(R){R.path_=decodeURIComponent(R.path)}let d="v[A-Za-z0-9_]+",p=n.replace(/[.]/g,"\\."),f="(/([^?#]*).*)?$",A=new RegExp(`^https?://${p}/${d}/b/${o}/o${f}`,"i"),h={bucket:1,path:3},y=n===fsi?"(?:storage.googleapis.com|storage.cloud.google.com)":n,C="([^?#]*)",v=new RegExp(`^https?://${y}/${o}/${C}`,"i"),w=[{regex:l,indices:c,postModify:s},{regex:A,indices:h,postModify:u},{regex:v,indices:{bucket:1,path:2},postModify:u}];for(let R=0;R<w.length;R++){let k=w[R],z=k.regex.exec(t);if(z){let H=z[k.indices.bucket],J=z[k.indices.path];J||(J=""),i=new r(H,J),k.postModify(i);break}}if(i==null)throw NVa(t);return i}},Syr=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"})(Pae||(Pae={}));Oyr=class{constructor(t,n,i,o,s,a,l,c,u,d,p,f=!0){this.url_=t,this.method_=n,this.headers_=i,this.body_=o,this.successCodes_=s,this.additionalRetryCodes_=a,this.callback_=l,this.errorCallback_=c,this.timeout_=u,this.progressCallback_=d,this.connectionFactory_=p,this.retry=f,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((A,h)=>{this.resolve_=A,this.reject_=h,this.start_()})}start_(){let t=(i,o)=>{if(o){i(!1,new dye(!1,null,!0));return}let s=this.connectionFactory_();this.pendingConnection_=s;let a=l=>{let c=l.loaded,u=l.lengthComputable?l.total:-1;this.progressCallback_!==null&&this.progressCallback_(c,u)};this.progressCallback_!==null&&s.addUploadProgressListener(a),s.send(this.url_,this.method_,this.body_,this.headers_).then(()=>{this.progressCallback_!==null&&s.removeUploadProgressListener(a),this.pendingConnection_=null;let l=s.getErrorCode()===Pae.NO_ERROR,c=s.getStatus();if(!l||bsi(c,this.additionalRetryCodes_)&&this.retry){let d=s.getErrorCode()===Pae.ABORT;i(!1,new dye(!1,null,d));return}let u=this.successCodes_.indexOf(c)!==-1;i(!0,new dye(u,s))})},n=(i,o)=>{let s=this.resolve_,a=this.reject_,l=o.connection;if(o.wasSuccessCode)try{let c=this.callback_(l,l.getResponse());zVa(c)?s(c):s()}catch(c){a(c)}else if(l!==null){let c=Byr();c.serverResponse=l.getErrorText(),this.errorCallback_?a(this.errorCallback_(l,c)):a(c)}else if(o.canceled){let c=this.appDelete_?ysi():gsi();a(c)}else{let c=hsi();a(c)}};this.canceled_?n(!1,new dye(!1,null,!0)):this.backoffId_=FVa(t,n,this.timeout_)}getPromise(){return this.promise_}cancel(t){this.canceled_=!0,this.appDelete_=t||!1,this.backoffId_!==null&&qVa(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}},dye=class{constructor(t,n,i){this.wasSuccessCode=t,this.connection=n,this.canceled=!!i}};T_={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"},zQe=class{constructor(t,n){this.data=t,this.contentType=n||null}};vAt=class{constructor(t){this.base64=!1,this.contentType=null;let n=t.match(/^data:([^,]+)?,/);if(n===null)throw pye(T_.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");let i=n[1]||null;i!=null&&(this.base64=rYa(i,";base64"),this.contentType=this.base64?i.substring(0,i.length-7):i),this.rest=t.substring(t.indexOf(",")+1)}};fye=class r{constructor(t,n){let i=0,o="";ssi(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(ssi(this.data_)){let i=this.data_,o=XVa(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(Myr()){let n=t.map(i=>i instanceof r?i.data_:i);return new r(JVa.apply(null,n))}else{let n=t.map(a=>_At(a)?Dyr(T_.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 l=0;l<a.length;l++)o[s++]=a[l]}),new r(o,!0)}}uploadData(){return this.data_}};c3=class{constructor(t,n,i,o){this.server=t,this.local=n||t,this.writable=!!i,this.xform=o||oYa}},IAt=null;asi="prefixes",lsi="items";FT=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=[]}};Aye=class{constructor(t,n,i,o){this.current=t,this.total=n,this.finalized=!!i,this.metadata=o||null}};usi=256*1024;Tsi={STATE_CHANGED:"state_changed"},WE={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};Tyr=class{constructor(t,n,i){if(UVa(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}}};csi=null,SAt=class{constructor(){this.errorText_="",this.sent_=!1,this.fetch_=psi.fetch,this.errorCode_=Pae.NO_ERROR}async send(t,n,i,o){if(this.sent_)throw cye("cannot .send() more than once");this.sent_=!0;try{let s=await this.fetch_(t,{method:n,headers:o||{},body:i});this.headers_=s.headers,this.statusCode_=s.status,this.errorCode_=Pae.NO_ERROR,this.body_=await s.arrayBuffer()}catch(s){this.errorText_=s?.message,this.statusCode_=0,this.errorCode_=Pae.NETWORK_ERROR}}getErrorCode(){if(this.errorCode_===void 0)throw cye("cannot .getErrorCode() before receiving response");return this.errorCode_}getStatus(){if(this.statusCode_===void 0)throw cye("cannot .getStatus() before receiving response");return this.statusCode_}getErrorText(){return this.errorText_}abort(){}getResponseHeader(t){if(!this.headers_)throw cye("cannot .getResponseHeader() before receiving response");return this.headers_.get(t)}addUploadProgressListener(t){}removeUploadProgressListener(t){}},wyr=class extends SAt{getResponse(){if(!this.body_)throw cye("cannot .getResponse() before receiving response");return Buffer.from(this.body_).toString("utf-8")}};Ryr=class extends SAt{getResponse(){if(!this.body_)throw cye("cannot .getResponse() before sending");return this.body_}};UQe=class{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=OAt(),this._resumable=this._shouldDoResumable(this._blob),this._state="running",this._errorHandler=o=>{if(this._request=void 0,this._chunkMultiplier=1,o._codeEquals(ef.CANCELED))this._needToFetchStatus=!0,this.completeTransitions_();else{let s=this.isExponentialBackoffExpired();if(bsi(o.status,[]))if(s)o=hsi();else{this.sleepTime=Math.max(this.sleepTime*2,wVa),this._needToFetchStatus=!0,this.completeTransitions_();return}this._error=o,this._transition("error")}},this._metadataErrorHandler=o=>{this._request=void 0,o._codeEquals(ef.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,()=>{})}isExponentialBackoffExpired(){return this.sleepTime>this.maxSleepTime}_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=CYa(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),o=this._ref.storage._makeRequest(i,V9,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=IYa(this._ref.storage,this._ref._location,t,this._blob),s=this._ref.storage._makeRequest(o,V9,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=usi*this._chunkMultiplier,n=new Aye(this._transferred,this._blob.size()),i=this._uploadUrl;this._resolveToken((o,s)=>{let a;try{a=vYa(this._ref._location,this._ref.storage,i,this._blob,t,this._mappings,n,this._makeProgressCallback())}catch(c){this._error=c,this._transition("error");return}let l=this._ref.storage._makeRequest(a,V9,o,s,!1);this._request=l,l.getPromise().then(c=>{this._increaseMultiplier(),this._request=void 0,this._updateProgress(c.current),c.finalized?(this._metadata=c.metadata,this._transition("success")):this.completeTransitions_()},this._errorHandler)})}_increaseMultiplier(){usi*this._chunkMultiplier*2<32*1024*1024&&(this._chunkMultiplier*=2)}_fetchMetadata(){this._resolveToken((t,n)=>{let i=_si(this._ref.storage,this._ref._location,this._mappings),o=this._ref.storage._makeRequest(i,V9,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=bYa(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),o=this._ref.storage._makeRequest(i,V9,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=gsi(),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=vyr(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 Tyr(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(vyr(this._state)){case WE.SUCCESS:uye(this._resolve.bind(null,this.snapshot))();break;case WE.CANCELED:case WE.ERROR:let n=this._reject;uye(n.bind(null,this._error))();break;default:t=!1;break}t&&(this._resolve=void 0,this._reject=void 0)}}_notifyObserver(t){switch(vyr(this._state)){case WE.RUNNING:case WE.PAUSED:t.next&&uye(t.next.bind(t,this.snapshot))();break;case WE.SUCCESS:t.complete&&uye(t.complete.bind(t))();break;case WE.CANCELED:case WE.ERROR:t.error&&uye(t.error.bind(t,this._error))();break;default:t.error&&uye(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}};hye=class r{constructor(t,n){this._service=t,n instanceof PC?this._location=n:this._location=PC.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 PC(this._location.bucket,"");return this._newRef(this._service,t)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return vsi(this._location.path)}get storage(){return this._service}get parent(){let t=nYa(this._location.path);if(t===null)return null;let n=new PC(this._location.bucket,t);return new r(this._service,n)}_throwIfRoot(t){if(this._location.path==="")throw xyr(t)}};jQe=class{constructor(t,n,i,o,s){this.app=t,this._authProvider=n,this._appCheckProvider=i,this._url=o,this._firebaseVersion=s,this._bucket=null,this._host=fsi,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=OVa,this._maxUploadRetryTime=TVa,this._requests=new Set,o!=null?this._bucket=PC.makeFromBucketSpec(o,this._host):this._bucket=dsi(this._host,this.app.options)}get host(){return this._host}set host(t){this._host=t,this._url!=null?this._bucket=PC.makeFromBucketSpec(this._url,t):this._bucket=dsi(t,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(t){_yr("time",0,Number.POSITIVE_INFINITY,t),this._maxUploadRetryTime=t}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(t){_yr("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(){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 hye(this,t)}_makeRequest(t,n,i,o,s=!0){if(this._deleted)return new Syr(ysi());{let a=YVa(t,this._appId,i,o,n,this._firebaseVersion,s);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()}},kYa="@firebase/storage",QYa="0.12.3";LYa="storage";qYa()});function zsi(r){return/^[A-Za-z]+:\/\//.test(r)}function GYa(r,{instanceIdentifier:t}){let n=r.getProvider("app-compat").getImmediate(),i=r.getProvider("storage").getImmediate({identifier:t});return new xAt(n,i)}function WYa(r){let t={TaskState:WE,TaskEvent:Tsi,StringFormat:T_,Storage:xAt,Reference:Qae};r.INTERNAL.registerComponent(new _p(jYa,GYa,"PUBLIC").setServiceProps(t).setMultipleInstances(!0)),r.registerVersion(zYa,UYa)}var mye,RAt,BAt,Qae,xAt,zYa,UYa,jYa,Usi=et(()=>{Ase();Qyr();l_();mye=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}};RAt=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 mye(this._delegate.snapshot,this,this._ref)}then(t,n){return this._delegate.then(i=>{if(t)return t(new mye(i,this,this._ref))},n)}on(t,n,i,o){let s;return n&&(typeof n=="function"?s=a=>n(new mye(a,this,this._ref)):s={next:n.next?a=>n.next(new mye(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)}},BAt=class{constructor(t,n){this._delegate=t,this._service=n}get prefixes(){return this._delegate.prefixes.map(t=>new Qae(t,this._service))}get items(){return this._delegate.items.map(t=>new Qae(t,this._service))}get nextPageToken(){return this._delegate.nextPageToken||null}};Qae=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=Fsi(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 RAt(wAt(this._delegate,t,n),this)}putString(t,n=T_.RAW,i){this._throwIfRoot("putString");let o=Dyr(n,t),s=Object.assign({},i);return s.contentType==null&&o.contentType!=null&&(s.contentType=o.contentType),new RAt(new UQe(this._delegate,new fye(o.data,!0),s),this)}listAll(){return ksi(this._delegate).then(t=>new BAt(t,this.storage))}list(t){return Psi(this._delegate,t||void 0).then(n=>new BAt(n,this.storage))}getMetadata(){return Dsi(this._delegate)}updateMetadata(t){return Nsi(this._delegate,t)}getDownloadURL(){return Qsi(this._delegate)}delete(){return this._throwIfRoot("delete"),Lsi(this._delegate)}_throwIfRoot(t){if(this._delegate._location.path==="")throw xyr(t)}};xAt=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(zsi(t))throw kae("ref() expected a child path but got a URL, use refFromURL instead.");return new Qae(WQe(this._delegate,t),this)}refFromURL(t){if(!zsi(t))throw kae("refFromURL() expected a full URL but got a child path, use ref() instead.");try{PC.makeFromUrl(t,this._delegate.host)}catch{throw kae("refFromUrl() expected a valid full URL but got an invalid one.")}return new Qae(WQe(this._delegate,t),this)}setMaxUploadRetryTime(t){this._delegate.maxUploadRetryTime=t}setMaxOperationRetryTime(t){this._delegate.maxOperationRetryTime=t}useEmulator(t,n,i={}){qsi(this._delegate,t,n,i)}};zYa="@firebase/storage-compat",UYa="0.3.6";jYa="storage-compat";WYa(Kd)});var Lyr=et(()=>{Usi()});var jsi,Gsi=et(()=>{jsi=typeof globalThis=="object"?globalThis:global});var Wsi=et(()=>{Gsi()});var Hsi=et(()=>{Wsi()});var Oq,Fyr=et(()=>{Oq="1.9.0"});function HYa(r){var t=new Set([r]),n=new Set,i=r.match(Vsi);if(!i)return function(){return!1};var o={major:+i[1],minor:+i[2],patch:+i[3],prerelease:i[4]};if(o.prerelease!=null)return function(c){return c===r};function s(l){return n.add(l),!1}function a(l){return t.add(l),!0}return function(c){if(t.has(c))return!0;if(n.has(c))return!1;var u=c.match(Vsi);if(!u)return s(c);var d={major:+u[1],minor:+u[2],patch:+u[3],prerelease:u[4]};return d.prerelease!=null||o.major!==d.major?s(c):o.major===0?o.minor===d.minor&&o.patch<=d.patch?a(c):s(c):o.minor<=d.minor?a(c):s(c)}}var Vsi,Ysi,Ksi=et(()=>{Fyr();Vsi=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;Ysi=HYa(Oq)});function K9(r,t,n,i){var o;i===void 0&&(i=!1);var s=VQe[HQe]=(o=VQe[HQe])!==null&&o!==void 0?o:{version:Oq};if(!i&&s[r]){var a=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+r);return n.error(a.stack||a.message),!1}if(s.version!==Oq){var a=new Error("@opentelemetry/api: Registration of version v"+s.version+" for "+r+" does not match previously registered API v"+Oq);return n.error(a.stack||a.message),!1}return s[r]=t,n.debug("@opentelemetry/api: Registered a global for "+r+" v"+Oq+"."),!0}function w_(r){var t,n,i=(t=VQe[HQe])===null||t===void 0?void 0:t.version;if(!(!i||!Ysi(i)))return(n=VQe[HQe])===null||n===void 0?void 0:n[r]}function J9(r,t){t.debug("@opentelemetry/api: Unregistering a global for "+r+" v"+Oq+".");var n=VQe[HQe];n&&delete n[r]}var VYa,HQe,VQe,Lae=et(()=>{Hsi();Fyr();Ksi();VYa=Oq.split(".")[0],HQe=Symbol.for("opentelemetry.js.api."+VYa),VQe=jsi});function YQe(r,t,n){var i=w_("diag");if(i)return n.unshift(t),i[r].apply(i,KYa([],YYa(n),!1))}var YYa,KYa,Jsi,Xsi=et(()=>{Lae();YYa=function(r,t){var n=typeof Symbol=="function"&&r[Symbol.iterator];if(!n)return r;var i=n.call(r),o,s=[],a;try{for(;(t===void 0||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(l){a={error:l}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return s},KYa=function(r,t,n){if(n||arguments.length===2)for(var i=0,o=t.length,s;i<o;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return r.concat(s||Array.prototype.slice.call(t))},Jsi=function(){function r(t){this._namespace=t.namespace||"DiagComponentLogger"}return r.prototype.debug=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return YQe("debug",this._namespace,t)},r.prototype.error=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return YQe("error",this._namespace,t)},r.prototype.info=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return YQe("info",this._namespace,t)},r.prototype.warn=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return YQe("warn",this._namespace,t)},r.prototype.verbose=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return YQe("verbose",this._namespace,t)},r}()});var d3,MAt=et(()=>{(function(r){r[r.NONE=0]="NONE",r[r.ERROR=30]="ERROR",r[r.WARN=50]="WARN",r[r.INFO=60]="INFO",r[r.DEBUG=70]="DEBUG",r[r.VERBOSE=80]="VERBOSE",r[r.ALL=9999]="ALL"})(d3||(d3={}))});function $si(r,t){r<d3.NONE?r=d3.NONE:r>d3.ALL&&(r=d3.ALL),t=t||{};function n(i,o){var s=t[i];return typeof s=="function"&&r>=o?s.bind(t):function(){}}return{error:n("error",d3.ERROR),warn:n("warn",d3.WARN),info:n("info",d3.INFO),debug:n("debug",d3.DEBUG),verbose:n("verbose",d3.VERBOSE)}}var Zsi=et(()=>{MAt()});var JYa,XYa,$Ya,HE,Fae=et(()=>{Xsi();Zsi();MAt();Lae();JYa=function(r,t){var n=typeof Symbol=="function"&&r[Symbol.iterator];if(!n)return r;var i=n.call(r),o,s=[],a;try{for(;(t===void 0||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(l){a={error:l}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return s},XYa=function(r,t,n){if(n||arguments.length===2)for(var i=0,o=t.length,s;i<o;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return r.concat(s||Array.prototype.slice.call(t))},$Ya="diag",HE=function(){function r(){function t(o){return function(){for(var s=[],a=0;a<arguments.length;a++)s[a]=arguments[a];var l=w_("diag");if(l)return l[o].apply(l,XYa([],JYa(s),!1))}}var n=this,i=function(o,s){var a,l,c;if(s===void 0&&(s={logLevel:d3.INFO}),o===n){var u=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return n.error((a=u.stack)!==null&&a!==void 0?a:u.message),!1}typeof s=="number"&&(s={logLevel:s});var d=w_("diag"),p=$si((l=s.logLevel)!==null&&l!==void 0?l:d3.INFO,o);if(d&&!s.suppressOverrideMessage){var f=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";d.warn("Current logger will be overwritten from "+f),p.warn("Current logger will overwrite one already registered from "+f)}return K9("diag",p,n,!0)};n.setLogger=i,n.disable=function(){J9($Ya,n)},n.createComponentLogger=function(o){return new Jsi(o)},n.verbose=t("verbose"),n.debug=t("debug"),n.info=t("info"),n.warn=t("warn"),n.error=t("error")}return r.instance=function(){return this._instance||(this._instance=new r),this._instance},r}()});var ZYa,eKa,eai,tai=et(()=>{ZYa=function(r,t){var n=typeof Symbol=="function"&&r[Symbol.iterator];if(!n)return r;var i=n.call(r),o,s=[],a;try{for(;(t===void 0||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(l){a={error:l}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return s},eKa=function(r){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&r[t],i=0;if(n)return n.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},eai=function(){function r(t){this._entries=t?new Map(t):new Map}return r.prototype.getEntry=function(t){var n=this._entries.get(t);if(n)return Object.assign({},n)},r.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(t){var n=ZYa(t,2),i=n[0],o=n[1];return[i,o]})},r.prototype.setEntry=function(t,n){var i=new r(this._entries);return i._entries.set(t,n),i},r.prototype.removeEntry=function(t){var n=new r(this._entries);return n._entries.delete(t),n},r.prototype.removeEntries=function(){for(var t,n,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];var s=new r(this._entries);try{for(var a=eKa(i),l=a.next();!l.done;l=a.next()){var c=l.value;s._entries.delete(c)}}catch(u){t={error:u}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return s},r.prototype.clear=function(){return new r},r}()});var rai,nai=et(()=>{rai=Symbol("BaggageEntryMetadata")});function iai(r){return r===void 0&&(r={}),new eai(new Map(Object.entries(r)))}function oai(r){return typeof r!="string"&&(tKa.error("Cannot create baggage metadata from unknown type: "+typeof r),r=""),{__TYPE__:rai,toString:function(){return r}}}var tKa,qyr=et(()=>{Fae();tai();nai();tKa=HE.instance()});function yye(r){return Symbol.for(r)}var rKa,DAt,KQe=et(()=>{rKa=function(){function r(t){var n=this;n._currentContext=t?new Map(t):new Map,n.getValue=function(i){return n._currentContext.get(i)},n.setValue=function(i,o){var s=new r(n._currentContext);return s._currentContext.set(i,o),s},n.deleteValue=function(i){var o=new r(n._currentContext);return o._currentContext.delete(i),o}}return r}(),DAt=new rKa});var zyr,sai,aai=et(()=>{zyr=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],sai=function(){function r(){function t(i){return function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];if(console){var a=console[i];if(typeof a!="function"&&(a=console.log),typeof a=="function")return a.apply(console,o)}}}for(var n=0;n<zyr.length;n++)this[zyr[n].n]=t(zyr[n].c)}return r}()});function lai(){return jyr}var qae,nKa,NAt,iKa,oKa,sKa,aKa,Uyr,lKa,uKa,cKa,jyr,dKa,pKa,fKa,AKa,hKa,gKa,mKa,Gyr=et(()=>{qae=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,o){i.__proto__=o}||function(i,o){for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(i[s]=o[s])},r(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");r(t,n);function i(){this.constructor=t}t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}}(),nKa=function(){function r(){}return r.prototype.createGauge=function(t,n){return pKa},r.prototype.createHistogram=function(t,n){return fKa},r.prototype.createCounter=function(t,n){return dKa},r.prototype.createUpDownCounter=function(t,n){return AKa},r.prototype.createObservableGauge=function(t,n){return gKa},r.prototype.createObservableCounter=function(t,n){return hKa},r.prototype.createObservableUpDownCounter=function(t,n){return mKa},r.prototype.addBatchObservableCallback=function(t,n){},r.prototype.removeBatchObservableCallback=function(t){},r}(),NAt=function(){function r(){}return r}(),iKa=function(r){qae(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.add=function(n,i){},t}(NAt),oKa=function(r){qae(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.add=function(n,i){},t}(NAt),sKa=function(r){qae(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.record=function(n,i){},t}(NAt),aKa=function(r){qae(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.record=function(n,i){},t}(NAt),Uyr=function(){function r(){}return r.prototype.addCallback=function(t){},r.prototype.removeCallback=function(t){},r}(),lKa=function(r){qae(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t}(Uyr),uKa=function(r){qae(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t}(Uyr),cKa=function(r){qae(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t}(Uyr),jyr=new nKa,dKa=new iKa,pKa=new sKa,fKa=new aKa,AKa=new oKa,hKa=new lKa,gKa=new uKa,mKa=new cKa});var PAt,uai=et(()=>{(function(r){r[r.INT=0]="INT",r[r.DOUBLE=1]="DOUBLE"})(PAt||(PAt={}))});var kAt,QAt,Wyr=et(()=>{kAt={get:function(r,t){if(r!=null)return r[t]},keys:function(r){return r==null?[]:Object.keys(r)}},QAt={set:function(r,t,n){r!=null&&(r[t]=n)}}});var yKa,EKa,cai,dai=et(()=>{KQe();yKa=function(r,t){var n=typeof Symbol=="function"&&r[Symbol.iterator];if(!n)return r;var i=n.call(r),o,s=[],a;try{for(;(t===void 0||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(l){a={error:l}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return s},EKa=function(r,t,n){if(n||arguments.length===2)for(var i=0,o=t.length,s;i<o;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return r.concat(s||Array.prototype.slice.call(t))},cai=function(){function r(){}return r.prototype.active=function(){return DAt},r.prototype.with=function(t,n,i){for(var o=[],s=3;s<arguments.length;s++)o[s-3]=arguments[s];return n.call.apply(n,EKa([i],yKa(o),!1))},r.prototype.bind=function(t,n){return n},r.prototype.enable=function(){return this},r.prototype.disable=function(){return this},r}()});var bKa,CKa,Hyr,IKa,_V,JQe=et(()=>{dai();Lae();Fae();bKa=function(r,t){var n=typeof Symbol=="function"&&r[Symbol.iterator];if(!n)return r;var i=n.call(r),o,s=[],a;try{for(;(t===void 0||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(l){a={error:l}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return s},CKa=function(r,t,n){if(n||arguments.length===2)for(var i=0,o=t.length,s;i<o;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return r.concat(s||Array.prototype.slice.call(t))},Hyr="context",IKa=new cai,_V=function(){function r(){}return r.getInstance=function(){return this._instance||(this._instance=new r),this._instance},r.prototype.setGlobalContextManager=function(t){return K9(Hyr,t,HE.instance())},r.prototype.active=function(){return this._getContextManager().active()},r.prototype.with=function(t,n,i){for(var o,s=[],a=3;a<arguments.length;a++)s[a-3]=arguments[a];return(o=this._getContextManager()).with.apply(o,CKa([t,n,i],bKa(s),!1))},r.prototype.bind=function(t,n){return this._getContextManager().bind(t,n)},r.prototype._getContextManager=function(){return w_(Hyr)||IKa},r.prototype.disable=function(){this._getContextManager().disable(),J9(Hyr,HE.instance())},r}()});var Eye,Vyr=et(()=>{(function(r){r[r.NONE=0]="NONE",r[r.SAMPLED=1]="SAMPLED"})(Eye||(Eye={}))});var XQe,$Qe,LAt,FAt=et(()=>{Vyr();XQe="0000000000000000",$Qe="00000000000000000000000000000000",LAt={traceId:$Qe,spanId:XQe,traceFlags:Eye.NONE}});var OV,qAt=et(()=>{FAt();OV=function(){function r(t){t===void 0&&(t=LAt),this._spanContext=t}return r.prototype.spanContext=function(){return this._spanContext},r.prototype.setAttribute=function(t,n){return this},r.prototype.setAttributes=function(t){return this},r.prototype.addEvent=function(t,n){return this},r.prototype.addLink=function(t){return this},r.prototype.addLinks=function(t){return this},r.prototype.setStatus=function(t){return this},r.prototype.updateName=function(t){return this},r.prototype.end=function(t){},r.prototype.isRecording=function(){return!1},r.prototype.recordException=function(t,n){},r}()});function zAt(r){return r.getValue(Yyr)||void 0}function pai(){return zAt(_V.getInstance().active())}function ZQe(r,t){return r.setValue(Yyr,t)}function fai(r){return r.deleteValue(Yyr)}function Aai(r,t){return ZQe(r,new OV(t))}function UAt(r){var t;return(t=zAt(r))===null||t===void 0?void 0:t.spanContext()}var Yyr,Kyr=et(()=>{KQe();qAt();JQe();Yyr=yye("OpenTelemetry Context Key SPAN")});function Jyr(r){return vKa.test(r)&&r!==$Qe}function Xyr(r){return SKa.test(r)&&r!==XQe}function bye(r){return Jyr(r.traceId)&&Xyr(r.spanId)}function hai(r){return new OV(r)}var vKa,SKa,jAt=et(()=>{FAt();qAt();vKa=/^([0-9a-f]{32})$/i,SKa=/^[0-9a-f]{16}$/i});function _Ka(r){return typeof r=="object"&&typeof r.spanId=="string"&&typeof r.traceId=="string"&&typeof r.traceFlags=="number"}var $yr,GAt,Zyr=et(()=>{JQe();Kyr();qAt();jAt();$yr=_V.getInstance(),GAt=function(){function r(){}return r.prototype.startSpan=function(t,n,i){i===void 0&&(i=$yr.active());var o=!!n?.root;if(o)return new OV;var s=i&&UAt(i);return _Ka(s)&&bye(s)?new OV(s):new OV},r.prototype.startActiveSpan=function(t,n,i,o){var s,a,l;if(!(arguments.length<2)){arguments.length===2?l=n:arguments.length===3?(s=n,l=i):(s=n,a=i,l=o);var c=a??$yr.active(),u=this.startSpan(t,s,c),d=ZQe(c,u);return $yr.with(d,l,void 0,u)}},r}()});var OKa,WAt,e3r=et(()=>{Zyr();OKa=new GAt,WAt=function(){function r(t,n,i,o){this._provider=t,this.name=n,this.version=i,this.options=o}return r.prototype.startSpan=function(t,n,i){return this._getTracer().startSpan(t,n,i)},r.prototype.startActiveSpan=function(t,n,i,o){var s=this._getTracer();return Reflect.apply(s.startActiveSpan,s,arguments)},r.prototype._getTracer=function(){if(this._delegate)return this._delegate;var t=this._provider.getDelegateTracer(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):OKa},r}()});var gai,mai=et(()=>{Zyr();gai=function(){function r(){}return r.prototype.getTracer=function(t,n,i){return new GAt},r}()});var TKa,eLe,t3r=et(()=>{e3r();mai();TKa=new gai,eLe=function(){function r(){}return r.prototype.getTracer=function(t,n,i){var o;return(o=this.getDelegateTracer(t,n,i))!==null&&o!==void 0?o:new WAt(this,t,n,i)},r.prototype.getDelegate=function(){var t;return(t=this._delegate)!==null&&t!==void 0?t:TKa},r.prototype.setDelegate=function(t){this._delegate=t},r.prototype.getDelegateTracer=function(t,n,i){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getTracer(t,n,i)},r}()});var HAt,yai=et(()=>{(function(r){r[r.NOT_RECORD=0]="NOT_RECORD",r[r.RECORD=1]="RECORD",r[r.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(HAt||(HAt={}))});var VAt,Eai=et(()=>{(function(r){r[r.INTERNAL=0]="INTERNAL",r[r.SERVER=1]="SERVER",r[r.CLIENT=2]="CLIENT",r[r.PRODUCER=3]="PRODUCER",r[r.CONSUMER=4]="CONSUMER"})(VAt||(VAt={}))});var YAt,bai=et(()=>{(function(r){r[r.UNSET=0]="UNSET",r[r.OK=1]="OK",r[r.ERROR=2]="ERROR"})(YAt||(YAt={}))});function Cai(r){return BKa.test(r)}function Iai(r){return xKa.test(r)&&!MKa.test(r)}var r3r,wKa,RKa,BKa,xKa,MKa,vai=et(()=>{r3r="[_0-9a-z-*/]",wKa="[a-z]"+r3r+"{0,255}",RKa="[a-z0-9]"+r3r+"{0,240}@[a-z]"+r3r+"{0,13}",BKa=new RegExp("^(?:"+wKa+"|"+RKa+")$"),xKa=/^[ -~]{0,255}[!-~]$/,MKa=/,|=/});var Sai,DKa,_ai,Oai,Tai,wai=et(()=>{vai();Sai=32,DKa=512,_ai=",",Oai="=",Tai=function(){function r(t){this._internalState=new Map,t&&this._parse(t)}return r.prototype.set=function(t,n){var i=this._clone();return i._internalState.has(t)&&i._internalState.delete(t),i._internalState.set(t,n),i},r.prototype.unset=function(t){var n=this._clone();return n._internalState.delete(t),n},r.prototype.get=function(t){return this._internalState.get(t)},r.prototype.serialize=function(){var t=this;return this._keys().reduce(function(n,i){return n.push(i+Oai+t.get(i)),n},[]).join(_ai)},r.prototype._parse=function(t){t.length>DKa||(this._internalState=t.split(_ai).reverse().reduce(function(n,i){var o=i.trim(),s=o.indexOf(Oai);if(s!==-1){var a=o.slice(0,s),l=o.slice(s+1,i.length);Cai(a)&&Iai(l)&&n.set(a,l)}return n},new Map),this._internalState.size>Sai&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,Sai))))},r.prototype._keys=function(){return Array.from(this._internalState.keys()).reverse()},r.prototype._clone=function(){var t=new r;return t._internalState=new Map(this._internalState),t},r}()});function Rai(r){return new Tai(r)}var Bai=et(()=>{wai()});var n3r,xai=et(()=>{JQe();n3r=_V.getInstance()});var i3r,Mai=et(()=>{Fae();i3r=HE.instance()});var NKa,Dai,Nai=et(()=>{Gyr();NKa=function(){function r(){}return r.prototype.getMeter=function(t,n,i){return jyr},r}(),Dai=new NKa});var o3r,Pai,kai=et(()=>{Nai();Lae();Fae();o3r="metrics",Pai=function(){function r(){}return r.getInstance=function(){return this._instance||(this._instance=new r),this._instance},r.prototype.setGlobalMeterProvider=function(t){return K9(o3r,t,HE.instance())},r.prototype.getMeterProvider=function(){return w_(o3r)||Dai},r.prototype.getMeter=function(t,n,i){return this.getMeterProvider().getMeter(t,n,i)},r.prototype.disable=function(){J9(o3r,HE.instance())},r}()});var s3r,Qai=et(()=>{kai();s3r=Pai.getInstance()});var Lai,Fai=et(()=>{Lai=function(){function r(){}return r.prototype.inject=function(t,n){},r.prototype.extract=function(t,n){return t},r.prototype.fields=function(){return[]},r}()});function l3r(r){return r.getValue(a3r)||void 0}function qai(){return l3r(_V.getInstance().active())}function zai(r,t){return r.setValue(a3r,t)}function Uai(r){return r.deleteValue(a3r)}var a3r,jai=et(()=>{JQe();KQe();a3r=yye("OpenTelemetry Baggage Key")});var u3r,PKa,Gai,Wai=et(()=>{Lae();Fai();Wyr();jai();qyr();Fae();u3r="propagation",PKa=new Lai,Gai=function(){function r(){this.createBaggage=iai,this.getBaggage=l3r,this.getActiveBaggage=qai,this.setBaggage=zai,this.deleteBaggage=Uai}return r.getInstance=function(){return this._instance||(this._instance=new r),this._instance},r.prototype.setGlobalPropagator=function(t){return K9(u3r,t,HE.instance())},r.prototype.inject=function(t,n,i){return i===void 0&&(i=QAt),this._getGlobalPropagator().inject(t,n,i)},r.prototype.extract=function(t,n,i){return i===void 0&&(i=kAt),this._getGlobalPropagator().extract(t,n,i)},r.prototype.fields=function(){return this._getGlobalPropagator().fields()},r.prototype.disable=function(){J9(u3r,HE.instance())},r.prototype._getGlobalPropagator=function(){return w_(u3r)||PKa},r}()});var c3r,Hai=et(()=>{Wai();c3r=Gai.getInstance()});var d3r,Vai,Yai=et(()=>{Lae();t3r();jAt();Kyr();Fae();d3r="trace",Vai=function(){function r(){this._proxyTracerProvider=new eLe,this.wrapSpanContext=hai,this.isSpanContextValid=bye,this.deleteSpan=fai,this.getSpan=zAt,this.getActiveSpan=pai,this.getSpanContext=UAt,this.setSpan=ZQe,this.setSpanContext=Aai}return r.getInstance=function(){return this._instance||(this._instance=new r),this._instance},r.prototype.setGlobalTracerProvider=function(t){var n=K9(d3r,this._proxyTracerProvider,HE.instance());return n&&this._proxyTracerProvider.setDelegate(t),n},r.prototype.getTracerProvider=function(){return w_(d3r)||this._proxyTracerProvider},r.prototype.getTracer=function(t,n){return this.getTracerProvider().getTracer(t,n)},r.prototype.disable=function(){J9(d3r,HE.instance()),this._proxyTracerProvider=new eLe},r}()});var R_,Kai=et(()=>{Yai();R_=Vai.getInstance()});var Jai={};ZS(Jai,{DiagConsoleLogger:()=>sai,DiagLogLevel:()=>d3,INVALID_SPANID:()=>XQe,INVALID_SPAN_CONTEXT:()=>LAt,INVALID_TRACEID:()=>$Qe,ProxyTracer:()=>WAt,ProxyTracerProvider:()=>eLe,ROOT_CONTEXT:()=>DAt,SamplingDecision:()=>HAt,SpanKind:()=>VAt,SpanStatusCode:()=>YAt,TraceFlags:()=>Eye,ValueType:()=>PAt,baggageEntryMetadataFromString:()=>oai,context:()=>n3r,createContextKey:()=>yye,createNoopMeter:()=>lai,createTraceState:()=>Rai,default:()=>kKa,defaultTextMapGetter:()=>kAt,defaultTextMapSetter:()=>QAt,diag:()=>i3r,isSpanContextValid:()=>bye,isValidSpanId:()=>Xyr,isValidTraceId:()=>Jyr,metrics:()=>s3r,propagation:()=>c3r,trace:()=>R_});var kKa,zae=et(()=>{qyr();KQe();aai();MAt();Gyr();uai();Wyr();e3r();t3r();yai();Eai();bai();Vyr();Bai();jAt();FAt();xai();Mai();Qai();Hai();Kai();kKa={context:n3r,diag:i3r,metrics:s3r,propagation:c3r,trace:R_}});var Xai,X9,$ai=et(()=>{"use strict";X9=(r,t={},n=1)=>{Xai&&Xai.increment(r,t,n)}});function FKa(){let r,t;return{promise:new Promise((n,i)=>{r=n,t=i}),resolve:r,reject:t}}function qKa(r,t){return[...r,t]}function zKa(r,t){return[...r.slice(0,t),...r.slice(t+1)]}function UKa(r,t){let n=r.indexOf(t);return n!==-1?zKa(r,n):r}var Zai,p3r,QKa,LKa,KAt,f3r=et(()=>{p3r=new WeakMap,QKa=()=>{},LKa=class TV{constructor(t){this.subscribers=[],this.settlement=null,this[Zai]="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=FKa();this.subscribers=qKa(this.subscribers,o),t=o.promise,n=()=>{this.subscribers!==null&&(this.subscribers=UKa(this.subscribers,o))}}else{let{status:o}=i;o==="fulfilled"?t=Promise.resolve(i.value):t=Promise.reject(i.reason),n=QKa}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=TV.getSubscribablePromise(t);return typeof n<"u"?n:TV.createSubscribablePromise(t)}static createSubscribablePromise(t){let n=new TV(t);return p3r.set(t,n),p3r.set(n,n),n}static getSubscribablePromise(t){return p3r.get(t)}static resolve(t){return TV.proxy(t).subscribe()}static async any(t){let n=t.map(TV.resolve);try{return await Promise.any(n)}finally{n.forEach(({unsubscribe:i})=>{i()})}}static async race(t){let n=t.map(TV.resolve);try{return await Promise.race(n)}finally{n.forEach(({unsubscribe:i})=>{i()})}}static async raceSingletons(t){let n=t.map(i=>TV.proxy(i).then(()=>[i]));try{return await Promise.race(n)}finally{for(let i of n)i.unsubscribe()}}};Zai=Symbol.toStringTag;KAt=LKa});var Uae,R2,jKa,eli=et(()=>{"use strict";vr();f3r();Iut();Uae=class extends At{},R2=async(r,t,n)=>{let i=jKa(r),o=i.promise.then(()=>{throw new Uae(t)});return await KAt.race([n,o]).finally(i.cancel)},jKa=r=>{let t=yC(),n=setTimeout(t.resolve,r),i=()=>clearTimeout(n);return{promise:t.promise,cancel:i}}});var QOd,tli=et(()=>{"use strict";QOd=global.setImmediate??setTimeout});var n8=et(()=>{"use strict";eli();tli()});var A3r,rli=et(()=>{"use strict";Ag();A3r=(r,t,n,...i)=>{let o=o0(),s={...t,area:r};o[n](...i,s)}});var wV,JAt,qT,Cye,XAt=et(()=>{"use strict";vr();Ag();rli();wV=class{valid=!1;failures;originalValue;constructor(t,n){this.originalValue=JD(t),this.failures=n}get failureMessage(){return this.failures.map(t=>t.path.length>0?`${t.path}: ${t.message}`:t.message).join(`
177
177
  `)}},JAt=null,qT=class extends At{code;result;constructor(t,n,i=400){super(t,typeof n=="string"?n:n?.failureMessage),this.result=typeof n=="string"?void 0:n,this.code=i}statusCode(){return this.code}get validationResult(){return this.result}get failureDetails(){return this.result?`${this.message}: ${this.result.failureMessage}`:this.message}},Cye=class{constructor(t){this.name=t}is(t){return this.validate(t).valid}assert(t,n){return this.doAssert(t,!0,n)}verify(t,n){let i=!!(n?.throwOnVerify??!1);return this.doAssert(t,i,n)}doAssert(t,n,i){let{logContext:o,logArea:s,failureLogLevel:a,successLogLevel:l,statusCode:c,errorMessage:u}=i||{},d=this.validate(t),p=i?.additionalValidation?.(t)||{valid:!0},f=p.valid?d:p;if(!f.valid){let A=typeof u=="function"?u(f):u??`Found ${f.failures.length} validation failure(s) for ${this.name}`,h=new qT(A,f,c);if(a!==JAt){let y=t;y&&typeof y=="object"&&(y=JD(y)),A3r(s,o,a||"error",h,y)}if(n)throw h;return t}return l&&A3r(s,o,l,`${this.name} validation succeeded`,t),f.value}}});var h3r,wd,g3r=et(()=>{"use strict";Ag();vr();XAt();h3r=class extends Cye{constructor(n,i){super(n);this.runtype=i;if(!i)throw new At(`Missing runtype for ${n} validator. Did you use a circular import?`)}validate(n){try{let i=this.runtype.validate(n);return i.success?{valid:!0,value:n}:this.createValidationFailedResult(i,n)}catch(i){return o0().error(`RuntypesValidator: Unable to validate ${this.name} value. `,`
178
178
  Error: `,i,`
179
- Value: `,n),new wV(n,[{path:"",message:"value triggered unknown runtypes error"}])}}createValidationFailedResult(n,i){let o=[],s=(a,l)=>{for(let[c,u]of Object.entries(l)){let d=a.concat(c);typeof u=="string"?o.push({path:d.join("."),message:u}):s(d,u)}};if(n.code==="TYPE_INCORRECT"||n.code==="CONSTRAINT_FAILED")o.push({path:"",message:n.message});else{let a=n.details;a&&s([],a)}return new wV(i,o)}},wd=(r,t)=>new h3r(r,t)});var y3r,GKa,WKa,m3r,Cr,nli=et(()=>{"use strict";y3r=Ct(is());vr();Ag();XAt();sn();GKa=r=>r.code==="unrecognized_keys"?r.keys.length:r.code==="invalid_type"&&r.received==="undefined"&&r.message==="Required"?1:r.code==="invalid_literal"?10:0,WKa=r=>y3r.default.sum(r.issues.map(t=>GKa(t))),m3r=class extends Cye{constructor(n,i){super(n);this.zodType=i;if(!i)throw new At(`Missing Zod type for ${n} validator. Did you use a circular import?`)}convertZodError=n=>{let i=[];for(let o of n.issues)if(o.code==="invalid_union"){let s=y3r.default.minBy(o.unionErrors,a=>WKa(a));s&&i.push(...this.convertZodError(s))}else i.push({path:o.path.join("."),message:o.message});return i};validate(n){try{let i=this.zodType.safeParse(n);if(i.success)return{valid:!0,value:i.data};let o=this.convertZodError(i.error);return new wV(n,o)}catch(i){let o=i instanceof T.ZodError?[i.flatten(),i.issues]:[];return o0().error(`ZodValidator: Unable to validate ${this.name} value`,"error: ",i,"value: ",n,...o),new wV(n,[{path:"",message:"value triggered unknown Zod error"}])}}},Cr=(r,t)=>new m3r(r,t)});var Iye=et(()=>{"use strict";g3r();XAt();nli()});var HKa,VKa,ili,E3r,$At,b3r,ZAt,C3r,I3r,v3r,S3r,_3r,YKa,oli,sli,RV=et(()=>{"use strict";sn();Zpr();vV();Cyr();Lyr();zae();$ai();n8();Iye();HKa=T.object({auth:T.string(),firestore:T.string(),storage:T.string()}),VKa=T.object({apiKey:T.string(),authDomain:T.string(),projectId:T.string(),storageBucket:T.string(),messagingSenderId:T.string(),appId:T.string(),measurementId:T.string(),emulatorInfo:HKa.optional()}),ili=Cr("FirebaseConfig",VKa),E3r=r=>{X9("firestore.delete",{path:r})},$At=r=>{X9("firestore.set",{path:r})},b3r=r=>{X9("firestore.update",{path:r})},ZAt=r=>{X9("firestore.get",{path:r})},C3r=r=>{X9("firestore.transaction.get",{path:r})},I3r=r=>{X9("firestore.transaction.set",{path:r})},v3r=r=>{X9("firestore.transaction.update",{path:r})},S3r=r=>{X9("firestore.transaction.delete",{path:r})},_3r=()=>{X9("firestore.batch")},YKa=R_.getTracer("firestore"),oli=r=>(ZAt(r.path),YKa.startActiveSpan(`get ${r.path}`,async t=>{t.setAttribute("path",r.path),t.setAttribute("operation","get");let n=await r.get();return t.end(),n})),sli=async(r,t=1e3)=>{let n=()=>{},i=new Promise(o=>{n=r.onSnapshot(s=>{s.metadata.hasPendingWrites||o(s)})});return await R2(t,`Timed out in GetDocumentNoPendingWrites after ${t} ms`,i).finally(n)}});var eht,tht,ali,jae=et(()=>{"use strict";eht={emerg:"emerg",info:"info",error:"error",debug:"debug",assert:"assert",warn:"warn",alert:"alert",app:"app"},tht={LEVELS:{emerg:0,assert:1,alert:2,error:3,app:4,info:5,debug:6,warn:4},COLORS:{emerg:"red",assert:"yellow",alert:"yellow",warn:"yellow",error:"cyan",app:"blue",info:"green",debug:"magenta"}},ali=["Authorization","Token","Password","Secret","idToken","id_token","clientID","clientSecret"]});var O3r,B_,tLe=et(()=>{"use strict";O3r=["ACTUAL_STATE","ADVANCED_DEPLOY","APP","AUTH","BULK_WRITE","CLI","CLI_INTERNAL","COLUMN_LINEAGE","COLUMN_METADATA","COMMON","CONNECTION","DEBUG","DEPLOY","DNS","DOCS","DRAG","ENTITY_API","ENV","ENVIRONMENTS","ERROR_OPERATIONS","FIREBASE","FOLDERS","GIT","GIT_SETTINGS","GOOGLE_DEBUG","GRAPH","HEARTBEAT","INTEGRATIONS","JDBC_SERVICE","JEST","JOBS","JSON_PARSER","LIGHTNING_FS","LISTENERS","MACROS","MAPPING_GRID","METADATA_HYDRATION","METADATA_OPERATIONS","NARROW_METADATA","NODE_TYPES","ORGS","ORG_BOOTSTRAP","ORG_SCANNER","ORG_SETTINGS","ORG_UPGRADE","PACKAGES","PACKAGES_BACKEND","PACKAGE_NAMESPACES","PACKAGE_REGISTRY","PALETTE","PARTNER_CONNECT","PENDO","PERFORMANCE","PIPELINE","PLAN","PLATFORM","PRESYNC","PROBLEM_SCANNER","PROJECTS","RBAC","RENDERER","RUNNER","RUNNER_BACKEND","RUN_RESULTS","RUN_TRANSACTION","SEARCH","SECRETS","SECURE_RUN_AND_WORKSPACE","SQL_PARSING","SQL_TESTING","STATE","STEPS","STORAGE_LOCATIONS","STRUMENTA","SYSTEM_EMAILS","TEMPLATE_EDITOR","TESTING","TIMING_UTILS","TREE_OPERATIONS","TYPESENSE","UI","USERS","USER_ACTIVATION","USER_MANAGEMENT","USER_SETTINGS","VERSIONING","VERSION_CONTROL_ACTIONS","WORKSPACES","XML_PARSER","YAML","ZIP","AI_COLUMN_DESCRIPTIONS","AI_NODE_DESCRIPTIONS","AI_GIT_COMMIT_MESSAGE"],B_={...Object.fromEntries(O3r.map(r=>[r,{level:"info"}]))}});var Tq,vye,p3,rht=et(()=>{"use strict";Tq=(r,t,n,i,o)=>({orgID:r,workspaceID:t,userID:n,runID:i,nodeID:o}),vye=(r,t)=>{r.runID=t},p3={}});var uli=I(lli=>{"use strict";Object.defineProperty(lli,"__esModule",{value:!0})});var T3r=I(nht=>{"use strict";Object.defineProperty(nht,"__esModule",{value:!0});nht.Failcode=void 0;nht.Failcode={TYPE_INCORRECT:"TYPE_INCORRECT",VALUE_INCORRECT:"VALUE_INCORRECT",KEY_INCORRECT:"KEY_INCORRECT",CONTENT_INCORRECT:"CONTENT_INCORRECT",ARGUMENT_INCORRECT:"ARGUMENT_INCORRECT",RETURN_INCORRECT:"RETURN_INCORRECT",CONSTRAINT_FAILED:"CONSTRAINT_FAILED",PROPERTY_MISSING:"PROPERTY_MISSING",PROPERTY_PRESENT:"PROPERTY_PRESENT",NOTHING_EXPECTED:"NOTHING_EXPECTED"}});var _ye=I(Sye=>{"use strict";var KKa=Sye&&Sye.__extends||function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,o){i.__proto__=o}||function(i,o){for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(i[s]=o[s])},r(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");r(t,n);function i(){this.constructor=t}t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}}();Object.defineProperty(Sye,"__esModule",{value:!0});Sye.ValidationError=void 0;var JKa=function(r){KKa(t,r);function t(n){var i=r.call(this,n.message)||this;return i.name="ValidationError",i.code=n.code,n.details!==void 0&&(i.details=n.details),Object.setPrototypeOf(i,t.prototype),i}return t}(Error);Sye.ValidationError=JKa});var rLe=I(w3r=>{"use strict";Object.defineProperty(w3r,"__esModule",{value:!0});var iht=function(r){return function(t){switch(t.tag){case"literal":return'"'.concat(String(t.value),'"');case"string":return"string";case"brand":return t.brand;case"constraint":return t.name||iht(r)(t.underlying);case"union":return t.alternatives.map(iht(r)).join(" | ");case"intersect":return t.intersectees.map(iht(r)).join(" & ");default:break}return"`${".concat(x_(!1,r)(t),"}`")}},oht=function(r){return function(t){switch(t.tag){case"literal":return String(t.value);case"brand":return"${".concat(t.brand,"}");case"constraint":return t.name?"${".concat(t.name,"}"):oht(r)(t.underlying);case"union":if(t.alternatives.length===1){var n=t.alternatives[0];return oht(r)(n.reflect)}break;case"intersect":if(t.intersectees.length===1){var n=t.intersectees[0];return oht(r)(n.reflect)}break;default:break}return"${".concat(x_(!1,r)(t),"}")}},x_=function(r,t){return function(n){var i=function(u){return r?"(".concat(u,")"):u};if(t.has(n))return i("CIRCULAR ".concat(n.tag));t.add(n);try{switch(n.tag){case"unknown":case"never":case"void":case"boolean":case"number":case"bigint":case"string":case"symbol":case"function":return n.tag;case"literal":{var o=n.value;return typeof o=="string"?'"'.concat(o,'"'):String(o)}case"template":{if(n.strings.length===0)return'""';if(n.strings.length===1)return'"'.concat(n.strings[0],'"');if(n.strings.length===2&&n.strings.every(function(u){return u===""})){var s=n.runtypes[0];return iht(t)(s.reflect)}var a=!1,l=n.strings.reduce(function(u,d,p){var f=u+d,A=n.runtypes[p];if(A){var h=oht(t)(A.reflect);return!a&&h.startsWith("$")&&(a=!0),f+h}else return f},"");return a?"`".concat(l,"`"):'"'.concat(l,'"')}case"array":return"".concat(cli(n)).concat(x_(!0,t)(n.element),"[]");case"dictionary":return"{ [_: ".concat(n.key,"]: ").concat(x_(!1,t)(n.value)," }");case"record":{var c=Object.keys(n.fields);return c.length?"{ ".concat(c.map(function(u){return"".concat(cli(n)).concat(u).concat(XKa(n,u),": ").concat(n.fields[u].tag==="optional"?x_(!1,t)(n.fields[u].underlying):x_(!1,t)(n.fields[u]),";")}).join(" ")," }"):"{}"}case"tuple":return"[".concat(n.components.map(x_(!1,t)).join(", "),"]");case"union":return i("".concat(n.alternatives.map(x_(!0,t)).join(" | ")));case"intersect":return i("".concat(n.intersectees.map(x_(!0,t)).join(" & ")));case"optional":return x_(r,t)(n.underlying)+" | undefined";case"constraint":return n.name||x_(r,t)(n.underlying);case"instanceof":return n.ctor.name;case"brand":return x_(r,t)(n.entity)}}finally{t.delete(n)}throw Error("impossible")}};w3r.default=x_(!1,new Set);function XKa(r,t){var n=r.isPartial,i=r.fields;return n||t!==void 0&&i[t].tag==="optional"?"?":""}function cli(r){var t=r.isReadonly;return t?"readonly ":""}});var tf=I(Rd=>{"use strict";var R3r=Rd&&Rd.__assign||function(){return R3r=Object.assign||function(r){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},R3r.apply(this,arguments)};Object.defineProperty(Rd,"__esModule",{value:!0});Rd.FAILURE=Rd.SUCCESS=Rd.enumerableKeysOf=Rd.typeOf=Rd.hasKey=void 0;var $9=T3r(),Gae=rLe();function $Ka(r,t){return typeof t=="object"&&t!==null&&r in t}Rd.hasKey=$Ka;var ZKa=function(r){var t,n,i;return typeof r=="object"?r===null?"null":Array.isArray(r)?"array":((t=r.constructor)===null||t===void 0?void 0:t.name)==="Object"?"object":(i=(n=r.constructor)===null||n===void 0?void 0:n.name)!==null&&i!==void 0?i:typeof r:typeof r};Rd.typeOf=ZKa;var eJa=function(r){return typeof r=="object"&&r!==null?Reflect.ownKeys(r).filter(function(t){var n,i;return(i=(n=r.propertyIsEnumerable)===null||n===void 0?void 0:n.call(r,t))!==null&&i!==void 0?i:!0}):[]};Rd.enumerableKeysOf=eJa;function tJa(r){return{success:!0,value:r}}Rd.SUCCESS=tJa;Rd.FAILURE=Object.assign(function(r,t,n){return R3r({success:!1,code:r,message:t},n?{details:n}:{})},{TYPE_INCORRECT:function(r,t){var n="Expected ".concat(r.tag==="template"?"string ".concat((0,Gae.default)(r)):(0,Gae.default)(r),", but was ").concat((0,Rd.typeOf)(t));return(0,Rd.FAILURE)($9.Failcode.TYPE_INCORRECT,n)},VALUE_INCORRECT:function(r,t,n){return(0,Rd.FAILURE)($9.Failcode.VALUE_INCORRECT,"Expected ".concat(r," ").concat(String(t),", but was ").concat(String(n)))},KEY_INCORRECT:function(r,t,n){return(0,Rd.FAILURE)($9.Failcode.KEY_INCORRECT,"Expected ".concat((0,Gae.default)(r)," key to be ").concat((0,Gae.default)(t),", but was ").concat((0,Rd.typeOf)(n)))},CONTENT_INCORRECT:function(r,t){var n="Expected ".concat((0,Gae.default)(r),", but was incompatible");return(0,Rd.FAILURE)($9.Failcode.CONTENT_INCORRECT,n,t)},ARGUMENT_INCORRECT:function(r){return(0,Rd.FAILURE)($9.Failcode.ARGUMENT_INCORRECT,r)},RETURN_INCORRECT:function(r){return(0,Rd.FAILURE)($9.Failcode.RETURN_INCORRECT,r)},CONSTRAINT_FAILED:function(r,t){var n=t?": ".concat(t):"";return(0,Rd.FAILURE)($9.Failcode.CONSTRAINT_FAILED,"Failed constraint check for ".concat((0,Gae.default)(r)).concat(n))},PROPERTY_MISSING:function(r){var t="Expected ".concat((0,Gae.default)(r),", but was missing");return(0,Rd.FAILURE)($9.Failcode.PROPERTY_MISSING,t)},PROPERTY_PRESENT:function(r){var t="Expected nothing, but was ".concat((0,Rd.typeOf)(r));return(0,Rd.FAILURE)($9.Failcode.PROPERTY_PRESENT,t)},NOTHING_EXPECTED:function(r){var t="Expected nothing, but was ".concat((0,Rd.typeOf)(r));return(0,Rd.FAILURE)($9.Failcode.NOTHING_EXPECTED,t)}})});var dli=I(BV=>{"use strict";var rJa=BV&&BV.__read||function(r,t){var n=typeof Symbol=="function"&&r[Symbol.iterator];if(!n)return r;var i=n.call(r),o,s=[],a;try{for(;(t===void 0||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(l){a={error:l}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return s},nJa=BV&&BV.__spreadArray||function(r,t,n){if(n||arguments.length===2)for(var i=0,o=t.length,s;i<o;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return r.concat(s||Array.prototype.slice.call(t))};Object.defineProperty(BV,"__esModule",{value:!0});BV.Contract=void 0;var iJa=_ye(),oJa=tf();function sJa(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n=r.length-1,i=r.slice(0,n),o=r[n];return{enforce:function(s){return function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];if(a.length<i.length){var c="Expected ".concat(i.length," arguments but only received ").concat(a.length),u=oJa.FAILURE.ARGUMENT_INCORRECT(c);throw new iJa.ValidationError(u)}for(var d=0;d<i.length;d++)i[d].check(a[d]);return o.check(s.apply(void 0,nJa([],rJa(a),!1)))}}}}BV.Contract=sJa});var Ali=I(xV=>{"use strict";var aJa=xV&&xV.__read||function(r,t){var n=typeof Symbol=="function"&&r[Symbol.iterator];if(!n)return r;var i=n.call(r),o,s=[],a;try{for(;(t===void 0||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(l){a={error:l}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return s},lJa=xV&&xV.__spreadArray||function(r,t,n){if(n||arguments.length===2)for(var i=0,o=t.length,s;i<o;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return r.concat(s||Array.prototype.slice.call(t))};Object.defineProperty(xV,"__esModule",{value:!0});xV.AsyncContract=void 0;var pli=_ye(),fli=tf();function uJa(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n=r.length-1,i=r.slice(0,n),o=r[n];return{enforce:function(s){return function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];if(a.length<i.length){var c="Expected ".concat(i.length," arguments but only received ").concat(a.length),u=fli.FAILURE.ARGUMENT_INCORRECT(c);throw new pli.ValidationError(u)}for(var d=0;d<i.length;d++)i[d].check(a[d]);var p=s.apply(void 0,lJa([],aJa(a),!1));if(!(p instanceof Promise)){var c="Expected function to return a promise, but instead got ".concat(p),u=fli.FAILURE.RETURN_INCORRECT(c);throw new pli.ValidationError(u)}return p.then(o.check)}}}}xV.AsyncContract=uJa});var hli=I(Z9=>{"use strict";var cJa=Z9&&Z9.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&r[t],i=0;if(n)return n.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},dJa=Z9&&Z9.__read||function(r,t){var n=typeof Symbol=="function"&&r[Symbol.iterator];if(!n)return r;var i=n.call(r),o,s=[],a;try{for(;(t===void 0||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(l){a={error:l}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return s};Object.defineProperty(Z9,"__esModule",{value:!0});Z9.when=Z9.match=void 0;function pJa(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return function(n){var i,o;try{for(var s=cJa(r),a=s.next();!a.done;a=s.next()){var l=dJa(a.value,2),c=l[0],u=l[1];if(c.guard(n))return u(n)}}catch(d){i={error:d}}finally{try{a&&!a.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}throw new Error("No alternatives were matched")}}Z9.match=pJa;function fJa(r,t){return[r,t]}Z9.when=fJa});var MA=I(DV=>{"use strict";Object.defineProperty(DV,"__esModule",{value:!0});DV.innerValidate=DV.create=DV.isRuntype=void 0;var MV=f3(),AJa=rLe(),hJa=_ye(),gli=tf(),mli=Symbol(),gJa=function(r){return(0,gli.hasKey)(mli,r)};DV.isRuntype=gJa;function mJa(r,t){return t[mli]=!0,t.check=n,t.assert=n,t._innerValidate=function(p,f){return f.has(p,t)?(0,gli.SUCCESS)(p):r(p,f)},t.validate=function(p){return t._innerValidate(p,EJa())},t.guard=i,t.Or=o,t.And=s,t.optional=a,t.nullable=l,t.withConstraint=c,t.withGuard=u,t.withBrand=d,t.reflect=t,t.toString=function(){return"Runtype<".concat((0,AJa.default)(t),">")},t;function n(p){var f=t.validate(p);if(f.success)return f.value;throw new hJa.ValidationError(f)}function i(p){return t.validate(p).success}function o(p){return(0,MV.Union)(t,p)}function s(p){return(0,MV.Intersect)(t,p)}function a(){return(0,MV.Optional)(t)}function l(){return(0,MV.Union)(t,MV.Null)}function c(p,f){return(0,MV.Constraint)(t,p,f)}function u(p,f){return(0,MV.Constraint)(t,p,f)}function d(p){return(0,MV.Brand)(p,t)}}DV.create=mJa;function yJa(r,t,n){return r._innerValidate(t,n)}DV.innerValidate=yJa;function EJa(){var r=new WeakMap,t=function(i,o){if(!(i===null||typeof i!="object")){var s=r.get(i);r.set(i,s?s.set(o,!0):new WeakMap().set(o,!0))}},n=function(i,o){var s=r.get(i),a=s&&s.get(o)||!1;return t(i,o),a};return{has:n}}});var aht=I(sht=>{"use strict";Object.defineProperty(sht,"__esModule",{value:!0});sht.Unknown=void 0;var bJa=MA(),CJa=tf(),IJa={tag:"unknown"};sht.Unknown=(0,bJa.create)(function(r){return(0,CJa.SUCCESS)(r)},IJa)});var yli=I(lht=>{"use strict";Object.defineProperty(lht,"__esModule",{value:!0});lht.Never=void 0;var vJa=MA(),SJa=tf(),_Ja={tag:"never"};lht.Never=(0,vJa.create)(SJa.FAILURE.NOTHING_EXPECTED,_Ja)});var Eli=I(uht=>{"use strict";Object.defineProperty(uht,"__esModule",{value:!0});uht.Void=void 0;var OJa=aht();uht.Void=OJa.Unknown});var B3r=I(Oye=>{"use strict";var cht=Oye&&Oye.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&r[t],i=0;if(n)return n.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Oye,"__esModule",{value:!0});Oye.Union=void 0;var dht=MA(),nLe=tf();function TJa(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n=function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];return function(a){for(var l=0;l<r.length;l++)if(r[l].guard(a))return o[l](a)}},i={tag:"union",alternatives:r,match:n};return(0,dht.create)(function(o,s){var a,l,c,u,d,p,f,A;if(typeof o!="object"||o===null){try{for(var h=cht(r),y=h.next();!y.done;y=h.next()){var C=y.value;if((0,dht.innerValidate)(C,o,s).success)return(0,nLe.SUCCESS)(o)}}catch(X){a={error:X}}finally{try{y&&!y.done&&(l=h.return)&&l.call(h)}finally{if(a)throw a.error}}return nLe.FAILURE.TYPE_INCORRECT(i,o)}var v={};try{for(var O=cht(r),w=O.next();!w.done;w=O.next()){var C=w.value;if(C.reflect.tag==="record"){var R=function(Y){var L=C.reflect.fields[Y];L.tag==="literal"&&(v[Y]?v[Y].every(function($){return $!==L.value})&&v[Y].push(L.value):v[Y]=[L.value])};for(var k in C.reflect.fields)R(k)}}}catch(X){c={error:X}}finally{try{w&&!w.done&&(u=O.return)&&u.call(O)}finally{if(c)throw c.error}}for(var k in v)if(v[k].length===r.length)try{for(var z=(d=void 0,cht(r)),H=z.next();!H.done;H=z.next()){var C=H.value;if(C.reflect.tag==="record"){var J=C.reflect.fields[k];if(J.tag==="literal"&&(0,nLe.hasKey)(k,o)&&o[k]===J.value)return(0,dht.innerValidate)(C,o,s)}}}catch(Y){d={error:Y}}finally{try{H&&!H.done&&(p=z.return)&&p.call(z)}finally{if(d)throw d.error}}try{for(var K=cht(r),V=K.next();!V.done;V=K.next()){var F=V.value;if((0,dht.innerValidate)(F,o,s).success)return(0,nLe.SUCCESS)(o)}}catch(X){f={error:X}}finally{try{V&&!V.done&&(A=K.return)&&A.call(K)}finally{if(f)throw f.error}}return nLe.FAILURE.TYPE_INCORRECT(i,o)},i)}Oye.Union=TJa});var D3r=I(Nv=>{"use strict";Object.defineProperty(Nv,"__esModule",{value:!0});Nv.Nullish=Nv.Null=Nv.Undefined=Nv.Literal=Nv.literal=void 0;var wJa=MA(),bli=tf(),RJa=B3r();function x3r(r){return Array.isArray(r)?String(r.map(String)):typeof r=="bigint"?String(r)+"n":String(r)}Nv.literal=x3r;function M3r(r){var t={tag:"literal",value:r};return(0,wJa.create)(function(n){return n===r?(0,bli.SUCCESS)(n):bli.FAILURE.VALUE_INCORRECT("literal","`".concat(x3r(r),"`"),"`".concat(x3r(n),"`"))},t)}Nv.Literal=M3r;Nv.Undefined=M3r(void 0);Nv.Null=M3r(null);Nv.Nullish=(0,RJa.Union)(Nv.Null,Nv.Undefined)});var _li=I(e7=>{"use strict";var NV=e7&&e7.__read||function(r,t){var n=typeof Symbol=="function"&&r[Symbol.iterator];if(!n)return r;var i=n.call(r),o,s=[],a;try{for(;(t===void 0||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(l){a={error:l}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return s},N3r=e7&&e7.__spreadArray||function(r,t,n){if(n||arguments.length===2)for(var i=0,o=t.length,s;i<o;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return r.concat(s||Array.prototype.slice.call(t))},Cli=e7&&e7.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&r[t],i=0;if(n)return n.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e7,"__esModule",{value:!0});e7.Template=void 0;var pht=MA(),Ili=rLe(),wq=tf(),Sli=D3r(),P3r=function(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},BJa=function(r){if(0<r.length&&Array.isArray(r[0])){var t=NV(r),n=t[0],i=t.slice(1);return[Array.from(n),i]}else{var o=r,n=o.reduce(function(l,c){return(0,pht.isRuntype)(c)?l.push(""):l.push(l.pop()+String(c)),l},[""]),i=o.filter(pht.isRuntype);return[n,i]}},xJa=function(r,t){for(var n=0;n<t.length;)switch(t[n].reflect.tag){case"literal":{var i=t[n];t.splice(n,1);var o=String(i.value);r.splice(n,2,r[n]+o+r[n+1]);break}case"template":{var s=t[n];t.splice.apply(t,N3r([n,1],NV(s.runtypes),!1));var a=s.strings;if(a.length===1)r.splice(n,2,r[n]+a[0]+r[n+1]);else{var l=a[0],c=a.slice(1,-1),u=a[a.length-1];r.splice.apply(r,N3r(N3r([n,2,r[n]+l],NV(c),!1),[u+r[n+1]],!1))}break}case"union":{var d=t[n];if(d.alternatives.length===1)try{var p=sLe(d);t.splice(n,1);var o=String(p.value);r.splice(n,2,r[n]+o+r[n+1]);break}catch{n++;break}else{n++;break}}case"intersect":{var f=t[n];if(f.intersectees.length===1)try{var A=sLe(f);t.splice(n,1);var o=String(A.value);r.splice(n,2,r[n]+o+r[n+1]);break}catch{n++;break}else{n++;break}}default:n++;break}},MJa=function(r){var t=NV(BJa(r),2),n=t[0],i=t[1];return xJa(n,i),[n,i]},sLe=function(r){switch(r.reflect.tag){case"literal":return r;case"brand":return sLe(r.reflect.entity);case"union":if(r.reflect.alternatives.length===1)return sLe(r.reflect.alternatives[0]);break;case"intersect":if(r.reflect.intersectees.length===1)return sLe(r.reflect.intersectees[0]);break;default:break}throw void 0},vli=function(r){return r},k3r={string:[function(r){return globalThis.String(r)},".*"],number:[function(r){return globalThis.Number(r)},"[+-]?(?:\\d*\\.\\d+|\\d+\\.\\d*|\\d+)(?:[Ee][+-]?\\d+)?","0[Bb][01]+","0[Oo][0-7]+","0[Xx][0-9A-Fa-f]+"],bigint:[function(r){return globalThis.BigInt(r)},"-?[1-9]d*"],boolean:[function(r){return r!=="false"},"true","false"],null:[function(){return null},"null"],undefined:[function(){},"undefined"]},iLe=function(r){switch(r.tag){case"literal":{var t=NV(k3r[(0,wq.typeOf)(r.value)]||[vli],1),n=t[0];return n}case"brand":return iLe(r.entity);case"constraint":return iLe(r.underlying);case"union":return r.alternatives.map(iLe);case"intersect":return r.intersectees.map(iLe);default:var i=NV(k3r[r.tag]||[vli],1),o=i[0];return o}},Q3r=function(r,t){return function(n){var i,o,s,a,l=iLe(r);if(Array.isArray(l))switch(r.tag){case"union":try{for(var c=Cli(r.alternatives),u=c.next();!u.done;u=c.next()){var d=u.value,p=Q3r(d.reflect,t)(n);if(p.success)return p}}catch(C){i={error:C}}finally{try{u&&!u.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}return wq.FAILURE.TYPE_INCORRECT(r,n);case"intersect":try{for(var f=Cli(r.intersectees),A=f.next();!A.done;A=f.next()){var h=A.value,p=Q3r(h.reflect,t)(n);if(!p.success)return p}}catch(C){s={error:C}}finally{try{A&&!A.done&&(a=f.return)&&a.call(f)}finally{if(s)throw s.error}}return(0,wq.SUCCESS)(n);default:throw Error("impossible")}else{var y=l,p=(0,pht.innerValidate)(r,y(n),t);return!p.success&&p.code==="VALUE_INCORRECT"&&r.tag==="literal"?wq.FAILURE.VALUE_INCORRECT("literal",'"'.concat((0,Sli.literal)(r.value),'"'),'"'.concat(n,'"')):p}}},oLe=function(r){switch(r.tag){case"literal":return P3r(String(r.value));case"brand":return oLe(r.entity);case"constraint":return oLe(r.underlying);case"union":return r.alternatives.map(oLe).join("|");case"template":return r.strings.map(P3r).reduce(function(i,o,s){var a=i+o,l=r.runtypes[s];return l?a+"(?:".concat(oLe(l.reflect),")"):a},"");default:var t=NV(k3r[r.tag]||[void 0,".*"]),n=t.slice(1);return n.join("|")}},DJa=function(r){var t=r.strings.map(P3r).reduce(function(n,i,o){var s=n+i,a=r.runtypes[o];return a?s+"(".concat(oLe(a.reflect),")"):s},"");return new RegExp("^".concat(t,"$"),"su")};function NJa(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n=NV(MJa(r),2),i=n[0],o=n[1],s={tag:"template",strings:i,runtypes:o},a=DJa(s),l=function(c,u){var d=c.match(a);if(d){for(var p=d.slice(1),f=0;f<o.length;f++){var A=o[f],h=p[f],y=Q3r(A.reflect,u)(h);if(!y.success)return y}return(0,wq.SUCCESS)(c)}else return wq.FAILURE.VALUE_INCORRECT("string","".concat((0,Ili.default)(s)),'"'.concat((0,Sli.literal)(c),'"'))};return(0,pht.create)(function(c,u){if(typeof c!="string")return wq.FAILURE.TYPE_INCORRECT(s,c);var d=l(c,u);if(d.success)return(0,wq.SUCCESS)(c);var p=wq.FAILURE.VALUE_INCORRECT("string","".concat((0,Ili.default)(s)),'"'.concat(c,'"'));return p.message!==d.message&&(p.message+=" (inner: ".concat(d.message,")")),p},s)}e7.Template=NJa});var wli=I(fht=>{"use strict";Object.defineProperty(fht,"__esModule",{value:!0});fht.Boolean=void 0;var PJa=MA(),Oli=tf(),Tli={tag:"boolean"};fht.Boolean=(0,PJa.create)(function(r){return typeof r=="boolean"?(0,Oli.SUCCESS)(r):Oli.FAILURE.TYPE_INCORRECT(Tli,r)},Tli)});var xli=I(Aht=>{"use strict";Object.defineProperty(Aht,"__esModule",{value:!0});Aht.Number=void 0;var kJa=MA(),Rli=tf(),Bli={tag:"number"};Aht.Number=(0,kJa.create)(function(r){return typeof r=="number"?(0,Rli.SUCCESS)(r):Rli.FAILURE.TYPE_INCORRECT(Bli,r)},Bli)});var Nli=I(hht=>{"use strict";Object.defineProperty(hht,"__esModule",{value:!0});hht.BigInt=void 0;var QJa=MA(),Mli=tf(),Dli={tag:"bigint"};hht.BigInt=(0,QJa.create)(function(r){return typeof r=="bigint"?(0,Mli.SUCCESS)(r):Mli.FAILURE.TYPE_INCORRECT(Dli,r)},Dli)});var L3r=I(ght=>{"use strict";Object.defineProperty(ght,"__esModule",{value:!0});ght.String=void 0;var LJa=MA(),Pli=tf(),kli={tag:"string"};ght.String=(0,LJa.create)(function(r){return typeof r=="string"?(0,Pli.SUCCESS)(r):Pli.FAILURE.TYPE_INCORRECT(kli,r)},kli)});var qli=I(mht=>{"use strict";Object.defineProperty(mht,"__esModule",{value:!0});mht.Symbol=void 0;var Fli=MA(),aLe=tf(),FJa=function(r){var t={tag:"symbol",key:r};return(0,Fli.create)(function(n){if(typeof n!="symbol")return aLe.FAILURE.TYPE_INCORRECT(t,n);var i=globalThis.Symbol.keyFor(n);return i!==r?aLe.FAILURE.VALUE_INCORRECT("symbol key",Lli(r),Lli(i)):(0,aLe.SUCCESS)(n)},t)},Qli={tag:"symbol"};mht.Symbol=(0,Fli.create)(function(r){return typeof r=="symbol"?(0,aLe.SUCCESS)(r):aLe.FAILURE.TYPE_INCORRECT(Qli,r)},Object.assign(FJa,Qli));var Lli=function(r){return r===void 0?"undefined":'"'.concat(r,'"')}});var jli=I(yht=>{"use strict";Object.defineProperty(yht,"__esModule",{value:!0});yht.Array=void 0;var zli=MA(),lLe=tf();function Uli(r,t){var n={tag:"array",isReadonly:t,element:r};return zJa((0,zli.create)(function(i,o){if(!Array.isArray(i))return lLe.FAILURE.TYPE_INCORRECT(n,i);var s=(0,lLe.enumerableKeysOf)(i),a=s.map(function(c){return(0,zli.innerValidate)(r,i[c],o)}),l=s.reduce(function(c,u){var d=a[u];return d.success||(c[u]=d.details||d.message),c},[]);return(0,lLe.enumerableKeysOf)(l).length!==0?lLe.FAILURE.CONTENT_INCORRECT(n,l):(0,lLe.SUCCESS)(i)},n))}function qJa(r){return Uli(r,!1)}yht.Array=qJa;function zJa(r){return r.asReadonly=t,r;function t(){return Uli(r.element,!0)}}});var Wli=I(Eht=>{"use strict";Object.defineProperty(Eht,"__esModule",{value:!0});Eht.Tuple=void 0;var Gli=MA(),Tye=tf();function UJa(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n={tag:"tuple",components:r};return(0,Gli.create)(function(i,o){if(!Array.isArray(i))return Tye.FAILURE.TYPE_INCORRECT(n,i);if(i.length!==r.length)return Tye.FAILURE.CONSTRAINT_FAILED(n,"Expected length ".concat(r.length,", but was ").concat(i.length));var s=(0,Tye.enumerableKeysOf)(i),a=s.map(function(c){return(0,Gli.innerValidate)(r[c],i[c],o)}),l=s.reduce(function(c,u){var d=a[u];return d.success||(c[u]=d.details||d.message),c},[]);return(0,Tye.enumerableKeysOf)(l).length!==0?Tye.FAILURE.CONTENT_INCORRECT(n,l):(0,Tye.SUCCESS)(i)},n)}Eht.Tuple=UJa});var Vli=I(zT=>{"use strict";var F3r=zT&&zT.__read||function(r,t){var n=typeof Symbol=="function"&&r[Symbol.iterator];if(!n)return r;var i=n.call(r),o,s=[],a;try{for(;(t===void 0||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(l){a={error:l}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return s},q3r=zT&&zT.__spreadArray||function(r,t,n){if(n||arguments.length===2)for(var i=0,o=t.length,s;i<o;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return r.concat(s||Array.prototype.slice.call(t))};Object.defineProperty(zT,"__esModule",{value:!0});zT.Partial=zT.Record=zT.InternalRecord=void 0;var Hli=MA(),Pv=tf();function PV(r,t,n){var i={tag:"record",isPartial:t,isReadonly:n,fields:r};return WJa((0,Hli.create)(function(o,s){if(o==null)return Pv.FAILURE.TYPE_INCORRECT(i,o);var a=(0,Pv.enumerableKeysOf)(r);if(a.length!==0&&typeof o!="object")return Pv.FAILURE.TYPE_INCORRECT(i,o);var l=q3r([],F3r(new Set(q3r(q3r([],F3r(a),!1),F3r((0,Pv.enumerableKeysOf)(o)),!1))),!1),c=l.reduce(function(d,p){var f=(0,Pv.hasKey)(p,r),A=(0,Pv.hasKey)(p,o);if(f){var h=r[p],y=t||h.reflect.tag==="optional";if(A){var C=o[p];y&&C===void 0?d[p]=(0,Pv.SUCCESS)(C):d[p]=(0,Hli.innerValidate)(h,C,s)}else y?d[p]=(0,Pv.SUCCESS)(void 0):d[p]=Pv.FAILURE.PROPERTY_MISSING(h.reflect)}else if(A){var C=o[p];d[p]=(0,Pv.SUCCESS)(C)}else throw new Error("impossible");return d},{}),u=l.reduce(function(d,p){var f=c[p];return f.success||(d[p]=f.details||f.message),d},{});return(0,Pv.enumerableKeysOf)(u).length!==0?Pv.FAILURE.CONTENT_INCORRECT(i,u):(0,Pv.SUCCESS)(o)},i))}zT.InternalRecord=PV;function jJa(r){return PV(r,!1,!1)}zT.Record=jJa;function GJa(r){return PV(r,!0,!1)}zT.Partial=GJa;function WJa(r){return r.asPartial=t,r.asReadonly=n,r.pick=i,r.omit=o,r.extend=s,r;function t(){return PV(r.fields,!0,r.isReadonly)}function n(){return PV(r.fields,r.isPartial,!0)}function i(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var c={};return a.forEach(function(u){c[u]=r.fields[u]}),PV(c,r.isPartial,r.isReadonly)}function o(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var c={},u=(0,Pv.enumerableKeysOf)(r.fields);return u.forEach(function(d){a.includes(d)||(c[d]=r.fields[d])}),PV(c,r.isPartial,r.isReadonly)}function s(a){return PV(Object.assign({},r.fields,a),r.isPartial,r.isReadonly)}}});var U3r=I(wye=>{"use strict";Object.defineProperty(wye,"__esModule",{value:!0});wye.Guard=wye.Constraint=void 0;var HJa=MA(),z3r=tf(),VJa=aht();function YJa(r,t,n){var i=n&&n.name,o=n&&n.args,s={tag:"constraint",underlying:r,constraint:t,name:i,args:o};return(0,HJa.create)(function(a){var l=r.validate(a);if(!l.success)return l;var c=t(l.value);return typeof c=="string"?z3r.FAILURE.CONSTRAINT_FAILED(s,c):c?(0,z3r.SUCCESS)(l.value):z3r.FAILURE.CONSTRAINT_FAILED(s)},s)}wye.Constraint=YJa;var KJa=function(r,t){return VJa.Unknown.withGuard(r,t)};wye.Guard=KJa});var Kli=I(bht=>{"use strict";Object.defineProperty(bht,"__esModule",{value:!0});bht.Dictionary=void 0;var Yli=MA(),j3r=L3r(),JJa=U3r(),XJa=rLe(),Wae=tf(),$Ja=(0,JJa.Constraint)(j3r.String,function(r){return!isNaN(+r)},{name:"number"});function ZJa(r,t){var n=t===void 0||t==="string"?j3r.String:t==="number"?$Ja:t,i=(0,XJa.default)(n),o={tag:"dictionary",key:i,value:r};return(0,Yli.create)(function(s,a){if(s==null||typeof s!="object"||Object.getPrototypeOf(s)!==Object.prototype&&(!Array.isArray(s)||i==="string"))return Wae.FAILURE.TYPE_INCORRECT(o,s);var l=/^(?:NaN|-?\d+(?:\.\d+)?)$/,c=(0,Wae.enumerableKeysOf)(s),u=c.reduce(function(p,f){var A=typeof f=="string"&&l.test(f),h=A?globalThis.Number(f):f;return(A?!n.guard(h)&&!n.guard(f):!n.guard(h))?p[f]=Wae.FAILURE.KEY_INCORRECT(o,n.reflect,h):p[f]=(0,Yli.innerValidate)(r,s[f],a),p},{}),d=c.reduce(function(p,f){var A=u[f];return A.success||(p[f]=A.details||A.message),p},{});return(0,Wae.enumerableKeysOf)(d).length!==0?Wae.FAILURE.CONTENT_INCORRECT(o,d):(0,Wae.SUCCESS)(s)},o)}bht.Dictionary=ZJa});var Xli=I(Rye=>{"use strict";var eXa=Rye&&Rye.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&r[t],i=0;if(n)return n.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Rye,"__esModule",{value:!0});Rye.Intersect=void 0;var Jli=MA(),tXa=tf();function rXa(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n={tag:"intersect",intersectees:r};return(0,Jli.create)(function(i,o){var s,a;try{for(var l=eXa(r),c=l.next();!c.done;c=l.next()){var u=c.value,d=(0,Jli.innerValidate)(u,i,o);if(!d.success)return d}}catch(p){s={error:p}}finally{try{c&&!c.done&&(a=l.return)&&a.call(l)}finally{if(s)throw s.error}}return(0,tXa.SUCCESS)(i)},n)}Rye.Intersect=rXa});var $li=I(Cht=>{"use strict";Object.defineProperty(Cht,"__esModule",{value:!0});Cht.Optional=void 0;var nXa=MA(),iXa=tf();function oXa(r){var t={tag:"optional",underlying:r};return(0,nXa.create)(function(n){return n===void 0?(0,iXa.SUCCESS)(n):r.validate(n)},t)}Cht.Optional=oXa});var tui=I(Iht=>{"use strict";Object.defineProperty(Iht,"__esModule",{value:!0});Iht.Function=void 0;var sXa=MA(),Zli=tf(),eui={tag:"function"};Iht.Function=(0,sXa.create)(function(r){return typeof r=="function"?(0,Zli.SUCCESS)(r):Zli.FAILURE.TYPE_INCORRECT(eui,r)},eui)});var nui=I(vht=>{"use strict";Object.defineProperty(vht,"__esModule",{value:!0});vht.InstanceOf=void 0;var aXa=MA(),rui=tf();function lXa(r){var t={tag:"instanceof",ctor:r};return(0,aXa.create)(function(n){return n instanceof r?(0,rui.SUCCESS)(n):rui.FAILURE.TYPE_INCORRECT(t,n)},t)}vht.InstanceOf=lXa});var iui=I(Sht=>{"use strict";Object.defineProperty(Sht,"__esModule",{value:!0});Sht.Lazy=void 0;var uXa=MA();function cXa(r){var t={get tag(){return i().tag}},n;function i(){if(!n){n=r();for(var o in n)o!=="tag"&&(t[o]=n[o])}return n}return(0,uXa.create)(function(o){return i().validate(o)},t)}Sht.Lazy=cXa});var oui=I(_ht=>{"use strict";Object.defineProperty(_ht,"__esModule",{value:!0});_ht.Brand=void 0;var dXa=MA();function pXa(r,t){var n={tag:"brand",brand:r,entity:t};return(0,dXa.create)(function(i){return t.validate(i)},n)}_ht.Brand=pXa});var sui=I(Bye=>{"use strict";Object.defineProperty(Bye,"__esModule",{value:!0});Bye.checked=Bye.check=void 0;var fXa=_ye(),AXa=tf(),G3r=new WeakMap;function hXa(r,t,n){var i=G3r.get(r)||new Map;G3r.set(r,i);var o=i.get(t)||[];i.set(t,o),o.push(n)}Bye.check=hXa;function gXa(r,t,n){var i=G3r.get(r),o=i&&i.get(t);if(o)return o;for(var s=[],a=0;a<n;a++)s.push(a);return s}function mXa(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(r.length===0)throw new Error("No runtype provided to `@checked`. Please remove the decorator.");return function(n,i,o){var s=o.value,a=(n.name||n.constructor.name+".prototype")+(typeof i=="string"?'["'.concat(i,'"]'):"[".concat(String(i),"]")),l=gXa(n,i,r.length);if(l.length!==r.length)throw new Error("Number of `@checked` runtypes and @check parameters not matched.");if(l.length>s.length)throw new Error("Number of `@checked` runtypes exceeds actual parameter length.");o.value=function(){for(var c=[],u=0;u<arguments.length;u++)c[u]=arguments[u];return r.forEach(function(d,p){var f=l[p],A=d.validate(c[f]);if(!A.success){var h="".concat(a,", argument #").concat(f,": ").concat(A.message),y=AXa.FAILURE.ARGUMENT_INCORRECT(h);throw new fXa.ValidationError(y)}}),s.apply(this,c)}}}Bye.checked=mXa});var f3=I(yl=>{"use strict";var yXa=yl&&yl.__createBinding||(Object.create?function(r,t,n,i){i===void 0&&(i=n),Object.defineProperty(r,i,{enumerable:!0,get:function(){return t[n]}})}:function(r,t,n,i){i===void 0&&(i=n),r[i]=t[n]}),ep=yl&&yl.__exportStar||function(r,t){for(var n in r)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&yXa(t,r,n)};Object.defineProperty(yl,"__esModule",{value:!0});yl.InstanceOf=yl.Nullish=yl.Null=yl.Undefined=yl.Literal=void 0;ep(uli(),yl);ep(T3r(),yl);ep(dli(),yl);ep(Ali(),yl);ep(hli(),yl);ep(_ye(),yl);ep(aht(),yl);ep(yli(),yl);ep(Eli(),yl);var Oht=D3r();Object.defineProperty(yl,"Literal",{enumerable:!0,get:function(){return Oht.Literal}});Object.defineProperty(yl,"Undefined",{enumerable:!0,get:function(){return Oht.Undefined}});Object.defineProperty(yl,"Null",{enumerable:!0,get:function(){return Oht.Null}});Object.defineProperty(yl,"Nullish",{enumerable:!0,get:function(){return Oht.Nullish}});ep(_li(),yl);ep(wli(),yl);ep(xli(),yl);ep(Nli(),yl);ep(L3r(),yl);ep(qli(),yl);ep(jli(),yl);ep(Wli(),yl);ep(Vli(),yl);ep(Kli(),yl);ep(B3r(),yl);ep(Xli(),yl);ep($li(),yl);ep(tui(),yl);var EXa=nui();Object.defineProperty(yl,"InstanceOf",{enumerable:!0,get:function(){return EXa.InstanceOf}});ep(iui(),yl);ep(U3r(),yl);ep(oui(),yl);ep(sui(),yl)});var uLe=I((ZTd,aui)=>{var bXa="2.0.0",CXa=Number.MAX_SAFE_INTEGER||9007199254740991,IXa=16,vXa=250,SXa=["major","premajor","minor","preminor","patch","prepatch","prerelease"];aui.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:IXa,MAX_SAFE_BUILD_LENGTH:vXa,MAX_SAFE_INTEGER:CXa,RELEASE_TYPES:SXa,SEMVER_SPEC_VERSION:bXa,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var cLe=I((ewd,lui)=>{var _Xa=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{};lui.exports=_Xa});var xye=I((Rq,uui)=>{var{MAX_SAFE_COMPONENT_LENGTH:W3r,MAX_SAFE_BUILD_LENGTH:OXa,MAX_LENGTH:TXa}=uLe(),wXa=cLe();Rq=uui.exports={};var RXa=Rq.re=[],BXa=Rq.safeRe=[],as=Rq.src=[],ls=Rq.t={},xXa=0,H3r="[a-zA-Z0-9-]",MXa=[["\\s",1],["\\d",TXa],[H3r,OXa]],DXa=r=>{for(let[t,n]of MXa)r=r.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return r},ou=(r,t,n)=>{let i=DXa(t),o=xXa++;wXa(r,o,t),ls[r]=o,as[o]=t,RXa[o]=new RegExp(t,n?"g":void 0),BXa[o]=new RegExp(i,n?"g":void 0)};ou("NUMERICIDENTIFIER","0|[1-9]\\d*");ou("NUMERICIDENTIFIERLOOSE","\\d+");ou("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${H3r}*`);ou("MAINVERSION",`(${as[ls.NUMERICIDENTIFIER]})\\.(${as[ls.NUMERICIDENTIFIER]})\\.(${as[ls.NUMERICIDENTIFIER]})`);ou("MAINVERSIONLOOSE",`(${as[ls.NUMERICIDENTIFIERLOOSE]})\\.(${as[ls.NUMERICIDENTIFIERLOOSE]})\\.(${as[ls.NUMERICIDENTIFIERLOOSE]})`);ou("PRERELEASEIDENTIFIER",`(?:${as[ls.NUMERICIDENTIFIER]}|${as[ls.NONNUMERICIDENTIFIER]})`);ou("PRERELEASEIDENTIFIERLOOSE",`(?:${as[ls.NUMERICIDENTIFIERLOOSE]}|${as[ls.NONNUMERICIDENTIFIER]})`);ou("PRERELEASE",`(?:-(${as[ls.PRERELEASEIDENTIFIER]}(?:\\.${as[ls.PRERELEASEIDENTIFIER]})*))`);ou("PRERELEASELOOSE",`(?:-?(${as[ls.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${as[ls.PRERELEASEIDENTIFIERLOOSE]})*))`);ou("BUILDIDENTIFIER",`${H3r}+`);ou("BUILD",`(?:\\+(${as[ls.BUILDIDENTIFIER]}(?:\\.${as[ls.BUILDIDENTIFIER]})*))`);ou("FULLPLAIN",`v?${as[ls.MAINVERSION]}${as[ls.PRERELEASE]}?${as[ls.BUILD]}?`);ou("FULL",`^${as[ls.FULLPLAIN]}$`);ou("LOOSEPLAIN",`[v=\\s]*${as[ls.MAINVERSIONLOOSE]}${as[ls.PRERELEASELOOSE]}?${as[ls.BUILD]}?`);ou("LOOSE",`^${as[ls.LOOSEPLAIN]}$`);ou("GTLT","((?:<|>)?=?)");ou("XRANGEIDENTIFIERLOOSE",`${as[ls.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);ou("XRANGEIDENTIFIER",`${as[ls.NUMERICIDENTIFIER]}|x|X|\\*`);ou("XRANGEPLAIN",`[v=\\s]*(${as[ls.XRANGEIDENTIFIER]})(?:\\.(${as[ls.XRANGEIDENTIFIER]})(?:\\.(${as[ls.XRANGEIDENTIFIER]})(?:${as[ls.PRERELEASE]})?${as[ls.BUILD]}?)?)?`);ou("XRANGEPLAINLOOSE",`[v=\\s]*(${as[ls.XRANGEIDENTIFIERLOOSE]})(?:\\.(${as[ls.XRANGEIDENTIFIERLOOSE]})(?:\\.(${as[ls.XRANGEIDENTIFIERLOOSE]})(?:${as[ls.PRERELEASELOOSE]})?${as[ls.BUILD]}?)?)?`);ou("XRANGE",`^${as[ls.GTLT]}\\s*${as[ls.XRANGEPLAIN]}$`);ou("XRANGELOOSE",`^${as[ls.GTLT]}\\s*${as[ls.XRANGEPLAINLOOSE]}$`);ou("COERCE",`(^|[^\\d])(\\d{1,${W3r}})(?:\\.(\\d{1,${W3r}}))?(?:\\.(\\d{1,${W3r}}))?(?:$|[^\\d])`);ou("COERCERTL",as[ls.COERCE],!0);ou("LONETILDE","(?:~>?)");ou("TILDETRIM",`(\\s*)${as[ls.LONETILDE]}\\s+`,!0);Rq.tildeTrimReplace="$1~";ou("TILDE",`^${as[ls.LONETILDE]}${as[ls.XRANGEPLAIN]}$`);ou("TILDELOOSE",`^${as[ls.LONETILDE]}${as[ls.XRANGEPLAINLOOSE]}$`);ou("LONECARET","(?:\\^)");ou("CARETTRIM",`(\\s*)${as[ls.LONECARET]}\\s+`,!0);Rq.caretTrimReplace="$1^";ou("CARET",`^${as[ls.LONECARET]}${as[ls.XRANGEPLAIN]}$`);ou("CARETLOOSE",`^${as[ls.LONECARET]}${as[ls.XRANGEPLAINLOOSE]}$`);ou("COMPARATORLOOSE",`^${as[ls.GTLT]}\\s*(${as[ls.LOOSEPLAIN]})$|^$`);ou("COMPARATOR",`^${as[ls.GTLT]}\\s*(${as[ls.FULLPLAIN]})$|^$`);ou("COMPARATORTRIM",`(\\s*)${as[ls.GTLT]}\\s*(${as[ls.LOOSEPLAIN]}|${as[ls.XRANGEPLAIN]})`,!0);Rq.comparatorTrimReplace="$1$2$3";ou("HYPHENRANGE",`^\\s*(${as[ls.XRANGEPLAIN]})\\s+-\\s+(${as[ls.XRANGEPLAIN]})\\s*$`);ou("HYPHENRANGELOOSE",`^\\s*(${as[ls.XRANGEPLAINLOOSE]})\\s+-\\s+(${as[ls.XRANGEPLAINLOOSE]})\\s*$`);ou("STAR","(<|>)?=?\\s*\\*");ou("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");ou("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Tht=I((twd,cui)=>{var NXa=Object.freeze({loose:!0}),PXa=Object.freeze({}),kXa=r=>r?typeof r!="object"?NXa:r:PXa;cui.exports=kXa});var V3r=I((rwd,fui)=>{var dui=/^[0-9]+$/,pui=(r,t)=>{let n=dui.test(r),i=dui.test(t);return n&&i&&(r=+r,t=+t),r===t?0:n&&!i?-1:i&&!n?1:r<t?-1:1},QXa=(r,t)=>pui(t,r);fui.exports={compareIdentifiers:pui,rcompareIdentifiers:QXa}});var VE=I((nwd,mui)=>{var wht=cLe(),{MAX_LENGTH:Aui,MAX_SAFE_INTEGER:Rht}=uLe(),{safeRe:hui,t:gui}=xye(),LXa=Tht(),{compareIdentifiers:Mye}=V3r(),Y3r=class r{constructor(t,n){if(n=LXa(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>Aui)throw new TypeError(`version is longer than ${Aui} characters`);wht("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;let i=t.trim().match(n.loose?hui[gui.LOOSE]:hui[gui.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>Rht||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Rht||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Rht||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<Rht)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(wht("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)),Mye(this.major,t.major)||Mye(this.minor,t.minor)||Mye(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(wht("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 Mye(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(wht("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 Mye(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]),Mye(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}};mui.exports=Y3r});var Hae=I((iwd,Eui)=>{var yui=VE(),FXa=(r,t,n=!1)=>{if(r instanceof yui)return r;try{return new yui(r,t)}catch(i){if(!n)return null;throw i}};Eui.exports=FXa});var Cui=I((owd,bui)=>{var qXa=Hae(),zXa=(r,t)=>{let n=qXa(r,t);return n?n.version:null};bui.exports=zXa});var vui=I((swd,Iui)=>{var UXa=Hae(),jXa=(r,t)=>{let n=UXa(r.trim().replace(/^[=v]+/,""),t);return n?n.version:null};Iui.exports=jXa});var Oui=I((awd,_ui)=>{var Sui=VE(),GXa=(r,t,n,i,o)=>{typeof n=="string"&&(o=i,i=n,n=void 0);try{return new Sui(r instanceof Sui?r.version:r,n).inc(t,i,o).version}catch{return null}};_ui.exports=GXa});var Rui=I((lwd,wui)=>{var Tui=Hae(),WXa=(r,t)=>{let n=Tui(r,null,!0),i=Tui(t,null,!0),o=n.compare(i);if(o===0)return null;let s=o>0,a=s?n:i,l=s?i:n,c=!!a.prerelease.length;if(!!l.prerelease.length&&!c)return!l.patch&&!l.minor?"major":a.patch?"patch":a.minor?"minor":"major";let d=c?"pre":"";return n.major!==i.major?d+"major":n.minor!==i.minor?d+"minor":n.patch!==i.patch?d+"patch":"prerelease"};wui.exports=WXa});var xui=I((uwd,Bui)=>{var HXa=VE(),VXa=(r,t)=>new HXa(r,t).major;Bui.exports=VXa});var Dui=I((cwd,Mui)=>{var YXa=VE(),KXa=(r,t)=>new YXa(r,t).minor;Mui.exports=KXa});var Pui=I((dwd,Nui)=>{var JXa=VE(),XXa=(r,t)=>new JXa(r,t).patch;Nui.exports=XXa});var Qui=I((pwd,kui)=>{var $Xa=Hae(),ZXa=(r,t)=>{let n=$Xa(r,t);return n&&n.prerelease.length?n.prerelease:null};kui.exports=ZXa});var UT=I((fwd,Fui)=>{var Lui=VE(),e$a=(r,t,n)=>new Lui(r,n).compare(new Lui(t,n));Fui.exports=e$a});var zui=I((Awd,qui)=>{var t$a=UT(),r$a=(r,t,n)=>t$a(t,r,n);qui.exports=r$a});var jui=I((hwd,Uui)=>{var n$a=UT(),i$a=(r,t)=>n$a(r,t,!0);Uui.exports=i$a});var Bht=I((gwd,Wui)=>{var Gui=VE(),o$a=(r,t,n)=>{let i=new Gui(r,n),o=new Gui(t,n);return i.compare(o)||i.compareBuild(o)};Wui.exports=o$a});var Vui=I((mwd,Hui)=>{var s$a=Bht(),a$a=(r,t)=>r.sort((n,i)=>s$a(n,i,t));Hui.exports=a$a});var Kui=I((ywd,Yui)=>{var l$a=Bht(),u$a=(r,t)=>r.sort((n,i)=>l$a(i,n,t));Yui.exports=u$a});var dLe=I((Ewd,Jui)=>{var c$a=UT(),d$a=(r,t,n)=>c$a(r,t,n)>0;Jui.exports=d$a});var xht=I((bwd,Xui)=>{var p$a=UT(),f$a=(r,t,n)=>p$a(r,t,n)<0;Xui.exports=f$a});var K3r=I((Cwd,$ui)=>{var A$a=UT(),h$a=(r,t,n)=>A$a(r,t,n)===0;$ui.exports=h$a});var J3r=I((Iwd,Zui)=>{var g$a=UT(),m$a=(r,t,n)=>g$a(r,t,n)!==0;Zui.exports=m$a});var Mht=I((vwd,eci)=>{var y$a=UT(),E$a=(r,t,n)=>y$a(r,t,n)>=0;eci.exports=E$a});var Dht=I((Swd,tci)=>{var b$a=UT(),C$a=(r,t,n)=>b$a(r,t,n)<=0;tci.exports=C$a});var X3r=I((_wd,rci)=>{var I$a=K3r(),v$a=J3r(),S$a=dLe(),_$a=Mht(),O$a=xht(),T$a=Dht(),w$a=(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 I$a(r,n,i);case"!=":return v$a(r,n,i);case">":return S$a(r,n,i);case">=":return _$a(r,n,i);case"<":return O$a(r,n,i);case"<=":return T$a(r,n,i);default:throw new TypeError(`Invalid operator: ${t}`)}};rci.exports=w$a});var ici=I((Owd,nci)=>{var R$a=VE(),B$a=Hae(),{safeRe:Nht,t:Pht}=xye(),x$a=(r,t)=>{if(r instanceof R$a)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(Nht[Pht.COERCE]);else{let i;for(;(i=Nht[Pht.COERCERTL].exec(r))&&(!n||n.index+n[0].length!==r.length);)(!n||i.index+i[0].length!==n.index+n[0].length)&&(n=i),Nht[Pht.COERCERTL].lastIndex=i.index+i[1].length+i[2].length;Nht[Pht.COERCERTL].lastIndex=-1}return n===null?null:B$a(`${n[2]}.${n[3]||"0"}.${n[4]||"0"}`,t)};nci.exports=x$a});var sci=I((Twd,oci)=>{"use strict";oci.exports=function(r){r.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}});var $3r=I((wwd,aci)=>{"use strict";aci.exports=l0;l0.Node=Vae;l0.create=l0;function l0(r){var t=this;if(t instanceof l0||(t=new l0),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}l0.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};l0.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++}};l0.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++}};l0.prototype.push=function(){for(var r=0,t=arguments.length;r<t;r++)D$a(this,arguments[r]);return this.length};l0.prototype.unshift=function(){for(var r=0,t=arguments.length;r<t;r++)N$a(this,arguments[r]);return this.length};l0.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}};l0.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}};l0.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};l0.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};l0.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};l0.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};l0.prototype.map=function(r,t){t=t||this;for(var n=new l0,i=this.head;i!==null;)n.push(r.call(t,i.value,this)),i=i.next;return n};l0.prototype.mapReverse=function(r,t){t=t||this;for(var n=new l0,i=this.tail;i!==null;)n.push(r.call(t,i.value,this)),i=i.prev;return n};l0.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};l0.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};l0.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};l0.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};l0.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 l0;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};l0.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 l0;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};l0.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=M$a(this,o,n[i]);return s};l0.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 M$a(r,t,n){var i=t===r.head?new Vae(n,null,t,r):new Vae(n,t,t.next,r);return i.next===null&&(r.tail=i),i.prev===null&&(r.head=i),r.length++,i}function D$a(r,t){r.tail=new Vae(t,r.tail,null,r),r.head||(r.head=r.tail),r.length++}function N$a(r,t){r.head=new Vae(t,null,r.head,r),r.tail||(r.tail=r.head),r.length++}function Vae(r,t,n,i){if(!(this instanceof Vae))return new Vae(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{sci()(l0)}catch{}});var Pye=I((Rwd,dci)=>{"use strict";var P$a=$3r(),Yae=Symbol("max"),xq=Symbol("length"),Dye=Symbol("lengthCalculator"),fLe=Symbol("allowStale"),Kae=Symbol("maxAge"),Bq=Symbol("dispose"),lci=Symbol("noDisposeOnSet"),B2=Symbol("lruList"),i8=Symbol("cache"),cci=Symbol("updateAgeOnGet"),Z3r=()=>1,tEr=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[Yae]=t.max||1/0,i=t.length||Z3r;if(this[Dye]=typeof i!="function"?Z3r:i,this[fLe]=t.stale||!1,t.maxAge&&typeof t.maxAge!="number")throw new TypeError("maxAge must be a number");this[Kae]=t.maxAge||0,this[Bq]=t.dispose,this[lci]=t.noDisposeOnSet||!1,this[cci]=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[Yae]=t||1/0,pLe(this)}get max(){return this[Yae]}set allowStale(t){this[fLe]=!!t}get allowStale(){return this[fLe]}set maxAge(t){if(typeof t!="number")throw new TypeError("maxAge must be a non-negative number");this[Kae]=t,pLe(this)}get maxAge(){return this[Kae]}set lengthCalculator(t){typeof t!="function"&&(t=Z3r),t!==this[Dye]&&(this[Dye]=t,this[xq]=0,this[B2].forEach(n=>{n.length=this[Dye](n.value,n.key),this[xq]+=n.length})),pLe(this)}get lengthCalculator(){return this[Dye]}get length(){return this[xq]}get itemCount(){return this[B2].length}rforEach(t,n){n=n||this;for(let i=this[B2].tail;i!==null;){let o=i.prev;uci(this,t,i,n),i=o}}forEach(t,n){n=n||this;for(let i=this[B2].head;i!==null;){let o=i.next;uci(this,t,i,n),i=o}}keys(){return this[B2].toArray().map(t=>t.key)}values(){return this[B2].toArray().map(t=>t.value)}reset(){this[Bq]&&this[B2]&&this[B2].length&&this[B2].forEach(t=>this[Bq](t.key,t.value)),this[i8]=new Map,this[B2]=new P$a,this[xq]=0}dump(){return this[B2].map(t=>kht(this,t)?!1:{k:t.key,v:t.value,e:t.now+(t.maxAge||0)}).toArray().filter(t=>t)}dumpLru(){return this[B2]}set(t,n,i){if(i=i||this[Kae],i&&typeof i!="number")throw new TypeError("maxAge must be a number");let o=i?Date.now():0,s=this[Dye](n,t);if(this[i8].has(t)){if(s>this[Yae])return Nye(this,this[i8].get(t)),!1;let c=this[i8].get(t).value;return this[Bq]&&(this[lci]||this[Bq](t,c.value)),c.now=o,c.maxAge=i,c.value=n,this[xq]+=s-c.length,c.length=s,this.get(t),pLe(this),!0}let a=new rEr(t,n,s,o,i);return a.length>this[Yae]?(this[Bq]&&this[Bq](t,n),!1):(this[xq]+=a.length,this[B2].unshift(a),this[i8].set(t,this[B2].head),pLe(this),!0)}has(t){if(!this[i8].has(t))return!1;let n=this[i8].get(t).value;return!kht(this,n)}get(t){return eEr(this,t,!0)}peek(t){return eEr(this,t,!1)}pop(){let t=this[B2].tail;return t?(Nye(this,t),t.value):null}del(t){Nye(this,this[i8].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[i8].forEach((t,n)=>eEr(this,n,!1))}},eEr=(r,t,n)=>{let i=r[i8].get(t);if(i){let o=i.value;if(kht(r,o)){if(Nye(r,i),!r[fLe])return}else n&&(r[cci]&&(i.value.now=Date.now()),r[B2].unshiftNode(i));return o.value}},kht=(r,t)=>{if(!t||!t.maxAge&&!r[Kae])return!1;let n=Date.now()-t.now;return t.maxAge?n>t.maxAge:r[Kae]&&n>r[Kae]},pLe=r=>{if(r[xq]>r[Yae])for(let t=r[B2].tail;r[xq]>r[Yae]&&t!==null;){let n=t.prev;Nye(r,t),t=n}},Nye=(r,t)=>{if(t){let n=t.value;r[Bq]&&r[Bq](n.key,n.value),r[xq]-=n.length,r[i8].delete(n.key),r[B2].removeNode(t)}},rEr=class{constructor(t,n,i,o,s){this.key=t,this.value=n,this.length=i,this.now=o,this.maxAge=s||0}},uci=(r,t,n,i)=>{let o=n.value;kht(r,o)&&(Nye(r,n),r[fLe]||(o=void 0)),o&&t.call(i,o.value,o.key,r)};dci.exports=tEr});var jT=I((Bwd,hci)=>{var nEr=class r{constructor(t,n){if(n=Q$a(n),t instanceof r)return t.loose===!!n.loose&&t.includePrerelease===!!n.includePrerelease?t:new r(t.raw,n);if(t instanceof iEr)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=>!fci(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&&G$a(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&&U$a)|(this.options.loose&&j$a))+":"+t,o=pci.get(i);if(o)return o;let s=this.options.loose,a=s?kv[kC.HYPHENRANGELOOSE]:kv[kC.HYPHENRANGE];t=t.replace(a,eZa(this.options.includePrerelease)),y1("hyphen replace",t),t=t.replace(kv[kC.COMPARATORTRIM],F$a),y1("comparator trim",t),t=t.replace(kv[kC.TILDETRIM],q$a),y1("tilde trim",t),t=t.replace(kv[kC.CARETTRIM],z$a),y1("caret trim",t);let l=t.split(" ").map(p=>W$a(p,this.options)).join(" ").split(/\s+/).map(p=>Z$a(p,this.options));s&&(l=l.filter(p=>(y1("loose invalid filter",p,this.options),!!p.match(kv[kC.COMPARATORLOOSE])))),y1("range list",l);let c=new Map,u=l.map(p=>new iEr(p,this.options));for(let p of u){if(fci(p))return[p];c.set(p.value,p)}c.size>1&&c.has("")&&c.delete("");let d=[...c.values()];return pci.set(i,d),d}intersects(t,n){if(!(t instanceof r))throw new TypeError("a Range is required");return this.set.some(i=>Aci(i,n)&&t.set.some(o=>Aci(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 L$a(t,this.options)}catch{return!1}for(let n=0;n<this.set.length;n++)if(tZa(this.set[n],t,this.options))return!0;return!1}};hci.exports=nEr;var k$a=Pye(),pci=new k$a({max:1e3}),Q$a=Tht(),iEr=ALe(),y1=cLe(),L$a=VE(),{safeRe:kv,t:kC,comparatorTrimReplace:F$a,tildeTrimReplace:q$a,caretTrimReplace:z$a}=xye(),{FLAG_INCLUDE_PRERELEASE:U$a,FLAG_LOOSE:j$a}=uLe(),fci=r=>r.value==="<0.0.0-0",G$a=r=>r.value==="",Aci=(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},W$a=(r,t)=>(y1("comp",r,t),r=Y$a(r,t),y1("caret",r),r=H$a(r,t),y1("tildes",r),r=J$a(r,t),y1("xrange",r),r=$$a(r,t),y1("stars",r),r),QC=r=>!r||r.toLowerCase()==="x"||r==="*",H$a=(r,t)=>r.trim().split(/\s+/).map(n=>V$a(n,t)).join(" "),V$a=(r,t)=>{let n=t.loose?kv[kC.TILDELOOSE]:kv[kC.TILDE];return r.replace(n,(i,o,s,a,l)=>{y1("tilde",r,i,o,s,a,l);let c;return QC(o)?c="":QC(s)?c=`>=${o}.0.0 <${+o+1}.0.0-0`:QC(a)?c=`>=${o}.${s}.0 <${o}.${+s+1}.0-0`:l?(y1("replaceTilde pr",l),c=`>=${o}.${s}.${a}-${l} <${o}.${+s+1}.0-0`):c=`>=${o}.${s}.${a} <${o}.${+s+1}.0-0`,y1("tilde return",c),c})},Y$a=(r,t)=>r.trim().split(/\s+/).map(n=>K$a(n,t)).join(" "),K$a=(r,t)=>{y1("caret",r,t);let n=t.loose?kv[kC.CARETLOOSE]:kv[kC.CARET],i=t.includePrerelease?"-0":"";return r.replace(n,(o,s,a,l,c)=>{y1("caret",r,o,s,a,l,c);let u;return QC(s)?u="":QC(a)?u=`>=${s}.0.0${i} <${+s+1}.0.0-0`:QC(l)?s==="0"?u=`>=${s}.${a}.0${i} <${s}.${+a+1}.0-0`:u=`>=${s}.${a}.0${i} <${+s+1}.0.0-0`:c?(y1("replaceCaret pr",c),s==="0"?a==="0"?u=`>=${s}.${a}.${l}-${c} <${s}.${a}.${+l+1}-0`:u=`>=${s}.${a}.${l}-${c} <${s}.${+a+1}.0-0`:u=`>=${s}.${a}.${l}-${c} <${+s+1}.0.0-0`):(y1("no pr"),s==="0"?a==="0"?u=`>=${s}.${a}.${l}${i} <${s}.${a}.${+l+1}-0`:u=`>=${s}.${a}.${l}${i} <${s}.${+a+1}.0-0`:u=`>=${s}.${a}.${l} <${+s+1}.0.0-0`),y1("caret return",u),u})},J$a=(r,t)=>(y1("replaceXRanges",r,t),r.split(/\s+/).map(n=>X$a(n,t)).join(" ")),X$a=(r,t)=>{r=r.trim();let n=t.loose?kv[kC.XRANGELOOSE]:kv[kC.XRANGE];return r.replace(n,(i,o,s,a,l,c)=>{y1("xRange",r,i,o,s,a,l,c);let u=QC(s),d=u||QC(a),p=d||QC(l),f=p;return o==="="&&f&&(o=""),c=t.includePrerelease?"-0":"",u?o===">"||o==="<"?i="<0.0.0-0":i="*":o&&f?(d&&(a=0),l=0,o===">"?(o=">=",d?(s=+s+1,a=0,l=0):(a=+a+1,l=0)):o==="<="&&(o="<",d?s=+s+1:a=+a+1),o==="<"&&(c="-0"),i=`${o+s}.${a}.${l}${c}`):d?i=`>=${s}.0.0${c} <${+s+1}.0.0-0`:p&&(i=`>=${s}.${a}.0${c} <${s}.${+a+1}.0-0`),y1("xRange return",i),i})},$$a=(r,t)=>(y1("replaceStars",r,t),r.trim().replace(kv[kC.STAR],"")),Z$a=(r,t)=>(y1("replaceGTE0",r,t),r.trim().replace(kv[t.includePrerelease?kC.GTE0PRE:kC.GTE0],"")),eZa=r=>(t,n,i,o,s,a,l,c,u,d,p,f,A)=>(QC(i)?n="":QC(o)?n=`>=${i}.0.0${r?"-0":""}`:QC(s)?n=`>=${i}.${o}.0${r?"-0":""}`:a?n=`>=${n}`:n=`>=${n}${r?"-0":""}`,QC(u)?c="":QC(d)?c=`<${+u+1}.0.0-0`:QC(p)?c=`<${u}.${+d+1}.0-0`:f?c=`<=${u}.${d}.${p}-${f}`:r?c=`<${u}.${d}.${+p+1}-0`:c=`<=${c}`,`${n} ${c}`.trim()),tZa=(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(y1(r[i].semver),r[i].semver!==iEr.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 ALe=I((xwd,Cci)=>{var hLe=Symbol("SemVer ANY"),aEr=class r{static get ANY(){return hLe}constructor(t,n){if(n=gci(n),t instanceof r){if(t.loose===!!n.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),sEr("comparator",t,n),this.options=n,this.loose=!!n.loose,this.parse(t),this.semver===hLe?this.value="":this.value=this.operator+this.semver.version,sEr("comp",this)}parse(t){let n=this.options.loose?mci[yci.COMPARATORLOOSE]:mci[yci.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 Eci(i[2],this.options.loose):this.semver=hLe}toString(){return this.value}test(t){if(sEr("Comparator.test",t,this.options.loose),this.semver===hLe||t===hLe)return!0;if(typeof t=="string")try{t=new Eci(t,this.options)}catch{return!1}return oEr(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 bci(t.value,n).test(this.value):t.operator===""?t.value===""?!0:new bci(this.value,n).test(t.semver):(n=gci(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("=")||oEr(this.semver,"<",t.semver,n)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||oEr(this.semver,">",t.semver,n)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};Cci.exports=aEr;var gci=Tht(),{safeRe:mci,t:yci}=xye(),oEr=X3r(),sEr=cLe(),Eci=VE(),bci=jT()});var gLe=I((Mwd,Ici)=>{var rZa=jT(),nZa=(r,t,n)=>{try{t=new rZa(t,n)}catch{return!1}return t.test(r)};Ici.exports=nZa});var Sci=I((Dwd,vci)=>{var iZa=jT(),oZa=(r,t)=>new iZa(r,t).set.map(n=>n.map(i=>i.value).join(" ").trim().split(" "));vci.exports=oZa});var Oci=I((Nwd,_ci)=>{var sZa=VE(),aZa=jT(),lZa=(r,t,n)=>{let i=null,o=null,s=null;try{s=new aZa(t,n)}catch{return null}return r.forEach(a=>{s.test(a)&&(!i||o.compare(a)===-1)&&(i=a,o=new sZa(i,n))}),i};_ci.exports=lZa});var wci=I((Pwd,Tci)=>{var uZa=VE(),cZa=jT(),dZa=(r,t,n)=>{let i=null,o=null,s=null;try{s=new cZa(t,n)}catch{return null}return r.forEach(a=>{s.test(a)&&(!i||o.compare(a)===1)&&(i=a,o=new uZa(i,n))}),i};Tci.exports=dZa});var xci=I((kwd,Bci)=>{var lEr=VE(),pZa=jT(),Rci=dLe(),fZa=(r,t)=>{r=new pZa(r,t);let n=new lEr("0.0.0");if(r.test(n)||(n=new lEr("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 l=new lEr(a.semver.version);switch(a.operator){case">":l.prerelease.length===0?l.patch++:l.prerelease.push(0),l.raw=l.format();case"":case">=":(!s||Rci(l,s))&&(s=l);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),s&&(!n||Rci(n,s))&&(n=s)}return n&&r.test(n)?n:null};Bci.exports=fZa});var Dci=I((Qwd,Mci)=>{var AZa=jT(),hZa=(r,t)=>{try{return new AZa(r,t).range||"*"}catch{return null}};Mci.exports=hZa});var Qht=I((Lwd,Qci)=>{var gZa=VE(),kci=ALe(),{ANY:mZa}=kci,yZa=jT(),EZa=gLe(),Nci=dLe(),Pci=xht(),bZa=Dht(),CZa=Mht(),IZa=(r,t,n,i)=>{r=new gZa(r,i),t=new yZa(t,i);let o,s,a,l,c;switch(n){case">":o=Nci,s=bZa,a=Pci,l=">",c=">=";break;case"<":o=Pci,s=CZa,a=Nci,l="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(EZa(r,t,i))return!1;for(let u=0;u<t.set.length;++u){let d=t.set[u],p=null,f=null;if(d.forEach(A=>{A.semver===mZa&&(A=new kci(">=0.0.0")),p=p||A,f=f||A,o(A.semver,p.semver,i)?p=A:a(A.semver,f.semver,i)&&(f=A)}),p.operator===l||p.operator===c||(!f.operator||f.operator===l)&&s(r,f.semver))return!1;if(f.operator===c&&a(r,f.semver))return!1}return!0};Qci.exports=IZa});var Fci=I((Fwd,Lci)=>{var vZa=Qht(),SZa=(r,t,n)=>vZa(r,t,">",n);Lci.exports=SZa});var zci=I((qwd,qci)=>{var _Za=Qht(),OZa=(r,t,n)=>_Za(r,t,"<",n);qci.exports=OZa});var Gci=I((zwd,jci)=>{var Uci=jT(),TZa=(r,t,n)=>(r=new Uci(r,n),t=new Uci(t,n),r.intersects(t,n));jci.exports=TZa});var Hci=I((Uwd,Wci)=>{var wZa=gLe(),RZa=UT();Wci.exports=(r,t,n)=>{let i=[],o=null,s=null,a=r.sort((d,p)=>RZa(d,p,n));for(let d of a)wZa(d,t,n)?(s=d,o||(o=d)):(s&&i.push([o,s]),s=null,o=null);o&&i.push([o,null]);let l=[];for(let[d,p]of i)d===p?l.push(d):!p&&d===a[0]?l.push("*"):p?d===a[0]?l.push(`<=${p}`):l.push(`${d} - ${p}`):l.push(`>=${d}`);let c=l.join(" || "),u=typeof t.raw=="string"?t.raw:String(t);return c.length<u.length?c:t}});var $ci=I((jwd,Xci)=>{var Vci=jT(),cEr=ALe(),{ANY:uEr}=cEr,mLe=gLe(),dEr=UT(),BZa=(r,t,n={})=>{if(r===t)return!0;r=new Vci(r,n),t=new Vci(t,n);let i=!1;e:for(let o of r.set){for(let s of t.set){let a=MZa(o,s,n);if(i=i||a!==null,a)continue e}if(i)return!1}return!0},xZa=[new cEr(">=0.0.0-0")],Yci=[new cEr(">=0.0.0")],MZa=(r,t,n)=>{if(r===t)return!0;if(r.length===1&&r[0].semver===uEr){if(t.length===1&&t[0].semver===uEr)return!0;n.includePrerelease?r=xZa:r=Yci}if(t.length===1&&t[0].semver===uEr){if(n.includePrerelease)return!0;t=Yci}let i=new Set,o,s;for(let A of r)A.operator===">"||A.operator===">="?o=Kci(o,A,n):A.operator==="<"||A.operator==="<="?s=Jci(s,A,n):i.add(A.semver);if(i.size>1)return null;let a;if(o&&s){if(a=dEr(o.semver,s.semver,n),a>0)return null;if(a===0&&(o.operator!==">="||s.operator!=="<="))return null}for(let A of i){if(o&&!mLe(A,String(o),n)||s&&!mLe(A,String(s),n))return null;for(let h of t)if(!mLe(A,String(h),n))return!1;return!0}let l,c,u,d,p=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1,f=o&&!n.includePrerelease&&o.semver.prerelease.length?o.semver:!1;p&&p.prerelease.length===1&&s.operator==="<"&&p.prerelease[0]===0&&(p=!1);for(let A of t){if(d=d||A.operator===">"||A.operator===">=",u=u||A.operator==="<"||A.operator==="<=",o){if(f&&A.semver.prerelease&&A.semver.prerelease.length&&A.semver.major===f.major&&A.semver.minor===f.minor&&A.semver.patch===f.patch&&(f=!1),A.operator===">"||A.operator===">="){if(l=Kci(o,A,n),l===A&&l!==o)return!1}else if(o.operator===">="&&!mLe(o.semver,String(A),n))return!1}if(s){if(p&&A.semver.prerelease&&A.semver.prerelease.length&&A.semver.major===p.major&&A.semver.minor===p.minor&&A.semver.patch===p.patch&&(p=!1),A.operator==="<"||A.operator==="<="){if(c=Jci(s,A,n),c===A&&c!==s)return!1}else if(s.operator==="<="&&!mLe(s.semver,String(A),n))return!1}if(!A.operator&&(s||o)&&a!==0)return!1}return!(o&&u&&!s&&a!==0||s&&d&&!o&&a!==0||f||p)},Kci=(r,t,n)=>{if(!r)return t;let i=dEr(r.semver,t.semver,n);return i>0?r:i<0||t.operator===">"&&r.operator===">="?t:r},Jci=(r,t,n)=>{if(!r)return t;let i=dEr(r.semver,t.semver,n);return i<0?r:i>0||t.operator==="<"&&r.operator==="<="?t:r};Xci.exports=BZa});var kye=I((Gwd,t0i)=>{var pEr=xye(),Zci=uLe(),DZa=VE(),e0i=V3r(),NZa=Hae(),PZa=Cui(),kZa=vui(),QZa=Oui(),LZa=Rui(),FZa=xui(),qZa=Dui(),zZa=Pui(),UZa=Qui(),jZa=UT(),GZa=zui(),WZa=jui(),HZa=Bht(),VZa=Vui(),YZa=Kui(),KZa=dLe(),JZa=xht(),XZa=K3r(),$Za=J3r(),ZZa=Mht(),eel=Dht(),tel=X3r(),rel=ici(),nel=ALe(),iel=jT(),oel=gLe(),sel=Sci(),ael=Oci(),lel=wci(),uel=xci(),cel=Dci(),del=Qht(),pel=Fci(),fel=zci(),Ael=Gci(),hel=Hci(),gel=$ci();t0i.exports={parse:NZa,valid:PZa,clean:kZa,inc:QZa,diff:LZa,major:FZa,minor:qZa,patch:zZa,prerelease:UZa,compare:jZa,rcompare:GZa,compareLoose:WZa,compareBuild:HZa,sort:VZa,rsort:YZa,gt:KZa,lt:JZa,eq:XZa,neq:$Za,gte:ZZa,lte:eel,cmp:tel,coerce:rel,Comparator:nel,Range:iel,satisfies:oel,toComparators:sel,maxSatisfying:ael,minSatisfying:lel,minVersion:uel,validRange:cel,outside:del,gtr:pel,ltr:fel,intersects:Ael,simplifyRange:hel,subset:gel,SemVer:DZa,re:pEr.re,src:pEr.src,tokens:pEr.t,SEMVER_SPEC_VERSION:Zci.SEMVER_SPEC_VERSION,RELEASE_TYPES:Zci.RELEASE_TYPES,compareIdentifiers:e0i.compareIdentifiers,rcompareIdentifiers:e0i.rcompareIdentifiers}});var yLe,mel,Wwd,yel,LC,kV=et(()=>{"use strict";yLe=Ct(f3()),mel=Ct(kye()),Wwd=(0,yLe.Record)({version:yLe.String,hash:yLe.String}),yel=()=>({version:"7.17.0-rc.1",hash:"2b48d3f242674b40ab02d90d7f530e7552fa0aec"}),LC=yel()});var M_,r0i,ELe,Lht=et(()=>{"use strict";kV();r0i=r=>{M_=r},ELe=r=>({coalesceSoftwareVersion:LC?.version||"",service:r,env:process.env.REACT_APP_OWNER??"",reactAppCoalesceDev:process.env.REACT_APP_COALESCE_DEV??""})});var n0i,i0i,D_,fEr,o0i,s0i,a0i,bLe,AEr,Fht,bel,hEr,Qye,CLe,qht,gEr,l0i,Lye=et(()=>{"use strict";n0i=Ct(MF()),i0i=Ct(Wlt()),D_=Ct(ise());jae();rht();Lht();jl();n8();vr();fEr=null,o0i=r=>{fEr=r},s0i={emerg:"error",assert:"warn",alert:"warn",error:"warn",warn:"warn",app:"info",info:"info",debug:"debug"},a0i={emerg:"emerg",assert:"alert",alert:"alert",error:"error",app:"info",info:"info",warn:"warn",debug:"debug"},bLe=class extends n0i.default{baseContext;constructor(t){super(t),this.baseContext=ELe(M_)}log(t,n){fEr&&fEr.log({...t,level:a0i[t.level]},{...this.baseContext,...p3},s0i[t.level]),n()}},Fht=r=>{let t=ELe(r);AEr={host:"http-intake.logs.datadoghq.com",path:`/v1/input/pub04bd017317b60c96b62874179d82ff97?ddtags=env:${t.env},coalesceSoftwareVersion:${t.coalesceSoftwareVersion}&ddsource=nodejs&service=${r}`,ssl:!0}},bel=!1,hEr=()=>D_.format.combine(D_.format.timestamp(),D_.format.colorize({colors:tht.COLORS}),D_.format.printf(r=>`|${r.timestamp}|${process.env.JEST_WORKER_ID?`[SHARD:${process.env.JEST_WORKER_ID}]`:""}[${r.loggingArea}]${r.orgID?`|(org:${r.orgID})`:""}${r.workspaceID?`|(env:${r.workspaceID})`:""}${r.userID?`|(user:${r.userID})`:""}${r.runID?`|run:${r.runID})`:""}(${r.nodeID?`|(node:${r.nodeID})`:""})|)|${r.level}:${r.message}`)),Qye=r=>new D_.transports.Console({format:process.env.CONSOLE_JSON_LOGS?D_.format.combine(D_.format.timestamp(),D_.format.json()):hEr(),level:r.level,silent:bel}),CLe=class extends i0i.Http{running=0;rejectLogCalls=!1;constructor(){let t={batch:!1,...AEr,format:D_.format.combine(hEr(),D_.format.uncolorize())};super(t),this.on("logged",()=>{this.running-=1}),this.on("warn",()=>{this.running-=1})}log(t,n){if(this.rejectLogCalls)return;let i={...t,level:a0i[t.level],status:s0i[t.level]};this.running+=1,super.log?.(i,n)}async closeAndWait(t){this.rejectLogCalls=!0;let n=async()=>{let i=t>5e3?500:t/100,o=0;for(;o++*i<t;){if(this.running===0)return;await new Promise(s=>setTimeout(s,i))}if(this.running!==0)throw new At("should not be reachable")};this.close&&this.close(),await R2(t,"Close took too long",n())}},qht=()=>new CLe,gEr=()=>new D_.transports.File({filename:process.env.JEST_WORKER_ID?`test-shard-${process.env.JEST_WORKER_ID}.log`:"test.log",dirname:"./test-logs",format:hEr(),level:eht.debug}),l0i=r=>{let t=[];return t.push(Qye(r)),AEr&&t.push(qht()),wu().isTest&&t.push(gEr()),[new bLe,...t]}});var u0i,mEr,yEr,Cel,Iel,ILe,EEr=et(()=>{"use strict";u0i=Ct(ise());Lht();jae();tLe();Lye();jl();mEr=r=>r.includes("production")?"production":r.includes("staging")?"staging":r.includes("qa")?"qa":"development",yEr=()=>{if(d1()){let r=process.env.RUNTIME_ENVIRONMENT||"development";return yzn("coa")?BB()?mEr(r):void 0:mEr(r)}else{let r;try{r=self.ENVIRONMENT}catch{}return typeof r=="string"?mEr(r):void 0}},Cel=()=>{let r=wu();if(r.isTest)return{};let t=yEr();return r.isNode?{firebaseEnv:t}:{windowInfo:{frontendURLHost:self.location.host},firebaseEnv:t}},Iel=r=>{let t=ELe(M_);return{appEnv:Cel(),loggingArea:r,...t}},ILe=r=>{let t=B_[r];if(!t)throw new Error(`Logging area "${r}" is not a valid LoggingAreas key`);return t.logger||(t.logger=u0i.createLogger({levels:tht.LEVELS,defaultMeta:Iel(r),level:t.level,transports:l0i(t)})),t.logger}});var c0i,zht,Uht,bEr,jht,Mq,d0i=et(()=>{"use strict";c0i=Ct(is()),zht=Ct(ise());tLe();Lye();jl();EEr();jae();Ag();Uht=(r,t)=>{let n=r.toUpperCase(),i=[];if(n in B_||i.push(`invalid logging area '${n}'`),eht[t]||i.push("`invalid log level '${logLevel}'`"),i.length)throw i.forEach(l=>{console.error(l)}),new Error("Invalid logging area or log level: "+i.join(", "));let o=ILe(n),s=o.transports.filter(l=>l instanceof zht.transports.Console),a=o.transports;s.length||(a=[...a,Qye(B_[n])]),a.filter(l=>l instanceof zht.transports.Console)[0].level=t,o.configure({...o,transports:o.transports})},bEr=()=>{Object.keys(B_).forEach(r=>{Uht(r,"debug")})},jht=(r,t)=>{for(let n in r){let i=n,o=ILe(i);r[i].defaultMeta={...o.defaultMeta,...r[i].defaultMeta,...t};let s=r[i].transports||o.transports,a;if(wu().isTest&&s.length>0){let l=s[s.length-1];l instanceof zht.transports.File&&(a=l,s=o.transports.slice(0,-1),s.push(gEr()))}o.configure({...o,...r[i],transports:s,level:r[i].level||o.level}),a&&a.close&&a.close()}},Mq=r=>{let t=c0i.default.mapValues(B_,(n,i)=>({}));jht(t,r)}});function vLe(r,t){return function(){return r.apply(t,arguments)}}var CEr=et(()=>{"use strict"});function Sel(r){return r!==null&&!SLe(r)&&r.constructor!==null&&!SLe(r.constructor)&&N_(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}function _el(r){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(r):t=r&&r.buffer&&A0i(r.buffer),t}function _Le(r,t,{allOwnKeys:n=!1}={}){if(r===null||typeof r>"u")return;let i,o;if(typeof r!="object"&&(r=[r]),Fye(r))for(i=0,o=r.length;i<o;i++)t.call(null,r[i],i,r);else{let s=n?Object.getOwnPropertyNames(r):Object.keys(r),a=s.length,l;for(i=0;i<a;i++)l=s[i],t.call(null,r[l],l,r)}}function g0i(r,t){t=t.toLowerCase();let n=Object.keys(r),i=n.length,o;for(;i-- >0;)if(o=n[i],t===o.toLowerCase())return o;return null}function vEr(){let{caseless:r}=m0i(this)&&this||{},t={},n=(i,o)=>{let s=r&&g0i(t,o)||o;Ght(t[s])&&Ght(i)?t[s]=vEr(t[s],i):Ght(i)?t[s]=vEr({},i):Fye(i)?t[s]=i.slice():t[s]=i};for(let i=0,o=arguments.length;i<o;i++)arguments[i]&&_Le(arguments[i],n);return t}function ntl(r){return!!(r&&N_(r.append)&&r[Symbol.toStringTag]==="FormData"&&r[Symbol.iterator])}var vel,SEr,Wht,o8,Hht,Fye,SLe,A0i,Oel,N_,h0i,Vht,Tel,Ght,wel,Rel,Bel,xel,Mel,Del,Nel,Pel,kel,Qel,Lel,Fel,Jae,m0i,qel,zel,Uel,jel,Gel,Wel,Hel,Vel,Yel,Kel,Jel,p0i,Xel,y0i,$el,Zel,etl,ttl,IEr,f0i,E0i,rtl,itl,otl,stl,b0i,atl,er,Bd=et(()=>{"use strict";CEr();({toString:vel}=Object.prototype),{getPrototypeOf:SEr}=Object,Wht=(r=>t=>{let n=vel.call(t);return r[n]||(r[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),o8=r=>(r=r.toLowerCase(),t=>Wht(t)===r),Hht=r=>t=>typeof t===r,{isArray:Fye}=Array,SLe=Hht("undefined");A0i=o8("ArrayBuffer");Oel=Hht("string"),N_=Hht("function"),h0i=Hht("number"),Vht=r=>r!==null&&typeof r=="object",Tel=r=>r===!0||r===!1,Ght=r=>{if(Wht(r)!=="object")return!1;let t=SEr(r);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)},wel=o8("Date"),Rel=o8("File"),Bel=o8("Blob"),xel=o8("FileList"),Mel=r=>Vht(r)&&N_(r.pipe),Del=r=>{let t;return r&&(typeof FormData=="function"&&r instanceof FormData||N_(r.append)&&((t=Wht(r))==="formdata"||t==="object"&&N_(r.toString)&&r.toString()==="[object FormData]"))},Nel=o8("URLSearchParams"),[Pel,kel,Qel,Lel]=["ReadableStream","Request","Response","Headers"].map(o8),Fel=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");Jae=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,m0i=r=>!SLe(r)&&r!==Jae;qel=(r,t,n,{allOwnKeys:i}={})=>(_Le(t,(o,s)=>{n&&N_(o)?r[s]=vLe(o,n):r[s]=o},{allOwnKeys:i}),r),zel=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),Uel=(r,t,n,i)=>{r.prototype=Object.create(t.prototype,i),r.prototype.constructor=r,Object.defineProperty(r,"super",{value:t.prototype}),n&&Object.assign(r.prototype,n)},jel=(r,t,n,i)=>{let o,s,a,l={};if(t=t||{},r==null)return t;do{for(o=Object.getOwnPropertyNames(r),s=o.length;s-- >0;)a=o[s],(!i||i(a,r,t))&&!l[a]&&(t[a]=r[a],l[a]=!0);r=n!==!1&&SEr(r)}while(r&&(!n||n(r,t))&&r!==Object.prototype);return t},Gel=(r,t,n)=>{r=String(r),(n===void 0||n>r.length)&&(n=r.length),n-=t.length;let i=r.indexOf(t,n);return i!==-1&&i===n},Wel=r=>{if(!r)return null;if(Fye(r))return r;let t=r.length;if(!h0i(t))return null;let n=new Array(t);for(;t-- >0;)n[t]=r[t];return n},Hel=(r=>t=>r&&t instanceof r)(typeof Uint8Array<"u"&&SEr(Uint8Array)),Vel=(r,t)=>{let i=(r&&r[Symbol.iterator]).call(r),o;for(;(o=i.next())&&!o.done;){let s=o.value;t.call(r,s[0],s[1])}},Yel=(r,t)=>{let n,i=[];for(;(n=r.exec(t))!==null;)i.push(n);return i},Kel=o8("HTMLFormElement"),Jel=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,i,o){return i.toUpperCase()+o}),p0i=(({hasOwnProperty:r})=>(t,n)=>r.call(t,n))(Object.prototype),Xel=o8("RegExp"),y0i=(r,t)=>{let n=Object.getOwnPropertyDescriptors(r),i={};_Le(n,(o,s)=>{let a;(a=t(o,s,r))!==!1&&(i[s]=a||o)}),Object.defineProperties(r,i)},$el=r=>{y0i(r,(t,n)=>{if(N_(r)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;let i=r[n];if(N_(i)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Zel=(r,t)=>{let n={},i=o=>{o.forEach(s=>{n[s]=!0})};return Fye(r)?i(r):i(String(r).split(t)),n},etl=()=>{},ttl=(r,t)=>r!=null&&Number.isFinite(r=+r)?r:t,IEr="abcdefghijklmnopqrstuvwxyz",f0i="0123456789",E0i={DIGIT:f0i,ALPHA:IEr,ALPHA_DIGIT:IEr+IEr.toUpperCase()+f0i},rtl=(r=16,t=E0i.ALPHA_DIGIT)=>{let n="",{length:i}=t;for(;r--;)n+=t[Math.random()*i|0];return n};itl=r=>{let t=new Array(10),n=(i,o)=>{if(Vht(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[o]=i;let s=Fye(i)?[]:{};return _Le(i,(a,l)=>{let c=n(a,o+1);!SLe(c)&&(s[l]=c)}),t[o]=void 0,s}}return i};return n(r,0)},otl=o8("AsyncFunction"),stl=r=>r&&(Vht(r)||N_(r))&&N_(r.then)&&N_(r.catch),b0i=((r,t)=>r?setImmediate:t?((n,i)=>(Jae.addEventListener("message",({source:o,data:s})=>{o===Jae&&s===n&&i.length&&i.shift()()},!1),o=>{i.push(o),Jae.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",N_(Jae.postMessage)),atl=typeof queueMicrotask<"u"?queueMicrotask.bind(Jae):typeof process<"u"&&process.nextTick||b0i,er={isArray:Fye,isArrayBuffer:A0i,isBuffer:Sel,isFormData:Del,isArrayBufferView:_el,isString:Oel,isNumber:h0i,isBoolean:Tel,isObject:Vht,isPlainObject:Ght,isReadableStream:Pel,isRequest:kel,isResponse:Qel,isHeaders:Lel,isUndefined:SLe,isDate:wel,isFile:Rel,isBlob:Bel,isRegExp:Xel,isFunction:N_,isStream:Mel,isURLSearchParams:Nel,isTypedArray:Hel,isFileList:xel,forEach:_Le,merge:vEr,extend:qel,trim:Fel,stripBOM:zel,inherits:Uel,toFlatObject:jel,kindOf:Wht,kindOfTest:o8,endsWith:Gel,toArray:Wel,forEachEntry:Vel,matchAll:Yel,isHTMLForm:Kel,hasOwnProperty:p0i,hasOwnProp:p0i,reduceDescriptors:y0i,freezeMethods:$el,toObjectSet:Zel,toCamelCase:Jel,noop:etl,toFiniteNumber:ttl,findKey:g0i,global:Jae,isContextDefined:m0i,ALPHABET:E0i,generateString:rtl,isSpecCompliantForm:ntl,toJSONObject:itl,isAsyncFn:otl,isThenable:stl,setImmediate:b0i,asap:atl}});function qye(r,t,n,i,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=r,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),i&&(this.request=i),o&&(this.response=o,this.status=o.status?o.status:null)}var C0i,I0i,so,P_=et(()=>{"use strict";Bd();er.inherits(qye,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:er.toJSONObject(this.config),code:this.code,status:this.status}}});C0i=qye.prototype,I0i={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(r=>{I0i[r]={value:r}});Object.defineProperties(qye,I0i);Object.defineProperty(C0i,"isAxiosError",{value:!0});qye.from=(r,t,n,i,o,s)=>{let a=Object.create(C0i);return er.toFlatObject(r,a,function(c){return c!==Error.prototype},l=>l!=="isAxiosError"),qye.call(a,r.message,t,n,i,o),a.cause=r,a.name=r.name,s&&Object.assign(a,s),a};so=qye});var v0i,Yht,_Er=et(()=>{v0i=Ct(ENe(),1),Yht=v0i.default});function OEr(r){return er.isPlainObject(r)||er.isArray(r)}function _0i(r){return er.endsWith(r,"[]")?r.slice(0,-2):r}function S0i(r,t,n){return r?r.concat(t).map(function(o,s){return o=_0i(o),!n&&s?"["+o+"]":o}).join(n?".":""):t}function ltl(r){return er.isArray(r)&&!r.some(OEr)}function ctl(r,t,n){if(!er.isObject(r))throw new TypeError("target must be an object");t=t||new(Yht||FormData),n=er.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,C){return!er.isUndefined(C[y])});let i=n.metaTokens,o=n.visitor||d,s=n.dots,a=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&er.isSpecCompliantForm(t);if(!er.isFunction(o))throw new TypeError("visitor must be a function");function u(h){if(h===null)return"";if(er.isDate(h))return h.toISOString();if(!c&&er.isBlob(h))throw new so("Blob is not supported. Use a Buffer instead.");return er.isArrayBuffer(h)||er.isTypedArray(h)?c&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function d(h,y,C){let v=h;if(h&&!C&&typeof h=="object"){if(er.endsWith(y,"{}"))y=i?y:y.slice(0,-2),h=JSON.stringify(h);else if(er.isArray(h)&&ltl(h)||(er.isFileList(h)||er.endsWith(y,"[]"))&&(v=er.toArray(h)))return y=_0i(y),v.forEach(function(w,R){!(er.isUndefined(w)||w===null)&&t.append(a===!0?S0i([y],R,s):a===null?y:y+"[]",u(w))}),!1}return OEr(h)?!0:(t.append(S0i(C,y,s),u(h)),!1)}let p=[],f=Object.assign(utl,{defaultVisitor:d,convertValue:u,isVisitable:OEr});function A(h,y){if(!er.isUndefined(h)){if(p.indexOf(h)!==-1)throw Error("Circular reference detected in "+y.join("."));p.push(h),er.forEach(h,function(v,O){(!(er.isUndefined(v)||v===null)&&o.call(t,v,er.isString(O)?O.trim():O,y,f))===!0&&A(v,y?y.concat(O):[O])}),p.pop()}}if(!er.isObject(r))throw new TypeError("data must be an object");return A(r),t}var utl,QV,OLe=et(()=>{"use strict";Bd();P_();_Er();utl=er.toFlatObject(er,{},null,function(t){return/^is[A-Z]/.test(t)});QV=ctl});function O0i(r){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function T0i(r,t){this._pairs=[],r&&QV(r,this,t)}var w0i,R0i,B0i=et(()=>{"use strict";OLe();w0i=T0i.prototype;w0i.append=function(t,n){this._pairs.push([t,n])};w0i.toString=function(t){let n=t?function(i){return t.call(this,i,O0i)}:O0i;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};R0i=T0i});function dtl(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Xae(r,t,n){if(!t)return r;let i=n&&n.encode||dtl,o=n&&n.serialize,s;if(o?s=o(t,n):s=er.isURLSearchParams(t)?t.toString():new R0i(t,n).toString(i),s){let a=r.indexOf("#");a!==-1&&(r=r.slice(0,a)),r+=(r.indexOf("?")===-1?"?":"&")+s}return r}var Kht=et(()=>{"use strict";Bd();B0i()});var TEr,wEr,x0i=et(()=>{"use strict";Bd();TEr=class{constructor(){this.handlers=[]}use(t,n,i){return this.handlers.push({fulfilled:t,rejected:n,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){er.forEach(this.handlers,function(i){i!==null&&t(i)})}},wEr=TEr});var zye,Jht=et(()=>{"use strict";zye={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}});var M0i,D0i,N0i=et(()=>{"use strict";M0i=Ct(require("url"),1),D0i=M0i.default.URLSearchParams});var P0i,k0i=et(()=>{N0i();_Er();P0i={isNode:!0,classes:{URLSearchParams:D0i,FormData:Yht,Blob:typeof Blob<"u"&&Blob||null},protocols:["http","https","file","data"]}});var xEr={};ZS(xEr,{hasBrowserEnv:()=>BEr,hasStandardBrowserEnv:()=>ptl,hasStandardBrowserWebWorkerEnv:()=>ftl,navigator:()=>REr,origin:()=>Atl});var BEr,REr,ptl,ftl,Atl,Q0i=et(()=>{BEr=typeof window<"u"&&typeof document<"u",REr=typeof navigator=="object"&&navigator||void 0,ptl=BEr&&(!REr||["ReactNative","NativeScript","NS"].indexOf(REr.product)<0),ftl=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Atl=BEr&&window.location.href||"http://localhost"});var tp,t7=et(()=>{k0i();Q0i();tp={...xEr,...P0i}});function MEr(r,t){return QV(r,new tp.classes.URLSearchParams,Object.assign({visitor:function(n,i,o,s){return tp.isNode&&er.isBuffer(n)?(this.append(i,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}var L0i=et(()=>{"use strict";Bd();OLe();t7()});function htl(r){return er.matchAll(/\w+|\[(\w*)]/g,r).map(t=>t[0]==="[]"?"":t[1]||t[0])}function gtl(r){let t={},n=Object.keys(r),i,o=n.length,s;for(i=0;i<o;i++)s=n[i],t[s]=r[s];return t}function mtl(r){function t(n,i,o,s){let a=n[s++];if(a==="__proto__")return!0;let l=Number.isFinite(+a),c=s>=n.length;return a=!a&&er.isArray(o)?o.length:a,c?(er.hasOwnProp(o,a)?o[a]=[o[a],i]:o[a]=i,!l):((!o[a]||!er.isObject(o[a]))&&(o[a]=[]),t(n,i,o[a],s)&&er.isArray(o[a])&&(o[a]=gtl(o[a])),!l)}if(er.isFormData(r)&&er.isFunction(r.entries)){let n={};return er.forEachEntry(r,(i,o)=>{t(htl(i),o,n,0)}),n}return null}var Xht,DEr=et(()=>{"use strict";Bd();Xht=mtl});function ytl(r,t,n){if(er.isString(r))try{return(t||JSON.parse)(r),er.trim(r)}catch(i){if(i.name!=="SyntaxError")throw i}return(n||JSON.stringify)(r)}var NEr,Uye,$ht=et(()=>{"use strict";Bd();P_();Jht();OLe();L0i();t7();DEr();NEr={transitional:zye,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){let i=n.getContentType()||"",o=i.indexOf("application/json")>-1,s=er.isObject(t);if(s&&er.isHTMLForm(t)&&(t=new FormData(t)),er.isFormData(t))return o?JSON.stringify(Xht(t)):t;if(er.isArrayBuffer(t)||er.isBuffer(t)||er.isStream(t)||er.isFile(t)||er.isBlob(t)||er.isReadableStream(t))return t;if(er.isArrayBufferView(t))return t.buffer;if(er.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(s){if(i.indexOf("application/x-www-form-urlencoded")>-1)return MEr(t,this.formSerializer).toString();if((l=er.isFileList(t))||i.indexOf("multipart/form-data")>-1){let c=this.env&&this.env.FormData;return QV(l?{"files[]":t}:t,c&&new c,this.formSerializer)}}return s||o?(n.setContentType("application/json",!1),ytl(t)):t}],transformResponse:[function(t){let n=this.transitional||NEr.transitional,i=n&&n.forcedJSONParsing,o=this.responseType==="json";if(er.isResponse(t)||er.isReadableStream(t))return t;if(t&&er.isString(t)&&(i&&!this.responseType||o)){let a=!(n&&n.silentJSONParsing)&&o;try{return JSON.parse(t)}catch(l){if(a)throw l.name==="SyntaxError"?so.from(l,so.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:tp.classes.FormData,Blob:tp.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};er.forEach(["delete","get","head","post","put","patch"],r=>{NEr.headers[r]={}});Uye=NEr});var Etl,F0i,q0i=et(()=>{"use strict";Bd();Etl=er.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),F0i=r=>{let t={},n,i,o;return r&&r.split(`
179
+ Value: `,n),new wV(n,[{path:"",message:"value triggered unknown runtypes error"}])}}createValidationFailedResult(n,i){let o=[],s=(a,l)=>{for(let[c,u]of Object.entries(l)){let d=a.concat(c);typeof u=="string"?o.push({path:d.join("."),message:u}):s(d,u)}};if(n.code==="TYPE_INCORRECT"||n.code==="CONSTRAINT_FAILED")o.push({path:"",message:n.message});else{let a=n.details;a&&s([],a)}return new wV(i,o)}},wd=(r,t)=>new h3r(r,t)});var y3r,GKa,WKa,m3r,Cr,nli=et(()=>{"use strict";y3r=Ct(is());vr();Ag();XAt();sn();GKa=r=>r.code==="unrecognized_keys"?r.keys.length:r.code==="invalid_type"&&r.received==="undefined"&&r.message==="Required"?1:r.code==="invalid_literal"?10:0,WKa=r=>y3r.default.sum(r.issues.map(t=>GKa(t))),m3r=class extends Cye{constructor(n,i){super(n);this.zodType=i;if(!i)throw new At(`Missing Zod type for ${n} validator. Did you use a circular import?`)}convertZodError=n=>{let i=[];for(let o of n.issues)if(o.code==="invalid_union"){let s=y3r.default.minBy(o.unionErrors,a=>WKa(a));s&&i.push(...this.convertZodError(s))}else i.push({path:o.path.join("."),message:o.message});return i};validate(n){try{let i=this.zodType.safeParse(n);if(i.success)return{valid:!0,value:i.data};let o=this.convertZodError(i.error);return new wV(n,o)}catch(i){let o=i instanceof T.ZodError?[i.flatten(),i.issues]:[];return o0().error(`ZodValidator: Unable to validate ${this.name} value`,"error: ",i,"value: ",n,...o),new wV(n,[{path:"",message:"value triggered unknown Zod error"}])}}},Cr=(r,t)=>new m3r(r,t)});var Iye=et(()=>{"use strict";g3r();XAt();nli()});var HKa,VKa,ili,E3r,$At,b3r,ZAt,C3r,I3r,v3r,S3r,_3r,YKa,oli,sli,RV=et(()=>{"use strict";sn();Zpr();vV();Cyr();Lyr();zae();$ai();n8();Iye();HKa=T.object({auth:T.string(),firestore:T.string(),storage:T.string()}),VKa=T.object({apiKey:T.string(),authDomain:T.string(),projectId:T.string(),storageBucket:T.string(),messagingSenderId:T.string(),appId:T.string(),measurementId:T.string(),emulatorInfo:HKa.optional()}),ili=Cr("FirebaseConfig",VKa),E3r=r=>{X9("firestore.delete",{path:r})},$At=r=>{X9("firestore.set",{path:r})},b3r=r=>{X9("firestore.update",{path:r})},ZAt=r=>{X9("firestore.get",{path:r})},C3r=r=>{X9("firestore.transaction.get",{path:r})},I3r=r=>{X9("firestore.transaction.set",{path:r})},v3r=r=>{X9("firestore.transaction.update",{path:r})},S3r=r=>{X9("firestore.transaction.delete",{path:r})},_3r=()=>{X9("firestore.batch")},YKa=R_.getTracer("firestore"),oli=r=>(ZAt(r.path),YKa.startActiveSpan(`get ${r.path}`,async t=>{t.setAttribute("path",r.path),t.setAttribute("operation","get");let n=await r.get();return t.end(),n})),sli=async(r,t=1e3)=>{let n=()=>{},i=new Promise(o=>{n=r.onSnapshot(s=>{s.metadata.hasPendingWrites||o(s)})});return await R2(t,`Timed out in GetDocumentNoPendingWrites after ${t} ms`,i).finally(n)}});var eht,tht,ali,jae=et(()=>{"use strict";eht={emerg:"emerg",info:"info",error:"error",debug:"debug",assert:"assert",warn:"warn",alert:"alert",app:"app"},tht={LEVELS:{emerg:0,assert:1,alert:2,error:3,app:4,info:5,debug:6,warn:4},COLORS:{emerg:"red",assert:"yellow",alert:"yellow",warn:"yellow",error:"cyan",app:"blue",info:"green",debug:"magenta"}},ali=["Authorization","Token","Password","Secret","idToken","id_token","clientID","clientSecret"]});var O3r,B_,tLe=et(()=>{"use strict";O3r=["ACTUAL_STATE","ADVANCED_DEPLOY","APP","AUTH","BULK_WRITE","CLI","CLI_INTERNAL","COLUMN_LINEAGE","COLUMN_METADATA","COMMON","CONNECTION","DEBUG","DEPLOY","DNS","DOCS","DRAG","ENTITY_API","ENV","ENVIRONMENTS","ERROR_OPERATIONS","FIREBASE","FOLDERS","GIT","GIT_SETTINGS","GOOGLE_DEBUG","GRAPH","HEARTBEAT","INTEGRATIONS","JDBC_SERVICE","JEST","JOBS","JSON_PARSER","LIGHTNING_FS","LISTENERS","MACROS","MAPPING_GRID","METADATA_HYDRATION","METADATA_OPERATIONS","NARROW_METADATA","NODE_TYPES","ORGS","ORG_BOOTSTRAP","ORG_SCANNER","ORG_SETTINGS","ORG_UPGRADE","PACKAGES","PACKAGES_BACKEND","PACKAGE_NAMESPACES","PACKAGE_REGISTRY","PALETTE","PARTNER_CONNECT","PENDO","PERFORMANCE","PIPELINE","PLAN","PLATFORM","PRESYNC","PROBLEM_SCANNER","PROJECTS","RBAC","RENDERER","RUNNER","RUNNER_BACKEND","RUN_RESULTS","RUN_TRANSACTION","SEARCH","SECRETS","SECURE_RUN_AND_WORKSPACE","SQL_PARSING","SQL_TESTING","STATE","STEPS","STORAGE_LOCATIONS","STRUMENTA","SYSTEM_EMAILS","TEMPLATE_EDITOR","TESTING","TIMING_UTILS","TREE_OPERATIONS","TYPESENSE","UI","USERS","USER_ACTIVATION","USER_MANAGEMENT","USER_SETTINGS","VERSIONING","VERSION_CONTROL_ACTIONS","WORKSPACES","XML_PARSER","YAML","ZIP","AI_COLUMN_DESCRIPTIONS","AI_NODE_DESCRIPTIONS","AI_GIT_COMMIT_MESSAGE"],B_={...Object.fromEntries(O3r.map(r=>[r,{level:"info"}]))}});var Tq,vye,p3,rht=et(()=>{"use strict";Tq=(r,t,n,i,o)=>({orgID:r,workspaceID:t,userID:n,runID:i,nodeID:o}),vye=(r,t)=>{r.runID=t},p3={}});var uli=I(lli=>{"use strict";Object.defineProperty(lli,"__esModule",{value:!0})});var T3r=I(nht=>{"use strict";Object.defineProperty(nht,"__esModule",{value:!0});nht.Failcode=void 0;nht.Failcode={TYPE_INCORRECT:"TYPE_INCORRECT",VALUE_INCORRECT:"VALUE_INCORRECT",KEY_INCORRECT:"KEY_INCORRECT",CONTENT_INCORRECT:"CONTENT_INCORRECT",ARGUMENT_INCORRECT:"ARGUMENT_INCORRECT",RETURN_INCORRECT:"RETURN_INCORRECT",CONSTRAINT_FAILED:"CONSTRAINT_FAILED",PROPERTY_MISSING:"PROPERTY_MISSING",PROPERTY_PRESENT:"PROPERTY_PRESENT",NOTHING_EXPECTED:"NOTHING_EXPECTED"}});var _ye=I(Sye=>{"use strict";var KKa=Sye&&Sye.__extends||function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,o){i.__proto__=o}||function(i,o){for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(i[s]=o[s])},r(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");r(t,n);function i(){this.constructor=t}t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}}();Object.defineProperty(Sye,"__esModule",{value:!0});Sye.ValidationError=void 0;var JKa=function(r){KKa(t,r);function t(n){var i=r.call(this,n.message)||this;return i.name="ValidationError",i.code=n.code,n.details!==void 0&&(i.details=n.details),Object.setPrototypeOf(i,t.prototype),i}return t}(Error);Sye.ValidationError=JKa});var rLe=I(w3r=>{"use strict";Object.defineProperty(w3r,"__esModule",{value:!0});var iht=function(r){return function(t){switch(t.tag){case"literal":return'"'.concat(String(t.value),'"');case"string":return"string";case"brand":return t.brand;case"constraint":return t.name||iht(r)(t.underlying);case"union":return t.alternatives.map(iht(r)).join(" | ");case"intersect":return t.intersectees.map(iht(r)).join(" & ");default:break}return"`${".concat(x_(!1,r)(t),"}`")}},oht=function(r){return function(t){switch(t.tag){case"literal":return String(t.value);case"brand":return"${".concat(t.brand,"}");case"constraint":return t.name?"${".concat(t.name,"}"):oht(r)(t.underlying);case"union":if(t.alternatives.length===1){var n=t.alternatives[0];return oht(r)(n.reflect)}break;case"intersect":if(t.intersectees.length===1){var n=t.intersectees[0];return oht(r)(n.reflect)}break;default:break}return"${".concat(x_(!1,r)(t),"}")}},x_=function(r,t){return function(n){var i=function(u){return r?"(".concat(u,")"):u};if(t.has(n))return i("CIRCULAR ".concat(n.tag));t.add(n);try{switch(n.tag){case"unknown":case"never":case"void":case"boolean":case"number":case"bigint":case"string":case"symbol":case"function":return n.tag;case"literal":{var o=n.value;return typeof o=="string"?'"'.concat(o,'"'):String(o)}case"template":{if(n.strings.length===0)return'""';if(n.strings.length===1)return'"'.concat(n.strings[0],'"');if(n.strings.length===2&&n.strings.every(function(u){return u===""})){var s=n.runtypes[0];return iht(t)(s.reflect)}var a=!1,l=n.strings.reduce(function(u,d,p){var f=u+d,A=n.runtypes[p];if(A){var h=oht(t)(A.reflect);return!a&&h.startsWith("$")&&(a=!0),f+h}else return f},"");return a?"`".concat(l,"`"):'"'.concat(l,'"')}case"array":return"".concat(cli(n)).concat(x_(!0,t)(n.element),"[]");case"dictionary":return"{ [_: ".concat(n.key,"]: ").concat(x_(!1,t)(n.value)," }");case"record":{var c=Object.keys(n.fields);return c.length?"{ ".concat(c.map(function(u){return"".concat(cli(n)).concat(u).concat(XKa(n,u),": ").concat(n.fields[u].tag==="optional"?x_(!1,t)(n.fields[u].underlying):x_(!1,t)(n.fields[u]),";")}).join(" ")," }"):"{}"}case"tuple":return"[".concat(n.components.map(x_(!1,t)).join(", "),"]");case"union":return i("".concat(n.alternatives.map(x_(!0,t)).join(" | ")));case"intersect":return i("".concat(n.intersectees.map(x_(!0,t)).join(" & ")));case"optional":return x_(r,t)(n.underlying)+" | undefined";case"constraint":return n.name||x_(r,t)(n.underlying);case"instanceof":return n.ctor.name;case"brand":return x_(r,t)(n.entity)}}finally{t.delete(n)}throw Error("impossible")}};w3r.default=x_(!1,new Set);function XKa(r,t){var n=r.isPartial,i=r.fields;return n||t!==void 0&&i[t].tag==="optional"?"?":""}function cli(r){var t=r.isReadonly;return t?"readonly ":""}});var tf=I(Rd=>{"use strict";var R3r=Rd&&Rd.__assign||function(){return R3r=Object.assign||function(r){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},R3r.apply(this,arguments)};Object.defineProperty(Rd,"__esModule",{value:!0});Rd.FAILURE=Rd.SUCCESS=Rd.enumerableKeysOf=Rd.typeOf=Rd.hasKey=void 0;var $9=T3r(),Gae=rLe();function $Ka(r,t){return typeof t=="object"&&t!==null&&r in t}Rd.hasKey=$Ka;var ZKa=function(r){var t,n,i;return typeof r=="object"?r===null?"null":Array.isArray(r)?"array":((t=r.constructor)===null||t===void 0?void 0:t.name)==="Object"?"object":(i=(n=r.constructor)===null||n===void 0?void 0:n.name)!==null&&i!==void 0?i:typeof r:typeof r};Rd.typeOf=ZKa;var eJa=function(r){return typeof r=="object"&&r!==null?Reflect.ownKeys(r).filter(function(t){var n,i;return(i=(n=r.propertyIsEnumerable)===null||n===void 0?void 0:n.call(r,t))!==null&&i!==void 0?i:!0}):[]};Rd.enumerableKeysOf=eJa;function tJa(r){return{success:!0,value:r}}Rd.SUCCESS=tJa;Rd.FAILURE=Object.assign(function(r,t,n){return R3r({success:!1,code:r,message:t},n?{details:n}:{})},{TYPE_INCORRECT:function(r,t){var n="Expected ".concat(r.tag==="template"?"string ".concat((0,Gae.default)(r)):(0,Gae.default)(r),", but was ").concat((0,Rd.typeOf)(t));return(0,Rd.FAILURE)($9.Failcode.TYPE_INCORRECT,n)},VALUE_INCORRECT:function(r,t,n){return(0,Rd.FAILURE)($9.Failcode.VALUE_INCORRECT,"Expected ".concat(r," ").concat(String(t),", but was ").concat(String(n)))},KEY_INCORRECT:function(r,t,n){return(0,Rd.FAILURE)($9.Failcode.KEY_INCORRECT,"Expected ".concat((0,Gae.default)(r)," key to be ").concat((0,Gae.default)(t),", but was ").concat((0,Rd.typeOf)(n)))},CONTENT_INCORRECT:function(r,t){var n="Expected ".concat((0,Gae.default)(r),", but was incompatible");return(0,Rd.FAILURE)($9.Failcode.CONTENT_INCORRECT,n,t)},ARGUMENT_INCORRECT:function(r){return(0,Rd.FAILURE)($9.Failcode.ARGUMENT_INCORRECT,r)},RETURN_INCORRECT:function(r){return(0,Rd.FAILURE)($9.Failcode.RETURN_INCORRECT,r)},CONSTRAINT_FAILED:function(r,t){var n=t?": ".concat(t):"";return(0,Rd.FAILURE)($9.Failcode.CONSTRAINT_FAILED,"Failed constraint check for ".concat((0,Gae.default)(r)).concat(n))},PROPERTY_MISSING:function(r){var t="Expected ".concat((0,Gae.default)(r),", but was missing");return(0,Rd.FAILURE)($9.Failcode.PROPERTY_MISSING,t)},PROPERTY_PRESENT:function(r){var t="Expected nothing, but was ".concat((0,Rd.typeOf)(r));return(0,Rd.FAILURE)($9.Failcode.PROPERTY_PRESENT,t)},NOTHING_EXPECTED:function(r){var t="Expected nothing, but was ".concat((0,Rd.typeOf)(r));return(0,Rd.FAILURE)($9.Failcode.NOTHING_EXPECTED,t)}})});var dli=I(BV=>{"use strict";var rJa=BV&&BV.__read||function(r,t){var n=typeof Symbol=="function"&&r[Symbol.iterator];if(!n)return r;var i=n.call(r),o,s=[],a;try{for(;(t===void 0||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(l){a={error:l}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return s},nJa=BV&&BV.__spreadArray||function(r,t,n){if(n||arguments.length===2)for(var i=0,o=t.length,s;i<o;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return r.concat(s||Array.prototype.slice.call(t))};Object.defineProperty(BV,"__esModule",{value:!0});BV.Contract=void 0;var iJa=_ye(),oJa=tf();function sJa(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n=r.length-1,i=r.slice(0,n),o=r[n];return{enforce:function(s){return function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];if(a.length<i.length){var c="Expected ".concat(i.length," arguments but only received ").concat(a.length),u=oJa.FAILURE.ARGUMENT_INCORRECT(c);throw new iJa.ValidationError(u)}for(var d=0;d<i.length;d++)i[d].check(a[d]);return o.check(s.apply(void 0,nJa([],rJa(a),!1)))}}}}BV.Contract=sJa});var Ali=I(xV=>{"use strict";var aJa=xV&&xV.__read||function(r,t){var n=typeof Symbol=="function"&&r[Symbol.iterator];if(!n)return r;var i=n.call(r),o,s=[],a;try{for(;(t===void 0||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(l){a={error:l}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return s},lJa=xV&&xV.__spreadArray||function(r,t,n){if(n||arguments.length===2)for(var i=0,o=t.length,s;i<o;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return r.concat(s||Array.prototype.slice.call(t))};Object.defineProperty(xV,"__esModule",{value:!0});xV.AsyncContract=void 0;var pli=_ye(),fli=tf();function uJa(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n=r.length-1,i=r.slice(0,n),o=r[n];return{enforce:function(s){return function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];if(a.length<i.length){var c="Expected ".concat(i.length," arguments but only received ").concat(a.length),u=fli.FAILURE.ARGUMENT_INCORRECT(c);throw new pli.ValidationError(u)}for(var d=0;d<i.length;d++)i[d].check(a[d]);var p=s.apply(void 0,lJa([],aJa(a),!1));if(!(p instanceof Promise)){var c="Expected function to return a promise, but instead got ".concat(p),u=fli.FAILURE.RETURN_INCORRECT(c);throw new pli.ValidationError(u)}return p.then(o.check)}}}}xV.AsyncContract=uJa});var hli=I(Z9=>{"use strict";var cJa=Z9&&Z9.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&r[t],i=0;if(n)return n.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},dJa=Z9&&Z9.__read||function(r,t){var n=typeof Symbol=="function"&&r[Symbol.iterator];if(!n)return r;var i=n.call(r),o,s=[],a;try{for(;(t===void 0||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(l){a={error:l}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return s};Object.defineProperty(Z9,"__esModule",{value:!0});Z9.when=Z9.match=void 0;function pJa(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return function(n){var i,o;try{for(var s=cJa(r),a=s.next();!a.done;a=s.next()){var l=dJa(a.value,2),c=l[0],u=l[1];if(c.guard(n))return u(n)}}catch(d){i={error:d}}finally{try{a&&!a.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}throw new Error("No alternatives were matched")}}Z9.match=pJa;function fJa(r,t){return[r,t]}Z9.when=fJa});var MA=I(DV=>{"use strict";Object.defineProperty(DV,"__esModule",{value:!0});DV.innerValidate=DV.create=DV.isRuntype=void 0;var MV=f3(),AJa=rLe(),hJa=_ye(),gli=tf(),mli=Symbol(),gJa=function(r){return(0,gli.hasKey)(mli,r)};DV.isRuntype=gJa;function mJa(r,t){return t[mli]=!0,t.check=n,t.assert=n,t._innerValidate=function(p,f){return f.has(p,t)?(0,gli.SUCCESS)(p):r(p,f)},t.validate=function(p){return t._innerValidate(p,EJa())},t.guard=i,t.Or=o,t.And=s,t.optional=a,t.nullable=l,t.withConstraint=c,t.withGuard=u,t.withBrand=d,t.reflect=t,t.toString=function(){return"Runtype<".concat((0,AJa.default)(t),">")},t;function n(p){var f=t.validate(p);if(f.success)return f.value;throw new hJa.ValidationError(f)}function i(p){return t.validate(p).success}function o(p){return(0,MV.Union)(t,p)}function s(p){return(0,MV.Intersect)(t,p)}function a(){return(0,MV.Optional)(t)}function l(){return(0,MV.Union)(t,MV.Null)}function c(p,f){return(0,MV.Constraint)(t,p,f)}function u(p,f){return(0,MV.Constraint)(t,p,f)}function d(p){return(0,MV.Brand)(p,t)}}DV.create=mJa;function yJa(r,t,n){return r._innerValidate(t,n)}DV.innerValidate=yJa;function EJa(){var r=new WeakMap,t=function(i,o){if(!(i===null||typeof i!="object")){var s=r.get(i);r.set(i,s?s.set(o,!0):new WeakMap().set(o,!0))}},n=function(i,o){var s=r.get(i),a=s&&s.get(o)||!1;return t(i,o),a};return{has:n}}});var aht=I(sht=>{"use strict";Object.defineProperty(sht,"__esModule",{value:!0});sht.Unknown=void 0;var bJa=MA(),CJa=tf(),IJa={tag:"unknown"};sht.Unknown=(0,bJa.create)(function(r){return(0,CJa.SUCCESS)(r)},IJa)});var yli=I(lht=>{"use strict";Object.defineProperty(lht,"__esModule",{value:!0});lht.Never=void 0;var vJa=MA(),SJa=tf(),_Ja={tag:"never"};lht.Never=(0,vJa.create)(SJa.FAILURE.NOTHING_EXPECTED,_Ja)});var Eli=I(uht=>{"use strict";Object.defineProperty(uht,"__esModule",{value:!0});uht.Void=void 0;var OJa=aht();uht.Void=OJa.Unknown});var B3r=I(Oye=>{"use strict";var cht=Oye&&Oye.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&r[t],i=0;if(n)return n.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Oye,"__esModule",{value:!0});Oye.Union=void 0;var dht=MA(),nLe=tf();function TJa(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n=function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];return function(a){for(var l=0;l<r.length;l++)if(r[l].guard(a))return o[l](a)}},i={tag:"union",alternatives:r,match:n};return(0,dht.create)(function(o,s){var a,l,c,u,d,p,f,A;if(typeof o!="object"||o===null){try{for(var h=cht(r),y=h.next();!y.done;y=h.next()){var C=y.value;if((0,dht.innerValidate)(C,o,s).success)return(0,nLe.SUCCESS)(o)}}catch(X){a={error:X}}finally{try{y&&!y.done&&(l=h.return)&&l.call(h)}finally{if(a)throw a.error}}return nLe.FAILURE.TYPE_INCORRECT(i,o)}var v={};try{for(var O=cht(r),w=O.next();!w.done;w=O.next()){var C=w.value;if(C.reflect.tag==="record"){var R=function(Y){var L=C.reflect.fields[Y];L.tag==="literal"&&(v[Y]?v[Y].every(function($){return $!==L.value})&&v[Y].push(L.value):v[Y]=[L.value])};for(var k in C.reflect.fields)R(k)}}}catch(X){c={error:X}}finally{try{w&&!w.done&&(u=O.return)&&u.call(O)}finally{if(c)throw c.error}}for(var k in v)if(v[k].length===r.length)try{for(var z=(d=void 0,cht(r)),H=z.next();!H.done;H=z.next()){var C=H.value;if(C.reflect.tag==="record"){var J=C.reflect.fields[k];if(J.tag==="literal"&&(0,nLe.hasKey)(k,o)&&o[k]===J.value)return(0,dht.innerValidate)(C,o,s)}}}catch(Y){d={error:Y}}finally{try{H&&!H.done&&(p=z.return)&&p.call(z)}finally{if(d)throw d.error}}try{for(var K=cht(r),V=K.next();!V.done;V=K.next()){var F=V.value;if((0,dht.innerValidate)(F,o,s).success)return(0,nLe.SUCCESS)(o)}}catch(X){f={error:X}}finally{try{V&&!V.done&&(A=K.return)&&A.call(K)}finally{if(f)throw f.error}}return nLe.FAILURE.TYPE_INCORRECT(i,o)},i)}Oye.Union=TJa});var D3r=I(Nv=>{"use strict";Object.defineProperty(Nv,"__esModule",{value:!0});Nv.Nullish=Nv.Null=Nv.Undefined=Nv.Literal=Nv.literal=void 0;var wJa=MA(),bli=tf(),RJa=B3r();function x3r(r){return Array.isArray(r)?String(r.map(String)):typeof r=="bigint"?String(r)+"n":String(r)}Nv.literal=x3r;function M3r(r){var t={tag:"literal",value:r};return(0,wJa.create)(function(n){return n===r?(0,bli.SUCCESS)(n):bli.FAILURE.VALUE_INCORRECT("literal","`".concat(x3r(r),"`"),"`".concat(x3r(n),"`"))},t)}Nv.Literal=M3r;Nv.Undefined=M3r(void 0);Nv.Null=M3r(null);Nv.Nullish=(0,RJa.Union)(Nv.Null,Nv.Undefined)});var _li=I(e7=>{"use strict";var NV=e7&&e7.__read||function(r,t){var n=typeof Symbol=="function"&&r[Symbol.iterator];if(!n)return r;var i=n.call(r),o,s=[],a;try{for(;(t===void 0||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(l){a={error:l}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return s},N3r=e7&&e7.__spreadArray||function(r,t,n){if(n||arguments.length===2)for(var i=0,o=t.length,s;i<o;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return r.concat(s||Array.prototype.slice.call(t))},Cli=e7&&e7.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&r[t],i=0;if(n)return n.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e7,"__esModule",{value:!0});e7.Template=void 0;var pht=MA(),Ili=rLe(),wq=tf(),Sli=D3r(),P3r=function(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},BJa=function(r){if(0<r.length&&Array.isArray(r[0])){var t=NV(r),n=t[0],i=t.slice(1);return[Array.from(n),i]}else{var o=r,n=o.reduce(function(l,c){return(0,pht.isRuntype)(c)?l.push(""):l.push(l.pop()+String(c)),l},[""]),i=o.filter(pht.isRuntype);return[n,i]}},xJa=function(r,t){for(var n=0;n<t.length;)switch(t[n].reflect.tag){case"literal":{var i=t[n];t.splice(n,1);var o=String(i.value);r.splice(n,2,r[n]+o+r[n+1]);break}case"template":{var s=t[n];t.splice.apply(t,N3r([n,1],NV(s.runtypes),!1));var a=s.strings;if(a.length===1)r.splice(n,2,r[n]+a[0]+r[n+1]);else{var l=a[0],c=a.slice(1,-1),u=a[a.length-1];r.splice.apply(r,N3r(N3r([n,2,r[n]+l],NV(c),!1),[u+r[n+1]],!1))}break}case"union":{var d=t[n];if(d.alternatives.length===1)try{var p=sLe(d);t.splice(n,1);var o=String(p.value);r.splice(n,2,r[n]+o+r[n+1]);break}catch{n++;break}else{n++;break}}case"intersect":{var f=t[n];if(f.intersectees.length===1)try{var A=sLe(f);t.splice(n,1);var o=String(A.value);r.splice(n,2,r[n]+o+r[n+1]);break}catch{n++;break}else{n++;break}}default:n++;break}},MJa=function(r){var t=NV(BJa(r),2),n=t[0],i=t[1];return xJa(n,i),[n,i]},sLe=function(r){switch(r.reflect.tag){case"literal":return r;case"brand":return sLe(r.reflect.entity);case"union":if(r.reflect.alternatives.length===1)return sLe(r.reflect.alternatives[0]);break;case"intersect":if(r.reflect.intersectees.length===1)return sLe(r.reflect.intersectees[0]);break;default:break}throw void 0},vli=function(r){return r},k3r={string:[function(r){return globalThis.String(r)},".*"],number:[function(r){return globalThis.Number(r)},"[+-]?(?:\\d*\\.\\d+|\\d+\\.\\d*|\\d+)(?:[Ee][+-]?\\d+)?","0[Bb][01]+","0[Oo][0-7]+","0[Xx][0-9A-Fa-f]+"],bigint:[function(r){return globalThis.BigInt(r)},"-?[1-9]d*"],boolean:[function(r){return r!=="false"},"true","false"],null:[function(){return null},"null"],undefined:[function(){},"undefined"]},iLe=function(r){switch(r.tag){case"literal":{var t=NV(k3r[(0,wq.typeOf)(r.value)]||[vli],1),n=t[0];return n}case"brand":return iLe(r.entity);case"constraint":return iLe(r.underlying);case"union":return r.alternatives.map(iLe);case"intersect":return r.intersectees.map(iLe);default:var i=NV(k3r[r.tag]||[vli],1),o=i[0];return o}},Q3r=function(r,t){return function(n){var i,o,s,a,l=iLe(r);if(Array.isArray(l))switch(r.tag){case"union":try{for(var c=Cli(r.alternatives),u=c.next();!u.done;u=c.next()){var d=u.value,p=Q3r(d.reflect,t)(n);if(p.success)return p}}catch(C){i={error:C}}finally{try{u&&!u.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}return wq.FAILURE.TYPE_INCORRECT(r,n);case"intersect":try{for(var f=Cli(r.intersectees),A=f.next();!A.done;A=f.next()){var h=A.value,p=Q3r(h.reflect,t)(n);if(!p.success)return p}}catch(C){s={error:C}}finally{try{A&&!A.done&&(a=f.return)&&a.call(f)}finally{if(s)throw s.error}}return(0,wq.SUCCESS)(n);default:throw Error("impossible")}else{var y=l,p=(0,pht.innerValidate)(r,y(n),t);return!p.success&&p.code==="VALUE_INCORRECT"&&r.tag==="literal"?wq.FAILURE.VALUE_INCORRECT("literal",'"'.concat((0,Sli.literal)(r.value),'"'),'"'.concat(n,'"')):p}}},oLe=function(r){switch(r.tag){case"literal":return P3r(String(r.value));case"brand":return oLe(r.entity);case"constraint":return oLe(r.underlying);case"union":return r.alternatives.map(oLe).join("|");case"template":return r.strings.map(P3r).reduce(function(i,o,s){var a=i+o,l=r.runtypes[s];return l?a+"(?:".concat(oLe(l.reflect),")"):a},"");default:var t=NV(k3r[r.tag]||[void 0,".*"]),n=t.slice(1);return n.join("|")}},DJa=function(r){var t=r.strings.map(P3r).reduce(function(n,i,o){var s=n+i,a=r.runtypes[o];return a?s+"(".concat(oLe(a.reflect),")"):s},"");return new RegExp("^".concat(t,"$"),"su")};function NJa(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n=NV(MJa(r),2),i=n[0],o=n[1],s={tag:"template",strings:i,runtypes:o},a=DJa(s),l=function(c,u){var d=c.match(a);if(d){for(var p=d.slice(1),f=0;f<o.length;f++){var A=o[f],h=p[f],y=Q3r(A.reflect,u)(h);if(!y.success)return y}return(0,wq.SUCCESS)(c)}else return wq.FAILURE.VALUE_INCORRECT("string","".concat((0,Ili.default)(s)),'"'.concat((0,Sli.literal)(c),'"'))};return(0,pht.create)(function(c,u){if(typeof c!="string")return wq.FAILURE.TYPE_INCORRECT(s,c);var d=l(c,u);if(d.success)return(0,wq.SUCCESS)(c);var p=wq.FAILURE.VALUE_INCORRECT("string","".concat((0,Ili.default)(s)),'"'.concat(c,'"'));return p.message!==d.message&&(p.message+=" (inner: ".concat(d.message,")")),p},s)}e7.Template=NJa});var wli=I(fht=>{"use strict";Object.defineProperty(fht,"__esModule",{value:!0});fht.Boolean=void 0;var PJa=MA(),Oli=tf(),Tli={tag:"boolean"};fht.Boolean=(0,PJa.create)(function(r){return typeof r=="boolean"?(0,Oli.SUCCESS)(r):Oli.FAILURE.TYPE_INCORRECT(Tli,r)},Tli)});var xli=I(Aht=>{"use strict";Object.defineProperty(Aht,"__esModule",{value:!0});Aht.Number=void 0;var kJa=MA(),Rli=tf(),Bli={tag:"number"};Aht.Number=(0,kJa.create)(function(r){return typeof r=="number"?(0,Rli.SUCCESS)(r):Rli.FAILURE.TYPE_INCORRECT(Bli,r)},Bli)});var Nli=I(hht=>{"use strict";Object.defineProperty(hht,"__esModule",{value:!0});hht.BigInt=void 0;var QJa=MA(),Mli=tf(),Dli={tag:"bigint"};hht.BigInt=(0,QJa.create)(function(r){return typeof r=="bigint"?(0,Mli.SUCCESS)(r):Mli.FAILURE.TYPE_INCORRECT(Dli,r)},Dli)});var L3r=I(ght=>{"use strict";Object.defineProperty(ght,"__esModule",{value:!0});ght.String=void 0;var LJa=MA(),Pli=tf(),kli={tag:"string"};ght.String=(0,LJa.create)(function(r){return typeof r=="string"?(0,Pli.SUCCESS)(r):Pli.FAILURE.TYPE_INCORRECT(kli,r)},kli)});var qli=I(mht=>{"use strict";Object.defineProperty(mht,"__esModule",{value:!0});mht.Symbol=void 0;var Fli=MA(),aLe=tf(),FJa=function(r){var t={tag:"symbol",key:r};return(0,Fli.create)(function(n){if(typeof n!="symbol")return aLe.FAILURE.TYPE_INCORRECT(t,n);var i=globalThis.Symbol.keyFor(n);return i!==r?aLe.FAILURE.VALUE_INCORRECT("symbol key",Lli(r),Lli(i)):(0,aLe.SUCCESS)(n)},t)},Qli={tag:"symbol"};mht.Symbol=(0,Fli.create)(function(r){return typeof r=="symbol"?(0,aLe.SUCCESS)(r):aLe.FAILURE.TYPE_INCORRECT(Qli,r)},Object.assign(FJa,Qli));var Lli=function(r){return r===void 0?"undefined":'"'.concat(r,'"')}});var jli=I(yht=>{"use strict";Object.defineProperty(yht,"__esModule",{value:!0});yht.Array=void 0;var zli=MA(),lLe=tf();function Uli(r,t){var n={tag:"array",isReadonly:t,element:r};return zJa((0,zli.create)(function(i,o){if(!Array.isArray(i))return lLe.FAILURE.TYPE_INCORRECT(n,i);var s=(0,lLe.enumerableKeysOf)(i),a=s.map(function(c){return(0,zli.innerValidate)(r,i[c],o)}),l=s.reduce(function(c,u){var d=a[u];return d.success||(c[u]=d.details||d.message),c},[]);return(0,lLe.enumerableKeysOf)(l).length!==0?lLe.FAILURE.CONTENT_INCORRECT(n,l):(0,lLe.SUCCESS)(i)},n))}function qJa(r){return Uli(r,!1)}yht.Array=qJa;function zJa(r){return r.asReadonly=t,r;function t(){return Uli(r.element,!0)}}});var Wli=I(Eht=>{"use strict";Object.defineProperty(Eht,"__esModule",{value:!0});Eht.Tuple=void 0;var Gli=MA(),Tye=tf();function UJa(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n={tag:"tuple",components:r};return(0,Gli.create)(function(i,o){if(!Array.isArray(i))return Tye.FAILURE.TYPE_INCORRECT(n,i);if(i.length!==r.length)return Tye.FAILURE.CONSTRAINT_FAILED(n,"Expected length ".concat(r.length,", but was ").concat(i.length));var s=(0,Tye.enumerableKeysOf)(i),a=s.map(function(c){return(0,Gli.innerValidate)(r[c],i[c],o)}),l=s.reduce(function(c,u){var d=a[u];return d.success||(c[u]=d.details||d.message),c},[]);return(0,Tye.enumerableKeysOf)(l).length!==0?Tye.FAILURE.CONTENT_INCORRECT(n,l):(0,Tye.SUCCESS)(i)},n)}Eht.Tuple=UJa});var Vli=I(zT=>{"use strict";var F3r=zT&&zT.__read||function(r,t){var n=typeof Symbol=="function"&&r[Symbol.iterator];if(!n)return r;var i=n.call(r),o,s=[],a;try{for(;(t===void 0||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(l){a={error:l}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return s},q3r=zT&&zT.__spreadArray||function(r,t,n){if(n||arguments.length===2)for(var i=0,o=t.length,s;i<o;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return r.concat(s||Array.prototype.slice.call(t))};Object.defineProperty(zT,"__esModule",{value:!0});zT.Partial=zT.Record=zT.InternalRecord=void 0;var Hli=MA(),Pv=tf();function PV(r,t,n){var i={tag:"record",isPartial:t,isReadonly:n,fields:r};return WJa((0,Hli.create)(function(o,s){if(o==null)return Pv.FAILURE.TYPE_INCORRECT(i,o);var a=(0,Pv.enumerableKeysOf)(r);if(a.length!==0&&typeof o!="object")return Pv.FAILURE.TYPE_INCORRECT(i,o);var l=q3r([],F3r(new Set(q3r(q3r([],F3r(a),!1),F3r((0,Pv.enumerableKeysOf)(o)),!1))),!1),c=l.reduce(function(d,p){var f=(0,Pv.hasKey)(p,r),A=(0,Pv.hasKey)(p,o);if(f){var h=r[p],y=t||h.reflect.tag==="optional";if(A){var C=o[p];y&&C===void 0?d[p]=(0,Pv.SUCCESS)(C):d[p]=(0,Hli.innerValidate)(h,C,s)}else y?d[p]=(0,Pv.SUCCESS)(void 0):d[p]=Pv.FAILURE.PROPERTY_MISSING(h.reflect)}else if(A){var C=o[p];d[p]=(0,Pv.SUCCESS)(C)}else throw new Error("impossible");return d},{}),u=l.reduce(function(d,p){var f=c[p];return f.success||(d[p]=f.details||f.message),d},{});return(0,Pv.enumerableKeysOf)(u).length!==0?Pv.FAILURE.CONTENT_INCORRECT(i,u):(0,Pv.SUCCESS)(o)},i))}zT.InternalRecord=PV;function jJa(r){return PV(r,!1,!1)}zT.Record=jJa;function GJa(r){return PV(r,!0,!1)}zT.Partial=GJa;function WJa(r){return r.asPartial=t,r.asReadonly=n,r.pick=i,r.omit=o,r.extend=s,r;function t(){return PV(r.fields,!0,r.isReadonly)}function n(){return PV(r.fields,r.isPartial,!0)}function i(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var c={};return a.forEach(function(u){c[u]=r.fields[u]}),PV(c,r.isPartial,r.isReadonly)}function o(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var c={},u=(0,Pv.enumerableKeysOf)(r.fields);return u.forEach(function(d){a.includes(d)||(c[d]=r.fields[d])}),PV(c,r.isPartial,r.isReadonly)}function s(a){return PV(Object.assign({},r.fields,a),r.isPartial,r.isReadonly)}}});var U3r=I(wye=>{"use strict";Object.defineProperty(wye,"__esModule",{value:!0});wye.Guard=wye.Constraint=void 0;var HJa=MA(),z3r=tf(),VJa=aht();function YJa(r,t,n){var i=n&&n.name,o=n&&n.args,s={tag:"constraint",underlying:r,constraint:t,name:i,args:o};return(0,HJa.create)(function(a){var l=r.validate(a);if(!l.success)return l;var c=t(l.value);return typeof c=="string"?z3r.FAILURE.CONSTRAINT_FAILED(s,c):c?(0,z3r.SUCCESS)(l.value):z3r.FAILURE.CONSTRAINT_FAILED(s)},s)}wye.Constraint=YJa;var KJa=function(r,t){return VJa.Unknown.withGuard(r,t)};wye.Guard=KJa});var Kli=I(bht=>{"use strict";Object.defineProperty(bht,"__esModule",{value:!0});bht.Dictionary=void 0;var Yli=MA(),j3r=L3r(),JJa=U3r(),XJa=rLe(),Wae=tf(),$Ja=(0,JJa.Constraint)(j3r.String,function(r){return!isNaN(+r)},{name:"number"});function ZJa(r,t){var n=t===void 0||t==="string"?j3r.String:t==="number"?$Ja:t,i=(0,XJa.default)(n),o={tag:"dictionary",key:i,value:r};return(0,Yli.create)(function(s,a){if(s==null||typeof s!="object"||Object.getPrototypeOf(s)!==Object.prototype&&(!Array.isArray(s)||i==="string"))return Wae.FAILURE.TYPE_INCORRECT(o,s);var l=/^(?:NaN|-?\d+(?:\.\d+)?)$/,c=(0,Wae.enumerableKeysOf)(s),u=c.reduce(function(p,f){var A=typeof f=="string"&&l.test(f),h=A?globalThis.Number(f):f;return(A?!n.guard(h)&&!n.guard(f):!n.guard(h))?p[f]=Wae.FAILURE.KEY_INCORRECT(o,n.reflect,h):p[f]=(0,Yli.innerValidate)(r,s[f],a),p},{}),d=c.reduce(function(p,f){var A=u[f];return A.success||(p[f]=A.details||A.message),p},{});return(0,Wae.enumerableKeysOf)(d).length!==0?Wae.FAILURE.CONTENT_INCORRECT(o,d):(0,Wae.SUCCESS)(s)},o)}bht.Dictionary=ZJa});var Xli=I(Rye=>{"use strict";var eXa=Rye&&Rye.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&r[t],i=0;if(n)return n.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Rye,"__esModule",{value:!0});Rye.Intersect=void 0;var Jli=MA(),tXa=tf();function rXa(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n={tag:"intersect",intersectees:r};return(0,Jli.create)(function(i,o){var s,a;try{for(var l=eXa(r),c=l.next();!c.done;c=l.next()){var u=c.value,d=(0,Jli.innerValidate)(u,i,o);if(!d.success)return d}}catch(p){s={error:p}}finally{try{c&&!c.done&&(a=l.return)&&a.call(l)}finally{if(s)throw s.error}}return(0,tXa.SUCCESS)(i)},n)}Rye.Intersect=rXa});var $li=I(Cht=>{"use strict";Object.defineProperty(Cht,"__esModule",{value:!0});Cht.Optional=void 0;var nXa=MA(),iXa=tf();function oXa(r){var t={tag:"optional",underlying:r};return(0,nXa.create)(function(n){return n===void 0?(0,iXa.SUCCESS)(n):r.validate(n)},t)}Cht.Optional=oXa});var tui=I(Iht=>{"use strict";Object.defineProperty(Iht,"__esModule",{value:!0});Iht.Function=void 0;var sXa=MA(),Zli=tf(),eui={tag:"function"};Iht.Function=(0,sXa.create)(function(r){return typeof r=="function"?(0,Zli.SUCCESS)(r):Zli.FAILURE.TYPE_INCORRECT(eui,r)},eui)});var nui=I(vht=>{"use strict";Object.defineProperty(vht,"__esModule",{value:!0});vht.InstanceOf=void 0;var aXa=MA(),rui=tf();function lXa(r){var t={tag:"instanceof",ctor:r};return(0,aXa.create)(function(n){return n instanceof r?(0,rui.SUCCESS)(n):rui.FAILURE.TYPE_INCORRECT(t,n)},t)}vht.InstanceOf=lXa});var iui=I(Sht=>{"use strict";Object.defineProperty(Sht,"__esModule",{value:!0});Sht.Lazy=void 0;var uXa=MA();function cXa(r){var t={get tag(){return i().tag}},n;function i(){if(!n){n=r();for(var o in n)o!=="tag"&&(t[o]=n[o])}return n}return(0,uXa.create)(function(o){return i().validate(o)},t)}Sht.Lazy=cXa});var oui=I(_ht=>{"use strict";Object.defineProperty(_ht,"__esModule",{value:!0});_ht.Brand=void 0;var dXa=MA();function pXa(r,t){var n={tag:"brand",brand:r,entity:t};return(0,dXa.create)(function(i){return t.validate(i)},n)}_ht.Brand=pXa});var sui=I(Bye=>{"use strict";Object.defineProperty(Bye,"__esModule",{value:!0});Bye.checked=Bye.check=void 0;var fXa=_ye(),AXa=tf(),G3r=new WeakMap;function hXa(r,t,n){var i=G3r.get(r)||new Map;G3r.set(r,i);var o=i.get(t)||[];i.set(t,o),o.push(n)}Bye.check=hXa;function gXa(r,t,n){var i=G3r.get(r),o=i&&i.get(t);if(o)return o;for(var s=[],a=0;a<n;a++)s.push(a);return s}function mXa(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(r.length===0)throw new Error("No runtype provided to `@checked`. Please remove the decorator.");return function(n,i,o){var s=o.value,a=(n.name||n.constructor.name+".prototype")+(typeof i=="string"?'["'.concat(i,'"]'):"[".concat(String(i),"]")),l=gXa(n,i,r.length);if(l.length!==r.length)throw new Error("Number of `@checked` runtypes and @check parameters not matched.");if(l.length>s.length)throw new Error("Number of `@checked` runtypes exceeds actual parameter length.");o.value=function(){for(var c=[],u=0;u<arguments.length;u++)c[u]=arguments[u];return r.forEach(function(d,p){var f=l[p],A=d.validate(c[f]);if(!A.success){var h="".concat(a,", argument #").concat(f,": ").concat(A.message),y=AXa.FAILURE.ARGUMENT_INCORRECT(h);throw new fXa.ValidationError(y)}}),s.apply(this,c)}}}Bye.checked=mXa});var f3=I(yl=>{"use strict";var yXa=yl&&yl.__createBinding||(Object.create?function(r,t,n,i){i===void 0&&(i=n),Object.defineProperty(r,i,{enumerable:!0,get:function(){return t[n]}})}:function(r,t,n,i){i===void 0&&(i=n),r[i]=t[n]}),ep=yl&&yl.__exportStar||function(r,t){for(var n in r)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&yXa(t,r,n)};Object.defineProperty(yl,"__esModule",{value:!0});yl.InstanceOf=yl.Nullish=yl.Null=yl.Undefined=yl.Literal=void 0;ep(uli(),yl);ep(T3r(),yl);ep(dli(),yl);ep(Ali(),yl);ep(hli(),yl);ep(_ye(),yl);ep(aht(),yl);ep(yli(),yl);ep(Eli(),yl);var Oht=D3r();Object.defineProperty(yl,"Literal",{enumerable:!0,get:function(){return Oht.Literal}});Object.defineProperty(yl,"Undefined",{enumerable:!0,get:function(){return Oht.Undefined}});Object.defineProperty(yl,"Null",{enumerable:!0,get:function(){return Oht.Null}});Object.defineProperty(yl,"Nullish",{enumerable:!0,get:function(){return Oht.Nullish}});ep(_li(),yl);ep(wli(),yl);ep(xli(),yl);ep(Nli(),yl);ep(L3r(),yl);ep(qli(),yl);ep(jli(),yl);ep(Wli(),yl);ep(Vli(),yl);ep(Kli(),yl);ep(B3r(),yl);ep(Xli(),yl);ep($li(),yl);ep(tui(),yl);var EXa=nui();Object.defineProperty(yl,"InstanceOf",{enumerable:!0,get:function(){return EXa.InstanceOf}});ep(iui(),yl);ep(U3r(),yl);ep(oui(),yl);ep(sui(),yl)});var uLe=I((ZTd,aui)=>{var bXa="2.0.0",CXa=Number.MAX_SAFE_INTEGER||9007199254740991,IXa=16,vXa=250,SXa=["major","premajor","minor","preminor","patch","prepatch","prerelease"];aui.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:IXa,MAX_SAFE_BUILD_LENGTH:vXa,MAX_SAFE_INTEGER:CXa,RELEASE_TYPES:SXa,SEMVER_SPEC_VERSION:bXa,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var cLe=I((ewd,lui)=>{var _Xa=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{};lui.exports=_Xa});var xye=I((Rq,uui)=>{var{MAX_SAFE_COMPONENT_LENGTH:W3r,MAX_SAFE_BUILD_LENGTH:OXa,MAX_LENGTH:TXa}=uLe(),wXa=cLe();Rq=uui.exports={};var RXa=Rq.re=[],BXa=Rq.safeRe=[],as=Rq.src=[],ls=Rq.t={},xXa=0,H3r="[a-zA-Z0-9-]",MXa=[["\\s",1],["\\d",TXa],[H3r,OXa]],DXa=r=>{for(let[t,n]of MXa)r=r.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return r},ou=(r,t,n)=>{let i=DXa(t),o=xXa++;wXa(r,o,t),ls[r]=o,as[o]=t,RXa[o]=new RegExp(t,n?"g":void 0),BXa[o]=new RegExp(i,n?"g":void 0)};ou("NUMERICIDENTIFIER","0|[1-9]\\d*");ou("NUMERICIDENTIFIERLOOSE","\\d+");ou("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${H3r}*`);ou("MAINVERSION",`(${as[ls.NUMERICIDENTIFIER]})\\.(${as[ls.NUMERICIDENTIFIER]})\\.(${as[ls.NUMERICIDENTIFIER]})`);ou("MAINVERSIONLOOSE",`(${as[ls.NUMERICIDENTIFIERLOOSE]})\\.(${as[ls.NUMERICIDENTIFIERLOOSE]})\\.(${as[ls.NUMERICIDENTIFIERLOOSE]})`);ou("PRERELEASEIDENTIFIER",`(?:${as[ls.NUMERICIDENTIFIER]}|${as[ls.NONNUMERICIDENTIFIER]})`);ou("PRERELEASEIDENTIFIERLOOSE",`(?:${as[ls.NUMERICIDENTIFIERLOOSE]}|${as[ls.NONNUMERICIDENTIFIER]})`);ou("PRERELEASE",`(?:-(${as[ls.PRERELEASEIDENTIFIER]}(?:\\.${as[ls.PRERELEASEIDENTIFIER]})*))`);ou("PRERELEASELOOSE",`(?:-?(${as[ls.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${as[ls.PRERELEASEIDENTIFIERLOOSE]})*))`);ou("BUILDIDENTIFIER",`${H3r}+`);ou("BUILD",`(?:\\+(${as[ls.BUILDIDENTIFIER]}(?:\\.${as[ls.BUILDIDENTIFIER]})*))`);ou("FULLPLAIN",`v?${as[ls.MAINVERSION]}${as[ls.PRERELEASE]}?${as[ls.BUILD]}?`);ou("FULL",`^${as[ls.FULLPLAIN]}$`);ou("LOOSEPLAIN",`[v=\\s]*${as[ls.MAINVERSIONLOOSE]}${as[ls.PRERELEASELOOSE]}?${as[ls.BUILD]}?`);ou("LOOSE",`^${as[ls.LOOSEPLAIN]}$`);ou("GTLT","((?:<|>)?=?)");ou("XRANGEIDENTIFIERLOOSE",`${as[ls.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);ou("XRANGEIDENTIFIER",`${as[ls.NUMERICIDENTIFIER]}|x|X|\\*`);ou("XRANGEPLAIN",`[v=\\s]*(${as[ls.XRANGEIDENTIFIER]})(?:\\.(${as[ls.XRANGEIDENTIFIER]})(?:\\.(${as[ls.XRANGEIDENTIFIER]})(?:${as[ls.PRERELEASE]})?${as[ls.BUILD]}?)?)?`);ou("XRANGEPLAINLOOSE",`[v=\\s]*(${as[ls.XRANGEIDENTIFIERLOOSE]})(?:\\.(${as[ls.XRANGEIDENTIFIERLOOSE]})(?:\\.(${as[ls.XRANGEIDENTIFIERLOOSE]})(?:${as[ls.PRERELEASELOOSE]})?${as[ls.BUILD]}?)?)?`);ou("XRANGE",`^${as[ls.GTLT]}\\s*${as[ls.XRANGEPLAIN]}$`);ou("XRANGELOOSE",`^${as[ls.GTLT]}\\s*${as[ls.XRANGEPLAINLOOSE]}$`);ou("COERCE",`(^|[^\\d])(\\d{1,${W3r}})(?:\\.(\\d{1,${W3r}}))?(?:\\.(\\d{1,${W3r}}))?(?:$|[^\\d])`);ou("COERCERTL",as[ls.COERCE],!0);ou("LONETILDE","(?:~>?)");ou("TILDETRIM",`(\\s*)${as[ls.LONETILDE]}\\s+`,!0);Rq.tildeTrimReplace="$1~";ou("TILDE",`^${as[ls.LONETILDE]}${as[ls.XRANGEPLAIN]}$`);ou("TILDELOOSE",`^${as[ls.LONETILDE]}${as[ls.XRANGEPLAINLOOSE]}$`);ou("LONECARET","(?:\\^)");ou("CARETTRIM",`(\\s*)${as[ls.LONECARET]}\\s+`,!0);Rq.caretTrimReplace="$1^";ou("CARET",`^${as[ls.LONECARET]}${as[ls.XRANGEPLAIN]}$`);ou("CARETLOOSE",`^${as[ls.LONECARET]}${as[ls.XRANGEPLAINLOOSE]}$`);ou("COMPARATORLOOSE",`^${as[ls.GTLT]}\\s*(${as[ls.LOOSEPLAIN]})$|^$`);ou("COMPARATOR",`^${as[ls.GTLT]}\\s*(${as[ls.FULLPLAIN]})$|^$`);ou("COMPARATORTRIM",`(\\s*)${as[ls.GTLT]}\\s*(${as[ls.LOOSEPLAIN]}|${as[ls.XRANGEPLAIN]})`,!0);Rq.comparatorTrimReplace="$1$2$3";ou("HYPHENRANGE",`^\\s*(${as[ls.XRANGEPLAIN]})\\s+-\\s+(${as[ls.XRANGEPLAIN]})\\s*$`);ou("HYPHENRANGELOOSE",`^\\s*(${as[ls.XRANGEPLAINLOOSE]})\\s+-\\s+(${as[ls.XRANGEPLAINLOOSE]})\\s*$`);ou("STAR","(<|>)?=?\\s*\\*");ou("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");ou("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Tht=I((twd,cui)=>{var NXa=Object.freeze({loose:!0}),PXa=Object.freeze({}),kXa=r=>r?typeof r!="object"?NXa:r:PXa;cui.exports=kXa});var V3r=I((rwd,fui)=>{var dui=/^[0-9]+$/,pui=(r,t)=>{let n=dui.test(r),i=dui.test(t);return n&&i&&(r=+r,t=+t),r===t?0:n&&!i?-1:i&&!n?1:r<t?-1:1},QXa=(r,t)=>pui(t,r);fui.exports={compareIdentifiers:pui,rcompareIdentifiers:QXa}});var VE=I((nwd,mui)=>{var wht=cLe(),{MAX_LENGTH:Aui,MAX_SAFE_INTEGER:Rht}=uLe(),{safeRe:hui,t:gui}=xye(),LXa=Tht(),{compareIdentifiers:Mye}=V3r(),Y3r=class r{constructor(t,n){if(n=LXa(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>Aui)throw new TypeError(`version is longer than ${Aui} characters`);wht("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;let i=t.trim().match(n.loose?hui[gui.LOOSE]:hui[gui.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>Rht||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Rht||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Rht||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<Rht)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(wht("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)),Mye(this.major,t.major)||Mye(this.minor,t.minor)||Mye(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(wht("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 Mye(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(wht("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 Mye(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]),Mye(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}};mui.exports=Y3r});var Hae=I((iwd,Eui)=>{var yui=VE(),FXa=(r,t,n=!1)=>{if(r instanceof yui)return r;try{return new yui(r,t)}catch(i){if(!n)return null;throw i}};Eui.exports=FXa});var Cui=I((owd,bui)=>{var qXa=Hae(),zXa=(r,t)=>{let n=qXa(r,t);return n?n.version:null};bui.exports=zXa});var vui=I((swd,Iui)=>{var UXa=Hae(),jXa=(r,t)=>{let n=UXa(r.trim().replace(/^[=v]+/,""),t);return n?n.version:null};Iui.exports=jXa});var Oui=I((awd,_ui)=>{var Sui=VE(),GXa=(r,t,n,i,o)=>{typeof n=="string"&&(o=i,i=n,n=void 0);try{return new Sui(r instanceof Sui?r.version:r,n).inc(t,i,o).version}catch{return null}};_ui.exports=GXa});var Rui=I((lwd,wui)=>{var Tui=Hae(),WXa=(r,t)=>{let n=Tui(r,null,!0),i=Tui(t,null,!0),o=n.compare(i);if(o===0)return null;let s=o>0,a=s?n:i,l=s?i:n,c=!!a.prerelease.length;if(!!l.prerelease.length&&!c)return!l.patch&&!l.minor?"major":a.patch?"patch":a.minor?"minor":"major";let d=c?"pre":"";return n.major!==i.major?d+"major":n.minor!==i.minor?d+"minor":n.patch!==i.patch?d+"patch":"prerelease"};wui.exports=WXa});var xui=I((uwd,Bui)=>{var HXa=VE(),VXa=(r,t)=>new HXa(r,t).major;Bui.exports=VXa});var Dui=I((cwd,Mui)=>{var YXa=VE(),KXa=(r,t)=>new YXa(r,t).minor;Mui.exports=KXa});var Pui=I((dwd,Nui)=>{var JXa=VE(),XXa=(r,t)=>new JXa(r,t).patch;Nui.exports=XXa});var Qui=I((pwd,kui)=>{var $Xa=Hae(),ZXa=(r,t)=>{let n=$Xa(r,t);return n&&n.prerelease.length?n.prerelease:null};kui.exports=ZXa});var UT=I((fwd,Fui)=>{var Lui=VE(),e$a=(r,t,n)=>new Lui(r,n).compare(new Lui(t,n));Fui.exports=e$a});var zui=I((Awd,qui)=>{var t$a=UT(),r$a=(r,t,n)=>t$a(t,r,n);qui.exports=r$a});var jui=I((hwd,Uui)=>{var n$a=UT(),i$a=(r,t)=>n$a(r,t,!0);Uui.exports=i$a});var Bht=I((gwd,Wui)=>{var Gui=VE(),o$a=(r,t,n)=>{let i=new Gui(r,n),o=new Gui(t,n);return i.compare(o)||i.compareBuild(o)};Wui.exports=o$a});var Vui=I((mwd,Hui)=>{var s$a=Bht(),a$a=(r,t)=>r.sort((n,i)=>s$a(n,i,t));Hui.exports=a$a});var Kui=I((ywd,Yui)=>{var l$a=Bht(),u$a=(r,t)=>r.sort((n,i)=>l$a(i,n,t));Yui.exports=u$a});var dLe=I((Ewd,Jui)=>{var c$a=UT(),d$a=(r,t,n)=>c$a(r,t,n)>0;Jui.exports=d$a});var xht=I((bwd,Xui)=>{var p$a=UT(),f$a=(r,t,n)=>p$a(r,t,n)<0;Xui.exports=f$a});var K3r=I((Cwd,$ui)=>{var A$a=UT(),h$a=(r,t,n)=>A$a(r,t,n)===0;$ui.exports=h$a});var J3r=I((Iwd,Zui)=>{var g$a=UT(),m$a=(r,t,n)=>g$a(r,t,n)!==0;Zui.exports=m$a});var Mht=I((vwd,eci)=>{var y$a=UT(),E$a=(r,t,n)=>y$a(r,t,n)>=0;eci.exports=E$a});var Dht=I((Swd,tci)=>{var b$a=UT(),C$a=(r,t,n)=>b$a(r,t,n)<=0;tci.exports=C$a});var X3r=I((_wd,rci)=>{var I$a=K3r(),v$a=J3r(),S$a=dLe(),_$a=Mht(),O$a=xht(),T$a=Dht(),w$a=(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 I$a(r,n,i);case"!=":return v$a(r,n,i);case">":return S$a(r,n,i);case">=":return _$a(r,n,i);case"<":return O$a(r,n,i);case"<=":return T$a(r,n,i);default:throw new TypeError(`Invalid operator: ${t}`)}};rci.exports=w$a});var ici=I((Owd,nci)=>{var R$a=VE(),B$a=Hae(),{safeRe:Nht,t:Pht}=xye(),x$a=(r,t)=>{if(r instanceof R$a)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(Nht[Pht.COERCE]);else{let i;for(;(i=Nht[Pht.COERCERTL].exec(r))&&(!n||n.index+n[0].length!==r.length);)(!n||i.index+i[0].length!==n.index+n[0].length)&&(n=i),Nht[Pht.COERCERTL].lastIndex=i.index+i[1].length+i[2].length;Nht[Pht.COERCERTL].lastIndex=-1}return n===null?null:B$a(`${n[2]}.${n[3]||"0"}.${n[4]||"0"}`,t)};nci.exports=x$a});var sci=I((Twd,oci)=>{"use strict";oci.exports=function(r){r.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}});var $3r=I((wwd,aci)=>{"use strict";aci.exports=l0;l0.Node=Vae;l0.create=l0;function l0(r){var t=this;if(t instanceof l0||(t=new l0),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}l0.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};l0.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++}};l0.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++}};l0.prototype.push=function(){for(var r=0,t=arguments.length;r<t;r++)D$a(this,arguments[r]);return this.length};l0.prototype.unshift=function(){for(var r=0,t=arguments.length;r<t;r++)N$a(this,arguments[r]);return this.length};l0.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}};l0.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}};l0.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};l0.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};l0.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};l0.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};l0.prototype.map=function(r,t){t=t||this;for(var n=new l0,i=this.head;i!==null;)n.push(r.call(t,i.value,this)),i=i.next;return n};l0.prototype.mapReverse=function(r,t){t=t||this;for(var n=new l0,i=this.tail;i!==null;)n.push(r.call(t,i.value,this)),i=i.prev;return n};l0.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};l0.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};l0.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};l0.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};l0.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 l0;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};l0.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 l0;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};l0.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=M$a(this,o,n[i]);return s};l0.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 M$a(r,t,n){var i=t===r.head?new Vae(n,null,t,r):new Vae(n,t,t.next,r);return i.next===null&&(r.tail=i),i.prev===null&&(r.head=i),r.length++,i}function D$a(r,t){r.tail=new Vae(t,r.tail,null,r),r.head||(r.head=r.tail),r.length++}function N$a(r,t){r.head=new Vae(t,null,r.head,r),r.tail||(r.tail=r.head),r.length++}function Vae(r,t,n,i){if(!(this instanceof Vae))return new Vae(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{sci()(l0)}catch{}});var Pye=I((Rwd,dci)=>{"use strict";var P$a=$3r(),Yae=Symbol("max"),xq=Symbol("length"),Dye=Symbol("lengthCalculator"),fLe=Symbol("allowStale"),Kae=Symbol("maxAge"),Bq=Symbol("dispose"),lci=Symbol("noDisposeOnSet"),B2=Symbol("lruList"),i8=Symbol("cache"),cci=Symbol("updateAgeOnGet"),Z3r=()=>1,tEr=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[Yae]=t.max||1/0,i=t.length||Z3r;if(this[Dye]=typeof i!="function"?Z3r:i,this[fLe]=t.stale||!1,t.maxAge&&typeof t.maxAge!="number")throw new TypeError("maxAge must be a number");this[Kae]=t.maxAge||0,this[Bq]=t.dispose,this[lci]=t.noDisposeOnSet||!1,this[cci]=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[Yae]=t||1/0,pLe(this)}get max(){return this[Yae]}set allowStale(t){this[fLe]=!!t}get allowStale(){return this[fLe]}set maxAge(t){if(typeof t!="number")throw new TypeError("maxAge must be a non-negative number");this[Kae]=t,pLe(this)}get maxAge(){return this[Kae]}set lengthCalculator(t){typeof t!="function"&&(t=Z3r),t!==this[Dye]&&(this[Dye]=t,this[xq]=0,this[B2].forEach(n=>{n.length=this[Dye](n.value,n.key),this[xq]+=n.length})),pLe(this)}get lengthCalculator(){return this[Dye]}get length(){return this[xq]}get itemCount(){return this[B2].length}rforEach(t,n){n=n||this;for(let i=this[B2].tail;i!==null;){let o=i.prev;uci(this,t,i,n),i=o}}forEach(t,n){n=n||this;for(let i=this[B2].head;i!==null;){let o=i.next;uci(this,t,i,n),i=o}}keys(){return this[B2].toArray().map(t=>t.key)}values(){return this[B2].toArray().map(t=>t.value)}reset(){this[Bq]&&this[B2]&&this[B2].length&&this[B2].forEach(t=>this[Bq](t.key,t.value)),this[i8]=new Map,this[B2]=new P$a,this[xq]=0}dump(){return this[B2].map(t=>kht(this,t)?!1:{k:t.key,v:t.value,e:t.now+(t.maxAge||0)}).toArray().filter(t=>t)}dumpLru(){return this[B2]}set(t,n,i){if(i=i||this[Kae],i&&typeof i!="number")throw new TypeError("maxAge must be a number");let o=i?Date.now():0,s=this[Dye](n,t);if(this[i8].has(t)){if(s>this[Yae])return Nye(this,this[i8].get(t)),!1;let c=this[i8].get(t).value;return this[Bq]&&(this[lci]||this[Bq](t,c.value)),c.now=o,c.maxAge=i,c.value=n,this[xq]+=s-c.length,c.length=s,this.get(t),pLe(this),!0}let a=new rEr(t,n,s,o,i);return a.length>this[Yae]?(this[Bq]&&this[Bq](t,n),!1):(this[xq]+=a.length,this[B2].unshift(a),this[i8].set(t,this[B2].head),pLe(this),!0)}has(t){if(!this[i8].has(t))return!1;let n=this[i8].get(t).value;return!kht(this,n)}get(t){return eEr(this,t,!0)}peek(t){return eEr(this,t,!1)}pop(){let t=this[B2].tail;return t?(Nye(this,t),t.value):null}del(t){Nye(this,this[i8].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[i8].forEach((t,n)=>eEr(this,n,!1))}},eEr=(r,t,n)=>{let i=r[i8].get(t);if(i){let o=i.value;if(kht(r,o)){if(Nye(r,i),!r[fLe])return}else n&&(r[cci]&&(i.value.now=Date.now()),r[B2].unshiftNode(i));return o.value}},kht=(r,t)=>{if(!t||!t.maxAge&&!r[Kae])return!1;let n=Date.now()-t.now;return t.maxAge?n>t.maxAge:r[Kae]&&n>r[Kae]},pLe=r=>{if(r[xq]>r[Yae])for(let t=r[B2].tail;r[xq]>r[Yae]&&t!==null;){let n=t.prev;Nye(r,t),t=n}},Nye=(r,t)=>{if(t){let n=t.value;r[Bq]&&r[Bq](n.key,n.value),r[xq]-=n.length,r[i8].delete(n.key),r[B2].removeNode(t)}},rEr=class{constructor(t,n,i,o,s){this.key=t,this.value=n,this.length=i,this.now=o,this.maxAge=s||0}},uci=(r,t,n,i)=>{let o=n.value;kht(r,o)&&(Nye(r,n),r[fLe]||(o=void 0)),o&&t.call(i,o.value,o.key,r)};dci.exports=tEr});var jT=I((Bwd,hci)=>{var nEr=class r{constructor(t,n){if(n=Q$a(n),t instanceof r)return t.loose===!!n.loose&&t.includePrerelease===!!n.includePrerelease?t:new r(t.raw,n);if(t instanceof iEr)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=>!fci(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&&G$a(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&&U$a)|(this.options.loose&&j$a))+":"+t,o=pci.get(i);if(o)return o;let s=this.options.loose,a=s?kv[kC.HYPHENRANGELOOSE]:kv[kC.HYPHENRANGE];t=t.replace(a,eZa(this.options.includePrerelease)),y1("hyphen replace",t),t=t.replace(kv[kC.COMPARATORTRIM],F$a),y1("comparator trim",t),t=t.replace(kv[kC.TILDETRIM],q$a),y1("tilde trim",t),t=t.replace(kv[kC.CARETTRIM],z$a),y1("caret trim",t);let l=t.split(" ").map(p=>W$a(p,this.options)).join(" ").split(/\s+/).map(p=>Z$a(p,this.options));s&&(l=l.filter(p=>(y1("loose invalid filter",p,this.options),!!p.match(kv[kC.COMPARATORLOOSE])))),y1("range list",l);let c=new Map,u=l.map(p=>new iEr(p,this.options));for(let p of u){if(fci(p))return[p];c.set(p.value,p)}c.size>1&&c.has("")&&c.delete("");let d=[...c.values()];return pci.set(i,d),d}intersects(t,n){if(!(t instanceof r))throw new TypeError("a Range is required");return this.set.some(i=>Aci(i,n)&&t.set.some(o=>Aci(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 L$a(t,this.options)}catch{return!1}for(let n=0;n<this.set.length;n++)if(tZa(this.set[n],t,this.options))return!0;return!1}};hci.exports=nEr;var k$a=Pye(),pci=new k$a({max:1e3}),Q$a=Tht(),iEr=ALe(),y1=cLe(),L$a=VE(),{safeRe:kv,t:kC,comparatorTrimReplace:F$a,tildeTrimReplace:q$a,caretTrimReplace:z$a}=xye(),{FLAG_INCLUDE_PRERELEASE:U$a,FLAG_LOOSE:j$a}=uLe(),fci=r=>r.value==="<0.0.0-0",G$a=r=>r.value==="",Aci=(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},W$a=(r,t)=>(y1("comp",r,t),r=Y$a(r,t),y1("caret",r),r=H$a(r,t),y1("tildes",r),r=J$a(r,t),y1("xrange",r),r=$$a(r,t),y1("stars",r),r),QC=r=>!r||r.toLowerCase()==="x"||r==="*",H$a=(r,t)=>r.trim().split(/\s+/).map(n=>V$a(n,t)).join(" "),V$a=(r,t)=>{let n=t.loose?kv[kC.TILDELOOSE]:kv[kC.TILDE];return r.replace(n,(i,o,s,a,l)=>{y1("tilde",r,i,o,s,a,l);let c;return QC(o)?c="":QC(s)?c=`>=${o}.0.0 <${+o+1}.0.0-0`:QC(a)?c=`>=${o}.${s}.0 <${o}.${+s+1}.0-0`:l?(y1("replaceTilde pr",l),c=`>=${o}.${s}.${a}-${l} <${o}.${+s+1}.0-0`):c=`>=${o}.${s}.${a} <${o}.${+s+1}.0-0`,y1("tilde return",c),c})},Y$a=(r,t)=>r.trim().split(/\s+/).map(n=>K$a(n,t)).join(" "),K$a=(r,t)=>{y1("caret",r,t);let n=t.loose?kv[kC.CARETLOOSE]:kv[kC.CARET],i=t.includePrerelease?"-0":"";return r.replace(n,(o,s,a,l,c)=>{y1("caret",r,o,s,a,l,c);let u;return QC(s)?u="":QC(a)?u=`>=${s}.0.0${i} <${+s+1}.0.0-0`:QC(l)?s==="0"?u=`>=${s}.${a}.0${i} <${s}.${+a+1}.0-0`:u=`>=${s}.${a}.0${i} <${+s+1}.0.0-0`:c?(y1("replaceCaret pr",c),s==="0"?a==="0"?u=`>=${s}.${a}.${l}-${c} <${s}.${a}.${+l+1}-0`:u=`>=${s}.${a}.${l}-${c} <${s}.${+a+1}.0-0`:u=`>=${s}.${a}.${l}-${c} <${+s+1}.0.0-0`):(y1("no pr"),s==="0"?a==="0"?u=`>=${s}.${a}.${l}${i} <${s}.${a}.${+l+1}-0`:u=`>=${s}.${a}.${l}${i} <${s}.${+a+1}.0-0`:u=`>=${s}.${a}.${l} <${+s+1}.0.0-0`),y1("caret return",u),u})},J$a=(r,t)=>(y1("replaceXRanges",r,t),r.split(/\s+/).map(n=>X$a(n,t)).join(" ")),X$a=(r,t)=>{r=r.trim();let n=t.loose?kv[kC.XRANGELOOSE]:kv[kC.XRANGE];return r.replace(n,(i,o,s,a,l,c)=>{y1("xRange",r,i,o,s,a,l,c);let u=QC(s),d=u||QC(a),p=d||QC(l),f=p;return o==="="&&f&&(o=""),c=t.includePrerelease?"-0":"",u?o===">"||o==="<"?i="<0.0.0-0":i="*":o&&f?(d&&(a=0),l=0,o===">"?(o=">=",d?(s=+s+1,a=0,l=0):(a=+a+1,l=0)):o==="<="&&(o="<",d?s=+s+1:a=+a+1),o==="<"&&(c="-0"),i=`${o+s}.${a}.${l}${c}`):d?i=`>=${s}.0.0${c} <${+s+1}.0.0-0`:p&&(i=`>=${s}.${a}.0${c} <${s}.${+a+1}.0-0`),y1("xRange return",i),i})},$$a=(r,t)=>(y1("replaceStars",r,t),r.trim().replace(kv[kC.STAR],"")),Z$a=(r,t)=>(y1("replaceGTE0",r,t),r.trim().replace(kv[t.includePrerelease?kC.GTE0PRE:kC.GTE0],"")),eZa=r=>(t,n,i,o,s,a,l,c,u,d,p,f,A)=>(QC(i)?n="":QC(o)?n=`>=${i}.0.0${r?"-0":""}`:QC(s)?n=`>=${i}.${o}.0${r?"-0":""}`:a?n=`>=${n}`:n=`>=${n}${r?"-0":""}`,QC(u)?c="":QC(d)?c=`<${+u+1}.0.0-0`:QC(p)?c=`<${u}.${+d+1}.0-0`:f?c=`<=${u}.${d}.${p}-${f}`:r?c=`<${u}.${d}.${+p+1}-0`:c=`<=${c}`,`${n} ${c}`.trim()),tZa=(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(y1(r[i].semver),r[i].semver!==iEr.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 ALe=I((xwd,Cci)=>{var hLe=Symbol("SemVer ANY"),aEr=class r{static get ANY(){return hLe}constructor(t,n){if(n=gci(n),t instanceof r){if(t.loose===!!n.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),sEr("comparator",t,n),this.options=n,this.loose=!!n.loose,this.parse(t),this.semver===hLe?this.value="":this.value=this.operator+this.semver.version,sEr("comp",this)}parse(t){let n=this.options.loose?mci[yci.COMPARATORLOOSE]:mci[yci.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 Eci(i[2],this.options.loose):this.semver=hLe}toString(){return this.value}test(t){if(sEr("Comparator.test",t,this.options.loose),this.semver===hLe||t===hLe)return!0;if(typeof t=="string")try{t=new Eci(t,this.options)}catch{return!1}return oEr(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 bci(t.value,n).test(this.value):t.operator===""?t.value===""?!0:new bci(this.value,n).test(t.semver):(n=gci(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("=")||oEr(this.semver,"<",t.semver,n)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||oEr(this.semver,">",t.semver,n)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};Cci.exports=aEr;var gci=Tht(),{safeRe:mci,t:yci}=xye(),oEr=X3r(),sEr=cLe(),Eci=VE(),bci=jT()});var gLe=I((Mwd,Ici)=>{var rZa=jT(),nZa=(r,t,n)=>{try{t=new rZa(t,n)}catch{return!1}return t.test(r)};Ici.exports=nZa});var Sci=I((Dwd,vci)=>{var iZa=jT(),oZa=(r,t)=>new iZa(r,t).set.map(n=>n.map(i=>i.value).join(" ").trim().split(" "));vci.exports=oZa});var Oci=I((Nwd,_ci)=>{var sZa=VE(),aZa=jT(),lZa=(r,t,n)=>{let i=null,o=null,s=null;try{s=new aZa(t,n)}catch{return null}return r.forEach(a=>{s.test(a)&&(!i||o.compare(a)===-1)&&(i=a,o=new sZa(i,n))}),i};_ci.exports=lZa});var wci=I((Pwd,Tci)=>{var uZa=VE(),cZa=jT(),dZa=(r,t,n)=>{let i=null,o=null,s=null;try{s=new cZa(t,n)}catch{return null}return r.forEach(a=>{s.test(a)&&(!i||o.compare(a)===1)&&(i=a,o=new uZa(i,n))}),i};Tci.exports=dZa});var xci=I((kwd,Bci)=>{var lEr=VE(),pZa=jT(),Rci=dLe(),fZa=(r,t)=>{r=new pZa(r,t);let n=new lEr("0.0.0");if(r.test(n)||(n=new lEr("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 l=new lEr(a.semver.version);switch(a.operator){case">":l.prerelease.length===0?l.patch++:l.prerelease.push(0),l.raw=l.format();case"":case">=":(!s||Rci(l,s))&&(s=l);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),s&&(!n||Rci(n,s))&&(n=s)}return n&&r.test(n)?n:null};Bci.exports=fZa});var Dci=I((Qwd,Mci)=>{var AZa=jT(),hZa=(r,t)=>{try{return new AZa(r,t).range||"*"}catch{return null}};Mci.exports=hZa});var Qht=I((Lwd,Qci)=>{var gZa=VE(),kci=ALe(),{ANY:mZa}=kci,yZa=jT(),EZa=gLe(),Nci=dLe(),Pci=xht(),bZa=Dht(),CZa=Mht(),IZa=(r,t,n,i)=>{r=new gZa(r,i),t=new yZa(t,i);let o,s,a,l,c;switch(n){case">":o=Nci,s=bZa,a=Pci,l=">",c=">=";break;case"<":o=Pci,s=CZa,a=Nci,l="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(EZa(r,t,i))return!1;for(let u=0;u<t.set.length;++u){let d=t.set[u],p=null,f=null;if(d.forEach(A=>{A.semver===mZa&&(A=new kci(">=0.0.0")),p=p||A,f=f||A,o(A.semver,p.semver,i)?p=A:a(A.semver,f.semver,i)&&(f=A)}),p.operator===l||p.operator===c||(!f.operator||f.operator===l)&&s(r,f.semver))return!1;if(f.operator===c&&a(r,f.semver))return!1}return!0};Qci.exports=IZa});var Fci=I((Fwd,Lci)=>{var vZa=Qht(),SZa=(r,t,n)=>vZa(r,t,">",n);Lci.exports=SZa});var zci=I((qwd,qci)=>{var _Za=Qht(),OZa=(r,t,n)=>_Za(r,t,"<",n);qci.exports=OZa});var Gci=I((zwd,jci)=>{var Uci=jT(),TZa=(r,t,n)=>(r=new Uci(r,n),t=new Uci(t,n),r.intersects(t,n));jci.exports=TZa});var Hci=I((Uwd,Wci)=>{var wZa=gLe(),RZa=UT();Wci.exports=(r,t,n)=>{let i=[],o=null,s=null,a=r.sort((d,p)=>RZa(d,p,n));for(let d of a)wZa(d,t,n)?(s=d,o||(o=d)):(s&&i.push([o,s]),s=null,o=null);o&&i.push([o,null]);let l=[];for(let[d,p]of i)d===p?l.push(d):!p&&d===a[0]?l.push("*"):p?d===a[0]?l.push(`<=${p}`):l.push(`${d} - ${p}`):l.push(`>=${d}`);let c=l.join(" || "),u=typeof t.raw=="string"?t.raw:String(t);return c.length<u.length?c:t}});var $ci=I((jwd,Xci)=>{var Vci=jT(),cEr=ALe(),{ANY:uEr}=cEr,mLe=gLe(),dEr=UT(),BZa=(r,t,n={})=>{if(r===t)return!0;r=new Vci(r,n),t=new Vci(t,n);let i=!1;e:for(let o of r.set){for(let s of t.set){let a=MZa(o,s,n);if(i=i||a!==null,a)continue e}if(i)return!1}return!0},xZa=[new cEr(">=0.0.0-0")],Yci=[new cEr(">=0.0.0")],MZa=(r,t,n)=>{if(r===t)return!0;if(r.length===1&&r[0].semver===uEr){if(t.length===1&&t[0].semver===uEr)return!0;n.includePrerelease?r=xZa:r=Yci}if(t.length===1&&t[0].semver===uEr){if(n.includePrerelease)return!0;t=Yci}let i=new Set,o,s;for(let A of r)A.operator===">"||A.operator===">="?o=Kci(o,A,n):A.operator==="<"||A.operator==="<="?s=Jci(s,A,n):i.add(A.semver);if(i.size>1)return null;let a;if(o&&s){if(a=dEr(o.semver,s.semver,n),a>0)return null;if(a===0&&(o.operator!==">="||s.operator!=="<="))return null}for(let A of i){if(o&&!mLe(A,String(o),n)||s&&!mLe(A,String(s),n))return null;for(let h of t)if(!mLe(A,String(h),n))return!1;return!0}let l,c,u,d,p=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1,f=o&&!n.includePrerelease&&o.semver.prerelease.length?o.semver:!1;p&&p.prerelease.length===1&&s.operator==="<"&&p.prerelease[0]===0&&(p=!1);for(let A of t){if(d=d||A.operator===">"||A.operator===">=",u=u||A.operator==="<"||A.operator==="<=",o){if(f&&A.semver.prerelease&&A.semver.prerelease.length&&A.semver.major===f.major&&A.semver.minor===f.minor&&A.semver.patch===f.patch&&(f=!1),A.operator===">"||A.operator===">="){if(l=Kci(o,A,n),l===A&&l!==o)return!1}else if(o.operator===">="&&!mLe(o.semver,String(A),n))return!1}if(s){if(p&&A.semver.prerelease&&A.semver.prerelease.length&&A.semver.major===p.major&&A.semver.minor===p.minor&&A.semver.patch===p.patch&&(p=!1),A.operator==="<"||A.operator==="<="){if(c=Jci(s,A,n),c===A&&c!==s)return!1}else if(s.operator==="<="&&!mLe(s.semver,String(A),n))return!1}if(!A.operator&&(s||o)&&a!==0)return!1}return!(o&&u&&!s&&a!==0||s&&d&&!o&&a!==0||f||p)},Kci=(r,t,n)=>{if(!r)return t;let i=dEr(r.semver,t.semver,n);return i>0?r:i<0||t.operator===">"&&r.operator===">="?t:r},Jci=(r,t,n)=>{if(!r)return t;let i=dEr(r.semver,t.semver,n);return i<0?r:i>0||t.operator==="<"&&r.operator==="<="?t:r};Xci.exports=BZa});var kye=I((Gwd,t0i)=>{var pEr=xye(),Zci=uLe(),DZa=VE(),e0i=V3r(),NZa=Hae(),PZa=Cui(),kZa=vui(),QZa=Oui(),LZa=Rui(),FZa=xui(),qZa=Dui(),zZa=Pui(),UZa=Qui(),jZa=UT(),GZa=zui(),WZa=jui(),HZa=Bht(),VZa=Vui(),YZa=Kui(),KZa=dLe(),JZa=xht(),XZa=K3r(),$Za=J3r(),ZZa=Mht(),eel=Dht(),tel=X3r(),rel=ici(),nel=ALe(),iel=jT(),oel=gLe(),sel=Sci(),ael=Oci(),lel=wci(),uel=xci(),cel=Dci(),del=Qht(),pel=Fci(),fel=zci(),Ael=Gci(),hel=Hci(),gel=$ci();t0i.exports={parse:NZa,valid:PZa,clean:kZa,inc:QZa,diff:LZa,major:FZa,minor:qZa,patch:zZa,prerelease:UZa,compare:jZa,rcompare:GZa,compareLoose:WZa,compareBuild:HZa,sort:VZa,rsort:YZa,gt:KZa,lt:JZa,eq:XZa,neq:$Za,gte:ZZa,lte:eel,cmp:tel,coerce:rel,Comparator:nel,Range:iel,satisfies:oel,toComparators:sel,maxSatisfying:ael,minSatisfying:lel,minVersion:uel,validRange:cel,outside:del,gtr:pel,ltr:fel,intersects:Ael,simplifyRange:hel,subset:gel,SemVer:DZa,re:pEr.re,src:pEr.src,tokens:pEr.t,SEMVER_SPEC_VERSION:Zci.SEMVER_SPEC_VERSION,RELEASE_TYPES:Zci.RELEASE_TYPES,compareIdentifiers:e0i.compareIdentifiers,rcompareIdentifiers:e0i.rcompareIdentifiers}});var yLe,mel,Wwd,yel,LC,kV=et(()=>{"use strict";yLe=Ct(f3()),mel=Ct(kye()),Wwd=(0,yLe.Record)({version:yLe.String,hash:yLe.String}),yel=()=>({version:"7.17.1-rc.1",hash:"79a4ede973dd5c65c2d5b8d2e81cb751f2aeb47f"}),LC=yel()});var M_,r0i,ELe,Lht=et(()=>{"use strict";kV();r0i=r=>{M_=r},ELe=r=>({coalesceSoftwareVersion:LC?.version||"",service:r,env:process.env.REACT_APP_OWNER??"",reactAppCoalesceDev:process.env.REACT_APP_COALESCE_DEV??""})});var n0i,i0i,D_,fEr,o0i,s0i,a0i,bLe,AEr,Fht,bel,hEr,Qye,CLe,qht,gEr,l0i,Lye=et(()=>{"use strict";n0i=Ct(MF()),i0i=Ct(Wlt()),D_=Ct(ise());jae();rht();Lht();jl();n8();vr();fEr=null,o0i=r=>{fEr=r},s0i={emerg:"error",assert:"warn",alert:"warn",error:"warn",warn:"warn",app:"info",info:"info",debug:"debug"},a0i={emerg:"emerg",assert:"alert",alert:"alert",error:"error",app:"info",info:"info",warn:"warn",debug:"debug"},bLe=class extends n0i.default{baseContext;constructor(t){super(t),this.baseContext=ELe(M_)}log(t,n){fEr&&fEr.log({...t,level:a0i[t.level]},{...this.baseContext,...p3},s0i[t.level]),n()}},Fht=r=>{let t=ELe(r);AEr={host:"http-intake.logs.datadoghq.com",path:`/v1/input/pub04bd017317b60c96b62874179d82ff97?ddtags=env:${t.env},coalesceSoftwareVersion:${t.coalesceSoftwareVersion}&ddsource=nodejs&service=${r}`,ssl:!0}},bel=!1,hEr=()=>D_.format.combine(D_.format.timestamp(),D_.format.colorize({colors:tht.COLORS}),D_.format.printf(r=>`|${r.timestamp}|${process.env.JEST_WORKER_ID?`[SHARD:${process.env.JEST_WORKER_ID}]`:""}[${r.loggingArea}]${r.orgID?`|(org:${r.orgID})`:""}${r.workspaceID?`|(env:${r.workspaceID})`:""}${r.userID?`|(user:${r.userID})`:""}${r.runID?`|run:${r.runID})`:""}(${r.nodeID?`|(node:${r.nodeID})`:""})|)|${r.level}:${r.message}`)),Qye=r=>new D_.transports.Console({format:process.env.CONSOLE_JSON_LOGS?D_.format.combine(D_.format.timestamp(),D_.format.json()):hEr(),level:r.level,silent:bel}),CLe=class extends i0i.Http{running=0;rejectLogCalls=!1;constructor(){let t={batch:!1,...AEr,format:D_.format.combine(hEr(),D_.format.uncolorize())};super(t),this.on("logged",()=>{this.running-=1}),this.on("warn",()=>{this.running-=1})}log(t,n){if(this.rejectLogCalls)return;let i={...t,level:a0i[t.level],status:s0i[t.level]};this.running+=1,super.log?.(i,n)}async closeAndWait(t){this.rejectLogCalls=!0;let n=async()=>{let i=t>5e3?500:t/100,o=0;for(;o++*i<t;){if(this.running===0)return;await new Promise(s=>setTimeout(s,i))}if(this.running!==0)throw new At("should not be reachable")};this.close&&this.close(),await R2(t,"Close took too long",n())}},qht=()=>new CLe,gEr=()=>new D_.transports.File({filename:process.env.JEST_WORKER_ID?`test-shard-${process.env.JEST_WORKER_ID}.log`:"test.log",dirname:"./test-logs",format:hEr(),level:eht.debug}),l0i=r=>{let t=[];return t.push(Qye(r)),AEr&&t.push(qht()),wu().isTest&&t.push(gEr()),[new bLe,...t]}});var u0i,mEr,yEr,Cel,Iel,ILe,EEr=et(()=>{"use strict";u0i=Ct(ise());Lht();jae();tLe();Lye();jl();mEr=r=>r.includes("production")?"production":r.includes("staging")?"staging":r.includes("qa")?"qa":"development",yEr=()=>{if(d1()){let r=process.env.RUNTIME_ENVIRONMENT||"development";return yzn("coa")?BB()?mEr(r):void 0:mEr(r)}else{let r;try{r=self.ENVIRONMENT}catch{}return typeof r=="string"?mEr(r):void 0}},Cel=()=>{let r=wu();if(r.isTest)return{};let t=yEr();return r.isNode?{firebaseEnv:t}:{windowInfo:{frontendURLHost:self.location.host},firebaseEnv:t}},Iel=r=>{let t=ELe(M_);return{appEnv:Cel(),loggingArea:r,...t}},ILe=r=>{let t=B_[r];if(!t)throw new Error(`Logging area "${r}" is not a valid LoggingAreas key`);return t.logger||(t.logger=u0i.createLogger({levels:tht.LEVELS,defaultMeta:Iel(r),level:t.level,transports:l0i(t)})),t.logger}});var c0i,zht,Uht,bEr,jht,Mq,d0i=et(()=>{"use strict";c0i=Ct(is()),zht=Ct(ise());tLe();Lye();jl();EEr();jae();Ag();Uht=(r,t)=>{let n=r.toUpperCase(),i=[];if(n in B_||i.push(`invalid logging area '${n}'`),eht[t]||i.push("`invalid log level '${logLevel}'`"),i.length)throw i.forEach(l=>{console.error(l)}),new Error("Invalid logging area or log level: "+i.join(", "));let o=ILe(n),s=o.transports.filter(l=>l instanceof zht.transports.Console),a=o.transports;s.length||(a=[...a,Qye(B_[n])]),a.filter(l=>l instanceof zht.transports.Console)[0].level=t,o.configure({...o,transports:o.transports})},bEr=()=>{Object.keys(B_).forEach(r=>{Uht(r,"debug")})},jht=(r,t)=>{for(let n in r){let i=n,o=ILe(i);r[i].defaultMeta={...o.defaultMeta,...r[i].defaultMeta,...t};let s=r[i].transports||o.transports,a;if(wu().isTest&&s.length>0){let l=s[s.length-1];l instanceof zht.transports.File&&(a=l,s=o.transports.slice(0,-1),s.push(gEr()))}o.configure({...o,...r[i],transports:s,level:r[i].level||o.level}),a&&a.close&&a.close()}},Mq=r=>{let t=c0i.default.mapValues(B_,(n,i)=>({}));jht(t,r)}});function vLe(r,t){return function(){return r.apply(t,arguments)}}var CEr=et(()=>{"use strict"});function Sel(r){return r!==null&&!SLe(r)&&r.constructor!==null&&!SLe(r.constructor)&&N_(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}function _el(r){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(r):t=r&&r.buffer&&A0i(r.buffer),t}function _Le(r,t,{allOwnKeys:n=!1}={}){if(r===null||typeof r>"u")return;let i,o;if(typeof r!="object"&&(r=[r]),Fye(r))for(i=0,o=r.length;i<o;i++)t.call(null,r[i],i,r);else{let s=n?Object.getOwnPropertyNames(r):Object.keys(r),a=s.length,l;for(i=0;i<a;i++)l=s[i],t.call(null,r[l],l,r)}}function g0i(r,t){t=t.toLowerCase();let n=Object.keys(r),i=n.length,o;for(;i-- >0;)if(o=n[i],t===o.toLowerCase())return o;return null}function vEr(){let{caseless:r}=m0i(this)&&this||{},t={},n=(i,o)=>{let s=r&&g0i(t,o)||o;Ght(t[s])&&Ght(i)?t[s]=vEr(t[s],i):Ght(i)?t[s]=vEr({},i):Fye(i)?t[s]=i.slice():t[s]=i};for(let i=0,o=arguments.length;i<o;i++)arguments[i]&&_Le(arguments[i],n);return t}function ntl(r){return!!(r&&N_(r.append)&&r[Symbol.toStringTag]==="FormData"&&r[Symbol.iterator])}var vel,SEr,Wht,o8,Hht,Fye,SLe,A0i,Oel,N_,h0i,Vht,Tel,Ght,wel,Rel,Bel,xel,Mel,Del,Nel,Pel,kel,Qel,Lel,Fel,Jae,m0i,qel,zel,Uel,jel,Gel,Wel,Hel,Vel,Yel,Kel,Jel,p0i,Xel,y0i,$el,Zel,etl,ttl,IEr,f0i,E0i,rtl,itl,otl,stl,b0i,atl,er,Bd=et(()=>{"use strict";CEr();({toString:vel}=Object.prototype),{getPrototypeOf:SEr}=Object,Wht=(r=>t=>{let n=vel.call(t);return r[n]||(r[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),o8=r=>(r=r.toLowerCase(),t=>Wht(t)===r),Hht=r=>t=>typeof t===r,{isArray:Fye}=Array,SLe=Hht("undefined");A0i=o8("ArrayBuffer");Oel=Hht("string"),N_=Hht("function"),h0i=Hht("number"),Vht=r=>r!==null&&typeof r=="object",Tel=r=>r===!0||r===!1,Ght=r=>{if(Wht(r)!=="object")return!1;let t=SEr(r);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)},wel=o8("Date"),Rel=o8("File"),Bel=o8("Blob"),xel=o8("FileList"),Mel=r=>Vht(r)&&N_(r.pipe),Del=r=>{let t;return r&&(typeof FormData=="function"&&r instanceof FormData||N_(r.append)&&((t=Wht(r))==="formdata"||t==="object"&&N_(r.toString)&&r.toString()==="[object FormData]"))},Nel=o8("URLSearchParams"),[Pel,kel,Qel,Lel]=["ReadableStream","Request","Response","Headers"].map(o8),Fel=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");Jae=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,m0i=r=>!SLe(r)&&r!==Jae;qel=(r,t,n,{allOwnKeys:i}={})=>(_Le(t,(o,s)=>{n&&N_(o)?r[s]=vLe(o,n):r[s]=o},{allOwnKeys:i}),r),zel=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),Uel=(r,t,n,i)=>{r.prototype=Object.create(t.prototype,i),r.prototype.constructor=r,Object.defineProperty(r,"super",{value:t.prototype}),n&&Object.assign(r.prototype,n)},jel=(r,t,n,i)=>{let o,s,a,l={};if(t=t||{},r==null)return t;do{for(o=Object.getOwnPropertyNames(r),s=o.length;s-- >0;)a=o[s],(!i||i(a,r,t))&&!l[a]&&(t[a]=r[a],l[a]=!0);r=n!==!1&&SEr(r)}while(r&&(!n||n(r,t))&&r!==Object.prototype);return t},Gel=(r,t,n)=>{r=String(r),(n===void 0||n>r.length)&&(n=r.length),n-=t.length;let i=r.indexOf(t,n);return i!==-1&&i===n},Wel=r=>{if(!r)return null;if(Fye(r))return r;let t=r.length;if(!h0i(t))return null;let n=new Array(t);for(;t-- >0;)n[t]=r[t];return n},Hel=(r=>t=>r&&t instanceof r)(typeof Uint8Array<"u"&&SEr(Uint8Array)),Vel=(r,t)=>{let i=(r&&r[Symbol.iterator]).call(r),o;for(;(o=i.next())&&!o.done;){let s=o.value;t.call(r,s[0],s[1])}},Yel=(r,t)=>{let n,i=[];for(;(n=r.exec(t))!==null;)i.push(n);return i},Kel=o8("HTMLFormElement"),Jel=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,i,o){return i.toUpperCase()+o}),p0i=(({hasOwnProperty:r})=>(t,n)=>r.call(t,n))(Object.prototype),Xel=o8("RegExp"),y0i=(r,t)=>{let n=Object.getOwnPropertyDescriptors(r),i={};_Le(n,(o,s)=>{let a;(a=t(o,s,r))!==!1&&(i[s]=a||o)}),Object.defineProperties(r,i)},$el=r=>{y0i(r,(t,n)=>{if(N_(r)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;let i=r[n];if(N_(i)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Zel=(r,t)=>{let n={},i=o=>{o.forEach(s=>{n[s]=!0})};return Fye(r)?i(r):i(String(r).split(t)),n},etl=()=>{},ttl=(r,t)=>r!=null&&Number.isFinite(r=+r)?r:t,IEr="abcdefghijklmnopqrstuvwxyz",f0i="0123456789",E0i={DIGIT:f0i,ALPHA:IEr,ALPHA_DIGIT:IEr+IEr.toUpperCase()+f0i},rtl=(r=16,t=E0i.ALPHA_DIGIT)=>{let n="",{length:i}=t;for(;r--;)n+=t[Math.random()*i|0];return n};itl=r=>{let t=new Array(10),n=(i,o)=>{if(Vht(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[o]=i;let s=Fye(i)?[]:{};return _Le(i,(a,l)=>{let c=n(a,o+1);!SLe(c)&&(s[l]=c)}),t[o]=void 0,s}}return i};return n(r,0)},otl=o8("AsyncFunction"),stl=r=>r&&(Vht(r)||N_(r))&&N_(r.then)&&N_(r.catch),b0i=((r,t)=>r?setImmediate:t?((n,i)=>(Jae.addEventListener("message",({source:o,data:s})=>{o===Jae&&s===n&&i.length&&i.shift()()},!1),o=>{i.push(o),Jae.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",N_(Jae.postMessage)),atl=typeof queueMicrotask<"u"?queueMicrotask.bind(Jae):typeof process<"u"&&process.nextTick||b0i,er={isArray:Fye,isArrayBuffer:A0i,isBuffer:Sel,isFormData:Del,isArrayBufferView:_el,isString:Oel,isNumber:h0i,isBoolean:Tel,isObject:Vht,isPlainObject:Ght,isReadableStream:Pel,isRequest:kel,isResponse:Qel,isHeaders:Lel,isUndefined:SLe,isDate:wel,isFile:Rel,isBlob:Bel,isRegExp:Xel,isFunction:N_,isStream:Mel,isURLSearchParams:Nel,isTypedArray:Hel,isFileList:xel,forEach:_Le,merge:vEr,extend:qel,trim:Fel,stripBOM:zel,inherits:Uel,toFlatObject:jel,kindOf:Wht,kindOfTest:o8,endsWith:Gel,toArray:Wel,forEachEntry:Vel,matchAll:Yel,isHTMLForm:Kel,hasOwnProperty:p0i,hasOwnProp:p0i,reduceDescriptors:y0i,freezeMethods:$el,toObjectSet:Zel,toCamelCase:Jel,noop:etl,toFiniteNumber:ttl,findKey:g0i,global:Jae,isContextDefined:m0i,ALPHABET:E0i,generateString:rtl,isSpecCompliantForm:ntl,toJSONObject:itl,isAsyncFn:otl,isThenable:stl,setImmediate:b0i,asap:atl}});function qye(r,t,n,i,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=r,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),i&&(this.request=i),o&&(this.response=o,this.status=o.status?o.status:null)}var C0i,I0i,so,P_=et(()=>{"use strict";Bd();er.inherits(qye,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:er.toJSONObject(this.config),code:this.code,status:this.status}}});C0i=qye.prototype,I0i={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(r=>{I0i[r]={value:r}});Object.defineProperties(qye,I0i);Object.defineProperty(C0i,"isAxiosError",{value:!0});qye.from=(r,t,n,i,o,s)=>{let a=Object.create(C0i);return er.toFlatObject(r,a,function(c){return c!==Error.prototype},l=>l!=="isAxiosError"),qye.call(a,r.message,t,n,i,o),a.cause=r,a.name=r.name,s&&Object.assign(a,s),a};so=qye});var v0i,Yht,_Er=et(()=>{v0i=Ct(ENe(),1),Yht=v0i.default});function OEr(r){return er.isPlainObject(r)||er.isArray(r)}function _0i(r){return er.endsWith(r,"[]")?r.slice(0,-2):r}function S0i(r,t,n){return r?r.concat(t).map(function(o,s){return o=_0i(o),!n&&s?"["+o+"]":o}).join(n?".":""):t}function ltl(r){return er.isArray(r)&&!r.some(OEr)}function ctl(r,t,n){if(!er.isObject(r))throw new TypeError("target must be an object");t=t||new(Yht||FormData),n=er.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,C){return!er.isUndefined(C[y])});let i=n.metaTokens,o=n.visitor||d,s=n.dots,a=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&er.isSpecCompliantForm(t);if(!er.isFunction(o))throw new TypeError("visitor must be a function");function u(h){if(h===null)return"";if(er.isDate(h))return h.toISOString();if(!c&&er.isBlob(h))throw new so("Blob is not supported. Use a Buffer instead.");return er.isArrayBuffer(h)||er.isTypedArray(h)?c&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function d(h,y,C){let v=h;if(h&&!C&&typeof h=="object"){if(er.endsWith(y,"{}"))y=i?y:y.slice(0,-2),h=JSON.stringify(h);else if(er.isArray(h)&&ltl(h)||(er.isFileList(h)||er.endsWith(y,"[]"))&&(v=er.toArray(h)))return y=_0i(y),v.forEach(function(w,R){!(er.isUndefined(w)||w===null)&&t.append(a===!0?S0i([y],R,s):a===null?y:y+"[]",u(w))}),!1}return OEr(h)?!0:(t.append(S0i(C,y,s),u(h)),!1)}let p=[],f=Object.assign(utl,{defaultVisitor:d,convertValue:u,isVisitable:OEr});function A(h,y){if(!er.isUndefined(h)){if(p.indexOf(h)!==-1)throw Error("Circular reference detected in "+y.join("."));p.push(h),er.forEach(h,function(v,O){(!(er.isUndefined(v)||v===null)&&o.call(t,v,er.isString(O)?O.trim():O,y,f))===!0&&A(v,y?y.concat(O):[O])}),p.pop()}}if(!er.isObject(r))throw new TypeError("data must be an object");return A(r),t}var utl,QV,OLe=et(()=>{"use strict";Bd();P_();_Er();utl=er.toFlatObject(er,{},null,function(t){return/^is[A-Z]/.test(t)});QV=ctl});function O0i(r){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function T0i(r,t){this._pairs=[],r&&QV(r,this,t)}var w0i,R0i,B0i=et(()=>{"use strict";OLe();w0i=T0i.prototype;w0i.append=function(t,n){this._pairs.push([t,n])};w0i.toString=function(t){let n=t?function(i){return t.call(this,i,O0i)}:O0i;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};R0i=T0i});function dtl(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Xae(r,t,n){if(!t)return r;let i=n&&n.encode||dtl,o=n&&n.serialize,s;if(o?s=o(t,n):s=er.isURLSearchParams(t)?t.toString():new R0i(t,n).toString(i),s){let a=r.indexOf("#");a!==-1&&(r=r.slice(0,a)),r+=(r.indexOf("?")===-1?"?":"&")+s}return r}var Kht=et(()=>{"use strict";Bd();B0i()});var TEr,wEr,x0i=et(()=>{"use strict";Bd();TEr=class{constructor(){this.handlers=[]}use(t,n,i){return this.handlers.push({fulfilled:t,rejected:n,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){er.forEach(this.handlers,function(i){i!==null&&t(i)})}},wEr=TEr});var zye,Jht=et(()=>{"use strict";zye={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}});var M0i,D0i,N0i=et(()=>{"use strict";M0i=Ct(require("url"),1),D0i=M0i.default.URLSearchParams});var P0i,k0i=et(()=>{N0i();_Er();P0i={isNode:!0,classes:{URLSearchParams:D0i,FormData:Yht,Blob:typeof Blob<"u"&&Blob||null},protocols:["http","https","file","data"]}});var xEr={};ZS(xEr,{hasBrowserEnv:()=>BEr,hasStandardBrowserEnv:()=>ptl,hasStandardBrowserWebWorkerEnv:()=>ftl,navigator:()=>REr,origin:()=>Atl});var BEr,REr,ptl,ftl,Atl,Q0i=et(()=>{BEr=typeof window<"u"&&typeof document<"u",REr=typeof navigator=="object"&&navigator||void 0,ptl=BEr&&(!REr||["ReactNative","NativeScript","NS"].indexOf(REr.product)<0),ftl=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Atl=BEr&&window.location.href||"http://localhost"});var tp,t7=et(()=>{k0i();Q0i();tp={...xEr,...P0i}});function MEr(r,t){return QV(r,new tp.classes.URLSearchParams,Object.assign({visitor:function(n,i,o,s){return tp.isNode&&er.isBuffer(n)?(this.append(i,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}var L0i=et(()=>{"use strict";Bd();OLe();t7()});function htl(r){return er.matchAll(/\w+|\[(\w*)]/g,r).map(t=>t[0]==="[]"?"":t[1]||t[0])}function gtl(r){let t={},n=Object.keys(r),i,o=n.length,s;for(i=0;i<o;i++)s=n[i],t[s]=r[s];return t}function mtl(r){function t(n,i,o,s){let a=n[s++];if(a==="__proto__")return!0;let l=Number.isFinite(+a),c=s>=n.length;return a=!a&&er.isArray(o)?o.length:a,c?(er.hasOwnProp(o,a)?o[a]=[o[a],i]:o[a]=i,!l):((!o[a]||!er.isObject(o[a]))&&(o[a]=[]),t(n,i,o[a],s)&&er.isArray(o[a])&&(o[a]=gtl(o[a])),!l)}if(er.isFormData(r)&&er.isFunction(r.entries)){let n={};return er.forEachEntry(r,(i,o)=>{t(htl(i),o,n,0)}),n}return null}var Xht,DEr=et(()=>{"use strict";Bd();Xht=mtl});function ytl(r,t,n){if(er.isString(r))try{return(t||JSON.parse)(r),er.trim(r)}catch(i){if(i.name!=="SyntaxError")throw i}return(n||JSON.stringify)(r)}var NEr,Uye,$ht=et(()=>{"use strict";Bd();P_();Jht();OLe();L0i();t7();DEr();NEr={transitional:zye,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){let i=n.getContentType()||"",o=i.indexOf("application/json")>-1,s=er.isObject(t);if(s&&er.isHTMLForm(t)&&(t=new FormData(t)),er.isFormData(t))return o?JSON.stringify(Xht(t)):t;if(er.isArrayBuffer(t)||er.isBuffer(t)||er.isStream(t)||er.isFile(t)||er.isBlob(t)||er.isReadableStream(t))return t;if(er.isArrayBufferView(t))return t.buffer;if(er.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(s){if(i.indexOf("application/x-www-form-urlencoded")>-1)return MEr(t,this.formSerializer).toString();if((l=er.isFileList(t))||i.indexOf("multipart/form-data")>-1){let c=this.env&&this.env.FormData;return QV(l?{"files[]":t}:t,c&&new c,this.formSerializer)}}return s||o?(n.setContentType("application/json",!1),ytl(t)):t}],transformResponse:[function(t){let n=this.transitional||NEr.transitional,i=n&&n.forcedJSONParsing,o=this.responseType==="json";if(er.isResponse(t)||er.isReadableStream(t))return t;if(t&&er.isString(t)&&(i&&!this.responseType||o)){let a=!(n&&n.silentJSONParsing)&&o;try{return JSON.parse(t)}catch(l){if(a)throw l.name==="SyntaxError"?so.from(l,so.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:tp.classes.FormData,Blob:tp.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};er.forEach(["delete","get","head","post","put","patch"],r=>{NEr.headers[r]={}});Uye=NEr});var Etl,F0i,q0i=et(()=>{"use strict";Bd();Etl=er.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),F0i=r=>{let t={},n,i,o;return r&&r.split(`
180
180
  `).forEach(function(a){o=a.indexOf(":"),n=a.substring(0,o).trim().toLowerCase(),i=a.substring(o+1).trim(),!(!n||t[n]&&Etl[n])&&(n==="set-cookie"?t[n]?t[n].push(i):t[n]=[i]:t[n]=t[n]?t[n]+", "+i:i)}),t}});function TLe(r){return r&&String(r).trim().toLowerCase()}function Zht(r){return r===!1||r==null?r:er.isArray(r)?r.map(Zht):String(r)}function btl(r){let t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,i;for(;i=n.exec(r);)t[i[1]]=i[2];return t}function PEr(r,t,n,i,o){if(er.isFunction(i))return i.call(this,t,n);if(o&&(t=n),!!er.isString(t)){if(er.isString(i))return t.indexOf(i)!==-1;if(er.isRegExp(i))return i.test(t)}}function Itl(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,i)=>n.toUpperCase()+i)}function vtl(r,t){let n=er.toCamelCase(" "+t);["get","set","has"].forEach(i=>{Object.defineProperty(r,i+n,{value:function(o,s,a){return this[i].call(this,t,o,s,a)},configurable:!0})})}var z0i,Ctl,jye,Uf,r7=et(()=>{"use strict";Bd();q0i();z0i=Symbol("internals");Ctl=r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim());jye=class{constructor(t){t&&this.set(t)}set(t,n,i){let o=this;function s(l,c,u){let d=TLe(c);if(!d)throw new Error("header name must be a non-empty string");let p=er.findKey(o,d);(!p||o[p]===void 0||u===!0||u===void 0&&o[p]!==!1)&&(o[p||c]=Zht(l))}let a=(l,c)=>er.forEach(l,(u,d)=>s(u,d,c));if(er.isPlainObject(t)||t instanceof this.constructor)a(t,n);else if(er.isString(t)&&(t=t.trim())&&!Ctl(t))a(F0i(t),n);else if(er.isHeaders(t))for(let[l,c]of t.entries())s(c,l,i);else t!=null&&s(n,t,i);return this}get(t,n){if(t=TLe(t),t){let i=er.findKey(this,t);if(i){let o=this[i];if(!n)return o;if(n===!0)return btl(o);if(er.isFunction(n))return n.call(this,o,i);if(er.isRegExp(n))return n.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=TLe(t),t){let i=er.findKey(this,t);return!!(i&&this[i]!==void 0&&(!n||PEr(this,this[i],i,n)))}return!1}delete(t,n){let i=this,o=!1;function s(a){if(a=TLe(a),a){let l=er.findKey(i,a);l&&(!n||PEr(i,i[l],l,n))&&(delete i[l],o=!0)}}return er.isArray(t)?t.forEach(s):s(t),o}clear(t){let n=Object.keys(this),i=n.length,o=!1;for(;i--;){let s=n[i];(!t||PEr(this,this[s],s,t,!0))&&(delete this[s],o=!0)}return o}normalize(t){let n=this,i={};return er.forEach(this,(o,s)=>{let a=er.findKey(i,s);if(a){n[a]=Zht(o),delete n[s];return}let l=t?Itl(s):String(s).trim();l!==s&&delete n[s],n[l]=Zht(o),i[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let n=Object.create(null);return er.forEach(this,(i,o)=>{i!=null&&i!==!1&&(n[o]=t&&er.isArray(i)?i.join(", "):i)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
181
181
  `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){let i=new this(t);return n.forEach(o=>i.set(o)),i}static accessor(t){let i=(this[z0i]=this[z0i]={accessors:{}}).accessors,o=this.prototype;function s(a){let l=TLe(a);i[l]||(vtl(o,a),i[l]=!0)}return er.isArray(t)?t.forEach(s):s(t),this}};jye.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);er.reduceDescriptors(jye.prototype,({value:r},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>r,set(i){this[n]=i}}});er.freezeMethods(jye);Uf=jye});function wLe(r,t){let n=this||Uye,i=t||n,o=Uf.from(i.headers),s=i.data;return er.forEach(r,function(l){s=l.call(n,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}var U0i=et(()=>{"use strict";Bd();$ht();r7()});function RLe(r){return!!(r&&r.__CANCEL__)}var kEr=et(()=>{"use strict"});function j0i(r,t,n){so.call(this,r??"canceled",so.ERR_CANCELED,t,n),this.name="CanceledError"}var k_,$ae=et(()=>{"use strict";P_();Bd();er.inherits(j0i,so,{__CANCEL__:!0});k_=j0i});function n7(r,t,n){let i=n.config.validateStatus;!n.status||!i||i(n.status)?r(n):t(new so("Request failed with status code "+n.status,[so.ERR_BAD_REQUEST,so.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}var egt=et(()=>{"use strict";P_()});function QEr(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}var G0i=et(()=>{"use strict"});function LEr(r,t){return t?r.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):r}var W0i=et(()=>{"use strict"});function Zae(r,t){return r&&!QEr(t)?LEr(r,t):t}var tgt=et(()=>{"use strict";G0i();W0i()});var ele,rgt=et(()=>{ele="1.7.7"});function BLe(r){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return t&&t[1]||""}var FEr=et(()=>{"use strict"});function qEr(r,t,n){let i=n&&n.Blob||tp.classes.Blob,o=BLe(r);if(t===void 0&&i&&(t=!0),o==="data"){r=o.length?r.slice(o.length+1):r;let s=Stl.exec(r);if(!s)throw new so("Invalid URL",so.ERR_INVALID_URL);let a=s[1],l=s[2],c=s[3],u=Buffer.from(decodeURIComponent(c),l?"base64":"utf8");if(t){if(!i)throw new so("Blob is not supported",so.ERR_NOT_SUPPORT);return new i([u],{type:a})}return u}throw new so("Unsupported protocol "+o,so.ERR_NOT_SUPPORT)}var Stl,H0i=et(()=>{"use strict";P_();FEr();t7();Stl=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/});var V0i,zEr,UEr,jEr,Y0i=et(()=>{"use strict";V0i=Ct(require("stream"),1);Bd();zEr=Symbol("internals"),UEr=class extends V0i.default.Transform{constructor(t){t=er.toFlatObject(t,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(i,o)=>!er.isUndefined(o[i])),super({readableHighWaterMark:t.chunkSize});let n=this[zEr]={timeWindow:t.timeWindow,chunkSize:t.chunkSize,maxRate:t.maxRate,minChunkSize:t.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",i=>{i==="progress"&&(n.isCaptured||(n.isCaptured=!0))})}_read(t){let n=this[zEr];return n.onReadCallback&&n.onReadCallback(),super._read(t)}_transform(t,n,i){let o=this[zEr],s=o.maxRate,a=this.readableHighWaterMark,l=o.timeWindow,c=1e3/l,u=s/c,d=o.minChunkSize!==!1?Math.max(o.minChunkSize,u*.01):0,p=(A,h)=>{let y=Buffer.byteLength(A);o.bytesSeen+=y,o.bytes+=y,o.isCaptured&&this.emit("progress",o.bytesSeen),this.push(A)?process.nextTick(h):o.onReadCallback=()=>{o.onReadCallback=null,process.nextTick(h)}},f=(A,h)=>{let y=Buffer.byteLength(A),C=null,v=a,O,w=0;if(s){let R=Date.now();(!o.ts||(w=R-o.ts)>=l)&&(o.ts=R,O=u-o.bytes,o.bytes=O<0?-O:0,w=0),O=u-o.bytes}if(s){if(O<=0)return setTimeout(()=>{h(null,A)},l-w);O<v&&(v=O)}v&&y>v&&y-v>d&&(C=A.subarray(v),A=A.subarray(0,v)),p(A,C?()=>{process.nextTick(h,null,C)}:h)};f(t,function A(h,y){if(h)return i(h);y?f(y,A):i(null)})}},jEr=UEr});var K0i,_tl,ngt,GEr=et(()=>{({asyncIterator:K0i}=Symbol),_tl=async function*(r){r.stream?yield*r.stream():r.arrayBuffer?yield await r.arrayBuffer():r[K0i]?yield*r[K0i]():yield r},ngt=_tl});var J0i,X0i,Otl,xLe,LV,Ttl,wtl,WEr,Rtl,$0i,Z0i=et(()=>{J0i=require("util"),X0i=require("stream");Bd();GEr();Otl=er.ALPHABET.ALPHA_DIGIT+"-_",xLe=new J0i.TextEncoder,LV=`\r
182
182
  `,Ttl=xLe.encode(LV),wtl=2,WEr=class{constructor(t,n){let{escapeName:i}=this.constructor,o=er.isString(n),s=`Content-Disposition: form-data; name="${i(t)}"${!o&&n.name?`; filename="${i(n.name)}"`:""}${LV}`;o?n=xLe.encode(String(n).replace(/\r?\n|\r\n?/g,LV)):s+=`Content-Type: ${n.type||"application/octet-stream"}${LV}`,this.headers=xLe.encode(s+LV),this.contentLength=o?n.byteLength:n.size,this.size=this.headers.byteLength+this.contentLength+wtl,this.name=t,this.value=n}async*encode(){yield this.headers;let{value:t}=this;er.isTypedArray(t)?yield t:yield*ngt(t),yield Ttl}static escapeName(t){return String(t).replace(/[\r\n"]/g,n=>({"\r":"%0D","\n":"%0A",'"':"%22"})[n])}},Rtl=(r,t,n)=>{let{tag:i="form-data-boundary",size:o=25,boundary:s=i+"-"+er.generateString(o,Otl)}=n||{};if(!er.isFormData(r))throw TypeError("FormData instance required");if(s.length<1||s.length>70)throw Error("boundary must be 10-70 characters long");let a=xLe.encode("--"+s+LV),l=xLe.encode("--"+s+"--"+LV+LV),c=l.byteLength,u=Array.from(r.entries()).map(([p,f])=>{let A=new WEr(p,f);return c+=A.size,A});c+=a.byteLength*u.length,c=er.toFiniteNumber(c);let d={"Content-Type":`multipart/form-data; boundary=${s}`};return Number.isFinite(c)&&(d["Content-Length"]=c),t&&t(d),X0i.Readable.from(async function*(){for(let p of u)yield a,yield*p.encode();yield l}())},$0i=Rtl});var edi,HEr,tdi,rdi=et(()=>{"use strict";edi=Ct(require("stream"),1),HEr=class extends edi.default.Transform{__transform(t,n,i){this.push(t),i()}_transform(t,n,i){if(t.length!==0&&(this._transform=this.__transform,t[0]!==120)){let o=Buffer.alloc(2);o[0]=120,o[1]=156,this.push(o,n)}this.__transform(t,n,i)}},tdi=HEr});var Btl,ndi,idi=et(()=>{Bd();Btl=(r,t)=>er.isAsyncFn(r)?function(...n){let i=n.pop();r.apply(this,n).then(o=>{try{t?i(null,...t(o)):i(null,o)}catch(s){i(s)}},i)}:r,ndi=Btl});function xtl(r,t){r=r||10;let n=new Array(r),i=new Array(r),o=0,s=0,a;return t=t!==void 0?t:1e3,function(c){let u=Date.now(),d=i[s];a||(a=u),n[o]=c,i[o]=u;let p=s,f=0;for(;p!==o;)f+=n[p++],p=p%r;if(o=(o+1)%r,o===s&&(s=(s+1)%r),u-a<t)return;let A=d&&u-d;return A?Math.round(f*1e3/A):void 0}}var odi,sdi=et(()=>{"use strict";odi=xtl});function Mtl(r,t){let n=0,i=1e3/t,o,s,a=(u,d=Date.now())=>{n=d,o=null,s&&(clearTimeout(s),s=null),r.apply(null,u)};return[(...u)=>{let d=Date.now(),p=d-n;p>=i?a(u,d):(o=u,s||(s=setTimeout(()=>{s=null,a(o)},i-p)))},()=>o&&a(o)]}var adi,ldi=et(()=>{adi=Mtl});var Dq,Gye,Wye,igt=et(()=>{sdi();ldi();Bd();Dq=(r,t,n=3)=>{let i=0,o=odi(50,250);return adi(s=>{let a=s.loaded,l=s.lengthComputable?s.total:void 0,c=a-i,u=o(c),d=a<=l;i=a;let p={loaded:a,total:l,progress:l?a/l:void 0,bytes:c,rate:u||void 0,estimated:u&&l&&d?(l-a)/u:void 0,event:s,lengthComputable:l!=null,[t?"download":"upload"]:!0};r(p)},n)},Gye=(r,t)=>{let n=r!=null;return[i=>t[0]({lengthComputable:n,total:r,loaded:i}),t[1]]},Wye=r=>(...t)=>er.asap(()=>r(...t))});function Qtl(r,t){r.beforeRedirects.proxy&&r.beforeRedirects.proxy(r),r.beforeRedirects.config&&r.beforeRedirects.config(r,t)}function bdi(r,t,n){let i=t;if(!i&&i!==!1){let o=(0,Adi.getProxyForUrl)(n);o&&(i=new URL(o))}if(i){if(i.username&&(i.auth=(i.username||"")+":"+(i.password||"")),i.auth){(i.auth.username||i.auth.password)&&(i.auth=(i.auth.username||"")+":"+(i.auth.password||""));let s=Buffer.from(i.auth,"utf8").toString("base64");r.headers["Proxy-Authorization"]="Basic "+s}r.headers.host=r.hostname+(r.port?":"+r.port:"");let o=i.hostname||i.host;r.hostname=o,r.host=o,r.port=i.port,r.path=n,i.protocol&&(r.protocol=i.protocol.includes(":")?i.protocol:`${i.protocol}:`)}r.beforeRedirects.proxy=function(s){bdi(s,t,s.href)}}var Adi,hdi,gdi,mdi,ydi,Nq,tle,Edi,udi,Dtl,cdi,Ntl,Ptl,ktl,ddi,pdi,Ltl,Ftl,qtl,fdi,Cdi,Idi=et(()=>{"use strict";Bd();egt();tgt();Kht();Adi=Ct(bNe(),1),hdi=Ct(require("http"),1),gdi=Ct(require("https"),1),mdi=Ct(require("util"),1),ydi=Ct(Kar(),1),Nq=Ct(require("zlib"),1);rgt();Jht();P_();$ae();t7();H0i();tle=Ct(require("stream"),1);r7();Y0i();Edi=require("events");Z0i();GEr();rdi();idi();igt();udi={flush:Nq.default.constants.Z_SYNC_FLUSH,finishFlush:Nq.default.constants.Z_SYNC_FLUSH},Dtl={flush:Nq.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:Nq.default.constants.BROTLI_OPERATION_FLUSH},cdi=er.isFunction(Nq.default.createBrotliDecompress),{http:Ntl,https:Ptl}=ydi.default,ktl=/https:?/,ddi=tp.protocols.map(r=>r+":"),pdi=(r,[t,n])=>(r.on("end",n).on("error",n),t);Ltl=typeof process<"u"&&er.kindOf(process)==="process",Ftl=r=>new Promise((t,n)=>{let i,o,s=(c,u)=>{o||(o=!0,i&&i(c,u))},a=c=>{s(c),t(c)},l=c=>{s(c,!0),n(c)};r(a,l,c=>i=c).catch(l)}),qtl=({address:r,family:t})=>{if(!er.isString(r))throw TypeError("address must be a string");return{address:r,family:t||(r.indexOf(".")<0?6:4)}},fdi=(r,t)=>qtl(er.isObject(r)?r:{address:r,family:t}),Cdi=Ltl&&function(t){return Ftl(async function(i,o,s){let{data:a,lookup:l,family:c}=t,{responseType:u,responseEncoding:d}=t,p=t.method.toUpperCase(),f,A=!1,h;if(l){let ne=ndi(l,ie=>er.isArray(ie)?ie:[ie]);l=(ie,W,se)=>{ne(ie,W,(le,oe,fe)=>{if(le)return se(le);let Re=er.isArray(oe)?oe.map(Fe=>fdi(Fe)):[fdi(oe,fe)];W.all?se(le,Re):se(le,Re[0].address,Re[0].family)})}}let y=new Edi.EventEmitter,C=()=>{t.cancelToken&&t.cancelToken.unsubscribe(v),t.signal&&t.signal.removeEventListener("abort",v),y.removeAllListeners()};s((ne,ie)=>{f=!0,ie&&(A=!0,C())});function v(ne){y.emit("abort",!ne||ne.type?new k_(null,t,h):ne)}y.once("abort",o),(t.cancelToken||t.signal)&&(t.cancelToken&&t.cancelToken.subscribe(v),t.signal&&(t.signal.aborted?v():t.signal.addEventListener("abort",v)));let O=Zae(t.baseURL,t.url),w=new URL(O,tp.hasBrowserEnv?tp.origin:void 0),R=w.protocol||ddi[0];if(R==="data:"){let ne;if(p!=="GET")return n7(i,o,{status:405,statusText:"method not allowed",headers:{},config:t});try{ne=qEr(t.url,u==="blob",{Blob:t.env&&t.env.Blob})}catch(ie){throw so.from(ie,so.ERR_BAD_REQUEST,t)}return u==="text"?(ne=ne.toString(d),(!d||d==="utf8")&&(ne=er.stripBOM(ne))):u==="stream"&&(ne=tle.default.Readable.from(ne)),n7(i,o,{data:ne,status:200,statusText:"OK",headers:new Uf,config:t})}if(ddi.indexOf(R)===-1)return o(new so("Unsupported protocol "+R,so.ERR_BAD_REQUEST,t));let k=Uf.from(t.headers).normalize();k.set("User-Agent","axios/"+ele,!1);let{onUploadProgress:z,onDownloadProgress:H}=t,J=t.maxRate,K,V;if(er.isSpecCompliantForm(a)){let ne=k.getContentType(/boundary=([-_\w\d]{10,70})/i);a=$0i(a,ie=>{k.set(ie)},{tag:`axios-${ele}-boundary`,boundary:ne&&ne[1]||void 0})}else if(er.isFormData(a)&&er.isFunction(a.getHeaders)){if(k.set(a.getHeaders()),!k.hasContentLength())try{let ne=await mdi.default.promisify(a.getLength).call(a);Number.isFinite(ne)&&ne>=0&&k.setContentLength(ne)}catch{}}else if(er.isBlob(a))a.size&&k.setContentType(a.type||"application/octet-stream"),k.setContentLength(a.size||0),a=tle.default.Readable.from(ngt(a));else if(a&&!er.isStream(a)){if(!Buffer.isBuffer(a))if(er.isArrayBuffer(a))a=Buffer.from(new Uint8Array(a));else if(er.isString(a))a=Buffer.from(a,"utf-8");else return o(new so("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",so.ERR_BAD_REQUEST,t));if(k.setContentLength(a.length,!1),t.maxBodyLength>-1&&a.length>t.maxBodyLength)return o(new so("Request body larger than maxBodyLength limit",so.ERR_BAD_REQUEST,t))}let F=er.toFiniteNumber(k.getContentLength());er.isArray(J)?(K=J[0],V=J[1]):K=V=J,a&&(z||K)&&(er.isStream(a)||(a=tle.default.Readable.from(a,{objectMode:!1})),a=tle.default.pipeline([a,new jEr({maxRate:er.toFiniteNumber(K)})],er.noop),z&&a.on("progress",pdi(a,Gye(F,Dq(Wye(z),!1,3)))));let X;if(t.auth){let ne=t.auth.username||"",ie=t.auth.password||"";X=ne+":"+ie}if(!X&&w.username){let ne=w.username,ie=w.password;X=ne+":"+ie}X&&k.delete("authorization");let Y;try{Y=Xae(w.pathname+w.search,t.params,t.paramsSerializer).replace(/^\?/,"")}catch(ne){let ie=new Error(ne.message);return ie.config=t,ie.url=t.url,ie.exists=!0,o(ie)}k.set("Accept-Encoding","gzip, compress, deflate"+(cdi?", br":""),!1);let L={path:Y,method:p,headers:k.toJSON(),agents:{http:t.httpAgent,https:t.httpsAgent},auth:X,protocol:R,family:c,beforeRedirect:Qtl,beforeRedirects:{}};!er.isUndefined(l)&&(L.lookup=l),t.socketPath?L.socketPath=t.socketPath:(L.hostname=w.hostname.startsWith("[")?w.hostname.slice(1,-1):w.hostname,L.port=w.port,bdi(L,t.proxy,R+"//"+w.hostname+(w.port?":"+w.port:"")+L.path));let $,te=ktl.test(L.protocol);if(L.agent=te?t.httpsAgent:t.httpAgent,t.transport?$=t.transport:t.maxRedirects===0?$=te?gdi.default:hdi.default:(t.maxRedirects&&(L.maxRedirects=t.maxRedirects),t.beforeRedirect&&(L.beforeRedirects.config=t.beforeRedirect),$=te?Ptl:Ntl),t.maxBodyLength>-1?L.maxBodyLength=t.maxBodyLength:L.maxBodyLength=1/0,t.insecureHTTPParser&&(L.insecureHTTPParser=t.insecureHTTPParser),h=$.request(L,function(ie){if(h.destroyed)return;let W=[ie],se=+ie.headers["content-length"];if(H||V){let Fe=new jEr({maxRate:er.toFiniteNumber(V)});H&&Fe.on("progress",pdi(Fe,Gye(se,Dq(Wye(H),!0,3)))),W.push(Fe)}let le=ie,oe=ie.req||h;if(t.decompress!==!1&&ie.headers["content-encoding"])switch((p==="HEAD"||ie.statusCode===204)&&delete ie.headers["content-encoding"],(ie.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":W.push(Nq.default.createUnzip(udi)),delete ie.headers["content-encoding"];break;case"deflate":W.push(new tdi),W.push(Nq.default.createUnzip(udi)),delete ie.headers["content-encoding"];break;case"br":cdi&&(W.push(Nq.default.createBrotliDecompress(Dtl)),delete ie.headers["content-encoding"])}le=W.length>1?tle.default.pipeline(W,er.noop):W[0];let fe=tle.default.finished(le,()=>{fe(),C()}),Re={status:ie.statusCode,statusText:ie.statusMessage,headers:new Uf(ie.headers),config:t,request:oe};if(u==="stream")Re.data=le,n7(i,o,Re);else{let Fe=[],me=0;le.on("data",function(Ye){Fe.push(Ye),me+=Ye.length,t.maxContentLength>-1&&me>t.maxContentLength&&(A=!0,le.destroy(),o(new so("maxContentLength size of "+t.maxContentLength+" exceeded",so.ERR_BAD_RESPONSE,t,oe)))}),le.on("aborted",function(){if(A)return;let Ye=new so("maxContentLength size of "+t.maxContentLength+" exceeded",so.ERR_BAD_RESPONSE,t,oe);le.destroy(Ye),o(Ye)}),le.on("error",function(Ye){h.destroyed||o(so.from(Ye,null,t,oe))}),le.on("end",function(){try{let Ye=Fe.length===1?Fe[0]:Buffer.concat(Fe);u!=="arraybuffer"&&(Ye=Ye.toString(d),(!d||d==="utf8")&&(Ye=er.stripBOM(Ye))),Re.data=Ye}catch(Ye){return o(so.from(Ye,null,t,Re.request,Re))}n7(i,o,Re)})}y.once("abort",Fe=>{le.destroyed||(le.emit("error",Fe),le.destroy())})}),y.once("abort",ne=>{o(ne),h.destroy(ne)}),h.on("error",function(ie){o(so.from(ie,null,t,h))}),h.on("socket",function(ie){ie.setKeepAlive(!0,1e3*60)}),t.timeout){let ne=parseInt(t.timeout,10);if(Number.isNaN(ne)){o(new so("error trying to parse `config.timeout` to int",so.ERR_BAD_OPTION_VALUE,t,h));return}h.setTimeout(ne,function(){if(f)return;let W=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",se=t.transitional||zye;t.timeoutErrorMessage&&(W=t.timeoutErrorMessage),o(new so(W,se.clarifyTimeoutError?so.ETIMEDOUT:so.ECONNABORTED,t,h)),v()})}if(er.isStream(a)){let ne=!1,ie=!1;a.on("end",()=>{ne=!0}),a.once("error",W=>{ie=!0,h.destroy(W)}),a.on("close",()=>{!ne&&!ie&&v(new k_("Request stream has been aborted",t,h))}),a.pipe(h)}else h.end(a)})}});var vdi,Sdi=et(()=>{"use strict";Bd();t7();vdi=tp.hasStandardBrowserEnv?function(){let t=tp.navigator&&/(msie|trident)/i.test(tp.navigator.userAgent),n=document.createElement("a"),i;function o(s){let a=s;return t&&(n.setAttribute("href",a),a=n.href),n.setAttribute("href",a),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return i=o(window.location.href),function(a){let l=er.isString(a)?o(a):a;return l.protocol===i.protocol&&l.host===i.host}}():function(){return function(){return!0}}()});var _di,Odi=et(()=>{Bd();t7();_di=tp.hasStandardBrowserEnv?{write(r,t,n,i,o,s){let a=[r+"="+encodeURIComponent(t)];er.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),er.isString(i)&&a.push("path="+i),er.isString(o)&&a.push("domain="+o),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read(r){let t=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(r){this.write(r,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}}});function s8(r,t){t=t||{};let n={};function i(u,d,p){return er.isPlainObject(u)&&er.isPlainObject(d)?er.merge.call({caseless:p},u,d):er.isPlainObject(d)?er.merge({},d):er.isArray(d)?d.slice():d}function o(u,d,p){if(er.isUndefined(d)){if(!er.isUndefined(u))return i(void 0,u,p)}else return i(u,d,p)}function s(u,d){if(!er.isUndefined(d))return i(void 0,d)}function a(u,d){if(er.isUndefined(d)){if(!er.isUndefined(u))return i(void 0,u)}else return i(void 0,d)}function l(u,d,p){if(p in t)return i(u,d);if(p in r)return i(void 0,u)}let c={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:l,headers:(u,d)=>o(Tdi(u),Tdi(d),!0)};return er.forEach(Object.keys(Object.assign({},r,t)),function(d){let p=c[d]||o,f=p(r[d],t[d],d);er.isUndefined(f)&&p!==l||(n[d]=f)}),n}var Tdi,ogt=et(()=>{"use strict";Bd();r7();Tdi=r=>r instanceof Uf?{...r}:r});var sgt,VEr=et(()=>{t7();Bd();Sdi();Odi();tgt();ogt();r7();Kht();sgt=r=>{let t=s8({},r),{data:n,withXSRFToken:i,xsrfHeaderName:o,xsrfCookieName:s,headers:a,auth:l}=t;t.headers=a=Uf.from(a),t.url=Xae(Zae(t.baseURL,t.url),r.params,r.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let c;if(er.isFormData(n)){if(tp.hasStandardBrowserEnv||tp.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((c=a.getContentType())!==!1){let[u,...d]=c?c.split(";").map(p=>p.trim()).filter(Boolean):[];a.setContentType([u||"multipart/form-data",...d].join("; "))}}if(tp.hasStandardBrowserEnv&&(i&&er.isFunction(i)&&(i=i(t)),i||i!==!1&&vdi(t.url))){let u=o&&s&&_di.read(s);u&&a.set(o,u)}return t}});var ztl,wdi,Rdi=et(()=>{Bd();egt();Jht();P_();$ae();FEr();t7();r7();igt();VEr();ztl=typeof XMLHttpRequest<"u",wdi=ztl&&function(r){return new Promise(function(n,i){let o=sgt(r),s=o.data,a=Uf.from(o.headers).normalize(),{responseType:l,onUploadProgress:c,onDownloadProgress:u}=o,d,p,f,A,h;function y(){A&&A(),h&&h(),o.cancelToken&&o.cancelToken.unsubscribe(d),o.signal&&o.signal.removeEventListener("abort",d)}let C=new XMLHttpRequest;C.open(o.method.toUpperCase(),o.url,!0),C.timeout=o.timeout;function v(){if(!C)return;let w=Uf.from("getAllResponseHeaders"in C&&C.getAllResponseHeaders()),k={data:!l||l==="text"||l==="json"?C.responseText:C.response,status:C.status,statusText:C.statusText,headers:w,config:r,request:C};n7(function(H){n(H),y()},function(H){i(H),y()},k),C=null}"onloadend"in C?C.onloadend=v:C.onreadystatechange=function(){!C||C.readyState!==4||C.status===0&&!(C.responseURL&&C.responseURL.indexOf("file:")===0)||setTimeout(v)},C.onabort=function(){C&&(i(new so("Request aborted",so.ECONNABORTED,r,C)),C=null)},C.onerror=function(){i(new so("Network Error",so.ERR_NETWORK,r,C)),C=null},C.ontimeout=function(){let R=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded",k=o.transitional||zye;o.timeoutErrorMessage&&(R=o.timeoutErrorMessage),i(new so(R,k.clarifyTimeoutError?so.ETIMEDOUT:so.ECONNABORTED,r,C)),C=null},s===void 0&&a.setContentType(null),"setRequestHeader"in C&&er.forEach(a.toJSON(),function(R,k){C.setRequestHeader(k,R)}),er.isUndefined(o.withCredentials)||(C.withCredentials=!!o.withCredentials),l&&l!=="json"&&(C.responseType=o.responseType),u&&([f,h]=Dq(u,!0),C.addEventListener("progress",f)),c&&C.upload&&([p,A]=Dq(c),C.upload.addEventListener("progress",p),C.upload.addEventListener("loadend",A)),(o.cancelToken||o.signal)&&(d=w=>{C&&(i(!w||w.type?new k_(null,r,C):w),C.abort(),C=null)},o.cancelToken&&o.cancelToken.subscribe(d),o.signal&&(o.signal.aborted?d():o.signal.addEventListener("abort",d)));let O=BLe(o.url);if(O&&tp.protocols.indexOf(O)===-1){i(new so("Unsupported protocol "+O+":",so.ERR_BAD_REQUEST,r));return}C.send(s||null)})}});var Utl,Bdi,xdi=et(()=>{$ae();P_();Bd();Utl=(r,t)=>{let{length:n}=r=r?r.filter(Boolean):[];if(t||n){let i=new AbortController,o,s=function(u){if(!o){o=!0,l();let d=u instanceof Error?u:this.reason;i.abort(d instanceof so?d:new k_(d instanceof Error?d.message:d))}},a=t&&setTimeout(()=>{a=null,s(new so(`timeout ${t} of ms exceeded`,so.ETIMEDOUT))},t),l=()=>{r&&(a&&clearTimeout(a),a=null,r.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),r=null)};r.forEach(u=>u.addEventListener("abort",s));let{signal:c}=i;return c.unsubscribe=()=>er.asap(l),c}},Bdi=Utl});var jtl,Gtl,Wtl,YEr,Mdi=et(()=>{jtl=function*(r,t){let n=r.byteLength;if(!t||n<t){yield r;return}let i=0,o;for(;i<n;)o=i+t,yield r.slice(i,o),i=o},Gtl=async function*(r,t){for await(let n of Wtl(r))yield*jtl(n,t)},Wtl=async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}let t=r.getReader();try{for(;;){let{done:n,value:i}=await t.read();if(n)break;yield i}}finally{await t.cancel()}},YEr=(r,t,n,i)=>{let o=Gtl(r,t),s=0,a,l=c=>{a||(a=!0,i&&i(c))};return new ReadableStream({async pull(c){try{let{done:u,value:d}=await o.next();if(u){l(),c.close();return}let p=d.byteLength;if(n){let f=s+=p;n(f)}c.enqueue(new Uint8Array(d))}catch(u){throw l(u),u}},cancel(c){return l(c),o.return()}},{highWaterMark:2})}});var lgt,Ndi,Htl,Pdi,Vtl,Ddi,KEr,agt,Ytl,Ktl,kdi,Qdi=et(()=>{t7();Bd();P_();xdi();Mdi();r7();igt();VEr();egt();lgt=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Ndi=lgt&&typeof ReadableStream=="function",Htl=lgt&&(typeof TextEncoder=="function"?(r=>t=>r.encode(t))(new TextEncoder):async r=>new Uint8Array(await new Response(r).arrayBuffer())),Pdi=(r,...t)=>{try{return!!r(...t)}catch{return!1}},Vtl=Ndi&&Pdi(()=>{let r=!1,t=new Request(tp.origin,{body:new ReadableStream,method:"POST",get duplex(){return r=!0,"half"}}).headers.has("Content-Type");return r&&!t}),Ddi=64*1024,KEr=Ndi&&Pdi(()=>er.isReadableStream(new Response("").body)),agt={stream:KEr&&(r=>r.body)};lgt&&(r=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!agt[t]&&(agt[t]=er.isFunction(r[t])?n=>n[t]():(n,i)=>{throw new so(`Response type '${t}' is not supported`,so.ERR_NOT_SUPPORT,i)})})})(new Response);Ytl=async r=>{if(r==null)return 0;if(er.isBlob(r))return r.size;if(er.isSpecCompliantForm(r))return(await new Request(tp.origin,{method:"POST",body:r}).arrayBuffer()).byteLength;if(er.isArrayBufferView(r)||er.isArrayBuffer(r))return r.byteLength;if(er.isURLSearchParams(r)&&(r=r+""),er.isString(r))return(await Htl(r)).byteLength},Ktl=async(r,t)=>{let n=er.toFiniteNumber(r.getContentLength());return n??Ytl(t)},kdi=lgt&&(async r=>{let{url:t,method:n,data:i,signal:o,cancelToken:s,timeout:a,onDownloadProgress:l,onUploadProgress:c,responseType:u,headers:d,withCredentials:p="same-origin",fetchOptions:f}=sgt(r);u=u?(u+"").toLowerCase():"text";let A=Bdi([o,s&&s.toAbortSignal()],a),h,y=A&&A.unsubscribe&&(()=>{A.unsubscribe()}),C;try{if(c&&Vtl&&n!=="get"&&n!=="head"&&(C=await Ktl(d,i))!==0){let k=new Request(t,{method:"POST",body:i,duplex:"half"}),z;if(er.isFormData(i)&&(z=k.headers.get("content-type"))&&d.setContentType(z),k.body){let[H,J]=Gye(C,Dq(Wye(c)));i=YEr(k.body,Ddi,H,J)}}er.isString(p)||(p=p?"include":"omit");let v="credentials"in Request.prototype;h=new Request(t,{...f,signal:A,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:i,duplex:"half",credentials:v?p:void 0});let O=await fetch(h),w=KEr&&(u==="stream"||u==="response");if(KEr&&(l||w&&y)){let k={};["status","statusText","headers"].forEach(K=>{k[K]=O[K]});let z=er.toFiniteNumber(O.headers.get("content-length")),[H,J]=l&&Gye(z,Dq(Wye(l),!0))||[];O=new Response(YEr(O.body,Ddi,H,()=>{J&&J(),y&&y()}),k)}u=u||"text";let R=await agt[er.findKey(agt,u)||"text"](O,r);return!w&&y&&y(),await new Promise((k,z)=>{n7(k,z,{data:R,headers:Uf.from(O.headers),status:O.status,statusText:O.statusText,config:r,request:h})})}catch(v){throw y&&y(),v&&v.name==="TypeError"&&/fetch/i.test(v.message)?Object.assign(new so("Network Error",so.ERR_NETWORK,r,h),{cause:v.cause||v}):so.from(v,v&&v.code,r,h)}})});var JEr,Ldi,Jtl,ugt,XEr=et(()=>{Bd();Idi();Rdi();Qdi();P_();JEr={http:Cdi,xhr:wdi,fetch:kdi};er.forEach(JEr,(r,t)=>{if(r){try{Object.defineProperty(r,"name",{value:t})}catch{}Object.defineProperty(r,"adapterName",{value:t})}});Ldi=r=>`- ${r}`,Jtl=r=>er.isFunction(r)||r===null||r===!1,ugt={getAdapter:r=>{r=er.isArray(r)?r:[r];let{length:t}=r,n,i,o={};for(let s=0;s<t;s++){n=r[s];let a;if(i=n,!Jtl(n)&&(i=JEr[(a=String(n)).toLowerCase()],i===void 0))throw new so(`Unknown adapter '${a}'`);if(i)break;o[a||"#"+s]=i}if(!i){let s=Object.entries(o).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build")),a=t?s.length>1?`since :
@@ -7184,7 +7184,7 @@ hasNodeNameDifference: ${l}, hasLocationMappingDifference: ${c}`);let w=this.wor
7184
7184
  Total columns by schema: `,a,`
7185
7185
  Total columns from all schemas: `,l)}catch(a){B1e.errorContext(n,i,"Failed to log object list details",a)}let s={};for(let[a,l]of Object.entries(o))l.handle(c=>{s[a]=c},()=>{});return s}buildObjectsByLocationLookup(t){let n={},i={};for(let[o,s]of Object.entries(t))s.handle(a=>{let{tables:l,views:c}=this.convertObjectRowsToMaterializationKinds(a);n[o]=new Set(l),i[o]=new Set(c)},()=>{});return{views:i,tables:n}}async getDataWarehouseObjectsByLocation(t,n){let i="getDataWarehouseObjectsByLocation:";return Bc(i,n,"ACTUAL_STATE",async()=>{try{let o=await this.getObjects(t,!0,n);try{let{details:s,totalObjects:a}=PAn(t,o);B1e.appContext(n,i,`
7186
7186
  Total objects by schema: `,s,`
7187
- Total objects from all schemas: `,a)}catch(s){B1e.errorContext(n,i,"failed to log object list details",s)}return this.buildObjectsByLocationLookup(o)}catch(o){throw B1e.errorContext(n,i,'Error when building object by location name lookup for objectType "objects"',o),o}},"appContext")}async getActualState(t,n,i){try{let[o,s]=await Promise.all([this.getDataWarehouseObjectsByLocation(n,i),this.getDataWarehouseColumns(n,i)]);return this.createState(t,n,s,o)}catch(o){throw B1e.errorContext(i,"getting actual state failed",o),Hv(o,"Could not get location or object/column lookups: ")}}wrapSQLWithTest=t=>`SELECT 1 WHERE EXISTS (${t})`;getTemplateString=(t,n,i)=>{let o=t;return i&&(o=this.wrapSQLWithTest(o)),n&&(o=this.wrapSQLWithExplain(o)),o}};vr();var a8e=class extends At{noRoleFound;noWarehouseFound;isWarehouseInvalid;constructor(t,n){let i="Snowflake user authentication unsuccessful: ";t.invalidWarehouseInfo?i+=`Warehouse not found, is invalid, or the user with current role ${t.invalidWarehouseInfo.role} does not have permission.`:i+=`${t.noRoleFound?`Role${t.noWarehouseFound?" and Warehouse":""}`:"Warehouse"} must be provided.`,super(i,n),this.noRoleFound=!!t.noRoleFound,this.noWarehouseFound=!!t.noWarehouseFound,this.isWarehouseInvalid=!!t.invalidWarehouseInfo}},GSs=r=>typeof r=="object"&&r instanceof a8e;sn();vr();hr();xs();var WSs=(r,t,n,i)=>`SELECT * FROM TABLE(RESULT_SCAN('${r}')) ORDER BY ${t} LIMIT ${n} OFFSET ${i}`;var cet=nt.PLATFORM,Bh0=T.object({TABLE_NAME:T.string(),COMMENT:T.string().nullable(),TABLE_TYPE:T.string()}),kUt=class extends Lre{validator=Cr("InformationSchemaTablesRow",Bh0);query(t){return`SELECT TABLE_NAME, TABLE_TYPE, COMMENT from "${t.database}".INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='${t.schema}';`}convert(t){let{TABLE_NAME:n,COMMENT:i,...o}=t;return{kind:o.TABLE_TYPE.match(/^(.+\s)?TABLE$/)?"TABLE":o.TABLE_TYPE.match(/^(.+\s)?VIEW$/)?"VIEW":"<unknown>",name:n,comment:i??"",extra:o}}},xh0=T.object({TABLE_NAME:T.string(),COMMENT:T.string().nullable(),COLUMN_NAME:T.string(),IS_NULLABLE:T.union([T.literal("YES"),T.literal("NO")]),COLUMN_DEFAULT:T.string().nullable()}),QUt=class extends Fre{validator=Cr("InformationSchemaColumnsRow",xh0);get columnsString(){return"TABLE_NAME, COLUMN_NAME, IS_NULLABLE, COMMENT, COLUMN_DEFAULT"}query(t){return`SELECT ${this.columnsString} from "${t.database}".INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA='${t.schema}'`}convert(t){let{TABLE_NAME:n,COLUMN_NAME:i,COMMENT:o,...s}=t;return{name:i,objectName:n,comment:o??"",extra:s}}async runQuery(t,n,i){let o=`${this.runQuery.name}:`,{data:{status:s},runDetails:{queryID:a}}=await n(t);if(!a)throw cet.emergContext(i,o,`query ID was unexpectedly ${a}`),new At(`Query ID was unexpectedly ${a} when querying warehouse columns`);cet.infoContext(i,o,`initial query (ID ${a}) completed with status ${s}`);let l=[],c=5e4,u=0,d=1,p=!1;for(;!p;){let f,A,h;try{let y=WSs(a,this.columnsString,c,u),{data:{rows:C,status:v},runDetails:{queryID:O}}=await n(y);f=C.map(w=>this.validateAndConvert(w)),A=v,h=O}catch(y){throw cet.errorContext(i,o,`query for batch ${d} failed with error`,y),y}cet.infoContext(i,o,`query for batch ${d} (ID ${h} / status "${A}") returned ${f.length} records`),l.push(...f),p=f.length<c,p||(u+=c,d++)}return cet.infoContext(i,o,`finished querying ${l.length} rows in ${d} batches`),l}},Mh0=T.object({name:T.string(),owner:T.string(),comment:T.string(),budget:T.string().nullable(),is_default:T.union([T.literal("Y"),T.literal("N")]),is_current:T.union([T.literal("Y"),T.literal("N")]),retention_time:T.string(),created_on:T.union([T.date(),T.string()]),options:T.string(),owner_role_type:T.string(),database_name:T.string()}),LUt=class extends qre{validator=Cr("SnowflakeShowSchemaRow",Mh0);convert(t){let{name:n,options:i,...o}=t;return{name:n,extra:{...o,options:new Set(i.length?i.split(", "):[])}}}query(t){return`SHOW SCHEMAS IN DATABASE "${t.database}"`}};var det=class extends zre{constructor(n){super("snowflake");this.userContext=n}log(n,...i){nt.PLATFORM[n]({orgID:this.userContext.orgID,workspaceID:this.userContext.environmentID,...i})}getObjectsImplementation=new kUt;getColumnsImplementation=new QUt;getSchemasImplementation=new LUt;getQueryResultFromTemplateRunResult(n,i){let o=n.runDetails.compiledSQL,s={error:null,fields:[],rows:[],success:!0,sql:o,exportedRefs:[],invalidExportedRefs:[],startTime:i,endTime:new Date,isRunning:!1,name:"",status:n?.data?.status||"Success",type:"sql",queryID:n.runDetails.queryID,warehouse:n.runDetails.warehouse};if(n.data){let a=n.data.columns.map(u=>u.Name),l=n.data.rows.map(u=>({values:NUt(a,u)})),c=n.data.columns.map(u=>({name:u.Name,type:u.DataType||""}));s.fields=c,s.rows=l}if(n?.runDetails?.exported_refs.length){let a=n.runDetails.exported_refs.map(l=>({locationName:l.location_name,nodeName:l.node_name}));s.exportedRefs=A4(a)}if(n?.runDetails?.invalid_exported_refs.length){let a=n.runDetails.invalid_exported_refs.map(l=>({locationName:l.location_name,nodeName:l.node_name}));s.invalidExportedRefs=A4(a)}return s}validateUserContext(){let n="In your environment settings, verify that you have";if(!this.userContext)throw new At(`Missing ${this.name} connection information! ${n} selected and authenticated a connection type.`);if(Bh(this.userContext.kind==="snowflake",`Expected snowflake user context but received kind ${this.userContext.kind}`,"PLATFORM"),!this.userContext.accountName?.trim())throw new At(`Missing ${this.name} account information! ${n} added an account.`);let i=QAn(this.userContext),o=`Missing ${this.name} credentials! ${n} added a`,s=f$(i,a=>a.snowflakeUsername.trim()&&a.snowflakePassword?null:`${o} username and password.`,()=>null,()=>null,a=>a.snowflakeUsername?.trim()?null:`${o} username.`);if(s)throw new At(s)}async testConnection(n=!1){if(n)try{this.validateUserContext();let i=(await this.getRows("select current_role()"))[0]?.["CURRENT_ROLE()"],o=(await this.getRows("select current_warehouse()"))[0]?.["CURRENT_WAREHOUSE()"],s=!1,a=!1;if(!o){if(this.userContext.warehouse)throw new a8e({invalidWarehouseInfo:{warehouse:this.userContext.warehouse,role:i??""}});a=!0}if((!i||i==="PUBLIC")&&!this.userContext.role&&(s=!0),a||s)throw new a8e({noRoleFound:s,noWarehouseFound:a})}catch(i){throw GSs(i)?i:Vd(i)?new At(`${(0,kAn.capitalize)(this.name)} user authentication unsuccessful: ${i.message}`,i.detail):new At(`${(0,kAn.capitalize)(this.name)} user authentication unsuccessful:`,Wl(i).error.errorDetail)}else try{await this.runSQL(_7,void 0)}catch(i){throw Vd(i)?new At(`Could not validate connection to ${this.name}: ${i.message}`,i.detail):new At(`Could not validate connection to ${this.name}`,Wl(i).error.errorDetail)}}async getDatabaseNames(){return(await this.getRows("SHOW DATABASES")).map(i=>i.name)}async getSchemaNames(n){return(await this.getRows(`SHOW SCHEMAS IN "${n}"`)).map(o=>o.name)}async getVariantRows(n,i,o,s){let a=this.getName(s,o),l=`SELECT "${n}" FROM ${a} SAMPLE (${i} ROWS)`;return this.getSQLQueryResult(l)}async getObjectRows(n,i,o){let s=`SELECT * FROM ${this.getName(n,i)} LIMIT 100`;return o&&(s=this.wrapSQLWithExplain(s)),this.getSQLQueryResult(s)}createColumnMetadata(n,i){return{name:n.name,dataType:n.type,transform:"",nullable:n["null?"]==="Y",defaultValue:"",columnReference:{columnCounter:al(),stepCounter:i},primaryKey:n["primary key"]==="Y",uniqueKey:n["unique key"]==="Y",description:n.comment||"",appliedColumnTests:{},acceptedValues:{strictMatch:!0,values:[]},config:{},sourceColumnReferences:[{transform:"",columnReferences:[]}]}}async describeObject(n,i,o,s){let a=`DESC ${o.toUpperCase()} ${this.getName(n,i)}`;return(await this.runSQL(a,al())).data.rows.map(c=>this.createColumnMetadata(c,s))}convertObjectRowsToMaterializationKinds(n){let i="convertObjectRowsToMaterializationKinds:",o=[],s=[];for(let a of n)a.kind==="TABLE"?o.push(a.name):a.kind==="VIEW"?s.push(a.name):this.log("emergContext",i,`table ${a.name} is of unexpected table type ${a.kind}`);return{tables:o,views:s}}createState(n,i,o,s){return new JBe(s,o,i,n)}wrapSQLWithExplain(n){return`EXPLAIN USING text ${n}`}};var QAn=r=>({snowflakeAccount:r.accountName||"",snowflakeAccessUrl:r.accessUrl,snowflakeUsername:r.user||"",snowflakePassword:r.password||"",snowflakeKeyPairKey:r.keyPairKey,snowflakeRole:r.role||"",snowflakeWarehouse:r.warehouse||"",snowflakeAuthType:r.authenticator,snowflakeKeyPairPass:r.keyPairPass??void 0});var HSs=Ct(Sre());hr();xs();var r21=nt.RUNNER;hr();var VSs=nt.RUNNER;var YSs=(r,t)=>{try{return r.replace("{{NODE_NAME}}",t)}catch{throw new Error(`Error: initializing system columns for ${t}, column name is Undefined.`)}};var Dh0=r=>{if(r.authenticator==="Token")return{token:r.token??"",path:r.path,host:r.host,databricksAuthType:r.authenticator,platformKind:"databricks"};if(r.authenticator==="Cloud")return{path:r.path,databricksAuthType:r.authenticator,host:r.host,platformKind:"databricks"};if(r.authenticator==="OAuthU2M")return{path:r.path,databricksAuthType:r.authenticator,host:r.host,platformKind:"databricks",accessToken:r.accessToken};if(r.authenticator==="OAuthM2M")return{path:r.path,databricksAuthType:r.authenticator,host:r.host,clientID:r.clientID??"",clientSecret:r.secret??"",platformKind:"databricks"};{let t=r.authenticator;throw new At(`Databricks authenticator not supported: ${t}`)}},Nh0=r=>{if(r.authenticator==="oauth")return{credentials:r.credentials,connectionString:r.connectionString,fabricAuthType:r.authenticator,platformKind:"fabric"};{let t=r.authenticator;throw new At(`Fabric authenticator not supported: ${t}`)}},Ffn=r=>{if(r.kind==="databricks")return Dh0(r);if(r.kind==="snowflake")return QAn(r);if(r.kind==="fabric")return Nh0(r);throw new yB(r.kind,"ConvertFromUserContextToUserCredentials")},l8e=(r,t)=>{if(Dje(r)){if(t.kind!=="snowflake")throw new Rs(`User context kind ${t.kind} does not match expected value "snowflake"`);let n=f$(r,()=>{},o=>o.snowflakeKeyPairKey,()=>{},()=>{},()=>{});return{snowflakeAccount:t.accountName,snowflakeAccessUrl:t.accessUrl,snowflakeKeyPairKey:n,snowflakeUsername:t.user,snowflakeRole:t.role,snowflakeWarehouse:t.warehouse,snowflakeAuthType:t.authenticator}}else if(g5t(r)){if(t.kind!=="databricks")throw new Rs(`User context kind ${t.kind} does not match expected value "databricks"`);let n=r.databricksAuthType==="Token"?r.token:void 0;return{databricksAuthType:r.databricksAuthType,databricksPath:r.path,databricksHost:t.host,databricksToken:n,platformKind:"databricks"}}else if(Woo(r)){if(t.kind!=="fabric")throw new Rs(`User context kind ${t.kind} does not match expected value "databricks"`);return{fabricAuthType:r.fabricAuthType,fabricConnectionString:t.connectionString,platformKind:"fabric"}}else throw new Rs(`Unsupported request credentials type "${r.kind??""}"`)};var KSs=async(r,t=g8())=>{VSs.app("Attempting to cancel run",r);try{let n=await t.currentUser?.getIdToken();if(!n)throw new At("There is no logged in user!");await _P("/scheduler/cancelRun",r,n)}catch(n){let i=Wl(n);throw VSs.error(i),i}};ow();nx();var UQ=nt.METADATA_HYDRATION,G21=nt.DEPLOY,$Ss=(r,t)=>r.operation.metadata?.sourceMapping?.[t]?.customSQL?.customSQL??"",Ph0=r=>typeof r=="object"&&!!r?.hasOwnProperty("stepCounter")&&r.hasOwnProperty("columnCounter"),ZSs=(r,t,n,i)=>{if(!r||!r.columnReferences)return{};{let o=r.columnReferences[0]?.stepCounter??null,s=r.columnReferences[0]?.columnCounter??null;if(!o||!s)return{};let a=t[o];if(!a)return{};let l=x2o(a.operation,s);return l?{node:LAn(a.operation,o),column:Kj(l,n,a.operation.name,i)}:{}}},kh0=(r,t,n,i,o,s,a,l,c)=>{if(HBe(t))return UQ.debugContext(l,`in formatHydratedMetadataMultiSources: source node ${r} does not need to be formatted for multisource`),null;{let u;return UQ.debugContext(l,`in formatHydratedMetadataMultiSources: formatting for ${t.name} at specifiedIndex: ${o}`),o!==null?u=[XSs(r,t,n,i,o,s,a,l,c)]:u=(t.isMultisource?t.metadata.sourceMapping:[t.metadata.sourceMapping[0]]).map((p,f)=>(UQ.debug(`in formatHydratedMetadataMultiSources: formatting at index ${f}. (multisource)`),XSs(r,t,n,i,f,s,a,l,c))),u}},XSs=(r,t,n,i,o,s,a,l,c)=>{let u=ZC(t.sqlType,i,"[formatHydratedSourceMetadata]"),d=FUt(t,o,s),p=t.metadata.sourceMapping[o];if(!p)throw new USe(r,"Cannot format hydrated source metadata");return{name:p.name,columns:t.metadata.columns.map(A=>{let h=A.sourceColumnReferences?.[o],y=Kj(A,u,t.name,c),C=zh0(t,A,n,o,u,c),v={...y,id:A.columnReference.columnCounter,transform:h?h.transform:"",sourceColumns:[ZSs(h,n,u,c)]};return C!==null&&(v.hashDetails=C),v}),join:p.join.joinCondition,dependencies:WEo(r,d,n,i,a,l,c),customSQL:$Ss({operation:t},o)}},WEo=(r,t,n,i,o,s,a)=>{let l=`[FormatHydratedSourceNodes]: For node ${r}: `,c=[],u=[];UQ.debugContext(s,l,`Formatting source dependencies for node ${r} with ${t.length} dependencies: `,t);let d=t.map(p=>{let f=n[p];if(f){let A=i[f.operation.sqlType];return A||(UQ.debugContext(s,l,`Node ${p} was listed as a source dependency, but it's node type ${f.operation.sqlType} was not found`),u.push(`[${p}: ${f.operation.sqlType}]`)),{node:LAn(f.operation,p),columns:f.operation.metadata.columns.map(h=>Kj(h,A,f.operation.name,a))}}else return UQ.debugContext(s,l,`Node ${p} was listed as a source dependency, but was not found in the nodes collection`),c.push(p),{}});if(o&&(c.length||u.length))throw new At(`Could not format source dependencies data for node ${r}. Missing node data for the following dependencies: ${c.length?c.toString():"n/a"}. Missing node types for the following dependencies: ${u.length?u.toString():"n/a"}.`);return d},Pwt=(r,t={})=>{if(!r)return{};try{return JSON.parse(r)}catch(n){UQ.errorContext(t,"Failed to parse runTime parameters. Error: ",n);let{message:i}=n;throw new Error(`${R4i}: ${i}`)}},SUt=r=>typeof r=="string"?Pwt(r):r,LAn=(r,t)=>{let n={operation:r},i=Md(n,{});return i||UQ.debugContext({nodeID:t},`FormatHydratedSQLNodeMetadata: Node ${t} is not a SQL node`),{id:t,name:r.name,nodeType:r.sqlType,location:{name:r.locationName},description:r.description||"",materializationType:i?n.operation.materializationType:"table",isMultisource:i?n.operation.isMultisource:!1,override:{create:{enabled:i?n.operation.overrideSQL??!1:!1,script:i?$Ss(n,0):""}},tests:i?Uh0(r):[]}},Kj=(r,t,n,i)=>{let o=Qh0(r,i);return Lh0(r,o),Fh0(r,o),qh0(r,o,t,n),o},Qh0=(r,t)=>({id:r.columnReference.columnCounter,name:r.name,dataType:r.dataType,description:r.description,nullable:r.nullable,defaultValue:r.defaultValue??"",tests:jh0(r,t)}),Lh0=(r,t)=>{Object.entries(K_i).forEach(([n,i])=>{(r[n]||r.keyColumnType&&n in N5r&&r.keyColumnType===N5r[n])&&(t[i]=!0)})},Fh0=(r,t)=>{for(let n in S7){let i=S7[n];i!==null&&(i in r&&r[i]||r.systemColumnType&&r.systemColumnType===Y_i[i])&&(t[i]=!0)}},qh0=(r,t,n,i)=>{let o=n?.metadata?.nodeMetadataSpec?.systemColumns??null;if(o){let a=Object.fromEntries(o.map(l=>[YSs(l.displayName,i),l.attributeName]))[r.name]??null;a&&(t[a]=!0)}r.config&&Object.entries(r.config).forEach(s=>{t[s[0]]=s[1]})},zh0=(r,t,n,i,o,s)=>{if(!t.hashedColumns||!t.hashedColumns?.length)return null;let a=t.hashedColumns.filter(c=>!!c.columnCounter),l=[];return a.forEach(c=>{let u=r.metadata.columns.find(d=>v5(d.columnReference.columnCounter,c.columnCounter));if(u){let d=Kj(u,o,r.name,s),p=u.sourceColumnReferences?.[i];l.push({...d,transform:p?.transform||"",sourceColumns:[ZSs(p,n,o,s)]})}}),t.hashDetails?.hashAlgorithm?{columns:l,algorithm:t.hashDetails?.hashAlgorithm}:(UQ.debugContext({columnID:t.columnReference.columnCounter},`hydrateHashColumn: Column ${t.columnReference.columnCounter} has hashDetails but no hash algorithm. This is unexpected. Returning null.`),null)},e_s=(r,t)=>{let{name:n,description:i,continueOnFailure:o,runOrder:s}=r;return{name:n,description:i,continueOnFailure:o,runOrder:s,templateString:t}},Uh0=r=>JFr(r).map(n=>e_s(n,n.templateString)),jh0=(r,t)=>UEo(r).map(i=>{let o=i.getTemplateString(r,t);return e_s(i,o)}),Gh0=(r,t,n,i)=>{let s=t.metadata.columns.find(a=>v5(a.columnReference.columnCounter,r.columnCounter));return s?Kj(s,n,t.name,i):{}},Wh0=(r,t,n,i)=>{let o=s=>Object.fromEntries(Object.entries(s).map(([a,l])=>{if(Ph0(l))return[a,Gh0(l,t,n,i)];if(J_i(l)){let c=l.items.map(u=>o(u));return[a,{items:c}]}else return[a,l]}));return o(r)},F3=(r,t,n,i,o,s,a,l,c,u,d=!1)=>{let p="[hydrateMetadata]";UQ.debugContext(c,`Hydrating metadata for step ${t} ${s?`at specified index ${s}`:""}`);let f=ZC(r.sqlType,i,p),A=r.metadata.columns.map(k=>Kj(k,f,r.name,u)),h=[];o&&(h=Object.values(o).map(k=>({database:k.database,schema:k.schema,name:k.locationName})));let y=r.config||{},C=Wh0(y,r,f,u),v=kh0(t,r,n,i,s,l,d,c,u),O=LAn(r,t);return{columns:A,storageLocations:h,config:C,sources:v,node:O,this:"{{ ref_no_link(node.location.name, node.name) }}",parameters:a}};var Zwt=(r,t)=>({operationName:r.name,destinationName:r.locationName,mapping:t});y3t();nx();var HBe=r=>r.sqlType==="Source",dFr=r=>{if(r.scratch){let{scratch:t,...n}=r;return n}return r},JSs=r=>V_(r,["operation","locationName"],"");var r_s=(r,t)=>{let n=[];if(!Md(r,void 0))return n;let i=r?.operation?.metadata?.sourceMapping||[];for(let o of i){let s=o[t]||[];n.push(...s)}return n},Yh0=r=>r_s(r,"dependencies"),Kh0=r=>r_s(r,"noLinkRefs");var dvs=r=>{let t={},n=dFr(r);for(let[i,o]of Object.entries(n)){let s=Yh0(o),a=Kh0(o),l=_$(o);nSr(l,p3,`Node name not found for stepCounter ${i}`);let c=JSs(o),u={nodeName:l,locationName:c};t[i]={dependencies:s,nodeRefLink:u,noLinkDependencies:a}}return t},pvs=r=>{let t=Object.keys(r),n={};for(let o of t){let s=r[o].nodeRefLink;n[s.locationName]||(n[s.locationName]=new Set),n[s.locationName].add(s.nodeName)}let i={};return t.forEach(o=>{if(!r[o].dependencies.every(l=>n[l.locationName]?n[l.locationName].has(l.nodeName):!1)){let{nodeName:l}=r[o].nodeRefLink;i[o]=l}}),i};var Jh0=nt.GRAPH;var Xh0=r=>{let t={},{scratch:n,...i}=r,o=xre(i);zSe(r,(a,l)=>{switch(l.operation.type){case"sourceInput":break;case"sql":{FUt(l.operation,null,o).forEach(u=>{t[u]||(t[u]=new Set),t[u].add(a)});break}default:au("GRAPH",!1,"Unknown step type in get edges lookup")}}),zSe(r,a=>{t[a]||(t[a]=new Set)});let s={};return Object.keys(t).forEach(a=>{s[a]=Array.from(t[a]??[])}),s};var e6t=(r,t)=>{let n=[],i=[];for(let o of r){let s=t.getRef(o);s===void 0?i.push(o):n.push(s)}return{nodeIDsToAdd:n,nonExistentRefs:i}},S1e=class{constructor(t){this.allNodes=t;for(let[n,i]of Object.entries(t)){let{locationName:o,name:s}=i.operation;this.locationMap(o).set(s,n)}}locations=new Map;locationMap(t){let n=this.locations.get(t);if(n)return n;let i=new Map;return this.locations.set(t,i),i}get(t,n){return this.locationMap(t).get(n)}getRef(t){return this.get(t.locationName,t.nodeName)}getDependenciesLookup(){return(0,pet.mapValues)(this.allNodes,t=>FUt(t.operation,null,this))}},xre=r=>new S1e(r),$h0=(r,t)=>{let n=t!==null,i=[];return r===null||HBe(r)?i:r.metadata.sourceMapping?(r.metadata.sourceMapping.forEach((s,a)=>{n&&t===a?s.dependencies.forEach(l=>{i.push(l)}):n||s.dependencies.forEach(l=>{i.push(l)})}),A4(i)):(Jh0.warn("No source mapping found for sql step",r.name),A4(i))},FUt=(r,t,n)=>{let i=[],o=$h0(r,t);if(!o.length)return[];let{nodeIDsToAdd:s}=e6t(o,n);return s.forEach(a=>{!i.includes(a)&&a&&i.push(a)}),i},Zh0=(r,t,n,i)=>{zSe(t,o=>{let{widthOfNode:s,heightOfNode:a}=n(o);return r.setNode(o,{label:"",width:s,height:a}),!0});for(let[o,s]of(0,pet.toPairs)(i))for(let a of s)a in t&&o in t&&r.setEdge(o,a);return r};var eg0=(r,t,n,i)=>{let o=new n_s.graphlib.Graph({});return o.setGraph({...r}),o.setDefaultEdgeLabel(function(){return{}}),Zh0(o,n,t,i)},i_s=r=>{let t=Xh0(r);return eg0({},()=>({widthOfNode:1,heightOfNode:1}),r,t)};var u8e=nt.SEARCH,tg0=new RegExp(/([\+]?){([\s\S]+)}([\+](?![\+]))?\s*/g),rg0=new RegExp(/((\w+):\s*((?:["])((([^\"\+\r\n\[/\\]+))(?:["]))|(([^\"\ \+\r\n\[/\\]+))))/g),ng0=new RegExp(/((?:[^\+\ \r\n\[/\\]|\\.|\[(?:[^\r\n\]\\]|\\.)*\])+)\s*/g),fet=(r,t)=>!!PNr(r,t).length,o_s={name:{MatchFunction:fet,MatchList:r=>[r.operation.name]},location:{MatchFunction:fet,MatchList:r=>[r.operation.locationName]},nodeType:{MatchFunction:fet,MatchList:r=>[r.operation.sqlType]},subgraph:{MatchFunction:fet,MatchList:r=>[r?.folderCounter?.toString(),r.name]},nodeID:{MatchFunction:fet,MatchList:r=>[r]}},s_s=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],l=s[0];a!=="}"&&a!=="+"&&(o=o+r[i+1]),l!=="{"&&l!=="+"&&(o=r[i-1]+o),t.push(o)}),t},ig0=2,og0=1,sg0=3,ag0=2,lg0=5,ug0=8,a_s=(r,t,n)=>{let{steps:i,gFinal:o,allSubgraphs:s,allStepTypesYAML:a}=n,l={},c=d1()?Date.now():performance.now(),u=r;u||(u=t);let d=u.split(/(\}\+?)\s*(or|OR|\|\|)\s*(\+?\{)/).filter(A=>!(A==="OR"||A==="or"||A==="||")),p=s_s(d);p.length||(p=[t]),u8e.debug("got unions",p,"searchStringTouse",u,"defaultSearchString",t,"steps",i),p.forEach(A=>{let h=A.split(/(\}\+?)\s*(and|AND|\,)\s*(\+?\{)/).filter(w=>!(w==="AND"||w==="and"||w===",")),y=s_s(h),C=[];y.forEach(w=>{let R={};u8e.debug("Got intersection:",w);let k=[...w.matchAll(tg0)];if(u8e.debug("Got matches:",w,k),!k[0])return;let z=k[0][ig0],H={prefix:k[0][og0]||"",postfix:k[0][sg0]||""};if(z.indexOf(":")>-1)[...z.trim().matchAll(rg0)].forEach(F=>{let X=F[ag0],Y=F[lg0]||F[ug0];H[X]=Y});else{let F=[...z.trim().matchAll(ng0)][0];F&&(H.name=F[0])}rb(H);let J=H;u8e.debug("Got groups ",w,J);let K=new Set;if(J.subgraph?Object.values(s).forEach(V=>{let F=o_s.subgraph,X=F.MatchList(V);if(F.MatchFunction(X,J.subgraph)){let{steps:L}=V;L.forEach($=>{K.add($.toString())})}else return}):K=new Set(Object.keys(i)),J.nodeType){let{nodeType:V}=J;if(!a[V]){let F=V;Object.entries(a).forEach(([X,Y])=>{Y.name===V&&(F=X)}),J.nodeType=F}}Object.keys(i).forEach(V=>{if(!J){u8e.emerg("got an unexpected undefined value for match",u,J,w);return}let F=K.has(V);if(Object.entries(J).forEach(([X,Y])=>{let L=i[V];if(X==="nodeID"&&(L=V),X==="subgraph"){F=K.has(V);return}let $=o_s[X];if($){let te=$.MatchList(L).filter(ne=>ne!=null);F=F&&$.MatchFunction(te,Y)}}),F){if(R[V]=!0,J.prefix&&o){let X=jFr(o,V,"predecessors");Object.values(X).forEach(Y=>[...Y.keys()].forEach(L=>R[L]=!0))}if(J.postfix&&o){let X=jFr(o,V,"successors");Object.values(X).forEach(Y=>[...Y.keys()].forEach(L=>R[L]=!0))}}}),C.push(R)}),C.length||C.push({});let v={};Object.keys(i).forEach(w=>{v[w]=!0});let O=C.reduce((w,R)=>Object.fromEntries(ZCi(w,R).map(k=>[k,!0])),v);l={...l,...O}});let f=d1()?Date.now():performance.now();return u8e.debug("Time that search took: ",f-c),l},l_s=(r,t,n)=>{let i=a_s(`${r}`,"{ * }",n),o=a_s(`${t}`,"!*",n),s=i;return Object.keys(o).forEach(a=>{delete s[a]}),{stepsResult:s}};var My1=nt.GRAPH,qUt=async(r,t,n)=>{let i=await cg0(r,t);return c8e(t.runDetails,n,i)},cg0=async(r,t)=>{let n=new Set,i=await avs(t.reRunID,r);for(let o of i){let s=await r.run(o).runResults.select();for(let{id:a,runState:l}of s)l==="complete"&&n.add(a)}return n},c8e=(r,t,n)=>pg0(r,t,n||new Set)||new Set(Object.keys(t.steps)),dg0=(r,t,n,i)=>({steps:r,allStepTypesYAML:wzt(n,t),allSubgraphs:i}),pg0=(r,t,n)=>{let i=null,o="",s="";if(r.jobID?{includeSelector:o,excludeSelector:s}=Aso(t,+r.jobID):(r.includeNodesSelector||r.excludeNodesSelector)&&(o=r.includeNodesSelector||"",s=r.excludeNodesSelector||""),o||s||n.size){let a=dg0(t.steps,t.stepTypes,t.installedPackages??{},t.folders);i=new Set(fg0(o,s,a).filter(l=>!n.has(l)))}return i},fg0=(r,t,n)=>{let i=i_s(n.steps);n.gFinal=i;let o=l_s(r,t,n);return Object.keys(o.stepsResult)},Dre=r=>{let t=new Set;for(let n of Object.values(r))for(let i in n)t.add(i);return t};hr();var uLs=Ct(IUt()),cLs=Ct(is()),dLs=Ct(Sre());ds();vr();Pi();ic();hr();vr();Np();vr();ic();ow();hr();ic();vr();var u_s="Invalid connection: Couldn't get a valid token for Databricks user. Update user credentials in Coalesce.";sn();xs();var Ag0=T.object({table_catalog:T.string(),table_schema:T.string(),table_name:T.string(),table_type:T.string(),is_insertable_into:T.string(),commit_action:T.string(),table_owner:T.string(),comment:T.string().nullable(),created:T.string(),created_by:T.string(),last_altered:T.string(),last_altered_by:T.string(),data_source_format:T.string(),storage_sub_directory:T.string().nullable()}),zUt=class extends Lre{validator=Cr("DatabricksInformationSchemaTablesType",Ag0);query(t){return`SELECT * FROM ${eA([t.database],"databricks")}.information_schema.tables where table_schema = '${t.schema}'`}convert(t){let n=t.table_type;(t.table_type==="MANAGED"||t.table_type==="MANAGED_SHALLOW_CLONE"||t.table_type==="BASE TABLE")&&(n="TABLE");let{table_name:i,...o}=t;return{kind:n,name:i,extra:o,comment:""}}},hg0=T.object({table_catalog:T.string(),table_schema:T.string(),table_name:T.string(),column_name:T.string(),ordinal_position:T.number(),column_default:T.string().nullable(),is_nullable:T.union([T.literal("YES"),T.literal("NO")]),full_data_type:T.string(),data_type:T.string(),character_maximum_length:T.number().nullable(),comment:T.string().nullable()}),UUt=class extends Fre{validator=Cr("DatabricksInformationSchemaColumnsType",hg0);query(t){return`SELECT * FROM ${eA([t.database],"databricks")}.INFORMATION_SCHEMA.COLUMNS where table_schema = "${t.schema}"`}convert(t){let{table_catalog:n,table_schema:i,table_name:o,column_name:s,comment:a,...l}=t;return{objectName:o,name:s,comment:a??"",extra:l}}queryForObject(t,n){return`${this.query(t)} and table_name = "${n}"`}},gg0=T.object({databaseName:T.string()}),jUt=class extends qre{validator=Cr("DatabricksShowSchemaRow",gg0);query(t){return`SHOW SCHEMAS IN ${eA([t.database],"databricks")}`}convert(t){return{name:t.databaseName,extra:{}}}};var mg0=nt.PLATFORM,Aet=class extends zre{constructor(n){super("databricks");this.userContext=n}getObjectsImplementation=new zUt;getColumnsImplementation=new UUt;getSchemasImplementation=new jUt;async getDatabaseNames(){return(await this.getRows("SHOW CATALOGS")).map(i=>i.catalog)}async getSchemaNames(n){let i=eA([n],"databricks");return(await this.getRows(`SHOW SCHEMAS IN ${i}`)).map(s=>s.databaseName)}async getVariantRows(n,i,o,s){let a=this.getName(s,o),l=`SELECT ${n} FROM ${a} TABLESAMPLE (${i} ROWS)`;return this.getSQLQueryResult(l)}async getObjectRows(n,i,o){let s=`SELECT * FROM ${this.getName(n,i)} LIMIT 100`;return o&&(s=this.wrapSQLWithExplain(s)),this.getSQLQueryResult(s)}createColumnMetadata(n,i){return{name:n.name,dataType:n.extra.data_type,transform:"",nullable:n.extra.is_nullable==="YES",defaultValue:"",columnReference:{columnCounter:al(),stepCounter:i},description:n.comment||"",appliedColumnTests:{},acceptedValues:{strictMatch:!0,values:[]},config:{},sourceColumnReferences:[{transform:"",columnReferences:[]}]}}async describeObject(n,i,o,s){let a=Yz(i.locationName,n,"[DatabricksBasePlatform.describeObject()]"),l=this.getColumnsImplementation.queryForObject(a,i.name);return(await this.runSQL(l,al())).data.rows.map(u=>this.createColumnMetadata(this.getColumnsImplementation.validateAndConvert(u),s))}async testConnection(){try{await this.runSQL(_7,void 0)}catch(n){let i;throw Vd(n)?n.message===u_s?i=n:i=new At(`Could not validate connection to ${this.name}: ${n.message}`,n.detail):i=new At(`Could not validate connection to ${this.name}`,Wl(n).error.errorDetail),i}}getQueryResultFromTemplateRunResult(n,i){let o=n.runDetails.compiledSQL,s={error:null,fields:[],rows:[],success:!0,sql:o,exportedRefs:[],invalidExportedRefs:[],startTime:i,endTime:new Date,isRunning:!1,name:"",status:n?.data?.status||"Success",type:"sql",queryID:n.runDetails.queryID,warehouse:n.runDetails.warehouse};if(n.data){let a=n.data.columns.map(u=>u.Name),l=n.data.rows.map(u=>({values:NUt(a,u)})),c=n.data.columns.map(u=>({name:u.Name,type:u.DataType}));s.fields=c,s.rows=l}if(n?.runDetails?.exported_refs.length){let a=n.runDetails.exported_refs.map(l=>({locationName:l.location_name,nodeName:l.node_name}));s.exportedRefs=A4(a)}if(n?.runDetails?.invalid_exported_refs.length){let a=n.runDetails.invalid_exported_refs.map(l=>({locationName:l.location_name,nodeName:l.node_name}));s.invalidExportedRefs=A4(a)}return s}convertObjectRowsToMaterializationKinds(n){let i="convertObjectRowsToMaterializationKinds:",o=[],s=[];for(let a of n){let l=a.name.toLowerCase();a.kind==="TABLE"?o.push(l):a.kind==="VIEW"?s.push(l):mg0.errorContext({workspaceID:this.userContext.environmentID?+this.userContext.environmentID:void 0},i,`table ${l} is of unexpected table type ${a.kind} - skipping it`)}return{tables:o,views:s}}createState(n,i,o,s){return new MUt(s,o,i,n)}wrapSQLWithExplain(n){return`EXPLAIN COST ${n}`}};var GUt=class r extends Aet{constructor(n,i){super(i);this.connection=n}async runSQL(n,i){let o=await this.connection.execute({statement:n});return FIs(o,n)}usingConnection=n=>new r(n,this.userContext);teardown(){return this.connection.teardown()}},c_s=async(r,t,n,i,o)=>{let s=await lqt.New(r,t,o,n);i&&await s.test();let a=new GUt(s.getConnection(),r);return{connectionManager:s,platform:a}},d_s=async(r,t)=>{let n=await NRo(r,t);return new GUt(n,r)};Np();var WUt=class r extends det{constructor(n,i){super(i);this.connection=n}async runSQL(n,i){let o=await this.connection.execute({sqlText:n,requestId:i||al()});return r.GetTemplateResultFromExecutionResult(n,o)}static GetTemplateResultFromExecutionResult(n,i){let o=i.stmt.getColumns().map(a=>({Name:a.getName(),DataType:a.getType()}));return{runDetails:{compiledSQL:n,exported_refs:[],invalid_exported_refs:[],ref_usage:{invalid_ref:[],invalid_ref_link:[],invalid_ref_no_link:[],ref:[],ref_link:[],ref_no_link:[]},queryID:i.queryID,warehouse:i.warehouse},data:{columns:o,rows:i.rows,status:i.status}}}usingConnection=n=>new r(n,this.userContext);teardown(){return this.connection.teardown()}},p_s=async(r,t,n,i,o)=>{let s=await uqt.New(r,t,o,n);i&&await s.test();let a=new WUt(s.getConnection(),r);return{connectionManager:s,platform:a}},f_s=async(r,t,n)=>{let i=await yms(r,t,n);return new WUt(i,r)};Np();Np();zv();Ad();xh();hr();vr();var yg0=nt.RUNNER,FAn=class extends At{constructor(){super("No current user, cannot run SQL!")}},het=async(r,t)=>{if(!t){let n=g8().currentUser;if(!n)throw new FAn;t=await n.getIdToken(!1)}return Eg0(r,t)},Eg0=(r,t)=>{let n=r.userContext?.orgID,i=r.userContext.environmentID?+r.userContext.environmentID:void 0;return Bc(`Front-end/runSQL/API: ${r.templateString}`,{orgID:n,workspaceID:i},"RUNNER_BACKEND",async()=>{try{let o=await _P("/scheduler/run",r,t);if(o.data.error)throw new Error(o.data.error);return o.data}catch(o){throw yg0.error("got error on run sql with token",o),o}})};hr();jl();var qAn=nt.TESTING;async function A_s(r,t,n,i,o){let s=r.includes(_Nr)?r:`${r}${_Nr}`,a={clientID:n.clientID,clientSecret:n.clientSecret,connectionString:s,query:t};try{let l=await tw,c=process.env.JAVA_SERVICE_BASE_URL,u=process.env.JAVA_SERVICE_PORT;if(!c&&!wu().isTest){let d=process.env.COALESCE_COA_CLOUD_TOKEN??null;return await het({userContext:{connectionString:a.connectionString,kind:"fabric",credentials:n,authenticator:"oauth",environmentID:o},templateString:t,requestId:al()},d)}else{let d=`${c}:${u}/api/sql/v1/execute`;qAn.infoContext(i,"Fabric request sending query to JDBC");let p=await l.post(d,a);return qAn.infoContext(i,"Fabric request response received from JDBC"),mzt(p.data,a.query)}}catch(l){let c=xje(l);throw qAn.errorContext(i,"error querying the java service",c),c}}vr();var get=class extends dee{name="fabric";userContext;constructor(t,n){super(void 0,n,al(),0,null,void 0),this.userContext=t}async makePendingQuery(t){let{credentials:n,connectionString:i,environmentID:o}=this.userContext,s=async()=>{if(!o)throw new At("Missing environmentID","makePendingQuery");if(!n)throw new At("Failed to load secrets");if(!i)throw new At("Connection string not found");return{rows:(await A_s(i,t.statement,n,this.logContext,o.toString())).data.rows}},a={Cancel:async()=>{},coalesceQueryID:al(),sqlText:t.statement,promise:s(),attachThen:()=>{}};return this.runningQueries.set(a.coalesceQueryID,a),a}async teardown(){return Promise.resolve()}async resetConnection(){throw new ud("resetConnection() is not supported in FabricConnection.")}setQueryTag=async t=>{}},HUt=async(r,t)=>new get(r,t);Np();vr();ic();ow();sn();vr();xs();var bg0=T.object({TABLE_CATALOG:T.string(),TABLE_SCHEMA:T.string(),TABLE_NAME:T.string(),TABLE_TYPE:T.string()}),VUt=class extends Lre{validator=Cr("FabricInformationSchemaTablesType",bg0);query(t){return`SELECT * FROM ${eA([t.database],"fabric")}.INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = '${t.schema}'`}convert(t){let{TABLE_TYPE:n,TABLE_NAME:i}=t;return{kind:n,name:i,comment:"",extra:t}}},Cg0=T.object({table_catalog:T.string(),table_schema:T.string(),table_name:T.string(),column_name:T.string(),ordinal_position:T.number(),column_default:T.string().nullable(),is_nullable:T.union([T.literal("YES"),T.literal("NO")]),data_type:T.string(),character_maximum_length:T.number().nullable()}),YUt=class extends Fre{validator=Cr("FabricInformationSchemaColumnsType",Cg0);query(t){return`SELECT * FROM ${eA([t.database],"fabric")}.INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '${t.schema}'`}convert(t){throw new ud("Fabric is not implemented","FabricInformationSchemaColumnsImplementation - convert")}queryForObject(t,n){return`${this.query(t)} and table_name = "${n}"`}},Ig0=T.object({name:T.string()}),KUt=class extends qre{validator=Cr("FabricShowSchemaRow",Ig0);query(t){return`SELECT name FROM ${eA([t.database],"fabric")}.sys.schemas;`}convert(t){return{name:t.name,extra:{}}}};var met=class extends zre{constructor(n){super("fabric");this.userContext=n}getObjectsImplementation=new VUt;getColumnsImplementation=new YUt;getSchemasImplementation=new KUt;async getDatabaseNames(){return(await this.getRows(V_i)).map(i=>i.name)}async getSchemaNames(n){let i=eA([n],"fabric");return(await this.getRows(`SELECT name FROM ${i}.sys.schemas;`)).map(s=>s.name)}async getVariantRows(n,i,o,s){throw new ud("Fabric is not implemented","getVariantRows")}async getObjectRows(n,i,o){let s=`SELECT TOP 100 * FROM ${this.getName(n,i)}`;return o&&(s=this.wrapSQLWithExplain(s)),this.getSQLQueryResult(s)}mapDataTypePrecision(n){let i=n.DATA_TYPE,o="";switch(i){case"varchar":case"char":o=n.CHARACTER_MAXIMUM_LENGTH?.toString()||"8000";break;case"nvarchar":case"nchar":o=n.CHARACTER_MAXIMUM_LENGTH?.toString()||"4000";break;case"decimal":case"numeric":o=`${n.NUMERIC_PRECISION?.toString()||"38"},${n.NUMERIC_SCALE?.toString()||"0"}`;break;case"datetime2":case"datetimeoffset":case"time":o=n.DATETIME_PRECISION?.toString()||"7";break;default:return i.toUpperCase()}return`${i.toUpperCase()}(${o})`}createColumnMetadata(n,i){let o=this.mapDataTypePrecision(n);return{name:n.COLUMN_NAME,dataType:o,transform:"",nullable:n.IS_NULLABLE==="YES",defaultValue:"",columnReference:{columnCounter:al(),stepCounter:i},description:"",appliedColumnTests:{},acceptedValues:{strictMatch:!0,values:[]},config:{},sourceColumnReferences:[{transform:"",columnReferences:[]}]}}async describeObject(n,i,o,s){let{database:a,schema:l}=Yz(i.locationName,n,"[FabricBasePlatform.describeObject()]"),u=`SELECT COLUMN_NAME, DATA_TYPE, IS_NULLABLE, CHARACTER_MAXIMUM_LENGTH, NUMERIC_PRECISION, NUMERIC_SCALE, DATETIME_PRECISION FROM ${eA([a],"fabric")}.INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '${i.name}' AND TABLE_SCHEMA = '${l}'`;return(await this.runSQL(u,al())).data.rows.map(p=>this.createColumnMetadata(p,s))}async testConnection(){try{await this.runSQL(_7,void 0)}catch(n){throw Vd(n)?new At(`Could not validate connection to ${this.name}: ${n.message}`,n.detail):new At(`Could not validate connection to ${this.name}`,Hv(n).detail)}}getQueryResultFromTemplateRunResult(n,i){let o=n.runDetails.compiledSQL,s={error:null,fields:[],rows:[],success:!0,sql:o,exportedRefs:[],invalidExportedRefs:[],startTime:i,endTime:new Date,isRunning:!1,name:"",status:n.data.status??"Success",type:"sql",queryID:n.runDetails.queryID,warehouse:n.runDetails.warehouse};if(n.data.rows.length){let a=n.data.rows.map(c=>({values:Object.values(c)})),l=Object.keys(n.data.rows[0]??{}).map(c=>({name:c,type:""}));s.fields=l,s.rows=a}if(n?.runDetails?.exported_refs.length){let a=n.runDetails.exported_refs.map(l=>({locationName:l.location_name,nodeName:l.node_name}));s.exportedRefs=A4(a)}if(n?.runDetails?.invalid_exported_refs.length){let a=n.runDetails.invalid_exported_refs.map(l=>({locationName:l.location_name,nodeName:l.node_name}));s.invalidExportedRefs=A4(a)}return s}convertObjectRowsToMaterializationKinds(n){throw new ud("Fabric is not implemented","convertObjectRowsToMaterializationKinds")}createState(n,i,o,s){return new DUt(s,o,i,n)}wrapSQLWithExplain(n){return`SELECT TOP 0 * FROM (${n}) as CoalesceWrapped`}};vr();var zAn=class extends gre{async createConnection(){return await HUt(this.userContext,this.logContext)}async updateFromResult(t){}async assertConnected(){}async setup(){this.newConnection()}newConnection(){return new get(this.userContext,this.logContext)}},JUt=class r extends mre{static async New(t,n,i,o){let s=new r(t,n,i,o);return await s.setup(),s}NewSlotMember(t,n){return new zAn(t,n,{...this.userContext},this.teamInfo,this.logContext)}test(){throw new ud("test() is not implemented in FabricConnectionManager.")}};var XUt=class r extends met{constructor(n,i){super(i);this.connection=n}async runSQL(n,i){let o=await this.connection.execute({statement:n});return mzt(o,n)}usingConnection=n=>new r(n,this.userContext);teardown(){return Promise.resolve()}},h_s=async(r,t,n,i)=>{let o=await JUt.New(r,t,i,n),s=new XUt(o.getConnection(),r);return{connectionManager:o,platform:s}},g_s=async(r,t)=>{let n=await HUt(r,t);return new XUt(n,r)};var $Ut=(r,t,n)=>{switch(r.kind){case"snowflake":return f_s(r,t,n);case"databricks":return d_s(r,t);case"fabric":return g_s(r,t);default:throw new At(`Cannot create backend for '${r.kind}' connection kind`)}},tG=(r,t,n,i,o)=>{switch(r.kind){case"snowflake":return p_s(r,t,n,i,o);case"databricks":return c_s(r,t,n,i,o);case"fabric":return h_s(r,t,n,o);default:throw new At(`Cannot create backend for '${r.kind}' connection kind`)}};vr();Z_();hr();zq();zae();var RL0=Ct(is());vr();RW();cse();Ag();jl();var gE0=Ct(Qws());zq();RW();cse();Ag();kV();zv();Pi();ic();Jq();xh();mFe();vr();sn();var mE0=T.enum(["org-settings-read","org-settings-write","org-users-read","org-users-write","org-users-create","org-users-delete","org-userRoles-read","org-userRoles-write","org-projects-create"]),yE0=T.enum(["project-settings-read","project-summary-read","project-settings-write","project-delete","project-members-read","project-members-add","project-members-write","project-members-remove","project-workspaces-create","project-documentation-read","project-environments-create","project-workspace-settings-read","project-workspace-settings-write","project-workspaces-delete","project-workspace-jobs-create","project-workspace-jobs-read","project-workspace-jobs-write","project-workspace-jobs-delete","project-workspace-macros-create","project-workspace-macros-read","project-workspace-macros-write","project-workspace-macros-delete","project-workspace-node-types-create","project-workspace-node-types-read","project-workspace-node-types-write","project-workspace-node-types-delete","project-workspace-nodes-create","project-workspace-nodes-read","project-workspace-nodes-write","project-workspace-nodes-delete","project-workspace-packages-create","project-workspace-packages-read","project-workspace-packages-write","project-workspace-packages-delete","project-workspace-sql-run","project-workspace-subgraphs-create","project-workspace-subgraphs-read","project-workspace-subgraphs-write","project-workspace-subgraphs-delete"]),EE0=T.enum(["env-run-results-read","env-run-job","env-delete","env-deploy","env-refresh","env-settings-read","env-summary-read","env-settings-write","env-documentation-read","env-members-read","env-members-add","env-members-write","env-members-remove","env-job-schedule-write","env-job-schedule-read"]),eyn={reader:{permissions:["env-run-results-read","env-summary-read","env-documentation-read","env-job-schedule-read"],inheritedEnvironmentRoles:[]},admin:{permissions:[...EE0.options],inheritedEnvironmentRoles:["reader"]}},tyn={member:{permissions:["project-summary-read","project-members-read","project-workspace-sql-run"],inheritedProjectRoles:[],inheritedEnvironmentRoles:[]},contributor:{permissions:["project-settings-read","project-members-read","project-workspaces-create","project-workspace-settings-read","project-workspace-settings-write","project-workspaces-delete","project-workspace-jobs-read","project-workspace-macros-read","project-workspace-node-types-read","project-workspace-nodes-create","project-workspace-nodes-read","project-workspace-nodes-write","project-workspace-nodes-delete","project-workspace-packages-read","project-workspace-subgraphs-read","project-workspace-subgraphs-create","project-workspace-subgraphs-write","project-workspace-subgraphs-delete","project-documentation-read","env-delete","env-documentation-read"],inheritedProjectRoles:["member"],inheritedEnvironmentRoles:["reader"]},architect:{permissions:["project-workspace-jobs-create","project-workspace-jobs-write","project-workspace-jobs-delete","project-workspace-macros-create","project-workspace-macros-write","project-workspace-macros-delete","project-workspace-node-types-create","project-workspace-node-types-write","project-workspace-node-types-delete","project-workspace-packages-create","project-workspace-packages-write","project-workspace-packages-delete","project-workspace-subgraphs-create","project-workspace-subgraphs-write","project-workspace-subgraphs-delete"],inheritedProjectRoles:["contributor"],inheritedEnvironmentRoles:["reader"]},admin:{permissions:[...yE0.options],inheritedProjectRoles:["architect"],inheritedEnvironmentRoles:["admin"]}},ryn={member:{permissions:["org-users-read"],inheritedOrganizationRoles:[],inheritedProjectRoles:[]},contributor:{permissions:["org-projects-create"],inheritedOrganizationRoles:["member"],inheritedProjectRoles:[]},admin:{permissions:[...mE0.options],inheritedOrganizationRoles:["contributor"],inheritedProjectRoles:["admin"]}},Gjt=r=>{let t=eyn[r],n=new Set(t.permissions);for(let i of t.inheritedEnvironmentRoles)Gjt(i).forEach(o=>n.add(o));return Array.from(n)},T8e=r=>{let t=tyn[r],n=new Set(t.permissions);for(let i of t.inheritedProjectRoles)T8e(i).forEach(o=>n.add(o));for(let i of t.inheritedEnvironmentRoles)Gjt(i).forEach(o=>n.add(o));return Array.from(n)},jjt=r=>{let t=ryn[r],n=new Set(t.permissions);for(let i of t.inheritedOrganizationRoles)jjt(i).forEach(o=>n.add(o));for(let i of t.inheritedProjectRoles)T8e(i).forEach(o=>n.add(o));return Array.from(n)},Lws={admin:jjt("admin"),contributor:jjt("contributor"),member:jjt("member")},Fws={admin:T8e("admin"),architect:T8e("architect"),contributor:T8e("contributor"),member:T8e("member")},qws={admin:Gjt("admin"),reader:Gjt("reader")};var Pet=class{throwIfOrgPermissionDenied(t,n=!1){if(!this.hasOrgPermission(t))throw n?new Zu("The requested resource is unavailable"):new Jy("Permission denied",`Permission '${t}' is required to perform this operation.`)}throwIfProjectPermissionDenied(t,n,i=!1){if(!this.hasProjectPermission(t,n))throw i?new Zu("The requested resource is unavailable"):new Jy("Permission denied",`Permission '${t}' is required to perform this operation.`)}throwIfEnvironmentPermissionDenied(t,n,i,o=!1){if(!this.hasEnvironmentPermission(t,n,i))throw o?new Zu("The requested resource is unavailable"):new Jy("Permission denied",`'Permission ${t}' is required to perform this operation.`)}},Wjt=class r extends Pet{constructor(n,i){super();this.userRoles=n;this.hasSuperUserAccess=i;this.userPermissions=this.ConstructPermissionsFromRoles(n)}userPermissions;hasOrgPermissionInternal(n){return this.userPermissions.organizationPermissions?.has(n)}hasOrgPermission(n){return this.hasSuperUserAccess||this.hasOrgPermissionInternal(n)}hasProjectPermissionInternal(n,i){return this.userPermissions.projects[i]?.projectPermissions?.has(n)}hasProjectPermission(n,i){return this.hasSuperUserAccess||this.hasOrgPermissionInternal(n)||this.hasProjectPermissionInternal(n,i)}hasEnvironmentPermissionInternal(n,i,o){return this.userPermissions.projects[i]?.environments[o]?.environmentPermissions?.has(n)}hasEnvironmentPermission(n,i,o){return this.hasSuperUserAccess||this.hasOrgPermissionInternal(n)||this.hasProjectPermissionInternal(n,i)||this.hasEnvironmentPermissionInternal(n,i,o)}ConstructPermissionsFromRoles(n){return n?{organizationPermissions:r.ConstructOrgPermissionsFromRoles(n.organizationRoles),projects:r.ConstructProjectsPermissionsFromRoles(n.projects)}:{organizationPermissions:new Set,projects:{}}}static ConstructEnvironmentPermissionsFromRoles(n){let i=new Set;return n.environmentRoles.forEach(o=>{qws[o].forEach(s=>{i.add(s)})}),i}static ConstructEnvironmentPermissionObjectsFromRoles(n){let i={};return Object.entries(n).forEach(([o,s])=>{i[o]={environmentPermissions:r.ConstructEnvironmentPermissionsFromRoles(s)}}),i}static ConstructProjectPermissionsFromRoles(n){let i=new Set;return n.projectRoles.forEach(s=>{Fws[s].forEach(a=>{i.add(a)})}),{projectPermissions:i,environments:r.ConstructEnvironmentPermissionObjectsFromRoles(n.environments)}}static ConstructProjectsPermissionsFromRoles(n){let i={};return Object.keys(n).forEach(o=>{i[o]=this.ConstructProjectPermissionsFromRoles(n[o])}),i}static ConstructOrgPermissionsFromRoles(n){let i=new Set;return n.forEach(o=>{Lws[o].forEach(s=>{i.add(s)})}),i}};var Hjt=class extends Pet{constructor(n,i){super();this.userRole=n;this.hasSuperUserAccess=i}hasOrgPermission(n){if(this.hasSuperUserAccess||this.userRole==="Admin")return!0;{let i=["org-settings-read","org-settings-write","org-users-read","org-users-write","org-users-delete"];return this.userRole==="User"&&!i.includes(n)}}hasProjectPermission(n,i){return!!this.userRole||this.hasSuperUserAccess}hasEnvironmentPermission(n,i,o){return!!this.userRole||this.hasSuperUserAccess}};Z_();Pi();var bE0=(r,t)=>{if(t=t===void 0?aIi:t,r<=1||t<=1)return 1;let s=r<=4?r:Math.floor((r-4)/2)+4;return Math.min(s,t)},lG=(r,t)=>{let n=bE0(r,t),i=lIi,o=i<n?i:n;return o>0?o:1};ow();Ad();RV();Pi();xh();hr();var Qv1=nt.FIREBASE;var zws=(r,t)=>oli(r.collection("users").doc(t)).then(n=>({fbEmail:"",fbRole:n.data()?.role,fbUserID:t,fbTeamID:n.data()?.currentTeam,fbOrg:n.data()?.organization,fbFullName:`${n.data()?.firstName} ${n.data()?.lastName}`,fbFirstName:n.data()?.firstName,fbLastName:n.data()?.lastName,fbHasSuperUserAccess:n.data()?.hasSuperUserAccess,fbActivated:n.data()?.activated??!0,hasProvisioningAccess:n.data()?.hasProvisioningAccess}));var Uws=async(r,t)=>(await r.org(t).fetch()).superDebugEnabled;var jws=Ct(is());RV();Pi();yo();xh();jl();hr();yo();hr();var IE0=Ct(is()),Gv1=nt.FIREBASE,vE0=()=>{let r={organization:{},project:{},environment:{}},t=(n,i,o)=>{for(let s of o(n))i.add(s),t(s,i,o);return Array.from(i)};for(let n of Eqe.options)r.organization[n]=t(n,new Set,i=>ryn[i].inheritedOrganizationRoles);for(let n of b5r.options)r.project[n]=t(n,new Set,i=>tyn[i].inheritedProjectRoles);for(let n of C5r.options)r.environment[n]=t(n,new Set,i=>eyn[i].inheritedEnvironmentRoles);return r},Wv1=vE0();sn();yo();var Kv1=Ip({firstName:Wa(),lastName:Wa(),role:Wa(),currentTeam:Wa(),email:Wa(),password:Wa().optional(),accountType:Wa(),hasSuperUserAccess:gB().optional(),hasProvisioningAccess:gB().optional(),activated:gB().optional(),authDisabled:gB().optional(),multiFactorIsEnabled:gB().optional(),deleted:gB().optional()}),Jv1=vEe.pick({firstName:!0,lastName:!0,role:!0,currentTeam:!0,email:!0,activated:!0,password:!0,accountType:!0,version:!0}).extend({rbacRole:Eqe.optional()}).strict(),Xv1=vEe.partial({firstName:!0,lastName:!0,role:!0,activated:!0,authDisabled:!0,deleted:!0,phoneNumber:!0,currentTeam:!0,email:!0,accountType:!0}).strict();var h41=nt.FIREBASE,g41=nt.USER_ACTIVATION;var m41=new RegExp("(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[!\"#$%&'()*+,-.\\/:;<=>?@[\\]\\^_`{|}~]).{8,}");var Gws=r=>{let t={canUpdateUser:["Admin"],canUpdateSuperUser:[],canResetPassword:["Admin"]};return n=>t[n].includes(r)};kV();yo();hr();vr();ds();Ag();var _E0=500,OE0=10*1024*1024,TE0=.7*OE0,Vjt=class{constructor(t){this.firestoreOperations=t;this.batch=t.batch(),this.batchSize=0,this.requestSize=0,this.batchesCommitted=0}batch;batchSize;requestSize;batchesCommitted;batchIncrement=async(t,n)=>{let i=Gq(t)+Gq(n),o=this.requestSize+i>=TE0,s=this.batchSize+1>=_E0;o||s?(await this.commit(),this.batchSize=1,this.requestSize=i,this.batch=this.firestoreOperations.batch()):(this.batchSize+=1,this.requestSize+=i)};async save(t,n){let i=t,o=i.prepareDataForSave(n);await this.batchIncrement(o,i.docRef.path),this.firestoreOperations.saveDocBatch(this.batch,i.docRef,o)}async merge(t,n){let i=t,o=i.prepareDataForMerge(n);await this.batchIncrement(o,i.docRef.path),this.firestoreOperations.updateDocBatch(this.batch,i.docRef,o)}async delete(t,n){let i=t,o=i.docRef;if(await this.batchIncrement(n,o.path),this.firestoreOperations.deleteDocBatch(this.batch,i.docRef),o.parent.id==="steps"){let s=this.firestoreOperations.collectionRef(o.parent.parent,"deletedSteps"),a=this.firestoreOperations.docRef(s,o.id),l={deletedAt:this.firestoreOperations.getServerTimestampSentinel()};await this.batchIncrement(l,a.path),this.firestoreOperations.saveDocBatch(this.batch,a,l)}}async commit(){return o0().info("committing batch!"),this.batchSize&&(this.batchesCommitted+=1,await this.firestoreOperations.commitBatch(this.batch)),this.batchesCommitted}};vr();var Yjt=r=>r?r?.message??"":"",wE0=r=>/(PERMISSION_DENIED)|(false for 'get')|(false for 'list')|(false for 'update')|(false for 'delete')|(Missing or insufficient permissions.)/.test(Yjt(r)),RE0=r=>/NOT_FOUND/.test(Yjt(r)),ket=r=>wE0(r)?new Jy("Permission denied",Yjt(r)):RE0(r)?new Zu("Not found",Yjt(r)):r,bR=async r=>{try{return await r}catch(t){throw ket(t)}};var ene=class extends mle{constructor(n,i,o,s,a,l){super(n);this.id=n;this.ref=i;this.subCollectionNames=o;this.parent=s;this.logContext=a;this.firestoreOperations=l}subCollections=[];runTransaction(n,i){let o=n?.transaction;return bR(o?i(n):this.firestoreOperations.runTransaction(s=>i({...n??{},transaction:s})))}getSubCollection(n,i){let o=this.subCollections[n];return o||(o=new i(this.firestoreOperations.collectionRef(this.ref,n),this,this.logContext,this.firestoreOperations),this.subCollections[n]=o),o}};vr();yo();var Wws=Ct(is());Ag();var Xs=class extends ene{constructor(n,i,o,s,a,l){super(n.id,n,[],o,s,a);this.collectionRef=n;this.dataTransform=i;this.EntityRepositoryConstructor=l}get path(){return this.collectionRef.path}get(n){let i=this.firestoreOperations.docRef(this.collectionRef,n.toString());return new this.EntityRepositoryConstructor(n,i,this.parent,this.logContext,this.firestoreOperations)}async select(n,i){let o=i?.transaction,s=this.firestoreOperations.createQuery(this.collectionRef,n),a;return o?a=await bR(o.getQuery(s)):a=await bR(this.firestoreOperations.runQuery(s)),a.docs.map(l=>this.transformDataFromStorage(l.ref,this.firestoreOperations.data(l),i))}async createEntity(n,i){let o=i?.transaction,s=await this.generateID(n),a=this.firestoreOperations.docRef(this.collectionRef,s?.toString()),l=await this.prepareDataForCreate(n,s??a.id,i);return o?o.set(a,l):await bR(this.firestoreOperations.addDoc(a,l)),new this.EntityRepositoryConstructor(s||a.id,a,this.parent,this.logContext,this.firestoreOperations)}listenCollection(n,i,o){let[s,a]=this.getListenCallbacks(n,i,o);return this.firestoreOperations.onCollectionSnapshot(this.collectionRef,s,a)}listenQuery(n,i,o,s){let[a,l]=this.getListenCallbacks(i,o,s);return this.firestoreOperations.onQuerySnapshot(this.firestoreOperations.createQuery(this.collectionRef,n),a,l)}async prepareDataForCreate(n,i,o){let s=n.createdBy??this.firestoreOperations.currentUser(),a={...(0,Wws.cloneDeep)(n),id:i,createdAt:p8(),createdBy:s,updatedAt:p8(),updatedBy:s};return this.dataTransform.toStorage(i.toString(),`${this.path}/${i}`,a,this.firestoreOperations,o)}getListenCallbacks(n,i,o){return[s=>{let a=this.firestoreOperations.snapShotChanges(s).reduce((l,c)=>{try{let u=this.transformDataFromStorage(c.doc.ref,c.doc.data(),o);l.push({type:c.type==="added"?"added":c.type==="removed"?"removed":"modified",value:u,id:u.id.toString(),hasPendingWrites:this.firestoreOperations.hasPendingWrites(c.doc)})}catch(u){i&&i(u)}return l},[]);o0().debug(`Listener notification for ${a.length} changes in collection ${this.path}`),n(a)},s=>{o0().error(`Firestore error listening to collection ${this.path}`,s),i&&i(ket(s))}]}transformDataFromStorage(n,i,o){return this.dataTransform.fromStorage(n.id,n.path,i,this.firestoreOperations,o)}async generateID(n){return n.id}async getCount(){return this.firestoreOperations.getCount(this.collectionRef)}async selectInBatches(n,i){return(await this.firestoreOperations.selectInBatches(this.collectionRef,n,i)).map(a=>a.docs).flat().map(a=>this.transformDataFromStorage(a.ref,this.firestoreOperations.data(a)))}};var Qet=Ct(is());vr();Ag();var $s=class extends ene{constructor(n,i,o,s,a,l,c=[]){super(n,i,c,s,a,l);this.docRef=i;this.dataTransform=o}get path(){return this.docRef.path}async fetch(n){let i=n?.transaction,o;if(i?o=await bR(i.get(this.docRef)):o=await bR(this.firestoreOperations.getDoc(this.docRef,n)),!o.exists)throw o0().info(`Document ${this.path} not found`),new Zu(`Entity ${this.path} not found`);return this.dataTransform.fromStorage(this.id.toString(),this.path,this.firestoreOperations.data(o),this.firestoreOperations,n)}async save(n,i){let o=i?.transaction,s=this.prepareDataForSave(n,i);o?o.set(this.docRef,s):await bR(this.firestoreOperations.saveDoc(this.docRef,s))}async merge(n,i){let o=i?.transaction,s=this.prepareDataForMerge(n,i);o?o.update(this.docRef,s):await bR(this.firestoreOperations.updateDoc(this.docRef,s))}fetchAndMerge(n,i){return this.runTransaction(i,async o=>{let s=await this.fetch(o);return this.save(this.mergeWithDeletes(s,n),o)})}async delete(n){let i=n?.transaction;i?i.delete(this.docRef):await bR(this.firestoreOperations.deleteDoc(this.docRef))}listen(n,i,o){let s=!0;return this.firestoreOperations.onDocSnapshot(this.docRef,a=>{if(this.firestoreOperations.exists(a))try{o0().debug(`Listener notification for document ${this.path} modified`),n({type:s?"added":"modified",value:this.dataTransform.fromStorage(this.id.toString(),this.path,this.firestoreOperations.data(a),this.firestoreOperations,o),id:this.id.toString(),hasPendingWrites:this.firestoreOperations.hasPendingWrites(a)}),s=!1}catch(l){i&&i(l)}else o0().debug(`Listener notification for document ${this.path} removed`),n({type:"removed",id:a.id,hasPendingWrites:this.firestoreOperations.hasPendingWrites(a)})},a=>{o0().error(`Firestore error listening to document ${this.path}`,a),i&&i(ket(a))})}prepareDataForSave(n,i){if(n.id&&n.id?.toString()!==this.docRef.id)throw new Rs(`Attempt to assign a new ID to entity ${this.path} `);let o=this.firestoreOperations.currentUser(),s=this.id.toString(),a={id:this.id,...(0,Qet.cloneDeep)(n),createdAt:n.createdAt??p8(),createdBy:n.createdBy??o,updatedAt:p8(),updatedBy:o};return this.dataTransform.toStorage(s,this.path,a,this.firestoreOperations,i)}prepareDataForMerge(n,i){let o=n.id;if(o&&o.toString()!==this.docRef.id)throw new Rs(`Attempt to assign a new ID to entity ${this.path} `);let s={...(0,Qet.cloneDeep)(n),updatedAt:p8(),updatedBy:this.firestoreOperations.currentUser()};return this.dataTransform.mergeToStorage(this.id.toString(),this.path,s,this.firestoreOperations)}mergeWithDeletes(n,i){return Hce(this.path,o=>o instanceof hle?[void 0,!0]:[o,!1],(0,Qet.merge)(n,i))}};yo();Np();yo();var BE0=Os.merge(cSi),xE0=_a("GitAccount",BE0),Hws=Oa(xE0),nyn=class extends $s{constructor(t,n,i,o,s){super(t,n,Hws,i,o,s)}},Kjt=class extends Xs{constructor(t,n,i,o){super(t,Hws,n,i,o,nyn)}async generateID(t){return t.id??al()}};Np();yo();var ME0=Os.merge(KSi),DE0=_a("ProjectGitAccount",ME0),Vws=Oa(DE0),iyn=class extends $s{constructor(t,n,i,o,s){super(t,n,Vws,i,o,s)}},Jjt=class extends Xs{constructor(t,n,i,o){super(t,Vws,n,i,o,iyn)}async generateID(t){return t.id??al()}};var NE0=Os.merge(fSi),PE0=_a("GlobalUserSettings",NE0),Yws=Oa(PE0),oyn=class extends $s{constructor(t,n,i,o,s){super(t,n,Yws,i,o,s,["gitAccounts","projectGitAccounts"])}get gitAccounts(){return this.getSubCollection("gitAccounts",Kjt)}gitAccount(t){return this.gitAccounts.get(t)}get projectGitAccounts(){return this.getSubCollection("projectGitAccounts",Jjt)}projectGitAccount(t){return this.projectGitAccounts.get(t)}},Xjt=class extends Xs{constructor(t,n,i,o){super(t,Yws,n,i,o,oyn)}};Np();yo();var kE0=Os.merge(X_r),QE0=_a("Project",kE0),Kws=Oa(QE0),syn=class extends $s{constructor(t,n,i,o,s){super(t,n,Kws,i,o,s)}},$jt=class extends Xs{constructor(t,n,i,o){super(t,Kws,n,i,o,syn)}async generateID(t){return t.id??al()}};sn();vr();yo();hr();hr();var LE0=nt.FIREBASE,Zjt=class extends ty{transformFromStorage(t,n,i){let o=[];return i.hasOwnProperty("endTime")&&(o.push("Removing property 'endTime'"),delete i.endTime),(!i.version||i.version<=3)&&(o.push(`Updating version ${i?.version} to 3`),i.version=3),i.runType==="refresh"&&i.runDetails&&!i.runDetails.environmentID&&(o.push('Setting missing runDetails.environmentID to "0"'),i.runDetails.environmentID="0"),LE0.debug(`Patched run ${n}`,o),i}};yo();hr();var FE0=nt.FIREBASE,eGt=class extends ty{transformFromStorage(t,n,i){let o=[];return!i.queryResultSequence&&Array.isArray(i.history)&&i.history.length>0&&(o.push("Moving 'history[0]' to 'queryResultSequence'"),i.queryResultSequence=i.history[0]?.queryResultSequence,delete i.history),(i.runExecutionSequenceID===void 0||i.runExecutionSequenceID===null)&&(o.push("Setting 'runExecutionSequenceID' to zero"),i.runExecutionSequenceID=0),(i.name===void 0||i.name===null)&&(o.push("Setting 'name' to 'unknown'"),i.name="unknown"),i.queryResultSequence?.queryResults?.map((s,a)=>{s.isRunning!==!0&&typeof s=="object"&&(s.status||(o.push(`Setting 'status' to 'Failure' for query result ${a}`),s.status="Failure"),s.type||(o.push(`Setting 'type' to 'sql' for query result ${a}`),s.type="sql"),s.exportedRefs||(o.push(`Setting 'exportedRefs' to empty array for query result ${a}`),s.exportedRefs=[]),s.invalidExportedRefs||(o.push(`Setting 'invalidExportedRefs' to empty array for query result ${a}`),s.invalidExportedRefs=[]),s.fields||(o.push(`Setting 'fields' to empty array for query result ${a}`),s.fields=[]),s.sql||(o.push(`Setting 'sql' to empty string for query result ${a}`),s.sql=""),s.rows||(o.push(`Setting 'rows' to empty array for query result ${a}`),s.rows=[]),s.startTime||(o.push(`Setting 'startTime' to ${eZ.toISOString} for query result ${a}`),s.startTime=eZ),s.endTime||(o.push(`Setting 'endTime' to ${eZ.toISOString} for query result ${a}`),s.endTime=eZ),s.fields?.map((l,c)=>{o.push(`Setting 'type' to 'unknown' for field ${c} of query result ${a}`),l.type||(l.type="unknown")}),s.error?.message&&(s.error.errorString||(o.push(`Setting 'error.errorString' to 'error.message' for query result ${a}`),s.error.errorString=s.error.message),o.push(`Removing 'error.message' for query result ${a}`),delete s.error.message),s.error?.originalError&&(o.push(`Removing 'error.originalError' from query result ${a}`),delete s.error.originalError))}),i.runResultVersion=2,i.version=2,o.length>0&&FE0.debug(`Patched run result ${n}`,o),i}};var qE0=Os.merge(p3t),zE0=_a("QueryResult",qE0),nGt=Oa(zE0),ayn=class extends $s{constructor(t,n,i,o,s){super(t,n,nGt,i,o,s)}},lyn=class extends Xs{constructor(t,n,i,o){super(t,nGt,n,i,o,ayn)}},uyn=class extends $s{constructor(t,n,i,o,s){super(t,n,nGt,i,o,s)}},cyn=class extends Xs{constructor(t,n,i,o){super(t,nGt,n,i,o,uyn)}},UE0=Os.merge(h3t),jE0=_a("RunResult",UE0),iGt=Oa(jE0,new eGt),dyn=class extends $s{constructor(t,n,i,o,s){super(t,n,iGt,i,o,s,["queryResults"])}get queryResults(){return this.getSubCollection("queryResults",lyn)}queryResult(t){return this.queryResults.get(t)}},tGt=class extends Xs{constructor(t,n,i,o){super(t,iGt,n,i,o,dyn)}},pyn=class extends $s{constructor(t,n,i,o,s){super(t,n,iGt,i,o,s,["queryResults"])}get queryResults(){return this.getSubCollection("queryResults",cyn)}queryResult(t){return this.queryResults.get(t)}},rGt=class extends Xs{constructor(t,n,i,o){super(t,iGt,n,i,o,pyn)}};var Let=(r,t,n)=>{let i=typeof r=="string"?parseInt(r):r;if(isNaN(i)||i===void 0)throw new t(`Missing or invalid environment ID '${r}' context=${JSON.stringify(n)}`);return i};var tne=nt.FIREBASE,GE0=T.discriminatedUnion("runType",[Os.merge(c5r),Os.merge(d5r),Os.merge(p5r)]),WE0=_a("Run",GE0),aGt=Oa(WE0,new Zjt,!0),fyn=class extends $s{constructor(t,n,i,o,s){super(t,n,aGt,i,{...o,runID:t},s,["runResults"])}get runResults(){return this.getSubCollection("runResults",tGt)}runResult(t){return this.runResults.get(t)}async updateHeartbeat(t={},n){return this.merge({...t,runHeartbeat:p8()},n)}},oGt=class extends Xs{constructor(t,n,i,o){super(t,aGt,n,i,o,fyn)}async createDeployRun(t,n){let i=t.runDetails.environmentID?Let(t.runDetails.environmentID,Rs,this.logContext):Let(t.runDetails.toWorkspaceID,Rs,this.logContext),o={...this.logContext,environmentID:i},s=(c,u)=>($Fr(c,"deploy",t.runDetails.forcedDeployment,o),{status:"Deploying",currentlyRunningJobs:c.currentlyRunningJobs?c.currentlyRunningJobs.concat(u):u}),a={...t,runDetails:{...t.runDetails}};if(delete a.runDetails.fromWorkspaceData,a.runDetails.version===2)for(let c of h_i)delete a.runDetails[c];else for(let c of f_i)delete a.runDetails[c];let l=await hyn(this,i,a,s,n);return vye(o,l.id),tne.infoContext(o,"FirestoreOrgRepo createDeployRun: finished securing workspace"),l}async createRefreshRun(t,n){let i=Let(t.runDetails.environmentID,Rs,this.logContext),o={...this.logContext,environmentID:i},a=await hyn(this,i,t,(l,c)=>($Fr(l,"refresh",t.runDetails.forceIgnoreWorkspaceStatus,o),{status:l.status==="Failed Deploy"?l.status:"Refreshing",currentlyRunningJobs:l.currentlyRunningJobs?l.currentlyRunningJobs.concat(c):c}),n);return vye(o,a.id),tne.infoContext(o,"FirestoreOrgRepo createRefreshRun: finished securing workspace"),a}},Ayn=class extends $s{constructor(t,n,i,o,s){super(t,n,aGt,i,{...o,runID:t},s,["runResults"])}get runResults(){return this.getSubCollection("runResults",rGt)}runResult(t){return this.runResults.get(t)}async updateHeartbeat(t={}){let n=this.prepareDataForMerge(t);n.runHeartbeat=this.firestoreOperations.getServerTimestampSentinel(),await this.firestoreOperations.updateDoc(this.docRef,n)}},sGt=class extends Xs{constructor(t,n,i,o){super(t,aGt,n,i,o,Ayn)}async createDevRun(t){let n=Let(t.runDetails.environmentID,Rs,this.logContext),i={...this.logContext,environmentID:n},o=(a,l)=>{if(!a.devEnv)throw new Rs(`Unable to secure ${a.name}`,`${a.name} is a not a development workspace, context=${JSON.stringify(i)}`);return{currentlyRunningDevJobs:a.currentlyRunningDevJobs?a.currentlyRunningDevJobs.concat(l):l}};delete t.runDetails.dependencies;let s=await hyn(this,n,t,o);return vye(i,s.id),tne.infoContext(i,"FirestoreOrgRepo createDevRun: finished securing workspace"),s}},hyn=(r,t,n,i,o)=>{let s=r.parent.workspace(t),a={...r.logContext,environmentID:t};return r.runTransaction(o,async l=>{tne.infoContext(a,"securing workspace status");let[c,u]=await Promise.all([s.fetch(l),r.parent.getNextCounter(r.id.substring(0,r.id.length-1),1,l)]);vye(a,u),tne.infoContext(a,"got workspace doc data, updating workspace",{status:c?.status,jobs:c?.currentlyRunningJobs});let d=()=>{try{return i(c,[u])}catch(A){if(tne.errorContext(a,"createRun: error updating workspace",{error:A}),A instanceof oZ){let h=A.detail??`${c.name} is in state ${c.status},`;throw new r_(A.message,h+` context=${JSON.stringify(a)}.`)}throw A}};await s.merge(d(),l),tne.infoContext(a,`Run ${u} will use the following mappings:`,c.mappingsV1),tne.infoContext(a,"reserving run");let p=await r.prepareDataForCreate(n,u);p.runStartTime=r.firestoreOperations.getServerTimestampSentinel(),p.runHeartbeat=r.firestoreOperations.getServerTimestampSentinel();let f=r.get(u);return l.transaction.set(f.docRef,p),f})};yo();yo();var HE0=Os.merge(v7),VE0=_a("Macro",HE0),Jws=Oa(VE0,void 0,!0),gyn=class extends $s{constructor(t,n,i,o,s){super(t,n,Jws,i,o,s)}},lGt=class extends Xs{constructor(t,n,i,o){super(t,Jws,n,i,o,gyn)}};yo();var YE0=Os.merge(c3t),KE0=_a("NodeType",YE0),Xws=Oa(KE0),myn=class extends $s{constructor(t,n,i,o,s){super(t,n,Xws,i,o,s)}},uGt=class extends Xs{constructor(t,n,i,o){super(t,Xws,n,i,o,myn)}async generateID(t){return t.id??(await this.parent.parent.getNextCounter("template")).toString()}};Np();sn();ds();yo();vr();var JE0=T.discriminatedUnion("type",[Os.merge(Fi.merge(fY)),Os.merge(Fi.merge(AY))]),XE0=_a("Node",JE0),$ws=Oa(XE0,new Lwt),yyn=class extends $s{constructor(t,n,i,o,s){super(t,n,$ws,i,{...o,nodeID:t},s)}async delete(t){if(await super.delete(t),this.docRef.parent.id==="steps"){let n=this.firestoreOperations.collectionRef(this.docRef.parent.parent,"deletedSteps"),i=this.firestoreOperations.docRef(n,this.id);await this.firestoreOperations.saveDoc(i,{deletedAt:this.firestoreOperations.getServerTimestampSentinel()})}}mergeMetadata(t,n){return this.merge(Object.fromEntries(Object.entries(t).map(([i,o])=>[`metadata.${i}`,o])),n)}},cGt=class extends Xs{constructor(t,n,i,o){super(t,$ws,n,i,o,yyn)}async generateID(t){return t.id??al()}listenCollection(t,n,i){throw new ud("The firestore nodes repository listener is not implemented. Use listenCollectionOverride")}listenCollectionOverride(t,n,i,o,s){let[a,l]=this.getListenCallbacks(t,o,s),c=this.firestoreOperations.onCollectionSnapshot(this.collectionRef.orderBy("updatedAt").startAfter(n),a,l),u=p=>{let A=[...p.docChanges()].map(h=>({type:"removed",id:h.doc.id,doc:h.doc,oldIndex:-1,newIndex:-1})).filter(h=>{let y=h.doc.data(),C=i[h.doc.id];if(C)if(C.updatedAt){let v=new Date(C.updatedAt),O=y.deletedAt?y.deletedAt.toDate():v;return v<=O}else return!0;return!1}).map(h=>({type:"removed",value:{id:h.doc.id},id:h.doc.id,hasPendingWrites:!1}));t(A)},d=this.firestoreOperations.onCollectionSnapshot(this.collectionRef.parent.collection("deletedSteps").orderBy("deletedAt").startAfter(n),u,l);return()=>{c(),d()}}convertFromRestAPIStorage(t,n){return this.transformDataFromStorage({id:n},t)}async getNodesLocationInfo(){let t=this.firestoreOperations.createQuery(this.collectionRef,{selectFields:["id","name","locationName","sqlType","type"]}),n=await this.firestoreOperations.runQuery(t),i={};return n.forEach(o=>{let s=aSi.verify({operation:{...o.data()}});i[o.id]=s}),i}};vr();yo();var $E0=Os.merge(yqe),ZE0=_a("Subgraph",$E0),Zws=Oa(ZE0),Eyn=class extends $s{constructor(t,n,i,o,s){super(t,n,Zws,i,o,s)}fetchAndMerge(t,n){return n?.uniquenessConstraints?this.runTransaction(n,async i=>{if((await this.fetch(i)).name!==t.name&&(await this.parent.subgraphs.select({where:[[n.uniquenessConstraints.field,"in",n.uniquenessConstraints.values]]},i)).length>0)throw new r_(`${n.uniquenessConstraints.field} must be unique`);let a=this.prepareDataForMerge(t,n);return i.transaction.update(this.docRef,a)}):super.fetchAndMerge(t,n)}},dGt=class extends Xs{constructor(t,n,i,o){super(t,Zws,n,i,o,Eyn)}createEntity(t,n){return n?.uniquenessConstraints?this.runTransaction(n,async i=>{if((await this.select({where:[[n.uniquenessConstraints.field,"in",n.uniquenessConstraints.values]]},i)).length>0)throw new r_(`${n.uniquenessConstraints.field} must be unique`);let s=await this.generateID(t),a=this.firestoreOperations.docRef(this.collectionRef,s?.toString()),l=await this.prepareDataForCreate(t,s??a.id,n);return i.transaction.set(a,l),new this.EntityRepositoryConstructor(s||a.id,a,this.parent,this.logContext,this.firestoreOperations)}):super.createEntity(t,n)}};sn();yo();hr();var eb0=nt.FIREBASE,pGt=class extends ty{transformFromStorage(t,n,i){let o=[];return["connectionDetails","authenticator"].forEach(s=>{i?.connectionDetails?.hasOwnProperty(s)&&(o.push(`deleting property 'connectionDetails.${s}']`),delete i.connectionDetails[s])}),o.length>0&&eb0.debug(`Patched workspace user ${n}`,o),i}};var tb0=T.union([Os.merge(I5r),Os.merge(v5r),Os.merge(S5r)]),rb0=_a("WorkspaceUser",tb0),e6s=Oa(rb0,new pGt),byn=class extends $s{constructor(t,n,i,o,s){super(t,n,e6s,i,o,s)}},fGt=class extends Xs{constructor(t,n,i,o){super(t,e6s,n,i,o,byn)}};hr();yo();var nb0=nt.FIREBASE,AGt=class extends ty{transformFromStorage(t,n,i){let o=i,s=[];return o.status||(s.push("setting missing 'status' property to 'initializing'"),o.status="Initializing"),o.version||(s.push(`setting missing 'version' property to '${fEe}'`),o.version=fEe),o.tagColors||(s.push("Setting missing 'tagColors' property to default"),o.tagColors={backgroundColor:cFr,textColor:"#e5e5e5"}),o.mappingsV1||(s.push("Setting missing 'mappingsV1' property to '{}'"),o.mappingsV1="{}"),o.version===0&&(o.mappings||(s.push("Setting missing 'mappings' property to empty object"),o.mappings={}),o.deployedWorkspaces||(s.push("Setting missing 'deployedWorkspaces' property to empty object"),o.deployedWorkspaces={})),(o.mappingsV1===null||o.mappingsV1===void 0)&&(s.push("Settings missing 'mappingsV1' property to an empty string"),o.mappingsV1=""),o.name||(o.name=`Workspace${t}`,s.push(`Setting missing 'name' property to '${o.name}`)),s.length>0&&nb0.debug(`Patched workspace ${n}:`,s),o}};yo();var ib0=Os.merge(gY),ob0=_a("Job",ib0),t6s=Oa(ob0),Cyn=class extends $s{constructor(t,n,i,o,s){super(t,n,t6s,i,o,s)}},hGt=class extends Xs{constructor(t,n,i,o){super(t,t6s,n,i,o,Cyn)}async generateID(t){return t.id??this.parent.parent.getNextCounter("job")}};yo();var sb0=Os.merge(bEe),ab0=_a("InstalledPackage",sb0),r6s=Oa(ab0),Iyn=class extends $s{constructor(t,n,i,o,s){super(t,n,r6s,i,o,s)}},gGt=class extends Xs{constructor(t,n,i,o){super(t,r6s,n,i,o,Iyn)}};Np();_5r();var lb0=Os.merge(L_i),ub0=_a("NodeLastRefreshed",lb0),n6s=Oa(ub0,void 0,!0),vyn=class extends $s{constructor(t,n,i,o,s){super(t,n,n6s,i,{...o,nodeID:t},s)}},mGt=class extends Xs{constructor(t,n,i,o){super(t,n6s,n,i,o,vyn)}async generateID(t){return t.id??al()}};var cb0=Os.merge(Y4i),db0=_a("Workspace",cb0),i6s=Oa(db0,new AGt,!0),Syn=class extends $s{constructor(t,n,i,o,s){super(t,n,i6s,i,o,s,["jobs","macros","nodes","nodeTypes","subgraphs","users","installedPackages","nodesLastRefreshed"])}get installedPackages(){return this.getSubCollection("installedPackages",gGt)}installedPackage(t){return this.installedPackages.get(t)}get jobs(){return this.getSubCollection("jobs",hGt)}job(t){return this.jobs.get(t)}get macros(){return this.getSubCollection("macros",lGt)}macro(t){return this.macros.get(t)}get nodes(){return this.getSubCollection("steps",cGt)}node(t){return this.nodes.get(t)}get nodesLastRefreshed(){return this.getSubCollection("nodesLastRefreshed",mGt)}nodeLastRefreshed(t){return this.nodesLastRefreshed.get(t)}get nodeTypes(){return this.getSubCollection("templates",uGt)}nodeType(t){return this.nodeTypes.get(t)}get subgraphs(){return this.getSubCollection("folders",dGt)}subgraph(t){return this.subgraphs.get(t)}get users(){return this.getSubCollection("users",fGt)}user(t){return this.users.get(t)}async isDevEnv(){return!!(await this.fetch()).devEnv}async removeDeletedSteps(){let n=this.firestoreOperations.collectionRef(this.docRef,"deletedSteps").orderBy("__name__").limit(100),i=async(o,s)=>{try{let a=this.parent.parent.batch(),l=await n.get();if(l.size===0){o();return}let u=[...l.docs].map(d=>({docRef:d.ref}));for(let d of u)await a.delete(d,{});await a.commit(),process.nextTick(()=>{i(o,s)})}catch(a){s(a)}};return new Promise((o,s)=>i(o,s))}},yGt=class extends Xs{constructor(t,n,i,o){super(t,i6s,n,i,o,Syn)}async generateID(t){return t.id??this.parent.getNextCounter("workspace")}async fetchWorkspacesForPermissions(t){let n=this.firestoreOperations.createQuery(this.collectionRef,{selectFields:["id","project"],where:[["devEnv","==",t]]});return(await this.firestoreOperations.runQuery(n)).docs.map(s=>s.data())}};hr();var pb0=nt.FIREBASE,EGt=class extends ty{transformFromStorage(t,n,i){let o=[];i.orgName||(o.push("Adding property orgName with default value"),i.orgName="");let s=i.licenseDetails;return typeof s=="object"&&(s.trialActivator||(o.push("Adding property licenseDetails.trialActivator with default value"),s.trialActivator=""),s.companyName||(o.push("Adding property licenseDetails.companyName with default value"),s.companyName="")),o.length>0&&pb0.debug(`Patched org ${n}`,o),i}};var w8e=Ct(is());vr();yo();hr();hr();var fb0=nt.FIREBASE,bGt=class extends ty{transformFromStorage(t,n,i){let o=i,s=[],a=(l,c,u,d)=>{let p=c.indexOf(u);p>=0&&(s.push(`Changing ${l} role '${u}' to '${d}'`),c[p]=d)};for(let l of Object.values(o?.projects)){l.projectRoles?(a("project",l.projectRoles,"reader","member"),a("project",l.projectRoles,"owner","admin")):(l.projectRoles=[],s.push("Changing project.projectRoles from undefined to empty array"));for(let c of Object.values(l?.environments))c.environmentRoles?a("env",c.environmentRoles,"owner","admin"):(c.environmentRoles=[],s.push("Changing env.environmentRoles from undefined to empty array"))}return s.length>0&&fb0.debug(`Patched userRoles ${n}`,s),i}};var Fet=nt.USER_MANAGEMENT,Ab0=Os.merge(B_i),hb0=_a("UserRoles",Ab0),o6s=Oa(hb0,new bGt),_yn=class extends $s{constructor(t,n,i,o,s){super(t,n,o6s,i,o,s)}async upsertProjectRoles(t,n,i){return await this.runTransaction(i,async o=>{await this.parent.project(n).fetch(o);let s=await this.fetch(o);(s.projects[n]?.projectRoles.includes("admin")??!1)&&!t.projectRoles.includes("admin")&&await this.throwIfLastProjectAdmin(n,o);let c=(0,w8e.cloneDeep)(s.projects[n]);return Object.values(t.environments).forEach(u=>{t.projectRoles.includes("member")?u.environmentRoles=[]:t.projectRoles.includes("admin")?u.environmentRoles=["admin"]:u.environmentRoles=["reader"]}),s.projects[n]=t,await this.save(s,o),Fet.infoContext(this.logContext,`User project roles updated for user ${s.id} at project ${n}. Previous roles:`,c,"New roles:",s.projects[n]),s})}async upsertUserOrganizationRoles(t,n){return await this.runTransaction(n,async i=>{let o;try{o=await this.fetch(i)}catch(d){if(Vd(d)&&(d instanceof Zu||d instanceof Jy))o={id:this.id,organizationRoles:[],projects:{}};else throw d}let s=o.organizationRoles.includes("admin"),a=t.includes("admin"),l=!s&&a,c=s&&!a;l&&await this.parent.parent.user(this.id).merge({role:"Admin"},i),c&&(await this.throwIfLastOrgAdmin(i),await this.parent.parent.user(this.id).merge({role:"User"},i));let u=(0,w8e.cloneDeep)(o.organizationRoles);return o.organizationRoles=t,await this.save(o,i),Fet.infoContext(this.logContext,`User org roles updated for user ${o.id}. Previous roles:`,u,"New roles:",o.organizationRoles),o})}async upsertEnvironmentRoles(t,n,i,o){return await this.runTransaction(o,async s=>{let a=await this.parent.workspace(i).fetch(s);if(a.project!==n||a.devEnv)throw new Zu(`Environment ${i} not found`);let l=await this.fetch(s);if(!l.projects[n]?.projectRoles.length)throw new Jy("User must have a project role before being granted any environment roles therein");(l.projects[n]?.environments[i]?.environmentRoles.includes("admin")??!1)&&!t.environmentRoles.includes("admin")&&await this.throwIfLastEnvironmentAdmin(n,i,s);let d=(0,w8e.cloneDeep)(l.projects[n].environments[i]);return l.projects[n].environments[i]=t,await this.save(l,s),Fet.infoContext(this.logContext,`User env roles updated for user ${l.id} at envID ${i} in project ${n}. Previous roles:`,d,"New roles:",l.projects[n].environments[i]),l})}async deleteUserProjectRoles(t,n){return await this.runTransaction(n,async i=>{let o=await this.fetch(i);(o.projects[t]?.projectRoles.includes("admin")??!1)&&await this.throwIfLastProjectAdmin(t,i);let a=(0,w8e.cloneDeep)(o.projects[t]);delete o.projects[t],await this.save(o,i),Fet.infoContext(this.logContext,`User project roles deleted for user ${o.id} at projectID ${t}. Previous roles:`,a)})}async deleteUserEnvironmentRoles(t,n,i){return await this.runTransaction(i,async o=>{let s=await this.fetch(o);(s?.projects[t]?.environments[n]?.environmentRoles.includes("admin")??!1)&&await this.throwIfLastEnvironmentAdmin(t,n,o);let l=(0,w8e.cloneDeep)(s.projects[t].environments[n]);delete s.projects[t].environments[n],await this.save(s,o),Fet.infoContext(this.logContext,`User environment roles deleted for user ${s.id} at envID ${n} in project ${t}. Previous roles:`,l)})}async throwIfLastOrgAdmin(t){return await this.runTransaction(t,async n=>{if((await this.parent.userRoles.select({where:[["organizationRoles","array-contains","admin"]]},n)).length<2)throw new r_("Role change failed, at least one org admin is required")})}async throwIfLastProjectAdmin(t,n){return await this.runTransaction(n,async i=>{if((await this.parent.userRoles.select({where:[[`projects.${t}.projectRoles`,"array-contains","admin"]]},i)).length<2)throw new r_("Role change failed, at least one project admin is required")})}async throwIfLastEnvironmentAdmin(t,n,i){return await this.runTransaction(i,async o=>{let s=await this.parent.userRoles.select({where:[[`projects.${t}.environments.${n}.environmentRoles`,"array-contains","admin"]]},o),a=await this.parent.userRoles.select({where:[[`projects.${t}.projectRoles`,"array-contains","admin"]]},o),l=s.length<2;if(!a.length&&l)throw new r_("Role change failed, at least one environment admin is required")})}},CGt=class extends Xs{constructor(t,n,i,o){super(t,o6s,n,i,o,_yn)}};var gb0=Os.merge(zSi),mb0=_a("Org",gb0),s6s=Oa(mb0,new EGt),yb0={gitRepo:"gitRepo",workspace:"workspace",job:"job",subgraph:"folder",location:"location",connection:"connection",template:"template",run:"run",devRun:"devRun"},Oyn=class extends $s{constructor(t,n,i,o,s){super(t,n,s6s,i,{...o,orgID:t},s,["devRuns","globalUsersSettings","projects","runs","userRoles","workspaces"])}get devRuns(){return this.getSubCollection("devRuns",sGt)}devRun(t){return this.devRuns.get(t)}get globalUsersSettings(){return this.getSubCollection("globalUsersSettings",Xjt)}globalUsersSetting(t){return this.globalUsersSettings.get(t)}get projects(){return this.getSubCollection("projects",$jt)}project(t){return this.projects.get(t)}get runs(){return this.getSubCollection("runs",oGt)}run(t){return this.runs.get(t)}get userRoles(){return this.getSubCollection("userRoles",CGt)}userRole(t){return this.userRoles.get(t)}get workspaces(){return this.getSubCollection("workspaces",yGt)}workspace(t){return this.workspaces.get(t)}async getNextCounter(t,n=1,i){if(!n||n<=0)throw new koe(`getNextCounter() expected reserveCount value greater than zero, received ${n}`);let o=yb0[t];if(!o)throw new koe(`getNextCounter() received unsupported counter name '${t}'`);return this.runTransaction(i,async s=>{let a=await this.fetch(s),l=`${o}Counter`,c=l in a?a[l]??0:0;return await this.merge({[l]:c+n},s),c+1})}async releaseWorkspaceStatusAndEndRun(t,n,i,o,s,a){return this.runTransaction(a,async l=>{let c=this.workspace(t),u=await c.fetch(l),{newStatus:d,remainingActiveRuns:p}=await o();u.status=d??u.status,i==="run"?u.currentlyRunningJobs=p:u.currentlyRunningDevJobs=p,await c.save(u,l);let f=this[i](n);return l.transaction.update(f.docRef,{...f.prepareDataForMerge(s,l),runEndTime:this.firestoreOperations.getServerTimestampSentinel()}),u.status})}async updateLastLoginTime(){let t=this.prepareDataForMerge({});t.lastLoginTime=this.firestoreOperations.getServerTimestampSentinel(),await this.firestoreOperations.updateDoc(this.docRef,t)}},IGt=class extends Xs{constructor(t,n,i,o){super(t,s6s,n,i,o,Oyn)}};yo();var Eb0=Os.merge(GSi),bb0=_a("OrgPublic",Eb0),a6s=Oa(bb0),Tyn=class extends $s{constructor(t,n,i,o,s){super(t,n,a6s,i,{...o,orgID:t},s)}},vGt=class extends Xs{constructor(t,n,i,o){super(t,a6s,n,i,o,Tyn)}};yo();hr();var Cb0=nt.FIREBASE,SGt=class extends ty{transformFromStorage(t,n,i){return i.accountType||(Cb0.debug(`Patched user ${n}: Setting accountType to 'normal'`),i.accountType="normal"),i}};var Ib0=Os.merge(vEe),vb0=_a("User",Ib0),l6s=Oa(vb0,new SGt),wyn=class extends $s{constructor(t,n,i,o,s){super(t,n,l6s,i,o,s)}},_Gt=class extends Xs{constructor(t,n,i,o){super(t,l6s,n,i,o,wyn)}};var OGt=class{constructor(t){this.firestoreOperations=t;this.firestoreOperations=t}async uploadFile(t,n){await this.firestoreOperations.uploadToStorage(t,n)}async downloadFile(t){return this.firestoreOperations.downloadFromStorage(t)}async checkIfReferenceExists(t){return this.firestoreOperations.checkIfStorageReferenceExists(t)}async deleteFile(t){return this.firestoreOperations.deleteFileFromStorage(t)}};yo();yo();var Sb0=Os.merge(Wyt),_b0=_a("RegistryPackageRelease",Sb0),u6s=Oa(_b0),Ryn=class extends $s{constructor(t,n,i,o,s){super(t,n,u6s,i,o,s)}},TGt=class extends Xs{constructor(t,n,i,o){super(t,u6s,n,i,o,Ryn)}};var Ob0=Os.merge(Hyt),Tb0=_a("RegistryPackage",Ob0),c6s=Oa(Tb0),Byn=class extends $s{constructor(t,n,i,o,s){super(t,n,c6s,i,o,s,["releases"])}get releases(){return this.getSubCollection("releases",TGt)}release(t){return this.releases.get(t)}},wGt=class extends Xs{constructor(t,n,i,o){super(t,c6s,n,i,o,Byn)}};sn();ds();ez();w_r();R_r();B_r();x_r();Q_r();L_r();var wb0=T.discriminatedUnion("type",[Os.merge(Fi.merge(I3)),Os.merge(Fi.merge(Yyt)),Os.merge(Fi.merge(Kyt)),Os.merge(Fi.merge(Jyt)),Os.merge(Fi.merge(Xyt)),Os.merge(Fi.merge(t3t)),Os.merge(Fi.merge(r3t)),Os.merge(Fi.merge(n3t))]),Rb0=_a("Event",wb0),d6s=Oa(Rb0),xyn=class extends $s{constructor(t,n,i,o,s){super(t,n,d6s,i,o,s)}},RGt=class extends Xs{constructor(t,n,i,o){super(t,d6s,n,i,o,xyn)}createEventCore(t,n,i,o,s,a,l){return{type:"core",orgID:t,event:n,resourceType:i,resourceID:o,fromID:s,requestedBy:a,requestedByUserAgent:l}}async createDuplicatePkgNodeTypeEvent(t,n,i,o,s,a,l,c){let d={...this.createEventCore(t,"workspaces.nodeType.duplicate","NodeType",n,i,o,c),type:"duplicate",packageID:s,releaseID:a,workspaceID:l};return(await this.createEntity(d)).id}async createInstallPkgNodeTypeEvent(t,n,i,o,s,a){let c={...this.createEventCore(t,"workspaces.nodeType.install","NodeType",n,"",s,a),type:"install",packageID:n,releaseID:i,workspaceID:o};return(await this.createEntity(c)).id}async createEnableTotpTypeEvent(t,n,i){let o=this.createEventCore(t,"users.auth.enableTotp","Auth","Totp","",n,i);return(await this.createEntity(o)).id}async createDisableTotpTypeEvent(t,n,i,o){let s=this.createEventCore(t,"users.auth.disableTotp","Auth","Totp",i,n,o);return(await this.createEntity(s)).id}async createAIColumnDescriptionsTypeEvent(t,n,i,o,s,a,l,c){let d={...this.createEventCore(t,"ai.description.columnDescriptions","AI","Description",n,n,c),type:"update",workspaceID:i,nodeID:o,acceptedDescriptionsCount:s,modifiedDescriptionsCount:a,rejectedDescriptionsCount:l};return(await this.createEntity(d)).id}async createNewWorkspaceWizardTypeEvent(t,n,i,o,s,a,l,c,u,d){let p=this.createEventCore(t,"workspaces.create.newWorkspace","NewWorkspace",i.toString(),u?.toString()??"",c,d),f=typeof s=="string"?new Date(s):s,A={...p,type:"create",projectID:n,stepNumber:o,startTime:f,endTime:a,status:l};return(await this.createEntity(A)).id}async createAINodeDescriptionTypeEvent(t,n,i,o,s,a){let c={...this.createEventCore(t,"ai.description.nodeDescription","AI",o,"",n,a),type:"update_node_description",workspaceID:i,nodeID:o,action:s};return(await this.createEntity(c)).id}async createAIGitCommitMessageRequestEvent(t,n,i,o,s,a,l){let u={...this.createEventCore(t,"ai.git.commit","AI",l,"",n),type:"request",fileCount:i,diffContent:o,charCount:s,latencyMs:a,aiGitRequestId:l};return(await this.createEntity(u)).id}async createAIGitCommitMessageActionEvent(t,n,i,o,s,a,l){let u={...this.createEventCore(t,"ai.git.commit","AI","",n,l),type:"action",aiMessage:i,finalMessage:o,editDistance:s,action:a,aiGitRequestId:l};return(await this.createEntity(u)).id}};yo();var Bb0=Os.merge(P_i),xb0=_a("ActivePrompt",Bb0),p6s=Oa(xb0),Mb0=Os.merge(k_i),Db0=_a("PromptVersion",Mb0),f6s=Oa(Db0),Myn=class extends $s{constructor(t,n,i,o,s){super(t,n,p6s,i,{...o,nodeID:t},s)}},Dyn=class extends $s{constructor(t,n,i,o,s){super(t,n,f6s,i,{...o,nodeID:t},s)}},BGt=class extends Xs{constructor(t,n,i,o){super(t,p6s,n,i,o,Myn)}},xGt=class extends Xs{constructor(t,n,i,o){super(t,f6s,n,i,o,Dyn)}};yo();var Nb0=_a("Event",F_i),A6s=Oa(Nb0),Nyn=class extends $s{constructor(t,n,i,o,s){super(t,n,A6s,i,o,s)}},MGt=class extends Xs{constructor(t,n,i,o){super(t,A6s,n,i,o,Nyn)}};var DGt=class extends ene{constructor(t){super("root",t.db,["orgs","users","packagesRegistry","events"],void 0,t.currentLogContext(),t)}get path(){return""}get orgs(){return this.getSubCollection("orgs",IGt)}org(t){return this.orgs.get(t)}get orgsPublic(){return this.getSubCollection("orgsPublic",vGt)}orgPublic(t){return this.orgsPublic.get(t)}get users(){return this.getSubCollection("users",_Gt)}user(t){return this.users.get(t)}get packagesRegistry(){return this.getSubCollection("packagesRegistry",wGt)}registryPackage(t){return this.packagesRegistry.get(t)}get events(){return this.getSubCollection("events",RGt)}event(t){return this.events.get(t)}get oauthStates(){return this.getSubCollection("oauthState",MGt)}oauthState(t){return this.oauthStates.get(t)}get activePrompts(){return this.getSubCollection("activePrompts",BGt)}activePrompt(t){return this.activePrompts.get(t)}get promptVersions(){return this.getSubCollection("promptVersions",xGt)}promptVersion(t){return this.promptVersions.get(t)}batch(){return new Vjt(this.firestoreOperations)}getRepositoryFromPath(t){let n=t.split("/"),i,o;if(n.length){n[0].length||n.shift();for(let s of n)if(i)o=i.get(s),i=void 0;else{if(i=(o??this)[s],!i)throw new Rs(`No '${s}' collection found`);o=void 0}}return i||o||this}storage(){return new OGt(this.firestoreOperations)}};vr();var Pb0=["run","runs","devRun","devRuns"],Pyn=class r{providers;constructor(t,n,i,o){return this.providers=n,new Proxy(this,{get:(s,a)=>{if(Pb0.includes(a))return this.providers.firebase[a];let l=o(a,i);if(!(l in this.providers))throw new At("[FLAGGED_REPOSITORY] Attempted to access a flagged repository implementation that is not configured.",`Provider ID: ${l}`);let c=s.providers[l]?.[a];if(c instanceof mle){let u=Object.fromEntries(Object.entries(this.providers).map(([d,p])=>[d,p?.[a]]));return new r(c,u,{...i},o)}return typeof c=="function"?(...u)=>{let d=t?.[a]?.bind(t)?.(...u);if(!(d instanceof mle))return d;let p=Object.fromEntries(Object.entries(this.providers).map(([h,y])=>[h,y?.[a]?.bind(y)?.(...u)])),f=i.orgId;a==="org"&&(f=u[0]),a==="get"&&t.id==="orgs"&&(f=u[0]);let A=(s.providers[l]?.[a]).bind(s.providers[l])?.(...u);return new r(A,p,{...i,orgId:f},o)}:t[a]}})}},h6s=(r,t,n)=>new Pyn(r,t,{},n);var kyn=(r,t)=>{let n=new DGt(r);return h6s(n,{firebase:n,service:n},t)};var B6s=Ct($v(),1);b3();var q1e=Ct(Lyn(),1),O6s=Ct(AQt(),1),Gyn=Ct($v(),1),Wyn=Ct(ovt(),1),T6s=require("stream"),Hyn=Ct(zyn(),1);b3();var b6s=Ct(require("querystring"),1),C6s=require("stream");var I6s=Ct(D8e(),1);var Kb0=!0;function CR(r,t){return{options:typeof r=="object"?r:{},callback:typeof r=="function"?r:t}}function jyn(r){return Object.keys(r).map(t=>[t,r[t]])}function Jb0(r){return encodeURIComponent(r).replace(/[!'()*]/g,t=>"%"+t.charCodeAt(0).toString(16).toUpperCase())}function zet(r,t){return r.split("/").map(Jb0).join(t?"%2F":"/")}function v6s(r){return b6s.stringify(r,"&","=",{encodeURIComponent:t=>zet(t,!0)})}function S6s(r){let t={};for(let n of Object.keys(r)){let i=r[n];n=n.toLowerCase(),t[n]=i}return t}function _6s(r){return JSON.stringify(r).replace(/[\u0080-\uFFFF]/g,t=>"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4))}function LGt(r){return r instanceof Date||r instanceof RegExp?r:Array.isArray(r)?r.map(LGt):r instanceof Object?Object.keys(r).reduce((t,n)=>{let i=n[0].toLocaleLowerCase()+n.slice(1).replace(/([A-Z]+)/g,(o,s)=>`_${s.toLowerCase()}`);return t[i]=LGt(r[n]),t},Object()):r}function F1e(r,t=!1,n="",i=""){let o=r.getUTCFullYear(),s=r.getUTCMonth()+1,a=r.getUTCDate(),l=r.getUTCHours(),c=r.getUTCMinutes(),u=r.getUTCSeconds(),d=`${o.toString().padStart(4,"0")}${n}${s.toString().padStart(2,"0")}${n}${a.toString().padStart(2,"0")}`;return t&&(d=`${d}T${l.toString().padStart(2,"0")}${i}${c.toString().padStart(2,"0")}${i}${u.toString().padStart(2,"0")}Z`),d}function $Q(){return globalThis.Deno&&globalThis.Deno.version&&globalThis.Deno.version.deno?`gl-deno/${globalThis.Deno.version.deno}`:`gl-node/${process.versions.node}`}function ZQ(){let r=(0,I6s.getPackageJSON)();return r.name.replace("@google-cloud","gcloud-node").replace("/","-")+"/"+r.version}function rne(){return Kb0?"ESM":"CJS"}var qet=class extends C6s.PassThrough{constructor(){super(...arguments),this.shouldEmitReading=!0,this.shouldEmitWriting=!0}_read(t){this.shouldEmitReading&&(this.emit("reading"),this.shouldEmitReading=!1),super._read(t)}_write(t,n,i){this.shouldEmitWriting&&(this.emit("writing"),this.shouldEmitWriting=!1),process.nextTick(()=>{super._write(t,n,i)})}_final(t){this.shouldEmitReading&&(this.emit("reading"),this.shouldEmitReading=!1),this.shouldEmitWriting&&(this.emit("writing"),this.shouldEmitWriting=!1),t(null)}};var w6s=Ct(yK(),1),R6s=Ct(D8e(),1);var Xb0=(0,R6s.getPackageJSON)(),xy=Symbol.for("GCCL_GCS_CMD"),FGt={timeout:6e4,gzip:!0,forever:!0,pool:{maxSockets:1/0}},$b0=!0,Zb0=3,cG=class r extends Error{constructor(t){if(super(),typeof t!="object"){this.message=t||"";return}let n=t;this.code=n.code,this.errors=n.errors,this.response=n.response;try{this.errors=JSON.parse(this.response.body).error.errors}catch{this.errors=n.errors}this.message=r.createMultiErrorMessage(n,this.errors),Error.captureStackTrace(this)}static createMultiErrorMessage(t,n){let i=new Set;t.message&&i.add(t.message),n&&n.length?n.forEach(({message:s})=>i.add(s)):t.response&&t.response.body?i.add(O6s.decode(t.response.body.toString())):t.message||i.add("A failure occurred during this request.");let o=Array.from(i);return o.length>1&&(o=o.map((s,a)=>` ${a+1}. ${s}`),o.unshift("Multiple errors occurred during the request. Please see the `errors` array for complete details.\n"),o.push(`
7187
+ Total objects from all schemas: `,a)}catch(s){B1e.errorContext(n,i,"failed to log object list details",s)}return this.buildObjectsByLocationLookup(o)}catch(o){throw B1e.errorContext(n,i,'Error when building object by location name lookup for objectType "objects"',o),o}},"appContext")}async getActualState(t,n,i){try{let[o,s]=await Promise.all([this.getDataWarehouseObjectsByLocation(n,i),this.getDataWarehouseColumns(n,i)]);return this.createState(t,n,s,o)}catch(o){throw B1e.errorContext(i,"getting actual state failed",o),Hv(o,"Could not get location or object/column lookups: ")}}wrapSQLWithTest=t=>`SELECT 1 WHERE EXISTS (${t})`;getTemplateString=(t,n,i)=>{let o=t;return i&&(o=this.wrapSQLWithTest(o)),n&&(o=this.wrapSQLWithExplain(o)),o}};vr();var a8e=class extends At{noRoleFound;noWarehouseFound;isWarehouseInvalid;constructor(t,n){let i="Snowflake user authentication unsuccessful: ";t.invalidWarehouseInfo?i+=`Warehouse not found, is invalid, or the user with current role ${t.invalidWarehouseInfo.role} does not have permission.`:i+=`${t.noRoleFound?`Role${t.noWarehouseFound?" and Warehouse":""}`:"Warehouse"} must be provided.`,super(i,n),this.noRoleFound=!!t.noRoleFound,this.noWarehouseFound=!!t.noWarehouseFound,this.isWarehouseInvalid=!!t.invalidWarehouseInfo}},GSs=r=>typeof r=="object"&&r instanceof a8e;sn();vr();hr();xs();var WSs=(r,t,n,i)=>`SELECT * FROM TABLE(RESULT_SCAN('${r}')) ORDER BY ${t} LIMIT ${n} OFFSET ${i}`;var cet=nt.PLATFORM,Bh0=T.object({TABLE_NAME:T.string(),COMMENT:T.string().nullable(),TABLE_TYPE:T.string()}),kUt=class extends Lre{validator=Cr("InformationSchemaTablesRow",Bh0);query(t){return`SELECT TABLE_NAME, TABLE_TYPE, COMMENT from "${t.database}".INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='${t.schema}';`}convert(t){let{TABLE_NAME:n,COMMENT:i,...o}=t;return{kind:o.TABLE_TYPE.match(/^(.+\s)?TABLE$/)?"TABLE":o.TABLE_TYPE.match(/^(.+\s)?VIEW$/)?"VIEW":"<unknown>",name:n,comment:i??"",extra:o}}},xh0=T.object({TABLE_NAME:T.string(),COMMENT:T.string().nullable(),COLUMN_NAME:T.string(),IS_NULLABLE:T.union([T.literal("YES"),T.literal("NO")]),COLUMN_DEFAULT:T.string().nullable()}),QUt=class extends Fre{validator=Cr("InformationSchemaColumnsRow",xh0);get columnsString(){return"TABLE_NAME, COLUMN_NAME, IS_NULLABLE, COMMENT, COLUMN_DEFAULT"}query(t){return`SELECT ${this.columnsString} from "${t.database}".INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA='${t.schema}'`}convert(t){let{TABLE_NAME:n,COLUMN_NAME:i,COMMENT:o,...s}=t;return{name:i,objectName:n,comment:o??"",extra:s}}async runQuery(t,n,i){let o=`${this.runQuery.name}:`,{data:{status:s},runDetails:{queryID:a}}=await n(t);if(!a)throw cet.emergContext(i,o,`query ID was unexpectedly ${a}`),new At(`Query ID was unexpectedly ${a} when querying warehouse columns`);cet.infoContext(i,o,`initial query (ID ${a}) completed with status ${s}`);let l=[],c=5e4,u=0,d=1,p=!1;for(;!p;){let f,A,h;try{let y=WSs(a,this.columnsString,c,u),{data:{rows:C,status:v},runDetails:{queryID:O}}=await n(y);f=C.map(w=>this.validateAndConvert(w)),A=v,h=O}catch(y){throw cet.errorContext(i,o,`query for batch ${d} failed with error`,y),y}cet.infoContext(i,o,`query for batch ${d} (ID ${h} / status "${A}") returned ${f.length} records`),l.push(...f),p=f.length<c,p||(u+=c,d++)}return cet.infoContext(i,o,`finished querying ${l.length} rows in ${d} batches`),l}},Mh0=T.object({name:T.string(),owner:T.string(),comment:T.string(),budget:T.string().nullable().optional(),is_default:T.union([T.literal("Y"),T.literal("N")]),is_current:T.union([T.literal("Y"),T.literal("N")]),retention_time:T.string(),created_on:T.union([T.date(),T.string()]),options:T.string(),owner_role_type:T.string(),database_name:T.string()}),LUt=class extends qre{validator=Cr("SnowflakeShowSchemaRow",Mh0);convert(t){let{name:n,options:i,...o}=t;return{name:n,extra:{...o,options:new Set(i.length?i.split(", "):[])}}}query(t){return`SHOW SCHEMAS IN DATABASE "${t.database}"`}};var det=class extends zre{constructor(n){super("snowflake");this.userContext=n}log(n,...i){nt.PLATFORM[n]({orgID:this.userContext.orgID,workspaceID:this.userContext.environmentID,...i})}getObjectsImplementation=new kUt;getColumnsImplementation=new QUt;getSchemasImplementation=new LUt;getQueryResultFromTemplateRunResult(n,i){let o=n.runDetails.compiledSQL,s={error:null,fields:[],rows:[],success:!0,sql:o,exportedRefs:[],invalidExportedRefs:[],startTime:i,endTime:new Date,isRunning:!1,name:"",status:n?.data?.status||"Success",type:"sql",queryID:n.runDetails.queryID,warehouse:n.runDetails.warehouse};if(n.data){let a=n.data.columns.map(u=>u.Name),l=n.data.rows.map(u=>({values:NUt(a,u)})),c=n.data.columns.map(u=>({name:u.Name,type:u.DataType||""}));s.fields=c,s.rows=l}if(n?.runDetails?.exported_refs.length){let a=n.runDetails.exported_refs.map(l=>({locationName:l.location_name,nodeName:l.node_name}));s.exportedRefs=A4(a)}if(n?.runDetails?.invalid_exported_refs.length){let a=n.runDetails.invalid_exported_refs.map(l=>({locationName:l.location_name,nodeName:l.node_name}));s.invalidExportedRefs=A4(a)}return s}validateUserContext(){let n="In your environment settings, verify that you have";if(!this.userContext)throw new At(`Missing ${this.name} connection information! ${n} selected and authenticated a connection type.`);if(Bh(this.userContext.kind==="snowflake",`Expected snowflake user context but received kind ${this.userContext.kind}`,"PLATFORM"),!this.userContext.accountName?.trim())throw new At(`Missing ${this.name} account information! ${n} added an account.`);let i=QAn(this.userContext),o=`Missing ${this.name} credentials! ${n} added a`,s=f$(i,a=>a.snowflakeUsername.trim()&&a.snowflakePassword?null:`${o} username and password.`,()=>null,()=>null,a=>a.snowflakeUsername?.trim()?null:`${o} username.`);if(s)throw new At(s)}async testConnection(n=!1){if(n)try{this.validateUserContext();let i=(await this.getRows("select current_role()"))[0]?.["CURRENT_ROLE()"],o=(await this.getRows("select current_warehouse()"))[0]?.["CURRENT_WAREHOUSE()"],s=!1,a=!1;if(!o){if(this.userContext.warehouse)throw new a8e({invalidWarehouseInfo:{warehouse:this.userContext.warehouse,role:i??""}});a=!0}if((!i||i==="PUBLIC")&&!this.userContext.role&&(s=!0),a||s)throw new a8e({noRoleFound:s,noWarehouseFound:a})}catch(i){throw GSs(i)?i:Vd(i)?new At(`${(0,kAn.capitalize)(this.name)} user authentication unsuccessful: ${i.message}`,i.detail):new At(`${(0,kAn.capitalize)(this.name)} user authentication unsuccessful:`,Wl(i).error.errorDetail)}else try{await this.runSQL(_7,void 0)}catch(i){throw Vd(i)?new At(`Could not validate connection to ${this.name}: ${i.message}`,i.detail):new At(`Could not validate connection to ${this.name}`,Wl(i).error.errorDetail)}}async getDatabaseNames(){return(await this.getRows("SHOW DATABASES")).map(i=>i.name)}async getSchemaNames(n){return(await this.getRows(`SHOW SCHEMAS IN "${n}"`)).map(o=>o.name)}async getVariantRows(n,i,o,s){let a=this.getName(s,o),l=`SELECT "${n}" FROM ${a} SAMPLE (${i} ROWS)`;return this.getSQLQueryResult(l)}async getObjectRows(n,i,o){let s=`SELECT * FROM ${this.getName(n,i)} LIMIT 100`;return o&&(s=this.wrapSQLWithExplain(s)),this.getSQLQueryResult(s)}createColumnMetadata(n,i){return{name:n.name,dataType:n.type,transform:"",nullable:n["null?"]==="Y",defaultValue:"",columnReference:{columnCounter:al(),stepCounter:i},primaryKey:n["primary key"]==="Y",uniqueKey:n["unique key"]==="Y",description:n.comment||"",appliedColumnTests:{},acceptedValues:{strictMatch:!0,values:[]},config:{},sourceColumnReferences:[{transform:"",columnReferences:[]}]}}async describeObject(n,i,o,s){let a=`DESC ${o.toUpperCase()} ${this.getName(n,i)}`;return(await this.runSQL(a,al())).data.rows.map(c=>this.createColumnMetadata(c,s))}convertObjectRowsToMaterializationKinds(n){let i="convertObjectRowsToMaterializationKinds:",o=[],s=[];for(let a of n)a.kind==="TABLE"?o.push(a.name):a.kind==="VIEW"?s.push(a.name):this.log("emergContext",i,`table ${a.name} is of unexpected table type ${a.kind}`);return{tables:o,views:s}}createState(n,i,o,s){return new JBe(s,o,i,n)}wrapSQLWithExplain(n){return`EXPLAIN USING text ${n}`}};var QAn=r=>({snowflakeAccount:r.accountName||"",snowflakeAccessUrl:r.accessUrl,snowflakeUsername:r.user||"",snowflakePassword:r.password||"",snowflakeKeyPairKey:r.keyPairKey,snowflakeRole:r.role||"",snowflakeWarehouse:r.warehouse||"",snowflakeAuthType:r.authenticator,snowflakeKeyPairPass:r.keyPairPass??void 0});var HSs=Ct(Sre());hr();xs();var r21=nt.RUNNER;hr();var VSs=nt.RUNNER;var YSs=(r,t)=>{try{return r.replace("{{NODE_NAME}}",t)}catch{throw new Error(`Error: initializing system columns for ${t}, column name is Undefined.`)}};var Dh0=r=>{if(r.authenticator==="Token")return{token:r.token??"",path:r.path,host:r.host,databricksAuthType:r.authenticator,platformKind:"databricks"};if(r.authenticator==="Cloud")return{path:r.path,databricksAuthType:r.authenticator,host:r.host,platformKind:"databricks"};if(r.authenticator==="OAuthU2M")return{path:r.path,databricksAuthType:r.authenticator,host:r.host,platformKind:"databricks",accessToken:r.accessToken};if(r.authenticator==="OAuthM2M")return{path:r.path,databricksAuthType:r.authenticator,host:r.host,clientID:r.clientID??"",clientSecret:r.secret??"",platformKind:"databricks"};{let t=r.authenticator;throw new At(`Databricks authenticator not supported: ${t}`)}},Nh0=r=>{if(r.authenticator==="oauth")return{credentials:r.credentials,connectionString:r.connectionString,fabricAuthType:r.authenticator,platformKind:"fabric"};{let t=r.authenticator;throw new At(`Fabric authenticator not supported: ${t}`)}},Ffn=r=>{if(r.kind==="databricks")return Dh0(r);if(r.kind==="snowflake")return QAn(r);if(r.kind==="fabric")return Nh0(r);throw new yB(r.kind,"ConvertFromUserContextToUserCredentials")},l8e=(r,t)=>{if(Dje(r)){if(t.kind!=="snowflake")throw new Rs(`User context kind ${t.kind} does not match expected value "snowflake"`);let n=f$(r,()=>{},o=>o.snowflakeKeyPairKey,()=>{},()=>{},()=>{});return{snowflakeAccount:t.accountName,snowflakeAccessUrl:t.accessUrl,snowflakeKeyPairKey:n,snowflakeUsername:t.user,snowflakeRole:t.role,snowflakeWarehouse:t.warehouse,snowflakeAuthType:t.authenticator}}else if(g5t(r)){if(t.kind!=="databricks")throw new Rs(`User context kind ${t.kind} does not match expected value "databricks"`);let n=r.databricksAuthType==="Token"?r.token:void 0;return{databricksAuthType:r.databricksAuthType,databricksPath:r.path,databricksHost:t.host,databricksToken:n,platformKind:"databricks"}}else if(Woo(r)){if(t.kind!=="fabric")throw new Rs(`User context kind ${t.kind} does not match expected value "databricks"`);return{fabricAuthType:r.fabricAuthType,fabricConnectionString:t.connectionString,platformKind:"fabric"}}else throw new Rs(`Unsupported request credentials type "${r.kind??""}"`)};var KSs=async(r,t=g8())=>{VSs.app("Attempting to cancel run",r);try{let n=await t.currentUser?.getIdToken();if(!n)throw new At("There is no logged in user!");await _P("/scheduler/cancelRun",r,n)}catch(n){let i=Wl(n);throw VSs.error(i),i}};ow();nx();var UQ=nt.METADATA_HYDRATION,G21=nt.DEPLOY,$Ss=(r,t)=>r.operation.metadata?.sourceMapping?.[t]?.customSQL?.customSQL??"",Ph0=r=>typeof r=="object"&&!!r?.hasOwnProperty("stepCounter")&&r.hasOwnProperty("columnCounter"),ZSs=(r,t,n,i)=>{if(!r||!r.columnReferences)return{};{let o=r.columnReferences[0]?.stepCounter??null,s=r.columnReferences[0]?.columnCounter??null;if(!o||!s)return{};let a=t[o];if(!a)return{};let l=x2o(a.operation,s);return l?{node:LAn(a.operation,o),column:Kj(l,n,a.operation.name,i)}:{}}},kh0=(r,t,n,i,o,s,a,l,c)=>{if(HBe(t))return UQ.debugContext(l,`in formatHydratedMetadataMultiSources: source node ${r} does not need to be formatted for multisource`),null;{let u;return UQ.debugContext(l,`in formatHydratedMetadataMultiSources: formatting for ${t.name} at specifiedIndex: ${o}`),o!==null?u=[XSs(r,t,n,i,o,s,a,l,c)]:u=(t.isMultisource?t.metadata.sourceMapping:[t.metadata.sourceMapping[0]]).map((p,f)=>(UQ.debug(`in formatHydratedMetadataMultiSources: formatting at index ${f}. (multisource)`),XSs(r,t,n,i,f,s,a,l,c))),u}},XSs=(r,t,n,i,o,s,a,l,c)=>{let u=ZC(t.sqlType,i,"[formatHydratedSourceMetadata]"),d=FUt(t,o,s),p=t.metadata.sourceMapping[o];if(!p)throw new USe(r,"Cannot format hydrated source metadata");return{name:p.name,columns:t.metadata.columns.map(A=>{let h=A.sourceColumnReferences?.[o],y=Kj(A,u,t.name,c),C=zh0(t,A,n,o,u,c),v={...y,id:A.columnReference.columnCounter,transform:h?h.transform:"",sourceColumns:[ZSs(h,n,u,c)]};return C!==null&&(v.hashDetails=C),v}),join:p.join.joinCondition,dependencies:WEo(r,d,n,i,a,l,c),customSQL:$Ss({operation:t},o)}},WEo=(r,t,n,i,o,s,a)=>{let l=`[FormatHydratedSourceNodes]: For node ${r}: `,c=[],u=[];UQ.debugContext(s,l,`Formatting source dependencies for node ${r} with ${t.length} dependencies: `,t);let d=t.map(p=>{let f=n[p];if(f){let A=i[f.operation.sqlType];return A||(UQ.debugContext(s,l,`Node ${p} was listed as a source dependency, but it's node type ${f.operation.sqlType} was not found`),u.push(`[${p}: ${f.operation.sqlType}]`)),{node:LAn(f.operation,p),columns:f.operation.metadata.columns.map(h=>Kj(h,A,f.operation.name,a))}}else return UQ.debugContext(s,l,`Node ${p} was listed as a source dependency, but was not found in the nodes collection`),c.push(p),{}});if(o&&(c.length||u.length))throw new At(`Could not format source dependencies data for node ${r}. Missing node data for the following dependencies: ${c.length?c.toString():"n/a"}. Missing node types for the following dependencies: ${u.length?u.toString():"n/a"}.`);return d},Pwt=(r,t={})=>{if(!r)return{};try{return JSON.parse(r)}catch(n){UQ.errorContext(t,"Failed to parse runTime parameters. Error: ",n);let{message:i}=n;throw new Error(`${R4i}: ${i}`)}},SUt=r=>typeof r=="string"?Pwt(r):r,LAn=(r,t)=>{let n={operation:r},i=Md(n,{});return i||UQ.debugContext({nodeID:t},`FormatHydratedSQLNodeMetadata: Node ${t} is not a SQL node`),{id:t,name:r.name,nodeType:r.sqlType,location:{name:r.locationName},description:r.description||"",materializationType:i?n.operation.materializationType:"table",isMultisource:i?n.operation.isMultisource:!1,override:{create:{enabled:i?n.operation.overrideSQL??!1:!1,script:i?$Ss(n,0):""}},tests:i?Uh0(r):[]}},Kj=(r,t,n,i)=>{let o=Qh0(r,i);return Lh0(r,o),Fh0(r,o),qh0(r,o,t,n),o},Qh0=(r,t)=>({id:r.columnReference.columnCounter,name:r.name,dataType:r.dataType,description:r.description,nullable:r.nullable,defaultValue:r.defaultValue??"",tests:jh0(r,t)}),Lh0=(r,t)=>{Object.entries(K_i).forEach(([n,i])=>{(r[n]||r.keyColumnType&&n in N5r&&r.keyColumnType===N5r[n])&&(t[i]=!0)})},Fh0=(r,t)=>{for(let n in S7){let i=S7[n];i!==null&&(i in r&&r[i]||r.systemColumnType&&r.systemColumnType===Y_i[i])&&(t[i]=!0)}},qh0=(r,t,n,i)=>{let o=n?.metadata?.nodeMetadataSpec?.systemColumns??null;if(o){let a=Object.fromEntries(o.map(l=>[YSs(l.displayName,i),l.attributeName]))[r.name]??null;a&&(t[a]=!0)}r.config&&Object.entries(r.config).forEach(s=>{t[s[0]]=s[1]})},zh0=(r,t,n,i,o,s)=>{if(!t.hashedColumns||!t.hashedColumns?.length)return null;let a=t.hashedColumns.filter(c=>!!c.columnCounter),l=[];return a.forEach(c=>{let u=r.metadata.columns.find(d=>v5(d.columnReference.columnCounter,c.columnCounter));if(u){let d=Kj(u,o,r.name,s),p=u.sourceColumnReferences?.[i];l.push({...d,transform:p?.transform||"",sourceColumns:[ZSs(p,n,o,s)]})}}),t.hashDetails?.hashAlgorithm?{columns:l,algorithm:t.hashDetails?.hashAlgorithm}:(UQ.debugContext({columnID:t.columnReference.columnCounter},`hydrateHashColumn: Column ${t.columnReference.columnCounter} has hashDetails but no hash algorithm. This is unexpected. Returning null.`),null)},e_s=(r,t)=>{let{name:n,description:i,continueOnFailure:o,runOrder:s}=r;return{name:n,description:i,continueOnFailure:o,runOrder:s,templateString:t}},Uh0=r=>JFr(r).map(n=>e_s(n,n.templateString)),jh0=(r,t)=>UEo(r).map(i=>{let o=i.getTemplateString(r,t);return e_s(i,o)}),Gh0=(r,t,n,i)=>{let s=t.metadata.columns.find(a=>v5(a.columnReference.columnCounter,r.columnCounter));return s?Kj(s,n,t.name,i):{}},Wh0=(r,t,n,i)=>{let o=s=>Object.fromEntries(Object.entries(s).map(([a,l])=>{if(Ph0(l))return[a,Gh0(l,t,n,i)];if(J_i(l)){let c=l.items.map(u=>o(u));return[a,{items:c}]}else return[a,l]}));return o(r)},F3=(r,t,n,i,o,s,a,l,c,u,d=!1)=>{let p="[hydrateMetadata]";UQ.debugContext(c,`Hydrating metadata for step ${t} ${s?`at specified index ${s}`:""}`);let f=ZC(r.sqlType,i,p),A=r.metadata.columns.map(k=>Kj(k,f,r.name,u)),h=[];o&&(h=Object.values(o).map(k=>({database:k.database,schema:k.schema,name:k.locationName})));let y=r.config||{},C=Wh0(y,r,f,u),v=kh0(t,r,n,i,s,l,d,c,u),O=LAn(r,t);return{columns:A,storageLocations:h,config:C,sources:v,node:O,this:"{{ ref_no_link(node.location.name, node.name) }}",parameters:a}};var Zwt=(r,t)=>({operationName:r.name,destinationName:r.locationName,mapping:t});y3t();nx();var HBe=r=>r.sqlType==="Source",dFr=r=>{if(r.scratch){let{scratch:t,...n}=r;return n}return r},JSs=r=>V_(r,["operation","locationName"],"");var r_s=(r,t)=>{let n=[];if(!Md(r,void 0))return n;let i=r?.operation?.metadata?.sourceMapping||[];for(let o of i){let s=o[t]||[];n.push(...s)}return n},Yh0=r=>r_s(r,"dependencies"),Kh0=r=>r_s(r,"noLinkRefs");var dvs=r=>{let t={},n=dFr(r);for(let[i,o]of Object.entries(n)){let s=Yh0(o),a=Kh0(o),l=_$(o);nSr(l,p3,`Node name not found for stepCounter ${i}`);let c=JSs(o),u={nodeName:l,locationName:c};t[i]={dependencies:s,nodeRefLink:u,noLinkDependencies:a}}return t},pvs=r=>{let t=Object.keys(r),n={};for(let o of t){let s=r[o].nodeRefLink;n[s.locationName]||(n[s.locationName]=new Set),n[s.locationName].add(s.nodeName)}let i={};return t.forEach(o=>{if(!r[o].dependencies.every(l=>n[l.locationName]?n[l.locationName].has(l.nodeName):!1)){let{nodeName:l}=r[o].nodeRefLink;i[o]=l}}),i};var Jh0=nt.GRAPH;var Xh0=r=>{let t={},{scratch:n,...i}=r,o=xre(i);zSe(r,(a,l)=>{switch(l.operation.type){case"sourceInput":break;case"sql":{FUt(l.operation,null,o).forEach(u=>{t[u]||(t[u]=new Set),t[u].add(a)});break}default:au("GRAPH",!1,"Unknown step type in get edges lookup")}}),zSe(r,a=>{t[a]||(t[a]=new Set)});let s={};return Object.keys(t).forEach(a=>{s[a]=Array.from(t[a]??[])}),s};var e6t=(r,t)=>{let n=[],i=[];for(let o of r){let s=t.getRef(o);s===void 0?i.push(o):n.push(s)}return{nodeIDsToAdd:n,nonExistentRefs:i}},S1e=class{constructor(t){this.allNodes=t;for(let[n,i]of Object.entries(t)){let{locationName:o,name:s}=i.operation;this.locationMap(o).set(s,n)}}locations=new Map;locationMap(t){let n=this.locations.get(t);if(n)return n;let i=new Map;return this.locations.set(t,i),i}get(t,n){return this.locationMap(t).get(n)}getRef(t){return this.get(t.locationName,t.nodeName)}getDependenciesLookup(){return(0,pet.mapValues)(this.allNodes,t=>FUt(t.operation,null,this))}},xre=r=>new S1e(r),$h0=(r,t)=>{let n=t!==null,i=[];return r===null||HBe(r)?i:r.metadata.sourceMapping?(r.metadata.sourceMapping.forEach((s,a)=>{n&&t===a?s.dependencies.forEach(l=>{i.push(l)}):n||s.dependencies.forEach(l=>{i.push(l)})}),A4(i)):(Jh0.warn("No source mapping found for sql step",r.name),A4(i))},FUt=(r,t,n)=>{let i=[],o=$h0(r,t);if(!o.length)return[];let{nodeIDsToAdd:s}=e6t(o,n);return s.forEach(a=>{!i.includes(a)&&a&&i.push(a)}),i},Zh0=(r,t,n,i)=>{zSe(t,o=>{let{widthOfNode:s,heightOfNode:a}=n(o);return r.setNode(o,{label:"",width:s,height:a}),!0});for(let[o,s]of(0,pet.toPairs)(i))for(let a of s)a in t&&o in t&&r.setEdge(o,a);return r};var eg0=(r,t,n,i)=>{let o=new n_s.graphlib.Graph({});return o.setGraph({...r}),o.setDefaultEdgeLabel(function(){return{}}),Zh0(o,n,t,i)},i_s=r=>{let t=Xh0(r);return eg0({},()=>({widthOfNode:1,heightOfNode:1}),r,t)};var u8e=nt.SEARCH,tg0=new RegExp(/([\+]?){([\s\S]+)}([\+](?![\+]))?\s*/g),rg0=new RegExp(/((\w+):\s*((?:["])((([^\"\+\r\n\[/\\]+))(?:["]))|(([^\"\ \+\r\n\[/\\]+))))/g),ng0=new RegExp(/((?:[^\+\ \r\n\[/\\]|\\.|\[(?:[^\r\n\]\\]|\\.)*\])+)\s*/g),fet=(r,t)=>!!PNr(r,t).length,o_s={name:{MatchFunction:fet,MatchList:r=>[r.operation.name]},location:{MatchFunction:fet,MatchList:r=>[r.operation.locationName]},nodeType:{MatchFunction:fet,MatchList:r=>[r.operation.sqlType]},subgraph:{MatchFunction:fet,MatchList:r=>[r?.folderCounter?.toString(),r.name]},nodeID:{MatchFunction:fet,MatchList:r=>[r]}},s_s=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],l=s[0];a!=="}"&&a!=="+"&&(o=o+r[i+1]),l!=="{"&&l!=="+"&&(o=r[i-1]+o),t.push(o)}),t},ig0=2,og0=1,sg0=3,ag0=2,lg0=5,ug0=8,a_s=(r,t,n)=>{let{steps:i,gFinal:o,allSubgraphs:s,allStepTypesYAML:a}=n,l={},c=d1()?Date.now():performance.now(),u=r;u||(u=t);let d=u.split(/(\}\+?)\s*(or|OR|\|\|)\s*(\+?\{)/).filter(A=>!(A==="OR"||A==="or"||A==="||")),p=s_s(d);p.length||(p=[t]),u8e.debug("got unions",p,"searchStringTouse",u,"defaultSearchString",t,"steps",i),p.forEach(A=>{let h=A.split(/(\}\+?)\s*(and|AND|\,)\s*(\+?\{)/).filter(w=>!(w==="AND"||w==="and"||w===",")),y=s_s(h),C=[];y.forEach(w=>{let R={};u8e.debug("Got intersection:",w);let k=[...w.matchAll(tg0)];if(u8e.debug("Got matches:",w,k),!k[0])return;let z=k[0][ig0],H={prefix:k[0][og0]||"",postfix:k[0][sg0]||""};if(z.indexOf(":")>-1)[...z.trim().matchAll(rg0)].forEach(F=>{let X=F[ag0],Y=F[lg0]||F[ug0];H[X]=Y});else{let F=[...z.trim().matchAll(ng0)][0];F&&(H.name=F[0])}rb(H);let J=H;u8e.debug("Got groups ",w,J);let K=new Set;if(J.subgraph?Object.values(s).forEach(V=>{let F=o_s.subgraph,X=F.MatchList(V);if(F.MatchFunction(X,J.subgraph)){let{steps:L}=V;L.forEach($=>{K.add($.toString())})}else return}):K=new Set(Object.keys(i)),J.nodeType){let{nodeType:V}=J;if(!a[V]){let F=V;Object.entries(a).forEach(([X,Y])=>{Y.name===V&&(F=X)}),J.nodeType=F}}Object.keys(i).forEach(V=>{if(!J){u8e.emerg("got an unexpected undefined value for match",u,J,w);return}let F=K.has(V);if(Object.entries(J).forEach(([X,Y])=>{let L=i[V];if(X==="nodeID"&&(L=V),X==="subgraph"){F=K.has(V);return}let $=o_s[X];if($){let te=$.MatchList(L).filter(ne=>ne!=null);F=F&&$.MatchFunction(te,Y)}}),F){if(R[V]=!0,J.prefix&&o){let X=jFr(o,V,"predecessors");Object.values(X).forEach(Y=>[...Y.keys()].forEach(L=>R[L]=!0))}if(J.postfix&&o){let X=jFr(o,V,"successors");Object.values(X).forEach(Y=>[...Y.keys()].forEach(L=>R[L]=!0))}}}),C.push(R)}),C.length||C.push({});let v={};Object.keys(i).forEach(w=>{v[w]=!0});let O=C.reduce((w,R)=>Object.fromEntries(ZCi(w,R).map(k=>[k,!0])),v);l={...l,...O}});let f=d1()?Date.now():performance.now();return u8e.debug("Time that search took: ",f-c),l},l_s=(r,t,n)=>{let i=a_s(`${r}`,"{ * }",n),o=a_s(`${t}`,"!*",n),s=i;return Object.keys(o).forEach(a=>{delete s[a]}),{stepsResult:s}};var My1=nt.GRAPH,qUt=async(r,t,n)=>{let i=await cg0(r,t);return c8e(t.runDetails,n,i)},cg0=async(r,t)=>{let n=new Set,i=await avs(t.reRunID,r);for(let o of i){let s=await r.run(o).runResults.select();for(let{id:a,runState:l}of s)l==="complete"&&n.add(a)}return n},c8e=(r,t,n)=>pg0(r,t,n||new Set)||new Set(Object.keys(t.steps)),dg0=(r,t,n,i)=>({steps:r,allStepTypesYAML:wzt(n,t),allSubgraphs:i}),pg0=(r,t,n)=>{let i=null,o="",s="";if(r.jobID?{includeSelector:o,excludeSelector:s}=Aso(t,+r.jobID):(r.includeNodesSelector||r.excludeNodesSelector)&&(o=r.includeNodesSelector||"",s=r.excludeNodesSelector||""),o||s||n.size){let a=dg0(t.steps,t.stepTypes,t.installedPackages??{},t.folders);i=new Set(fg0(o,s,a).filter(l=>!n.has(l)))}return i},fg0=(r,t,n)=>{let i=i_s(n.steps);n.gFinal=i;let o=l_s(r,t,n);return Object.keys(o.stepsResult)},Dre=r=>{let t=new Set;for(let n of Object.values(r))for(let i in n)t.add(i);return t};hr();var uLs=Ct(IUt()),cLs=Ct(is()),dLs=Ct(Sre());ds();vr();Pi();ic();hr();vr();Np();vr();ic();ow();hr();ic();vr();var u_s="Invalid connection: Couldn't get a valid token for Databricks user. Update user credentials in Coalesce.";sn();xs();var Ag0=T.object({table_catalog:T.string(),table_schema:T.string(),table_name:T.string(),table_type:T.string(),is_insertable_into:T.string(),commit_action:T.string(),table_owner:T.string(),comment:T.string().nullable(),created:T.string(),created_by:T.string(),last_altered:T.string(),last_altered_by:T.string(),data_source_format:T.string(),storage_sub_directory:T.string().nullable()}),zUt=class extends Lre{validator=Cr("DatabricksInformationSchemaTablesType",Ag0);query(t){return`SELECT * FROM ${eA([t.database],"databricks")}.information_schema.tables where table_schema = '${t.schema}'`}convert(t){let n=t.table_type;(t.table_type==="MANAGED"||t.table_type==="MANAGED_SHALLOW_CLONE"||t.table_type==="BASE TABLE")&&(n="TABLE");let{table_name:i,...o}=t;return{kind:n,name:i,extra:o,comment:""}}},hg0=T.object({table_catalog:T.string(),table_schema:T.string(),table_name:T.string(),column_name:T.string(),ordinal_position:T.number(),column_default:T.string().nullable(),is_nullable:T.union([T.literal("YES"),T.literal("NO")]),full_data_type:T.string(),data_type:T.string(),character_maximum_length:T.number().nullable(),comment:T.string().nullable()}),UUt=class extends Fre{validator=Cr("DatabricksInformationSchemaColumnsType",hg0);query(t){return`SELECT * FROM ${eA([t.database],"databricks")}.INFORMATION_SCHEMA.COLUMNS where table_schema = "${t.schema}"`}convert(t){let{table_catalog:n,table_schema:i,table_name:o,column_name:s,comment:a,...l}=t;return{objectName:o,name:s,comment:a??"",extra:l}}queryForObject(t,n){return`${this.query(t)} and table_name = "${n}"`}},gg0=T.object({databaseName:T.string()}),jUt=class extends qre{validator=Cr("DatabricksShowSchemaRow",gg0);query(t){return`SHOW SCHEMAS IN ${eA([t.database],"databricks")}`}convert(t){return{name:t.databaseName,extra:{}}}};var mg0=nt.PLATFORM,Aet=class extends zre{constructor(n){super("databricks");this.userContext=n}getObjectsImplementation=new zUt;getColumnsImplementation=new UUt;getSchemasImplementation=new jUt;async getDatabaseNames(){return(await this.getRows("SHOW CATALOGS")).map(i=>i.catalog)}async getSchemaNames(n){let i=eA([n],"databricks");return(await this.getRows(`SHOW SCHEMAS IN ${i}`)).map(s=>s.databaseName)}async getVariantRows(n,i,o,s){let a=this.getName(s,o),l=`SELECT ${n} FROM ${a} TABLESAMPLE (${i} ROWS)`;return this.getSQLQueryResult(l)}async getObjectRows(n,i,o){let s=`SELECT * FROM ${this.getName(n,i)} LIMIT 100`;return o&&(s=this.wrapSQLWithExplain(s)),this.getSQLQueryResult(s)}createColumnMetadata(n,i){return{name:n.name,dataType:n.extra.data_type,transform:"",nullable:n.extra.is_nullable==="YES",defaultValue:"",columnReference:{columnCounter:al(),stepCounter:i},description:n.comment||"",appliedColumnTests:{},acceptedValues:{strictMatch:!0,values:[]},config:{},sourceColumnReferences:[{transform:"",columnReferences:[]}]}}async describeObject(n,i,o,s){let a=Yz(i.locationName,n,"[DatabricksBasePlatform.describeObject()]"),l=this.getColumnsImplementation.queryForObject(a,i.name);return(await this.runSQL(l,al())).data.rows.map(u=>this.createColumnMetadata(this.getColumnsImplementation.validateAndConvert(u),s))}async testConnection(){try{await this.runSQL(_7,void 0)}catch(n){let i;throw Vd(n)?n.message===u_s?i=n:i=new At(`Could not validate connection to ${this.name}: ${n.message}`,n.detail):i=new At(`Could not validate connection to ${this.name}`,Wl(n).error.errorDetail),i}}getQueryResultFromTemplateRunResult(n,i){let o=n.runDetails.compiledSQL,s={error:null,fields:[],rows:[],success:!0,sql:o,exportedRefs:[],invalidExportedRefs:[],startTime:i,endTime:new Date,isRunning:!1,name:"",status:n?.data?.status||"Success",type:"sql",queryID:n.runDetails.queryID,warehouse:n.runDetails.warehouse};if(n.data){let a=n.data.columns.map(u=>u.Name),l=n.data.rows.map(u=>({values:NUt(a,u)})),c=n.data.columns.map(u=>({name:u.Name,type:u.DataType}));s.fields=c,s.rows=l}if(n?.runDetails?.exported_refs.length){let a=n.runDetails.exported_refs.map(l=>({locationName:l.location_name,nodeName:l.node_name}));s.exportedRefs=A4(a)}if(n?.runDetails?.invalid_exported_refs.length){let a=n.runDetails.invalid_exported_refs.map(l=>({locationName:l.location_name,nodeName:l.node_name}));s.invalidExportedRefs=A4(a)}return s}convertObjectRowsToMaterializationKinds(n){let i="convertObjectRowsToMaterializationKinds:",o=[],s=[];for(let a of n){let l=a.name.toLowerCase();a.kind==="TABLE"?o.push(l):a.kind==="VIEW"?s.push(l):mg0.errorContext({workspaceID:this.userContext.environmentID?+this.userContext.environmentID:void 0},i,`table ${l} is of unexpected table type ${a.kind} - skipping it`)}return{tables:o,views:s}}createState(n,i,o,s){return new MUt(s,o,i,n)}wrapSQLWithExplain(n){return`EXPLAIN COST ${n}`}};var GUt=class r extends Aet{constructor(n,i){super(i);this.connection=n}async runSQL(n,i){let o=await this.connection.execute({statement:n});return FIs(o,n)}usingConnection=n=>new r(n,this.userContext);teardown(){return this.connection.teardown()}},c_s=async(r,t,n,i,o)=>{let s=await lqt.New(r,t,o,n);i&&await s.test();let a=new GUt(s.getConnection(),r);return{connectionManager:s,platform:a}},d_s=async(r,t)=>{let n=await NRo(r,t);return new GUt(n,r)};Np();var WUt=class r extends det{constructor(n,i){super(i);this.connection=n}async runSQL(n,i){let o=await this.connection.execute({sqlText:n,requestId:i||al()});return r.GetTemplateResultFromExecutionResult(n,o)}static GetTemplateResultFromExecutionResult(n,i){let o=i.stmt.getColumns().map(a=>({Name:a.getName(),DataType:a.getType()}));return{runDetails:{compiledSQL:n,exported_refs:[],invalid_exported_refs:[],ref_usage:{invalid_ref:[],invalid_ref_link:[],invalid_ref_no_link:[],ref:[],ref_link:[],ref_no_link:[]},queryID:i.queryID,warehouse:i.warehouse},data:{columns:o,rows:i.rows,status:i.status}}}usingConnection=n=>new r(n,this.userContext);teardown(){return this.connection.teardown()}},p_s=async(r,t,n,i,o)=>{let s=await uqt.New(r,t,o,n);i&&await s.test();let a=new WUt(s.getConnection(),r);return{connectionManager:s,platform:a}},f_s=async(r,t,n)=>{let i=await yms(r,t,n);return new WUt(i,r)};Np();Np();zv();Ad();xh();hr();vr();var yg0=nt.RUNNER,FAn=class extends At{constructor(){super("No current user, cannot run SQL!")}},het=async(r,t)=>{if(!t){let n=g8().currentUser;if(!n)throw new FAn;t=await n.getIdToken(!1)}return Eg0(r,t)},Eg0=(r,t)=>{let n=r.userContext?.orgID,i=r.userContext.environmentID?+r.userContext.environmentID:void 0;return Bc(`Front-end/runSQL/API: ${r.templateString}`,{orgID:n,workspaceID:i},"RUNNER_BACKEND",async()=>{try{let o=await _P("/scheduler/run",r,t);if(o.data.error)throw new Error(o.data.error);return o.data}catch(o){throw yg0.error("got error on run sql with token",o),o}})};hr();jl();var qAn=nt.TESTING;async function A_s(r,t,n,i,o){let s=r.includes(_Nr)?r:`${r}${_Nr}`,a={clientID:n.clientID,clientSecret:n.clientSecret,connectionString:s,query:t};try{let l=await tw,c=process.env.JAVA_SERVICE_BASE_URL,u=process.env.JAVA_SERVICE_PORT;if(!c&&!wu().isTest){let d=process.env.COALESCE_COA_CLOUD_TOKEN??null;return await het({userContext:{connectionString:a.connectionString,kind:"fabric",credentials:n,authenticator:"oauth",environmentID:o},templateString:t,requestId:al()},d)}else{let d=`${c}:${u}/api/sql/v1/execute`;qAn.infoContext(i,"Fabric request sending query to JDBC");let p=await l.post(d,a);return qAn.infoContext(i,"Fabric request response received from JDBC"),mzt(p.data,a.query)}}catch(l){let c=xje(l);throw qAn.errorContext(i,"error querying the java service",c),c}}vr();var get=class extends dee{name="fabric";userContext;constructor(t,n){super(void 0,n,al(),0,null,void 0),this.userContext=t}async makePendingQuery(t){let{credentials:n,connectionString:i,environmentID:o}=this.userContext,s=async()=>{if(!o)throw new At("Missing environmentID","makePendingQuery");if(!n)throw new At("Failed to load secrets");if(!i)throw new At("Connection string not found");return{rows:(await A_s(i,t.statement,n,this.logContext,o.toString())).data.rows}},a={Cancel:async()=>{},coalesceQueryID:al(),sqlText:t.statement,promise:s(),attachThen:()=>{}};return this.runningQueries.set(a.coalesceQueryID,a),a}async teardown(){return Promise.resolve()}async resetConnection(){throw new ud("resetConnection() is not supported in FabricConnection.")}setQueryTag=async t=>{}},HUt=async(r,t)=>new get(r,t);Np();vr();ic();ow();sn();vr();xs();var bg0=T.object({TABLE_CATALOG:T.string(),TABLE_SCHEMA:T.string(),TABLE_NAME:T.string(),TABLE_TYPE:T.string()}),VUt=class extends Lre{validator=Cr("FabricInformationSchemaTablesType",bg0);query(t){return`SELECT * FROM ${eA([t.database],"fabric")}.INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = '${t.schema}'`}convert(t){let{TABLE_TYPE:n,TABLE_NAME:i}=t;return{kind:n,name:i,comment:"",extra:t}}},Cg0=T.object({table_catalog:T.string(),table_schema:T.string(),table_name:T.string(),column_name:T.string(),ordinal_position:T.number(),column_default:T.string().nullable(),is_nullable:T.union([T.literal("YES"),T.literal("NO")]),data_type:T.string(),character_maximum_length:T.number().nullable()}),YUt=class extends Fre{validator=Cr("FabricInformationSchemaColumnsType",Cg0);query(t){return`SELECT * FROM ${eA([t.database],"fabric")}.INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '${t.schema}'`}convert(t){throw new ud("Fabric is not implemented","FabricInformationSchemaColumnsImplementation - convert")}queryForObject(t,n){return`${this.query(t)} and table_name = "${n}"`}},Ig0=T.object({name:T.string()}),KUt=class extends qre{validator=Cr("FabricShowSchemaRow",Ig0);query(t){return`SELECT name FROM ${eA([t.database],"fabric")}.sys.schemas;`}convert(t){return{name:t.name,extra:{}}}};var met=class extends zre{constructor(n){super("fabric");this.userContext=n}getObjectsImplementation=new VUt;getColumnsImplementation=new YUt;getSchemasImplementation=new KUt;async getDatabaseNames(){return(await this.getRows(V_i)).map(i=>i.name)}async getSchemaNames(n){let i=eA([n],"fabric");return(await this.getRows(`SELECT name FROM ${i}.sys.schemas;`)).map(s=>s.name)}async getVariantRows(n,i,o,s){throw new ud("Fabric is not implemented","getVariantRows")}async getObjectRows(n,i,o){let s=`SELECT TOP 100 * FROM ${this.getName(n,i)}`;return o&&(s=this.wrapSQLWithExplain(s)),this.getSQLQueryResult(s)}mapDataTypePrecision(n){let i=n.DATA_TYPE,o="";switch(i){case"varchar":case"char":o=n.CHARACTER_MAXIMUM_LENGTH?.toString()||"8000";break;case"nvarchar":case"nchar":o=n.CHARACTER_MAXIMUM_LENGTH?.toString()||"4000";break;case"decimal":case"numeric":o=`${n.NUMERIC_PRECISION?.toString()||"38"},${n.NUMERIC_SCALE?.toString()||"0"}`;break;case"datetime2":case"datetimeoffset":case"time":o=n.DATETIME_PRECISION?.toString()||"7";break;default:return i.toUpperCase()}return`${i.toUpperCase()}(${o})`}createColumnMetadata(n,i){let o=this.mapDataTypePrecision(n);return{name:n.COLUMN_NAME,dataType:o,transform:"",nullable:n.IS_NULLABLE==="YES",defaultValue:"",columnReference:{columnCounter:al(),stepCounter:i},description:"",appliedColumnTests:{},acceptedValues:{strictMatch:!0,values:[]},config:{},sourceColumnReferences:[{transform:"",columnReferences:[]}]}}async describeObject(n,i,o,s){let{database:a,schema:l}=Yz(i.locationName,n,"[FabricBasePlatform.describeObject()]"),u=`SELECT COLUMN_NAME, DATA_TYPE, IS_NULLABLE, CHARACTER_MAXIMUM_LENGTH, NUMERIC_PRECISION, NUMERIC_SCALE, DATETIME_PRECISION FROM ${eA([a],"fabric")}.INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '${i.name}' AND TABLE_SCHEMA = '${l}'`;return(await this.runSQL(u,al())).data.rows.map(p=>this.createColumnMetadata(p,s))}async testConnection(){try{await this.runSQL(_7,void 0)}catch(n){throw Vd(n)?new At(`Could not validate connection to ${this.name}: ${n.message}`,n.detail):new At(`Could not validate connection to ${this.name}`,Hv(n).detail)}}getQueryResultFromTemplateRunResult(n,i){let o=n.runDetails.compiledSQL,s={error:null,fields:[],rows:[],success:!0,sql:o,exportedRefs:[],invalidExportedRefs:[],startTime:i,endTime:new Date,isRunning:!1,name:"",status:n.data.status??"Success",type:"sql",queryID:n.runDetails.queryID,warehouse:n.runDetails.warehouse};if(n.data.rows.length){let a=n.data.rows.map(c=>({values:Object.values(c)})),l=Object.keys(n.data.rows[0]??{}).map(c=>({name:c,type:""}));s.fields=l,s.rows=a}if(n?.runDetails?.exported_refs.length){let a=n.runDetails.exported_refs.map(l=>({locationName:l.location_name,nodeName:l.node_name}));s.exportedRefs=A4(a)}if(n?.runDetails?.invalid_exported_refs.length){let a=n.runDetails.invalid_exported_refs.map(l=>({locationName:l.location_name,nodeName:l.node_name}));s.invalidExportedRefs=A4(a)}return s}convertObjectRowsToMaterializationKinds(n){throw new ud("Fabric is not implemented","convertObjectRowsToMaterializationKinds")}createState(n,i,o,s){return new DUt(s,o,i,n)}wrapSQLWithExplain(n){return`SELECT TOP 0 * FROM (${n}) as CoalesceWrapped`}};vr();var zAn=class extends gre{async createConnection(){return await HUt(this.userContext,this.logContext)}async updateFromResult(t){}async assertConnected(){}async setup(){this.newConnection()}newConnection(){return new get(this.userContext,this.logContext)}},JUt=class r extends mre{static async New(t,n,i,o){let s=new r(t,n,i,o);return await s.setup(),s}NewSlotMember(t,n){return new zAn(t,n,{...this.userContext},this.teamInfo,this.logContext)}test(){throw new ud("test() is not implemented in FabricConnectionManager.")}};var XUt=class r extends met{constructor(n,i){super(i);this.connection=n}async runSQL(n,i){let o=await this.connection.execute({statement:n});return mzt(o,n)}usingConnection=n=>new r(n,this.userContext);teardown(){return Promise.resolve()}},h_s=async(r,t,n,i)=>{let o=await JUt.New(r,t,i,n),s=new XUt(o.getConnection(),r);return{connectionManager:o,platform:s}},g_s=async(r,t)=>{let n=await HUt(r,t);return new XUt(n,r)};var $Ut=(r,t,n)=>{switch(r.kind){case"snowflake":return f_s(r,t,n);case"databricks":return d_s(r,t);case"fabric":return g_s(r,t);default:throw new At(`Cannot create backend for '${r.kind}' connection kind`)}},tG=(r,t,n,i,o)=>{switch(r.kind){case"snowflake":return p_s(r,t,n,i,o);case"databricks":return c_s(r,t,n,i,o);case"fabric":return h_s(r,t,n,o);default:throw new At(`Cannot create backend for '${r.kind}' connection kind`)}};vr();Z_();hr();zq();zae();var RL0=Ct(is());vr();RW();cse();Ag();jl();var gE0=Ct(Qws());zq();RW();cse();Ag();kV();zv();Pi();ic();Jq();xh();mFe();vr();sn();var mE0=T.enum(["org-settings-read","org-settings-write","org-users-read","org-users-write","org-users-create","org-users-delete","org-userRoles-read","org-userRoles-write","org-projects-create"]),yE0=T.enum(["project-settings-read","project-summary-read","project-settings-write","project-delete","project-members-read","project-members-add","project-members-write","project-members-remove","project-workspaces-create","project-documentation-read","project-environments-create","project-workspace-settings-read","project-workspace-settings-write","project-workspaces-delete","project-workspace-jobs-create","project-workspace-jobs-read","project-workspace-jobs-write","project-workspace-jobs-delete","project-workspace-macros-create","project-workspace-macros-read","project-workspace-macros-write","project-workspace-macros-delete","project-workspace-node-types-create","project-workspace-node-types-read","project-workspace-node-types-write","project-workspace-node-types-delete","project-workspace-nodes-create","project-workspace-nodes-read","project-workspace-nodes-write","project-workspace-nodes-delete","project-workspace-packages-create","project-workspace-packages-read","project-workspace-packages-write","project-workspace-packages-delete","project-workspace-sql-run","project-workspace-subgraphs-create","project-workspace-subgraphs-read","project-workspace-subgraphs-write","project-workspace-subgraphs-delete"]),EE0=T.enum(["env-run-results-read","env-run-job","env-delete","env-deploy","env-refresh","env-settings-read","env-summary-read","env-settings-write","env-documentation-read","env-members-read","env-members-add","env-members-write","env-members-remove","env-job-schedule-write","env-job-schedule-read"]),eyn={reader:{permissions:["env-run-results-read","env-summary-read","env-documentation-read","env-job-schedule-read"],inheritedEnvironmentRoles:[]},admin:{permissions:[...EE0.options],inheritedEnvironmentRoles:["reader"]}},tyn={member:{permissions:["project-summary-read","project-members-read","project-workspace-sql-run"],inheritedProjectRoles:[],inheritedEnvironmentRoles:[]},contributor:{permissions:["project-settings-read","project-members-read","project-workspaces-create","project-workspace-settings-read","project-workspace-settings-write","project-workspaces-delete","project-workspace-jobs-read","project-workspace-macros-read","project-workspace-node-types-read","project-workspace-nodes-create","project-workspace-nodes-read","project-workspace-nodes-write","project-workspace-nodes-delete","project-workspace-packages-read","project-workspace-subgraphs-read","project-workspace-subgraphs-create","project-workspace-subgraphs-write","project-workspace-subgraphs-delete","project-documentation-read","env-delete","env-documentation-read"],inheritedProjectRoles:["member"],inheritedEnvironmentRoles:["reader"]},architect:{permissions:["project-workspace-jobs-create","project-workspace-jobs-write","project-workspace-jobs-delete","project-workspace-macros-create","project-workspace-macros-write","project-workspace-macros-delete","project-workspace-node-types-create","project-workspace-node-types-write","project-workspace-node-types-delete","project-workspace-packages-create","project-workspace-packages-write","project-workspace-packages-delete","project-workspace-subgraphs-create","project-workspace-subgraphs-write","project-workspace-subgraphs-delete"],inheritedProjectRoles:["contributor"],inheritedEnvironmentRoles:["reader"]},admin:{permissions:[...yE0.options],inheritedProjectRoles:["architect"],inheritedEnvironmentRoles:["admin"]}},ryn={member:{permissions:["org-users-read"],inheritedOrganizationRoles:[],inheritedProjectRoles:[]},contributor:{permissions:["org-projects-create"],inheritedOrganizationRoles:["member"],inheritedProjectRoles:[]},admin:{permissions:[...mE0.options],inheritedOrganizationRoles:["contributor"],inheritedProjectRoles:["admin"]}},Gjt=r=>{let t=eyn[r],n=new Set(t.permissions);for(let i of t.inheritedEnvironmentRoles)Gjt(i).forEach(o=>n.add(o));return Array.from(n)},T8e=r=>{let t=tyn[r],n=new Set(t.permissions);for(let i of t.inheritedProjectRoles)T8e(i).forEach(o=>n.add(o));for(let i of t.inheritedEnvironmentRoles)Gjt(i).forEach(o=>n.add(o));return Array.from(n)},jjt=r=>{let t=ryn[r],n=new Set(t.permissions);for(let i of t.inheritedOrganizationRoles)jjt(i).forEach(o=>n.add(o));for(let i of t.inheritedProjectRoles)T8e(i).forEach(o=>n.add(o));return Array.from(n)},Lws={admin:jjt("admin"),contributor:jjt("contributor"),member:jjt("member")},Fws={admin:T8e("admin"),architect:T8e("architect"),contributor:T8e("contributor"),member:T8e("member")},qws={admin:Gjt("admin"),reader:Gjt("reader")};var Pet=class{throwIfOrgPermissionDenied(t,n=!1){if(!this.hasOrgPermission(t))throw n?new Zu("The requested resource is unavailable"):new Jy("Permission denied",`Permission '${t}' is required to perform this operation.`)}throwIfProjectPermissionDenied(t,n,i=!1){if(!this.hasProjectPermission(t,n))throw i?new Zu("The requested resource is unavailable"):new Jy("Permission denied",`Permission '${t}' is required to perform this operation.`)}throwIfEnvironmentPermissionDenied(t,n,i,o=!1){if(!this.hasEnvironmentPermission(t,n,i))throw o?new Zu("The requested resource is unavailable"):new Jy("Permission denied",`'Permission ${t}' is required to perform this operation.`)}},Wjt=class r extends Pet{constructor(n,i){super();this.userRoles=n;this.hasSuperUserAccess=i;this.userPermissions=this.ConstructPermissionsFromRoles(n)}userPermissions;hasOrgPermissionInternal(n){return this.userPermissions.organizationPermissions?.has(n)}hasOrgPermission(n){return this.hasSuperUserAccess||this.hasOrgPermissionInternal(n)}hasProjectPermissionInternal(n,i){return this.userPermissions.projects[i]?.projectPermissions?.has(n)}hasProjectPermission(n,i){return this.hasSuperUserAccess||this.hasOrgPermissionInternal(n)||this.hasProjectPermissionInternal(n,i)}hasEnvironmentPermissionInternal(n,i,o){return this.userPermissions.projects[i]?.environments[o]?.environmentPermissions?.has(n)}hasEnvironmentPermission(n,i,o){return this.hasSuperUserAccess||this.hasOrgPermissionInternal(n)||this.hasProjectPermissionInternal(n,i)||this.hasEnvironmentPermissionInternal(n,i,o)}ConstructPermissionsFromRoles(n){return n?{organizationPermissions:r.ConstructOrgPermissionsFromRoles(n.organizationRoles),projects:r.ConstructProjectsPermissionsFromRoles(n.projects)}:{organizationPermissions:new Set,projects:{}}}static ConstructEnvironmentPermissionsFromRoles(n){let i=new Set;return n.environmentRoles.forEach(o=>{qws[o].forEach(s=>{i.add(s)})}),i}static ConstructEnvironmentPermissionObjectsFromRoles(n){let i={};return Object.entries(n).forEach(([o,s])=>{i[o]={environmentPermissions:r.ConstructEnvironmentPermissionsFromRoles(s)}}),i}static ConstructProjectPermissionsFromRoles(n){let i=new Set;return n.projectRoles.forEach(s=>{Fws[s].forEach(a=>{i.add(a)})}),{projectPermissions:i,environments:r.ConstructEnvironmentPermissionObjectsFromRoles(n.environments)}}static ConstructProjectsPermissionsFromRoles(n){let i={};return Object.keys(n).forEach(o=>{i[o]=this.ConstructProjectPermissionsFromRoles(n[o])}),i}static ConstructOrgPermissionsFromRoles(n){let i=new Set;return n.forEach(o=>{Lws[o].forEach(s=>{i.add(s)})}),i}};var Hjt=class extends Pet{constructor(n,i){super();this.userRole=n;this.hasSuperUserAccess=i}hasOrgPermission(n){if(this.hasSuperUserAccess||this.userRole==="Admin")return!0;{let i=["org-settings-read","org-settings-write","org-users-read","org-users-write","org-users-delete"];return this.userRole==="User"&&!i.includes(n)}}hasProjectPermission(n,i){return!!this.userRole||this.hasSuperUserAccess}hasEnvironmentPermission(n,i,o){return!!this.userRole||this.hasSuperUserAccess}};Z_();Pi();var bE0=(r,t)=>{if(t=t===void 0?aIi:t,r<=1||t<=1)return 1;let s=r<=4?r:Math.floor((r-4)/2)+4;return Math.min(s,t)},lG=(r,t)=>{let n=bE0(r,t),i=lIi,o=i<n?i:n;return o>0?o:1};ow();Ad();RV();Pi();xh();hr();var Qv1=nt.FIREBASE;var zws=(r,t)=>oli(r.collection("users").doc(t)).then(n=>({fbEmail:"",fbRole:n.data()?.role,fbUserID:t,fbTeamID:n.data()?.currentTeam,fbOrg:n.data()?.organization,fbFullName:`${n.data()?.firstName} ${n.data()?.lastName}`,fbFirstName:n.data()?.firstName,fbLastName:n.data()?.lastName,fbHasSuperUserAccess:n.data()?.hasSuperUserAccess,fbActivated:n.data()?.activated??!0,hasProvisioningAccess:n.data()?.hasProvisioningAccess}));var Uws=async(r,t)=>(await r.org(t).fetch()).superDebugEnabled;var jws=Ct(is());RV();Pi();yo();xh();jl();hr();yo();hr();var IE0=Ct(is()),Gv1=nt.FIREBASE,vE0=()=>{let r={organization:{},project:{},environment:{}},t=(n,i,o)=>{for(let s of o(n))i.add(s),t(s,i,o);return Array.from(i)};for(let n of Eqe.options)r.organization[n]=t(n,new Set,i=>ryn[i].inheritedOrganizationRoles);for(let n of b5r.options)r.project[n]=t(n,new Set,i=>tyn[i].inheritedProjectRoles);for(let n of C5r.options)r.environment[n]=t(n,new Set,i=>eyn[i].inheritedEnvironmentRoles);return r},Wv1=vE0();sn();yo();var Kv1=Ip({firstName:Wa(),lastName:Wa(),role:Wa(),currentTeam:Wa(),email:Wa(),password:Wa().optional(),accountType:Wa(),hasSuperUserAccess:gB().optional(),hasProvisioningAccess:gB().optional(),activated:gB().optional(),authDisabled:gB().optional(),multiFactorIsEnabled:gB().optional(),deleted:gB().optional()}),Jv1=vEe.pick({firstName:!0,lastName:!0,role:!0,currentTeam:!0,email:!0,activated:!0,password:!0,accountType:!0,version:!0}).extend({rbacRole:Eqe.optional()}).strict(),Xv1=vEe.partial({firstName:!0,lastName:!0,role:!0,activated:!0,authDisabled:!0,deleted:!0,phoneNumber:!0,currentTeam:!0,email:!0,accountType:!0}).strict();var h41=nt.FIREBASE,g41=nt.USER_ACTIVATION;var m41=new RegExp("(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[!\"#$%&'()*+,-.\\/:;<=>?@[\\]\\^_`{|}~]).{8,}");var Gws=r=>{let t={canUpdateUser:["Admin"],canUpdateSuperUser:[],canResetPassword:["Admin"]};return n=>t[n].includes(r)};kV();yo();hr();vr();ds();Ag();var _E0=500,OE0=10*1024*1024,TE0=.7*OE0,Vjt=class{constructor(t){this.firestoreOperations=t;this.batch=t.batch(),this.batchSize=0,this.requestSize=0,this.batchesCommitted=0}batch;batchSize;requestSize;batchesCommitted;batchIncrement=async(t,n)=>{let i=Gq(t)+Gq(n),o=this.requestSize+i>=TE0,s=this.batchSize+1>=_E0;o||s?(await this.commit(),this.batchSize=1,this.requestSize=i,this.batch=this.firestoreOperations.batch()):(this.batchSize+=1,this.requestSize+=i)};async save(t,n){let i=t,o=i.prepareDataForSave(n);await this.batchIncrement(o,i.docRef.path),this.firestoreOperations.saveDocBatch(this.batch,i.docRef,o)}async merge(t,n){let i=t,o=i.prepareDataForMerge(n);await this.batchIncrement(o,i.docRef.path),this.firestoreOperations.updateDocBatch(this.batch,i.docRef,o)}async delete(t,n){let i=t,o=i.docRef;if(await this.batchIncrement(n,o.path),this.firestoreOperations.deleteDocBatch(this.batch,i.docRef),o.parent.id==="steps"){let s=this.firestoreOperations.collectionRef(o.parent.parent,"deletedSteps"),a=this.firestoreOperations.docRef(s,o.id),l={deletedAt:this.firestoreOperations.getServerTimestampSentinel()};await this.batchIncrement(l,a.path),this.firestoreOperations.saveDocBatch(this.batch,a,l)}}async commit(){return o0().info("committing batch!"),this.batchSize&&(this.batchesCommitted+=1,await this.firestoreOperations.commitBatch(this.batch)),this.batchesCommitted}};vr();var Yjt=r=>r?r?.message??"":"",wE0=r=>/(PERMISSION_DENIED)|(false for 'get')|(false for 'list')|(false for 'update')|(false for 'delete')|(Missing or insufficient permissions.)/.test(Yjt(r)),RE0=r=>/NOT_FOUND/.test(Yjt(r)),ket=r=>wE0(r)?new Jy("Permission denied",Yjt(r)):RE0(r)?new Zu("Not found",Yjt(r)):r,bR=async r=>{try{return await r}catch(t){throw ket(t)}};var ene=class extends mle{constructor(n,i,o,s,a,l){super(n);this.id=n;this.ref=i;this.subCollectionNames=o;this.parent=s;this.logContext=a;this.firestoreOperations=l}subCollections=[];runTransaction(n,i){let o=n?.transaction;return bR(o?i(n):this.firestoreOperations.runTransaction(s=>i({...n??{},transaction:s})))}getSubCollection(n,i){let o=this.subCollections[n];return o||(o=new i(this.firestoreOperations.collectionRef(this.ref,n),this,this.logContext,this.firestoreOperations),this.subCollections[n]=o),o}};vr();yo();var Wws=Ct(is());Ag();var Xs=class extends ene{constructor(n,i,o,s,a,l){super(n.id,n,[],o,s,a);this.collectionRef=n;this.dataTransform=i;this.EntityRepositoryConstructor=l}get path(){return this.collectionRef.path}get(n){let i=this.firestoreOperations.docRef(this.collectionRef,n.toString());return new this.EntityRepositoryConstructor(n,i,this.parent,this.logContext,this.firestoreOperations)}async select(n,i){let o=i?.transaction,s=this.firestoreOperations.createQuery(this.collectionRef,n),a;return o?a=await bR(o.getQuery(s)):a=await bR(this.firestoreOperations.runQuery(s)),a.docs.map(l=>this.transformDataFromStorage(l.ref,this.firestoreOperations.data(l),i))}async createEntity(n,i){let o=i?.transaction,s=await this.generateID(n),a=this.firestoreOperations.docRef(this.collectionRef,s?.toString()),l=await this.prepareDataForCreate(n,s??a.id,i);return o?o.set(a,l):await bR(this.firestoreOperations.addDoc(a,l)),new this.EntityRepositoryConstructor(s||a.id,a,this.parent,this.logContext,this.firestoreOperations)}listenCollection(n,i,o){let[s,a]=this.getListenCallbacks(n,i,o);return this.firestoreOperations.onCollectionSnapshot(this.collectionRef,s,a)}listenQuery(n,i,o,s){let[a,l]=this.getListenCallbacks(i,o,s);return this.firestoreOperations.onQuerySnapshot(this.firestoreOperations.createQuery(this.collectionRef,n),a,l)}async prepareDataForCreate(n,i,o){let s=n.createdBy??this.firestoreOperations.currentUser(),a={...(0,Wws.cloneDeep)(n),id:i,createdAt:p8(),createdBy:s,updatedAt:p8(),updatedBy:s};return this.dataTransform.toStorage(i.toString(),`${this.path}/${i}`,a,this.firestoreOperations,o)}getListenCallbacks(n,i,o){return[s=>{let a=this.firestoreOperations.snapShotChanges(s).reduce((l,c)=>{try{let u=this.transformDataFromStorage(c.doc.ref,c.doc.data(),o);l.push({type:c.type==="added"?"added":c.type==="removed"?"removed":"modified",value:u,id:u.id.toString(),hasPendingWrites:this.firestoreOperations.hasPendingWrites(c.doc)})}catch(u){i&&i(u)}return l},[]);o0().debug(`Listener notification for ${a.length} changes in collection ${this.path}`),n(a)},s=>{o0().error(`Firestore error listening to collection ${this.path}`,s),i&&i(ket(s))}]}transformDataFromStorage(n,i,o){return this.dataTransform.fromStorage(n.id,n.path,i,this.firestoreOperations,o)}async generateID(n){return n.id}async getCount(){return this.firestoreOperations.getCount(this.collectionRef)}async selectInBatches(n,i){return(await this.firestoreOperations.selectInBatches(this.collectionRef,n,i)).map(a=>a.docs).flat().map(a=>this.transformDataFromStorage(a.ref,this.firestoreOperations.data(a)))}};var Qet=Ct(is());vr();Ag();var $s=class extends ene{constructor(n,i,o,s,a,l,c=[]){super(n,i,c,s,a,l);this.docRef=i;this.dataTransform=o}get path(){return this.docRef.path}async fetch(n){let i=n?.transaction,o;if(i?o=await bR(i.get(this.docRef)):o=await bR(this.firestoreOperations.getDoc(this.docRef,n)),!o.exists)throw o0().info(`Document ${this.path} not found`),new Zu(`Entity ${this.path} not found`);return this.dataTransform.fromStorage(this.id.toString(),this.path,this.firestoreOperations.data(o),this.firestoreOperations,n)}async save(n,i){let o=i?.transaction,s=this.prepareDataForSave(n,i);o?o.set(this.docRef,s):await bR(this.firestoreOperations.saveDoc(this.docRef,s))}async merge(n,i){let o=i?.transaction,s=this.prepareDataForMerge(n,i);o?o.update(this.docRef,s):await bR(this.firestoreOperations.updateDoc(this.docRef,s))}fetchAndMerge(n,i){return this.runTransaction(i,async o=>{let s=await this.fetch(o);return this.save(this.mergeWithDeletes(s,n),o)})}async delete(n){let i=n?.transaction;i?i.delete(this.docRef):await bR(this.firestoreOperations.deleteDoc(this.docRef))}listen(n,i,o){let s=!0;return this.firestoreOperations.onDocSnapshot(this.docRef,a=>{if(this.firestoreOperations.exists(a))try{o0().debug(`Listener notification for document ${this.path} modified`),n({type:s?"added":"modified",value:this.dataTransform.fromStorage(this.id.toString(),this.path,this.firestoreOperations.data(a),this.firestoreOperations,o),id:this.id.toString(),hasPendingWrites:this.firestoreOperations.hasPendingWrites(a)}),s=!1}catch(l){i&&i(l)}else o0().debug(`Listener notification for document ${this.path} removed`),n({type:"removed",id:a.id,hasPendingWrites:this.firestoreOperations.hasPendingWrites(a)})},a=>{o0().error(`Firestore error listening to document ${this.path}`,a),i&&i(ket(a))})}prepareDataForSave(n,i){if(n.id&&n.id?.toString()!==this.docRef.id)throw new Rs(`Attempt to assign a new ID to entity ${this.path} `);let o=this.firestoreOperations.currentUser(),s=this.id.toString(),a={id:this.id,...(0,Qet.cloneDeep)(n),createdAt:n.createdAt??p8(),createdBy:n.createdBy??o,updatedAt:p8(),updatedBy:o};return this.dataTransform.toStorage(s,this.path,a,this.firestoreOperations,i)}prepareDataForMerge(n,i){let o=n.id;if(o&&o.toString()!==this.docRef.id)throw new Rs(`Attempt to assign a new ID to entity ${this.path} `);let s={...(0,Qet.cloneDeep)(n),updatedAt:p8(),updatedBy:this.firestoreOperations.currentUser()};return this.dataTransform.mergeToStorage(this.id.toString(),this.path,s,this.firestoreOperations)}mergeWithDeletes(n,i){return Hce(this.path,o=>o instanceof hle?[void 0,!0]:[o,!1],(0,Qet.merge)(n,i))}};yo();Np();yo();var BE0=Os.merge(cSi),xE0=_a("GitAccount",BE0),Hws=Oa(xE0),nyn=class extends $s{constructor(t,n,i,o,s){super(t,n,Hws,i,o,s)}},Kjt=class extends Xs{constructor(t,n,i,o){super(t,Hws,n,i,o,nyn)}async generateID(t){return t.id??al()}};Np();yo();var ME0=Os.merge(KSi),DE0=_a("ProjectGitAccount",ME0),Vws=Oa(DE0),iyn=class extends $s{constructor(t,n,i,o,s){super(t,n,Vws,i,o,s)}},Jjt=class extends Xs{constructor(t,n,i,o){super(t,Vws,n,i,o,iyn)}async generateID(t){return t.id??al()}};var NE0=Os.merge(fSi),PE0=_a("GlobalUserSettings",NE0),Yws=Oa(PE0),oyn=class extends $s{constructor(t,n,i,o,s){super(t,n,Yws,i,o,s,["gitAccounts","projectGitAccounts"])}get gitAccounts(){return this.getSubCollection("gitAccounts",Kjt)}gitAccount(t){return this.gitAccounts.get(t)}get projectGitAccounts(){return this.getSubCollection("projectGitAccounts",Jjt)}projectGitAccount(t){return this.projectGitAccounts.get(t)}},Xjt=class extends Xs{constructor(t,n,i,o){super(t,Yws,n,i,o,oyn)}};Np();yo();var kE0=Os.merge(X_r),QE0=_a("Project",kE0),Kws=Oa(QE0),syn=class extends $s{constructor(t,n,i,o,s){super(t,n,Kws,i,o,s)}},$jt=class extends Xs{constructor(t,n,i,o){super(t,Kws,n,i,o,syn)}async generateID(t){return t.id??al()}};sn();vr();yo();hr();hr();var LE0=nt.FIREBASE,Zjt=class extends ty{transformFromStorage(t,n,i){let o=[];return i.hasOwnProperty("endTime")&&(o.push("Removing property 'endTime'"),delete i.endTime),(!i.version||i.version<=3)&&(o.push(`Updating version ${i?.version} to 3`),i.version=3),i.runType==="refresh"&&i.runDetails&&!i.runDetails.environmentID&&(o.push('Setting missing runDetails.environmentID to "0"'),i.runDetails.environmentID="0"),LE0.debug(`Patched run ${n}`,o),i}};yo();hr();var FE0=nt.FIREBASE,eGt=class extends ty{transformFromStorage(t,n,i){let o=[];return!i.queryResultSequence&&Array.isArray(i.history)&&i.history.length>0&&(o.push("Moving 'history[0]' to 'queryResultSequence'"),i.queryResultSequence=i.history[0]?.queryResultSequence,delete i.history),(i.runExecutionSequenceID===void 0||i.runExecutionSequenceID===null)&&(o.push("Setting 'runExecutionSequenceID' to zero"),i.runExecutionSequenceID=0),(i.name===void 0||i.name===null)&&(o.push("Setting 'name' to 'unknown'"),i.name="unknown"),i.queryResultSequence?.queryResults?.map((s,a)=>{s.isRunning!==!0&&typeof s=="object"&&(s.status||(o.push(`Setting 'status' to 'Failure' for query result ${a}`),s.status="Failure"),s.type||(o.push(`Setting 'type' to 'sql' for query result ${a}`),s.type="sql"),s.exportedRefs||(o.push(`Setting 'exportedRefs' to empty array for query result ${a}`),s.exportedRefs=[]),s.invalidExportedRefs||(o.push(`Setting 'invalidExportedRefs' to empty array for query result ${a}`),s.invalidExportedRefs=[]),s.fields||(o.push(`Setting 'fields' to empty array for query result ${a}`),s.fields=[]),s.sql||(o.push(`Setting 'sql' to empty string for query result ${a}`),s.sql=""),s.rows||(o.push(`Setting 'rows' to empty array for query result ${a}`),s.rows=[]),s.startTime||(o.push(`Setting 'startTime' to ${eZ.toISOString} for query result ${a}`),s.startTime=eZ),s.endTime||(o.push(`Setting 'endTime' to ${eZ.toISOString} for query result ${a}`),s.endTime=eZ),s.fields?.map((l,c)=>{o.push(`Setting 'type' to 'unknown' for field ${c} of query result ${a}`),l.type||(l.type="unknown")}),s.error?.message&&(s.error.errorString||(o.push(`Setting 'error.errorString' to 'error.message' for query result ${a}`),s.error.errorString=s.error.message),o.push(`Removing 'error.message' for query result ${a}`),delete s.error.message),s.error?.originalError&&(o.push(`Removing 'error.originalError' from query result ${a}`),delete s.error.originalError))}),i.runResultVersion=2,i.version=2,o.length>0&&FE0.debug(`Patched run result ${n}`,o),i}};var qE0=Os.merge(p3t),zE0=_a("QueryResult",qE0),nGt=Oa(zE0),ayn=class extends $s{constructor(t,n,i,o,s){super(t,n,nGt,i,o,s)}},lyn=class extends Xs{constructor(t,n,i,o){super(t,nGt,n,i,o,ayn)}},uyn=class extends $s{constructor(t,n,i,o,s){super(t,n,nGt,i,o,s)}},cyn=class extends Xs{constructor(t,n,i,o){super(t,nGt,n,i,o,uyn)}},UE0=Os.merge(h3t),jE0=_a("RunResult",UE0),iGt=Oa(jE0,new eGt),dyn=class extends $s{constructor(t,n,i,o,s){super(t,n,iGt,i,o,s,["queryResults"])}get queryResults(){return this.getSubCollection("queryResults",lyn)}queryResult(t){return this.queryResults.get(t)}},tGt=class extends Xs{constructor(t,n,i,o){super(t,iGt,n,i,o,dyn)}},pyn=class extends $s{constructor(t,n,i,o,s){super(t,n,iGt,i,o,s,["queryResults"])}get queryResults(){return this.getSubCollection("queryResults",cyn)}queryResult(t){return this.queryResults.get(t)}},rGt=class extends Xs{constructor(t,n,i,o){super(t,iGt,n,i,o,pyn)}};var Let=(r,t,n)=>{let i=typeof r=="string"?parseInt(r):r;if(isNaN(i)||i===void 0)throw new t(`Missing or invalid environment ID '${r}' context=${JSON.stringify(n)}`);return i};var tne=nt.FIREBASE,GE0=T.discriminatedUnion("runType",[Os.merge(c5r),Os.merge(d5r),Os.merge(p5r)]),WE0=_a("Run",GE0),aGt=Oa(WE0,new Zjt,!0),fyn=class extends $s{constructor(t,n,i,o,s){super(t,n,aGt,i,{...o,runID:t},s,["runResults"])}get runResults(){return this.getSubCollection("runResults",tGt)}runResult(t){return this.runResults.get(t)}async updateHeartbeat(t={},n){return this.merge({...t,runHeartbeat:p8()},n)}},oGt=class extends Xs{constructor(t,n,i,o){super(t,aGt,n,i,o,fyn)}async createDeployRun(t,n){let i=t.runDetails.environmentID?Let(t.runDetails.environmentID,Rs,this.logContext):Let(t.runDetails.toWorkspaceID,Rs,this.logContext),o={...this.logContext,environmentID:i},s=(c,u)=>($Fr(c,"deploy",t.runDetails.forcedDeployment,o),{status:"Deploying",currentlyRunningJobs:c.currentlyRunningJobs?c.currentlyRunningJobs.concat(u):u}),a={...t,runDetails:{...t.runDetails}};if(delete a.runDetails.fromWorkspaceData,a.runDetails.version===2)for(let c of h_i)delete a.runDetails[c];else for(let c of f_i)delete a.runDetails[c];let l=await hyn(this,i,a,s,n);return vye(o,l.id),tne.infoContext(o,"FirestoreOrgRepo createDeployRun: finished securing workspace"),l}async createRefreshRun(t,n){let i=Let(t.runDetails.environmentID,Rs,this.logContext),o={...this.logContext,environmentID:i},a=await hyn(this,i,t,(l,c)=>($Fr(l,"refresh",t.runDetails.forceIgnoreWorkspaceStatus,o),{status:l.status==="Failed Deploy"?l.status:"Refreshing",currentlyRunningJobs:l.currentlyRunningJobs?l.currentlyRunningJobs.concat(c):c}),n);return vye(o,a.id),tne.infoContext(o,"FirestoreOrgRepo createRefreshRun: finished securing workspace"),a}},Ayn=class extends $s{constructor(t,n,i,o,s){super(t,n,aGt,i,{...o,runID:t},s,["runResults"])}get runResults(){return this.getSubCollection("runResults",rGt)}runResult(t){return this.runResults.get(t)}async updateHeartbeat(t={}){let n=this.prepareDataForMerge(t);n.runHeartbeat=this.firestoreOperations.getServerTimestampSentinel(),await this.firestoreOperations.updateDoc(this.docRef,n)}},sGt=class extends Xs{constructor(t,n,i,o){super(t,aGt,n,i,o,Ayn)}async createDevRun(t){let n=Let(t.runDetails.environmentID,Rs,this.logContext),i={...this.logContext,environmentID:n},o=(a,l)=>{if(!a.devEnv)throw new Rs(`Unable to secure ${a.name}`,`${a.name} is a not a development workspace, context=${JSON.stringify(i)}`);return{currentlyRunningDevJobs:a.currentlyRunningDevJobs?a.currentlyRunningDevJobs.concat(l):l}};delete t.runDetails.dependencies;let s=await hyn(this,n,t,o);return vye(i,s.id),tne.infoContext(i,"FirestoreOrgRepo createDevRun: finished securing workspace"),s}},hyn=(r,t,n,i,o)=>{let s=r.parent.workspace(t),a={...r.logContext,environmentID:t};return r.runTransaction(o,async l=>{tne.infoContext(a,"securing workspace status");let[c,u]=await Promise.all([s.fetch(l),r.parent.getNextCounter(r.id.substring(0,r.id.length-1),1,l)]);vye(a,u),tne.infoContext(a,"got workspace doc data, updating workspace",{status:c?.status,jobs:c?.currentlyRunningJobs});let d=()=>{try{return i(c,[u])}catch(A){if(tne.errorContext(a,"createRun: error updating workspace",{error:A}),A instanceof oZ){let h=A.detail??`${c.name} is in state ${c.status},`;throw new r_(A.message,h+` context=${JSON.stringify(a)}.`)}throw A}};await s.merge(d(),l),tne.infoContext(a,`Run ${u} will use the following mappings:`,c.mappingsV1),tne.infoContext(a,"reserving run");let p=await r.prepareDataForCreate(n,u);p.runStartTime=r.firestoreOperations.getServerTimestampSentinel(),p.runHeartbeat=r.firestoreOperations.getServerTimestampSentinel();let f=r.get(u);return l.transaction.set(f.docRef,p),f})};yo();yo();var HE0=Os.merge(v7),VE0=_a("Macro",HE0),Jws=Oa(VE0,void 0,!0),gyn=class extends $s{constructor(t,n,i,o,s){super(t,n,Jws,i,o,s)}},lGt=class extends Xs{constructor(t,n,i,o){super(t,Jws,n,i,o,gyn)}};yo();var YE0=Os.merge(c3t),KE0=_a("NodeType",YE0),Xws=Oa(KE0),myn=class extends $s{constructor(t,n,i,o,s){super(t,n,Xws,i,o,s)}},uGt=class extends Xs{constructor(t,n,i,o){super(t,Xws,n,i,o,myn)}async generateID(t){return t.id??(await this.parent.parent.getNextCounter("template")).toString()}};Np();sn();ds();yo();vr();var JE0=T.discriminatedUnion("type",[Os.merge(Fi.merge(fY)),Os.merge(Fi.merge(AY))]),XE0=_a("Node",JE0),$ws=Oa(XE0,new Lwt),yyn=class extends $s{constructor(t,n,i,o,s){super(t,n,$ws,i,{...o,nodeID:t},s)}async delete(t){if(await super.delete(t),this.docRef.parent.id==="steps"){let n=this.firestoreOperations.collectionRef(this.docRef.parent.parent,"deletedSteps"),i=this.firestoreOperations.docRef(n,this.id);await this.firestoreOperations.saveDoc(i,{deletedAt:this.firestoreOperations.getServerTimestampSentinel()})}}mergeMetadata(t,n){return this.merge(Object.fromEntries(Object.entries(t).map(([i,o])=>[`metadata.${i}`,o])),n)}},cGt=class extends Xs{constructor(t,n,i,o){super(t,$ws,n,i,o,yyn)}async generateID(t){return t.id??al()}listenCollection(t,n,i){throw new ud("The firestore nodes repository listener is not implemented. Use listenCollectionOverride")}listenCollectionOverride(t,n,i,o,s){let[a,l]=this.getListenCallbacks(t,o,s),c=this.firestoreOperations.onCollectionSnapshot(this.collectionRef.orderBy("updatedAt").startAfter(n),a,l),u=p=>{let A=[...p.docChanges()].map(h=>({type:"removed",id:h.doc.id,doc:h.doc,oldIndex:-1,newIndex:-1})).filter(h=>{let y=h.doc.data(),C=i[h.doc.id];if(C)if(C.updatedAt){let v=new Date(C.updatedAt),O=y.deletedAt?y.deletedAt.toDate():v;return v<=O}else return!0;return!1}).map(h=>({type:"removed",value:{id:h.doc.id},id:h.doc.id,hasPendingWrites:!1}));t(A)},d=this.firestoreOperations.onCollectionSnapshot(this.collectionRef.parent.collection("deletedSteps").orderBy("deletedAt").startAfter(n),u,l);return()=>{c(),d()}}convertFromRestAPIStorage(t,n){return this.transformDataFromStorage({id:n},t)}async getNodesLocationInfo(){let t=this.firestoreOperations.createQuery(this.collectionRef,{selectFields:["id","name","locationName","sqlType","type"]}),n=await this.firestoreOperations.runQuery(t),i={};return n.forEach(o=>{let s=aSi.verify({operation:{...o.data()}});i[o.id]=s}),i}};vr();yo();var $E0=Os.merge(yqe),ZE0=_a("Subgraph",$E0),Zws=Oa(ZE0),Eyn=class extends $s{constructor(t,n,i,o,s){super(t,n,Zws,i,o,s)}fetchAndMerge(t,n){return n?.uniquenessConstraints?this.runTransaction(n,async i=>{if((await this.fetch(i)).name!==t.name&&(await this.parent.subgraphs.select({where:[[n.uniquenessConstraints.field,"in",n.uniquenessConstraints.values]]},i)).length>0)throw new r_(`${n.uniquenessConstraints.field} must be unique`);let a=this.prepareDataForMerge(t,n);return i.transaction.update(this.docRef,a)}):super.fetchAndMerge(t,n)}},dGt=class extends Xs{constructor(t,n,i,o){super(t,Zws,n,i,o,Eyn)}createEntity(t,n){return n?.uniquenessConstraints?this.runTransaction(n,async i=>{if((await this.select({where:[[n.uniquenessConstraints.field,"in",n.uniquenessConstraints.values]]},i)).length>0)throw new r_(`${n.uniquenessConstraints.field} must be unique`);let s=await this.generateID(t),a=this.firestoreOperations.docRef(this.collectionRef,s?.toString()),l=await this.prepareDataForCreate(t,s??a.id,n);return i.transaction.set(a,l),new this.EntityRepositoryConstructor(s||a.id,a,this.parent,this.logContext,this.firestoreOperations)}):super.createEntity(t,n)}};sn();yo();hr();var eb0=nt.FIREBASE,pGt=class extends ty{transformFromStorage(t,n,i){let o=[];return["connectionDetails","authenticator"].forEach(s=>{i?.connectionDetails?.hasOwnProperty(s)&&(o.push(`deleting property 'connectionDetails.${s}']`),delete i.connectionDetails[s])}),o.length>0&&eb0.debug(`Patched workspace user ${n}`,o),i}};var tb0=T.union([Os.merge(I5r),Os.merge(v5r),Os.merge(S5r)]),rb0=_a("WorkspaceUser",tb0),e6s=Oa(rb0,new pGt),byn=class extends $s{constructor(t,n,i,o,s){super(t,n,e6s,i,o,s)}},fGt=class extends Xs{constructor(t,n,i,o){super(t,e6s,n,i,o,byn)}};hr();yo();var nb0=nt.FIREBASE,AGt=class extends ty{transformFromStorage(t,n,i){let o=i,s=[];return o.status||(s.push("setting missing 'status' property to 'initializing'"),o.status="Initializing"),o.version||(s.push(`setting missing 'version' property to '${fEe}'`),o.version=fEe),o.tagColors||(s.push("Setting missing 'tagColors' property to default"),o.tagColors={backgroundColor:cFr,textColor:"#e5e5e5"}),o.mappingsV1||(s.push("Setting missing 'mappingsV1' property to '{}'"),o.mappingsV1="{}"),o.version===0&&(o.mappings||(s.push("Setting missing 'mappings' property to empty object"),o.mappings={}),o.deployedWorkspaces||(s.push("Setting missing 'deployedWorkspaces' property to empty object"),o.deployedWorkspaces={})),(o.mappingsV1===null||o.mappingsV1===void 0)&&(s.push("Settings missing 'mappingsV1' property to an empty string"),o.mappingsV1=""),o.name||(o.name=`Workspace${t}`,s.push(`Setting missing 'name' property to '${o.name}`)),s.length>0&&nb0.debug(`Patched workspace ${n}:`,s),o}};yo();var ib0=Os.merge(gY),ob0=_a("Job",ib0),t6s=Oa(ob0),Cyn=class extends $s{constructor(t,n,i,o,s){super(t,n,t6s,i,o,s)}},hGt=class extends Xs{constructor(t,n,i,o){super(t,t6s,n,i,o,Cyn)}async generateID(t){return t.id??this.parent.parent.getNextCounter("job")}};yo();var sb0=Os.merge(bEe),ab0=_a("InstalledPackage",sb0),r6s=Oa(ab0),Iyn=class extends $s{constructor(t,n,i,o,s){super(t,n,r6s,i,o,s)}},gGt=class extends Xs{constructor(t,n,i,o){super(t,r6s,n,i,o,Iyn)}};Np();_5r();var lb0=Os.merge(L_i),ub0=_a("NodeLastRefreshed",lb0),n6s=Oa(ub0,void 0,!0),vyn=class extends $s{constructor(t,n,i,o,s){super(t,n,n6s,i,{...o,nodeID:t},s)}},mGt=class extends Xs{constructor(t,n,i,o){super(t,n6s,n,i,o,vyn)}async generateID(t){return t.id??al()}};var cb0=Os.merge(Y4i),db0=_a("Workspace",cb0),i6s=Oa(db0,new AGt,!0),Syn=class extends $s{constructor(t,n,i,o,s){super(t,n,i6s,i,o,s,["jobs","macros","nodes","nodeTypes","subgraphs","users","installedPackages","nodesLastRefreshed"])}get installedPackages(){return this.getSubCollection("installedPackages",gGt)}installedPackage(t){return this.installedPackages.get(t)}get jobs(){return this.getSubCollection("jobs",hGt)}job(t){return this.jobs.get(t)}get macros(){return this.getSubCollection("macros",lGt)}macro(t){return this.macros.get(t)}get nodes(){return this.getSubCollection("steps",cGt)}node(t){return this.nodes.get(t)}get nodesLastRefreshed(){return this.getSubCollection("nodesLastRefreshed",mGt)}nodeLastRefreshed(t){return this.nodesLastRefreshed.get(t)}get nodeTypes(){return this.getSubCollection("templates",uGt)}nodeType(t){return this.nodeTypes.get(t)}get subgraphs(){return this.getSubCollection("folders",dGt)}subgraph(t){return this.subgraphs.get(t)}get users(){return this.getSubCollection("users",fGt)}user(t){return this.users.get(t)}async isDevEnv(){return!!(await this.fetch()).devEnv}async removeDeletedSteps(){let n=this.firestoreOperations.collectionRef(this.docRef,"deletedSteps").orderBy("__name__").limit(100),i=async(o,s)=>{try{let a=this.parent.parent.batch(),l=await n.get();if(l.size===0){o();return}let u=[...l.docs].map(d=>({docRef:d.ref}));for(let d of u)await a.delete(d,{});await a.commit(),process.nextTick(()=>{i(o,s)})}catch(a){s(a)}};return new Promise((o,s)=>i(o,s))}},yGt=class extends Xs{constructor(t,n,i,o){super(t,i6s,n,i,o,Syn)}async generateID(t){return t.id??this.parent.getNextCounter("workspace")}async fetchWorkspacesForPermissions(t){let n=this.firestoreOperations.createQuery(this.collectionRef,{selectFields:["id","project"],where:[["devEnv","==",t]]});return(await this.firestoreOperations.runQuery(n)).docs.map(s=>s.data())}};hr();var pb0=nt.FIREBASE,EGt=class extends ty{transformFromStorage(t,n,i){let o=[];i.orgName||(o.push("Adding property orgName with default value"),i.orgName="");let s=i.licenseDetails;return typeof s=="object"&&(s.trialActivator||(o.push("Adding property licenseDetails.trialActivator with default value"),s.trialActivator=""),s.companyName||(o.push("Adding property licenseDetails.companyName with default value"),s.companyName="")),o.length>0&&pb0.debug(`Patched org ${n}`,o),i}};var w8e=Ct(is());vr();yo();hr();hr();var fb0=nt.FIREBASE,bGt=class extends ty{transformFromStorage(t,n,i){let o=i,s=[],a=(l,c,u,d)=>{let p=c.indexOf(u);p>=0&&(s.push(`Changing ${l} role '${u}' to '${d}'`),c[p]=d)};for(let l of Object.values(o?.projects)){l.projectRoles?(a("project",l.projectRoles,"reader","member"),a("project",l.projectRoles,"owner","admin")):(l.projectRoles=[],s.push("Changing project.projectRoles from undefined to empty array"));for(let c of Object.values(l?.environments))c.environmentRoles?a("env",c.environmentRoles,"owner","admin"):(c.environmentRoles=[],s.push("Changing env.environmentRoles from undefined to empty array"))}return s.length>0&&fb0.debug(`Patched userRoles ${n}`,s),i}};var Fet=nt.USER_MANAGEMENT,Ab0=Os.merge(B_i),hb0=_a("UserRoles",Ab0),o6s=Oa(hb0,new bGt),_yn=class extends $s{constructor(t,n,i,o,s){super(t,n,o6s,i,o,s)}async upsertProjectRoles(t,n,i){return await this.runTransaction(i,async o=>{await this.parent.project(n).fetch(o);let s=await this.fetch(o);(s.projects[n]?.projectRoles.includes("admin")??!1)&&!t.projectRoles.includes("admin")&&await this.throwIfLastProjectAdmin(n,o);let c=(0,w8e.cloneDeep)(s.projects[n]);return Object.values(t.environments).forEach(u=>{t.projectRoles.includes("member")?u.environmentRoles=[]:t.projectRoles.includes("admin")?u.environmentRoles=["admin"]:u.environmentRoles=["reader"]}),s.projects[n]=t,await this.save(s,o),Fet.infoContext(this.logContext,`User project roles updated for user ${s.id} at project ${n}. Previous roles:`,c,"New roles:",s.projects[n]),s})}async upsertUserOrganizationRoles(t,n){return await this.runTransaction(n,async i=>{let o;try{o=await this.fetch(i)}catch(d){if(Vd(d)&&(d instanceof Zu||d instanceof Jy))o={id:this.id,organizationRoles:[],projects:{}};else throw d}let s=o.organizationRoles.includes("admin"),a=t.includes("admin"),l=!s&&a,c=s&&!a;l&&await this.parent.parent.user(this.id).merge({role:"Admin"},i),c&&(await this.throwIfLastOrgAdmin(i),await this.parent.parent.user(this.id).merge({role:"User"},i));let u=(0,w8e.cloneDeep)(o.organizationRoles);return o.organizationRoles=t,await this.save(o,i),Fet.infoContext(this.logContext,`User org roles updated for user ${o.id}. Previous roles:`,u,"New roles:",o.organizationRoles),o})}async upsertEnvironmentRoles(t,n,i,o){return await this.runTransaction(o,async s=>{let a=await this.parent.workspace(i).fetch(s);if(a.project!==n||a.devEnv)throw new Zu(`Environment ${i} not found`);let l=await this.fetch(s);if(!l.projects[n]?.projectRoles.length)throw new Jy("User must have a project role before being granted any environment roles therein");(l.projects[n]?.environments[i]?.environmentRoles.includes("admin")??!1)&&!t.environmentRoles.includes("admin")&&await this.throwIfLastEnvironmentAdmin(n,i,s);let d=(0,w8e.cloneDeep)(l.projects[n].environments[i]);return l.projects[n].environments[i]=t,await this.save(l,s),Fet.infoContext(this.logContext,`User env roles updated for user ${l.id} at envID ${i} in project ${n}. Previous roles:`,d,"New roles:",l.projects[n].environments[i]),l})}async deleteUserProjectRoles(t,n){return await this.runTransaction(n,async i=>{let o=await this.fetch(i);(o.projects[t]?.projectRoles.includes("admin")??!1)&&await this.throwIfLastProjectAdmin(t,i);let a=(0,w8e.cloneDeep)(o.projects[t]);delete o.projects[t],await this.save(o,i),Fet.infoContext(this.logContext,`User project roles deleted for user ${o.id} at projectID ${t}. Previous roles:`,a)})}async deleteUserEnvironmentRoles(t,n,i){return await this.runTransaction(i,async o=>{let s=await this.fetch(o);(s?.projects[t]?.environments[n]?.environmentRoles.includes("admin")??!1)&&await this.throwIfLastEnvironmentAdmin(t,n,o);let l=(0,w8e.cloneDeep)(s.projects[t].environments[n]);delete s.projects[t].environments[n],await this.save(s,o),Fet.infoContext(this.logContext,`User environment roles deleted for user ${s.id} at envID ${n} in project ${t}. Previous roles:`,l)})}async throwIfLastOrgAdmin(t){return await this.runTransaction(t,async n=>{if((await this.parent.userRoles.select({where:[["organizationRoles","array-contains","admin"]]},n)).length<2)throw new r_("Role change failed, at least one org admin is required")})}async throwIfLastProjectAdmin(t,n){return await this.runTransaction(n,async i=>{if((await this.parent.userRoles.select({where:[[`projects.${t}.projectRoles`,"array-contains","admin"]]},i)).length<2)throw new r_("Role change failed, at least one project admin is required")})}async throwIfLastEnvironmentAdmin(t,n,i){return await this.runTransaction(i,async o=>{let s=await this.parent.userRoles.select({where:[[`projects.${t}.environments.${n}.environmentRoles`,"array-contains","admin"]]},o),a=await this.parent.userRoles.select({where:[[`projects.${t}.projectRoles`,"array-contains","admin"]]},o),l=s.length<2;if(!a.length&&l)throw new r_("Role change failed, at least one environment admin is required")})}},CGt=class extends Xs{constructor(t,n,i,o){super(t,o6s,n,i,o,_yn)}};var gb0=Os.merge(zSi),mb0=_a("Org",gb0),s6s=Oa(mb0,new EGt),yb0={gitRepo:"gitRepo",workspace:"workspace",job:"job",subgraph:"folder",location:"location",connection:"connection",template:"template",run:"run",devRun:"devRun"},Oyn=class extends $s{constructor(t,n,i,o,s){super(t,n,s6s,i,{...o,orgID:t},s,["devRuns","globalUsersSettings","projects","runs","userRoles","workspaces"])}get devRuns(){return this.getSubCollection("devRuns",sGt)}devRun(t){return this.devRuns.get(t)}get globalUsersSettings(){return this.getSubCollection("globalUsersSettings",Xjt)}globalUsersSetting(t){return this.globalUsersSettings.get(t)}get projects(){return this.getSubCollection("projects",$jt)}project(t){return this.projects.get(t)}get runs(){return this.getSubCollection("runs",oGt)}run(t){return this.runs.get(t)}get userRoles(){return this.getSubCollection("userRoles",CGt)}userRole(t){return this.userRoles.get(t)}get workspaces(){return this.getSubCollection("workspaces",yGt)}workspace(t){return this.workspaces.get(t)}async getNextCounter(t,n=1,i){if(!n||n<=0)throw new koe(`getNextCounter() expected reserveCount value greater than zero, received ${n}`);let o=yb0[t];if(!o)throw new koe(`getNextCounter() received unsupported counter name '${t}'`);return this.runTransaction(i,async s=>{let a=await this.fetch(s),l=`${o}Counter`,c=l in a?a[l]??0:0;return await this.merge({[l]:c+n},s),c+1})}async releaseWorkspaceStatusAndEndRun(t,n,i,o,s,a){return this.runTransaction(a,async l=>{let c=this.workspace(t),u=await c.fetch(l),{newStatus:d,remainingActiveRuns:p}=await o();u.status=d??u.status,i==="run"?u.currentlyRunningJobs=p:u.currentlyRunningDevJobs=p,await c.save(u,l);let f=this[i](n);return l.transaction.update(f.docRef,{...f.prepareDataForMerge(s,l),runEndTime:this.firestoreOperations.getServerTimestampSentinel()}),u.status})}async updateLastLoginTime(){let t=this.prepareDataForMerge({});t.lastLoginTime=this.firestoreOperations.getServerTimestampSentinel(),await this.firestoreOperations.updateDoc(this.docRef,t)}},IGt=class extends Xs{constructor(t,n,i,o){super(t,s6s,n,i,o,Oyn)}};yo();var Eb0=Os.merge(GSi),bb0=_a("OrgPublic",Eb0),a6s=Oa(bb0),Tyn=class extends $s{constructor(t,n,i,o,s){super(t,n,a6s,i,{...o,orgID:t},s)}},vGt=class extends Xs{constructor(t,n,i,o){super(t,a6s,n,i,o,Tyn)}};yo();hr();var Cb0=nt.FIREBASE,SGt=class extends ty{transformFromStorage(t,n,i){return i.accountType||(Cb0.debug(`Patched user ${n}: Setting accountType to 'normal'`),i.accountType="normal"),i}};var Ib0=Os.merge(vEe),vb0=_a("User",Ib0),l6s=Oa(vb0,new SGt),wyn=class extends $s{constructor(t,n,i,o,s){super(t,n,l6s,i,o,s)}},_Gt=class extends Xs{constructor(t,n,i,o){super(t,l6s,n,i,o,wyn)}};var OGt=class{constructor(t){this.firestoreOperations=t;this.firestoreOperations=t}async uploadFile(t,n){await this.firestoreOperations.uploadToStorage(t,n)}async downloadFile(t){return this.firestoreOperations.downloadFromStorage(t)}async checkIfReferenceExists(t){return this.firestoreOperations.checkIfStorageReferenceExists(t)}async deleteFile(t){return this.firestoreOperations.deleteFileFromStorage(t)}};yo();yo();var Sb0=Os.merge(Wyt),_b0=_a("RegistryPackageRelease",Sb0),u6s=Oa(_b0),Ryn=class extends $s{constructor(t,n,i,o,s){super(t,n,u6s,i,o,s)}},TGt=class extends Xs{constructor(t,n,i,o){super(t,u6s,n,i,o,Ryn)}};var Ob0=Os.merge(Hyt),Tb0=_a("RegistryPackage",Ob0),c6s=Oa(Tb0),Byn=class extends $s{constructor(t,n,i,o,s){super(t,n,c6s,i,o,s,["releases"])}get releases(){return this.getSubCollection("releases",TGt)}release(t){return this.releases.get(t)}},wGt=class extends Xs{constructor(t,n,i,o){super(t,c6s,n,i,o,Byn)}};sn();ds();ez();w_r();R_r();B_r();x_r();Q_r();L_r();var wb0=T.discriminatedUnion("type",[Os.merge(Fi.merge(I3)),Os.merge(Fi.merge(Yyt)),Os.merge(Fi.merge(Kyt)),Os.merge(Fi.merge(Jyt)),Os.merge(Fi.merge(Xyt)),Os.merge(Fi.merge(t3t)),Os.merge(Fi.merge(r3t)),Os.merge(Fi.merge(n3t))]),Rb0=_a("Event",wb0),d6s=Oa(Rb0),xyn=class extends $s{constructor(t,n,i,o,s){super(t,n,d6s,i,o,s)}},RGt=class extends Xs{constructor(t,n,i,o){super(t,d6s,n,i,o,xyn)}createEventCore(t,n,i,o,s,a,l){return{type:"core",orgID:t,event:n,resourceType:i,resourceID:o,fromID:s,requestedBy:a,requestedByUserAgent:l}}async createDuplicatePkgNodeTypeEvent(t,n,i,o,s,a,l,c){let d={...this.createEventCore(t,"workspaces.nodeType.duplicate","NodeType",n,i,o,c),type:"duplicate",packageID:s,releaseID:a,workspaceID:l};return(await this.createEntity(d)).id}async createInstallPkgNodeTypeEvent(t,n,i,o,s,a){let c={...this.createEventCore(t,"workspaces.nodeType.install","NodeType",n,"",s,a),type:"install",packageID:n,releaseID:i,workspaceID:o};return(await this.createEntity(c)).id}async createEnableTotpTypeEvent(t,n,i){let o=this.createEventCore(t,"users.auth.enableTotp","Auth","Totp","",n,i);return(await this.createEntity(o)).id}async createDisableTotpTypeEvent(t,n,i,o){let s=this.createEventCore(t,"users.auth.disableTotp","Auth","Totp",i,n,o);return(await this.createEntity(s)).id}async createAIColumnDescriptionsTypeEvent(t,n,i,o,s,a,l,c){let d={...this.createEventCore(t,"ai.description.columnDescriptions","AI","Description",n,n,c),type:"update",workspaceID:i,nodeID:o,acceptedDescriptionsCount:s,modifiedDescriptionsCount:a,rejectedDescriptionsCount:l};return(await this.createEntity(d)).id}async createNewWorkspaceWizardTypeEvent(t,n,i,o,s,a,l,c,u,d){let p=this.createEventCore(t,"workspaces.create.newWorkspace","NewWorkspace",i.toString(),u?.toString()??"",c,d),f=typeof s=="string"?new Date(s):s,A={...p,type:"create",projectID:n,stepNumber:o,startTime:f,endTime:a,status:l};return(await this.createEntity(A)).id}async createAINodeDescriptionTypeEvent(t,n,i,o,s,a){let c={...this.createEventCore(t,"ai.description.nodeDescription","AI",o,"",n,a),type:"update_node_description",workspaceID:i,nodeID:o,action:s};return(await this.createEntity(c)).id}async createAIGitCommitMessageRequestEvent(t,n,i,o,s,a,l){let u={...this.createEventCore(t,"ai.git.commit","AI",l,"",n),type:"request",fileCount:i,diffContent:o,charCount:s,latencyMs:a,aiGitRequestId:l};return(await this.createEntity(u)).id}async createAIGitCommitMessageActionEvent(t,n,i,o,s,a,l){let u={...this.createEventCore(t,"ai.git.commit","AI","",n,l),type:"action",aiMessage:i,finalMessage:o,editDistance:s,action:a,aiGitRequestId:l};return(await this.createEntity(u)).id}};yo();var Bb0=Os.merge(P_i),xb0=_a("ActivePrompt",Bb0),p6s=Oa(xb0),Mb0=Os.merge(k_i),Db0=_a("PromptVersion",Mb0),f6s=Oa(Db0),Myn=class extends $s{constructor(t,n,i,o,s){super(t,n,p6s,i,{...o,nodeID:t},s)}},Dyn=class extends $s{constructor(t,n,i,o,s){super(t,n,f6s,i,{...o,nodeID:t},s)}},BGt=class extends Xs{constructor(t,n,i,o){super(t,p6s,n,i,o,Myn)}},xGt=class extends Xs{constructor(t,n,i,o){super(t,f6s,n,i,o,Dyn)}};yo();var Nb0=_a("Event",F_i),A6s=Oa(Nb0),Nyn=class extends $s{constructor(t,n,i,o,s){super(t,n,A6s,i,o,s)}},MGt=class extends Xs{constructor(t,n,i,o){super(t,A6s,n,i,o,Nyn)}};var DGt=class extends ene{constructor(t){super("root",t.db,["orgs","users","packagesRegistry","events"],void 0,t.currentLogContext(),t)}get path(){return""}get orgs(){return this.getSubCollection("orgs",IGt)}org(t){return this.orgs.get(t)}get orgsPublic(){return this.getSubCollection("orgsPublic",vGt)}orgPublic(t){return this.orgsPublic.get(t)}get users(){return this.getSubCollection("users",_Gt)}user(t){return this.users.get(t)}get packagesRegistry(){return this.getSubCollection("packagesRegistry",wGt)}registryPackage(t){return this.packagesRegistry.get(t)}get events(){return this.getSubCollection("events",RGt)}event(t){return this.events.get(t)}get oauthStates(){return this.getSubCollection("oauthState",MGt)}oauthState(t){return this.oauthStates.get(t)}get activePrompts(){return this.getSubCollection("activePrompts",BGt)}activePrompt(t){return this.activePrompts.get(t)}get promptVersions(){return this.getSubCollection("promptVersions",xGt)}promptVersion(t){return this.promptVersions.get(t)}batch(){return new Vjt(this.firestoreOperations)}getRepositoryFromPath(t){let n=t.split("/"),i,o;if(n.length){n[0].length||n.shift();for(let s of n)if(i)o=i.get(s),i=void 0;else{if(i=(o??this)[s],!i)throw new Rs(`No '${s}' collection found`);o=void 0}}return i||o||this}storage(){return new OGt(this.firestoreOperations)}};vr();var Pb0=["run","runs","devRun","devRuns"],Pyn=class r{providers;constructor(t,n,i,o){return this.providers=n,new Proxy(this,{get:(s,a)=>{if(Pb0.includes(a))return this.providers.firebase[a];let l=o(a,i);if(!(l in this.providers))throw new At("[FLAGGED_REPOSITORY] Attempted to access a flagged repository implementation that is not configured.",`Provider ID: ${l}`);let c=s.providers[l]?.[a];if(c instanceof mle){let u=Object.fromEntries(Object.entries(this.providers).map(([d,p])=>[d,p?.[a]]));return new r(c,u,{...i},o)}return typeof c=="function"?(...u)=>{let d=t?.[a]?.bind(t)?.(...u);if(!(d instanceof mle))return d;let p=Object.fromEntries(Object.entries(this.providers).map(([h,y])=>[h,y?.[a]?.bind(y)?.(...u)])),f=i.orgId;a==="org"&&(f=u[0]),a==="get"&&t.id==="orgs"&&(f=u[0]);let A=(s.providers[l]?.[a]).bind(s.providers[l])?.(...u);return new r(A,p,{...i,orgId:f},o)}:t[a]}})}},h6s=(r,t,n)=>new Pyn(r,t,{},n);var kyn=(r,t)=>{let n=new DGt(r);return h6s(n,{firebase:n,service:n},t)};var B6s=Ct($v(),1);b3();var q1e=Ct(Lyn(),1),O6s=Ct(AQt(),1),Gyn=Ct($v(),1),Wyn=Ct(ovt(),1),T6s=require("stream"),Hyn=Ct(zyn(),1);b3();var b6s=Ct(require("querystring"),1),C6s=require("stream");var I6s=Ct(D8e(),1);var Kb0=!0;function CR(r,t){return{options:typeof r=="object"?r:{},callback:typeof r=="function"?r:t}}function jyn(r){return Object.keys(r).map(t=>[t,r[t]])}function Jb0(r){return encodeURIComponent(r).replace(/[!'()*]/g,t=>"%"+t.charCodeAt(0).toString(16).toUpperCase())}function zet(r,t){return r.split("/").map(Jb0).join(t?"%2F":"/")}function v6s(r){return b6s.stringify(r,"&","=",{encodeURIComponent:t=>zet(t,!0)})}function S6s(r){let t={};for(let n of Object.keys(r)){let i=r[n];n=n.toLowerCase(),t[n]=i}return t}function _6s(r){return JSON.stringify(r).replace(/[\u0080-\uFFFF]/g,t=>"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4))}function LGt(r){return r instanceof Date||r instanceof RegExp?r:Array.isArray(r)?r.map(LGt):r instanceof Object?Object.keys(r).reduce((t,n)=>{let i=n[0].toLocaleLowerCase()+n.slice(1).replace(/([A-Z]+)/g,(o,s)=>`_${s.toLowerCase()}`);return t[i]=LGt(r[n]),t},Object()):r}function F1e(r,t=!1,n="",i=""){let o=r.getUTCFullYear(),s=r.getUTCMonth()+1,a=r.getUTCDate(),l=r.getUTCHours(),c=r.getUTCMinutes(),u=r.getUTCSeconds(),d=`${o.toString().padStart(4,"0")}${n}${s.toString().padStart(2,"0")}${n}${a.toString().padStart(2,"0")}`;return t&&(d=`${d}T${l.toString().padStart(2,"0")}${i}${c.toString().padStart(2,"0")}${i}${u.toString().padStart(2,"0")}Z`),d}function $Q(){return globalThis.Deno&&globalThis.Deno.version&&globalThis.Deno.version.deno?`gl-deno/${globalThis.Deno.version.deno}`:`gl-node/${process.versions.node}`}function ZQ(){let r=(0,I6s.getPackageJSON)();return r.name.replace("@google-cloud","gcloud-node").replace("/","-")+"/"+r.version}function rne(){return Kb0?"ESM":"CJS"}var qet=class extends C6s.PassThrough{constructor(){super(...arguments),this.shouldEmitReading=!0,this.shouldEmitWriting=!0}_read(t){this.shouldEmitReading&&(this.emit("reading"),this.shouldEmitReading=!1),super._read(t)}_write(t,n,i){this.shouldEmitWriting&&(this.emit("writing"),this.shouldEmitWriting=!1),process.nextTick(()=>{super._write(t,n,i)})}_final(t){this.shouldEmitReading&&(this.emit("reading"),this.shouldEmitReading=!1),this.shouldEmitWriting&&(this.emit("writing"),this.shouldEmitWriting=!1),t(null)}};var w6s=Ct(yK(),1),R6s=Ct(D8e(),1);var Xb0=(0,R6s.getPackageJSON)(),xy=Symbol.for("GCCL_GCS_CMD"),FGt={timeout:6e4,gzip:!0,forever:!0,pool:{maxSockets:1/0}},$b0=!0,Zb0=3,cG=class r extends Error{constructor(t){if(super(),typeof t!="object"){this.message=t||"";return}let n=t;this.code=n.code,this.errors=n.errors,this.response=n.response;try{this.errors=JSON.parse(this.response.body).error.errors}catch{this.errors=n.errors}this.message=r.createMultiErrorMessage(n,this.errors),Error.captureStackTrace(this)}static createMultiErrorMessage(t,n){let i=new Set;t.message&&i.add(t.message),n&&n.length?n.forEach(({message:s})=>i.add(s)):t.response&&t.response.body?i.add(O6s.decode(t.response.body.toString())):t.message||i.add("A failure occurred during this request.");let o=Array.from(i);return o.length>1&&(o=o.map((s,a)=>` ${a+1}. ${s}`),o.unshift("Multiple errors occurred during the request. Please see the `errors` array for complete details.\n"),o.push(`
7188
7188
  `)),o.join(`
7189
7189
  `)}},Vyn=class extends Error{constructor(t){super();let n=t;this.errors=n.errors,this.name="PartialFailureError",this.response=n.response,this.message=cG.createMultiErrorMessage(n,this.errors)}},Yyn=class{constructor(){this.ApiError=cG,this.PartialFailureError=Vyn}noop(){}handleResp(t,n,i,o){o=o||Cc.noop;let s={err:t||null,...n&&Cc.parseHttpRespMessage(n),...i&&Cc.parseHttpRespBody(i)};!s.err&&n&&typeof s.body=="object"&&(s.resp.body=s.body),s.err&&n&&(s.err.response=n),o(s.err,s.body,s.resp)}parseHttpRespMessage(t){let n={resp:t};return(t.statusCode<200||t.statusCode>299)&&(n.err=new cG({errors:new Array,code:t.statusCode,message:t.statusMessage,response:t})),n}parseHttpRespBody(t){let n={body:t};if(typeof t=="string")try{n.body=JSON.parse(t)}catch{n.body=t}return n.body&&n.body.error&&(n.err=new cG(n.body.error)),n}makeWritableStream(t,n,i){var o;i=i||Cc.noop;let s=new Kyn;s.on("progress",u=>t.emit("progress",u)),t.setWritable(s);let a={method:"POST",qs:{uploadType:"multipart"},timeout:0,maxRetries:0},l=n.metadata||{},c={...a,...n.request,qs:{...a.qs,...(o=n.request)===null||o===void 0?void 0:o.qs},multipart:[{"Content-Type":"application/json",body:JSON.stringify(l)},{"Content-Type":l.contentType||"application/octet-stream",body:s}]};n.makeAuthenticatedRequest(c,{onAuthenticated(u,d){if(u){t.destroy(u);return}FGt.headers=Cc._getDefaultHeaders(c[xy]),Hyn.teenyRequest.defaults(FGt)(d,(f,A,h)=>{Cc.handleResp(f,A,h,(y,C)=>{if(y){t.destroy(y);return}t.emit("response",A),i(C)})})}})}shouldRetryRequest(t){if(t){if([408,429,500,502,503,504].indexOf(t.code)!==-1)return!0;if(t.errors)for(let n of t.errors){let i=n.reason;if(i==="rateLimitExceeded"||i==="userRateLimitExceeded"||i&&i.includes("EAI_AGAIN"))return!0}}return!1}makeAuthenticatedRequestFactory(t){let n={...t};n.projectId===N8e&&delete n.projectId;let i;n.authClient instanceof Gyn.GoogleAuth?i=n.authClient:i=new Gyn.GoogleAuth({...n,authClient:n.authClient,clientOptions:n.clientOptions});function o(a,l){let c,u,d={...t},p;l||(c=(0,w6s.default)(),d.stream=c);let f=typeof l=="object"?l:void 0,A=typeof l=="function"?l:void 0;async function h(){u=await i.getProjectId()}let y=async(v,O)=>{let w=v,R=v&&typeof v.message=="string"&&v.message.indexOf("Could not load the default credentials")>-1;if(R&&(O=a),!v||R)try{O=Cc.decorateRequest(O,u),v=null}catch(k){if(k instanceof q1e.MissingProjectIdError)try{await h(),O=Cc.decorateRequest(O,u),v=null}catch(z){v=v||z}else v=v||k}if(v){c?c.destroy(v):(f&&f.onAuthenticated?f.onAuthenticated:A)(v);return}f&&f.onAuthenticated?f.onAuthenticated(null,O):p=Cc.makeRequest(O,d,(k,...z)=>{k&&k.code===401&&w&&(k=w),A(k,...z)})};return(async()=>{try{let v=async()=>t.projectId&&t.projectId!==N8e?t.projectId:t.projectIdRequired===!1?N8e:h(),O=async()=>d.customEndpoint&&!d.useAuthWithCustomEndpoint?a:i.authorizeRequest(a),[w,R]=await Promise.all([v(),O()]);return w&&(u=w),y(null,R)}catch(v){return y(v)}})(),c||{abort(){setImmediate(()=>{p&&(p.abort(),p=null)})}}}let s=o;return s.getCredentials=i.getCredentials.bind(i),s.authClient=i,s}makeRequest(t,n,i){var o,s,a,l,c;let u=$b0;n.autoRetry!==void 0?u=n.autoRetry:((o=n.retryOptions)===null||o===void 0?void 0:o.autoRetry)!==void 0&&(u=n.retryOptions.autoRetry);let d=Zb0;n.maxRetries!==void 0?d=n.maxRetries:((s=n.retryOptions)===null||s===void 0?void 0:s.maxRetries)!==void 0&&(d=n.retryOptions.maxRetries),FGt.headers=this._getDefaultHeaders(t[xy]);let p={request:Hyn.teenyRequest.defaults(FGt),retries:u!==!1?d:0,noResponseRetries:u!==!1?d:0,shouldRetryFn(y){var C,v;let O=Cc.parseHttpRespMessage(y).err;return!((C=n.retryOptions)===null||C===void 0)&&C.retryableErrorFn?O&&((v=n.retryOptions)===null||v===void 0?void 0:v.retryableErrorFn(O)):O&&Cc.shouldRetryRequest(O)},maxRetryDelay:(a=n.retryOptions)===null||a===void 0?void 0:a.maxRetryDelay,retryDelayMultiplier:(l=n.retryOptions)===null||l===void 0?void 0:l.retryDelayMultiplier,totalTimeout:(c=n.retryOptions)===null||c===void 0?void 0:c.totalTimeout};if(typeof t.maxRetries=="number"&&(p.retries=t.maxRetries,p.noResponseRetries=t.maxRetries),!n.stream)return(0,Wyn.default)(t,p,(y,C,v)=>{Cc.handleResp(y,C,v,i)});let f=n.stream,A;return(t.method||"GET").toUpperCase()==="GET"?(A=(0,Wyn.default)(t,p),f.setReadable(A)):(A=p.request(t),f.setWritable(A)),A.on("error",f.destroy.bind(f)).on("response",f.emit.bind(f,"response")).on("complete",f.emit.bind(f,"complete")),f.abort=A.abort,f}decorateRequest(t,n){return delete t.autoPaginate,delete t.autoPaginateVal,delete t.objectMode,t.qs!==null&&typeof t.qs=="object"&&(delete t.qs.autoPaginate,delete t.qs.autoPaginateVal,t.qs=(0,q1e.replaceProjectIdToken)(t.qs,n)),Array.isArray(t.multipart)&&(t.multipart=t.multipart.map(i=>(0,q1e.replaceProjectIdToken)(i,n))),t.json!==null&&typeof t.json=="object"&&(delete t.json.autoPaginate,delete t.json.autoPaginateVal,t.json=(0,q1e.replaceProjectIdToken)(t.json,n)),t.uri=(0,q1e.replaceProjectIdToken)(t.uri,n),t}isCustomType(t,n){function i(c){return c.constructor&&c.constructor.name.toLowerCase()}let o=n.split("/"),s=o[0]&&o[0].toLowerCase(),a=o[1]&&o[1].toLowerCase();if(a&&i(t)!==a)return!1;let l=t;for(;;){if(i(l)===s)return!0;if(l=l.parent,!l)return!1}}maybeOptionsOrCallback(t,n){return typeof t=="function"?[{},t]:[t,n]}_getDefaultHeaders(t){let n={"User-Agent":ZQ(),"x-goog-api-client":`${$Q()} gccl/${Xb0.version}-${rne()} gccl-invocation-id/${H_()}`};return t&&(n["x-goog-api-client"]+=` gccl-gcs-cmd/${t}`),n}},Kyn=class extends T6s.Transform{constructor(){super(...arguments),this.bytesRead=0}_transform(t,n,i){this.bytesRead+=t.length,this.emit("progress",{bytesWritten:this.bytesRead,contentLength:"*"}),this.push(t),i()}},Cc=new Yyn;var N8e="{{projectId}}",Uet=class r{constructor(t,n={}){this.baseUrl=t.baseUrl,this.apiEndpoint=t.apiEndpoint,this.timeout=n.timeout,this.globalInterceptors=Array.isArray(n.interceptors_)?n.interceptors_:[],this.interceptors=[],this.packageJson=t.packageJson,this.projectId=n.projectId||N8e,this.projectIdRequired=t.projectIdRequired!==!1,this.providedUserAgent=n.userAgent,this.universeDomain=n.universeDomain||B6s.DEFAULT_UNIVERSE,this.customEndpoint=t.customEndpoint||!1,this.makeAuthenticatedRequest=Cc.makeAuthenticatedRequestFactory({...t,projectIdRequired:this.projectIdRequired,projectId:this.projectId,authClient:n.authClient||t.authClient,credentials:n.credentials,keyFile:n.keyFilename,email:n.email,clientOptions:{universeDomain:n.universeDomain,...n.clientOptions}}),this.authClient=this.makeAuthenticatedRequest.authClient,!!process.env.FUNCTION_NAME&&this.interceptors.push({request(o){return o.forever=!1,o}})}getRequestInterceptors(){return[].slice.call(this.globalInterceptors).concat(this.interceptors).filter(t=>typeof t.request=="function").map(t=>t.request)}getProjectId(t){if(!t)return this.getProjectIdAsync();this.getProjectIdAsync().then(n=>t(null,n),t)}async getProjectIdAsync(){let t=await this.authClient.getProjectId();return this.projectId===N8e&&t&&(this.projectId=t),this.projectId}request_(t,n){t={...t,timeout:this.timeout};let i=t.uri.indexOf("http")===0,o=[this.baseUrl];this.projectIdRequired&&(t.projectId?(o.push("projects"),o.push(t.projectId)):(o.push("projects"),o.push(this.projectId))),o.push(t.uri),i&&o.splice(0,o.indexOf(t.uri)),t.uri=o.map(u=>{let d=/^\/*|\/*$/g;return u.replace(d,"")}).join("/").replace(/\/:/g,":");let s=this.getRequestInterceptors();(Array.isArray(t.interceptors_)?t.interceptors_:[]).forEach(u=>{typeof u.request=="function"&&s.push(u.request)}),s.forEach(u=>{t=u(t)}),delete t.interceptors_;let l=this.packageJson,c=ZQ();if(this.providedUserAgent&&(c=`${this.providedUserAgent} ${c}`),t.headers={...t.headers,"User-Agent":c,"x-goog-api-client":`${$Q()} gccl/${l.version}-${rne()} gccl-invocation-id/${H_()}`},t[xy]&&(t.headers["x-goog-api-client"]+=` gccl-gcs-cmd/${t[xy]}`),t.shouldReturnStream)return this.makeAuthenticatedRequest(t);this.makeAuthenticatedRequest(t,n)}request(t,n){r.prototype.request_.call(this,t,n)}requestStream(t){let n={...t,shouldReturnStream:!0};return r.prototype.request_.call(this,n)}};var x6s=Ct(e2(),1),M6s=require("events");var pS=class r extends M6s.EventEmitter{constructor(t){super(),this.metadata={},this.baseUrl=t.baseUrl,this.parent=t.parent,this.id=t.id,this.createMethod=t.createMethod,this.methods=t.methods||{},this.interceptors=[],this.projectId=t.projectId,t.methods&&Object.getOwnPropertyNames(r.prototype).filter(n=>!/^request/.test(n)&&!/^getRequestInterceptors/.test(n)&&this[n]===r.prototype[n]&&!t.methods[n]).forEach(n=>{this[n]=void 0})}create(t,n){let i=this,o=[this.id];typeof t=="function"&&(n=t),typeof t=="object"&&o.push(t);function s(...a){let[l,c]=a;l||(i.metadata=c.metadata,i.id&&c.metadata&&(i.id=c.metadata.id),a[1]=i),n(...a)}o.push(s),this.createMethod.apply(null,o)}delete(t,n){var i;let[o,s]=Cc.maybeOptionsOrCallback(t,n),a=o.ignoreNotFound;delete o.ignoreNotFound;let l=typeof this.methods.delete=="object"&&this.methods.delete||{},c={method:"DELETE",uri:"",...l.reqOpts,qs:{...(i=l.reqOpts)===null||i===void 0?void 0:i.qs,...o}};r.prototype.request.call(this,c,(u,d,p)=>{u&&u.code===404&&a&&(u=null),s(u,p)})}exists(t,n){let[i,o]=Cc.maybeOptionsOrCallback(t,n);this.get(i,s=>{if(s){s.code===404?o(null,!1):o(s);return}o(null,!0)})}get(t,n){let i=this,[o,s]=Cc.maybeOptionsOrCallback(t,n),a=Object.assign({},o),l=a.autoCreate&&typeof this.create=="function";delete a.autoCreate;function c(u,d,p){if(u){if(u.code===409){i.get(a,s);return}s(u,null,p);return}s(null,d,p)}this.getMetadata(a,(u,d)=>{if(u){if(u.code===404&&l){let p=[];Object.keys(a).length>0&&p.push(a),p.push(c),i.create(...p);return}s(u,null,d);return}s(null,i,d)})}getMetadata(t,n){var i;let[o,s]=Cc.maybeOptionsOrCallback(t,n),a=typeof this.methods.getMetadata=="object"&&this.methods.getMetadata||{},l={uri:"",...a.reqOpts,qs:{...(i=a.reqOpts)===null||i===void 0?void 0:i.qs,...o}};r.prototype.request.call(this,l,(c,u,d)=>{this.metadata=u,s(c,this.metadata,d)})}getRequestInterceptors(){let t=this.interceptors.filter(n=>typeof n.request=="function").map(n=>n.request);return this.parent.getRequestInterceptors().concat(t)}setMetadata(t,n,i){var o,s;let[a,l]=Cc.maybeOptionsOrCallback(n,i),c=typeof this.methods.setMetadata=="object"&&this.methods.setMetadata||{},u={method:"PATCH",uri:"",...c.reqOpts,json:{...(o=c.reqOpts)===null||o===void 0?void 0:o.json,...t},qs:{...(s=c.reqOpts)===null||s===void 0?void 0:s.qs,...a}};r.prototype.request.call(this,u,(d,p,f)=>{this.metadata=p,l(d,this.metadata,f)})}request_(t,n){t={...t},this.projectId&&(t.projectId=this.projectId);let i=t.uri.indexOf("http")===0,o=[this.baseUrl,this.id||"",t.uri];i&&o.splice(0,o.indexOf(t.uri)),t.uri=o.filter(l=>l.trim()).map(l=>{let c=/^\/*|\/*$/g;return l.replace(c,"")}).join("/");let s=Array.isArray(t.interceptors_)?t.interceptors_:[],a=[].slice.call(this.interceptors);if(t.interceptors_=s.concat(a),t.shouldReturnStream)return this.parent.requestStream(t);this.parent.request(t,n)}request(t,n){this.request_(t,n)}requestStream(t){let n={...t,shouldReturnStream:!0};return this.request_(n)}};(0,x6s.promisifyAll)(pS,{exclude:["getRequestInterceptors"]});var ZGt=Ct(jet(),1),hRs=Ct(e2(),1),s3n=require("stream");var o3n=Ct(jet(),1),sRs=Ct(e2(),1),aRs=Ct(require("fs"),1),lRs=Ct(WW(),1),uRs=Ct(require("path"),1),r3n=Ct(jpe(),1),n3n=require("util"),cRs=Ct(dO(),1);var k6s=Ct(e2(),1),k8e=class r{constructor(){this.owners={},this.readers={},this.writers={},this.owners={},this.readers={},this.writers={},r.roles.forEach(this._assignAccessMethods.bind(this))}_assignAccessMethods(t){let n=r.accessMethods,i=r.entities,o=t.toLowerCase()+"s";this[o]=i.reduce((s,a)=>{let l=a.charAt(a.length-1)==="-";return n.forEach(c=>{let u=c+a[0].toUpperCase()+a.substring(1);l&&(u=u.replace("-","")),s[u]=(d,p,f)=>{let A;typeof p=="function"&&(f=p,p={}),l?A=a+d:(A=a,f=d),p=Object.assign({entity:A,role:t},p);let h=[p];return typeof f=="function"&&h.push(f),this[c].apply(this,h)}}),s},{})}};k8e.accessMethods=["add","delete"];k8e.entities=["allAuthenticatedUsers","allUsers","domain-","group-","project-","user-"];k8e.roles=["OWNER","READER","WRITER"];var ine=class extends k8e{constructor(t){super(),this.pathPrefix=t.pathPrefix,this.request_=t.request}add(t,n){let i={};t.generation&&(i.generation=t.generation),t.userProject&&(i.userProject=t.userProject),this.request({method:"POST",uri:"",qs:i,maxRetries:0,json:{entity:t.entity,role:t.role.toUpperCase()}},(o,s)=>{if(o){n(o,null,s);return}n(null,this.makeAclObject_(s),s)})}delete(t,n){let i={};t.generation&&(i.generation=t.generation),t.userProject&&(i.userProject=t.userProject),this.request({method:"DELETE",uri:"/"+encodeURIComponent(t.entity),qs:i},(o,s)=>{n(o,s)})}get(t,n){let i=typeof t=="object"?t:null,o=typeof t=="function"?t:n,s="",a={};i&&(s="/"+encodeURIComponent(i.entity),i.generation&&(a.generation=i.generation),i.userProject&&(a.userProject=i.userProject)),this.request({uri:s,qs:a},(l,c)=>{if(l){o(l,null,c);return}let u;c.items?u=c.items.map(this.makeAclObject_):u=this.makeAclObject_(c),o(null,u,c)})}update(t,n){let i={};t.generation&&(i.generation=t.generation),t.userProject&&(i.userProject=t.userProject),this.request({method:"PUT",uri:"/"+encodeURIComponent(t.entity),qs:i,json:{role:t.role.toUpperCase()}},(o,s)=>{if(o){n(o,null,s);return}n(null,this.makeAclObject_(s),s)})}makeAclObject_(t){let n={entity:t.entity,role:t.role};return t.projectTeam&&(n.projectTeam=t.projectTeam),n}request(t,n){t.uri=this.pathPrefix+t.uri,this.request_(t,n)}};(0,k6s.promisifyAll)(ine,{exclude:["request"]});var $6s=Ct(e2(),1),Z6s=Ct(KLt(),1),eRs=Ct(require("crypto"),1),JGt=Ct(require("fs"),1),tRs=Ct(XLt(),1);var Q6s=Ct($be(),1),L6s=require("crypto"),aC0=Ct(R8(),1),z1e=Ct($v(),1),WGt=require("stream"),F6s=Ct(dO(),1);b3();var q6s=Ct(D8e(),1),sC0=function(r,t,n,i,o){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?r!==t||!o:!t.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?o.call(r,n):o?o.value=n:t.set(r,n),n},_O=function(r,t,n,i){if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?r!==t||!i:!t.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?i:n==="a"?i.call(r):i?i.value:t.get(r)},dG,pG,Get,jGt,lC0=404,UGt=308,Xyn=(0,q6s.getPackageJSON)(),uC0=/^(\w*):\/\//,GGt=class extends WGt.Writable{constructor(t){var n;if(super(t),dG.add(this),this.numBytesWritten=0,this.numRetries=0,this.currentInvocationId={checkUploadStatus:H_(),chunk:H_(),uri:H_()},this.writeBuffers=[],this.numChunksReadInRequest=0,this.localWriteCache=[],this.localWriteCacheByteLength=0,this.upstreamEnded=!1,pG.set(this,void 0),t=t||{},!t.bucket||!t.file)throw new Error("A bucket and file name are required");if(t.offset&&!t.uri)throw new RangeError("Cannot provide an `offset` without providing a `uri`");if(t.isPartialUpload&&!t.chunkSize)throw new RangeError("Cannot set `isPartialUpload` without providing a `chunkSize`");t.authConfig=t.authConfig||{},t.authConfig.scopes=["https://www.googleapis.com/auth/devstorage.full_control"],this.authClient=t.authClient||new z1e.GoogleAuth(t.authConfig);let i=t.universeDomain||z1e.DEFAULT_UNIVERSE;if(this.apiEndpoint=`https://storage.${i}`,t.apiEndpoint&&t.apiEndpoint!==this.apiEndpoint){this.apiEndpoint=this.sanitizeEndpoint(t.apiEndpoint);let l=new URL(this.apiEndpoint).hostname,c=l===i,u=l===z1e.DEFAULT_UNIVERSE,d=l.slice(-(i.length+1))===`.${i}`,p=l.slice(-(z1e.DEFAULT_UNIVERSE.length+1))===`.${z1e.DEFAULT_UNIVERSE}`;!c&&!u&&!d&&!p&&(this.authClient=aC0)}this.baseURI=`${this.apiEndpoint}/upload/storage/v1/b`,this.bucket=t.bucket;let o=[t.bucket,t.file];if(typeof t.generation=="number"&&o.push(`${t.generation}`),this.cacheKey=o.join("/"),this.customRequestOptions=t.customRequestOptions||{},this.file=t.file,this.generation=t.generation,this.kmsKeyName=t.kmsKeyName,this.metadata=t.metadata||{},this.offset=t.offset,this.origin=t.origin,this.params=t.params||{},this.userProject=t.userProject,this.chunkSize=t.chunkSize,this.retryOptions=t.retryOptions,this.isPartialUpload=(n=t.isPartialUpload)!==null&&n!==void 0?n:!1,t.key){let l=Buffer.from(t.key).toString("base64");this.encryption={key:l,hash:(0,L6s.createHash)("sha256").update(t.key).digest("base64")}}this.predefinedAcl=t.predefinedAcl,t.private&&(this.predefinedAcl="private"),t.public&&(this.predefinedAcl="publicRead");let s=t.retryOptions.autoRetry;this.uriProvidedManually=!!t.uri,this.uri=t.uri,this.offset&&(this.numBytesWritten=this.offset),this.numRetries=0,s||(t.retryOptions.maxRetries=0),this.timeOfFirstRequest=Date.now();let a=t.metadata?Number(t.metadata.contentLength):NaN;this.contentLength=isNaN(a)?"*":a,sC0(this,pG,t[xy],"f"),this.once("writing",()=>{this.uri?this.continueUploading():this.createURI(l=>{if(l)return this.destroy(l);this.startUploading()})})}_final(t=()=>{}){this.upstreamEnded=!0,this.once("uploadFinished",t),process.nextTick(()=>{this.emit("upstreamFinished"),this.emit("writing")})}_write(t,n,i=()=>{}){this.emit("writing"),this.writeBuffers.push(typeof t=="string"?Buffer.from(t,n):t),this.once("readFromChunkBuffer",i),process.nextTick(()=>this.emit("wroteToChunkBuffer"))}prependLocalBufferToUpstream(t){let n=[];if(t){let o=0;for(;t>o;){let s=this.localWriteCache.pop();if(!s)break;if(o+=s.byteLength,o>t){let a=o-t;s=s.subarray(a),o-=a}n.unshift(s)}}else n=this.localWriteCache;let i=this.writeBuffers;this.writeBuffers=n;for(let o of i)this.writeBuffers.push(o);_O(this,dG,"m",Get).call(this)}*pullFromChunkBuffer(t){for(;t;){let n=this.writeBuffers.shift();if(!n)break;let i=n;n.byteLength>t?(i=n.subarray(0,t),this.writeBuffers.unshift(n.subarray(t)),t=0):t-=n.byteLength,yield i,this.emit("readFromChunkBuffer")}}async waitForNextChunk(){return await new Promise(n=>{if(this.writeBuffers.length)return n(!0);if(this.upstreamEnded)return n(!1);let i=()=>(s(),n(!0)),o=()=>(s(),this.writeBuffers.length?n(!0):n(!1)),s=()=>{this.removeListener("wroteToChunkBuffer",i),this.removeListener("upstreamFinished",o)};this.once("wroteToChunkBuffer",i),this.once("upstreamFinished",o)})}async*upstreamIterator(t=1/0){for(;t&&await this.waitForNextChunk();)for(let n of this.pullFromChunkBuffer(t))t-=n.byteLength,yield n}createURI(t){if(!t)return this.createURIAsync();this.createURIAsync().then(n=>t(null,n),t)}async createURIAsync(){let t={...this.metadata},n={};t.contentLength&&(n["X-Upload-Content-Length"]=t.contentLength.toString(),delete t.contentLength),t.contentType&&(n["X-Upload-Content-Type"]=t.contentType,delete t.contentType);let i=`${$Q()} gccl/${Xyn.version}-${rne()} gccl-invocation-id/${this.currentInvocationId.uri}`;_O(this,pG,"f")&&(i+=` gccl-gcs-cmd/${_O(this,pG,"f")}`);let o={method:"POST",url:[this.baseURI,this.bucket,"o"].join("/"),params:Object.assign({name:this.file,uploadType:"resumable"},this.params),data:t,headers:{"User-Agent":ZQ(),"x-goog-api-client":i,...n}};t.contentLength&&(o.headers["X-Upload-Content-Length"]=t.contentLength.toString()),t.contentType&&(o.headers["X-Upload-Content-Type"]=t.contentType),typeof this.generation<"u"&&(o.params.ifGenerationMatch=this.generation),this.kmsKeyName&&(o.params.kmsKeyName=this.kmsKeyName),this.predefinedAcl&&(o.params.predefinedAcl=this.predefinedAcl),this.origin&&(o.headers.Origin=this.origin);let s=await(0,F6s.default)(async a=>{var l,c,u;try{let d=await this.makeRequest(o);return this.currentInvocationId.uri=H_(),d.headers.location}catch(d){let p=d,f={code:(l=p.response)===null||l===void 0?void 0:l.status,name:(c=p.response)===null||c===void 0?void 0:c.statusText,message:(u=p.response)===null||u===void 0?void 0:u.statusText,errors:[{reason:p.code}]};if(this.retryOptions.maxRetries>0&&this.retryOptions.retryableErrorFn(f))throw p;return a(p)}},{retries:this.retryOptions.maxRetries,factor:this.retryOptions.retryDelayMultiplier,maxTimeout:this.retryOptions.maxRetryDelay*1e3,maxRetryTime:this.retryOptions.totalTimeout*1e3});return this.uri=s,this.offset=0,this.emit("uri",s),s}async continueUploading(){var t;return(t=this.offset)!==null&&t!==void 0||await this.getAndSetOffset(),this.startUploading()}async startUploading(){let t=!!this.chunkSize,n=!1;if(this.numChunksReadInRequest=0,this.offset||(this.offset=0),this.offset<this.numBytesWritten){let u=this.numBytesWritten-this.offset,d=`The offset is lower than the number of bytes written. The server has ${this.offset} bytes and while ${this.numBytesWritten} bytes has been uploaded - thus ${u} bytes are missing. Stopping as this could result in data loss. Initiate a new upload to continue.`;this.emit("error",new RangeError(d));return}if(this.numBytesWritten<this.offset){let u=this.offset-this.numBytesWritten;for await(let d of this.upstreamIterator(u));this.numBytesWritten=this.offset}let i;typeof this.contentLength=="number"&&(i=this.contentLength-this.numBytesWritten),this.chunkSize&&(i=i?Math.min(this.chunkSize,i):this.chunkSize);let o=this.upstreamIterator(i),s=new WGt.Readable({read:async()=>{n&&s.push(null);let u=await o.next();u.value&&(this.numChunksReadInRequest++,t?_O(this,dG,"m",jGt).call(this,u.value):(_O(this,dG,"m",Get).call(this),_O(this,dG,"m",jGt).call(this,u.value)),this.numBytesWritten+=u.value.byteLength,this.emit("progress",{bytesWritten:this.numBytesWritten,contentLength:this.contentLength}),s.push(u.value)),u.done&&s.push(null)}}),a=`${$Q()} gccl/${Xyn.version}-${rne()} gccl-invocation-id/${this.currentInvocationId.chunk}`;_O(this,pG,"f")&&(a+=` gccl-gcs-cmd/${_O(this,pG,"f")}`);let l={"User-Agent":ZQ(),"x-goog-api-client":a};if(t){for await(let A of this.upstreamIterator(i))_O(this,dG,"m",jGt).call(this,A);let u=this.localWriteCacheByteLength,d=!await this.waitForNextChunk();this.prependLocalBufferToUpstream();let p=this.contentLength;typeof this.contentLength!="number"&&d&&!this.isPartialUpload&&(p=u+this.numBytesWritten);let f=u+this.numBytesWritten-1;l["Content-Length"]=u,l["Content-Range"]=`bytes ${this.offset}-${f}/${p}`}else l["Content-Range"]=`bytes ${this.offset}-*/${this.contentLength}`;let c={method:"PUT",url:this.uri,headers:l,body:s};try{let u=await this.makeRequestStream(c);u&&(n=!0,await this.responseHandler(u))}catch(u){let d=u;if(this.retryOptions.retryableErrorFn(d)){this.attemptDelayedRetry({status:NaN,data:d});return}this.destroy(d)}}async responseHandler(t){if(t.data.error){this.destroy(t.data.error);return}this.currentInvocationId.chunk=H_();let n=await this.waitForNextChunk(),i=this.chunkSize&&t.status===UGt&&t.headers.range&&n,o=this.isPartialUpload&&t.status===UGt&&!n;if(i){let s=t.headers.range;this.offset=Number(s.split("-")[1])+1;let a=this.numBytesWritten-this.offset;a?(this.prependLocalBufferToUpstream(a),this.numBytesWritten-=a):_O(this,dG,"m",Get).call(this),this.continueUploading()}else if(!this.isSuccessfulResponse(t.status)&&!o){let s=new Error("Upload failed");s.code=t.status,s.name="Upload failed",t?.data&&(s.errors=[t?.data]),this.destroy(s)}else _O(this,dG,"m",Get).call(this),t&&t.data&&(t.data.size=Number(t.data.size)),this.emit("metadata",t.data),this.emit("uploadFinished")}async checkUploadStatus(t={}){let n=`${$Q()} gccl/${Xyn.version}-${rne()} gccl-invocation-id/${this.currentInvocationId.checkUploadStatus}`;_O(this,pG,"f")&&(n+=` gccl-gcs-cmd/${_O(this,pG,"f")}`);let i={method:"PUT",url:this.uri,headers:{"Content-Length":0,"Content-Range":"bytes */*","User-Agent":ZQ(),"x-goog-api-client":n}};try{let o=await this.makeRequest(i);return this.currentInvocationId.checkUploadStatus=H_(),o}catch(o){if(t.retry===!1||!(o instanceof Error)||!this.retryOptions.retryableErrorFn(o))throw o;let s=this.getRetryDelay();if(s<=0)throw o;return await new Promise(a=>setTimeout(a,s)),this.checkUploadStatus(t)}}async getAndSetOffset(){try{let t=await this.checkUploadStatus({retry:!1});if(t.status===UGt&&typeof t.headers.range=="string"){this.offset=Number(t.headers.range.split("-")[1])+1;return}this.offset=0}catch(t){let n=t;if(this.retryOptions.retryableErrorFn(n)){this.attemptDelayedRetry({status:NaN,data:n});return}this.destroy(n)}}async makeRequest(t){this.encryption&&(t.headers=t.headers||{},t.headers["x-goog-encryption-algorithm"]="AES256",t.headers["x-goog-encryption-key"]=this.encryption.key.toString(),t.headers["x-goog-encryption-key-sha256"]=this.encryption.hash.toString()),this.userProject&&(t.params=t.params||{},t.params.userProject=this.userProject),t.validateStatus=o=>this.isSuccessfulResponse(o)||o===UGt;let n={...this.customRequestOptions,...t,headers:{...this.customRequestOptions.headers,...t.headers}},i=await this.authClient.request(n);if(i.data&&i.data.error)throw i.data.error;return i}async makeRequestStream(t){let n=new Q6s.default,i=()=>n.abort();this.once("error",i),this.userProject&&(t.params=t.params||{},t.params.userProject=this.userProject),t.signal=n.signal,t.validateStatus=()=>!0;let o={...this.customRequestOptions,...t,headers:{...this.customRequestOptions.headers,...t.headers}},s=await this.authClient.request(o),a=this.onResponse(s);return this.removeListener("error",i),a?s:null}onResponse(t){return t.status!==200&&this.retryOptions.retryableErrorFn({code:t.status,message:t.statusText,name:t.statusText})?(this.attemptDelayedRetry(t),!1):(this.emit("response",t),!0)}attemptDelayedRetry(t){if(this.numRetries<this.retryOptions.maxRetries){if(t.status===lC0&&this.numChunksReadInRequest===0)this.startUploading();else{let n=this.getRetryDelay();if(n<=0){this.destroy(new Error(`Retry total time limit exceeded - ${t.data}`));return}this.numBytesWritten-=this.localWriteCacheByteLength,this.prependLocalBufferToUpstream(),this.offset=void 0,setTimeout(this.continueUploading.bind(this),n)}this.numRetries++}else this.destroy(new Error("Retry limit exceeded - "+t.data))}getRetryDelay(){let t=Math.round(Math.random()*1e3),n=Math.pow(this.retryOptions.retryDelayMultiplier,this.numRetries)*1e3+t,i=this.retryOptions.totalTimeout*1e3-(Date.now()-this.timeOfFirstRequest),o=this.retryOptions.maxRetryDelay*1e3;return Math.min(n,o,i)}sanitizeEndpoint(t){return uC0.test(t)||(t=`https://${t}`),t.replace(/\/+$/,"")}isSuccessfulResponse(t){return t>=200&&t<300}};pG=new WeakMap,dG=new WeakSet,Get=function(){this.localWriteCache=[],this.localWriteCacheByteLength=0},jGt=function(t){this.localWriteCache.push(t),this.localWriteCacheByteLength+=t.byteLength};function z6s(r){return new GGt(r)}function U6s(r,t){let n=new GGt(r);if(!t)return n.createURI();n.createURI().then(i=>t(null,i),t)}var L8e=require("stream"),XGt=Ct(require("zlib"),1);var G6s=Ct(require("crypto"),1),$yn=Ct(require("url"),1);var Wet;(function(r){r.ACCESSIBLE_DATE_INVALID="The accessible at date provided was invalid.",r.EXPIRATION_BEFORE_ACCESSIBLE_DATE="An expiration date cannot be before accessible date.",r.X_GOOG_CONTENT_SHA256="The header X-Goog-Content-SHA256 must be a hexadecimal string."})(Wet||(Wet={}));var dC0="v2",j6s=7*24*60*60;var Q8e=class{constructor(t,n,i,o=new vR){this.auth=t,this.bucket=n,this.file=i,this.storage=o}getSignedUrl(t){let n=this.parseExpires(t.expires),i=t.method,o=this.parseAccessibleAt(t.accessibleAt);if(n<o)throw new Error(Wet.EXPIRATION_BEFORE_ACCESSIBLE_DATE);let s,a=t.virtualHostedStyle||!1;t.cname?s=t.cname:a&&(s=`https://${this.bucket.name}.storage.${this.storage.universeDomain}`);let l=1e3,c=Object.assign({},t,{method:i,expiration:n,accessibleAt:new Date(l*o),bucket:this.bucket.name,file:this.file?zet(this.file.name,!1):void 0});s&&(c.cname=s);let u=t.version||dC0,d;if(u==="v2")d=this.getSignedUrlV2(c);else if(u==="v4")d=this.getSignedUrlV4(c);else throw new Error(`Invalid signed URL version: ${u}. Supported versions are 'v2' and 'v4'.`);return d.then(p=>{var f;p=Object.assign(p,t.queryParams);let A=new $yn.URL(((f=t.host)===null||f===void 0?void 0:f.toString())||c.cname||this.storage.apiEndpoint);return A.pathname=this.getResourcePath(!!c.cname,this.bucket.name,c.file),A.search=v6s(p),A.href})}getSignedUrlV2(t){let n=this.getCanonicalHeaders(t.extensionHeaders||{}),i=this.getResourcePath(!1,t.bucket,t.file),o=[t.method,t.contentMd5||"",t.contentType||"",t.expiration,n+i].join(`
7190
7190
  `);return(async()=>{var a;let l=this.auth;try{let c=await l.sign(o,(a=t.signingEndpoint)===null||a===void 0?void 0:a.toString());return{GoogleAccessId:(await l.getCredentials()).client_email,Expires:t.expiration,Signature:c}}catch(c){let u=c,d=new U1e(u.message);throw d.stack=u.stack,d}})()}getSignedUrlV4(t){var n;t.accessibleAt=t.accessibleAt?t.accessibleAt:new Date;let i=1/1e3,o=t.expiration-t.accessibleAt.valueOf()*i;if(o>j6s)throw new Error(`Max allowed expiration is seven days (${j6s} seconds).`);let s=Object.assign({},t.extensionHeaders),a=new $yn.URL(((n=t.host)===null||n===void 0?void 0:n.toString())||t.cname||this.storage.apiEndpoint);s.host=a.hostname,t.contentMd5&&(s["content-md5"]=t.contentMd5),t.contentType&&(s["content-type"]=t.contentType);let l,c=s["x-goog-content-sha256"];if(c){if(typeof c!="string"||!/[A-Fa-f0-9]{40}/.test(c))throw new Error(Wet.X_GOOG_CONTENT_SHA256);l=c}let u=Object.keys(s).map(h=>h.toLowerCase()).sort().join(";"),d=this.getCanonicalHeaders(s),f=`${F1e(t.accessibleAt)}/auto/storage/goog4_request`;return(async()=>{var h;let C=`${(await this.auth.getCredentials()).client_email}/${f}`,v=F1e(t.accessibleAt?t.accessibleAt:new Date,!0),O={"X-Goog-Algorithm":"GOOG4-RSA-SHA256","X-Goog-Credential":C,"X-Goog-Date":v,"X-Goog-Expires":o.toString(10),"X-Goog-SignedHeaders":u,...t.queryParams||{}},w=this.getCanonicalQueryParams(O),R=this.getCanonicalRequest(t.method,this.getResourcePath(!!t.cname,t.bucket,t.file),w,d,u,l),k=G6s.createHash("sha256").update(R).digest("hex"),z=["GOOG4-RSA-SHA256",v,f,k].join(`